#include <deal.II/base/quadrature_lib.h>
#include <deal.II/base/work_stream.h>
-#include <deal.II/distributed/tria.h>
+#include <deal.II/distributed/tria_base.h>
#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/dofs/dof_handler.h>
const types::material_id material_id,
const Strategy strategy)
{
-#ifdef DEAL_II_WITH_P4EST
- if (dynamic_cast<const parallel::distributed::Triangulation<dim, spacedim> *>(
- &dof_handler.get_triangulation()) != nullptr)
- Assert((subdomain_id_ == numbers::invalid_subdomain_id) ||
- (subdomain_id_ ==
- dynamic_cast<
- const parallel::distributed::Triangulation<dim, spacedim> &>(
- dof_handler.get_triangulation())
- .locally_owned_subdomain()),
- ExcMessage(
- "For parallel distributed triangulations, the only "
- "valid subdomain_id that can be passed here is the "
- "one that corresponds to the locally owned subdomain id."));
-
- const types::subdomain_id subdomain_id =
- ((dynamic_cast<const parallel::distributed::Triangulation<dim, spacedim> *>(
- &dof_handler.get_triangulation()) != nullptr) ?
- dynamic_cast<const parallel::distributed::Triangulation<dim, spacedim>
- &>(dof_handler.get_triangulation())
- .locally_owned_subdomain() :
- subdomain_id_);
-#else
- const types::subdomain_id subdomain_id = subdomain_id_;
-#endif
+ types::subdomain_id subdomain_id = numbers::invalid_subdomain_id;
+ if (const auto *triangulation = dynamic_cast<
+ const parallel::DistributedTriangulationBase<dim, spacedim> *>(
+ &dof_handler.get_triangulation()))
+ {
+ Assert((subdomain_id_ == numbers::invalid_subdomain_id) ||
+ (subdomain_id_ == triangulation->locally_owned_subdomain()),
+ ExcMessage(
+ "For distributed Triangulation objects and associated "
+ "DoFHandler objects, asking for any subdomain other than the "
+ "locally owned one does not make sense."));
+ subdomain_id = triangulation->locally_owned_subdomain();
+ }
+ else
+ {
+ subdomain_id = subdomain_id_;
+ }
const unsigned int n_components = dof_handler.get_fe(0).n_components();
(void)n_components;
Assert(sparsity.n_cols() == n_dofs,
ExcDimensionMismatch(sparsity.n_cols(), n_dofs));
- // If we have a distributed::Triangulation only allow locally_owned
+ // If we have a distributed Triangulation only allow locally_owned
// subdomain. Not setting a subdomain is also okay, because we skip
// ghost cells in the loop below.
- Assert((dof.get_triangulation().locally_owned_subdomain() ==
- numbers::invalid_subdomain_id) ||
- (subdomain_id == numbers::invalid_subdomain_id) ||
- (subdomain_id ==
- dof.get_triangulation().locally_owned_subdomain()),
- ExcMessage(
- "For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any subdomain other "
- "than the locally owned one does not make sense."));
+ if (const auto *triangulation = dynamic_cast<
+ const parallel::DistributedTriangulationBase<dim, spacedim> *>(
+ &dof.get_triangulation()))
+ {
+ Assert((subdomain_id == numbers::invalid_subdomain_id) ||
+ (subdomain_id == triangulation->locally_owned_subdomain()),
+ ExcMessage(
+ "For distributed Triangulation objects and associated "
+ "DoFHandler objects, asking for any subdomain other than the "
+ "locally owned one does not make sense."));
+ }
std::vector<types::global_dof_index> dofs_on_this_cell;
dofs_on_this_cell.reserve(dof.get_fe_collection().max_dofs_per_cell());
ExcDimensionMismatch(couplings.n_cols(),
dof.get_fe(0).n_components()));
- // If we have a distributed::Triangulation only allow locally_owned
+ // If we have a distributed Triangulation only allow locally_owned
// subdomain. Not setting a subdomain is also okay, because we skip
// ghost cells in the loop below.
- Assert((dof.get_triangulation().locally_owned_subdomain() ==
- numbers::invalid_subdomain_id) ||
- (subdomain_id == numbers::invalid_subdomain_id) ||
- (subdomain_id ==
- dof.get_triangulation().locally_owned_subdomain()),
- ExcMessage(
- "For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any subdomain other "
- "than the locally owned one does not make sense."));
+ if (const auto *triangulation = dynamic_cast<
+ const parallel::DistributedTriangulationBase<dim, spacedim> *>(
+ &dof.get_triangulation()))
+ {
+ Assert((subdomain_id == numbers::invalid_subdomain_id) ||
+ (subdomain_id == triangulation->locally_owned_subdomain()),
+ ExcMessage(
+ "For distributed Triangulation objects and associated "
+ "DoFHandler objects, asking for any subdomain other than the "
+ "locally owned one does not make sense."));
+ }
const hp::FECollection<dim, spacedim> &fe_collection =
dof.get_fe_collection();
AssertDimension(sparsity.n_rows(), n_dofs);
AssertDimension(sparsity.n_cols(), n_dofs);
- // If we have a distributed::Triangulation only allow locally_owned
+ // If we have a distributed Triangulation only allow locally_owned
// subdomain. Not setting a subdomain is also okay, because we skip
// ghost cells in the loop below.
- Assert((dof.get_triangulation().locally_owned_subdomain() ==
- numbers::invalid_subdomain_id) ||
- (subdomain_id == numbers::invalid_subdomain_id) ||
- (subdomain_id ==
- dof.get_triangulation().locally_owned_subdomain()),
- ExcMessage(
- "For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any subdomain other "
- "than the locally owned one does not make sense."));
+ if (const auto *triangulation = dynamic_cast<
+ const parallel::DistributedTriangulationBase<dim, spacedim> *>(
+ &dof.get_triangulation()))
+ {
+ Assert((subdomain_id == numbers::invalid_subdomain_id) ||
+ (subdomain_id == triangulation->locally_owned_subdomain()),
+ ExcMessage(
+ "For distributed Triangulation objects and associated "
+ "DoFHandler objects, asking for any subdomain other than the "
+ "locally owned one does not make sense."));
+ }
std::vector<types::global_dof_index> dofs_on_this_cell;
std::vector<types::global_dof_index> dofs_on_other_cell;
Assert(flux_mask.n_cols() == n_comp,
ExcDimensionMismatch(flux_mask.n_cols(), n_comp));
- // If we have a distributed::Triangulation only allow locally_owned
+ // If we have a distributed Triangulation only allow locally_owned
// subdomain. Not setting a subdomain is also okay, because we skip
// ghost cells in the loop below.
- Assert((dof.get_triangulation().locally_owned_subdomain() ==
- numbers::invalid_subdomain_id) ||
- (subdomain_id == numbers::invalid_subdomain_id) ||
- (subdomain_id ==
- dof.get_triangulation().locally_owned_subdomain()),
- ExcMessage(
- "For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any subdomain other "
- "than the locally owned one does not make sense."));
+ if (const auto *triangulation = dynamic_cast<
+ const parallel::DistributedTriangulationBase<dim, spacedim> *>(
+ &dof.get_triangulation()))
+ {
+ Assert((subdomain_id == numbers::invalid_subdomain_id) ||
+ (subdomain_id == triangulation->locally_owned_subdomain()),
+ ExcMessage(
+ "For distributed Triangulation objects and associated "
+ "DoFHandler objects, asking for any subdomain other than the "
+ "locally owned one does not make sense."));
+ }
Assert(
face_has_flux_coupling,
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/base/work_stream.h>
-#include <deal.II/distributed/tria.h>
+#include <deal.II/distributed/tria_base.h>
#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/dofs/dof_handler.h>
const Strategy strategy)
{
AssertThrow(strategy == cell_diameter_over_24, ExcNotImplemented());
- using number = typename InputVector::value_type;
-#ifdef DEAL_II_WITH_P4EST
- if (dynamic_cast<const parallel::distributed::Triangulation<1, spacedim> *>(
- &dof_handler.get_triangulation()) != nullptr)
- Assert((subdomain_id_ == numbers::invalid_subdomain_id) ||
- (subdomain_id_ ==
- dynamic_cast<
- const parallel::distributed::Triangulation<1, spacedim> &>(
- dof_handler.get_triangulation())
- .locally_owned_subdomain()),
- ExcMessage(
- "For parallel distributed triangulations, the only "
- "valid subdomain_id that can be passed here is the "
- "one that corresponds to the locally owned subdomain id."));
-
- const types::subdomain_id subdomain_id =
- ((dynamic_cast<const parallel::distributed::Triangulation<1, spacedim> *>(
- &dof_handler.get_triangulation()) != nullptr) ?
- dynamic_cast<const parallel::distributed::Triangulation<1, spacedim> &>(
- dof_handler.get_triangulation())
- .locally_owned_subdomain() :
- subdomain_id_);
-#else
- const types::subdomain_id subdomain_id = subdomain_id_;
-#endif
+ using number = typename InputVector::value_type;
+ types::subdomain_id subdomain_id = numbers::invalid_subdomain_id;
+ if (const auto *triangulation = dynamic_cast<
+ const parallel::DistributedTriangulationBase<1, spacedim> *>(
+ &dof_handler.get_triangulation()))
+ {
+ Assert((subdomain_id_ == numbers::invalid_subdomain_id) ||
+ (subdomain_id_ == triangulation->locally_owned_subdomain()),
+ ExcMessage(
+ "For distributed Triangulation objects and associated "
+ "DoFHandler objects, asking for any subdomain other than the "
+ "locally owned one does not make sense."));
+ subdomain_id = triangulation->locally_owned_subdomain();
+ }
+ else
+ {
+ subdomain_id = subdomain_id_;
+ }
const unsigned int n_components = dof_handler.get_fe(0).n_components();
const unsigned int n_solution_vectors = solutions.size();