TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
EcrFicPartage Class Reference

#include <EcrFicPartage.h>

Inheritance diagram for EcrFicPartage:
[legend]
Collaboration diagram for EcrFicPartage:
[legend]

Public Member Functions

 EcrFicPartage ()
 EcrFicPartage (const char *name, IOS_OPEN_MODE mode=ios::out)
 Opens the file with the given mode and prot parameters. These parameters are the parameters of the standard open method.
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 standard open method.
 ~EcrFicPartage () override
 Closes the file.
void close ()
Sortielockfile () override
 Allows the calling process to block waiting for the common resource shared by all processes, which is the shared file.
Sortieunlockfile () override
 Releases the critical resource for the next process.
Sortiesyncfile () override
 Triggers writing to disk of the data accumulated on the different processors since the last call to syncfile().
void precision (int) override
int get_precision () override
Sortieflush () override
void set_bin (bool bin) override
void set_64b (bool is64) override
Sortieoperator<< (const char *ob) override
 Writes a character string.
Sortieoperator<< (const Objet_U &ob) override
 Writes an object or variable.
Sortieoperator<< (const std::string &ob) override
Sortieoperator<< (const Separateur &) override
Sortieoperator<< (const int ob) override
Sortieoperator<< (const unsigned ob) override
Sortieoperator<< (const long ob) override
Sortieoperator<< (const long long ob) override
Sortieoperator<< (const unsigned long ob) override
Sortieoperator<< (const float ob) override
Sortieoperator<< (const double ob) override
int put (const unsigned *ob, std::streamsize n, std::streamsize pas) override
int put (const int *ob, std::streamsize n, std::streamsize pas) override
int put (const long *ob, std::streamsize n, std::streamsize pas) override
int put (const long long *ob, std::streamsize n, std::streamsize pas) override
int put (const float *ob, std::streamsize n, std::streamsize pas) override
int put (const double *ob, std::streamsize n, std::streamsize pas) override
Public Member Functions inherited from SFichier
 SFichier (const char *name, IOS_OPEN_MODE mode=ios::out)
 SFichier (const SFichier &)=default
SFichieroperator= (const SFichier &f)=default
Public Member Functions inherited from Sortie_Fichier_base
 Sortie_Fichier_base ()
 Sortie_Fichier_base (const Sortie_Fichier_base &)=default
 Sortie_Fichier_base (const char *name, IOS_OPEN_MODE mode=ios::out)
ofstream & get_ofstream ()
void close ()
void precision (int pre) override
void setf (IOS_FORMAT code) override
bool is_open ()
Sortieflush () override
 Forces the data in the buffer to be written to disk. Uses the ofstream class implementation.
Public Member Functions inherited from Sortie
 Sortie ()
 Sortie (ostream &os)
 Sortie (const Sortie &os)
virtual ~Sortie ()
Sortieoperator= (ostream &os)
Sortieoperator= (Sortie &os)
void set_bin (bool bin) override
 Changes the write mode of the file.
ostream & get_ostream ()
const ostream & get_ostream () const
void set_col_width (int w)
Sortieoperator<< (ostream &(*f)(ostream &))
Sortieoperator<< (Sortie &(*f)(Sortie &))
Sortieoperator<< (ios &(*f)(ios &))
template<typename T>
Sortieoperator<< (const TRUST_Ref< T > &)
Sortieoperator<< (const TRUST_Ref_Objet_U &)
virtual int add_col (const double ob)
virtual int add_col (const char *ob)
bool has_ostream () const
Public Member Functions inherited from AbstractIO
bool is_64b () const
bool is_bin ()
void set_avoid_conversion (bool avoid)
bool avoid_conversion ()
Public Member Functions inherited from Objet_U
 ~Objet_U () override
 Destructor. Removes the object from the list of objects registered in "memory".
int numero () const
 Returns the index of the object in Memoire::data.
virtual int duplique () const =0
virtual SortieprintOn (Sortie &) const
 Writes the object to an output stream. Virtual method to override.
virtual EntreereadOn (Entree &)
 Reads an Objet_U from an input stream. Virtual method to override.
