45 int main(
int argc,
char *argv[])
48 const char *mesh_file =
"../../data/star.mesh";
49 bool static_cond =
false;
50 bool visualization = 1;
55 args.
AddOption(&mesh_file,
"-m",
"--mesh",
58 "Finite element order (polynomial degree) or -1 for"
59 " isoparametric space.");
60 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
61 "--no-static-condensation",
"Enable static condensation.");
62 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
64 "Enable or disable GLVis visualization.");
76 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
85 (int)floor(log(50000./mesh->
GetNE())/log(2.)/
dim);
86 for (
int l = 0; l < ref_levels; l++)
105 cout <<
"Using isoparametric FEs: " << fec->
Name() << endl;
109 cout <<
"Mesh does not have FEs --> Assume order 1.\n";
114 else if (mesh->
NURBSext && (order[0] > 0) )
120 if (order.
Size() == 1)
126 if (order.
Size() != nkv ) {
mfem_error(
"Wrong number of orders set."); }
131 if (order.
Size() > 1) { cout <<
"Wrong number of orders set, needs one.\n"; }
136 cout <<
"Number of finite element unknowns: "
182 cout <<
"Size of linear system: " << A.
Height() << endl;
184 #ifndef MFEM_USE_SUITESPARSE
188 PCG(A, M, B, X, 1, 200, 1e-12, 0.0);
192 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
194 umf_solver.
Mult(B, X);
202 ofstream mesh_ofs(
"refined.mesh");
203 mesh_ofs.precision(8);
204 mesh->
Print(mesh_ofs);
205 ofstream sol_ofs(
"sol.gf");
206 sol_ofs.precision(8);
212 char vishost[] =
"localhost";
215 sol_sock.precision(8);
216 sol_sock <<
"solution\n" << *mesh << x << flush;
228 if (own_fec) {
delete fec; }
Arbitrary order non-uniform rational B-splines (NURBS) finite elements.
int Size() const
Logical size of the array.
Class for domain integration L(v) := (f, v)
virtual void Print(std::ostream &out=mfem::out) const
Class for grid function - Vector with associated FE space.
Subclass constant coefficient.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
int GetNE() const
Returns number of elements.
virtual void Save()
Save the collection and a VisIt root file.
int main(int argc, char *argv[])
Data type for Gauss-Seidel smoother of sparse matrix.
Direct sparse solver using UMFPACK.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Data collection with VisIt I/O routines.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void PCG(const Operator &A, Solver &B, const Vector &b, Vector &x, int print_iter, int max_num_iter, double RTOLERANCE, double ATOLERANCE)
Preconditioned conjugate gradient method. (tolerances are squared)
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
void PrintUsage(std::ostream &out) const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
double Control[UMFPACK_CONTROL]
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
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)
void SetSize(int nsize)
Change logical size of the array, keep existing entries.
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.
virtual const char * Name() const
void PrintOptions(std::ostream &out) const
void GetNodes(Vector &node_coord) const
Arbitrary order H1-conforming (continuous) finite elements.
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
virtual void SetOperator(const Operator &op)
Factorize the given Operator op which must be a SparseMatrix.