mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GIT: Initial commit after latest foundation merge
This commit is contained in:
@ -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
|
||||
@ -33,11 +33,8 @@ License
|
||||
template<class Type>
|
||||
Foam::scalar Foam::dynamicIndexedOctree<Type>::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<class Type>
|
||||
bool Foam::dynamicIndexedOctree<Type>::overlaps
|
||||
(
|
||||
@ -80,8 +77,6 @@ bool Foam::dynamicIndexedOctree<Type>::overlaps
|
||||
}
|
||||
|
||||
|
||||
// Does bb intersect a sphere around sample? Or is any corner point of bb
|
||||
// closer than nearestDistSqr to sample.
|
||||
template<class Type>
|
||||
bool Foam::dynamicIndexedOctree<Type>::overlaps
|
||||
(
|
||||
@ -139,16 +134,10 @@ bool Foam::dynamicIndexedOctree<Type>::overlaps
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Construction helper routines
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
|
||||
// Split list of indices into 8 bins
|
||||
template<class Type>
|
||||
void Foam::dynamicIndexedOctree<Type>::divide
|
||||
(
|
||||
const autoPtr<DynamicList<label> >& indices,
|
||||
const autoPtr<DynamicList<label>>& indices,
|
||||
const treeBoundBox& bb,
|
||||
contentListList& result
|
||||
) const
|
||||
@ -157,7 +146,7 @@ void Foam::dynamicIndexedOctree<Type>::divide
|
||||
{
|
||||
result.append
|
||||
(
|
||||
autoPtr<DynamicList<label> >
|
||||
autoPtr<DynamicList<label>>
|
||||
(
|
||||
new DynamicList<label>(indices().size()/8)
|
||||
)
|
||||
@ -186,7 +175,6 @@ void Foam::dynamicIndexedOctree<Type>::divide
|
||||
}
|
||||
|
||||
|
||||
// Subdivide the (content) node.
|
||||
template<class Type>
|
||||
typename Foam::dynamicIndexedOctree<Type>::node
|
||||
Foam::dynamicIndexedOctree<Type>::divide
|
||||
@ -197,7 +185,7 @@ Foam::dynamicIndexedOctree<Type>::divide
|
||||
const label octantToBeDivided
|
||||
)
|
||||
{
|
||||
const autoPtr<DynamicList<label> >& indices = contents_[contentI];
|
||||
const autoPtr<DynamicList<label>>& indices = contents_[contentI];
|
||||
|
||||
node nod;
|
||||
|
||||
@ -226,7 +214,7 @@ Foam::dynamicIndexedOctree<Type>::divide
|
||||
|
||||
for (direction octant = 0; octant < dividedIndices.size(); octant++)
|
||||
{
|
||||
autoPtr<DynamicList<label> >& subIndices = dividedIndices[octant];
|
||||
autoPtr<DynamicList<label>>& subIndices = dividedIndices[octant];
|
||||
|
||||
if (subIndices().size())
|
||||
{
|
||||
@ -245,7 +233,7 @@ Foam::dynamicIndexedOctree<Type>::divide
|
||||
|
||||
contents_.append
|
||||
(
|
||||
autoPtr<DynamicList<label> >
|
||||
autoPtr<DynamicList<label>>
|
||||
(
|
||||
new DynamicList<label>()
|
||||
)
|
||||
@ -330,15 +318,16 @@ void Foam::dynamicIndexedOctree<Type>::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<class Type>
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::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<Type>::getSide
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Query routines
|
||||
// ~~~~~~~~~~~~~~
|
||||
//
|
||||
|
||||
// Find nearest point starting from nodeI
|
||||
template<class Type>
|
||||
void Foam::dynamicIndexedOctree<Type>::findNearest
|
||||
(
|
||||
@ -554,7 +537,6 @@ void Foam::dynamicIndexedOctree<Type>::findNearest
|
||||
}
|
||||
|
||||
|
||||
// Find nearest point to line.
|
||||
template<class Type>
|
||||
void Foam::dynamicIndexedOctree<Type>::findNearest
|
||||
(
|
||||
@ -645,8 +627,6 @@ Foam::treeBoundBox Foam::dynamicIndexedOctree<Type>::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<class Type>
|
||||
Foam::point Foam::dynamicIndexedOctree<Type>::pushPoint
|
||||
(
|
||||
@ -655,6 +635,9 @@ Foam::point Foam::dynamicIndexedOctree<Type>::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<Type>::pushPoint
|
||||
}
|
||||
|
||||
|
||||
// Takes a bb and a point on the edge of the bb and pushes the point
|
||||
// outside by a small fraction.
|
||||
template<class Type>
|
||||
Foam::point Foam::dynamicIndexedOctree<Type>::pushPoint
|
||||
(
|
||||
@ -727,6 +708,9 @@ Foam::point Foam::dynamicIndexedOctree<Type>::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<Type>::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<class Type>
|
||||
Foam::point Foam::dynamicIndexedOctree<Type>::pushPointIntoFace
|
||||
(
|
||||
@ -988,205 +969,6 @@ Foam::point Foam::dynamicIndexedOctree<Type>::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<class Type>
|
||||
//void Foam::dynamicIndexedOctree<Type>::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<scalar, 6> 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<class Type>
|
||||
bool Foam::dynamicIndexedOctree<Type>::walkToParent
|
||||
(
|
||||
@ -1233,10 +1015,7 @@ bool Foam::dynamicIndexedOctree<Type>::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<class Type>
|
||||
bool Foam::dynamicIndexedOctree<Type>::walkToNeighbour
|
||||
(
|
||||
@ -1246,6 +1025,11 @@ bool Foam::dynamicIndexedOctree<Type>::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<Type>::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<class Type>
|
||||
void Foam::dynamicIndexedOctree<Type>::traverseNode
|
||||
(
|
||||
@ -1689,7 +1467,6 @@ void Foam::dynamicIndexedOctree<Type>::traverseNode
|
||||
}
|
||||
|
||||
|
||||
// Find first intersection
|
||||
template<class Type>
|
||||
Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
|
||||
(
|
||||
@ -1877,7 +1654,6 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
|
||||
}
|
||||
|
||||
|
||||
// Find first intersection
|
||||
template<class Type>
|
||||
Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
|
||||
(
|
||||
@ -1901,7 +1677,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
|
||||
if ((startBit & endBit) != 0)
|
||||
{
|
||||
// Both start and end outside domain and in same block.
|
||||
return pointIndexHit(false, vector::zero, -1);
|
||||
return pointIndexHit(false, Zero, -1);
|
||||
}
|
||||
|
||||
|
||||
@ -1915,7 +1691,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
|
||||
// Track start to inside domain.
|
||||
if (!treeBb.intersects(start, end, trackStart))
|
||||
{
|
||||
return pointIndexHit(false, vector::zero, -1);
|
||||
return pointIndexHit(false, Zero, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1924,7 +1700,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
|
||||
// Track end to inside domain.
|
||||
if (!treeBb.intersects(end, trackStart, trackEnd))
|
||||
{
|
||||
return pointIndexHit(false, vector::zero, -1);
|
||||
return pointIndexHit(false, Zero, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2218,7 +1994,6 @@ void Foam::dynamicIndexedOctree<Type>::findNear
|
||||
}
|
||||
|
||||
|
||||
// Number of elements in node.
|
||||
template<class Type>
|
||||
Foam::label Foam::dynamicIndexedOctree<Type>::countElements
|
||||
(
|
||||
@ -2354,7 +2129,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findNearest
|
||||
{
|
||||
scalar nearestDistSqr = startDistSqr;
|
||||
label nearestShapeI = -1;
|
||||
point nearestPoint = vector::zero;
|
||||
point nearestPoint = Zero;
|
||||
|
||||
if (nodes_.size())
|
||||
{
|
||||
@ -2399,14 +2174,13 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findNearest
|
||||
}
|
||||
else
|
||||
{
|
||||
nearestPoint = vector::zero;
|
||||
nearestPoint = Zero;
|
||||
}
|
||||
|
||||
return pointIndexHit(nearestShapeI != -1, nearestPoint, nearestShapeI);
|
||||
}
|
||||
|
||||
|
||||
// Find nearest intersection
|
||||
template<class Type>
|
||||
Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
|
||||
(
|
||||
@ -2418,7 +2192,6 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
|
||||
}
|
||||
|
||||
|
||||
// Find nearest intersection
|
||||
template<class Type>
|
||||
Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLineAny
|
||||
(
|
||||
@ -2467,7 +2240,6 @@ Foam::labelList Foam::dynamicIndexedOctree<Type>::findSphere
|
||||
}
|
||||
|
||||
|
||||
// Find node (as parent+octant) containing point
|
||||
template<class Type>
|
||||
Foam::labelBits Foam::dynamicIndexedOctree<Type>::findNode
|
||||
(
|
||||
@ -2571,7 +2343,6 @@ const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices
|
||||
}
|
||||
|
||||
|
||||
// Determine type (inside/outside/mixed) per node.
|
||||
template<class Type>
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
(
|
||||
@ -2677,7 +2448,7 @@ bool Foam::dynamicIndexedOctree<Type>::insert(label startIndex, label endIndex)
|
||||
{
|
||||
contents_.append
|
||||
(
|
||||
autoPtr<DynamicList<label> >
|
||||
autoPtr<DynamicList<label>>
|
||||
(
|
||||
new DynamicList<label>(1)
|
||||
)
|
||||
@ -2771,7 +2542,7 @@ bool Foam::dynamicIndexedOctree<Type>::insertIndex
|
||||
|
||||
contents_.append
|
||||
(
|
||||
autoPtr<DynamicList<label> >(new DynamicList<label>(1))
|
||||
autoPtr<DynamicList<label>>(new DynamicList<label>(1))
|
||||
);
|
||||
|
||||
contents_[sz]().append(index);
|
||||
@ -2885,7 +2656,6 @@ Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex
|
||||
}
|
||||
|
||||
|
||||
// Print contents of nodeI
|
||||
template<class Type>
|
||||
void Foam::dynamicIndexedOctree<Type>::print
|
||||
(
|
||||
@ -2985,7 +2755,6 @@ void Foam::dynamicIndexedOctree<Type>::writeTreeInfo() const
|
||||
}
|
||||
|
||||
|
||||
// Print contents of nodeI
|
||||
template<class Type>
|
||||
bool Foam::dynamicIndexedOctree<Type>::write(Ostream& os) const
|
||||
{
|
||||
|
||||
@ -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
|
||||
@ -50,7 +50,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
typedef DynamicList<autoPtr<DynamicList<label > > > contentListList;
|
||||
typedef DynamicList<autoPtr<DynamicList<label >>> contentListList;
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class Type> class dynamicIndexedOctree;
|
||||
@ -181,7 +181,7 @@ private:
|
||||
// according to where they are in relation to mid.
|
||||
void divide
|
||||
(
|
||||
const autoPtr<DynamicList<label> >& indices,
|
||||
const autoPtr<DynamicList<label>>& indices,
|
||||
const treeBoundBox& bb,
|
||||
contentListList& result
|
||||
) const;
|
||||
@ -206,17 +206,6 @@ private:
|
||||
label& nLevels
|
||||
);
|
||||
|
||||
// static label compactContents
|
||||
// (
|
||||
// DynamicList<node>& nodes,
|
||||
// DynamicList<labelList>& contents,
|
||||
// const label compactLevel,
|
||||
// const label nodeI,
|
||||
// const label level,
|
||||
// List<labelList>& 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,
|
||||
@ -435,9 +416,9 @@ public:
|
||||
);
|
||||
|
||||
//- Clone
|
||||
autoPtr<dynamicIndexedOctree<Type> > clone() const
|
||||
autoPtr<dynamicIndexedOctree<Type>> clone() const
|
||||
{
|
||||
return autoPtr<dynamicIndexedOctree<Type> >
|
||||
return autoPtr<dynamicIndexedOctree<Type>>
|
||||
(
|
||||
new dynamicIndexedOctree<Type>(*this)
|
||||
);
|
||||
@ -683,7 +664,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "dynamicIndexedOctree.C"
|
||||
#include "dynamicIndexedOctree.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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
|
||||
@ -55,8 +55,6 @@ Foam::dynamicTreeDataPoint::shapePoints() const
|
||||
}
|
||||
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
Foam::volumeType Foam::dynamicTreeDataPoint::getVolumeType
|
||||
(
|
||||
const dynamicIndexedOctree<dynamicTreeDataPoint>& oc,
|
||||
@ -67,7 +65,6 @@ Foam::volumeType Foam::dynamicTreeDataPoint::getVolumeType
|
||||
}
|
||||
|
||||
|
||||
// Check if any point on shape is inside cubeBb.
|
||||
bool Foam::dynamicTreeDataPoint::overlaps
|
||||
(
|
||||
const label index,
|
||||
@ -78,7 +75,6 @@ bool Foam::dynamicTreeDataPoint::overlaps
|
||||
}
|
||||
|
||||
|
||||
// Check if any point on shape is inside sphere.
|
||||
bool Foam::dynamicTreeDataPoint::overlaps
|
||||
(
|
||||
const label index,
|
||||
@ -99,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,
|
||||
@ -129,8 +123,6 @@ void Foam::dynamicTreeDataPoint::findNearest
|
||||
}
|
||||
|
||||
|
||||
//- Calculates nearest (to line) point in shape.
|
||||
// Returns point and distance (squared)
|
||||
void Foam::dynamicTreeDataPoint::findNearest
|
||||
(
|
||||
const labelUList& indices,
|
||||
|
||||
@ -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
|
||||
@ -37,8 +37,6 @@ Foam::scalar Foam::indexedOctree<Type>::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<class Type>
|
||||
bool Foam::indexedOctree<Type>::overlaps
|
||||
(
|
||||
@ -54,8 +52,6 @@ bool Foam::indexedOctree<Type>::overlaps
|
||||
}
|
||||
|
||||
|
||||
// Does bb intersect a sphere around sample? Or is any corner point of bb
|
||||
// closer than nearestDistSqr to sample.
|
||||
template<class Type>
|
||||
bool Foam::indexedOctree<Type>::overlaps
|
||||
(
|
||||
@ -113,12 +109,6 @@ bool Foam::indexedOctree<Type>::overlaps
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Construction helper routines
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
|
||||
// Split list of indices into 8 bins
|
||||
template<class Type>
|
||||
void Foam::indexedOctree<Type>::divide
|
||||
(
|
||||
@ -127,7 +117,7 @@ void Foam::indexedOctree<Type>::divide
|
||||
labelListList& result
|
||||
) const
|
||||
{
|
||||
List<DynamicList<label> > subIndices(8);
|
||||
List<DynamicList<label>> subIndices(8);
|
||||
for (direction octant = 0; octant < subIndices.size(); octant++)
|
||||
{
|
||||
subIndices[octant].setCapacity(indices.size()/8);
|
||||
@ -161,7 +151,6 @@ void Foam::indexedOctree<Type>::divide
|
||||
}
|
||||
|
||||
|
||||
// Subdivide the (content) node.
|
||||
template<class Type>
|
||||
typename Foam::indexedOctree<Type>::node
|
||||
Foam::indexedOctree<Type>::divide
|
||||
@ -231,7 +220,6 @@ Foam::indexedOctree<Type>::divide
|
||||
}
|
||||
|
||||
|
||||
// Split any contents node with more than minSize elements.
|
||||
template<class Type>
|
||||
void Foam::indexedOctree<Type>::splitNodes
|
||||
(
|
||||
@ -284,8 +272,6 @@ void Foam::indexedOctree<Type>::splitNodes
|
||||
}
|
||||
|
||||
|
||||
// Reorder contents to be in same order as nodes. Returns number of nodes on
|
||||
// the compactLevel.
|
||||
template<class Type>
|
||||
Foam::label Foam::indexedOctree<Type>::compactContents
|
||||
(
|
||||
@ -353,15 +339,16 @@ Foam::label Foam::indexedOctree<Type>::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<class Type>
|
||||
Foam::volumeType Foam::indexedOctree<Type>::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<Type>::getSide
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Query routines
|
||||
// ~~~~~~~~~~~~~~
|
||||
//
|
||||
|
||||
|
||||
// Find nearest point starting from nodeI
|
||||
template<class Type>
|
||||
template<class FindNearestOp>
|
||||
void Foam::indexedOctree<Type>::findNearest
|
||||
@ -580,7 +560,6 @@ void Foam::indexedOctree<Type>::findNearest
|
||||
}
|
||||
|
||||
|
||||
// Find nearest point to line.
|
||||
template<class Type>
|
||||
template<class FindNearestOp>
|
||||
void Foam::indexedOctree<Type>::findNearest
|
||||
@ -676,8 +655,6 @@ Foam::treeBoundBox Foam::indexedOctree<Type>::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<class Type>
|
||||
Foam::point Foam::indexedOctree<Type>::pushPoint
|
||||
(
|
||||
@ -747,8 +724,6 @@ Foam::point Foam::indexedOctree<Type>::pushPoint
|
||||
}
|
||||
|
||||
|
||||
// Takes a bb and a point on the edge of the bb and pushes the point
|
||||
// outside by a small fraction.
|
||||
template<class Type>
|
||||
Foam::point Foam::indexedOctree<Type>::pushPoint
|
||||
(
|
||||
@ -859,9 +834,6 @@ Foam::point Foam::indexedOctree<Type>::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<class Type>
|
||||
Foam::point Foam::indexedOctree<Type>::pushPointIntoFace
|
||||
(
|
||||
@ -1019,205 +991,6 @@ Foam::point Foam::indexedOctree<Type>::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<class Type>
|
||||
//void Foam::indexedOctree<Type>::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<scalar, 6> 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<class Type>
|
||||
bool Foam::indexedOctree<Type>::walkToParent
|
||||
(
|
||||
@ -1264,10 +1037,6 @@ bool Foam::indexedOctree<Type>::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<class Type>
|
||||
bool Foam::indexedOctree<Type>::walkToNeighbour
|
||||
(
|
||||
@ -1277,6 +1046,10 @@ bool Foam::indexedOctree<Type>::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<Type>::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<class Type>
|
||||
template<class FindIntersectOp>
|
||||
void Foam::indexedOctree<Type>::traverseNode
|
||||
@ -1577,6 +1344,14 @@ void Foam::indexedOctree<Type>::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<Type>::traverseNode
|
||||
}
|
||||
|
||||
|
||||
// Find first intersection
|
||||
template<class Type>
|
||||
template<class FindIntersectOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
@ -1911,7 +1685,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
}
|
||||
|
||||
|
||||
// Find first intersection
|
||||
template<class Type>
|
||||
template<class FindIntersectOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
@ -1937,7 +1710,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
if ((startBit & endBit) != 0)
|
||||
{
|
||||
// Both start and end outside domain and in same block.
|
||||
return pointIndexHit(false, vector::zero, -1);
|
||||
return pointIndexHit(false, Zero, -1);
|
||||
}
|
||||
|
||||
|
||||
@ -1951,7 +1724,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
// Track start to inside domain.
|
||||
if (!treeBb.intersects(start, end, trackStart))
|
||||
{
|
||||
return pointIndexHit(false, vector::zero, -1);
|
||||
return pointIndexHit(false, Zero, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1960,7 +1733,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
// Track end to inside domain.
|
||||
if (!treeBb.intersects(end, trackStart, trackEnd))
|
||||
{
|
||||
return pointIndexHit(false, vector::zero, -1);
|
||||
return pointIndexHit(false, Zero, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2255,7 +2028,6 @@ void Foam::indexedOctree<Type>::findNear
|
||||
}
|
||||
|
||||
|
||||
// Number of elements in node.
|
||||
template<class Type>
|
||||
Foam::label Foam::indexedOctree<Type>::countElements
|
||||
(
|
||||
@ -2550,27 +2322,6 @@ Foam::scalar& Foam::indexedOctree<Type>::perturbTol()
|
||||
}
|
||||
|
||||
|
||||
//template<class Type>
|
||||
//bool Foam::indexedOctree<Type>::findAnyOverlap
|
||||
//(
|
||||
// const point& sample,
|
||||
// const scalar startDistSqr
|
||||
//) const
|
||||
//{
|
||||
// if (nodes_.size())
|
||||
// {
|
||||
// return findAnyOverlap
|
||||
// (
|
||||
// 0,
|
||||
// sample,
|
||||
// startDistSqr
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
(
|
||||
@ -2599,7 +2350,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
{
|
||||
scalar nearestDistSqr = startDistSqr;
|
||||
label nearestShapeI = -1;
|
||||
point nearestPoint = vector::zero;
|
||||
point nearestPoint = Zero;
|
||||
|
||||
if (nodes_.size())
|
||||
{
|
||||
@ -2650,7 +2401,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
) const
|
||||
{
|
||||
label nearestShapeI = -1;
|
||||
point nearestPoint = vector::zero;
|
||||
point nearestPoint = Zero;
|
||||
|
||||
if (nodes_.size())
|
||||
{
|
||||
@ -2672,7 +2423,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||
}
|
||||
|
||||
|
||||
// Find nearest intersection
|
||||
template<class Type>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
(
|
||||
@ -2690,7 +2440,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
}
|
||||
|
||||
|
||||
// Find nearest intersection
|
||||
template<class Type>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
|
||||
(
|
||||
@ -2708,7 +2457,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
|
||||
}
|
||||
|
||||
|
||||
// Find nearest intersection
|
||||
template<class Type>
|
||||
template<class FindIntersectOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
@ -2722,7 +2470,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||
}
|
||||
|
||||
|
||||
// Find nearest intersection
|
||||
template<class Type>
|
||||
template<class FindIntersectOp>
|
||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
|
||||
@ -2773,7 +2520,6 @@ Foam::labelList Foam::indexedOctree<Type>::findSphere
|
||||
}
|
||||
|
||||
|
||||
// Find node (as parent+octant) containing point
|
||||
template<class Type>
|
||||
Foam::labelBits Foam::indexedOctree<Type>::findNode
|
||||
(
|
||||
@ -2874,7 +2620,6 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
|
||||
}
|
||||
|
||||
|
||||
// Determine type (inside/outside/mixed) per node.
|
||||
template<class Type>
|
||||
Foam::volumeType Foam::indexedOctree<Type>::getVolumeType
|
||||
(
|
||||
@ -2886,13 +2631,6 @@ Foam::volumeType Foam::indexedOctree<Type>::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<Type>::findNear
|
||||
}
|
||||
|
||||
|
||||
// Print contents of nodeI
|
||||
template<class Type>
|
||||
void Foam::indexedOctree<Type>::print
|
||||
(
|
||||
@ -3049,7 +2786,6 @@ void Foam::indexedOctree<Type>::print
|
||||
}
|
||||
|
||||
|
||||
// Print contents of nodeI
|
||||
template<class Type>
|
||||
bool Foam::indexedOctree<Type>::write(Ostream& os) const
|
||||
{
|
||||
|
||||
@ -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
|
||||
@ -181,6 +181,8 @@ private:
|
||||
DynamicList<labelList>& contents
|
||||
) const;
|
||||
|
||||
//- Reorder contents to be in same order as nodes.
|
||||
// Returns number of nodes on the compactLevel.
|
||||
static label compactContents
|
||||
(
|
||||
DynamicList<node>& 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
|
||||
(
|
||||
@ -434,9 +430,9 @@ public:
|
||||
indexedOctree(const Type& shapes, Istream& is);
|
||||
|
||||
//- Clone
|
||||
autoPtr<indexedOctree<Type> > clone() const
|
||||
autoPtr<indexedOctree<Type>> clone() const
|
||||
{
|
||||
return autoPtr<indexedOctree<Type> >
|
||||
return autoPtr<indexedOctree<Type>>
|
||||
(
|
||||
new indexedOctree<Type>(*this)
|
||||
);
|
||||
@ -697,7 +693,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "indexedOctree.C"
|
||||
#include "indexedOctree.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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
|
||||
@ -57,7 +57,7 @@ class labelBits
|
||||
|
||||
inline static label pack(const label val, const direction bits)
|
||||
{
|
||||
# ifdef FULLDEBUG
|
||||
#ifdef FULLDEBUG
|
||||
if (bits > 7 || (((val<<3)>>3) != val))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -66,7 +66,7 @@ class labelBits
|
||||
<< label(8*sizeof(label)-3) << " bit representation"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return (val<<3) | bits;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user