16 #ifndef moonolith_tools_include_h
17 #define moonolith_tools_include_h
21 #ifdef DEAL_II_WITH_PARMOONOLITH
33 # include <moonolith_build_quadrature.hpp>
34 # include <moonolith_convex_decomposition.hpp>
35 # include <moonolith_intersect_polyhedra.hpp>
36 # include <moonolith_map_quadrature.hpp>
37 # include <moonolith_mesh_io.hpp>
38 # include <moonolith_par_l2_transfer.hpp>
39 # include <moonolith_polygon.hpp>
40 # include <moonolith_vector.hpp>
41 # include <par_moonolith.hpp>
56 template <
int dim,
typename NumberType>
57 inline dealii::Point<dim, NumberType>
58 to_dealii(
const moonolith::Vector<NumberType, dim> &p)
60 dealii::Point<dim, NumberType> result;
61 for (
unsigned int i = 0; i < dim; ++i)
69 template <
int dim,
typename NumberType>
70 inline moonolith::Vector<NumberType, dim>
71 to_moonolith(
const dealii::Point<dim, NumberType> &p)
73 moonolith::Vector<NumberType, dim> result;
74 for (
unsigned int i = 0; i < dim; ++i)
84 inline dealii::Quadrature<dim>
85 to_dealii(
const moonolith::Quadrature<double, dim> &q)
87 const auto points = q.points;
88 const auto weights = q.weights;
89 const unsigned int quad_size = points.size();
90 std::vector<dealii::Point<dim>> dealii_points(quad_size);
91 std::vector<double> dealii_weights(quad_size);
92 for (
unsigned int i = 0; i < quad_size; ++i)
94 dealii_points[i] = to_dealii(points[i]);
95 dealii_weights[i] = weights[i];
97 return dealii::Quadrature<dim>(dealii_points, dealii_weights);
105 inline Line<double, dim>
110 Line<double, dim> line;
111 line.p0 = to_moonolith(vertices[0]);
112 line.p1 = to_moonolith(vertices[1]);
120 template <
int spacedim>
121 inline Polygon<double, spacedim>
125 static_assert(2 <= spacedim,
"2 must be <= spacedim");
127 Polygon<double, spacedim> poly;
130 poly.points = {to_moonolith(vertices[0]),
131 to_moonolith(vertices[1]),
132 to_moonolith(vertices[2])};
134 poly.points = {to_moonolith(vertices[0]),
135 to_moonolith(vertices[1]),
136 to_moonolith(vertices[3]),
137 to_moonolith(vertices[2])};
147 inline Polyhedron<double>
152 Polyhedron<double> poly;
156 poly.el_index = {0, 2, 1, 0, 3, 2, 0, 1, 3, 1, 2, 3};
157 poly.el_ptr = {0, 3, 6, 9, 12};
159 poly.points = {to_moonolith(vertices[0]),
160 to_moonolith(vertices[1]),
161 to_moonolith(vertices[2]),
162 to_moonolith(vertices[3])};
168 make_cube(to_moonolith(vertices[0]), to_moonolith(vertices[7]), poly);
169 poly.points = {to_moonolith(vertices[0]),
170 to_moonolith(vertices[1]),
171 to_moonolith(vertices[3]),
172 to_moonolith(vertices[2]),
173 to_moonolith(vertices[4]),
174 to_moonolith(vertices[5]),
175 to_moonolith(vertices[7]),
176 to_moonolith(vertices[6])};
181 poly.el_index = {0, 1, 3, 2, 0, 1, 4, 1, 3, 4, 3, 4, 2, 0, 4, 2};
182 poly.el_ptr = {0, 4, 7, 10, 13, 16};
184 poly.points = {to_moonolith(vertices[0]),
185 to_moonolith(vertices[1]),
186 to_moonolith(vertices[2]),
187 to_moonolith(vertices[3]),
188 to_moonolith(vertices[4])};
194 poly.el_index = {0, 1, 2, 0, 1, 4, 3, 1, 4, 5, 2, 0, 2, 5, 3, 3, 4, 5};
195 poly.el_ptr = {0, 3, 7, 11, 15, 18};
197 poly.points = {to_moonolith(vertices[0]),
198 to_moonolith(vertices[1]),
199 to_moonolith(vertices[2]),
200 to_moonolith(vertices[3]),
201 to_moonolith(vertices[4]),
202 to_moonolith(vertices[5])};
223 template <
int spacedim,
int dim,
class T1,
class T2>
224 inline moonolith::Quadrature<double, spacedim>
229 BuildQuadrature<T1, T2> intersect;
231 intersect.apply(ref_quad, t1, t2, out);
252 template <
int dim0,
int dim1,
int spacedim>
253 inline dealii::Quadrature<spacedim>
257 const unsigned int degree,
261 const auto t0 = to_moonolith(cell0, mapping0);
262 const auto t1 = to_moonolith(cell1, mapping1);
263 moonolith::Quadrature<Real,
std::min(dim0, dim1)> ref_quad;
264 moonolith::Gauss::get(degree, ref_quad);
265 auto mquad = compute_intersection<spacedim>(ref_quad, t0, t1);
266 return to_dealii(mquad);
virtual boost::container::small_vector< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
Quadrature< spacedim > compute_intersection(const typename Triangulation< dim0, spacedim >::cell_iterator &cell0, const typename Triangulation< dim1, spacedim >::cell_iterator &cell1, const unsigned int degree, const Mapping< dim0, spacedim > &mapping0=(ReferenceCells::get_hypercube< dim0 >() .template get_default_linear_mapping< dim0, spacedim >()), const Mapping< dim1, spacedim > &mapping1=(ReferenceCells::get_hypercube< dim1 >() .template get_default_linear_mapping< dim1, spacedim >()))
Intersect cell0 and cell1 and construct a Quadrature<spacedim> of degree degreeover the intersection,...
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)