mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Test-globalMeshData.C : updated to include transforms
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const labelList& transformedSlavePoints = transformedSlaves[pointI];
|
||||
|
||||
|
||||
// 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)
|
||||
if (transformedSlavePoints.size() > 0)
|
||||
{
|
||||
Pout<< " " << fc[bFaces[i]] << endl;
|
||||
Pout<< "Master point:" << pointI
|
||||
<< " coord:" << coords[pointI]
|
||||
<< " connected to transformed slave points:" << endl;
|
||||
|
||||
forAll(transformedSlavePoints, i)
|
||||
{
|
||||
Pout<< " " << coords[transformedSlavePoints[i]]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Test:(collocated) point to cells addressing
|
||||
// Test:print shared edges
|
||||
{
|
||||
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:print (collocated) 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;
|
||||
|
||||
Reference in New Issue
Block a user