44 int main(
int argc,
char *argv[])
47 const char *mesh_file =
"../data/beam-tri.mesh";
49 bool visualization = 1;
52 args.
AddOption(&mesh_file,
"-m",
"--mesh",
55 "Finite element order (polynomial degree).");
56 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
58 "Enable or disable GLVis visualization.");
70 ifstream imesh(mesh_file);
73 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
76 mesh =
new Mesh(imesh, 1, 1);
82 cerr <<
"\nInput mesh should have at least two materials and "
83 <<
"two boundary attributes! (See schematic in ex2.cpp)\n"
99 (int)floor(log(5000./mesh->
GetNE())/log(2.)/dim);
100 for (
int l = 0; l < ref_levels; l++)
114 fespace = mesh->
GetNodes()->FESpace();
121 cout <<
"Number of unknowns: " << fespace->
GetVSize() << endl
122 <<
"Assembling: " << flush;
133 for (
int i = 0; i < dim-1; i++)
138 pull_force(1) = -1.0e-2;
144 cout <<
"r.h.s. ... " << flush;
160 lambda(0) = lambda(1)*50;
169 cout <<
"matrix ... " << flush;
176 cout <<
"done." << endl;
179 #ifndef MFEM_USE_SUITESPARSE
183 PCG(A, M, *b, x, 1, 500, 1e-8, 0.0);
187 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
189 umf_solver.
Mult(*b, x);
209 ofstream mesh_ofs(
"displaced.mesh");
210 mesh_ofs.precision(8);
211 mesh->
Print(mesh_ofs);
212 ofstream sol_ofs(
"sol.gf");
213 sol_ofs.precision(8);
221 char vishost[] =
"localhost";
224 sol_sock.precision(8);
225 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)
int GetNE() const
Returns number of elements.
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.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
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
virtual void Print(std::ostream &out=std::cout) const
Print the mesh to the given stream using the default MFEM mesh format.
Array< int > bdr_attributes
int main(int argc, char *argv[])
double Control[UMFPACK_CONTROL]
Abstract finite element space.
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
class for piecewise constant coefficient
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.
virtual void Mult(const Vector &b, Vector &x) const
Operator application.
virtual void SetOperator(const Operator &op)
Set/update the solver for the given operator.