mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: mapFields: expose AMI mapping methods
This commit is contained in:
@ -41,7 +41,8 @@ void mapConsistentMesh
|
||||
(
|
||||
const fvMesh& meshSource,
|
||||
const fvMesh& meshTarget,
|
||||
const meshToMesh::interpolationMethod& mapMethod,
|
||||
const word& mapMethod,
|
||||
const word& AMIMapMethod,
|
||||
const bool subtract,
|
||||
const HashSet<word>& selectedFields,
|
||||
const bool noLagrangian
|
||||
@ -50,7 +51,7 @@ void mapConsistentMesh
|
||||
Info<< nl << "Consistently creating and mapping fields for time "
|
||||
<< meshSource.time().timeName() << nl << endl;
|
||||
|
||||
meshToMesh interp(meshSource, meshTarget, mapMethod);
|
||||
meshToMesh interp(meshSource, meshTarget, mapMethod, AMIMapMethod);
|
||||
|
||||
if (subtract)
|
||||
{
|
||||
@ -79,7 +80,8 @@ void mapSubMesh
|
||||
const fvMesh& meshTarget,
|
||||
const HashTable<word>& patchMap,
|
||||
const wordList& cuttingPatches,
|
||||
const meshToMesh::interpolationMethod& mapMethod,
|
||||
const word& mapMethod,
|
||||
const word& AMIMapMethod,
|
||||
const bool subtract,
|
||||
const HashSet<word>& selectedFields,
|
||||
const bool noLagrangian
|
||||
@ -93,6 +95,7 @@ void mapSubMesh
|
||||
meshSource,
|
||||
meshTarget,
|
||||
mapMethod,
|
||||
AMIMapMethod,
|
||||
patchMap,
|
||||
cuttingPatches
|
||||
);
|
||||
@ -186,6 +189,12 @@ int main(int argc, char *argv[])
|
||||
"word",
|
||||
"specify the mapping method (direct|mapNearest|cellVolumeWeight)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"patchMapMethod",
|
||||
"word",
|
||||
"specify the patch mapping method (direct|mapNearest|faceAreaWeight)"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"subtract",
|
||||
@ -231,17 +240,50 @@ int main(int argc, char *argv[])
|
||||
|
||||
const bool consistent = args.optionFound("consistent");
|
||||
|
||||
meshToMesh::interpolationMethod mapMethod =
|
||||
meshToMesh::imCellVolumeWeight;
|
||||
|
||||
if (args.optionFound("mapMethod"))
|
||||
word mapMethod = meshToMesh::interpolationMethodNames_
|
||||
[
|
||||
meshToMesh::imCellVolumeWeight
|
||||
];
|
||||
|
||||
if (args.optionReadIfPresent("mapMethod", mapMethod))
|
||||
{
|
||||
mapMethod = meshToMesh::interpolationMethodNames_[args["mapMethod"]];
|
||||
|
||||
Info<< "Mapping method: "
|
||||
<< meshToMesh::interpolationMethodNames_[mapMethod] << endl;
|
||||
Info<< "Mapping method: " << mapMethod << endl;
|
||||
}
|
||||
|
||||
|
||||
word patchMapMethod;
|
||||
if (meshToMesh::interpolationMethodNames_.found(mapMethod))
|
||||
{
|
||||
// Lookup corresponding AMI method
|
||||
meshToMesh::interpolationMethod method =
|
||||
meshToMesh::interpolationMethodNames_[mapMethod];
|
||||
|
||||
patchMapMethod = AMIPatchToPatchInterpolation::interpolationMethodToWord
|
||||
(
|
||||
meshToMesh::interpolationMethodAMI(method)
|
||||
);
|
||||
}
|
||||
|
||||
// Optionally override
|
||||
if (args.optionFound("patchMapMethod"))
|
||||
{
|
||||
patchMapMethod = args["patchMapMethod"];
|
||||
|
||||
Info<< "Patch mapping method: " << patchMapMethod << endl;
|
||||
}
|
||||
|
||||
|
||||
if (patchMapMethod.empty())
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "No valid patchMapMethod for method " << mapMethod
|
||||
<< ". Please supply one through the 'patchMapMethod' option"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const bool subtract = args.optionFound("subtract");
|
||||
if (subtract)
|
||||
{
|
||||
@ -314,6 +356,7 @@ int main(int argc, char *argv[])
|
||||
meshSource,
|
||||
meshTarget,
|
||||
mapMethod,
|
||||
patchMapMethod,
|
||||
subtract,
|
||||
selectedFields,
|
||||
noLagrangian
|
||||
@ -328,6 +371,7 @@ int main(int argc, char *argv[])
|
||||
patchMap,
|
||||
addProcessorPatches(meshTarget, cuttingPatches),
|
||||
mapMethod,
|
||||
patchMapMethod,
|
||||
subtract,
|
||||
selectedFields,
|
||||
noLagrangian
|
||||
|
||||
Reference in New Issue
Block a user