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

Public Member Functions

 SimpleCsvComparatorService (const ServiceBuildInfo &sbi)
void init (ISimpleTableOutput *simple_table_output_ptr) override
 Method allowing the service to be initialized.
void clear () override
 Method allowing the data read by readReferenceFile() to be cleared.
void editRootDirectory (const Directory &root_directory) override
 Method allowing the root directory to be modified. This allows writing or searching for reference files elsewhere than in the directory determined by the implementation.
void print (Integer rank) override
 Method allowing the read table to be displayed.
bool writeReferenceFile (Integer rank) override
bool readReferenceFile (Integer rank) override
 Method allowing reference files to be read.
bool isReferenceExist (Integer rank) override
 Method allowing to check if the reference files exist.
bool compareWithReference (Integer rank, bool compare_dimension_too) override
 Method allowing the ISimpleTableOutput object to be compared to the reference files.
bool compareElemWithReference (const String &column_name, const String &row_name, Integer rank) override
 Method allowing only an element to be compared. Both SimpleTableInternals are represented by Refs, so they are always up to date. This method can be used during calculation, allowing to compare values as the calculation progresses, instead of performing a final comparison at the end (it is still possible to do both).
bool compareElemWithReference (Real elem, const String &column_name, const String &row_name, Integer rank) override
 Method allowing a value to be compared with a value from the reference table. This method does not need an internal 'toCompare' (setInternalToCompare() unnecessary).
bool addColumnForComparing (const String &column_name) override
 Method allowing a column to be added to the list of columns to be compared.
bool addRowForComparing (const String &row_name) override
 Method allowing a row to be added to the list of rows to be compared.
void isAnArrayExclusiveColumns (bool is_exclusive) override
 Method allowing definition whether the array of columns represents the columns to include in the comparison (false/default) or represents the columns to exclude from the comparison (true).
void isAnArrayExclusiveRows (bool is_exclusive) override
 Method allowing definition whether the array of rows represents the rows to include in the comparison (false/default) or represents the rows to exclude from the comparison (true).
void editRegexColumns (const String &regex_column) override
 Method allowing a regular expression to be added to determine the columns to compare.
void editRegexRows (const String &regex_row) override
 Method allowing a regular expression to be added to determine the rows to compare.
void isARegexExclusiveColumns (bool is_exclusive) override
 Method allowing to request that the regular expression excludes columns instead of including them.
void isARegexExclusiveRows (bool is_exclusive) override
 Method allowing to request that the regular expression excludes rows instead of including them.
bool addEpsilonColumn (const String &column_name, Real epsilon) override
 Method allowing an epsilon to be defined for a given column. This epsilon must be positive to be taken into account. If there is a conflict with a row epsilon (defined with addEpsilonRow()), the largest epsilon is taken into account.
bool addEpsilonRow (const String &row_name, Real epsilon) override
 Method allowing an epsilon to be defined for a given row. This epsilon must be positive to be taken into account. If there is a conflict with a column epsilon (defined with addEpsilonColumn()), the largest epsilon is taken into account.
Public Member Functions inherited from ArcaneSimpleCsvComparatorObject
 ArcaneSimpleCsvComparatorObject (const Arcane::ServiceBuildInfo &sbi)
 Constructeur.
virtual ~ArcaneSimpleCsvComparatorObject ()
 Destructeur.
CaseOptionsSimpleCsvComparatoroptions () const
 Options du jeu de données du service.
Public Member Functions inherited from Arcane::BasicService
 ~BasicService () override
 Releases resources.
virtual ISubDomainsubDomain ()
Public Member Functions inherited from Arcane::AbstractService
 ~AbstractService () override
 Destructor.
virtual void build ()
 Build-level construction of the service.
IServiceInfoserviceInfo () const override
 Access to service information. See IServiceInfo for details.
IBaseserviceParent () const override
 Access to the base interface of main Arcane objects.
IServiceserviceInterface () override
 Returns the low-level IService interface of the service.
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () const
 Trace manager.
TraceMessage info () const
 Flow for an information message.
TraceMessage pinfo () const
 Flow for a parallel information message.
TraceMessage info (char category) const
 Flow for an information message of a given category.
TraceMessage pinfo (char category) const
 Flow for a parallel information message of a given category.
TraceMessage info (bool v) const
 Flow for an information message.
TraceMessage warning () const
 Flow for a warning message.
TraceMessage pwarning () const
TraceMessage error () const
 Flow for an error message.
TraceMessage perror () const
TraceMessage log () const
 Flow for a log message.
TraceMessage plog () const
 Flow for a log message.
TraceMessage logdate () const
 Flow for a log message preceded by the date.
