29#include "iocgns_export.h"
40 class StructuredBlock;
46#define CGCHECK(funcall) \
48 if ((funcall) != CG_OK) { \
49 Iocgns::Utils::cgns_error(cgns_file_ptr, __FILE__, __func__, __LINE__, myProcessor); \
54#define CGCHECKM(funcall) \
56 if ((funcall) != CG_OK) { \
57 Iocgns::Utils::cgns_error(m_cgnsFilePtr, __FILE__, __func__, __LINE__, myProcessor); \
61#define CGCHECKNP(funcall) \
63 if ((funcall) != CG_OK) { \
64 Iocgns::Utils::cgns_error(cgns_file_ptr, __FILE__, __func__, __LINE__, -1); \
69#define CGCHECK2(funcall) \
71 if ((funcall) != CG_OK) { \
72 Iocgns::Utils::cgns_error(filePtr, __FILE__, __func__, __LINE__, \
73 m_decomposition.m_processor); \
82 return GridConnectivityTypeName[t];
89 class StructuredZoneData;
93 ZoneBC(std::string bc_name, std::array<cgsize_t, 2> &point_range)
94 : name(std::move(bc_name)), range_beg(point_range[0]), range_end(point_range[1])
106 IOSS_NODISCARD static std::pair<std::string, int> decompose_name(
const std::string &name,
108 IOSS_NODISCARD static std::string decompose_sb_name(
const std::string &name);
112 static void cgns_error(
int cgnsid,
const char *file,
const char *function,
int lineno,
115 static void update_db_zone_property(
int cgns_file_ptr,
const Ioss::Region *region,
116 int myProcessor,
bool is_parallel,
bool is_parallel_io);
118 static void set_field_index(
const Ioss::Field &field,
size_t index,
122 template <
typename INT>
127 switch (topo->
shape()) {
137 static std::array<int, 7> hex27_map{26, 20, 25, 24, 22, 21, 23};
138 for (
size_t i = 0; i < element_count; i++) {
139 size_t con_beg = 27 * i;
140 std::array<int, 7> reorder;
141 for (
size_t j = 0; j < 7; j++) {
142 reorder[j] = idata[con_beg + hex27_map[j]];
145 for (
size_t j = 0; j < 7; j++) {
146 idata[con_beg + 20 + j] = reorder[j];
159 template <
typename INT>
164 switch (topo->
shape()) {
174 static std::array<int, 7> hex27_map{26, 20, 25, 24, 22, 21, 23};
175 for (
size_t i = 0; i < element_count; i++) {
176 size_t con_beg = 27 * i;
177 std::array<int, 7> reorder;
178 for (
size_t j = 0; j < 7; j++) {
179 reorder[j] = idata[con_beg + 20 + j];
182 for (
size_t j = 0; j < 7; j++) {
183 idata[con_beg + hex27_map[j]] = reorder[j];
196 template <
typename INT>
204 switch (parent_topo->
shape()) {
206 static std::array<int, 7> hex_map = {0, 5, 1, 2, 3, 4, 6};
207 for (
size_t i = 0; i < num_to_get; i++) {
208 idata[2 * i + 1] = hex_map[idata[2 * i + 1]];
213 static std::array<int, 5> tet_map = {0, 4, 1, 2, 3};
214 for (
size_t i = 0; i < num_to_get; i++) {
215 idata[2 * i + 1] = tet_map[idata[2 * i + 1]];
220 static std::array<int, 6> pyr_map = {0, 5, 1, 2, 3, 4};
221 for (
size_t i = 0; i < num_to_get; i++) {
222 idata[2 * i + 1] = pyr_map[idata[2 * i + 1]];
228 static std::array<int, 6> wed_map = {0, 1, 2, 3, 4, 5};
230 for (
size_t i=0; i < num_to_get; i++) {
231 idata[2*i+1] = wed_map[idata[2*i+1]];
246 switch (parent_topo->
shape()) {
248 static int hex_map[] = {0, 2, 3, 4, 5, 1, 6};
249 for (
size_t i = 0; i < num_to_get; i++) {
250 data[num_to_get * 2 + i] = hex_map[data[num_to_get * 2 + i]];
255 static int tet_map[] = {0, 2, 3, 4, 1};
256 for (
size_t i = 0; i < num_to_get; i++) {
257 data[num_to_get * 2 + i] = tet_map[data[num_to_get * 2 + i]];
262 static int pyr_map[] = {0, 2, 3, 4, 5, 1};
263 for (
size_t i = 0; i < num_to_get; i++) {
264 data[num_to_get * 2 + i] = pyr_map[data[num_to_get * 2 + i]];
270 static int wed_map[] = {0, 1, 2, 3, 4, 5};
272 for (
size_t i=0; i < num_to_get; i++) {
273 data[num_to_get * 2 + i] = wed_map[data[num_to_get * 2 + i]];
281 IOSS_NODISCARD static std::vector<ZoneBC> parse_zonebc_sideblocks(
int cgns_file_ptr,
int base,
282 int zone,
int myProcessor);
286 std::map<std::string, Ioss::FaceUnorderedSet> &boundary_faces,
289 static void write_flow_solution_metadata(
int file_ptr,
int base_ptr,
Ioss::Region *region,
290 int state,
const int *vertex_solution_index,
291 const int *cell_center_solution_index,
292 bool is_parallel_io);
293 IOSS_NODISCARD static int find_solution_index(
int cgns_file_ptr,
int base,
int zone,
int step,
297 static void output_assembly(
int file_ptr,
const Ioss::Assembly *assembly,
bool is_parallel_io,
298 bool appending =
false);
299 static void output_assemblies(
int file_ptr,
const Ioss::Region ®ion,
bool is_parallel_io);
301 static void write_state_meta_data(
int file_ptr,
const Ioss::Region ®ion,
302 bool is_parallel_io);
303 static size_t common_write_metadata(
int file_ptr,
const Ioss::Region ®ion,
304 std::vector<size_t> &zone_offset,
bool is_parallel);
305 static size_t resolve_nodes(
Ioss::Region ®ion,
int my_processor,
bool is_parallel);
306 IOSS_NODISCARD static std::vector<std::vector<std::pair<size_t, size_t>>>
307 resolve_processor_shared_nodes(
Ioss::Region ®ion,
int my_processor);
317 bool is_parallel_io);
318 static void add_structured_boundary_conditions_fpp(
int cgns_file_ptr,
320 static void add_structured_boundary_conditions_pio(
int cgns_file_ptr,
323 static void finalize_database(
int cgns_file_ptr,
const std::vector<double> ×teps,
324 Ioss::Region *region,
int myProcessor,
bool is_parallel_io);
325 static int get_step_times(
int cgns_file_ptr, std::vector<double> ×teps,
326 Ioss::Region *region,
double timeScaleFactor,
int myProcessor);
327 static void add_transient_variables(
int cgns_file_ptr,
const std::vector<double> ×teps,
328 Ioss::Region *region,
int myProcessor,
bool is_parallel_io);
330 static void set_line_decomposition(
int cgns_file_ptr,
const std::string &line_decomposition,
331 std::vector<Iocgns::StructuredZoneData *> &zones,
int rank,
333 static void decompose_model(std::vector<Iocgns::StructuredZoneData *> &zones,
int proc_count,
334 int rank,
double load_balance_threshold,
bool verbose);
335 static int pre_split(std::vector<Iocgns::StructuredZoneData *> &zones,
double avg_work,
336 double load_balance,
int proc_rank,
int proc_count,
bool verbose);
337 static void assign_zones_to_procs(std::vector<Iocgns::StructuredZoneData *> &zones,
338 std::vector<size_t> &work_vector,
bool verbose);
341 template <
typename INT>
343 const std::vector<INT> &connectivity,
345 const std::vector<INT> &zone_local_zone_global);
std::vector< cgsize_t > CGNSIntVector
Definition Iocgns_Defines.h:12
CGNS_ENUMT(ElementType_t)
Definition Iocgns_Utils.C:1470
IOSS_NODISCARD auto format_as(CGNS_ENUMT(BCType_t) t)
Definition Iocgns_Utils.h:77
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
Definition Iocgns_Utils.h:104
static void unmap_cgns_connectivity(const Ioss::ElementTopology *topo, size_t element_count, INT *idata)
Definition Iocgns_Utils.h:160
static void map_cgns_face_to_ioss(const Ioss::ElementTopology *parent_topo, size_t num_to_get, INT *idata)
Definition Iocgns_Utils.h:197
static void map_ioss_face_to_cgns(const Ioss::ElementTopology *parent_topo, size_t num_to_get, CGNSIntVector &data)
Definition Iocgns_Utils.h:239
static void map_cgns_connectivity(const Ioss::ElementTopology *topo, size_t element_count, INT *idata)
Definition Iocgns_Utils.h:123
A homogeneous collection of other GroupingEntities.
Definition Ioss_Assembly.h:31
An input or output Database.
Definition Ioss_DatabaseIO.h:63
Represents an element topology.
Definition Ioss_ElementTopology.h:68
virtual IOSS_NODISCARD ElementShape shape() const =0
virtual IOSS_NODISCARD int number_nodes() const =0
Base class for all 'block'-type grouping entities, which means all members of the block are similar o...
Definition Ioss_EntityBlock.h:38
Holds metadata for bulk data associated with a GroupingEntity.
Definition Ioss_Field.h:25
BasicType
The basic data type held in the field.
Definition Ioss_Field.h:29
Base class for all 'grouping' entities. The following derived classes are typical:
Definition Ioss_GroupingEntity.h:67
A grouping entity that contains other grouping entities.
Definition Ioss_Region.h:93
A structured zone – i,j,k.
Definition Ioss_StructuredBlock.h:91
Definition robin_set.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
Definition Iocgns_Utils.h:92
cgsize_t range_beg
Definition Iocgns_Utils.h:99
std::string name
Definition Iocgns_Utils.h:98
ZoneBC(std::string bc_name, std::array< cgsize_t, 2 > &point_range)
Definition Iocgns_Utils.h:93
cgsize_t range_end
Definition Iocgns_Utils.h:100