From 13b1749d5e2b91f89aef32addecff69d0f5078dd Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 5 Sep 2011 17:34:39 +0100 Subject: [PATCH] STYLE: corrected/updated various comments/formatting --- .../AMIInterpolation/AMIInterpolation.C | 20 ++++---- .../mappedFixedInternalValueFvPatchField.C | 2 +- .../mapped/mappedPolyPatch/mappedPatchBase.C | 46 +++++++++++-------- .../mapped/mappedPolyPatch/mappedPatchBase.H | 13 ++++-- 4 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index a0bf7fc15f..031291cce7 100644 --- a/src/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -995,7 +995,7 @@ void Foam::AMIInterpolation::normaliseWeights scalar s = sum(wght[faceI]); wghtSum[faceI] = s; - scalar t = s/patch[faceI].mag(patch.points()); + scalar t = s/patch[faceI].mag(patch.localPoints()); if (t < minBound) { minBound = t; @@ -1309,9 +1309,11 @@ Foam::AMIInterpolation::interpolateToSource FatalErrorIn ( "AMIInterpolation::interpolateToSource(const Field) const" - ) << "Supplied field size is not equal to target patch size. " - << "Target patch = " << tgtAddress_.size() << ", supplied field = " - << fld.size() << abort(FatalError); + ) << "Supplied field size is not equal to target patch size" << nl + << " source patch = " << srcAddress_.size() << nl + << " target patch = " << tgtAddress_.size() << nl + << " supplied field = " << fld.size() + << abort(FatalError); } tmp > tresult @@ -1386,10 +1388,12 @@ Foam::AMIInterpolation::interpolateToTarget { FatalErrorIn ( - "AMIInterpolation::interpolateToSource(const Field&) const" - ) << "Supplied field size is not equal to source patch size. " - << "Source patch = " << srcAddress_.size() << ", supplied field = " - << fld.size() << abort(FatalError); + "AMIInterpolation::interpolateToTarget(const Field&) const" + ) << "Supplied field size is not equal to source patch size" << nl + << " source patch = " << srcAddress_.size() << nl + << " target patch = " << tgtAddress_.size() << nl + << " supplied field = " << fld.size() + << abort(FatalError); } tmp > tresult diff --git a/src/AMIInterpolation/patches/mapped/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C b/src/AMIInterpolation/patches/mapped/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C index 6acae6a705..7f0c0e6cd2 100644 --- a/src/AMIInterpolation/patches/mapped/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C +++ b/src/AMIInterpolation/patches/mapped/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C @@ -148,7 +148,7 @@ void Foam::mappedFixedInternalValueFvPatchField::updateCoeffs() } } - // Assign (this) patch internal field to its neighbour values + // Assign to (this) patch internal field its neighbour values Field& intFld = const_cast&>(this->internalField()); UIndirectList(intFld, this->patch().faceCells()) = nbrIntFld; } diff --git a/src/AMIInterpolation/patches/mapped/mappedPolyPatch/mappedPatchBase.C b/src/AMIInterpolation/patches/mapped/mappedPolyPatch/mappedPatchBase.C index bd5dce024f..ff39e152b8 100644 --- a/src/AMIInterpolation/patches/mapped/mappedPolyPatch/mappedPatchBase.C +++ b/src/AMIInterpolation/patches/mapped/mappedPolyPatch/mappedPatchBase.C @@ -672,7 +672,10 @@ Foam::mappedPatchBase::mappedPatchBase offsets_(pp.size(), offset_), distance_(0), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), - mapPtr_(NULL) + mapPtr_(NULL), + AMIPtr_(NULL), + surfPtr_(NULL), + surfDict_(dictionary::null) {} @@ -694,7 +697,10 @@ Foam::mappedPatchBase::mappedPatchBase offsets_(offsets), distance_(0), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), - mapPtr_(NULL) + mapPtr_(NULL), + AMIPtr_(NULL), + surfPtr_(NULL), + surfDict_(dictionary::null) {} @@ -716,7 +722,10 @@ Foam::mappedPatchBase::mappedPatchBase offsets_(0), distance_(0), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), - mapPtr_(NULL) + mapPtr_(NULL), + AMIPtr_(NULL), + surfPtr_(NULL), + surfDict_(dictionary::null) {} @@ -738,7 +747,10 @@ Foam::mappedPatchBase::mappedPatchBase offsets_(0), distance_(distance), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), - mapPtr_(NULL) + mapPtr_(NULL), + AMIPtr_(NULL), + surfPtr_(NULL), + surfDict_(dictionary::null) {} @@ -810,8 +822,8 @@ Foam::mappedPatchBase::mappedPatchBase ( "mappedPatchBase::mappedPatchBase\n" "(\n" - " const polyPatch& pp,\n" - " const dictionary& dict\n" + " const polyPatch&,\n" + " const dictionary&\n" ")\n", dict ) << "Please supply the offsetMode as one of " @@ -899,7 +911,7 @@ const Foam::polyPatch& Foam::mappedPatchBase::samplePolyPatch() const if (patchI == -1) { - FatalErrorIn("mappedPatchBase::samplePolyPatch() ") + FatalErrorIn("mappedPatchBase::samplePolyPatch()") << "Cannot find patch " << samplePatch_ << " in region " << sampleRegion_ << endl << "Valid patches are " << nbrMesh.boundaryMesh().names() @@ -915,20 +927,18 @@ Foam::tmp Foam::mappedPatchBase::samplePoints() const tmp tfld(new pointField(patch_.faceCentres())); pointField& fld = tfld(); - switch(offsetMode_) + switch (offsetMode_) { case UNIFORM: { fld += offset_; + break; } - break; - case NONUNIFORM: { fld += offsets_; + break; } - break; - case NORMAL: { // Get outwards pointing normal @@ -936,8 +946,8 @@ Foam::tmp Foam::mappedPatchBase::samplePoints() const n /= mag(n); fld += distance_*n; + break; } - break; } return tfld; @@ -956,27 +966,25 @@ void Foam::mappedPatchBase::write(Ostream& os) const os.writeKeyword("offsetMode") << offsetModeNames_[offsetMode_] << token::END_STATEMENT << nl; - switch(offsetMode_) + switch (offsetMode_) { case UNIFORM: { os.writeKeyword("offset") << offset_ << token::END_STATEMENT << nl; + break; } - break; - case NONUNIFORM: { os.writeKeyword("offsets") << offsets_ << token::END_STATEMENT << nl; + break; } - break; - case NORMAL: { os.writeKeyword("distance") << distance_ << token::END_STATEMENT << nl; + break; } - break; } } diff --git a/src/AMIInterpolation/patches/mapped/mappedPolyPatch/mappedPatchBase.H b/src/AMIInterpolation/patches/mapped/mappedPolyPatch/mappedPatchBase.H index 7d91ffb06d..4f5194a0a8 100644 --- a/src/AMIInterpolation/patches/mapped/mappedPolyPatch/mappedPatchBase.H +++ b/src/AMIInterpolation/patches/mapped/mappedPolyPatch/mappedPatchBase.H @@ -33,9 +33,12 @@ Description sampleRegion region0; // What to sample: - // - nearestCell : sample nearest cell - // - nearestPatchFace : nearest face on selected patch - // - nearestFace : nearest boundary face on any patch + // - nearestCell : sample nearest cell + // - nearestPatchFace : nearest face on selected patch + // - nearestPatchFaceAMI : nearest face on selected patch + - patches need not conform + - uses AMI interpolation + // - nearestFace : nearest boundary face on any patch sampleMode nearestCell; // If sampleMod is nearestPatchFace : patch to find faces of @@ -82,7 +85,7 @@ class polyMesh; class mapDistribute; /*---------------------------------------------------------------------------*\ - Class mappedPatchBase Declaration + Class mappedPatchBase Declaration \*---------------------------------------------------------------------------*/ class mappedPatchBase @@ -317,6 +320,7 @@ public: return offsets_; } + //- Wrapper around map/interpolate data distribution template void distribute(List& lst) const { @@ -342,6 +346,7 @@ public: { calcMapping(); } + return mapPtr_(); }