Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::ISimpleTableComparator Class Referenceabstract

Class interface representing a table comparator. To be used with a service implementing ISimpleTableOutput. More...

#include <arcane/core/ISimpleTableComparator.h>

Inheritance diagram for Arcane::ISimpleTableComparator:
Collaboration diagram for Arcane::ISimpleTableComparator:

Public Member Functions

virtual void init (ISimpleTableOutput *simple_table_output_ptr)=0
 Method allowing the service to be initialized.
virtual void clear ()=0
 Method allowing the data read by readReferenceFile() to be cleared.
virtual void print (Integer rank=0)=0
 Method allowing the read table to be displayed.
virtual void editRootDirectory (const Directory &root_directory)=0
 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.
virtual bool writeReferenceFile (Integer rank=-1)=0
 Method allowing reference files to be written.
virtual bool readReferenceFile (Integer rank=-1)=0
 Method allowing reference files to be read.
virtual bool isReferenceExist (Integer rank=-1)=0
 Method allowing to check if the reference files exist.
virtual bool compareWithReference (Integer rank=-1, bool compare_dimension_too=false)=0
 Method allowing the ISimpleTableOutput object to be compared to the reference files.
virtual bool compareElemWithReference (const String &column_name, const String &row_name, Integer rank=-1)=0
 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).
virtual bool compareElemWithReference (Real elem, const String &column_name, const String &row_name, Integer rank=-1)=0
 Method allowing a value to be compared with a value from the reference table. This method does not need an internal 'toCompare' (setInternalToCompare() unnecessary).
virtual bool addColumnForComparing (const String &column_name)=0
 Method allowing a column to be added to the list of columns to be compared.
virtual bool addRowForComparing (const String &row_name)=0
 Method allowing a row to be added to the list of rows to be compared.
virtual void isAnArrayExclusiveColumns (bool is_exclusive)=0
 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).
virtual void isAnArrayExclusiveRows (bool is_exclusive)=0
 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).
virtual void editRegexColumns (const String &regex_column)=0
 Method allowing a regular expression to be added to determine the columns to compare.
virtual void editRegexRows (const String &regex_row)=0
 Method allowing a regular expression to be added to determine the rows to compare.
virtual void isARegexExclusiveColumns (bool is_exclusive)=0
 Method allowing to request that the regular expression excludes columns instead of including them.
virtual void isARegexExclusiveRows (bool is_exclusive)=0
 Method allowing to request that the regular expression excludes rows instead of including them.
virtual bool addEpsilonColumn (const String &column_name, Real epsilon)=0
 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.
virtual bool addEpsilonRow (const String &row_name, Real epsilon)=0
 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.

Detailed Description

Class interface representing a table comparator. To be used with a service implementing ISimpleTableOutput.

The difference with ISimpleTableInternalComparator is that we compare a SimpleTableInternal contained in an ISimpleTableOutput with a SimpleTableInternal generated from a reference file.

This interface also allows generating the reference files using the directory name and the table name of the ISimpleTableOutput, facilitating the process.

Definition at line 46 of file ISimpleTableComparator.h.

Member Function Documentation

◆ addColumnForComparing()

virtual bool Arcane::ISimpleTableComparator::addColumnForComparing ( const String & column_name)
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ addEpsilonColumn()

virtual bool Arcane::ISimpleTableComparator::addEpsilonColumn ( const String & column_name,
Real epsilon )
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ addEpsilonRow()

virtual bool Arcane::ISimpleTableComparator::addEpsilonRow ( const String & row_name,
Real epsilon )
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ addRowForComparing()

virtual bool Arcane::ISimpleTableComparator::addRowForComparing ( const String & row_name)
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ clear()

virtual void Arcane::ISimpleTableComparator::clear ( )
pure virtual

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

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

Implemented in Arcane::SimpleCsvComparatorService.

◆ compareElemWithReference() [1/2]

virtual bool Arcane::ISimpleTableComparator::compareElemWithReference ( const String & column_name,
const String & row_name,
Integer rank = -1 )
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ compareElemWithReference() [2/2]

virtual bool Arcane::ISimpleTableComparator::compareElemWithReference ( Real elem,
const String & column_name,
const String & row_name,
Integer rank = -1 )
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ compareWithReference()

virtual bool Arcane::ISimpleTableComparator::compareWithReference ( Integer rank = -1,
bool compare_dimension_too = false )
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ editRegexColumns()

virtual void Arcane::ISimpleTableComparator::editRegexColumns ( const String & regex_column)
pure virtual

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

Parameters
regex_columnThe regular expression (ECMAScript format).

Implemented in Arcane::SimpleCsvComparatorService.

◆ editRegexRows()

virtual void Arcane::ISimpleTableComparator::editRegexRows ( const String & regex_row)
pure virtual

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

Parameters
regex_rowThe regular expression (ECMAScript format).

Implemented in Arcane::SimpleCsvComparatorService.

◆ editRootDirectory()

virtual void Arcane::ISimpleTableComparator::editRootDirectory ( const Directory & root_directory)
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ init()

virtual void Arcane::ISimpleTableComparator::init ( ISimpleTableOutput * simple_table_output_ptr)
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ isAnArrayExclusiveColumns()

virtual void Arcane::ISimpleTableComparator::isAnArrayExclusiveColumns ( bool is_exclusive)
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ isAnArrayExclusiveRows()

virtual void Arcane::ISimpleTableComparator::isAnArrayExclusiveRows ( bool is_exclusive)
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ isARegexExclusiveColumns()

virtual void Arcane::ISimpleTableComparator::isARegexExclusiveColumns ( bool is_exclusive)
pure virtual

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

Parameters
is_exclusiveIf the regular expression is exclusive.

Implemented in Arcane::SimpleCsvComparatorService.

◆ isARegexExclusiveRows()

virtual void Arcane::ISimpleTableComparator::isARegexExclusiveRows ( bool is_exclusive)
pure virtual

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

Parameters
is_exclusiveIf the regular expression is exclusive.

Implemented in Arcane::SimpleCsvComparatorService.

◆ isReferenceExist()

virtual bool Arcane::ISimpleTableComparator::isReferenceExist ( Integer rank = -1)
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ print()

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

Method allowing the read table to be displayed.

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

Implemented in Arcane::SimpleCsvComparatorService.

◆ readReferenceFile()

virtual bool Arcane::ISimpleTableComparator::readReferenceFile ( Integer rank = -1)
pure virtual

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.

Implemented in Arcane::SimpleCsvComparatorService.

◆ writeReferenceFile()

virtual bool Arcane::ISimpleTableComparator::writeReferenceFile ( Integer rank = -1)
pure virtual

Method allowing reference files to be written.

Warning
(For now), this method uses the object pointed to by the pointer given during init(), so the writing will occur in the format desired by the ISimpleTableOutput implementation. If the reading and writing formats do not match, a call to "compareWithReference()" will necessarily return false.
Parameters
rankThe process that must write its file (-1 for all processes).
Returns
true If the writing was successful (and if calling process != rank).
false If the writing did not occur.

Implemented in Arcane::SimpleCsvComparatorService.


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