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.");
96 ifstream imesh(mesh_file);
101 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
106 mesh =
new Mesh(imesh, 1, 1);
113 cerr <<
"\nInput mesh should have at least two materials and "
114 <<
"two boundary attributes! (See schematic in ex2.cpp)\n"
133 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
134 for (
int l = 0; l < ref_levels; l++)
146 int par_ref_levels = 1;
147 for (
int l = 0; l < par_ref_levels; l++)
161 const bool use_nodal_fespace = pmesh->
NURBSext && !amg_elast;
162 if (use_nodal_fespace)
175 cout <<
"Number of finite element unknowns: " << size << endl
176 <<
"Assembling: " << flush;
197 for (
int i = 0; i < dim-1; i++)
204 pull_force(1) = -1.0e-2;
212 cout <<
"r.h.s. ... " << flush;
227 lambda(0) = lambda(1)*50;
241 if (myid == 0) { cout <<
"matrix ... " << flush; }
250 cout <<
"done." << endl;
283 if (!use_nodal_fespace)
296 ostringstream mesh_name, sol_name;
297 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
298 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
300 ofstream mesh_ofs(mesh_name.str().c_str());
301 mesh_ofs.precision(8);
302 pmesh->
Print(mesh_ofs);
304 ofstream sol_ofs(sol_name.str().c_str());
305 sol_ofs.precision(8);
313 char vishost[] =
"localhost";
316 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
317 sol_sock.precision(8);
318 sol_sock <<
"solution\n" << *pmesh << 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)
HYPRE_Int GlobalTrueVSize()
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 *)
void SetElasticityOptions(ParFiniteElementSpace *fespace)
void SetNodalFESpace(FiniteElementSpace *nfes)
void PrintUsage(std::ostream &out) const
void SetMaxIter(int max_iter)
Array< int > bdr_attributes
int main(int argc, char *argv[])
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list)
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 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.
virtual void Print(std::ostream &out=std::cout) const