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 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::gradingDescriptor
29 
30 Description
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 
45 SourceFiles
46  gradingDescriptor.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef gradingDescriptor_H
51 #define gradingDescriptor_H
52 
53 #include "scalar.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 // Forward declarations
61 class Istream;
62 class Ostream;
63 class gradingDescriptor;
64 class gradingDescriptors;
65 
66 Istream& operator>>(Istream&, gradingDescriptor&);
67 Ostream& operator<<(Ostream&, const gradingDescriptor&);
68 
69 /*---------------------------------------------------------------------------*\
70  Class gradingDescriptor Declaration
71 \*---------------------------------------------------------------------------*/
72 
74 {
75  // Private Data
76 
77  scalar blockFraction_;
78  scalar nDivFraction_;
79  scalar expansionRatio_;
80 
81 
82 public:
83 
84  friend class gradingDescriptors;
85 
86 
87  // Constructors
88 
89  //- Default constructor
91 
92  //- Construct from components
94  (
95  const scalar blockFraction,
96  const scalar nDivFraction,
97  const scalar expansionRatio
98  );
99 
100  //- Construct from expansionRatio
101  explicit gradingDescriptor(const scalar expansionRatio);
102 
103  //- Construct from Istream
104  explicit gradingDescriptor(Istream& is);
105 
106 
107  //- Destructor
108  ~gradingDescriptor() = default;
109 
110 
111  // Member Functions
112 
113  // Access
114 
115  scalar blockFraction() const
116  {
117  return blockFraction_;
118  }
119 
120  scalar nDivFraction() const
121  {
122  return nDivFraction_;
123  }
124 
125  scalar expansionRatio() const
126  {
127  return expansionRatio_;
128  }
129 
130  // Member Functions
131 
132  //- Return the inverse gradingDescriptor with 1/expansionRatio
133  gradingDescriptor inv() const;
134 
135 
136  // Member Operators
137 
138  bool operator==(const gradingDescriptor&) const;
139  bool operator!=(const gradingDescriptor&) const;
140 
141 
142  // IOstream Operators
143 
145  friend Ostream& operator<<(Ostream&, const gradingDescriptor&);
146 
148 };
149 
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 } // End namespace Foam
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
Foam::gradingDescriptor::inv
gradingDescriptor inv() const
Return the inverse gradingDescriptor with 1/expansionRatio.
Definition: gradingDescriptor.C:85
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::gradingDescriptors
List of gradingDescriptor for the sections of a block with additional IO functionality.
Definition: gradingDescriptors.H:58
Foam::gradingDescriptor::expansionRatio
scalar expansionRatio() const
Definition: gradingDescriptor.H:124
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::gradingDescriptor::operator<<
friend Ostream & operator<<(Ostream &, const gradingDescriptor &)
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::gradingDescriptor::blockFraction
scalar blockFraction() const
Definition: gradingDescriptor.H:114
Foam::gradingDescriptor::operator!=
bool operator!=(const gradingDescriptor &) const
Definition: gradingDescriptor.C:107
scalar.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::gradingDescriptor::gradingDescriptor
gradingDescriptor()
Default constructor.
Definition: gradingDescriptor.C:35
Foam::gradingDescriptor
Handles the specification for grading within a section of a block.
Definition: gradingDescriptor.H:72
Foam::gradingDescriptor::operator==
bool operator==(const gradingDescriptor &) const
Definition: gradingDescriptor.C:98
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::gradingDescriptor::nDivFraction
scalar nDivFraction() const
Definition: gradingDescriptor.H:119
Foam::gradingDescriptor::~gradingDescriptor
~gradingDescriptor()=default
Destructor.
Foam::gradingDescriptor::operator>>
friend Istream & operator>>(Istream &, gradingDescriptor &)