OpenFOAM logo
Open Source CFD Toolkit

globalProcessorTetPolyPatchCellDecomp.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     globalProcessorTetPolyPatchCellDecomp
00027 
00028 Description
00029     In parallel decompositions of FEM meshes a number of vertices may
00030     be shared between more that only two processors.  These vertices
00031     are typically located on intersections of face processor patches
00032     and cause all kinds of trouble, both in terms or organisation and
00033     communication.
00034 
00035     In order to simplify this issue, a processor point communication
00036     mechanism caters for all such points for a parallel decomposition.
00037     They are colected in a single global list which gets globally
00038     communicated (as necessary).  A processor point patch knows which
00039     local processor points are in the global list and where.  In order
00040     for this mechanism to work, the multiply-shared points need to be
00041     elominated from all other processor patches as well.
00042 
00043     Note: This patch is created automatically for parallel runs and is
00044     not accessible through the run-time selection mechanism as the
00045     user may get the construction wrong!
00046 
00047 
00048 SourceFiles
00049     globalProcessorTetPolyPatchCellDecomp.C
00050 
00051 \*---------------------------------------------------------------------------*/
00052 
00053 #ifndef globalProcessorTetPolyPatchCellDecomp_H
00054 #define globalProcessorTetPolyPatchCellDecomp_H
00055 
00056 #include "tetPolyPatchCellDecomp.H"
00057 #include "edgeList.H"
00058 
00059 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00060 
00061 namespace Foam
00062 {
00063 
00064 /*---------------------------------------------------------------------------*\
00065              Class globalProcessorTetPolyPatchCellDecomp Declaration
00066 \*---------------------------------------------------------------------------*/
00067 
00068 class globalProcessorTetPolyPatchCellDecomp
00069 :
00070     public tetPolyPatchCellDecomp
00071 {
00072     // Private data
00073 
00074         //- Global point size - number of all shared points in decomposition
00075         label globalPointSize_;
00076 
00077         //- List of local multiply shared points
00078         labelList meshPoints_;
00079 
00080         //- Addressing into the global point patch
00081         labelList sharedPointAddr_;
00082 
00083         //- Global edge size - number of all shared edges in decomposition
00084         label globalEdgeSize_;
00085 
00086         //- List of local multiply shared edges
00087         edgeList meshEdges_;
00088 
00089         //- Addressing into the global point patch
00090         labelList sharedEdgeAddr_;
00091 
00092         //- List of local cut edges
00093         edgeList meshCutEdges_;
00094 
00095         //- Local cut edge multiplication mask
00096         scalarField meshCutEdgeMask_;
00097 
00098         //- Index in the boundary mesh
00099         label boundaryIndex_;
00100 
00101     // Demand driven private data
00102 
00103         //- Local edge indices
00104         mutable labelList* localEdgeIndicesPtr_;
00105 
00106 
00107         //- Cut edges indices, i.e. the ones originating from the
00108         //  points on the patch but connected to points which are
00109         //  internal (not on the patch)
00110         mutable labelList* cutEdgeIndicesPtr_;
00111 
00112         // Edge addressing for cut edges.
00113         // Edges are separated into two lists, one where the patch point
00114         // is the owner and one for the neighbour.  The edges are ordered
00115         // such that the first n add a contribution to the vertex zero and
00116         // so on; the breaks in the list are stored in the "start"
00117         // mechanism, described in lduAddressing.  This will be used to
00118         // calculate the cross-processor contribution of the vector-matrix
00119         // multiply.
00120 
00121             //- Cut edges owner list
00122             mutable labelList* cutEdgeOwnerIndicesPtr_;
00123 
00124             //- Cut edge owner starts
00125             mutable labelList* cutEdgeOwnerStartPtr_;
00126 
00127             //- Cut edges neighbour list
00128             mutable labelList* cutEdgeNeighbourIndicesPtr_;
00129 
00130             //- Cut edge neighbour starts
00131             mutable labelList* cutEdgeNeighbourStartPtr_;
00132 
00133 
00134             //- Doubly cut edge indices
00135             mutable labelList* doubleCutEdgeIndicesPtr_;
00136 
00137             //- Doubly cut edge owner addressing
00138             mutable labelList* doubleCutOwnerPtr_;
00139 
00140             //- Doubly cut edge neighbour addressing
00141             mutable labelList* doubleCutNeighbourPtr_;
00142 
00143             //- Owner-neighbour-double cut multiplication mask
00144             mutable scalarField* ownNeiDoubleMaskPtr_;
00145 
00146 
00147     // Private Member Functions
00148 
00149         //- Disallow default construct as copy
00150         globalProcessorTetPolyPatchCellDecomp
00151         (
00152             const globalProcessorTetPolyPatchCellDecomp&
00153         );
00154 
00155         //- Disallow default assignment
00156         void operator=(const globalProcessorTetPolyPatchCellDecomp&);
00157 
00158         // Construction of demand-driven data
00159 
00160             //- Calculate local points
00161             void calcLocalPoints() const;
00162 
00163             //- Calculate local edge indices
00164             void calcLocalEdgesIndices() const;
00165 
00166             //- Calculate cut edge indices
00167             void calcCutEdgeIndices() const;
00168 
00169             //- Calculate cut edge addressing
00170             void calcCutEdgeAddressing() const;
00171 
00172             //- Clear cut edge addressing
00173             void clearCutEdgeAddressing() const;
00174 
00175 
00176 public:
00177 
00178     typedef tetPolyBoundaryMeshCellDecomp BoundaryMesh;
00179 
00180 
00181     //- Runtime type information
00182     TypeName("globalProcessor");
00183 
00184     // Constructors
00185 
00186         //- Construct from components
00187         globalProcessorTetPolyPatchCellDecomp
00188         (
00189             const label globalPointSize,
00190             const labelList& meshPoints,
00191             const labelList& sharedPointAddr,
00192             const label globalEdgeSize,
00193             const edgeList& meshEdges,
00194             const labelList& sharedEdgeAddr,
00195             const edgeList& meshCutEdges,
00196             const scalarField& meshCutEdgeMask,
00197             const tetPolyBoundaryMeshCellDecomp& bm,
00198             const label index
00199         );
00200 
00201 
00202     // Destructor
00203 
00204         virtual ~globalProcessorTetPolyPatchCellDecomp();
00205 
00206     // Member functions
00207 
00208         //- Return name
00209         virtual const word& name() const
00210         {
00211             // There can only be a single patch of this type - therefore
00212             // its name is hard-coded.  
00213             return type();
00214         }
00215 
00216         //- Return size
00217         virtual label size() const
00218         {
00219             return meshPoints().size();
00220         }
00221 
00222         //- Return number of faces
00223         virtual label nFaces() const
00224         {
00225             return 0;
00226         }
00227 
00228         //- Return total number of shared points
00229         virtual label globalPointSize() const
00230         {
00231             return globalPointSize_;
00232         }
00233 
00234         //- Return total number of shared edges
00235         virtual label globalEdgeSize() const
00236         {
00237             return globalEdgeSize_;
00238         }
00239 
00240         //- Return the index of this patch in the tetPolyBoundaryMeshCellDecomp
00241         virtual label index() const
00242         {
00243             return boundaryIndex_;
00244         }
00245 
00246         //- Return mesh points
00247         virtual const labelList& meshPoints() const
00248         {
00249             return meshPoints_;
00250         }
00251 
00252         //- Return local points.  Not implemented
00253         virtual const pointField& localPoints() const;
00254 
00255         //- Return point normals.  Not implemented
00256         virtual const vectorField& pointNormals() const;
00257 
00258         //- Face decomposition into triangle.  Not implemented
00259         virtual triFaceList faceTriangles(const label faceID) const;
00260 
00261         //- Return complete list of faces.  Not implemented
00262         virtual faceList triFaces() const;
00263 
00264 
00265         //- Return addressing into the global points list
00266         const labelList& sharedPointAddr() const
00267         {
00268             return sharedPointAddr_;
00269         }
00270 
00271         //- Return mesh edges
00272         virtual const edgeList& meshEdges() const
00273         {
00274             return meshEdges_;
00275         }
00276 
00277         //- Return addressing into the global edge list
00278         const labelList& sharedEdgeAddr() const
00279         {
00280             return sharedEdgeAddr_;
00281         }
00282 
00283         //- Return cut mesh edges
00284         const edgeList& meshCutEdges() const
00285         {
00286             return meshCutEdges_;
00287         }
00288 
00289         //- Return cut mesh edges multiplication mask
00290         //  Warning: this one is in the original cut edge order.
00291         //  For patch matrix multiplication se the reordered one
00292         const scalarField& meshCutEdgeMask() const
00293         {
00294             return meshCutEdgeMask_;
00295         }
00296 
00297         // Access functions for demand driven data
00298 
00299             //- Return list of edge indices for edges local to the patch
00300             virtual const labelList& localEdgeIndices() const;
00301 
00302             //- Return list of edge indices for cut edges
00303             //  (i.e. connecting points within the patch ot points outside it)
00304             virtual const labelList& cutEdgeIndices() const;
00305 
00306             // Cut edge addressing
00307 
00308                //- Return cut edge owner edge indices
00309                const labelList& cutEdgeOwnerIndices() const;
00310 
00311                //- Return cut edge owner edge starts
00312                const labelList& cutEdgeOwnerStart() const;
00313 
00314                //- Return cut edge neighbour edge indices
00315                const labelList& cutEdgeNeighbourIndices() const;
00316 
00317                //- Return cut edge neighbour edge starts
00318                const labelList& cutEdgeNeighbourStart() const;
00319 
00320               // Doubly cut edge addressing
00321 
00322                   //- Return doubly cut edge indices
00323                   const labelList& doubleCutEdgeIndices() const;
00324 
00325                   //- Return doubly cut edge owner addressing
00326                   //  into current patch
00327                   const labelList& doubleCutOwner() const;
00328 
00329                   //- Return doubly cut edge neighbour addressing
00330                   //  into current patch
00331                   const labelList& doubleCutNeighbour() const;
00332 
00333               //- Return cut edge multiplication mask
00334               const scalarField& ownNeiDoubleMask() const;
00335 
00336 
00337         // Update topology
00338         virtual void updateMesh();
00339 };
00340 
00341 
00342 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00343 
00344 } // End namespace Foam
00345 
00346 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00347 
00348 #endif
00349 
00350 // ************************************************************************* //
For further information go to www.openfoam.org