virtual unsigned taille_memoire () const =0
virtual int est_egal_a (const Objet_U &) const
 Returns 1 if x and *this are the same instance (same memory address).
virtual const Nomle_nom () const
 Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
virtual void nommer (const Nom &)
 Assigns a name to the Objet_U. Virtual method to override.
virtual int reprendre (Entree &)
 Restores an Objet_U from an input stream. Virtual method to override.
virtual int sauvegarder (Sortie &) const
 Saves an Objet_U to an output stream. Virtual method to override.
int get_object_id () const
 Returns the unique identifier of the object (object_id_).
virtual const Type_infoget_info () const
 Returns type information for the Objet_U.
const Nomque_suis_je () const
 Returns the string identifying the class.
const char * le_type () const
 Returns the type name of the Objet_U.
virtual int change_num (const int *const)
 Changes the internal number of the Objet_U.
virtual int lire_motcle_non_standard (const Motcle &motlu, Entree &is)
 Reads non-simple-type parameters of an Objet_U from an input stream.
virtual int associer_ (Objet_U &)
 Associates the Objet_U with another Objet_U. Virtual method to override.
const Interpreteinterprete () const
Interpreteinterprete ()
Public Member Functions inherited from Process
virtual ~Process ()

Protected Attributes

Nom nom_fic_
Protected Attributes inherited from Sortie_Fichier_base
ofstream * ofstream_ = nullptr
 This pointer is just a (typed) view on the smart ptr hold by the base class (Sortie). The base class is managing the memory.
Protected Attributes inherited from Sortie
int col_width_
std::unique_ptr< ostream > ostream_
Protected Attributes inherited from AbstractIO
bool bin_ = false
 Is this a binary flux?
bool is_64b_
 Will we be reading/writing in 64b? (Init in ctor to avoid including arch.h probably).
bool avoid_conversion_ = false

Additional Inherited Members

Static Public Member Functions inherited from Sortie_Fichier_base
static void set_root (const std::string dirname)
Static Public Member Functions inherited from Objet_U
static const Nomnom_du_cas ()
 Returns a constant reference to the case name. This method is static.
static Nomget_set_nom_du_cas ()
 Returns a non-constant reference to the case name (to allow modification). This method is static.
static const Type_infoinfo ()
 Returns type information for the Objet_U (static version).
static const Objet_Uself_cast (const Objet_U &)
 Method added for casting in Python.
static Objet_Uself_cast (Objet_U &)
Static Public Member Functions inherited from Process
static int me ()
 Returns the rank of the local processor in the current communication group. See Comm_Group::rank() and PE_Groups::current_group().
static int nproc ()
 Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current_group().
static bool is_parallel ()
static void exit (int exit_code=-1)
 Exit routine for TRUST within a Kokkos region.
static double mp_sum (double)
 Computes the sum of x over all processors in the current group.
static float mp_sum (float)
static trustIdType mp_sum (trustIdType)
 Computes the sum of x over all processors in the current group.
static double mp_max (double)
static double mp_min (double)
static int mp_max (int)
 Returns the maximum value of x across all processors in the current group.
static int mp_min (int)
 Returns the minimum value of x across all processors in the current group.
static double mp_sum_as_double (int v)
static trustIdType mppartial_sum (trustIdType i)
 Computes the partial sum of x over processors 0 to me()-1 (returns 0 on processor 0).
template<typename T>
static void mp_sum_for_each (T &arg1, T &arg2)
 C++14 compatible mp_sum_for_each: combine multiple mp_sum calls into one collective operation Usage: mp_sum_for_each(a, b); mp_sum_for_each(a, b, c); mp_sum_for_each(a, b, c, d); mp_sum_for_each(a, b, c, d, e); All arguments must be of the same type (double or int) and are modified in place. Supports 2-5 parameters.
