From 100f60654ebf3136d55a8419127442016df69ce3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Oct 2008 11:23:50 +0100 Subject: [PATCH 1/7] two argument constructor --- src/OpenFOAM/meshes/MeshObject/MeshObject.C | 20 ++++++++++++++++++++ src/OpenFOAM/meshes/MeshObject/MeshObject.H | 3 +++ 2 files changed, 23 insertions(+) diff --git a/src/OpenFOAM/meshes/MeshObject/MeshObject.C b/src/OpenFOAM/meshes/MeshObject/MeshObject.C index c089e0e531..fddfadfa59 100644 --- a/src/OpenFOAM/meshes/MeshObject/MeshObject.C +++ b/src/OpenFOAM/meshes/MeshObject/MeshObject.C @@ -83,6 +83,26 @@ const Type& Foam::MeshObject::New } +template +template +const Type& Foam::MeshObject::New +( + const Mesh& mesh, + const Data1& d1, + const Data2& d2 +) +{ + if (!mesh.db().objectRegistry::foundObject(Type::typeName)) + { + return store(new Type(mesh, d1, d2)); + } + else + { + return mesh.db().objectRegistry::lookupObject(Type::typeName); + } +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // template diff --git a/src/OpenFOAM/meshes/MeshObject/MeshObject.H b/src/OpenFOAM/meshes/MeshObject/MeshObject.H index 595f2f1df4..b142b47f96 100644 --- a/src/OpenFOAM/meshes/MeshObject/MeshObject.H +++ b/src/OpenFOAM/meshes/MeshObject/MeshObject.H @@ -72,6 +72,9 @@ public: template static const Type& New(const Mesh& mesh, const Data& d); + template + static const Type& New(const Mesh& mesh, const Data1&, const Data2&); + // Destructor From 42fbaffabfc0441f960d69fb9f5045928f173c48 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 15 Oct 2008 11:24:02 +0100 Subject: [PATCH 2/7] indexing errors --- .../searchableSurfaceWithGaps.C | 22 +++++++++++++++---- .../searchableSurfaceWithGaps.H | 2 ++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.C b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.C index f138daa7a4..50e851296b 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.C +++ b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.C @@ -232,9 +232,9 @@ void Foam::searchableSurfaceWithGaps::findLine // do we accept the hit. List plusInfo; - surface().findLine(start+offset0, end+offset0, plusInfo); + surface().findLine(compactStart+offset0, compactEnd+offset0, plusInfo); List minInfo; - surface().findLine(start-offset0, end-offset0, minInfo); + surface().findLine(compactStart-offset0, compactEnd-offset0, minInfo); // Extract any hits forAll(plusInfo, i) @@ -257,14 +257,28 @@ void Foam::searchableSurfaceWithGaps::findLine compactStart[i] = compactStart[mapI]; compactEnd[i] = compactEnd[mapI]; compactMap[i] = compactMap[mapI]; + offset0[i] = offset0[mapI]; + offset1[i] = offset1[mapI]; } compactStart.setSize(plusMissMap.size()); compactEnd.setSize(plusMissMap.size()); compactMap.setSize(plusMissMap.size()); + offset0.setSize(plusMissMap.size()); + offset1.setSize(plusMissMap.size()); - surface().findLine(start+offset1, end+offset1, plusInfo); - surface().findLine(start-offset1, end-offset1, minInfo); + surface().findLine + ( + compactStart+offset1, + compactEnd+offset1, + plusInfo + ); + surface().findLine + ( + compactStart-offset1, + compactEnd-offset1, + minInfo + ); // Extract any hits forAll(plusInfo, i) diff --git a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H index 1bdddb9706..a5392867f1 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H +++ b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H @@ -148,6 +148,8 @@ public: // Multiple point queries. + //- Find nearest on original surface. Note:does not use perturbation + // and hence might be inconsistent with intersections. virtual void findNearest ( const pointField& sample, From bbe1952b084a6e860563a4bcab0e650f084193ac Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 16 Oct 2008 12:30:58 +0100 Subject: [PATCH 3/7] extraneous parallel sync --- src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C | 4 ++-- src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index c181d2d5c1..a46c2f5d06 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -1280,8 +1280,8 @@ Foam::autoPtr Foam::fvMeshDistribute::receiveMesh domainMesh.boundaryMesh() ).ptr(); } - domainMesh.addFvPatches(patches); - + // Add patches; no parallel comms + domainMesh.addFvPatches(patches, false); // Construct zones List pZonePtrs(pointZoneNames.size()); diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C index 6ec5f6643e..2351ab9f8b 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C @@ -1330,7 +1330,7 @@ void Foam::fvMeshSubset::setLargeCellSubset // Add the fvPatches - fvMeshSubsetPtr_().addFvPatches(newBoundary); + fvMeshSubsetPtr_().addFvPatches(newBoundary, syncPar); // Subset and add any zones subsetZones(); From 242e53ed6e39c850818d9d6e1f031f15acdffc22 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 16 Oct 2008 12:31:59 +0100 Subject: [PATCH 4/7] distributed regions --- .../refinementSurfaces/refinementSurfaces.C | 48 +++++++------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C index 5f5d89c29a..2f23e9706c 100644 --- a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C +++ b/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C @@ -539,27 +539,6 @@ void Foam::refinementSurfaces::findHigherIntersection return; } - - // Precalculate per surface whether it has a minlevelfield - UPtrList minLevelFields(surfaces_.size()); - forAll(surfaces_, surfI) - { - const searchableSurface& geom = allGeometry_[surfaces_[surfI]]; - - if (isA(geom)) - { - const triSurfaceMesh& triMesh = refCast(geom); - minLevelFields.set - ( - surfI, - &const_cast - ( - triMesh.lookupObject("minLevel") - ) - ); - } - } - // Work arrays labelList hitMap(identity(start.size())); pointField p0(start); @@ -568,7 +547,21 @@ void Foam::refinementSurfaces::findHigherIntersection forAll(surfaces_, surfI) { - allGeometry_[surfaces_[surfI]].findLineAny(p0, p1, hitInfo); + const searchableSurface& geom = allGeometry_[surfaces_[surfI]]; + + geom.findLineAny(p0, p1, hitInfo); + + labelList minLevelField; + if (isA(geom)) + { + const triSurfaceMesh& triMesh = refCast(geom); + triMesh.getField + ( + "minLevel", + hitInfo, + minLevelField + ); + } // Copy all hits into arguments, continue with misses @@ -581,14 +574,9 @@ void Foam::refinementSurfaces::findHigherIntersection if (hitInfo[hitI].hit()) { // Check if minLevelField for this surface. - if - ( - minLevelFields.set(surfI) - && minLevelFields[surfI].size() > 0 - ) + if (minLevelField.size() > 0) { - minLocalLevel = - minLevelFields[surfI][hitInfo[hitI].index()]; + minLocalLevel = minLevelField[hitI]; } else { @@ -618,7 +606,7 @@ void Foam::refinementSurfaces::findHigherIntersection } // All done? Note that this decision should be synchronised - if (newI == 0) + if (returnReduce(newI, sumOp