OpenFOAM logo
Open Source CFD Toolkit

processorTetPolyPatchCellDecomp.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     processorTetPolyPatchCellDecomp
00027 
00028 Description
00029     Processor patch boundary needs to be such that the ordering of
00030     points in the patch is the same on both sides. Looking at the
00031     creation of the faces on both sides of the processor patch they
00032     need to be identical on both sides with the normals pointing in
00033     opposite directions.  This is achieved by calling the reverseFace
00034     function in the decomposition.  It is therefore possible to
00035     re-create the ordering of patch points on the slave side by
00036     reversing all the patch faces of the owner.  Warning: this will
00037     work only with the FOAM parallel decomposition tools - enforce the
00038     same in all other decomposition tools.
00039     
00040 
00041 SourceFiles
00042     processorTetPolyPatchCellDecomp.C
00043     calcProcessorTetPolyPatchCellDecompAddr.C
00044     calcProcessorTetPolyPatchCellDecompPointAddr.C
00045 
00046 \*---------------------------------------------------------------------------*/
00047 
00048 #ifndef processorTetPolyPatchCellDecomp_H
00049 #define processorTetPolyPatchCellDecomp_H
00050 
00051 #include "faceTetPolyPatchCellDecomp.H"
00052 #include "processorPolyPatch.H"
00053 
00054 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00055 
00056 namespace Foam
00057 {
00058 
00059 /*---------------------------------------------------------------------------*\
00060                 Class processorTetPolyPatchCellDecomp Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 class processorTetPolyPatchCellDecomp
00064 :
00065     public faceTetPolyPatchCellDecomp
00066 {
00067     // Private data
00068 
00069         // Calculation of point addressing is based on the master
00070         // patch.  
00071 
00072     // Demand driven private data
00073 
00074         //- Mesh points
00075         mutable labelList* meshPointsPtr_;
00076 
00077         //- Local edge indices
00078         mutable labelList* localEdgeIndicesPtr_;
00079 
00080         //- Cut edges indices, i.e. the ones originating from the
00081         //  points on the patch but connected to points which are
00082         //  internal (not on the patch)
00083         mutable labelList* cutEdgeIndicesPtr_;
00084 
00085         // Edge addressing for cut edges.
00086         // Edges are separated into two lists, one where the patch point
00087         // is the owner and one for the neighbour.  The edges are ordered
00088         // such that the first n add a contribution to the vertex zero and
00089         // so on; the breaks in the list are stored in the "start"
00090         // mechanism, described in lduAddressing.  This will be used to
00091         // calculate the cross-processor contribution of the vector-matrix
00092         // multiply.  
00093 
00094             //- Cut edges owner list
00095             mutable labelList* cutEdgeOwnerIndicesPtr_;
00096 
00097             //- Cut edge owner starts
00098             mutable labelList* cutEdgeOwnerStartPtr_;
00099 
00100             //- Cut edges neighbour list
00101             mutable labelList* cutEdgeNeighbourIndicesPtr_;
00102 
00103             //- Cut edge neighbour starts
00104             mutable labelList* cutEdgeNeighbourStartPtr_;
00105 
00106 
00107             //- Doubly cut edge indices
00108             mutable labelList* doubleCutEdgeIndicesPtr_;
00109 
00110             //- Doubly cut edge owner addressing
00111             mutable labelList* doubleCutOwnerPtr_;
00112 
00113             //- Doubly cut edge neighbour addressing
00114             mutable labelList* doubleCutNeighbourPtr_;
00115 
00116             //- Owner-neighbour-double cut multiplication mask
00117             mutable scalarField* ownNeiDoubleMaskPtr_;
00118 
00119 
00120     // Private Member Functions
00121 
00122         //- Disallow default construct as copy
00123         processorTetPolyPatchCellDecomp(const processorTetPolyPatchCellDecomp&);
00124 
00125         //- Disallow default assignment
00126         void operator=(const processorTetPolyPatchCellDecomp&);
00127 
00128         //- Local reference to processor patch
00129         const processorPolyPatch& procPatch() const
00130         {
00131             return refCast<const processorPolyPatch>(patch());
00132         }
00133 
00134 
00135         // Construction of demand-driven data
00136 
00137             //- Calculate mesh points
00138             void calcMeshPoints() const;
00139 
00140             //- Calculate local edge indices
00141             template<template<class> class FaceList>
00142             labelList calcProcLocalEdgesIndices
00143             (
00144                 const PrimitivePatch<face, FaceList, const pointField&>& p
00145             ) const;
00146 
00147             //- Calculate cut edge indices
00148             void calcCutEdgeIndices() const;
00149 
00150             //- Calculate cut edge addressing
00151             void calcCutEdgeAddressing() const;
00152 
00153             //- Calculate local multiplication mask
00154             void calcOwnNeiDoubleMask() const;
00155 
00156             //- Clear cut edge addressing
00157             void clearCutEdgeAddressing() const;
00158 
00159 public:
00160 
00161     typedef tetPolyBoundaryMeshCellDecomp BoundaryMesh;
00162 
00163 
00164     //- Runtime type information
00165     TypeName("processor");
00166 
00167     // Constructors
00168 
00169         //- Construct from components
00170         processorTetPolyPatchCellDecomp
00171         (
00172             const polyPatch& patch,
00173             const tetPolyBoundaryMeshCellDecomp& bm
00174         );
00175 
00176 
00177     // Destructor
00178 
00179         virtual ~processorTetPolyPatchCellDecomp();
00180 
00181 
00182     // Member functions
00183 
00184         //- Return size
00185         virtual label size() const
00186         {
00187             return meshPoints().size();
00188         }
00189 
00190         //- Return processor number
00191         int myProcNo() const
00192         {
00193             return procPatch().myProcNo();
00194         }
00195 
00196         //- Return neigbour processor number
00197         int neighbProcNo() const
00198         {
00199             return procPatch().neighbProcNo();
00200         }
00201 
00202         //- Is this a master patch
00203         bool isMaster() const
00204         {
00205             return myProcNo() < neighbProcNo();
00206         }
00207 
00208         //- Is this a slave patch
00209         bool isSlave() const
00210         {
00211             return !isMaster();
00212         }
00213 
00214         // Access functions for demand driven data
00215 
00216             //- Return mesh points
00217             virtual const labelList& meshPoints() const;
00218 
00219             //- Return pointField of points in patch.  Not impelemented.
00220             virtual const pointField& localPoints() const;
00221 
00222             //- Return point unit normals.  Not impelemented.
00223             virtual const vectorField& pointNormals() const;
00224 
00225             //- Return list of edge indices for edges local to the patch
00226             //  (i.e. connecting points within the patch)
00227             virtual const labelList& localEdgeIndices() const;
00228 
00229             //- Return list of edge indices for cut edges
00230             //  (i.e. connecting points within the patch ot points outside it)
00231             virtual const labelList& cutEdgeIndices() const;
00232 
00233 
00234             // Cut edge addressing
00235 
00236                //- Return cut edge owner edge indices
00237                const labelList& cutEdgeOwnerIndices() const;
00238 
00239                //- Return cut edge owner edge starts
00240                const labelList& cutEdgeOwnerStart() const;
00241 
00242                //- Return cut edge neighbour edge indices
00243                const labelList& cutEdgeNeighbourIndices() const;
00244 
00245                //- Return cut edge neighbour edge starts
00246                const labelList& cutEdgeNeighbourStart() const;
00247 
00248               // There exists a possibility of having an internal edge for a
00249               // point on the processor patch which is in fact connected to
00250               // another point of the same patch.  This particular nastiness
00251               // introduces a deformation in the solution because the edge is
00252               // either multiplied twice or not at all.  For this purpose, the
00253               // offending edges need to be separated out and multiplied
00254               // appropriately.  This will only happen for cell tetrahedral
00255               // decomposition and is generally nasty.  
00256 
00257                   //- Return doubly cut edge indices
00258                   const labelList& doubleCutEdgeIndices() const;
00259 
00260                   //- Return doubly cut edge owner addressing
00261                   //  into current patch
00262                   const labelList& doubleCutOwner() const;
00263 
00264                   //- Return doubly cut edge neighbour addressing
00265                   //  into current patch
00266                   const labelList& doubleCutNeighbour() const;
00267 
00268               //- Return cut edge multiplication mask
00269               const scalarField& ownNeiDoubleMask() const;
00270 };
00271 
00272 
00273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00274 
00275 } // End namespace Foam
00276 
00277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00278 
00279 #ifdef NoRepository
00280 #   include "processorTetPolyPatchCellDecomp.C"
00281 #endif
00282 
00283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00284 
00285 #endif
00286 
00287 // ************************************************************************* //
For further information go to www.openfoam.org