mapFields, mapFieldsPar: Removed the subtract option and supporting complexity in meshToMesh0 and meshToMesh

The subtract option in mapFieldsPar was not implemented correctly and the
significant complexity in meshToMesh required to support it creates an
unwarranted maintenance overhead.  The equivalent functionality is now provided
by the more flexible, convenient and simpler subtract functionObject.
This commit is contained in:
Henry Weller
2022-03-15 23:21:32 +00:00
parent e9608d8f0f
commit 08b7a94452
18 changed files with 468 additions and 766 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,148 +33,11 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "fvMesh.H"
#include "surfaceMesh.H"
#include "mapMeshes.H"
#include "decompositionMethod.H"
#include "meshToMesh0.H"
#include "processorFvPatch.H"
#include "MapMeshes.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void mapConsistentMesh
(
const fvMesh& meshSource,
const fvMesh& meshTarget,
const meshToMesh0::order& mapOrder,
const bool subtract
)
{
if (subtract)
{
MapConsistentMesh<minusEqOp>
(
meshSource,
meshTarget,
mapOrder
);
}
else
{
MapConsistentMesh<eqOp>
(
meshSource,
meshTarget,
mapOrder
);
}
}
void mapSubMesh
(
const fvMesh& meshSource,
const fvMesh& meshTarget,
const HashTable<word>& patchMap,
const wordList& cuttingPatches,
const meshToMesh0::order& mapOrder,
const bool subtract
)
{
if (subtract)
{
MapSubMesh<minusEqOp>
(
meshSource,
meshTarget,
patchMap,
cuttingPatches,
mapOrder
);
}
else
{
MapSubMesh<eqOp>
(
meshSource,
meshTarget,
patchMap,
cuttingPatches,
mapOrder
);
}
}
void mapConsistentSubMesh
(
const fvMesh& meshSource,
const fvMesh& meshTarget,
const meshToMesh0::order& mapOrder,
const bool subtract
)
{
if (subtract)
{
MapConsistentSubMesh<minusEqOp>
(
meshSource,
meshTarget,
mapOrder
);
}
else
{
MapConsistentSubMesh<eqOp>
(
meshSource,
meshTarget,
mapOrder
);
}
}
wordList addProcessorPatches
(
const fvMesh& meshTarget,
const wordList& cuttingPatches
)
{
// Add the processor patches to the cutting list
HashTable<label> cuttingPatchTable;
forAll(cuttingPatches, i)
{
cuttingPatchTable.insert(cuttingPatches[i], i);
}
forAll(meshTarget.boundary(), patchi)
{
if (isA<processorFvPatch>(meshTarget.boundary()[patchi]))
{
if
(
!cuttingPatchTable.found
(
meshTarget.boundaryMesh()[patchi].name()
)
)
{
cuttingPatchTable.insert
(
meshTarget.boundaryMesh()[patchi].name(),
-1
);
}
}
}
return cuttingPatchTable.toc();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
@ -225,11 +88,6 @@ int main(int argc, char *argv[])
"word",
"specify the mapping method"
);
argList::addBoolOption
(
"subtract",
"subtract mapped source from target"
);
argList args(argc, argv);
@ -292,12 +150,6 @@ int main(int argc, char *argv[])
Info<< "Mapping method: " << mapMethod << endl;
}
const bool subtract = args.optionFound("subtract");
if (subtract)
{
Info<< "Subtracting mapped source field from target" << endl;
}
#include "createTimes.H"
@ -380,8 +232,7 @@ int main(int argc, char *argv[])
(
meshSource,
meshTarget,
mapOrder,
subtract
mapOrder
);
}
else
@ -392,8 +243,7 @@ int main(int argc, char *argv[])
meshTarget,
patchMap,
cuttingPatches,
mapOrder,
subtract
mapOrder
);
}
}
@ -455,8 +305,7 @@ int main(int argc, char *argv[])
(
meshSource,
meshTarget,
mapOrder,
subtract
mapOrder
);
}
else
@ -467,8 +316,7 @@ int main(int argc, char *argv[])
meshTarget,
patchMap,
addProcessorPatches(meshTarget, cuttingPatches),
mapOrder,
subtract
mapOrder
);
}
}
@ -567,8 +415,7 @@ int main(int argc, char *argv[])
(
meshSource,
meshTarget,
mapOrder,
subtract
mapOrder
);
}
else
@ -579,8 +426,7 @@ int main(int argc, char *argv[])
meshTarget,
patchMap,
addProcessorPatches(meshTarget, cuttingPatches),
mapOrder,
subtract
mapOrder
);
}
}
@ -621,7 +467,7 @@ int main(int argc, char *argv[])
if (consistent)
{
mapConsistentMesh(meshSource, meshTarget, mapOrder, subtract);
mapConsistentMesh(meshSource, meshTarget, mapOrder);
}
else
{
@ -631,8 +477,7 @@ int main(int argc, char *argv[])
meshTarget,
patchMap,
cuttingPatches,
mapOrder,
subtract
mapOrder
);
}
}