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 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 {
58  // Lazy?
59  if (true)
60  {
61  correct();
62  }
63 }
64 
65 
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 
69 {
70  clear();
71 
72  // Area meshes (currently only one)
73  const label areaId = 0;
74  {
75  ensightFaces& part = areaPart_;
76 
77  part.clear();
78  part.identifier() = areaId;
79  part.rename("finite-area");
80 
81  part.classify
82  (
83  mesh_.mesh().faces(),
84  mesh_.faceLabels()
85  );
86 
87  // Finalize
88  part.reduce();
89 
90  // if (!part.total())
91  // {
92  // areaParts_.erase(areaId);
93  // }
94  }
95 
96  renumber();
97 
98  needsUpdate_ = false;
99 }
100 
101 
103 (
105  bool parallel
106 ) const
107 {
108  // Area meshes (currently only one)
109  // const label areaId = 0;
110  areaPart_.write(os, mesh_.mesh(), parallel);
111 }
112 
113 
114 // ************************************************************************* //
Foam::ensightPart::rename
void rename(const string &value)
Change the part name or description.
Definition: ensightPart.H:166
faMesh.H
Foam::ensightFaces
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:71
Foam::ensightGeoFile
Specialized Ensight output with extra geometry file header.
Definition: ensightGeoFile.H:48
Foam::ensightFaces::reduce
void reduce()
Sum element counts across all processes.
Definition: ensightFaces.C:164
correct
fvOptions correct(rho)
Foam::ensightFaMesh::correct
void correct()
Update for new mesh.
Definition: ensightFaMesh.C:68
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::renumber
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
Definition: ListOpsTemplates.C:37
ensightGeoFile.H
clear
patchWriters clear()
Foam::ensightFaces::clear
void clear()
Set addressable sizes to zero, free up addressing memory.
Definition: ensightFaces.C:147
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::ensightPart::identifier
label identifier() const noexcept
OpenFOAM identifier (patch, zone, etc), -1 when not in use.
Definition: ensightPart.H:136
Foam::ensightFaMesh::write
void write(ensightGeoFile &os, bool parallel=Pstream::parRun()) const
Write geometry to file. Normally in parallel.
Definition: ensightFaMesh.C:103
Foam::ensightFaces::classify
void classify(const UList< face > &faces)
Classify the face types and set the element lists.
Definition: ensightFaces.C:219
ensightFaMesh.H