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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -60,33 +60,57 @@ List<T> transform
//- Apply transformation to list. Either single transformation tensor
// or one tensor per element.
template<class T>
void transformList(const tensor&, UList<T>&);
template<class T>
void transformList(const tensorField&, UList<T>&);
template<class T>
void transformList(const tensor&, Map<T>&);
template<class T>
void transformList(const tensorField&, Map<T>&);
template<class T>
void transformList(const tensor&, EdgeMap<T>&);
template<class T>
void transformList(const tensorField&, EdgeMap<T>&);
template<>
inline void transformList(const tensor&, labelUList&)
{}
template<>
inline void transformList(const tensorField&, labelUList&)
{}
template<>
inline void transformList(const tensor&, Map<label>&)
{}
template<>
inline void transformList(const tensorField&, Map<label>&)
{}
template<>
inline void transformList(const tensor&, EdgeMap<label>&)
{}
template<>
inline void transformList(const tensorField&, EdgeMap<label>&)
{}
template<>
inline void transformList(const tensor&, UList<scalar>&)
{}
template<>
inline void transformList(const tensorField&, UList<scalar>&)
{}
template<>
inline void transformList(const tensor&, Map<scalar>&)
{}
template<>
inline void transformList(const tensorField&, Map<scalar>&)
{}
template<>
inline void transformList(const tensor&, EdgeMap<scalar>&)
{}
template<>
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_;
//// Coupled point to boundary faces
//
//mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
//mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
//mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
//
//// Coupled point to collocated boundary cells
//
//mutable autoPtr<labelList> boundaryCellsPtr_;
//mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
//mutable autoPtr<labelListList> globalPointBoundaryCellsPtr_;
//mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
// Coupled point to boundary faces
mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
mutable autoPtr<labelListList>
globalPointTransformedBoundaryFacesPtr_;
mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
// Coupled point to collocated boundary cells
mutable autoPtr<labelList> boundaryCellsPtr_;
mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
mutable autoPtr<labelListList> globalPointBoundaryCellsPtr_;
mutable autoPtr<labelListList>
globalPointTransformedBoundaryCellsPtr_;
mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
// Globally shared point addressing
@ -288,6 +292,18 @@ class globalMeshData
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
globalMeshData(const globalMeshData&);
@ -458,7 +474,7 @@ public:
const globalIndexAndTransform& globalTransforms() const;
//- Helper: synchronise data with transforms
template<class Type, class CombineOp>
template<class Type, class CombineOp, class TransformOp>
static void syncData
(
List<Type>& pointData,
@ -467,7 +483,7 @@ public:
const mapDistribute& slavesMap,
const globalIndexAndTransform&,
const CombineOp& cop,
const bool isPosition
const TransformOp& top
);
//- Helper: synchronise data without transforms
@ -490,13 +506,13 @@ public:
const labelListList& globalPointSlaves() const;
const labelListList& globalPointTransformedSlaves() const;
const mapDistribute& globalPointSlavesMap() const;
//- Helper to synchronise mesh point data
template<class Type, class CombineOp>
//- Helper to synchronise coupled patch point data
template<class Type, class CombineOp, class TransformOp>
void syncPointData
(
List<Type>& pointData,
const CombineOp& cop,
const bool isPosition
const TransformOp& top
) const;
// Coupled edge to coupled edges.
@ -506,6 +522,28 @@ public:
const labelListList& globalEdgeTransformedSlaves() 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

View File

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

View File

