49int main (
int argc,
char *argv[])
57 const char *mesh_file =
"square01.mesh";
58 int mesh_poly_deg = 1;
63 real_t surface_fit_const = 100.0;
71 real_t solver_rtol = 1e-10;
73 int solver_art_type = 0;
75 int max_lin_iter = 100;
77 bool visualization =
true;
78 int verbosity_level = 0;
80 const char *devopt =
"cpu";
81 real_t surface_fit_adapt = 0.0;
82 real_t surface_fit_threshold = -10;
83 bool adapt_marking =
false;
84 bool surf_bg_mesh =
false;
85 bool comp_dist =
false;
88 bool mod_bndr_attr =
false;
90 int mesh_node_ordering = 0;
95 args.
AddOption(&mesh_file,
"-m",
"--mesh",
97 args.
AddOption(&mesh_poly_deg,
"-o",
"--order",
98 "Polynomial degree of mesh finite element space.");
99 args.
AddOption(&rs_levels,
"-rs",
"--refine-serial",
100 "Number of times to refine the mesh uniformly in serial.");
101 args.
AddOption(&rp_levels,
"-rp",
"--refine-parallel",
102 "Number of times to refine the mesh uniformly in parallel.");
103 args.
AddOption(&metric_id,
"-mid",
"--metric-id",
104 "Mesh optimization metric. See list in mesh-optimizer.");
105 args.
AddOption(&target_id,
"-tid",
"--target-id",
106 "Target (ideal element) type:\n\t"
107 "1: Ideal shape, unit size\n\t"
108 "2: Ideal shape, equal size\n\t"
109 "3: Ideal shape, initial size\n\t"
110 "4: Given full analytic Jacobian (in physical space)\n\t"
111 "5: Ideal shape, given size (in physical space)");
112 args.
AddOption(&surface_fit_const,
"-sfc",
"--surface-fit-const",
113 "Surface preservation constant.");
114 args.
AddOption(&quad_type,
"-qt",
"--quad-type",
115 "Quadrature rule type:\n\t"
116 "1: Gauss-Lobatto\n\t"
117 "2: Gauss-Legendre\n\t"
118 "3: Closed uniform points");
119 args.
AddOption(&quad_order,
"-qo",
"--quad_order",
120 "Order of the quadrature rule.");
121 args.
AddOption(&solver_type,
"-st",
"--solver-type",
122 " Type of solver: (default) 0: Newton, 1: LBFGS");
123 args.
AddOption(&solver_iter,
"-ni",
"--newton-iters",
124 "Maximum number of Newton iterations.");
125 args.
AddOption(&solver_rtol,
"-rtol",
"--newton-rel-tolerance",
126 "Relative tolerance for the Newton solver.");
127 args.
AddOption(&solver_art_type,
"-art",
"--adaptive-rel-tol",
128 "Type of adaptive relative linear solver tolerance:\n\t"
129 "0: None (default)\n\t"
130 "1: Eisenstat-Walker type 1\n\t"
131 "2: Eisenstat-Walker type 2");
132 args.
AddOption(&lin_solver,
"-ls",
"--lin-solver",
137 "3: MINRES + Jacobi preconditioner\n\t"
138 "4: MINRES + l1-Jacobi preconditioner");
139 args.
AddOption(&max_lin_iter,
"-li",
"--lin-iter",
140 "Maximum number of iterations in the linear solve.");
141 args.
AddOption(&move_bnd,
"-bnd",
"--move-boundary",
"-fix-bnd",
143 "Enable motion along horizontal and vertical boundaries.");
144 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
145 "--no-visualization",
146 "Enable or disable GLVis visualization.");
147 args.
AddOption(&verbosity_level,
"-vl",
"--verbosity-level",
148 "Set the verbosity level - 0, 1, or 2.");
149 args.
AddOption(&adapt_eval,
"-ae",
"--adaptivity-evaluator",
150 "0 - Advection based (DEFAULT), 1 - GSLIB.");
151 args.
AddOption(&devopt,
"-d",
"--device",
152 "Device configuration string, see Device::Configure().");
153 args.
AddOption(&surface_fit_adapt,
"-sfa",
"--adaptive-surface-fit",
154 "Enable or disable adaptive surface fitting.");
155 args.
AddOption(&surface_fit_threshold,
"-sft",
"--surf-fit-threshold",
156 "Set threshold for surface fitting. TMOP solver will"
157 "terminate when max surface fitting error is below this limit");
158 args.
AddOption(&adapt_marking,
"-marking",
"--adaptive-marking",
"-no-amarking",
159 "--no-adaptive-marking",
160 "Enable or disable adaptive marking surface fitting.");
161 args.
AddOption(&surf_bg_mesh,
"-sbgmesh",
"--surf-bg-mesh",
162 "-no-sbgmesh",
"--no-surf-bg-mesh",
163 "Use background mesh for surface fitting.");
164 args.
AddOption(&comp_dist,
"-dist",
"--comp-dist",
165 "-no-dist",
"--no-comp-dist",
166 "Compute distance from 0 level set or not.");
167 args.
AddOption(&surf_ls_type,
"-slstype",
"--surf-ls-type",
168 "1 - Circle (DEFAULT), 2 - Squircle, 3 - Butterfly.");
169 args.
AddOption(&marking_type,
"-smtype",
"--surf-marking-type",
170 "1 - Interface (DEFAULT), 2 - Boundary attribute.");
171 args.
AddOption(&mod_bndr_attr,
"-mod-bndr-attr",
"--modify-boundary-attribute",
172 "-fix-bndr-attr",
"--fix-boundary-attribute",
173 "Change boundary attribute based on alignment with Cartesian axes.");
175 "-no-mat",
"--no-mat",
"Use default material attributes.");
176 args.
AddOption(&mesh_node_ordering,
"-mno",
"--mesh_node_ordering",
177 "Ordering of mesh nodes."
178 "0 (default): byNodes, 1: byVDIM");
179 args.
AddOption(&amr_iters,
"-amriter",
"--amr-iter",
180 "Number of amr iterations on background mesh");
190 if (myid == 0) { device.
Print();}
193 Mesh *mesh =
new Mesh(mesh_file, 1, 1,
false);
194 for (
int lev = 0; lev < rs_levels; lev++)
202 if (surf_ls_type == 1)
206 else if (surf_ls_type == 2)
210 else if (surf_ls_type == 6)
216 MFEM_ABORT(
"Surface fitting level set type not implemented yet.")
224 ParMesh *pmesh_surf_fit_bg = NULL;
227 Mesh *mesh_surf_fit_bg = NULL;
239 pmesh_surf_fit_bg =
new ParMesh(MPI_COMM_WORLD, *mesh_surf_fit_bg);
240 delete mesh_surf_fit_bg;
248 if (mesh_poly_deg <= 0)
273 ostringstream mesh_name;
274 mesh_name <<
"perturbed.mesh";
275 ofstream mesh_ofs(mesh_name.str().c_str());
276 mesh_ofs.precision(8);
295 if (myid == 0) { cout <<
"Unknown metric_id: " << metric_id << endl; }
301 MFEM_VERIFY(
dim == 2,
"Incompatible metric for 3D meshes");
303 if (metric_id >= 300)
305 MFEM_VERIFY(
dim == 3,
"Incompatible metric for 2D meshes");
317 if (myid == 0) { cout <<
"Unknown target_id: " << target_id << endl; }
321 if (target_c == NULL)
336 if (myid == 0) { cout <<
"Unknown quad_type: " << quad_type << endl; }
340 if (myid == 0 &&
dim == 2)
342 cout <<
"Triangle quadrature points: "
344 <<
"\nQuadrilateral quadrature points: "
347 if (myid == 0 &&
dim == 3)
349 cout <<
"Tetrahedron quadrature points: "
351 <<
"\nHexahedron quadrature points: "
353 <<
"\nPrism quadrature points: "
403 const int num_nodes = x_bg.
Size() /
dim;
404 for (
int i = 0; i < num_nodes; i++)
406 for (
int d = 0; d <
dim; d++)
408 real_t length_d = p_max(d) - p_min(d),
409 extra_d = 0.2 * length_d;
410 x_bg(i + d*num_nodes) = p_min(d) - extra_d +
411 x_bg(i + d*num_nodes) * (length_d + 2*extra_d);
420 if (surface_fit_const > 0.0)
426 amr_iters, *surf_fit_bg_gf0);
428 surf_fit_bg_fes->
Update();
429 surf_fit_bg_gf0->
Update();
438 surf_fit_bg_grad_fes =
446 surf_fit_bg_hess_fes =
455 const int size_bg = surf_fit_bg_gf0->
Size();
456 for (
int d = 0; d < pmesh_surf_fit_bg->
Dimension(); d++)
459 surf_fit_bg_fes, surf_fit_bg_grad->
GetData() + d * size_bg);
465 for (
int d = 0; d < pmesh_surf_fit_bg->
Dimension(); d++)
467 for (
int idir = 0; idir < pmesh_surf_fit_bg->
Dimension(); idir++)
470 surf_fit_bg_fes, surf_fit_bg_grad->
GetData() + d * size_bg);
472 surf_fit_bg_fes, surf_fit_bg_hess->
GetData()+
id * size_bg);
474 surf_fit_bg_hess_comp);
488 for (
int i = 0; i < pmesh->
GetNE(); i++)
517 if (marking_type == 0)
521 for (
int j = 0; j < surf_fit_marker.
Size(); j++)
523 surf_fit_marker[j] =
false;
525 surf_fit_mat_gf = 0.0;
534 int mat1 = mat(tr->Elem1No);
535 int mat2 = mat(tr->Elem2No);
549 int mat1 = mat(tr->Elem1No);
550 int mat2 = FaceNbrData(tr->Elem2No-pmesh->
GetNE());
558 for (
int i = 0; i < dof_list.
Size(); i++)
560 surf_fit_marker[dof_list[i]] =
true;
561 surf_fit_mat_gf(dof_list[i]) = 1.0;
565 else if (marking_type > 0)
567 for (
int i = 0; i < pmesh->
GetNBE(); i++)
570 if (attr == marking_type)
573 for (
int j = 0; j < vdofs.
Size(); j++)
575 surf_fit_marker[vdofs[j]] =
true;
576 surf_fit_mat_gf(vdofs[j]) = 1.0;
587 MFEM_VERIFY(!surf_bg_mesh,
"Background meshes require GSLIB.");
589 else if (adapt_eval == 1)
599 MFEM_ABORT(
"MFEM is not built with GSLIB support!");
602 else { MFEM_ABORT(
"Bad interpolation option."); }
607 surf_fit_coeff, *adapt_surface);
612 *surf_fit_bg_gf0, surf_fit_gf0,
613 surf_fit_marker, surf_fit_coeff, *adapt_surface,
614 *surf_fit_bg_grad, *surf_fit_grad, *adapt_grad_surface,
615 *surf_fit_bg_hess, *surf_fit_hess, *adapt_hess_surface);
622 "Level Set", 0, 0, 300, 300);
624 "Materials", 300, 0, 300, 300);
626 "Surface DOFs", 600, 0, 300, 300);
630 "Level Set - Background",
645 a.AddDomainIntegrator(tmop_integ);
649 const int NE = pmesh->
GetNE();
650 for (
int i = 0; i < NE; i++)
658 min_detJ = min(min_detJ, transf->
Jacobian().
Det());
661 MPI_Allreduce(MPI_IN_PLACE, &min_detJ, 1,
664 { cout <<
"Minimum det(J) of the original mesh is " << min_detJ << endl; }
666 MFEM_VERIFY(min_detJ > 0,
"The input mesh is inverted, use mesh-optimizer.");
668 const real_t init_energy =
a.GetParGridFunctionEnergy(x);
669 real_t init_metric_energy = init_energy;
670 if (surface_fit_const > 0.0)
673 init_metric_energy =
a.GetParGridFunctionEnergy(x);
674 surf_fit_coeff.
constant = surface_fit_const;
681 if (move_bnd ==
false)
685 if (marking_type > 0)
687 ess_bdr[marking_type-1] = 0;
689 a.SetEssentialBC(ess_bdr);
694 for (
int i = 0; i < pmesh->
GetNBE(); i++)
698 MFEM_VERIFY(!(
dim == 2 && attr == 3),
699 "Boundary attribute 3 must be used only for 3D meshes. "
700 "Adjust the attributes (1/2/3/4 for fixed x/y/z/all "
701 "components, rest for free nodes), or use -fix-bnd.");
702 if (attr == 1 || attr == 2 || attr == 3) { n += nd; }
703 if (attr == 4) { n += nd *
dim; }
707 for (
int i = 0; i < pmesh->
GetNBE(); i++)
714 for (
int j = 0; j < nd; j++)
715 { ess_vdofs[n++] = vdofs[j]; }
719 for (
int j = 0; j < nd; j++)
720 { ess_vdofs[n++] = vdofs[j+nd]; }
724 for (
int j = 0; j < nd; j++)
725 { ess_vdofs[n++] = vdofs[j+2*nd]; }
729 for (
int j = 0; j < vdofs.
Size(); j++)
730 { ess_vdofs[n++] = vdofs[j]; }
733 a.SetEssentialVDofs(ess_vdofs);
738 Solver *S = NULL, *S_prec = NULL;
739#ifdef MFEM_USE_SINGLE
740 const real_t linsol_rtol = 1e-5;
742 const real_t linsol_rtol = 1e-12;
748 else if (lin_solver == 1)
764 else { minres->
SetPrintLevel(verbosity_level == 2 ? 3 : -1); }
765 if (lin_solver == 3 || lin_solver == 4)
770 hs->SetPositiveDiagonal(
true);
781 if (surface_fit_adapt > 0.0)
785 if (surface_fit_threshold > 0)
791 if (solver_type == 0)
800 if (solver_art_type > 0)
813 ostringstream mesh_name;
814 mesh_name <<
"optimized.mesh";
815 ofstream mesh_ofs(mesh_name.str().c_str());
816 mesh_ofs.precision(8);
821 const real_t fin_energy =
a.GetParGridFunctionEnergy(x);
822 real_t fin_metric_energy = fin_energy;
823 if (surface_fit_const > 0.0)
826 fin_metric_energy =
a.GetParGridFunctionEnergy(x);
827 surf_fit_coeff.
constant = surface_fit_const;
832 std::cout << std::scientific << std::setprecision(4);
833 cout <<
"Initial strain energy: " << init_energy
834 <<
" = metrics: " << init_metric_energy
835 <<
" + extra terms: " << init_energy - init_metric_energy << endl;
836 cout <<
" Final strain energy: " << fin_energy
837 <<
" = metrics: " << fin_metric_energy
838 <<
" + extra terms: " << fin_energy - fin_metric_energy << endl;
839 cout <<
"The strain energy decreased by: "
840 << (init_energy - fin_energy) * 100.0 / init_energy <<
" %." << endl;
843 if (surface_fit_const > 0.0)
849 "Materials", 300, 400, 300, 300);
851 "Surface DOFs", 600, 400, 300, 300);
857 std::cout <<
"Avg fitting error: " << err_avg << std::endl
858 <<
"Max fitting error: " << err_max << std::endl;
868 "Displacements", 900, 400, 300, 300,
"jRmclA");
873 delete metric_coeff1;
874 delete adapt_surface;
875 delete adapt_grad_surface;
876 delete adapt_hess_surface;
878 delete surf_fit_hess;
879 delete surf_fit_hess_fes;
880 delete surf_fit_bg_hess;
881 delete surf_fit_bg_hess_fes;
882 delete surf_fit_grad;
883 delete surf_fit_grad_fes;
884 delete surf_fit_bg_grad;
885 delete surf_fit_bg_grad_fes;
886 delete surf_fit_bg_gf0;
887 delete surf_fit_bg_fes;
888 delete surf_fit_bg_fec;
893 delete pmesh_surf_fit_bg;
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Conjugate gradient method.
A coefficient that is constant across space and time.
Data type for scaled Jacobi-type smoother of sparse matrix.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
int GetAttribute() const
Return element's attribute.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
const FiniteElement * GetBE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th boundary fac...
DofTransformation * GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for i'th boundary element. The returned indices are offsets int...
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
A general function coefficient.
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
Class for grid function - Vector with associated FE space.
void SetTrueVector()
Shortcut for calling GetTrueDofs() with GetTrueVector() as argument.
void SetFromTrueVector()
Shortcut for calling SetFromTrueDofs() with GetTrueVector() as argument.
const Vector & GetTrueVector() const
Read only access to the (optional) internal true-dof Vector.
Arbitrary order H1-conforming (continuous) finite elements.
Parallel smoothers in hypre.
void SetType(HypreSmoother::Type type, int relax_times=1)
Set the relaxation type and number of sweeps.
@ l1Jacobi
l1-scaled Jacobi
static void Init()
Initialize hypre by calling HYPRE_Init() and set default options. After calling Hypre::Init(),...
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
Container class for integration rules.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
void SetRelTol(real_t rtol)
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
void SetMaxIter(int max_it)
void SetAbsTol(real_t atol)
Arbitrary order "L2-conforming" discontinuous finite elements.
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
int GetAttribute(int i) const
Return the attribute of element i.
void SetAttribute(int i, int attr)
Set the attribute of element i.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
const Element * GetBdrElement(int i) const
Return pointer to the i'th boundary element object.
void GetElementTransformation(int i, IsoparametricTransformation *ElTr) const
Builds the transformation defining the i-th element in ElTr. ElTr must be allocated in advance and wi...
static Mesh MakeCartesian3D(int nx, int ny, int nz, Element::Type type, real_t sx=1.0, real_t sy=1.0, real_t sz=1.0, bool sfc_ordering=true)
Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz hexahedra if type =...
void SetNodalGridFunction(GridFunction *nodes, bool make_owner=false)
void GetNodes(Vector &node_coord) const
int GetNBE() const
Returns number of boundary elements.
FaceElementTransformations * GetInteriorFaceTransformations(int FaceNo)
See GetFaceElementTransformations().
void EnsureNCMesh(bool simplices_nonconforming=false)
static Mesh MakeCartesian2D(int nx, int ny, Element::Type type, bool generate_edges=false, real_t sx=1.0, real_t sy=1.0, bool sfc_ordering=true)
Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny quadrilaterals if type = QUADRILATER...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
static int WorldRank()
Return the MPI rank in MPI_COMM_WORLD.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
void SetAdaptiveLinRtol(const int type=2, const real_t rtol0=0.5, const real_t rtol_max=0.9, const real_t alpha=0.5 *(1.0+sqrt(5.0)), const real_t gamma=1.0)
Enable adaptive linear solver relative tolerance algorithm.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
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...
bool Good() const
Return true if the command line options were parsed successfully.
Abstract parallel finite element space.
int GetFaceDofs(int i, Array< int > &dofs, int variant=0) const override
void Update(bool want_transform=true) override
const FiniteElement * GetFE(int i) const override
Class for parallel grid function.
void ExchangeFaceNbrData()
void ProjectDiscCoefficient(VectorCoefficient &coeff) override
Project a discontinuous vector coefficient as a grid function on a continuous finite element space....
ParFiniteElementSpace * ParFESpace() const
void GetDerivative(int comp, int der_comp, ParGridFunction &der)
Parallel version of GridFunction::GetDerivative(); see its documentation.
void ProjectCoefficient(Coefficient &coeff) override
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void Update() override
Transform by the Space UpdateMatrix (e.g., on Mesh change).
Class for parallel meshes.
void ExchangeFaceNbrData(Table *gr_sface, int *s2l_face)
int GetNSharedFaces() const
Return the number of shared faces (3D), edges (2D), vertices (1D)
void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1) override
Set the curvature of the mesh nodes using the given polynomial degree.
void SetAttributes() override
Determine the sets of unique attribute values in domain and boundary elements.
void SetNodalFESpace(FiniteElementSpace *nfes) override
int GetSharedFace(int sface) const
Return the local face index for the given shared face.
FaceElementTransformations * GetSharedFaceTransformations(int sf, bool fill2=true)
Get the FaceElementTransformations for the given shared face (edge 2D) using the shared face index sf...
void PrintAsSerial(std::ostream &out=mfem::out, const std::string &comments="") const
void GetBoundingBox(Vector &p_min, Vector &p_max, int ref=2)
Version of QuadraticFECollection with positive basis functions.
void SetAdaptiveSurfaceFittingScalingFactor(real_t factor)
void SetMinimumDeterminantThreshold(real_t threshold)
void SetIntegrationRules(IntegrationRules &irules, int order)
Prescribe a set of integration rules; relevant for mixed meshes.
virtual void Mult(const Vector &b, Vector &x) const
Solve the nonlinear system with right-hand side b.
void SetTerminationWithMaxSurfaceFittingError(real_t max_error)
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
A TMOP integrator class based on any given TMOP_QualityMetric and TargetConstructor.
void EnableSurfaceFittingFromSource(const ParGridFunction &s_bg, ParGridFunction &s0, const Array< bool > &smarker, Coefficient &coeff, AdaptivityEvaluator &ae, const ParGridFunction &s_bg_grad, ParGridFunction &s0_grad, AdaptivityEvaluator &age, const ParGridFunction &s_bg_hess, ParGridFunction &s0_hess, AdaptivityEvaluator &ahe)
Fitting of certain DOFs in the current mesh to the zero level set of a function defined on another (f...
void GetSurfaceFittingErrors(const Vector &pos, real_t &err_avg, real_t &err_max)
void SetIntegrationRules(IntegrationRules &irules, int order)
Prescribe a set of integration rules; relevant for mixed meshes.
void EnableSurfaceFitting(const GridFunction &s0, const Array< bool > &smarker, Coefficient &coeff, AdaptivityEvaluator &ae)
Fitting of certain DOFs to the zero level set of a function.
2D barrier shape (S) metric (not polyconvex).
3D barrier Shape (S) metric, well-posed (polyconvex & invex).
3D compound barrier Shape+Size (VS) metric (polyconvex, balanced).
Abstract class for local mesh quality metrics in the target-matrix optimization paradigm (TMOP) by P....
Base class representing target-matrix construction algorithms for mesh optimization via the target-ma...
void SetNodes(const GridFunction &n)
Set the nodes to be used in the target-matrix construction.
TargetType
Target-matrix construction algorithms supported by this class.
int Size() const
Returns the size of the vector.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
real_t reactor(const Vector &x)
real_t csg_cubecylsph(const Vector &x)
void ModifyBoundaryAttributesForNodeMovement(ParMesh *pmesh, ParGridFunction &x)
void ModifyAttributeForMarkingDOFS(ParMesh *pmesh, ParGridFunction &mat, int attr_to_switch)
void OptimizeMeshWithAMRAroundZeroLevelSet(ParMesh &pmesh, FunctionCoefficient &ls_coeff, int amr_iter, ParGridFunction &distance_s, const int quad_order=5, Array< ParGridFunction * > *pgf_to_update=NULL)
void ComputeScalarDistanceFromLevelSet(ParMesh &pmesh, FunctionCoefficient &ls_coeff, ParGridFunction &distance_s, const int nDiffuse=2, const int pLapOrder=5, const int pLapNewton=50)
real_t circle_level_set(const Vector &x)
int material_id(int el_id, const GridFunction &g)
IntegrationRules IntRulesCU(0, Quadrature1D::ClosedUniform)
IntegrationRules IntRulesLo(0, Quadrature1D::GaussLobatto)
void VisualizeField(socketstream &sock, const char *vishost, int visport, GridFunction &gf, const char *title, int x, int y, int w, int h, const char *keys, bool vec)
real_t infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
int material(Vector &x, Vector &xmin, Vector &xmax)
Helper struct to convert a C++ type to an MPI type.