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 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
44 
45 void Foam::pointMesh::mapFields(const mapPolyMesh& mpm)
46 {
47  if (debug)
48  {
49  Pout<< "void pointMesh::mapFields(const mapPolyMesh&): "
50  << "Mapping all registered pointFields."
51  << endl;
52  }
53  // Create a mapper
54  const pointMeshMapper m(*this, mpm);
55 
56  MapGeometricFields<scalar, pointPatchField, pointMeshMapper, pointMesh>(m);
57  MapGeometricFields<vector, pointPatchField, pointMeshMapper, pointMesh>(m);
59  <
61  pointPatchField,
62  pointMeshMapper,
63  pointMesh
64  >(m);
65  MapGeometricFields<symmTensor, pointPatchField, pointMeshMapper, pointMesh>
66  (m);
67  MapGeometricFields<tensor, pointPatchField, pointMeshMapper, pointMesh>(m);
68 }
69 
70 
71 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72 
73 Foam::pointMesh::pointMesh(const polyMesh& pMesh)
74 :
76  GeoMesh<polyMesh>(pMesh),
77  boundary_(*this, pMesh.boundaryMesh())
78 {
79  if (debug)
80  {
81  Pout<< "pointMesh::pointMesh(const polyMesh&): "
82  << "Constructing from polyMesh " << pMesh.name()
83  << endl;
84  }
85 
86  // Calculate the geometry for the patches (transformation tensors etc.)
87  boundary_.calcGeometry();
88 }
89 
90 
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 
94 {
95  if (debug)
96  {
97  Pout<< "pointMesh::movePoints(const pointField&): "
98  << "Moving points." << endl;
99  }
100 
101  boundary_.movePoints(GeoMesh<polyMesh>::mesh_.points());
102 
103  return true;
104 }
105 
106 
108 {
109  if (debug)
110  {
111  Pout<< "pointMesh::updateMesh(const mapPolyMesh&): "
112  << "Updating for topology changes." << nl << endl;
113  }
114  boundary_.updateMesh();
115 
116  // Map all registered point fields
117  mapFields(mpm);
118 }
119 
120 
121 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::sphericalTensor
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
Definition: sphericalTensor.H:54
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobjectI.H:70
globalMeshData.H
Foam::MapGeometricFields
void MapGeometricFields(const MeshMapper &mapper)
Generic Geometric field mapper.
Definition: MapGeometricFields.H:73
MapGeometricFields.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::UpdateableMeshObject
Definition: MeshObject.H:241
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::GeoMesh
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:48
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:50
Foam::nl
constexpr char nl
Definition: Ostream.H:385
MapPointField.H
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:62
Foam::MeshObject
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:88
Foam::pointMesh::movePoints
bool movePoints()
Move points.
Definition: pointMesh.C:93
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
pointFields.H
pointMesh.H
pointMeshMapper.H
Foam::pointMesh::updateMesh
void updateMesh(const mapPolyMesh &mpm)
Update the mesh corresponding to given map.
Definition: pointMesh.C:107