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_GPU
85 cout <<
"\nAs of mfem-4.3 and hypre-2.22.0 (July 2021) this example\n"
86 <<
"is NOT supported with the GPU version of hypre.\n\n";
91 Mpi::Init(argc, argv);
92 int num_procs = Mpi::WorldSize();
93 int myid = Mpi::WorldRank();
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 for (
int l = 0; l < ref_levels; l++)
157 int par_ref_levels = 1;
158 for (
int l = 0; l < par_ref_levels; l++)
172 const bool use_nodal_fespace = pmesh->
NURBSext;
173 if (use_nodal_fespace)
193 cout <<
"Number of finite element unknowns: " << size << endl
194 <<
"Assembling matrix and r.h.s... " << flush;
214 for (
int i = 0; i < dim-1; i++)
223 push_force(1) = -5.0e-2;
262 cout <<
"done." << endl;
269 constraint_atts[0] = 1;
270 constraint_atts[1] = 4;
274 constraint_rowstarts);
283 constraint_rowstarts, dim,
308 if (!use_nodal_fespace)
331 ostringstream mesh_name, sol_name;
332 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
333 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
335 ofstream mesh_ofs(mesh_name.str().c_str());
336 mesh_ofs.precision(8);
337 pmesh->
Print(mesh_ofs);
339 ofstream sol_ofs(sol_name.str().c_str());
340 sol_ofs.precision(8);
351 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
352 sol_sock.precision(8);
353 sol_sock <<
"solution\n" << *pmesh << x << flush;
357 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)
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
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.
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...
FDualNumber< tbase > log(const FDualNumber< tbase > &f)
log([dual number])
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.
void Print(std::ostream &out=mfem::out) const override
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.