/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Class Foam::globalMeshData Description Various mesh related information for a parallel run. Upon construction constructs all info by using parallel communication. Requires: - all processor patches to have correct ordering. - all processorPatches to have their transforms set. The shared point and edge addressing is quite interesting. It calculates addressing for points and edges on coupled patches. In the 'old' way a distincation was made between points/edges that are only on two processors and those that are on multiple processors. The problem is that those on multiple processors do not allow any transformations and require a global reduction on the master processor. The alternative is to have an exchange schedule (through a 'mapDistribute') which sends all point/edge data (no distinction is made between those on two and those on more than two coupled patches) to the local 'master'. This master then does any calculation and sends the result back to the 'slave' points/edges. This only needs to be done on points on coupled faces. Any transformation is done using a predetermined set of transformations - since transformations have to be space filling only a certain number of transformation is supported. The exchange needs - a field of data - a mapDistribute which does all parallel exchange and transformations This appens remote data to the end of the field. - a set of indices which indicate where to get untransformed data in the field - a set of indices which indicate where to get transformed data in the field See also mapDistribute, globalIndexAndTransform Notes: - compared to 17x nTotalFaces, nTotalPoints do not compensate for shared points since this would trigger full connectivity analysis - most calculation is demand driven and uses parallel communication so make sure to invoke on all processors at the same time. - old sharedEdge calculation: currently an edge is considered shared if it uses two shared points and is used more than once. This is not correct on processor patches but it only slightly overestimates the number of shared edges. Doing full analysis of how many patches use the edge would be too complicated. SourceFiles globalMeshData.C globalMeshDataTemplates.C \*---------------------------------------------------------------------------*/ #ifndef globalMeshData_H #define globalMeshData_H #include "processorTopology.H" #include "labelPair.H" #include "indirectPrimitivePatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // Forward declaration of friend functions and operators class polyMesh; class mapDistribute; template class EdgeMap; class globalIndex; class globalIndexAndTransform; /*---------------------------------------------------------------------------*\ Class globalMeshData Declaration \*---------------------------------------------------------------------------*/ class globalMeshData : public processorTopology { // Private class // To combineReduce a pointField. Just appends all lists. template class plusEqOp { public: void operator()(T& x, const T& y) const { label n = x.size(); x.setSize(x.size() + y.size()); forAll(y, i) { x[n++] = y[i]; } } }; // Private data //- Reference to mesh const polyMesh& mesh_; // Data related to the complete mesh //- Total number of points in the complete mesh label nTotalPoints_; //- Total number of faces in the complete mesh label nTotalFaces_; //- Total number of cells in the complete mesh label nTotalCells_; // Processor patch addressing (be careful if not running in parallel!) //- List of processor patch labels // (size of list = number of processor patches) labelList processorPatches_; //- List of indices into processorPatches_ for each patch. // Index = -1 for non-processor patches. // (size of list = number of patches) labelList processorPatchIndices_; //- processorPatchIndices_ of the neighbours processor patches labelList processorPatchNeighbours_; // Coupled point addressing // This is addressing from coupled point to coupled points/faces/cells. // This is a full schedule so includes points used by only two // coupled patches. //- Patch of coupled faces. Additional patch edge to mesh edges // correspondence: // points: meshPoints(), meshPointMap() // edges : meshEdges(), meshEdgeMap() mutable autoPtr coupledPatchPtr_; mutable autoPtr coupledPatchMeshEdgesPtr_; mutable autoPtr > coupledPatchMeshEdgeMapPtr_; //- Global numbering for coupledPatch points mutable autoPtr globalPointNumberingPtr_; //- Global numbering for transforms mutable autoPtr globalTransformsPtr_; // Coupled point to coupled points mutable autoPtr globalPointSlavesPtr_; mutable autoPtr globalPointTransformedSlavesPtr_; mutable autoPtr globalPointSlavesMapPtr_; // Coupled edge to coupled edges mutable autoPtr globalEdgeNumberingPtr_; mutable autoPtr globalEdgeSlavesPtr_; mutable autoPtr globalEdgeTransformedSlavesPtr_; mutable autoPtr globalEdgeSlavesMapPtr_; // Coupled point to boundary faces mutable autoPtr globalBoundaryFaceNumberingPtr_; mutable autoPtr globalPointBoundaryFacesPtr_; mutable autoPtr globalPointTransformedBoundaryFacesPtr_; mutable autoPtr globalPointBoundaryFacesMapPtr_; // Coupled point to collocated boundary cells mutable autoPtr boundaryCellsPtr_; mutable autoPtr globalBoundaryCellNumberingPtr_; mutable autoPtr globalPointBoundaryCellsPtr_; mutable autoPtr globalPointTransformedBoundaryCellsPtr_; mutable autoPtr globalPointBoundaryCellsMapPtr_; // Globally shared point addressing //- Total number of global points mutable label nGlobalPoints_; //- Indices of local points that are globally shared mutable autoPtr sharedPointLabelsPtr_; //- Indices of globally shared points in the master list // This list contains all the shared points in the mesh mutable autoPtr sharedPointAddrPtr_; //- Shared point global labels. // Global point index for every local shared point. // Only valid if constructed with this information or if // pointProcAddressing read. mutable autoPtr sharedPointGlobalLabelsPtr_; // Globally shared edge addressing. Derived from shared points. // All demand driven since don't want to construct edges always. //- Total number of global edges mutable label nGlobalEdges_; //- Indices of local edges that are globally shared mutable autoPtr sharedEdgeLabelsPtr_; //- Indices of globally shared edge in the master list // This list contains all the shared edges in the mesh mutable autoPtr sharedEdgeAddrPtr_; // Private Member Functions //- Set up processor patch addressing void initProcAddr(); //- Helper function for shared edge addressing static void countSharedEdges ( const EdgeMap&, EdgeMap