Reference documentation for deal.II version Git 1aa49a030b 2021-12-07 05:12:24 -0500
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Functions
TriangulationDescription::Utilities Namespace Reference

Functions

template<int dim, int spacedim = dim>
Description< dim, spacedim > create_description_from_triangulation (const ::Triangulation< dim, spacedim > &tria, const MPI_Comm &comm, const TriangulationDescription::Settings settings=TriangulationDescription::Settings::default_setting, const unsigned int my_rank_in=numbers::invalid_unsigned_int)
 
template<int dim, int spacedim>
Description< dim, spacedim > create_description_from_triangulation (const Triangulation< dim, spacedim > &tria, const LinearAlgebra::distributed::Vector< double > &partition, const TriangulationDescription::Settings settings=TriangulationDescription::Settings::default_setting)
 
template<int dim, int spacedim>
Description< dim, spacedim > create_description_from_triangulation (const Triangulation< dim, spacedim > &tria, const LinearAlgebra::distributed::Vector< double > &partition, const std::vector< LinearAlgebra::distributed::Vector< double >> &mg_partitions, const TriangulationDescription::Settings settings=TriangulationDescription::Settings::default_setting)
 
template<int dim, int spacedim = dim>
Description< dim, spacedim > create_description_from_triangulation_in_groups (const std::function< void(::Triangulation< dim, spacedim > &)> &serial_grid_generator, const std::function< void(::Triangulation< dim, spacedim > &, const MPI_Comm &, const unsigned int)> &serial_grid_partitioner, const MPI_Comm &comm, const int group_size=1, const typename Triangulation< dim, spacedim >::MeshSmoothing smoothing=::Triangulation< dim, spacedim >::none, const TriangulationDescription::Settings setting=TriangulationDescription::Settings::default_setting)
 

Detailed Description

A namespace for TriangulationDescription::Description utility functions.

Function Documentation

◆ create_description_from_triangulation() [1/3]

template<int dim, int spacedim = dim>
Description< dim, spacedim > TriangulationDescription::Utilities::create_description_from_triangulation ( const ::Triangulation< dim, spacedim > &  tria,
const MPI_Comm comm,
const TriangulationDescription::Settings  settings = TriangulationDescription::Settings::default_setting,
const unsigned int  my_rank_in = numbers::invalid_unsigned_int 
)

Construct TriangulationDescription::Description from a given partitioned triangulation tria and a specified process. The input triangulation can be either a serial triangulation of type Triangulation which has been colored (subdomain_id and/or level_subdomain_id has been set) or a distributed triangulation of type parallel::distributed::Triangulation, where the partitioning is adopted unaltered.

Example for a serial Triangulation:

// fill serial triangulation (e.g., read external mesh)
grid_in.attach_triangulation(tria_base);
grid_in.read(file_name);
// partition serial triangulation
// create description
// create triangulation
tria_pft.create_triangulation(description);

Example for parallel::distributed::Triangulation (partitioning can be skipped, since the triangulation has already been partitioned by p4est):

// fill tria_base (not shown)
// create triangulation
// create triangulation
tria_pft.create_triangulation(description);
Parameters
triaPartitioned input triangulation.
commMPI_Communicator to be used. In the case of parallel::distributed::Triangulation, the communicators have to match.
settingsSee the description of the Settings enumerator.
my_rank_inConstruct Description for the specified rank (only working for serial triangulations that have been partitioned by functions like GridTools::partition_triangulation()).
Returns
Description to be used to set up a Triangulation.
Note
If construct_multigrid_hierarchy is set in the settings, the source triangulation has to be setup with limit_level_difference_at_vertices.

Definition at line 679 of file tria_description.cc.

◆ create_description_from_triangulation() [2/3]

