mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated meshToMesh to be able to use the new processorLOD
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -46,6 +46,7 @@ void mapConsistentMesh
|
|||||||
const fvMesh& meshTarget,
|
const fvMesh& meshTarget,
|
||||||
const word& mapMethod,
|
const word& mapMethod,
|
||||||
const word& AMIMapMethod,
|
const word& AMIMapMethod,
|
||||||
|
const word& procMapMethod,
|
||||||
const bool subtract,
|
const bool subtract,
|
||||||
const wordHashSet& selectedFields,
|
const wordHashSet& selectedFields,
|
||||||
const bool noLagrangian
|
const bool noLagrangian
|
||||||
@ -54,7 +55,14 @@ void mapConsistentMesh
|
|||||||
Info<< nl << "Consistently creating and mapping fields for time "
|
Info<< nl << "Consistently creating and mapping fields for time "
|
||||||
<< meshSource.time().timeName() << nl << endl;
|
<< meshSource.time().timeName() << nl << endl;
|
||||||
|
|
||||||
meshToMesh interp(meshSource, meshTarget, mapMethod, AMIMapMethod);
|
meshToMesh interp
|
||||||
|
(
|
||||||
|
meshSource,
|
||||||
|
meshTarget,
|
||||||
|
mapMethod,
|
||||||
|
AMIMapMethod,
|
||||||
|
meshToMesh::procMapMethodNames_[procMapMethod]
|
||||||
|
);
|
||||||
|
|
||||||
if (subtract)
|
if (subtract)
|
||||||
{
|
{
|
||||||
@ -85,6 +93,7 @@ void mapSubMesh
|
|||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
const word& mapMethod,
|
const word& mapMethod,
|
||||||
const word& AMIMapMethod,
|
const word& AMIMapMethod,
|
||||||
|
const word& procMapMethod,
|
||||||
const bool subtract,
|
const bool subtract,
|
||||||
const wordHashSet& selectedFields,
|
const wordHashSet& selectedFields,
|
||||||
const bool noLagrangian
|
const bool noLagrangian
|
||||||
@ -100,7 +109,8 @@ void mapSubMesh
|
|||||||
mapMethod,
|
mapMethod,
|
||||||
AMIMapMethod,
|
AMIMapMethod,
|
||||||
patchMap,
|
patchMap,
|
||||||
cuttingPatches
|
cuttingPatches,
|
||||||
|
meshToMesh::procMapMethodNames_[procMapMethod]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (subtract)
|
if (subtract)
|
||||||
@ -171,6 +181,12 @@ int main(int argc, char *argv[])
|
|||||||
"word",
|
"word",
|
||||||
"specify the patch mapping method (direct|mapNearest|faceAreaWeight)"
|
"specify the patch mapping method (direct|mapNearest|faceAreaWeight)"
|
||||||
);
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"procMapMethod",
|
||||||
|
"word",
|
||||||
|
"specify the processor distribution map method (AABB|LOD)"
|
||||||
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"subtract",
|
"subtract",
|
||||||
@ -217,7 +233,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
word mapMethod = meshToMesh::interpolationMethodNames_
|
word mapMethod = meshToMesh::interpolationMethodNames_
|
||||||
[
|
[
|
||||||
meshToMesh::imCellVolumeWeight
|
meshToMesh::interpolationMethod::imCellVolumeWeight
|
||||||
];
|
];
|
||||||
|
|
||||||
if (args.readIfPresent("mapMethod", mapMethod))
|
if (args.readIfPresent("mapMethod", mapMethod))
|
||||||
@ -225,7 +241,6 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Mapping method: " << mapMethod << endl;
|
Info<< "Mapping method: " << mapMethod << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
word patchMapMethod;
|
word patchMapMethod;
|
||||||
if (meshToMesh::interpolationMethodNames_.found(mapMethod))
|
if (meshToMesh::interpolationMethodNames_.found(mapMethod))
|
||||||
{
|
{
|
||||||
@ -233,12 +248,25 @@ int main(int argc, char *argv[])
|
|||||||
meshToMesh::interpolationMethod method =
|
meshToMesh::interpolationMethod method =
|
||||||
meshToMesh::interpolationMethodNames_[mapMethod];
|
meshToMesh::interpolationMethodNames_[mapMethod];
|
||||||
|
|
||||||
patchMapMethod = AMIPatchToPatchInterpolation::interpolationMethodNames_
|
patchMapMethod =
|
||||||
|
AMIPatchToPatchInterpolation::interpolationMethodNames_
|
||||||
[
|
[
|
||||||
meshToMesh::interpolationMethodAMI(method)
|
meshToMesh::interpolationMethodAMI(method)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
word procMapMethod =
|
||||||
|
meshToMesh::procMapMethodNames_
|
||||||
|
[
|
||||||
|
meshToMesh::procMapMethod::pmAABB
|
||||||
|
];
|
||||||
|
|
||||||
|
if (args.readIfPresent("prcoMapMethod", procMapMethod))
|
||||||
|
{
|
||||||
|
Info<< "Processor map method: " << procMapMethod << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Optionally override
|
// Optionally override
|
||||||
if (args.readIfPresent("patchMapMethod", patchMapMethod))
|
if (args.readIfPresent("patchMapMethod", patchMapMethod))
|
||||||
{
|
{
|
||||||
@ -325,6 +353,7 @@ int main(int argc, char *argv[])
|
|||||||
meshTarget,
|
meshTarget,
|
||||||
mapMethod,
|
mapMethod,
|
||||||
patchMapMethod,
|
patchMapMethod,
|
||||||
|
procMapMethod,
|
||||||
subtract,
|
subtract,
|
||||||
selectedFields,
|
selectedFields,
|
||||||
noLagrangian
|
noLagrangian
|
||||||
@ -340,6 +369,7 @@ int main(int argc, char *argv[])
|
|||||||
cuttingPatches,
|
cuttingPatches,
|
||||||
mapMethod,
|
mapMethod,
|
||||||
patchMapMethod,
|
patchMapMethod,
|
||||||
|
procMapMethod,
|
||||||
subtract,
|
subtract,
|
||||||
selectedFields,
|
selectedFields,
|
||||||
noLagrangian
|
noLagrangian
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -65,10 +65,17 @@ void Foam::fv::interRegionOption::setMapper()
|
|||||||
(
|
(
|
||||||
mesh_,
|
mesh_,
|
||||||
nbrMesh,
|
nbrMesh,
|
||||||
meshToMesh::interpolationMethodNames_.lookup
|
meshToMesh::interpolationMethodNames_.lookupOrDefault
|
||||||
(
|
(
|
||||||
"interpolationMethod",
|
"interpolationMethod",
|
||||||
coeffs_
|
coeffs_,
|
||||||
|
meshToMesh::interpolationMethod::imCellVolumeWeight
|
||||||
|
),
|
||||||
|
meshToMesh::procMapMethodNames_.lookupOrDefault
|
||||||
|
(
|
||||||
|
"procMapMethod",
|
||||||
|
coeffs_,
|
||||||
|
meshToMesh::procMapMethod::pmAABB
|
||||||
),
|
),
|
||||||
false // not interpolating patches
|
false // not interpolating patches
|
||||||
)
|
)
|
||||||
|
|||||||
@ -784,9 +784,10 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
|
|||||||
(
|
(
|
||||||
srcMesh,
|
srcMesh,
|
||||||
tgtMesh,
|
tgtMesh,
|
||||||
meshToMesh::imCellVolumeWeight,
|
meshToMesh::interpolationMethod::imCellVolumeWeight,
|
||||||
HashTable<word>(0), // patchMap,
|
HashTable<word>(0), // patchMap,
|
||||||
wordList(0), // cuttingPatches
|
wordList(0), // cuttingPatches
|
||||||
|
meshToMesh::procMapMethod::pmAABB,
|
||||||
false // do not normalise
|
false // do not normalise
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -84,7 +84,14 @@ bool Foam::meshToMeshMethod::intersect
|
|||||||
|
|
||||||
tetOverlapVolume overlapEngine;
|
tetOverlapVolume overlapEngine;
|
||||||
|
|
||||||
treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]);
|
// Note: avoid demand-driven construction of cellPoints
|
||||||
|
// treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]);
|
||||||
|
const UList<label>& cellFaces = tgt_.cells()[tgtCelli];
|
||||||
|
treeBoundBox bbTgtCell(tgt_.points(), tgt_.faces()[cellFaces[0]]);
|
||||||
|
for (label i = 1; i < cellFaces.size(); ++i)
|
||||||
|
{
|
||||||
|
bbTgtCell.add(tgt_.points(), tgt_.faces()[cellFaces[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
return overlapEngine.cellCellOverlapMinDecomp
|
return overlapEngine.cellCellOverlapMinDecomp
|
||||||
(
|
(
|
||||||
@ -106,7 +113,14 @@ Foam::scalar Foam::meshToMeshMethod::interVol
|
|||||||
{
|
{
|
||||||
tetOverlapVolume overlapEngine;
|
tetOverlapVolume overlapEngine;
|
||||||
|
|
||||||
treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]);
|
// Note: avoid demand-driven construction of cellPoints
|
||||||
|
// treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]);
|
||||||
|
const UList<label>& cellFaces = tgt_.cells()[tgtCelli];
|
||||||
|
treeBoundBox bbTgtCell(tgt_.points(), tgt_.faces()[cellFaces[0]]);
|
||||||
|
for (label i = 1; i < cellFaces.size(); ++i)
|
||||||
|
{
|
||||||
|
bbTgtCell.add(tgt_.points(), tgt_.faces()[cellFaces[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
scalar vol = overlapEngine.cellCellOverlapVolumeMinDecomp
|
scalar vol = overlapEngine.cellCellOverlapVolumeMinDecomp
|
||||||
(
|
(
|
||||||
@ -124,21 +138,28 @@ Foam::scalar Foam::meshToMeshMethod::interVol
|
|||||||
Foam::Tuple2<Foam::scalar, Foam::point>
|
Foam::Tuple2<Foam::scalar, Foam::point>
|
||||||
Foam::meshToMeshMethod::interVolAndCentroid
|
Foam::meshToMeshMethod::interVolAndCentroid
|
||||||
(
|
(
|
||||||
const label srcCellI,
|
const label srcCelli,
|
||||||
const label tgtCellI
|
const label tgtCelli
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
tetOverlapVolume overlapEngine;
|
tetOverlapVolume overlapEngine;
|
||||||
|
|
||||||
treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCellI]);
|
// Note: avoid demand-driven construction of cellPoints
|
||||||
|
// treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]);
|
||||||
|
const UList<label>& cellFaces = tgt_.cells()[tgtCelli];
|
||||||
|
treeBoundBox bbTgtCell(tgt_.points(), tgt_.faces()[cellFaces[0]]);
|
||||||
|
for (label i = 1; i < cellFaces.size(); ++i)
|
||||||
|
{
|
||||||
|
bbTgtCell.add(tgt_.points(), tgt_.faces()[cellFaces[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
Tuple2<scalar, point> volAndInertia =
|
Tuple2<scalar, point> volAndInertia =
|
||||||
overlapEngine.cellCellOverlapMomentMinDecomp
|
overlapEngine.cellCellOverlapMomentMinDecomp
|
||||||
(
|
(
|
||||||
src_,
|
src_,
|
||||||
srcCellI,
|
srcCelli,
|
||||||
tgt_,
|
tgt_,
|
||||||
tgtCellI,
|
tgtCelli,
|
||||||
bbTgtCell
|
bbTgtCell
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -52,6 +52,17 @@ Foam::meshToMesh::interpolationMethodNames_
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::meshToMesh::procMapMethod
|
||||||
|
>
|
||||||
|
Foam::meshToMesh::procMapMethodNames_
|
||||||
|
{
|
||||||
|
{ procMapMethod::pmAABB, "AABB" },
|
||||||
|
{ procMapMethod::pmLOD, "LOD" },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
@ -628,18 +639,18 @@ Foam::meshToMesh::interpolationMethodAMI(const interpolationMethod method)
|
|||||||
{
|
{
|
||||||
switch (method)
|
switch (method)
|
||||||
{
|
{
|
||||||
case imDirect:
|
case interpolationMethod::imDirect:
|
||||||
{
|
{
|
||||||
return AMIPatchToPatchInterpolation::imDirect;
|
return AMIPatchToPatchInterpolation::imDirect;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case imMapNearest:
|
case interpolationMethod::imMapNearest:
|
||||||
{
|
{
|
||||||
return AMIPatchToPatchInterpolation::imMapNearest;
|
return AMIPatchToPatchInterpolation::imMapNearest;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case imCellVolumeWeight:
|
case interpolationMethod::imCellVolumeWeight:
|
||||||
case imCorrectedCellVolumeWeight:
|
case interpolationMethod::imCorrectedCellVolumeWeight:
|
||||||
{
|
{
|
||||||
return AMIPatchToPatchInterpolation::imFaceAreaWeight;
|
return AMIPatchToPatchInterpolation::imFaceAreaWeight;
|
||||||
break;
|
break;
|
||||||
@ -647,7 +658,7 @@ Foam::meshToMesh::interpolationMethodAMI(const interpolationMethod method)
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Unhandled enumeration " << method
|
<< "Unhandled enumeration " << interpolationMethodNames_[method]
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -827,11 +838,13 @@ Foam::meshToMesh::meshToMesh
|
|||||||
const polyMesh& src,
|
const polyMesh& src,
|
||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const interpolationMethod& method,
|
const interpolationMethod& method,
|
||||||
|
const procMapMethod& mapMethod,
|
||||||
bool interpAllPatches
|
bool interpAllPatches
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
srcRegion_(src),
|
srcRegion_(src),
|
||||||
tgtRegion_(tgt),
|
tgtRegion_(tgt),
|
||||||
|
procMapMethod_(mapMethod),
|
||||||
srcPatchID_(),
|
srcPatchID_(),
|
||||||
tgtPatchID_(),
|
tgtPatchID_(),
|
||||||
patchAMIs_(),
|
patchAMIs_(),
|
||||||
@ -865,11 +878,13 @@ Foam::meshToMesh::meshToMesh
|
|||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const word& methodName,
|
const word& methodName,
|
||||||
const word& AMIMethodName,
|
const word& AMIMethodName,
|
||||||
|
const procMapMethod& mapMethod,
|
||||||
bool interpAllPatches
|
bool interpAllPatches
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
srcRegion_(src),
|
srcRegion_(src),
|
||||||
tgtRegion_(tgt),
|
tgtRegion_(tgt),
|
||||||
|
procMapMethod_(mapMethod),
|
||||||
srcPatchID_(),
|
srcPatchID_(),
|
||||||
tgtPatchID_(),
|
tgtPatchID_(),
|
||||||
patchAMIs_(),
|
patchAMIs_(),
|
||||||
@ -896,11 +911,13 @@ Foam::meshToMesh::meshToMesh
|
|||||||
const interpolationMethod& method,
|
const interpolationMethod& method,
|
||||||
const HashTable<word>& patchMap,
|
const HashTable<word>& patchMap,
|
||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
|
const procMapMethod& mapMethod,
|
||||||
const bool normalise
|
const bool normalise
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
srcRegion_(src),
|
srcRegion_(src),
|
||||||
tgtRegion_(tgt),
|
tgtRegion_(tgt),
|
||||||
|
procMapMethod_(mapMethod),
|
||||||
srcPatchID_(),
|
srcPatchID_(),
|
||||||
tgtPatchID_(),
|
tgtPatchID_(),
|
||||||
patchAMIs_(),
|
patchAMIs_(),
|
||||||
@ -936,11 +953,13 @@ Foam::meshToMesh::meshToMesh
|
|||||||
const word& AMIMethodName, // boundary mapping
|
const word& AMIMethodName, // boundary mapping
|
||||||
const HashTable<word>& patchMap,
|
const HashTable<word>& patchMap,
|
||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
|
const procMapMethod& mapMethod,
|
||||||
const bool normalise
|
const bool normalise
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
srcRegion_(src),
|
srcRegion_(src),
|
||||||
tgtRegion_(tgt),
|
tgtRegion_(tgt),
|
||||||
|
procMapMethod_(mapMethod),
|
||||||
srcPatchID_(),
|
srcPatchID_(),
|
||||||
tgtPatchID_(),
|
tgtPatchID_(),
|
||||||
patchAMIs_(),
|
patchAMIs_(),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
// Public data types
|
// Public data types
|
||||||
|
|
||||||
//- Enumeration specifying interpolation method
|
//- Enumeration specifying interpolation method
|
||||||
enum interpolationMethod
|
enum class interpolationMethod
|
||||||
{
|
{
|
||||||
imDirect,
|
imDirect,
|
||||||
imMapNearest,
|
imMapNearest,
|
||||||
@ -76,6 +76,15 @@ public:
|
|||||||
|
|
||||||
static const Enum<interpolationMethod> interpolationMethodNames_;
|
static const Enum<interpolationMethod> interpolationMethodNames_;
|
||||||
|
|
||||||
|
//- Enumeration specifying processor parallel map construction method
|
||||||
|
enum class procMapMethod
|
||||||
|
{
|
||||||
|
pmAABB,
|
||||||
|
pmLOD
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Enum<procMapMethod> procMapMethodNames_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
@ -86,6 +95,9 @@ private:
|
|||||||
//- Reference to the target mesh
|
//- Reference to the target mesh
|
||||||
const polyMesh& tgtRegion_;
|
const polyMesh& tgtRegion_;
|
||||||
|
|
||||||
|
//- Processor parallel map construction method
|
||||||
|
procMapMethod procMapMethod_;
|
||||||
|
|
||||||
//- List of target patch IDs per source patch (local index)
|
//- List of target patch IDs per source patch (local index)
|
||||||
List<label> srcPatchID_;
|
List<label> srcPatchID_;
|
||||||
|
|
||||||
@ -301,6 +313,7 @@ public:
|
|||||||
const polyMesh& src,
|
const polyMesh& src,
|
||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const interpolationMethod& method,
|
const interpolationMethod& method,
|
||||||
|
const procMapMethod& mapMethod = procMapMethod::pmAABB,
|
||||||
const bool interpAllPatches = true
|
const bool interpAllPatches = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -311,6 +324,7 @@ public:
|
|||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const word& methodName, // internal mapping
|
const word& methodName, // internal mapping
|
||||||
const word& AMIMethodName, // boundary mapping
|
const word& AMIMethodName, // boundary mapping
|
||||||
|
const procMapMethod& mapMethod = procMapMethod::pmAABB,
|
||||||
const bool interpAllPatches = true
|
const bool interpAllPatches = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -322,6 +336,7 @@ public:
|
|||||||
const interpolationMethod& method,
|
const interpolationMethod& method,
|
||||||
const HashTable<word>& patchMap,
|
const HashTable<word>& patchMap,
|
||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
|
const procMapMethod& mapMethod = procMapMethod::pmAABB,
|
||||||
const bool normalise = true
|
const bool normalise = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -335,6 +350,7 @@ public:
|
|||||||
const word& AMIMethodName, // boundary mapping
|
const word& AMIMethodName, // boundary mapping
|
||||||
const HashTable<word>& patchMap,
|
const HashTable<word>& patchMap,
|
||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
|
const procMapMethod& mapMethod = procMapMethod::pmAABB,
|
||||||
const bool normalise = true
|
const bool normalise = true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,6 +31,7 @@ License
|
|||||||
#include "processorPolyPatch.H"
|
#include "processorPolyPatch.H"
|
||||||
#include "SubField.H"
|
#include "SubField.H"
|
||||||
#include "AABBTree.H"
|
#include "AABBTree.H"
|
||||||
|
#include "cellBox.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -98,12 +99,12 @@ Foam::label Foam::meshToMesh::calcOverlappingProcs
|
|||||||
{
|
{
|
||||||
const treeBoundBoxList& bbp = procBb[proci];
|
const treeBoundBoxList& bbp = procBb[proci];
|
||||||
|
|
||||||
forAll(bbp, bbi)
|
for (const treeBoundBox& b : bbp)
|
||||||
{
|
{
|
||||||
if (bbp[bbi].overlaps(bb))
|
if (b.overlaps(bb))
|
||||||
{
|
{
|
||||||
overlaps[proci] = true;
|
overlaps[proci] = true;
|
||||||
nOverlaps++;
|
++nOverlaps;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,6 +120,37 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
|||||||
const polyMesh& tgt
|
const polyMesh& tgt
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
switch (procMapMethod_)
|
||||||
|
{
|
||||||
|
case procMapMethod::pmLOD:
|
||||||
|
{
|
||||||
|
Info<< "meshToMesh: Using processorLOD method" << endl;
|
||||||
|
|
||||||
|
// Create processor map of overlapping faces. This map gets
|
||||||
|
// (possibly remote) cells from the tgt mesh such that they
|
||||||
|
// (together) cover all of the src mesh
|
||||||
|
label nGlobalSrcCells =
|
||||||
|
returnReduce(src.cells().size(), sumOp<label>());
|
||||||
|
label cellsPerBox = max(1, 0.001*nGlobalSrcCells);
|
||||||
|
typename processorLODs::cellBox boxLOD
|
||||||
|
(
|
||||||
|
src.cells(),
|
||||||
|
src.faces(),
|
||||||
|
src.points(),
|
||||||
|
tgt.cells(),
|
||||||
|
tgt.faces(),
|
||||||
|
tgt.points(),
|
||||||
|
cellsPerBox,
|
||||||
|
src.nCells()
|
||||||
|
);
|
||||||
|
|
||||||
|
return boxLOD.map();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Info<< "meshToMesh: Using AABBTree method" << endl;
|
||||||
|
|
||||||
// get decomposition of cells on src mesh
|
// get decomposition of cells on src mesh
|
||||||
List<treeBoundBoxList> procBb(Pstream::nProcs());
|
List<treeBoundBoxList> procBb(Pstream::nProcs());
|
||||||
|
|
||||||
@ -170,7 +202,8 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
|||||||
dynSendMap[proci].setCapacity(iniSize);
|
dynSendMap[proci].setCapacity(iniSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// work array - whether src processor bb overlaps the tgt cell bounds
|
// work array - whether src processor bb overlaps the tgt cell
|
||||||
|
// bounds
|
||||||
boolList procBbOverlaps(Pstream::nProcs());
|
boolList procBbOverlaps(Pstream::nProcs());
|
||||||
forAll(cells, celli)
|
forAll(cells, celli)
|
||||||
{
|
{
|
||||||
@ -210,16 +243,19 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
|||||||
// debug printing
|
// debug printing
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "Of my " << cells.size() << " target cells I need to send to:"
|
Pout<< "Of my " << cells.size()
|
||||||
<< nl << "\tproc\tcells" << endl;
|
<< " target cells I need to send to:" << nl
|
||||||
|
<< "\tproc\tcells" << endl;
|
||||||
forAll(sendMap, proci)
|
forAll(sendMap, proci)
|
||||||
{
|
{
|
||||||
Pout<< '\t' << proci << '\t' << sendMap[proci].size() << endl;
|
Pout<< '\t' << proci << '\t' << sendMap[proci].size()
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// send over how many tgt cells I need to receive from each processor
|
// send over how many tgt cells I need to receive from each
|
||||||
|
// processor
|
||||||
labelListList sendSizes(Pstream::nProcs());
|
labelListList sendSizes(Pstream::nProcs());
|
||||||
sendSizes[Pstream::myProcNo()].setSize(Pstream::nProcs());
|
sendSizes[Pstream::myProcNo()].setSize(Pstream::nProcs());
|
||||||
forAll(sendMap, proci)
|
forAll(sendMap, proci)
|
||||||
@ -236,7 +272,8 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
|||||||
label segmentI = 0;
|
label segmentI = 0;
|
||||||
forAll(constructMap, proci)
|
forAll(constructMap, proci)
|
||||||
{
|
{
|
||||||
// what I need to receive is what other processor is sending to me
|
// what I need to receive is what other processor is sending
|
||||||
|
// to me
|
||||||
label nRecv = sendSizes[proci][Pstream::myProcNo()];
|
label nRecv = sendSizes[proci][Pstream::myProcNo()];
|
||||||
constructMap[proci].setSize(nRecv);
|
constructMap[proci].setSize(nRecv);
|
||||||
|
|
||||||
@ -252,6 +289,10 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
|||||||
std::move(sendMap),
|
std::move(sendMap),
|
||||||
std::move(constructMap)
|
std::move(constructMap)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user