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

View File

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