gradingDescriptor.H
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) 2015 OpenFOAM Foundation
9 Copyright (C) 2019-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::gradingDescriptor
29
30Description
31 Handles the specification for grading within a section of a block
32
33 The grading specification is handled is controlled by three parameters:
34
35 - blockFraction: the fraction of the block the section occupies
36
37 - nDivFraction: the fraction of the divisions of the block allocated to
38 the section
39
40 - expansionRatio:
41 the expansion ratio for the grading with the section of
42 block defined as the ratio of end-size / start-size for the section.
43 A negative value is trapped and treated as its inverse.
44
45SourceFiles
46 gradingDescriptor.C
47
48\*---------------------------------------------------------------------------*/
49
50#ifndef gradingDescriptor_H
51#define gradingDescriptor_H
52
53#include "scalar.H"
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace Foam
58{
59
60// Forward Declarations
61class Istream;
62class Ostream;
63class gradingDescriptor;
64class gradingDescriptors;
65
66Istream& operator>>(Istream&, gradingDescriptor&);
67Ostream& operator<<(Ostream&, const gradingDescriptor&);
68
69/*---------------------------------------------------------------------------*\
70 Class gradingDescriptor Declaration
71\*---------------------------------------------------------------------------*/
74{
75 // Private Data
76
77 scalar blockFraction_;
78 scalar nDivFraction_;
79 scalar expansionRatio_;
80
81
82public:
83
84 // Friendship with gradingDescriptors
85 friend class gradingDescriptors;
86
87
88 // Constructors
89
90 //- Default construct (1, 1, 1)
92
93 //- Construct from components
95 (
96 const scalar blockFraction,
97 const scalar nDivFraction,
98 const scalar expansionRatio
99 );
100
101 //- Construct from expansionRatio
102 explicit gradingDescriptor(const scalar expansionRatio);
103
104 //- Construct from Istream
105 explicit gradingDescriptor(Istream& is);
106
107
108 //- Destructor
109 ~gradingDescriptor() = default;
110
111
112 // Member Functions
114 scalar blockFraction() const
115 {
116 return blockFraction_;
117 }
119 scalar nDivFraction() const
120 {
121 return nDivFraction_;
122 }
124 scalar expansionRatio() const
125 {
126 return expansionRatio_;
127 }
128
129 //- Adjust expansion ratio.
130 // Trap negative value and treat as its inverse.
131 void correct();
132
133 //- Return the inverse gradingDescriptor with 1/expansionRatio
134 gradingDescriptor inv() const;
135
136
137 // Member Operators
138
139 bool operator==(const gradingDescriptor&) const;
140 bool operator!=(const gradingDescriptor&) const;
141
142
143 // IOstream Operators
147};
148
149
150// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151
152} // End namespace Foam
153
154// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155
156#endif
157
158// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Handles the specification for grading within a section of a block.
void correct()
Adjust expansion ratio.
bool operator==(const gradingDescriptor &) const
~gradingDescriptor()=default
Destructor.
friend Istream & operator>>(Istream &, gradingDescriptor &)
bool operator!=(const gradingDescriptor &) const
gradingDescriptor()
Default construct (1, 1, 1)
friend Ostream & operator<<(Ostream &, const gradingDescriptor &)
gradingDescriptor inv() const
Return the inverse gradingDescriptor with 1/expansionRatio.
List of gradingDescriptor for the sections of a block with additional IO functionality.
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)