9#include <kernel/geometry/mesh_part.hpp>
22 template<
typename,
int>
23 class PatchPartMapHolder;
34 template<
typename Mesh_>
55 template<
typename Shape_,
int num_coords_,
typename Coord_>
57 public Factory<MeshPart<Geometry::ConformalMesh<Shape_, num_coords_, Coord_>>>
63 static constexpr int shape_dim = ShapeType::dimension;
101 _base_mesh(base_mesh),
102 _patch_mesh_part(patch_mesh_part),
103 _cur_part_attribute_container(nullptr),
104 _cur_part_topology(nullptr),
105 _part_holder(patch_mesh_part.get_target_set_holder())
128 _cur_part_topology = mesh_part.get_topology();
130 return _part_holder.
build(mesh_part.get_target_set_holder(), mesh_part.get_topology());
168 virtual void fill_index_sets(std::unique_ptr<IndexSetHolderType>& index_set_holder)
override
170 XASSERT(index_set_holder ==
nullptr);
176 Index num_entities[shape_dim+1];
177 for(
int i(0); i < shape_dim+1; ++i)
178 num_entities[i] = get_num_entities(i);
269 auto it =
_idx_map.find(target_in[i]);
304 template<
typename Attribute_>
306 std::map<
String, std::unique_ptr<Attribute_>>& attribute_container_out,
307 const std::map<
String, std::unique_ptr<Attribute_>>& attribute_container_in)
const
309 for(
auto it(attribute_container_in.begin()); it != attribute_container_in.end(); ++it)
312 std::unique_ptr<Attribute_> new_attribute(
new Attribute_(
315 const int dim = it->second->get_dimension();
320 for(
int k(0); k < dim; ++k)
321 new_attribute->operator()(jt.second, k) = it->second->operator()(jt.first, k);
325 XASSERTM(attribute_container_out.insert(std::make_pair(it->first, std::move(new_attribute))).second,
"Error inserting new AttributeSet");
371 template<
typename IndexSetType_>
372 void fill_index_set(IndexSetType_& index_set_out,
const IndexSetType_& index_set_in,
373 const std::map<Index, Index>& vertex_map)
const
376 for(
Index k(0); k < index_set_in.get_num_entities(); ++k)
383 for(
int j(0); j < index_set_in.get_num_indices(); ++j)
386 Index i_in(index_set_in(k,j));
388 auto jt = vertex_map.find(i_in);
389 if(jt != vertex_map.end())
391 index_set_out(kt->second, j) = jt->second;
422 template<
typename Shape_,
int dim_ = Shape_::dimension>
445 _patch_map(tsh.template get_target_set<dim_>()),
462 bool build(
const TargetSetHolder<Shape_>& tsh,
const IndexSetHolder<Shape_>* ish)
513 template<
typename AttributeSetContainer_>
515 AttributeSetContainer_& attribute_container_out,
516 const AttributeSetContainer_& attribute_container_in)
const
548 template<
typename IndexSetHolder_>
573 template<
typename Shape_>
574 class PatchPartMapHolder<Shape_, 0>
580 explicit PatchPartMapHolder(
const TargetSetHolder<Shape_>& tsh) :
585 bool build(
const TargetSetHolder<Shape_>& tsh,
const IndexSetHolder<Shape_>* DOXY(ish))
596 template<
typename AttributeSetContainer_>
598 AttributeSetContainer_& attribute_container_out,
599 const AttributeSetContainer_& attribute_container_in)
const
605 template<
typename IndexSetHolder_>
606 void fill_index_sets(IndexSetHolder_& DOXY(ish),
const IndexSetHolder_& DOXY(ish_in))
const
#define XABORTM(msg)
Abortion macro definition with custom message.
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Mesh Factory class template.
Class template for partial meshes.
const AttributeSetContainer & get_mesh_attributes() const
Returns a const reference to the mesh attributes container.
TargetSetHolder< ShapeType > TargetSetHolderType
Target set holder type.
IndexSetHolder< ShapeType > IndexSetHolderType
Index set holder type.
std::map< String, std::unique_ptr< AttributeSetType > > AttributeSetContainer
submesh node bin container type
Class for creating MeshParts referring to a patch BaseMesh.
This is a container class for holding PatchPartMaps for all dimensions.
bool has_topology() const
Does the current BaseMesh MeshPart have a topology?
void fill_target_sets(TargetSetHolder< Shape_ > &tsh) const
Factory interface: Fills the TargetSetHolder.
const std::map< Index, Index > & get_vertex_map() const
Gets the vertex map.
bool _has_topology
We need to know if the last BaseMesh MeshPart from build() had a topology.
void fill_index_sets(IndexSetHolder_ &ish, const IndexSetHolder_ &ish_in) const
Factory interface: Fills the IndexSetHolder.
Index get_num_entities(int dim) const
Gets the number of entities.
PatchPartMapHolder< Shape_, dim_ - 1 > BaseClass
Our base class.
PatchPartMap _patch_map
The PatchPartMap for our dimension.
void fill_attribute_sets(AttributeSetContainer_ &attribute_container_out, const AttributeSetContainer_ &attribute_container_in) const
MeshPart Factory interface: Fills the AttributeSetContainer.
bool build(const TargetSetHolder< Shape_ > &tsh, const IndexSetHolder< Shape_ > *ish)
Assembles information from a BaseMesh MeshPart.
PatchPartMapHolder(const TargetSetHolder< Shape_ > &tsh)
Standard constructor.
Mapping class for BaseMesh/PatchBaseMesh and MeshPart index conversions.
std::map< Index, Index > _io_map
Index map from base mesh MeshPart entities to patch boundary MeshPart entities.
bool build(const TargetSet &target_in)
Creates mapping information from a BaseMesh MeshPart to a Patch MeshPart boundary MeshPart.
PatchPartMap(const TargetSet &target_set)
Standard constructor.
void fill_index_set(IndexSetType_ &index_set_out, const IndexSetType_ &index_set_in, const std::map< Index, Index > &vertex_map) const
Fills the vertex-at-shape IndexSet of the PatchMeshPart MeshPart.
void fill_attribute_set(std::map< String, std::unique_ptr< Attribute_ > > &attribute_container_out, const std::map< String, std::unique_ptr< Attribute_ > > &attribute_container_in) const
Fills an attribute set.
void fill_target_set(TargetSet &target_out) const
Fills the PatchMeshPart MeshPart's TargetSet.
std::map< Index, Index > _idx_map
Index map from BaseMesh entity to PatchMeshPart entity.
const std::map< Index, Index > & get_io_map() const
Gets the mapping BaseMesh MeshPart entities to PatchMeshPart MeshPart entities.
Index size() const
The size of the PatchMeshPart MeshPart.
std::vector< Index > _indices
This is basically the TargetSet mapping PatchMeshPart MeshPart entities to the PatchMeshPart.
static void compute(IndexSetHolder< Shape_ > &index_set_holder)
Routine that does the actual work.
Index get_num_entities() const
Returns the number of entities.
String class implementation.
String stringify(const T_ &item)
Converts an item into a String.
std::uint64_t Index
Index data type.