14#include "arcane/expr/OperatorMng.h"
24OperatorMng* OperatorMng::m_instance = 0;
29#define CREATE_ALL_OP(map,name) \
30 map .insert(name##OpMap::value_type \
31 (VariantBase::TReal, new name##OperatorT<Real>())); \
32 map .insert(name##OpMap::value_type \
33 (VariantBase::TInt64, new name##OperatorT<Int64>())); \
34 map .insert(name##OpMap::value_type \
35 (VariantBase::TInt32, new name##OperatorT<Int32>())); \
36 map .insert(name##OpMap::value_type \
37 (VariantBase::TBool, new name##OperatorT<bool>())); \
38 map .insert(name##OpMap::value_type \
39 (VariantBase::TReal2, new name##OperatorT<Real2>())); \
40 map .insert(name##OpMap::value_type \
41 (VariantBase::TReal3, new name##OperatorT<Real3>())); \
42 map .insert(name##OpMap::value_type \
43 (VariantBase::TReal2x2, new name##OperatorT<Real2x2>())); \
44 map .insert(name##OpMap::value_type \
45 (VariantBase::TReal3x3, new name##OperatorT<Real3x3>()));
47#define CREATE_OP(map,var,maptype,varname,vartype,operator) \
48 map[var].insert( maptype ::value_type(VariantBase::varname, \
49 new operator##Operator<vartype>()));
61 UnaryExpressionImpl::eOperationType ut;
62 ut = UnaryExpressionImpl::UnarySubstract;
63 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,UnarySubstract)
64 ut = UnaryExpressionImpl::Inverse;
65 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Inverse)
66 ut = UnaryExpressionImpl::Acos;
67 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Acos)
68 ut = UnaryExpressionImpl::Asin;
69 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Asin)
70 ut = UnaryExpressionImpl::Atan;
71 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Atan)
72 ut = UnaryExpressionImpl::Ceil;
73 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Ceil)
74 ut = UnaryExpressionImpl::Cos;
75 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Cos)
76 ut = UnaryExpressionImpl::Cosh;
77 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Cosh)
78 ut = UnaryExpressionImpl::Exp;
79 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Exp)
80 ut = UnaryExpressionImpl::Fabs;
81 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Fabs)
82 ut = UnaryExpressionImpl::Floor;
83 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Floor)
84 ut = UnaryExpressionImpl::Log;
85 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Log)
86 ut = UnaryExpressionImpl::Log10;
87 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Log10)
88 ut = UnaryExpressionImpl::Sin;
89 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Sin)
90 ut = UnaryExpressionImpl::Sinh;
91 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Sinh)
92 ut = UnaryExpressionImpl::Sqrt;
93 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Sqrt)
94 ut = UnaryExpressionImpl::Tan;
95 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Tan)
96 ut = UnaryExpressionImpl::Tanh;
97 CREATE_OP(m_unary_op,ut,UnaryOpMap,TReal,
Real,Tanh)
102 BinaryExpressionImpl::eOperationType bt;
104 bt = BinaryExpressionImpl::Add;
105 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,Add)
106 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,Add)
107 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,Add)
108 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2,Real2,Add)
109 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3,Real3,Add)
110 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2x2,Real2x2,Add)
111 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3x3,Real3x3,Add)
113 bt = BinaryExpressionImpl::Substract;
114 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,Substract)
115 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,Substract)
116 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,Substract)
117 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2,Real2,Substract)
118 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3,Real3,Substract)
119 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2x2,Real2x2,Substract)
120 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3x3,Real3x3,Substract)
122 bt = BinaryExpressionImpl::Multiply;
123 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,Multiply)
124 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,Multiply)
125 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,Multiply)
126 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2,Real2,Multiply)
127 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3,Real3,Multiply)
131 bt = BinaryExpressionImpl::Divide;
132 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,Divide)
133 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,Divide)
134 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,Divide)
135 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2,Real2,Divide)
136 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3,Real3,Divide)
140 bt = BinaryExpressionImpl::Minimum;
141 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,Minimum)
142 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,Minimum)
143 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,Minimum)
144 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2,Real2,Minimum)
145 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3,Real3,Minimum)
147 bt = BinaryExpressionImpl::Maximum;
148 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,Maximum)
149 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,Maximum)
150 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,Maximum)
151 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2,Real2,Maximum)
152 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3,Real3,Maximum)
154 bt = BinaryExpressionImpl::Pow;
155 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,Pow)
157 bt = BinaryExpressionImpl::Equal;
158 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,EQ)
159 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,EQ)
160 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,EQ)
161 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2,Real2,EQ)
162 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3,Real3,EQ)
164 bt = BinaryExpressionImpl::LessThan;
165 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,LT)
166 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,LT)
167 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,LT)
168 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal2,Real2,LT)
169 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal3,Real3,LT)
171 bt = BinaryExpressionImpl::LessOrEqualThan;
172 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,LOET)
173 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,LOET)
174 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,LOET)
176 bt = BinaryExpressionImpl::GreaterThan;
177 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,GT)
178 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,GT)
179 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,GT)
181 bt = BinaryExpressionImpl::GreaterOrEqualThan;
182 CREATE_OP(m_binary_op,bt,BinaryOpMap,TReal,
Real,GOET)
183 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt32,Integer,GOET)
184 CREATE_OP(m_binary_op,bt,BinaryOpMap,TInt64,Integer,GOET)
186 bt = BinaryExpressionImpl::Or;
187 CREATE_OP(m_binary_op,bt,BinaryOpMap,TBool,
bool,Or)
189 bt = BinaryExpressionImpl::And;
190 CREATE_OP(m_binary_op,bt,BinaryOpMap,TBool,
bool,And)
195 CREATE_ALL_OP(m_where_op,Where)
197 CREATE_ALL_OP(m_variable_op,Variable)
199 CREATE_ALL_OP(m_litteral_op,Litteral)
205 for (
int i=0 ; i<UnaryExpressionImpl::NbOperationType ; i++)
207 UnaryOpMap& m = m_unary_op[i];
208 for (UnaryOpMap::iterator it=m.begin() ; it!=m.end() ; it++)
212 for (
int i=0 ; i<BinaryExpressionImpl::NbOperationType ; i++)
214 BinaryOpMap& m = m_binary_op[i];
215 for (BinaryOpMap::iterator it=m.begin() ; it!=m.end() ; it++)
219 for (WhereOpMap::iterator it=m_where_op.begin();
220 it!=m_where_op.end();
225 for (VariableOpMap::iterator it=m_variable_op.begin();
226 it!=m_variable_op.end();
231 for (LitteralOpMap::iterator it=m_litteral_op.begin();
232 it!=m_litteral_op.end();
240OperatorMng* OperatorMng::
244 m_instance =
new OperatorMng();
251UnaryOperator* OperatorMng::
252find(UnaryExpressionImpl*, VariantBase::eType type,
253 UnaryExpressionImpl::eOperationType operation)
255 UnaryOpMap::iterator it=m_unary_op[operation].find(type);
256 if (it == m_unary_op[operation].end())
262BinaryOperator* OperatorMng::
263find(BinaryExpressionImpl*, VariantBase::eType type,
264 BinaryExpressionImpl::eOperationType operation)
266 BinaryOpMap::iterator it=m_binary_op[operation].find(type);
267 if (it == m_binary_op[operation].end())
273WhereOperator* OperatorMng::
274find(WhereExpressionImpl*, VariantBase::eType type)
276 WhereOpMap::iterator it=m_where_op.find(type);
277 if (it == m_where_op.end())
283LitteralOperator* OperatorMng::
284find(LitteralExpressionImpl*, VariantBase::eType type)
286 LitteralOpMap::iterator it=m_litteral_op.find(type);
287 if (it == m_litteral_op.end())
294VariableOperator* OperatorMng::
295find(VariableExpressionImpl*, VariantBase::eType type)
297 VariableOpMap::iterator it=m_variable_op.find(type);
298 if (it == m_variable_op.end())
Lecteur des fichiers de maillage via la bibliothèque LIMA.