Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
AMRTransportFunctor.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/* FunctorAMRTansport.h (C) 2000-2022 */
9/* */
10/* Functor with two arguments. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_FUNCTORAMRTRANSPORT_H
13#define ARCANE_UTILS_FUNCTORAMRTRANSPORT_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/IAMRTransportFunctor.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \internal
30 * \brief Functor associated with a method of a class \a T.
31 */
32template <typename ClassType>
35{
36 public:
37
38 typedef void (ClassType::*FuncPtr)(Array<ItemInternal*>&, AMROperationType); //!< Type of the method pointer
39 typedef void (ClassType::*FuncPtr2)(Array<Cell>&, AMROperationType); //!< Type of the method pointer
40 public:
41
42 //! Constructor
43 AMRTransportFunctorT(ClassType* object, FuncPtr funcptr)
44 : m_object(object)
45 , m_function(funcptr)
46 {}
47
48 AMRTransportFunctorT(ClassType* object, FuncPtr2 funcptr2)
49 : m_object(object)
50 , m_function2(funcptr2)
51 {}
52
53 protected:
54
55 //! Executes the associated method
56 void executeFunctor(Array<ItemInternal*>& old_cells, AMROperationType op)
57 {
58 (m_object->*m_function)(old_cells, op);
59 }
60 //! Executes the associated method
61 void executeFunctor(Array<Cell>& old_cells, AMROperationType op)
62 {
63 (m_object->*m_function2)(old_cells, op);
64 }
65
66 private:
67
68 ClassType* m_object = nullptr; //!< Associated object.
69 FuncPtr m_function = nullptr; //!< Pointer to the associated method.
70 FuncPtr2 m_function2 = nullptr; //!< Pointer to the associated method.
71};
72
73/*---------------------------------------------------------------------------*/
74/*---------------------------------------------------------------------------*/
75
76} // End namespace Arcane
77
78/*---------------------------------------------------------------------------*/
79/*---------------------------------------------------------------------------*/
80
81#endif
AMRTransportFunctorT(ClassType *object, FuncPtr funcptr)
Constructor.
void executeFunctor(Array< ItemInternal * > &old_cells, AMROperationType op)
Executes the associated method.
void executeFunctor(Array< Cell > &old_cells, AMROperationType op)
Executes the associated method.
void(ClassType::* FuncPtr)(Array< ItemInternal * > &, AMROperationType)
Type of the method pointer.
void(ClassType::* FuncPtr2)(Array< Cell > &, AMROperationType)
Type of the method pointer.
Base class for 1D data vectors.
Interface of a functor with argument.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --