- // This anonymous namespace contains utility functions to extract the
- // triangulation from any container such as DoFHandler
- // and the like
- namespace
- {
- template<int dim, int spacedim>
- const Triangulation<dim, spacedim> &
- get_tria(const Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, int spacedim>
- const Triangulation<dim, spacedim> &
- get_tria(const parallel::distributed::Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, int spacedim>
- const Triangulation<dim, spacedim> &
- get_tria(const parallel::shared::Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, template<int, int> class Container, int spacedim>
- const Triangulation<dim,spacedim> &
- get_tria(const Container<dim,spacedim> &container)
- {
- return container.get_tria();
- }
-
-
- template<int dim, int spacedim>
- Triangulation<dim, spacedim> &
- get_tria(Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, int spacedim>
- Triangulation<dim, spacedim> &
- get_tria(parallel::distributed::Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, int spacedim>
- Triangulation<dim, spacedim> &
- get_tria(parallel::shared::Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, template<int, int> class Container, int spacedim>
- const Triangulation<dim,spacedim> &
- get_tria(Container<dim,spacedim> &container)
- {
- return container.get_tria();
- }
- }
-
-
-
template <template <int,int> class Container, int dim, int spacedim>
#ifndef _MSC_VER
std::map<typename Container<dim-1,spacedim>::cell_iterator,
mapping; // temporary map for level==0
- std::vector< bool > touched (get_tria(volume_mesh).n_vertices(), false);
+ std::vector< bool > touched (volume_mesh.get_tria().n_vertices(), false);
std::vector< CellData< boundary_dim > > cells;
SubCellData subcell_data;
std::vector< Point<spacedim> > vertices;
// create level 0 surface triangulation
Assert (cells.size() > 0, ExcMessage ("No boundary faces selected"));
- const_cast<Triangulation<dim-1,spacedim>&>(get_tria(surface_mesh))
+ const_cast<Triangulation<dim-1,spacedim>&>(surface_mesh.get_tria())
.create_triangulation (vertices, cells, subcell_data);
// Make the actual mapping
if (changed)
{
- const_cast<Triangulation<dim-1,spacedim>&>(get_tria(surface_mesh))
+ const_cast<Triangulation<dim-1,spacedim>&>(surface_mesh.get_tria())
.execute_coarsening_and_refinement();
for (typename Container<dim-1,spacedim>::cell_iterator
namespace GridTools
{
- // This anonymous namespace contains utility functions to extract the
- // triangulation from any container such as DoFHandler and the like
- namespace
- {
- template<int dim, int spacedim>
- const Triangulation<dim, spacedim> &
- get_tria(const Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, int spacedim>
- const Triangulation<dim, spacedim> &
- get_tria(const parallel::distributed::Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, int spacedim>
- const Triangulation<dim, spacedim> &
- get_tria(const parallel::shared::Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
-
- template<int dim, template<int, int> class Container, int spacedim>
- const Triangulation<dim,spacedim> &
- get_tria(const Container<dim,spacedim> &container)
- {
- return container.get_tria();
- }
-
-
- template<int dim, int spacedim>
- Triangulation<dim, spacedim> &
- get_tria(Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, int spacedim>
- Triangulation<dim, spacedim> &
- get_tria(parallel::distributed::Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
- template<int dim, int spacedim>
- Triangulation<dim, spacedim> &
- get_tria(parallel::shared::Triangulation<dim, spacedim> &tria)
- {
- return tria;
- }
-
-
- template<int dim, template<int, int> class Container, int spacedim>
- const Triangulation<dim,spacedim> &
- get_tria(Container<dim,spacedim> &container)
- {
- return container.get_tria();
- }
- }
-
-
-
template <int dim, int spacedim>
double
diameter (const Triangulation<dim, spacedim> &tria)
// triangulation from the
// container and determine vertices
// and used vertices
- const Triangulation<dim, spacedim> &tria = get_tria(container);
+ const Triangulation<dim, spacedim> &tria = container.get_tria();
const std::vector< Point<spacedim> > &vertices = tria.get_vertices();
const std::vector< bool > &used = tria.get_used_vertices();
// make sure that the given vertex is
// an active vertex of the underlying
// triangulation
- Assert(vertex < get_tria(container).n_vertices(),
- ExcIndexRange(0,get_tria(container).n_vertices(),vertex));
- Assert(get_tria(container).get_used_vertices()[vertex],
+ Assert(vertex < container.get_tria().n_vertices(),
+ ExcIndexRange(0,container.get_tria().n_vertices(),vertex));
+ Assert(container.get_tria().get_used_vertices()[vertex],
ExcVertexNotUsed(vertex));
// use a set instead of a vector
// the cell and have not searched
// every cell in the triangulation,
// we keep on looking.
- const unsigned int n_active_cells = get_tria(container).n_active_cells();
+ const unsigned int n_active_cells = container.get_tria().n_active_cells();
bool found = false;
unsigned int cells_searched = 0;
while (!found && cells_searched < n_active_cells)
// the cell and have not searched
// every cell in the triangulation,
// we keep on looking.
- const unsigned int n_cells =get_tria(container).n_cells();
+ const unsigned int n_cells = container.get_tria().n_cells();
bool found = false;
unsigned int cells_searched = 0;
while (!found && cells_searched < n_cells)
const std_cxx11::function<bool (const typename Container::active_cell_iterator &)> &predicate)
{
std::vector<typename Container::active_cell_iterator> active_halo_layer;
- std::vector<bool> locally_active_vertices_on_subdomain (get_tria(container).n_vertices(),
+ std::vector<bool> locally_active_vertices_on_subdomain (container.get_tria().n_vertices(),
false);
// Find the cells for which the predicate is true
have_same_coarse_mesh (const Container &mesh_1,
const Container &mesh_2)
{
- return have_same_coarse_mesh (get_tria(mesh_1),
- get_tria(mesh_2));
+ return have_same_coarse_mesh (mesh_1.get_tria(),
+ mesh_2.get_tria());
}
DEAL_II_NAMESPACE_OPEN
-namespace
-{
-// helper function to acquire the number of levels within a grid
- template <class GridClass>
- unsigned int
- get_n_levels (const GridClass &grid)
- {
- // all objects we deal with are able
- // to deliver a pointer to the
- // underlying triangulation.
- //
- // for the triangulation as GridClass
- // of this object, there is a
- // specialization of this function
- return grid.get_tria().n_levels();
- }
-
-
-// specialization for triangulation classes
- template <int dim, int spacedim>
- unsigned int
- get_n_levels (const Triangulation<dim, spacedim> &grid)
- {
- // if GridClass==Triangulation, then
- // we can ask directly.
- return grid.n_levels();
- }
-
- template <int dim, int spacedim>
- unsigned int
- get_n_levels (const parallel::distributed::Triangulation<dim, spacedim> &grid)
- {
- // if GridClass==Triangulation, then
- // we can ask directly.
- return grid.n_levels();
- }
-
- template <int dim, int spacedim>
- unsigned int
- get_n_levels (const parallel::shared::Triangulation<dim, spacedim> &grid)
- {
- // if GridClass==Triangulation, then
- // we can ask directly.
- return grid.n_levels();
- }
-}
-
-
template <class GridClass>
InterGridMap<GridClass>::InterGridMap ()
:
// then set up the containers from
// scratch and fill them with end-iterators
- const unsigned int n_levels = get_n_levels(source_grid);
+ const unsigned int n_levels = source_grid.get_tria().n_levels();
mapping.resize (n_levels);
for (unsigned int level=0; level<n_levels; ++level)
{