TraceMessage fatal () const
 Flow for a fatal error message.
TraceMessage pfatal () const
 Flow for a parallel fatal error message.
TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium) const
 Flow for a debug message.
Trace::eDebugLevel configDbgLevel () const
 Debug level of the configuration file.
TraceMessage info (Int32 verbose_level) const
 Flow for an information message of a given level.
TraceMessage linfo () const
 Flow for an information message with the local information level of this instance.
TraceMessage linfo (Int32 relative_level) const
 Flow for an information message with the local information level of this instance.
void fatalMessage (const StandaloneTraceMessage &o) const
Public Member Functions inherited from Arcane::IService
virtual ~IService ()
 Releases resources.
Public Member Functions inherited from Arcane::MeshAccessor
 MeshAccessor (ISubDomain *sd)
 MeshAccessor (IMesh *mesh)
 MeshAccessor (const MeshHandle &mesh_handle)
Integer nbCell () const
 Returns the number of cells in the mesh.
Integer nbFace () const
 Returns the number of faces in the mesh.
Integer nbEdge () const
 Returns the number of edges in the mesh.
Integer nbNode () const
 Returns the number of nodes in the mesh.
VariableNodeReal3nodesCoordinates () const
 Returns the coordinates of the mesh nodes.
NodeGroup allNodes () const
 Returns the group containing all nodes.
EdgeGroup allEdges () const
 Returns the group containing all edges.
FaceGroup allFaces () const
 Returns the group containing all faces.
CellGroup allCells () const
 Returns the group containing all cells.
FaceGroup outerFaces () const
 Returns the group containing all boundary faces.
NodeGroup ownNodes () const
 Returns the group containing all nodes specific to this domain.
CellGroup ownCells () const
 Returns the group containing all cells specific to this domain.
FaceGroup ownFaces () const
 Group containing all faces specific to this domain.
EdgeGroup ownEdges () const
 Group containing all edges specific to this domain.
IMeshmesh () const
const MeshHandlemeshHandle () const
Public Member Functions inherited from Arcane::CommonVariables
 CommonVariables (IModule *c)
 Constructs the references of the common variables for the module c.
 CommonVariables (IVariableMng *variable_mng)
 Constructs the references of the common variables for the manager variable_mng.
 CommonVariables (ISubDomain *sd)
 Constructs the references of the common variables for the subdomain sd.
virtual ~CommonVariables ()
 Releases resources.
Int32 globalIteration () const
 Current iteration number.
Real globalTime () const
 Current time.
Real globalOldTime () const
 Previous current time.
Real globalFinalTime () const
 Final time of the simulation.
Real globalDeltaT () const
 Current Delta T.
Real globalCPUTime () const
 CPU time used (in seconds).
Real globalOldCPUTime () const
 Previous CPU time used (in seconds).
Real globalElapsedTime () const
 Clock time (elapsed) used (in seconds).
Real globalOldElapsedTime () const
 Previous clock time (elapsed) used (in seconds).

Private Member Functions

bool _exploreColumn (Integer position)
bool _exploreRows (Integer position)

Private Attributes

ISimpleTableOutputm_simple_table_output_ptr
Directory m_reference_path
Directory m_root_path
String m_output_directory
String m_file_name
String m_table_name
std::ifstream m_ifstream
bool m_is_file_open
bool m_is_file_read
Ref< SimpleTableInternalm_simple_table_internal_reference
Ref< SimpleTableInternalm_simple_table_internal_to_compare
SimpleTableInternalComparator m_simple_table_internal_comparator
SimpleCsvReaderWriter m_simple_csv_reader_writer
bool m_is_already_init

Additional Inherited Members

Static Public Member Functions inherited from ArcaneSimpleCsvComparatorObject
template<typename ServiceClassType>
static void fillServiceInfo (Arcane::ServiceInfo *si)
Public Attributes inherited from Arcane::CommonVariables
VariableScalarInt32 m_global_iteration
 Current iteration.
VariableScalarReal m_global_time
 Current time.
VariableScalarReal m_global_deltat
 Global Delta T.
VariableScalarReal m_global_old_time
 Time previous to the current time.
VariableScalarReal m_global_old_deltat
 Delta T at the time previous to the global time.
VariableScalarReal m_global_final_time
 Final time of the case.
VariableScalarReal m_global_old_cpu_time
 Previous CPU time used (in seconds).
VariableScalarReal m_global_cpu_time
 CPU time used (in seconds).
VariableScalarReal m_global_old_elapsed_time
 Previous clock time used (in seconds).
VariableScalarReal m_global_elapsed_time
 Clock time used (in seconds).
