46 namespace MeshClassifierImplementation
50 "The Triangulation has not been classified. You need to call the "
51 "reclassify()-function before using this function.");
55 "The incoming cell does not belong to the triangulation passed to "
63 template <
typename VectorType>
67 const auto min_max_element =
68 std::minmax_element(local_levelset_values.begin(),
69 local_levelset_values.end());
71 if (*min_max_element.second < 0)
73 if (0 < *min_max_element.first)
85 template <
int dim,
typename VectorType>
107 &cell)
const override;
116 const unsigned int face_index,
134 template <
int dim,
typename VectorType>
137 const VectorType &level_set)
138 : dof_handler(&dof_handler)
139 , level_set(&level_set)
144 template <
int dim,
typename VectorType>
148 return dof_handler->get_fe_collection();
153 template <
int dim,
typename VectorType>
157 const unsigned int face_index,
160 const auto cell_with_dofs = cell->as_dof_handler_iterator(*dof_handler);
162 const unsigned int n_dofs_per_face =
163 dof_handler->get_fe().n_dofs_per_face();
164 std::vector<types::global_dof_index> dof_indices(n_dofs_per_face);
165 cell_with_dofs->face(face_index)->get_dof_indices(dof_indices);
167 local_levelset_values.
reinit(dof_indices.size());
169 for (
unsigned int i = 0; i < dof_indices.size(); i++)
170 local_levelset_values[i] =
177 template <
int dim,
typename VectorType>
182 const auto cell_with_dofs = cell->as_dof_handler_iterator(*dof_handler);
184 return cell_with_dofs->active_fe_index();
216 &cell)
const override;
225 const unsigned int face_index,
253 : level_set(&level_set)
254 , fe_collection(element)
255 , fe_face_values(element,
257 element.get_unit_face_support_points()),
267 const unsigned int face_index,
271 fe_face_values.n_quadrature_points);
273 fe_face_values.reinit(cell, face_index);
274 const std::vector<Point<dim>> &points =
275 fe_face_values.get_quadrature_points();
277 for (
unsigned int i = 0; i < points.size(); i++)
278 local_levelset_values[i] = level_set->value(points[i]);
287 return fe_collection;
305 template <
typename VectorType>
307 const VectorType &level_set)
309 , level_set_description(
310 std::make_unique<
internal::MeshClassifierImplementation::
311 DiscreteLevelSetDescription<dim, VectorType>>(
315#ifdef DEAL_II_WITH_LAPACK
318 for (
unsigned int i = 0; i < fe_collection.
size(); i++)
323 Assert(fe_collection[i].has_face_support_points(),
325 "The elements in the FECollection of the incoming DoFHandler "
326 "must have face support points."));
340 , level_set_description(
341 std::make_unique<
internal::MeshClassifierImplementation::
342 AnalyticLevelSetDescription<dim>>(level_set,
364 for (
const auto &cell :
triangulation->active_cell_iterators())
365 if (!cell->is_artificial())
368 determine_face_location_to_levelset(cell, 0);
370 face_locations[cell->face(0)->index()] = face0_location;
373 for (
unsigned int f = 1; f < GeometryInfo<dim>::faces_per_cell; ++f)
376 determine_face_location_to_levelset(cell, f);
378 face_locations[cell->face(f)->index()] = face_location;
380 if (face_location != face0_location)
383 cell_locations[cell->active_cell_index()] = cell_location;
393 const unsigned int face_index)
398 face_locations.at(cell->face(face_index)->index());
404 const unsigned int fe_index = level_set_description->active_fe_index(cell);
405 const unsigned int n_local_dofs =
406 lagrange_to_bernstein_face[fe_index][face_index].m();
409 level_set_description->get_local_level_set_values(cell,
411 local_levelset_values);
414 level_set_description->get_fe_collection()[fe_index];
421 const bool is_linear = fe_q_iso_q1 !=
nullptr ||
422 (fe_poly !=
nullptr && fe_poly->
get_degree() == 1);
428 local_levelset_values);
431 lagrange_to_bernstein_face[fe_index][face_index].solve(
432 local_levelset_values);
435 local_levelset_values);
450 return cell_locations.at(cell->active_cell_index());
459 const unsigned int face_index)
const
467 return face_locations.at(cell->face(face_index)->index());
477 level_set_description->get_fe_collection();
482 lagrange_to_bernstein_face.resize(fe_collection.
size());
484 for (
unsigned int i = 0; i < fe_collection.
size(); i++)
494 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell; f++)
500 *fe_q, face_interpolation_matrix, f);
501 lagrange_to_bernstein_face[i][f].reinit(dofs_per_face);
502 lagrange_to_bernstein_face[i][f] = face_interpolation_matrix;
503 lagrange_to_bernstein_face[i][f].compute_lu_factorization();
510#include "mesh_classifier.inst"
const hp::FECollection< dim, spacedim > & get_fe_collection() const
virtual void get_face_interpolation_matrix(const FiniteElement< dim, spacedim > &source, FullMatrix< double > &matrix, const unsigned int face_no=0) const override
unsigned int get_degree() const
const unsigned int dofs_per_face
unsigned int n_components() const
const unsigned int n_components
LocationToLevelSet location_to_level_set(const typename Triangulation< dim >::cell_iterator &cell) const
LocationToLevelSet determine_face_location_to_levelset(const typename Triangulation< dim >::active_cell_iterator &cell, const unsigned int face_index)
MeshClassifier(const DoFHandler< dim > &level_set_dof_handler, const VectorType &level_set)
AnalyticLevelSetDescription(const Function< dim > &level_set, const FiniteElement< dim > &element)
unsigned int active_fe_index(const typename Triangulation< dim >::active_cell_iterator &cell) const override
FEFaceValues< dim > fe_face_values
const hp::FECollection< dim > & get_fe_collection() const override
const ObserverPointer< const Function< dim > > level_set
const hp::FECollection< dim > fe_collection
void get_local_level_set_values(const typename Triangulation< dim >::active_cell_iterator &cell, const unsigned int face_index, Vector< double > &local_levelset_values) override
void get_local_level_set_values(const typename Triangulation< dim >::active_cell_iterator &cell, const unsigned int face_index, Vector< double > &local_levelset_values) override
const ObserverPointer< const DoFHandler< dim > > dof_handler
unsigned int active_fe_index(const typename Triangulation< dim >::active_cell_iterator &cell) const override
const hp::FECollection< dim > & get_fe_collection() const override
const ObserverPointer< const VectorType > level_set
DiscreteLevelSetDescription(const DoFHandler< dim > &dof_handler, const VectorType &level_set)
virtual size_type size() const override
virtual void reinit(const size_type N, const bool omit_zeroing_entries=false)
unsigned int size() const
unsigned int n_components() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcNeedsLAPACK()
static ::ExceptionBase & ExcReclassifyNotCalled()
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcTriangulationMismatch()
#define AssertThrow(cond, exc)
@ update_quadrature_points
Transformed quadrature points.
LocationToLevelSet location_from_dof_signs(const VectorType &local_levelset_values)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation