Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
data/CompositeVector.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 IFPEN-CEA
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 */
18
19/*!
20 * \file alien/data/CompositeVector.h
21 * \brief CompositeVector.h
22 */
23
24#pragma once
25
26#include <alien/data/IVector.h>
27#include <alien/kernels/composite/CompositeVectorElement.h>
28#include <alien/utils/ObjectWithTrace.h>
29#include <cstdlib>
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34namespace Alien
35{
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
40namespace CompositeKernel
41{
42
43 /*---------------------------------------------------------------------------*/
44 /*---------------------------------------------------------------------------*/
45
46 class Vector;
47
48 /*---------------------------------------------------------------------------*/
49 /*---------------------------------------------------------------------------*/
50
51} // namespace CompositeKernel
52
53/*---------------------------------------------------------------------------*/
54/*---------------------------------------------------------------------------*/
55
56/*!
57 * \ingroup data
58 * \brief Composite vector for heterogenous vector
59 *
60 * This class allow to handle vectors made of several vectors
61 */
62class ALIEN_EXPORT CompositeVector : public IVector
63, private ObjectWithTrace
64{
65 public:
66 //! Type of submatrix element
68
69 public:
70 //! Constructor
72
73 /*!
74 * \brief Constructor
75 * \param[in] nc The number of subvectors
76 */
77 CompositeVector(Arccore::Integer nc);
78
79 //! Free resources
80 virtual ~CompositeVector() {}
81
82 /*!
83 * \brief Visit method
84 * \param[in] visit Visit vector method
85 */
86 void visit(ICopyOnWriteVector&) const;
87
88 /*!
89 * \brief Get the space of the global vector
90 * \returns The space
91 */
92 const ISpace& space() const;
93
94 /*!
95 * \brief Resize the number of submatrices
96 * \param[in] nc The number of submatrices
97 */
98 void resize(Arccore::Integer nc);
99
100 /*!
101 * \brief Get the number of subvectors
102 * \returns The number of subvectors
103 */
104 Arccore::Integer size() const;
105
106 /*!
107 * \brief Get the i-th element
108 * \param[in] i The index of the element
109 * \returns The i-th element
110 */
111 Element composite(Arccore::Integer i);
112
113 /*!
114 * \brief Get the i-th subvector
115 * \param[in] i The index of the subvector
116 * \returns The i-th subvector
117 */
118 IVector& operator[](Arccore::Integer i);
119
120 /*!
121 * \brief Get the i-th subvector
122 * \param[in] i The index of the subvector
123 * \returns The i-th subvector
124 */
125 const IVector& operator[](Arccore::Integer i) const;
126
127 /*!
128 * \brief Add a feature to the composite vector
129 * \param[in] feature The feature to add
130 */
131 void setUserFeature(Arccore::String feature);
132
133 /*!
134 * \brief Check if the composite vector has a feature
135 * \returns Wheteher or not the composite matrix has the feature
136 */
137 bool hasUserFeature(Arccore::String feature) const;
138
139 public:
140 /*!
141 * \brief Get the multivector implementation
142 * \returns The multivector implementation
143 */
145
146 /*!
147 * \brief Get the multivector implementation
148 * \returns The multivector implementation
149 */
150 const MultiVectorImpl* impl() const;
151
152 //! Free resources
153 void free();
154
155 //! Clear resources
156 void clear();
157
158 private:
159 //! The multivector implementation
160 std::shared_ptr<MultiVectorImpl> m_impl;
161 //! The composite vector
162 CompositeKernel::Vector& m_composite_vector;
163};
164
165/*---------------------------------------------------------------------------*/
166/*---------------------------------------------------------------------------*/
167
168extern ALIEN_EXPORT CompositeVector::Element CompositeElement(
169CompositeVector& v, Arccore::Integer i);
170
171/*---------------------------------------------------------------------------*/
172/*---------------------------------------------------------------------------*/
173
174} // namespace Alien
175
176/*---------------------------------------------------------------------------*/
177/*---------------------------------------------------------------------------*/
IVector.h.
Composite vector for heterogenous vector.
IVector & operator[](Arccore::Integer i)
Get the i-th subvector.
MultiVectorImpl * impl()
Get the multivector implementation.
CompositeVector(Arccore::Integer nc)
Constructor.
virtual ~CompositeVector()
Free resources.
CompositeKernel::VectorElement Element
Type of submatrix element.
void setUserFeature(Arccore::String feature)
Add a feature to the composite vector.
bool hasUserFeature(Arccore::String feature) const
Check if the composite vector has a feature.
void free()
Free resources.
const IVector & operator[](Arccore::Integer i) const
Get the i-th subvector.
void clear()
Clear resources.
Interface for algebraic space objects.
Definition ISpace.h:44
IVector()
Constructor.
Definition IVector.h:54
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17