Protected Member Functions inherited from Arcane::BasicService
 BasicService (const ServiceBuildInfo &)
Protected Member Functions inherited from Arcane::AbstractService
 AbstractService (const ServiceBuildInfo &)
 Constructor from a ServiceBuildInfo.
Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const
Protected Member Functions inherited from Arcane::IService
 IService ()
 Constructor.

Detailed Description

Definition at line 39 of file SimpleCsvComparatorService.h.

Constructor & Destructor Documentation

◆ SimpleCsvComparatorService()

Arcane::SimpleCsvComparatorService::SimpleCsvComparatorService ( const ServiceBuildInfo & sbi)
inlineexplicit

Definition at line 44 of file SimpleCsvComparatorService.h.

Member Function Documentation

◆ addColumnForComparing()

bool Arcane::SimpleCsvComparatorService::addColumnForComparing ( const String & column_name)
overridevirtual

Method allowing a column to be added to the list of columns to be compared.

Parameters
column_nameThe name of the column to compare.
Returns
true If the name was successfully added.
false Otherwise.

Implements Arcane::ISimpleTableComparator.

Definition at line 215 of file SimpleCsvComparatorService.cc.

◆ addEpsilonColumn()

bool Arcane::SimpleCsvComparatorService::addEpsilonColumn ( const String & column_name,
Real epsilon )
overridevirtual

Method allowing an epsilon to be defined for a given column. This epsilon must be positive to be taken into account. If there is a conflict with a row epsilon (defined with addEpsilonRow()), the largest epsilon is taken into account.

Note
If an epsilon has already been defined on this column, then the old epsilon will be replaced.
Parameters
column_nameThe name of the column where the epsilon will be taken into account.
epsilonThe epsilon error margin.
Returns
true If the epsilon could be defined.
false If the epsilon could not be defined.

Implements Arcane::ISimpleTableComparator.

Definition at line 287 of file SimpleCsvComparatorService.cc.

◆ addEpsilonRow()

bool Arcane::SimpleCsvComparatorService::addEpsilonRow ( const String & row_name,
Real epsilon )
overridevirtual

Method allowing an epsilon to be defined for a given row. This epsilon must be positive to be taken into account. If there is a conflict with a column epsilon (defined with addEpsilonColumn()), the largest epsilon is taken into account.

Note
If an epsilon has already been defined on this row, then the old epsilon will be replaced.
Parameters
column_nameThe name of the row where the epsilon will be taken into account.
epsilonThe epsilon error margin.
Returns
true If the epsilon could be defined.
false If the epsilon could not be defined.

Implements Arcane::ISimpleTableComparator.

Definition at line 296 of file SimpleCsvComparatorService.cc.

◆ addRowForComparing()

bool Arcane::SimpleCsvComparatorService::addRowForComparing ( const String & row_name)
overridevirtual

Method allowing a row to be added to the list of rows to be compared.

Parameters
row_nameThe name of the row to compare.
Returns
true If the name was successfully added.
false Otherwise.

Implements Arcane::ISimpleTableComparator.

Definition at line 224 of file SimpleCsvComparatorService.cc.

◆ clear()

void Arcane::SimpleCsvComparatorService::clear ( )
overridevirtual

Method allowing the data read by readReferenceFile() to be cleared.

Note
Clears the comparator's SimpleTableInternal without affecting that of the SimpleTableOutput.

Implements Arcane::ISimpleTableComparator.

Definition at line 66 of file SimpleCsvComparatorService.cc.

◆ compareElemWithReference() [1/2]

bool Arcane::SimpleCsvComparatorService::compareElemWithReference ( const String & column_name,
const String & row_name,
Integer rank )
overridevirtual

Method allowing only an element to be compared. Both SimpleTableInternals are represented by Refs, so they are always up to date. This method can be used during calculation, allowing to compare values as the calculation progresses, instead of performing a final comparison at the end (it is still possible to do both).

Parameters
column_nameThe name of the column where the element is located.
row_nameThe name of the row where the element is located.
rankThe process that must compare its results (-1 for all processes).
Returns
true If the two values are equal.
false If the two values are different.

Implements Arcane::ISimpleTableComparator.

Definition at line 177 of file SimpleCsvComparatorService.cc.

References Arcane::TraceAccessor::error(), and readReferenceFile().

Here is the call graph for this function:

◆ compareElemWithReference() [2/2]

bool Arcane::SimpleCsvComparatorService::compareElemWithReference ( Real elem,
const String & column_name,
const String & row_name,
Integer rank )
overridevirtual

Method allowing a value to be compared with a value from the reference table. This method does not need an internal 'toCompare' (setInternalToCompare() unnecessary).

Parameters
elemThe value to be compared.
column_nameThe name of the column where the reference element is located.
row_nameThe name of the row where the reference element is located.
rankThe process that must compare its results (-1 for all processes).
Returns
true If the two values are equal.
false If the two values are different.

Implements Arcane::ISimpleTableComparator.

Definition at line 196 of file SimpleCsvComparatorService.cc.

References Arcane::TraceAccessor::error(), and readReferenceFile().

Here is the call graph for this function:

◆ compareWithReference()

bool Arcane::SimpleCsvComparatorService::compareWithReference ( Integer rank,
bool compare_dimension_too )
overridevirtual

Method allowing the ISimpleTableOutput object to be compared to the reference files.

Parameters
rankThe process that must compare its results (-1 for all processes).
compare_dimension_tooWhether the dimensions of the value tables should also be compared.
Returns
true If there are no differences (and if calling process != rank).
false If there is at least one difference.

Implements Arcane::ISimpleTableComparator.

Definition at line 158 of file SimpleCsvComparatorService.cc.

References Arcane::TraceAccessor::error(), and readReferenceFile().

Here is the call graph for this function:

◆ editRegexColumns()

void Arcane::SimpleCsvComparatorService::editRegexColumns ( const String & regex_column)
overridevirtual

Method allowing a regular expression to be added to determine the columns to compare.

Parameters
regex_columnThe regular expression (ECMAScript format).

Implements Arcane::ISimpleTableComparator.

Definition at line 251 of file SimpleCsvComparatorService.cc.

◆ editRegexRows()

void Arcane::SimpleCsvComparatorService::editRegexRows ( const String & regex_row)
overridevirtual

Method allowing a regular expression to be added to determine the rows to compare.

Parameters
regex_rowThe regular expression (ECMAScript format).

Implements Arcane::ISimpleTableComparator.

Definition at line 260 of file SimpleCsvComparatorService.cc.

◆ editRootDirectory()

void Arcane::SimpleCsvComparatorService::editRootDirectory ( const Directory & root_directory)
overridevirtual

Method allowing the root directory to be modified. This allows writing or searching for reference files elsewhere than in the directory determined by the implementation.

By default, for the csv implementation, the root directory is: ./output/csv_ref/

Parameters
root_directoryThe new root directory.

Implements Arcane::ISimpleTableComparator.

Definition at line 80 of file SimpleCsvComparatorService.cc.

◆ init()

void Arcane::SimpleCsvComparatorService::init ( ISimpleTableOutput * simple_table_output_ptr)
overridevirtual

Method allowing the service to be initialized.

The pointer to an ISimpleTableOutput implementation must contain the values to be compared or written as reference values and the destination location of the output files, so that the location of the reference files is automatically determined.

Parameters
simple_table_output_ptrAn implementation of ISimpleTableOutput.

Implements Arcane::ISimpleTableComparator.

Definition at line 36 of file SimpleCsvComparatorService.cc.

References Arcane::ISimpleTableOutput::internal(), and Arcane::makeRef().

Here is the call graph for this function:

◆ isAnArrayExclusiveColumns()

void Arcane::SimpleCsvComparatorService::isAnArrayExclusiveColumns ( bool is_exclusive)
overridevirtual

Method allowing definition whether the array of columns represents the columns to include in the comparison (false/default) or represents the columns to exclude from the comparison (true).

Parameters
is_exclusivetrue if the columns must be excluded.

Implements Arcane::ISimpleTableComparator.

Definition at line 233 of file SimpleCsvComparatorService.cc.

◆ isAnArrayExclusiveRows()

void Arcane::SimpleCsvComparatorService::isAnArrayExclusiveRows ( bool is_exclusive)
overridevirtual

Method allowing definition whether the array of rows represents the rows to include in the comparison (false/default) or represents the rows to exclude from the comparison (true).

Parameters
is_exclusivetrue if the rows must be excluded.

Implements Arcane::ISimpleTableComparator.

Definition at line 242 of file SimpleCsvComparatorService.cc.

◆ isARegexExclusiveColumns()

void Arcane::SimpleCsvComparatorService::isARegexExclusiveColumns ( bool is_exclusive)
overridevirtual

Method allowing to request that the regular expression excludes columns instead of including them.

Parameters
is_exclusiveIf the regular expression is exclusive.

Implements Arcane::ISimpleTableComparator.

Definition at line 269 of file SimpleCsvComparatorService.cc.

◆ isARegexExclusiveRows()

void Arcane::SimpleCsvComparatorService::isARegexExclusiveRows ( bool is_exclusive)
overridevirtual

