48 int main(
int argc,
char *argv[])
52 MPI_Init(&argc, &argv);
53 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
54 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
57 const char *mesh_file =
"../data/beam-tri.mesh";
59 bool static_cond =
false;
60 bool visualization = 1;
64 args.
AddOption(&mesh_file,
"-m",
"--mesh",
67 "Finite element order (polynomial degree).");
68 args.
AddOption(&amg_elast,
"-elast",
"--amg-for-elasticity",
"-sys",
70 "Use the special AMG elasticity solver (GM/LN approaches), "
71 "or standard AMG for systems (unknown approach).");
72 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
73 "--no-static-condensation",
"Enable static condensation.");
74 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
76 "Enable or disable GLVis visualization.");
95 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
101 cerr <<
"\nInput mesh should have at least two materials and "
102 <<
"two boundary attributes! (See schematic in ex2.cpp)\n"
121 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
122 for (
int l = 0; l < ref_levels; l++)
134 int par_ref_levels = 1;
135 for (
int l = 0; l < par_ref_levels; l++)
149 const bool use_nodal_fespace = pmesh->
NURBSext && !amg_elast;
150 if (use_nodal_fespace)
163 cout <<
"Number of finite element unknowns: " << size << endl
164 <<
"Assembling: " << flush;
185 for (
int i = 0; i < dim-1; i++)
192 pull_force(1) = -1.0e-2;
200 cout <<
"r.h.s. ... " << flush;
215 lambda(0) = lambda(1)*50;
229 if (myid == 0) { cout <<
"matrix ... " << flush; }
238 cout <<
"done." << endl;
271 if (!use_nodal_fespace)
284 ostringstream mesh_name, sol_name;
285 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
286 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
288 ofstream mesh_ofs(mesh_name.str().c_str());
289 mesh_ofs.precision(8);
290 pmesh->
Print(mesh_ofs);
292 ofstream sol_ofs(sol_name.str().c_str());
293 sol_ofs.precision(8);
301 char vishost[] =
"localhost";
304 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
305 sol_sock.precision(8);
306 sol_sock <<
"solution\n" << *pmesh << x << flush;
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
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.
virtual void Save(std::ostream &out) const
Abstract parallel finite element space.
void SetPrintLevel(int print_lvl)
void SetSystemsOptions(int dim)
The BoomerAMG solver in hypre.
HYPRE_Int GetGlobalNumRows() const
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.
HYPRE_Int GlobalTrueVSize() const
virtual void Print(std::ostream &out=mfem::out) const
void SetElasticityOptions(ParFiniteElementSpace *fespace)
void SetNodalFESpace(FiniteElementSpace *nfes)
void PrintUsage(std::ostream &out) const
void SetMaxIter(int max_iter)
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
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
void SetPreconditioner(HypreSolver &precond)
Set the hypre solver to be used as a preconditioner.
void PrintOptions(std::ostream &out) const
void GetNodes(Vector &node_coord) const
Arbitrary order H1-conforming (continuous) finite elements.
Class for parallel grid function.
Wrapper for hypre's ParCSR matrix class.
virtual void Mult(const HypreParVector &b, HypreParVector &x) const
Solve Ax=b with hypre's PCG.
Class for parallel meshes.
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.