Loading...
Searching...
No Matches
genericPointPatchField.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-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
31
32// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
33
34template<class Type>
36(
37 const pointPatch& p,
39)
40:
41 parent_bctype(p, iF)
42{
44 << "Trying to construct generic patchField on patch "
45 << this->patch().name()
46 << " of field " << this->internalField().name() << nl
47 << abort(FatalError);
48}
49
50
51template<class Type>
53(
54 const pointPatch& p,
56 const dictionary& dict
57)
58:
59 parent_bctype(p, iF, dict),
61{
62 const label patchSize = this->size();
63 const word& patchName = this->patch().name();
64 const IOobject& io = this->internalField();
66 // No separate "value"
67 processGeneric(patchSize, patchName, io, false);
68}
69
70
71template<class Type>
73(
75 const pointPatch& p,
77 const pointPatchFieldMapper& mapper
78)
79:
80 parent_bctype(rhs, p, iF, mapper),
82{
83 this->mapGeneric(rhs, mapper);
84}
85
86
87template<class Type>
89(
92)
93:
94 parent_bctype(rhs, iF),
96{}
97
98
99// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100
101template<class Type>
104 // No separate treatment for "value"
106}
107
108
109template<class Type>
111(
112 const pointPatchFieldMapper& m
114{
115 this->autoMapGeneric(m);
116}
117
118
119template<class Type>
121(
123 const labelList& addr
124)
125{
126 const auto* base = isA<genericPatchFieldBase>(rhs);
127 if (base)
128 {
129 this->rmapGeneric(*base, addr);
130 }
131}
132
133
134// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const word & name() const noexcept
Return the object name.
Definition IOobjectI.H:205
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Generic infrastructure for reading/writing unknown patch types.
void writeGeneric(Ostream &os, const bool separateValue) const
Write all generic entries from dictionary, optionally treating the "value" entry separately.
void rmapGeneric(const genericPatchFieldBase &rhs, const labelList &addr)
Implementation for reverse map given patch field onto this patch field.
void autoMapGeneric(const MapperType &mapper)
Implementation for autoMap of self given a mapping object.
genericPatchFieldBase(const Foam::zero, const genericPatchFieldBase &)
Partial copy construct. Only copy type and dictionary.
void processGeneric(const label patchSize, const word &patchName, const IOobject &io, const bool separateValue)
void mapGeneric(const genericPatchFieldBase &rhs, const MapperType &mapper)
Implementation for construct with mapper.
A generic version of calculatedPointPatchField, useful as a fallback for handling unknown patch types...
genericPointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
virtual void write(Ostream &) const
Write.
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given pointPatchField onto this pointPatchField.
const word & name() const noexcept
The patch name.
const pointPatch & patch() const noexcept
Return the patch.
Foam::pointPatchFieldMapper.
Abstract base class for point-mesh patch fields.
label size() const noexcept
Return the patch size.
const DimensionedField< Type, pointMesh > & internalField() const noexcept
Return const-reference to the dimensioned internal field.
Basic pointPatch represents a set of points from the mesh.
Definition pointPatch.H:67
A class for handling words, derived from Foam::string.
Definition word.H:66
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
volScalarField & p
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
OBJstream os(runTime.globalPath()/outputName)
const auto & io
List< label > labelList
A List of labels.
Definition List.H:62
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Definition typeInfo.H:87
errorManip< error > abort(error &err)
Definition errorManip.H:139
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
dictionary dict