14#include "arcane/utils/ArcanePrecomp.h"
16#include "arcane/utils/OStringStream.h"
17#include "arcane/utils/NotImplementedException.h"
19#include "arcane/expr/ExpressionResult.h"
20#include "arcane/expr/BadExpressionException.h"
23#include "arcane/IVariableAccessor.h"
39 if (v->dimension() != 1)
40 throw BadExpressionException(
"ExpressionResult::ExpressionResult(IVariablePrv* v)",
41 "Only variables of dimension 1 are dealt with in the expressions.");
43 throw NotImplementedException(A_FUNCINFO,
"building expression result after removing IVariableAccessor");
51 m_data =
new ArrayVariant(values);
57 m_data =
new ArrayVariant(values);
63 m_data =
new ArrayVariant(values);
69 m_data =
new ArrayVariant(values);
75 m_data =
new ArrayVariant(values);
81 m_data =
new ArrayVariant(values);
87 m_data =
new ArrayVariant(values);
92 String s = String(
"Type de variable (") + type +
") non supporté.\n";
93 throw BadExpressionException(
"ExpressionResult::ExpressionResult(IVariable* v)",s);
114 m_own_indices.resize(size);
115 for (Integer i = 0; i < size; ++i)
116 m_own_indices[i] = i;
117 m_indices = m_own_indices.view();
124ExpressionResult(IntegerConstArrayView indices)
142void ExpressionResult::
143allocate(VariantBase::eType type)
146 m_data =
new ArrayVariant(type, m_indices.size());
148 else if (type != m_data->type()) {
150 s() <<
"The result type of the expression ("
151 << m_data->typeName() <<
") "
152 <<
"is not compatible with the type of the variable ("
153 << VariantBase::typeName(type) <<
").\n";
154 throw BadExpressionException(
"ExpressionResult::allocate", s.str());
162operator<<(std::ostream& s,
const ExpressionResult& x)
164 s <<
"ExpressionResult [";
166 s <<
"data=" << *x.m_data <<
", ";
168 Integer size = x.m_indices.size();
169 for (Integer i = 0; i < size; ++i)
170 s << x.m_indices[i] <<
" ";
Polymorphic base type for arrays (dimension 1).
UniqueArray< Integer > m_own_indices
Array of indices allocated by this instance.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
ArrayView< Int64 > Int64ArrayView
C equivalent of a 1D array of 64-bit integers.
ArrayView< Real2x2 > Real2x2ArrayView
C equivalent of a 1D array of Real2x2.
ArrayView< Real3 > Real3ArrayView
C equivalent of a 1D array of Real3.
Int32 Integer
Type representing an integer.
ArrayView< Real3x3 > Real3x3ArrayView
C equivalent of a 1D array of Real3x3.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
ArrayView< Real2 > Real2ArrayView
C equivalent of a 1D array of Real2.
@ DT_Real2x2
2x2 tensor data type
@ DT_Real3x3
3x3 tensor data type
@ DT_Int32
32-bit integer data type
@ DT_Real3
Vector 3 data type.
@ DT_Int64
64-bit integer data type
@ DT_Real2
Vector 2 data type.
ArrayView< Real > RealArrayView
C equivalent of a 1D array of reals.