FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

processorPolyPatch.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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::processorPolyPatch
00026 
00027 Description
00028     Neighbour processor patch.
00029 
00030     Note: morph patch face ordering comes geometric or topological.
00031     Geometric: no cyclics allowed (assumes faces coincident)
00032     Topological: needs unmodified faces on both sides to correspond. Also
00033     needs at least one per connected patch area (so all patch faces can be
00034     visited from an unmodified face)
00035 
00036 SourceFiles
00037     processorPolyPatch.C
00038     processorPolyPatchMorph.C
00039 
00040 \*---------------------------------------------------------------------------*/
00041 
00042 #ifndef processorPolyPatch_H
00043 #define processorPolyPatch_H
00044 
00045 #include <OpenFOAM/coupledPolyPatch.H>
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 namespace Foam
00050 {
00051 
00052 /*---------------------------------------------------------------------------*\
00053                            Class processorPolyPatch Declaration
00054 \*---------------------------------------------------------------------------*/
00055 
00056 class processorPolyPatch
00057 :
00058     public coupledPolyPatch
00059 {
00060     // Private data
00061 
00062         int myProcNo_;
00063         int neighbProcNo_;
00064 
00065         //- Processor-neighbbour patch face centres
00066         vectorField neighbFaceCentres_;
00067 
00068         //- Processor-neighbbour patch face areas
00069         vectorField neighbFaceAreas_;
00070 
00071         //- Processor-neighbbour patch neighbour cell centres
00072         vectorField neighbFaceCellCentres_;
00073 
00074         //- Corresponding neighbouring local point label for every local point
00075         //  (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]])
00076         mutable labelList* neighbPointsPtr_;
00077 
00078         //- Corresponding neighbouring local edge label for every local edge
00079         //  (so edges()[i] == neighb.edges()[neighbEdges_[i]])
00080         mutable labelList* neighbEdgesPtr_;
00081 
00082 
00083 
00084     // Private static data
00085 
00086         //- Whether to use geometric or topological matching
00087         static bool geometricMatch_;
00088 
00089         //- Relative tolerance (for geometric matching only). Is factor of
00090         //  maximum edge length per face.
00091         static scalar matchTol_;
00092 
00093 
00094 protected:
00095 
00096     // Protected Member functions
00097 
00098         //- Initialise the calculation of the patch geometry
00099         void initGeometry();
00100 
00101         //- Calculate the patch geometry
00102         void calcGeometry();
00103 
00104         //- Initialise the patches for moving points
00105         void initMovePoints(const pointField&);
00106 
00107         //- Correct patches after moving points
00108         void movePoints(const pointField&);
00109 
00110         //- Initialise the update of the patch topology
00111         virtual void initUpdateMesh();
00112 
00113         //- Update of the patch topology
00114         virtual void updateMesh();
00115 
00116 
00117 public:
00118 
00119     //- Runtime type information
00120     TypeName("processor");
00121 
00122 
00123     // Constructors
00124 
00125         //- Construct from components
00126         processorPolyPatch
00127         (
00128             const word& name,
00129             const label size,
00130             const label start,
00131             const label index,
00132             const polyBoundaryMesh& bm,
00133             const int myProcNo,
00134             const int neighbProcNo
00135         );
00136 
00137         //- Construct from dictionary
00138         processorPolyPatch
00139         (
00140             const word& name,
00141             const dictionary& dict,
00142             const label index,
00143             const polyBoundaryMesh&
00144         );
00145 
00146         //- Construct as copy, resetting the boundary mesh
00147         processorPolyPatch(const processorPolyPatch&, const polyBoundaryMesh&);
00148 
00149         //- Construct as given the original patch and resetting the
00150         //  face list and boundary mesh information
00151         processorPolyPatch
00152         (
00153             const processorPolyPatch& pp,
00154             const polyBoundaryMesh& bm,
00155             const label index,
00156             const label newSize,
00157             const label newStart
00158         );
00159 
00160         //- Construct and return a clone, resetting the boundary mesh
00161         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
00162         {
00163             return autoPtr<polyPatch>(new processorPolyPatch(*this, bm));
00164         }
00165 
00166         //- Construct and return a clone, resetting the face list
00167         //  and boundary mesh
00168         virtual autoPtr<polyPatch> clone
00169         (
00170             const polyBoundaryMesh& bm,
00171             const label index,
00172             const label newSize,
00173             const label newStart
00174         ) const
00175         {
00176             return autoPtr<polyPatch>
00177             (
00178                 new processorPolyPatch
00179                 (
00180                     refCast<const processorPolyPatch>(*this),
00181                     bm,
00182                     index,
00183                     newSize,
00184                     newStart
00185                 )
00186             );
00187         }
00188 
00189 
00190     // Destructor
00191 
00192         virtual ~processorPolyPatch();
00193 
00194 
00195     // Member functions
00196 
00197         //- Return processor number
00198         int myProcNo() const
00199         {
00200             return myProcNo_;
00201         }
00202 
00203         //- Return neigbour processor number
00204         int neighbProcNo() const
00205         {
00206             return neighbProcNo_;
00207         }
00208 
00209         //- Does the processor own the patch ?
00210         bool owner() const
00211         {
00212             return (myProcNo_ < neighbProcNo_);
00213         }
00214 
00215         //- Is the processor the patch neighbour ?
00216         bool neighbour() const
00217         {
00218             return !owner();
00219         }
00220 
00221         //- Return processor-neighbbour patch face centres
00222         const vectorField& neighbFaceCentres() const
00223         {
00224             return neighbFaceCentres_;
00225         }
00226 
00227         //- Return processor-neighbbour patch face areas
00228         const vectorField& neighbFaceAreas() const
00229         {
00230             return neighbFaceAreas_;
00231         }
00232 
00233         //- Return processor-neighbbour patch neighbour cell centres
00234         const vectorField& neighbFaceCellCentres() const
00235         {
00236             return neighbFaceCellCentres_;
00237         }
00238 
00239         //- Return neighbour point labels. This is for my local point (-1 or)
00240         //  the corresponding local point on the other side. It is -1 if
00241         //  there are multiple corresponding points on this or the other side
00242         //  (can happen for cyclics being converted into proc patches)
00243         const labelList& neighbPoints() const;
00244 
00245         //- Return neighbour edge labels. This is for my local edge (-1 or) the
00246         //  corresponding local edge on the other side. See above for -1 cause.
00247         const labelList& neighbEdges() const;
00248 
00249 
00250         //- Initialize ordering for primitivePatch. Does not
00251         //  refer to *this (except for name() and type() etc.)
00252         virtual void initOrder(const primitivePatch&) const;
00253 
00254         //- Return new ordering for primitivePatch.
00255         //  Ordering is -faceMap: for every face
00256         //  index of the new face -rotation:for every new face the clockwise
00257         //  shift of the original face. Return false if nothing changes
00258         //  (faceMap is identity, rotation is 0), true otherwise.
00259         virtual bool order
00260         (
00261             const primitivePatch&,
00262             labelList& faceMap,
00263             labelList& rotation
00264         ) const;
00265 
00266 
00267         //- Write the polyPatch data as a dictionary
00268         virtual void write(Ostream&) const;
00269 };
00270 
00271 
00272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00273 
00274 } // End namespace Foam
00275 
00276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00277 
00278 #endif
00279 
00280 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines