Go to the documentation of this file.
7 #ifndef IOSS_IOCGNS_UTILS_H
8 #define IOSS_IOCGNS_UTILS_H
26 #define CGCHECK(funcall) \
27 if ((funcall) != CG_OK) { \
28 Iocgns::Utils::cgns_error(cgns_file_ptr, __FILE__, __func__, __LINE__, myProcessor); \
32 #define CGCHECKM(funcall) \
33 if ((funcall) != CG_OK) { \
34 Iocgns::Utils::cgns_error(m_cgnsFilePtr, __FILE__, __func__, __LINE__, myProcessor); \
37 #define CGCHECKNP(funcall) \
38 if ((funcall) != CG_OK) { \
39 Iocgns::Utils::cgns_error(cgns_file_ptr, __FILE__, __func__, __LINE__, -1); \
43 #define CGCHECK2(funcall) \
44 if ((funcall) != CG_OK) { \
45 Iocgns::Utils::cgns_error(filePtr, __FILE__, __func__, __LINE__, m_decomposition.m_processor); \
49 class StructuredZoneData;
53 ZoneBC(
const std::string &bc_name, std::array<cgsize_t, 2> &point_range)
72 static std::pair<std::string, int>
decompose_name(
const std::string &
name,
bool is_parallel);
77 static void cgns_error(
int cgnsid,
const char *file,
const char *
function,
int lineno,
81 int myProcessor,
bool is_parallel,
bool is_parallel_io);
86 template <
typename INT>
91 switch (topo->
shape()) {
101 static std::array<int, 7> hex27_map{26, 20, 25, 24, 22, 21, 23};
102 for (
size_t i = 0; i < element_count; i++) {
103 size_t con_beg = 27 * i;
104 std::array<int, 7> reorder;
105 for (
size_t j = 0; j < 7; j++) {
106 reorder[j] = idata[con_beg + hex27_map[j]];
109 for (
size_t j = 0; j < 7; j++) {
110 idata[con_beg + 20 + j] = reorder[j];
123 template <
typename INT>
128 switch (topo->
shape()) {
138 static std::array<int, 7> hex27_map{26, 20, 25, 24, 22, 21, 23};
139 for (
size_t i = 0; i < element_count; i++) {
140 size_t con_beg = 27 * i;
141 std::array<int, 7> reorder;
142 for (
size_t j = 0; j < 7; j++) {
143 reorder[j] = idata[con_beg + 20 + j];
146 for (
size_t j = 0; j < 7; j++) {
147 idata[con_beg + hex27_map[j]] = reorder[j];
160 template <
typename INT>
168 switch (parent_topo->
shape()) {
170 static int hex_map[] = {0, 5, 1, 2, 3, 4, 6};
171 for (
size_t i = 0; i < num_to_get; i++) {
172 idata[2 * i + 1] = hex_map[idata[2 * i + 1]];
176 case Ioss::ElementShape::TET:
177 static int tet_map[] = {0, 4, 1, 2, 3};
178 for (
size_t i = 0; i < num_to_get; i++) {
179 idata[2 * i + 1] = tet_map[idata[2 * i + 1]];
183 case Ioss::ElementShape::PYRAMID:
184 static int pyr_map[] = {0, 5, 1, 2, 3, 4};
185 for (
size_t i = 0; i < num_to_get; i++) {
186 idata[2 * i + 1] = pyr_map[idata[2 * i + 1]];
190 case Ioss::ElementShape::WEDGE:
192 static int wed_map[] = {0, 1, 2, 3, 4, 5};
194 for (
size_t i=0; i < num_to_get; i++) {
195 idata[2*i+1] = wed_map[idata[2*i+1]];
210 switch (parent_topo->
shape()) {
212 static int hex_map[] = {0, 2, 3, 4, 5, 1, 6};
213 for (
size_t i = 0; i < num_to_get; i++) {
214 data[num_to_get * 2 + i] = hex_map[
data[num_to_get * 2 + i]];
218 case Ioss::ElementShape::TET:
219 static int tet_map[] = {0, 2, 3, 4, 1};
220 for (
size_t i = 0; i < num_to_get; i++) {
221 data[num_to_get * 2 + i] = tet_map[
data[num_to_get * 2 + i]];
225 case Ioss::ElementShape::PYRAMID:
226 static int pyr_map[] = {0, 2, 3, 4, 5, 1};
227 for (
size_t i = 0; i < num_to_get; i++) {
228 data[num_to_get * 2 + i] = pyr_map[
data[num_to_get * 2 + i]];
232 case Ioss::ElementShape::WEDGE:
234 static int wed_map[] = {0, 1, 2, 3, 4, 5};
236 for (
size_t i=0; i < num_to_get; i++) {
237 data[num_to_get * 2 + i] = wed_map[
data[num_to_get * 2 + i]];
250 std::map<std::string, Ioss::FaceUnorderedSet> &boundary_faces,
254 int state,
const int *vertex_solution_index,
255 const int *cell_center_solution_index,
256 bool is_parallel_io);
258 CG_GridLocation_t location);
262 bool appending =
false);
266 bool is_parallel_io);
268 std::vector<size_t> &zone_offset,
bool is_parallel);
270 static std::vector<std::vector<std::pair<size_t, size_t>>>
281 bool is_parallel_io);
287 static void finalize_database(
int cgns_file_ptr,
const std::vector<double> ×teps,
288 Ioss::Region *region,
int myProcessor,
bool is_parallel_io);
289 static int get_step_times(
int cgns_file_ptr, std::vector<double> ×teps,
290 Ioss::Region *region,
double timeScaleFactor,
int myProcessor);
293 char suffix_separator,
int myProcessor,
294 bool is_parallel_io);
297 std::vector<Iocgns::StructuredZoneData *> &zones,
int rank,
299 static void decompose_model(std::vector<Iocgns::StructuredZoneData *> &zones,
int proc_count,
300 int rank,
double load_balance_threshold,
bool verbose);
301 static size_t pre_split(std::vector<Iocgns::StructuredZoneData *> &zones,
double avg_work,
302 double load_balance,
int proc_rank,
int proc_count,
bool verbose);
304 std::vector<size_t> &work_vector,
bool verbose);
307 template <
typename INT>
309 const std::vector<INT> &connectivity,
311 const std::vector<INT> &zone_local_zone_global);
cgsize_t range_end
Definition: Iocgns_Utils.h:60
static int get_db_zone(const Ioss::GroupingEntity *entity)
Definition: Iocgns_Utils.C:531
static void finalize_database(int cgns_file_ptr, const std::vector< double > ×teps, Ioss::Region *region, int myProcessor, bool is_parallel_io)
Definition: Iocgns_Utils.C:2071
MeshType
The mesh type – structured, unstructured, hybrid (future), or unknown.
Definition: Ioss_MeshType.h:13
static void update_db_zone_property(int cgns_file_ptr, const Ioss::Region *region, int myProcessor, bool is_parallel, bool is_parallel_io)
Definition: Iocgns_Utils.C:469
static void show_config()
Definition: Iocgns_Utils.C:2874
static Ioss::MeshType check_mesh_type(int cgns_file_ptr)
Definition: Iocgns_Utils.C:428
Holds metadata for bulk data associated with a GroupingEntity.
Definition: Ioss_Field.h:22
static void add_assemblies(int cgns_file_ptr, Ioss::DatabaseIO *db)
Definition: Iocgns_Utils.C:1638
A homogeneous collection of other GroupingEntities.
Definition: Ioss_Assembly.h:28
static std::string decompose_sb_name(const std::string &name)
Definition: Iocgns_Utils.C:393
static void decompose_model(std::vector< Iocgns::StructuredZoneData * > &zones, int proc_count, int rank, double load_balance_threshold, bool verbose)
Definition: Iocgns_Utils.C:2406
static void assign_zones_to_procs(std::vector< Iocgns::StructuredZoneData * > &zones, std::vector< size_t > &work_vector, bool verbose)
Definition: Iocgns_Utils.C:2534
Definition: robin_set.h:83
static void output_assembly(int file_ptr, const Ioss::Assembly *assembly, bool is_parallel_io, bool appending=false)
Definition: Iocgns_Utils.C:848
static bool is_cell_field(const Ioss::Field &field)
Definition: Iocgns_Utils.C:563
std::string name
Definition: Iocgns_Utils.h:58
Definition: Iocgns_Utils.h:52
static void generate_boundary_faces(Ioss::Region *region, std::map< std::string, Ioss::FaceUnorderedSet > &boundary_faces, Ioss::Field::BasicType field_type)
Definition: Iocgns_Utils.C:1972
cgsize_t range_beg
Definition: Iocgns_Utils.h:59
static void add_structured_boundary_conditions_fpp(int cgns_file_ptr, Ioss::StructuredBlock *block)
Definition: Iocgns_Utils.C:2000
static void add_to_assembly(int cgns_file_ptr, Ioss::Region *region, Ioss::EntityBlock *block, int base, int zone)
Definition: Iocgns_Utils.C:1877
static void set_line_decomposition(int cgns_file_ptr, const std::string &line_decomposition, std::vector< Iocgns::StructuredZoneData * > &zones, int rank, bool verbose)
Definition: Iocgns_Utils.C:2284
A grouping entity that contains other grouping entities.
Definition: Ioss_Region.h:78
static size_t resolve_nodes(Ioss::Region ®ion, int my_processor, bool is_parallel)
Definition: Iocgns_Utils.C:1696
A structured zone – i,j,k.
Definition: Ioss_StructuredBlock.h:78
static std::pair< std::string, int > decompose_name(const std::string &name, bool is_parallel)
Definition: Iocgns_Utils.C:370
int INT
Definition: Ioss_StructuredBlock.h:27
static void write_state_meta_data(int file_ptr, const Ioss::Region ®ion, bool is_parallel_io)
Definition: Iocgns_Utils.C:912
static void write_flow_solution_metadata(int file_ptr, int base_ptr, Ioss::Region *region, int state, const int *vertex_solution_index, const int *cell_center_solution_index, bool is_parallel_io)
Definition: Iocgns_Utils.C:1439
static const size_t CG_VERTEX_FIELD_ID
Definition: Iocgns_Utils.h:70
int rank
Definition: Iocgns_DecompositionData.C:30
std::vector< cgsize_t > CGNSIntVector
Definition: Iocgns_Defines.h:13
Definition: Iocgns_Utils.h:64
static void map_cgns_connectivity(const Ioss::ElementTopology *topo, size_t element_count, INT *idata)
Definition: Iocgns_Utils.h:87
static int get_step_times(int cgns_file_ptr, std::vector< double > ×teps, Ioss::Region *region, double timeScaleFactor, int myProcessor)
Definition: Iocgns_Utils.C:2253
static void generate_block_faces(Ioss::ElementTopology *topo, size_t num_elem, const std::vector< INT > &connectivity, Ioss::FaceUnorderedSet &boundary, const std::vector< INT > &zone_local_zone_global)
Definition: Iocgns_Utils.C:2925
An input or output Database.
Definition: Ioss_DatabaseIO.h:59
static void output_assemblies(int file_ptr, const Ioss::Region ®ion, bool is_parallel_io)
Definition: Iocgns_Utils.C:904
static void set_field_index(const Ioss::Field &field, size_t index, CG_GridLocation_t location)
Definition: Iocgns_Utils.C:551
static void unmap_cgns_connectivity(const Ioss::ElementTopology *topo, size_t element_count, INT *idata)
Definition: Iocgns_Utils.h:124
static void add_structured_boundary_conditions(int cgns_file_ptr, Ioss::StructuredBlock *block, bool is_parallel_io)
Definition: Iocgns_Utils.C:1893
static std::string map_cgns_to_topology_type(CG_ElementType_t type)
Definition: Iocgns_Utils.C:1335
Base class for all 'block'-type grouping entities, which means all members of the block are similar o...
Definition: Ioss_EntityBlock.h:36
static CG_ElementType_t map_topology_to_cgns(const std::string &name)
Definition: Iocgns_Utils.C:1366
static void add_transient_variables(int cgns_file_ptr, const std::vector< double > ×teps, Ioss::Region *region, bool enable_field_recognition, char suffix_separator, int myProcessor, bool is_parallel_io)
Definition: Iocgns_Utils.C:2162
virtual ElementShape shape() const =0
static void map_ioss_face_to_cgns(const Ioss::ElementTopology *parent_topo, size_t num_to_get, CGNSIntVector &data)
Definition: Iocgns_Utils.h:203
Represents an element topology.
Definition: Ioss_ElementTopology.h:47
static size_t common_write_meta_data(int file_ptr, const Ioss::Region ®ion, std::vector< size_t > &zone_offset, bool is_parallel)
Definition: Iocgns_Utils.C:988
static std::vector< std::vector< std::pair< size_t, size_t > > > resolve_processor_shared_nodes(Ioss::Region ®ion, int my_processor)
Definition: Iocgns_Utils.C:1813
static const size_t CG_CELL_CENTER_FIELD_ID
Definition: Iocgns_Utils.h:69
ZoneBC(const std::string &bc_name, std::array< cgsize_t, 2 > &point_range)
Definition: Iocgns_Utils.h:53
std::vector< char > data
Definition: cth_pressure_map.C:48
static void cgns_error(int cgnsid, const char *file, const char *function, int lineno, int processor)
Definition: Iocgns_Utils.C:406
static size_t index(const Ioss::Field &field)
Definition: Iocgns_Utils.C:549
virtual int number_nodes() const =0
BasicType
The basic data type held in the field.
Definition: Ioss_Field.h:26
static void map_cgns_face_to_ioss(const Ioss::ElementTopology *parent_topo, size_t num_to_get, INT *idata)
Definition: Iocgns_Utils.h:161
std::string name(const Ioss::GroupingEntity *entity)
Definition: io_info.C:65
static size_t pre_split(std::vector< Iocgns::StructuredZoneData * > &zones, double avg_work, double load_balance, int proc_rank, int proc_count, bool verbose)
Definition: Iocgns_Utils.C:2606
A namespace for the CGNS database format.
Definition: Iocgns_DatabaseIO.C:516
static void add_sidesets(int cgns_file_ptr, Ioss::DatabaseIO *db)
Definition: Iocgns_Utils.C:1575
static int find_solution_index(int cgns_file_ptr, int base, int zone, int step, CG_GridLocation_t location)
Definition: Iocgns_Utils.C:1514
Base class for all 'grouping' entities. The following derived classes are typical:
Definition: Ioss_GroupingEntity.h:68
static void add_structured_boundary_conditions_pio(int cgns_file_ptr, Ioss::StructuredBlock *block)
Definition: Iocgns_Utils.C:1907
static std::vector< ZoneBC > parse_zonebc_sideblocks(int cgns_file_ptr, int base, int zone, int myProcessor)
Definition: Iocgns_Utils.C:2833