16 #ifndef dealii_tria_manifold_h 17 #define dealii_tria_manifold_h 22 #include <deal.II/base/config.h> 23 #include <deal.II/base/array_view.h> 24 #include <deal.II/base/subscriptor.h> 25 #include <deal.II/base/quadrature_lib.h> 26 #include <deal.II/base/thread_management.h> 27 #include <deal.II/base/point.h> 28 #include <deal.II/base/derivative_form.h> 29 #include <deal.II/grid/tria.h> 31 DEAL_II_NAMESPACE_OPEN
34 template <
int,
typename>
class Table;
48 template <
typename MeshIteratorType>
103 template <
typename MeshIteratorType>
107 const bool with_interpolation =
false);
151 template <
typename MeshIteratorType>
152 std::pair<std::array<Point<MeshIteratorType::AccessorType::space_dimension>,
153 n_default_points_per_cell<MeshIteratorType>()>,
154 std::array<
double, n_default_points_per_cell<MeshIteratorType>()> >
156 const bool with_interpolation =
false);
322 template <
int dim,
int spacedim=dim>
328 static_assert (dim<=spacedim,
329 "The dimension <dim> of a Manifold must be less than or " 330 "equal to the space dimension <spacedim> in which it lives.");
358 virtual std::unique_ptr<Manifold<dim,spacedim> >
clone()
const = 0;
386 const double w)
const;
668 template <
int dim,
int spacedim=dim>
705 virtual std::unique_ptr<Manifold<dim,spacedim> >
clone()
const override;
835 <<
"The component number " << arg1 <<
" of the point [ " << arg2
836 <<
" ] is not in the interval [ 0, " << arg3 <<
"), bailing out.");
934 template <
int dim,
int spacedim=dim,
int chartdim=dim>
939 static_assert (dim<=spacedim,
940 "The dimension <dim> of a ChartManifold must be less than or " 941 "equal to the space dimension <spacedim> in which it lives.");
973 const double w)
const override;
1178 template <
typename MeshIteratorType>
1181 const bool with_interpolation)
1184 static const int spacedim = MeshIteratorType::AccessorType::space_dimension;
1186 (std::vector<Point<spacedim>>(points_and_weights.first.begin(),
1187 points_and_weights.first.end()),
1188 std::vector<double>(points_and_weights.second.begin(),
1189 points_and_weights.second.end()));
1194 template <
typename MeshIteratorType>
1195 std::pair<std::array<Point<MeshIteratorType::AccessorType::space_dimension>,
1196 n_default_points_per_cell<MeshIteratorType>()>,
1197 std::array<
double, n_default_points_per_cell<MeshIteratorType>()> >
1199 const bool with_interpolation)
1201 const int dim = MeshIteratorType::AccessorType::structure_dimension;
1202 const int spacedim = MeshIteratorType::AccessorType::space_dimension;
1203 constexpr std::size_t points_per_cell = n_default_points_per_cell<MeshIteratorType>();
1205 std::pair<std::array<Point<spacedim>, points_per_cell>, std::array<double, points_per_cell> >
1218 points_weights.first[0] = iterator->vertex(0);
1219 points_weights.second[0] = .5;
1220 points_weights.first[1] = iterator->vertex(1);
1221 points_weights.second[1] = .5;
1227 for (
unsigned int i=0; i<4; ++i)
1229 points_weights.first[i] = iterator->vertex(i);
1230 points_weights.first[4+i] = ( iterator->line(i)->has_children() ?
1231 iterator->line(i)->child(0)->vertex(1) :
1232 iterator->line(i)->get_manifold().get_new_point_on_line(iterator->line(i)) );
1235 if (with_interpolation)
1237 std::fill(points_weights.second.begin(), points_weights.second.begin()+4, -0.25);
1238 std::fill(points_weights.second.begin()+4, points_weights.second.end(), 0.5);
1241 std::fill(points_weights.second.begin(), points_weights.second.end(), 1.0/8.0);
1247 const unsigned int np =
1253 auto *sp3 =
reinterpret_cast<std::array<Point<3>, n_default_points_per_cell<decltype(hex)>()
> *>
1254 (&points_weights.first);
1263 if (with_interpolation)
1265 for (
unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i, ++j)
1267 (*sp3)[j] = hex->vertex(i);
1268 points_weights.second[j] = 1.0/8.0;
1270 for (
unsigned int i=0; i<GeometryInfo<dim>::lines_per_cell; ++i, ++j)
1272 (*sp3)[j] = (hex->line(i)->has_children() ?
1273 hex->line(i)->child(0)->vertex(1) :
1274 hex->line(i)->get_manifold().get_new_point_on_line(hex->line(i)));
1275 points_weights.second[j] = -1.0/4.0;
1277 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i, ++j)
1279 (*sp3)[j] = (hex->quad(i)->has_children() ?
1280 hex->quad(i)->isotropic_child(0)->vertex(3) :
1281 hex->quad(i)->get_manifold().get_new_point_on_quad(hex->quad(i)));
1282 points_weights.second[j] = 1.0/2.0;
1288 std::fill(points_weights.second.begin(), points_weights.second.end(), 1.0/np);
1295 return points_weights;
1301 DEAL_II_NAMESPACE_CLOSE
const Tensor< 1, spacedim > periodicity
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
const FlatManifold< chartdim, chartdim > sub_manifold
const Tensor< 1, spacedim > & get_periodicity() const
virtual Point< spacedim > get_new_point_on_hex(const typename Triangulation< dim, spacedim >::hex_iterator &hex) const
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 std::unique_ptr< Manifold< dim, spacedim > > clone() const =0
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)
virtual ~Manifold()=default
static ::ExceptionBase & ExcPeriodicBox(int arg1, Point< spacedim > arg2, double arg3)
Tensor< 1, spacedim > FaceVertexNormals[GeometryInfo< dim >::vertices_per_face]
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
virtual Point< spacedim > get_intermediate_point(const Point< spacedim > &p1, const Point< spacedim > &p2, const double w) const
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
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
static ::ExceptionBase & ExcInternalError()
Point< spacedim > get_new_point_on_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const