meshSurfaceEdgeExtractor.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "demandDrivenData.H"
30 
31 // #define DEBUGSearch
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
40 // Construct from mesh, octree, regions for boundary vertices
42 (
44  const meshOctree& octree,
45  const labelList& pointRegion
46 )
47 :
48  mesh_(mesh),
49  nPoints_(mesh.points().size()),
50  boundaryCell_(mesh.cells().size(), false),
51  nFacesInCell_(mesh.cells().size(), direction(0)),
52  meshOctree_(octree),
53  pointRegions_(pointRegion.size())
54 {
55  forAll(pointRegion, pointI)
56  if( pointRegion[pointI] != -1 )
57  pointRegions_.append(pointI, pointRegion[pointI]);
58 
59  createEdgeVertices();
60 
61  removeOldBoundaryFaces();
62 
63  createBoundaryFaces();
64 }
65 
66 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
67 
69 {
70 }
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
75 {
76  const labelList neighbour_ = mesh_.neighbour();
77  polyMeshGenModifier meshModifier_(mesh_);
78  cellListPMG& cells_ = meshModifier_.cellsAccess();
79 
80  forAll(cells_, cellI)
81  {
82  const cell& c = cells_[cellI];
83 
84  cell newC(c);
85 
86  forAll(c, fI)
87  if( neighbour_[c[fI]] != -1 )
88  {
89  boundaryCell_[cellI] = true;
90  newC[nFacesInCell_[cellI]++] = c[fI];
91  }
92 
93  if( nFacesInCell_[cellI] < direction(c.size()) )
94  {
95  newC.setSize(nFacesInCell_[cellI]);
96 
97  cells_[cellI] = newC;
98  };
99  }
100 
101  PtrList<boundaryPatch>& boundaries = meshModifier_.boundariesAccess();
102  boundaries.setSize(1);
103  boundaries[0].patchSize() = 0;
104  meshModifier_.facesAccess().setSize(boundaries[0].patchStart());
105 }
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 } // End namespace Foam
110 
111 // ************************************************************************* //
Foam::polyMeshGenFaces::neighbour
const labelList & neighbour() const
Definition: polyMeshGenFacesI.H:86
Foam::meshSurfaceEdgeExtractor::meshSurfaceEdgeExtractor
meshSurfaceEdgeExtractor(const meshSurfaceEdgeExtractor &)
Disallow default bitwise copy construct.
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:979
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::primitiveMesh::cells
const cellList & cells() const
Definition: primitiveMeshCells.C:136
Foam::polyMeshGen
Definition: polyMeshGen.H:46
Foam::cellListPMG
Definition: cellListPMG.H:49
Foam::meshSurfaceEdgeExtractor::mesh_
polyMeshGen & mesh_
mesh
Definition: meshSurfaceEdgeExtractor.H:57
Foam::polyMeshGenModifier::boundariesAccess
PtrList< boundaryPatch > & boundariesAccess()
access to boundary data
Definition: polyMeshGenModifier.H:131
Foam::meshSurfaceEdgeExtractor::nFacesInCell_
List< direction > nFacesInCell_
Definition: meshSurfaceEdgeExtractor.H:63
Foam::polyMeshGenModifier::cellsAccess
cellListPMG & cellsAccess()
access to cells
Definition: polyMeshGenModifier.H:119
Foam::faceListPMG::setSize
void setSize(const label nElmts)
set the number of used elements
Definition: faceListPMGI.H:78
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::meshSurfaceEdgeExtractor::~meshSurfaceEdgeExtractor
~meshSurfaceEdgeExtractor()
Definition: meshSurfaceEdgeExtractor.C:68
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::polyMeshGenModifier
Definition: polyMeshGenModifier.H:52
Foam::List::setSize
void setSize(const label)
Reset size of List.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::meshOctree
Definition: meshOctree.H:55
Foam::meshSurfaceEdgeExtractor::boundaryCell_
boolList boundaryCell_
Definition: meshSurfaceEdgeExtractor.H:61
Foam::PtrList::setSize
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:142
Foam::direction
unsigned char direction
Definition: direction.H:43
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::polyMeshGenModifier::facesAccess
faceListPMG & facesAccess()
access to mesh faces
Definition: polyMeshGenModifier.H:113
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::meshSurfaceEdgeExtractor::removeOldBoundaryFaces
void removeOldBoundaryFaces()
remove old boundary faces
Definition: meshSurfaceEdgeExtractor.C:74
Foam::cell
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56
meshSurfaceEdgeExtractor.H