OpenFOAM logo
Open Source CFD Toolkit

globalProcessorTetPolyPatchFaceDecomp.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     globalProcessorTetPolyPatchFaceDecomp
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     globalProcessorTetPolyPatchFaceDecomp.C
00050 
00051 \*---------------------------------------------------------------------------*/
00052 
00053 #ifndef globalProcessorTetPolyPatchFaceDecomp_H
00054 #define globalProcessorTetPolyPatchFaceDecomp_H
00055 
00056 #include "tetPolyPatchFaceDecomp.H"
00057 #include "edgeList.H"
00058 
00059 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00060 
00061 namespace Foam
00062 {
00063 
00064 /*---------------------------------------------------------------------------*\
00065              Class globalProcessorTetPolyPatchFaceDecomp Declaration
00066 \*---------------------------------------------------------------------------*/
00067 
00068 class globalProcessorTetPolyPatchFaceDecomp
00069 :
00070     public tetPolyPatchFaceDecomp
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         globalProcessorTetPolyPatchFaceDecomp
00151         (
00152             const globalProcessorTetPolyPatchFaceDecomp&
00153         );
00154 
00155         //- Disallow default assignment
00156         void operator=(const globalProcessorTetPolyPatchFaceDecomp&);
00157 
00158         // Construction of demand-driven data
00159 
00160             //- Calculate local edge indices
00161             void calcLocalEdgesIndices() const;
00162 
00163             //- Calculate cut edge indices
00164             void calcCutEdgeIndices() const;
00165 
00166             //- Calculate cut edge addressing
00167             void calcCutEdgeAddressing() const;
00168 
00169             //- Clear cut edge addressing
00170             void clearCutEdgeAddressing() const;
00171 
00172 
00173 public:
00174 
00175     typedef tetPolyBoundaryMeshFaceDecomp BoundaryMesh;
00176 
00177 
00178     //- Runtime type information
00179     TypeName("globalProcessor");
00180 
00181     // Constructors
00182 
00183         //- Construct from components
00184         globalProcessorTetPolyPatchFaceDecomp
00185         (
00186             const label globalPointSize,
00187             const labelList& meshPoints,
00188             const labelList& sharedPointAddr,
00189             const label globalEdgeSize,
00190             const edgeList& meshEdges,
00191             const labelList& sharedEdgeAddr,
00192             const edgeList& meshCutEdges,
00193             const scalarField& meshCutEdgeMask,
00194             const tetPolyBoundaryMeshFaceDecomp& bm,
00195             const label index
00196         );
00197 
00198 
00199     // Destructor
00200 
00201         virtual ~globalProcessorTetPolyPatchFaceDecomp();
00202 
00203     // Member functions
00204 
00205         //- Return name
00206         virtual const word& name() const
00207         {
00208             // There can only be a single patch of this type - therefore
00209             // its name is hard-coded.  
00210             return type();
00211         }
00212 
00213         //- Return size
00214         virtual label size() const
00215         {
00216             return meshPoints().size();
00217         }
00218 
00219         //- Return number of faces
00220         virtual label nFaces() const
00221         {
00222             return 0;
00223         }
00224 
00225         //- Return total number of shared points
00226         virtual label globalPointSize() const
00227         {
00228             return globalPointSize_;
00229         }
00230 
00231         //- Return total number of shared edges
00232         virtual label globalEdgeSize() const
00233         {
00234             return globalEdgeSize_;
00235         }
00236 
00237         //- Return the index of this patch in the tetPolyBoundaryMeshFaceDecomp
00238         virtual label index() const
00239         {
00240             return boundaryIndex_;
00241         }
00242 
00243         //- Return mesh points
00244         virtual const labelList& meshPoints() const
00245         {
00246             return meshPoints_;
00247         }
00248 
00249         //- Return local points.  Not implemented
00250         virtual const pointField& localPoints() const;
00251 
00252         //- Return point normals.  Not implemented
00253         virtual const vectorField& pointNormals() const;
00254 
00255         //- Face decomposition into triangle.  Not implemented
00256         virtual triFaceList faceTriangles(const label faceID) const;
00257 
00258         //- Return complete list of faces.  Not implemented
00259         virtual faceList triFaces() const;
00260 
00261 
00262         //- Return addressing into the global points list
00263         const labelList& sharedPointAddr() const
00264         {
00265             return sharedPointAddr_;
00266         }
00267 
00268         //- Return mesh edges
00269         virtual const edgeList& meshEdges() const
00270         {
00271             return meshEdges_;
00272         }
00273 
00274         //- Return addressing into the global edge list
00275         const labelList& sharedEdgeAddr() const
00276         {
00277             return sharedEdgeAddr_;
00278         }
00279 
00280         //- Return cut mesh edges
00281         const edgeList& meshCutEdges() const
00282         {
00283             return meshCutEdges_;
00284         }
00285 
00286         //- Return cut mesh edges multiplication mask
00287         //  Warning: this one is in the original cut edge order.
00288         //  For patch matrix multiplication se the reordered one
00289         const scalarField& meshCutEdgeMask() const
00290         {
00291             return meshCutEdgeMask_;
00292         }
00293 
00294         // Access functions for demand driven data
00295 
00296             //- Return list of edge indices for edges local to the patch
00297             virtual const labelList& localEdgeIndices() const;
00298 
00299             //- Return list of edge indices for cut edges
00300             //  (i.e. connecting points within the patch ot points outside it)
00301             virtual const labelList& cutEdgeIndices() const;
00302 
00303             // Cut edge addressing
00304 
00305                //- Return cut edge owner edge indices
00306                const labelList& cutEdgeOwnerIndices() const;
00307 
00308                //- Return cut edge owner edge starts
00309                const labelList& cutEdgeOwnerStart() const;
00310 
00311                //- Return cut edge neighbour edge indices
00312                const labelList& cutEdgeNeighbourIndices() const;
00313 
00314                //- Return cut edge neighbour edge starts
00315                const labelList& cutEdgeNeighbourStart() const;
00316 
00317               // Doubly cut edge addressing
00318 
00319                   //- Return doubly cut edge indices
00320                   const labelList& doubleCutEdgeIndices() const;
00321 
00322                   //- Return doubly cut edge owner addressing
00323                   //  into current patch
00324                   const labelList& doubleCutOwner() const;
00325 
00326                   //- Return doubly cut edge neighbour addressing
00327                   //  into current patch
00328                   const labelList& doubleCutNeighbour() const;
00329 
00330               //- Return cut edge multiplication mask
00331               const scalarField& ownNeiDoubleMask() const;
00332 
00333 
00334         // Update topology
00335         virtual void updateMesh();
00336 };
00337 
00338 
00339 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00340 
00341 } // End namespace Foam
00342 
00343 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00344 
00345 #endif
00346 
00347 // ************************************************************************* //
For further information go to www.openfoam.org