From e8a0078301d4799f16061ab6ce087c09d187af01 Mon Sep 17 00:00:00 2001 From: Danial Khazaei Date: Sat, 16 Feb 2019 00:44:11 +0330 Subject: [PATCH] [bugfix]: 64-bit label bugfix some how got overwritten by cfMesh update. --- .../utilities/containers/DynList/DynListI.H | 19 +++++++++++++++++++ .../decomposeCells/decomposeCellsPyramids.C | 6 ++++-- .../helperFunctionsGeometryQueriesI.H | 2 +- .../partTriMeshParallelAddressing.C | 2 +- .../utilities/octrees/meshOctree/meshOctree.C | 2 +- .../meshOctreeAutomaticRefinement.C | 2 +- .../meshOctreeCreatorCreateOctreeBoxes.C | 12 ++++++------ .../meshUntanglerCutRegionFaces.C | 4 ++-- .../edgeExtractor/edgeExtractor.C | 4 +--- 9 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/mesh/cfMesh/utilities/containers/DynList/DynListI.H b/src/mesh/cfMesh/utilities/containers/DynList/DynListI.H index 3692a12cd..a3728f895 100644 --- a/src/mesh/cfMesh/utilities/containers/DynList/DynListI.H +++ b/src/mesh/cfMesh/utilities/containers/DynList/DynListI.H @@ -150,6 +150,25 @@ inline Foam::DynList::DynList(const label s) # endif } + +#if WM_LABEL_SIZE == 64 +template +inline Foam::DynList::DynList(const int s) +: + dataPtr_(nullptr), + nAllocated_(0), + staticData_(), + nextFree_(0) +{ + setSize(s); + + # ifdef DEBUG + checkAllocation(); + # endif +} +#endif + + template inline Foam::DynList::DynList(const label s, const T& val) : diff --git a/src/mesh/cfMesh/utilities/decomposeCells/decomposeCellsPyramids.C b/src/mesh/cfMesh/utilities/decomposeCells/decomposeCellsPyramids.C index eff6ef4bf..16daf21ac 100644 --- a/src/mesh/cfMesh/utilities/decomposeCells/decomposeCellsPyramids.C +++ b/src/mesh/cfMesh/utilities/decomposeCells/decomposeCellsPyramids.C @@ -58,8 +58,10 @@ void decomposeCells::findAddressingForCell const faceListPMG& faces = mesh_.faces(); forAll(faceEdges, feI) { - faceEdges[feI].setSize(faces[c[feI]].size()); - faceEdges[feI] = -1; + DynList& fEdges = faceEdges[feI]; + + fEdges.setSize(faces[c[feI]].size()); + fEdges = label(-1); } forAll(c, fI) diff --git a/src/mesh/cfMesh/utilities/helperFunctions/helperFunctionsGeometryQueriesI.H b/src/mesh/cfMesh/utilities/helperFunctions/helperFunctionsGeometryQueriesI.H index fb7a7eda7..170876362 100644 --- a/src/mesh/cfMesh/utilities/helperFunctions/helperFunctionsGeometryQueriesI.H +++ b/src/mesh/cfMesh/utilities/helperFunctions/helperFunctionsGeometryQueriesI.H @@ -1221,7 +1221,7 @@ inline bool doTrianglesOverlap x /= (mag(x) + VSMALL); vector y = vec ^ x; - DynList poly2D(3); + DynList poly2D(label(3)); poly2D[0] = point2D((tri0.a() - origin) & x, (tri0.a() - origin) & y); poly2D[1] = point2D((tri0.b() - origin) & x, (tri0.b() - origin) & y); poly2D[2] = point2D((tri0.c() - origin) & x, (tri0.c() - origin) & y); diff --git a/src/mesh/cfMesh/utilities/meshes/partTriMesh/partTriMeshParallelAddressing.C b/src/mesh/cfMesh/utilities/meshes/partTriMesh/partTriMeshParallelAddressing.C index 14075472c..b4199e149 100644 --- a/src/mesh/cfMesh/utilities/meshes/partTriMesh/partTriMeshParallelAddressing.C +++ b/src/mesh/cfMesh/utilities/meshes/partTriMesh/partTriMeshParallelAddressing.C @@ -354,7 +354,7 @@ void partTriMesh::createBufferLayers() { const parTriFace& tri = receivedTrias[i]; - DynList triPointLabels(3); + DynList triPointLabels(label(3)); for(label j=0;j<3;++j) { const label gpI = tri.globalLabelOfPoint(j); diff --git a/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctree.C b/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctree.C index e34146e20..498f98d75 100644 --- a/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctree.C +++ b/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctree.C @@ -136,7 +136,7 @@ void meshOctree::setOctantVectorsAndPositions() //- set vrtLeavesPos_ for(label vrtI=0;vrtI<8;++vrtI) { - FixedList vc(0); + FixedList vc(label(0)); if( vrtI & 1 ) vc[0] += 1; diff --git a/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctreeAutomaticRefinement/meshOctreeAutomaticRefinement.C b/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctreeAutomaticRefinement/meshOctreeAutomaticRefinement.C index 28153aefa..c9ee5a5f5 100644 --- a/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctreeAutomaticRefinement/meshOctreeAutomaticRefinement.C +++ b/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctreeAutomaticRefinement/meshOctreeAutomaticRefinement.C @@ -138,7 +138,7 @@ void meshOctreeAutomaticRefinement::setMaxRefLevel() { finished = false; - const scalar lSize = size / pow(2, label(maxRefLevel_)); + const scalar lSize = size / pow(2.0, label(maxRefLevel_)); if( lSize < cs ) { diff --git a/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctreeCreator/meshOctreeCreatorCreateOctreeBoxes.C b/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctreeCreator/meshOctreeCreatorCreateOctreeBoxes.C index 45af48b60..257120620 100644 --- a/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctreeCreator/meshOctreeCreatorCreateOctreeBoxes.C +++ b/src/mesh/cfMesh/utilities/octrees/meshOctree/meshOctreeCreator/meshOctreeCreatorCreateOctreeBoxes.C @@ -87,12 +87,12 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters() { finished = false; - const scalar lSize = size / Foam::pow(2, label(globalRefLevel_)); + const scalar lSize = size / pow(label(2), label(globalRefLevel_)); if( lSize < (maxSize * (1.0-SMALL)) ) { const scalar bbSize = - 0.5 * maxSize * Foam::pow(2, label(globalRefLevel_)); + 0.5 * maxSize * pow(label(2), label(globalRefLevel_)); rootBox.max() = c + point(bbSize, bbSize, bbSize); rootBox.min() = c - point(bbSize, bbSize, bbSize); finished = true; @@ -136,7 +136,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters() { finished = false; - const scalar lSize = maxSize / Foam::pow(2, addLevel); + const scalar lSize = maxSize / Foam::pow(label(2), addLevel); if( lSize <= cs ) { @@ -233,7 +233,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters() { finished = false; - const scalar lSize = maxSize / Foam::pow(2, addLevel); + const scalar lSize = maxSize / Foam::pow(label(2), addLevel); if( lSize <= cs ) { @@ -311,7 +311,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters() { finished = false; - const scalar lSize = maxSize / Foam::pow(2, addLevel); + const scalar lSize = maxSize / Foam::pow(label(2), addLevel); if( lSize <= cs ) { @@ -383,7 +383,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters() { finished = false; - const scalar lSize = maxSize / Foam::pow(2, nLevel); + const scalar lSize = maxSize / Foam::pow(label(2), nLevel); if( lSize <= cs ) { diff --git a/src/mesh/cfMesh/utilities/smoothers/geometry/meshOptimizer/tetMeshOptimisation/advancedSmoothers/meshUntangler/meshUntanglerCutRegionFaces.C b/src/mesh/cfMesh/utilities/smoothers/geometry/meshOptimizer/tetMeshOptimisation/advancedSmoothers/meshUntangler/meshUntanglerCutRegionFaces.C index 83964742d..823fec41f 100644 --- a/src/mesh/cfMesh/utilities/smoothers/geometry/meshOptimizer/tetMeshOptimisation/advancedSmoothers/meshUntangler/meshUntanglerCutRegionFaces.C +++ b/src/mesh/cfMesh/utilities/smoothers/geometry/meshOptimizer/tetMeshOptimisation/advancedSmoothers/meshUntangler/meshUntanglerCutRegionFaces.C @@ -75,7 +75,7 @@ void meshUntangler::cutRegion::findNewFaces() << " consisting of edges " << f << endl; # endif - pointUsage = 0; + pointUsage = label(0); DynList newFace; @@ -147,7 +147,7 @@ void meshUntangler::cutRegion::findNewFaces() //- find edges which form the faceInPlane DynList edgeUsage; edgeUsage.setSize(cEdges.size()); - edgeUsage = 0; + edgeUsage = label(0); forAll(cFaces, fI) { const DynList& f = cFaces[fI]; diff --git a/src/mesh/cfMesh/utilities/surfaceTools/edgeExtraction/edgeExtractor/edgeExtractor.C b/src/mesh/cfMesh/utilities/surfaceTools/edgeExtraction/edgeExtractor/edgeExtractor.C index a97e3f6c4..957eb556c 100644 --- a/src/mesh/cfMesh/utilities/surfaceTools/edgeExtraction/edgeExtractor/edgeExtractor.C +++ b/src/mesh/cfMesh/utilities/surfaceTools/edgeExtraction/edgeExtractor/edgeExtractor.C @@ -29,8 +29,6 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" -#include "objectRegistry.H" -#include "foamTime.H" #include "polyMeshGenModifier.H" #include "edgeExtractor.H" #include "meshSurfaceEngine.H" @@ -1529,7 +1527,7 @@ bool edgeExtractor::checkConcaveEdgeCells() DynList nFacesInPatch; nFacesInPatch.setSize(2); - nFacesInPatch = 0; + nFacesInPatch = label(0); DynList hasPatchPoints; hasPatchPoints.setSize(2);