OpenFOAM logo
Open Source CFD Toolkit

cellModelI.H

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-2005 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 Description
00026 
00027 \*---------------------------------------------------------------------------*/
00028 
00029 #include "error.H"
00030 #include "cellModel.H"
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 
00037 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00038 
00039 inline const word& cellModel::name() const
00040 {
00041     return name_;
00042 }
00043 
00044 
00045 inline label cellModel::index() const
00046 {
00047     return index_;
00048 }
00049 
00050 
00051 inline label cellModel::nPoints() const
00052 {
00053     return nPoints_;
00054 }
00055 
00056 
00057 inline label cellModel::nEdges() const
00058 {
00059     return edges_.size();
00060 }
00061 
00062 
00063 inline label cellModel::nFaces() const
00064 {
00065     return faces_.size();
00066 }
00067 
00068 
00069 //  Return the faces of a cellModel by untangling the geometry
00070 //  supplied in terms of the face labels
00071 inline edgeList cellModel::edges(const labelList& pointLabels) const
00072 {
00073     edgeList e(edges_.size());
00074 
00075     // Translate model lebels into global labels
00076     forAll(edges_, edgeI)
00077     {
00078          e[edgeI] =
00079              edge
00080              (
00081                  pointLabels[edges_[edgeI].start()],
00082                  pointLabels[edges_[edgeI].end()]
00083              );
00084     }
00085 
00086     return e;
00087 }
00088 
00089 
00090 // Return a raw list of model faces
00091 inline const faceList& cellModel::modelFaces() const
00092 {
00093     return faces_;
00094 }
00095 
00096 //  Return the faces of a cellModel by untangling the geometry
00097 //  supplied in terms of the face labels
00098 inline faceList cellModel::faces(const labelList& pointLabels) const
00099 {
00100     faceList f(faces_.size());
00101 
00102     // Translate model lebels into global labels
00103     forAll(faces_, faceI)
00104     {
00105          const labelList& curModelLabels = faces_[faceI];
00106 
00107          face& curFace = f[faceI];
00108 
00109          curFace.setSize(curModelLabels.size());
00110 
00111          forAll (curModelLabels, labelI)
00112          {
00113              curFace[labelI] = pointLabels[curModelLabels[labelI]];
00114          }
00115     }
00116 
00117     return f;
00118 }
00119 
00120 
00121 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00122 
00123 // Equality operator: true => ptr to models are equal !
00124 inline bool operator==(const cellModel& m1, const cellModel& m2)
00125 {
00126     return (&m1 == &m2);
00127 }
00128 
00129 // Inequality operator: true => ptr to models are not equal !
00130 inline bool operator!=(const cellModel& m1, const cellModel& m2)
00131 {
00132     return (&m1 != &m2);
00133 }
00134 
00135 
00136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00137 
00138 } // End namespace Foam
00139 
00140 // ************************************************************************* //
For further information go to www.openfoam.org