From a11a6867c727d346e15243b5d2de99643f78a301 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 10 Jul 2013 12:28:18 +0100 Subject: [PATCH 1/6] BUG: wallPoint: I/O operators missing space --- src/meshTools/cellDist/wallPoint/wallPoint.C | 4 ++-- src/meshTools/cellDist/wallPoint/wallPointData.C | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/meshTools/cellDist/wallPoint/wallPoint.C b/src/meshTools/cellDist/wallPoint/wallPoint.C index 16f67df42a..3f4aa14399 100644 --- a/src/meshTools/cellDist/wallPoint/wallPoint.C +++ b/src/meshTools/cellDist/wallPoint/wallPoint.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,7 +29,7 @@ License Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::wallPoint& wDist) { - return os << wDist.origin() << wDist.distSqr(); + return os << wDist.origin() << token::SPACE << wDist.distSqr(); } Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallPoint& wDist) diff --git a/src/meshTools/cellDist/wallPoint/wallPointData.C b/src/meshTools/cellDist/wallPoint/wallPointData.C index 7379e2c113..1fbbf05f8a 100644 --- a/src/meshTools/cellDist/wallPoint/wallPointData.C +++ b/src/meshTools/cellDist/wallPoint/wallPointData.C @@ -39,9 +39,10 @@ Ostream& operator<< const wallPointData& wDist ) { - operator<<(os, static_cast(wDist)); - - return os << wDist.data(); + return os + << static_cast(wDist) + << token::SPACE + << wDist.data(); } @@ -52,9 +53,7 @@ Istream& operator>> wallPointData& wDist ) { - operator>>(is, static_cast(wDist)); - - return is >> wDist.data_; + return is >> static_cast(wDist) >> wDist.data_; } From f9664eb3e464a04c5412e8261949e87693a4f597 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 10 Jul 2013 12:29:07 +0100 Subject: [PATCH 2/6] STYLE: indexedOctree: removed commented out code --- .../algorithms/indexedOctree/indexedOctree.C | 97 ------------------- .../algorithms/indexedOctree/indexedOctree.H | 20 ---- 2 files changed, 117 deletions(-) diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C index a19b16a672..b83b7ba1a1 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C @@ -508,66 +508,6 @@ Foam::volumeType Foam::indexedOctree::getSide // -//template -//bool Foam::indexedOctree::findAnyOverlap -//( -// const label nodeI, -// const point& sample, -// const scalar nearestDistSqr -//) const -//{ -// const node& nod = nodes_[nodeI]; -// -// // Determine order to walk through octants -// FixedList octantOrder; -// nod.bb_.searchOrder(sample, octantOrder); -// -// // Go into all suboctants (one containing sample first) and update -// // nearest. -// for (direction i = 0; i < 8; i++) -// { -// direction octant = octantOrder[i]; -// -// labelBits index = nod.subNodes_[octant]; -// -// if (isNode(index)) -// { -// label subNodeI = getNode(index); -// -// const treeBoundBox& subBb = nodes_[subNodeI].bb_; -// -// if (overlaps(subBb.min(), subBb.max(), nearestDistSqr, sample)) -// { -// return findAnyOverlap -// ( -// subNodeI, -// sample, -// nearestDistSqr -// ); -// } -// } -// else if (isContent(index)) -// { -// if -// ( -// overlaps -// ( -// nod.bb_, -// octant, -// nearestDistSqr, -// sample -// ) -// ) -// { -// return true; -// } -// } -// } -// -// return false; -//} - - // Find nearest point starting from nodeI template template @@ -1819,11 +1759,6 @@ Foam::pointIndexHit Foam::indexedOctree::findLine label i = 0; for (; i < 100000; i++) { -// if (isLineInsideOrOutside(nodeI, treeStart, treeEnd)) -// { -// return hitInfo; -// } - // Ray-trace to end of current node. Updates point (either on triangle // in case of hit or on node bounding box in case of miss) @@ -1981,38 +1916,6 @@ Foam::pointIndexHit Foam::indexedOctree::findLine } -//template -//bool Foam::indexedOctree::isLineInsideOrOutside -//( -// const label nodeI, -// const point& start, -// const point& end -//) const -//{ -// const node& nod = nodes_[nodeI]; -// -// direction startOctant = nod.bb_.subOctant(start); -// direction endOctant = nod.bb_.subOctant(end); -// -// if (startOctant == endOctant) -// { -// volumeType startOctantType -// = volumeType(nodeTypes_.get((nodeI<<3) + startOctant)); -// -// if -// ( -// startOctantType == INSIDE || startOctantType == OUTSIDE -// ) -// { -// //Info<< nodeI << " | " << start << " " << end << endl; -// return true; -// } -// } -// -// return false; -//} - - // Find first intersection template template diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H index eaa51c175d..83b773289b 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H @@ -319,13 +319,6 @@ private: const bool verbose = false ) const; -// bool isLineInsideOrOutside -// ( -// const label nodeI, -// const point& start, -// const point& end -// ) const; - //- Find any or nearest intersection of line between start and end. template pointIndexHit findLine @@ -549,19 +542,6 @@ public: const FindNearestOp& fnOp ) const; -// bool findAnyOverlap -// ( -// const point& sample, -// const scalar nearestDistSqr -// ) const; -// -// bool findAnyOverlap -// ( -// const label nodeI, -// const point& sample, -// const scalar nearestDistSqr -// ) const; - //- Low level: calculate nearest starting from subnode. template void findNearest From c2ff0a8779cfd25574b59d4700926b951efe8458 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 10 Jul 2013 12:29:40 +0100 Subject: [PATCH 3/6] ENH: addPatchCellLayer: additional checking --- .../polyTopoChange/addPatchCellLayer.C | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C index bc9b292aab..58d39bc3cf 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -848,6 +848,30 @@ void Foam::addPatchCellLayer::setRefinement } } + forAll(globalEdgeFaces, edgeI) + { + if (globalEdgeFaces[edgeI].size() > 2) + { + const edge& e = pp.edges()[edgeI]; + + if (nPointLayers[e[0]] > 0 || nPointLayers[e[1]] > 0) + { + FatalErrorIn + ( + "addPatchCellLayer::setRefinement" + "(const scalar, const indirectPrimitivePatch&" + ", const labelList&, const vectorField&, polyTopoChange&)" + ) << "Trying to extrude edge " + << e.line(pp.localPoints()) + << " which is non-manifold (has " + << globalEdgeFaces[edgeI].size() + << " faces using it)" + << abort(FatalError); + } + } + } + + const labelList& meshPoints = pp.meshPoints(); // Some storage for edge-face-addressing. From c2e3902e7a3f3dbb1640dad2571d7d79b9f17acc Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 10 Jul 2013 12:36:23 +0100 Subject: [PATCH 4/6] ENH: printStack: offsets are size_t --- src/OSspecific/POSIX/printStack.C | 10 +-- src/OpenFOAM/db/IOstreams/Sstreams/ReadHex.C | 76 +++++++++++++++++++ src/OpenFOAM/db/IOstreams/Sstreams/ReadHex.H | 63 +++++++++++++++ .../db/IOstreams/Sstreams/readHexLabel.C | 41 +--------- 4 files changed, 147 insertions(+), 43 deletions(-) create mode 100644 src/OpenFOAM/db/IOstreams/Sstreams/ReadHex.C create mode 100644 src/OpenFOAM/db/IOstreams/Sstreams/ReadHex.H diff --git a/src/OSspecific/POSIX/printStack.C b/src/OSspecific/POSIX/printStack.C index 4a3859dcae..d94451e5aa 100644 --- a/src/OSspecific/POSIX/printStack.C +++ b/src/OSspecific/POSIX/printStack.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,7 +28,7 @@ License #include "OStringStream.H" #include "OSspecific.H" #include "IFstream.H" -#include "readHexLabel.H" +#include "ReadHex.H" #include #include @@ -100,8 +100,8 @@ void printSourceFileAndLine unsigned long offset = ulong(info.dli_fbase); IStringStream addressStr(address.substr(2)); - label addressValue = readHexLabel(addressStr); - label relativeAddress = addressValue-offset; + long addressValue = ReadHex(addressStr); + long relativeAddress = addressValue-offset; // Reconstruct hex word from address OStringStream nStream; @@ -211,7 +211,7 @@ void error::printStack(Ostream& os) { string offsetString(line.substr(0, line.find('-'))); IStringStream offsetStr(offsetString); - addressMap.insert(libPath, readHexLabel(offsetStr)); + addressMap.insert(libPath, ReadHex