Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
DataOperation.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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.cc (C) 2000-2024 */
9/* */
10/* Data operation. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/impl/DataOperation.h"
15
16#include "arcane/utils/FatalErrorException.h"
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21namespace Arcane
22{
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
28{
29 public:
30
31 template <typename DataType>
32 DataType operator()(const DataType& input1, const DataType& input2)
33 {
34 return (DataType)(input1 + input2);
35 }
36};
37
39{
40 public:
41
42 template <typename DataType>
43 DataType operator()(const DataType& input1, const DataType& input2)
44 {
45 return input1 - input2;
46 }
47};
48
50{
51 public:
52
53 template <typename DataType>
54 DataType operator()(const DataType& input1, const DataType& input2)
55 {
56 return math::max(input1, input2);
57 }
58};
59
61{
62 public:
63
64 template <typename DataType>
65 DataType operator()(const DataType& input1, const DataType& input2)
66 {
67 return math::min(input1, input2);
68 }
69};
70
71/*---------------------------------------------------------------------------*/
72/*---------------------------------------------------------------------------*/
73
74extern "C++" ARCANE_IMPL_EXPORT IDataOperation*
75arcaneCreateDataOperation(Parallel::eReduceType rt)
76{
77 switch (rt) {
80 break;
83 break;
86 break;
87 }
88 ARCANE_FATAL("Operation not found");
89}
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
93
94} // End namespace Arcane
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Interface of an operation on a data.
__host__ __device__ Real2 min(Real2 a, Real2 b)
Returns the minimum of two Real2.
Definition MathUtils.h:346
T max(const T &a, const T &b, const T &c)
Returns the maximum of three elements.
Definition MathUtils.h:407
eReduceType
Supported reduction types.
@ ReduceMin
Minimum of values.
@ ReduceMax
Maximum of values.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --