10#include "iocgns_export.h"
12#include <cgnsconfig.h>
20#include <unordered_map>
21#elif defined CG_USE_HOPSCOTCH
23#elif defined CG_USE_ROBIN
42#if !defined(NO_PARMETIS_SUPPORT)
48#if !defined(NO_ZOLTAN_SUPPORT)
49#include <zoltan_cpp.h>
53 template <
typename INT>
class Decomposition;
58 class IOCGNS_EXPORT ZoneData
64 size_t m_elementOffset;
67 class IOCGNS_EXPORT DecompositionDataBase
70 DecompositionDataBase() =
default;
72 virtual ~DecompositionDataBase();
73 virtual void decompose_model(
int filePtr,
Ioss::MeshType mesh_type) = 0;
91 virtual void get_node_coordinates(
int filePtr,
double *ioss_data,
94 void get_block_connectivity(
int filePtr,
void *data,
int blk_seq,
bool raw_ids =
false)
const;
96 void get_element_field(
int filePtr,
int solution_index,
int blk_seq,
int field_index,
99 void get_node_field(
int filePtr,
int step,
int field_index,
double *data)
const;
104 template <
typename T>
105 void communicate_element_data(T *file_data, T *ioss_data,
size_t comp_count)
const;
107 template <
typename T>
108 void communicate_node_data(T *file_data, T *ioss_data,
size_t comp_count)
const;
113 std::vector<ZoneData> m_zones;
114 std::vector<Ioss::BlockDecompositionData> m_elementBlocks;
115 std::vector<Ioss::SetDecompositionData> m_sideSets;
116 std::vector<Iocgns::StructuredZoneData *> m_structuredZones;
120#if defined CG_USE_STD
121 using ZoneSharedMap = std::unordered_map<cgsize_t, cgsize_t>;
122#elif defined CG_USE_HOPSCOTCH
125#elif defined CG_USE_ROBIN
128 ZoneSharedMap m_zoneSharedMap;
131 template <
typename INT>
class DecompositionData :
public DecompositionDataBase
135 ~DecompositionData()
override =
default;
137 IOSS_NODISCARD int int_size()
const override {
return sizeof(INT); }
139 void decompose_model(
int filePtr,
Ioss::MeshType mesh_type)
override;
143 return m_decomposition.m_spatialDimension;
148 return m_decomposition.global_node_count();
152 return m_decomposition.global_elem_count();
157 return m_decomposition.ioss_node_count();
161 return m_decomposition.ioss_elem_count();
166 return m_decomposition.file_node_offset();
170 return m_decomposition.file_node_count();
174 return m_decomposition.file_elem_offset();
178 return m_decomposition.file_elem_count();
181 IOSS_NODISCARD std::vector<double> ¢roids()
override {
return m_decomposition.m_centroids; }
183 template <
typename T>
184 void communicate_element_data(T *file_data, T *ioss_data,
size_t comp_count)
const
186 m_decomposition.communicate_element_data(file_data, ioss_data, comp_count);
189 template <
typename T>
191 size_t comp_count)
const
193 m_decomposition.communicate_set_data(file_data, ioss_data, set, comp_count);
196 template <
typename T>
197 void communicate_node_data(T *file_data, T *ioss_data,
size_t comp_count)
const
199 m_decomposition.communicate_node_data(file_data, ioss_data, comp_count);
202 template <
typename U,
typename T>
203 void communicate_block_data(U *file_data, T *ioss_data,
206 m_decomposition.communicate_block_data(file_data, ioss_data, block, comp_count);
209 void get_block_connectivity(
int filePtr, INT *data,
int blk_seq,
bool raw_ids)
const;
211 void get_element_field(
int filePtr,
int solution_index,
int blk_seq,
int field_index,
214 void get_node_field(
int filePtr,
int step,
int field_offset,
double *data)
const;
218 return m_decomposition.m_nodeCommMap.size() / 2;
225 void decompose_structured(
int filePtr);
226 void decompose_unstructured(
int filePtr);
228 void get_sideset_data(
int filePtr);
229 void generate_zone_shared_nodes(
int filePtr, INT min_node, INT max_node);
234 return m_decomposition.i_own_node(node);
240 return m_decomposition.i_own_elem(elem);
246 IOSS_NODISCARD size_t node_global_to_local(
size_t global_index)
const
248 return m_decomposition.node_global_to_local(global_index);
251 IOSS_NODISCARD size_t elem_global_to_local(
size_t global_index)
const
253 return m_decomposition.elem_global_to_local(global_index);
256 void build_global_to_local_elem_map()
258 return m_decomposition.build_global_to_local_elem_map();
261 void get_element_block_communication()
263 m_decomposition.get_element_block_communication(m_elementBlocks);
268 void calculate_element_centroids(
int filePtr, std::vector<double> ¢roids);
270 void get_shared_node_list() { m_decomposition.get_shared_node_list(); }
272 void get_local_node_list() { m_decomposition.get_local_node_list(); }
274 void get_file_node_coordinates(
int filePtr,
int direction,
double *ioss_data)
const;
275 void get_node_coordinates(
int filePtr,
double *ioss_data,
278 double m_loadBalanceThreshold{1.4};
279 std::string m_lineDecomposition{};
281 mutable std::map<int, Ioss::FaceUnorderedSet> m_boundaryFaces;
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
int Ioss_MPI_Comm
Definition Ioss_CodeTypes.h:64
Definition Ioss_Decomposition.h:45
Definition Ioss_Decomposition.h:180
Holds metadata for bulk data associated with a GroupingEntity.
Definition Ioss_Field.h:25
A collection of Ioss::Property objects.
Definition Ioss_PropertyManager.h:36
Definition Ioss_Decomposition.h:92
Definition bhopscotch_map.h:61
Definition robin_map.h:90
A namespace for the CGNS database format.
Definition Iocgns_DatabaseIO.C:555
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
MeshType
The mesh type – structured, unstructured, hybrid (future), or unknown.
Definition Ioss_MeshType.h:12
std::vector< int64_t > MapContainer
Definition Ioss_Map.h:29