14#include "arcane/utils/ArcanePrecomp.h"
16#include "arcane/utils/Array.h"
17#include "arcane/expr/WhereExpressionImpl.h"
18#include "arcane/expr/OperatorMng.h"
19#include "arcane/expr/BadOperationException.h"
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());
Base class for the expression implementation.
Interface for the different implementations of an expression.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< Integer > IntegerConstArrayView
C equivalent of a 1D array of integers.