51int main (
int argc,
char *argv[])
54 cout <<
"\nThis miniapp is NOT supported with the GPU version of hypre.\n\n";
55 return MFEM_SKIP_RETURN_VALUE;
63 const char *mesh_file =
"square01.mesh";
64 int mesh_poly_deg = 1;
69 real_t surface_fit_const = 100.0;
76 real_t solver_rtol = 1e-10;
79 int max_lin_iter = 100;
81 bool visualization =
false;
82 int verbosity_level = 0;
84 const char *devopt =
"cpu";
85 real_t surface_fit_adapt = 0.0;
86 real_t surface_fit_threshold = -10;
87 real_t surf_fit_const_max = 1e20;
88 bool adapt_marking =
false;
89 bool surf_bg_mesh =
false;
90 bool comp_dist =
false;
93 bool mod_bndr_attr =
false;
95 int mesh_node_ordering = 0;
97 bool conv_residual =
true;
101 args.
AddOption(&mesh_file,
"-m",
"--mesh",
102 "Mesh file to use.");
103 args.
AddOption(&mesh_poly_deg,
"-o",
"--order",
104 "Polynomial degree of mesh finite element space.");
105 args.
AddOption(&rs_levels,
"-rs",
"--refine-serial",
106 "Number of times to refine the mesh uniformly in serial.");
107 args.
AddOption(&rp_levels,
"-rp",
"--refine-parallel",
108 "Number of times to refine the mesh uniformly in parallel.");
109 args.
AddOption(&metric_id,
"-mid",
"--metric-id",
110 "Mesh optimization metric. See list in mesh-optimizer.");
111 args.
AddOption(&target_id,
"-tid",
"--target-id",
112 "Target (ideal element) type:\n\t"
113 "1: Ideal shape, unit size\n\t"
114 "2: Ideal shape, equal size\n\t"
115 "3: Ideal shape, initial size\n\t"
116 "4: Given full analytic Jacobian (in physical space)\n\t"
117 "5: Ideal shape, given size (in physical space)");
118 args.
AddOption(&surface_fit_const,
"-sfc",
"--surface-fit-const",
119 "Surface preservation constant.");
120 args.
AddOption(&quad_order,
"-qo",
"--quad_order",
121 "Order of the quadrature rule.");
122 args.
AddOption(&solver_type,
"-st",
"--solver-type",
123 " Type of solver: (default) 0: Newton, 1: LBFGS");
124 args.
AddOption(&solver_iter,
"-ni",
"--newton-iters",
125 "Maximum number of Newton iterations.");
126 args.
AddOption(&solver_rtol,
"-rtol",
"--newton-rel-tolerance",
127 "Relative tolerance for the Newton solver.");
128 args.
AddOption(&lin_solver,
"-ls",
"--lin-solver",
133 "3: MINRES + Jacobi preconditioner\n\t"
134 "4: MINRES + l1-Jacobi preconditioner");
135 args.
AddOption(&max_lin_iter,
"-li",
"--lin-iter",
136 "Maximum number of iterations in the linear solve.");
137 args.
AddOption(&move_bnd,
"-bnd",
"--move-boundary",
"-fix-bnd",
139 "Enable motion along horizontal and vertical boundaries.");
140 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
141 "--no-visualization",
142 "Enable or disable GLVis visualization.");
143 args.
AddOption(&verbosity_level,
"-vl",
"--verbosity-level",
144 "Set the verbosity level - 0, 1, or 2.");
145 args.
AddOption(&adapt_eval,
"-ae",
"--adaptivity-evaluator",
146 "0 - Advection based (DEFAULT), 1 - GSLIB.");
147 args.
AddOption(&devopt,
"-d",
"--device",
148 "Device configuration string, see Device::Configure().");
149 args.
AddOption(&surface_fit_adapt,
"-sfa",
"--adaptive-surface-fit",
150 "Scaling factor for surface fitting weight.");
151 args.
AddOption(&surface_fit_threshold,
"-sft",
"--surf-fit-threshold",
152 "Set threshold for surface fitting. TMOP solver will"
153 "terminate when max surface fitting error is below this limit");
154 args.
AddOption(&surf_fit_const_max,
"-sfcmax",
"--surf-fit-const-max",
155 "Max surface fitting weight allowed");
156 args.
AddOption(&adapt_marking,
"-marking",
"--adaptive-marking",
"-no-amarking",
157 "--no-adaptive-marking",
158 "Enable or disable adaptive marking surface fitting.");
159 args.
AddOption(&surf_bg_mesh,
"-sbgmesh",
"--surf-bg-mesh",
160 "-no-sbgmesh",
"--no-surf-bg-mesh",
161 "Use background mesh for surface fitting.");
162 args.
AddOption(&comp_dist,
"-dist",
"--comp-dist",
163 "-no-dist",
"--no-comp-dist",
164 "Compute distance from 0 level set or not.");
165 args.
AddOption(&surf_ls_type,
"-slstype",
"--surf-ls-type",
166 "1 - Circle (DEFAULT), 2 - reactor level-set, 3 - squircle.");
167 args.
AddOption(&marking_type,
"-smtype",
"--surf-marking-type",
168 "0 - Interface (DEFAULT), otherwise Boundary attribute.");
169 args.
AddOption(&mod_bndr_attr,
"-mod-bndr-attr",
"--modify-boundary-attribute",
170 "-fix-bndr-attr",
"--fix-boundary-attribute",
171 "Change boundary attribute based on alignment with Cartesian axes.");
173 "-no-mat",
"--no-mat",
"Use default material attributes.");
174 args.
AddOption(&mesh_node_ordering,
"-mno",
"--mesh_node_ordering",
175 "Ordering of mesh nodes."
176 "0 (default): byNodes, 1: byVDIM");
177 args.
AddOption(&bg_amr_iters,
"-bgamriter",
"--amr-iter",
178 "Number of amr iterations on background mesh");
179 args.
AddOption(&conv_residual,
"-resid",
"--resid",
"-no-resid",
181 "Enable residual based convergence.");
191 if (myid == 0) { device.
Print();}
193 MFEM_VERIFY(surface_fit_const > 0.0,
194 "This miniapp is for surface fitting only. See (p)mesh-optimizer"
195 "miniapps for general high-order mesh optimization.");
198 Mesh *mesh =
new Mesh(mesh_file, 1, 1,
false);
199 for (
int lev = 0; lev < rs_levels; lev++)
207 if (surf_ls_type == 1)
211 else if (surf_ls_type == 2)
215 else if (surf_ls_type == 3)
219 else if (surf_ls_type == 6)
225 MFEM_ABORT(
"Surface fitting level set type not implemented yet.")
233 ParMesh *pmesh_surf_fit_bg = NULL;
236 Mesh *mesh_surf_fit_bg = NULL;
248 pmesh_surf_fit_bg =
new ParMesh(MPI_COMM_WORLD, *mesh_surf_fit_bg);
249 delete mesh_surf_fit_bg;
257 if (mesh_poly_deg <= 0)
282 ostringstream mesh_name;
283 mesh_name <<
"perturbed.mesh";
284 ofstream mesh_ofs(mesh_name.str().c_str());
285 mesh_ofs.precision(8);
304 if (myid == 0) { cout <<
"Unknown metric_id: " << metric_id << endl; }
310 MFEM_VERIFY(
dim == 2,
"Incompatible metric for 3D meshes");
312 if (metric_id >= 300)
314 MFEM_VERIFY(
dim == 3,
"Incompatible metric for 2D meshes");
326 if (myid == 0) { cout <<
"Unknown target_id: " << target_id << endl; }
330 if (target_c == NULL)
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 bg_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 surf_fit_marker =
false;
518 surf_fit_mat_gf = 0.;
521 if (marking_type == 0)
533 int mat1 = mat(tr->Elem1No);
534 int mat2 = mat(tr->Elem2No);
548 int mat1 = mat(tr->Elem1No);
549 int mat2 = FaceNbrData(tr->Elem2No-pmesh->
GetNE());
557 for (
int i = 0; i < dof_list.
Size(); i++)
559 surf_fit_marker[dof_list[i]] =
true;
560 surf_fit_mat_gf(dof_list[i]) = 1.0;
564 else if (marking_type > 0)
566 for (
int i = 0; i < pmesh->
GetNBE(); i++)
569 if (attr == marking_type)
572 for (
int j = 0; j < vdofs.
Size(); j++)
574 surf_fit_marker[vdofs[j]] =
true;
575 surf_fit_mat_gf(vdofs[j]) = 1.0;
586 surf_fit_mat_gf.
Size());
588 gcomm.
Bcast(gf_array);
592 for (
int i = 0; i < surf_fit_mat_gf.
Size(); i++)
594 surf_fit_marker[i] = surf_fit_mat_gf(i) == 1.0;
602 MFEM_VERIFY(!surf_bg_mesh,
"Background meshes require GSLIB.");
604 else if (adapt_eval == 1)
611 MFEM_ABORT(
"MFEM is not built with GSLIB support!");
614 else { MFEM_ABORT(
"Bad interpolation option."); }
619 surf_fit_coeff, *adapt_surface,
626 *surf_fit_bg_gf0, surf_fit_gf0,
627 surf_fit_marker, surf_fit_coeff, *adapt_surface,
628 *surf_fit_bg_grad, *surf_fit_grad, *adapt_grad_surface,
629 *surf_fit_bg_hess, *surf_fit_hess, *adapt_hess_surface);
636 "Level Set", 0, 0, 300, 300);
638 "Materials", 300, 0, 300, 300);
640 "Surface DOFs", 600, 0, 300, 300);
644 "Level Set - Background",
652 a.AddDomainIntegrator(tmop_integ);
656 const int NE = pmesh->
GetNE();
657 for (
int i = 0; i < NE; i++)
665 min_detJ = min(min_detJ, transf->
Jacobian().
Det());
668 MPI_Allreduce(MPI_IN_PLACE, &min_detJ, 1,
671 { cout <<
"Minimum det(J) of the original mesh is " << min_detJ << endl; }
673 MFEM_VERIFY(min_detJ > 0,
"The input mesh is inverted, use mesh-optimizer.");
675 const real_t init_energy =
a.GetParGridFunctionEnergy(x);
676 real_t init_metric_energy = init_energy;
677 if (surface_fit_const > 0.0)
680 init_metric_energy =
a.GetParGridFunctionEnergy(x);
681 surf_fit_coeff.
constant = surface_fit_const;
688 if (move_bnd ==
false)
692 if (marking_type > 0)
694 ess_bdr[marking_type-1] = 0;
696 a.SetEssentialBC(ess_bdr);
701 for (
int i = 0; i < pmesh->
GetNBE(); i++)
705 MFEM_VERIFY(!(
dim == 2 && attr == 3),
706 "Boundary attribute 3 must be used only for 3D meshes. "
707 "Adjust the attributes (1/2/3/4 for fixed x/y/z/all "
708 "components, rest for free nodes), or use -fix-bnd.");
709 if (attr == 1 || attr == 2 || attr == 3) { n += nd; }
710 if (attr == 4) { n += nd *
dim; }
714 for (
int i = 0; i < pmesh->
GetNBE(); i++)
721 for (
int j = 0; j < nd; j++)
722 { ess_vdofs[n++] = vdofs[j]; }
726 for (
int j = 0; j < nd; j++)
727 { ess_vdofs[n++] = vdofs[j+nd]; }
731 for (
int j = 0; j < nd; j++)
732 { ess_vdofs[n++] = vdofs[j+2*nd]; }
736 for (
int j = 0; j < vdofs.
Size(); j++)
737 { ess_vdofs[n++] = vdofs[j]; }
740 a.SetEssentialVDofs(ess_vdofs);
744 Solver *S = NULL, *S_prec = NULL;
745#ifdef MFEM_USE_SINGLE
746 const real_t linsol_rtol = 1e-5;
748 const real_t linsol_rtol = 1e-12;
754 else if (lin_solver == 1)
770 else { minres->
SetPrintLevel(verbosity_level == 2 ? 3 : -1); }
771 if (lin_solver == 3 || lin_solver == 4)
776 hs->SetPositiveDiagonal(
true);
787 if (surface_fit_adapt > 0.0)
791 if (surface_fit_threshold > 0)
803 if (solver_type == 0)
821 ostringstream mesh_name;
822 mesh_name <<
"optimized.mesh";
823 ofstream mesh_ofs(mesh_name.str().c_str());
824 mesh_ofs.precision(8);
829 const real_t fin_energy =
a.GetParGridFunctionEnergy(x);
830 real_t fin_metric_energy = fin_energy;
831 if (surface_fit_const > 0.0)
834 fin_metric_energy =
a.GetParGridFunctionEnergy(x);
835 surf_fit_coeff.
constant = surface_fit_const;
840 std::cout << std::scientific << std::setprecision(4);
841 cout <<
"Initial strain energy: " << init_energy
842 <<
" = metrics: " << init_metric_energy
843 <<
" + extra terms: " << init_energy - init_metric_energy << endl;
844 cout <<
" Final strain energy: " << fin_energy
845 <<
" = metrics: " << fin_metric_energy
846 <<
" + extra terms: " << fin_energy - fin_metric_energy << endl;
847 cout <<
"The strain energy decreased by: "
848 << (init_energy - fin_energy) * 100.0 / init_energy <<
" %." << endl;
851 if (surface_fit_const > 0.0)
859 "Level Set", 000, 400, 300, 300);
861 "Materials", 300, 400, 300, 300);
863 "Surface DOFs", 600, 400, 300, 300);
869 std::cout <<
"Avg fitting error: " << err_avg << std::endl
870 <<
"Max fitting error: " << err_max << std::endl;
880 "Displacements", 900, 400, 300, 300,
"jRmclA");
885 delete adapt_surface;
886 delete adapt_grad_surface;
887 delete adapt_hess_surface;
889 delete surf_fit_hess;
890 delete surf_fit_hess_fes;
891 delete surf_fit_bg_hess;
892 delete surf_fit_bg_hess_fes;
893 delete surf_fit_grad;
894 delete surf_fit_grad_fes;
895 delete surf_fit_bg_grad;
896 delete surf_fit_bg_grad_fes;
897 delete surf_fit_bg_gf0;
898 delete surf_fit_bg_fes;
899 delete surf_fit_bg_fec;
904 delete pmesh_surf_fit_bg;
virtual void ComputeAtNewPosition(const Vector &new_mesh_nodes, Vector &new_field, int nodes_ordering=Ordering::byNODES)=0
Perform field transfer between the original and a new mesh. The source mesh and field are given by Se...
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...
Ordering::Type GetOrdering() const
Return the ordering method.
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.
FiniteElementSpace * FESpace()
Communicator performing operations within groups defined by a GroupTopology with arbitrary-size data ...
void Reduce(T *ldata, void(*Op)(OpData< T >)) const
Reduce within each group where the master is the root.
void Bcast(T *ldata, int layout) const
Broadcast within each group where the master is the root.
static void Max(OpData< T >)
Reduce operation Max, instantiated for int and double.
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.
void SetOperator(const Operator &op) override
Also calls SetOperator for the preconditioner if there is one.
void SetPreconditioner(Solver &pr) override
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.
Geometry::Type GetTypicalElementGeometry() const
If the local mesh is not empty, return GetElementGeometry(0); otherwise, return a typical Geometry pr...
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 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.
GroupCommunicator & GroupComm()
Return a reference to the internal GroupCommunicator (on VDofs)
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 GetDerivative(int comp, int der_comp, ParGridFunction &der) const
Parallel version of GridFunction::GetDerivative(); see its documentation.
void ProjectDiscCoefficient(VectorCoefficient &coeff) override
Project a discontinuous vector coefficient as a grid function on a continuous finite element space....
ParFiniteElementSpace * ParFESpace() const
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)
Set minimum determinant enforced during line-search.
void Mult(const Vector &b, Vector &x) const override
Optimizes the mesh positions given by x.
void SetPreconditioner(Solver &pr) override
This should be called before SetOperator.
void SetIntegrationRules(IntegrationRules &irules, int order)
Prescribe a set of integration rules; relevant for mixed meshes.
void SetSurfaceFittingMaxErrorLimit(real_t max_error)
Could be used with both error-based or residual-based convergence.
void SetSurfaceFittingConvergenceBasedOnError(bool mode)
Toggle convergence based on residual or error.
void SetSurfaceFittingWeightLimit(real_t weight)
Used for residual-based surface fitting termination.
A TMOP integrator class based on any given TMOP_QualityMetric and TargetConstructor.
void GetSurfaceFittingErrors(const Vector &d_loc, real_t &err_avg, real_t &err_max)
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 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)
real_t squircle_level_set(const Vector &x)
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 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()
int material(Vector &x, Vector &xmin, Vector &xmax)
Helper struct to convert a C++ type to an MPI type.