40 MFEM_VERIFY(offset < 0.9,
"offset is too large!");
49 vc[0] = 0.0; vc[1] = 0.0;
51 vc[0] = 1.0; vc[1] = 0.0;
53 vc[0] = offset; vc[1] = 1.0;
55 vc[0] = 1.0; vc[1] = 1.0;
60 vert[0] = 0; vert[1] = 1; vert[2] = 3; vert[3] = 2;
79 int main(
int argc,
char *argv[])
83 bool visualization = 1;
89 "Finite element order (polynomial degree).");
90 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
92 "Enable or disable GLVis visualization.");
93 args.
AddOption(&offset,
"--offset",
"--offset",
94 "How much to offset the trapezoid.");
95 args.
AddOption(&visit,
"-visit",
"--visit-datafiles",
"-no-visit",
96 "--no-visit-datafiles",
97 "Save data files for VisIt (visit.llnl.gov) visualization.");
117 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
118 for (
int l = 0; l < ref_levels; l++)
130 cout <<
"Number of finite element unknowns: " << fespace->
GetTrueVSize()
132 cout <<
"Assembling matrix and r.h.s... " << flush;
147 for (
int i = 0; i <
dim-1; i++)
154 push_force(1) = -5.0e-2;
189 a->FormLinearSystem(ess_tdof_list, x, *
b, A, X, B);
190 cout <<
"done." << endl;
191 cout <<
"Size of linear system: " << A.
Height() << endl;
196 constraint_atts[0] = 1;
197 constraint_atts[1] = 4;
216 a->RecoverFEMSolution(X, *
b, x);
235 ofstream mesh_ofs(
"displaced.mesh");
236 mesh_ofs.precision(8);
237 mesh->
Print(mesh_ofs);
238 ofstream sol_ofs(
"sol.gf");
239 sol_ofs.precision(8);
250 sol_sock.precision(8);
251 sol_sock <<
"solution\n" << *mesh << x << flush;
255 delete local_constraints;
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.
Solve constrained system by solving original mixed system; see ConstrainedSolver. ...
void PrintOptions(std::ostream &out) const
Print the options.
int Dimension() const
Dimension of the reference space used within the elements.
SparseMatrix * BuildNormalConstraints(FiniteElementSpace &fespace, Array< int > &constrained_att, Array< int > &constraint_rowstarts, bool parallel)
Build a matrix constraining normal components to zero.
void PrintUsage(std::ostream &out) const
Print the usage message.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Get a list of essential true dofs, ess_tdof_list, corresponding to the boundary attributes marked in ...
bool Good() const
Return true if the command line options were parsed successfully.
Data type for Gauss-Seidel smoother of sparse matrix.
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)
int main(int argc, char *argv[])
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.
virtual void SetNodalFESpace(FiniteElementSpace *nfes)
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
void SetRelTol(double rtol)
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
virtual void Save() override
Save the collection and a VisIt root file.
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...
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int GetNE() const
Returns number of elements.
A piecewise constant coefficient with the constants keyed off the element attribute numbers...
void FinalizeQuadMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
Finalize the construction of a quadrilateral Mesh.
constexpr int dimension
This example only works in 3D. Kernels for 2D are not implemented.
Mesh * build_trapezoid_mesh(double offset)
virtual void Print(std::ostream &os=mfem::out) const
Arbitrary order H1-conforming (continuous) finite elements.
void GetNodes(Vector &node_coord) const
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
Array< int > attributes
A list of all unique element attributes used by the Mesh.
double f(const Vector &p)
virtual void RegisterField(const std::string &field_name, GridFunction *gf) override
Add a grid function to the collection and update the root file.