/usr/include/freefoam/dynamicMesh/addPatchCellLayer.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 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | /*---------------------------------------------------------------------------*\
========= |
\\ / 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::addPatchCellLayer
Description
Adds layers of cells to outside of polyPatch.
Call setRefinement with offset vector for every patch point and number
of layers per patch face and number of layers per patch point.
- offset vector should be zero for any non-manifold point and synchronised
on coupled points before calling this.
- offset vector of zero will not add any points.
- gets supplied the number of extruded layers both per face and per
point. Usually the point nlayers is the max of surrounding face nlayers.
point nlayers:
- 0 : no extrusion. Any surrounding face being extruded becomes 'prism'
- >0 : should be max of surrounding face nlayers.
- differing face nlayers: 'termination' : (e.g. from 2 to 4 layers) match
at original patch face side.
E.g. 2 boundary faces on patches a,b. 2 layers for a, 3 for b.
@verbatim
Was:
a b <- patch of boundary face
+------+------+
| | | <- original cells
+------+------+
Becomes:
a b <- patch of boundary face
+------+------+
+ +------+
+------+------+
+------+------+
| | | <- original cells
+------+------+
@endverbatim
- added faces get same patchID as face they are extruded from
- 'side' faces (i.e. on the edge of pp) get the patchID of the
other patch they are connected to.
E.g. 3 boundary faces on patches a,b. b gets extruded, a doesn't.
@verbatim
a b b <- patch of boundary face
+------+------+------+
| | | | <- cells
+------+------+------+
^ ^ <- wanted extrusion vector (none at far right)
a | b | b <- patch of boundary face
+------+------+------+
| | | | <- cells
+------+------+------+
b
+------+\ b 1. prism cell added onto second b face since
a a| | ----\ only one side gets extruded.
+------+------+------+ 2. side-face gets patch a, not b.
| | | |
+------+------+------+
@endverbatim
SourceFiles
addPatchCellLayer.C
\*---------------------------------------------------------------------------*/
#ifndef addPatchCellLayer_H
#define addPatchCellLayer_H
#include <OpenFOAM/labelList.H>
#include <OpenFOAM/typeInfo.H>
#include <OpenFOAM/labelPair.H>
#include <OpenFOAM/indirectPrimitivePatch.H>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class polyMesh;
class polyTopoChange;
class mapPolyMesh;
class primitiveMesh;
class globalIndex;
/*---------------------------------------------------------------------------*\
Class addPatchCellLayer Declaration
\*---------------------------------------------------------------------------*/
class addPatchCellLayer
{
// Private classes
// To combineReduce a labelList. Filters out duplicates.
class uniqueEqOp
{
public:
void operator()(labelList& x, const labelList& y) const
{
if (x.empty())
{
if (y.size())
{
x = y;
}
}
else
{
forAll(y, yi)
{
if (findIndex(x, y[yi]) == -1)
{
label sz = x.size();
x.setSize(sz+1);
x[sz] = y[yi];
}
}
}
}
};
// Private data
//- Reference to mesh
const polyMesh& mesh_;
//- For all patchpoints: list of added points (size 0 or nLayers)
// First point in list is one nearest to original point in patch,
// last one is the new point on the surface.
labelListList addedPoints_;
//- For all patchfaces: list of layer faces.
// - empty if no face extruded
// - first face is original boundary face
// - last one is new boundary face.
labelListList layerFaces_;
// Private Member Functions
//- Per patch edge the pp faces (in global indices) using it. Uses
// uniqueEqOp() to remove duplicates.
labelListList calcGlobalEdgeFaces
(
const polyMesh& mesh,
const globalIndex& globalFaces,
const indirectPrimitivePatch& pp,
const labelList& meshEdges
);
//- Get the face on the other side of the edge.
static label nbrFace
(
const labelListList& edgeFaces,
const label edgeI,
const label faceI
);
//- Add vertex to face if unique.
static void addVertex(const label, face&, label& fp);
bool sameEdgeNeighbour
(
const indirectPrimitivePatch& pp,
const labelListList& globalEdgeFaces,
const boolList& doneEdge,
const label thisGlobalFaceI,
const label nbrGlobalFaceI,
const label edgeI
) const;
labelPair getEdgeString
(
const indirectPrimitivePatch& pp,
const labelListList& globalEdgeFaces,
const boolList& doneEdge,
const label patchFaceI,
const label globalFaceI
) const;
//- Add face between layer-1 and layer.
label addSideFace
(
const indirectPrimitivePatch&,
const labelList& patchID,
const labelListList& addedCells,
const face& newFace,
const label ownFaceI,
const label nbrFaceI,
const label patchEdgeI,
const label meshEdgeI,
const label layerI,
const label numEdgeFaces,
const labelList& meshFaces,
polyTopoChange&
) const;
//- Disallow default bitwise copy construct
addPatchCellLayer(const addPatchCellLayer&);
//- Disallow default bitwise assignment
void operator=(const addPatchCellLayer&);
public:
//- Runtime type information
ClassName("addPatchCellLayer");
// Constructors
//- Construct from mesh.
addPatchCellLayer(const polyMesh& mesh);
// Member Functions
// Access
//- Added points per patch point.
const labelListList& addedPoints() const
{
return addedPoints_;
}
//- Layer faces per patch face. See above.
const labelListList& layerFaces() const
{
return layerFaces_;
}
//- Helper: get added cells per patch face.
// addedCells[patchFace] is list of cells added. Last element is
// the top cells (i.e. the boundary cell)
static labelListList addedCells
(
const polyMesh&,
const labelListList& layerFaces
);
//- added cells given current mesh & layerfaces.
labelListList addedCells() const;
// Edit
//- Play commands into polyTopoChange to create layers on top
// of indirectPrimitivePatch (have to be outside faces).
// Gets displacement per patch point.
// - nPointLayers : number of layers per (patch)point
// - nFaceLayers : number of layers per (patch) face
// - firstDisplacement : displacement per point for first
// layer of points (i.e. nearest to original mesh). If zero
// do not add point.
// Layer thicknesses are calculated to constant geometric
// expansion. Use expansionRatio 1 for constant size.
// Sets addedPoints_ which is per pp point a list of points
// added.
// Note: firstDisplacement has to be parallel synchronised before
// calling this routine. Only if all procs sharing a point
// get a cell should firstDisplacement be <> 0
// Note: cells get added from owner cells of patch faces
// (instead of e.g. from patch faces)
void setRefinement
(
const scalarField& expansionRatio,
const indirectPrimitivePatch& pp,
const labelList& nFaceLayers,
const labelList& nPointLayers,
const vectorField& firstLayerDisp,
polyTopoChange& meshMod
);
//- Add with constant expansion ratio and same nLayers everywhere
void setRefinement
(
const label nLayers,
const indirectPrimitivePatch& pp,
const vectorField& overallDisplacement,
polyTopoChange& meshMod
)
{
setRefinement
(
scalarField(pp.nPoints(), 1.0), // expansion ration
pp,
labelList(pp.size(), nLayers),
labelList(pp.nPoints(), nLayers),
overallDisplacement / nLayers,
meshMod
);
}
//- Update any locally stored mesh information. Gets additional
// map from new to old patch (since patch needs to be
// recreated since has to be on outside).
void updateMesh
(
const mapPolyMesh&,
const labelList& faceMap, // new to old patch faces
const labelList& pointMap // new to old patch points
);
// Helper
//- Per patch edge the corresponding mesh edge
static labelList calcMeshEdges
(
const primitiveMesh& mesh,
const indirectPrimitivePatch&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************ vim: set sw=4 sts=4 et: ************************ //
|