TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
AbstractIO Class Reference

Base class for all input/output streams. More...

#include <AbstractIO.h>

Inheritance diagram for AbstractIO:
[legend]

Public Member Functions

bool is_64b () const
virtual void set_64b (bool is_64b)
virtual void set_bin (bool bin)
bool is_bin ()
void set_avoid_conversion (bool avoid)
bool avoid_conversion ()

Protected Member Functions

 AbstractIO ()
virtual ~AbstractIO ()
template<typename _TYPE_>
bool must_convert () const
 Whether to convert an int into a long when reading/writing out data.

Protected Attributes

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

Detailed Description

Base class for all input/output streams.

Holds information about binary/ascii format, and 32b/64b information.

  • bin_ indicates whether the stream is binary or ASCII
  • is_64b_ incidates whether the stream is in 64b or 32b
  • avoid_conversion_ is used for MPI Comm buffer, where we do not want any int/long conversion.

See method must_convert() and file arch.h.in for more explanations on 32/64b.

Note that the .sauv files for example are always written in 32b.

See also
Entree, Sortie, and specifically the comments in operator_template<>() method.

Definition at line 34 of file AbstractIO.h.

Constructor & Destructor Documentation

◆ AbstractIO()

AbstractIO::AbstractIO ( )
protected

Definition at line 20 of file AbstractIO.cpp.

◆ ~AbstractIO()

virtual AbstractIO::~AbstractIO ( )
inlineprotectedvirtual

Definition at line 46 of file AbstractIO.h.

Member Function Documentation

◆ avoid_conversion()

bool AbstractIO::avoid_conversion ( )
inline

Definition at line 42 of file AbstractIO.h.

◆ is_64b()

bool AbstractIO::is_64b ( ) const
inline

Definition at line 37 of file AbstractIO.h.

◆ is_bin()

bool AbstractIO::is_bin ( )
inline

Definition at line 40 of file AbstractIO.h.

◆ must_convert()

template<typename _TYPE_>
template bool AbstractIO::must_convert< double > ( ) const
protected

Whether to convert an int into a long when reading/writing out data.

The rules are:

  • for 32 files, everything is read/written as 'int', even if TYPE 'long' (or trustIdType) was requested - overflow is checked in Entree/Sortie classes
  • for 64 files, everything is read/written as 'long', even if TYPE 'int' (or trustIdType) was requested This is for historical reasons: in the former 64b version of TRUST all int were replaced by long, we need to keep backward compatibility. When we read a former .sauv file written prior to 1.9.5 for example, all integer values are 'long'. But we might need to load them in an 'int' variable (for example this is the case with the 'format_sauvegarde' value in Probleme_base).

Note however that we can force the file to written in 32b even when running the 64b executable, thanks to the is_64b flag. This is what we do in Problem_base, save/restart logic.

Definition at line 44 of file AbstractIO.cpp.

◆ set_64b()

virtual void AbstractIO::set_64b ( bool is_64b)
inlinevirtual

Reimplemented in EcrFicPartage.

Definition at line 38 of file AbstractIO.h.

◆ set_avoid_conversion()

void AbstractIO::set_avoid_conversion ( bool avoid)
inline

Definition at line 41 of file AbstractIO.h.

◆ set_bin()

virtual void AbstractIO::set_bin ( bool bin)
inlinevirtual

Member Data Documentation

◆ avoid_conversion_

bool AbstractIO::avoid_conversion_ = false
protected

If true, no hacking on int/long is performed in operator_template() methods of Entree/Sortie This is useful for CommBuffer classes (=MPI exchanges) where we always want int to be sent as int, and long to be sent as long.

Definition at line 57 of file AbstractIO.h.

◆ bin_

bool AbstractIO::bin_ = false
protected

Is this a binary flux?

Definition at line 50 of file AbstractIO.h.

◆ is_64b_

bool AbstractIO::is_64b_
protected

Will we be reading/writing in 64b? (Init in ctor to avoid including arch.h probably).

Definition at line 51 of file AbstractIO.h.


The documentation for this class was generated from the following files:
  • /home/docs/checkouts/readthedocs.org/user_builds/cea-trust-platform/checkouts/master/src/Kernel/Utilitaires/AbstractIO.h
  • /home/docs/checkouts/readthedocs.org/user_builds/cea-trust-platform/checkouts/master/src/Kernel/Utilitaires/AbstractIO.cpp