mapMeshes.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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 #include "mapMeshes.H"
27 #include "surfaceMesh.H"
28 #include "processorFvPatch.H"
29 #include "pointMesh.H"
30 #include "mapLagrangian.H"
31 #include "MapVolFields.H"
32 #include "UnMapped.H"
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 void Foam::mapMesh
37 (
38  const meshToMesh& interp,
39  const HashSet<word>& selectedFields,
40  const bool noLagrangian
41 )
42 {
43  {
44  const polyMesh& meshSource = interp.srcRegion();
45 
46  // Search for list of objects for this time
47  IOobjectList objects(meshSource, meshSource.time().timeName());
48 
49  // Map volFields
50  // ~~~~~~~~~~~~~
51  MapVolFields<scalar>
52  (
53  objects,
54  selectedFields,
55  interp
56  );
57 
58  MapVolFields<vector>
59  (
60  objects,
61  selectedFields,
62  interp
63  );
64  MapVolFields<sphericalTensor>
65  (
66  objects,
67  selectedFields,
68  interp
69  );
70  MapVolFields<symmTensor>
71  (
72  objects,
73  selectedFields,
74  interp
75  );
76  MapVolFields<tensor>
77  (
78  objects,
79  selectedFields,
80  interp
81  );
82  }
83 
84  {
85  const polyMesh& meshTarget = interp.tgtRegion();
86 
87  // Search for list of target objects for this time
88  IOobjectList objects(meshTarget, meshTarget.time().timeName());
89 
90  // Mark surfaceFields as unmapped
91  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92  UnMapped<surfaceScalarField>(objects);
93  UnMapped<surfaceVectorField>(objects);
94  UnMapped<surfaceSphericalTensorField>(objects);
95  UnMapped<surfaceSymmTensorField>(objects);
96  UnMapped<surfaceTensorField>(objects);
97 
98  // Mark pointFields as unmapped
99  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100  UnMapped<pointScalarField>(objects);
101  UnMapped<pointVectorField>(objects);
102  UnMapped<pointSphericalTensorField>(objects);
103  UnMapped<pointSymmTensorField>(objects);
104  UnMapped<pointTensorField>(objects);
105  }
106 
107  if (!noLagrangian)
108  {
109  mapLagrangian(interp);
110  }
111 }
112 
113 
115 (
116  const fvMesh& meshSource,
117  const fvMesh& meshTarget,
118  const word& mapMethod,
119  const HashSet<word>& selectedFields,
120  const bool noLagrangian
121 )
122 {
123  Info<< nl << "Consistently creating and mapping fields for time "
124  << meshSource.time().timeName() << nl << endl;
125 
126  meshToMesh interp(meshSource, meshTarget, mapMethod);
127 
128  mapMesh
129  (
130  interp,
131  selectedFields,
132  noLagrangian
133  );
134 }
135 
136 
137 void Foam::mapSubMesh
138 (
139  const fvMesh& meshSource,
140  const fvMesh& meshTarget,
141  const HashTable<word>& patchMap,
142  const wordList& cuttingPatches,
143  const word& mapMethod,
144  const HashSet<word>& selectedFields,
145  const bool noLagrangian
146 )
147 {
148  Info<< nl << "Creating and mapping fields for time "
149  << meshSource.time().timeName() << nl << endl;
150 
151  meshToMesh interp
152  (
153  meshSource,
154  meshTarget,
155  mapMethod,
156  patchMap,
157  cuttingPatches
158  );
159 
160  mapMesh
161  (
162  interp,
163  selectedFields,
164  noLagrangian
165  );
166 }
167 
168 
169 // ************************************************************************* //
void mapSubMesh(const fvMesh &meshSource, const fvMesh &meshTarget, const HashTable< word > &patchMap, const wordList &cuttingPatches, const meshToMesh0::order &mapOrder)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
void mapMesh(const meshToMesh &interp, const HashSet< word > &selectedFields, const bool noLagrangian)
static const char nl
Definition: Ostream.H:260
objects
void mapConsistentMesh(const fvMesh &meshSource, const fvMesh &meshTarget, const meshToMesh0::order &mapOrder)
List< word > wordList
A List of words.
Definition: fileName.H:54
void mapLagrangian(const meshToMesh0 &meshToMesh0Interp)
Maps lagrangian positions and fields.
messageStream Info