50int main(
int argc,
char *argv[])
53 const char *mesh_file =
"../data/compass.msh";
55 string source_name =
"Rose Even";
56 string ess_name =
"Boundary";
57 bool visualization =
true;
60 args.
AddOption(&mesh_file,
"-m",
"--mesh",
63 "Finite element order (polynomial degree) or -1 for"
64 " isoparametric space.");
65 args.
AddOption(&source_name,
"-src",
"--source-attr-name",
66 "Name of attribute set containing source.");
67 args.
AddOption(&ess_name,
"-ess",
"--ess-attr-name",
68 "Name of attribute set containing essential BC.");
69 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
71 "Enable or disable GLVis visualization.");
77 Mesh mesh(mesh_file, 1, 1);
86 (int)floor(log(50000./mesh.
GetNE())/log(2.)/
dim);
87 for (
int l = 0; l < ref_levels; l++)
98 cout <<
"Element Attribute Set Names: ";
99 for (
auto const &set_name : names)
101 cout <<
" \"" << set_name <<
"\"";
106 cout <<
"Boundary Attribute Set Names: ";
107 for (
auto const &bdr_set_name : bdr_names)
109 cout <<
" \"" << bdr_set_name <<
"\"";
184 (
"Northern Boundary"));
187 (
"Southern Boundary"));
190 (
"Eastern Boundary"));
193 (
"Western Boundary"));
200 cout <<
"Number of finite element unknowns: "
258 a.FormLinearSystem(ess_tdof_list, x,
b, A, X, B);
260 cout <<
"Size of linear system: " << A.
Height() << endl;
264 PCG(A, M, B, X, 1, 800, 1e-12, 0.0);
267 a.RecoverFEMSolution(X,
b, x);
271 mesh.
Save(
"refined.mesh");
280 sol_sock.precision(8);
281 sol_sock <<
"solution\n" << mesh << x <<
"keys Rjmm" << flush;
void SetAttributeSet(const std::string &set_name, const Array< int > &attr)
Create a new attribute set.
Array< int > GetAttributeSetMarker(const std::string &set_name)
Return a marker array corresponding to a named attribute set.
bool AttributeSetExists(const std::string &name) const
Return true is the named attribute set is present.
Array< int > & GetAttributeSet(const std::string &set_name)
Access a named attribute set.
void AddToAttributeSet(const std::string &set_name, int attr)
Add a single entry to an existing attribute set.
std::set< std::string > GetAttributeSetNames() const
Return all attribute set names as an STL set.
A coefficient that is constant across space and time.
Class for domain integration .
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.
AttributeSets bdr_attribute_sets
Named sets of boundary element attributes.
int GetNE() const
Returns number of elements.
virtual void Save(const std::string &fname, int precision=16) const
int Dimension() const
Dimension of the reference space used within the elements.
AttributeSets attribute_sets
Named sets of element attributes.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void ParseCheck(std::ostream &out=mfem::out)
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...
void PCG(const Operator &A, Solver &B, const Vector &b, Vector &x, int print_iter, int max_num_iter, real_t RTOLERANCE, real_t ATOLERANCE)
Preconditioned conjugate gradient method. (tolerances are squared)