From fd1fd164370d3cdb441f931d2cba90ffdc655bc5 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 16 Mar 2009 10:45:01 +0000 Subject: [PATCH 01/12] decomposed cyclics handling --- .../processor/processorPointPatchField.C | 54 +++++++++++++------ 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C index 02fb26d52c..1d34feed6a 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C @@ -100,15 +100,32 @@ void processorPointPatchField::initSwapAdd(Field& pField) const { if (Pstream::parRun()) { + // Get internal field into my point order Field pf(this->patchInternalField(pField)); - OPstream::write - ( - Pstream::blocking, - procPatch_.neighbProcNo(), - reinterpret_cast(pf.begin()), - pf.byteSize() - ); + // Normally points will be ordered same on both sides due to + // the point numbering by decomposePar. However this will not be + // the case for meshes changed in parallel. + + // Reorder into neighbour point order. Note that one side can have + // more or less points than other side if partically decomposed + // cyclics are present. + + const labelList& nbrPts = procPatch_.procPolyPatch().neighbPoints(); + + Field nbrf(this->size(), pTraits::zero); + + forAll(nbrPts, i) + { + label nbrPointI = nbrPts[i]; + if (nbrPointI >= 0 && nbrPointI < nbrf.size()) + { + nbrf[nbrPointI] = pf[i]; + } + } + + OPstream toNbr(Pstream::blocking, procPatch_.neighbProcNo()); + toNbr << nbrf; } } @@ -119,23 +136,26 @@ void processorPointPatchField::swapAdd(Field& pField) const if (Pstream::parRun()) { Field pnf(this->size()); + { + // We do not know the number of points on the other side + // so cannot use Pstream::read. + IPstream fromNbr + ( + Pstream::blocking, + procPatch_.neighbProcNo() + ); + fromNbr >> pnf; + } - IPstream::read - ( - Pstream::blocking, - procPatch_.neighbProcNo(), - reinterpret_cast(pnf.begin()), - pnf.byteSize() - ); + pnf.setSize(this->size(), pTraits::zero); if (doTransform()) { + const processorPolyPatch& ppp = procPatch_.procPolyPatch(); + const tensorField& forwardT = ppp.forwardT(); const labelList& nonGlobalPatchPoints = procPatch_.nonGlobalPatchPoints(); - - const processorPolyPatch& ppp = procPatch_.procPolyPatch(); const labelListList& pointFaces = ppp.pointFaces(); - const tensorField& forwardT = ppp.forwardT(); if (forwardT.size() == 1) { From f6a7d951245bcd3b5871e8d19d99bd263d31bfd2 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 16 Mar 2009 10:45:27 +0000 Subject: [PATCH 02/12] interpolation mesh objects --- .../test/volPointInterpolation/volPointInterpolationTest.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/applications/test/volPointInterpolation/volPointInterpolationTest.C b/applications/test/volPointInterpolation/volPointInterpolationTest.C index 07329ac349..d44dcf9fa4 100644 --- a/applications/test/volPointInterpolation/volPointInterpolationTest.C +++ b/applications/test/volPointInterpolation/volPointInterpolationTest.C @@ -68,8 +68,7 @@ int main(int argc, char *argv[]) mesh ); - pointMesh pMesh(mesh); - volPointInterpolation pInterp(mesh, pMesh); + const volPointInterpolation& pInterp = volPointInterpolation::New(mesh); pointScalarField pp(pInterp.interpolate(p)); pp.write(); From b60fc2b971be4a1c4792c79e58897051aa7a1641 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 16 Mar 2009 10:46:21 +0000 Subject: [PATCH 03/12] extraneous include files --- src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H | 1 - src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C | 1 - 2 files changed, 2 deletions(-) diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H index 83e7dd9c69..9ae910b5a7 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H @@ -38,7 +38,6 @@ SourceFiles #include "autoPtr.H" #include "dictionary.H" -#include "pointField.H" #include "boolList.H" #include "wallPoint.H" #include "searchableSurfaces.H" diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index aa7ecddf8b..905cf72f3e 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -29,7 +29,6 @@ Description #include "autoSnapDriver.H" #include "Time.H" -#include "pointFields.H" #include "motionSmoother.H" #include "polyTopoChange.H" #include "OFstream.H" From a760a63411116f4de580608a9000d2ac0d5ee61b Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 16 Mar 2009 10:46:48 +0000 Subject: [PATCH 04/12] outside orientation --- src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C b/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C index 9c06ccddea..856f2ba923 100644 --- a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C +++ b/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C @@ -193,7 +193,7 @@ void Foam::shellSurfaces::orient() if (hasSurface) { - const point outsidePt = 2 * overallBb.span(); + const point outsidePt = overallBb.max() + overallBb.span(); //Info<< "Using point " << outsidePt << " to orient shells" << endl; From f0bff1d658803ef4aedb24a5c89cbccb89d5519f Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 17 Mar 2009 19:58:06 +0000 Subject: [PATCH 05/12] compiler bug --- .../searchableSurface/triSurfaceMesh.C | 86 +++++++++++-------- .../searchableSurface/triSurfaceMesh.H | 8 ++ 2 files changed, 59 insertions(+), 35 deletions(-) diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.C b/src/meshTools/searchableSurface/triSurfaceMesh.C index 4703d69201..877f264341 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.C +++ b/src/meshTools/searchableSurface/triSurfaceMesh.C @@ -120,6 +120,29 @@ const Foam::fileName& Foam::triSurfaceMesh::checkFile } +bool Foam::triSurfaceMesh::addFaceToEdge +( + const edge& e, + EdgeMap