Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
IVectorImpl.h
Go to the documentation of this file.
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/*!
9 * \file IVectorImpl.h
10 * \brief IVectorImpl.h
11 */
12
13#pragma once
14
18#include <alien/utils/ObjectWithTrace.h>
19#include <alien/utils/Precomp.h>
20#include <alien/utils/time_stamp/Timestamp.h>
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Alien
26{
27
28typedef Arccore::String BackEndId;
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33class MultiVectorImpl;
34class ISpace;
35class Block;
36class VBlock;
37
38/*---------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------*/
40
41/*!
42 * \ingroup impl
43 * \brief Interface to handle abstract vectors implementation
44 */
45class ALIEN_EXPORT IVectorImpl : public Timestamp
46, public ObjectWithTrace
47{
48 public:
49 //! Type of the values stored in the vectors
50 typedef Arccore::Real ValueType;
51
52 public:
53 /*!
54 * \brief Constructor
55 * \param[in] multi_impl Pointer to the multivector handler, null if not associated
56 * \param[in] backend Name of the underneath backend, empty string if not associated
57 */
58 explicit IVectorImpl(const MultiVectorImpl* multi_impl, BackEndId backend = "");
59
60 //! Free resources
61 virtual ~IVectorImpl() override
62 {
63 delete m_vblock_sizes;
64 m_vblock_sizes = nullptr;
65 }
66
67 IVectorImpl(const IVectorImpl& src) = delete;
68 IVectorImpl(IVectorImpl&& src) = delete;
69 IVectorImpl& operator=(const IVectorImpl& src) = delete;
70 IVectorImpl& operator=(IVectorImpl&& src) = delete;
71
72 public:
73 //! Wipe out internal data.
74 virtual void clear() {}
75
76 /*!
77 * \brief Initialize vector datas
78 * \param[in] dist The vector distribution
79 * \param[in] do_alloc Allocate memory or not
80 *
81 * \todo Fix this method : could be removed during the process of solver refactoring
82 */
83 virtual void init([[maybe_unused]] const VectorDistribution& dist, [[maybe_unused]] bool do_alloc) {}
84
85 /*!
86 * \brief Get the vector space
87 * \returns The space associated to the vector
88 */
89 virtual const ISpace& space() const;
90
91 /*!
92 * Get the vector backend id
93 * \returns The backend if associated to the vector
94 */
95 virtual BackEndId backend() const { return m_backend; }
96
97 /*!
98 * \brief Get the distribution of the vector
99 * \returns The vector distribution
100 */
101 virtual const VectorDistribution& distribution() const;
102
103 /*!
104 * \brief Get block datas of the vector
105 *
106 * Get the block datas of the vector. This method should be used only with uniform
107 * blocks vectors, otherwise il will return a nullptr
108 *
109 * \returns Block data for block vector, nullptr for scalar and variable block vector
110 */
111 virtual const Block* block() const;
112
113 /*!
114 * \brief Get block datas of the vector
115 *
116 * Get the block datas of the vector. This method should be used only with variable
117 * blocks vectors, otherwise il will return a nullptr
118 *
119 * \returns Block data for variable block vector, nullptr for scalar and block vector
120 */
121 virtual const VBlock* vblock() const;
122
123 /*!
124 * \brief Get the "scalarized" local size
125 * \see VBlockSizes for "scalarized" definition
126 * \returns The actual local size
127 */
128 virtual Arccore::Integer scalarizedLocalSize() const;
129
130 /*!
131 * \brief Get the "scalarized" global size
132 * \see VBlockSizes for "scalarized" definition
133 * \returns The actual global size
134 */
135 virtual Arccore::Integer scalarizedGlobalSize() const;
136
137 /*!
138 * \brief Get the "scalarized" offset
139 * \see VBlockSizes for "scalarized" definition
140 * \returns The actual offset
141 */
142 virtual Arccore::Integer scalarizedOffset() const;
143
144 const MultiVectorImpl* impls() const {
145 return m_multi_impl;
146 }
147 protected:
148 //! Pointer on vectors implementations
150 //! Backend id
151 BackEndId m_backend;
152 //! Variable blocks size data
154};
155
156/*---------------------------------------------------------------------------*/
157/*---------------------------------------------------------------------------*/
158
159} // namespace Alien
160
161/*---------------------------------------------------------------------------*/
162/*---------------------------------------------------------------------------*/
Block.h.
VBlockSizes.h.
VectorDistribution.h.
Block elements for block matrices.
Definition Block.h:45
Interface for algebraic space objects.
Definition ISpace.h:44
Interface to handle abstract vectors implementation.
Definition IVectorImpl.h:47
const MultiVectorImpl * m_multi_impl
Pointer on vectors implementations.
virtual void init(const VectorDistribution &dist, bool do_alloc)
Initialize vector datas.
Definition IVectorImpl.h:83
virtual ~IVectorImpl() override
Free resources.
Definition IVectorImpl.h:61
virtual void clear()
Wipe out internal data.
Definition IVectorImpl.h:74
IVectorImpl(const MultiVectorImpl *multi_impl, BackEndId backend="")
Constructor.
BackEndId m_backend
Backend id.
VBlockSizes * m_vblock_sizes
Variable blocks size data.
Arccore::Real ValueType
Type of the values stored in the vectors.
Definition IVectorImpl.h:50
virtual BackEndId backend() const
Definition IVectorImpl.h:95
Compute the actual size of variable block size algebraic elements.
Definition VBlockSizes.h:51
Variable size block elements for block matrices.
Definition VBlock.h:46
Computes a vector distribution.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17