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