Loading...
Searching...
No Matches
IjkField.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
26Class
27 Foam::IjkField
28
29Description
30 Generic templated field type with i-j-k addressing.
31
32SourceFiles
33 IjkFieldI.H
34 IjkField.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_IjkField_H
39#define Foam_IjkField_H
40
41#include "ijkAddressing.H"
42#include "Field.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class IjkField Declaration
51\*---------------------------------------------------------------------------*/
52
53template<class Type>
54class IjkField
55:
56 public Field<Type>
57{
58 // Private Data
59
60 //- The i-j-k addressing
61 ijkAddressing ijk_;
62
63
64public:
65
66 // Constructors
67
68 //- Construct zero-sized
69 inline IjkField();
70
71 //- Copy construct
72 inline IjkField(const IjkField<Type>& field);
73
74 //- Move construct
76
77 //- Construct with sizing information, leaving values uninitialized
78 inline explicit IjkField(const labelVector& ijk);
79
80 //- Construct with sizing information and initial value
81 inline IjkField(const labelVector& ijk, const Type& val);
82
83 //- Construct with sizing information and initial values of zero
84 inline IjkField(const labelVector& ijk, Foam::zero);
85
86 //- Copy construct from components
87 inline IjkField(const labelVector& ijk, const UList<Type>& list);
88
89 //- Move construct from components
90 inline IjkField(const labelVector& ijk, Field<Type>&& field);
91
92
93 // Member Functions
94
95 // Access
96
97 //- Return i,j,k addressing
98 const ijkAddressing& ijk() const noexcept { return ijk_; }
99
100 //- Return i,j,k addressing for modification
101 ijkAddressing& ijk() noexcept { return ijk_; }
102
103 //- Return i,j,k addressing sizes
104 const labelVector& sizes() const noexcept { return ijk_.sizes(); }
105
106 //- Return i,j,k addressing sizes for modification
107 labelVector& sizes() noexcept { return ijk_.sizes(); }
108
109 //- The field size
110 using Field<Type>::size;
111
112 //- The addressing dimension in the given direction
113 inline label size(const vector::components cmpt) const;
114
115
116 // Edit
117
118 //- Clear dimensions and field
119 inline void clear();
120
121 //- Change dimensions. Fill new values with zero
122 void resize(const labelVector& newSizes);
124 //- Change dimensions
125 void resize(const labelVector& newSizes, const Type& val);
126
127
128 // Access Operators
129
130 //- Field access at given i-j-k position
131 inline const Type& operator()
132 (
133 const label i,
134 const label j,
135 const label k
136 ) const;
137
138 //- Field access at given i-j-k position
139 inline Type& operator()
140 (
141 const label i,
142 const label j,
143 const label k
144 );
145
146 //- Field access at given i-j-k position
147 inline const Type& operator()(const labelVector& ijk) const;
148
149 //- Field access at given i-j-k position
150 inline Type& operator()(const labelVector& ijk);
151
152
153 // Member Operators
154
155 //- Copy assignment
156 void operator=(const IjkField<Type>& rhs);
157 void operator=(const tmp<IjkField<Type>>& rhs);
158
159 //- Move assignment
160 inline void operator=(IjkField<Type>&& rhs);
161
162 //- Value assignment
163 inline void operator=(const Type& val);
164 inline void operator=(Foam::zero);
165
166};
167
168
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170
171} // End namespace Foam
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175#include "IjkFieldI.H"
176
177#ifdef NoRepository
178 #include "IjkField.C"
179#endif
180
181// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182
183#endif
184
185// ************************************************************************* //
label k
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
constexpr Field() noexcept
Default construct.
Definition FieldI.H:24
Generic templated field type with i-j-k addressing.
Definition IjkField.H:52
IjkField()
Construct zero-sized.
Definition IjkFieldI.H:24
const ijkAddressing & ijk() const noexcept
Return i,j,k addressing.
Definition IjkField.H:113
const labelVector & sizes() const noexcept
Return i,j,k addressing sizes.
Definition IjkField.H:123
label size(const vector::components cmpt) const
The addressing dimension in the given direction.
Definition IjkFieldI.H:129
void operator=(const IjkField< Type > &rhs)
Copy assignment.
Definition IjkField.C:117
ijkAddressing & ijk() noexcept
Return i,j,k addressing for modification.
Definition IjkField.H:118
void clear()
Clear dimensions and field.
Definition IjkFieldI.H:138
void resize(const labelVector &newSizes)
Change dimensions. Fill new values with zero.
Definition IjkField.C:108
labelVector & sizes() noexcept
Return i,j,k addressing sizes for modification.
Definition IjkField.H:128
const Type & operator()(const label i, const label j, const label k) const
Field access at given i-j-k position.
Definition IjkFieldI.H:149
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:89
A simple i-j-k (row-major order) to linear addressing.
A class for managing temporary objects.
Definition tmp.H:75
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
rDeltaTY field()
Namespace for OpenFOAM.
Vector< label > labelVector
Vector of labels.
Definition labelVector.H:47
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
const direction noexcept
Definition scalarImpl.H:265