Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::ISimpleTableWriterHelper Class Referenceabstract

Class interface for writing a file using ISimpleTableReaderWriter. Provides methods for managing parallel writing and name symbols. More...

#include <arcane/core/ISimpleTableWriterHelper.h>

Public Member Functions

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

Detailed Description

Class interface for writing a file using ISimpleTableReaderWriter. Provides methods for managing parallel writing and name symbols.

This class is, in a way, a wrapper around ISimpleTableReaderWriter, which is quite basic. ISimpleTableWriterHelper is here to simplify the use of ISimpleTableReaderWriter.

In the SimpleTable part, name symbols are keywords surrounded by at signs () that will be replaced by their meaning during execution. In the SimpleTableWriterHelper implementation, there are currently two supported name symbols:

  • @proc_id@: Will be replaced by the process ID.
  • @num_procs@: Will be replaced by the number of processes. And in SimpleTableWriterHelper, these symbols are only replaced in the table name.

Definition at line 53 of file ISimpleTableWriterHelper.h.

Member Function Documentation

◆ fileName()

virtual String Arcane::ISimpleTableWriterHelper::fileName ( )
pure virtual

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.

◆ fileType()

virtual String Arcane::ISimpleTableWriterHelper::fileType ( )
pure virtual

Method to know the file type that will be used.

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

◆ init()

virtual bool Arcane::ISimpleTableWriterHelper::init ( const Directory & root_directory,
const String & table_name,
const String & directory_name )
pure virtual

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.

◆ internal()

virtual Ref< SimpleTableInternal > Arcane::ISimpleTableWriterHelper::internal ( )
pure virtual

Method to retrieve a reference to the SimpleTableInternal object used.

Returns
Ref<SimpleTableInternal> A copy of the reference.

◆ isFixed()

virtual bool Arcane::ISimpleTableWriterHelper::isFixed ( )
pure virtual

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

Returns
true If yes.
false If no.

◆ isForcedToUseScientificNotation()

virtual bool Arcane::ISimpleTableWriterHelper::isForcedToUseScientificNotation ( )
pure virtual

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

Returns
true If yes.
false If no.

◆ isOneFileByRanksPermited()

virtual bool Arcane::ISimpleTableWriterHelper::isOneFileByRanksPermited ( )
pure virtual

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.

◆ outputDirectory()

virtual String Arcane::ISimpleTableWriterHelper::outputDirectory ( )
pure virtual

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.

◆ outputDirectoryWithoutComputation()

virtual String Arcane::ISimpleTableWriterHelper::outputDirectoryWithoutComputation ( )
pure virtual

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

Name symbols are still present here.

Returns
String The directory.

◆ outputPath()

virtual Directory Arcane::ISimpleTableWriterHelper::outputPath ( )
pure virtual

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

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

Returns
String The path.

◆ precision()

virtual Integer Arcane::ISimpleTableWriterHelper::precision ( )
pure virtual

Method to retrieve the precision currently used for writing values.

Returns
Integer The precision.

Referenced by setPrecision().

◆ print()

virtual void Arcane::ISimpleTableWriterHelper::print ( Integer rank = 0)
pure virtual

Method to display the table.

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

◆ readerWriter()

virtual Ref< ISimpleTableReaderWriter > Arcane::ISimpleTableWriterHelper::readerWriter ( )
pure virtual

Method to retrieve a reference to the ISimpleTableReaderWriter object used.

Returns
Ref<ISimpleTableReaderWriter> A copy of the reference.

◆ rootPath()

virtual Directory Arcane::ISimpleTableWriterHelper::rootPath ( )
pure virtual

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

Example (relative): ./output/csv/

Returns
String The path.

◆ setFixed()

virtual void Arcane::ISimpleTableWriterHelper::setFixed ( bool fixed)
pure virtual

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.

◆ setForcedToUseScientificNotation()

virtual void Arcane::ISimpleTableWriterHelper::setForcedToUseScientificNotation ( bool use_scientific)
pure virtual

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.

◆ setOutputDirectory()

virtual void Arcane::ISimpleTableWriterHelper::setOutputDirectory ( const String & directory)
pure virtual

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

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

Parameters
directoryThe directory.

◆ setPrecision()

virtual void Arcane::ISimpleTableWriterHelper::setPrecision ( Integer precision)
pure virtual

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.

References precision().

◆ setReaderWriter()

virtual void Arcane::ISimpleTableWriterHelper::setReaderWriter ( const Ref< ISimpleTableReaderWriter > & simple_table_reader_writer)
pure virtual

Method to set a reference to an ISimpleTableReaderWriter.

Parameters
simple_table_reader_writerThe reference to an ISimpleTableReaderWriter.

◆ setTableName()

virtual void Arcane::ISimpleTableWriterHelper::setTableName ( const String & name)
pure virtual

Method to set the table name.

Parameters
nameThe name.

◆ tableName()

virtual String Arcane::ISimpleTableWriterHelper::tableName ( )
pure virtual

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.

◆ tableNameWithoutComputation()

virtual String Arcane::ISimpleTableWriterHelper::tableNameWithoutComputation ( )
pure virtual

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

Name symbols are still present here.

Returns
String The name.

◆ writeFile() [1/2]

virtual bool Arcane::ISimpleTableWriterHelper::writeFile ( const Directory & root_directory,
Integer rank )
pure virtual

Method to write the table to a file. If rank != -1, processes other than rank return true.

For example, in the SimpleTableWriterHelper implementation, the file(s) will be written in the directory: root_directory/[directory_name]/[table_name].[ISimpleTableReaderWriter.fileType()]

Parameters
root_directoryThe root directory where the tables directory should be created.
rankThe process ID that should write the table to a file (-1 to signify "all processes").
Returns
true If the file was written correctly.
false If the file was not written correctly.

◆ writeFile() [2/2]

virtual bool Arcane::ISimpleTableWriterHelper::writeFile ( Integer rank = -1)
pure virtual

Method to write the table to a file. If rank != -1, processes other than rank return true.

For example, in the SimpleTableWriterHelper implementation, the file(s) will be written in the directory: ./[output]/[directory_name]/[table_name].[ISimpleTableReaderWriter.fileType()]

Parameters
rankThe process ID that should write the table to a file (-1 to signify "all processes").
Returns
true If the file was written correctly.
false If the file was not written correctly.

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