diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.H b/src/OpenFOAM/meshes/boundBox/boundBox.H index 927ff3dc5b..e41b6efa46 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.H +++ b/src/OpenFOAM/meshes/boundBox/boundBox.H @@ -228,7 +228,7 @@ public: }; -//- Specify data associated with boundBox type are contiguous +//- Data associated with boundBox type are contiguous template<> inline bool contiguous() {return contiguous();} diff --git a/src/OpenFOAM/primitives/Hash/Hash.H b/src/OpenFOAM/primitives/Hash/Hash.H index e722dda6c2..ab8aa07a3b 100644 --- a/src/OpenFOAM/primitives/Hash/Hash.H +++ b/src/OpenFOAM/primitives/Hash/Hash.H @@ -45,7 +45,7 @@ namespace Foam Class Hash Declaration \*---------------------------------------------------------------------------*/ -template +template 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; } diff --git a/src/OpenFOAM/primitives/Pair/Pair.H b/src/OpenFOAM/primitives/Pair/Pair.H index 497e4972b9..fe92c64c7a 100644 --- a/src/OpenFOAM/primitives/Pair/Pair.H +++ b/src/OpenFOAM/primitives/Pair/Pair.H @@ -29,6 +29,9 @@ Description An ordered pair of two objects of type \ 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& a, const Pair& b) { - return - ( - (a.first() == b.first()) && (a.second() == b.second()) - ); + return (a.first() == b.first() && a.second() == b.second()); } friend bool operator!=(const Pair& a, const Pair& b) { - return (!(a == b)); + return !(a == b); } }; diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.C b/src/OpenFOAM/primitives/Scalar/Scalar.C index 4593405cd5..be85011331 100644 --- a/src/OpenFOAM/primitives/Scalar/Scalar.C +++ b/src/OpenFOAM/primitives/Scalar/Scalar.C @@ -26,18 +26,13 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ +const char* const Foam::pTraits::typeName = "scalar"; +const Foam::Scalar Foam::pTraits::zero(0.0); +const Foam::Scalar Foam::pTraits::one(1.0); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +const char* Foam::pTraits::componentNames[] = { "x" }; -const char* const pTraits::typeName = "scalar"; -const Scalar pTraits::zero = 0.0; -const Scalar pTraits::one = 1.0; - -const char* pTraits::componentNames[] = { "x" }; - -pTraits::pTraits(Istream& is) +Foam::pTraits::pTraits(Istream& is) { is >> p_; } @@ -45,27 +40,26 @@ pTraits::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 - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.H b/src/OpenFOAM/primitives/Scalar/Scalar.H index 5e2fbc0a26..2eacda679b 100644 --- a/src/OpenFOAM/primitives/Scalar/Scalar.H +++ b/src/OpenFOAM/primitives/Scalar/Scalar.H @@ -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); diff --git a/src/OpenFOAM/primitives/Tuple2/Tuple2.H b/src/OpenFOAM/primitives/Tuple2/Tuple2.H index 3d7ee8c4aa..9a850e6236 100644 --- a/src/OpenFOAM/primitives/Tuple2/Tuple2.H +++ b/src/OpenFOAM/primitives/Tuple2/Tuple2.H @@ -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&); /*---------------------------------------------------------------------------*\ - class Tuple2 Declaration + class Tuple2 Declaration \*---------------------------------------------------------------------------*/ template @@ -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& 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& b ) { - return (!(a == b)); + return !(a == b); } @@ -224,7 +224,7 @@ inline Ostream& operator<<(Ostream& os, const Tuple2& t2) os << token::BEGIN_LIST << t2.f_ << token::SPACE << t2.s_ << token::END_LIST; - + return os; } diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C index 73a981f7a2..59828e6469 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C @@ -29,16 +29,11 @@ License #include -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from Istream template -VectorSpace::VectorSpace +Foam::VectorSpace::VectorSpace ( Istream& is ) @@ -55,36 +50,37 @@ VectorSpace::VectorSpace is.readEnd("VectorSpace"); // Check state of Istream - is.check("VectorSpace::VectorSpace(Istream& is)"); + is.check("VectorSpace::VectorSpace(Istream&)"); } -//- Return a string representation +// Return a string representation template -word name +Foam::word +Foam::name ( const VectorSpace& vs ) { - std::ostringstream osBuffer; + std::ostringstream buf; - osBuffer << '('; + buf << '('; for (int i=0; i -Istream& operator>> +Foam::Istream& Foam::operator>> ( Istream& is, VectorSpace& vs @@ -109,7 +105,7 @@ Istream& operator>> template -Ostream& operator<< +Foam::Ostream& Foam::operator<< ( Ostream& os, const VectorSpace& vs @@ -131,8 +127,4 @@ Ostream& operator<< } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/char/charIO.C b/src/OpenFOAM/primitives/char/charIO.C index e5806063ca..28d3ab12d3 100644 --- a/src/OpenFOAM/primitives/char/charIO.C +++ b/src/OpenFOAM/primitives/char/charIO.C @@ -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 - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/complex/complex.C b/src/OpenFOAM/primitives/complex/complex.C index 0053cc6e57..bec6fefb0e 100644 --- a/src/OpenFOAM/primitives/complex/complex.C +++ b/src/OpenFOAM/primitives/complex/complex.C @@ -29,38 +29,33 @@ License #include -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -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 - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/complex/complex.H b/src/OpenFOAM/primitives/complex/complex.H index fe82ecfee2..1def519a99 100644 --- a/src/OpenFOAM/primitives/complex/complex.H +++ b/src/OpenFOAM/primitives/complex/complex.H @@ -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() {return true;} diff --git a/src/OpenFOAM/primitives/contiguous/contiguous.H b/src/OpenFOAM/primitives/contiguous/contiguous.H index ba5afbed15..3c272839a0 100644 --- a/src/OpenFOAM/primitives/contiguous/contiguous.H +++ b/src/OpenFOAM/primitives/contiguous/contiguous.H @@ -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 FixedList; template class Pair; -// Assume the data associated with type T is not contiguous +//- Assume the data associated with type T are not contiguous template -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() {return true;} @@ -143,7 +140,7 @@ inline bool contiguous() {return true;} template<> inline bool contiguous >() {return true;} template<> -inline bool contiguous >() {return true;} +inline bool contiguous >() {return true;} template<> inline bool contiguous() {return true;} diff --git a/src/OpenFOAM/primitives/diagTensor/diagTensor.H b/src/OpenFOAM/primitives/diagTensor/diagTensor.H index 31c8970b45..0a23ab1bf6 100644 --- a/src/OpenFOAM/primitives/diagTensor/diagTensor.H +++ b/src/OpenFOAM/primitives/diagTensor/diagTensor.H @@ -49,7 +49,7 @@ namespace Foam typedef DiagTensor diagTensor; -//- Specify data associated with diagTensor type is contiguous +//- Data associated with diagTensor type are contiguous template<> inline bool contiguous() {return true;} diff --git a/src/OpenFOAM/primitives/int/int.H b/src/OpenFOAM/primitives/int/int.H index e53a63ae11..e8abfacd47 100644 --- a/src/OpenFOAM/primitives/int/int.H +++ b/src/OpenFOAM/primitives/int/int.H @@ -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); diff --git a/src/OpenFOAM/primitives/int/intIO.C b/src/OpenFOAM/primitives/int/intIO.C index e8812cc58a..b7a70228c0 100644 --- a/src/OpenFOAM/primitives/int/intIO.C +++ b/src/OpenFOAM/primitives/int/intIO.C @@ -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 - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/label/label.C b/src/OpenFOAM/primitives/label/label.C index 5d4d7dd2bb..5487b39761 100644 --- a/src/OpenFOAM/primitives/label/label.C +++ b/src/OpenFOAM/primitives/label/label.C @@ -38,8 +38,8 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // const char* const pTraits