From e939a6e0952ad4396833351c873991ca71fb3cb7 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 8 May 2013 11:39:21 +0100 Subject: [PATCH] ENH: mesh-to-mesh developments --- .../meshToMeshNew/meshToMeshNew.C | 81 ++++++++++--------- .../meshToMeshNew/meshToMeshNew.H | 7 +- .../meshToMeshNew/meshToMeshNewTemplates.C | 17 +++- 3 files changed, 62 insertions(+), 43 deletions(-) diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C index 27f0bd592c..48ac3f4aab 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C @@ -93,7 +93,6 @@ Foam::labelList Foam::meshToMeshNew::maskCells void Foam::meshToMeshNew::normaliseWeights ( const word& descriptor, - const scalarField& cellVolumes, const labelListList& addr, scalarListList& wght ) const @@ -102,27 +101,18 @@ void Foam::meshToMeshNew::normaliseWeights if (nCell > 0) { - scalar minW = GREAT; - scalar maxW = -GREAT; - forAll(wght, cellI) { scalarList& w = wght[cellI]; scalar s = sum(w); - scalar Vc = cellVolumes[cellI]; forAll(w, i) { - w[i] /= Vc; + // note: normalise by s instead of cell volume since + // 1-to-1 methods duplicate contributions in parallel + w[i] /= s; } - - minW = min(minW, s/Vc); - maxW = max(maxW, s/Vc); } - - Info<< " " << descriptor << " weights min/max = " - << returnReduce(minW, minOp()) << ", " - << returnReduce(maxW, maxOp()) << endl; } } @@ -303,7 +293,6 @@ void Foam::meshToMeshNew::calculate() normaliseWeights ( "source", - srcRegion_.cellVolumes(), srcToTgtCellAddr_, srcToTgtCellWght_ ); @@ -311,7 +300,6 @@ void Foam::meshToMeshNew::calculate() normaliseWeights ( "target", - tgtRegion_.cellVolumes(), tgtToSrcCellAddr_, tgtToSrcCellWght_ ); @@ -337,7 +325,6 @@ void Foam::meshToMeshNew::calculate() normaliseWeights ( "source", - srcRegion_.cellVolumes(), srcToTgtCellAddr_, srcToTgtCellWght_ ); @@ -345,7 +332,6 @@ void Foam::meshToMeshNew::calculate() normaliseWeights ( "target", - tgtRegion_.cellVolumes(), tgtToSrcCellAddr_, tgtToSrcCellWght_ ); @@ -461,6 +447,7 @@ Foam::meshToMeshNew::meshToMeshNew srcPatchID_(), tgtPatchID_(), patchAMIs_(), + cuttingPatches_(), srcToTgtCellAddr_(), tgtToSrcCellAddr_(), srcToTgtCellWght_(), @@ -476,34 +463,42 @@ Foam::meshToMeshNew::meshToMeshNew const polyBoundaryMesh& srcBM = src.boundaryMesh(); const polyBoundaryMesh& tgtBM = tgt.boundaryMesh(); - if (srcBM.size() != tgtBM.size()) - { - FatalErrorIn - ( - "Foam::meshToMeshNew::meshToMeshNew" - "(" - "const polyMesh&, " - "const polyMesh&, " - "const interpolationMethod&" - ")" - ) << "Source and target meshes are dissimiar:" << nl - << " Source patches: " << srcBM.size() << nl - << " Target patches: " << tgtBM.size() << exit(FatalError); - } - - DynamicList