9#include <kernel/geometry/conformal_mesh.hpp>
10#include <kernel/geometry/mesh_part.hpp>
11#include <kernel/geometry/intern/boundary_computer.hpp>
12#include <kernel/util/dist.hpp>
26 template<
typename ParentMesh_>
28 public Factory<MeshPart<ParentMesh_>>
42 static constexpr int shape_dim = ShapeType::dimension;
82 virtual void fill_index_sets(std::unique_ptr<typename BaseClass::IndexSetHolderType>&)
override
103 template<
typename Mesh_>
107 return factory.make();
119 template<
typename Mesh_>
123 return factory.make_unique();
145 template<
typename ParentMesh_>
147 public Factory<MeshPart<ParentMesh_>>
191 void add_mask_facet(
Index facet_idx)
204 const TargetSet& trg_set = part.template get_target_set<facet_dim>();
231 virtual void fill_index_sets(std::unique_ptr<typename BaseClass::IndexSetHolderType>&)
override
270 template<
typename ParentMesh_>
272 public Factory<MeshPart<ParentMesh_>>
302 std::vector<std::pair<int, const MeshType*>>
_halos;
318 void add_mask_facet(
Index facet_idx)
331 const TargetSet& trg_set = part.template get_target_set<facet_dim>();
351 _halos.push_back(std::make_pair(rank, &halo));
385 virtual void fill_index_sets(std::unique_ptr<typename BaseClass::IndexSetHolderType>&)
override
405 std::vector<std::vector<int>> halo_send_bufs(
_halos.size()), halo_recv_bufs(
_halos.size());
408 for(std::size_t i(0); i <
_halos.size(); ++i)
413 count +=
_halos[i].second->get_num_entities(dim);
415 halo_recv_bufs[i].resize(count);
416 halo_send_bufs[i].resize(count);
422 for(std::size_t i(0); i <
_halos.size(); ++i)
423 recv_reqs.
push_back(comm.
irecv(halo_recv_bufs[i].data(), halo_recv_bufs[i].size(),
_halos[i].first));
427 for(std::size_t i(0); i <
_halos.size(); ++i)
428 send_reqs.
push_back(comm.
isend(halo_send_bufs[i].data(), halo_send_bufs[i].size(),
_halos[i].first));
434 for(std::size_t i(0); i <
_halos.size(); ++i)
453 template<
typename MeshNode_>
458 for(
const auto& pair : node.get_halo_map())
460 boundary_factory.
add_halo(pair.first, *pair.second);
462 boundary_factory.
compile(comm);
463 return boundary_factory.make();
475 template<
typename MeshNode_>
480 for(
const auto& pair : node.get_halo_map())
482 boundary_factory.
add_halo(pair.first, *pair.second);
484 boundary_factory.
compile(comm);
485 return boundary_factory.make_unique();
Request irecv(void *buffer, std::size_t count, const Datatype &datatype, int source, int tag=0) const
Nonblocking Receive.
Request isend(const void *buffer, std::size_t count, const Datatype &datatype, int dest, int tag=0) const
Nonblocking Send.
Communication Request vector class.
void push_back(Request &&request)
Inserts a new request at the end of the request vector.
void wait_all()
Blocks until all active requests are fulfilled.
BoundaryFactory implementation.
Intern::BoundaryFaceComputer< ShapeType > _face_computer
a boundary face computer object for the dirty work
MeshType::ShapeType ShapeType
the shape type
static constexpr int shape_dim
the facet dimension
std::array< std::vector< int >, std::size_t(shape_dim)> _bnd_masks
the face masks for each face dimensions
std::array< std::vector< Index >, std::size_t(shape_dim)> _face_idx
the (cell_dim_-1)-dimensional boundary face indices for each face dimension
virtual Index get_num_entities(int dim) override
Returns the number of entities.
virtual void fill_index_sets(std::unique_ptr< typename BaseClass::IndexSetHolderType > &) override
Fills the MeshPart's index_set_holder, except that it doesn't as there is no topology.
BoundaryFactory(const ParentMeshType &mesh_in)
Constructor.
virtual void fill_target_sets(TargetSetHolderType &target_set_holder) override
Fills the MeshPart's target set.
MeshType::TargetSetHolderType TargetSetHolderType
target set holder type
const ParentMeshType & _mesh_in
a reference to the input mesh
MeshPart< ParentMeshType > MeshType
The MeshPart type.
virtual void fill_attribute_sets(typename BaseClass::AttributeSetContainer &) override
Fills the MeshPart's target set, except that it doesn't.
ParentMesh_ ParentMeshType
the parent mesh type
Factory< MeshPart< ParentMesh_ > > BaseClass
Our base class.
Mesh Factory class template.
GlobalMaskedBoundaryFactory implementation.
virtual void fill_index_sets(std::unique_ptr< typename BaseClass::IndexSetHolderType > &) override
Fills the MeshPart's index_set_holder, except that it doesn't as there is no topology.
std::array< std::vector< int >, std::size_t(shape_dim)> _bnd_masks
the face masks for each face dimensions
ParentMesh_ ParentMeshType
the parent mesh type
MeshPart< ParentMeshType > MeshType
The MeshPart type.
GlobalMaskedBoundaryFactory(const ParentMeshType &mesh_in)
Constructor.
virtual void fill_attribute_sets(typename BaseClass::AttributeSetContainer &) override
Fills the MeshPart's target set, except that it doesn't.
void _sync_bnd_masks(const Dist::Comm &comm)
Synchronizes the boundary masks over the communicators.
Factory< MeshPart< ParentMesh_ > > BaseClass
Our base class.
virtual Index get_num_entities(int dim) override
Returns the number of entities.
static constexpr int shape_dim
the shape dimension
const ParentMeshType & _mesh_in
a reference to the input mesh
MeshType::ShapeType ShapeType
the shape type
void add_mask_meshpart(const MeshPart< ParentMeshType > &part)
Adds all facets in a mesh-part to the boundary facet mask.
std::vector< int > _facet_mask
a mask vector for the facets
MeshType::TargetSetHolderType TargetSetHolderType
target set holder type
virtual void fill_target_sets(TargetSetHolderType &target_set_holder) override
Fills the MeshPart's target set.
std::array< std::vector< Index >, std::size_t(shape_dim)> _face_idx
the (cell_dim_-1)-dimensional boundary face indices for each face dimension
std::vector< std::pair< int, const MeshType * > > _halos
a map of all halos
void compile(const Dist::Comm &comm)
Compiles the factory.
void add_halo(int rank, const MeshPart< ParentMeshType > &halo)
Adds a halo to the mask and saves it for synchronization.
Intern::BoundaryFaceComputer< ShapeType > _face_computer
a boundary face computer object for the dirty work
static constexpr int facet_dim
the facet dimension
MaskedBoundaryFactory implementation.
void add_mask_meshpart(const MeshPart< ParentMeshType > &part)
Adds all facets in a mesh-part to the boundary facet mask.
std::array< std::vector< int >, std::size_t(shape_dim)> _bnd_masks
the face masks for each face dimensions
virtual void fill_index_sets(std::unique_ptr< typename BaseClass::IndexSetHolderType > &) override
Fills the MeshPart's index_set_holder, except that it doesn't as there is no topology.
ParentMesh_ ParentMeshType
the parent mesh type
static constexpr int shape_dim
the shape dimension
static constexpr int facet_dim
the facet dimension
MaskedBoundaryFactory(const ParentMeshType &mesh_in)
Constructor.
MeshType::TargetSetHolderType TargetSetHolderType
target set holder type
std::vector< int > _facet_mask
a mask vector for the facets
virtual void fill_attribute_sets(typename BaseClass::AttributeSetContainer &) override
Fills the MeshPart's target set, except that it doesn't.
const ParentMeshType & _mesh_in
a reference to the input mesh
Factory< MeshPart< ParentMesh_ > > BaseClass
Our base class.
MeshPart< ParentMeshType > MeshType
The MeshPart type.
void compile()
Compiles the factory.
Intern::BoundaryFaceComputer< ShapeType > _face_computer
a boundary face computer object for the dirty work
std::array< std::vector< Index >, std::size_t(shape_dim)> _face_idx
the (cell_dim_-1)-dimensional boundary face indices for each face dimension
virtual void fill_target_sets(TargetSetHolderType &target_set_holder) override
Fills the MeshPart's target set.
MeshType::ShapeType ShapeType
the shape type
virtual Index get_num_entities(int dim) override
Returns the number of entities.
Class template for partial meshes.
MeshType::ShapeType ShapeType
Shape type.
TargetSetHolder< ShapeType > TargetSetHolderType
Target set holder type.
Index get_num_entities() const
Returns the number of entities.
std::unique_ptr< MeshPart< Mesh_ > > make_unique_boundary_meshpart(const Mesh_ &mesh)
Creates a new boundary mesh-part for a given mesh.
MeshPart< Mesh_ > make_boundary_meshpart(const Mesh_ &mesh)
Creates a new boundary mesh-part for a given mesh.
std::uint64_t Index
Index data type.