FreeFOAM The Cross-Platform CFD Toolkit
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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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 "pointMesh.H"
30 #include <OpenFOAM/pointFields.H>
32 #include <OpenFOAM/MapPointField.H>
33 
34 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35 
36 void Foam::pointMesh::mapFields(const mapPolyMesh& mpm)
37 {
38  // Create a mapper
39  const pointMeshMapper m(*this, mpm);
40 
41  MapGeometricFields<scalar, pointPatchField, pointMeshMapper, pointMesh>(m);
42  MapGeometricFields<vector, pointPatchField, pointMeshMapper, pointMesh>(m);
44  <
46  pointPatchField,
47  pointMeshMapper,
48  pointMesh
49  >(m);
50  MapGeometricFields<symmTensor, pointPatchField, pointMeshMapper, pointMesh>
51  (m);
52  MapGeometricFields<tensor, pointPatchField, pointMeshMapper, pointMesh>(m);
53 }
54 
55 
56 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57 
58 Foam::pointMesh::pointMesh
59 (
60  const polyMesh& pMesh,
61  bool alwaysConstructGlobalPatch
62 )
63 :
65  GeoMesh<polyMesh>(pMesh),
66  boundary_(*this, pMesh.boundaryMesh())
67 {
68  // Add the globalPointPatch if there are global points
69  if
70  (
71  alwaysConstructGlobalPatch
72  || GeoMesh<polyMesh>::mesh_.globalData().nGlobalPoints()
73  )
74  {
75  boundary_.setSize(boundary_.size() + 1);
76 
77  boundary_.set
78  (
79  boundary_.size() - 1,
81  (
82  boundary_,
83  boundary_.size() - 1
84  )
85  );
86  }
87 
88  // Calculate the geometry for the patches (transformation tensors etc.)
89  boundary_.calcGeometry();
90 }
91 
92 
94 {
95  boundary_.movePoints(newPoints);
96 }
97 
98 
100 {
101  boundary_.updateMesh();
102 
103  // Map all registered point fields
104  mapFields(mpm);
105 }
106 
107 
108 // ************************ vim: set sw=4 sts=4 et: ************************ //