FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

pointSet.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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "pointSet.H"
00027 #include <OpenFOAM/mapPolyMesh.H>
00028 #include <OpenFOAM/polyMesh.H>
00029 #include <OpenFOAM/syncTools.H>
00030 
00031 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037 
00038 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00039 
00040 defineTypeNameAndDebug(pointSet, 0);
00041 
00042 addToRunTimeSelectionTable(topoSet, pointSet, word);
00043 addToRunTimeSelectionTable(topoSet, pointSet, size);
00044 addToRunTimeSelectionTable(topoSet, pointSet, set);
00045 
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 pointSet::pointSet(const IOobject& obj)
00050 :
00051     topoSet(obj, typeName)
00052 {}
00053 
00054 
00055 pointSet::pointSet
00056 (
00057     const polyMesh& mesh,
00058     const word& name,
00059     readOption r,
00060     writeOption w
00061 )
00062 :
00063     topoSet(mesh, typeName, name, r, w)
00064 {
00065     check(mesh.nPoints());
00066 }
00067 
00068 
00069 pointSet::pointSet
00070 (
00071     const polyMesh& mesh,
00072     const word& name,
00073     const label size,
00074     writeOption w
00075 )
00076 :
00077     topoSet(mesh, name, size, w)
00078 {}
00079 
00080 
00081 pointSet::pointSet
00082 (
00083     const polyMesh& mesh,
00084     const word& name,
00085     const topoSet& set,
00086     writeOption w
00087 )
00088 :
00089     topoSet(mesh, name, set, w)
00090 {}
00091 
00092 
00093 pointSet::pointSet
00094 (
00095     const polyMesh& mesh,
00096     const word& name,
00097     const labelHashSet& set,
00098     writeOption w
00099 )
00100 :
00101     topoSet(mesh, name, set, w)
00102 {}
00103 
00104 
00105 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00106 
00107 pointSet::~pointSet()
00108 {}
00109 
00110 
00111 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00112 
00113 void pointSet::sync(const polyMesh& mesh)
00114 {
00115     // Convert to boolList
00116 
00117     boolList contents(mesh.nPoints(), false);
00118 
00119     forAllConstIter(pointSet, *this, iter)
00120     {
00121         contents[iter.key()] = true;
00122     }
00123     syncTools::syncPointList
00124     (
00125         mesh,
00126         contents,
00127         orEqOp<bool>(),
00128         false,          // null value
00129         false           // no separation
00130     );
00131 
00132     // Convert back to labelHashSet
00133 
00134     labelHashSet newContents(size());
00135 
00136     forAll(contents, pointI)
00137     {
00138         if (contents[pointI])
00139         {
00140             newContents.insert(pointI);
00141         }
00142     }
00143 
00144     transfer(newContents);
00145 }
00146 
00147 
00148 label pointSet::maxSize(const polyMesh& mesh) const
00149 {
00150     return mesh.nPoints();
00151 }
00152 
00153 
00154 void pointSet::updateMesh(const mapPolyMesh& morphMap)
00155 {
00156     updateLabels(morphMap.reversePointMap());
00157 }
00158 
00159 
00160 void pointSet::writeDebug
00161 (
00162     Ostream& os,
00163     const primitiveMesh& mesh,
00164     const label maxLen
00165 ) const
00166 {
00167     topoSet::writeDebug(os, mesh.points(), maxLen);
00168 }
00169 
00170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00171 
00172 } // End namespace Foam
00173 
00174 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines