|
|
|
primitiveMeshCellPoints.CGo 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 "primitiveMesh.H" 00028 #include "ListOps.H" 00029 00030 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00031 00032 const Foam::labelListList& Foam::primitiveMesh::cellPoints() const 00033 { 00034 if (!cpPtr_) 00035 { 00036 if (debug) 00037 { 00038 Pout<< "primitiveMesh::cellPoints() : " 00039 << "calculating cellPoints" << endl; 00040 00041 if (debug == -1) 00042 { 00043 // For checking calls:abort so we can quickly hunt down 00044 // origin of call 00045 FatalErrorIn("primitiveMesh::cellPoints()") 00046 << abort(FatalError); 00047 } 00048 } 00049 00050 // Invert pointCells 00051 cpPtr_ = new labelListList(nCells()); 00052 invertManyToMany(nCells(), pointCells(), *cpPtr_); 00053 } 00054 00055 return *cpPtr_; 00056 } 00057 00058 00059 const Foam::labelList& Foam::primitiveMesh::cellPoints 00060 ( 00061 const label cellI, 00062 DynamicList<label>& storage 00063 ) const 00064 { 00065 if (hasCellPoints()) 00066 { 00067 return cellPoints()[cellI]; 00068 } 00069 else 00070 { 00071 const faceList& fcs = faces(); 00072 const labelList& cFaces = cells()[cellI]; 00073 00074 labelSet_.clear(); 00075 00076 forAll(cFaces, i) 00077 { 00078 const labelList& f = fcs[cFaces[i]]; 00079 00080 forAll(f, fp) 00081 { 00082 labelSet_.insert(f[fp]); 00083 } 00084 } 00085 00086 storage.clear(); 00087 if (labelSet_.size() > storage.capacity()) 00088 { 00089 storage.setCapacity(labelSet_.size()); 00090 } 00091 00092 forAllConstIter(labelHashSet, labelSet_, iter) 00093 { 00094 storage.append(iter.key()); 00095 } 00096 00097 return storage; 00098 } 00099 } 00100 00101 00102 const Foam::labelList& Foam::primitiveMesh::cellPoints(const label cellI) const 00103 { 00104 return cellPoints(cellI, labels_); 00105 } 00106 00107 00108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00109 00110 // ************************************************************************* // |