pointMesh.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) 2011-2013 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
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 #include "pointMesh.H"
29 #include "globalMeshData.H"
30 #include "pointMeshMapper.H"
31 #include "pointFields.H"
32 #include "MapGeometricFields.H"
33 #include "MapPointField.H"
34 
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40  defineTypeNameAndDebug(pointMesh, 0);
41 }
42 
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
46 void Foam::pointMesh::mapFields(const mapPolyMesh& mpm)
47 {
48  if (debug)
49  {
50  Pout<< "void pointMesh::mapFields(const mapPolyMesh&): "
51  << "Mapping all registered pointFields."
52  << endl;
53  }
54  // Create a mapper
55  const pointMeshMapper m(*this, mpm);
56 
57  MapGeometricFields<scalar, pointPatchField, pointMeshMapper, pointMesh>(m);
58  MapGeometricFields<vector, pointPatchField, pointMeshMapper, pointMesh>(m);
60  <
62  pointPatchField,
63  pointMeshMapper,
64  pointMesh
65  >(m);
66  MapGeometricFields<symmTensor, pointPatchField, pointMeshMapper, pointMesh>
67  (m);
68  MapGeometricFields<tensor, pointPatchField, pointMeshMapper, pointMesh>(m);
69 }
70 
71 
72 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
73 
74 Foam::pointMesh::pointMesh(const polyMesh& pMesh)
75 :
76  MeshObject_type(pMesh),
77  GeoMesh<polyMesh>(pMesh),
78  boundary_(*this, pMesh.boundaryMesh())
79 {
80  if (debug)
81  {
82  Pout<< "pointMesh::pointMesh(const polyMesh&): "
83  << "Constructing from polyMesh " << pMesh.name()
84  << endl;
85  }
86 
87  // Calculate the geometry for the patches (transformation tensors etc.)
88  boundary_.calcGeometry();
89 }
90 
91 
92 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
93 
95 {
96  if (debug)
97  {
98  Pout<< "pointMesh::movePoints(): "
99  << "Moving points." << endl;
100  }
102  boundary_.movePoints(GeoMesh<polyMesh>::mesh_.points());
103 
104  return true;
105 }
106 
107 
109 {
110  if (debug)
111  {
112  Pout<< "pointMesh::updateMesh(const mapPolyMesh&): "
113  << "Updating for topology changes." << nl << endl;
114  }
115  boundary_.updateMesh();
116 
117  // Map all registered point fields
118  mapFields(mpm);
119 }
120 
121 
122 // ************************************************************************* //
bool movePoints()
Move points.
Definition: pointMesh.C:87
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:195
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Definition: boundaryMesh.H:58
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
void updateMesh(const mapPolyMesh &mpm)
Update the mesh corresponding to given map.
Definition: pointMesh.C:101
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
void MapGeometricFields(const MeshMapper &mapper)
Generic Geometric field mapper.
const pointField & points
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:42
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Namespace for OpenFOAM.