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