Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
CaseTable.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/* CaseTable.h (C) 2000-2025 */
9/* */
10/* Class managing a lookup table. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_CASETABLE_H
13#define ARCANE_CORE_CASETABLE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/datatype/SmallVariant.h"
18
19#include "arcane/core/CaseFunction.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30class CaseTableParams;
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
39class ARCANE_CORE_EXPORT CaseTable
40: public CaseFunction
41{
42 public:
43
61
70
71 public:
72
76 CaseTable(const CaseFunctionBuildInfo& info, eCurveType curve_type);
77 virtual ~CaseTable();
78
79 public:
80
82 virtual Integer nbElement() const;
83
85 virtual void valueToString(Integer id, String& str) const;
86
88 virtual void paramToString(Integer id, String& param) const;
89
98 virtual eError setParam(Integer id, const String& value);
99
108 virtual eError setValue(Integer id, const String& value);
109
116 virtual eError appendElement(const String& param, const String& value);
117
129 virtual void insertElement(Integer id);
130
137 virtual void removeElement(Integer id);
138
141
142 virtual eCurveType curveType() const { return m_curve_type; }
144
145 virtual void setParamType(eParamType type);
146
147 virtual bool checkIfValid() const;
148
149 virtual void value(Real param, Real& v) const;
150 virtual void value(Real param, Integer& v) const;
151 virtual void value(Real param, bool& v) const;
152 virtual void value(Real param, String& v) const;
153 virtual void value(Real param, Real3& v) const;
154 virtual void value(Integer param, Real& v) const;
155 virtual void value(Integer param, Integer& v) const;
156 virtual void value(Integer param, bool& v) const;
157 virtual void value(Integer param, String& v) const;
158 virtual void value(Integer param, Real3& v) const;
159
160 public:
161 private:
162
163 CaseTableParams* m_param_list;
166 bool m_use_fast_search = true;
167
168 private:
169
170 template <typename U, typename V> void _findValue(U param, V& value) const;
171 template <typename U, typename V> void _findValueAndApplyTransform(U param, V& value) const;
172
173 bool _isValidIndex(Integer index) const;
174 eError _setValue(Integer index, const String& value_str);
175};
176
177/*---------------------------------------------------------------------------*/
178/*---------------------------------------------------------------------------*/
179
180} // namespace Arcane
181
182/*---------------------------------------------------------------------------*/
183/*---------------------------------------------------------------------------*/
184
185#endif
Information to build an instance of CaseFunction.
CaseFunction(const CaseFunctionBuildInfo &info)
Constructs a dataset function.
Parameter of a function.
Data set function.
Definition CaseTable.h:41
virtual eCurveType curveType() const
Returns the curve type of the function.
Definition CaseTable.h:142
eCurveType
Type of the table curve.
Definition CaseTable.h:65
@ CurveUnknown
Unknown curve type.
Definition CaseTable.h:66
@ CurveLinear
Piecewise linear curve.
Definition CaseTable.h:68
@ CurveConstant
Piecewise constant curve.
Definition CaseTable.h:67
CaseTable(const CaseFunctionBuildInfo &info, eCurveType curve_type)
Constructs a lookup table from the data set.
Definition CaseTable.cc:46
eError
Types of errors returned by the class.
Definition CaseTable.h:48
@ ErrCanNotConvertParamToRightType
Indicates that converting the parameter to the desired type is impossible.
Definition CaseTable.h:53
@ ErrBadRange
Indicates that an element index is not valid.
Definition CaseTable.h:51
@ ErrNotGreaterThanPrevious
Indicates that the parameter is not greater than the previous one.
Definition CaseTable.h:57
@ ErrNotLesserThanNext
Indicates that the parameter is not less than the next one.
Definition CaseTable.h:59
@ ErrCanNotConvertValueToRightType
Indicates that converting the value to the desired type is impossible.
Definition CaseTable.h:55
eCurveType m_curve_type
Curve type.
Definition CaseTable.h:165
virtual void value(Real param, Real &v) const
Value v of the option for parameter param.
Definition CaseTable.cc:104
UniqueArray< SmallVariant > m_value_list
List of values.
Definition CaseTable.h:164
Class managing a 3-dimensional real vector.
Definition Real3.h:132
1D data vector with value semantics (STL style).
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
double Real
Type representing a real number.