ENH: AMI - added profiling hooks

This commit is contained in:
Andrew Heather
2017-09-19 12:01:05 +01:00
committed by mattijs
parent 0af97856f1
commit dedde07d96
2 changed files with 33 additions and 8 deletions

View File

@ -28,6 +28,7 @@ License
#include "meshTools.H" #include "meshTools.H"
#include "mapDistribute.H" #include "mapDistribute.H"
#include "flipOp.H" #include "flipOp.H"
#include "profiling.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -128,10 +129,9 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::projectPointsToSurface
pointField& pts pointField& pts
) const ) const
{ {
if (debug) addProfiling(ami, "AMIInterpolation::projectPointsToSurface");
{
Info<< "AMI: projecting points to surface" << endl; DebugInfo<< "AMI: projecting points to surface" << endl;
}
List<pointIndexHit> nearInfo; List<pointIndexHit> nearInfo;
@ -148,8 +148,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::projectPointsToSurface
} }
else else
{ {
pts[i] = pts[i]; // Point remains unchanged
nMiss++; ++nMiss;
} }
} }
@ -176,6 +176,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
const scalar lowWeightTol const scalar lowWeightTol
) )
{ {
addProfiling(ami, "AMIInterpolation::normaliseWeights");
// Normalise the weights // Normalise the weights
wghtSum.setSize(wght.size(), 0.0); wghtSum.setSize(wght.size(), 0.0);
label nLowWeight = 0; label nLowWeight = 0;
@ -261,6 +263,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
autoPtr<mapDistribute>& tgtMap autoPtr<mapDistribute>& tgtMap
) )
{ {
addProfiling(ami, "AMIInterpolation::agglomerate");
label sourceCoarseSize = label sourceCoarseSize =
( (
sourceRestrictAddressing.size() sourceRestrictAddressing.size()
@ -357,7 +361,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
{ {
oldToNew[coarseElem] = newi; oldToNew[coarseElem] = newi;
newSubMap[newi] = coarseElem; newSubMap[newi] = coarseElem;
newi++; ++newi;
} }
} }
newSubMap.setSize(newi); newSubMap.setSize(newi);
@ -438,7 +442,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
oldToNew[coarseElem] = newi; oldToNew[coarseElem] = newi;
tgtCompactMap[fineElem] = compacti; tgtCompactMap[fineElem] = compacti;
newConstructMap[newi] = compacti++; newConstructMap[newi] = compacti++;
newi++; ++newi;
} }
else else
{ {
@ -864,6 +868,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
const TargetPatch& tgtPatch const TargetPatch& tgtPatch
) )
{ {
addProfiling(ami, "AMIInterpolation::update");
label srcTotalSize = returnReduce(srcPatch.size(), sumOp<label>()); label srcTotalSize = returnReduce(srcPatch.size(), sumOp<label>());
label tgtTotalSize = returnReduce(tgtPatch.size(), sumOp<label>()); label tgtTotalSize = returnReduce(tgtPatch.size(), sumOp<label>());
@ -1097,6 +1103,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::append
const TargetPatch& tgtPatch const TargetPatch& tgtPatch
) )
{ {
addProfiling(ami, "AMIInterpolation::append");
// Create a new interpolation // Create a new interpolation
autoPtr<AMIInterpolation<SourcePatch, TargetPatch>> newPtr autoPtr<AMIInterpolation<SourcePatch, TargetPatch>> newPtr
( (
@ -1311,6 +1319,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
const UList<Type>& defaultValues const UList<Type>& defaultValues
) const ) const
{ {
addProfiling(ami, "AMIInterpolation::interpolateToTarget");
if (fld.size() != srcAddress_.size()) if (fld.size() != srcAddress_.size())
{ {
FatalErrorInFunction FatalErrorInFunction
@ -1396,6 +1406,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
const UList<Type>& defaultValues const UList<Type>& defaultValues
) const ) const
{ {
addProfiling(ami, "AMIInterpolation::interpolateToSource");
if (fld.size() != tgtAddress_.size()) if (fld.size() != tgtAddress_.size())
{ {
FatalErrorInFunction FatalErrorInFunction

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faceAreaWeightAMI.H" #include "faceAreaWeightAMI.H"
#include "profiling.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
@ -38,6 +39,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
label tgtFacei label tgtFacei
) )
{ {
addProfiling(ami, "faceAreaWeightAMI::calcAddressing");
// construct weights and addressing // construct weights and addressing
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -123,6 +126,8 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
List<DynamicList<scalar>>& tgtWght List<DynamicList<scalar>>& tgtWght
) )
{ {
addProfiling(ami, "faceAreaWeightAMI::processSourceFace");
if (tgtStartFacei == -1) if (tgtStartFacei == -1)
{ {
return false; return false;
@ -188,6 +193,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
bool errorOnNotFound bool errorOnNotFound
) const ) const
{ {
addProfiling(ami, "faceAreaWeightAMI::setNextFaces");
const labelList& srcNbrFaces = this->srcPatch_.faceFaces()[srcFacei]; const labelList& srcNbrFaces = this->srcPatch_.faceFaces()[srcFacei];
// initialise tgtFacei // initialise tgtFacei
@ -298,6 +305,8 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
const label tgtFacei const label tgtFacei
) const ) const
{ {
addProfiling(ami, "faceAreaWeightAMI::interArea");
scalar area = 0; scalar area = 0;
const pointField& srcPoints = this->srcPatch_.points(); const pointField& srcPoints = this->srcPatch_.points();
@ -364,6 +373,8 @@ restartUncoveredSourceFace
List<DynamicList<scalar>>& tgtWght List<DynamicList<scalar>>& tgtWght
) )
{ {
addProfiling(ami, "faceAreaWeightAMI::restartUncoveredSourceFace");
// Collect all src faces with a low weight // Collect all src faces with a low weight
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -501,6 +512,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
label tgtFacei label tgtFacei
) )
{ {
addProfiling(ami, "faceAreaWeightAMI::calculate");
bool ok = bool ok =
this->initialise this->initialise
( (