Forward compatibility: flex
[foam-extend-3.2.git] / src / foam / meshes / pointMesh / pointMesh.C
blob5077c61613f82c803b454e2f3c6c62c1b9637823
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "pointMesh.H"
27 #include "globalMeshData.H"
28 #include "globalPointPatch.H"
29 #include "pointMeshMapper.H"
30 #include "pointFields.H"
31 #include "MapGeometricFields.H"
32 #include "MapPointField.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(Foam::pointMesh, 0);
39 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
41 void Foam::pointMesh::mapFields(const mapPolyMesh& mpm) const
43     // Create a mapper
44     const pointMeshMapper m(*this, mpm);
46     MapGeometricFields<scalar, pointPatchField, pointMeshMapper, pointMesh>(m);
47     MapGeometricFields<vector, pointPatchField, pointMeshMapper, pointMesh>(m);
48     MapGeometricFields
49     <
50         sphericalTensor,
51         pointPatchField,
52         pointMeshMapper,
53         pointMesh
54     >(m);
56     MapGeometricFields<symmTensor, pointPatchField, pointMeshMapper, pointMesh>
57     (m);
59     MapGeometricFields
60     <
61         symmTensor4thOrder,
62         pointPatchField,
63         pointMeshMapper,
64         pointMesh
65     >(m);
67     MapGeometricFields<diagTensor, pointPatchField, pointMeshMapper, pointMesh>
68     (m);
70     MapGeometricFields<tensor, pointPatchField, pointMeshMapper, pointMesh>(m);
74 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
76 Foam::pointMesh::pointMesh
78     const polyMesh& pMesh,
79     bool alwaysConstructGlobalPatch
82     MeshObject<polyMesh, pointMesh>(pMesh),
83     GeoMesh<polyMesh>(pMesh),
84     boundary_(*this, pMesh.boundaryMesh())
86     // Add the globalPointPatch if there are global points
87     if
88     (
89         alwaysConstructGlobalPatch
90      || GeoMesh<polyMesh>::mesh_.globalData().nGlobalPoints()
91     )
92     {
93         boundary_.setSize(boundary_.size() + 1);
95         boundary_.set
96         (
97             boundary_.size() - 1,
98             new globalPointPatch
99             (
100                 boundary_,
101                 boundary_.size() - 1
102             )
103         );
104     }
106     // Calculate the geometry for the patches (transformation tensors etc.)
107     boundary_.calcGeometry();
111 bool Foam::pointMesh::movePoints() const
113     // Casting const-ness to answer the interface of meshObject
114     // HJ, 30/Aug/2010
115     const_cast<pointBoundaryMesh&>(boundary_).movePoints();
117     return true;
121 bool Foam::pointMesh::updateMesh(const mapPolyMesh& mpm) const
123     // Casting const-ness to answer the interface of meshObject
124     // HJ, 30/Aug/2010
125     const_cast<pointBoundaryMesh&>(boundary_).updateMesh();
127     // Map all registered point fields
128     mapFields(mpm);
130     return true;
134 // ************************************************************************* //