55 #ifndef MFEM_THREAD_SAFE
62 Diffusion2Integrator() { Q = NULL; }
77 #ifdef MFEM_THREAD_SAFE
90 if (el.
Space() == FunctionSpace::Pk)
99 if (el.
Space() == FunctionSpace::rQk)
121 w *= Q->Eval(Trans, ip);
124 for (
int j = 0; j < nd; j++)
126 for (
int i = 0; i < nd; i++)
128 elmat(i, j) += w*shape(i)*laplace(j);
136 int main(
int argc,
char *argv[])
140 MPI_Init(&argc, &argv);
141 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
142 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
145 const char *mesh_file =
"../../data/star.mesh";
148 bool static_cond =
false;
149 bool visualization = 1;
153 args.
AddOption(&mesh_file,
"-m",
"--mesh",
154 "Mesh file to use.");
156 "Finite element order (polynomial degree) or -1 for"
157 " isoparametric space.");
158 args.
AddOption(&ibp,
"-ibp",
"--ibp",
"-no-ibp",
160 "Selects the standard weak form (IBP) or the nonstandard (NO-IBP).");
161 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
162 "--no-static-condensation",
"Enable static condensation.");
163 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
164 "--no-visualization",
165 "Enable or disable GLVis visualization.");
184 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
193 (int)floor(log(10000./mesh->
GetNE())/log(2.)/
dim);
194 for (
int l = 0; l < ref_levels; l++)
207 int par_ref_levels = 2;
208 for (
int l = 0; l < par_ref_levels; l++)
227 cout <<
"Using isoparametric FEs: " << fec->
Name() << endl;
231 cout <<
"Mesh does not have FEs --> Assume order 1.\n";
236 else if (pmesh->
NURBSext && (order[0] > 0) )
242 if (order.
Size() == 1)
248 if (order.
Size() != nkv ) {
mfem_error(
"Wrong number of orders set."); }
253 if (order.
Size() > 1) { cout <<
"Wrong number of orders set, needs one.\n"; }
261 cout <<
"Number of finite element unknowns: " << size << endl;
268 cout <<
"No integration by parts requires a NURBS mesh."<< endl;
273 cout <<
"No integration by parts requires a NURBS mesh, with only 1 patch."<<
275 cout <<
"A C_1 discretisation is required."<< endl;
276 cout <<
"Currently only C_0 multipatch coupling implemented."<< endl;
281 cout <<
"No integration by parts requires at least quadratic NURBS."<< endl;
282 cout <<
"A C_1 discretisation is required."<< endl;
359 ostringstream mesh_name, sol_name;
360 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
361 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
363 ofstream mesh_ofs(mesh_name.str().c_str());
364 mesh_ofs.precision(8);
365 pmesh->
Print(mesh_ofs);
367 ofstream sol_ofs(sol_name.str().c_str());
368 sol_ofs.precision(8);
375 char vishost[] =
"localhost";
378 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
379 sol_sock.precision(8);
380 sol_sock <<
"solution\n" << *pmesh << x << flush;
394 if (own_fec) {
delete fec; }
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for Finite Elements.
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 GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
int GetDim() const
Returns the reference space dimension for the finite element.
Class for an integration rule - an Array of IntegrationPoint.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
Subclass constant coefficient.
void SetSize(int s)
Resize the vector to size s.
virtual void CalcPhysLaplacian(ElementTransformation &Trans, Vector &Laplacian) const
Evaluate the Laplacian of all shape functions of a scalar finite element in reference space at the gi...
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Data type dense matrix using column-major storage.
int GetNE() const
Returns number of elements.
virtual void Save()
Save the collection and a VisIt root file.
virtual void Save(std::ostream &out) const
int Space() const
Returns the type of space on each element.
Abstract parallel finite element space.
int main(int argc, char *argv[])
void SetPrintLevel(int print_lvl)
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
The BoomerAMG solver in hypre.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
HYPRE_Int GetGlobalNumRows() const
Return the global number of rows.
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.
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
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 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.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
Base class Coefficient that may optionally depend on time.
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
Class for integration point with weight.
void SetPreconditioner(HypreSolver &precond)
Set the hypre solver to be used as a preconditioner.
void PrintOptions(std::ostream &out) const
Abstract class for hypre's solvers and preconditioners.
IntegrationRules RefinedIntRules(1, Quadrature1D::GaussLegendre)
A global object with all refined integration rules.
void GetNodes(Vector &node_coord) const
Arbitrary order H1-conforming (continuous) finite elements.
Class for parallel grid function.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
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.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)