initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / octree / treeNodeI.H
blob6df9ac1136d086d4d0080ca14c84e09194272810
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Description
27 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
31 // Get type of octant
32 template <class Type>
33 inline Foam::label Foam::treeNode<Type>::getVolType(const label octant) const
35     return (volType_ >> 2*octant) & 0x3;
39 template <class Type>
40 inline const Foam::point& Foam::treeNode<Type>::midpoint() const
42     return mid_;
46 template <class Type>
47 inline Foam::treeElem<Type>* const* Foam::treeNode<Type>::subNodes() const
49     return subNodes_;
53 // octant contains pointer to treeNode(1) or treeLeaf(0)
54 template <class Type>
55 inline Foam::label Foam::treeNode<Type>::isNode(const label octant) const
57     return subNodeTypes_ & (0x1 << octant);
61 // Get pointer to sub node
62 template <class Type>
63 inline Foam::treeNode<Type>* Foam::treeNode<Type>::getNodePtr
65     const label octant
66 ) const
68 #   ifdef FULLDEBUG
69     if (!isNode(octant))
70     {
71         FatalErrorIn("treeNode::getNodePtr(const label)")
72             << "not a treeNode"
73             << abort(FatalError);
74     }
75 #   endif
77     return static_cast<treeNode<Type>*>(subNodes_[octant]);
81 // Get pointer to sub leaf
82 template <class Type>
83 inline Foam::treeLeaf<Type>* Foam::treeNode<Type>::getLeafPtr
85     const label octant
86 ) const
88 #   ifdef FULLDEBUG
89     if (isNode(octant))
90     {
91         FatalErrorIn("treeNode::getLeafPtr(const label)")
92             << "not a treeLeaf"
93             << abort(FatalError);
94     }
95 #   endif
97     return static_cast<treeLeaf<Type>*>(subNodes_[octant]);
101 // ************************************************************************* //