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
|
\\ / 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
|
||||||
@ -50,133 +50,71 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
const globalMeshData& globalData = mesh.globalData();
|
const globalMeshData& globalData = mesh.globalData();
|
||||||
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
|
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 =
|
const mapDistribute& globalPointSlavesMap =
|
||||||
globalData.globalPointSlavesMap();
|
globalData.globalPointSlavesMap();
|
||||||
|
const labelListList& slaves =
|
||||||
|
globalData.globalPointSlaves();
|
||||||
|
const labelListList& transformedSlaves =
|
||||||
|
globalData.globalPointTransformedSlaves();
|
||||||
|
|
||||||
|
// Create field with my local data
|
||||||
pointField coords(globalPointSlavesMap.constructSize());
|
pointField coords(globalPointSlavesMap.constructSize());
|
||||||
SubList<point>(coords, coupledPatch.nPoints()).assign
|
SubList<point>(coords, coupledPatch.nPoints()).assign
|
||||||
(
|
(
|
||||||
coupledPatch.localPoints()
|
coupledPatch.localPoints()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Exchange data
|
// Exchange data. Apply positional transforms.
|
||||||
globalPointSlavesMap.distribute(coords);
|
globalPointSlavesMap.distribute(transforms, coords, true);
|
||||||
|
|
||||||
// Print
|
// Print
|
||||||
forAll(globalPointSlaves, pointI)
|
forAll(slaves, pointI)
|
||||||
{
|
{
|
||||||
const labelList& slavePoints = globalPointSlaves[pointI];
|
const labelList& slavePoints = slaves[pointI];
|
||||||
|
|
||||||
if (slavePoints.size() > 0)
|
if (slavePoints.size() > 0)
|
||||||
{
|
{
|
||||||
Pout<< "Master point:" << pointI
|
Pout<< "Master point:" << pointI
|
||||||
<< " coord:" << coords[pointI]
|
<< " coord:" << coords[pointI]
|
||||||
<< " connected to slave points:" << endl;
|
<< " connected to untransformed slave points:" << endl;
|
||||||
|
|
||||||
forAll(slavePoints, i)
|
forAll(slavePoints, i)
|
||||||
{
|
{
|
||||||
Pout<< " " << coords[slavePoints[i]] << endl;
|
Pout<< " " << coords[slavePoints[i]] << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const labelList& transformedSlavePoints = transformedSlaves[pointI];
|
||||||
|
|
||||||
|
if (transformedSlavePoints.size() > 0)
|
||||||
// Test: (collocated) point to faces addressing
|
|
||||||
{
|
{
|
||||||
const labelListList& globalPointBoundaryFaces =
|
Pout<< "Master point:" << pointI
|
||||||
globalData.globalPointBoundaryFaces();
|
<< " coord:" << coords[pointI]
|
||||||
const mapDistribute& globalPointBoundaryFacesMap =
|
<< " connected to transformed slave points:" << endl;
|
||||||
globalData.globalPointBoundaryFacesMap();
|
|
||||||
|
|
||||||
label nBnd = mesh.nFaces()-mesh.nInternalFaces();
|
forAll(transformedSlavePoints, i)
|
||||||
|
|
||||||
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<< " " << coords[transformedSlavePoints[i]]
|
||||||
|
<< endl;
|
||||||
Pout<< "Point:" << pointI
|
}
|
||||||
<< " at:" << coupledPatch.localPoints()[pointI]
|
|
||||||
<< " connected to faces:" << endl;
|
|
||||||
|
|
||||||
forAll(bFaces, i)
|
|
||||||
{
|
|
||||||
Pout<< " " << fc[bFaces[i]] << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Test:print shared edges
|
||||||
|
|
||||||
|
|
||||||
// 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:print (collocated) shared edges
|
|
||||||
{
|
|
||||||
const labelListList& globalEdgeSlaves =
|
|
||||||
globalData.globalEdgeSlaves();
|
|
||||||
const mapDistribute& globalEdgeSlavesMap =
|
const mapDistribute& globalEdgeSlavesMap =
|
||||||
globalData.globalEdgeSlavesMap();
|
globalData.globalEdgeSlavesMap();
|
||||||
|
const labelListList& slaves =
|
||||||
|
globalData.globalEdgeSlaves();
|
||||||
|
const labelListList& transformedSlaves =
|
||||||
|
globalData.globalEdgeTransformedSlaves();
|
||||||
|
|
||||||
// Test: distribute edge centres
|
// Test: distribute edge centres
|
||||||
pointField ec(globalEdgeSlavesMap.constructSize());
|
pointField ec(globalEdgeSlavesMap.constructSize());
|
||||||
@ -188,13 +126,13 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exchange data
|
// Exchange data Apply positional transforms.
|
||||||
globalEdgeSlavesMap.distribute(ec);
|
globalEdgeSlavesMap.distribute(transforms, ec, true);
|
||||||
|
|
||||||
// Print
|
// Print
|
||||||
forAll(globalEdgeSlaves, edgeI)
|
forAll(slaves, edgeI)
|
||||||
{
|
{
|
||||||
const labelList& slaveEdges = globalEdgeSlaves[edgeI];
|
const labelList& slaveEdges = slaves[edgeI];
|
||||||
|
|
||||||
if (slaveEdges.size() > 0)
|
if (slaveEdges.size() > 0)
|
||||||
{
|
{
|
||||||
@ -207,8 +145,100 @@ int main(int argc, char *argv[])
|
|||||||
Pout<< " " << ec[slaveEdges[i]] << endl;
|
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;
|
Info<< "End\n" << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user