Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IMathFunctor.h
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/* IMathFunctor.h (C) 2000-2011 */
9/* */
10/* Interface of a functor for a mathematical function. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_IMATHFUNCTOR_H
13#define ARCANE_UTILS_IMATHFUNCTOR_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \brief Interface of a binary mathematical function.
30 */
31template <typename Arg1, typename Arg2, typename ReturnType>
33{
34 public:
35
36 //! Releases resources
38
39 public:
40
41 //! Executes the associated method
42 virtual ReturnType apply(Arg1 a1, Arg2 a2) = 0;
43
44 //! Executes the associated method
46 {
47 for (Integer i = 0, n = result.size(); i < n; ++i)
48 result[i] = apply(a1[i], a2[i]);
49 }
50};
51
52/*---------------------------------------------------------------------------*/
53/*---------------------------------------------------------------------------*/
54
55} // namespace Arcane
56
57/*---------------------------------------------------------------------------*/
58/*---------------------------------------------------------------------------*/
59
60#endif
Arcane configuration file.
Modifiable view of an array of type T.
constexpr Integer size() const noexcept
Returns the size of the array.
Constant view of an array of type T.
Interface of a binary mathematical function.
virtual void apply(ConstArrayView< Arg1 > a1, ConstArrayView< Arg2 > a2, ArrayView< ReturnType > result)
Executes the associated method.
virtual ~IBinaryMathFunctor()
Releases resources.
virtual ReturnType apply(Arg1 a1, Arg2 a2)=0
Executes the associated method.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.