STYLE: suppress fatal errors for indexedOctree debug=1

- these errors are mostly rounding related (when a point is located on
  the edge of a bounding box instead of being fully inside it).

  For debug > 1, continue to treat as fatal.
This commit is contained in:
Mark Olesen 2018-04-04 18:14:34 +02:00
parent 0cfe88f2e4
commit 12157acf07
2 changed files with 194 additions and 72 deletions

View File

@ -685,13 +685,19 @@ Foam::point Foam::dynamicIndexedOctree<Type>::pushPoint
{ {
if (pushInside != bb.contains(perturbedPt)) if (pushInside != bb.contains(perturbedPt))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "pushed point:" << pt << "pushed point:" << pt
<< " to:" << perturbedPt << " to:" << perturbedPt
<< " wanted side:" << pushInside << " wanted side:" << pushInside
<< " obtained side:" << bb.contains(perturbedPt) << " obtained side:" << bb.contains(perturbedPt)
<< " of bb:" << bb << " of bb:" << bb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -798,13 +804,19 @@ Foam::point Foam::dynamicIndexedOctree<Type>::pushPoint
{ {
if (pushInside != bb.contains(perturbedPt)) if (pushInside != bb.contains(perturbedPt))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "pushed point:" << pt << " on face:" << faceString(faceID) << "pushed point:" << pt << " on face:" << faceString(faceID)
<< " to:" << perturbedPt << " to:" << perturbedPt
<< " wanted side:" << pushInside << " wanted side:" << pushInside
<< " obtained side:" << bb.contains(perturbedPt) << " obtained side:" << bb.contains(perturbedPt)
<< " of bb:" << bb << " of bb:" << bb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -824,9 +836,16 @@ Foam::point Foam::dynamicIndexedOctree<Type>::pushPointIntoFace
{ {
if (bb.posBits(pt) != 0) if (bb.posBits(pt) != 0)
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< " bb:" << bb << endl << " bb:" << bb << endl
<< "does not contain point " << pt << abort(FatalError); << "does not contain point " << pt << nl;
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -946,21 +965,34 @@ Foam::point Foam::dynamicIndexedOctree<Type>::pushPointIntoFace
{ {
if (faceID != bb.faceBits(facePoint)) if (faceID != bb.faceBits(facePoint))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "Pushed point from " << pt << "Pushed point from " << pt
<< " on face:" << ptFaceID << " of bb:" << bb << endl << " on face:" << ptFaceID << " of bb:" << bb << nl
<< "onto " << facePoint << "onto " << facePoint
<< " on face:" << faceID << " on face:" << faceID
<< " which is not consistent with geometric face " << " which is not consistent with geometric face "
<< bb.faceBits(facePoint) << bb.faceBits(facePoint) << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
if (bb.posBits(facePoint) != 0) if (bb.posBits(facePoint) != 0)
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
<< " bb:" << bb << endl
fatal
<< " bb:" << bb << nl
<< "does not contain perturbed point " << "does not contain perturbed point "
<< facePoint << abort(FatalError); << facePoint << nl;
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -1204,12 +1236,18 @@ bool Foam::dynamicIndexedOctree<Type>::walkToNeighbour
if (!subBb.contains(facePoint)) if (!subBb.contains(facePoint))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "When searching for " << facePoint << "When searching for " << facePoint
<< " ended up in node:" << nodeI << " ended up in node:" << nodeI
<< " octant:" << octant << " octant:" << octant
<< " with bb:" << subBb << " with bb:" << subBb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -1233,24 +1271,36 @@ bool Foam::dynamicIndexedOctree<Type>::walkToNeighbour
if (nodeI == oldNodeI && octant == oldOctant) if (nodeI == oldNodeI && octant == oldOctant)
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "Did not go to neighbour when searching for " << facePoint << "Did not go to neighbour when searching for " << facePoint
<< endl << nl
<< " starting from face:" << faceString(faceID) << " starting from face:" << faceString(faceID)
<< " node:" << nodeI << " node:" << nodeI
<< " octant:" << octant << " octant:" << octant
<< " bb:" << subBb << " bb:" << subBb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
if (!subBb.contains(facePoint)) if (!subBb.contains(facePoint))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "When searching for " << facePoint << "When searching for " << facePoint
<< " ended up in node:" << nodeI << " ended up in node:" << nodeI
<< " octant:" << octant << " octant:" << octant
<< " bb:" << subBb << " bb:" << subBb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -1327,10 +1377,17 @@ void Foam::dynamicIndexedOctree<Type>::traverseNode
if (octantBb.posBits(start) != 0) if (octantBb.posBits(start) != 0)
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "Node:" << nodeI << " octant:" << octant << "Node:" << nodeI << " octant:" << octant
<< " bb:" << octantBb << endl << " bb:" << octantBb << nl
<< "does not contain point " << start << abort(FatalError); << "does not contain point " << start << nl;
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -2209,13 +2266,15 @@ Foam::labelList Foam::dynamicIndexedOctree<Type>::findBox
const treeBoundBox& searchBox const treeBoundBox& searchBox
) const ) const
{ {
if (nodes_.empty())
{
return labelList();
}
// Storage for labels of shapes inside bb. Size estimate. // Storage for labels of shapes inside bb. Size estimate.
labelHashSet elements(shapes_.size() / 100); labelHashSet elements(shapes_.size() / 100);
if (nodes_.size()) findBox(0, searchBox, elements);
{
findBox(0, searchBox, elements);
}
return elements.toc(); return elements.toc();
} }
@ -2228,13 +2287,15 @@ Foam::labelList Foam::dynamicIndexedOctree<Type>::findSphere
const scalar radiusSqr const scalar radiusSqr
) const ) const
{ {
if (nodes_.empty())
{
return labelList();
}
// Storage for labels of shapes inside bb. Size estimate. // Storage for labels of shapes inside bb. Size estimate.
labelHashSet elements(shapes_.size() / 100); labelHashSet elements(shapes_.size() / 100);
if (nodes_.size()) findSphere(0, centre, radiusSqr, elements);
{
findSphere(0, centre, radiusSqr, elements);
}
return elements.toc(); return elements.toc();
} }

View File

@ -710,13 +710,19 @@ Foam::point Foam::indexedOctree<Type>::pushPoint
{ {
if (pushInside != bb.contains(perturbedPt)) if (pushInside != bb.contains(perturbedPt))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "pushed point:" << pt << "pushed point:" << pt
<< " to:" << perturbedPt << " to:" << perturbedPt
<< " wanted side:" << pushInside << " wanted side:" << pushInside
<< " obtained side:" << bb.contains(perturbedPt) << " obtained side:" << bb.contains(perturbedPt)
<< " of bb:" << bb << " of bb:" << bb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -820,13 +826,19 @@ Foam::point Foam::indexedOctree<Type>::pushPoint
{ {
if (pushInside != bb.contains(perturbedPt)) if (pushInside != bb.contains(perturbedPt))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "pushed point:" << pt << " on face:" << faceString(faceID) << "pushed point:" << pt << " on face:" << faceString(faceID)
<< " to:" << perturbedPt << " to:" << perturbedPt
<< " wanted side:" << pushInside << " wanted side:" << pushInside
<< " obtained side:" << bb.contains(perturbedPt) << " obtained side:" << bb.contains(perturbedPt)
<< " of bb:" << bb << " of bb:" << bb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -846,9 +858,16 @@ Foam::point Foam::indexedOctree<Type>::pushPointIntoFace
{ {
if (bb.posBits(pt) != 0) if (bb.posBits(pt) != 0)
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< " bb:" << bb << endl << " bb:" << bb << endl
<< "does not contain point " << pt << abort(FatalError); << "does not contain point " << pt << nl;
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -968,21 +987,34 @@ Foam::point Foam::indexedOctree<Type>::pushPointIntoFace
{ {
if (faceID != bb.faceBits(facePoint)) if (faceID != bb.faceBits(facePoint))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "Pushed point from " << pt << "Pushed point from " << pt
<< " on face:" << ptFaceID << " of bb:" << bb << endl << " on face:" << ptFaceID << " of bb:" << bb << nl
<< "onto " << facePoint << "onto " << facePoint
<< " on face:" << faceID << " on face:" << faceID
<< " which is not consistent with geometric face " << " which is not consistent with geometric face "
<< bb.faceBits(facePoint) << bb.faceBits(facePoint) << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
if (bb.posBits(facePoint) != 0) if (bb.posBits(facePoint) != 0)
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
<< " bb:" << bb << endl
fatal
<< " bb:" << bb << nl
<< "does not contain perturbed point " << "does not contain perturbed point "
<< facePoint << abort(FatalError); << facePoint << nl;
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -1224,12 +1256,18 @@ bool Foam::indexedOctree<Type>::walkToNeighbour
if (!subBb.contains(facePoint)) if (!subBb.contains(facePoint))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "When searching for " << facePoint << "When searching for " << facePoint
<< " ended up in node:" << nodeI << " ended up in node:" << nodeI
<< " octant:" << octant << " octant:" << octant
<< " with bb:" << subBb << " with bb:" << subBb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -1253,24 +1291,36 @@ bool Foam::indexedOctree<Type>::walkToNeighbour
if (nodeI == oldNodeI && octant == oldOctant) if (nodeI == oldNodeI && octant == oldOctant)
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "Did not go to neighbour when searching for " << facePoint << "Did not go to neighbour when searching for " << facePoint
<< endl << nl
<< " starting from face:" << faceString(faceID) << " starting from face:" << faceString(faceID)
<< " node:" << nodeI << " node:" << nodeI
<< " octant:" << octant << " octant:" << octant
<< " bb:" << subBb << " bb:" << subBb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
if (!subBb.contains(facePoint)) if (!subBb.contains(facePoint))
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "When searching for " << facePoint << "When searching for " << facePoint
<< " ended up in node:" << nodeI << " ended up in node:" << nodeI
<< " octant:" << octant << " octant:" << octant
<< " bb:" << subBb << " bb:" << subBb << nl;
<< abort(FatalError);
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -1358,10 +1408,17 @@ void Foam::indexedOctree<Type>::traverseNode
if (octantBb.posBits(start) != 0) if (octantBb.posBits(start) != 0)
{ {
FatalErrorInFunction auto fatal = FatalErrorInFunction;
fatal
<< "Node:" << nodeI << " octant:" << octant << "Node:" << nodeI << " octant:" << octant
<< " bb:" << octantBb << endl << " bb:" << octantBb << nl
<< "does not contain point " << start << abort(FatalError); << "does not contain point " << start << nl;
if (debug > 1)
{
fatal << abort(FatalError);
}
} }
} }
@ -2489,13 +2546,15 @@ Foam::labelList Foam::indexedOctree<Type>::findBox
const treeBoundBox& searchBox const treeBoundBox& searchBox
) const ) const
{ {
if (nodes_.empty())
{
return labelList();
}
// Storage for labels of shapes inside bb. Size estimate. // Storage for labels of shapes inside bb. Size estimate.
labelHashSet elements(shapes_.size() / 100); labelHashSet elements(shapes_.size() / 100);
if (nodes_.size()) findBox(0, searchBox, elements);
{
findBox(0, searchBox, elements);
}
return elements.toc(); return elements.toc();
} }
@ -2508,13 +2567,15 @@ Foam::labelList Foam::indexedOctree<Type>::findSphere
const scalar radiusSqr const scalar radiusSqr
) const ) const
{ {
if (nodes_.empty())
{
return labelList();
}
// Storage for labels of shapes inside bb. Size estimate. // Storage for labels of shapes inside bb. Size estimate.
labelHashSet elements(shapes_.size() / 100); labelHashSet elements(shapes_.size() / 100);
if (nodes_.size()) findSphere(0, centre, radiusSqr, elements);
{
findSphere(0, centre, radiusSqr, elements);
}
return elements.toc(); return elements.toc();
} }