template<typename T>
static void mp_sum_for_each (T &arg1, T &arg2, T &arg3)
template<typename T>
static void mp_sum_for_each (T &arg1, T &arg2, T &arg3, T &arg4)
template<typename T>
static void mp_sum_for_each (T &arg1, T &arg2, T &arg3, T &arg4, T &arg5)
template<typename T>
static void mp_max_for_each (T &arg1, T &arg2)
 C++14 compatible mp_max_for_each: combine multiple mp_max calls into one collective operation.
template<typename T>
static void mp_max_for_each (T &arg1, T &arg2, T &arg3)
template<typename T>
static void mp_max_for_each (T &arg1, T &arg2, T &arg3, T &arg4)
template<typename T>
static void mp_max_for_each (T &arg1, T &arg2, T &arg3, T &arg4, T &arg5)
template<typename T>
static void mp_min_for_each (T &arg1, T &arg2)
 C++14 compatible mp_min_for_each: combine multiple mp_min calls into one collective operation.
template<typename T>
static void mp_min_for_each (T &arg1, T &arg2, T &arg3)
template<typename T>
static void mp_min_for_each (T &arg1, T &arg2, T &arg3, T &arg4)
template<typename T>
static void mp_min_for_each (T &arg1, T &arg2, T &arg3, T &arg4, T &arg5)
template<typename _TYPE_>
static void mp_sum_for_each_item (TRUSTArray< _TYPE_ > &x, int n=-1)
template<typename _TYPE_>
static void mp_max_for_each_item (TRUSTArray< _TYPE_ > &x, int n=-1)
template<typename _TYPE_>
static void mp_min_for_each_item (TRUSTArray< _TYPE_ > &x, int n=-1)
static bool mp_and (bool)
 Computes the logical AND of b across all processors in the current group.
static bool mp_or (bool)
static int check_int_overflow (trustIdType)
static int je_suis_maitre ()
 Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
static KOKKOS_INLINE_FUNCTION void Kokkos_exit (const char *)
 Exit routine for TRUST within a Kokkos region.
static int node_master ()
 Returns 1 if on the NUMA node master processor, 0 otherwise.
static void exit (const Nom &message, int exit_code=-1)
static bool is_sequential ()
static void barrier ()
 Synchronizes all processors in the current group (waits until all processors have reached the barrier).
static void abort ()
 Abort routine for TRUST on a fatal error.
static SortieJournal (int message_level=0)
 Returns a static Sortie object used as an event journal.
static double ram_processeur ()
static void imprimer_ram_totale (int all_process=0)
static bool force_single_file (const int ranks, const Nom &filename)
Static Public Attributes inherited from Sortie_Fichier_base
static std::string root = ""
Static Public Attributes inherited from Objet_U
static double precision_geom = 1e-10
static constexpr bool HAS_POINTER = false
static int dimension =0
static int format_precision_geom =11
static int axi =0
static int bidim_axi =0
static int DEACTIVATE_SIGINT_CATCH =0
static Type_info info_obj
static bool disable_TU =false
 Flag to disable or not the writing of the .TU files.
static bool stat_per_proc_perf_log =false
 Flag to enable the writing of the statistics detailed per processor in _csv.TU file.
Static Public Attributes inherited from Process
static int exception_sur_exit =0
static int multiple_files =5120
Protected Member Functions inherited from Sortie_Fichier_base
Sortie_Fichier_baseoperator= (const Sortie_Fichier_base &f)
Protected Member Functions inherited from AbstractIO
 AbstractIO ()
virtual ~AbstractIO ()
template<typename _TYPE_>
bool must_convert () const
 Whether to convert an int into a long when reading/writing out data.
Protected Member Functions inherited from Objet_U
 Objet_U ()
 Default constructor: assigns a unique identifier to the object (object_id_) and registers the object in "memory" by giving it a num_obj number.
 Objet_U (const Objet_U &)
 Copy constructor.
const Objet_Uoperator= (const Objet_U &)
 Assignment operator: does nothing (the number and identifier are preserved).
virtual void set_param (Param &) const

Detailed Description

Definition at line 36 of file EcrFicPartage.h.

Constructor & Destructor Documentation

◆ EcrFicPartage() [1/2]

EcrFicPartage::EcrFicPartage ( )

