43 MFEM_VERIFY(offset < 0.9,
"offset is too large!");
45 const int dimension = 2;
48 Mesh * mesh =
new Mesh(dimension, nvt, 1, nbe);
52 vc[0] = 0.0; vc[1] = 0.0;
54 vc[0] = 1.0; vc[1] = 0.0;
56 vc[0] = offset; vc[1] = 1.0;
58 vc[0] = 1.0; vc[1] = 1.0;
63 vert[0] = 0; vert[1] = 1; vert[2] = 3; vert[3] = 2;
82 int main(
int argc,
char *argv[])
84 #ifdef HYPRE_USING_CUDA
85 cout <<
"\nAs of mfem-4.3 and hypre-2.22.0 (July 2021) this example\n"
86 <<
"is NOT supported with the CUDA version of hypre.\n\n";
92 MPI_Init(&argc, &argv);
93 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
94 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
98 bool visualization = 1;
99 bool reorder_space =
false;
102 double penalty = 0.0;
106 "Finite element order (polynomial degree).");
107 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
108 "--no-visualization",
109 "Enable or disable GLVis visualization.");
110 args.
AddOption(&reorder_space,
"-nodes",
"--by-nodes",
"-vdim",
"--by-vdim",
111 "Use byNODES ordering of vector space instead of byVDIM");
112 args.
AddOption(&offset,
"--offset",
"--offset",
113 "How much to offset the trapezoid.");
114 args.
AddOption(&visit,
"-visit",
"--visit-datafiles",
"-no-visit",
115 "--no-visit-datafiles",
116 "Save data files for VisIt (visit.llnl.gov) visualization.");
117 args.
AddOption(&penalty,
"-p",
"--penalty",
118 "Penalty parameter; 0 means use elimination solver.");
145 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
146 for (
int l = 0; l < ref_levels; l++)
158 int par_ref_levels = 1;
159 for (
int l = 0; l < par_ref_levels; l++)
173 const bool use_nodal_fespace = pmesh->
NURBSext;
174 if (use_nodal_fespace)
194 cout <<
"Number of finite element unknowns: " << size << endl
195 <<
"Assembling matrix and r.h.s... " << flush;
215 for (
int i = 0; i < dim-1; i++)
224 push_force(1) = -5.0e-2;
263 cout <<
"done." << endl;
270 constraint_atts[0] = 1;
271 constraint_atts[1] = 4;
275 constraint_rowstarts);
284 constraint_rowstarts, dim,
309 if (!use_nodal_fespace)
332 ostringstream mesh_name, sol_name;
333 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
334 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
336 ofstream mesh_ofs(mesh_name.str().c_str());
337 mesh_ofs.precision(8);
338 pmesh->
Print(mesh_ofs);
340 ofstream sol_ofs(sol_name.str().c_str());
341 sol_ofs.precision(8);
352 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
353 sol_sock.precision(8);
354 sol_sock <<
"solution\n" << *pmesh << x << flush;
358 delete local_constraints;
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Vector coefficient defined by an array of scalar coefficients. Coefficients that are not set will eva...
Class for grid function - Vector with associated FE space.
int AddQuad(int v1, int v2, int v3, int v4, int attr=1)
A coefficient that is constant across space and time.
SparseMatrix * ParBuildNormalConstraints(ParFiniteElementSpace &fespace, Array< int > &constrained_att, Array< int > &constraint_rowstarts)
Parallel wrapper for BuildNormalConstraints.
An abstract class to solve the constrained system subject to the constraint .
HYPRE_BigInt GlobalTrueVSize() const
int GetNE() const
Returns number of elements.
virtual void Save()
Save the collection and a VisIt root file.
virtual void Save(std::ostream &out) const
Abstract parallel finite element space.
virtual void Mult(const Vector &f, Vector &x) const override
Solve for given .
int AddVertex(double x, double y=0.0, double z=0.0)
void SetPrintLevel(int print_lvl)
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Data collection with VisIt I/O routines.
void SetMaxIter(int max_it)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void Set(int i, Coefficient *c, bool own=true)
Sets coefficient in the vector.
virtual void Print(std::ostream &out=mfem::out) const
int AddBdrSegment(int v1, int v2, int attr=1)
void SetLevelsOfDetail(int levels_of_detail)
Set VisIt parameter: default levels of detail for the MultiresControl.
void SetNodalFESpace(FiniteElementSpace *nfes)
void PrintUsage(std::ostream &out) const
Print the usage message.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
void SetRelTol(double rtol)
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection and update the root file.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
A piecewise constant coefficient with the constants keyed off the element attribute numbers...
HYPRE_BigInt GetGlobalNumRows() const
Return the global number of rows.
void FinalizeQuadMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
Finalize the construction of a quadrilateral Mesh.
void PrintOptions(std::ostream &out) const
Print the options.
Mesh * build_trapezoid_mesh(double offset)
void GetNodes(Vector &node_coord) const
Arbitrary order H1-conforming (continuous) finite elements.
Class for parallel grid function.
Wrapper for hypre's ParCSR matrix class.
Class for parallel meshes.
Array< int > attributes
A list of all unique element attributes used by the Mesh.
double f(const Vector &p)
bool Good() const
Return true if the command line options were parsed successfully.