16#ifndef Ecrire_CGNS_helper_included
17#define Ecrire_CGNS_helper_included
19#include <Option_CGNS.h>
28#pragma GCC diagnostic push
29#if __GNUC__ > 5 || __clang_major__ > 10
30#pragma GCC diagnostic ignored "-Wsuggest-override"
37#pragma GCC diagnostic pop
39#define CGNS_STR_SIZE 32
41#define CGNS_DOUBLE_TYPE CGNS_ENUMV(RealDouble)
43enum class TYPE_ECRITURE_CGNS { SEQ , PAR_IN, PAR_OVER };
44enum class TYPE_LINK_CGNS { GRID , SOLUTION, FINAL_LINK };
45enum class TYPE_MODE_CGNS { WRITE, MODIFY , READ };
46enum class TYPE_RUN_CGNS { SEQ, PAR };
48inline void TRUST_CGNS_ERROR()
57 Cerr <<
"CGNS error: " << cg_get_error() << finl;
63struct Ecrire_CGNS_helper
65 template<TYPE_RUN_CGNS _TYPE_, TYPE_MODE_CGNS _MODE_ = TYPE_MODE_CGNS::WRITE>
66 inline void cgns_open_file(
const std::string&,
int&,
const bool print =
true);
68 template<TYPE_RUN_CGNS _TYPE_>
69 inline void cgns_close_file(
const std::string&,
const int,
const bool print =
true);
71 template<TYPE_ECRITURE_CGNS _TYPE_>
72 inline void cgns_write_zone_grid_coord(
const int,
const int,
const int,
const char*,
const cgsize_t*,
int&,
73 const std::vector<double>&,
const std::vector<double>&,
const std::vector<double>&,
int&,
int&,
int&);
75 template<TYPE_ECRITURE_CGNS _TYPE_>
76 inline std::enable_if_t< _TYPE_ != TYPE_ECRITURE_CGNS::SEQ, void>
77 cgns_write_grid_coord_data(
const int,
const int,
const int,
const int,
const int,
const int,
const int,
const cgsize_t,
const cgsize_t,
78 const std::vector<double>&,
const std::vector<double>&,
const std::vector<double>&);
80 template<TYPE_ECRITURE_CGNS _TYPE_>
81 inline void cgns_sol_write(
const int,
const int,
const int,
const int,
const int,
const std::vector<int>&,
82 const std::string&, std::string&, std::string&, std::string&,
83 bool&,
bool&,
bool&,
int&,
int&,
int&);
85 template<TYPE_ECRITURE_CGNS _TYPE_>
86 inline std::enable_if_t< _TYPE_ != TYPE_ECRITURE_CGNS::SEQ, void>
87 cgns_field_write(
const int,
const int,
const int,
const int,
const std::vector<int>&,
const std::string&,
88 const int,
const int,
const int,
const char*,
int&,
int&,
int&);
90 template<TYPE_ECRITURE_CGNS _TYPE_>
91 inline std::enable_if_t<_TYPE_ == TYPE_ECRITURE_CGNS::SEQ, void>
92 cgns_field_write_data(
const int,
const int,
const int,
const std::vector<int>&,
const std::string&,
93 const int,
const int,
const int,
const int,
94 const char * ,
const DoubleTab& ,
int& ,
int& ,
int&);
96 template<TYPE_ECRITURE_CGNS _TYPE_>
97 inline std::enable_if_t<_TYPE_ != TYPE_ECRITURE_CGNS::SEQ, void>
98 cgns_field_write_data(
const int,
const int,
const int,
const std::vector<int>&,
const std::string&,
99 const int,
const int,
const int,
const int,
const int,
const int,
const int,
100 const cgsize_t,
const cgsize_t,
const DoubleTab&);
102 template<TYPE_ECRITURE_CGNS _TYPE_>
103 inline void cgns_write_iters(
const bool,
const int,
const int ,
const int,
const int,
const std::vector<int>&,
104 const std::string&,
const std::string&,
const std::string&,
const std::string&,
105 const std::vector<double>&);
107 template<TYPE_ECRITURE_CGNS _TYPE_>
108 inline void cgns_write_iters_deformable(
const bool,
const bool,
const int,
const int ,
const int,
const int,
const std::vector<int>&,
109 const std::string&,
const std::string&,
const std::string&,
const std::string&,
const std::string&,
110 const std::vector<double>&);
113 inline void cgns_write_zone_and_classic_links(
const bool write_zone,
const int fileId,
const int baseId,
const std::string& zone_name_to_write,
const cgsize_t *isize,
int& zoneId,
114 const int zone_goto_id,
const std::string& linkfile,
const std::string& target_base_name,
const std::string& target_zone_name,
115 const std::vector<std::string>& connect_names,
const char *where,
const bool write_connectivity =
true);
117 inline void cgns_write_solution_classic_links(
const std::string& base_linkfile,
const std::string& target_base_name,
const std::string& target_zone_name,
118 const std::string& LOC,
const std::vector<double>& time_post,
const char *where);
120 inline void cgns_write_zone_and_deformable_links(
const bool write_zone,
const bool has_field,
const int fileId,
const int baseId,
const std::string& zone_name_to_write,
const cgsize_t *isize,
int& zoneId,
121 const int zone_goto_id,
const std::string& file_prefix,
const std::string& target_base_name,
const std::string& target_zone_name,
122 const std::vector<std::string>& connect_names,
const Nom& nom_dom,
const std::string& LOC,
123 const std::vector<double>& time_post,
const char *where,
const bool write_connectivity =
true);
125 inline void cgns_write_connectivity_deformable_links(
const int fileId,
const int baseId,
const int zone_goto_id,
const std::string& linkfile,
const std::string& target_base_name,
126 const std::string& target_zone_name,
const std::vector<std::string>& connect_names,
const char *where);
128 std::string convert_double_to_string(
const double t)
131 char str_temps[100] =
"0.0";
133 snprintf(str_temps, 100,
"%.10f", t);
135 return std::string(str_temps);
152#include <Ecrire_CGNS_helper.tpp>
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
static bool is_sequential()