Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::SimpleTableWriterHelper Class Reference
Inheritance diagram for Arcane::SimpleTableWriterHelper:
Collaboration diagram for Arcane::SimpleTableWriterHelper:

Public Member Functions

 SimpleTableWriterHelper (const Ref< ISimpleTableReaderWriter > &simple_table_reader_writer)
bool init (const Directory &root_directory, const String &table_name, const String &directory_name) override
 Method to initialize the object. Specifically, the table name and the directory name that will contain the files (the tables directory/directory_name).
void print (Integer rank) override
 Method to display the table.
bool writeFile (Integer rank) override
bool writeFile (const Directory &root_directory, Integer rank) override
Integer precision () override
 Method to retrieve the precision currently used for writing values.
void setPrecision (Integer precision) override
 Method to modify the print precision.
bool isFixed () override
 Method to check if the 'std::fixed' flag is active for writing values.
void setFixed (bool fixed) override
 Method to set or unset the 'std::fixed' flag.
bool isForcedToUseScientificNotation () override
 Method to check if the 'std::scientific' flag is active for writing values.
void setForcedToUseScientificNotation (bool use_scientific) override
 Method to set or unset the 'std::scientific' flag.
String outputDirectory () override
 Method to retrieve the directory name where the tables will be placed.
String outputDirectoryWithoutComputation () override
 Method to retrieve the directory name as it was previously provided.
void setOutputDirectory (const String &directory) override
 Method to set the directory where the tables should be saved.
String tableName () override
 Method to retrieve the table name.
String tableNameWithoutComputation () override
 Method to retrieve the table name as it was previously provided.
void setTableName (const String &name) override
 Method to set the table name.
String fileName () override
 Method to retrieve the file name.
Directory outputPath () override
 Method to retrieve the path where the tables will be saved.
Directory rootPath () override
 Method to retrieve the path where the implementation saves these tables.
String fileType () override
 Method to know the file type that will be used.
bool isOneFileByRanksPermited () override
 Method to check if the parameters currently held by the implementation allow it to write a file per process, especially thanks to name symbols.
Ref< SimpleTableInternalinternal () override
 Method to retrieve a reference to the SimpleTableInternal object used.
Ref< ISimpleTableReaderWriterreaderWriter () override
 Method to retrieve a reference to the ISimpleTableReaderWriter object used.
void setReaderWriter (const Ref< ISimpleTableReaderWriter > &simple_table_reader_writer) override
 Method to set a reference to an ISimpleTableReaderWriter.

Protected Member Functions

void _computeTableName ()
void _computeOutputDirectory ()
String _computeName (String name, bool &one_file_by_ranks_permited)
 Method allowing replacement of name symbols by their value.

Protected Attributes

Ref< SimpleTableInternalm_simple_table_internal
Ref< ISimpleTableReaderWriterm_simple_table_reader_writer
String m_name_output_directory
String m_name_output_directory_without_computation
String m_name_table_without_computation
Directory m_root
bool m_name_table_computed
bool m_name_output_directory_computed
bool m_name_table_one_file_by_ranks_permited
bool m_name_output_directory_one_file_by_ranks_permited

Detailed Description

Definition at line 35 of file SimpleTableWriterHelper.h.

Constructor & Destructor Documentation

◆ SimpleTableWriterHelper() [1/2]

Arcane::SimpleTableWriterHelper::SimpleTableWriterHelper ( const Ref< ISimpleTableReaderWriter > & simple_table_reader_writer)
inline

Definition at line 40 of file SimpleTableWriterHelper.h.

◆ SimpleTableWriterHelper() [2/2]

Arcane::SimpleTableWriterHelper::SimpleTableWriterHelper ( )
inline

Definition at line 55 of file SimpleTableWriterHelper.h.

Member Function Documentation

◆ _computeName()

String Arcane::SimpleTableWriterHelper::_computeName ( String name,
bool & one_file_by_ranks_permited )
protected

Method allowing replacement of name symbols by their value.

