parFvFieldReconstructor.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 
32 {
33  const fvBoundaryMesh& fvb = procMesh_.boundary();
34 
35  patchFaceMaps_.setSize(fvb.size());
36  forAll(fvb, patchI)
37  {
38  if (!isA<processorFvPatch>(fvb[patchI]))
39  {
40  // Create map for patch faces only
41 
42  // Mark all used elements (i.e. destination patch faces)
43  boolList faceIsUsed(distMap_.faceMap().constructSize(), false);
44  const polyPatch& basePatch = baseMesh_.boundaryMesh()[patchI];
45  forAll(basePatch, i)
46  {
47  faceIsUsed[basePatch.start()+i] = true;
48  }
49 
50  // Copy face map
51  patchFaceMaps_.set
52  (
53  patchI,
55  );
56 
57  // Compact out unused elements
58  labelList oldToNewSub;
59  labelList oldToNewConstruct;
60  patchFaceMaps_[patchI].compact
61  (
62  faceIsUsed,
63  procMesh_.nFaces(), // maximum index of subMap
64  oldToNewSub,
65  oldToNewConstruct,
67  );
68  //Pout<< "patchMap:" << patchFaceMaps_[patchI] << endl;
69  }
70  }
71 }
72 
73 
74 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75 
77 (
78  fvMesh& baseMesh,
79  const fvMesh& procMesh,
80  const mapDistributePolyMesh& distMap,
81  const bool isWriteProc
82 )
83 :
84  baseMesh_(baseMesh),
85  procMesh_(procMesh),
86  distMap_(distMap),
87  isWriteProc_(isWriteProc)
88 {
89  createPatchFaceMaps();
90 }
91 
92 
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 
96 {
97  // Reconstruct the points for moving mesh cases and write
98  // them out
100  (
102  distMap_.pointMap()
103  );
104  pointField basePoints(procMesh_.points(), mapper);
105  baseMesh_.movePoints(basePoints);
106  if (Pstream::master())
107  {
108  baseMesh_.write();
109  }
110 }
111 
112 
113 // ************************************************************************* //
Foam::distributedUnallocatedDirectFieldMapper
FieldMapper with direct mapping from remote quantities.
Definition: distributedUnallocatedDirectFieldMapper.H:43
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::parFvFieldReconstructor::reconstructPoints
void reconstructPoints()
Helper: reconstruct and write mesh points.
Definition: parFvFieldReconstructor.C:95
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:421
Foam::parFvFieldReconstructor::baseMesh_
fvMesh & baseMesh_
Reconstructed mesh reference.
Definition: parFvFieldReconstructor.H:62
parFvFieldReconstructor.H
Foam::parFvFieldReconstructor::patchFaceMaps_
PtrList< mapDistributeBase > patchFaceMaps_
Patch mappers.
Definition: parFvFieldReconstructor.H:74
Foam::fvBoundaryMesh
Foam::fvBoundaryMesh.
Definition: fvBoundaryMesh.H:52
Foam::parFvFieldReconstructor::procMesh_
const fvMesh & procMesh_
Processor mesh reference.
Definition: parFvFieldReconstructor.H:65
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::mapDistributePolyMesh::faceMap
const mapDistribute & faceMap() const
Face distribute map.
Definition: mapDistributePolyMesh.H:208
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::parFvFieldReconstructor::distMap_
const mapDistributePolyMesh & distMap_
Distribution map reference.
Definition: parFvFieldReconstructor.H:68
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:312
Foam::UPstream::master
static bool master(const label communicator=0)
Am I the master process.
Definition: UPstream.H:399
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:550
Foam::mapDistributeBase::constructSize
label constructSize() const
Constructed data size.
Definition: mapDistributeBase.H:244
Foam::UPstream::msgType
static int & msgType()
Message tag of standard messages.
Definition: UPstream.H:452
Foam::primitiveMesh::nFaces
label nFaces() const
Definition: primitiveMeshI.H:58
Foam::parFvFieldReconstructor::parFvFieldReconstructor
parFvFieldReconstructor(const parFvFieldReconstructor &)
Disallow default bitwise copy construct.
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::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::mapDistributeBase
Class containing processor-to-processor mapping information.
Definition: mapDistributeBase.H:91
Foam::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition: mapDistributePolyMesh.H:57
Foam::UList::null
static const UList< T > & null()
Return a null UList.
Definition: UListI.H:51
Foam::parFvFieldReconstructor::createPatchFaceMaps
void createPatchFaceMaps()
Construct per-patch addressing.
Definition: parFvFieldReconstructor.C:31