Commit fe987dad authored by mattijs's avatar mattijs
Browse files

ENH: Test-globalMeshData.C : updated to include transforms

parent f91d99c8
......@@ -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
......@@ -50,133 +50,71 @@ int main(int argc, char *argv[])
const globalMeshData& globalData = mesh.globalData();
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
const globalIndexAndTransform& transforms = globalData.globalTransforms();
// Test:print (collocated) shared points
// Test:print shared points
{
const labelListList& globalPointSlaves =
globalData.globalPointSlaves();
const mapDistribute& globalPointSlavesMap =
globalData.globalPointSlavesMap();
const labelListList& slaves =
globalData.globalPointSlaves();
const labelListList& transformedSlaves =
globalData.globalPointTransformedSlaves();
// Create field with my local data
pointField coords(globalPointSlavesMap.constructSize());
SubList<point>(coords, coupledPatch.nPoints()).assign
(
coupledPatch.localPoints()
);
// Exchange data
globalPointSlavesMap.distribute(coords);
// Exchange data. Apply positional transforms.
globalPointSlavesMap.distribute(transforms, coords, true);
// Print
forAll(globalPointSlaves, pointI)
forAll(slaves, pointI)
{
const labelList& slavePoints = globalPointSlaves[pointI];
const labelList& slavePoints = slaves[pointI];
if (slavePoints.size() > 0)
{
Pout<< "Master point:" << pointI
<< " coord:" << coords[pointI]
<< " connected to slave points:" << endl;
<< " connected to untransformed slave points:" << endl;
forAll(slavePoints, i)
{
Pout<< " " << coords[slavePoints[i]] << endl;
}
}
}
}
// 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);
const labelList& transformedSlavePoints = transformedSlaves[pointI];
// Print
forAll(globalPointBoundaryFaces, pointI)
{
const labelList& bFaces = globalPointBoundaryFaces[pointI];
Pout<< "Point:" << pointI
<< " at:" << coupledPatch.localPoints()[pointI]
<< " connected to faces:" << endl;
forAll(bFaces, i)
if (transformedSlavePoints.size() > 0)
{
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;
Pout<< "Master point:" << pointI
<< " coord:" << coords[pointI]
<< " connected to transformed slave points:" << endl;
forAll(bCells, i)
{
Pout<< " " << cc[bCells[i]] << endl;
forAll(transformedSlavePoints, i)
{
Pout<< " " << coords[transformedSlavePoints[i]]
<< endl;
}
}
}
}
// Test:print (collocated) shared edges
// Test:print shared edges
{
const labelListList& globalEdgeSlaves =
globalData.globalEdgeSlaves();
const mapDistribute& globalEdgeSlavesMap =
globalData.globalEdgeSlavesMap();
const labelListList& slaves =
globalData.globalEdgeSlaves();
const labelListList& transformedSlaves =
globalData.globalEdgeTransformedSlaves();
// Test: distribute edge centres
pointField ec(globalEdgeSlavesMap.constructSize());
......@@ -188,13 +126,13 @@ int main(int argc, char *argv[])
);
}
// Exchange data
globalEdgeSlavesMap.distribute(ec);
// Exchange data Apply positional transforms.
globalEdgeSlavesMap.distribute(transforms, ec, true);
// Print
forAll(globalEdgeSlaves, edgeI)
forAll(slaves, edgeI)
{
const labelList& slaveEdges = globalEdgeSlaves[edgeI];
const labelList& slaveEdges = slaves[edgeI];
if (slaveEdges.size() > 0)
{
......@@ -207,10 +145,102 @@ int main(int argc, char *argv[])
Pout<< " " << ec[slaveEdges[i]] << endl;
}
}
const labelList& transformedSlaveEdges = transformedSlaves[edgeI];
if (transformedSlaveEdges.size() > 0)
{
Pout<< "Master edge:" << edgeI
<< " centre:" << ec[edgeI]
<< " connected to transformed slave edges:" << endl;
forAll(transformedSlaveEdges, i)
{
Pout<< " " << ec[transformedSlaveEdges[i]]
<< endl;
}
}
}
}
//// 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;
// }
// }
//}
Info<< "End\n" << endl;
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment