Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
Space.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 Space.h
21 * \brief Space.h
22 */
23
24#pragma once
25
26#include <alien/data/ISpace.h>
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31namespace Alien
32{
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37/*!
38 * \ingroup data
39 * \brief Implementation of an algebraic space
40 *
41 * An algebraic space is composed of a name and size, on which can be added some labels
42 * over some elements on this space. The purpose is to be able to differentiate different
43 * spaces which have the same size, although operations between elements on those spaces
44 * should not be permitted. It is close to the algebraic definition of a space
45 */
46class ALIEN_EXPORT Space final : public ISpace
47{
48 public:
49 //! Constructor
50 Space();
51
52 /*!
53 * \brief Anonymous constructor. The space have no name
54 * \param[in] size The size of the space
55 */
56 Space(Arccore::Integer size);
57
58 /*!
59 * \brief Full constructor
60 * \param[in] size The size of the space
61 * \param[in] name The name of the space
62 */
63 Space(Arccore::Integer size, Arccore::String name);
64
65 /*!
66 * \brief Copy constructor
67 * \param[in] s The space to copy
68 */
69 Space(const Space& s);
70
71 /*!
72 * \brief Rvalue constructor
73 * \param[in] s The space to take
74 */
75 Space(Space&& s);
76
77 //! Free resources
78 ~Space();
79
80 /*!
81 * \brief Equal operator
82 * \param[in] src The space to copy
83 * \returns The space copied
84 */
85 Space& operator=(const Space& src);
86
87 /*!
88 * \brief Rvalue equal operator
89 * \param[in] src The space to copy
90 * \returns The space copied
91 */
92 Space& operator=(Space&& src);
93
94 /*!
95 * \brief Comparison operator
96 * \param[in] space The space to compare to
97 * \returns Wheteher the spaces are the same
98 */
99 bool operator==(const ISpace& space) const;
100
101 /*!
102 * \brief Comparison operator
103 * \param[in] space The space to compare to
104 * \returns Wheteher the spaces are different
105 */
106 bool operator!=(const ISpace& space) const;
107
108 /*!
109 * \brief Get space size
110 * \returns The size of the space
111 */
112 Arccore::Integer size() const;
113
114 /*!
115 * \brief Get space name
116 * \returns The name of the space
117 */
118 const Arccore::String& name() const;
119
120 /*!
121 * \brief Set label on matrix entries
122 * \param[in] label The name of the label
123 * \param[in] indices The indices to which label is set
124 */
126 Arccore::String label, const Arccore::UniqueArray<Arccore::Integer>& indices);
127
128 /*!
129 * \brief Get the number of fields
130 * \returns The number of fields (labels)
131 */
132 Arccore::Integer nbField() const;
133
134 /*!
135 * \brief Get the label of the i-th field
136 * \param[in] i The requested field
137 * \returns The associated label
138 */
139 Arccore::String fieldLabel(Arccore::Integer i) const;
140
141 /*!
142 * \brief Get indices associated to the i-th field
143 * \para[in] i The requested field
144 * \returns The indices associated to the field
145 */
146 const Arccore::UniqueArray<Arccore::Integer>& field(Arccore::Integer i) const;
147
148 /*!
149 * \brief Get the indices associated to a label
150 * \param[in] label The requested label
151 * \returns The indices associated to the field
152 */
153 const Arccore::UniqueArray<Arccore::Integer>& field(Arccore::String label) const;
154
155 /*!
156 * \brief Clone this object
157 * \returns A clone of this object
158 */
159 std::shared_ptr<ISpace> clone() const;
160
161 private:
162 class Internal;
163 //! Internal implementation of a space
164 std::shared_ptr<Internal> m_internal;
165};
166
167/*---------------------------------------------------------------------------*/
168/*---------------------------------------------------------------------------*/
169
170} // namespace Alien
171
172/*---------------------------------------------------------------------------*/
173/*---------------------------------------------------------------------------*/
ISpace.h.
ISpace()
Constructor.
Definition ISpace.h:47
Internal structure of Space object.
Definition Space.cc:49
Space(Arccore::Integer size, Arccore::String name)
Full constructor.
Space & operator=(const Space &src)
Equal operator.
Definition Space.cc:191
Arccore::Integer nbField() const
Get the number of fields.
Definition Space.cc:253
Arccore::String fieldLabel(Arccore::Integer i) const
Get the label of the i-th field.
const Arccore::String & name() const
Get space name.
Definition Space.cc:236
Arccore::Integer size() const
Get space size.
Definition Space.cc:211
void setField(Arccore::String label, const Arccore::UniqueArray< Arccore::Integer > &indices)
Set label on matrix entries.
Space(Arccore::Integer size)
Anonymous constructor. The space have no name.
Space()
Constructor.
Definition Space.cc:149
const Arccore::UniqueArray< Arccore::Integer > & field(Arccore::String label) const
Get the indices associated to a label.
const Arccore::UniqueArray< Arccore::Integer > & field(Arccore::Integer i) const
Get indices associated to the i-th field \para[in] i The requested field.
std::shared_ptr< ISpace > clone() const
Clone this object.
Definition Space.cc:289
bool operator!=(const ISpace &space) const
Comparison operator.
Definition Space.cc:227
bool operator==(const ISpace &space) const
Comparison operator.
Definition Space.cc:219
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17