46 int main(
int argc,
char *argv[])
49 const char *mesh_file =
"../data/beam-tri.mesh";
51 bool static_cond =
false;
52 bool visualization = 1;
55 args.
AddOption(&mesh_file,
"-m",
"--mesh",
58 "Finite element order (polynomial degree).");
59 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
60 "--no-static-condensation",
"Enable static condensation.");
61 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
63 "Enable or disable GLVis visualization.");
74 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
79 cerr <<
"\nInput mesh should have at least two materials and "
80 <<
"two boundary attributes! (See schematic in ex2.cpp)\n"
98 (int)floor(log(5000./mesh->
GetNE())/log(2.)/
dim);
99 for (
int l = 0; l < ref_levels; l++)
115 fespace = mesh->
GetNodes()->FESpace();
122 cout <<
"Number of finite element unknowns: " << fespace->
GetTrueVSize()
123 << endl <<
"Assembling: " << flush;
143 for (
int i = 0; i < dim-1; i++)
150 pull_force(1) = -1.0e-2;
156 cout <<
"r.h.s. ... " << flush;
170 lambda(0) = lambda(1)*50;
184 cout <<
"matrix ... " << flush;
191 cout <<
"done." << endl;
193 cout <<
"Size of linear system: " << A.
Height() << endl;
195 #ifndef MFEM_USE_SUITESPARSE
199 PCG(A, M, B, X, 1, 500, 1e-8, 0.0);
203 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
205 umf_solver.
Mult(B, X);
230 ofstream mesh_ofs(
"displaced.mesh");
231 mesh_ofs.precision(8);
232 mesh->
Print(mesh_ofs);
233 ofstream sol_ofs(
"sol.gf");
234 sol_ofs.precision(8);
242 char vishost[] =
"localhost";
245 sol_sock.precision(8);
246 sol_sock <<
"solution\n" << *mesh << x << flush;
Vector coefficient defined by an array of scalar coefficients.
Class for grid function - Vector with associated FE space.
Subclass constant coefficient.
void DegreeElevate(int t)
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list)
int GetNE() const
Returns number of elements.
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 UniformRefinement(int i, const DSTable &, int *, int *, int *)
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)
void SetNodalFESpace(FiniteElementSpace *nfes)
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]
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)
NURBSExtension * NURBSext
Optional NURBS mesh extension.
class for piecewise constant coefficient
virtual int GetTrueVSize()
Return the number of vector true (conforming) dofs.
void PrintOptions(std::ostream &out) const
void GetNodes(Vector &node_coord) const
Arbitrary order H1-conforming (continuous) finite elements.
void Set(int i, Coefficient *c)
Sets coefficient in the vector.
Array< int > attributes
A list of all unique element attributes used by the Mesh.
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.
virtual void Print(std::ostream &out=std::cout) const