Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IMeshMaterialSynchronizeBuffer.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/* IMeshMaterialSynchronizeBuffer.h (C) 2000-2023 */
9/* */
10/* Interface for buffers for material variable synchronization. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MATERIALS_IMESHMATERIALSYNCHRONIZEBUFFER_H
13#define ARCANE_MATERIALS_IMESHMATERIALSYNCHRONIZEBUFFER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/ArrayView.h"
18#include "arcane/utils/Ref.h"
19
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane::Materials
26{
27/*
28 * TODO: This interface could be used outside of materials.
29 * Look into how to make it generic.
30 */
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34/*!
35 * \internal
36 * \brief Interface for buffers for material variable synchronization.
37 *
38 * To use instances of this interface, proceed as follows:
39 * 1. Set the number of ranks via setNbRank().
40 * 2. For each buffer, call setSendBufferSize() and setReceiveBufferSize()
41 * to indicate the number of elements in each buffer.
42 * 3. Call allocate() to allocate the buffers.
43 * 4. Retrieve views on the buffers via sendBuffer() or receiveBuffer().
44 */
46{
47 public:
48
50
51 public:
52
53 //! Number of ranks
54 virtual Int32 nbRank() const = 0;
55
56 //! Sets the number of ranks. This invalidates the send and receive buffers
57 virtual void setNbRank(Int32 nb_rank) = 0;
58
59 //! Send buffer for the i-th buffer
60 virtual Span<Byte> sendBuffer(Int32 i) = 0;
61
62 //! Sets the number of elements for the i-th send buffer
63 virtual void setSendBufferSize(Int32 i, Int32 new_size) = 0;
64
65 //! Send buffer for the i-th buffer
67
68 //! Sets the number of elements for the i-th receive buffer
69 virtual void setReceiveBufferSize(Int32 i, Int32 new_size) = 0;
70
71 //! Allocates memory for the buffers
72 virtual void allocate() = 0;
73
74 //! Total size allocated for the buffers
75 virtual Int64 totalSize() const = 0;
76};
77
78/*---------------------------------------------------------------------------*/
79/*---------------------------------------------------------------------------*/
80
81namespace impl
82{
84 makeMultiBufferMeshMaterialSynchronizeBufferRef();
86 makeMultiBufferMeshMaterialSynchronizeBufferRef(eMemoryRessource mem);
88 makeOneBufferMeshMaterialSynchronizeBufferRef(eMemoryRessource mem);
89} // namespace impl
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
93
94} // End namespace Arcane::Materials
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
98
99#endif
virtual void setNbRank(Int32 nb_rank)=0
Sets the number of ranks. This invalidates the send and receive buffers.
virtual Span< Byte > receiveBuffer(Int32 i)=0
Send buffer for the i-th buffer.
virtual Int64 totalSize() const =0
Total size allocated for the buffers.
virtual Span< Byte > sendBuffer(Int32 i)=0
Send buffer for the i-th buffer.
virtual void setReceiveBufferSize(Int32 i, Int32 new_size)=0
Sets the number of elements for the i-th receive buffer.
virtual void setSendBufferSize(Int32 i, Int32 new_size)=0
Sets the number of elements for the i-th send buffer.
virtual Int32 nbRank() const =0
Number of ranks.
virtual void allocate()=0
Allocates memory for the buffers.
Reference to an instance.
View of an array of elements of type T.
Definition Span.h:635
Always enables tracing in Arcane parts concerning materials.
class ARCANE_MATERIALS_EXPORT(64) SimdMatVarIndex
SIMD indexer on a component.
std::int64_t Int64
Signed integer type of 64 bits.
Arcane::eMemoryResource eMemoryRessource
Typedef for the historical Arcane version (with 2's').
std::int32_t Int32
Signed integer type of 32 bits.