Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
DataOperation.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* DataOperation.h (C) 2000-2021 */
9/* */
10/* Opération sur une donnée. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_IMPL_DATAOPERATION_H
13#define ARCANE_IMPL_DATAOPERATION_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/base/ArrayView.h"
18#include "arccore/base/Span.h"
19
20#include "arcane/utils/Real2.h"
21#include "arcane/utils/Real3.h"
22#include "arcane/utils/Real2x2.h"
23#include "arcane/utils/Real3x3.h"
24
25#include "arcane/datatype/IDataOperation.h"
26
27#include "arcane/Parallel.h"
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32namespace Arcane
33{
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
38template<typename DataOperator>
40: public IDataOperation
41{
42 public:
43
45 DataOperationT(const DataOperator& op) : m_operator(op) {}
46
47 public:
48
49 void apply(ByteArrayView output,ByteConstArrayView input) override
50 {
51 for( Integer i=0, n=input.size(); i<n; ++i )
52 output[i] = m_operator(output[i],input[i]);
53 }
54 void apply(RealArrayView output,RealConstArrayView input) override
55 {
56 for( Integer i=0, n=input.size(); i<n; ++i )
57 output[i] = m_operator(output[i],input[i]);
58 }
59 void apply(Int32ArrayView output,Int32ConstArrayView input) override
60 {
61 for( Integer i=0, n=input.size(); i<n; ++i )
62 output[i] = m_operator(output[i],input[i]);
63 }
64 void apply(Int16ArrayView output,Int16ConstArrayView input) override
65 {
66 for( Integer i=0, n=input.size(); i<n; ++i )
67 output[i] = m_operator(output[i],input[i]);
68 }
69 void apply(Int64ArrayView output,Int64ConstArrayView input) override
70 {
71 for( Integer i=0, n=input.size(); i<n; ++i )
72 output[i] = m_operator(output[i],input[i]);
73 }
74 void apply(Real2ArrayView output,Real2ConstArrayView input) override
75 {
76 for( Integer i=0, n=input.size(); i<n; ++i )
77 output[i] = m_operator(output[i],input[i]);
78 }
79 void apply(Real3ArrayView output,Real3ConstArrayView input) override
80 {
81 for( Integer i=0, n=input.size(); i<n; ++i )
82 output[i] = m_operator(output[i],input[i]);
83 }
84 void apply(Real2x2ArrayView output,Real2x2ConstArrayView input) override
85 {
86 for( Integer i=0, n=input.size(); i<n; ++i )
87 output[i] = m_operator(output[i],input[i]);
88 }
89 void apply(Real3x3ArrayView output,Real3x3ConstArrayView input) override
90 {
91 for( Integer i=0, n=input.size(); i<n; ++i )
92 output[i] = m_operator(output[i],input[i]);
93 }
94
95 template<typename DataType> void
97 {
98 for( Int64 i=0, n=input.size(); i<n; ++i )
99 output[i] = m_operator(output[i],input[i]);
100 }
101 void applySpan(Span<Byte> output,Span<const Byte> input) override
102 {
103 _applySpan(output,input);
104 }
105 void applySpan(Span<Real> output,Span<const Real> input) override
106 {
107 _applySpan(output,input);
108 }
109 void applySpan(Span<Int16> output,Span<const Int16> input) override
110 {
111 _applySpan(output,input);
112 }
113 void applySpan(Span<Int32> output,Span<const Int32> input) override
114 {
115 _applySpan(output,input);
116 }
117 void applySpan(Span<Int64> output,Span<const Int64> input) override
118 {
119 _applySpan(output,input);
120 }
121 void applySpan(Span<Real2> output,Span<const Real2> input) override
122 {
123 _applySpan(output,input);
124 }
125 void applySpan(Span<Real3> output,Span<const Real3> input) override
126 {
127 _applySpan(output,input);
128 }
129 void applySpan(Span<Real2x2> output,Span<const Real2x2> input) override
130 {
131 _applySpan(output,input);
132 }
133 void applySpan(Span<Real3x3> output,Span<const Real3x3> input) override
134 {
135 _applySpan(output,input);
136 }
137 private:
138 DataOperator m_operator;
139};
140
141/*---------------------------------------------------------------------------*/
142/*---------------------------------------------------------------------------*/
143
144extern "C++" ARCANE_IMPL_EXPORT IDataOperation*
145arcaneCreateDataOperation(Parallel::eReduceType rt);
146
147/*---------------------------------------------------------------------------*/
148/*---------------------------------------------------------------------------*/
149
150} // End namespace Arcane
151
152/*---------------------------------------------------------------------------*/
153/*---------------------------------------------------------------------------*/
154#endif
Interface d'une opération sur une donnée.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Vue modifiable d'un tableau d'un type T.
Vue constante d'un tableau de type T.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
eReduceType
Types des réductions supportées.