OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

pointMesh.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "pointMesh.H"
00028 #include "globalMeshData.H"
00029 #include "globalPointPatch.H"
00030 #include "pointMeshMapper.H"
00031 #include "pointFields.H"
00032 #include "MapGeometricFields.H"
00033 #include "MapPointField.H"
00034 
00035 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00036 
00037 void Foam::pointMesh::mapFields(const mapPolyMesh& mpm)
00038 {
00039     // Create a mapper
00040     const pointMeshMapper m(*this, mpm);
00041 
00042     MapGeometricFields<scalar, pointPatchField, pointMeshMapper, pointMesh>(m);
00043     MapGeometricFields<vector, pointPatchField, pointMeshMapper, pointMesh>(m);
00044     MapGeometricFields
00045     <
00046         sphericalTensor,
00047         pointPatchField,
00048         pointMeshMapper,
00049         pointMesh
00050     >(m);
00051     MapGeometricFields<symmTensor, pointPatchField, pointMeshMapper, pointMesh>
00052     (m);
00053     MapGeometricFields<tensor, pointPatchField, pointMeshMapper, pointMesh>(m);
00054 }
00055 
00056 
00057 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00058 
00059 Foam::pointMesh::pointMesh
00060 (
00061     const polyMesh& pMesh,
00062     bool alwaysConstructGlobalPatch
00063 )
00064 :
00065     MeshObject<polyMesh, pointMesh>(pMesh),
00066     GeoMesh<polyMesh>(pMesh),
00067     boundary_(*this, pMesh.boundaryMesh())
00068 {
00069     // Add the globalPointPatch if there are global points
00070     if
00071     (
00072         alwaysConstructGlobalPatch
00073      || GeoMesh<polyMesh>::mesh_.globalData().nGlobalPoints()
00074     )
00075     {
00076         boundary_.setSize(boundary_.size() + 1);
00077 
00078         boundary_.set
00079         (
00080             boundary_.size() - 1,
00081             new globalPointPatch
00082             (
00083                 boundary_,
00084                 boundary_.size() - 1
00085             )
00086         );
00087     }
00088 
00089     // Calculate the geometry for the patches (transformation tensors etc.)
00090     boundary_.calcGeometry();
00091 }
00092 
00093 
00094 void Foam::pointMesh::movePoints(const pointField& newPoints)
00095 {
00096     boundary_.movePoints(newPoints);
00097 }
00098 
00099 
00100 void Foam::pointMesh::updateMesh(const mapPolyMesh& mpm)
00101 {
00102     boundary_.updateMesh();
00103 
00104     // Map all registered point fields
00105     mapFields(mpm);
00106 }
00107 
00108 
00109 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd