From 6c577922c5453d4223796dbd8bbe9004c0d99c24 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 27 May 2011 18:17:39 +0100 Subject: [PATCH] Development branch merge --- .../processor/ProcessorPointPatchField.C | 46 +- src/OpenFOAM/graph/curve/curve.H | 1 + src/OpenFOAM/memory/autoPtr/autoPtr.H | 3 +- .../constraint/processor/processorPolyPatch.C | 71 +- .../autoHexMeshDriver/autoLayerDriver.C | 3 +- .../meshRefinement/meshRefinement.C | 2 +- .../fvMeshDistribute/CompactListList_dev.C | 257 -- .../fvMeshDistribute/CompactListList_dev.H | 270 -- .../fvMeshDistribute/CompactListList_devI.H | 276 -- .../fvMeshDistribute/CompactListList_devIO.C | 66 - .../fvMeshDistribute/fvMeshDistribute.C | 2346 ----------------- .../fvMeshDistribute/fvMeshDistribute.H | 368 --- .../fvMeshDistributeTemplates.C | 499 ---- .../edgeInterpolationScheme.C | 6 +- .../flowRateInletVelocityFvPatchVectorField.C | 6 +- .../CoEulerDdtScheme/CoEulerDdtScheme.C | 4 +- .../fvMesh/fvPatches/fvPatch/fvPatch.H | 5 +- ...ProcessorTetPolyPatchCellDecompPointAddr.C | 11 +- 18 files changed, 90 insertions(+), 4150 deletions(-) delete mode 100644 src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/CompactListList_dev.C delete mode 100644 src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/CompactListList_dev.H delete mode 100644 src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/CompactListList_devI.H delete mode 100644 src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/CompactListList_devIO.C delete mode 100644 src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/fvMeshDistribute.C delete mode 100644 src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/fvMeshDistribute.H delete mode 100644 src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/fvMeshDistributeTemplates.C diff --git a/src/OpenFOAM/fields/PointPatchFields/constraint/processor/ProcessorPointPatchField.C b/src/OpenFOAM/fields/PointPatchFields/constraint/processor/ProcessorPointPatchField.C index 677473247..b7835747d 100644 --- a/src/OpenFOAM/fields/PointPatchFields/constraint/processor/ProcessorPointPatchField.C +++ b/src/OpenFOAM/fields/PointPatchFields/constraint/processor/ProcessorPointPatchField.C @@ -466,9 +466,12 @@ initEvaluate const Pstream::commsTypes commsType ) { - if (this->isPointField()) + if (Pstream::parRun()) { - initAddFieldTempl(Pstream::blocking, this->internalField()); + if (this->isPointField()) + { + initAddFieldTempl(Pstream::blocking, this->internalField()); + } } } @@ -491,27 +494,30 @@ evaluate const Pstream::commsTypes commsType ) { - if (this->isPointField()) + if (Pstream::parRun()) { - // Get the neighbour side values - tmp > tpNeighbour = receivePointField(commsType); - Field& tpn = tpNeighbour(); - - if (doTransform()) + if (this->isPointField()) { - const processorPolyPatch& ppp = procPatch_.procPolyPatch(); - const tensorField& forwardT = ppp.forwardT(); + // Get the neighbour side values + tmp > tpNeighbour = receivePointField(commsType); + Field& tpn = tpNeighbour(); - transform(tpn, forwardT[0], tpn); + if (doTransform()) + { + const processorPolyPatch& ppp = procPatch_.procPolyPatch(); + const tensorField& forwardT = ppp.forwardT(); + + transform(tpn, forwardT[0], tpn); + } + + // Average over two sides + tpn = 0.5*(patchInternalField(this->internalField()) + tpn); + + // Get internal field to insert values into + Field& iF = const_cast&>(this->internalField()); + + this->setInInternalField(iF, tpn); } - - // Average over two sides - tpn = 0.5*(patchInternalField(this->internalField()) + tpn); - - // Get internal field to insert values into - Field& iF = const_cast&>(this->internalField()); - - this->setInInternalField(iF, tpn); } } @@ -697,7 +703,7 @@ initAddUpperLower { // Gather the data from the given field and send it. Note that the // size of the field is equal to the number of edges on the field - // and NOT the number of points. + // and NOT the number of points. HJ, 14/Nov/2001 // Get the addressing const labelList& me = procPatch_.localEdgeIndices(); diff --git a/src/OpenFOAM/graph/curve/curve.H b/src/OpenFOAM/graph/curve/curve.H index 31d81d3dc..3008f60c3 100644 --- a/src/OpenFOAM/graph/curve/curve.H +++ b/src/OpenFOAM/graph/curve/curve.H @@ -144,6 +144,7 @@ public: const scalarField& y ); + //- Create and return a clone autoPtr clone() const { return autoPtr(new curve(*this)); diff --git a/src/OpenFOAM/memory/autoPtr/autoPtr.H b/src/OpenFOAM/memory/autoPtr/autoPtr.H index fd5e6643c..a4dee6035 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtr.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtr.H @@ -95,7 +95,8 @@ public: // If object pointer already set issue a FatalError. inline void set(T*); - //- If object pointer already set, delete object and set to given pointer + //- If object pointer already set, delete object and set to + // given pointer inline void reset(T* = 0); //- If object pointer points to valid object: diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index 1d365aa09..a8e6fff36 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -182,7 +182,7 @@ void Foam::processorPolyPatch::calcGeometry() // Cache face areas const vectorField::subField localFaceAreas = faceAreas(); - forAll(faceNormals, facei) + forAll (faceNormals, facei) { scalar magSf = mag(localFaceAreas[facei]); scalar nbrMagSf = mag(neighbFaceAreas_[facei]); @@ -320,6 +320,10 @@ void Foam::processorPolyPatch::updateMesh() { // Note cannot predict exact size since opposite nPoints might // be different from one over here. + + // Disagree: This needs to be sorted out, so that processor patches + // are simply internal faces and treat cyclics separately + // HJ, 10/Mar/2011 IPstream fromNeighbProc(Pstream::blocking, neighbProcNo()); fromNeighbProc @@ -338,7 +342,7 @@ void Foam::processorPolyPatch::updateMesh() neighbPointsPtr_ = new labelList(nPoints(), -1); labelList& neighbPoints = *neighbPointsPtr_; - forAll(nbrPointFace, nbrPointI) + forAll (nbrPointFace, nbrPointI) { // Find face and index in face on this side. const face& f = localFaces()[nbrPointFace[nbrPointI]]; @@ -358,7 +362,7 @@ void Foam::processorPolyPatch::updateMesh() } // Reset all duplicate entries to -1. - forAll(neighbPoints, patchPointI) + forAll (neighbPoints, patchPointI) { if (neighbPoints[patchPointI] == -2) { @@ -372,7 +376,7 @@ void Foam::processorPolyPatch::updateMesh() neighbEdgesPtr_ = new labelList(nEdges(), -1); labelList& neighbEdges = *neighbEdgesPtr_; - forAll(nbrEdgeFace, nbrEdgeI) + forAll (nbrEdgeFace, nbrEdgeI) { // Find face and index in face on this side. const labelList& f = faceEdges()[nbrEdgeFace[nbrEdgeI]]; @@ -392,7 +396,7 @@ void Foam::processorPolyPatch::updateMesh() } // Reset all duplicate entries to -1. - forAll(neighbEdges, patchEdgeI) + forAll (neighbEdges, patchEdgeI) { if (neighbEdges[patchEdgeI] == -2) { @@ -414,6 +418,7 @@ const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const << "No extended addressing calculated for patch " << name() << abort(FatalError); } + return *neighbPointsPtr_; } @@ -426,6 +431,7 @@ const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const << "No extended addressing calculated for patch " << name() << abort(FatalError); } + return *neighbEdgesPtr_; } @@ -437,12 +443,13 @@ void Foam::processorPolyPatch::initOrder(const primitivePatch& pp) const return; } - const bool isMaster = Pstream::myProcNo() < neighbProcNo(); - - if (isMaster) + // Master side sends the data and slave side rotates the faces + // HJ, 10/Mar/2011 + if (owner()) { pointField ctrs(calcFaceCentres(pp, pp.points())); + // Anchor point is the start point of all faces. HJ, 10/Mar/2011 pointField anchors(getAnchorPoints(pp, pp.points())); // Now send all info over to the neighbour @@ -475,7 +482,7 @@ bool Foam::processorPolyPatch::order fileName nm ( boundaryMesh().mesh().time().path() - /name()+"_faces.obj" + /name() + "_faces.obj" ); Pout<< "processorPolyPatch::order : Writing my " << pp.size() << " faces to OBJ file " << nm << endl; @@ -493,7 +500,7 @@ bool Foam::processorPolyPatch::order << "Dumping " << ctrs.size() << " local faceCentres to " << localStr.name() << endl; - forAll(ctrs, faceI) + forAll (ctrs, faceI) { writeOBJ(localStr, ctrs[faceI]); } @@ -505,13 +512,11 @@ bool Foam::processorPolyPatch::order rotation.setSize(pp.size()); rotation = 0; - const bool isMaster = Pstream::myProcNo() < neighbProcNo(); - - if (isMaster) + if (owner()) { // Do nothing (i.e. identical mapping, zero rotation). // See comment at top. - forAll(faceMap, patchFaceI) + forAll (faceMap, patchFaceI) { faceMap[patchFaceI] = patchFaceI; } @@ -520,6 +525,7 @@ bool Foam::processorPolyPatch::order } else { + // Slave side: receive points vectorField masterCtrs; vectorField masterAnchors; @@ -543,10 +549,12 @@ bool Foam::processorPolyPatch::order boundaryMesh().mesh().time().path() /name() + "_nbrFaceCentres.obj" ); + Pout<< "processorPolyPatch::order : " << "Dumping neighbour faceCentres to " << nbrStr.name() << endl; - forAll(masterCtrs, faceI) + + forAll (masterCtrs, faceI) { writeOBJ(nbrStr, masterCtrs[faceI]); } @@ -585,12 +593,13 @@ bool Foam::processorPolyPatch::order if (v.size() == 1) { - transformedCtrs = masterCtrs-v[0]; + transformedCtrs = masterCtrs - v[0]; } else { - transformedCtrs = masterCtrs-v; + transformedCtrs = masterCtrs - v; } + matchedAll = matchPoints ( ctrs, @@ -624,6 +633,7 @@ bool Foam::processorPolyPatch::order { vectorField transformedCtrs = masterCtrs; transformList(forwardT(), transformedCtrs); + matchedAll = matchPoints ( ctrs, @@ -656,7 +666,7 @@ bool Foam::processorPolyPatch::order fileName str ( boundaryMesh().mesh().time().path() - /name()/name()+"_faces.obj" + /name()/name() + "_faces.obj" ); Pout<< "processorPolyPatch::order :" << " Writing faces to OBJ file " << str.name() << endl; @@ -675,7 +685,7 @@ bool Foam::processorPolyPatch::order label vertI = 0; - forAll(ctrs, faceI) + forAll (ctrs, faceI) { label masterFaceI = faceMap[faceI]; @@ -690,7 +700,8 @@ bool Foam::processorPolyPatch::order if (!matchedAll) { - SeriousErrorIn + FatalErrorIn +// SeriousErrorIn ( "processorPolyPatch::order(const primitivePatch&" ", labelList&, labelList&) const" @@ -703,13 +714,13 @@ bool Foam::processorPolyPatch::order << " multiple separated (from cyclics) processor patches" << endl << " Continuing with incorrect face ordering from now on!" - << endl; + << abort(FatalError); return false; } - // Set rotation. - forAll(faceMap, oldFaceI) + // Set rotation + forAll (faceMap, oldFaceI) { // The face f will be at newFaceI (after morphing) and we want its // anchorPoint (= f[0]) to align with the anchorpoint for the @@ -729,7 +740,8 @@ bool Foam::processorPolyPatch::order if (rotation[newFaceI] == -1) { - SeriousErrorIn + FatalErrorIn +// SeriousErrorIn ( "processorPolyPatch::order(const primitivePatch&" ", labelList&, labelList&) const" @@ -742,13 +754,13 @@ bool Foam::processorPolyPatch::order << " when matching the halves of processor patch " << name() << "Continuing with incorrect face ordering from now on!" - << endl; + << abort(FatalError); return false; } } - forAll(faceMap, faceI) + forAll (faceMap, faceI) { if (faceMap[faceI] != faceI || rotation[faceI] != 0) { @@ -768,10 +780,8 @@ void Foam::processorPolyPatch::syncOrder() const return; } - // Read and discard info from master side - const bool isMaster = Pstream::myProcNo() < neighbProcNo(); - - if (!isMaster) + // Read and discard info from owner side from the neighbour + if (neighbour()) { vectorField masterCtrs; vectorField masterAnchors; @@ -784,6 +794,7 @@ void Foam::processorPolyPatch::syncOrder() const } } + void Foam::processorPolyPatch::write(Ostream& os) const { polyPatch::write(os); diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 172205b05..f8fc6551d 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2975,7 +2975,8 @@ void Foam::autoLayerDriver::addLayers ); const_cast(mesh.time())++; - Info<< "Writing shrunk mesh to " << meshRefiner_.timeName() << endl; + Info<< "Writing shrunk mesh to " << meshRefiner_.timeName() + << endl; // See comment in autoSnapDriver why we should not remove meshPhi // using mesh.clearPout(). diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 1b2fd2043..3b661f455 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -1613,7 +1613,7 @@ Foam::label Foam::meshRefinement::addPatch fvBoundaryMesh& fvPatches = const_cast(mesh.boundary()); // Add polyPatch at the end - polyPatches.setSize(sz+1); + polyPatches.setSize(sz + 1); polyPatches.set ( sz, diff --git a/src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/CompactListList_dev.C b/src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/CompactListList_dev.C deleted file mode 100644 index 81e2d907b..000000000 --- a/src/dynamicMesh/dynamicMesh/directTopoChange/fvMeshDistribute/CompactListList_dev.C +++ /dev/null @@ -1,257 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright held by original author - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "CompactListList_dev.H" - -// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // - -template -Foam::CompactListList_dev::CompactListList_dev(const List& ll) -: - size_(ll.size()), - offsets_(ll.size()+1) -{ - label sumSize = 0; - offsets_[0] = 0; - forAll(ll, i) - { - sumSize += ll[i].size(); - offsets_[i+1] = sumSize; - } - - m_.setSize(sumSize); - - label k = 0; - forAll(ll, i) - { - const Container& lli = ll[i]; - - forAll(lli, j) - { - m_[k++] = lli[j]; - } - } -} - - -template -Foam::CompactListList_dev::CompactListList_dev -( - const UList