Loading...
Searching...
No Matches
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-2024 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
34void Foam::ensightFaMesh::clear()
35{
36 areaPart_.clear();
37}
38
39
40void Foam::ensightFaMesh::renumber()
41{
42 label partNo = 0;
44 areaPart_.index() = partNo++;
45}
46
47
48// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49
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 * * * * * * * * * * * * * //
70{
71 return verbose_;
72}
73
74
75int Foam::ensightFaMesh::verbose(const int level) noexcept
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 }
116 renumber();
117
118 needsUpdate_ = false;
119}
120
121
123(
125 bool parallel
126) const
127{
128 if (UPstream::master())
129 {
130 os.beginGeometry();
131 }
132
133 // Area meshes (currently only one)
134 // const label areaId = 0;
135 areaPart_.write(os, mesh_.mesh(), parallel);
136}
137
138
139// ************************************************************************* //
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Definition UPstream.H:1714
void write(ensightGeoFile &os, bool parallel=UPstream::parRun()) const
Write geometry to file (normally in parallel). Adds beginGeometry() marker.
const faMesh & mesh() const noexcept
Reference to the underlying faMesh.
void correct()
Update for new mesh.
int verbose() const noexcept
Output verbosity level.
ensightFaMesh(const ensightFaMesh &)=delete
No copy construct.
Sorting/classification of faces (2D) into corresponding ensight types.
void classify(const UList< face > &faces)
Classify the face types and set the element lists.
void reduce()
Sum element counts across all processes.
InfoProxy< ensightFaces > info() const noexcept
Return info proxy, used to print information to a stream.
void clear()
Set addressable sizes to zero, free up addressing memory.
A variant of ensightFile (Ensight writing) that includes the extra geometry file header information.
void rename(const string &value)
Change the part name or description.
label identifier() const noexcept
OpenFOAM identifier (patch, zone, etc), -1 when not in use.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition faMesh.H:140
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
surface1 clear()
messageStream Info
Information stream (stdout output on master, null elsewhere).
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
const direction noexcept
Definition scalarImpl.H:265