/usr/include/freefoam/dynamicMesh/undoableMeshCutter.H is in libfreefoam-dev 0.1.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::undoableMeshCutter
Description
The main refinement handler. Gets cellCuts which is structure that
describes which cells are to be cut and in what way. Maintains an undo
list (if told so during construction). Apart from undo list is just
wrapper around meshCutter.
Undo list: contains a refinement tree (of type splitCell; cell labels are
of no consequence) and a list of visible splitCells, i.e. the top of the
tree (where the cell labels are valid). Now every cell added gets put on
the tree and every updateMesh action updates the labels of visible
splitcells.
We can now ask this structure for a list of visible split cells or the list
of faces between these. These can be passed to removeFaces for actual
deletion and we delete the top splitCell and update the now newly visible
underlying cells for the new cell number (passed back from removeFaces).
NOTE: Undoing note properly tested. Expect it to fail if the faces to
be removed cause other faces to be additionally removed (i.e. removeFaces
adds additional faces to remove).
splitCell:
- original cell number.
- pointer to parent (null for first level splitCell)
- two pointers to splitCell children. Both null (unrefined=visible cell) or
both non-null.
- live are:
(-all unrefined cells (original cell without any splitCells))
-all splitCells with null children
- liveSplitCells contains pointers to splitCells with null children.
SourceFiles
undoableMeshCutter.C
\*---------------------------------------------------------------------------*/
#ifndef undoableMeshCutter_H
#define undoableMeshCutter_H
#include <dynamicMesh/edgeVertex.H>
#include <dynamicMesh/refineCell.H>
#include <OpenFOAM/boolList.H>
#include <dynamicMesh/cellLooper.H>
#include <dynamicMesh/meshCutter.H>
#include <OpenFOAM/Map.H>
#include <OpenFOAM/typeInfo.H>
#include <dynamicMesh/removeFaces.H>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class polyMesh;
class polyTopoChange;
class refineCell;
class splitCell;
/*---------------------------------------------------------------------------*\
Class undoableMeshCutter Declaration
\*---------------------------------------------------------------------------*/
class undoableMeshCutter
:
public meshCutter
{
// Private data
//- Whether or not to store actions for unplaying.
const bool undoable_;
//- Current split cells which are 'visible'. Only set if undoable.
Map<splitCell*> liveSplitCells_;
//- Face remover engine
removeFaces faceRemover_;
// Private Member Functions
//- Debug print
void printCellRefTree(Ostream& os, const word&, const splitCell*)
const;
//- Debug print
void printRefTree(Ostream& os) const;
//- Find shared face between two cells
label sharedFace
(
const label cell0I,
const label cell1I
) const;
//- Update labels on splitCell structure after morphing.
static void updateLabels(const labelList& map, Map<splitCell*>&);
//- Disallow default bitwise copy construct
undoableMeshCutter(const undoableMeshCutter&);
//- Disallow default bitwise assignment
void operator=(const undoableMeshCutter&);
public:
//- Runtime type information
ClassName("undoableMeshCutter");
// Constructors
//- Construct from mesh and flag whether refinement pattern needs
// to be stored.
undoableMeshCutter(const polyMesh& mesh, const bool undoable = true);
// Destructor
~undoableMeshCutter();
// Member Functions
// Access
//- All current live split cells. Warning: cell labels will change
// during morphing. Only this map is guaranteed to hold uptodate
// info.
const Map<splitCell*>& liveSplitCells() const
{
return liveSplitCells_;
}
const removeFaces& faceRemover() const
{
return faceRemover_;
}
// Edit
//- Refine cells acc. to cellCuts. Plays topology changes
// into polyTopoChange.
void setRefinement(const cellCuts& cuts, polyTopoChange&);
//- Update stored refinement pattern for changes to mesh. Only
// call if undoable set.
void updateMesh(const mapPolyMesh& morphMap);
//- Calculate split faces from current liveCells. Only
// call if undoable set.
labelList getSplitFaces() const;
//- Like getSplitFaces but returns map from original to added cell.
// Only call if undoable set.
Map<label> getAddedCells() const;
//- Remove some refinement. Needs to be supplied subset of
// getSplitFaces() output. Returns list of faces removed
// (can be more or equal but never less than splitFaces - since
// removeFaces might decide to take down unnessecary faces)
// Only call if undoable set.
labelList removeSplitFaces
(
const labelList& splitFaces,
polyTopoChange&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************ vim: set sw=4 sts=4 et: ************************ //
|