parFvFieldDistributor.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2015 OpenFOAM Foundation
9 Copyright (C) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
30#include "bitSet.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
35
36
37// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
38
39void Foam::parFvFieldDistributor::createPatchFaceMaps()
40{
41 const fvBoundaryMesh& fvb = srcMesh_.boundary();
42
43 patchFaceMaps_.resize(fvb.size());
44
45 forAll(fvb, patchi)
46 {
47 if (!isA<processorFvPatch>(fvb[patchi]))
48 {
49 // Create compact map for patch faces only
50 // - compact for used faces only (destination patch faces)
51 labelList oldToNewSub;
52 labelList oldToNewConstruct;
53
54 // Copy face map
55 patchFaceMaps_.set
56 (
57 patchi,
58 new mapDistributeBase(distMap_.faceMap())
59 );
60
61 patchFaceMaps_[patchi].compactRemoteData
62 (
63 bitSet(tgtMesh_.boundaryMesh()[patchi].range()),
64 oldToNewSub,
65 oldToNewConstruct,
66 srcMesh_.nFaces(), // max index of subMap
68 );
69 //Pout<< "patchMap:" << patchFaceMaps_[patchi] << endl;
70 }
71 }
72}
73
74
75// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
76
78(
79 const fvMesh& srcMesh,
80 fvMesh& tgtMesh,
81 const mapDistributePolyMesh& distMap,
82 const bool isWriteProc
83)
84:
85 srcMesh_(srcMesh),
86 tgtMesh_(tgtMesh),
87 distMap_(distMap),
88 isWriteProc_(isWriteProc)
89{
90 createPatchFaceMaps();
91}
92
93
94// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95
97{
98 // Reconstruct the points for moving mesh cases and write them out
100 (
102 distMap_.pointMap()
103 );
104
105 pointField newPoints(srcMesh_.points(), mapper);
106 tgtMesh_.movePoints(newPoints);
107
108 if (Pstream::master())
109 {
110 tgtMesh_.write();
111 }
112}
113
114
115// ************************************************************************* //
static const UList< label > & null()
Return a UList reference to a nullObject.
Definition: UListI.H:53
static int & msgType() noexcept
Message tag of standard messages.
Definition: UPstream.H:556
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:712
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
Definition: fvMesh.C:1079
virtual void movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Definition: fvMesh.C:895
const mapDistribute & pointMap() const noexcept
Point distribute map.
const mapDistribute & faceMap() const noexcept
Face distribute map.
Finite volume reconstructor for volume and surface fields.
static int verbose_
Output verbosity when writing.
void reconstructPoints()
Helper: reconstruct and write mesh points.
labelRange range() const noexcept
The face range for all boundary faces.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:456
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1083
label nFaces() const noexcept
Number of mesh faces.
splitCell * master() const
Definition: splitCell.H:113
DistributedFieldMapper< directFieldMapper > distributedFieldMapper
A directFieldMapper with distributed (with local or remote) quantities.
List< label > labelList
A List of labels.
Definition: List.H:66
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333