From 54ba194801876b4d38dfc1ac229d5d5688556209 Mon Sep 17 00:00:00 2001 From: graham <g.macpherson@opencfd.co.uk> Date: Wed, 11 May 2011 13:00:56 +0100 Subject: [PATCH] ENH: Improved bound box obj output. --- .../algorithms/indexedOctree/indexedOctree.C | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C index 6020d24d196..10cb44fa272 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C @@ -2282,7 +2282,7 @@ void Foam::indexedOctree<Type>::writeOBJ { subBb = nodes_[getNode(index)].bb_; } - else if (isContent(index)) + else if (isContent(index) || isEmpty(index)) { subBb = nodes_[nodeI].bb_.subBbox(octant); } @@ -2290,17 +2290,21 @@ void Foam::indexedOctree<Type>::writeOBJ Pout<< "dumpContentNode : writing node:" << nodeI << " octant:" << octant << " to " << str.name() << endl; - label vertI = 0; - // Dump bounding box pointField bbPoints(subBb.points()); - label pointVertI = vertI; + forAll(bbPoints, i) + { + const point& pt = bbPoints[i]; + + str<< "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl; + } + forAll(treeBoundBox::edges, i) { const edge& e = treeBoundBox::edges[i]; - str<< "l " << e[0]+pointVertI+1 << ' ' << e[1]+pointVertI+1 << nl; + str<< "l " << e[0] + 1 << ' ' << e[1] + 1 << nl; } } @@ -2852,6 +2856,11 @@ void Foam::indexedOctree<Type>::print { const labelList& indices = contents_[getContent(index)]; + if (debug) + { + writeOBJ(nodeI, octant); + } + os << "octant:" << octant << " content: n:" << indices.size() << " bb:" << subBb; @@ -2868,6 +2877,11 @@ void Foam::indexedOctree<Type>::print } else { + if (debug) + { + writeOBJ(nodeI, octant); + } + os << "octant:" << octant << " empty:" << subBb << endl; } } -- GitLab