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-------------------------------------------------------------------------------
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;
43
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 {
62 correct();
63 }
64}
65
66
67// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68
70{
71 return verbose_;
72}
73
74
75int 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
116 renumber();
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// ************************************************************************* //
Encapsulation of area meshes for writing in ensight format.
Definition: ensightFaMesh.H:63
void correct()
Update for new mesh.
Definition: ensightFaMesh.C:83
int verbose() const noexcept
Output verbosity level.
Definition: ensightFaMesh.C:69
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:75
void classify(const UList< face > &faces)
Classify the face types and set the element lists.
Definition: ensightFaces.C:219
void reduce()
Sum element counts across all processes.
Definition: ensightFaces.C:164
void clear()
Set addressable sizes to zero, free up addressing memory.
Definition: ensightFaces.C:147
InfoProxy< ensightFaces > info() const
Return info proxy.
Definition: ensightFaces.H:247
Specialized Ensight output with extra geometry file header.
void rename(const string &value)
Change the part name or description.
Definition: ensightPart.H:166
label identifier() const noexcept
OpenFOAM identifier (patch, zone, etc), -1 when not in use.
Definition: ensightPart.H:136
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:100
virtual bool write()
Write the output fields.
patchWriters clear()
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
messageStream Info
Information stream (stdout output on master, null elsewhere)
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
const direction noexcept
Definition: Scalar.H:223