MapDimensionedFields.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) 2012 OpenFOAM Foundation
9  Copyright (C) 2019 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 Description
28  Generic internal field mapper for dimensioned fields. For "real" mapping,
29  add template specialisations for mapping of internal fields depending on
30  mesh type.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef MapDimensionedFields_H
35 #define MapDimensionedFields_H
36 
37 #include "polyMesh.H"
38 #include "MapFvVolField.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 template<class Type, class MeshMapper, class GeoMesh>
46 void MapDimensionedFields(const MeshMapper& mapper)
47 {
48  typedef DimensionedField<Type, GeoMesh> FieldType;
49  typedef HashTable<const FieldType*> TableType;
50 
51  TableType fields(mapper.thisDb().template lookupClass<FieldType>(true));
52 
53  forAllConstIters(fields, fieldIter)
54  {
55  FieldType& field = const_cast<FieldType&>(*fieldIter());
56 
57  if (&field.mesh() == &mapper.mesh())
58  {
59  if (polyMesh::debug)
60  {
61  Info<< "Mapping " << field.typeName << ' ' << field.name()
62  << endl;
63  }
64 
66 
67  field.instance() = field.time().timeName();
68  }
69  else if (polyMesh::debug)
70  {
71  Info<< "Not mapping " << field.typeName << ' ' << field.name()
72  << " since originating mesh differs from that of mapper."
73  << endl;
74  }
75  }
76 }
77 
78 
79 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80 
81 } // End namespace Foam
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 #endif
86 
87 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
polyMesh.H
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
MapFvVolField.H
Map volume internal field on topology change. This is a partial template specialisation,...
field
rDeltaTY field()
Foam::MapDimensionedFields
void MapDimensionedFields(const MeshMapper &mapper)
Definition: MapDimensionedFields.H:46
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::HashTable
A HashTable similar to std::unordered_map.
Definition: HashTable.H:105
Foam::MapInternalField
Generic internal field mapper. For "real" mapping, add template specialisations for mapping of intern...
Definition: MapGeometricFields.H:47
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
fields
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54