Definition at line 26 of file EcrFicPartage.cpp.

◆ EcrFicPartage() [2/2]

EcrFicPartage::EcrFicPartage ( const char * name,
IOS_OPEN_MODE mode = ios::out )

Opens the file with the given mode and prot parameters. These parameters are the parameters of the standard open method.

Definition at line 35 of file EcrFicPartage.cpp.

◆ ~EcrFicPartage()

EcrFicPartage::~EcrFicPartage ( )
override

Closes the file.

Definition at line 83 of file EcrFicPartage.cpp.

Member Function Documentation

◆ close()

void EcrFicPartage::close ( )

Definition at line 90 of file EcrFicPartage.cpp.

◆ flush()

Sortie & EcrFicPartage::flush ( )
overridevirtual

Reimplemented from Sortie.

Definition at line 315 of file EcrFicPartage.cpp.

◆ get_precision()

int EcrFicPartage::get_precision ( )
overridevirtual

Reimplemented from Sortie_Fichier_base.

Definition at line 275 of file EcrFicPartage.cpp.

◆ lockfile()

Sortie & EcrFicPartage::lockfile ( )
overridevirtual

Allows the calling process to block waiting for the common resource shared by all processes, which is the shared file.

If the calling process is not the first, it waits for the previous process to indicate the position in the file where it should write next. This method is systematically called before any new write to the file.

Returns
(Sortie&) *this

Reimplemented from Sortie.

Definition at line 127 of file EcrFicPartage.cpp.

◆ operator<<() [1/11]

Sortie & EcrFicPartage::operator<< ( const char * ob)
overridevirtual

Writes a character string.

Note: to correctly re-read the string in ASCII mode, it must not contain any separator (neither space nor newline, ...).

Reimplemented from Sortie.

Definition at line 277 of file EcrFicPartage.cpp.

◆ operator<<() [2/11]

Sortie & EcrFicPartage::operator<< ( const double ob)
overridevirtual

Reimplemented from Sortie.

Definition at line 289 of file EcrFicPartage.cpp.

◆ operator<<() [3/11]

Sortie & EcrFicPartage::operator<< ( const float ob)
overridevirtual

Reimplemented from Sortie.

Definition at line 288 of file EcrFicPartage.cpp.

◆ operator<<() [4/11]

Sortie & EcrFicPartage::operator<< ( const int ob)
overridevirtual

Reimplemented from Sortie.

Definition at line 286 of file EcrFicPartage.cpp.

◆ operator<<() [5/11]

Sortie & EcrFicPartage::operator<< ( const long long ob)
overridevirtual

Reimplemented from Sortie.

Definition at line 291 of file EcrFicPartage.cpp.

◆ operator<<() [6/11]

Sortie & EcrFicPartage::operator<< ( const long ob)
overridevirtual

Reimplemented from Sortie.

Definition at line 290 of file EcrFicPartage.cpp.

◆ operator<<() [7/11]

Sortie & EcrFicPartage::operator<< ( const Objet_U & ob)
overridevirtual

Writes an object or variable.

In this implementation (and in most derived classes), ob.printOn is simply called (except in Sortie_Nulle). Note: if the stream must be usable in either ASCII or BINARY mode, "<< space <<" or "<< finl <<" must be inserted between objects.

Reimplemented from Sortie.

Definition at line 285 of file EcrFicPartage.cpp.

◆ operator<<() [8/11]

Sortie & EcrFicPartage::operator<< ( const Separateur & s)
overridevirtual

Reimplemented from Sortie.

Definition at line 284 of file EcrFicPartage.cpp.

◆ operator<<() [9/11]

Sortie & EcrFicPartage::operator<< ( const std::string & ob)
overridevirtual

Reimplemented from Sortie.

Definition at line 283 of file EcrFicPartage.cpp.

◆ operator<<() [10/11]

Sortie & EcrFicPartage::operator<< ( const unsigned long ob)
overridevirtual

Reimplemented from Sortie.

Definition at line 292 of file EcrFicPartage.cpp.

◆ operator<<() [11/11]

