IjkFieldI.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2019-2020 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29
30template<class Type>
32:
33 Field<Type>(),
34 ijk_()
35{}
36
37
38template<class Type>
40:
41 Field<Type>(field),
42 ijk_(field.ijk())
43{}
44
45
46template<class Type>
48:
49 Field<Type>(std::move(field)),
50 ijk_(field.ijk())
51{}
52
53
54template<class Type>
56:
57 Field<Type>(cmptProduct(ijk)),
58 ijk_(ijk)
59{}
60
61
62template<class Type>
64(
65 const labelVector& ijk,
66 const Type& val
67)
69 Field<Type>(cmptProduct(ijk), val),
70 ijk_(ijk)
71{}
72
73
74template<class Type>
76(
77 const labelVector& ijk,
78 const Foam::zero
79)
81 Field<Type>(cmptProduct(ijk), Zero),
82 ijk_(ijk)
83{}
84
85
86template<class Type>
88(
89 const labelVector& ijk,
90 const UList<Type>& list
91)
92:
93 Field<Type>(list),
94 ijk_(ijk)
95{
96 if (ijk_.size() != Field<Type>::size())
97 {
98 #ifdef FULLDEBUG
100 << "Resizing field to match i-j-k sizing " << sizes()
101 << nl << nl;
102 #endif
104 Field<Type>::resize(ijk_.size(), Zero);
105 }
107
108
109template<class Type>
111(
112 const labelVector& ijk,
114)
115:
116 Field<Type>(std::move(field)),
117 ijk_(ijk)
119 if (ijk_.size() != Field<Type>::size())
120 {
121 #ifdef FULLDEBUG
123 << "Resizing field to match i-j-k sizing " << sizes()
124 << nl << nl;
125 #endif
126
127 Field<Type>::resize(ijk_.size(), Zero);
128 }
129}
131
132// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
133
134template<class Type>
136{
137 return ijk_;
139
140
141template<class Type>
143{
144 return ijk_;
145}
147
148template<class Type>
150{
151 return ijk_.sizes();
152}
153
154
155template<class Type>
157{
158 return ijk_.sizes();
160
161
162template<class Type>
163inline const Foam::label& Foam::IjkField<Type>::size
164(
165 const vector::components cmpt
166) const
167{
168 return ijk_.size(cmpt);
169}
170
171
172template<class Type>
174{
175 ijk_.clear();
177}
178
179
180// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
181
182template<class Type>
184(
185 const label i,
186 const label j,
187 const label k
188) const
189{
190 return Field<Type>::operator[](ijk_.index(i, j, k));
191}
192
193
194template<class Type>
196(
197 const label i,
198 const label j,
199 const label k
200)
201{
202 return Field<Type>::operator[](ijk_.index(i, j, k));
203}
204
205
206template<class Type>
208(
209 const labelVector& ijk
210) const
211{
212 return Field<Type>::operator[](ijk_.index(ijk));
213}
214
215
216template<class Type>
218(
219 const labelVector& ijk
220)
221{
222 return Field<Type>::operator[](ijk_.index(ijk));
223}
224
225
226template<class Type>
228{
229 if (this != &rhs)
230 {
231 sizes() = rhs.sizes();
232
234
235 rhs.clear();
236 }
237}
238
239
240template<class Type>
241inline void Foam::IjkField<Type>::operator=(const Type& val)
242{
244}
245
246
247template<class Type>
249{
251}
252
253
254// ************************************************************************* //
label k
Generic templated field type.
Definition: Field.H:82
Generic templated field type with i-j-k addressing.
Definition: IjkField.H:56
const ijkAddressing & ijk() const
Return i,j,k addressing.
Definition: IjkFieldI.H:135
IjkField()
Construct zero-sized.
Definition: IjkFieldI.H:31
const labelVector & sizes() const
Return i,j,k addressing sizes.
Definition: IjkFieldI.H:149
void operator=(const IjkField< Type > &rhs)
Copy assignment.
Definition: IjkField.C:124
void clear()
Clear dimensions and field.
Definition: IjkFieldI.H:173
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
components
Component labeling enumeration.
Definition: Vector.H:81
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
A simple i-j-k (row-major order) to linear addressing.
Definition: ijkAddressing.H:52
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:63
rDeltaTY field()
#define WarningInFunction
Report a warning using Foam::Warning.
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
Definition: VectorSpaceI.H:598
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53