|
|
|
treeNodeI.HGo 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 Description 00026 00027 \*---------------------------------------------------------------------------*/ 00028 00029 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00030 00031 // Get type of octant 00032 template <class Type> 00033 inline Foam::label Foam::treeNode<Type>::getVolType(const label octant) const 00034 { 00035 return (volType_ >> 2*octant) & 0x3; 00036 } 00037 00038 00039 template <class Type> 00040 inline const Foam::point& Foam::treeNode<Type>::midpoint() const 00041 { 00042 return mid_; 00043 } 00044 00045 00046 template <class Type> 00047 inline Foam::treeElem<Type>* const* Foam::treeNode<Type>::subNodes() const 00048 { 00049 return subNodes_; 00050 } 00051 00052 00053 // octant contains pointer to treeNode(1) or treeLeaf(0) 00054 template <class Type> 00055 inline Foam::label Foam::treeNode<Type>::isNode(const label octant) const 00056 { 00057 return subNodeTypes_ & (0x1 << octant); 00058 } 00059 00060 00061 // Get pointer to sub node 00062 template <class Type> 00063 inline Foam::treeNode<Type>* Foam::treeNode<Type>::getNodePtr 00064 ( 00065 const label octant 00066 ) const 00067 { 00068 # ifdef FULLDEBUG 00069 if (!isNode(octant)) 00070 { 00071 FatalErrorIn("treeNode::getNodePtr(const label)") 00072 << "not a treeNode" 00073 << abort(FatalError); 00074 } 00075 # endif 00076 00077 return static_cast<treeNode<Type>*>(subNodes_[octant]); 00078 } 00079 00080 00081 // Get pointer to sub leaf 00082 template <class Type> 00083 inline Foam::treeLeaf<Type>* Foam::treeNode<Type>::getLeafPtr 00084 ( 00085 const label octant 00086 ) const 00087 { 00088 # ifdef FULLDEBUG 00089 if (isNode(octant)) 00090 { 00091 FatalErrorIn("treeNode::getLeafPtr(const label)") 00092 << "not a treeLeaf" 00093 << abort(FatalError); 00094 } 00095 # endif 00096 00097 return static_cast<treeLeaf<Type>*>(subNodes_[octant]); 00098 } 00099 00100 00101 // ************************************************************************* // |