template<int dim, int spacedim>
Description< dim, spacedim > TriangulationDescription::Utilities::create_description_from_triangulation ( const Triangulation< dim, spacedim > &  tria,
const LinearAlgebra::distributed::Vector< double > &  partition,
const TriangulationDescription::Settings  settings = TriangulationDescription::Settings::default_setting 
)

Similar to the above function but the owner of active cells are provided by a cell vector (see also parallel::TriangulationBase::global_active_cell_index_partitioner() and CellAccessor::global_active_cell_index()). This function allows to repartition distributed Triangulation objects.

If the setup of multigrid levels is requested, they are partitioned according to a first-child policy.

Note
The communicator is extracted from the vector partition.
The triangulation tria can be set up on a subcommunicator of the communicator of partitioner. All processes that are not part of that subcommunicator need to set up the local triangulation with the special-purpose communicator MPI_COMM_NULL.
The multgrid levels are currently not constructed, since partition only describes the partitioning of the active level.

Definition at line 873 of file tria_description.cc.

◆ create_description_from_triangulation() [3/3]

template<int dim, int spacedim>
Description< dim, spacedim > TriangulationDescription::Utilities::create_description_from_triangulation ( const Triangulation< dim, spacedim > &  tria,
const LinearAlgebra::distributed::Vector< double > &  partition,
const std::vector< LinearAlgebra::distributed::Vector< double >> &  mg_partitions,
const TriangulationDescription::Settings  settings = TriangulationDescription::Settings::default_setting 
)

Similar to the above function but allowing the user to prescribe the partitioning of the multigrid levels.

Definition at line 940 of file tria_description.cc.

◆ create_description_from_triangulation_in_groups()

template<int dim, int spacedim = dim>
Description< dim, spacedim > TriangulationDescription::Utilities::create_description_from_triangulation_in_groups ( const std::function< void(::Triangulation< dim, spacedim > &)> &  serial_grid_generator,
const std::function< void(::Triangulation< dim, spacedim > &, const MPI_Comm &, const unsigned int)> &  serial_grid_partitioner,
const MPI_Comm comm,
const int  group_size = 1,
const typename Triangulation< dim, spacedim >::MeshSmoothing  smoothing = ::Triangulation<dim, spacedim>::none,
const TriangulationDescription::Settings  setting = TriangulationDescription::Settings::default_setting 
)

Construct a TriangulationDescription::Description. In contrast to the function above, this function is also responsible for creating a serial triangulation and for its partitioning (by calling the provided std::function objects). Internally only selected processes ( every n-th/each root of a group of size group_size) create a serial triangulation and the TriangulationDescription::Description for all processes in its group, which is communicated.

This function can also be used to read an external mesh only once (by the root process and a group consisting all processes). The following code snippet shows a modified version of the example provided in the documentation of create_description_from_triangulation(). Function calls that only need to be performed by the root process (read and partition mesh) have been moved into std::function objects.

// create and partition serial triangulation and create description
TriangulationDescription::Utilities::
create_description_from_triangulation_in_groups<dim, spacedim>(
[file_name](auto &tria_base) {
grid_in.attach_triangulation(tria_base);
grid_in.read(file_name);
},
[](auto &tria_base, const auto comm, const auto group_size) {
},
// create triangulation
tria_pft.create_triangulation(description);
Note
A reasonable group size is the size of a NUMA domain or the size of a compute node.
Parameters
serial_grid_generatorA function which creates a serial triangulation.
serial_grid_partitionerA function which can partition a serial triangulation, i.e., sets the sudomain_ids of the active cells. The function takes as the first argument a serial triangulation, as the second argument the MPI communicator, and as the third argument the group size.
commMPI communicator.
group_sizeThe size of each group.
smoothingMesh smoothing type.
settingSee the description of the Settings enumerator.
Returns
Description to be used to set up a Triangulation.
Note
If construct_multigrid_hierarchy is set in the settings, the smoothing parameter is extended with the limit_level_difference_at_vertices flag.

Definition at line 743 of file tria_description.cc.