48 double a1 = 20., a2 = 2., a3 = 3.;
49 return tanh(a1*(x(1)-0.5) + a2*sin(a3*(x(0)-0.5)*M_PI));
52 int main(
int argc,
char *argv[])
55 const char *mesh_file =
"../../data/star-q3.mesh";
56 int ser_ref_levels = 1;
60 bool visualization =
true;
65 args.
AddOption(&mesh_file,
"-m",
"--mesh",
"Mesh file to use.");
69 "Number of times to refine the mesh uniformly in serial.");
73 "Order (degree) of the finite elements.");
77 "MFEM Integration order.");
81 "Algoim Integration order.");
85 "Level set type: 1: circle, 2 sinusoidal wave");
91 "Enable or disable GLVis visualization.");
92 args.
AddOption((&print_level),
"-prt",
"--print-level",
"Print level.");
102 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
107 for (
int lev = 0; lev < ser_ref_levels; lev++)
116 std::cout <<
"Number of finite element unknowns: " << glob_size << std::endl;
127 else if (ls_type == 2)
133 MFEM_ABORT(
"Level set coefficient not defined");
142 sock <<
"solution\n";
146 sock <<
"window_title 'Level set'\n"
147 <<
"window_geometry "
148 << 1200 <<
" " << 0 <<
" " << 600 <<
" " << 600 <<
"\n"
149 <<
"keys jRmmclA" << endl;
153 double exact_volume = -10, exact_area = -10;
156 if (strncmp(mesh_file,
"../../data/star-q3.mesh",100) == 0)
161 else if (strncmp(mesh_file,
"../../data/inline-quad.mesh",100) == 0)
163 exact_volume = M_PI/4;
167 else if (ls_type == 2)
169 if (strncmp(mesh_file,
"../../data/inline-quad.mesh",100) == 0)
172 exact_area = 1.194452300992437;
183 #if defined(MFEM_USE_ALGOIM) && defined(MFEM_USE_BLITZ)
192 for (
int i=0; i<fespace.
GetNE(); i++)
237 if (exact_volume > 0)
239 std::cout<<
"Algoim Volume="<<vol<<
" Error="<<vol-exact_volume<<std::endl;
240 std::cout<<
"Algoim Area="<<area<<
" Error="<<area-exact_area<<std::endl;
244 std::cout<<
"Algoim Volume="<<vol<<std::endl;
245 std::cout<<
"Algoim Area="<<area<<std::endl;
251 for (
int i=0; i<fespace.
GetNE(); i++)
271 if (exact_volume > 0.0)
273 std::cout<<
"MFEM Volume="<<vol<<
" Error="<<vol-exact_volume<<std::endl;
277 std::cout<<
"MFEM Volume="<<vol<<std::endl;
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for all finite elements.
int GetDim() const
Returns the reference space dimension for the finite element.
void trans(const Vector &u, Vector &x)
Class for an integration rule - an Array of IntegrationPoint.
Class for grid function - Vector with associated FE space.
const IntegrationRule * GetSurfaceIntegrationRule()
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
void SetSize(int s)
Resize the vector to size s.
Helper class for ParaView visualization data.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
double Norml2() const
Returns the l2 norm of the vector.
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
const IntegrationRule * GetVolumeIntegrationRule()
Data type dense matrix using column-major storage.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
int GetNE() const
Returns number of elements in the mesh.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
void MultTranspose(const double *x, double *y) const
Multiply a vector with the transpose matrix.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
double sphere_ls(const Vector &x)
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
void PrintUsage(std::ostream &out) const
Print the usage message.
void SetTime(double t)
Set physical time (for time-dependent simulations)
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i-th element.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
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)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
Class for integration point with weight.
virtual void Print(std::ostream &os=mfem::out) const
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
void PrintOptions(std::ostream &out) const
Print the options.
virtual void ProjectCoefficient(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void SetLevelsOfDetail(int levels_of_detail_)
A general function coefficient.
Arbitrary order H1-conforming (continuous) finite elements.
virtual void Save() override
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
double sinusoidal_ls(const Vector &x)
virtual double GetValue(int i, const IntegrationPoint &ip, int vdim=1) const
bool Good() const
Return true if the command line options were parsed successfully.