mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: fix (verbatim) documentation formatting
ENH: log10/bound optional in uniformInterpolationTable (consistent w/ example)
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -65,8 +65,8 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
|
||||
dict.lookup("data") >> *this;
|
||||
dict.lookup("x0") >> x0_;
|
||||
dict.lookup("dx") >> dx_;
|
||||
dict.lookup("log10") >> log10_;
|
||||
dict.lookup("bound") >> bound_;
|
||||
dict.readIfPresent("log10", log10_);
|
||||
dict.readIfPresent("bound", bound_);
|
||||
}
|
||||
|
||||
checkTable();
|
||||
@ -94,13 +94,13 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
|
||||
List<scalar>(2, 0.0),
|
||||
x0_(readScalar(dict.lookup("x0"))),
|
||||
dx_(readScalar(dict.lookup("dx"))),
|
||||
log10_(dict.lookup("log10")),
|
||||
bound_(dict.lookup("bound"))
|
||||
log10_(dict.lookupOrDefault<Switch>("log10", false)),
|
||||
bound_(dict.lookupOrDefault<Switch>("bound", false))
|
||||
{
|
||||
if (initialiseOnly)
|
||||
{
|
||||
scalar xMax = readScalar(dict.lookup("xMax"));
|
||||
label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
|
||||
const scalar xMax = readScalar(dict.lookup("xMax"));
|
||||
const label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
|
||||
this->setSize(nIntervals);
|
||||
}
|
||||
else
|
||||
@ -168,9 +168,9 @@ Type Foam::uniformInterpolationTable<Type>::interpolate(scalar x) const
|
||||
}
|
||||
}
|
||||
|
||||
label i = static_cast<label>((x - x0_)/dx_);
|
||||
const label i = static_cast<label>((x - x0_)/dx_);
|
||||
|
||||
scalar xLo = x0_ + i*dx_;
|
||||
const scalar xLo = x0_ + i*dx_;
|
||||
|
||||
Type fx = (x - xLo)/dx_*(operator[](i+1) - operator[](i)) + operator[](i);
|
||||
|
||||
@ -225,8 +225,14 @@ void Foam::uniformInterpolationTable<Type>::write() const
|
||||
dict.add("data", static_cast<const List<scalar>&>(*this));
|
||||
dict.add("x0", x0_);
|
||||
dict.add("dx", dx_);
|
||||
dict.add("log10", log10_);
|
||||
dict.add("bound", bound_);
|
||||
if (log10_)
|
||||
{
|
||||
dict.add("log10", log10_);
|
||||
}
|
||||
if (bound_)
|
||||
{
|
||||
dict.add("bound", bound_);
|
||||
}
|
||||
|
||||
dict.regIOobject::write();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,12 +28,13 @@ Description
|
||||
Table with uniform interval in independant variable, with linear
|
||||
interpolation
|
||||
|
||||
Example usage (scalar): values specified in a dictionary:
|
||||
Example usage (scalar): values specified within a dictionary:
|
||||
|
||||
@verbatim
|
||||
{
|
||||
x0 0; // lower limit
|
||||
dx 0.2; // fixed interval
|
||||
log10 true; // take log(10) when interpolating?
|
||||
x0 0; // lower limit
|
||||
dx 0.2; // fixed interval
|
||||
log10 true; // take log(10) when interpolating?
|
||||
data // list of dependent data values
|
||||
(
|
||||
7870 // value at x0
|
||||
@ -42,6 +43,7 @@ Description
|
||||
7870 // value at x0 + n*dx
|
||||
);
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
SourceFiles
|
||||
uniformInterpolationTable.C
|
||||
@ -73,7 +75,7 @@ class uniformInterpolationTable
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Control parameetrs
|
||||
// Control parameters
|
||||
|
||||
//- Lower limit
|
||||
scalar x0_;
|
||||
@ -81,7 +83,7 @@ class uniformInterpolationTable
|
||||
//- Fixed interval
|
||||
scalar dx_;
|
||||
|
||||
//- Flag to indicate that x data is given in log10(x) form
|
||||
//- Flag to indicate that x data are given in log10(x) form
|
||||
Switch log10_;
|
||||
|
||||
//- Bound x values
|
||||
@ -101,9 +103,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject and readFields flag. Creates a null object
|
||||
// if readFields = false
|
||||
uniformInterpolationTable(const IOobject& io, const bool readFields);
|
||||
//- Construct from IOobject and readFields flag.
|
||||
// Creates a null object if readFields = false
|
||||
uniformInterpolationTable(const IOobject&, const bool readFields);
|
||||
|
||||
//- Construct from name, objectRegistry and dictionary.
|
||||
// If initialiseOnly flag is set, control parameters are read from
|
||||
@ -111,13 +113,13 @@ public:
|
||||
uniformInterpolationTable
|
||||
(
|
||||
const word& tableName,
|
||||
const objectRegistry& db,
|
||||
const dictionary& dict,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool initialiseOnly = false
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
uniformInterpolationTable(const uniformInterpolationTable& uit);
|
||||
uniformInterpolationTable(const uniformInterpolationTable&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -174,22 +176,10 @@ public:
|
||||
// Override ancestor size() function and [] operator
|
||||
|
||||
//- Return the size of the table
|
||||
label size() const
|
||||
{
|
||||
return List<Type>::size();
|
||||
}
|
||||
using List<Type>::size;
|
||||
|
||||
//- Use List[] operator for read access
|
||||
Type operator[](label x) const
|
||||
{
|
||||
return List<Type>::operator[](x);
|
||||
}
|
||||
|
||||
//- Use List[] operator for write access
|
||||
Type& operator[](label x)
|
||||
{
|
||||
return List<Type>::operator[](x);
|
||||
}
|
||||
//- Use List[] operator for read/write access
|
||||
using List<Type>::operator[];
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
Reference in New Issue
Block a user