cosmetics

This commit is contained in:
andy
2009-03-26 11:34:32 +00:00
parent f8c6cfe0b5
commit dae6cbbea7
3 changed files with 42 additions and 54 deletions

View File

@ -29,23 +29,23 @@ License
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template <class Type> template <class Type>
Foam::label Foam::interpolationLookUpTable <Type>::index Foam::label Foam::interpolationLookUpTable<Type>::index
( (
const List<scalar>& indices, const List<scalar>& indices,
const bool lastDim const bool lastDim
) const ) const
{ {
label totalindex = 0; label totalIndex = 0;
for (int i = 0; i < dim_.size() - 1; i++) forAll(dim_, i)
{ {
label dim = 1; label dim = 1;
for (int j = i + 1; j < dim_.size(); j++) for (int j = i + 1; j < dim_.size(); j++)
{ {
dim *=(dim_[j]+1); dim *= dim_[j] + 1;
} }
totalindex += totalIndex +=
dim dim
*min *min
( (
@ -57,7 +57,7 @@ Foam::label Foam::interpolationLookUpTable <Type>::index
if (lastDim) if (lastDim)
{ {
label iLastdim = dim_.size() - 1; label iLastdim = dim_.size() - 1;
totalindex += Foam::min totalIndex += Foam::min
( (
max max
( (
@ -68,12 +68,12 @@ Foam::label Foam::interpolationLookUpTable <Type>::index
); );
} }
return totalindex; return totalIndex;
} }
template <class Type> template <class Type>
Foam::label Foam::interpolationLookUpTable <Type>::index Foam::label Foam::interpolationLookUpTable<Type>::index
( (
const scalar indice const scalar indice
) const ) const
@ -171,15 +171,15 @@ void Foam::interpolationLookUpTable<Type>::dimensionTable()
max_[i] = readScalar(entries_[i].lookup("max")); max_[i] = readScalar(entries_[i].lookup("max"));
min_[i] = readScalar(entries_[i].lookup("min")); min_[i] = readScalar(entries_[i].lookup("min"));
delta_[i] = (max_[i] - min_[i])/dim_[i]; delta_[i] = (max_[i] - min_[i])/dim_[i];
tableDim *= (dim_[i] + 1); tableDim *= dim_[i] + 1;
fieldIndices_.insert(entries_[i].lookup("name"),index); fieldIndices_.insert(entries_[i].lookup("name"), index);
entryIndices_[i] = index; entryIndices_[i] = index;
index++; index++;
} }
forAll(output_,i) forAll(output_,i)
{ {
fieldIndices_.insert(output_[i].lookup("name"),index); fieldIndices_.insert(output_[i].lookup("name"), index);
outputIndices_[i] = index; outputIndices_[i] = index;
index++; index++;
} }
@ -229,8 +229,7 @@ void Foam::interpolationLookUpTable<Type>::readTable
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationLookUpTable<Type>::readTable()" "Foam::interpolationLookUpTable<Type>::readTable()"
) << "table is empty" << nl ) << "table is empty" << nl << exit(FatalError);
<< exit(FatalError);
} }
} }
@ -240,7 +239,7 @@ void Foam::interpolationLookUpTable<Type>::readTable
template<class Type> template<class Type>
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable() Foam::interpolationLookUpTable<Type>::interpolationLookUpTable()
: :
List<scalarField >(), List<scalarField>(),
fileName_("fileNameIsUndefined") fileName_("fileNameIsUndefined")
{} {}
@ -251,7 +250,7 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
const fileName& fn, const word& instance, const fvMesh& mesh const fileName& fn, const word& instance, const fvMesh& mesh
) )
: :
List<scalarField >(), List<scalarField>(),
fileName_(fn), fileName_(fn),
dim_(0), dim_(0),
min_(0), min_(0),
@ -273,7 +272,7 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
const interpolationLookUpTable& interpTable const interpolationLookUpTable& interpTable
) )
: :
List<scalarField >(interpTable), List<scalarField>(interpTable),
fileName_(interpTable.fileName_), fileName_(interpTable.fileName_),
entryIndices_(interpTable.entryIndices_), entryIndices_(interpTable.entryIndices_),
outputIndices_(interpTable.outputIndices_), outputIndices_(interpTable.outputIndices_),
@ -293,7 +292,7 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
const dictionary& dict const dictionary& dict
) )
: :
List<scalarField >(), List<scalarField>(),
fileName_(fileName(dict.lookup("fileName")).expand()), fileName_(fileName(dict.lookup("fileName")).expand()),
dim_(0), dim_(0),
min_(0.0), min_(0.0),
@ -315,20 +314,19 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
template<class Type> template<class Type>
void Foam::interpolationLookUpTable<Type>::check() const void Foam::interpolationLookUpTable<Type>::check() const
{ {
// check order in the first dimension. // check order in the first dimension.
scalar prevValue = List<scalarField>::operator[](0).operator[](0);
scalar prevValue = List<scalarField >::operator[](0).operator[](0); label dim = 1;
label dim = 1 ;
for (int j = 1; j < dim_.size(); j++) for (int j = 1; j < dim_.size(); j++)
{ {
dim *=(dim_[j]+1); dim *= dim_[j] + 1;
} }
for (label i = 1; i < dim_[0]; i++) for (label i = 1; i < dim_[0]; i++)
{ {
label index = i*dim; label index = i*dim;
const scalar currValue = const scalar currValue =
List<scalarField >::operator[](0).operator[](index); List<scalarField>::operator[](0).operator[](index);
// avoid duplicate values (divide-by-zero error) // avoid duplicate values (divide-by-zero error)
if (currValue <= prevValue) if (currValue <= prevValue)
@ -336,9 +334,8 @@ void Foam::interpolationLookUpTable<Type>::check() const
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationLookUpTable<Type>::checkOrder() const" "Foam::interpolationLookUpTable<Type>::checkOrder() const"
) << "out-of-order value: " ) << "out-of-order value: " << currValue
<< currValue << " at index " << index << nl << " at index " << index << nl << exit(FatalError);
<< exit(FatalError);
} }
prevValue = currValue; prevValue = currValue;
} }
@ -379,8 +376,7 @@ void Foam::interpolationLookUpTable<Type>::write
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationTable<Type>::write()" "Foam::interpolationTable<Type>::write()"
) << "table is empty" << nl ) << "table is empty" << nl << exit(FatalError);
<< exit(FatalError);
} }
os.writeKeyword("values"); os.writeKeyword("values");
os << *this << token::END_STATEMENT << nl; os << *this << token::END_STATEMENT << nl;
@ -400,31 +396,25 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationLookUpTable<Type>::operator[]" "Foam::interpolationLookUpTable<Type>::operator[](const label)"
"(const label) const" ) << "table has (" << n << ") columns" << nl << exit(FatalError);
) << "table has (" << n << ") columns" << nl
<< exit(FatalError);
} }
else if (ii < 0) else if (ii < 0)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationLookUpTable<Type>::operator[]" "Foam::interpolationLookUpTable<Type>::operator[](const label)"
"(const label) const" ) << "index (" << ii << ") underflow" << nl << exit(FatalError);
) << "index (" << ii << ") underflow" << nl
<< exit(FatalError);
} }
else if (ii > n) else if (ii > n)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationLookUpTable<Type>::operator[]" "Foam::interpolationLookUpTable<Type>::operator[](const label)"
"(const label) const" ) << "index (" << ii << ") overflow" << nl << exit(FatalError);
) << "index (" << ii << ") overflow" << nl
<< exit(FatalError);
} }
return List<scalarField >::operator[](ii); return List<scalarField>::operator[](ii);
} }
@ -441,8 +431,7 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i) const
( (
"Foam::interpolationLookUpTable<Type>::operator[]" "Foam::interpolationLookUpTable<Type>::operator[]"
"(const label) const" "(const label) const"
) << "table has (" << n << ") columns" << nl ) << "table has (" << n << ") columns" << nl << exit(FatalError);
<< exit(FatalError);
} }
else if (ii < 0) else if (ii < 0)
{ {
@ -450,8 +439,7 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i) const
( (
"Foam::interpolationLookUpTable<Type>::operator[]" "Foam::interpolationLookUpTable<Type>::operator[]"
"(const label) const" "(const label) const"
) << "index (" << ii << ") underflow" << nl ) << "index (" << ii << ") underflow" << nl << exit(FatalError);
<< exit(FatalError);
} }
else if (ii > n) else if (ii > n)
@ -464,7 +452,7 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i) const
<< exit(FatalError); << exit(FatalError);
} }
return List<scalarField >::operator[](ii); return List<scalarField>::operator[](ii);
} }
@ -500,7 +488,7 @@ void Foam::interpolationLookUpTable<Type>::findHi
forAll(entryIndices_,i) forAll(entryIndices_,i)
{ {
if (checkRange(retvals,entryIndices_[i])) if (checkRange(retvals, entryIndices_[i]))
{ {
label dim = 1; label dim = 1;

View File

@ -54,7 +54,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class interpolationLookUpTable Declaration Class interpolationLookUpTable Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
@ -64,22 +64,22 @@ class interpolationLookUpTable
{ {
private: private:
// Private data // Privsate data
//- File name //- File name
fileName fileName_; fileName fileName_;
//- Table dimensions //- Table dimensions
List<label> dim_; List<label> dim_;
//- Min on each dimension //- Min on each dimension
List<scalar> min_; List<scalar> min_;
//- Deltas on each dimension //- Deltas on each dimension
List<scalar> delta_; List<scalar> delta_;
//- Maximum on each dimension //- Maximum on each dimension
List<scalar> max_; List<scalar> max_;
//- Dictionary entries //- Dictionary entries
List<dictionary> entries_; List<dictionary> entries_;

View File

@ -100,7 +100,7 @@ namespace radiation
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class constantAbsorptionEmission Declaration Class greyMeanAbsorptionEmission Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class greyMeanAbsorptionEmission class greyMeanAbsorptionEmission