All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cv2DControls.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) 2013-2019 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 
26 #include "cv2DControls.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 
32 (
33  const dictionary& controlDict,
34  const boundBox& bb
35 )
36 :
37  motionControl_(controlDict.subDict("motionControl")),
38  conformationControl_(controlDict.subDict("surfaceConformation")),
39 
40  minCellSize_(motionControl_.lookup<scalar>("minCellSize")),
41  minCellSize2_(Foam::sqr(minCellSize_)),
42 
43  maxQuadAngle_(conformationControl_.lookup<scalar>("maxQuadAngle")),
44 
45  nearWallAlignedDist_
46  (
47  motionControl_.lookup<scalar>("nearWallAlignedDist")*minCellSize_
48  ),
49  nearWallAlignedDist2_(Foam::sqr(nearWallAlignedDist_)),
50 
51  insertSurfaceNearestPointPairs_
52  (
53  conformationControl_.lookup("insertSurfaceNearestPointPairs")
54  ),
55  mirrorPoints_(conformationControl_.lookup("mirrorPoints")),
56  insertSurfaceNearPointPairs_
57  (
58  conformationControl_.lookup("insertSurfaceNearPointPairs")
59  ),
60 
61  objOutput_(motionControl_.lookupOrDefault<Switch>("objOutput", false)),
62 
63  meshedSurfaceOutput_
64  (
65  motionControl_.lookupOrDefault<Switch>("meshedSurfaceOutput", false)
66  ),
67 
68  randomiseInitialGrid_(conformationControl_.lookup("randomiseInitialGrid")),
69  randomPerturbation_
70  (
71  conformationControl_.lookup<scalar>("randomPerturbation")
72  ),
73 
74  maxBoundaryConformingIter_
75  (
76  conformationControl_.lookup<label>("maxBoundaryConformingIter")
77  ),
78 
79  span_
80  (
81  max(mag(bb.max().x()), mag(bb.min().x()))
82  + max(mag(bb.max().y()), mag(bb.min().y()))
83  ),
84  span2_(Foam::sqr(span_)),
85 
86  minEdgeLen_
87  (
88  conformationControl_.lookup<scalar>("minEdgeLenCoeff")
89  *minCellSize_
90  ),
91  minEdgeLen2_(Foam::sqr(minEdgeLen_)),
92 
93  maxNotchLen_
94  (
95  conformationControl_.lookup<scalar>("maxNotchLenCoeff")
96  *minCellSize_
97  ),
98  maxNotchLen2_(Foam::sqr(maxNotchLen_)),
99 
100  minNearPointDist_
101  (
102  conformationControl_.lookup<scalar>("minNearPointDistCoeff")
103  *minCellSize_
104  ),
105  minNearPointDist2_(Foam::sqr(minNearPointDist_)),
106 
107  ppDist_
108  (
109  conformationControl_.lookup<scalar>("pointPairDistanceCoeff")
110  *minCellSize_
111  )
112 {}
113 
114 
115 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
116 
118 {}
119 
120 
121 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
122 
123 void Foam::cv2DControls::write(Ostream& os) const
124 {
125  os.indentLevel() = 1;
126  os.precision(2);
127  os.flags(ios_base::scientific);
128 
129  os << nl << "Outputting CV2D Mesher controls:" << nl
130  << token::BEGIN_BLOCK << nl
131  << indent << "minCellSize2_ : " << minCellSize2_ << nl
132  << indent << "span_ / span2_ : " << span_ << " / " << span2_ << nl
133  << indent << "maxNotchLen2_ : " << maxNotchLen2_ << nl
134  << indent << "minNearPointDist2_ : " << minNearPointDist2_ << nl
135  << indent << "nearWallAlignedDist2_ : " << nearWallAlignedDist2_ << nl
136  << indent << "ppDist_ : " << ppDist_ << nl
137  << indent << "minEdgeLen2_ : " << minEdgeLen2_ << nl
138  << token::END_BLOCK << endl;
139 }
140 
141 
142 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
143 
144 Foam::Ostream& Foam::operator<<(Ostream& os, const cv2DControls& s)
145 {
146  s.write(os);
147  return os;
148 }
149 
150 
151 
152 // ************************************************************************* //
virtual Ostream & write(const char)=0
Write character.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221
runTime controlDict().lookup("adjustTimeStep") >> adjustTimeStep
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
~cv2DControls()
Destructor.
scalar y
stressControl lookup("compactNormalStress") >> compactNormalStress
void write(Ostream &os) const
Write controls to output stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static const char nl
Definition: Ostream.H:260
cv2DControls(const dictionary &controlDict, const boundBox &bb)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Ostream & operator<<(Ostream &, const ensightPart &)
dimensioned< scalar > mag(const dimensioned< Type > &)
IOstream & scientific(IOstream &io)
Definition: IOstream.H:582
Namespace for OpenFOAM.