surfaceFeaturesConfiguration.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 void Foam::surfaceFeaturesConfiguration::writeSurfaces()
31 {
32  beginList(os_, "surfaces");
33 
34  forAll(surfaces_, i)
35  {
36  os_ << indent << surfaces_[i].file() << endl;
37  }
38 
39  endList(os_);
40 }
41 
42 
43 void Foam::surfaceFeaturesConfiguration::writeSubsetFeatures()
44 {
45  beginDict(os_, "subsetFeatures");
46  os_ << indent << "nonManifoldEdges yes;" << endl;
47  os_ << indent << "openEdges yes;" << endl;
48  endDict(os_);
49 }
50 
51 
52 void Foam::surfaceFeaturesConfiguration::writeTrimFeatures()
53 {
54  beginDict(os_, "trimFeatures");
55  os_ << indent << "minElem 0;" << endl;
56  os_ << indent << "minLen 0;" << endl;
57  endDict(os_);
58 }
59 
60 
61 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
62 
64 (
65  const fileName& name,
66  const fileName& dir,
67  const Time& time,
68  const meshingSurfaceList& surfaces
69 )
70 :
71  caseFileConfiguration(name, dir, time),
72  surfaces_(surfaces)
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
77 
79 {}
80 
81 
82 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
83 
85 {
86  dict_.writeHeader(os_, word("dictionary"));
87 
88  writeSurfaces();
89 
90  os_ << "includedAngle 150;" << nl << endl;
91 
92  writeSubsetFeatures();
93  writeTrimFeatures();
94 
95  os_ << "writeObj yes;";
96 
97  dict_.writeEndDivider(os_);
98 }
99 
100 
101 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
void endList(OFstream &os, bool newline=true)
Output stream to end a list.
OFstream os_
Output file stream to write file content.
void beginList(OFstream &os)
Output stream to begin a new list without name.
surfaceFeaturesConfiguration(const fileName &name, const fileName &dir, const Time &time, const meshingSurfaceList &surfaces)
Construct from components.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221
static const char nl
Definition: Ostream.H:260