ensightFaMesh.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) 2021-2022 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 "ensightFaMesh.H"
29 #include "ensightGeoFile.H"
30 #include "faMesh.H"
31 
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 
34 void Foam::ensightFaMesh::clear()
35 {
36  areaPart_.clear();
37 }
38 
39 
40 void Foam::ensightFaMesh::renumber()
41 {
42  label partNo = 0;
43 
44  areaPart_.index() = partNo++;
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
50 Foam::ensightFaMesh::ensightFaMesh
51 (
52  const faMesh& mesh
53 )
54 :
55  mesh_(mesh),
56  needsUpdate_(true),
57  verbose_(0)
58 {
59  // Lazy?
60  if (true)
61  {
63  }
64 }
65 
66 
67 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68 
70 {
71  return verbose_;
72 }
73 
74 
75 int Foam::ensightFaMesh::verbose(const int level) noexcept
76 {
77  int old(verbose_);
78  verbose_ = level;
79  return old;
80 }
81 
82 
84 {
85  clear();
86 
87  // Area meshes (currently only one)
88  const label areaId = 0;
89  {
90  ensightFaces& part = areaPart_;
91 
92  part.clear();
93  part.identifier() = areaId;
94  part.rename("finite-area");
95 
96  part.classify
97  (
98  mesh_.mesh().faces(),
99  mesh_.faceLabels()
100  );
101 
102  // Finalize
103  part.reduce();
104 
105  if (verbose_)
106  {
107  Info<< part.info();
108  }
109 
110  // if (!part.total())
111  // {
112  // areaParts_.erase(areaId);
113  // }
114  }
115 
117 
118  needsUpdate_ = false;
119 }
120 
121 
123 (
125  bool parallel
126 ) const
127 {
128  // Area meshes (currently only one)
129  // const label areaId = 0;
130  areaPart_.write(os, mesh_.mesh(), parallel);
131 }
132 
133 
134 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:87
void clear()
Set addressable sizes to zero, free up addressing memory.
Definition: ensightFaces.C:140
int verbose() const noexcept
Output verbosity level.
Definition: ensightFaMesh.C:62
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
Specialized Ensight output with extra geometry file header.
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:66
void reduce()
Sum element counts across all processes.
Definition: ensightFaces.C:157
void write(ensightGeoFile &os, bool parallel=Pstream::parRun()) const
Write geometry to file. Normally in parallel.
void classify(const UList< face > &faces)
Classify the face types and set the element lists.
Definition: ensightFaces.C:211
dynamicFvMesh & mesh
label identifier() const noexcept
OpenFOAM identifier (patch, zone, etc), -1 when not in use.
Definition: ensightPart.H:169
patchWriters clear()
const direction noexcept
Definition: Scalar.H:258
OBJstream os(runTime.globalPath()/outputName)
InfoProxy< ensightFaces > info() const noexcept
Return info proxy, used to print information to a stream.
Definition: ensightFaces.H:330
void correct()
Update for new mesh.
Definition: ensightFaMesh.C:76
messageStream Info
Information stream (stdout output on master, null elsewhere)
void rename(const string &value)
Change the part name or description.
Definition: ensightPart.H:209