meshSurfaceMapper2D.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 
28 #include "meshSurfaceMapper2D.H"
29 #include "meshSurfaceEngine.H"
30 #include "meshSurfacePartitioner.H"
31 #include "polyMeshGen2DEngine.H"
32 #include "triSurf.H"
33 #include "triSurfacePartitioner.H"
34 #include "demandDrivenData.H"
35 #include "meshOctree.H"
36 #include "helperFunctions.H"
37 
38 // #define DEBUGSearch
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
48 {
49  const VRWGraph& edgeFaces = surfaceEngine_.edgeFaces();
50 
52  const boolList& activeFace = mesh2DEngine.activeFace();
53 
54  const label startFace = surfaceEngine_.mesh().boundaries()[0].patchStart();
55 
57 
58  //- check which edges are at the boundary
59  forAll(edgeFaces, edgeI)
60  {
61  if( edgeFaces.sizeOfRow(edgeI) == 2 )
62  {
63  const bool active0 = activeFace[startFace + edgeFaces(edgeI, 0)];
64  const bool active1 = activeFace[startFace + edgeFaces(edgeI, 1)];
65 
66  if( active0 && active1 )
68  }
69  }
70 
71  if( Pstream::parRun() )
72  {
73  const Map<label>& globalToLocal =
75  const Map<label>& otherProc = surfaceEngine_.otherEdgeFaceAtProc();
76 
77  const DynList<label>& neiProcs = surfaceEngine_.beNeiProcs();
78 
79  std::map<label, labelLongList> exchangeData;
80  forAll(neiProcs, i)
81  exchangeData[neiProcs[i]].clear();
82 
83  forAllConstIter(Map<label>, globalToLocal, it)
84  {
85  const label beI = it();
86 
87  if( activeFace[startFace + edgeFaces(beI, 0)] )
88  {
89  exchangeData[otherProc[beI]].append(it.key());
90  }
91  }
92 
93  labelLongList receivedData;
94  help::exchangeMap(exchangeData, receivedData);
95 
96  forAll(receivedData, i)
97  {
98  const label beI = globalToLocal[receivedData[i]];
99 
100  if( activeFace[startFace + edgeFaces(beI, 0)] )
102  }
103  }
104 }
105 
107 {
108  polyMeshGen& mesh = const_cast<polyMeshGen&>(surfaceEngine_.mesh());
110 }
111 
113 {
115 }
116 
118 {
120 }
121 
123 {
127 }
128 
129 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
130 
132 (
133  const meshSurfaceEngine& mse,
134  const meshOctree& octree
135 )
136 :
137  surfaceEngine_(mse),
138  meshOctree_(octree),
139  mesh2DEnginePtr_(NULL),
140  surfPartitionerPtr_(NULL),
141  meshPartitionerPtr_(NULL)
142 {
143  if( Pstream::parRun() )
144  {
145  //- allocate bpAtProcs and other addressing
146  //- this is done here to prevent possible deadlocks
147  surfaceEngine_.bpAtProcs();
148  }
149 
150  findActiveBoundaryEdges();
151 
152  createMeshSurfacePartitioner();
153 }
154 
155 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
156 
158 {
159  clearOut();
160 }
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // ************************************************************************* //
Foam::triSurfacePartitioner
Definition: triSurfacePartitioner.H:53
Foam::LongList::append
void append(const T &e)
Append an element at the end of the list.
Definition: LongListI.H:265
triSurf.H
Foam::meshSurfaceMapper2D::create2DEngine
void create2DEngine() const
create a 2D engine
Definition: meshSurfaceMapper2D.C:106
Foam::meshSurfaceEngine::globalToLocalBndEdgeAddressing
const Map< label > & globalToLocalBndEdgeAddressing() const
global boundary edge label to local label. Only for processor edges
Definition: meshSurfaceEngineI.H:510
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
triSurfacePartitioner.H
Foam::polyMeshGen2DEngine::activeFace
const boolList & activeFace() const
const access to active faces
Definition: polyMeshGen2DEngineI.H:48
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::LongList::clear
void clear()
Clear the list, i.e. set next free to zero.
Definition: LongListI.H:230
Foam::meshSurfaceMapper2D::meshPartitionerPtr_
meshSurfacePartitioner * meshPartitionerPtr_
mesh surface partitioner
Definition: meshSurfaceMapper2D.H:78
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:377
Foam::Map< label >
Foam::polyMeshGen
Definition: polyMeshGen.H:46
Foam::meshSurfaceMapper2D::mesh2DEngine
const polyMeshGen2DEngine & mesh2DEngine() const
create and return mesh 2D engine
Definition: meshSurfaceMapper2D.H:92
Foam::meshSurfaceMapper2D::~meshSurfaceMapper2D
~meshSurfaceMapper2D()
Definition: meshSurfaceMapper2D.C:157
meshOctree.H
Foam::meshSurfaceMapper2D::surfPartitionerPtr_
triSurfacePartitioner * surfPartitionerPtr_
triSurface partitioner
Definition: meshSurfaceMapper2D.H:75
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
Foam::LongList< label >
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:40
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::meshSurfaceMapper2D::createMeshSurfacePartitioner
void createMeshSurfacePartitioner() const
create mesh surface partitioner
Definition: meshSurfaceMapper2D.C:117
Foam::meshSurfaceEngine::otherEdgeFaceAtProc
const Map< label > & otherEdgeFaceAtProc() const
Definition: meshSurfaceEngineI.H:568
Foam::meshSurfaceEngine::beNeiProcs
const DynList< label > & beNeiProcs() const
communication matrix for sending edge data
Definition: meshSurfaceEngineI.H:549
Foam::meshSurfaceMapper2D::activeBoundaryEdges_
labelLongList activeBoundaryEdges_
Definition: meshSurfaceMapper2D.H:82
Foam::meshSurfaceMapper2D::clearOut
void clearOut()
delete dynamically allocated data
Definition: meshSurfaceMapper2D.C:122
Foam::VRWGraph::sizeOfRow
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
Definition: VRWGraphI.H:127
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
polyMeshGen2DEngine.H
Foam::meshSurfaceEngine::edgeFaces
const VRWGraph & edgeFaces() const
Definition: meshSurfaceEngineI.H:334
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::meshSurfaceMapper2D::mesh2DEnginePtr_
polyMeshGen2DEngine * mesh2DEnginePtr_
mesh 2D engine
Definition: meshSurfaceMapper2D.H:72
meshSurfaceEngine.H
Foam::DynList< label >
Foam::meshSurfaceMapper2D::meshOctree_
const meshOctree & meshOctree_
reference to the octree
Definition: meshSurfaceMapper2D.H:69
Foam::meshSurfacePartitioner
Definition: meshSurfacePartitioner.H:52
Foam::meshSurfaceMapper2D::surfaceEngine_
const meshSurfaceEngine & surfaceEngine_
reference to mesh surface
Definition: meshSurfaceMapper2D.H:66
Foam::meshSurfaceMapper2D::meshSurfaceMapper2D
meshSurfaceMapper2D(const meshSurfaceMapper2D &)
Disallow default bitwise copy construct.
Foam::meshSurfaceMapper2D::createTriSurfacePartitioner
void createTriSurfacePartitioner() const
create surface partitioner
Definition: meshSurfaceMapper2D.C:112
Foam::polyMeshGen2DEngine
Definition: polyMeshGen2DEngine.H:51
helperFunctions.H
Foam::polyMeshGenFaces::boundaries
const PtrList< boundaryPatch > & boundaries() const
ordinary boundaries
Definition: polyMeshGenFacesI.H:111
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::help::exchangeMap
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
Definition: helperFunctionsPar.C:129
Foam::meshSurfaceMapper2D::findActiveBoundaryEdges
void findActiveBoundaryEdges()
find active boundary edges
Definition: meshSurfaceMapper2D.C:47
Foam::meshOctree::surface
const triSurf & surface() const
return a reference to the surface
Definition: meshOctreeI.H:130
Foam::VRWGraph
Definition: VRWGraph.H:101
Foam::meshSurfaceEngine::mesh
const polyMeshGen & mesh() const
Definition: meshSurfaceEngineI.H:44
Foam::meshSurfaceEngine
Definition: meshSurfaceEngine.H:54
meshSurfacePartitioner.H
meshSurfaceMapper2D.H