Method allowing to request that the regular expression excludes rows instead of including them.

Parameters
is_exclusiveIf the regular expression is exclusive.

Implements Arcane::ISimpleTableComparator.

Definition at line 278 of file SimpleCsvComparatorService.cc.

◆ isReferenceExist()

bool Arcane::SimpleCsvComparatorService::isReferenceExist ( Integer rank)
overridevirtual

Method allowing to check if the reference files exist.

Parameters
rankThe process that must look for its file (-1 for all processes).
Returns
true If the file was found (and if calling process != rank).
false If the file was not found.

Implements Arcane::ISimpleTableComparator.

Definition at line 146 of file SimpleCsvComparatorService.cc.

References Arcane::SimpleTableReaderWriterUtils::isFileExist().

Here is the call graph for this function:

◆ print()

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

Method allowing the read table to be displayed.

Parameters
rankThe process that must display its table (-1 for all processes).

Implements Arcane::ISimpleTableComparator.

Definition at line 90 of file SimpleCsvComparatorService.cc.

◆ readReferenceFile()

bool Arcane::SimpleCsvComparatorService::readReferenceFile ( Integer rank)
overridevirtual

Method allowing reference files to be read.

The type of the reference files must correspond to the implementation of this chosen interface (example: .csv file -> SimpleCsvComparatorService).

Parameters
rankThe process that must read its file (-1 for all processes).
Returns
true If the file was read (and if calling process != rank).
false If the file was not read.

Implements Arcane::ISimpleTableComparator.

Definition at line 132 of file SimpleCsvComparatorService.cc.

Referenced by compareElemWithReference(), compareElemWithReference(), and compareWithReference().

Here is the caller graph for this function:

◆ writeReferenceFile()

bool Arcane::SimpleCsvComparatorService::writeReferenceFile ( Integer rank)
overridevirtual

Method performing collective operations.

Implements Arcane::ISimpleTableComparator.

Definition at line 104 of file SimpleCsvComparatorService.cc.

Member Data Documentation

◆ m_file_name

String Arcane::SimpleCsvComparatorService::m_file_name
private

Definition at line 102 of file SimpleCsvComparatorService.h.

◆ m_ifstream

std::ifstream Arcane::SimpleCsvComparatorService::m_ifstream
private

Definition at line 105 of file SimpleCsvComparatorService.h.

◆ m_is_already_init

bool Arcane::SimpleCsvComparatorService::m_is_already_init
private

Definition at line 115 of file SimpleCsvComparatorService.h.

◆ m_is_file_open

bool Arcane::SimpleCsvComparatorService::m_is_file_open
private

Definition at line 106 of file SimpleCsvComparatorService.h.

◆ m_is_file_read

bool Arcane::SimpleCsvComparatorService::m_is_file_read
private

Definition at line 107 of file SimpleCsvComparatorService.h.

◆ m_output_directory

String Arcane::SimpleCsvComparatorService::m_output_directory
private

Definition at line 101 of file SimpleCsvComparatorService.h.

◆ m_reference_path

Directory Arcane::SimpleCsvComparatorService::m_reference_path
private

Definition at line 98 of file SimpleCsvComparatorService.h.

◆ m_root_path

Directory Arcane::SimpleCsvComparatorService::m_root_path
private

Definition at line 99 of file SimpleCsvComparatorService.h.

◆ m_simple_csv_reader_writer

SimpleCsvReaderWriter Arcane::SimpleCsvComparatorService::m_simple_csv_reader_writer
private

Definition at line 113 of file SimpleCsvComparatorService.h.

◆ m_simple_table_internal_comparator

SimpleTableInternalComparator Arcane::SimpleCsvComparatorService::m_simple_table_internal_comparator
private

Definition at line 112 of file SimpleCsvComparatorService.h.

◆ m_simple_table_internal_reference

Ref<SimpleTableInternal> Arcane::SimpleCsvComparatorService::m_simple_table_internal_reference
private

Definition at line 109 of file SimpleCsvComparatorService.h.

◆ m_simple_table_internal_to_compare

Ref<SimpleTableInternal> Arcane::SimpleCsvComparatorService::m_simple_table_internal_to_compare
private

Definition at line 110 of file SimpleCsvComparatorService.h.

◆ m_simple_table_output_ptr

ISimpleTableOutput* Arcane::SimpleCsvComparatorService::m_simple_table_output_ptr
private

Definition at line 96 of file SimpleCsvComparatorService.h.

◆ m_table_name

String Arcane::SimpleCsvComparatorService::m_table_name
private

Definition at line 103 of file SimpleCsvComparatorService.h.


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