Parameters
name[IN] The name to modify.
one_file_by_ranks_permited[OUT] True if the name contains the symbol '@proc_id@' allowing differentiation of files written by different processes.
Returns
String The name with the symbols replaced.

Definition at line 282 of file SimpleTableWriterHelper.cc.

References Arcane::StringBuilder::append(), Arcane::AbstractArray< T >::size(), Arcane::Array< T >::span(), Arcane::String::split(), Arcane::String::startsWith(), and Arcane::StringBuilder::toString().

Here is the call graph for this function:

◆ _computeOutputDirectory()

void Arcane::SimpleTableWriterHelper::_computeOutputDirectory ( )
protected

Definition at line 264 of file SimpleTableWriterHelper.cc.

◆ _computeTableName()

void Arcane::SimpleTableWriterHelper::_computeTableName ( )
protected

Definition at line 255 of file SimpleTableWriterHelper.cc.

◆ fileName()

String Arcane::SimpleTableWriterHelper::fileName ( )
overridevirtual

Method to retrieve the file name.

May be different for each process (depending on the implementation).

Name symbols have been resolved and the extension is added here.

Returns
String The name.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 193 of file SimpleTableWriterHelper.cc.

◆ fileType()

String Arcane::SimpleTableWriterHelper::fileType ( )
overridevirtual

Method to know the file type that will be used.

Returns
String The output file type (= the extension).

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 222 of file SimpleTableWriterHelper.cc.

◆ init()

bool Arcane::SimpleTableWriterHelper::init ( const Directory & root_directory,
const String & table_name,
const String & directory_name )
overridevirtual

Method to initialize the object. Specifically, the table name and the directory name that will contain the files (the tables directory/directory_name).

Parameters
table_nameThe table name (and the output file name).
directory_nameThe folder name where the tables will be saved.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 34 of file SimpleTableWriterHelper.cc.

References setOutputDirectory(), and setTableName().

Here is the call graph for this function:

◆ internal()

Ref< SimpleTableInternal > Arcane::SimpleTableWriterHelper::internal ( )
overridevirtual

Method to retrieve a reference to the SimpleTableInternal object used.

Returns
Ref<SimpleTableInternal> A copy of the reference.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 231 of file SimpleTableWriterHelper.cc.

◆ isFixed()

bool Arcane::SimpleTableWriterHelper::isFixed ( )
overridevirtual

Method to check if the 'std::fixed' flag is active for writing values.

Returns
true If yes.
false If no.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 118 of file SimpleTableWriterHelper.cc.

◆ isForcedToUseScientificNotation()

bool Arcane::SimpleTableWriterHelper::isForcedToUseScientificNotation ( )
overridevirtual

Method to check if the 'std::scientific' flag is active for writing values.

Returns
true If yes.
false If no.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 130 of file SimpleTableWriterHelper.cc.

◆ isOneFileByRanksPermited()

bool Arcane::SimpleTableWriterHelper::isOneFileByRanksPermited ( )
overridevirtual

Method to check if the parameters currently held by the implementation allow it to write a file per process, especially thanks to name symbols.

Returns
true If yes, the implementation can write a file per process.
false Otherwise, only one file can be written.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 213 of file SimpleTableWriterHelper.cc.

Referenced by writeFile().

Here is the caller graph for this function:

◆ outputDirectory()

String Arcane::SimpleTableWriterHelper::outputDirectory ( )
overridevirtual

Method to retrieve the directory name where the tables will be placed.

May be different for each process (depending on the implementation).

Name symbols have been resolved here.

Returns
String The directory.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 145 of file SimpleTableWriterHelper.cc.

◆ outputDirectoryWithoutComputation()

String Arcane::SimpleTableWriterHelper::outputDirectoryWithoutComputation ( )
overridevirtual

Method to retrieve the directory name as it was previously provided.

Name symbols are still present here.

Returns
String The directory.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 152 of file SimpleTableWriterHelper.cc.

◆ outputPath()

Directory Arcane::SimpleTableWriterHelper::outputPath ( )
overridevirtual

Method to retrieve the path where the tables will be saved.

