mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added utility functions
This commit is contained in:
@ -28,6 +28,101 @@ License
|
|||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
#include "mapDistribute.H"
|
#include "mapDistribute.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
Foam::word
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolationMethodToWord
|
||||||
|
(
|
||||||
|
const interpolationMethod& im
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word method = "unknown-interpolationMethod";
|
||||||
|
|
||||||
|
switch (im)
|
||||||
|
{
|
||||||
|
case imDirect:
|
||||||
|
{
|
||||||
|
method = "directAMI";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case imMapNearest:
|
||||||
|
{
|
||||||
|
method = "mapNearestAMI";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case imFaceAreaWeight:
|
||||||
|
{
|
||||||
|
method = "faceAreaWeightAMI";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"const Foam::word"
|
||||||
|
"Foam::AMIInterpolation<SourcePatch, TargetPatch>::"
|
||||||
|
"interpolationMethodToWord"
|
||||||
|
"("
|
||||||
|
"const interpolationMethod&"
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
<< "Unhandled interpolationMethod enumeration " << method
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
typename Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolationMethod
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::wordTointerpolationMethod
|
||||||
|
(
|
||||||
|
const word& im
|
||||||
|
)
|
||||||
|
{
|
||||||
|
interpolationMethod method = imDirect;
|
||||||
|
|
||||||
|
wordList methods
|
||||||
|
(
|
||||||
|
IStringStream("(directAMI mapNearestAMI faceAreaWeightAMI)")()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (im == "directAMI")
|
||||||
|
{
|
||||||
|
method = imDirect;
|
||||||
|
}
|
||||||
|
else if (im == "mapNearestAMI")
|
||||||
|
{
|
||||||
|
method = imMapNearest;
|
||||||
|
}
|
||||||
|
else if (im == "faceAreaWeightAMI")
|
||||||
|
{
|
||||||
|
method = imFaceAreaWeight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::AMIInterpolation<SourcePatch, TargetPatch>::"
|
||||||
|
"interpolationMethod"
|
||||||
|
"Foam::AMIInterpolation<SourcePatch, TargetPatch>::"
|
||||||
|
"wordTointerpolationMethod"
|
||||||
|
"("
|
||||||
|
"const word&"
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
<< "Invalid interpolationMethod " << im
|
||||||
|
<< ". Valid methods are:" << methods
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
template<class SourcePatch, class TargetPatch>
|
||||||
@ -634,52 +729,6 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::~AMIInterpolation()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
|
||||||
Foam::word
|
|
||||||
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolationMethodToWord
|
|
||||||
(
|
|
||||||
const interpolationMethod& im
|
|
||||||
)
|
|
||||||
{
|
|
||||||
word method = "unknown-interpolationMethod";
|
|
||||||
|
|
||||||
switch (im)
|
|
||||||
{
|
|
||||||
case imDirect:
|
|
||||||
{
|
|
||||||
method = "directAMI";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case imMapNearest:
|
|
||||||
{
|
|
||||||
method = "mapNearestAMI";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case imFaceAreaWeight:
|
|
||||||
{
|
|
||||||
method = "faceAreaWeightAMI";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"const Foam::word"
|
|
||||||
"Foam::AMIInterpolation<SourcePatch, TargetPatch>::"
|
|
||||||
"interpolationMethodToWord"
|
|
||||||
"("
|
|
||||||
"const interpolationMethod&"
|
|
||||||
") const"
|
|
||||||
)
|
|
||||||
<< "Unhandled interpolationMethod enumeration " << method
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
template<class SourcePatch, class TargetPatch>
|
||||||
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||||
(
|
(
|
||||||
|
|||||||
@ -91,6 +91,18 @@ public:
|
|||||||
imFaceAreaWeight
|
imFaceAreaWeight
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//- Convert interpolationMethod to word representation
|
||||||
|
static word interpolationMethodToWord
|
||||||
|
(
|
||||||
|
const interpolationMethod& method
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Convert word to interpolationMethod
|
||||||
|
static interpolationMethod wordTointerpolationMethod
|
||||||
|
(
|
||||||
|
const word& method
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -301,12 +313,6 @@ public:
|
|||||||
// the AMI
|
// the AMI
|
||||||
label singlePatchProc() const;
|
label singlePatchProc() const;
|
||||||
|
|
||||||
//- Convert interpolationMethod to word representation
|
|
||||||
static word interpolationMethodToWord
|
|
||||||
(
|
|
||||||
const interpolationMethod& method
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Source patch
|
// Source patch
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user