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;
79int 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;
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
A coefficient that is constant across space and time.
virtual void Mult(const Vector &f, Vector &x) const override
Solve for given .
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const
Get a list of essential true dofs, ess_tdof_list, corresponding to the boundary attributes marked in ...
Data type for Gauss-Seidel smoother of sparse matrix.
Class for grid function - Vector with associated FE space.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
Arbitrary order H1-conforming (continuous) finite elements.
void SetRelTol(real_t rtol)
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
void SetMaxIter(int max_it)
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
int AddQuad(int v1, int v2, int v3, int v4, int attr=1)
Adds a quadrilateral to the mesh given by 4 vertices v1 through v4.
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
int AddVertex(real_t x, real_t y=0.0, real_t z=0.0)
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
int AddBdrSegment(int v1, int v2, int attr=1)
void FinalizeQuadMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
Finalize the construction of a quadrilateral Mesh.
void GetNodes(Vector &node_coord) const
virtual void SetNodalFESpace(FiniteElementSpace *nfes)
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Array< int > attributes
A list of all unique element attributes used by the Mesh.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
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...
bool Good() const
Return true if the command line options were parsed successfully.
A piecewise constant coefficient with the constants keyed off the element attribute numbers.
Solve constrained system by solving original mixed system; see ConstrainedSolver.
Vector coefficient defined by an array of scalar coefficients. Coefficients that are not set will eva...
Vector & Set(const real_t a, const Vector &x)
(*this) = a * x
Data collection with VisIt I/O routines.
void SetLevelsOfDetail(int levels_of_detail)
Set VisIt parameter: default levels of detail for the MultiresControl.
virtual void Save() override
Save the collection and a VisIt root file.
virtual void RegisterField(const std::string &field_name, GridFunction *gf) override
Add a grid function to the collection and update the root file.
Mesh * build_trapezoid_mesh(real_t offset)
constexpr int dimension
This example only works in 3D. Kernels for 2D are not implemented.
SparseMatrix * BuildNormalConstraints(FiniteElementSpace &fespace, Array< int > &constrained_att, Array< int > &constraint_rowstarts, bool parallel)
Build a matrix constraining normal components to zero.
std::function< real_t(const Vector &)> f(real_t mass_coeff)