22 else { level_set_index += 1; }
27 const double eps = 1e-10;
28 auto outside_of_domain = [&](
double value)
33 return (value - eps < 0.0);
38 return (value + eps < 0.0);
52 if (outside_of_domain(vals(j))) { count++; }
57 elem_marker[i] = SBElementType::OUTSIDE;
61 MFEM_VERIFY(elem_marker[i] <= SBElementType::OUTSIDE,
62 " One element cut by multiple level-sets.");
63 elem_marker[i] = SBElementType::CUT + level_set_index;
83 for (
int j = 0; j < nip; j++)
87 if (outside_of_domain(vals(j))) { count++; }
92 MFEM_VERIFY(elem_marker[i] != SBElementType::OUTSIDE,
93 "An element cannot be excluded by more than 1 level-set.");
94 elem_marker[i] = SBElementType::OUTSIDE;
98 MFEM_VERIFY(elem_marker[i] <= SBElementType::OUTSIDE,
99 "An element cannot be cut by multiple level-sets.");
100 elem_marker[i] = SBElementType::CUT + level_set_index;
125 int te1 = elem_marker[tr->
Elem1No], te2 = elem_marker[tr->
Elem2No];
130 sface_dof_list.
Append(dofs);
136 sface_dof_list.
Append(dofs);
139 te1 >= SBElementType::CUT && te2 == SBElementType::OUTSIDE)
142 sface_dof_list.
Append(dofs);
145 te1 == SBElementType::OUTSIDE && te2 >= SBElementType::CUT)
148 sface_dof_list.
Append(dofs);
161 if (elem_marker[tr->
Elem1No] >= SBElementType::CUT)
164 sface_dof_list.
Append(dofs);
177 int te1 = elem_marker[ne1];
186 sface_dof_list.
Append(dofs);
189 te2 == SBElementType::OUTSIDE && te1 >= SBElementType::CUT)
192 sface_dof_list.
Append(dofs);
209 int pmesh_bdr_attr_max = 0;
215 bool sbm_at_true_boundary =
false;
223 if (elem_marker[tr->
Elem1No] >= SBElementType::CUT)
226 sbm_at_true_boundary =
true;
231 bool sbm_at_true_boundary_global =
false;
232 MPI_Allreduce(&sbm_at_true_boundary, &sbm_at_true_boundary_global, 1,
233 MPI_C_BOOL, MPI_LOR, MPI_COMM_WORLD);
234 if (sbm_at_true_boundary_global)
241 ess_shift_bdr.
SetSize(ess_bdr.Size());
244 for (
int i = 0; i < ess_bdr.Size(); i++)
246 ess_shift_bdr[i] = 1 - ess_bdr[i];
259 (elem_marker[e] == SBElementType::OUTSIDE ||
260 elem_marker[e] >= SBElementType::CUT))
263 for (
int i = 0; i < dofs.Size(); i++)
265 ess_vdofs[dofs[i]] = -1;
269 elem_marker[e] == SBElementType::OUTSIDE)
272 for (
int i = 0; i < dofs.Size(); i++)
274 ess_vdofs[dofs[i]] = -1;
280 for (
int i = 0; i < ess_vdofs.
Size(); i++)
282 if (ess_vdofs_bdr[i] == -1) { ess_vdofs[i] = -1; }
286 for (
int i = 0; i < sface_dof_list.
Size(); i++)
288 if (ess_vdofs_bdr[sface_dof_list[i]] != -1)
290 ess_vdofs[sface_dof_list[i]] = 0;
295 for (
int i = 0; i < ess_vdofs.
Size() ; i++) { ess_vdofs[i] += 1; }
297 for (
int i = 0; i < ess_vdofs.
Size() ; i++) { ess_vdofs[i] -= 1; }
318 if (elem_marker[i] == SBElementType::OUTSIDE)
327 for (
int j = 0; j < marker_gf.
Size(); j++)
329 if (marker_gf(j) > 0.1 && marker_gf(j) < 0.9)
344 if (elem_marker[tr->
Elem1No] >= SBElementType::CUT)
347 sface_dof_list.
Append(dofs);
int GetNPoints() const
Returns the number of the points in the integration rule.
Class for an integration rule - an Array of IntegrationPoint.
IntegrationRules IntRulesLo(0, Quadrature1D::GaussLobatto)
Geometry::Type GetElementBaseGeometry(int i) const
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
void SetSize(int s)
Resize the vector to size s.
const bool include_cut_cell
int Size() const
Returns the size of the vector.
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
Container class for integration rules.
virtual void ProjectDiscCoefficient(VectorCoefficient &coeff)
Project a discontinuous vector coefficient as a grid function on a continuous finite element space...
Abstract parallel finite element space.
FaceElementTransformations * GetInteriorFaceTransformations(int FaceNo)
See GetFaceElementTransformations().
virtual const SparseMatrix * GetRestrictionMatrix() const
Get the R matrix which restricts a local dof vector to true dof vector.
int GetNBE() const
Returns number of boundary elements.
void DeleteAll()
Delete the whole array.
static void MarkerToList(const Array< int > &marker, Array< int > &list)
Convert a Boolean marker array to a list containing all marked indices.
void ListShiftedFaceDofs2(const Array< int > &elem_marker, Array< int > &sface_dof_list) const
virtual void GetEssentialVDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_dofs, int component=-1) const
Determine the boundary degrees of freedom.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
bool initial_marking_done
void GetValues(int i, const IntegrationRule &ir, Vector &vals, int vdim=1) const
double f(const Vector &xvec)
int Append(const T &el)
Append element 'el' to array, resize if necessary.
FaceElementTransformations * GetSharedFaceTransformations(int sf, bool fill2=true)
void Synchronize(Array< int > &ldof_marker) const
Given an integer array on the local degrees of freedom, perform a bitwise OR between the shared dofs...
ParFiniteElementSpace * pfes_sltn
void ListEssentialTDofs(const Array< int > &elem_marker, const Array< int > &sface_dof_list, Array< int > &ess_tdof_list, Array< int > &ess_shift_bdr) const
FaceElementTransformations * GetBdrFaceTransformations(int BdrElemNo)
int GetSharedFace(int sface) const
Return the local face index for the given shared face.
int GetBdrFace(int BdrElemNo) const
Return the local face index for the given boundary face.
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
virtual int GetFaceDofs(int i, Array< int > &dofs, int variant=0) const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
int GetNSharedFaces() const
Return the number of shared faces (3D), edges (2D), vertices (1D)
virtual const FiniteElement * GetFE(int i) const
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
void SetBdrAttribute(int i, int attr)
Set the attribute of boundary element i.
virtual double GetValue(int i, const IntegrationPoint &ip, int vdim=1) const
void SetAttributes() override
void BooleanMult(const Array< int > &x, Array< int > &y) const
y = A * x, treating all entries as booleans (zero=false, nonzero=true).
void GetFaceNbrElementTransformation(int i, IsoparametricTransformation *ElTr)
int GetNE() const
Returns number of elements.
Class for integration point with weight.
void ListShiftedFaceDofs(const Array< int > &elem_marker, Array< int > &sface_dof_list) const
const bool func_dof_marking
int Size() const
Return the logical size of the array.
Class for parallel grid function.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
void MarkElements(const ParGridFunction &ls_func, Array< int > &elem_marker)
Arbitrary order "L2-conforming" discontinuous finite elements.