@ -37,6 +37,99 @@ defineTypeNameAndDebug(Foam::mapDistribute, 0);
// * * * * * * * * * * * * * 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
(
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 * * * * * * * * * * * * * * //
//- Construct null

View File

@ -127,12 +127,14 @@ SourceFiles
#ifndef mapDistribute_H
#define mapDistribute_H
#include "transformList.H"
#include "labelList.H"
#include "labelPair.H"
#include "Pstream.H"
#include "boolList.H"
#include "Map.H"
#include "point.H"
#include "vectorTensorTransform.H"
#include "coupledPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -217,31 +219,124 @@ class mapDistribute
template<class T>
void applyDummyTransforms(List<T>& field) const;
template<class T> //, class CombineOp>
template<class T, class TransformOp>
void applyTransforms
(
const globalIndexAndTransform& globalTransforms,
List<T>& field,
const bool isPosition
//const CombineOp& cop
const TransformOp& top
) const;
//- Helper function: copy transformElements without transformation
template<class T>
void applyDummyInverseTransforms(List<T>& field) const;
template<class T> //, class CombineOp>
template<class T, class TransformOp>
void applyInverseTransforms
(
const globalIndexAndTransform& globalTransforms,
List<T>& field,
const bool isPosition
//const CombineOp& cop
const TransformOp& top
) const;
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
ClassName("mapDistribute");
@ -456,12 +551,12 @@ public:
const;
//- Same but with transforms
template<class T>
template<class T, class TransformOp>
void distribute
(
const globalIndexAndTransform&,
List<T>& fld,
const bool isPosition
const TransformOp& top
) const;
//- Reverse distribute data using default commsType.
@ -474,13 +569,13 @@ public:
) const;
//- Same but with transforms
template<class T>
template<class T, class TransformOp>
void reverseDistribute
(
const globalIndexAndTransform&,
const label constructSize,
List<T>& fld,
const bool isPosition
const TransformOp& top
) const;
//- Reverse distribute data using default commsType.
@ -496,14 +591,14 @@ public:
) const;
//- Same but with transforms
template<class T>
template<class T, class TransformOp>
void reverseDistribute
(
const globalIndexAndTransform&,
const label constructSize,
const T& nullValue,
List<T>& fld,
const bool isPosition
const TransformOp& top
) const;
//- Do all sends using PstreamBuffers
@ -531,24 +626,85 @@ public:
};
//- Specialisation for transforms that can apply positional transform
template<>
void mapDistribute::applyTransforms
void mapDistribute::transform::operator()
(
const globalIndexAndTransform& globalTransforms,
List<point>& field,
const bool isPosition
//const CombineOp& cop
const vectorTensorTransform&,
const bool,
List<label>&
) 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;
template<> //, class CombineOp>
void mapDistribute::applyInverseTransforms
template<>
void mapDistribute::transform::operator()
(
const globalIndexAndTransform& globalTransforms,
List<point>& field,
const bool isPosition
//const CombineOp& cop
const coupledPolyPatch&,
UList<scalar>&
) 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.
template<class T> //, class CombineOp>
template<class T, class TransformOp> //, class CombineOp>
void Foam::mapDistribute::applyTransforms
(
const globalIndexAndTransform& globalTransforms,
List<T>& field,
const bool isPosition
//const CombineOp& cop
const TransformOp& top
) 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 =
globalTransforms.transformPermutations();
@ -846,7 +830,8 @@ void Foam::mapDistribute::applyTransforms
label n = transformStart_[trafoI];
// 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)
{
@ -858,30 +843,14 @@ void Foam::mapDistribute::applyTransforms
// Calculate transformed elements.
template<class T> //, class CombineOp>
template<class T, class TransformOp> //, class CombineOp>
void Foam::mapDistribute::applyInverseTransforms
(
const globalIndexAndTransform& globalTransforms,
List<T>& field,
const bool isPosition
//const CombineOp& cop
const TransformOp& top
) 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 =
globalTransforms.transformPermutations();
@ -892,8 +861,8 @@ void Foam::mapDistribute::applyInverseTransforms
label n = transformStart_[trafoI];
// Could be optimised to avoid memory allocations
Field<T> transformFld(SubField<T>(field, elems.size(), n));
transform(transformFld, vt.R().T(), transformFld);
List<T> transformFld(SubList<T>(field, elems.size(), n));
top(vt, false, transformFld);
forAll(transformFld, i)
{
@ -1073,54 +1042,54 @@ void Foam::mapDistribute::reverseDistribute
//- Distribute data using default commsType.
template<class T>
template<class T, class TransformOp>
void Foam::mapDistribute::distribute
(
const globalIndexAndTransform& git,
List<T>& fld,
const bool isPosition
const TransformOp& top
) const
{
// Distribute. Leave out dummy transforms since we're doing them ourselves
distribute(fld, false);
// Do transforms
applyTransforms(git, fld, isPosition); //, eqOp<T>());
applyTransforms(git, fld, top);
}
template<class T>
template<class T, class TransformOp>
void Foam::mapDistribute::reverseDistribute
(
const globalIndexAndTransform& git,
const label constructSize,
List<T>& fld,
const bool isPosition
const TransformOp& top
) 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, isPosition); //, eqOp<T>());
applyInverseTransforms(git, fld, top);
// And send back (the remote slots). Disable dummy transformations.
reverseDistribute(constructSize, fld, false);
}
template<class T>
template<class T, class TransformOp>
void Foam::mapDistribute::reverseDistribute
(
const globalIndexAndTransform& git,
const label constructSize,
const T& nullValue,
List<T>& fld,
const bool isPosition
const TransformOp& top
) 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, isPosition); //, eqOp<T>());
applyInverseTransforms(git, fld, top); //, eqOp<T>());
// And send back (the remote slots) Disable dummy transformations.
reverseDistribute(constructSize, nullValue, fld, false);

