16#include <IJK_Lata_writer.h>
19void dumplata_newtime(
const char *filename,
double time)
26 const int default_prec = (int)std::cout.precision();
27 constexpr int max_prec = std::numeric_limits<double>::digits10 + 1;
28 std::ostringstream oss;
29 oss <<
"TEMPS " << std::setprecision(max_prec) << time << std::setprecision(default_prec);
31 master_file.
ouvrir(filename, ios::app);
32 master_file << oss.str() << finl;
36void dumplata_header(
const char *filename)
43 master_file.
ouvrir(filename);
44 master_file <<
"LATA_V2.1" << finl;
45 master_file <<
"IJK_specific_format" << finl;
46 master_file <<
"TRUST" << finl;
47 Nom format = (
sizeof(int)==8 ?
"INT64" :
"INT32");
48 master_file <<
"Format LITTLE_ENDIAN,C_INDEXING,C_ORDERING,F_MARKERS_NO,"<<format<<
",REAL32" << finl;
58void dumplata_add_geometry(
const char *filename,
const Domaine_IJK& splitting)
70 Nom basename(filename);
72 master_file.
ouvrir(basename, ios::app);
77 Cerr <<
"Error in dumplata_header: geometry has no name" << finl;
80 for (
int dir = 0; dir < 3; dir++)
82 fname[dir] = prefix + geomname +
Nom(
".coord") +
Nom((
char)(
'x'+dir));
84 binary_file.
ouvrir(fname[dir]);
88 for (i = 0; i < n; i++)
89 tmp[i] = (
float)coord[i];
90 binary_file.
put(tmp.
addr(), n, 1);
93 master_file <<
"Geom " << geomname <<
" type_elem=HEXAEDRE" << finl;
94 master_file <<
"Champ SOMMETS_IJK_I " << fname[0] <<
" geometrie=" << geomname <<
" size=" << splitting.
get_nb_elem_tot(0)+1 <<
" composantes=1" << finl;
95 master_file <<
"Champ SOMMETS_IJK_J " << fname[1] <<
" geometrie=" << geomname <<
" size=" << splitting.
get_nb_elem_tot(1)+1 <<
" composantes=1" << finl;
96 master_file <<
"Champ SOMMETS_IJK_K " << fname[2] <<
" geometrie=" << geomname <<
" size=" << splitting.
get_nb_elem_tot(2)+1 <<
" composantes=1" << finl;
101void dumplata_ft_field(
const char *filename,
const char *meshname,
102 const char *field_name,
const char *localisation,
103 const ArrOfInt& field,
int step)
106 Nom fdfield = prefix + field_name;
118 master_file.
ouvrir(filename, ios::app);
121 Nom format =
"INT32";
122 master_file <<
"Champ " << field_name <<
" " << basename(fdfield) <<
" geometrie=" << meshname ;
124 master_file <<
" size=" << nvaltot <<
" composantes=1 format="<<format<<
",NO_INDEXING localisation="
125 << localisation << finl;
130void dumplata_ft_field(
const char *filename,
const char *meshname,
131 const char *field_name,
const char *localisation,
132 const ArrOfDouble& field,
int step)
135 Nom fdfield = prefix + field_name;
143 for (
int i = 0; i < n; i++)
144 tmp[i] = (
float)field[i];
152 master_file.
ouvrir(filename, ios::app);
155 const DoubleTab* zfld =
dynamic_cast<const DoubleTab*
>(&field);
164 master_file <<
"Champ " << field_name <<
" " << basename(fdfield) <<
" geometrie=" << meshname;
166 master_file <<
" size=" << nvaltot/nb_compo <<
" composantes=" << nb_compo <<
" localisation="
167 << localisation << finl;
172void dumplata_finish(
const char *filename)
177 master_file.
ouvrir(filename, ios::app);
178 master_file <<
"FIN" << finl;
182Nom dirname(
const Nom& filename)
185 split_path_filename(filename, path, name);
188Nom basename(
const Nom& filename)
191 split_path_filename(filename, path, name);
195bool lata_has_field(
const char *filename_with_path,
int tstep,
const char *geometryname,
const char *fieldname)
198 split_path_filename(filename_with_path, path, dbname);
201 db.read_master_file(path, filename_with_path);
204 return db.field_exists(tstep, geometryname, fieldname);
virtual void set_64b(bool is_64b)
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
int get_nb_elem_tot(int direction) const
Returns the total (global) number of mesh cells in requested direction.
const ArrOfDouble & get_node_coordinates(int direction) const
Returns an array with the coordinates of all nodes in the mesh in requested direction.
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Writing to a shared file. This class derives from Ecr_Fic_Par, using binary output.
int put(const unsigned *ob, std::streamsize n, std::streamsize pas) override
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out) override
Opens the file with the given mode and prot parameters. These parameters are the parameters of the st...
Sortie & syncfile() override
Triggers writing to disk of the data accumulated on the different processors since the last call to s...
void set_64b(bool is64) override
class Nom: a character string for naming TRUST objects.
An array of character strings (VECT(Nom)).
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
virtual int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out)
virtual int put(const unsigned *ob, std::streamsize n, std::streamsize nb_colonnes=1)
void set_bin(bool bin) override
Changes the write mode of the file.
_SIZE_ size_array() const
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension(int d) const