Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
CaseFunction.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/* CaseFunction.h (C) 2000-2025 */
9/* */
10/* Class managing a dataset function. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_CASEFUNCTION_H
13#define ARCANE_CORE_CASEFUNCTION_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18#include "arccore/base/Ref.h"
19
20#include "arcane/utils/String.h"
21
22#include "arcane/core/ICaseFunction.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane
28{
29
30class ISubDomain;
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
35/*!
36 * \brief Information to build an instance of \a CaseFunction.
37 *
38 * \param name name of the function
39 * \param param_type type of the function parameter
40 * \param curve_type type of the function curve
41 */
42class ARCANE_CORE_EXPORT CaseFunctionBuildInfo
43{
44 public:
45
46 //! \deprecated Use CaseFunctionBuildInfo(ITraceMng* tm,const String& name)
47 ARCANE_DEPRECATED_260 CaseFunctionBuildInfo(ISubDomain* sd, const String& name);
49 : m_trace_mng(tm)
52 , m_deltat_coef(0.0)
53 {}
54 CaseFunctionBuildInfo(ITraceMng* tm, const String& name)
56 {
57 m_name = name;
58 }
59
60 public:
61
62 ITraceMng* m_trace_mng; //!< Associated trace manager.
63 String m_name; //!< Name of the function
64 ICaseFunction::eParamType m_param_type; //!< Parameter type (x)
66 String m_transform_param_func; //!< X transformation function
67 String m_transform_value_func; //!< Y transformation function
68 Real m_deltat_coef; //!< Multiplier coefficient of deltat for time tables
69};
70
71/*---------------------------------------------------------------------------*/
72/*---------------------------------------------------------------------------*/
73
74/*!
75 * \internal
76 * \brief Dataset function.
77 *
78 * \ingroup CaseOption
79 */
80class ARCANE_CORE_EXPORT CaseFunction
81: public ICaseFunction
83{
85
86 public:
87
88 //! Constructs a dataset function.
89 explicit CaseFunction(const CaseFunctionBuildInfo& info);
90 ~CaseFunction() override;
91
92 public:
93
94 String name() const override { return m_name; }
95 void setName(const String& new_name) override;
96
97 eParamType paramType() const override { return m_param_type; }
98 void setParamType(eParamType type) override;
99
100 eValueType valueType() const override { return m_value_type; }
101 void setValueType(eValueType type) override;
102
103 void setTransformValueFunction(const String& str) override;
104 String transformValueFunction() const override { return m_transform_value_func; }
105
106 void setTransformParamFunction(const String& str) override;
107 String transformParamFunction() const override { return m_transform_param_func; }
108
109 void setDeltatCoef(Real v) override { m_deltat_coef = v; }
110 Real deltatCoef() const override { return m_deltat_coef; }
111
112 bool checkIfValid() const override;
113
114 Ref<ICaseFunction> toReference();
115 ITraceMng* traceMng() const { return m_trace; }
116
117 public:
118 private:
119
120 ITraceMng* m_trace; //!< Trace manager
121 String m_name; //!< Name of the function
122 eParamType m_param_type; //!< Parameter type (x)
123 eValueType m_value_type; //!< Value type (y)
124 String m_transform_param_func; //!< Parameter transformation function
125 String m_transform_value_func; //!< Value transformation function
126 Real m_deltat_coef;
127
128 private:
129 protected:
130
131 template <typename ParamType> void _applyParamTransform2(ParamType& param) const;
132 Real _applyValueComulTransform(Real v, Real comul) const;
133 Integer _applyValueComulTransform(Integer v, Integer comul) const;
134 String _applyValueComulTransform(const String& v, const String& comul) const;
135 bool _applyValueComulTransform(bool v, bool comul) const;
136 Real3 _applyValueComulTransform(Real3 v, Real3 comul) const;
137
138 void _applyValueTransform(Real& value) const;
139 void _applyValueTransform(Integer& value) const;
140 void _applyValueTransform(String& value) const;
141 void _applyValueTransform(Real3& value) const;
142 void _applyValueTransform(bool& value) const;
143 template <typename ValueType> void _applyValueTransform2(ValueType& value) const;
144 void _applyParamTransform(Real& value) const;
145 void _applyParamTransform(Integer& value) const;
146};
147
148/*---------------------------------------------------------------------------*/
149/*---------------------------------------------------------------------------*/
150
151} // End namespace Arcane
152
153/*---------------------------------------------------------------------------*/
154/*---------------------------------------------------------------------------*/
155
156#endif
#define ARCCORE_DEFINE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro to define methods managing counters of references.
Management of references to a C++ class.
Information to build an instance of CaseFunction.
ITraceMng * m_trace_mng
Associated trace manager.
String m_name
Name of the function.
String m_transform_value_func
Y transformation function.
Real m_deltat_coef
Multiplier coefficient of deltat for time tables.
ICaseFunction::eValueType m_value_type
Value type (y).
String m_transform_param_func
X transformation function.
ARCANE_DEPRECATED_260 CaseFunctionBuildInfo(ISubDomain *sd, const String &name)
ICaseFunction::eParamType m_param_type
Parameter type (x).
String transformValueFunction() const override
Returns the value transformation function.
void setDeltatCoef(Real v) override
Sets the value of the deltat multiplier coefficient.
CaseFunction(const CaseFunctionBuildInfo &info)
Constructs a dataset function.
String name() const override
function name
Real deltatCoef() const override
Value of the deltat multiplier coefficient.
String transformParamFunction() const override
Parameter transformation function.
eValueType valueType() const override
Function value type.
eParamType paramType() const override
Function parameter type.
eParamType
Type of a function parameter.
@ ParamUnknown
Unknown parameter type.
eValueType
Type of a function value.
@ ValueUnknown
Unknown value type.
Interface of the subdomain manager.
Definition ISubDomain.h:75
Reference to an instance.
Thread-safe implementation of a reference counter.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
double Real
Type representing a real number.