polyDistributionMap: renamed from polyMeshDistributionMap for consistency with polyTopoChangeMap

This commit is contained in:
Henry Weller
2022-03-31 23:44:47 +01:00
parent 3ace8f434b
commit 6047f27aac
210 changed files with 328 additions and 6070 deletions

View File

@ -166,7 +166,7 @@ void Foam::fv::VoFClouds::updateMesh(const polyTopoChangeMap&)
{}
void Foam::fv::VoFClouds::distribute(const polyMeshDistributionMap& map)
void Foam::fv::VoFClouds::distribute(const polyDistributionMap& map)
{
clouds_.distribute(map);
}

View File

@ -152,7 +152,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -233,7 +233,7 @@ void Foam::fv::VoFSolidificationMeltingSource::updateMesh
void Foam::fv::VoFSolidificationMeltingSource::distribute
(
const polyMeshDistributionMap& map
const polyDistributionMap& map
)
{
set_.distribute(map);

View File

@ -194,7 +194,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -159,7 +159,7 @@ void Foam::fv::VoFSurfaceFilm::updateMesh(const polyTopoChangeMap&)
}
void Foam::fv::VoFSurfaceFilm::distribute(const polyMeshDistributionMap&)
void Foam::fv::VoFSurfaceFilm::distribute(const polyDistributionMap&)
{
NotImplemented;
}

View File

@ -139,7 +139,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -211,7 +211,7 @@ void Foam::fv::VoFTurbulenceDamping::updateMesh(const polyTopoChangeMap&)
{}
void Foam::fv::VoFTurbulenceDamping::distribute(const polyMeshDistributionMap&)
void Foam::fv::VoFTurbulenceDamping::distribute(const polyDistributionMap&)
{}

View File

@ -178,7 +178,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -206,7 +206,7 @@ void Foam::fv::VoFTurbulenceDamping::updateMesh(const polyTopoChangeMap&)
{}
void Foam::fv::VoFTurbulenceDamping::distribute(const polyMeshDistributionMap&)
void Foam::fv::VoFTurbulenceDamping::distribute(const polyDistributionMap&)
{}

View File

@ -177,7 +177,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -310,7 +310,7 @@ void Foam::fv::interfaceTurbulenceDamping::updateMesh(const polyTopoChangeMap&)
void Foam::fv::interfaceTurbulenceDamping::distribute
(
const polyMeshDistributionMap&
const polyDistributionMap&
)
{}

View File

@ -198,7 +198,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -244,7 +244,7 @@ void Foam::fv::phaseTurbulenceStabilisation::updateMesh
void Foam::fv::phaseTurbulenceStabilisation::distribute
(
const polyMeshDistributionMap&
const polyDistributionMap&
)
{}

View File

@ -168,7 +168,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -197,20 +197,20 @@ int main(int argc, char *argv[])
// Change mesh and inflate
Info<< "Actually changing mesh" << nl << endl;
autoPtr<polyTopoChangeMap> morphMap = meshMod.changeMesh(mesh, inflate);
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh, inflate);
Info<< "Mapping fields" << nl << endl;
mesh.updateMesh(morphMap);
mesh.updateMesh(map);
// Move mesh (since morphing does not do this)
if (morphMap().hasMotionPoints())
if (map().hasMotionPoints())
{
Info<< "Moving mesh" << nl << endl;
mesh.movePoints(morphMap().preMotionPoints());
mesh.movePoints(map().preMotionPoints());
}
// Update numbering of cells/vertices.
faceRemover.updateMesh(morphMap);
faceRemover.updateMesh(map);
Info<< "Writing fields" << nl << endl;

View File

@ -513,18 +513,18 @@ void subsetMesh
const Time& runTime = mesh.time();
autoPtr<polyTopoChangeMap> morphMap = meshMod.changeMesh(mesh, false);
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh, false);
if (morphMap().hasMotionPoints())
if (map().hasMotionPoints())
{
mesh.movePoints(morphMap().preMotionPoints());
mesh.movePoints(map().preMotionPoints());
}
// Update topology on cellRemover
cellRemover.updateMesh(morphMap());
cellRemover.updateMesh(map());
// Update refLevel for removed cells.
const labelList& cellMap = morphMap().cellMap();
const labelList& cellMap = map().cellMap();
labelList newRefLevel(cellMap.size());
@ -547,7 +547,7 @@ void subsetMesh
}
// Update cutCells for removed cells.
cutCells.updateMesh(morphMap());
cutCells.updateMesh(map());
}

View File

@ -461,7 +461,7 @@ void Foam::cellSplitter::setRefinement
}
void Foam::cellSplitter::updateMesh(const polyTopoChangeMap& morphMap)
void Foam::cellSplitter::updateMesh(const polyTopoChangeMap& map)
{
// Create copy since we're deleting entries. Only if both cell and added
// point get mapped do they get inserted.
@ -471,11 +471,11 @@ void Foam::cellSplitter::updateMesh(const polyTopoChangeMap& morphMap)
{
label oldCelli = iter.key();
label newCelli = morphMap.reverseCellMap()[oldCelli];
label newCelli = map.reverseCellMap()[oldCelli];
label oldPointi = iter();
label newPointi = morphMap.reversePointMap()[oldPointi];
label newPointi = map.reversePointMap()[oldPointi];
if (newCelli >= 0 && newPointi >= 0)
{

View File

@ -530,14 +530,14 @@ int main(int argc, char *argv[])
cutter.setRefinement(cellToPyrCentre, meshMod);
// Do changes
autoPtr<polyTopoChangeMap> morphMap = meshMod.changeMesh(mesh, false);
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh, false);
if (morphMap().hasMotionPoints())
if (map().hasMotionPoints())
{
mesh.movePoints(morphMap().preMotionPoints());
mesh.movePoints(map().preMotionPoints());
}
cutter.updateMesh(morphMap());
cutter.updateMesh(map());
if (!overwrite)
{
@ -602,15 +602,15 @@ int main(int argc, char *argv[])
cutter.setRefinement(allPointInfo, meshMod);
// Do changes
autoPtr<polyTopoChangeMap> morphMap = meshMod.changeMesh(mesh, false);
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh, false);
if (morphMap().hasMotionPoints())
if (map().hasMotionPoints())
{
mesh.movePoints(morphMap().preMotionPoints());
mesh.movePoints(map().preMotionPoints());
}
// Not implemented yet:
// cutter.updateMesh(morphMap());
// cutter.updateMesh(map());
if (!overwrite)
@ -647,14 +647,14 @@ int main(int argc, char *argv[])
);
// Do changes
autoPtr<polyTopoChangeMap> morphMap = meshMod.changeMesh(mesh, false);
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh, false);
if (morphMap().hasMotionPoints())
if (map().hasMotionPoints())
{
mesh.movePoints(morphMap().preMotionPoints());
mesh.movePoints(map().preMotionPoints());
}
cutter.updateMesh(morphMap());
cutter.updateMesh(map());
if (!overwrite)
{

View File

@ -240,15 +240,15 @@ int main(int argc, char *argv[])
runTime++;
}
autoPtr<polyTopoChangeMap> morphMap = meshMod.changeMesh(mesh, false);
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh, false);
if (morphMap().hasMotionPoints())
if (map().hasMotionPoints())
{
mesh.movePoints(morphMap().preMotionPoints());
mesh.movePoints(map().preMotionPoints());
}
// Update stored labels on meshCutter.
cutter.updateMesh(morphMap());
cutter.updateMesh(map());
Info<< "Finished refining" << endl;

View File

@ -136,18 +136,18 @@ int main(int argc, char *argv[])
meshMod
);
autoPtr<polyTopoChangeMap> morphMap = meshMod.changeMesh(mesh, false);
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh, false);
mesh.updateMesh(morphMap);
mesh.updateMesh(map);
// Move mesh (since morphing does not do this)
if (morphMap().hasMotionPoints())
if (map().hasMotionPoints())
{
mesh.movePoints(morphMap().preMotionPoints());
mesh.movePoints(map().preMotionPoints());
}
// Update numbering of cells/vertices.
faceRemover.updateMesh(morphMap);
faceRemover.updateMesh(map);
if (!overwrite)
{

View File

@ -685,18 +685,18 @@ int main(int argc, char *argv[])
runTime++;
}
autoPtr<polyTopoChangeMap> morphMap = meshMod.changeMesh(mesh, false);
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh, false);
if (morphMap().hasMotionPoints())
if (map().hasMotionPoints())
{
mesh.movePoints(morphMap().preMotionPoints());
mesh.movePoints(map().preMotionPoints());
}
// Update stored labels on meshCutter
cutter.updateMesh(morphMap());
cutter.updateMesh(map());
// Update cellSet
cellsToCut.updateMesh(morphMap());
cellsToCut.updateMesh(map());
Info<< "Remaining:" << cellsToCut.size() << endl;

View File

@ -251,9 +251,9 @@ int main(int argc, char *argv[])
extruder.setRefinement(meshMod());
// Create a mesh from topo changes.
autoPtr<polyTopoChangeMap> morphMap = meshMod().changeMesh(mesh(), false);
autoPtr<polyTopoChangeMap> map = meshMod().changeMesh(mesh(), false);
mesh().updateMesh(morphMap);
mesh().updateMesh(map);
{
edgeCollapser collapser(mesh());
@ -301,10 +301,10 @@ int main(int argc, char *argv[])
collapser.setRefinement(allPointInfo, meshModCollapse);
// Create a mesh from topo changes.
autoPtr<polyTopoChangeMap> morphMap
autoPtr<polyTopoChangeMap> map
= meshModCollapse.changeMesh(mesh(), false);
mesh().updateMesh(morphMap);
mesh().updateMesh(map);
}
if (!overwrite)

View File

