Class interface for writing a file using ISimpleTableReaderWriter. Provides methods for managing parallel writing and name symbols.
More...
#include <arcane/core/ISimpleTableWriterHelper.h>
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.
◆ 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_name | The table name (and the output file name). |
| directory_name | The folder name where the tables will be saved. |
◆ internal()
◆ 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
-
| rank | The process ID that should display the table (-1 to signify "all processes"). |
◆ readerWriter()
◆ 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
-
| fixed | Whether 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_scientific | Whether 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
-
◆ 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
-
References precision().
◆ setReaderWriter()
◆ setTableName()
| virtual void Arcane::ISimpleTableWriterHelper::setTableName |
( |
const String & | name | ) |
|
|
pure virtual |
Method to set the table name.
- Parameters
-
◆ 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_directory | The root directory where the tables directory should be created. |
| rank | The 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
-
| rank | The 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: