Commit c24035bc authored by andy's avatar andy
Browse files

ENH: Added utility functions

parent 6000d2fb
......@@ -28,6 +28,101 @@ License
#include "meshTools.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 * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
......@@ -634,52 +729,6 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::~AMIInterpolation()
// * * * * * * * * * * * * * * * 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>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
(
......
......@@ -91,6 +91,18 @@ public:
imFaceAreaWeight
};
//- Convert interpolationMethod to word representation
static word interpolationMethodToWord
(
const interpolationMethod& method
);
//- Convert word to interpolationMethod
static interpolationMethod wordTointerpolationMethod
(
const word& method
);
private:
......@@ -301,12 +313,6 @@ public:
// the AMI
label singlePatchProc() const;
//- Convert interpolationMethod to word representation
static word interpolationMethodToWord
(
const interpolationMethod& method
);
// Source patch
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment