15#include "arcane/utils/ArcanePrecomp.h"
17#include "arcane/utils/Array.h"
18#include "arcane/expr/WhereExpressionImpl.h"
19#include "arcane/expr/OperatorMng.h"
20#include "arcane/expr/BadOperationException.h"
31WhereExpressionImpl(IExpressionImpl* test,IExpressionImpl* iftrue,
32 IExpressionImpl* iffalse)
43void WhereExpressionImpl::
44apply(ExpressionResult* result)
50 ExpressionResult test_op(indices);
51 m_test->apply(&test_op);
52 ArrayView<bool> test_values;
53 test_op.data()->value(test_values);
57 for(Integer i=0 ; i<s ; ++i)
58 (test_values[i]==0.) ? ++nb_false : ++nb_true;
59 UniqueArray<Integer> true_indices(nb_true);
60 UniqueArray<Integer> false_indices(nb_false);
63 for(Integer i=0 ; i<s ; ++i)
64 (test_values[i]!=0.) ? true_indices[true_i++]=indices[i]
65 : false_indices[false_i++]=indices[i];
80 ExpressionResult iftrue_op(true_indices);
81 m_iftrue->apply(&iftrue_op);
82 ExpressionResult iffalse_op(false_indices);
83 m_iffalse->apply(&iffalse_op);
86 VariantBase::eType type = iftrue_op.data()->type();
87 WhereOperator* op = m_op_mng->find(
this, type);
89 throw BadOperationException(
"WhereExpressionImpl::apply",
"",type);
91 op->evaluate(result, test_op.data(), iftrue_op.data(), iffalse_op.data());
ConstArrayView< Integer > IntegerConstArrayView
Equivalent C d'un tableau à une dimension d'entiers.
Int32 Integer
Type représentant un entier.