ENH: globalMeshData, mapDistribute : added pointBoundaryFaces/pointBoundaryCells

This commit is contained in:
mattijs
2011-02-08 16:16:50 +00:00
parent a6e8df4aa2
commit 2adfd534db
13 changed files with 1462 additions and 1072 deletions

View File

@ -70,7 +70,12 @@ int main(int argc, char *argv[])
); );
// Exchange data. Apply positional transforms. // Exchange data. Apply positional transforms.
globalPointSlavesMap.distribute(transforms, coords, true); globalPointSlavesMap.distribute
(
transforms,
coords,
mapDistribute::transformPosition()
);
// Print // Print
forAll(slaves, pointI) forAll(slaves, pointI)
@ -127,7 +132,12 @@ int main(int argc, char *argv[])
} }
// Exchange data Apply positional transforms. // Exchange data Apply positional transforms.
globalEdgeSlavesMap.distribute(transforms, ec, true); globalEdgeSlavesMap.distribute
(
transforms,
ec,
mapDistribute::transformPosition()
);
// Print // Print
forAll(slaves, edgeI) forAll(slaves, edgeI)
@ -163,82 +173,131 @@ int main(int argc, char *argv[])
} }
//// Test: (collocated) point to faces addressing // Test: point to faces addressing
//{ {
// const labelListList& globalPointBoundaryFaces = const mapDistribute& globalPointBoundaryFacesMap =
// globalData.globalPointBoundaryFaces(); globalData.globalPointBoundaryFacesMap();
// const mapDistribute& globalPointBoundaryFacesMap = const labelListList& slaves =
// globalData.globalPointBoundaryFacesMap(); globalData.globalPointBoundaryFaces();
// const labelListList& transformedSlaves =
// label nBnd = mesh.nFaces()-mesh.nInternalFaces(); globalData.globalPointTransformedBoundaryFaces();
//
// pointField fc(globalPointBoundaryFacesMap.constructSize()); label nBnd = mesh.nFaces()-mesh.nInternalFaces();
// SubList<point>(fc, nBnd).assign
// ( pointField fc(globalPointBoundaryFacesMap.constructSize());
// primitivePatch SubList<point>(fc, nBnd).assign
// ( (
// SubList<face> primitivePatch
// ( (
// mesh.faces(), SubList<face>
// nBnd, (
// mesh.nInternalFaces() mesh.faces(),
// ), nBnd,
// mesh.points() mesh.nInternalFaces()
// ).faceCentres() ),
// ); mesh.points()
// ).faceCentres()
// // Exchange data );
// globalPointBoundaryFacesMap.distribute(fc);
// // Exchange data
// // Print globalPointBoundaryFacesMap.distribute
// forAll(globalPointBoundaryFaces, pointI) (
// { transforms,
// const labelList& bFaces = globalPointBoundaryFaces[pointI]; fc,
// mapDistribute::transformPosition()
// Pout<< "Point:" << pointI );
// << " at:" << coupledPatch.localPoints()[pointI]
// << " connected to faces:" << endl; // Print
// forAll(slaves, pointI)
// forAll(bFaces, i) {
// { const labelList& slaveFaces = slaves[pointI];
// Pout<< " " << fc[bFaces[i]] << endl;
// } if (slaveFaces.size() > 0)
// } {
//} Pout<< "Master point:" << pointI
// << " at:" << coupledPatch.localPoints()[pointI]
// << " connected to " << slaveFaces.size()
//// Test:(collocated) point to cells addressing << " untransformed faces:" << endl;
//{
// const labelList& boundaryCells = globalData.boundaryCells(); forAll(slaveFaces, i)
// const labelListList& globalPointBoundaryCells = {
// globalData.globalPointBoundaryCells(); Pout<< " " << fc[slaveFaces[i]] << endl;
// const mapDistribute& globalPointBoundaryCellsMap = }
// globalData.globalPointBoundaryCellsMap(); }
//
// pointField cc(globalPointBoundaryCellsMap.constructSize()); const labelList& transformedSlaveFaces = transformedSlaves[pointI];
// forAll(boundaryCells, i)
// { if (transformedSlaveFaces.size() > 0)
// cc[i] = mesh.cellCentres()[boundaryCells[i]]; {
// } Pout<< "Master point:" << pointI
// << " connected to " << transformedSlaveFaces.size()
// // Exchange data << " transformed faces:" << endl;
// globalPointBoundaryCellsMap.distribute(cc);
// forAll(transformedSlaveFaces, i)
// // Print {
// forAll(globalPointBoundaryCells, pointI) Pout<< " " << fc[transformedSlaveFaces[i]] << endl;
// { }
// const labelList& bCells = globalPointBoundaryCells[pointI]; }
// }
// Pout<< "Point:" << pointI }
// << " at:" << coupledPatch.localPoints()[pointI]
// << " connected to cells:" << endl;
// // Test: point to cells addressing
// forAll(bCells, i) {
// { const labelList& boundaryCells = globalData.boundaryCells();
// Pout<< " " << cc[bCells[i]] << endl; const mapDistribute& globalPointBoundaryCellsMap =
// } globalData.globalPointBoundaryCellsMap();
// } const labelListList& slaves = globalData.globalPointBoundaryCells();
//} const labelListList& transformedSlaves =
globalData.globalPointTransformedBoundaryCells();
pointField cc(globalPointBoundaryCellsMap.constructSize());
forAll(boundaryCells, i)
{
cc[i] = mesh.cellCentres()[boundaryCells[i]];
}
// Exchange data
globalPointBoundaryCellsMap.distribute
(
transforms,
cc,
mapDistribute::transformPosition()
);
// Print
forAll(slaves, pointI)
{
const labelList& pointCells = slaves[pointI];
if (pointCells.size() > 0)
{
Pout<< "Master point:" << pointI
<< " at:" << coupledPatch.localPoints()[pointI]
<< " connected to " << pointCells.size()
<< " untransformed boundaryCells:" << endl;
forAll(pointCells, i)
{
Pout<< " " << cc[pointCells[i]] << endl;
}
}
const labelList& transformPointCells = transformedSlaves[pointI];
if (transformPointCells.size() > 0)
{
Pout<< "Master point:" << pointI
<< " connected to " << transformPointCells.size()
<< " transformed boundaryCells:" << endl;
forAll(transformPointCells, i)
{
Pout<< " " << cc[transformPointCells[i]] << endl;
}
}
}
}
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -30,12 +30,12 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "syncTools.H"
#include "argList.H" #include "argList.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "Time.H" #include "Time.H"
#include "Random.H" #include "Random.H"
#include "PackedList.H" #include "PackedList.H"
#include "syncTools.H"
using namespace Foam; using namespace Foam;
@ -285,7 +285,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{ {
// Create some data. Use slightly perturbed positions. // Create some data. Use slightly perturbed positions.
EdgeMap<vector> sparseData; EdgeMap<point> sparseData;
pointField fullData(mesh.nEdges(), point::max); pointField fullData(mesh.nEdges(), point::max);
const edgeList& edges = allBoundary.edges(); const edgeList& edges = allBoundary.edges();
@ -313,13 +313,13 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
( (
mesh, mesh,
sparseData, sparseData,
minEqOp<vector>() minMagSqrEqOp<point>()
); );
syncTools::syncEdgeList syncTools::syncEdgeList
( (
mesh, mesh,
fullData, fullData,
minEqOp<vector>(), minMagSqrEqOp<point>(),
point::max point::max
); );
@ -350,7 +350,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{ {
const edge& e = mesh.edges()[meshEdgeI]; const edge& e = mesh.edges()[meshEdgeI];
EdgeMap<vector>::const_iterator iter = sparseData.find(e); EdgeMap<point>::const_iterator iter = sparseData.find(e);
if (iter != sparseData.end()) if (iter != sparseData.end())
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,11 +46,17 @@ Foam::List<T> Foam::transform
template <class T> template <class T>
void Foam::transformList void Foam::transformList(const tensor& rotTensor, UList<T>& field)
( {
const tensorField& rotTensor, forAll(field, i)
UList<T>& field {
) field[i] = transform(rotTensor, field[i]);
}
}
template <class T>
void Foam::transformList(const tensorField& rotTensor, UList<T>& field)
{ {
if (rotTensor.size() == 1) if (rotTensor.size() == 1)
{ {
@ -79,11 +85,17 @@ void Foam::transformList
template <class T> template <class T>
void Foam::transformList void Foam::transformList(const tensor& rotTensor, Map<T>& field)
( {
const tensorField& rotTensor, forAllIter(typename Map<T>, field, iter)
Map<T>& field {
) iter() = transform(rotTensor[0], iter());
}
}
template <class T>
void Foam::transformList(const tensorField& rotTensor, Map<T>& field)
{ {
if (rotTensor.size() == 1) if (rotTensor.size() == 1)
{ {
@ -105,11 +117,17 @@ void Foam::transformList
template <class T> template <class T>
void Foam::transformList void Foam::transformList(const tensor& rotTensor, EdgeMap<T>& field)
( {
const tensorField& rotTensor, forAllIter(typename EdgeMap<T>, field, iter)
EdgeMap<T>& field {
) iter() = transform(rotTensor[0], iter());
}
}
template <class T>
void Foam::transformList(const tensorField& rotTensor, EdgeMap<T>& field)
{ {
if (rotTensor.size() == 1) if (rotTensor.size() == 1)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -60,33 +60,57 @@ List<T> transform
//- Apply transformation to list. Either single transformation tensor //- Apply transformation to list. Either single transformation tensor
// or one tensor per element. // or one tensor per element.
template<class T> template<class T>
void transformList(const tensor&, UList<T>&);
template<class T>
void transformList(const tensorField&, UList<T>&); void transformList(const tensorField&, UList<T>&);
template<class T>
void transformList(const tensor&, Map<T>&);
template<class T> template<class T>
void transformList(const tensorField&, Map<T>&); void transformList(const tensorField&, Map<T>&);
template<class T>
void transformList(const tensor&, EdgeMap<T>&);
template<class T> template<class T>
void transformList(const tensorField&, EdgeMap<T>&); void transformList(const tensorField&, EdgeMap<T>&);
template<>
inline void transformList(const tensor&, labelUList&)
{}
template<> template<>
inline void transformList(const tensorField&, labelUList&) inline void transformList(const tensorField&, labelUList&)
{} {}
template<> template<>
inline void transformList(const tensor&, Map<label>&)
{}
template<>
inline void transformList(const tensorField&, Map<label>&) inline void transformList(const tensorField&, Map<label>&)
{} {}
template<> template<>
inline void transformList(const tensor&, EdgeMap<label>&)
{}
template<>
inline void transformList(const tensorField&, EdgeMap<label>&) inline void transformList(const tensorField&, EdgeMap<label>&)
{} {}
template<>
inline void transformList(const tensor&, UList<scalar>&)
{}
template<> template<>
inline void transformList(const tensorField&, UList<scalar>&) inline void transformList(const tensorField&, UList<scalar>&)
{} {}
template<> template<>
inline void transformList(const tensor&, Map<scalar>&)
{}
template<>
inline void transformList(const tensorField&, Map<scalar>&) inline void transformList(const tensorField&, Map<scalar>&)
{} {}
template<> template<>
inline void transformList(const tensor&, EdgeMap<scalar>&)
{}
template<>
inline void transformList(const tensorField&, EdgeMap<scalar>&) inline void transformList(const tensorField&, EdgeMap<scalar>&)
{} {}

File diff suppressed because it is too large Load Diff

View File

@ -194,18 +194,22 @@ class globalMeshData
mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_; mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_;
//// Coupled point to boundary faces // Coupled point to boundary faces
//
//mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_; mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
//mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_; mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
//mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_; mutable autoPtr<labelListList>
// globalPointTransformedBoundaryFacesPtr_;
//// Coupled point to collocated boundary cells mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
//
//mutable autoPtr<labelList> boundaryCellsPtr_; // Coupled point to collocated boundary cells
//mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
//mutable autoPtr<labelListList> globalPointBoundaryCellsPtr_; mutable autoPtr<labelList> boundaryCellsPtr_;
//mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_; mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
mutable autoPtr<labelListList> globalPointBoundaryCellsPtr_;
mutable autoPtr<labelListList>
globalPointTransformedBoundaryCellsPtr_;
mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
// Globally shared point addressing // Globally shared point addressing
@ -288,6 +292,18 @@ class globalMeshData
void calcGlobalEdgeSlaves() const; void calcGlobalEdgeSlaves() const;
// Global boundary face/cell addressing
//- Calculate coupled point to uncoupled boundary faces. Local only.
void calcPointBoundaryFaces(labelListList&) const;
//- Calculate global point to global boundary face addressing.
void calcGlobalPointBoundaryFaces() const;
//- Calculate global point to global boundary cell addressing.
void calcGlobalPointBoundaryCells() const;
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
globalMeshData(const globalMeshData&); globalMeshData(const globalMeshData&);
@ -458,7 +474,7 @@ public:
const globalIndexAndTransform& globalTransforms() const; const globalIndexAndTransform& globalTransforms() const;
//- Helper: synchronise data with transforms //- Helper: synchronise data with transforms
template<class Type, class CombineOp> template<class Type, class CombineOp, class TransformOp>
static void syncData static void syncData
( (
List<Type>& pointData, List<Type>& pointData,
@ -467,7 +483,7 @@ public:
const mapDistribute& slavesMap, const mapDistribute& slavesMap,
const globalIndexAndTransform&, const globalIndexAndTransform&,
const CombineOp& cop, const CombineOp& cop,
const bool isPosition const TransformOp& top
); );
//- Helper: synchronise data without transforms //- Helper: synchronise data without transforms
@ -490,13 +506,13 @@ public:
const labelListList& globalPointSlaves() const; const labelListList& globalPointSlaves() const;
const labelListList& globalPointTransformedSlaves() const; const labelListList& globalPointTransformedSlaves() const;
const mapDistribute& globalPointSlavesMap() const; const mapDistribute& globalPointSlavesMap() const;
//- Helper to synchronise mesh point data //- Helper to synchronise coupled patch point data
template<class Type, class CombineOp> template<class Type, class CombineOp, class TransformOp>
void syncPointData void syncPointData
( (
List<Type>& pointData, List<Type>& pointData,
const CombineOp& cop, const CombineOp& cop,
const bool isPosition const TransformOp& top
) const; ) const;
// Coupled edge to coupled edges. // Coupled edge to coupled edges.
@ -506,6 +522,28 @@ public:
const labelListList& globalEdgeTransformedSlaves() const; const labelListList& globalEdgeTransformedSlaves() const;
const mapDistribute& globalEdgeSlavesMap() const; const mapDistribute& globalEdgeSlavesMap() const;
// Coupled point to boundary faces. These are uncoupled boundary
// faces only but include empty patches.
//- Numbering of boundary faces is face-mesh.nInternalFaces()
const globalIndex& globalBoundaryFaceNumbering() const;
const labelListList& globalPointBoundaryFaces() const;
const labelListList& globalPointTransformedBoundaryFaces()
const;
const mapDistribute& globalPointBoundaryFacesMap() const;
// Coupled point to boundary cell
//- From boundary cell to mesh cell
const labelList& boundaryCells() const;
//- Numbering of boundary cells is according to boundaryCells()
const globalIndex& globalBoundaryCellNumbering() const;
const labelListList& globalPointBoundaryCells() const;
const labelListList& globalPointTransformedBoundaryCells()
const;
const mapDistribute& globalPointBoundaryCellsMap() const;
// Other // Other

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class CombineOp> template<class Type, class CombineOp, class TransformOp>
void Foam::globalMeshData::syncData void Foam::globalMeshData::syncData
( (
List<Type>& elems, List<Type>& elems,
@ -38,11 +38,11 @@ void Foam::globalMeshData::syncData
const mapDistribute& slavesMap, const mapDistribute& slavesMap,
const globalIndexAndTransform& transforms, const globalIndexAndTransform& transforms,
const CombineOp& cop, const CombineOp& cop,
const bool isPosition const TransformOp& top
) )
{ {
// Pull slave data onto master // Pull slave data onto master
slavesMap.distribute(transforms, elems, isPosition); slavesMap.distribute(transforms, elems, top);
// Combine master data with slave data // Combine master data with slave data
forAll(slaves, i) forAll(slaves, i)
@ -85,7 +85,7 @@ void Foam::globalMeshData::syncData
transforms, transforms,
elems.size(), elems.size(),
elems, elems,
isPosition top
); );
} }
@ -143,12 +143,12 @@ void Foam::globalMeshData::syncData
} }
template<class Type, class CombineOp> template<class Type, class CombineOp, class TransformOp>
void Foam::globalMeshData::syncPointData void Foam::globalMeshData::syncPointData
( (
List<Type>& pointData, List<Type>& pointData,
const CombineOp& cop, const CombineOp& cop,
const bool isPosition const TransformOp& top
) const ) const
{ {
if (pointData.size() != mesh_.nPoints()) if (pointData.size() != mesh_.nPoints())
@ -171,7 +171,7 @@ void Foam::globalMeshData::syncPointData
globalPointSlavesMap(), globalPointSlavesMap(),
globalTransforms(), globalTransforms(),
cop, cop,
isPosition top
); );
// Extract back onto mesh // Extract back onto mesh

View File

@ -37,6 +37,99 @@ defineTypeNameAndDebug(Foam::mapDistribute, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<>
void Foam::mapDistribute::transform::operator()
(
const vectorTensorTransform&,
const bool,
List<label>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const coupledPolyPatch&,
UList<label>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const vectorTensorTransform&,
const bool,
List<scalar>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const coupledPolyPatch&,
UList<scalar>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const coupledPolyPatch&,
Map<scalar>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<scalar>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const vectorTensorTransform&,
const bool,
List<bool>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const coupledPolyPatch&,
UList<bool>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const
{}
template<>
void Foam::mapDistribute::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const
{}
Foam::List<Foam::labelPair> Foam::mapDistribute::schedule Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
( (
const labelListList& subMap, const labelListList& subMap,
@ -535,101 +628,6 @@ void Foam::mapDistribute::exchangeAddressing
} }
template<>
void Foam::mapDistribute::applyTransforms
(
const globalIndexAndTransform& globalTransforms,
List<point>& field,
const bool isPosition
) const
{
const List<vectorTensorTransform>& totalTransform =
globalTransforms.transformPermutations();
forAll(totalTransform, trafoI)
{
const vectorTensorTransform& vt = totalTransform[trafoI];
const labelList& elems = transformElements_[trafoI];
label n = transformStart_[trafoI];
// Could be optimised to avoid memory allocations
if (isPosition)
{
Field<point> transformFld
(
vt.transformPosition(Field<point>(field, elems))
);
forAll(transformFld, i)
{
//cop(field[n++], transformFld[i]);
field[n++] = transformFld[i];
}
}
else
{
Field<point> transformFld
(
transform(vt.R(), Field<point>(field, elems))
);
forAll(transformFld, i)
{
//cop(field[n++], transformFld[i]);
field[n++] = transformFld[i];
}
}
}
}
template<>
void Foam::mapDistribute::applyInverseTransforms
(
const globalIndexAndTransform& globalTransforms,
List<point>& field,
const bool isPosition
) const
{
const List<vectorTensorTransform>& totalTransform =
globalTransforms.transformPermutations();
forAll(totalTransform, trafoI)
{
const vectorTensorTransform& vt = totalTransform[trafoI];
const labelList& elems = transformElements_[trafoI];
label n = transformStart_[trafoI];
// Could be optimised to avoid memory allocations
if (isPosition)
{
Field<point> transformFld
(
vt.invTransformPosition
(
SubField<point>(field, elems.size(), n)
)
);
forAll(transformFld, i)
{
field[elems[i]] = transformFld[i];
}
}
else
{
Field<point> transformFld(SubField<point>(field, elems.size(), n));
transform(transformFld, vt.R().T(), transformFld);
forAll(transformFld, i)
{
field[elems[i]] = transformFld[i];
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct null //- Construct null

View File

@ -127,12 +127,14 @@ SourceFiles
#ifndef mapDistribute_H #ifndef mapDistribute_H
#define mapDistribute_H #define mapDistribute_H
#include "transformList.H"
#include "labelList.H" #include "labelList.H"
#include "labelPair.H" #include "labelPair.H"
#include "Pstream.H" #include "Pstream.H"
#include "boolList.H" #include "boolList.H"
#include "Map.H" #include "Map.H"
#include "point.H" #include "vectorTensorTransform.H"
#include "coupledPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -217,31 +219,124 @@ class mapDistribute
template<class T> template<class T>
void applyDummyTransforms(List<T>& field) const; void applyDummyTransforms(List<T>& field) const;
template<class T> //, class CombineOp> template<class T, class TransformOp>
void applyTransforms void applyTransforms
( (
const globalIndexAndTransform& globalTransforms, const globalIndexAndTransform& globalTransforms,
List<T>& field, List<T>& field,
const bool isPosition const TransformOp& top
//const CombineOp& cop
) const; ) const;
//- Helper function: copy transformElements without transformation //- Helper function: copy transformElements without transformation
template<class T> template<class T>
void applyDummyInverseTransforms(List<T>& field) const; void applyDummyInverseTransforms(List<T>& field) const;
template<class T> //, class CombineOp> template<class T, class TransformOp>
void applyInverseTransforms void applyInverseTransforms
( (
const globalIndexAndTransform& globalTransforms, const globalIndexAndTransform& globalTransforms,
List<T>& field, List<T>& field,
const bool isPosition const TransformOp& top
//const CombineOp& cop
) const; ) const;
public: public:
// Public classes
//- Default transformation behaviour
class transform
{
public:
template<class T>
void operator()
(
const vectorTensorTransform& vt,
const bool forward,
List<T>& fld
) const
{
if (forward)
{
transformList(vt.R(), fld);
}
else
{
transformList(vt.R().T(), fld);
}
}
//- Transform patch-based field
template<class T>
void operator()(const coupledPolyPatch& cpp, UList<T>& fld) const
{
if (!cpp.parallel())
{
transformList(cpp.forwardT(), fld);
}
}
//- Transform sparse field
template<class T, template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<T>& map)
const
{
if (!cpp.parallel())
{
transformList(cpp.forwardT(), map);
}
}
};
//- Default transformation behaviour for position
class transformPosition
{
public:
void operator()
(
const vectorTensorTransform& vt,
const bool forward,
List<point>& fld
) const
{
pointField pfld(fld.xfer());
if (forward)
{
fld = vt.transformPosition(pfld);
}
else
{
fld = vt.invTransformPosition(pfld);
}
}
//- Transform patch-based field
void operator()(const coupledPolyPatch& cpp, pointField& fld) const
{
cpp.transformPosition(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.transformPosition(fld);
i = 0;
forAllIter(typename Container<point>, map, iter)
{
iter() = fld[i++];
}
}
};
// Declare name of the class and its debug switch // Declare name of the class and its debug switch
ClassName("mapDistribute"); ClassName("mapDistribute");
@ -456,12 +551,12 @@ public:
const; const;
//- Same but with transforms //- Same but with transforms
template<class T> template<class T, class TransformOp>
void distribute void distribute
( (
const globalIndexAndTransform&, const globalIndexAndTransform&,
List<T>& fld, List<T>& fld,
const bool isPosition const TransformOp& top
) const; ) const;
//- Reverse distribute data using default commsType. //- Reverse distribute data using default commsType.
@ -474,13 +569,13 @@ public:
) const; ) const;
//- Same but with transforms //- Same but with transforms
template<class T> template<class T, class TransformOp>
void reverseDistribute void reverseDistribute
( (
const globalIndexAndTransform&, const globalIndexAndTransform&,
const label constructSize, const label constructSize,
List<T>& fld, List<T>& fld,
const bool isPosition const TransformOp& top
) const; ) const;
//- Reverse distribute data using default commsType. //- Reverse distribute data using default commsType.
@ -496,14 +591,14 @@ public:
) const; ) const;
//- Same but with transforms //- Same but with transforms
template<class T> template<class T, class TransformOp>
void reverseDistribute void reverseDistribute
( (
const globalIndexAndTransform&, const globalIndexAndTransform&,
const label constructSize, const label constructSize,
const T& nullValue, const T& nullValue,
List<T>& fld, List<T>& fld,
const bool isPosition const TransformOp& top
) const; ) const;
//- Do all sends using PstreamBuffers //- Do all sends using PstreamBuffers
@ -531,24 +626,85 @@ public:
}; };
//- Specialisation for transforms that can apply positional transform
template<> template<>
void mapDistribute::applyTransforms void mapDistribute::transform::operator()
( (
const globalIndexAndTransform& globalTransforms, const vectorTensorTransform&,
List<point>& field, const bool,
const bool isPosition List<label>&
//const CombineOp& cop ) const;
template<>
void mapDistribute::transform::operator()
(
const coupledPolyPatch&,
UList<label>&
) const;
template<>
void mapDistribute::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const;
template<>
void mapDistribute::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const; ) const;
template<> //, class CombineOp> template<>
void mapDistribute::applyInverseTransforms void mapDistribute::transform::operator()
( (
const globalIndexAndTransform& globalTransforms, const coupledPolyPatch&,
List<point>& field, UList<scalar>&
const bool isPosition
//const CombineOp& cop
) const; ) const;
template<>
void mapDistribute::transform::operator()
(
const vectorTensorTransform&,
const bool,
List<scalar>&
) const;
template<>
void mapDistribute::transform::operator()
(
const coupledPolyPatch&,
Map<scalar>&
) const;
template<>
void mapDistribute::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<scalar>&
) const;
template<>
void mapDistribute::transform::operator()
(
const coupledPolyPatch& cpp,
UList<bool>& fld
) const;
template<>
void mapDistribute::transform::operator()
(
const vectorTensorTransform&,
const bool,
List<bool>&
) const;
template<>
void mapDistribute::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const;
template<>
void mapDistribute::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -812,30 +812,14 @@ void Foam::mapDistribute::applyDummyInverseTransforms(List<T>& field) const
// Calculate transformed elements. // Calculate transformed elements.
template<class T> //, class CombineOp> template<class T, class TransformOp> //, class CombineOp>
void Foam::mapDistribute::applyTransforms void Foam::mapDistribute::applyTransforms
( (
const globalIndexAndTransform& globalTransforms, const globalIndexAndTransform& globalTransforms,
List<T>& field, List<T>& field,
const bool isPosition const TransformOp& top
//const CombineOp& cop
) const ) const
{ {
if (isPosition)
{
FatalErrorIn
(
"mapDistribute::applyTransforms\n"
"(\n"
" const globalIndexAndTransform&,\n"
" List<T>&,\n"
" const bool\n"
") const\n"
) << "It does not make sense to apply position transformation"
<< " for anything else than pointFields."
<< abort(FatalError);
}
const List<vectorTensorTransform>& totalTransform = const List<vectorTensorTransform>& totalTransform =
globalTransforms.transformPermutations(); globalTransforms.transformPermutations();
@ -846,7 +830,8 @@ void Foam::mapDistribute::applyTransforms
label n = transformStart_[trafoI]; label n = transformStart_[trafoI];
// Could be optimised to avoid memory allocations // Could be optimised to avoid memory allocations
Field<T> transformFld(transform(vt.R(), Field<T>(field, elems))); List<T> transformFld(UIndirectList<T>(field, elems));
top(vt, true, transformFld);
forAll(transformFld, i) forAll(transformFld, i)
{ {
@ -858,30 +843,14 @@ void Foam::mapDistribute::applyTransforms
// Calculate transformed elements. // Calculate transformed elements.
template<class T> //, class CombineOp> template<class T, class TransformOp> //, class CombineOp>
void Foam::mapDistribute::applyInverseTransforms void Foam::mapDistribute::applyInverseTransforms
( (
const globalIndexAndTransform& globalTransforms, const globalIndexAndTransform& globalTransforms,
List<T>& field, List<T>& field,
const bool isPosition const TransformOp& top
//const CombineOp& cop
) const ) const
{ {
if (isPosition)
{
FatalErrorIn
(
"mapDistribute::applyInverseTransforms\n"
"(\n"
" const globalIndexAndTransform&,\n"
" List<T>&,\n"
" const bool\n"
") const\n"
) << "It does not make sense to apply position transformation"
<< " for anything else than pointFields."
<< abort(FatalError);
}
const List<vectorTensorTransform>& totalTransform = const List<vectorTensorTransform>& totalTransform =
globalTransforms.transformPermutations(); globalTransforms.transformPermutations();
@ -892,8 +861,8 @@ void Foam::mapDistribute::applyInverseTransforms
label n = transformStart_[trafoI]; label n = transformStart_[trafoI];
// Could be optimised to avoid memory allocations // Could be optimised to avoid memory allocations
Field<T> transformFld(SubField<T>(field, elems.size(), n)); List<T> transformFld(SubList<T>(field, elems.size(), n));
transform(transformFld, vt.R().T(), transformFld); top(vt, false, transformFld);
forAll(transformFld, i) forAll(transformFld, i)
{ {
@ -1073,54 +1042,54 @@ void Foam::mapDistribute::reverseDistribute
//- Distribute data using default commsType. //- Distribute data using default commsType.
template<class T> template<class T, class TransformOp>
void Foam::mapDistribute::distribute void Foam::mapDistribute::distribute
( (
const globalIndexAndTransform& git, const globalIndexAndTransform& git,
List<T>& fld, List<T>& fld,
const bool isPosition const TransformOp& top
) const ) const
{ {
// Distribute. Leave out dummy transforms since we're doing them ourselves // Distribute. Leave out dummy transforms since we're doing them ourselves
distribute(fld, false); distribute(fld, false);
// Do transforms // Do transforms
applyTransforms(git, fld, isPosition); //, eqOp<T>()); applyTransforms(git, fld, top);
} }
template<class T> template<class T, class TransformOp>
void Foam::mapDistribute::reverseDistribute void Foam::mapDistribute::reverseDistribute
( (
const globalIndexAndTransform& git, const globalIndexAndTransform& git,
const label constructSize, const label constructSize,
List<T>& fld, List<T>& fld,
const bool isPosition const TransformOp& top
) const ) const
{ {
// Fill slots with reverse-transformed data. Note that it also copies // 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 // back into the non-remote part of fld even though these values are not
// used. // used.
applyInverseTransforms(git, fld, isPosition); //, eqOp<T>()); applyInverseTransforms(git, fld, top);
// And send back (the remote slots). Disable dummy transformations. // And send back (the remote slots). Disable dummy transformations.
reverseDistribute(constructSize, fld, false); reverseDistribute(constructSize, fld, false);
} }
template<class T> template<class T, class TransformOp>
void Foam::mapDistribute::reverseDistribute void Foam::mapDistribute::reverseDistribute
( (
const globalIndexAndTransform& git, const globalIndexAndTransform& git,
const label constructSize, const label constructSize,
const T& nullValue, const T& nullValue,
List<T>& fld, List<T>& fld,
const bool isPosition const TransformOp& top
) const ) const
{ {
// Fill slots with reverse-transformed data Note that it also copies // 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 // back into the non-remote part of fld even though these values are not
// used. // used.
applyInverseTransforms(git, fld, isPosition); //, eqOp<T>()); applyInverseTransforms(git, fld, top); //, eqOp<T>());
// And send back (the remote slots) Disable dummy transformations. // And send back (the remote slots) Disable dummy transformations.
reverseDistribute(constructSize, nullValue, fld, false); reverseDistribute(constructSize, nullValue, fld, false);

View File

@ -25,77 +25,6 @@ License
#include "syncTools.H" #include "syncTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<label>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<scalar>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<scalar>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<scalar>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<bool>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Determines for every point whether it is coupled and if so sets only one. // Determines for every point whether it is coupled and if so sets only one.

View File

@ -47,7 +47,7 @@ SourceFiles
#include "PackedBoolList.H" #include "PackedBoolList.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "coupledPolyPatch.H" #include "coupledPolyPatch.H"
#include "transformList.H" #include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -87,59 +87,6 @@ class syncTools
public: public:
// Public classes
class transform
{
public:
//- Transform patch-based field
template<class T>
void operator()(const coupledPolyPatch& cpp, Field<T>& fld) const
{
if (!cpp.parallel())
{
transformList(cpp.forwardT(), fld);
}
}
//- Transform sparse field
template<class T, template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<T>& map)
const
{
if (!cpp.parallel())
{
transformList(cpp.forwardT(), map);
}
}
};
class transformPosition
{
public:
void operator()(const coupledPolyPatch& cpp, pointField& fld) const
{
cpp.transformPosition(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.transformPosition(fld);
i = 0;
forAllIter(typename Container<point>, map, iter)
{
iter() = fld[i++];
}
}
};
// Basic routines with user-supplied transformation. Preferably // Basic routines with user-supplied transformation. Preferably
// use specialisations below. // use specialisations below.
@ -163,41 +110,41 @@ public:
const CombineOp& cop, const CombineOp& cop,
const TransformOp& top const TransformOp& top
); );
//
// //- Synchronize values on all mesh points. //- Synchronize values on all mesh points.
// template <class T, class CombineOp, class TransformOp> template <class T, class CombineOp, class TransformOp>
// static void syncPointList static void syncPointList
// ( (
// const polyMesh&, const polyMesh&,
// UList<T>&, List<T>&,
// const CombineOp& cop, const CombineOp& cop,
// const T& nullValue, const T& nullValue,
// const TransformOp& top const TransformOp& top
// ); );
//
// //- Synchronize values on selected mesh points. //- Synchronize values on selected mesh points.
// template <class T, class CombineOp, class TransformOp> template <class T, class CombineOp, class TransformOp>
// static void syncPointList static void syncPointList
// ( (
// const polyMesh&, const polyMesh&,
// const labelList& meshPoints, const labelList& meshPoints,
// UList<T>&, List<T>&,
// const CombineOp& cop, const CombineOp& cop,
// const T& nullValue, const T& nullValue,
// const TransformOp& top const TransformOp& top
// ); );
//
// //- Synchronize values on all mesh edges. //- Synchronize values on all mesh edges.
// template <class T, class CombineOp, class TransformOp> template <class T, class CombineOp, class TransformOp>
// static void syncEdgeList static void syncEdgeList
// ( (
// const polyMesh&, const polyMesh&,
// UList<T>&, List<T>&,
// const CombineOp& cop, const CombineOp& cop,
// const T& nullValue, const T& nullValue,
// const TransformOp& top const TransformOp& top
// ); );
//
//- Synchronize values on boundary faces only. //- Synchronize values on boundary faces only.
template <class T, class CombineOp, class TransformOp> template <class T, class CombineOp, class TransformOp>
static void syncBoundaryFaceList static void syncBoundaryFaceList
@ -219,7 +166,17 @@ public:
List<T>& l, List<T>& l,
const CombineOp& cop, const CombineOp& cop,
const T& nullValue const T& nullValue
); )
{
syncPointList
(
mesh,
l,
cop,
nullValue,
mapDistribute::transform()
);
}
//- Synchronize locations on all mesh points. //- Synchronize locations on all mesh points.
template <class CombineOp> template <class CombineOp>
@ -229,7 +186,17 @@ public:
List<point>& l, List<point>& l,
const CombineOp& cop, const CombineOp& cop,
const point& nullValue const point& nullValue
); )
{
syncPointList
(
mesh,
l,
cop,
nullValue,
mapDistribute::transformPosition()
);
}
//- Synchronize values on selected mesh points. //- Synchronize values on selected mesh points.
template <class T, class CombineOp> template <class T, class CombineOp>
@ -237,10 +204,21 @@ public:
( (
const polyMesh& mesh, const polyMesh& mesh,
const labelList& meshPoints, const labelList& meshPoints,
UList<T>& l, List<T>& l,
const CombineOp& cop, const CombineOp& cop,
const T& nullValue const T& nullValue
); )
{
syncPointList
(
mesh,
meshPoints,
l,
cop,
nullValue,
mapDistribute::transform()
);
}
//- Synchronize locations on selected mesh points. //- Synchronize locations on selected mesh points.
template <class CombineOp> template <class CombineOp>
@ -248,10 +226,21 @@ public:
( (
const polyMesh& mesh, const polyMesh& mesh,
const labelList& meshPoints, const labelList& meshPoints,
UList<point>& l, List<point>& l,
const CombineOp& cop, const CombineOp& cop,
const point& nullValue const point& nullValue
); )
{
syncPointList
(
mesh,
meshPoints,
l,
cop,
nullValue,
mapDistribute::transformPosition()
);
}
// Synchronise edge-wise data // Synchronise edge-wise data
@ -261,20 +250,40 @@ public:
static void syncEdgeList static void syncEdgeList
( (
const polyMesh& mesh, const polyMesh& mesh,
UList<T>& l, List<T>& l,
const CombineOp& cop, const CombineOp& cop,
const T& nullValue const T& nullValue
); )
{
syncEdgeList
(
mesh,
l,
cop,
nullValue,
mapDistribute::transform()
);
}
//- Synchronize values on all mesh edges. //- Synchronize values on all mesh edges.
template <class CombineOp> template <class CombineOp>
static void syncEdgePositions static void syncEdgePositions
( (
const polyMesh& mesh, const polyMesh& mesh,
UList<point>& l, List<point>& l,
const CombineOp& cop, const CombineOp& cop,
const point& nullValue const point& nullValue
); )
{
syncEdgeList
(
mesh,
l,
cop,
nullValue,
mapDistribute::transformPosition()
);
}
// Synchronise face-wise data // Synchronise face-wise data
@ -288,7 +297,7 @@ public:
const CombineOp& cop const CombineOp& cop
) )
{ {
syncBoundaryFaceList(mesh, l, cop, transform()); syncBoundaryFaceList(mesh, l, cop, mapDistribute::transform());
} }
//- Synchronize locations on boundary faces only. //- Synchronize locations on boundary faces only.
@ -300,7 +309,13 @@ public:
const CombineOp& cop const CombineOp& cop
) )
{ {
syncBoundaryFaceList(mesh, l, cop, transformPosition()); syncBoundaryFaceList
(
mesh,
l,
cop,
mapDistribute::transformPosition()
);
} }
//- Synchronize values on all mesh faces. //- Synchronize values on all mesh faces.
@ -319,7 +334,13 @@ public:
mesh.nInternalFaces() mesh.nInternalFaces()
); );
syncBoundaryFaceList(mesh, bndValues, cop, transform()); syncBoundaryFaceList
(
mesh,
bndValues,
cop,
mapDistribute::transform()
);
} }
//- Synchronize locations on all mesh faces. //- Synchronize locations on all mesh faces.
@ -337,7 +358,13 @@ public:
mesh.nFaces()-mesh.nInternalFaces(), mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces() mesh.nInternalFaces()
); );
syncBoundaryFaceList(mesh, bndValues, cop, transformPosition()); syncBoundaryFaceList
(
mesh,
bndValues,
cop,
mapDistribute::transformPosition()
);
} }
//- Swap coupled boundary face values. //- Swap coupled boundary face values.
@ -348,7 +375,13 @@ public:
UList<T>& l UList<T>& l
) )
{ {
syncBoundaryFaceList(mesh, l, eqOp<T>(), transform()); syncBoundaryFaceList
(
mesh,
l,
eqOp<T>(),
mapDistribute::transform()
);
} }
//- Swap coupled positions. //- Swap coupled positions.
@ -359,7 +392,13 @@ public:
UList<T>& l UList<T>& l
) )
{ {
syncBoundaryFaceList(mesh, l, eqOp<T>(), transformPosition()); syncBoundaryFaceList
(
mesh,
l,
eqOp<T>(),
mapDistribute::transformPosition()
);
} }
//- Swap coupled face values. //- Swap coupled face values.
@ -376,7 +415,13 @@ public:
mesh.nFaces()-mesh.nInternalFaces(), mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces() mesh.nInternalFaces()
); );
syncBoundaryFaceList(mesh, bndValues, eqOp<T>(), transform()); syncBoundaryFaceList
(
mesh,
bndValues,
eqOp<T>(),
mapDistribute::transform()
);
} }
// Sparse versions // Sparse versions
@ -390,7 +435,7 @@ public:
const CombineOp& cop const CombineOp& cop
) )
{ {
syncPointMap(mesh, l, cop, transform()); syncPointMap(mesh, l, cop, mapDistribute::transform());
} }
//- Synchronize locations on selected points. //- Synchronize locations on selected points.
@ -402,7 +447,7 @@ public:
const CombineOp& cop const CombineOp& cop
) )
{ {
syncPointMap(mesh, l, cop, transformPosition()); syncPointMap(mesh, l, cop, mapDistribute::transformPosition());
} }
//- Synchronize values on selected edges. Edges are represented //- Synchronize values on selected edges. Edges are represented
@ -416,7 +461,7 @@ public:
const CombineOp& cop const CombineOp& cop
) )
{ {
syncEdgeMap(mesh, l, cop, transform()); syncEdgeMap(mesh, l, cop, mapDistribute::transform());
} }
//- Synchronize locations on selected edges. //- Synchronize locations on selected edges.
@ -428,7 +473,7 @@ public:
const CombineOp& cop const CombineOp& cop
) )
{ {
syncEdgeMap(mesh, l, cop, transformPosition()); syncEdgeMap(mesh, l, cop, mapDistribute::transformPosition());
} }
// PackedList versions // PackedList versions
@ -480,65 +525,6 @@ public:
}; };
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<label>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<scalar>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<scalar>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<scalar>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch& cpp,
Field<bool>& fld
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -764,7 +764,7 @@ void Foam::syncTools::syncEdgeMap
//void Foam::syncTools::syncPointList //void Foam::syncTools::syncPointList
//( //(
// const polyMesh& mesh, // const polyMesh& mesh,
// UList<T>& pointValues, // List<T>& pointValues,
// const CombineOp& cop, // const CombineOp& cop,
// const T& nullValue, // const T& nullValue,
// const TransformOp& top // const TransformOp& top
@ -775,7 +775,7 @@ void Foam::syncTools::syncEdgeMap
// FatalErrorIn // FatalErrorIn
// ( // (
// "syncTools<class T, class CombineOp>::syncPointList" // "syncTools<class T, class CombineOp>::syncPointList"
// "(const polyMesh&, UList<T>&, const CombineOp&, const T&" // "(const polyMesh&, List<T>&, const CombineOp&, const T&"
// ", const bool)" // ", const bool)"
// ) << "Number of values " << pointValues.size() // ) << "Number of values " << pointValues.size()
// << " is not equal to the number of points in the mesh " // << " is not equal to the number of points in the mesh "
@ -941,7 +941,7 @@ void Foam::syncTools::syncEdgeMap
//( //(
// const polyMesh& mesh, // const polyMesh& mesh,
// const labelList& meshPoints, // const labelList& meshPoints,
// UList<T>& pointValues, // List<T>& pointValues,
// const CombineOp& cop, // const CombineOp& cop,
// const T& nullValue, // const T& nullValue,
// const TransformOp& top // const TransformOp& top
@ -952,7 +952,7 @@ void Foam::syncTools::syncEdgeMap
// FatalErrorIn // FatalErrorIn
// ( // (
// "syncTools<class T, class CombineOp>::syncPointList" // "syncTools<class T, class CombineOp>::syncPointList"
// "(const polyMesh&, const labelList&, UList<T>&, const CombineOp&" // "(const polyMesh&, const labelList&, List<T>&, const CombineOp&"
// ", const T&, const bool)" // ", const T&, const bool)"
// ) << "Number of values " << pointValues.size() // ) << "Number of values " << pointValues.size()
// << " is not equal to the number of points " // << " is not equal to the number of points "
@ -986,13 +986,14 @@ void Foam::syncTools::syncEdgeMap
// } // }
//} //}
template <class T, class CombineOp> template <class T, class CombineOp, class TransformOp>
void Foam::syncTools::syncPointList void Foam::syncTools::syncPointList
( (
const polyMesh& mesh, const polyMesh& mesh,
List<T>& pointValues, List<T>& pointValues,
const CombineOp& cop, const CombineOp& cop,
const T& nullValue const T& nullValue,
const TransformOp& top
) )
{ {
if (pointValues.size() != mesh.nPoints()) if (pointValues.size() != mesh.nPoints())
@ -1000,48 +1001,50 @@ void Foam::syncTools::syncPointList
FatalErrorIn FatalErrorIn
( (
"syncTools<class T, class CombineOp>::syncPointList" "syncTools<class T, class CombineOp>::syncPointList"
"(const polyMesh&, UList<T>&, const CombineOp&, const T&)" "(const polyMesh&, List<T>&, const CombineOp&, const T&"
", const bool)"
) << "Number of values " << pointValues.size() ) << "Number of values " << pointValues.size()
<< " is not equal to the number of points in the mesh " << " is not equal to the number of points in the mesh "
<< mesh.nPoints() << abort(FatalError); << mesh.nPoints() << abort(FatalError);
} }
mesh.globalData().syncPointData(pointValues, cop, false); mesh.globalData().syncPointData(pointValues, cop, top);
} }
template <class CombineOp> //template <class CombineOp>
void Foam::syncTools::syncPointPositions //void Foam::syncTools::syncPointPositions
( //(
const polyMesh& mesh, // const polyMesh& mesh,
List<point>& pointValues, // List<point>& pointValues,
const CombineOp& cop, // const CombineOp& cop,
const point& nullValue // const point& nullValue
) //)
{ //{
if (pointValues.size() != mesh.nPoints()) // if (pointValues.size() != mesh.nPoints())
{ // {
FatalErrorIn // FatalErrorIn
( // (
"syncTools<class CombineOp>::syncPointPositions" // "syncTools<class CombineOp>::syncPointPositions"
"(const polyMesh&, List<point>&, const CombineOp&, const point&)" // "(const polyMesh&, List<point>&, const CombineOp&, const point&)"
) << "Number of values " << pointValues.size() // ) << "Number of values " << pointValues.size()
<< " is not equal to the number of points in the mesh " // << " is not equal to the number of points in the mesh "
<< mesh.nPoints() << abort(FatalError); // << mesh.nPoints() << abort(FatalError);
} // }
//
mesh.globalData().syncPointData(pointValues, cop, true); // mesh.globalData().syncPointData(pointValues, cop, true);
} //}
template <class T, class CombineOp> template <class T, class CombineOp, class TransformOp>
void Foam::syncTools::syncPointList void Foam::syncTools::syncPointList
( (
const polyMesh& mesh, const polyMesh& mesh,
const labelList& meshPoints, const labelList& meshPoints,
UList<T>& pointValues, List<T>& pointValues,
const CombineOp& cop, const CombineOp& cop,
const T& nullValue const T& nullValue,
const TransformOp& top
) )
{ {
if (pointValues.size() != meshPoints.size()) if (pointValues.size() != meshPoints.size())
@ -1049,7 +1052,7 @@ void Foam::syncTools::syncPointList
FatalErrorIn FatalErrorIn
( (
"syncTools<class T, class CombineOp>::syncPointList" "syncTools<class T, class CombineOp>::syncPointList"
"(const polyMesh&, UList<T>&, const CombineOp&, const T&)" "(const polyMesh&, List<T>&, const CombineOp&, const T&)"
) << "Number of values " << pointValues.size() ) << "Number of values " << pointValues.size()
<< " is not equal to the number of meshPoints " << " is not equal to the number of meshPoints "
<< meshPoints.size() << abort(FatalError); << meshPoints.size() << abort(FatalError);
@ -1078,7 +1081,7 @@ void Foam::syncTools::syncPointList
gd.globalPointSlavesMap(), gd.globalPointSlavesMap(),
gd.globalTransforms(), gd.globalTransforms(),
cop, cop,
false //position? top
); );
forAll(meshPoints, i) forAll(meshPoints, i)
@ -1093,72 +1096,74 @@ void Foam::syncTools::syncPointList
} }
template <class CombineOp> //template <class CombineOp>
void Foam::syncTools::syncPointPositions //void Foam::syncTools::syncPointPositions
( //(
const polyMesh& mesh, // const polyMesh& mesh,
const labelList& meshPoints, // const labelList& meshPoints,
UList<point>& pointValues, // List<point>& pointValues,
const CombineOp& cop, // const CombineOp& cop,
const point& nullValue // const point& nullValue
) //)
{ //{
if (pointValues.size() != meshPoints.size()) // if (pointValues.size() != meshPoints.size())
{ // {
FatalErrorIn // FatalErrorIn
( // (
"syncTools<class CombineOp>::syncPointList" // "syncTools<class CombineOp>::syncPointList"
"(const polyMesh&, UList<point>&, const CombineOp&, const point&)" // "(const polyMesh&, List<point>&, const CombineOp&, const point&)"
) << "Number of values " << pointValues.size() // ) << "Number of values " << pointValues.size()
<< " is not equal to the number of meshPoints " // << " is not equal to the number of meshPoints "
<< meshPoints.size() << abort(FatalError); // << meshPoints.size() << abort(FatalError);
} // }
const globalMeshData& gd = mesh.globalData(); // const globalMeshData& gd = mesh.globalData();
const indirectPrimitivePatch& cpp = gd.coupledPatch(); // const indirectPrimitivePatch& cpp = gd.coupledPatch();
const Map<label>& mpm = cpp.meshPointMap(); // const Map<label>& mpm = cpp.meshPointMap();
//
List<point> cppFld(cpp.nPoints(), nullValue); // List<point> cppFld(cpp.nPoints(), nullValue);
//
forAll(meshPoints, i) // forAll(meshPoints, i)
{ // {
label pointI = meshPoints[i]; // label pointI = meshPoints[i];
Map<label>::const_iterator iter = mpm.find(pointI); // Map<label>::const_iterator iter = mpm.find(pointI);
if (iter != mpm.end()) // if (iter != mpm.end())
{ // {
cppFld[iter()] = pointValues[i]; // cppFld[iter()] = pointValues[i];
} // }
} // }
//
globalMeshData::syncData // globalMeshData::syncData
( // (
cppFld, // cppFld,
gd.globalPointSlaves(), // gd.globalPointSlaves(),
gd.globalPointTransformedSlaves(), // gd.globalPointTransformedSlaves(),
gd.globalPointSlavesMap(), // gd.globalPointSlavesMap(),
gd.globalTransforms(), // gd.globalTransforms(),
cop, // cop,
true //position? // true, //position?
); // mapDistribute::transform() // not used
// );
forAll(meshPoints, i) //
{ // forAll(meshPoints, i)
label pointI = meshPoints[i]; // {
Map<label>::const_iterator iter = mpm.find(pointI); // label pointI = meshPoints[i];
if (iter != mpm.end()) // Map<label>::const_iterator iter = mpm.find(pointI);
{ // if (iter != mpm.end())
pointValues[i] = cppFld[iter()]; // {
} // pointValues[i] = cppFld[iter()];
} // }
} // }
//}
template <class T, class CombineOp> template <class T, class CombineOp, class TransformOp>
void Foam::syncTools::syncEdgeList void Foam::syncTools::syncEdgeList
( (
const polyMesh& mesh, const polyMesh& mesh,
UList<T>& edgeValues, List<T>& edgeValues,
const CombineOp& cop, const CombineOp& cop,
const T& nullValue const T& nullValue,
const TransformOp& top
) )
{ {
if (edgeValues.size() != mesh.nEdges()) if (edgeValues.size() != mesh.nEdges())
@ -1166,7 +1171,7 @@ void Foam::syncTools::syncEdgeList
FatalErrorIn FatalErrorIn
( (
"syncTools<class T, class CombineOp>::syncEdgeList" "syncTools<class T, class CombineOp>::syncEdgeList"
"(const polyMesh&, UList<T>&, const CombineOp&, const T&)" "(const polyMesh&, List<T>&, const CombineOp&, const T&)"
) << "Number of values " << edgeValues.size() ) << "Number of values " << edgeValues.size()
<< " is not equal to the number of edges in the mesh " << " is not equal to the number of edges in the mesh "
<< mesh.nEdges() << abort(FatalError); << mesh.nEdges() << abort(FatalError);
@ -1187,7 +1192,7 @@ void Foam::syncTools::syncEdgeList
edgeMap, edgeMap,
git, git,
cop, cop,
false //position? top
); );
// Extract back onto mesh // Extract back onto mesh
@ -1198,50 +1203,51 @@ void Foam::syncTools::syncEdgeList
} }
template <class CombineOp> //template <class CombineOp>
void Foam::syncTools::syncEdgePositions //void Foam::syncTools::syncEdgePositions
( //(
const polyMesh& mesh, // const polyMesh& mesh,
UList<point>& edgeValues, // List<point>& edgeValues,
const CombineOp& cop, // const CombineOp& cop,
const point& nullValue // const point& nullValue
) //)
{ //{
if (edgeValues.size() != mesh.nEdges()) // if (edgeValues.size() != mesh.nEdges())
{ // {
FatalErrorIn // FatalErrorIn
( // (
"syncTools<class CombineOp>::syncEdgePositions" // "syncTools<class CombineOp>::syncEdgePositions"
"(const polyMesh&, UList<point>&, const CombineOp&, const point&)" // "(const polyMesh&, List<point>&, const CombineOp&, const point&)"
) << "Number of values " << edgeValues.size() // ) << "Number of values " << edgeValues.size()
<< " is not equal to the number of edges in the mesh " // << " is not equal to the number of edges in the mesh "
<< mesh.nEdges() << abort(FatalError); // << mesh.nEdges() << abort(FatalError);
} // }
//
const globalMeshData& gd = mesh.globalData(); // const globalMeshData& gd = mesh.globalData();
const labelList& meshEdges = gd.coupledPatchMeshEdges(); // const labelList& meshEdges = gd.coupledPatchMeshEdges();
const globalIndexAndTransform& git = gd.globalTransforms(); // const globalIndexAndTransform& git = gd.globalTransforms();
const mapDistribute& map = gd.globalEdgeSlavesMap(); // const mapDistribute& map = gd.globalEdgeSlavesMap();
//
List<point> cppFld(UIndirectList<point>(edgeValues, meshEdges)); // List<point> cppFld(UIndirectList<point>(edgeValues, meshEdges));
//
globalMeshData::syncData // globalMeshData::syncData
( // (
cppFld, // cppFld,
gd.globalEdgeSlaves(), // gd.globalEdgeSlaves(),
gd.globalEdgeTransformedSlaves(), // gd.globalEdgeTransformedSlaves(),
map, // map,
git, // git,
cop, // cop,
true //position? // true, //position?
); // mapDistribute::transform() // not used
// );
// Extract back onto mesh //
forAll(meshEdges, i) // // Extract back onto mesh
{ // forAll(meshEdges, i)
edgeValues[meshEdges[i]] = cppFld[i]; // {
} // edgeValues[meshEdges[i]] = cppFld[i];
} // }
//}
template <class T, class CombineOp, class TransformOp> template <class T, class CombineOp, class TransformOp>