MapMeshes.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 | Copyright (C) 2011-2015 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 
26 #ifndef MapMeshes_H
27 #define MapMeshes_H
28 
29 #include "MapVolFields.H"
30 #include "mapLagrangian.H"
31 #include "UnMapped.H"
32 #include "pointMesh.H"
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 
39 template<template<class> class CombineOp>
40 void MapMesh
41 (
42  const meshToMesh& interp,
43  const HashSet<word>& selectedFields,
44  const bool noLagrangian
45 )
46 {
47  {
48  const polyMesh& meshSource = interp.srcRegion();
49 
50  // Search for list of objects for this time
51  IOobjectList objects(meshSource, meshSource.time().timeName());
52 
53  // Map volFields
54  // ~~~~~~~~~~~~~
55  MapVolFields<scalar>
56  (
57  objects,
58  selectedFields,
59  interp,
60  CombineOp<scalar>()
61  );
62 
63  MapVolFields<vector>
64  (
65  objects,
66  selectedFields,
67  interp,
68  CombineOp<vector>()
69  );
70  MapVolFields<sphericalTensor>
71  (
72  objects,
73  selectedFields,
74  interp,
75  CombineOp<sphericalTensor>()
76  );
77  MapVolFields<symmTensor>
78  (
79  objects,
80  selectedFields,
81  interp,
82  CombineOp<symmTensor>()
83  );
84  MapVolFields<tensor>
85  (
86  objects,
87  selectedFields,
88  interp,
89  CombineOp<tensor>()
90  );
91  }
92 
93  {
94  const polyMesh& meshTarget = interp.tgtRegion();
95 
96  // Search for list of target objects for this time
97  IOobjectList objects(meshTarget, meshTarget.time().timeName());
98 
99  // Mark surfaceFields as unmapped
100  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101  UnMapped<surfaceScalarField>(objects);
102  UnMapped<surfaceVectorField>(objects);
103  UnMapped<surfaceSphericalTensorField>(objects);
104  UnMapped<surfaceSymmTensorField>(objects);
105  UnMapped<surfaceTensorField>(objects);
106 
107  // Mark pointFields as unmapped
108  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109  UnMapped<pointScalarField>(objects);
110  UnMapped<pointVectorField>(objects);
111  UnMapped<pointSphericalTensorField>(objects);
112  UnMapped<pointSymmTensorField>(objects);
113  UnMapped<pointTensorField>(objects);
114  }
115 
116  if (!noLagrangian)
117  {
118  mapLagrangian(interp);
119  }
120 }
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
const Time & time() const
Return time.
A HashTable with keys but without contents.
Definition: HashSet.H:59
void MapMesh(const meshToMesh &interp, const HashSet< word > &selectedFields, const bool noLagrangian)
Definition: MapMeshes.H:41
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:50
Class to calculate the cell-addressing between two overlapping meshes.
Definition: meshToMesh.H:60
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:715
Maps lagrangian positions and fields.
const polyMesh & srcRegion() const
Return const access to the source mesh.
Definition: meshToMeshI.H:30
void mapLagrangian(const meshToMesh0 &meshToMesh0Interp)
Maps lagrangian positions and fields.
const polyMesh & tgtRegion() const
Return const access to the target mesh.
Definition: meshToMeshI.H:36
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.