slicedFaPatchField.C
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) 2011 OpenFOAM Foundation
9  Copyright (C) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "slicedFaPatchField.H"
30 
31 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const faPatch& p,
38  const Field<Type>& completeOrBoundaryField,
39  const bool isBoundaryOnly
40 )
41 :
42  faPatchField<Type>(p, iF, Field<Type>())
43 {
44  if (isBoundaryOnly)
45  {
46  // Set to a slice of the boundary field
47  UList<Type>::shallowCopy(p.boundarySlice(completeOrBoundaryField));
48  }
49  else
50  {
51  // Set to a slice of the complete field
52  UList<Type>::shallowCopy(p.patchSlice(completeOrBoundaryField));
53  }
54 }
55 
56 
57 template<class Type>
59 (
60  const faPatch& p,
61  const DimensionedField<Type, areaMesh>& iF
62 )
63 :
64  faPatchField<Type>(p, iF, Field<Type>())
65 {}
66 
67 
68 template<class Type>
70 (
71  const faPatch& p,
73  const dictionary& dict
74 )
75 :
76  faPatchField<Type>(p, iF) // bypass dictionary constructor
77 {
79  // Read "value" if present...
80 
82 }
83 
84 
85 template<class Type>
87 (
88  const slicedFaPatchField<Type>& ptf,
89  const faPatch& p,
91  const faPatchFieldMapper& mapper
92 )
93 :
94  faPatchField<Type>(ptf, p, iF, mapper)
95 {
97 }
98 
99 
100 template<class Type>
102 (
103  const slicedFaPatchField<Type>& ptf,
105 )
106 :
107  faPatchField<Type>(ptf.patch(), iF, Field<Type>())
108 {
109  // Transfer the slice from the argument
111 }
112 
113 
114 template<class Type>
117 {
118  return tmp<faPatchField<Type>>
119  (
121  );
122 }
123 
124 
125 template<class Type>
127 (
128  const slicedFaPatchField<Type>& ptf
129 )
130 :
131  faPatchField<Type>
132  (
133  ptf.patch(),
134  ptf.internalField(),
135  Field<Type>()
136  )
137 {
138  // Transfer the slice from the argument
140 }
141 
142 
143 template<class Type>
146 (
148 ) const
149 {
150  return tmp<faPatchField<Type>>
151  (
152  new slicedFaPatchField<Type>(*this, iF)
153  );
154 }
155 
156 
157 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
158 
159 template<class Type>
161 {
162  // Set to nullptr to avoid deletion of underlying field
164 }
165 
166 
167 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
168 
169 template<class Type>
171 {
174  return Field<Type>::null();
175 }
176 
177 
178 template<class Type>
181 {
183 
184  return Field<Type>::null();
185 }
186 
187 
188 template<class Type>
190 {
192 }
193 
194 
195 template<class Type>
198 (
199  const Field<Type>& iField
200 ) const
201 {
204  return Field<Type>::null();
205 }
206 
207 
208 template<class Type>
211 {
213 
215 }
216 
217 
218 template<class Type>
221 (
222  const tmp<scalarField>&
223 ) const
224 {
226 
228 }
229 
230 
231 template<class Type>
234 (
235  const tmp<scalarField>&
236 ) const
237 {
240  return Field<Type>::null();
241 }
242 
243 
244 template<class Type>
247 {
250  return Field<Type>::null();
251 }
252 
253 
254 template<class Type>
257 {
259 
260  return Field<Type>::null();
261 }
262 
263 
264 template<class Type>
266 {
269 }
270 
271 
272 // ************************************************************************* //
dictionary dict
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Specialization of faPatchField which creates the underlying faPatchField as a slice of the given comp...
virtual void write(Ostream &os) const
Write.
Definition: faPatchField.C:253
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField of the values on the patch or on the.
virtual void readDict(const dictionary &dict)
Read dictionary entries.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
Definition: faPatchField.H:317
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:56
virtual tmp< faPatchField< Type > > clone() const
Construct and return a clone.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Generic templated field type.
Definition: Field.H:62
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
virtual ~slicedFaPatchField()
Destructor.
virtual void write(Ostream &) const
Write.
static const Field< Type > & null()
Return nullObject reference Field.
Definition: FieldI.H:24
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
void shallowCopy(T *__restrict__ ptr, const label len) noexcept
Copy the pointer and size.
Definition: UListI.H:316
const std::string patch
OpenFOAM patch number as a std::string.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
slicedFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &, const Field< Type > &completeOrBoundaryField, const bool isBoundaryOnly=false)
Construct from patch, internal field and field to slice.
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A FieldMapper for finite-area patch fields.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686