diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C index c38bdfa81..043ea1558 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C @@ -33,11 +33,8 @@ License template Foam::scalar Foam::dynamicIndexedOctree::perturbTol_ = 10*SMALL; - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Does bb intersect a sphere around sample? Or is any corner point of bb -// closer than nearestDistSqr to sample. template bool Foam::dynamicIndexedOctree::overlaps ( @@ -80,8 +77,6 @@ bool Foam::dynamicIndexedOctree::overlaps } -// Does bb intersect a sphere around sample? Or is any corner point of bb -// closer than nearestDistSqr to sample. template bool Foam::dynamicIndexedOctree::overlaps ( @@ -139,12 +134,6 @@ bool Foam::dynamicIndexedOctree::overlaps } -// -// Construction helper routines -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// - -// Split list of indices into 8 bins template void Foam::dynamicIndexedOctree::divide ( @@ -186,7 +175,6 @@ void Foam::dynamicIndexedOctree::divide } -// Subdivide the (content) node. template typename Foam::dynamicIndexedOctree::node Foam::dynamicIndexedOctree::divide @@ -330,15 +318,16 @@ void Foam::dynamicIndexedOctree::recursiveSubDivision } -// Pre-calculates wherever possible the volume status per node/subnode. -// Recurses to determine status of lowest level boxes. Level above is -// combination of octants below. template Foam::volumeType Foam::dynamicIndexedOctree::calcVolumeType ( const label nodeI ) const { + // Pre-calculates wherever possible the volume status per node/subnode. + // Recurses to determine status of lowest level boxes. Level above is + // combination of octants below. + const node& nod = nodes_[nodeI]; volumeType myType = volumeType::UNKNOWN; @@ -477,12 +466,6 @@ Foam::volumeType Foam::dynamicIndexedOctree::getSide } -// -// Query routines -// ~~~~~~~~~~~~~~ -// - -// Find nearest point starting from nodeI template void Foam::dynamicIndexedOctree::findNearest ( @@ -554,7 +537,6 @@ void Foam::dynamicIndexedOctree::findNearest } -// Find nearest point to line. template void Foam::dynamicIndexedOctree::findNearest ( @@ -645,8 +627,6 @@ Foam::treeBoundBox Foam::dynamicIndexedOctree::subBbox } -// Takes a bb and a point on/close to the edge of the bb and pushes the point -// inside by a small fraction. template Foam::point Foam::dynamicIndexedOctree::pushPoint ( @@ -655,6 +635,9 @@ Foam::point Foam::dynamicIndexedOctree::pushPoint const bool pushInside ) { + // Takes a bb and a point on/close to the edge of the bb and pushes the + // point inside by a small fraction. + // Get local length scale. const vector perturbVec = perturbTol_*bb.span(); @@ -716,8 +699,6 @@ Foam::point Foam::dynamicIndexedOctree::pushPoint } -// Takes a bb and a point on the edge of the bb and pushes the point -// outside by a small fraction. template Foam::point Foam::dynamicIndexedOctree::pushPoint ( @@ -727,6 +708,9 @@ Foam::point Foam::dynamicIndexedOctree::pushPoint const bool pushInside ) { + // Takes a bb and a point on the edge of the bb and pushes the point + // outside by a small fraction. + // Get local length scale. const vector perturbVec = perturbTol_*bb.span(); @@ -828,9 +812,6 @@ Foam::point Foam::dynamicIndexedOctree::pushPoint } -// Guarantees that if pt is on a face it gets perturbed so it is away -// from the face edges. -// If pt is not on a face does nothing. template Foam::point Foam::dynamicIndexedOctree::pushPointIntoFace ( @@ -988,205 +969,6 @@ Foam::point Foam::dynamicIndexedOctree::pushPointIntoFace } -//// Takes a bb and a point on the outside of the bb. Checks if on multiple -// faces -//// and if so perturbs point so it is only on one face. -//template -//void Foam::dynamicIndexedOctree::checkMultipleFaces -//( -// const treeBoundBox& bb, -// const vector& dir, // end-start -// pointIndexHit& faceHitInfo, -// direction& faceID -//) -//{ -// // Do the quick elimination of no or one face. -// if -// ( -// (faceID == 0) -// || (faceID == treeBoundBox::LEFTBIT) -// || (faceID == treeBoundBox::RIGHTBIT) -// || (faceID == treeBoundBox::BOTTOMBIT) -// || (faceID == treeBoundBox::TOPBIT) -// || (faceID == treeBoundBox::BACKBIT) -// || (faceID == treeBoundBox::FRONTBIT) -// ) -// { -// return; -// } -// -// -// // Check the direction of vector w.r.t. faces being intersected. -// FixedList inproducts(-GREAT); -// -// direction nFaces = 0; -// -// if (faceID & treeBoundBox::LEFTBIT) -// { -// inproducts[treeBoundBox::LEFT] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::LEFT] -// & dir -// ); -// nFaces++; -// } -// if (faceID & treeBoundBox::RIGHTBIT) -// { -// inproducts[treeBoundBox::RIGHT] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::RIGHT] -// & dir -// ); -// nFaces++; -// } -// -// if (faceID & treeBoundBox::BOTTOMBIT) -// { -// inproducts[treeBoundBox::BOTTOM] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::BOTTOM] -// & dir -// ); -// nFaces++; -// } -// if (faceID & treeBoundBox::TOPBIT) -// { -// inproducts[treeBoundBox::TOP] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::TOP] -// & dir -// ); -// nFaces++; -// } -// -// if (faceID & treeBoundBox::BACKBIT) -// { -// inproducts[treeBoundBox::BACK] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::BACK] -// & dir -// ); -// nFaces++; -// } -// if (faceID & treeBoundBox::FRONTBIT) -// { -// inproducts[treeBoundBox::FRONT] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::FRONT] -// & dir -// ); -// nFaces++; -// } -// -// if (nFaces == 0 || nFaces == 1 || nFaces > 3) -// { -// FatalErrorInFunction -// << "Problem : nFaces:" << nFaces << abort(FatalError); -// } -// -// // Keep point on most perpendicular face; shift it away from the aligned -// // ones. -// // E.g. line hits top and left face: -// // a -// // ----+----+ -// // | | -// // | | -// // +----+ -// // Shift point down (away from top): -// // -// // a+----+ -// // ----| | -// // | | -// // +----+ -// -// label maxIndex = -1; -// scalar maxInproduct = -GREAT; -// -// for (direction i = 0; i < 6; i++) -// { -// if (inproducts[i] > maxInproduct) -// { -// maxInproduct = inproducts[i]; -// maxIndex = i; -// } -// } -// -// if (maxIndex == -1) -// { -// FatalErrorInFunction -// << "Problem maxIndex:" << maxIndex << " inproducts:" << inproducts -// << abort(FatalError); -// } -// -// const point oldPoint(faceHitInfo.rawPoint()); -// const direction oldFaceID = faceID; -// -// // 1. Push point into bb, away from all corners -// -// faceHitInfo.rawPoint() = pushPoint(bb, oldFaceID, oldPoint, true); -// -// // 2. Snap it back onto the preferred face -// -// if (maxIndex == treeBoundBox::LEFT) -// { -// faceHitInfo.rawPoint().x() = bb.min().x(); -// faceID = treeBoundBox::LEFTBIT; -// } -// else if (maxIndex == treeBoundBox::RIGHT) -// { -// faceHitInfo.rawPoint().x() = bb.max().x(); -// faceID = treeBoundBox::RIGHTBIT; -// } -// else if (maxIndex == treeBoundBox::BOTTOM) -// { -// faceHitInfo.rawPoint().y() = bb.min().y(); -// faceID = treeBoundBox::BOTTOMBIT; -// } -// else if (maxIndex == treeBoundBox::TOP) -// { -// faceHitInfo.rawPoint().y() = bb.max().y(); -// faceID = treeBoundBox::TOPBIT; -// } -// else if (maxIndex == treeBoundBox::BACK) -// { -// faceHitInfo.rawPoint().z() = bb.min().z(); -// faceID = treeBoundBox::BACKBIT; -// } -// else if (maxIndex == treeBoundBox::FRONT) -// { -// faceHitInfo.rawPoint().z() = bb.max().z(); -// faceID = treeBoundBox::FRONTBIT; -// } -// -// Pout<< "From ray:" << dir -// << " from point:" << oldPoint -// << " on faces:" << faceString(oldFaceID) -// << " of bb:" << bb -// << " with inprods:" << inproducts -// << " maxIndex:" << maxIndex << endl -// << "perturbed to point:" << faceHitInfo.rawPoint() -// << " on face:" << faceString(faceID) -// << endl; -// -// -// if (debug) -// { -// if (faceID != bb.faceBits(faceHitInfo.rawPoint())) -// { -// FatalErrorInFunction -// << "Pushed point from " << oldPoint -// << " on face:" << oldFaceID << " of bb:" << bb << endl -// << "onto " << faceHitInfo.rawPoint() -// << " on face:" << faceID -// << " which is not consistent with geometric face " -// << bb.faceBits(faceHitInfo.rawPoint()) -// << abort(FatalError); -// } -// } -//} - - -// Get parent node and octant. Return false if top of tree reached. template bool Foam::dynamicIndexedOctree::walkToParent ( @@ -1233,10 +1015,7 @@ bool Foam::dynamicIndexedOctree::walkToParent } -// Walk tree to neighbouring node. Gets current position as -// node and octant in this node and walks in the direction given by -// the facePointBits (combination of treeBoundBox::LEFTBIT, TOPBIT etc.) -// Returns false if edge of tree hit. + template bool Foam::dynamicIndexedOctree::walkToNeighbour ( @@ -1246,6 +1025,11 @@ bool Foam::dynamicIndexedOctree::walkToNeighbour direction& octant ) const { + // Walk tree to neighbouring node. Gets current position as node and octant + // in this node and walks in the direction given by the facePointBits + // (combination of treeBoundBox::LEFTBIT, TOPBIT etc.) Returns false if + // edge of tree hit. + label oldNodeI = nodeI; direction oldOctant = octant; @@ -1521,12 +1305,6 @@ Foam::word Foam::dynamicIndexedOctree::faceString } -// Traverse a node. If intersects a triangle return first intersection point: -// hitInfo.index = index of shape -// hitInfo.point = point on shape -// Else return a miss and the bounding box face hit: -// hitInfo.point = coordinate of intersection of ray with bounding box -// hitBits = posbits of point on bounding box template void Foam::dynamicIndexedOctree::traverseNode ( @@ -1689,7 +1467,6 @@ void Foam::dynamicIndexedOctree::traverseNode } -// Find first intersection template Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine ( @@ -1877,7 +1654,6 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine } -// Find first intersection template Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine ( @@ -2218,7 +1994,6 @@ void Foam::dynamicIndexedOctree::findNear } -// Number of elements in node. template Foam::label Foam::dynamicIndexedOctree::countElements ( @@ -2406,7 +2181,6 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree::findNearest } -// Find nearest intersection template Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine ( @@ -2418,7 +2192,6 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree::findLine } -// Find nearest intersection template Foam::pointIndexHit Foam::dynamicIndexedOctree::findLineAny ( @@ -2467,7 +2240,6 @@ Foam::labelList Foam::dynamicIndexedOctree::findSphere } -// Find node (as parent+octant) containing point template Foam::labelBits Foam::dynamicIndexedOctree::findNode ( @@ -2571,7 +2343,6 @@ const Foam::labelList& Foam::dynamicIndexedOctree::findIndices } -// Determine type (inside/outside/mixed) per node. template Foam::volumeType Foam::dynamicIndexedOctree::getVolumeType ( @@ -2885,7 +2656,6 @@ Foam::label Foam::dynamicIndexedOctree::removeIndex } -// Print contents of nodeI template void Foam::dynamicIndexedOctree::print ( @@ -2985,7 +2755,6 @@ void Foam::dynamicIndexedOctree::writeTreeInfo() const } -// Print contents of nodeI template bool Foam::dynamicIndexedOctree::write(Ostream& os) const { diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H index c54493d5e..8017a943f 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H @@ -206,17 +206,6 @@ private: label& nLevels ); -// static label compactContents -// ( -// DynamicList& nodes, -// DynamicList& contents, -// const label compactLevel, -// const label nodeI, -// const label level, -// List& compactedContents, -// label& compactI -// ); - //- Determine inside/outside per node (mixed if cannot be // determined). Only valid for closed shapes. volumeType calcVolumeType(const label nodeI) const; @@ -266,7 +255,7 @@ private: ); //- Helper: take point on face(s) of bb and push it away from - // edges of face. + // edges of face. If pt is not on a face does nothing. static point pushPointIntoFace ( const treeBoundBox& bb, @@ -274,16 +263,8 @@ private: const point& pt ); - ////- Push point on multiple faces away from any corner/edge. - //static void checkMultipleFaces - //( - // const treeBoundBox& bb, - // const vector& dir, // end-start - // pointIndexHit& faceHitInfo, - // direction& faceID - //); - //- Walk to parent of node+octant. + // Return false if top of tree reached. bool walkToParent ( const label nodeI, diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C index 4eca98a81..94f1b6f02 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C @@ -65,7 +65,6 @@ Foam::volumeType Foam::dynamicTreeDataPoint::getVolumeType } -// Check if any point on shape is inside cubeBb. bool Foam::dynamicTreeDataPoint::overlaps ( const label index, @@ -76,7 +75,6 @@ bool Foam::dynamicTreeDataPoint::overlaps } -// Check if any point on shape is inside sphere. bool Foam::dynamicTreeDataPoint::overlaps ( const label index, @@ -97,8 +95,6 @@ bool Foam::dynamicTreeDataPoint::overlaps } -// Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex, -// nearestPoint. void Foam::dynamicTreeDataPoint::findNearest ( const labelUList& indices, diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C index 3e2968117..4d79eef69 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C @@ -37,8 +37,6 @@ Foam::scalar Foam::indexedOctree::perturbTol_ = 10*SMALL; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Does bb intersect a sphere around sample? Or is any corner point of bb -// closer than nearestDistSqr to sample. template bool Foam::indexedOctree::overlaps ( @@ -54,8 +52,6 @@ bool Foam::indexedOctree::overlaps } -// Does bb intersect a sphere around sample? Or is any corner point of bb -// closer than nearestDistSqr to sample. template bool Foam::indexedOctree::overlaps ( @@ -113,12 +109,6 @@ bool Foam::indexedOctree::overlaps } -// -// Construction helper routines -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// - -// Split list of indices into 8 bins template void Foam::indexedOctree::divide ( @@ -161,7 +151,6 @@ void Foam::indexedOctree::divide } -// Subdivide the (content) node. template typename Foam::indexedOctree::node Foam::indexedOctree::divide @@ -231,7 +220,6 @@ Foam::indexedOctree::divide } -// Split any contents node with more than minSize elements. template void Foam::indexedOctree::splitNodes ( @@ -284,8 +272,6 @@ void Foam::indexedOctree::splitNodes } -// Reorder contents to be in same order as nodes. Returns number of nodes on -// the compactLevel. template Foam::label Foam::indexedOctree::compactContents ( @@ -353,15 +339,16 @@ Foam::label Foam::indexedOctree::compactContents } -// Pre-calculates wherever possible the volume status per node/subnode. -// Recurses to determine status of lowest level boxes. Level above is -// combination of octants below. template Foam::volumeType Foam::indexedOctree::calcVolumeType ( const label nodeI ) const { + // Pre-calculates wherever possible the volume status per node/subnode. + // Recurses to determine status of lowest level boxes. Level above is + // combination of octants below. + const node& nod = nodes_[nodeI]; volumeType myType = volumeType::UNKNOWN; @@ -497,13 +484,6 @@ Foam::volumeType Foam::indexedOctree::getSide } -// -// Query routines -// ~~~~~~~~~~~~~~ -// - - -// Find nearest point starting from nodeI template template void Foam::indexedOctree::findNearest @@ -580,7 +560,6 @@ void Foam::indexedOctree::findNearest } -// Find nearest point to line. template template void Foam::indexedOctree::findNearest @@ -676,8 +655,6 @@ Foam::treeBoundBox Foam::indexedOctree::subBbox } -// Takes a bb and a point on/close to the edge of the bb and pushes the point -// inside by a small fraction. template Foam::point Foam::indexedOctree::pushPoint ( @@ -747,8 +724,6 @@ Foam::point Foam::indexedOctree::pushPoint } -// Takes a bb and a point on the edge of the bb and pushes the point -// outside by a small fraction. template Foam::point Foam::indexedOctree::pushPoint ( @@ -859,9 +834,6 @@ Foam::point Foam::indexedOctree::pushPoint } -// Guarantees that if pt is on a face it gets perturbed so it is away -// from the face edges. -// If pt is not on a face does nothing. template Foam::point Foam::indexedOctree::pushPointIntoFace ( @@ -1019,205 +991,6 @@ Foam::point Foam::indexedOctree::pushPointIntoFace } -//// Takes a bb and a point on the outside of the bb. Checks if on multiple -// faces -//// and if so perturbs point so it is only on one face. -//template -//void Foam::indexedOctree::checkMultipleFaces -//( -// const treeBoundBox& bb, -// const vector& dir, // end-start -// pointIndexHit& faceHitInfo, -// direction& faceID -//) -//{ -// // Do the quick elimination of no or one face. -// if -// ( -// (faceID == 0) -// || (faceID == treeBoundBox::LEFTBIT) -// || (faceID == treeBoundBox::RIGHTBIT) -// || (faceID == treeBoundBox::BOTTOMBIT) -// || (faceID == treeBoundBox::TOPBIT) -// || (faceID == treeBoundBox::BACKBIT) -// || (faceID == treeBoundBox::FRONTBIT) -// ) -// { -// return; -// } -// -// -// // Check the direction of vector w.r.t. faces being intersected. -// FixedList inproducts(-GREAT); -// -// direction nFaces = 0; -// -// if (faceID & treeBoundBox::LEFTBIT) -// { -// inproducts[treeBoundBox::LEFT] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::LEFT] -// & dir -// ); -// nFaces++; -// } -// if (faceID & treeBoundBox::RIGHTBIT) -// { -// inproducts[treeBoundBox::RIGHT] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::RIGHT] -// & dir -// ); -// nFaces++; -// } -// -// if (faceID & treeBoundBox::BOTTOMBIT) -// { -// inproducts[treeBoundBox::BOTTOM] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::BOTTOM] -// & dir -// ); -// nFaces++; -// } -// if (faceID & treeBoundBox::TOPBIT) -// { -// inproducts[treeBoundBox::TOP] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::TOP] -// & dir -// ); -// nFaces++; -// } -// -// if (faceID & treeBoundBox::BACKBIT) -// { -// inproducts[treeBoundBox::BACK] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::BACK] -// & dir -// ); -// nFaces++; -// } -// if (faceID & treeBoundBox::FRONTBIT) -// { -// inproducts[treeBoundBox::FRONT] = mag -// ( -// treeBoundBox::faceNormals[treeBoundBox::FRONT] -// & dir -// ); -// nFaces++; -// } -// -// if (nFaces == 0 || nFaces == 1 || nFaces > 3) -// { -// FatalErrorInFunction -// << "Problem : nFaces:" << nFaces << abort(FatalError); -// } -// -// // Keep point on most perpendicular face; shift it away from the aligned -// // ones. -// // E.g. line hits top and left face: -// // a -// // ----+----+ -// // | | -// // | | -// // +----+ -// // Shift point down (away from top): -// // -// // a+----+ -// // ----| | -// // | | -// // +----+ -// -// label maxIndex = -1; -// scalar maxInproduct = -GREAT; -// -// for (direction i = 0; i < 6; i++) -// { -// if (inproducts[i] > maxInproduct) -// { -// maxInproduct = inproducts[i]; -// maxIndex = i; -// } -// } -// -// if (maxIndex == -1) -// { -// FatalErrorInFunction -// << "Problem maxIndex:" << maxIndex << " inproducts:" << inproducts -// << abort(FatalError); -// } -// -// const point oldPoint(faceHitInfo.rawPoint()); -// const direction oldFaceID = faceID; -// -// // 1. Push point into bb, away from all corners -// -// faceHitInfo.rawPoint() = pushPoint(bb, oldFaceID, oldPoint, true); -// -// // 2. Snap it back onto the preferred face -// -// if (maxIndex == treeBoundBox::LEFT) -// { -// faceHitInfo.rawPoint().x() = bb.min().x(); -// faceID = treeBoundBox::LEFTBIT; -// } -// else if (maxIndex == treeBoundBox::RIGHT) -// { -// faceHitInfo.rawPoint().x() = bb.max().x(); -// faceID = treeBoundBox::RIGHTBIT; -// } -// else if (maxIndex == treeBoundBox::BOTTOM) -// { -// faceHitInfo.rawPoint().y() = bb.min().y(); -// faceID = treeBoundBox::BOTTOMBIT; -// } -// else if (maxIndex == treeBoundBox::TOP) -// { -// faceHitInfo.rawPoint().y() = bb.max().y(); -// faceID = treeBoundBox::TOPBIT; -// } -// else if (maxIndex == treeBoundBox::BACK) -// { -// faceHitInfo.rawPoint().z() = bb.min().z(); -// faceID = treeBoundBox::BACKBIT; -// } -// else if (maxIndex == treeBoundBox::FRONT) -// { -// faceHitInfo.rawPoint().z() = bb.max().z(); -// faceID = treeBoundBox::FRONTBIT; -// } -// -// Pout<< "From ray:" << dir -// << " from point:" << oldPoint -// << " on faces:" << faceString(oldFaceID) -// << " of bb:" << bb -// << " with inprods:" << inproducts -// << " maxIndex:" << maxIndex << endl -// << "perturbed to point:" << faceHitInfo.rawPoint() -// << " on face:" << faceString(faceID) -// << endl; -// -// -// if (debug) -// { -// if (faceID != bb.faceBits(faceHitInfo.rawPoint())) -// { -// FatalErrorInFunction -// << "Pushed point from " << oldPoint -// << " on face:" << oldFaceID << " of bb:" << bb << endl -// << "onto " << faceHitInfo.rawPoint() -// << " on face:" << faceID -// << " which is not consistent with geometric face " -// << bb.faceBits(faceHitInfo.rawPoint()) -// << abort(FatalError); -// } -// } -//} - - -// Get parent node and octant. Return false if top of tree reached. template bool Foam::indexedOctree::walkToParent ( @@ -1264,10 +1037,6 @@ bool Foam::indexedOctree::walkToParent } -// Walk tree to neighbouring node. Gets current position as -// node and octant in this node and walks in the direction given by -// the facePointBits (combination of treeBoundBox::LEFTBIT, TOPBIT etc.) -// Returns false if edge of tree hit. template bool Foam::indexedOctree::walkToNeighbour ( @@ -1277,6 +1046,10 @@ bool Foam::indexedOctree::walkToNeighbour direction& octant ) const { + // Gets current position as node and octant in this node and walks in the + // direction given by the facePointBits (combination of + // treeBoundBox::LEFTBIT, TOPBIT etc.) Returns false if edge of tree hit. + label oldNodeI = nodeI; direction oldOctant = octant; @@ -1552,12 +1325,6 @@ Foam::word Foam::indexedOctree::faceString } -// Traverse a node. If intersects a triangle return first intersection point: -// hitInfo.index = index of shape -// hitInfo.point = point on shape -// Else return a miss and the bounding box face hit: -// hitInfo.point = coordinate of intersection of ray with bounding box -// hitBits = posbits of point on bounding box template template void Foam::indexedOctree::traverseNode @@ -1577,6 +1344,14 @@ void Foam::indexedOctree::traverseNode const FindIntersectOp& fiOp ) const { + // Traverse a node. If intersects a triangle return first intersection + // point: + // hitInfo.index = index of shape + // hitInfo.point = point on shape + // Else return a miss and the bounding box face hit: + // hitInfo.point = coordinate of intersection of ray with bounding box + // hitBits = posbits of point on bounding box + if (debug) { const treeBoundBox octantBb(subBbox(nodeI, octant)); @@ -1718,7 +1493,6 @@ void Foam::indexedOctree::traverseNode } -// Find first intersection template template Foam::pointIndexHit Foam::indexedOctree::findLine @@ -1911,7 +1685,6 @@ Foam::pointIndexHit Foam::indexedOctree::findLine } -// Find first intersection template template Foam::pointIndexHit Foam::indexedOctree::findLine @@ -2255,7 +2028,6 @@ void Foam::indexedOctree::findNear } -// Number of elements in node. template Foam::label Foam::indexedOctree::countElements ( @@ -2550,27 +2322,6 @@ Foam::scalar& Foam::indexedOctree::perturbTol() } -//template -//bool Foam::indexedOctree::findAnyOverlap -//( -// const point& sample, -// const scalar startDistSqr -//) const -//{ -// if (nodes_.size()) -// { -// return findAnyOverlap -// ( -// 0, -// sample, -// startDistSqr -// ); -// } -// -// return false; -//} - - template Foam::pointIndexHit Foam::indexedOctree::findNearest ( @@ -2672,7 +2423,6 @@ Foam::pointIndexHit Foam::indexedOctree::findNearest } -// Find nearest intersection template Foam::pointIndexHit Foam::indexedOctree::findLine ( @@ -2690,7 +2440,6 @@ Foam::pointIndexHit Foam::indexedOctree::findLine } -// Find nearest intersection template Foam::pointIndexHit Foam::indexedOctree::findLineAny ( @@ -2708,7 +2457,6 @@ Foam::pointIndexHit Foam::indexedOctree::findLineAny } -// Find nearest intersection template template Foam::pointIndexHit Foam::indexedOctree::findLine @@ -2722,7 +2470,6 @@ Foam::pointIndexHit Foam::indexedOctree::findLine } -// Find nearest intersection template template Foam::pointIndexHit Foam::indexedOctree::findLineAny @@ -2773,7 +2520,6 @@ Foam::labelList Foam::indexedOctree::findSphere } -// Find node (as parent+octant) containing point template Foam::labelBits Foam::indexedOctree::findNode ( @@ -2874,7 +2620,6 @@ const Foam::labelList& Foam::indexedOctree::findIndices } -// Determine type (inside/outside/mixed) per node. template Foam::volumeType Foam::indexedOctree::getVolumeType ( @@ -2886,13 +2631,6 @@ Foam::volumeType Foam::indexedOctree::getVolumeType return volumeType::UNKNOWN; } -// // If the sample is not within the octree, then have to query shapes -// // directly -// if (!nodes_[0].bb_.contains(sample)) -// { -// return volumeType(shapes_.getVolumeType(*this, sample)); -// } - if (nodeTypes_.size() != 8*nodes_.size()) { // Calculate type for every octant of node. @@ -2975,7 +2713,6 @@ void Foam::indexedOctree::findNear } -// Print contents of nodeI template void Foam::indexedOctree::print ( @@ -3049,7 +2786,6 @@ void Foam::indexedOctree::print } -// Print contents of nodeI template bool Foam::indexedOctree::write(Ostream& os) const { diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H index e0ead6cf0..0fb024f2d 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H @@ -181,6 +181,8 @@ private: DynamicList& contents ) const; + //- Reorder contents to be in same order as nodes. + // Returns number of nodes on the compactLevel. static label compactContents ( DynamicList& nodes, @@ -245,6 +247,9 @@ private: //- Helper: take point on face(s) of bb and push it away from // edges of face. + // Guarantees that if pt is on a face it gets perturbed + // so it is away from the face edges. + // If pt is not on a face does nothing. static point pushPointIntoFace ( const treeBoundBox& bb, @@ -252,15 +257,6 @@ private: const point& pt ); - ////- Push point on multiple faces away from any corner/edge. - //static void checkMultipleFaces - //( - // const treeBoundBox& bb, - // const vector& dir, // end-start - // pointIndexHit& faceHitInfo, - // direction& faceID - //); - //- Walk to parent of node+octant. bool walkToParent ( diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H index 6f32f291a..c9f6aefe8 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -64,6 +64,8 @@ class IOdictionary // Private Member Functions //- Read dictionary from file + // Parallel aware reading, using non-virtual type information + // (typeName instead of type()) because of use in constructor. void readFile(const bool); diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C index d18a0e293..992045100 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,8 +28,6 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Parallel aware reading, using non-virtual type information (typeName instead -// of type()) because of use in constructor. void Foam::IOdictionary::readFile(const bool masterOnly) { if (Pstream::master() || !masterOnly) diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.C b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.C index 06dcc9200..25ee28e00 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.C +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,8 +83,6 @@ bool Foam::Istream::peekBack(token& t) } -// Functions for reading object delimiters ( ... ) - Foam::Istream& Foam::Istream::readBegin(const char* funcName) { token delimiter(*this); @@ -126,8 +124,6 @@ Foam::Istream& Foam::Istream::readEndBegin(const char* funcName) } -// Functions for reading List delimiters ( ... ) or { ... } - char Foam::Istream::readBeginList(const char* funcName) { token delimiter(*this); diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C index 265152633..ab95c8c19 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,7 +31,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Decrement the indent level void Foam::Ostream::decrIndent() { if (indentLevel_ == 0) @@ -46,16 +45,12 @@ void Foam::Ostream::decrIndent() } -// Write keyType -// write regular expression as quoted string -// write plain word as word (unquoted) Foam::Ostream& Foam::Ostream::write(const keyType& kw) { return writeQuoted(kw, kw.isPattern()); } -// Write the keyword followed by appropriate indentation Foam::Ostream& Foam::Ostream::writeKeyword(const keyType& kw) { indent(); diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H index bf808f257..aada0b4f9 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -109,6 +109,8 @@ public: virtual Ostream& write(const word&) = 0; //- Write keyType + // write regular expression as quoted string + // write plain word as word (unquoted) virtual Ostream& write(const keyType&); //- Write string diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C index 6a332a1f4..af61a05de 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C @@ -115,7 +115,6 @@ Foam::List Foam::UPstream::calcLinearComm } -// Append my children (and my children children etc.) to allReceives. void Foam::UPstream::collectReceives ( const label procID, @@ -123,6 +122,8 @@ void Foam::UPstream::collectReceives DynamicList