Example (relative): ./output/csv/[directory_name]/

Returns
String The path.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 200 of file SimpleTableWriterHelper.cc.

◆ precision()

Integer Arcane::SimpleTableWriterHelper::precision ( )
overridevirtual

Method to retrieve the precision currently used for writing values.

Returns
Integer The precision.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 106 of file SimpleTableWriterHelper.cc.

Referenced by setPrecision().

Here is the caller graph for this function:

◆ print()

void Arcane::SimpleTableWriterHelper::print ( Integer rank)
overridevirtual

Method to display the table.

Parameters
rankThe process ID that should display the table (-1 to signify "all processes").

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 50 of file SimpleTableWriterHelper.cc.

◆ readerWriter()

Ref< ISimpleTableReaderWriter > Arcane::SimpleTableWriterHelper::readerWriter ( )
overridevirtual

Method to retrieve a reference to the ISimpleTableReaderWriter object used.

Returns
Ref<ISimpleTableReaderWriter> A copy of the reference.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 237 of file SimpleTableWriterHelper.cc.

◆ rootPath()

Directory Arcane::SimpleTableWriterHelper::rootPath ( )
overridevirtual

Method to retrieve the path where the implementation saves these tables.

Example (relative): ./output/csv/

Returns
String The path.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 207 of file SimpleTableWriterHelper.cc.

◆ setFixed()

void Arcane::SimpleTableWriterHelper::setFixed ( bool fixed)
overridevirtual

Method to set or unset the 'std::fixed' flag.

Applicable to both the 'print()' method and the 'writeFile()' methods.

This flag allows 'forcing' the number of digits after the comma to the desired precision. For example, if 'setPrecision(4)' was called, and 'setFixed(true)' is called, the print of '6.1' will output '6.1000'.

Warning
The "std::fixed" flag modifies the behavior of "setPrecision()"; if the "std::fixed" flag is disabled, the precision defines the total number of digits (before and after the comma); if the "std::fixed" flag is enabled, the precision defines the number of digits after the comma. Be careful when using "std::numeric_limits<Real>::max_digits10" (for writing) or "std::numeric_limits<Real>::digits10" (for reading), which should be used without the "std::fixed" flag.
Parameters
fixedWhether the 'std::fixed' flag should be set or not.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 124 of file SimpleTableWriterHelper.cc.

◆ setForcedToUseScientificNotation()

void Arcane::SimpleTableWriterHelper::setForcedToUseScientificNotation ( bool use_scientific)
overridevirtual

Method to set or unset the 'std::scientific' flag.

Applicable to both the 'print()' method and the 'writetable()' method.

This flag allows 'forcing' the display of values in scientific notation.

Parameters
use_scientificWhether the 'std::scientific' flag should be set or not.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 136 of file SimpleTableWriterHelper.cc.

◆ setOutputDirectory()

void Arcane::SimpleTableWriterHelper::setOutputDirectory ( const String & directory)
overridevirtual

Method to set the directory where the tables should be saved.

May be different for each process (depending on the implementation).

Parameters
directoryThe directory.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 158 of file SimpleTableWriterHelper.cc.

Referenced by init().

Here is the caller graph for this function:

◆ setPrecision()

void Arcane::SimpleTableWriterHelper::setPrecision ( Integer precision)
overridevirtual

Method to modify the print precision.

Applicable to both the 'print()' method and the 'writeFile()' methods.

Warning
The "std::fixed" flag modifies the behavior of "setPrecision()"; if the "std::fixed" flag is disabled, the precision defines the total number of digits (before and after the comma); if the "std::fixed" flag is enabled, the precision defines the number of digits after the comma. Be careful when using "std::numeric_limits<Real>::max_digits10" (for writing) or "std::numeric_limits<Real>::digits10" (for reading), which should be used without the "std::fixed" flag.
Parameters
precisionThe new precision.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 112 of file SimpleTableWriterHelper.cc.

References precision().

Here is the call graph for this function:

◆ setReaderWriter()

