OpenFOAM logo
Open Source CFD Toolkit

polyTopoChange.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     polyTopoChange
00027 
00028 Description
00029     Class accumulates information on how to perform mesh refinement.
00030     Once the refinement request is completed, polyMesh modifies the mesh
00031     topology.
00032 
00033 SourceFiles
00034     polyTopoChange.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef polyTopoChange_H
00039 #define polyTopoChange_H
00040 
00041 #include "DynamicList.H"
00042 #include "labelHashSet.H"
00043 #include "polyAddPoint.H"
00044 #include "polyModifyPoint.H"
00045 #include "polyRemovePoint.H"
00046 #include "polyAddFace.H"
00047 #include "polyModifyFace.H"
00048 #include "polyRemoveFace.H"
00049 #include "polyAddCell.H"
00050 #include "polyModifyCell.H"
00051 #include "polyRemoveCell.H"
00052 
00053 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00054 
00055 namespace Foam
00056 {
00057 
00058 class polyMesh;
00059 
00060 /*---------------------------------------------------------------------------*\
00061                        Class polyTopoChange Declaration
00062 \*---------------------------------------------------------------------------*/
00063 
00064 class polyTopoChange
00065 {
00066     // Private data
00067 
00068         //- Reference to mesh to be refined
00069         const polyMesh& mesh_;
00070 
00071         //- Points to add
00072         DynamicList<polyAddPoint> addedPoints_;
00073 
00074         //- Points to modify
00075         DynamicList<polyModifyPoint> modifiedPoints_;
00076 
00077         //- Points to remove
00078         labelHashSet removedPoints_;
00079 
00080         //- Faces to add
00081         DynamicList<polyAddFace> addedFaces_;
00082 
00083         //- Faces to modify
00084         DynamicList<polyModifyFace> modifiedFaces_;
00085 
00086         //- Faces to remove
00087         labelHashSet removedFaces_;
00088 
00089         //- Number of cells to add
00090         DynamicList<polyAddCell> addedCells_;
00091 
00092         //- Cells to modify
00093         DynamicList<polyModifyCell> modifiedCells_;
00094 
00095         //- Cells to remove
00096         labelHashSet removedCells_;
00097 
00098 
00099     // Private Member Functions
00100 
00101         //- Disallow default bitwise copy construct
00102         polyTopoChange(const polyTopoChange&);
00103 
00104         //- Disallow default bitwise assignment
00105         void operator=(const polyTopoChange&);
00106 
00107 
00108     // Private static data
00109 
00110         //- Minimum dynamic list size for object insertion
00111         static const label minListSize;
00112 
00113         //- Estimated fraction of removed points
00114         static const label pointFraction;
00115 
00116         //- Estimated fraction of removed faces
00117         static const label faceFraction;
00118 
00119         //- Estimated fraction of removed cells
00120         static const label cellFraction;
00121 
00122 
00123 public:
00124 
00125     static int debug;
00126 
00127 
00128     // Constructors
00129 
00130         //- Construct from mesh reference
00131         polyTopoChange(const polyMesh&);
00132 
00133 
00134     // Destructor
00135 
00136         ~polyTopoChange();
00137 
00138 
00139     // Member Functions
00140 
00141         // Definition of topological change
00142 
00143             //- Set topological action
00144             label setAction(const topoAction& action);
00145 
00146 
00147         // Topology morph data
00148 
00149             //- Point balance (added - removed)
00150             label pointBalance() const
00151             {
00152                 return
00153                     addedPoints_.size()
00154                   + modifiedPoints_.size()
00155                   - removedPoints_.size();
00156             }
00157 
00158             //- Face balance (added - removed)
00159             label faceBalance() const
00160             {
00161                 return
00162                     addedFaces_.size()
00163                   + modifiedFaces_.size()
00164                   - removedFaces_.size();
00165             }
00166 
00167             //- Cell balance (added - removed)
00168             label cellBalance() const
00169             {
00170                 return addedCells_.size() - removedCells_.size();
00171             }
00172 
00173             //- Added points
00174             const DynamicList<polyAddPoint>& addedPoints() const
00175             {
00176                 return addedPoints_;
00177             }
00178 
00179             //- Modified points
00180             const DynamicList<polyModifyPoint>& modifiedPoints() const
00181             {
00182                 return modifiedPoints_;
00183             }
00184 
00185             //- Map of removed points
00186             const labelHashSet& removedPoints() const
00187             {
00188                 return removedPoints_;
00189             }
00190 
00191             //- Added faces
00192             const DynamicList<polyAddFace>& addedFaces() const
00193             {
00194                 return addedFaces_;
00195             }
00196 
00197             //- Modified faces
00198             const DynamicList<polyModifyFace>& modifiedFaces() const
00199             {
00200                 return modifiedFaces_;
00201             }
00202 
00203             //- Map of removed faces
00204             const labelHashSet& removedFaces() const
00205             {
00206                 return removedFaces_;
00207             }
00208 
00209             //- Added cells
00210             const DynamicList<polyAddCell>& addedCells() const
00211             {
00212                 return addedCells_;
00213             }
00214 
00215             //- Modified cells
00216             const DynamicList<polyModifyCell>& modifiedCells() const
00217             {
00218                 return modifiedCells_;
00219             }
00220 
00221             //- Map of removed cells
00222             const labelHashSet& removedCells() const
00223             {
00224                 return removedCells_;
00225             }
00226 
00227             //- Check for consistency and report status
00228             //  Returns false for no error.
00229             bool check() const;
00230 
00231             //- Clear all contents
00232             void clear();
00233 };
00234 
00235 
00236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00237 
00238 } // End namespace Foam
00239 
00240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00241 
00242 #endif
00243 
00244 // ************************************************************************* //
For further information go to www.openfoam.org