@ -52,7 +52,7 @@ namespace Foam
class polyMesh;
class polyTopoChange;
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
class polyBoundaryMesh;
/*---------------------------------------------------------------------------*\
@ -123,7 +123,7 @@ public:
{}
//- Force recalculation of locally stored data for mesh distribution
void distribute(const polyMeshDistributionMap&)
void distribute(const polyDistributionMap&)
{}
label frontPatchi() const

View File

@ -409,7 +409,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
fvMeshDistribute distributor(mesh_);
autoPtr<polyMeshDistributionMap> mapDist = distributor.distribute
autoPtr<polyDistributionMap> mapDist = distributor.distribute
(
newDecomp
);
@ -841,7 +841,7 @@ Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::polyMeshDistributionMap>
Foam::autoPtr<Foam::polyDistributionMap>
Foam::backgroundMeshDecomposition::distribute
(
volScalarField& cellWeights
@ -988,7 +988,7 @@ Foam::backgroundMeshDecomposition::distribute
fvMeshDistribute distributor(mesh_);
autoPtr<polyMeshDistributionMap> mapDist =
autoPtr<polyDistributionMap> mapDist =
distributor.distribute(newDecomp);
meshCutter_.distribute(mapDist);

View File

@ -62,7 +62,7 @@ SourceFiles
#include "decompositionMethod.H"
#include "fvMeshDistribute.H"
#include "removeCells.H"
#include "polyMeshDistributionMap.H"
#include "polyDistributionMap.H"
#include "globalIndex.H"
#include "treeBoundBox.H"
#include "primitivePatch.H"
@ -210,7 +210,7 @@ public:
//- Redistribute the background mesh based on a supplied weight field,
// returning a map to use to redistribute vertices.
autoPtr<polyMeshDistributionMap> distribute
autoPtr<polyDistributionMap> distribute
(
volScalarField& cellWeights
);

View File

@ -127,7 +127,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
cwi[cI] = max(cellVertices[cI], 1e-2);
}
autoPtr<polyMeshDistributionMap> mapDist = decomposition_().distribute
autoPtr<polyDistributionMap> mapDist = decomposition_().distribute
(
cellWeights
);

View File

@ -550,7 +550,7 @@ int main(int argc, char *argv[])
<< distributor.countCells(decomp) << nl << endl;
// Do actual sending/receiving of mesh
autoPtr<polyMeshDistributionMap> map = distributor.distribute(decomp);
autoPtr<polyDistributionMap> map = distributor.distribute(decomp);
// Print some statistics
// Info<< "After distribution:" << endl;

View File

@ -201,10 +201,10 @@ int main(int argc, char *argv[])
extruder.setRefinement(meshMod);
autoPtr<polyTopoChangeMap> morphMap =
autoPtr<polyTopoChangeMap> map =
meshMod.changeMesh(pMesh, false);
pMesh.updateMesh(morphMap);
pMesh.updateMesh(map);
}
}

View File

@ -448,9 +448,9 @@ int main(int argc, char *argv[])
}
// Execute all polyMeshModifiers
autoPtr<polyTopoChangeMap> morphMap = stitcher.changeMesh(true);
autoPtr<polyTopoChangeMap> map = stitcher.changeMesh(true);
mesh.movePoints(morphMap->preMotionPoints());
mesh.movePoints(map->preMotionPoints());
// Write mesh
if (overwrite)

View File

@ -51,7 +51,7 @@ Description
#include "PstreamReduceOps.H"
#include "fvCFD.H"
#include "fvMeshDistribute.H"
#include "polyMeshDistributionMap.H"
#include "polyDistributionMap.H"
#include "IOobjectList.H"
#include "globalIndex.H"
#include "loadOrCreateMesh.H"
@ -642,7 +642,7 @@ int main(int argc, char *argv[])
// << distributor.countCells(finalDecomp) << nl << endl;
// Do actual sending/receiving of mesh
autoPtr<polyMeshDistributionMap> map = distributor.distribute(finalDecomp);
autoPtr<polyDistributionMap> map = distributor.distribute(finalDecomp);
//// Distribute any non-registered data accordingly
// map().distributeFaceData(faceCc);

View File

@ -187,7 +187,7 @@ void ${typeName}FvModel${SourceType}::updateMesh(const polyTopoChangeMap& map)
void ${typeName}FvModel${SourceType}::distribute
(
const polyMeshDistributionMap& map
const polyDistributionMap& map
)
{
set_.distribute(map);

View File

@ -118,7 +118,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -582,11 +582,11 @@ $(polyTopoChangeMap)/faceMapper/faceMapper.C
$(polyTopoChangeMap)/cellMapper/cellMapper.C
$(polyTopoChangeMap)/mapAddedPolyMesh.C
polyMeshDistributionMap = $(polyMesh)/polyMeshDistributionMap
$(polyMeshDistributionMap)/distributionMap.C
$(polyMeshDistributionMap)/distributionMapBase.C
$(polyMeshDistributionMap)/polyMeshDistributionMap.C
$(polyMeshDistributionMap)/IOdistributionMap.C
polyDistributionMap = $(polyMesh)/polyDistributionMap
$(polyDistributionMap)/distributionMap.C
$(polyDistributionMap)/distributionMapBase.C
$(polyDistributionMap)/polyDistributionMap.C
$(polyDistributionMap)/IOdistributionMap.C
PrimitivePatch = $(primitiveMesh)/PrimitivePatch
$(PrimitivePatch)/PrimitivePatchName.C

View File

@ -276,7 +276,7 @@ template<class Mesh>
void Foam::meshObject::distribute
(
objectRegistry& obr,
const polyMeshDistributionMap& map
const polyDistributionMap& map
)
{
HashTable<GeometricMeshObject<Mesh>*> meshObjects
@ -287,7 +287,7 @@ void Foam::meshObject::distribute
if (meshObject::debug)
{
Pout<< "meshObject::distribute(objectRegistry&, "
"const polyMeshDistributionMap& map) : updating "
"const polyDistributionMap& map) : updating "
<< Mesh::typeName
<< " meshObjects for region " << obr.name() << endl;
}

View File

@ -77,7 +77,7 @@ namespace Foam
// Forward declarations
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
/*---------------------------------------------------------------------------*\
Class MeshObject Declaration
@ -176,7 +176,7 @@ public:
static void updateMesh(objectRegistry&, const polyTopoChangeMap&);
template<class Mesh>
static void distribute(objectRegistry&, const polyMeshDistributionMap&);
static void distribute(objectRegistry&, const polyDistributionMap&);
template<class Mesh>
static void addPatch(objectRegistry&, const label patchi);
@ -296,7 +296,7 @@ public:
MoveableMeshObject<Mesh>(typeName, io)
{}
virtual void distribute(const polyMeshDistributionMap& map) = 0;
virtual void distribute(const polyDistributionMap& map) = 0;
};

View File

@ -102,11 +102,11 @@ void Foam::pointMesh::updateMesh(const polyTopoChangeMap& map)
}
void Foam::pointMesh::distribute(const polyMeshDistributionMap& map)
void Foam::pointMesh::distribute(const polyDistributionMap& map)
{
if (debug)
{
Pout<< "pointMesh::distribute(const polyMeshDistributionMap&): "
Pout<< "pointMesh::distribute(const polyDistributionMap&): "
<< "Distribute." << endl;
Pout<< endl;
}

View File

@ -122,7 +122,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Move points
virtual bool movePoints();

View File

@ -64,7 +64,7 @@ namespace Foam
// Forward declaration of classes
class globalMeshData;
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
class polyMeshTetDecomposition;
class treeDataCell;
template<class Type> class indexedOctree;
@ -610,7 +610,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap& map);
virtual void distribute(const polyDistributionMap& map);
//- Remove boundary patches
void removeBoundary();

View File

@ -1,158 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "IOdistributionMap.H"
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
namespace Foam
{
defineTypeNameAndDebug(IOdistributionMap, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::IOdistributionMap::IOdistributionMap(const IOobject& io)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningInFunction
<< "IOdistributionMap " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOdistributionMap does not support automatic rereading."
<< endl;
}
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
}
Foam::IOdistributionMap::IOdistributionMap
(
const IOobject& io,
const distributionMap& map
)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningInFunction
<< "IOdistributionMap " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOdistributionMap does not support automatic rereading."
<< endl;
}
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
else
{
distributionMap::operator=(map);
}
}
Foam::IOdistributionMap::IOdistributionMap
(
const IOobject& io,
distributionMap&& map
)
:
regIOobject(io),
distributionMap(move(map))
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningInFunction
<< "IOdistributionMap " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOdistributionMap does not support automatic rereading."
<< endl;
}
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
Foam::IOdistributionMap::~IOdistributionMap()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::IOdistributionMap::readData(Istream& is)
{
return (is >> *this).good();
}
bool Foam::IOdistributionMap::writeData(Ostream& os) const
{
return (os << *this).good();
}
// ************************************************************************* //

View File

@ -1,98 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::IOdistributionMap
Description
IOdistributionMap is derived from distributionMap and
IOobject to give the distributionMap
automatic IO functionality via the objectRegistry.
SourceFiles
IOdistributionMap.C
\*---------------------------------------------------------------------------*/
#ifndef IOdistributionMap_H
#define IOdistributionMap_H
#include "distributionMap.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class IOdistributionMap Declaration
\*---------------------------------------------------------------------------*/
class IOdistributionMap
:
public regIOobject,
public distributionMap
{
public:
//- Runtime type information
TypeName("distributionMap");
// Constructors
//- Construct given an IOobject
IOdistributionMap(const IOobject&);
//- Construct given an IOobject and distributionMap
IOdistributionMap(const IOobject&, const distributionMap&);
//- Move constructor transferring the distributionMap contents
IOdistributionMap(const IOobject&, distributionMap&&);
//- Destructor
virtual ~IOdistributionMap();
// Member Functions
//- ReadData function required for regIOobject read operation
virtual bool readData(Istream&);
//- WriteData function required for regIOobject write operation
virtual bool writeData(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,556 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "distributionMap.H"
#include "globalIndexAndTransform.H"
#include "transformField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(distributionMap, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<>
void Foam::distributionMap::transform::operator()
(
const transformer&,
const bool,
List<label>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const coupledPolyPatch&,
UList<label>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const transformer&,
const bool,
List<scalar>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const coupledPolyPatch&,
UList<scalar>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const coupledPolyPatch&,
Map<scalar>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<scalar>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const transformer&,
const bool,
List<bool>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const coupledPolyPatch&,
UList<bool>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const
{}
template<>
void Foam::distributionMap::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const
{}
void Foam::distributionMap::printLayout(Ostream& os) const
{
distributionMapBase::printLayout(os);
forAll(transformElements_, trafoI)
{
if (transformElements_[trafoI].size() > 0)
{
os << "transform " << trafoI << ':' << endl
<< " start : " << transformStart_[trafoI] << endl
<< " size : " << transformElements_[trafoI].size() << endl;
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::distributionMap::distributionMap()
:
distributionMapBase()
{}
Foam::distributionMap::distributionMap
(
const label constructSize,
labelListList&& subMap,
labelListList&& constructMap,
const bool subHasFlip,
const bool constructHasFlip
)
:
distributionMapBase
(
constructSize,
move(subMap),
move(constructMap),
subHasFlip,
constructHasFlip
)
{}
Foam::distributionMap::distributionMap
(
const label constructSize,
labelListList&& subMap,
labelListList&& constructMap,
labelListList&& transformElements,
labelList&& transformStart,
const bool subHasFlip,
const bool constructHasFlip
)
:
distributionMapBase
(
constructSize,
move(subMap),
move(constructMap),
subHasFlip,
constructHasFlip
),
transformElements_(move(transformElements)),
transformStart_(move(transformStart))
{}
Foam::distributionMap::distributionMap
(
const labelList& sendProcs,
const labelList& recvProcs
)
:
distributionMapBase(sendProcs, recvProcs)
{}
Foam::distributionMap::distributionMap
(
const globalIndex& globalNumbering,
labelList& elements,
List<Map<label>>& compactMap,
const int tag
)
:
distributionMapBase
(
globalNumbering,
elements,
compactMap,
tag
)
{}
Foam::distributionMap::distributionMap
(
const globalIndex& globalNumbering,
labelListList& cellCells,
List<Map<label>>& compactMap,
const int tag
)
:
distributionMapBase
(
globalNumbering,
cellCells,
compactMap,
tag
)
{}
Foam::distributionMap::distributionMap
(
const globalIndex& globalNumbering,
labelList& elements,
const globalIndexAndTransform& globalTransforms,
const labelPairList& transformedElements,
labelList& transformedIndices,
List<Map<label>>& compactMap,
const int tag
)
:
distributionMapBase()
{
// Construct per processor compact addressing of the global elements
// needed. The ones from the local processor are not included since
// these are always all needed.
calcCompactAddressing
(
globalNumbering,
elements,
compactMap
);
// Add all (non-local) transformed elements needed.
forAll(transformedElements, i)
{
labelPair elem = transformedElements[i];
label proci = globalTransforms.processor(elem);
if (proci != Pstream::myProcNo())
{
label index = globalTransforms.index(elem);
label nCompact = compactMap[proci].size();
compactMap[proci].insert(index, nCompact);
}
}
// Exchange what I need with processor that supplies it. Renumber elements
// into compact numbering
labelList compactStart;
exchangeAddressing
(
tag,
globalNumbering,
elements,
compactMap,
compactStart
);
// Renumber the transformed elements
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Count per transformIndex
label nTrafo = globalTransforms.transformPermutations().size();
labelList nPerTransform(nTrafo, 0);
forAll(transformedElements, i)
{
labelPair elem = transformedElements[i];
label trafoI = globalTransforms.transformIndex(elem);
nPerTransform[trafoI]++;
}
// Offset per transformIndex
transformStart_.setSize(nTrafo);
transformElements_.setSize(nTrafo);
forAll(transformStart_, trafoI)
{
transformStart_[trafoI] = constructSize_;
constructSize_ += nPerTransform[trafoI];
transformElements_[trafoI].setSize(nPerTransform[trafoI]);
}
// Sort transformed elements into their new slot.
nPerTransform = 0;
transformedIndices.setSize(transformedElements.size());
forAll(transformedElements, i)
{
labelPair elem = transformedElements[i];
label proci = globalTransforms.processor(elem);
label index = globalTransforms.index(elem);
label trafoI = globalTransforms.transformIndex(elem);
// Get compact index for untransformed element
label rawElemI =
(
proci == Pstream::myProcNo()
? index
: compactMap[proci][index]
);
label& n = nPerTransform[trafoI];
// index of element to transform
transformElements_[trafoI][n] = rawElemI;
// destination of transformed element
transformedIndices[i] = transformStart_[trafoI]+n;
n++;
}
if (debug)
{
printLayout(Pout);
}
}
Foam::distributionMap::distributionMap
(
const globalIndex& globalNumbering,
labelListList& cellCells,
const globalIndexAndTransform& globalTransforms,
const List<labelPairList>& transformedElements,
labelListList& transformedIndices,
List<Map<label>>& compactMap,
const int tag
)
:
distributionMapBase()
{
// Construct per processor compact addressing of the global elements
// needed. The ones from the local processor are not included since
// these are always all needed.
calcCompactAddressing
(
globalNumbering,
cellCells,
compactMap
);
// Add all (non-local) transformed elements needed.
forAll(transformedElements, celli)
{
const labelPairList& elems = transformedElements[celli];
forAll(elems, i)
{
label proci = globalTransforms.processor(elems[i]);
if (proci != Pstream::myProcNo())
{
label index = globalTransforms.index(elems[i]);
label nCompact = compactMap[proci].size();
compactMap[proci].insert(index, nCompact);
}
}
}
// Exchange what I need with processor that supplies it. Renumber elements
// into compact numbering
labelList compactStart;
exchangeAddressing
(
tag,
globalNumbering,
cellCells,
compactMap,
compactStart
);
// Renumber the transformed elements
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Count per transformIndex
label nTrafo = globalTransforms.transformPermutations().size();
labelList nPerTransform(nTrafo, 0);
forAll(transformedElements, celli)
{
const labelPairList& elems = transformedElements[celli];
forAll(elems, i)
{
label trafoI = globalTransforms.transformIndex(elems[i]);
nPerTransform[trafoI]++;
}
}
// Offset per transformIndex
transformStart_.setSize(nTrafo);
transformElements_.setSize(nTrafo);
forAll(transformStart_, trafoI)
{
transformStart_[trafoI] = constructSize_;
constructSize_ += nPerTransform[trafoI];
transformElements_[trafoI].setSize(nPerTransform[trafoI]);
}
// Sort transformed elements into their new slot.
nPerTransform = 0;
transformedIndices.setSize(transformedElements.size());
forAll(transformedElements, celli)
{
const labelPairList& elems = transformedElements[celli];
transformedIndices[celli].setSize(elems.size());
forAll(elems, i)
{
label proci = globalTransforms.processor(elems[i]);
label index = globalTransforms.index(elems[i]);
label trafoI = globalTransforms.transformIndex(elems[i]);
// Get compact index for untransformed element
label rawElemI =
(
proci == Pstream::myProcNo()
? index
: compactMap[proci][index]
);
label& n = nPerTransform[trafoI];
// index of element to transform
transformElements_[trafoI][n] = rawElemI;
// destination of transformed element
transformedIndices[celli][i] = transformStart_[trafoI]+n;
n++;
}
}
if (debug)
{
printLayout(Pout);
}
}
Foam::distributionMap::distributionMap(const distributionMap& map)
:
distributionMapBase(map),
transformElements_(map.transformElements_),
transformStart_(map.transformStart_)
{}
Foam::distributionMap::distributionMap(distributionMap&& map)
:
distributionMapBase(move(map)),
transformElements_(move(map.transformElements_)),
transformStart_(move(map.transformStart_))
{}
Foam::distributionMap::distributionMap(Istream& is)
{
is >> *this;
}
Foam::autoPtr<Foam::distributionMap> Foam::distributionMap::clone() const
{
return autoPtr<distributionMap>(new distributionMap(*this));
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::label Foam::distributionMap::whichTransform(const label index)
const
{
return findLower(transformStart_, index+1);
}
void Foam::distributionMap::transfer(distributionMap& rhs)
{
distributionMapBase::transfer(rhs);
transformElements_.transfer(rhs.transformElements_);
transformStart_.transfer(rhs.transformStart_);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::distributionMap::operator=(const distributionMap& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "Attempted assignment to self"
<< abort(FatalError);
}
distributionMapBase::operator=(rhs);
transformElements_ = rhs.transformElements_;
transformStart_ = rhs.transformStart_;
}
// * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, distributionMap& map)
{
is.fatalCheck("operator>>(Istream&, distributionMap&)");
is >> static_cast<distributionMapBase&>(map)
>> map.transformElements_ >> map.transformStart_;
return is;
}
// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const distributionMap& map)
{
os << static_cast<const distributionMapBase&>(map) << token::NL
<< map.transformElements_ << token::NL
<< map.transformStart_;
return os;
}
// ************************************************************************* //

View File

@ -1,672 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::distributionMap
Description
Class containing processor-to-processor mapping information.
We store mapping from the bits-to-send to the complete starting list
(subXXXMap) and from the received bits to their location in the new
list (constructXXXMap).
Note:
Schedule is a list of processor pairs (one send, one receive. One of
them will be myself) which forms a scheduled (i.e. non-buffered) exchange.
See distribute on how to use it.
Note2: number of items sent on one processor have to equal the number
of items received on the other processor.
To aid constructing these maps there are the constructors from global
numbering, either with or without transforms.
- without transforms:
Constructors using compact numbering: layout is
- all my own elements first (whether used or not)
- followed by used-only remote elements sorted by remote processor.
So e.g 4 procs and on proc 1 the compact
table will first have all globalIndex.localSize() elements from proc1
followed by used-only elements of proc0, proc2, proc3.
The constructed distributionMap sends the local elements from and
receives the remote elements into their compact position.
compactMap[proci] is the position of elements from proci in the compact
map. compactMap[myProcNo()] is empty since trivial addressing.
It rewrites the input global indices into indices into the constructed
data.
- with transforms:
This requires the precalculated set of possible transforms
(globalIndexAndTransform). These are given as permutations (+, -, or none)
of up to 3 independent transforms.
The layout of the data is
- all my own elements first (whether used or not)
- followed by used-only remote elements sorted by remote processor.
- followed by - for each transformation index - the set of local or
remote elements with that transformation.
The inputs for the constructor are
- the set of untransformed local or remote indices in globalIndex
numbering. These get rewritten to be indices into the layout of the data.
- the set of transformed local or remote indices in globalIndexAndTransform
encoding. These are labelPairs.
Any distribute with transforms is now done as:
1. exchange data with other processors and receive these into the
slots for that processor
2. for all transformations transform a subset of the data according
to transformElements_[transformI] and store this starting from
transformStart_[transformI]
In the same way a reverse distribute will
1. apply the inverse transform to the data starting at
transformStart_[transformI] and copy the result back into the
transformElements_[transformI]. These might be local or remote slots.
2. the data in the remote slots will now be sent back to the correct
location in the originating processor.
E.g. a map to handle
- mesh points on a mesh with
- 1 cyclic so 3 permutations (+,-,none) will have layout
- on e.g. processor 1 out of 2:
+------+ <- transformStart[2]
| |
| | <- transform2 applied to data in local or remote slots
| |
+------+ <- transformStart[1]
| |
| | <- transform1 applied to data in local or remote slots
| |
+------+ <- transformStart[1]
| |
| | <- transform0 applied to data in local or remote slots
| |
+------+ <- transformStart[0]
| |
| | <- data from proc2
| |
+------+
| |
| | <- data from proc0
| |
+------+ <- mesh.nPoints()
| |
| |
| |
+------+ 0
When constructing from components optionally a 'flip' on
the maps can be specified. This will interpret the map
values as index+flip, similar to e.g. faceProcAddressing. The flip
will only be applied to fieldTypes (scalar, vector, .. triad)
SourceFiles
distributionMap.C
distributionMapTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef distributionMap_H
#define distributionMap_H
#include "distributionMapBase.H"
#include "transformer.H"
#include "coupledPolyPatch.H"
#include "EdgeMap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class globalIndexAndTransform;
// Forward declaration of friend functions and operators
class distributionMap;
Istream& operator>>(Istream&, distributionMap&);
Ostream& operator<<(Ostream&, const distributionMap&);
/*---------------------------------------------------------------------------*\
Class distributionMap Declaration
\*---------------------------------------------------------------------------*/
class distributionMap
:
public distributionMapBase
{
// Private Data
//- For every globalIndexAndTransform::transformPermutations
// gives the elements that need to be transformed
labelListList transformElements_;
//- Destination in constructMap for transformed elements
labelList transformStart_;
// Private Member Functions
//- Helper function: copy transformElements without transformation
template<class T>
void applyDummyTransforms(List<T>& field) const;
template<class T, class TransformOp>
void applyTransforms
(
const globalIndexAndTransform& globalTransforms,
List<T>& field,
const TransformOp& top
) const;
//- Helper function: copy transformElements without transformation
template<class T>
void applyDummyInverseTransforms(List<T>& field) const;
template<class T, class TransformOp>
void applyInverseTransforms
(
const globalIndexAndTransform& globalTransforms,
List<T>& field,
const TransformOp& top
) const;
public:
// Public classes
//- Default transformation behaviour
class transform
{
public:
template<class Type>
void operator()
(
const transformer& vt,
const bool forward,
List<Type>& fld
) const
{
if (forward)
{
vt.transformList(fld);
}
else
{
vt.invTransformList(fld);
}
}
template<class Type>
void operator()
(
const transformer& vt,
const bool forward,
List<List<Type>>& flds
) const
{
forAll(flds, i)
{
operator()(vt, forward, flds[i]);
}
}
//- Transform patch-based field
template<class Type>
void operator()(const coupledPolyPatch& cpp, UList<Type>& fld) const
{
if (cpp.transform().transforms())
{
cpp.transform().transformList(fld);
}
}
//- Transform sparse field
template<class Type, template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<Type>& map)
const
{
if (cpp.transform().transforms())
{
cpp.transform().transformList(map);
}
}
};
//- Default transformation behaviour for position
class transformPosition
{
public:
void operator()
(
const transformer& vt,
const bool forward,
List<point>& fld
) const
{
pointField pfld(move(fld));
if (forward)
{
fld = vt.transformPosition(pfld);
}
else
{
fld = vt.invTransformPosition(pfld);
}
}
void operator()
(
const transformer& vt,
const bool forward,
List<List<point>>& flds
) const
{
forAll(flds, i)
{
operator()(vt, forward, flds[i]);
}
}
//- Transform patch-based field
void operator()(const coupledPolyPatch& cpp, pointField& fld) const
{
cpp.transform().transformPosition(fld, fld);
}
template<template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<point>& map)
const
{
Field<point> fld(map.size());
label i = 0;
forAllConstIter(typename Container<point>, map, iter)
{
fld[i++] = iter();
}
cpp.transform().transformPosition(fld, fld);
i = 0;
forAllIter(typename Container<point>, map, iter)
{
iter() = fld[i++];
}
}
};
// Declare name of the class and its debug switch
ClassName("distributionMap");
// Constructors
//- Construct null
distributionMap();
//- Construct from components
distributionMap
(
const label constructSize,
labelListList&& subMap,
labelListList&& constructMap,
const bool subHasFlip = false,
const bool constructHasFlip = false
);
//- Construct from components
distributionMap
(
const label constructSize,
labelListList&& subMap,
labelListList&& constructMap,
labelListList&& transformElements,
labelList&& transformStart,
const bool subHasFlip = false,
const bool constructHasFlip = false
);
//- Construct from reverse addressing: per data item the send
// processor and the receive processor. (note: data is not stored
// sorted per processor so cannot use printLayout).
distributionMap
(
const labelList& sendProcs,
const labelList& recvProcs
);
//- Construct from list of (possibly) remote elements in globalIndex
// numbering (or -1). Determines compact numbering (see above) and
// distribute map to get data into this ordering and renumbers the
// elements to be in compact numbering.
distributionMap
(
const globalIndex&,
labelList& elements,
List<Map<label>>& compactMap,
const int tag = Pstream::msgType()
);
//- Special variant that works with the info sorted into bins
// according to local indices. E.g. think cellCells where
// cellCells[localCelli] is a list of global cells
distributionMap
(
const globalIndex&,
labelListList& cellCells,
List<Map<label>>& compactMap,
const int tag = Pstream::msgType()
);
//- Construct from list of (possibly remote) untransformed elements
// in globalIndex numbering (or -1) and (possibly remote)
// transformded elements in globalIndexAndTransform numbering.
// Determines compact numbering (see above) and
// distribute map to get data into this ordering and renumbers the
// elements to be in compact numbering.
distributionMap
(
const globalIndex&,
labelList& untransformedElements,
const globalIndexAndTransform&,
const labelPairList& transformedElements,
labelList& transformedIndices,
List<Map<label>>& compactMap,
const int tag = Pstream::msgType()
);
//- As above but with ListLists.
distributionMap
(
const globalIndex&,
labelListList& cellCells,
const globalIndexAndTransform&,
const List<labelPairList>& transformedElements,
labelListList& transformedIndices,
List<Map<label>>& compactMap,
const int tag = Pstream::msgType()
);
//- Copy constructor
distributionMap(const distributionMap&);
//- Move constructor
distributionMap(distributionMap&&);
//- Construct from Istream
distributionMap(Istream&);
//- Clone
autoPtr<distributionMap> clone() const;
//- Destructor
virtual ~distributionMap()
{}
// Member Functions
// Access
//- For every globalIndexAndTransform::transformPermutations
// gives the elements that need to be transformed
const labelListList& transformElements() const
{
return transformElements_;
}
//- Destination in constructMap for transformed elements
const labelList& transformStart() const
{
return transformStart_;
}
//- Find transform from transformElements
label whichTransform(const label index) const;
// Other
//- Transfer the contents of the argument and annul the argument.
void transfer(distributionMap&);
//- Distribute data using default commsType.
template<class T>
void distribute
(
List<T>& fld,
const bool dummyTransform = true,
const int tag = UPstream::msgType()
) const;
//- Distribute data using default commsType.
template<class T, class negateOp>
void distribute
(
List<T>& fld,
const negateOp& negOp,
const bool dummyTransform = true,
const int tag = UPstream::msgType()
) const;
//- Distribute data using default commsType.
template<class T>
void distribute
(
DynamicList<T>& fld,
const bool dummyTransform = true,
const int tag = UPstream::msgType()
) const;
//- Reverse distribute data using default commsType.
template<class T>
void reverseDistribute
(
const label constructSize,
List<T>&,
const bool dummyTransform = true,
const int tag = UPstream::msgType()
) const;
//- Reverse distribute data using default commsType.
// Since constructSize might be larger than supplied size supply
// a nullValue
template<class T>
void reverseDistribute
(
const label constructSize,
const T& nullValue,
List<T>& fld,
const bool dummyTransform = true,
const int tag = UPstream::msgType()
) const;
//- Distribute with transforms
template<class T, class TransformOp>
void distribute
(
const globalIndexAndTransform&,
List<T>& fld,
const TransformOp& top,
const int tag = UPstream::msgType()
) const;
//- Reverse distribute with transforms
template<class T, class TransformOp>
void reverseDistribute
(
const globalIndexAndTransform&,
const label constructSize,
List<T>& fld,
const TransformOp& top,
const int tag = UPstream::msgType()
) const;
//- Reverse distribute with transforms
template<class T, class TransformOp>
void reverseDistribute
(
const globalIndexAndTransform&,
const label constructSize,
const T& nullValue,
List<T>& fld,
const TransformOp& top,
const int tag = UPstream::msgType()
) const;
//- Debug: print layout. Can only be used on maps with sorted
// storage (local data first, then non-local data)
void printLayout(Ostream& os) const;
//- Correct for topo change.
void updateMesh(const polyTopoChangeMap&)
{
notImplemented
(
"distributionMap::updateMesh(const polyTopoChangeMap&)"
);
}
// Member Operators
void operator=(const distributionMap&);
// IOstream Operators
//- Read dictionary from Istream
friend Istream& operator>>(Istream&, distributionMap&);
//- Write dictionary to Ostream
friend Ostream& operator<<(Ostream&, const distributionMap&);
};
// Template specialisation for primitives that do not need transform
template<>
void distributionMap::transform::operator()
(
const transformer&,
const bool,
List<label>&
) const;
template<>
void distributionMap::transform::operator()
(
const coupledPolyPatch&,
UList<label>&
) const;
template<>
void distributionMap::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const;
template<>
void distributionMap::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const;
template<>
void distributionMap::transform::operator()
(
const coupledPolyPatch&,
UList<scalar>&
) const;
template<>
void distributionMap::transform::operator()
(
const transformer&,
const bool,
List<scalar>&
) const;
template<>
void distributionMap::transform::operator()
(
const coupledPolyPatch&,
Map<scalar>&
) const;
template<>
void distributionMap::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<scalar>&
) const;
template<>
void distributionMap::transform::operator()
(
const coupledPolyPatch& cpp,
UList<bool>& fld
) const;
template<>
void distributionMap::transform::operator()
(
const transformer&,
const bool,
List<bool>&
) const;
template<>
void distributionMap::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const;
template<>
void distributionMap::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "distributionMapTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,495 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::distributionMapBase
Description
Class containing processor-to-processor mapping information.
We store mapping from the bits-to-send to the complete starting list
(subXXXMap) and from the received bits to their location in the new
list (constructXXXMap).
Note:
Schedule is a list of processor pairs (one send, one receive. One of
them will be myself) which forms a scheduled (i.e. non-buffered) exchange.
See distribute on how to use it.
Note2: number of items sent on one processor have to equal the number
of items received on the other processor.
To aid constructing these maps there are the constructors from global
numbering, either with or without transforms.
Constructors using compact numbering: layout is
- all my own elements first (whether used or not)
- followed by used-only remote elements sorted by remote processor.
So e.g 4 procs and on proc 1 the compact
table will first have all globalIndex.localSize() elements from proc1
followed by used-only elements of proc0, proc2, proc3.
The constructed distributionMapBase sends the local elements from and
receives the remote elements into their compact position.
compactMap[proci] is the position of elements from proci in the compact
map. compactMap[myProcNo()] is empty since trivial addressing.
It rewrites the input global indices into indices into the constructed
data.
When constructing from components optionally a 'flip' on
the maps can be specified. This will interpret the map
values as index+flip, similar to e.g. faceProcAddressing. The flip
will only be applied to fieldTypes (scalar, vector, .. triad)
SourceFiles
distributionMapBase.C
distributionMapBaseTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef distributionMapBase_H
#define distributionMapBase_H
#include "labelList.H"
#include "labelPair.H"
#include "Pstream.H"
#include "boolList.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyTopoChangeMap;
class globalIndex;
class PstreamBuffers;
// Forward declaration of friend functions and operators
class distributionMapBase;
Istream& operator>>(Istream&, distributionMapBase&);
Ostream& operator<<(Ostream&, const distributionMapBase&);
/*---------------------------------------------------------------------------*\
Class distributionMapBase Declaration
\*---------------------------------------------------------------------------*/
class distributionMapBase
{
protected:
// Protected data
//- Size of reconstructed data
label constructSize_;
//- Maps from subsetted data back to original data
labelListList subMap_;
//- Maps from subsetted data to new reconstructed data
labelListList constructMap_;
//- Whether subMap includes flip or not
bool subHasFlip_;
//- Whether constructMap includes flip or not
bool constructHasFlip_;
//- Schedule
mutable autoPtr<List<labelPair>> schedulePtr_;
// Private Member Functions
static void checkReceivedSize
(
const label proci,
const label expectedSize,
const label receivedSize
);
//- Construct per processor compact addressing of the global elements
// needed. The ones from the local processor are not included since
// these are always all needed.
void calcCompactAddressing
(
const globalIndex& globalNumbering,
const labelList& elements,
List<Map<label>>& compactMap
) const;
void calcCompactAddressing
(
const globalIndex& globalNumbering,
const labelListList& elements,
List<Map<label>>& compactMap
) const;
void exchangeAddressing
(
const int tag,
const globalIndex& globalNumbering,
labelList& elements,
List<Map<label>>& compactMap,
labelList& compactStart
);
void exchangeAddressing
(
const int tag,
const globalIndex& globalNumbering,
labelListList& elements,
List<Map<label>>& compactMap,
labelList& compactStart
);
template<class T, class CombineOp, class negateOp>
static void flipAndCombine
(
const UList<label>& map,
const bool hasFlip,
const UList<T>& rhs,
const CombineOp& cop,
const negateOp& negOp,
List<T>& lhs
);
template<class T, class negateOp>
static T accessAndFlip
(
const UList<T>& fld,
const label index,
const bool hasFlip,
const negateOp& negOp
);
public:
// Declare name of the class and its debug switch
ClassName("distributionMapBase");
// Constructors
//- Construct null
distributionMapBase();
//- Move construct from components
distributionMapBase
(
const label constructSize,
const labelListList&& subMap,
const labelListList&& constructMap,
const bool subHasFlip = false,
const bool constructHasFlip = false
);
//- Construct from reverse addressing: per data item the send
// processor and the receive processor. (note: data is not stored
// sorted per processor so cannot use printLayout).
distributionMapBase
(
const labelList& sendProcs,
const labelList& recvProcs
);
//- Construct from list of (possibly) remote elements in globalIndex
// numbering (or -1). Determines compact numbering (see above) and
// distribute map to get data into this ordering and renumbers the
// elements to be in compact numbering.
distributionMapBase
(
const globalIndex&,
labelList& elements,
List<Map<label>>& compactMap,
const int tag = Pstream::msgType()
);
//- Special variant that works with the info sorted into bins
// according to local indices. E.g. think cellCells where
// cellCells[localCellI] is a list of global cells
distributionMapBase
(
const globalIndex&,
labelListList& cellCells,
List<Map<label>>& compactMap,
const int tag = Pstream::msgType()
);
//- Construct copy
distributionMapBase(const distributionMapBase&);
//- Move constructor
distributionMapBase(distributionMapBase&&);
//- Construct from Istream
distributionMapBase(Istream&);
// Member Functions
// Access
//- Constructed data size
label constructSize() const
{
return constructSize_;
}
//- Constructed data size
label& constructSize()
{
return constructSize_;
}
//- From subsetted data back to original data
const labelListList& subMap() const
{
return subMap_;
}
//- From subsetted data back to original data
labelListList& subMap()
{
return subMap_;
}
//- From subsetted data to new reconstructed data
const labelListList& constructMap() const
{
return constructMap_;
}
//- From subsetted data to new reconstructed data
labelListList& constructMap()
{
return constructMap_;
}
//- Does subMap include a sign
bool subHasFlip() const
{
return subHasFlip_;
}
//- Does subMap include a sign
bool& subHasFlip()
{
return subHasFlip_;
}
//- Does constructMap include a sign
bool constructHasFlip() const
{
return constructHasFlip_;
}
//- Does constructMap include a sign
bool& constructHasFlip()
{
return constructHasFlip_;
}
//- Calculate a schedule. See above.
static List<labelPair> schedule
(
const labelListList& subMap,
const labelListList& constructMap,
const int tag
);
//- Return a schedule. Demand driven. See above.
const List<labelPair>& schedule() const;
// Other
//- Transfer the contents of the argument and annul the argument.
void transfer(distributionMapBase&);
//- Helper for construct from globalIndex. Renumbers element
// (in globalIndex numbering) into compact indices.
static label renumber
(
const globalIndex&,
const List<Map<label>>& compactMap,
const label globalElement
);
//- Compact maps. Gets per field a bool whether it is used (locally)
// and works out itself what this side and sender side can remove
// from maps. Only compacts non-local elements (i.e. the stuff
// that gets sent over), does not change the local layout
void compact
(
const boolList& elemIsUsed,
const int tag = UPstream::msgType()
);
//- Compact all maps and layout. Returns compaction maps for
// subMap and constructMap
void compact
(
const boolList& elemIsUsed,
const label localSize, // max index for subMap
labelList& oldToNewSub,
labelList& oldToNewConstruct,
const int tag = UPstream::msgType()
);
//- Distribute data. Note:schedule only used for
// Pstream::commsTypes::scheduled for now, all others just use
// send-to-all, receive-from-all.
template<class T, class negateOp>
static void distribute
(
const Pstream::commsTypes commsType,
const List<labelPair>& schedule,
const label constructSize,
const labelListList& subMap,
const bool subHasFlip,
const labelListList& constructMap,
const bool constructHasFlip,
List<T>&,
const negateOp& negOp,
const int tag = UPstream::msgType()
);
//- Distribute data. If multiple processors writing to same
// position adds contributions using cop.
template<class T, class CombineOp, class negateOp>
static void distribute
(
const Pstream::commsTypes commsType,
const List<labelPair>& schedule,
const label constructSize,
const labelListList& subMap,
const bool subHasFlip,
const labelListList& constructMap,
const bool constructHasFlip,
List<T>&,
const CombineOp& cop,
const negateOp& negOp,
const T& nullValue,
const int tag = UPstream::msgType()
);
//- Distribute data using default commsType.
template<class T>
void distribute
(
List<T>& fld,
const int tag = UPstream::msgType()
) const;
//- Distribute data using default commsType.
template<class T, class negateOp>
void distribute
(
List<T>& fld,
const negateOp& negOp,
const int tag = UPstream::msgType()
) const;
//- Distribute data using default commsType.
template<class T>
void distribute
(
DynamicList<T>& fld,
const int tag = UPstream::msgType()
) const;
//- Reverse distribute data using default commsType.
template<class T>
void reverseDistribute
(
const label constructSize,
List<T>&,
const int tag = UPstream::msgType()
) const;
//- Reverse distribute data using default commsType.
// Since constructSize might be larger than supplied size supply
// a nullValue
template<class T>
void reverseDistribute
(
const label constructSize,
const T& nullValue,
List<T>& fld,
const int tag = UPstream::msgType()
) const;
//- Do all sends using PstreamBuffers
template<class T>
void send(PstreamBuffers&, const List<T>&) const;
//- Do all receives using PstreamBuffers
template<class T>
void receive(PstreamBuffers&, List<T>&) const;
//- Debug: print layout. Can only be used on maps with sorted
// storage (local data first, then non-local data)
void printLayout(Ostream& os) const;
//- Correct for topo change.
void updateMesh(const polyTopoChangeMap&)
{
NotImplemented;
}
// Member Operators
void operator=(const distributionMapBase&);
void operator=(distributionMapBase&&);
// IOstream Operators
//- Read dictionary from Istream
friend Istream& operator>>(Istream&, distributionMapBase&);
//- Write dictionary to Ostream
friend Ostream& operator<<(Ostream&, const distributionMapBase&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "distributionMapBaseTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,271 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Pstream.H"
#include "PstreamBuffers.H"
#include "PstreamCombineReduceOps.H"
#include "globalIndexAndTransform.H"
#include "transformField.H"
#include "flipOp.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T>
void Foam::distributionMap::applyDummyTransforms(List<T>& field) const
{
forAll(transformElements_, trafoI)
{
const labelList& elems = transformElements_[trafoI];
label n = transformStart_[trafoI];
forAll(elems, i)
{
field[n++] = field[elems[i]];
}
}
}
template<class T>
void Foam::distributionMap::applyDummyInverseTransforms(List<T>& field) const
{
forAll(transformElements_, trafoI)
{
const labelList& elems = transformElements_[trafoI];
label n = transformStart_[trafoI];
forAll(elems, i)
{
field[elems[i]] = field[n++];
}
}
}
template<class T, class TransformOp> //, class CombineOp>
void Foam::distributionMap::applyTransforms
(
const globalIndexAndTransform& globalTransforms,
List<T>& field,
const TransformOp& top
) const
{
const List<transformer>& totalTransform =
globalTransforms.transformPermutations();
forAll(totalTransform, trafoI)
{
const transformer& vt = totalTransform[trafoI];
const labelList& elems = transformElements_[trafoI];
label n = transformStart_[trafoI];
// Could be optimised to avoid memory allocations
List<T> transformFld(UIndirectList<T>(field, elems));
top(vt, true, transformFld);
forAll(transformFld, i)
{
// cop(field[n++], transformFld[i]);
field[n++] = transformFld[i];
}
}
}
template<class T, class TransformOp> //, class CombineOp>
void Foam::distributionMap::applyInverseTransforms
(
const globalIndexAndTransform& globalTransforms,
List<T>& field,
const TransformOp& top
) const
{
const List<transformer>& totalTransform =
globalTransforms.transformPermutations();
forAll(totalTransform, trafoI)
{
const transformer& vt = totalTransform[trafoI];
const labelList& elems = transformElements_[trafoI];
label n = transformStart_[trafoI];
// Could be optimised to avoid memory allocations
List<T> transformFld(SubList<T>(field, elems.size(), n));
top(vt, false, transformFld);
forAll(transformFld, i)
{
// cop(field[elems[i]], transformFld[i]);
field[elems[i]] = transformFld[i];
}
}
}
template<class T, class negateOp>
void Foam::distributionMap::distribute
(
List<T>& fld,
const negateOp& negOp,
const bool dummyTransform,
const int tag
) const
{
distributionMapBase::distribute(fld, negOp, tag);
//- Fill in transformed slots with copies
if (dummyTransform)
{
applyDummyTransforms(fld);
}
}
template<class T>
void Foam::distributionMap::distribute
(
List<T>& fld,
const bool dummyTransform,
const int tag
) const
{
distribute(fld, flipOp(), dummyTransform, tag);
}
template<class T>
void Foam::distributionMap::distribute
(
DynamicList<T>& fld,
const bool dummyTransform,
const int tag
) const
{
fld.shrink();
List<T>& fldList = static_cast<List<T>& >(fld);
distribute(fldList, dummyTransform, tag);
fld.setCapacity(fldList.size());
}
template<class T>
void Foam::distributionMap::reverseDistribute
(
const label constructSize,
List<T>& fld,
const bool dummyTransform,
const int tag
) const
{
if (dummyTransform)
{
applyDummyInverseTransforms(fld);
}
distributionMapBase::reverseDistribute(constructSize, fld, tag);
}
template<class T>
void Foam::distributionMap::reverseDistribute
(
const label constructSize,
const T& nullValue,
List<T>& fld,
const bool dummyTransform,
const int tag
) const
{
if (dummyTransform)
{
applyDummyInverseTransforms(fld);
}
distributionMapBase::reverseDistribute(constructSize, nullValue, fld, tag);
}
template<class T, class TransformOp>
void Foam::distributionMap::distribute
(
const globalIndexAndTransform& git,
List<T>& fld,
const TransformOp& top,
const int tag
) const
{
// Distribute. Leave out dummy transforms since we're doing them ourselves
distribute(fld, false, tag);
// Do transforms
applyTransforms(git, fld, top);
}
template<class T, class TransformOp>
void Foam::distributionMap::reverseDistribute
(
const globalIndexAndTransform& git,
const label constructSize,
List<T>& fld,
const TransformOp& top,
const int tag
) const
{
// Fill slots with reverse-transformed data. Note that it also copies
// back into the non-remote part of fld even though these values are not
// used.
applyInverseTransforms(git, fld, top);
// And send back (the remote slots). Disable dummy transformations.
reverseDistribute(constructSize, fld, false, tag);
}
template<class T, class TransformOp>
void Foam::distributionMap::reverseDistribute
(
const globalIndexAndTransform& git,
const label constructSize,
const T& nullValue,
List<T>& fld,
const TransformOp& top,
const int tag
) const
{
// Fill slots with reverse-transformed data Note that it also copies
// back into the non-remote part of fld even though these values are not
// used.
applyInverseTransforms(git, fld, top); //, eqOp<T>());
// And send back (the remote slots) Disable dummy transformations.
reverseDistribute(constructSize, nullValue, fld, false, tag);
}
// ************************************************************************* //

View File

@ -1,122 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::lagrangianDistributionMap
Description
Class containing mesh-to-mesh mapping information for particles
SourceFiles
lagrangianDistributionMap.C
\*---------------------------------------------------------------------------*/
#ifndef lagrangianDistributionMap_H
#define lagrangianDistributionMap_H
#include "distributionMap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyTopoChangeMap;
/*---------------------------------------------------------------------------*\
Class lagrangianDistributionMap Declaration
\*---------------------------------------------------------------------------*/
class lagrangianDistributionMap
{
// Private Data
//- Map to distribute particles
const distributionMap particleMap_;
//- Per element in subsetted mesh the cell label
const labelListList constructCellLabels_;
public:
// Constructors
//- Construct from components
lagrangianDistributionMap
(
const label nNewParticles,
labelListList&& subParticleMap,
labelListList&& constructParticleMap,
labelListList&& constructCellLabels
)
:
particleMap_(nNewParticles, subParticleMap, constructParticleMap),
constructCellLabels_(constructCellLabels)
{}
// Member Functions
// Access
//- Distribution map
const distributionMap& particleMap() const
{
return particleMap_;
}
//- Per received particle the destination cell label
const labelListList& constructCellLabels() const
{
return constructCellLabels_;
}
// Edit
//- Distribute list of lagrangian data
template<class T>
void distributeLagrangianData(List<T>& lst) const
{
particleMap_.distribute(lst);
}
//- Correct for topo change.
void updateMesh(const polyTopoChangeMap&)
{
NotImplemented;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,366 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "polyMeshDistributionMap.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::polyMeshDistributionMap::calcPatchSizes()
{
oldPatchSizes_.setSize(oldPatchStarts_.size());
if (oldPatchStarts_.size())
{
// Calculate old patch sizes
for (label patchi = 0; patchi < oldPatchStarts_.size() - 1; patchi++)
{
oldPatchSizes_[patchi] =
oldPatchStarts_[patchi + 1] - oldPatchStarts_[patchi];
}
// Set the last one by hand
const label lastPatchID = oldPatchStarts_.size() - 1;
oldPatchSizes_[lastPatchID] = nOldFaces_ - oldPatchStarts_[lastPatchID];
if (min(oldPatchSizes_) < 0)
{
FatalErrorInFunction
<< "Calculated negative old patch size:" << oldPatchSizes_ << nl
<< "Error in mapping data" << abort(FatalError);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::polyMeshDistributionMap::polyMeshDistributionMap()
:
nOldPoints_(0),
nOldFaces_(0),
nOldCells_(0),
oldPatchSizes_(0),
oldPatchStarts_(0),
oldPatchNMeshPoints_(0),
pointMap_(),
faceMap_(),
cellMap_(),
patchMap_()
{}
Foam::polyMeshDistributionMap::polyMeshDistributionMap
(
const polyMesh& mesh,
// mesh before changes
const label nOldPoints,
const label nOldFaces,
const label nOldCells,
labelList&& oldPatchStarts,
labelList&& oldPatchNMeshPoints,
// how to subset pieces of mesh to send across
labelListList&& subPointMap,
labelListList&& subFaceMap,
labelListList&& subCellMap,
labelListList&& subPatchMap,
// how to reconstruct received mesh
labelListList&& constructPointMap,
labelListList&& constructFaceMap,
labelListList&& constructCellMap,
labelListList&& constructPatchMap,
const bool subFaceHasFlip,
const bool constructFaceHasFlip
)
:
nOldPoints_(nOldPoints),
nOldFaces_(nOldFaces),
nOldCells_(nOldCells),
oldPatchSizes_(oldPatchStarts.size()),
oldPatchStarts_(move(oldPatchStarts)),
oldPatchNMeshPoints_(move(oldPatchNMeshPoints)),
pointMap_(mesh.nPoints(), move(subPointMap), move(constructPointMap)),
faceMap_
(
mesh.nFaces(),
move(subFaceMap),
move(constructFaceMap),
move(subFaceHasFlip),
constructFaceHasFlip
),
cellMap_(mesh.nCells(), move(subCellMap), move(constructCellMap)),
patchMap_
(
mesh.boundaryMesh().size(),
move(subPatchMap),
move(constructPatchMap)
)
{
calcPatchSizes();
}
Foam::polyMeshDistributionMap::polyMeshDistributionMap
(
// mesh before changes
const label nOldPoints,
const label nOldFaces,
const label nOldCells,
labelList&& oldPatchStarts,
labelList&& oldPatchNMeshPoints,
// how to transfer pieces of mesh
distributionMap&& pointMap,
distributionMap&& faceMap,
distributionMap&& cellMap,
distributionMap&& patchMap
)
:
nOldPoints_(nOldPoints),
nOldFaces_(nOldFaces),
nOldCells_(nOldCells),
oldPatchSizes_(oldPatchStarts.size()),
oldPatchStarts_(move(oldPatchStarts)),
oldPatchNMeshPoints_(move(oldPatchNMeshPoints)),
pointMap_(move(pointMap)),
faceMap_(move(faceMap)),
cellMap_(move(cellMap)),
patchMap_(move(patchMap))
{
calcPatchSizes();
}
Foam::polyMeshDistributionMap::polyMeshDistributionMap
(
polyMeshDistributionMap&& map
)
:
nOldPoints_(map.nOldPoints_),
nOldFaces_(map.nOldFaces_),
nOldCells_(map.nOldCells_),
oldPatchSizes_(move(map.oldPatchSizes_)),
oldPatchStarts_(move(map.oldPatchStarts_)),
oldPatchNMeshPoints_(move(map.oldPatchNMeshPoints_)),
pointMap_(move(map.pointMap_)),
faceMap_(move(map.faceMap_)),
cellMap_(move(map.cellMap_)),
patchMap_(move(map.patchMap_))
{}
Foam::polyMeshDistributionMap::polyMeshDistributionMap(Istream& is)
{
is >> *this;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::polyMeshDistributionMap::transfer(polyMeshDistributionMap& rhs)
{
nOldPoints_ = rhs.nOldPoints_;
nOldFaces_ = rhs.nOldFaces_;
nOldCells_ = rhs.nOldCells_;
oldPatchSizes_.transfer(rhs.oldPatchSizes_);
oldPatchStarts_.transfer(rhs.oldPatchStarts_);
oldPatchNMeshPoints_.transfer(rhs.oldPatchNMeshPoints_);
pointMap_.transfer(rhs.pointMap_);
faceMap_.transfer(rhs.faceMap_);
cellMap_.transfer(rhs.cellMap_);
patchMap_.transfer(rhs.patchMap_);
}
void Foam::polyMeshDistributionMap::distributePointIndices(labelList& lst) const
{
// Construct boolList from selected elements
boolList isSelected
(
createWithValues<boolList>
(
nOldPoints(),
false,
lst,
true
)
);
// Distribute
distributePointData(isSelected);
// Collect selected elements
lst = findIndices(isSelected, true);
}
void Foam::polyMeshDistributionMap::distributeFaceIndices(labelList& lst) const
{
// Construct boolList from selected elements
boolList isSelected
(
createWithValues<boolList>
(
nOldFaces(),
false,
lst,
true
)
);
// Distribute
distributeFaceData(isSelected);
// Collect selected elements
lst = findIndices(isSelected, true);
}
void Foam::polyMeshDistributionMap::distributeCellIndices(labelList& lst) const
{
// Construct boolList from selected elements
boolList isSelected
(
createWithValues<boolList>
(
nOldCells(),
false,
lst,
true
)
);
// Distribute
distributeCellData(isSelected);
// Collect selected elements
lst = findIndices(isSelected, true);
}
void Foam::polyMeshDistributionMap::distributePatchIndices(labelList& lst) const
{
// Construct boolList from selected elements
boolList isSelected
(
createWithValues<boolList>
(
oldPatchStarts().size(), // nOldPatches
false,
lst,
true
)
);
// Distribute
distributePatchData(isSelected);
// Collect selected elements
lst = findIndices(isSelected, true);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::polyMeshDistributionMap::operator=
(
const polyMeshDistributionMap& rhs
)
{
nOldPoints_ = rhs.nOldPoints_;
nOldFaces_ = rhs.nOldFaces_;
nOldCells_ = rhs.nOldCells_;
oldPatchSizes_ = rhs.oldPatchSizes_;
oldPatchStarts_ = rhs.oldPatchStarts_;
oldPatchNMeshPoints_ = rhs.oldPatchNMeshPoints_;
pointMap_ = rhs.pointMap_;
faceMap_ = rhs.faceMap_;
cellMap_ = rhs.cellMap_;
patchMap_ = rhs.patchMap_;
}
void Foam::polyMeshDistributionMap::operator=(polyMeshDistributionMap&& rhs)
{
nOldPoints_ = rhs.nOldPoints_;
nOldFaces_ = rhs.nOldFaces_;
nOldCells_ = rhs.nOldCells_;
oldPatchSizes_ = move(rhs.oldPatchSizes_);
oldPatchStarts_ = move(rhs.oldPatchStarts_);
oldPatchNMeshPoints_ = move(rhs.oldPatchNMeshPoints_);
pointMap_ = move(rhs.pointMap_);
faceMap_ = move(rhs.faceMap_);
cellMap_ = move(rhs.cellMap_);
patchMap_ = move(rhs.patchMap_);
}
// * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, polyMeshDistributionMap& map)
{
is.fatalCheck("operator>>(Istream&, polyMeshDistributionMap&)");
is >> map.nOldPoints_
>> map.nOldFaces_
>> map.nOldCells_
>> map.oldPatchSizes_
>> map.oldPatchStarts_
>> map.oldPatchNMeshPoints_
>> map.pointMap_
>> map.faceMap_
>> map.cellMap_
>> map.patchMap_;
return is;
}
// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const polyMeshDistributionMap& map)
{
os << map.nOldPoints_
<< token::SPACE << map.nOldFaces_
<< token::SPACE << map.nOldCells_ << token::NL
<< map.oldPatchSizes_ << token::NL
<< map.oldPatchStarts_ << token::NL
<< map.oldPatchNMeshPoints_ << token::NL
<< map.pointMap_ << token::NL
<< map.faceMap_ << token::NL
<< map.cellMap_ << token::NL
<< map.patchMap_;
return os;
}
// ************************************************************************* //

View File

@ -1,312 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::polyMeshDistributionMap
Description
Class containing mesh-to-mesh mapping information after a mesh distribution
where we send parts of meshes (using subsetting) to other processors
and receive and reconstruct mesh.
We store mapping from the bits-to-send to the complete starting mesh
(subXXXMap) and from the received bits to their location in the new
mesh (constructXXXMap).
SourceFiles
polyMeshDistributionMap.C
\*---------------------------------------------------------------------------*/
#ifndef polyMeshDistributionMap_H
#define polyMeshDistributionMap_H
#include "distributionMap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyTopoChangeMap;
class polyMesh;
// Forward declaration of friend functions and operators
class polyMeshDistributionMap;
Istream& operator>>(Istream&, polyMeshDistributionMap&);
Ostream& operator<<(Ostream&, const polyMeshDistributionMap&);
/*---------------------------------------------------------------------------*\
Class polyMeshDistributionMap Declaration
\*---------------------------------------------------------------------------*/
class polyMeshDistributionMap
{
// Private Data
//- Number of old live points
label nOldPoints_;
//- Number of old live faces
label nOldFaces_;
//- Number of old live cells
label nOldCells_;
//- List of the old patch sizes
labelList oldPatchSizes_;
//- List of the old patch start labels
labelList oldPatchStarts_;
//- List of numbers of mesh points per old patch
labelList oldPatchNMeshPoints_;
//- Point distribute map
distributionMap pointMap_;
//- Face distribute map
distributionMap faceMap_;
//- Cell distribute map
distributionMap cellMap_;
//- Patch distribute map
distributionMap patchMap_;
// Private Member Functions
void calcPatchSizes();
public:
// Constructors
//- Construct null
polyMeshDistributionMap();
//- Move constructor from components.
// Note that mesh has to be changed already
// since uses mesh.nPoints etc as the new size.
polyMeshDistributionMap
(
const polyMesh& mesh,
// mesh before changes
const label nOldPoints,
const label nOldFaces,
const label nOldCells,
labelList&& oldPatchStarts,
labelList&& oldPatchNMeshPoints,
// how to subset pieces of mesh to send across
labelListList&& subPointMap,
labelListList&& subFaceMap,
labelListList&& subCellMap,
labelListList&& subPatchMap,
// how to reconstruct received mesh
labelListList&& constructPointMap,
labelListList&& constructFaceMap,
labelListList&& constructCellMap,
labelListList&& constructPatchMap,
const bool subFaceHasFlip = false,
const bool constructFaceHasFlip = false
);
//- Move constructor from components
polyMeshDistributionMap
(
// mesh before changes
const label nOldPoints,
const label nOldFaces,
const label nOldCells,
labelList&& oldPatchStarts,
labelList&& oldPatchNMeshPoints,
// how to subset pieces of mesh to send across
distributionMap&& pointMap,
distributionMap&& faceMap,
distributionMap&& cellMap,
distributionMap&& patchMap
);
//- Move constructor
polyMeshDistributionMap(polyMeshDistributionMap&&);
//- Construct from Istream
polyMeshDistributionMap(Istream&);
//- Disallow default bitwise copy construction
polyMeshDistributionMap(const polyMeshDistributionMap&) = delete;
// Member Functions
// Access
//- Number of points in mesh before distribution
label nOldPoints() const
{
return nOldPoints_;
}
//- Number of faces in mesh before distribution
label nOldFaces() const
{
return nOldFaces_;
}
//- Number of cells in mesh before distribution
label nOldCells() const
{
return nOldCells_;
}
//- List of the old patch sizes
const labelList& oldPatchSizes() const
{
return oldPatchSizes_;
}
//- List of the old patch start labels
const labelList& oldPatchStarts() const
{
return oldPatchStarts_;
}
//- List of numbers of mesh points per old patch
const labelList& oldPatchNMeshPoints() const
{
return oldPatchNMeshPoints_;
}
//- Point distribute map
const distributionMap& pointMap() const
{
return pointMap_;
}
//- Face distribute map
const distributionMap& faceMap() const
{
return faceMap_;
}
//- Cell distribute map
const distributionMap& cellMap() const
{
return cellMap_;
}
//- Patch distribute map
const distributionMap& patchMap() const
{
return patchMap_;
}
// Other
//- Transfer the contents of the argument and annul the argument.
void transfer(polyMeshDistributionMap&);
//- Distribute list of point data
template<class T>
void distributePointData(List<T>& lst) const
{
pointMap_.distribute(lst);
}
//- Distribute list of face data
template<class T>
void distributeFaceData(List<T>& lst) const
{
faceMap_.distribute(lst);
}
//- Distribute list of cell data
template<class T>
void distributeCellData(List<T>& lst) const
{
cellMap_.distribute(lst);
}
//- Distribute list of patch data
template<class T>
void distributePatchData(List<T>& lst) const
{
patchMap_.distribute(lst);
}
//- Distribute list of point/face/cell/patch indices.
// (Converts to boolList, distributes boolList and reconstructs)
void distributePointIndices(labelList& pointIDs) const;
void distributeFaceIndices(labelList& faceIDs) const;
void distributeCellIndices(labelList& cellIDs) const;
void distributePatchIndices(labelList& patchIDs) const;
//- Correct for topo change.
void updateMesh(const polyTopoChangeMap&)
{
NotImplemented;
}
// Member Operators
void operator=(const polyMeshDistributionMap&);
void operator=(polyMeshDistributionMap&&);
// IOstream Operators
//- Read dictionary from Istream
friend Istream& operator>>(Istream&, polyMeshDistributionMap&);
//- Write dictionary to Ostream
friend Ostream& operator<<(Ostream&, const polyMeshDistributionMap&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -127,7 +127,7 @@ void Foam::polyMesh::updateMesh(const polyTopoChangeMap& map)
}
void Foam::polyMesh::distribute(const polyMeshDistributionMap& map)
void Foam::polyMesh::distribute(const polyDistributionMap& map)
{
meshObject::distribute<polyMesh>(*this, map);
meshObject::distribute<pointMesh>(*this, map);

View File

@ -35,7 +35,7 @@ License
#include "removeCells.H"
#include "polyModifyFace.H"
#include "polyRemovePoint.H"
#include "polyMeshDistributionMap.H"
#include "polyDistributionMap.H"
#include "surfaceFields.H"
#include "pointFields.H"
#include "syncTools.H"
@ -1772,7 +1772,7 @@ Foam::labelList Foam::fvMeshDistribute::countCells
}
Foam::autoPtr<Foam::polyMeshDistributionMap> Foam::fvMeshDistribute::distribute
Foam::autoPtr<Foam::polyDistributionMap> Foam::fvMeshDistribute::distribute
(
const labelList& distribution
)
@ -1820,9 +1820,9 @@ Foam::autoPtr<Foam::polyMeshDistributionMap> Foam::fvMeshDistribute::distribute
if (!Pstream::parRun())
{
// Collect all maps and return
return autoPtr<polyMeshDistributionMap>
return autoPtr<polyDistributionMap>
(
new polyMeshDistributionMap
new polyDistributionMap
(
mesh_,
@ -3064,9 +3064,9 @@ Foam::autoPtr<Foam::polyMeshDistributionMap> Foam::fvMeshDistribute::distribute
}
// Collect all maps and return
return autoPtr<polyMeshDistributionMap>
return autoPtr<polyDistributionMap>
(
new polyMeshDistributionMap
new polyDistributionMap
(
mesh_,

View File

@ -62,7 +62,7 @@ namespace Foam
// Forward declaration of classes
class mapAddedPolyMesh;
class polyMeshDistributionMap;
class polyDistributionMap;
/*---------------------------------------------------------------------------*\
Class fvMeshDistribute Declaration
@ -366,7 +366,7 @@ public:
//- Send cells to neighbours according to distribution
// (for every cell the new proc)
autoPtr<polyMeshDistributionMap> distribute(const labelList& dist);
autoPtr<polyDistributionMap> distribute(const labelList& dist);
// Debugging

View File

@ -829,7 +829,7 @@ void Foam::boundaryCutter::setRefinement
}
void Foam::boundaryCutter::updateMesh(const polyTopoChangeMap& morphMap)
void Foam::boundaryCutter::updateMesh(const polyTopoChangeMap& map)
{
// Update stored labels for mesh change.
@ -845,11 +845,11 @@ void Foam::boundaryCutter::updateMesh(const polyTopoChangeMap& morphMap)
{
label oldFacei = iter.key();
label newFacei = morphMap.reverseFaceMap()[oldFacei];
label newFacei = map.reverseFaceMap()[oldFacei];
label oldPointi = iter();
label newPointi = morphMap.reversePointMap()[oldPointi];
label newPointi = map.reversePointMap()[oldPointi];
if (newFacei >= 0 && newPointi >= 0)
{
@ -882,9 +882,9 @@ void Foam::boundaryCutter::updateMesh(const polyTopoChangeMap& morphMap)
{
const edge& e = iter.key();
label newStart = morphMap.reversePointMap()[e.start()];
label newStart = map.reversePointMap()[e.start()];
label newEnd = morphMap.reversePointMap()[e.end()];
label newEnd = map.reversePointMap()[e.end()];
if (newStart >= 0 && newEnd >= 0)
{
@ -896,7 +896,7 @@ void Foam::boundaryCutter::updateMesh(const polyTopoChangeMap& morphMap)
forAll(addedPoints, i)
{
label newAddedPointi =
morphMap.reversePointMap()[addedPoints[i]];
map.reversePointMap()[addedPoints[i]];
if (newAddedPointi >= 0)
{

View File

@ -995,7 +995,7 @@ void Foam::meshCutter::setRefinement
}
void Foam::meshCutter::updateMesh(const polyTopoChangeMap& morphMap)
void Foam::meshCutter::updateMesh(const polyTopoChangeMap& map)
{
// Update stored labels for mesh change.
@ -1007,11 +1007,11 @@ void Foam::meshCutter::updateMesh(const polyTopoChangeMap& morphMap)
forAllConstIter(Map<label>, addedCells_, iter)
{
label celli = iter.key();
label newCelli = morphMap.reverseCellMap()[celli];
label newCelli = map.reverseCellMap()[celli];
label addedCelli = iter();
label newAddedCelli = morphMap.reverseCellMap()[addedCelli];
label newAddedCelli = map.reverseCellMap()[addedCelli];
if (newCelli >= 0 && newAddedCelli >= 0)
{
@ -1040,11 +1040,11 @@ void Foam::meshCutter::updateMesh(const polyTopoChangeMap& morphMap)
forAllConstIter(Map<label>, addedFaces_, iter)
{
label celli = iter.key();
label newCelli = morphMap.reverseCellMap()[celli];
label newCelli = map.reverseCellMap()[celli];
label addedFacei = iter();
label newAddedFacei = morphMap.reverseFaceMap()[addedFacei];
label newAddedFacei = map.reverseFaceMap()[addedFacei];
if ((newCelli >= 0) && (newAddedFacei >= 0))
{
@ -1081,13 +1081,13 @@ void Foam::meshCutter::updateMesh(const polyTopoChangeMap& morphMap)
{
const edge& e = iter.key();
label newStart = morphMap.reversePointMap()[e.start()];
label newStart = map.reversePointMap()[e.start()];
label newEnd = morphMap.reversePointMap()[e.end()];
label newEnd = map.reversePointMap()[e.end()];
label addedPointi = iter();
label newAddedPointi = morphMap.reversePointMap()[addedPointi];
label newAddedPointi = map.reversePointMap()[addedPointi];
if ((newStart >= 0) && (newEnd >= 0) && (newAddedPointi >= 0))
{

View File

@ -318,13 +318,13 @@ void Foam::multiDirRefinement::refineHex8
hexRefiner.setRefinement(consistentCells, meshMod);
// Change mesh, no inflation
autoPtr<polyTopoChangeMap> morphMapPtr =
autoPtr<polyTopoChangeMap> mapPtr =
meshMod.changeMesh(mesh, false, true);
const polyTopoChangeMap& morphMap = morphMapPtr();
const polyTopoChangeMap& map = mapPtr();
if (morphMap.hasMotionPoints())
if (map.hasMotionPoints())
{
mesh.movePoints(morphMap.preMotionPoints());
mesh.movePoints(map.preMotionPoints());
}
if (writeMesh)
@ -338,7 +338,7 @@ void Foam::multiDirRefinement::refineHex8
<< mesh.time().timeName() << endl;
}
hexRefiner.updateMesh(morphMap);
hexRefiner.updateMesh(map);
// Collect all cells originating from same old cell (original + 7 extra)
@ -348,7 +348,7 @@ void Foam::multiDirRefinement::refineHex8
}
labelList nAddedCells(addedCells_.size(), 0);
const labelList& cellMap = morphMap.cellMap();
const labelList& cellMap = map.cellMap();
forAll(cellMap, celli)
{

View File

@ -164,20 +164,20 @@ Foam::Map<Foam::label> Foam::refinementIterator::setRefinement
// Do all changes
//
autoPtr<polyTopoChangeMap> morphMap = meshMod.changeMesh
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh
(
mesh_,
false
);
// Move mesh (since morphing does not do this)
if (morphMap().hasMotionPoints())
if (map().hasMotionPoints())
{
mesh_.movePoints(morphMap().preMotionPoints());
mesh_.movePoints(map().preMotionPoints());
}
// Update stored refinement pattern
meshRefiner_.updateMesh(morphMap());
meshRefiner_.updateMesh(map());
// Write resulting mesh
if (writeMesh_)
@ -195,14 +195,14 @@ Foam::Map<Foam::label> Foam::refinementIterator::setRefinement
// in meshCutter class.
updateLabels
(
morphMap->reverseCellMap(),
map->reverseCellMap(),
currentRefCells
);
// Update addedCells for new cell numbers
updateLabels
(
morphMap->reverseCellMap(),
map->reverseCellMap(),
addedCells
);
@ -229,7 +229,7 @@ Foam::Map<Foam::label> Foam::refinementIterator::setRefinement
// Update refCells for new cell numbers.
updateLabels
(
morphMap->reverseCellMap(),
map->reverseCellMap(),
currentRefCells
);

View File

@ -321,20 +321,20 @@ void Foam::undoableMeshCutter::setRefinement
}
void Foam::undoableMeshCutter::updateMesh(const polyTopoChangeMap& morphMap)
void Foam::undoableMeshCutter::updateMesh(const polyTopoChangeMap& map)
{
// Update mesh cutter for new labels.
meshCutter::updateMesh(morphMap);
meshCutter::updateMesh(map);
// No need to update cell walker for new labels since does not store any.
// Update faceRemover for new labels
faceRemover_.updateMesh(morphMap);
faceRemover_.updateMesh(map);
if (undoable_)
{
// Update all live split cells for mesh mapper.
updateLabels(morphMap.reverseCellMap(), liveSplitCells_);
updateLabels(map.reverseCellMap(), liveSplitCells_);
}
}

View File

@ -175,7 +175,7 @@ public:
//- Update stored refinement pattern for changes to mesh. Only
// call if undoable set.
void updateMesh(const polyTopoChangeMap& morphMap);
void updateMesh(const polyTopoChangeMap& map);
//- Calculate split faces from current liveCells. Only
// call if undoable set.

View File

@ -200,7 +200,7 @@ void Foam::componentDisplacementMotionSolver::updateMesh
void Foam::componentDisplacementMotionSolver::distribute
(
const polyMeshDistributionMap& map
const polyDistributionMap& map
)
{}

View File

@ -129,7 +129,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
// Member Operators

View File

@ -116,7 +116,7 @@ void Foam::componentVelocityMotionSolver::updateMesh
void Foam::componentVelocityMotionSolver::distribute
(
const polyMeshDistributionMap& map
const polyDistributionMap& map
)
{}

View File

@ -121,7 +121,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
// Member Operators

View File

@ -159,7 +159,7 @@ void Foam::points0MotionSolver::updateMesh(const polyTopoChangeMap& map)
void Foam::points0MotionSolver::distribute
(
const polyMeshDistributionMap& map
const polyDistributionMap& map
)
{}

View File

@ -109,7 +109,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
// Member Operators

View File

@ -48,7 +48,7 @@ namespace Foam
// Forward class declarations
class polyMesh;
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
/*---------------------------------------------------------------------------*\
Class motionSolver Declaration
@ -151,7 +151,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&) = 0;
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&) = 0;
virtual void distribute(const polyDistributionMap&) = 0;
//- Optionally write motion state information for restart
virtual bool write() const;

View File

@ -115,7 +115,7 @@ void Foam::motionSolverList::updateMesh(const polyTopoChangeMap& map)
void Foam::motionSolverList::distribute
(
const polyMeshDistributionMap& map
const polyDistributionMap& map
)
{
forAll(motionSolvers_, i)

View File

@ -93,7 +93,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
// Member Operators

View File

@ -79,7 +79,7 @@ void Foam::velocityMotionSolver::updateMesh(const polyTopoChangeMap& map)
}
void Foam::velocityMotionSolver::distribute(const polyMeshDistributionMap&)
void Foam::velocityMotionSolver::distribute(const polyDistributionMap&)
{}

View File

@ -112,7 +112,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
// Member Operators

View File

@ -483,7 +483,7 @@ void Foam::perfectInterface::modifyMotionPoints(pointField& motionPoints) const
}
void Foam::perfectInterface::updateMesh(const polyTopoChangeMap& morphMap)
void Foam::perfectInterface::updateMesh(const polyTopoChangeMap& map)
{
// Mesh has changed topologically. Update local topological data
const polyMesh& mesh = topoChanger().mesh();

View File

@ -1721,7 +1721,7 @@ void Foam::addPatchCellLayer::setRefinement
void Foam::addPatchCellLayer::updateMesh
(
const polyTopoChangeMap& morphMap,
const polyTopoChangeMap& map,
const labelList& faceMap, // new to old patch faces
const labelList& pointMap // new to old patch points
)
@ -1741,7 +1741,7 @@ void Foam::addPatchCellLayer::updateMesh
forAll(added, i)
{
label newPointi = morphMap.reversePointMap()[added[i]];
label newPointi = map.reversePointMap()[added[i]];
if (newPointi >= 0)
{
@ -1768,7 +1768,7 @@ void Foam::addPatchCellLayer::updateMesh
forAll(added, i)
{
label newFacei = morphMap.reverseFaceMap()[added[i]];
label newFacei = map.reverseFaceMap()[added[i]];
if (newFacei >= 0)
{

View File

@ -39,7 +39,7 @@ License
#include "OFstream.H"
#include "Time.H"
#include "FaceCellWave.H"
#include "polyMeshDistributionMap.H"
#include "polyDistributionMap.H"
#include "refinementData.H"
#include "refinementDistanceData.H"
#include "degenerateMatcher.H"
@ -4514,7 +4514,7 @@ void Foam::hexRef8::subset
}
void Foam::hexRef8::distribute(const polyMeshDistributionMap& map)
void Foam::hexRef8::distribute(const polyDistributionMap& map)
{
if (debug)
{

View File

@ -56,7 +56,7 @@ class polyMesh;
class polyPatch;
class polyTopoChange;
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
/*---------------------------------------------------------------------------*\
Class hexRef8 Declaration
@ -532,7 +532,7 @@ public:
);
//- Update local numbering for mesh redistribution
void distribute(const polyMeshDistributionMap&);
void distribute(const polyDistributionMap&);
//- Debug: Check coupled mesh for correctness
void checkMesh() const;

View File

@ -28,7 +28,7 @@ License
#include "hexRef8Data.H"
#include "polyTopoChangeMap.H"
#include "polyMeshDistributionMap.H"
#include "polyDistributionMap.H"
#include "polyMesh.H"
#include "syncTools.H"
#include "refinementHistory.H"
@ -349,7 +349,7 @@ void Foam::hexRef8Data::updateMesh(const polyTopoChangeMap& map)
}
void Foam::hexRef8Data::distribute(const polyMeshDistributionMap& map)
void Foam::hexRef8Data::distribute(const polyDistributionMap& map)
{
if (cellLevelPtr_.valid())
{

View File

@ -47,7 +47,7 @@ namespace Foam
// Forward declaration of classes
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
class refinementHistory;
class fvMesh;
@ -115,7 +115,7 @@ public:
void updateMesh(const polyTopoChangeMap&);
//- In-place distribute
void distribute(const polyMeshDistributionMap&);
void distribute(const polyDistributionMap&);
//- Write
bool write() const;

View File

@ -25,7 +25,7 @@ License
#include "refinementHistory.H"
#include "polyTopoChangeMap.H"
#include "polyMeshDistributionMap.H"
#include "polyDistributionMap.H"
#include "polyMesh.H"
#include "syncTools.H"
@ -1257,7 +1257,7 @@ void Foam::refinementHistory::countProc
}
void Foam::refinementHistory::distribute(const polyMeshDistributionMap& map)
void Foam::refinementHistory::distribute(const polyDistributionMap& map)
{
if (!active())
{

View File

@ -86,7 +86,7 @@ namespace Foam
// Forward declaration of classes
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
// Forward declaration of friend functions and operators
@ -355,7 +355,7 @@ public:
//- Update local numbering for mesh redistribution.
// Can only distribute clusters sent across in one go; cannot
// handle parts recombined in multiple passes.
void distribute(const polyMeshDistributionMap&);
void distribute(const polyDistributionMap&);
//- Compact splitCells_. Removes all freeSplitCells_ elements.

View File

@ -54,7 +54,7 @@ class polyMesh;
class polyTopoChange;
class face;
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
/*---------------------------------------------------------------------------*\
Class removeFaces Declaration
@ -205,7 +205,7 @@ public:
{}
//- Force recalculation of locally stored data for mesh distribution
void distribute(const polyMeshDistributionMap&)
void distribute(const polyDistributionMap&)
{}

View File

@ -88,18 +88,18 @@ void Foam::setUpdater::modifyMotionPoints(pointField&) const
{}
void Foam::setUpdater::updateMesh(const polyTopoChangeMap& morphMap)
void Foam::setUpdater::updateMesh(const polyTopoChangeMap& map)
{
// Mesh has changed topologically. Update all sets.
if (debug)
{
Pout<< "setUpdater::updateMesh(const polyTopoChangeMap& morphMap)"
Pout<< "setUpdater::updateMesh(const polyTopoChangeMap& map)"
<< endl;
}
updateSets<cellSet>(morphMap);
updateSets<faceSet>(morphMap);
updateSets<pointSet>(morphMap);
updateSets<cellSet>(map);
updateSets<faceSet>(map);
updateSets<pointSet>(map);
}

View File

@ -56,7 +56,7 @@ class setUpdater
//- Updates all sets
template<class Type>
void updateSets(const polyTopoChangeMap& morphMap) const;
void updateSets(const polyTopoChangeMap& map) const;
public:

View File

@ -32,14 +32,14 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::setUpdater::updateSets(const polyTopoChangeMap& morphMap) const
void Foam::setUpdater::updateSets(const polyTopoChangeMap& map) const
{
//
// Update all sets in memory.
//
HashTable<const Type*> memSets =
morphMap.mesh().objectRegistry::lookupClass<Type>();
map.mesh().objectRegistry::lookupClass<Type>();
forAllIter(typename HashTable<const Type*>, memSets, iter)
{
@ -51,7 +51,7 @@ void Foam::setUpdater::updateSets(const polyTopoChangeMap& morphMap) const
<< " updated in memory" << endl;
}
set.updateMesh(morphMap);
set.updateMesh(map);
// Write or not? Debatable.
set.write();
@ -65,8 +65,8 @@ void Foam::setUpdater::updateSets(const polyTopoChangeMap& morphMap) const
// Get last valid mesh (discard points-only change)
IOobjectList Objects
(
morphMap.mesh().time(),
morphMap.mesh().facesInstance(),
map.mesh().time(),
map.mesh().facesInstance(),
"polyMesh/sets"
);
@ -85,7 +85,7 @@ void Foam::setUpdater::updateSets(const polyTopoChangeMap& morphMap) const
<< " updated on disk" << endl;
}
set.updateMesh(morphMap);
set.updateMesh(map);
set.write();
}

View File

@ -47,7 +47,7 @@ namespace Foam
class fvMesh;
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
/*---------------------------------------------------------------------------*\
Class option Declaration
@ -216,7 +216,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&) = 0;
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&) = 0;
virtual void distribute(const polyDistributionMap&) = 0;
//- Update for mesh motion
virtual bool movePoints() = 0;

View File

@ -248,7 +248,7 @@ void Foam::fvConstraints::updateMesh(const polyTopoChangeMap& map)
}
void Foam::fvConstraints::distribute(const polyMeshDistributionMap& map)
void Foam::fvConstraints::distribute(const polyDistributionMap& map)
{
PtrListDictionary<fvConstraint>& constraintList(*this);

View File

@ -137,7 +137,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -48,7 +48,7 @@ namespace Foam
class fvMesh;
class polyTopoChangeMap;
class polyMeshDistributionMap;
class polyDistributionMap;
/*---------------------------------------------------------------------------*\
Class fvModel Declaration
@ -334,7 +334,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&) = 0;
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&) = 0;
virtual void distribute(const polyDistributionMap&) = 0;
//- Update for mesh motion
virtual bool movePoints() = 0;

View File

@ -274,7 +274,7 @@ void Foam::fvModels::updateMesh(const polyTopoChangeMap& map)
}
void Foam::fvModels::distribute(const polyMeshDistributionMap& map)
void Foam::fvModels::distribute(const polyDistributionMap& map)
{
PtrListDictionary<fvModel>& modelList(*this);

View File

@ -243,7 +243,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();

View File

@ -174,7 +174,7 @@ void Foam::fvCellSet::updateMesh(const polyTopoChangeMap&)
}
void Foam::fvCellSet::distribute(const polyMeshDistributionMap&)
void Foam::fvCellSet::distribute(const polyDistributionMap&)
{
setCells();
setV();

View File

@ -70,7 +70,7 @@ namespace Foam
{
class fvMesh;
class polyMeshDistributionMap;
class polyDistributionMap;
/*---------------------------------------------------------------------------*\
Class fvCellSet Declaration
@ -170,7 +170,7 @@ public:
void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
void distribute(const polyMeshDistributionMap&);
void distribute(const polyDistributionMap&);
//- Update for mesh motion
void movePoints();

View File

@ -934,7 +934,7 @@ void Foam::fvMesh::updateMesh(const polyTopoChangeMap& map)
}
void Foam::fvMesh::distribute(const polyMeshDistributionMap& map)
void Foam::fvMesh::distribute(const polyDistributionMap& map)
{
// Distribute polyMesh data
polyMesh::distribute(map);

View File

@ -74,7 +74,7 @@ class fvMeshTopoChanger;
class fvMeshDistributor;
class fvMeshMover;
class volMesh;
class polyMeshDistributionMap;
class polyDistributionMap;
/*---------------------------------------------------------------------------*\
Class fvMesh Declaration
@ -384,7 +384,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap& map);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap& map);
virtual void distribute(const polyDistributionMap& map);
//- Move points, returns volumes swept by faces in motion
virtual tmp<scalarField> movePoints(const pointField&);

View File

@ -161,7 +161,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&) = 0;
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&) = 0;
virtual void distribute(const polyDistributionMap&) = 0;
//- Write the mover state
virtual bool write(const bool write = true) const

View File

@ -87,7 +87,7 @@ public:
{}
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&)
virtual void distribute(const polyDistributionMap&)
{}

View File

@ -161,7 +161,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&) = 0;
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&) = 0;
virtual void distribute(const polyDistributionMap&) = 0;
//- Write the mover state
virtual bool write(const bool write = true) const

View File

@ -87,7 +87,7 @@ public:
{}
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&)
virtual void distribute(const polyDistributionMap&)
{}

View File

@ -161,7 +161,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&) = 0;
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&) = 0;
virtual void distribute(const polyDistributionMap&) = 0;
//- Write the mover state
virtual bool write(const bool write = true) const

View File

@ -87,7 +87,7 @@ public:
{}
//- Update corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&)
virtual void distribute(const polyDistributionMap&)
{}

View File

@ -94,7 +94,7 @@ void Foam::nearWallDist::updateMesh(const polyTopoChangeMap& map)
}
void Foam::nearWallDist::distribute(const polyMeshDistributionMap& map)
void Foam::nearWallDist::distribute(const polyDistributionMap& map)
{
correct();
}

View File

@ -97,7 +97,7 @@ public:
virtual void updateMesh(const polyTopoChangeMap&);
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&);
virtual void distribute(const polyDistributionMap&);
//- Update the y-field when the mesh moves
virtual bool movePoints();

View File

@ -142,7 +142,7 @@ public:
{}
//- Update mesh corresponding to the given distribution map
virtual void distribute(const polyMeshDistributionMap&)
virtual void distribute(const polyDistributionMap&)
{}
//- Update cached geometry when the mesh moves

Some files were not shown because too many files have changed in this diff Show More