OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

enrichedPatch.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-2009 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     Foam::enrichedPatch
00027 
00028 Description
00029     The enriched patch contains a double set of faces from the two
00030     sides of the sliding interface before the cutting.
00031 
00032     The patch basically consists of two over-lapping sets of faces sitting
00033     on a common point support, where every edge may be shared by more than
00034     2 faces.  The patch points are collected in a map.  Additional
00035     information needed for cutting is the point insertion into every edge
00036     of master and slave.
00037 
00038     Note:
00039     If new points are created during master-slave edge cutting, they
00040     should be registred with the pointMap.
00041 
00042 
00043 SourceFiles
00044     enrichedPatch.C
00045     enrichedPatchCutFaces.C
00046     enrichedPatchFaces.C
00047     enrichedPatchPointMap.C
00048     enrichedPatchPointMergeMap.C
00049     enrichedPatchPointPoints.C
00050 
00051 \*---------------------------------------------------------------------------*/
00052 
00053 #ifndef enrichedPatch_H
00054 #define enrichedPatch_H
00055 
00056 #include "primitiveFacePatch.H"
00057 #include "Map.H"
00058 #include "point.H"
00059 
00060 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00061 
00062 namespace Foam
00063 {
00064 
00065 // Forward declaration of classes
00066 
00067 /*---------------------------------------------------------------------------*\
00068                           Class enrichedPatch Declaration
00069 \*---------------------------------------------------------------------------*/
00070 
00071 class enrichedPatch
00072 {
00073     // Private data
00074 
00075         //- Reference to master patch
00076         const primitiveFacePatch& masterPatch_;
00077 
00078         //- Reference to slave patch
00079         const primitiveFacePatch& slavePatch_;
00080 
00081         //- Map of points supporting patch faces
00082         mutable Map<point> pointMap_;
00083 
00084         //- Has the point map been completed?
00085         mutable bool pointMapComplete_;
00086 
00087         //- Map of point merges
00088         mutable Map<label> pointMergeMap_;
00089 
00090         //- Slave point point hits
00091         const labelList& slavePointPointHits_;
00092 
00093         //- Slave point edge hits
00094         const labelList& slavePointEdgeHits_;
00095 
00096         //- Slave point face hits
00097         const List<objectHit>& slavePointFaceHits_;
00098 
00099 
00100     // Demand-driven private data
00101 
00102         //- Enriched patch
00103         mutable faceList* enrichedFacesPtr_;
00104 
00105         //- Mesh points
00106         mutable labelList* meshPointsPtr_;
00107 
00108         //- Local faces
00109         mutable faceList* localFacesPtr_;
00110 
00111         //- Local points
00112         mutable pointField* localPointsPtr_;
00113 
00114         //- Point-point addressing
00115         mutable labelListList* pointPointsPtr_;
00116 
00117         // Master point addressing
00118         mutable Map<labelList>* masterPointFacesPtr_;
00119 
00120 
00121         // Cut faces and addressing
00122 
00123             //- Cut faces
00124             mutable faceList* cutFacesPtr_;
00125 
00126             //- Cut face master
00127             //  - the face on the master patch for internal faces
00128             //  - the creator face for boundary face
00129             mutable labelList* cutFaceMasterPtr_;
00130 
00131             //- Cut face slave
00132             //  - the face on the slave patch for internal faces
00133             //  - -1 for boundary face
00134             mutable labelList* cutFaceSlavePtr_;
00135 
00136 
00137     // Private Member Functions
00138 
00139         //- Disallow default bitwise copy construct
00140         enrichedPatch(const enrichedPatch&);
00141 
00142         //- Disallow default bitwise assignment
00143         void operator=(const enrichedPatch&);
00144 
00145         // Creation of demand-driven private data
00146 
00147             //- Calculate point merge map
00148             void calcPointMergeMap() const;
00149 
00150             //- Complete point map
00151             void completePointMap() const;
00152 
00153             //- Calculate mesh points
00154             void calcMeshPoints() const;
00155 
00156             //- Calculate local points
00157             void calcLocalPoints() const;
00158 
00159             //- Calculate local faces
00160             void calcLocalFaces() const;
00161 
00162             //- Calculate point-point addressing
00163             void calcPointPoints() const;
00164 
00165             //- Calculate master point addressing
00166             void calcMasterPointFaces() const;
00167 
00168             //- Calculate cut faces
00169             void calcCutFaces() const;
00170 
00171             //- Clear cut faces
00172             void clearCutFaces();
00173 
00174             //- Clear out demand-driven data
00175             void clearOut();
00176 
00177 
00178     // Static data members
00179 
00180         //- Estimated ratio of original-to-enriched face size
00181         static const label enrichedFaceRatio_;
00182 
00183         //- Estimated number of master face hits by slave points
00184         static const label nFaceHits_;
00185 
00186         //- Size of face on which the check is forced
00187         static const label maxFaceSizeDebug_;
00188 
00189 
00190 public:
00191 
00192     // Static data members
00193     ClassName("enrichedPatch");
00194 
00195     // Constructors
00196 
00197         //- Construct from components
00198         enrichedPatch
00199         (
00200             const primitiveFacePatch& masterPatch,
00201             const primitiveFacePatch& slavePatch,
00202             const labelList& slavePointPointHits,// -1 or common point snapped to
00203             const labelList& slavePointEdgeHits, // -1 or common edge snapped to
00204             const List<objectHit>& slavePointFaceHits // master face snapped to
00205         );
00206 
00207 
00208     // Destructor
00209 
00210         ~enrichedPatch();
00211 
00212 
00213     // Member Functions
00214 
00215         // Access
00216 
00217             //- Return non-const access to point map to add points
00218             Map<point>& pointMap();
00219 
00220             //- Return map of points
00221             const Map<point>& pointMap() const;
00222 
00223             //- Return map of point merges
00224             Map<label>& pointMergeMap()
00225             {
00226                 return pointMergeMap_;
00227             }
00228 
00229             //- Return map of point merges
00230             const Map<label>& pointMergeMap() const
00231             {
00232                 return pointMergeMap_;
00233             }
00234 
00235 
00236         // Topological data
00237 
00238             //- Calculate enriched faces
00239             void calcEnrichedFaces
00240             (
00241                 const labelListList& pointsIntoMasterEdges,
00242                 const labelListList& pointsIntoSlaveEdges,
00243                 const pointField& projectedSlavePoints
00244             );
00245 
00246             //- Return enriched faces
00247             const faceList& enrichedFaces() const;
00248 
00249             //- Return mesh points
00250             const labelList& meshPoints() const;
00251 
00252             //- Return local faces
00253             const faceList& localFaces() const;
00254 
00255             //- Return local points
00256             const pointField& localPoints() const;
00257 
00258             //- Return point-point addressing
00259             const labelListList& pointPoints() const;
00260 
00261             //- Master point face addressing
00262             const Map<labelList>& masterPointFaces() const;
00263 
00264 
00265         // Cut faces
00266 
00267             //- Return list of cut faces
00268             const faceList& cutFaces() const;
00269 
00270             //- Return cut face master list
00271             const labelList& cutFaceMaster() const;
00272 
00273             //- Return cut face slave list
00274             const labelList& cutFaceSlave() const;
00275 
00276 
00277         //- Check if the patch is fully supported
00278         bool checkSupport() const;
00279 
00280 
00281         //- Debugging: dump graphical representation to obj format file
00282         void writeOBJ(const fileName&) const;
00283 };
00284 
00285 
00286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00287 
00288 } // End namespace Foam
00289 
00290 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00291 
00292 #endif
00293 
00294 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd