|
|
|
multiDirRefinement.HGo 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::multiDirRefinement 00027 00028 Description 00029 Does multiple pass refinement to refine cells in multiple directions. 00030 00031 Gets a list of cells to refine and vectorFields for the whole mesh. 00032 It then tries to refine in one direction after the other the wanted cells. 00033 After construction the mesh will have been refined in multiple directions. 00034 00035 Holds the list of cells to refine and the map from original to added for 00036 every refinement level. 00037 00038 Gets constructed from a dictionary or from components. 00039 Uses an undoableMeshCutter which does the actual cutting. Undo facility 00040 is switched of unless constructed from external one which allows this. 00041 00042 The cut cells get stored in addedCells which is for every vectorField 00043 to cut with the map from uncut to added cell (i.e. from master to slave). 00044 Note: map is only valid for a given direction. 00045 00046 Parallel: should be ok. Uses 'reduce' whenever it needs to make a 00047 local decision. 00048 00049 SourceFiles 00050 multiDirRefinement.C 00051 00052 \*---------------------------------------------------------------------------*/ 00053 00054 #ifndef multiDirRefinement_H 00055 #define multiDirRefinement_H 00056 00057 #include "refinementIterator.H" 00058 #include "vectorField.H" 00059 #include "Map.H" 00060 #include "className.H" 00061 00062 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00063 00064 namespace Foam 00065 { 00066 00067 // Forward declaration of classes 00068 class undoableMeshCutter; 00069 class cellLooper; 00070 class topoSet; 00071 00072 /*---------------------------------------------------------------------------*\ 00073 Class multiDirRefinement Declaration 00074 \*---------------------------------------------------------------------------*/ 00075 00076 class multiDirRefinement 00077 { 00078 // Private data 00079 00080 //- Current set of cells to refine. Extended with added cells. 00081 labelList cellLabels_; 00082 00083 //- from original to added cells. 00084 // Gives for every cell in the original mesh an empty list or the 00085 // list of cells this one has been split into (note: will include 00086 // itself so e.g. for hex will be 8 if 2x2x2 refinement) 00087 labelListList addedCells_; 00088 00089 00090 // Private Static Functions 00091 00092 //- Given map from original to added cell set the refineCell for 00093 // the added cells to be equal to the one on the original cells. 00094 static void addCells(const Map<label>&, List<refineCell>&); 00095 00096 //- Given map from original to added cell set the vectorField for 00097 // the added cells to be equal to the one on the original cells. 00098 static void update(const Map<label>&, vectorField&); 00099 00100 //- Given map from original to added cell add the added cell to the 00101 // list of labels 00102 static void addCells(const Map<label>&, labelList& labels); 00103 00104 00105 // Private Member Functions 00106 00107 //- Add new cells from map to overall list (addedCells_). 00108 void addCells(const primitiveMesh&, const Map<label>&); 00109 00110 //- Remove hexes from cellLabels_ and return these in a list. 00111 labelList splitOffHex(const primitiveMesh& mesh); 00112 00113 00114 //- Refine cells (hex only) in all 3 directions. 00115 void refineHex8 00116 ( 00117 polyMesh& mesh, 00118 const labelList& hexCells, 00119 const bool writeMesh 00120 ); 00121 00122 //- Refine cells in cellLabels_ in directions mentioned. 00123 void refineAllDirs 00124 ( 00125 polyMesh& mesh, 00126 List<vectorField>& cellDirections, 00127 const cellLooper& cellWalker, 00128 undoableMeshCutter& cutter, 00129 const bool writeMesh 00130 ); 00131 00132 //- Refine based on dictionary. Calls refineAllDirs. 00133 void refineFromDict 00134 ( 00135 polyMesh& mesh, 00136 List<vectorField>& cellDirections, 00137 const dictionary& dict, 00138 const bool writeMesh 00139 ); 00140 00141 00142 //- Disallow default bitwise copy construct 00143 multiDirRefinement(const multiDirRefinement&); 00144 00145 //- Disallow default bitwise assignment 00146 void operator=(const multiDirRefinement&); 00147 00148 00149 public: 00150 00151 //- Runtime type information 00152 ClassName("multiDirRefinement"); 00153 00154 00155 // Constructors 00156 00157 //- Construct from dictionary. After construction all refinement will 00158 // have been done (and runTime will have increased a few time steps if 00159 // writeMesh = true) 00160 multiDirRefinement 00161 ( 00162 polyMesh& mesh, 00163 const labelList& cellLabels, // cells to refine 00164 const dictionary& dict 00165 ); 00166 00167 //- Explicitly provided directions to split in. 00168 multiDirRefinement 00169 ( 00170 polyMesh& mesh, 00171 const labelList& cellLabels, // cells to refine 00172 const List<vectorField>&, // Explicitly provided directions 00173 const dictionary& dict 00174 ); 00175 00176 //- Construct from components. Only this one would allow undo actions. 00177 multiDirRefinement 00178 ( 00179 polyMesh& mesh, 00180 undoableMeshCutter& cutter, // actual mesh modifier 00181 const cellLooper& cellCutter, // how to cut a single cell with 00182 // a plane 00183 const labelList& cellLabels, // list of cells to refine 00184 const List<vectorField>& directions, 00185 const bool writeMesh = false // write intermediate meshes 00186 ); 00187 00188 00189 // Member Functions 00190 00191 //- Access to addedCells (on the original mesh; see above) 00192 const labelListList& addedCells() const 00193 { 00194 return addedCells_; 00195 } 00196 }; 00197 00198 00199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00200 00201 } // End namespace Foam 00202 00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00204 00205 #endif 00206 00207 // ************************************************************************* // |