Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ISimpleTableInternalComparator.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ISimpleTableInternalComparator.h (C) 2000-2025 */
9/* */
10/* Interface representing a SimpleTableInternal comparator. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ISIMPLETABLEINTERNALCOMPARATOR_H
13#define ARCANE_CORE_ISIMPLETABLEINTERNALCOMPARATOR_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/ISimpleTableInternalMng.h"
18
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30/**
31 * \brief Class interface representing a SimpleTableInternal comparator
32 * (aka STI).
33 *
34 * The principle is to compare the values of one STI with the values of a
35 * reference STI, using an epsilon representing the acceptable error margin.
36 *
37 * There are two ways to configure this comparator:
38 * - two arrays of Strings (row/column),
39 * - two regular expressions (row/column).
40 *
41 * You can add row/column names to these arrays,
42 * specify whether these rows/columns should be included in the comparison, or,
43 * conversely, if they should be excluded from the comparison.
44 *
45 * The same applies to regular expressions: you add a row/column regular
46 * expression and specify whether these expressions include or exclude
47 * rows/columns.
48 *
49 *
50 * If both types of methods are defined, the arrays take precedence over the
51 * regular expressions: first, we check for the presence of the row/column
52 * name in the corresponding array.
53 *
54 * If the name is present, we include/exclude this row/column from the
55 * comparison.
56 * If the name is absent but a regular expression is defined, we search for
57 * a match within it.
58 *
59 * If neither type is defined (empty array and empty regular expression),
60 * all rows/columns are included in the comparison.
61 */
62class ARCANE_CORE_EXPORT ISimpleTableInternalComparator
63{
64 public:
65
66 virtual ~ISimpleTableInternalComparator() = default;
67
68 public:
69
70 /**
71 * \brief Method allowing comparison of the values of the two STIs.
72 *
73 * \param compare_dimension_too If the STI dimensions must be compared.
74 * \return true If there are no differences.
75 * \return false If there is at least one difference.
76 */
77 virtual bool compare(bool compare_dimension_too = false) = 0;
78
79 /**
80 * \brief Method allowing comparison of a single element.
81 * Both SimpleTableInternals are represented by Refs, so they are always up to date.
82 * This method can be used during calculation, allowing values to be compared as
83 * the calculation progresses, instead of performing a final comparison at the
84 * end (it is still possible to do both).
85 *
86 * \param column_name The name of the column where the element is located.
87 * \param row_name The name of the row where the element is located.
88 * \return true If both values are equal.
89 * \return false If both values are different.
90 */
91 virtual bool compareElem(const String& column_name, const String& row_name) = 0;
92
93 /**
94 * \brief Method allowing comparison of a value with a value from the reference table.
95 * This method does not use the internal 'toCompare'.
96 *
97 * \param elem The value to compare.
98 * \param column_name The name of the column where the reference element is located.
99 * \param row_name The name of the row where the reference element is located.
100 * \return true If both values are equal.
101 * \return false If both values are different.
102 */
103 virtual bool compareElem(Real elem, const String& column_name, const String& row_name) = 0;
104
105 /**
106 * \brief Method allowing the clearing of comparison arrays and regular
107 * expressions. Does not affect the STIs.
108 */
109 virtual void clearComparator() = 0;
110
111 /**
112 * \brief Method allowing the addition of a column to the list of columns to compare.
113 *
114 * \param column_name The name of the column to compare.
115 * \return true If the name was successfully added.
116 * \return false Otherwise.
117 */
118 virtual bool addColumnForComparing(const String& column_name) = 0;
119 /**
120 * \brief Method allowing the addition of a row to the list of rows to compare.
121 *
122 * \param row_name The name of the row to compare.
123 * \return true If the name was successfully added.
124 * \return false Otherwise.
125 */
126 virtual bool addRowForComparing(const String& row_name) = 0;
127
128 /**
129 * \brief Method allowing definition of whether the column array represents
130 * columns to include in the comparison (false/default) or columns to exclude
131 * from the comparison (true).
132 *
133 * \param is_exclusive true if the columns must be excluded.
134 */
135 virtual void isAnArrayExclusiveColumns(bool is_exclusive) = 0;
136
137 /**
138 * \brief Method allowing definition of whether the row array represents
139 * rows to include in the comparison (false/default) or rows to exclude
140 * from the comparison (true).
141 *
142 * \param is_exclusive true if the rows must be excluded.
143 */
144 virtual void isAnArrayExclusiveRows(bool is_exclusive) = 0;
145
146 /**
147 * \brief Method allowing the addition of a regular expression to
148 * determine the columns to compare.
149 *
150 * \param regex_column The regular expression (ECMAScript format).
151 */
152 virtual void editRegexColumns(const String& regex_column) = 0;
153 /**
154 * \brief Method allowing the addition of a regular expression to
155 * determine the rows to compare.
156 *
157 * \param regex_row The regular expression (ECMAScript format).
158 */
159 virtual void editRegexRows(const String& regex_row) = 0;
160
161 /**
162 * \brief Method allowing specification that the regular expression
163 * excludes columns instead of including them.
164 *
165 * \param is_exclusive If the regular expression is exclusionary.
166 */
167 virtual void isARegexExclusiveColumns(bool is_exclusive) = 0;
168 /**
169 * \brief Method allowing specification that the regular expression
170 * excludes rows instead of including them.
171 *
172 * \param is_exclusive If the regular expression is exclusionary.
173 */
174 virtual void isARegexExclusiveRows(bool is_exclusive) = 0;
175
176 /**
177 * \brief Method allowing the definition of an epsilon for a given column.
178 * This epsilon must be positive to be considered.
179 * If there is a conflict with a row epsilon (defined with addEpsilonRow()),
180 * the largest epsilon is taken into account.
181 * \note If an epsilon has already been defined for this column, the old
182 * epsilon will be replaced.
183 *
184 * \param column_name The name of the column where the epsilon will be
185 * taken into account.
186 * \param epsilon The epsilon error margin.
187 * \return true If the epsilon could be successfully defined.
188 * \return false If the epsilon could not be defined.
189 */
190 virtual bool addEpsilonColumn(const String& column_name, Real epsilon) = 0;
191
192 /**
193 * \brief Method allowing the definition of an epsilon for a given row.
194 * This epsilon must be positive to be considered.
195 * If there is a conflict with a column epsilon (defined with addEpsilonColumn()),
196 * the largest epsilon is taken into account.
197 * \note If an epsilon has already been defined for this row, the old epsilon
198 * will be replaced.
199 *
200 * \param row_name The name of the row where the epsilon will be taken into account.
201 * \param epsilon The epsilon error margin.
202 * \return true If the epsilon could be successfully defined.
203 * \return false If the epsilon could not be defined.
204 */
205 virtual bool addEpsilonRow(const String& row_name, Real epsilon) = 0;
206
207 /**
208 * \brief Method allowing retrieval of a reference to the used "reference"
209 * SimpleTableInternal object.
210 *
211 * \return Ref<SimpleTableInternal> A copy of the reference.
212 */
214
215 /**
216 * \brief Method allowing definition of a reference to a "reference"
217 * SimpleTableInternal.
218 *
219 * \param simple_table_internal The reference to a SimpleTableInternal.
220 */
221 virtual void setInternalRef(const Ref<SimpleTableInternal>& simple_table_internal) = 0;
222
223 /**
224 * \brief Method allowing retrieval of a reference to the used "to compare"
225 * SimpleTableInternal object.
226 *
227 * \return Ref<SimpleTableInternal> A copy of the reference.
228 */
230
231 /**
232 * \brief Method allowing definition of a reference to the "to compare"
233 * SimpleTableInternal.
234 *
235 * \param simple_table_internal The reference to a SimpleTableInternal.
236 */
237 virtual void setInternalToCompare(const Ref<SimpleTableInternal>& simple_table_internal) = 0;
238};
239
240/*---------------------------------------------------------------------------*/
241/*---------------------------------------------------------------------------*/
242
243} // End namespace Arcane
244
245/*---------------------------------------------------------------------------*/
246/*---------------------------------------------------------------------------*/
247
248#endif
Declarations of types on entities.
Class interface representing a SimpleTableInternal comparator (aka STI).
virtual void setInternalRef(const Ref< SimpleTableInternal > &simple_table_internal)=0
Method allowing definition of a reference to a "reference" SimpleTableInternal.
virtual bool addRowForComparing(const String &row_name)=0
Method allowing the addition of a row to the list of rows to compare.
virtual void isAnArrayExclusiveRows(bool is_exclusive)=0
Method allowing definition of whether the row array represents rows to include in the comparison (fal...
virtual void setInternalToCompare(const Ref< SimpleTableInternal > &simple_table_internal)=0
Method allowing definition of a reference to the "to compare" SimpleTableInternal.
virtual void isARegexExclusiveRows(bool is_exclusive)=0
Method allowing specification that the regular expression excludes rows instead of including them.
virtual Ref< SimpleTableInternal > internalRef()=0
Method allowing retrieval of a reference to the used "reference" SimpleTableInternal object.
virtual Ref< SimpleTableInternal > internalToCompare()=0
Method allowing retrieval of a reference to the used "to compare" SimpleTableInternal object.
virtual bool addEpsilonRow(const String &row_name, Real epsilon)=0
Method allowing the definition of an epsilon for a given row. This epsilon must be positive to be con...
virtual bool compare(bool compare_dimension_too=false)=0
Method allowing comparison of the values of the two STIs.
virtual void editRegexColumns(const String &regex_column)=0
Method allowing the addition of a regular expression to determine the columns to compare.
virtual void editRegexRows(const String &regex_row)=0
Method allowing the addition of a regular expression to determine the rows to compare.
virtual bool compareElem(const String &column_name, const String &row_name)=0
Method allowing comparison of a single element. Both SimpleTableInternals are represented by Refs,...
virtual bool addEpsilonColumn(const String &column_name, Real epsilon)=0
Method allowing the definition of an epsilon for a given column. This epsilon must be positive to be ...
virtual void isARegexExclusiveColumns(bool is_exclusive)=0
Method allowing specification that the regular expression excludes columns instead of including them.
virtual bool addColumnForComparing(const String &column_name)=0
Method allowing the addition of a column to the list of columns to compare.
virtual void clearComparator()=0
Method allowing the clearing of comparison arrays and regular expressions. Does not affect the STIs.
virtual void isAnArrayExclusiveColumns(bool is_exclusive)=0
Method allowing definition of whether the column array represents columns to include in the compariso...
virtual bool compareElem(Real elem, const String &column_name, const String &row_name)=0
Method allowing comparison of a value with a value from the reference table. This method does not use...
Reference to an instance.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
double Real
Type representing a real number.