ensightFacesAddr.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) 2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "ensightFaces.H"
29 #include "ensightOutput.H"
30 
31 #include "polyMesh.H"
32 #include "globalIndex.H"
33 #include "globalMeshData.H"
35 
36 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
37 
39 (
40  const polyMesh& mesh,
41  labelList& uniqueMeshPointLabels,
42  bool parallel
43 ) const
44 {
45  const ensightFaces& part = *this;
46 
47  parallel = parallel && Pstream::parRun();
48 
49  // Renumber the patch points/faces into unique points
50  label nPoints = 0; // Total number of points
51  labelList pointToGlobal; // local point to unique global index
52 
53  const pointField& points = mesh.points();
54  const faceList& faces = mesh.faces();
55 
56 
57  // Use the properly sorted faceIds (ensightFaces) and do NOT use
58  // the faceZone or anything else directly, otherwise the
59  // point-maps will not correspond.
60  // - perform face-flipping later
61 
63  (
64  UIndirectList<face>(faces, part.faceIds()),
65  points
66  );
67 
68  if (parallel)
69  {
70  autoPtr<globalIndex> globalPointsPtr =
71  mesh.globalData().mergePoints
72  (
73  pp.meshPoints(),
74  pp.meshPointMap(),
75  pointToGlobal,
76  uniqueMeshPointLabels
77  );
78 
79  nPoints = globalPointsPtr().size(); // nPoints (global)
80  }
81  else
82  {
83  // Non-parallel
84  // - all information already available from PrimitivePatch
85 
86  nPoints = pp.meshPoints().size();
87  uniqueMeshPointLabels = pp.meshPoints();
88 
89  // Not needed: pointToGlobal
90  }
91 
92  return nPoints;
93 }
94 
95 
96 // ************************************************************************* //
Foam::ensightFaces::faceIds
const labelList & faceIds() const noexcept
Processor-local face ids of all elements.
Definition: ensightFacesI.H:79
uindirectPrimitivePatch.H
ensightFaces.H
globalMeshData.H
globalIndex.H
polyMesh.H
Foam::ensightFaces
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:71
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
ensightOutput.H
Foam::Field< vector >
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::ensightFaces::uniqueMeshPoints
label uniqueMeshPoints(const polyMesh &mesh, labelList &uniqueMeshPointLabels, bool parallel) const
Definition: ensightFacesAddr.C:39
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::UIndirectList
A List with indirect addressing.
Definition: faMatrix.H:60
Foam::PrimitivePatch::meshPointMap
const Map< label > & meshPointMap() const
Mesh point map.
Definition: PrimitivePatch.C:343
Foam::PrimitivePatch::meshPoints
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Definition: PrimitivePatch.C:330
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79