View File

@ -25,77 +25,6 @@ License
#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 * * * * * * * * * * * //
// 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 "polyMesh.H"
#include "coupledPolyPatch.H"
#include "transformList.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -87,59 +87,6 @@ class syncTools
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
// use specialisations below.
@ -163,41 +110,41 @@ public:
const CombineOp& cop,
const TransformOp& top
);
//
// //- Synchronize values on all mesh points.
// template <class T, class CombineOp, class TransformOp>
// static void syncPointList
// (
// const polyMesh&,
// UList<T>&,
// const CombineOp& cop,
// const T& nullValue,
// const TransformOp& top
// );
//
// //- Synchronize values on selected mesh points.
// template <class T, class CombineOp, class TransformOp>
// static void syncPointList
// (
// const polyMesh&,
// const labelList& meshPoints,
// UList<T>&,
// const CombineOp& cop,
// const T& nullValue,
// const TransformOp& top
// );
//
// //- Synchronize values on all mesh edges.
// template <class T, class CombineOp, class TransformOp>
// static void syncEdgeList
// (
// const polyMesh&,
// UList<T>&,
// const CombineOp& cop,
// const T& nullValue,
// const TransformOp& top
// );
//
//- Synchronize values on all mesh points.
template <class T, class CombineOp, class TransformOp>
static void syncPointList
(
const polyMesh&,
List<T>&,
const CombineOp& cop,
const T& nullValue,
const TransformOp& top
);
//- Synchronize values on selected mesh points.
template <class T, class CombineOp, class TransformOp>
static void syncPointList
(
const polyMesh&,
const labelList& meshPoints,
List<T>&,
const CombineOp& cop,
const T& nullValue,
const TransformOp& top
);
//- Synchronize values on all mesh edges.
template <class T, class CombineOp, class TransformOp>
static void syncEdgeList
(
const polyMesh&,
List<T>&,
const CombineOp& cop,
const T& nullValue,
const TransformOp& top
);
//- Synchronize values on boundary faces only.
template <class T, class CombineOp, class TransformOp>
static void syncBoundaryFaceList
@ -219,7 +166,17 @@ public:
List<T>& l,
const CombineOp& cop,
const T& nullValue
);
)
{
syncPointList
(
mesh,
l,
cop,
nullValue,
mapDistribute::transform()
);
}
//- Synchronize locations on all mesh points.
template <class CombineOp>
@ -229,7 +186,17 @@ public:
List<point>& l,
const CombineOp& cop,
const point& nullValue
);
)
{
syncPointList
(
mesh,
l,
cop,
nullValue,
mapDistribute::transformPosition()
);
}
//- Synchronize values on selected mesh points.
template <class T, class CombineOp>
@ -237,10 +204,21 @@ public:
(
const polyMesh& mesh,
const labelList& meshPoints,
UList<T>& l,
List<T>& l,
const CombineOp& cop,
const T& nullValue
);
)
{
syncPointList
(
mesh,
meshPoints,
l,
cop,
nullValue,
mapDistribute::transform()
);
}
//- Synchronize locations on selected mesh points.
template <class CombineOp>
@ -248,10 +226,21 @@ public:
(
const polyMesh& mesh,
const labelList& meshPoints,
UList<point>& l,
List<point>& l,
const CombineOp& cop,
const point& nullValue
);
)
{
syncPointList
(
mesh,
meshPoints,
l,
cop,
nullValue,
mapDistribute::transformPosition()
);
}
// Synchronise edge-wise data
@ -261,20 +250,40 @@ public:
static void syncEdgeList
(
const polyMesh& mesh,
UList<T>& l,
List<T>& l,
const CombineOp& cop,
const T& nullValue
);
)
{
syncEdgeList
(
mesh,
l,
cop,
nullValue,
mapDistribute::transform()
);
}
//- Synchronize values on all mesh edges.
template <class CombineOp>
static void syncEdgePositions
(
const polyMesh& mesh,
UList<point>& l,
List<point>& l,
const CombineOp& cop,
const point& nullValue
);
)
{
syncEdgeList
(
mesh,
l,
cop,
nullValue,
mapDistribute::transformPosition()
);
}
// Synchronise face-wise data
@ -288,7 +297,7 @@ public:
const CombineOp& cop
)
{
syncBoundaryFaceList(mesh, l, cop, transform());
syncBoundaryFaceList(mesh, l, cop, mapDistribute::transform());
}
//- Synchronize locations on boundary faces only.
@ -300,7 +309,13 @@ public:
const CombineOp& cop
)
{
syncBoundaryFaceList(mesh, l, cop, transformPosition());
syncBoundaryFaceList
(
mesh,
l,
cop,
mapDistribute::transformPosition()
);
}
//- Synchronize values on all mesh faces.
@ -319,7 +334,13 @@ public:
mesh.nInternalFaces()
);
syncBoundaryFaceList(mesh, bndValues, cop, transform());
syncBoundaryFaceList
(
mesh,
bndValues,
cop,
mapDistribute::transform()
);
}
//- Synchronize locations on all mesh faces.
@ -337,7 +358,13 @@ public:
mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces()
);
syncBoundaryFaceList(mesh, bndValues, cop, transformPosition());
syncBoundaryFaceList
(
mesh,
bndValues,
cop,
mapDistribute::transformPosition()
);
}
//- Swap coupled boundary face values.
@ -348,7 +375,13 @@ public:
UList<T>& l
)
{
syncBoundaryFaceList(mesh, l, eqOp<T>(), transform());
syncBoundaryFaceList
(
mesh,
l,
eqOp<T>(),
mapDistribute::transform()
);
}
//- Swap coupled positions.
@ -359,7 +392,13 @@ public:
UList<T>& l
)
{
syncBoundaryFaceList(mesh, l, eqOp<T>(), transformPosition());
syncBoundaryFaceList
(
mesh,
l,
eqOp<T>(),
mapDistribute::transformPosition()
);
}
//- Swap coupled face values.
@ -376,7 +415,13 @@ public:
mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces()
);
syncBoundaryFaceList(mesh, bndValues, eqOp<T>(), transform());
syncBoundaryFaceList
(
mesh,
bndValues,
eqOp<T>(),
mapDistribute::transform()
);
}
// Sparse versions
@ -390,7 +435,7 @@ public:
const CombineOp& cop
)
{
syncPointMap(mesh, l, cop, transform());
syncPointMap(mesh, l, cop, mapDistribute::transform());
}
//- Synchronize locations on selected points.
@ -402,7 +447,7 @@ public:
const CombineOp& cop
)
{
syncPointMap(mesh, l, cop, transformPosition());
syncPointMap(mesh, l, cop, mapDistribute::transformPosition());
}
//- Synchronize values on selected edges. Edges are represented
@ -416,7 +461,7 @@ public:
const CombineOp& cop
)
{
syncEdgeMap(mesh, l, cop, transform());
syncEdgeMap(mesh, l, cop, mapDistribute::transform());
}
//- Synchronize locations on selected edges.
@ -428,7 +473,7 @@ public:
const CombineOp& cop
)
{
syncEdgeMap(mesh, l, cop, transformPosition());
syncEdgeMap(mesh, l, cop, mapDistribute::transformPosition());
}
// 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

View File

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