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

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