cosmetic cleanups

- grammar in comments, namespace qualifiers, etc.
This commit is contained in:
Mark Olesen
2009-01-16 19:07:14 +01:00
parent 7aee58e5fa
commit d5cbc3bf08
46 changed files with 187 additions and 299 deletions

View File

@ -228,7 +228,7 @@ public:
};
//- Specify data associated with boundBox type are contiguous
//- Data associated with boundBox type are contiguous
template<>
inline bool contiguous<boundBox>() {return contiguous<point>();}

View File

@ -45,7 +45,7 @@ namespace Foam
Class Hash Declaration
\*---------------------------------------------------------------------------*/
template<class primitive>
template<class PrimitiveType>
class Hash
{
@ -54,12 +54,12 @@ public:
Hash()
{}
label operator()(const primitive& p) const
label operator()(const PrimitiveType& p) const
{
return label(p);
}
label operator()(const primitive& p, const label tableSize) const
label operator()(const PrimitiveType& p, const label tableSize) const
{
return mag(operator()(p)) % tableSize;
}

View File

@ -29,6 +29,9 @@ Description
An ordered pair of two objects of type \<T\> with first() and second()
elements.
SeeAlso
Foam::Tuple2 for storing two objects of dissimilar types.
\*---------------------------------------------------------------------------*/
#ifndef Pair_H
@ -136,15 +139,12 @@ public:
friend bool operator==(const Pair<Type>& a, const Pair<Type>& b)
{
return
(
(a.first() == b.first()) && (a.second() == b.second())
);
return (a.first() == b.first() && a.second() == b.second());
}
friend bool operator!=(const Pair<Type>& a, const Pair<Type>& b)
{
return (!(a == b));
return !(a == b);
}
};

View File

@ -26,18 +26,13 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
const char* const Foam::pTraits<Foam::Scalar>::typeName = "scalar";
const Foam::Scalar Foam::pTraits<Foam::Scalar>::zero(0.0);
const Foam::Scalar Foam::pTraits<Foam::Scalar>::one(1.0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::pTraits<Foam::Scalar>::componentNames[] = { "x" };
const char* const pTraits<Scalar>::typeName = "scalar";
const Scalar pTraits<Scalar>::zero = 0.0;
const Scalar pTraits<Scalar>::one = 1.0;
const char* pTraits<Scalar>::componentNames[] = { "x" };
pTraits<Scalar>::pTraits(Istream& is)
Foam::pTraits<Foam::Scalar>::pTraits(Istream& is)
{
is >> p_;
}
@ -45,27 +40,26 @@ pTraits<Scalar>::pTraits(Istream& is)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- return a string representation of a Scalar
word name(const Scalar s)
Foam::word Foam::name(const Scalar s)
{
std::ostringstream osBuffer;
osBuffer << s;
return osBuffer.str();
std::ostringstream buf;
buf << s;
return buf.str();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Scalar readScalar(Istream& is)
Foam::Scalar Foam::readScalar(Istream& is)
{
Scalar rs;
is >> rs;
Scalar val;
is >> val;
return rs;
return val;
}
Istream& operator>>(Istream& is, Scalar& s)
Foam::Istream& Foam::operator>>(Istream& is, Scalar& s)
{
token t(is);
@ -96,7 +90,7 @@ Istream& operator>>(Istream& is, Scalar& s)
}
Ostream& operator<<(Ostream& os, const Scalar s)
Foam::Ostream& Foam::operator<<(Ostream& os, const Scalar s)
{
os.write(s);
os.check("Ostream& operator<<(Ostream&, const Scalar&)");
@ -104,8 +98,4 @@ Ostream& operator<<(Ostream& os, const Scalar s)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -51,7 +51,7 @@ public:
enum
{
dim = 3, // Dimensionality of space
rank = 0, // Rank od Scalar is 0
rank = 0, // Rank of Scalar is 0
nComponents = 1 // Number of components in Scalar is 1
};
@ -65,7 +65,8 @@ public:
// Constructors
//- Construct from Istream
pTraits(Istream& is);
pTraits(Istream&);
// Member Functions
@ -78,8 +79,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Return a string representation of a Scalar
word name(const Scalar s);
//- Return a string representation of a Scalar
word name(const Scalar);
inline Scalar& setComponent(Scalar& s, const direction)
@ -261,7 +262,7 @@ inline Scalar stabilise(const Scalar s, const Scalar small)
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Scalar readScalar(Istream& is);
Scalar readScalar(Istream&);
Istream& operator>>(Istream&, Scalar&);
Ostream& operator<<(Ostream&, const Scalar);

View File

@ -28,6 +28,9 @@ Class
Description
A 2-tuple.
SeeAlso
Foam::Pair for storing two objects of identical types.
\*---------------------------------------------------------------------------*/
#ifndef Tuple2_H
@ -67,7 +70,7 @@ inline Ostream& operator<<(Ostream&, const Tuple2<Type1, Type2>&);
/*---------------------------------------------------------------------------*\
class Tuple2 Declaration
class Tuple2 Declaration
\*---------------------------------------------------------------------------*/
template<class Type1, class Type2>
@ -97,7 +100,7 @@ public:
//- Construct from Istream
inline Tuple2(Istream& is)
{
operator>>(is, *this);
is >> *this;
}
@ -186,10 +189,7 @@ inline bool operator==
const Tuple2<Type1, Type2>& b
)
{
return
(
(a.first() == b.first()) && (a.second() == b.second())
);
return (a.first() == b.first() && a.second() == b.second());
}
@ -200,7 +200,7 @@ inline bool operator!=
const Tuple2<Type1, Type2>& b
)
{
return (!(a == b));
return !(a == b);
}
@ -224,7 +224,7 @@ inline Ostream& operator<<(Ostream& os, const Tuple2<Type1, Type2>& t2)
os << token::BEGIN_LIST
<< t2.f_ << token::SPACE << t2.s_
<< token::END_LIST;
return os;
}

View File

@ -29,16 +29,11 @@ License
#include <sstream>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from Istream
template<class Form, class Cmpt, int nCmpt>
VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
Foam::VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
(
Istream& is
)
@ -55,36 +50,37 @@ VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
is.readEnd("VectorSpace<Form, Cmpt, nCmpt>");
// Check state of Istream
is.check("VectorSpace<Form, Cmpt, nCmpt>::VectorSpace(Istream& is)");
is.check("VectorSpace<Form, Cmpt, nCmpt>::VectorSpace(Istream&)");
}
//- Return a string representation
// Return a string representation
template<class Form, class Cmpt, int nCmpt>
word name
Foam::word
Foam::name
(
const VectorSpace<Form, Cmpt, nCmpt>& vs
)
{
std::ostringstream osBuffer;
std::ostringstream buf;
osBuffer << '(';
buf << '(';
for (int i=0; i<nCmpt-1; i++)
{
osBuffer << vs.v_[i] << ',';
buf << vs.v_[i] << ',';
}
osBuffer << vs.v_[nCmpt-1] << ')';
buf << vs.v_[nCmpt-1] << ')';
return osBuffer.str();
return buf.str();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Form, class Cmpt, int nCmpt>
Istream& operator>>
Foam::Istream& Foam::operator>>
(
Istream& is,
VectorSpace<Form, Cmpt, nCmpt>& vs
@ -109,7 +105,7 @@ Istream& operator>>
template<class Form, class Cmpt, int nCmpt>
Ostream& operator<<
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const VectorSpace<Form, Cmpt, nCmpt>& vs
@ -131,8 +127,4 @@ Ostream& operator<<
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -36,12 +36,7 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Istream& operator>>(Istream& is, char& c)
Foam::Istream& Foam::operator>>(Istream& is, char& c)
{
is.read(c);
is.check("Istream& operator>>(Istream& is, char& c)");
@ -49,7 +44,7 @@ Istream& operator>>(Istream& is, char& c)
}
Ostream& operator<<(Ostream& os, const char c)
Foam::Ostream& Foam::operator<<(Ostream& os, const char c)
{
os.write(c);
os.check("Ostream& operator<<(Ostream&, const char)");
@ -57,7 +52,7 @@ Ostream& operator<<(Ostream& os, const char c)
}
char readChar(Istream& is)
char Foam::readChar(Istream& is)
{
char c;
is.read(c);
@ -65,7 +60,7 @@ char readChar(Istream& is)
}
Ostream& operator<<(Ostream& os, const char* s)
Foam::Ostream& Foam::operator<<(Ostream& os, const char* s)
{
os.write(s);
os.check("Ostream& operator<<(Ostream&, const char*)");
@ -73,8 +68,4 @@ Ostream& operator<<(Ostream& os, const char* s)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -29,38 +29,33 @@ License
#include <sstream>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* const complex::typeName = "complex";
const complex complex::zero(0, 0);
const complex complex::one(1, 1);
const char* const Foam::complex::typeName = "complex";
const Foam::complex Foam::complex::zero(0, 0);
const Foam::complex Foam::complex::one(1, 1);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
complex::complex(Istream& is)
Foam::complex::complex(Istream& is)
{
operator>>(is, *this);
is >> *this;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
word name(const complex& c)
Foam::word Foam::name(const complex& c)
{
std::ostringstream osBuffer;
osBuffer << '(' << c.Re() << ',' << c.Im() << ')';
return osBuffer.str();
std::ostringstream buf;
buf << '(' << c.Re() << ',' << c.Im() << ')';
return buf.str();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Istream& operator>>(Istream& is, complex& c)
Foam::Istream& Foam::operator>>(Istream& is, complex& c)
{
// Read beginning of complex
is.readBegin("complex");
@ -77,7 +72,7 @@ Istream& operator>>(Istream& is, complex& c)
}
Ostream& operator<<(Ostream& os, const complex& c)
Foam::Ostream& Foam::operator<<(Ostream& os, const complex& c)
{
os << token::BEGIN_LIST
<< c.re << token::SPACE << c.im
@ -87,8 +82,4 @@ Ostream& operator<<(Ostream& os, const complex& c)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -174,8 +174,8 @@ public:
// IOstream operators
friend Istream& operator>>(Istream& is, complex&);
friend Ostream& operator<<(Ostream& os, const complex& C);
friend Istream& operator>>(Istream&, complex&);
friend Ostream& operator<<(Ostream&, const complex&);
};
@ -186,7 +186,7 @@ public:
word name(const complex&);
//- Specify data associated with complex type is contiguous
//- Data associated with complex type are contiguous
template<>
inline bool contiguous<complex>() {return true;}

View File

@ -26,12 +26,10 @@ InClass
Foam::contiguous
Description
Template function which specifies if the data of the type is contiguous
or not.
Template function to specify if the data of a type are contiguous.
The default function specifies that data are not contiguous.
This is specialised for the types (e.g. primitives) for which their
data are contiguous.
This is specialised for the types (e.g. primitives) with contiguous data.
\*---------------------------------------------------------------------------*/
@ -52,14 +50,13 @@ template<class T, label Size> class FixedList;
template<class T> class Pair;
// Assume the data associated with type T is not contiguous
//- Assume the data associated with type T are not contiguous
template<class T>
inline bool contiguous() {return false;}
inline bool contiguous() {return false;}
// Specify data associated with primitive types (and simple fixed size
// containers - only size 2 defined here) is contiguous
// Data associated with primitive types (and simple fixed size containers
// - only size 2 defined here) are contiguous
template<>
inline bool contiguous<bool>() {return true;}
@ -143,7 +140,7 @@ inline bool contiguous<float>() {return true;}
template<>
inline bool contiguous<FixedList<float, 2> >() {return true;}
template<>
inline bool contiguous<Pair<float> >() {return true;}
inline bool contiguous<Pair<float> >() {return true;}
template<>
inline bool contiguous<double>() {return true;}

View File

@ -49,7 +49,7 @@ namespace Foam
typedef DiagTensor<scalar> diagTensor;
//- Specify data associated with diagTensor type is contiguous
//- Data associated with diagTensor type are contiguous
template<>
inline bool contiguous<diagTensor>() {return true;}

View File

@ -50,11 +50,11 @@ class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Return a word representation of an int
word name(const int i);
word name(const int);
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
int readInt(Istream& is);
int readInt(Istream&);
Istream& operator>>(Istream&, int&);
Ostream& operator<<(Ostream&, const int);

View File

@ -39,22 +39,17 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
Foam::word Foam::name(const int val)
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Return a string representation of an int
word name(const int i)
{
std::ostringstream osBuffer;
osBuffer << i;
return osBuffer.str();
std::ostringstream buf;
buf << val;
return buf.str();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Istream& operator>>(Istream& is, int& i)
Foam::Istream& Foam::operator>>(Istream& is, int& i)
{
token t(is);
@ -85,16 +80,16 @@ Istream& operator>>(Istream& is, int& i)
}
int readInt(Istream& is)
int Foam::readInt(Istream& is)
{
int ri;
is >> ri;
int val;
is >> val;
return ri;
return val;
}
Ostream& operator<<(Ostream& os, const int i)
Foam::Ostream& Foam::operator<<(Ostream& os, const int i)
{
os.write(label(i));
os.check("Ostream& operator<<(Ostream&, const int)");
@ -102,8 +97,4 @@ Ostream& operator<<(Ostream& os, const int i)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -38,8 +38,8 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* const pTraits<label>::typeName = "label";
const label pTraits<label>::zero = 0;
const label pTraits<label>::one = 1;
const label pTraits<label>::zero(0);
const label pTraits<label>::one(1);
const char* pTraits<label>::componentNames[] = { "x" };
@ -48,7 +48,6 @@ pTraits<label>::pTraits(Istream& is)
is >> p_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Raise one label to the power of another (overloaded function call)

View File

@ -140,7 +140,7 @@ public:
enum
{
dim = 3, // Dimensionality of space
rank = 0, // Rank od label is 0
rank = 0, // Rank of label is 0
nComponents = 1 // Number of components in label is 1
};
@ -154,7 +154,7 @@ public:
// Constructors
//- Construct from Istream
pTraits(Istream& is);
pTraits(Istream&);
// Member Functions

View File

@ -48,10 +48,10 @@ namespace Foam
typedef SphericalTensor<label> labelSphericalTensor;
// Identity labelTensor
//- Identity labelTensor
static const labelSphericalTensor labelI(1);
//- Specify data associated with labelSphericalTensor type is contiguous
//- Data associated with labelSphericalTensor type are contiguous
template<>
inline bool contiguous<labelSphericalTensor>() {return true;}

View File

@ -48,7 +48,7 @@ namespace Foam
typedef SymmTensor<label> labelSymmTensor;
//- Specify data associated with labelSymmTensor type is contiguous
//- Data associated with labelSymmTensor type are contiguous
template<>
inline bool contiguous<labelSymmTensor>() {return true;}

View File

@ -25,20 +25,15 @@ License
\*---------------------------------------------------------------------------*/
#include "labelTensor.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* const labelTensor::typeName = "labelTensor";
const char* const Foam::labelTensor::typeName = "labelTensor";
template<>
const char* labelTensor::componentNames[] =
const char* Foam::labelTensor::componentNames[] =
{
"xx", "xy", "xz",
"yx", "yy", "yz",
@ -46,7 +41,7 @@ const char* labelTensor::componentNames[] =
};
template<>
const labelTensor labelTensor::zero
const Foam::labelTensor Foam::labelTensor::zero
(
0, 0, 0,
0, 0, 0,
@ -54,7 +49,7 @@ const labelTensor labelTensor::zero
);
template<>
const labelTensor labelTensor::one
const Foam::labelTensor Foam::labelTensor::one
(
1, 1, 1,
1, 1, 1,
@ -62,9 +57,4 @@ const labelTensor labelTensor::one
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -48,7 +48,7 @@ namespace Foam
typedef Tensor<label> labelTensor;
//- Specify data associated with labelTensor type is contiguous
//- Specify data associated with labelTensor type are contiguous
template<>
inline bool contiguous<labelTensor>() {return true;}

View File

@ -29,27 +29,20 @@ Description
#include "labelVector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* const labelVector::typeName = "labelVector";
const char* const Foam::labelVector::typeName = "labelVector";
template<>
const char* labelVector::componentNames[] = {"x", "y", "z"};
const char* Foam::labelVector::componentNames[] = {"x", "y", "z"};
template<>
const labelVector labelVector::zero(0, 0, 0);
const Foam::labelVector Foam::labelVector::zero(0, 0, 0);
template<>
const labelVector labelVector::one(1, 1, 1);
const Foam::labelVector Foam::labelVector::one(1, 1, 1);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -50,7 +50,7 @@ namespace Foam
typedef Vector<label> labelVector;
//- Specify data associated with labelVector type is contiguous
//- Data associated with labelVector type are contiguous
template<>
inline bool contiguous<labelVector>() {return true;}

View File

@ -49,11 +49,11 @@ class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Return a string representation of a long
word name(long l);
word name(long);
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
long readLong(Istream& is);
long readLong(Istream&);
Istream& operator>>(Istream&, long&);
Ostream& operator<<(Ostream&, const long);

View File

@ -38,22 +38,16 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
Foam::word Foam::name(long val)
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Return a string representation of a long
word name(long l)
{
std::ostringstream osBuffer;
osBuffer << l;
return osBuffer.str();
std::ostringstream buf;
buf << val;
return buf.str();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Istream& operator>>(Istream& is, long& l)
Foam::Istream& Foam::operator>>(Istream& is, long& l)
{
token t(is);
@ -84,16 +78,16 @@ Istream& operator>>(Istream& is, long& l)
}
long readLong(Istream& is)
long Foam::readLong(Istream& is)
{
long l;
is >> l;
long val;
is >> val;
return l;
return val;
}
Ostream& operator<<(Ostream& os, const long l)
Foam::Ostream& Foam::operator<<(Ostream& os, const long l)
{
os.write(label(l));
os.check("Ostream& operator<<(Ostream&, const long)");
@ -101,8 +95,4 @@ Ostream& operator<<(Ostream& os, const long l)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -49,11 +49,11 @@ class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Return a string representation of a long long
word name(long long l);
word name(long long);
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
long long readLongLong(Istream& is);
long long readLongLong(Istream&);
Istream& operator>>(Istream&, long long&);
Ostream& operator<<(Ostream&, const long long);

View File

@ -38,22 +38,16 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
Foam::word Foam::name(long long val)
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Return a string representation of a long long
word name(long long l)
{
std::ostringstream osBuffer;
osBuffer << l;
return osBuffer.str();
std::ostringstream buf;
buf << val;
return buf.str();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Istream& operator>>(Istream& is, long long& l)
Foam::Istream& Foam::operator>>(Istream& is, long long& l)
{
l = readLongLong(is);
@ -64,7 +58,7 @@ Istream& operator>>(Istream& is, long long& l)
}
long long readLongLong(Istream& is)
long long Foam::readLongLong(Istream& is)
{
register long long result = 0;
@ -94,7 +88,7 @@ long long readLongLong(Istream& is)
}
Ostream& operator<<(Ostream& os, const long long l)
Foam::Ostream& Foam::operator<<(Ostream& os, const long long l)
{
long long val = l;
@ -119,7 +113,7 @@ Ostream& operator<<(Ostream& os, const long long l)
os.write(char(d+'0'));
}
val = val%mask;
val = val % mask;
mask /= 10;
}
os.check("Ostream& operator<<(Ostream&, const long long)");
@ -127,8 +121,4 @@ Ostream& operator<<(Ostream& os, const long long l)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,8 +26,9 @@ Class
Foam::pTraits
Description
Traits class for primitives. All primitives need a specialised
version of this class
Traits class for primitives.
All primitives need a specialised version of this class
\*---------------------------------------------------------------------------*/
@ -45,22 +46,22 @@ class Istream;
Class pTraits Declaration
\*---------------------------------------------------------------------------*/
template<class primitive>
template<class PrimitiveType>
class pTraits
:
public primitive
public PrimitiveType
{
public:
pTraits(const primitive& p)
pTraits(const PrimitiveType& p)
:
primitive(p)
PrimitiveType(p)
{}
pTraits(Istream& is)
:
primitive(is)
PrimitiveType(is)
{}
};

View File

@ -38,7 +38,7 @@ const Foam::quaternion Foam::quaternion::I(1, vector::zero);
Foam::quaternion::quaternion(Istream& is)
{
operator>>(is, *this);
is >> *this;
}
@ -46,9 +46,9 @@ Foam::quaternion::quaternion(Istream& is)
Foam::word Foam::name(const quaternion& q)
{
OStringStream osBuffer;
osBuffer << '(' << q.w() << ',' << q.v() << ')';
return osBuffer.str();
OStringStream buf;
buf << '(' << q.w() << ',' << q.v() << ')';
return buf.str();
}

View File

@ -194,7 +194,7 @@ inline quaternion inv(const quaternion& q);
//- Return a string representation of a quaternion
word name(const quaternion&);
//- Specify data associated with quaternion type is contiguous
//- Data associated with quaternion type are contiguous
template<>
inline bool contiguous<quaternion>() {return true;}

View File

@ -38,7 +38,7 @@ const Foam::septernion Foam::septernion::I(vector::zero, quaternion::I);
Foam::septernion::septernion(Istream& is)
{
operator>>(is, *this);
is >> *this;
}
@ -46,9 +46,9 @@ Foam::septernion::septernion(Istream& is)
Foam::word Foam::name(const septernion& s)
{
OStringStream osBuffer;
osBuffer << '(' << s.t() << ',' << s.r() << ')';
return osBuffer.str();
OStringStream buf;
buf << '(' << s.t() << ',' << s.r() << ')';
return buf.str();
}

View File

@ -159,7 +159,7 @@ inline septernion inv(const septernion& tr);
word name(const septernion&);
//- Specify data associated with septernion type is contiguous
//- Data associated with septernion type are contiguous
template<>
inline bool contiguous<septernion>() {return true;}

View File

@ -55,7 +55,7 @@ static const sphericalTensor oneThirdI(1.0/3.0);
static const sphericalTensor twoThirdsI(2.0/3.0);
//- Specify data associated with sphericalTensor type is contiguous
//- Specify data associated with sphericalTensor type are contiguous
template<>
inline bool contiguous<sphericalTensor>() {return true;}

View File

@ -49,14 +49,14 @@ namespace Foam
typedef SphericalTensor2D<scalar> sphericalTensor2D;
// Identity tensor
//- Identity tensor
static const sphericalTensor2D I2D(1);
static const sphericalTensor2D oneThirdI2D(1.0/3.0);
static const sphericalTensor2D twoThirdsI2D(2.0/3.0);
//- Specify data associated with sphericalTensor2D type is contiguous
//- Data associated with sphericalTensor2D type are contiguous
template<>
inline bool contiguous<sphericalTensor2D>() {return true;}

View File

@ -49,7 +49,7 @@ namespace Foam
typedef SymmTensor<scalar> symmTensor;
//- Specify data associated with symmTensor type is contiguous
//- Data associated with symmTensor type are contiguous
template<>
inline bool contiguous<symmTensor>() {return true;}

View File

@ -59,7 +59,7 @@ vector eigenValues(const symmTensor& t);
vector eigenVector(const symmTensor& t, const scalar lambda);
tensor eigenVectors(const symmTensor& t);
//- Specify data associated with tensor type is contiguous
//- Data associated with tensor type are contiguous
template<>
inline bool contiguous<tensor>() {return true;}

View File

@ -53,7 +53,7 @@ vector2D eigenValues(const tensor2D& t);
vector2D eigenVector(const tensor2D& t, const scalar lambda);
tensor2D eigenVectors(const tensor2D& t);
//- Specify data associated with tensor2D type is contiguous
//- Data associated with tensor2D type are contiguous
template<>
inline bool contiguous<tensor2D>() {return true;}

View File

@ -29,28 +29,17 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
const char* const Foam::pTraits<Foam::uLabel>::typeName = "uLabel";
const Foam::uLabel Foam::pTraits<Foam::uLabel>::zero(0);
const Foam::uLabel Foam::pTraits<Foam::uLabel>::one(1);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::pTraits<Foam::uLabel>::componentNames[] = { "x" };
const char* const pTraits<uLabel>::typeName = "uLabel";
const uLabel pTraits<uLabel>::zero = 0;
const uLabel pTraits<uLabel>::one = 1;
const char* pTraits<uLabel>::componentNames[] = { "x" };
pTraits<uLabel>::pTraits(Istream& is)
Foam::pTraits<Foam::uLabel>::pTraits(Istream& is)
{
is >> p_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -134,7 +134,8 @@ public:
// Constructors
//- Construct from Istream
pTraits(Istream& is);
pTraits(Istream&);
// Member Functions

View File

@ -49,11 +49,11 @@ class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Return a string representation of an uint
word name(const unsigned int i);
word name(const unsigned int);
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
unsigned int readUint(Istream& is);
unsigned int readUint(Istream&);
Istream& operator>>(Istream&, unsigned int&);
Ostream& operator<<(Ostream&, const unsigned int);

View File

@ -39,21 +39,16 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
Foam::word Foam::name(const unsigned int val)
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
word name(const unsigned int i)
{
std::ostringstream osBuffer;
osBuffer << i;
return osBuffer.str();
std::ostringstream buf;
buf << val;
return buf.str();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Istream& operator>>(Istream& is, unsigned int& i)
Foam::Istream& Foam::operator>>(Istream& is, unsigned int& i)
{
token t(is);
@ -84,16 +79,16 @@ Istream& operator>>(Istream& is, unsigned int& i)
}
unsigned int readUint(Istream& is)
unsigned int Foam::readUint(Istream& is)
{
unsigned int ri;
is >> ri;
unsigned int val;
is >> val;
return ri;
return val;
}
Ostream& operator<<(Ostream& os, const unsigned int i)
Foam::Ostream& Foam::operator<<(Ostream& os, const unsigned int i)
{
os.write(label(i));
os.check("Ostream& operator<<(Ostream&, const unsigned int)");
@ -101,8 +96,4 @@ Ostream& operator<<(Ostream& os, const unsigned int i)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -49,11 +49,11 @@ class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Return a string representation of an ulong
word name(const unsigned long i);
word name(const unsigned long);
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
unsigned long readUlong(Istream& is);
unsigned long readUlong(Istream&);
Istream& operator>>(Istream&, unsigned long&);
Ostream& operator<<(Ostream&, const unsigned long);

View File

@ -39,21 +39,16 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
Foam::word Foam::name(const unsigned long val)
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
word name(const unsigned long i)
{
std::ostringstream osBuffer;
osBuffer << i;
return osBuffer.str();
std::ostringstream buf;
buf << val;
return buf.str();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Istream& operator>>(Istream& is, unsigned long& i)
Foam::Istream& Foam::operator>>(Istream& is, unsigned long& i)
{
token t(is);
@ -84,16 +79,16 @@ Istream& operator>>(Istream& is, unsigned long& i)
}
unsigned long readUlong(Istream& is)
unsigned long Foam::readUlong(Istream& is)
{
unsigned long ri;
is >> ri;
unsigned long val;
is >> val;
return ri;
return val;
}
Ostream& operator<<(Ostream& os, const unsigned long i)
Foam::Ostream& Foam::operator<<(Ostream& os, const unsigned long i)
{
os.write(label(i));
os.check("Ostream& operator<<(Ostream&, const unsigned long)");
@ -101,8 +96,4 @@ Ostream& operator<<(Ostream& os, const unsigned long i)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -50,7 +50,7 @@ namespace Foam
typedef Vector<scalar> vector;
//- Specify data associated with vector type is contiguous
//- Data associated with vector type are contiguous
template<>
inline bool contiguous<vector>() {return true;}

View File

@ -50,7 +50,7 @@ namespace Foam
typedef Vector2D<scalar> vector2D;
//- Specify data associated with vector2D type is contiguous
//- Data associated with vector2D type are contiguous
template<>
inline bool contiguous<vector2D>() {return true;}

View File

@ -43,7 +43,7 @@ namespace Foam
typedef PointIndexHit<point> pointIndexHit;
//- Specify data associated with pointIndexHit type is contiguous
//- Data associated with pointIndexHit type are contiguous
template<>
inline bool contiguous<pointIndexHit>() {return contiguous<point>();}

View File

@ -327,7 +327,7 @@ public:
};
//- Specify data associated with boundBox type is contiguous
//- Data associated with treeBoundBox type are contiguous
template<>
inline bool contiguous<treeBoundBox>() {return contiguous<boundBox>();}