MapVolFields.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) 2011-2017 OpenFOAM Foundation
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\*---------------------------------------------------------------------------*/
27
28#ifndef MapVolFields_H
29#define MapVolFields_H
30
31#include "GeometricField.H"
32#include "meshToMesh0.H"
33#include "IOobjectList.H"
34
35// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36
37namespace Foam
38{
39
40template<class Type, class CombineOp>
42(
43 const IOobjectList& objects,
44 const meshToMesh0& meshToMesh0Interp,
45 const meshToMesh0::order& mapOrder,
46 const CombineOp& cop
47)
48{
50
51 const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
52 const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
53
54 IOobjectList fields = objects.lookupClass(fieldType::typeName);
55
56 forAllConstIters(fields, fieldIter)
57 {
58 IOobject fieldTargetIOobject
59 (
60 (*fieldIter)->name(),
61 meshTarget.time().timeName(),
62 meshTarget,
65 );
66
67 if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
68 {
69 Info<< " interpolating " << (*fieldIter)->name() << endl;
70
71 // Read field fieldSource. Do not auto-load old-time fields
72 fieldType fieldSource(*fieldIter(), meshSource, false);
73
74 // Read fieldTarget. Do not auto-load old-time fields
75 fieldType fieldTarget
76 (
77 fieldTargetIOobject,
78 meshTarget,
79 false
80 );
81
82 // Interpolate field
83 meshToMesh0Interp.interpolate
84 (
85 fieldTarget,
86 fieldSource,
87 mapOrder,
88 cop
89 );
90
91 // Write field
92 fieldTarget.write();
93 }
94 }
95}
96
97
98// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99
100} // End namespace Foam
101
102// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103
104#endif
105
106// ************************************************************************* //
Generic GeometricField class.
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:59
IOobjectList lookupClass(const char *clsName) const
The list of IOobjects with the given headerClassName.
Definition: IOobjectList.C:313
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
Serial mesh to mesh interpolation class.
Definition: meshToMesh0.H:66
const fvMesh & toMesh() const
Definition: meshToMesh0.H:238
void interpolate(VolumeField< Type > &, const VolumeField< Type > &, order=INTERPOLATE, const CombineOp &cop=eqOp< Type >()) const
Interpolate volume field.
order
Enumeration specifying required accuracy.
Definition: meshToMesh0.H:148
const fvMesh & fromMesh() const
Definition: meshToMesh0.H:233
Namespace for OpenFOAM.
void MapVolFields(const IOobjectList &objects, const meshToMesh0 &meshToMesh0Interp, const meshToMesh0::order &mapOrder, const CombineOp &cop)
Definition: MapVolFields.H:42
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Definition: stdFoam.H:278