Sortie & EcrFicPartage::operator<< ( const unsigned ob)
overridevirtual

Reimplemented from Sortie.

Definition at line 287 of file EcrFicPartage.cpp.

◆ ouvrir()

int EcrFicPartage::ouvrir ( const char * name,
IOS_OPEN_MODE mode = ios::out )
overridevirtual

Opens the file with the given mode and prot parameters. These parameters are the parameters of the standard open method.

Reimplemented from Sortie_Fichier_base.

Definition at line 53 of file EcrFicPartage.cpp.

◆ precision()

void EcrFicPartage::precision ( int i)
overridevirtual

Reimplemented from Sortie.

Definition at line 273 of file EcrFicPartage.cpp.

◆ put() [1/6]

int EcrFicPartage::put ( const double * ob,
std::streamsize n,
std::streamsize pas )
overridevirtual

Reimplemented from Sortie.

Definition at line 300 of file EcrFicPartage.cpp.

◆ put() [2/6]

int EcrFicPartage::put ( const float * ob,
std::streamsize n,
std::streamsize pas )
overridevirtual

Reimplemented from Sortie.

Definition at line 299 of file EcrFicPartage.cpp.

◆ put() [3/6]

int EcrFicPartage::put ( const int * ob,
std::streamsize n,
std::streamsize pas )
overridevirtual

Reimplemented from Sortie.

Definition at line 296 of file EcrFicPartage.cpp.

◆ put() [4/6]

int EcrFicPartage::put ( const long * ob,
std::streamsize n,
std::streamsize pas )
overridevirtual

Reimplemented from Sortie.

Definition at line 297 of file EcrFicPartage.cpp.

◆ put() [5/6]

int EcrFicPartage::put ( const long long * ob,
std::streamsize n,
std::streamsize pas )
overridevirtual

Reimplemented from Sortie.

Definition at line 298 of file EcrFicPartage.cpp.

◆ put() [6/6]

int EcrFicPartage::put ( const unsigned * ob,
std::streamsize n,
std::streamsize pas )
overridevirtual

Reimplemented from Sortie.

Definition at line 295 of file EcrFicPartage.cpp.

◆ set_64b()

void EcrFicPartage::set_64b ( bool is64)
overridevirtual

Reimplemented from AbstractIO.

Definition at line 309 of file EcrFicPartage.cpp.

◆ set_bin()

void EcrFicPartage::set_bin ( bool bin)
overridevirtual

Reimplemented from AbstractIO.

Definition at line 303 of file EcrFicPartage.cpp.

◆ syncfile()

Sortie & EcrFicPartage::syncfile ( )
overridevirtual

Triggers writing to disk of the data accumulated on the different processors since the last call to syncfile().

Data is written in ascending processor order. This function must be called the same number of times on all processors!

Example: processor 0: processor 1: file << "pe0 : 1" << finl; file << "pe1 : 1" << finl; file << "pe0 : 2" << finl; file << "pe1 : 2" << finl; file.syncfile(); file.syncfile(); file << "pe0 : 3" << finl; file << "pe1 : 3" << finl; file << "pe0 : 4" << finl; file.syncfile(); file.syncfile(); file << "pe0 : end" << finl; // processor 1 writes no data file.syncfile(); file.syncfile();

File contents: pe0 : 1 pe0 : 2 pe1 : 1 pe1 : 2 pe0 : 3 pe0 : 4 pe1 : 3 pe0 : end

Reimplemented from Sortie.

Definition at line 173 of file EcrFicPartage.cpp.

◆ unlockfile()

Sortie & EcrFicPartage::unlockfile ( )
overridevirtual

Releases the critical resource for the next process.

The calling process, unless it is the first process of the group, sends its current position to the next process in the group. This method should be called after each write to the file.

Returns
(Sortie&) *this

Reimplemented from Sortie.

Definition at line 141 of file EcrFicPartage.cpp.

Member Data Documentation

◆ nom_fic_

Nom EcrFicPartage::nom_fic_
protected

Definition at line 76 of file EcrFicPartage.h.


The documentation for this class was generated from the following files: