16 #ifndef dealii_tria_manifold_h 17 #define dealii_tria_manifold_h 22 #include <deal.II/base/config.h> 24 #include <deal.II/base/array_view.h> 25 #include <deal.II/base/derivative_form.h> 26 #include <deal.II/base/point.h> 27 #include <deal.II/base/quadrature_lib.h> 28 #include <deal.II/base/subscriptor.h> 29 #include <deal.II/base/thread_management.h> 31 #include <deal.II/grid/tria.h> 33 DEAL_II_NAMESPACE_OPEN
36 template <
int,
typename>
51 template <
typename MeshIteratorType>
52 inline constexpr std::size_t
110 template <
typename MeshIteratorType>
113 const bool with_interpolation =
false);
157 template <
typename MeshIteratorType>
158 std::pair<std::array<Point<MeshIteratorType::AccessorType::space_dimension>,
159 n_default_points_per_cell<MeshIteratorType>()>,
160 std::array<
double, n_default_points_per_cell<MeshIteratorType>()>>
162 const bool with_interpolation =
false);
328 template <
int dim,
int spacedim = dim>
333 static_assert(dim <= spacedim,
334 "The dimension <dim> of a Manifold must be less than or " 335 "equal to the space dimension <spacedim> in which it lives.");
364 virtual std::unique_ptr<Manifold<dim, spacedim>>
392 const double w)
const;
676 template <
int dim,
int spacedim = dim>
713 virtual std::unique_ptr<Manifold<dim, spacedim>>
714 clone()
const override;
845 <<
"The component number " << arg1 <<
" of the point [ " 846 << arg2 <<
" ] is not in the interval [ 0, " << arg3
847 <<
"), bailing out.");
945 template <
int dim,
int spacedim = dim,
int chartdim = dim>
950 static_assert(dim <= spacedim,
951 "The dimension <dim> of a ChartManifold must be less than or " 952 "equal to the space dimension <spacedim> in which it lives.");
983 const double w)
const override;
1183 template <
typename MeshIteratorType>
1186 const bool with_interpolation)
1188 const auto points_and_weights =
1190 static const int spacedim = MeshIteratorType::AccessorType::space_dimension;
1192 std::vector<Point<spacedim>>(points_and_weights.first.begin(),
1193 points_and_weights.first.end()),
1194 std::vector<double>(points_and_weights.second.begin(),
1195 points_and_weights.second.end()));
1200 template <
typename MeshIteratorType>
1201 std::pair<std::array<Point<MeshIteratorType::AccessorType::space_dimension>,
1202 n_default_points_per_cell<MeshIteratorType>()>,
1203 std::array<
double, n_default_points_per_cell<MeshIteratorType>()>>
1205 const bool with_interpolation)
1207 const int dim = MeshIteratorType::AccessorType::structure_dimension;
1208 const int spacedim = MeshIteratorType::AccessorType::space_dimension;
1209 constexpr std::size_t points_per_cell =
1210 n_default_points_per_cell<MeshIteratorType>();
1212 std::pair<std::array<Point<spacedim>, points_per_cell>,
1213 std::array<double, points_per_cell>>
1226 points_weights.first[0] = iterator->vertex(0);
1227 points_weights.second[0] = .5;
1228 points_weights.first[1] = iterator->vertex(1);
1229 points_weights.second[1] = .5;
1235 for (
unsigned int i = 0; i < 4; ++i)
1237 points_weights.first[i] = iterator->vertex(i);
1238 points_weights.first[4 + i] =
1239 (iterator->line(i)->has_children() ?
1240 iterator->line(i)->child(0)->vertex(1) :
1241 iterator->line(i)->get_manifold().get_new_point_on_line(
1242 iterator->line(i)));
1245 if (with_interpolation)
1247 std::fill(points_weights.second.begin(),
1248 points_weights.second.begin() + 4,
1250 std::fill(points_weights.second.begin() + 4,
1251 points_weights.second.end(),
1255 std::fill(points_weights.second.begin(),
1256 points_weights.second.end(),
1268 auto *sp3 =
reinterpret_cast< 1269 std::array<Point<3>, n_default_points_per_cell<decltype(hex)>()
> 1270 *>(&points_weights.first);
1279 if (with_interpolation)
1281 for (
unsigned int i = 0;
1282 i < GeometryInfo<dim>::vertices_per_cell;
1285 (*sp3)[j] = hex->vertex(i);
1286 points_weights.second[j] = 1.0 / 8.0;
1288 for (
unsigned int i = 0; i < GeometryInfo<dim>::lines_per_cell;
1292 (hex->line(i)->has_children() ?
1293 hex->line(i)->child(0)->vertex(1) :
1294 hex->line(i)->get_manifold().get_new_point_on_line(
1296 points_weights.second[j] = -1.0 / 4.0;
1298 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell;
1302 (hex->quad(i)->has_children() ?
1303 hex->quad(i)->isotropic_child(0)->vertex(3) :
1304 hex->quad(i)->get_manifold().get_new_point_on_quad(
1306 points_weights.second[j] = 1.0 / 2.0;
1312 std::fill(points_weights.second.begin(),
1313 points_weights.second.end(),
1321 return points_weights;
1327 DEAL_II_NAMESPACE_CLOSE
FlatManifold(const Tensor< 1, spacedim > &periodicity=Tensor< 1, spacedim >(), const double tolerance=1e-10)
std::pair< std::array< Point< MeshIteratorType::AccessorType::space_dimension >, n_default_points_per_cell< MeshIteratorType >)>, std::array< double, n_default_points_per_cell< MeshIteratorType >)> > get_default_points_and_weights(const MeshIteratorType &iterator, const bool with_interpolation=false)
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const override
typename IteratorSelector::line_iterator line_iterator
const Tensor< 1, spacedim > & get_periodicity() const
virtual Point< spacedim > get_new_point_on_hex(const typename Triangulation< dim, spacedim >::hex_iterator &hex) const
typename IteratorSelector::hex_iterator hex_iterator
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const =0
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const
virtual ~ChartManifold() override=default
constexpr std::size_t n_default_points_per_cell()
virtual Point< spacedim > get_new_point_on_line(const typename Triangulation< dim, spacedim >::line_iterator &line) const
virtual Tensor< 1, spacedim > get_tangent_vector(const Point< spacedim > &x1, const Point< spacedim > &x2) const
virtual DerivativeForm< 1, chartdim, spacedim > push_forward_gradient(const Point< chartdim > &chart_point) const
Quadrature< MeshIteratorType::AccessorType::space_dimension > get_default_quadrature(const MeshIteratorType &iterator, const bool with_interpolation=false)
virtual Point< spacedim > project_to_manifold(const ArrayView< const Point< spacedim >> &surrounding_points, const Point< spacedim > &candidate) const
#define Assert(cond, exc)
static ::ExceptionBase & ExcPeriodicBox(int arg1, Point< spacedim > arg2, double arg3)
const Tensor< 1, chartdim > & get_periodicity() const
virtual Point< spacedim > project_to_manifold(const ArrayView< const Point< spacedim >> &points, const Point< spacedim > &candidate) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
typename IteratorSelector::quad_iterator quad_iterator
virtual Point< spacedim > get_intermediate_point(const Point< spacedim > &p1, const Point< spacedim > &p2, const double w) const
const FlatManifold< chartdim, chartdim > sub_manifold
virtual void get_new_points(const ArrayView< const Point< spacedim >> &surrounding_points, const Table< 2, double > &weights, ArrayView< Point< spacedim >> new_points) const override
virtual Tensor< 1, spacedim > get_tangent_vector(const Point< spacedim > &x1, const Point< spacedim > &x2) const override
virtual void get_new_points(const ArrayView< const Point< spacedim >> &surrounding_points, const Table< 2, double > &weights, ArrayView< Point< spacedim >> new_points) const
virtual Tensor< 1, spacedim > get_tangent_vector(const Point< spacedim > &x1, const Point< spacedim > &x2) const override
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
virtual Point< spacedim > get_new_point_on_quad(const typename Triangulation< dim, spacedim >::quad_iterator &quad) const
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
virtual void get_normals_at_vertices(const typename Triangulation< dim, spacedim >::face_iterator &face, typename Manifold< dim, spacedim >::FaceVertexNormals &face_vertex_normals) const override
virtual Point< spacedim > push_forward(const Point< chartdim > &chart_point) const =0
std::array< Tensor< 1, spacedim >, GeometryInfo< dim >::vertices_per_face > FaceVertexNormals
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const
#define DeclException3(Exception3, type1, type2, type3, outsequence)
virtual void get_new_points(const ArrayView< const Point< spacedim >> &surrounding_points, const Table< 2, double > &weights, ArrayView< Point< spacedim >> new_points) const override
ChartManifold(const Tensor< 1, chartdim > &periodicity=Tensor< 1, chartdim >())
Point< spacedim > get_new_point_on_face(const typename Triangulation< dim, spacedim >::face_iterator &face) const
virtual void get_normals_at_vertices(const typename Triangulation< dim, spacedim >::face_iterator &face, FaceVertexNormals &face_vertex_normals) const
virtual Point< chartdim > pull_back(const Point< spacedim > &space_point) const =0
virtual Point< spacedim > get_intermediate_point(const Point< spacedim > &p1, const Point< spacedim > &p2, const double w) const override
const Tensor< 1, spacedim > periodicity
static ::ExceptionBase & ExcInternalError()
virtual ~Manifold() override=default
Point< spacedim > get_new_point_on_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const