// First, create a local mass matrix for the unit cell
Triangulation<dim, spacedim> tr;
- ReferenceCell::make_triangulation(reference_cell_type, tr);
+ GridGenerator::reference_cell(reference_cell_type, tr);
const auto &mapping =
reference_cell_type.template get_default_linear_mapping<dim, spacedim>();
// Set up meshes, one with a single
// reference cell and refine it once
Triangulation<dim, spacedim> tria;
- ReferenceCell::make_triangulation(reference_cell_type, tria);
+ GridGenerator::reference_cell(reference_cell_type, tria);
tria.begin_active()->set_refine_flag(RefinementCase<dim>(ref_case));
tria.execute_coarsening_and_refinement();
simplex(Triangulation<dim, dim> & tria,
const std::vector<Point<dim>> &vertices);
+ /*
+ * Create a (coarse) grid with a single cell of the shape of the provided
+ * reference cell. This is a generalization of the hyper_cube() and simplex()
+ * functions above.
+ */
+ template <int dim, int spacedim>
+ void
+ reference_cell(const ReferenceCell::Type & reference_cell,
+ Triangulation<dim, spacedim> &tria);
+
+
/**
* Same as hyper_cube(), but with the difference that not only one cell is
* created but each coordinate direction is subdivided into @p repetitions
return {};
}
- /*
- * Create a (coarse) grid with a single cell of the shape of the provided
- * reference cell.
- */
- template <int dim, int spacedim>
- void
- make_triangulation(const Type & reference_cell,
- Triangulation<dim, spacedim> &tria);
-
/**
* Return a default linear mapping that works for the given triangulation.
* Internally, this function calls the function above for the reference
}
+
template <int dim, int spacedim>
void
hyper_cube(Triangulation<dim, spacedim> &tria,
hyper_rectangle(tria, p1, p2, colorize);
}
+
+
template <int dim>
void
simplex(Triangulation<dim> &tria, const std::vector<Point<dim>> &vertices)
}
+
+ template <int dim, int spacedim>
+ void
+ reference_cell(const ReferenceCell::Type & reference_cell,
+ Triangulation<dim, spacedim> &tria)
+ {
+ AssertDimension(dim, reference_cell.get_dimension());
+
+ if (reference_cell == ReferenceCell::Type::get_hypercube<dim>())
+ {
+ GridGenerator::hyper_cube(tria, 0, 1);
+ }
+ else if ((dim == 2) && (reference_cell == ReferenceCell::Type::Tri))
+ {
+ const std::vector<Point<spacedim>> vertices = {
+ Point<spacedim>(), // the origin
+ Point<spacedim>::unit_vector(0), // unit point along x-axis
+ Point<spacedim>::unit_vector(1) // unit point along y-axis
+ };
+
+ std::vector<CellData<dim>> cells(1);
+ cells[0].vertices = {0, 1, 2};
+
+ tria.create_triangulation(vertices, cells, {});
+ }
+ else if ((dim == 3) && (reference_cell == ReferenceCell::Type::Tet))
+ {
+ AssertDimension(spacedim, 3);
+
+ static const std::vector<Point<spacedim>> vertices = {
+ {{0.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}};
+
+ std::vector<CellData<dim>> cells(1);
+ cells[0].vertices = {0, 1, 2, 3};
+
+ tria.create_triangulation(vertices, cells, {});
+ }
+ else if ((dim == 3) && (reference_cell == ReferenceCell::Type::Pyramid))
+ {
+ AssertDimension(spacedim, 3);
+
+ static const std::vector<Point<spacedim>> vertices = {
+ {{-1.0, -1.0, 0.0},
+ {+1.0, -1.0, 0.0},
+ {-1.0, +1.0, 0.0},
+ {+1.0, +1.0, 0.0},
+ {+0.0, +0.0, 1.0}}};
+
+ std::vector<CellData<dim>> cells(1);
+ cells[0].vertices = {0, 1, 2, 3, 4};
+
+ tria.create_triangulation(vertices, cells, {});
+ }
+ else if ((dim == 3) && (reference_cell == ReferenceCell::Type::Wedge))
+ {
+ AssertDimension(spacedim, 3);
+
+ static const std::vector<Point<spacedim>> vertices = {
+ {{1.0, 0.0, 0.0},
+ {0.0, 1.0, 0.0},
+ {0.0, 0.0, 0.0},
+ {1.0, 0.0, 1.0},
+ {0.0, 1.0, 1.0},
+ {0.0, 0.0, 1.0}}};
+
+ std::vector<CellData<dim>> cells(1);
+ cells[0].vertices = {0, 1, 2, 3, 4, 5};
+
+ tria.create_triangulation(vertices, cells, {});
+ }
+ else
+ {
+ Assert(false, ExcNotImplemented());
+ }
+ }
+
void moebius(Triangulation<3> & tria,
const unsigned int n_cells,
const unsigned int n_rotations,
namespace GridGenerator
\{
#if deal_II_dimension <= deal_II_space_dimension
+ template void
+ reference_cell<deal_II_dimension, deal_II_space_dimension>(
+ const ReferenceCell::Type &,
+ Triangulation<deal_II_dimension, deal_II_space_dimension> &);
+
template void
convert_hypercube_to_simplex_mesh(
const Triangulation<deal_II_dimension, deal_II_space_dimension> &,
- template <int dim, int spacedim>
- void
- make_triangulation(const Type & reference_cell,
- Triangulation<dim, spacedim> &tria)
- {
- AssertDimension(dim, reference_cell.get_dimension());
-
- if (reference_cell == Type::get_hypercube<dim>())
- {
- GridGenerator::hyper_cube(tria, 0, 1);
- }
- else if ((dim == 2) && (reference_cell == Type::Tri))
- {
- const std::vector<Point<spacedim>> vertices = {
- Point<spacedim>(), // the origin
- Point<spacedim>::unit_vector(0), // unit point along x-axis
- Point<spacedim>::unit_vector(1) // unit point along y-axis
- };
-
- std::vector<CellData<dim>> cells(1);
- cells[0].vertices = {0, 1, 2};
-
- tria.create_triangulation(vertices, cells, {});
- }
- else if ((dim == 3) && (reference_cell == Type::Tet))
- {
- AssertDimension(spacedim, 3);
-
- static const std::vector<Point<spacedim>> vertices = {
- {{0.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}};
-
- std::vector<CellData<dim>> cells(1);
- cells[0].vertices = {0, 1, 2, 3};
-
- tria.create_triangulation(vertices, cells, {});
- }
- else if ((dim == 3) && (reference_cell == Type::Pyramid))
- {
- AssertDimension(spacedim, 3);
-
- static const std::vector<Point<spacedim>> vertices = {
- {{-1.0, -1.0, 0.0},
- {+1.0, -1.0, 0.0},
- {-1.0, +1.0, 0.0},
- {+1.0, +1.0, 0.0},
- {+0.0, +0.0, 1.0}}};
-
- std::vector<CellData<dim>> cells(1);
- cells[0].vertices = {0, 1, 2, 3, 4};
-
- tria.create_triangulation(vertices, cells, {});
- }
- else if ((dim == 3) && (reference_cell == Type::Wedge))
- {
- AssertDimension(spacedim, 3);
-
- static const std::vector<Point<spacedim>> vertices = {
- {{1.0, 0.0, 0.0},
- {0.0, 1.0, 0.0},
- {0.0, 0.0, 0.0},
- {1.0, 0.0, 1.0},
- {0.0, 1.0, 1.0},
- {0.0, 0.0, 1.0}}};
-
- std::vector<CellData<dim>> cells(1);
- cells[0].vertices = {0, 1, 2, 3, 4, 5};
-
- tria.create_triangulation(vertices, cells, {});
- }
- else
- {
- Assert(false, ExcNotImplemented());
- }
- }
-
-
-
template <int dim, int spacedim>
std::unique_ptr<Mapping<dim, spacedim>>
Type::get_default_mapping(const unsigned int degree) const
const auto create_quadrature = [](const Type &reference_cell) {
Triangulation<dim> tria;
- make_triangulation(reference_cell, tria);
+ GridGenerator::reference_cell(reference_cell, tria);
return Quadrature<dim>(tria.get_vertices());
};
for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
{
#if deal_II_dimension <= deal_II_space_dimension
- template void make_triangulation(
- const Type & reference_cell,
- Triangulation<deal_II_dimension, deal_II_space_dimension> &tria);
-
template std::unique_ptr<
Mapping<deal_II_dimension, deal_II_space_dimension>>
Type::get_default_mapping(const unsigned int degree) const;
const Quadrature<dim> q_gauss =
ReferenceCell::get_gauss_type_quadrature<dim>(type, fe.tensor_degree() + 1);
Triangulation<dim, spacedim> tria;
- ReferenceCell::make_triangulation(type, tria);
+ GridGenerator::reference_cell(type, tria);
const Mapping<dim, spacedim> &mapping =
ReferenceCell::get_default_linear_mapping<dim, spacedim>(type);
Triangulation<3> dummy, tria;
- ReferenceCell::make_triangulation(ReferenceCell::Type::Tet, dummy);
+ GridGenerator::reference_cell(ReferenceCell::Type::Tet, dummy);
auto vertices = dummy.get_vertices();