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

polyMeshModifier.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::polyMeshModifier
00026 
00027 Description
00028     Virtual base class for mesh modifiers.
00029 
00030 SourceFiles
00031     polyMeshModifier.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef polyMeshModifier_H
00036 #define polyMeshModifier_H
00037 
00038 #include <OpenFOAM/label.H>
00039 #include <OpenFOAM/word.H>
00040 #include <OpenFOAM/Switch.H>
00041 #include <OpenFOAM/typeInfo.H>
00042 #include <OpenFOAM/runTimeSelectionTables.H>
00043 #include <OpenFOAM/autoPtr.H>
00044 #include <OpenFOAM/pointField.H>
00045 #include <OpenFOAM/faceList.H>
00046 #include <OpenFOAM/cellList.H>
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 namespace Foam
00051 {
00052 
00053 // Forward declaration of classes
00054 class polyTopoChanger;
00055 class polyTopoChange;
00056 class mapPolyMesh;
00057 
00058 /*---------------------------------------------------------------------------*\
00059                        Class polyMeshModifier Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class polyMeshModifier
00063 {
00064     // Private data
00065 
00066         //- Name of zone
00067         word name_;
00068 
00069         //- Index of zone
00070         label index_;
00071 
00072         //- Reference to morph engine
00073         const polyTopoChanger& topoChanger_;
00074 
00075         //- Activation switch
00076         mutable Switch active_;
00077 
00078 
00079     // Private Member Functions
00080 
00081         //- Disallow default bitwise copy construct
00082         polyMeshModifier(const polyMeshModifier&);
00083 
00084         //- Disallow default bitwise assignment
00085         void operator=(const polyMeshModifier&);
00086 
00087 
00088 public:
00089 
00090     // Static data members
00091 
00092         //- Runtime type information
00093         TypeName("meshModifier");
00094 
00095 
00096     // Declare run-time constructor selection tables
00097 
00098         declareRunTimeSelectionTable
00099         (
00100             autoPtr,
00101             polyMeshModifier,
00102             dictionary,
00103             (
00104                 const word& name,
00105                 const dictionary& dict,
00106                 const label index,
00107                 const polyTopoChanger& mme
00108             ),
00109             (name, dict, index, mme)
00110         );
00111 
00112 
00113     // Constructors
00114 
00115         //- Construct from components
00116         polyMeshModifier
00117         (
00118             const word& name,
00119             const label index,
00120             const polyTopoChanger& mme,
00121             const bool act
00122         );
00123 
00124 
00125     // Selectors
00126 
00127         //- Select constructed from dictionary
00128         static autoPtr<polyMeshModifier> New
00129         (
00130             const word& name,
00131             const dictionary& dict,
00132             const label index,
00133             const polyTopoChanger& mme
00134         );
00135 
00136 
00137     // Destructor
00138 
00139         virtual ~polyMeshModifier();
00140 
00141 
00142     // Member Functions
00143 
00144         //- Return name
00145         const word& name() const
00146         {
00147             return name_;
00148         }
00149 
00150         //- Return the index of this patch in the boundaryMesh
00151         label index() const
00152         {
00153             return index_;
00154         }
00155 
00156         //- Return reference to morph engine
00157         const polyTopoChanger& topoChanger() const;
00158 
00159         //- Check for topology change
00160         virtual bool changeTopology() const = 0;
00161 
00162         //- Insert the topological change instructions
00163         virtual void setRefinement(polyTopoChange&) const = 0;
00164 
00165         //- Modify motion points to comply with the topological change
00166         virtual void modifyMotionPoints(pointField& motionPoints) const = 0;
00167 
00168         //- Force recalculation of locally stored data on topological change
00169         virtual void updateMesh(const mapPolyMesh&) = 0;
00170 
00171 
00172         // Activation and deactivation
00173 
00174             const Switch& active() const
00175             {
00176                 return active_;
00177             }
00178 
00179             //- Activate mesh modifier
00180             void enable() const
00181             {
00182                 active_ = true;
00183             }
00184 
00185             //- Activate mesh modifier
00186             void disable() const
00187             {
00188                 active_ = false;
00189             }
00190 
00191 
00192         //- Write
00193         virtual void write(Ostream&) const = 0;
00194 
00195         //- Write dictionary
00196         virtual void writeDict(Ostream&) const = 0;
00197 
00198 
00199     // Ostream Operator
00200 
00201         friend Ostream& operator<<(Ostream&, const polyMeshModifier&);
00202 };
00203 
00204 
00205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00206 
00207 } // End namespace Foam
00208 
00209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00210 
00211 #endif
00212 
00213 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines