1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 An equation, read from a dictionary. Effectively just a container class
29 holding all data associated with an individual equation. Functions are
30 implemented in masterDictionary.
40 \*---------------------------------------------------------------------------*/
45 //#include "equationOperationList.H"
46 //#include "dimensionedScalar.H"
47 #include "scalarField.H"
48 #include "dimensionSet.H"
49 #include "equationOperation.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 // Forward declaration of friend functions and operators
60 // Friend IOstream Operators
62 Istream& operator>>(Istream&, equation&);
63 Ostream& operator<<(Ostream&, const equation&);
65 /*---------------------------------------------------------------------------*\
66 Class equation Declaration
67 \*---------------------------------------------------------------------------*/
77 mutable PtrList<equationOperation> ops_;
79 //- raw text read from the dictionary
80 mutable string rawText_;
82 //- Result of most recent evaluate() or update()
83 mutable dimensionedScalar lastResult_;
85 //- Override dimensions - if read from a dictionary with dimensions,
86 // eg: nu nu [0 2 -1 0 0 0 0] "sin(theta)";
87 // the dimensionedScalar resulting from evaluate() is given these
89 mutable dimensionSet overrideDimensions_;
91 //- true if there is a dimension override
92 mutable bool changeDimensions_;
94 //- Maximum field size of output, indexed by geoIndex
95 mutable labelList maxFieldSizes_;
97 // Private member functions
99 //- Disallow default bitwise assignment
100 void operator=(const equation&);
104 // Static data members
106 static const char* const typeName;
115 equation(const equation&);
117 //- Construct from Istream with optional name
118 equation(Istream& is, const word& name = word::null);
120 //- Construct from components
123 const word& equationName,
124 const string& rawText,
125 const dimensionSet& overrideDimensions = dimless,
126 const bool& changeDimensions = false
137 inline const word& name() const;
139 //- Size of operation list
140 inline label size() const;
142 //- setSize of operation list
143 inline void setSize(const label newSize) const;
145 //- set an element of operation list
146 inline autoPtr<equationOperation> set
148 const label elementIndex,
149 equationOperation * newOperation
152 //- Change the equation name
156 inline const string& rawText() const;
158 //- Set equation text
159 inline void setRawText(const string& newRawText) const;
162 inline const dimensionedScalar& lastResult() const;
164 //- Set the last result
165 inline void setLastResult
167 const dimensionedScalar& newResult
170 //- Set the value of the last result
171 inline void setLastResult(const word& newName) const;
173 //- Set the dimensions of the last result
174 inline void setLastResult(const dimensionSet& newDims) const;
176 //- Set the value of the last result
177 inline void setLastResult(const scalar& newScalar) const;
179 //- Dimension override
180 inline const dimensionSet& overrideDimensions() const;
182 //- Set override dimensions
183 inline void setOverrideDimensions
185 const dimensionSet& newDims
188 //- changeDimensions flag
189 inline const bool& changeDimensions() const;
191 //- Set the changeDimensions flag
192 inline void setChangeDimensions(bool newFlag) const;
194 //- Return maxFieldSizes
195 inline const labelList& maxFieldSizes() const;
197 //- Set maxFieldSizes
198 inline void setMaxFieldSizes
200 const labelList& newSizes
203 // Delete the operation list
208 //- Copy only the header info - rawText, equationName,
209 // dimensionOverride, and changeDimensions
210 void operator=(equation&);
213 inline equationOperation& operator[](const label) const;
215 // Friend IOstream Operators
217 friend Istream& operator>>(Istream&, equation&);
218 friend Ostream& operator<<(Ostream&, const equation&);
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 } // End namespace Foam
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 #include "equationI.H"
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //