timeVaryingMappedFixedValueFvPatchField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
34 (
35  const fvPatch& p,
37 )
38 :
40  fieldMapper_(p, iF.name())
41 {}
42 
43 
44 template<class Type>
47 (
48  const fvPatch& p,
50  const dictionary& dict
51 )
52 :
53  fixedValueFvPatchField<Type>(p, iF, dict, false),
54  fieldMapper_(p, dict, iF.name())
55 {
56  if (dict.found("value"))
57  {
58  fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
59  }
60  else
61  {
62  // Note: we use evaluate() here to trigger updateCoeffs followed
63  // by re-setting of fvatchfield::updated_ flag. This is
64  // so if first use is in the next time step it retriggers
65  // a new update.
66  this->evaluate(Pstream::commsTypes::blocking);
67  }
68 }
69 
70 
71 template<class Type>
74 (
76  const fvPatch& p,
78  const fvPatchFieldMapper& mapper
79 )
80 :
81  fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
82  fieldMapper_(ptf.fieldMapper_)
83 {}
84 
85 
86 template<class Type>
89 (
92 )
93 :
95  fieldMapper_(ptf.fieldMapper_)
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 
101 template<class Type>
103 (
104  const fvPatchFieldMapper& m
105 )
106 {
108  fieldMapper_.autoMap(m);
109 }
110 
111 
112 template<class Type>
114 (
115  const fvPatchField<Type>& ptf,
116  const labelList& addr
117 )
118 {
120  fieldMapper_.rmap
121  (
122  refCast
123  <
125  >(ptf).fieldMapper_,
126  addr
127  );
128 }
129 
130 
131 template<class Type>
133 (
134  const fvPatchField<Type>& ptf
135 )
136 {
138  fieldMapper_.reset
139  (
140  refCast
141  <
143  >(ptf).fieldMapper_
144  );
145 }
146 
147 
148 template<class Type>
150 {
151  if (this->updated())
152  {
153  return;
154  }
155 
156  this->operator==(fieldMapper_.map());
157 
159 }
160 
161 
162 template<class Type>
164 (
165  Ostream& os
166 ) const
167 {
169  fieldMapper_.write(os);
170  writeEntry(os, "value", *this);
171 }
172 
173 
174 // ************************************************************************* //
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
dictionary dict
const word & name() const
Return name.
Definition: IOobject.H:315
void evaluate(GeometricField< Type, PatchField, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, PatchField, GeoMesh > &x)
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
This boundary conditions interpolates the values from a set of supplied points in space and time...
Pre-declare SubField and related Field type.
Definition: Field.H:56
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Foam::fvPatchFieldMapper.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
timeVaryingMappedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
volScalarField & p