OpenFOAM logo
Open Source CFD Toolkit

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