void Arcane::SimpleTableWriterHelper::setReaderWriter ( const Ref< ISimpleTableReaderWriter > & simple_table_reader_writer)
overridevirtual

Method to set a reference to an ISimpleTableReaderWriter.

Parameters
simple_table_reader_writerThe reference to an ISimpleTableReaderWriter.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 243 of file SimpleTableWriterHelper.cc.

References ARCANE_FATAL, and Arcane::RefImpl< InstanceType, RefClassType, ImplTagId >::isNull().

Here is the call graph for this function:

◆ setTableName()

void Arcane::SimpleTableWriterHelper::setTableName ( const String & name)
overridevirtual

Method to set the table name.

Parameters
nameThe name.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 182 of file SimpleTableWriterHelper.cc.

Referenced by init().

Here is the caller graph for this function:

◆ tableName()

String Arcane::SimpleTableWriterHelper::tableName ( )
overridevirtual

Method to retrieve the table name.

May be different for each process (depending on the implementation).

Name symbols have been resolved here.

Returns
String The name.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 169 of file SimpleTableWriterHelper.cc.

◆ tableNameWithoutComputation()

String Arcane::SimpleTableWriterHelper::tableNameWithoutComputation ( )
overridevirtual

Method to retrieve the table name as it was previously provided.

Name symbols are still present here.

Returns
String The name.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 176 of file SimpleTableWriterHelper.cc.

◆ writeFile() [1/2]

bool Arcane::SimpleTableWriterHelper::writeFile ( const Directory & root_directory,
Integer rank )
overridevirtual

Method performing collective operations.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 61 of file SimpleTableWriterHelper.cc.

References Arcane::SimpleTableReaderWriterUtils::createDirectoryOnlyProcess0(), and isOneFileByRanksPermited().

Here is the call graph for this function:

◆ writeFile() [2/2]

bool Arcane::SimpleTableWriterHelper::writeFile ( Integer rank)
overridevirtual

Method performing collective operations.

Implements Arcane::ISimpleTableWriterHelper.

Definition at line 97 of file SimpleTableWriterHelper.cc.

References writeFile().

Referenced by writeFile().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_name_output_directory

String Arcane::SimpleTableWriterHelper::m_name_output_directory
protected

Definition at line 120 of file SimpleTableWriterHelper.h.

◆ m_name_output_directory_computed

bool Arcane::SimpleTableWriterHelper::m_name_output_directory_computed
protected

Definition at line 127 of file SimpleTableWriterHelper.h.

◆ m_name_output_directory_one_file_by_ranks_permited

bool Arcane::SimpleTableWriterHelper::m_name_output_directory_one_file_by_ranks_permited
protected

Definition at line 133 of file SimpleTableWriterHelper.h.

◆ m_name_output_directory_without_computation

String Arcane::SimpleTableWriterHelper::m_name_output_directory_without_computation
protected

Definition at line 121 of file SimpleTableWriterHelper.h.

◆ m_name_table_computed

bool Arcane::SimpleTableWriterHelper::m_name_table_computed
protected

Definition at line 126 of file SimpleTableWriterHelper.h.

◆ m_name_table_one_file_by_ranks_permited

bool Arcane::SimpleTableWriterHelper::m_name_table_one_file_by_ranks_permited
protected

Definition at line 132 of file SimpleTableWriterHelper.h.

◆ m_name_table_without_computation

String Arcane::SimpleTableWriterHelper::m_name_table_without_computation
protected

Definition at line 122 of file SimpleTableWriterHelper.h.

◆ m_root

Directory Arcane::SimpleTableWriterHelper::m_root
protected

Definition at line 124 of file SimpleTableWriterHelper.h.

◆ m_simple_table_internal

Ref<SimpleTableInternal> Arcane::SimpleTableWriterHelper::m_simple_table_internal
protected

Definition at line 117 of file SimpleTableWriterHelper.h.

◆ m_simple_table_reader_writer

Ref<ISimpleTableReaderWriter> Arcane::SimpleTableWriterHelper::m_simple_table_reader_writer
protected

Definition at line 118 of file SimpleTableWriterHelper.h.


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