Loading...
Searching...
No Matches
genericFaePatchField.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) 2023 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\*---------------------------------------------------------------------------*/
29#include "faPatchFieldMapper.H"
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class Type>
35(
36 const faPatch& p,
38)
39:
40 parent_bctype(p, iF)
41{
43 << "Trying to construct generic patchField on patch "
44 << this->patch().name()
45 << " of field " << this->internalField().name()
46 << abort(FatalError);
47}
48
49
50template<class Type>
52(
53 const faPatch& p,
55 const dictionary& dict
56)
57:
58 parent_bctype(p, iF, dict),
60{
61 const label patchSize = this->size();
62 const word& patchName = this->patch().name();
63 const IOobject& io = this->internalField();
64
65 if (!dict.findEntry("value", keyType::LITERAL))
66 {
67 reportMissingEntry("value", patchName, io);
68 }
70 // Handle "value" separately
71 processGeneric(patchSize, patchName, io, true);
72}
73
74
75template<class Type>
77(
79 const faPatch& p,
81 const faPatchFieldMapper& mapper
82)
83:
84 parent_bctype(rhs, p, iF, mapper),
86{
87 this->mapGeneric(rhs, mapper);
88}
89
90
91template<class Type>
93(
96)
97:
98 parent_bctype(rhs, iF),
100{}
101
102
103// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104
105template<class Type>
107{
108 // Handle "value" separately
111}
112
113
114template<class Type>
116(
117 const faPatchFieldMapper& m
118)
121 this->autoMapGeneric(m);
122}
123
124
125template<class Type>
127(
129 const labelList& addr
130)
131{
132 parent_bctype::rmap(rhs, addr);
133
134 const auto* base = isA<genericPatchFieldBase>(rhs);
135 if (base)
136 {
137 this->rmapGeneric(*base, addr);
138 }
139}
140
141
142// ************************************************************************* //
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
void size(const label n)
Definition UList.H:118
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
Definition dictionaryI.H:84
A FieldMapper for finite-area patch fields.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition faPatch.H:76
const faPatch & patch() const noexcept
Return the patch.
faePatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cove...
const DimensionedField< Type, edgeMesh > & internalField() const noexcept
Return const-reference to the dimensioned internal field.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const faePatchField< Type > &, const labelList &)
Reverse map the given faePatchField onto this faePatchField.
This boundary condition provides a generic version of the calculated condition, useful as a fallback ...
virtual void write(Ostream &) const
Write.
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
genericFaePatchField(const faPatch &, const DimensionedField< Type, edgeMesh > &)
Construct from patch and internal field.
virtual void rmap(const faePatchField< Type > &, const labelList &)
Reverse map the given faPatchField onto this faPatchField.
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 reportMissingEntry(const word &entryName, const word &patchName, const IOobject &io) const
FatalError for missing entry.
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.
@ LITERAL
String literal.
Definition keyType.H:82
const word & name() const noexcept
The patch name.
A class for handling words, derived from Foam::string.
Definition word.H:66
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...
dictionary dict
A non-counting (dummy) refCount.
Definition refCount.H:55