OpenFOAM logo
Open Source CFD Toolkit

polyTopoChanger.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     polyTopoChanger
00027 
00028 Description
00029     List of mesh modifiers defining the mesh dynamics.
00030 
00031 SourceFiles
00032     polyTopoChanger.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef polyTopoChanger_H
00037 #define polyTopoChanger_H
00038 
00039 #include "regIOobject.H"
00040 #include "PtrList.H"
00041 #include "polyMeshModifier.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 class polyMesh;
00051 class mapPolyMesh;
00052 class polyBoundaryMesh;
00053 
00054 /*---------------------------------------------------------------------------*\
00055                       Class polyTopoChanger Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 class polyTopoChanger
00059 :
00060     public PtrList<polyMeshModifier>,
00061     public regIOobject
00062 {
00063     // Private Member Functions
00064 
00065         //- Disallow default bitwise copy construct
00066         polyTopoChanger(const polyTopoChanger&);
00067 
00068         //- Disallow default bitwise assignment
00069         void operator=(const polyTopoChanger&);
00070 
00071         void readModifiers();
00072 
00073 
00074 protected:
00075 
00076     // Protected data
00077 
00078         //- Reference to mesh
00079         polyMesh& mesh_;
00080 
00081 
00082     // Protected Member Functions
00083 
00084         // Topology changes
00085 
00086             //- Rotate a face nShift positions in anticlockwise direction
00087             static face rotateFace(const face& f, const label nShift);
00088 
00089             //- Determine ordering of faces in coupled patches.
00090             //  Calculate mapping to shuffle faces inside coupled patches and
00091             //  rotation to make 0th vertex in faces align.
00092             static bool reorderCoupledPatches
00093             (
00094                 const polyBoundaryMesh& boundary,
00095                 const labelList& patchStarts,
00096                 const labelList& patchSizes,
00097                 const faceList& faces,
00098                 const pointField& points,
00099 
00100                 labelList& faceMap,
00101                 labelList& rotation
00102             );
00103 
00104 
00105 public:
00106 
00107     //- Runtime type information
00108     TypeName("polyTopoChanger");
00109 
00110 
00111     // Constructors
00112 
00113         //- Read constructor given IOobject and a polyMesh
00114         polyTopoChanger(const IOobject&, polyMesh&);
00115 
00116         //- Read constructor for given polyMesh
00117         explicit polyTopoChanger(polyMesh&);
00118 
00119 
00120     // Destructor
00121 
00122         virtual ~polyTopoChanger()
00123         {}
00124 
00125 
00126     // Member functions
00127 
00128         //- Return the mesh reference
00129         const polyMesh& mesh() const
00130         {
00131             return mesh_;
00132         }
00133 
00134         //- Return a list of patch types
00135         wordList types() const;
00136 
00137         //- Return a list of patch names
00138         wordList names() const;
00139 
00140         //- Is topology change required
00141         bool changeTopology() const;
00142 
00143         //- Return topology change request
00144         autoPtr<polyTopoChange> topoChangeRequest() const;
00145 
00146         //- Modify point motion
00147         void modifyMotionPoints(pointField&) const;
00148 
00149         static autoPtr<mapPolyMesh> changeMesh
00150         (
00151             polyMesh&,
00152             const polyTopoChange&
00153         );
00154 
00155         autoPtr<mapPolyMesh> changeMesh();
00156 
00157         //- Force recalculation of locally stored data on topological change
00158         void update(const mapPolyMesh& m);
00159 
00160         //- Add given set of topology modifiers to the topoChanger
00161         void addTopologyModifiers(const List<polyMeshModifier*>& tm);
00162 
00163         //- Find modifier given a name
00164         label findModifierID(const word& modName) const;
00165 
00166 
00167         //- writeData member function required by regIOobject
00168         bool writeData(Ostream&) const;
00169 
00170 
00171     // Member Operators
00172 
00173         bool operator!=(const polyTopoChanger&) const;
00174         bool operator==(const polyTopoChanger&) const;
00175 
00176 
00177     // Ostream operator
00178 
00179         friend Ostream& operator<<(Ostream&, const polyTopoChanger&);
00180 };
00181 
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 } // End namespace Foam
00186 
00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00188 
00189 #endif
00190 
00191 // ************************************************************************* //
For further information go to www.openfoam.org