Converted constant reference to primitive arguments to constant primitive arguments.

This commit is contained in:
henry
2009-10-26 22:45:21 +00:00
parent 86c3affb5b
commit 278e8c5030
24 changed files with 48 additions and 55 deletions

View File

@ -220,7 +220,7 @@ void Foam::writeFuns::writePointDataHeader
} }
void Foam::writeFuns::insert(const scalar& pt, DynamicList<floatScalar>& dest) void Foam::writeFuns::insert(const scalar pt, DynamicList<floatScalar>& dest)
{ {
dest.append(float(pt)); dest.append(float(pt));
} }

View File

@ -86,7 +86,7 @@ public:
// Convert to VTK and store // Convert to VTK and store
static void insert(const scalar&, DynamicList<floatScalar>&); static void insert(const scalar, DynamicList<floatScalar>&);
static void insert(const point&, DynamicList<floatScalar>&); static void insert(const point&, DynamicList<floatScalar>&);
static void insert(const sphericalTensor&, DynamicList<floatScalar>&); static void insert(const sphericalTensor&, DynamicList<floatScalar>&);
static void insert(const symmTensor&, DynamicList<floatScalar>&); static void insert(const symmTensor&, DynamicList<floatScalar>&);

View File

@ -42,7 +42,7 @@ Foam::scalarRange::scalarRange()
{} {}
Foam::scalarRange::scalarRange(const scalar& lower, const scalar& upper) Foam::scalarRange::scalarRange(const scalar lower, const scalar upper)
: :
type_(RANGE), type_(RANGE),
value_(lower), value_(lower),
@ -123,7 +123,7 @@ Foam::scalar Foam::scalarRange::upper() const
} }
bool Foam::scalarRange::selected(const scalar& value) const bool Foam::scalarRange::selected(const scalar value) const
{ {
switch (type_) switch (type_)
{ {

View File

@ -92,7 +92,7 @@ public:
scalarRange(); scalarRange();
//- Construct a Range //- Construct a Range
scalarRange(const scalar& lower, const scalar& upper); scalarRange(const scalar lower, const scalar upper);
//- Construct from Istream. //- Construct from Istream.
// Since commas can be used as list delimiters, // Since commas can be used as list delimiters,
@ -119,7 +119,7 @@ public:
scalar upper() const; scalar upper() const;
//- Return true if the value is within the range //- Return true if the value is within the range
bool selected(const scalar&) const; bool selected(const scalar) const;
// Member Operators // Member Operators

View File

@ -57,7 +57,7 @@ Foam::scalarRanges::scalarRanges(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::scalarRanges::selected(const scalar& value) const bool Foam::scalarRanges::selected(const scalar value) const
{ {
forAll(*this, i) forAll(*this, i)
{ {

View File

@ -66,7 +66,7 @@ public:
// Member Functions // Member Functions
//- Return true if the given value is within the ranges //- Return true if the given value is within the ranges
bool selected(const scalar&) const; bool selected(const scalar) const;
//- Return the set of selected entries in the given list //- Return the set of selected entries in the given list
// that are within the ranges // that are within the ranges

View File

@ -45,13 +45,13 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Conversion from degrees to radians //- Conversion from degrees to radians
inline scalar degToRad(const scalar& deg) inline scalar degToRad(const scalar deg)
{ {
return (deg*pi/180.0); return (deg*pi/180.0);
} }
//- Conversion from radians to degrees //- Conversion from radians to degrees
inline scalar radToDeg(const scalar& rad) inline scalar radToDeg(const scalar rad)
{ {
return (rad*180.0/pi); return (rad*180.0/pi);
} }

View File

@ -76,7 +76,7 @@ public:
{} {}
//- Construct from components //- Construct from components
objectHit(const bool success, const label& obj) objectHit(const bool success, const label obj)
: :
hit_(success), hit_(success),
hitObject_(obj) hitObject_(obj)
@ -111,7 +111,7 @@ public:
{ {
return ((a.hit_ == b.hit_) && (a.hitObject_ == b.hitObject_)); return ((a.hit_ == b.hit_) && (a.hitObject_ == b.hitObject_));
} }
friend bool operator!=(const objectHit& a, const objectHit& b) friend bool operator!=(const objectHit& a, const objectHit& b)
{ {
return (!(a == b)); return (!(a == b));

View File

@ -107,7 +107,7 @@ public:
//- Incrementally hash a label. //- Incrementally hash a label.
// This will necessarily return a different value than the // This will necessarily return a different value than the
// non-incremental version. // non-incremental version.
unsigned operator()(const label& p, unsigned seed) const unsigned operator()(const label p, unsigned seed) const
{ {
return Hasher(&p, sizeof(label), seed); return Hasher(&p, sizeof(label), seed);
} }
@ -115,11 +115,10 @@ public:
//- Return the unsigned representation of a label. //- Return the unsigned representation of a label.
// This helps if people have relied on the hash value corresponding to // This helps if people have relied on the hash value corresponding to
// the natural order. // the natural order.
unsigned operator()(const label& p) const unsigned operator()(const label p) const
{ {
return p; return p;
} }
}; };

View File

@ -47,8 +47,7 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// construct given seed Random::Random(const label seed)
Random::Random(const label& seed)
{ {
if (seed > 1) if (seed > 1)
{ {

View File

@ -61,7 +61,7 @@ public:
// Constructors // Constructors
//- Construct given seed //- Construct given seed
Random(const label&); Random(const label);
// Member functions // Member functions
@ -70,14 +70,19 @@ public:
//- scalar [0..1] (so including 0,1) //- scalar [0..1] (so including 0,1)
scalar scalar01(); scalar scalar01();
//- vector with every component scalar01 //- vector with every component scalar01
vector vector01(); vector vector01();
//- sphericalTensor with every component scalar01 //- sphericalTensor with every component scalar01
sphericalTensor sphericalTensor01(); sphericalTensor sphericalTensor01();
//- symmTensor with every component scalar01 //- symmTensor with every component scalar01
symmTensor symmTensor01(); symmTensor symmTensor01();
//- tensor with every component scalar01 //- tensor with every component scalar01
tensor tensor01(); tensor tensor01();
//- label [lower..upper] //- label [lower..upper]
label integer(const label lower, const label upper); label integer(const label lower, const label upper);

View File

@ -74,7 +74,7 @@ bool Foam::ensightFile::allowUndef(bool value)
} }
Foam::scalar Foam::ensightFile::undefValue(const scalar& value) Foam::scalar Foam::ensightFile::undefValue(const scalar value)
{ {
// enable its use too // enable its use too
allowUndef_ = true; allowUndef_ = true;
@ -133,7 +133,7 @@ Foam::Ostream& Foam::ensightFile::write(const string& value)
} }
Foam::Ostream& Foam::ensightFile::write(const label& value) Foam::Ostream& Foam::ensightFile::write(const label value)
{ {
if (format() == IOstream::BINARY) if (format() == IOstream::BINARY)
{ {
@ -157,7 +157,7 @@ Foam::Ostream& Foam::ensightFile::write(const label& value)
Foam::Ostream& Foam::ensightFile::write Foam::Ostream& Foam::ensightFile::write
( (
const label& value, const label value,
const label fieldWidth const label fieldWidth
) )
{ {
@ -181,7 +181,7 @@ Foam::Ostream& Foam::ensightFile::write
} }
Foam::Ostream& Foam::ensightFile::write(const scalar& value) Foam::Ostream& Foam::ensightFile::write(const scalar value)
{ {
if (format() == IOstream::BINARY) if (format() == IOstream::BINARY)
{ {

View File

@ -103,7 +103,7 @@ public:
//- Assign the value to represent undef in the results //- Assign the value to represent undef in the results
// Returns the previous value // Returns the previous value
// NB: do not use values larger than floatScalarVGREAT // NB: do not use values larger than floatScalarVGREAT
static scalar undefValue(const scalar&); static scalar undefValue(const scalar);
// Output // Output
@ -124,13 +124,13 @@ public:
Ostream& write(const string& value); Ostream& write(const string& value);
//- write integer as "%10d" or as binary //- write integer as "%10d" or as binary
Ostream& write(const label& value); Ostream& write(const label value);
//- write integer with specified width or as binary //- write integer with specified width or as binary
Ostream& write(const label& value, const label fieldWidth); Ostream& write(const label value, const label fieldWidth);
//- write float as "%12.5e" or as binary //- write float as "%12.5e" or as binary
Ostream& write(const scalar& value); Ostream& write(const scalar value);
//- Add carriage return to ascii stream //- Add carriage return to ascii stream
void newline(); void newline();

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellTable.H" #include "cellTable.H"
@ -81,7 +79,7 @@ void Foam::cellTable::addDefaults()
void Foam::cellTable::setEntry void Foam::cellTable::setEntry
( (
const label& id, const label id,
const word& keyWord, const word& keyWord,
const word& value const word& value
) )
@ -192,7 +190,7 @@ Foam::Map<Foam::word> Foam::cellTable::names
} }
Foam::word Foam::cellTable::name(const label& id) const Foam::word Foam::cellTable::name(const label id) const
{ {
word theName("cellTable_" + Foam::name(id)); word theName("cellTable_" + Foam::name(id));
@ -289,19 +287,19 @@ Foam::Map<Foam::word> Foam::cellTable::shells() const
void Foam::cellTable::setMaterial(const label& id, const word& matlType) void Foam::cellTable::setMaterial(const label id, const word& matlType)
{ {
setEntry(id, "MaterialType", matlType); setEntry(id, "MaterialType", matlType);
} }
void Foam::cellTable::setName(const label& id, const word& name) void Foam::cellTable::setName(const label id, const word& name)
{ {
setEntry(id, "Label", name); setEntry(id, "Label", name);
} }
void Foam::cellTable::setName(const label& id) void Foam::cellTable::setName(const label id)
{ {
iterator iter = find(id); iterator iter = find(id);

View File

@ -96,7 +96,7 @@ class cellTable
//- Add required entries - MaterialType //- Add required entries - MaterialType
void addDefaults(); void addDefaults();
void setEntry(const label& id, const word& keyWord, const word& value); void setEntry(const label id, const word& keyWord, const word& value);
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
cellTable(const cellTable&); cellTable(const cellTable&);
@ -133,7 +133,7 @@ public:
//- Return the name corresponding to id //- Return the name corresponding to id
// returns cellTable_ID if not otherwise defined // returns cellTable_ID if not otherwise defined
word name(const label& id) const; word name(const label id) const;
//- Return a Map of (id => name) //- Return a Map of (id => name)
Map<word> names() const; Map<word> names() const;
@ -157,13 +157,13 @@ public:
Map<word> materialTypes() const; Map<word> materialTypes() const;
//- Assign material Type //- Assign material Type
void setMaterial(const label&, const word&); void setMaterial(const label, const word&);
//- Assign name //- Assign name
void setName(const label&, const word&); void setName(const label, const word&);
//- Assign default name if not already set //- Assign default name if not already set
void setName(const label&); void setName(const label);
//- Read constant/cellTable //- Read constant/cellTable
void readDict void readDict

View File

@ -1536,7 +1536,7 @@ void Foam::faceCoupleInfo::perfectPointMatch
FatalErrorIn FatalErrorIn
( (
"faceCoupleInfo::perfectPointMatch" "faceCoupleInfo::perfectPointMatch"
"(const scalar&, const bool)" "(const scalar, const bool)"
) << "Did not match all of the master faces to the slave faces" ) << "Did not match all of the master faces to the slave faces"
<< endl << endl
<< "This usually means that the slave patch and master patch" << "This usually means that the slave patch and master patch"

View File

@ -55,7 +55,7 @@ namespace Foam
class ifEqEqOp class ifEqEqOp
{ {
public: public:
void operator()(label& x, const label& y) const void operator()(label x, const label y) const
{ {
x = (x==y) ? x : value; x = (x==y) ? x : value;
} }

View File

@ -36,7 +36,7 @@ Foam::spline::spline(const pointField& knotPoints)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::spline::B(const scalar& tau) const Foam::scalar Foam::spline::B(const scalar tau) const
{ {
if (tau <= -2.0 || tau >= 2.0) if (tau <= -2.0 || tau >= 2.0)
{ {
@ -60,7 +60,7 @@ Foam::scalar Foam::spline::B(const scalar& tau) const
} }
else else
{ {
FatalErrorIn("spline::B(const scalar&)") FatalErrorIn("spline::B(const scalar)")
<< "Programming error???, " << "Programming error???, "
<< "tau = " << tau << "tau = " << tau
<< abort(FatalError); << abort(FatalError);

View File

@ -59,7 +59,7 @@ class spline
// Private Member Functions // Private Member Functions
//- Blending function for constructing spline //- Blending function for constructing spline
scalar B(const scalar&) const; scalar B(const scalar) const;
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
spline(const spline&); spline(const spline&);

View File

@ -158,10 +158,6 @@ public:
static const FixedList<vector, 6> faceNormals; static const FixedList<vector, 6> faceNormals;
//- Face on which neighbour is
static direction neighbourFaceBits(const label&);
// Constructors // Constructors
//- Construct null setting points to zero //- Construct null setting points to zero

View File

@ -507,7 +507,7 @@ void Foam::MeshedSurface<Face>::movePoints(const pointField& newPoints)
template<class Face> template<class Face>
void Foam::MeshedSurface<Face>::scalePoints(const scalar& scaleFactor) void Foam::MeshedSurface<Face>::scalePoints(const scalar scaleFactor)
{ {
// avoid bad scaling // avoid bad scaling
if (scaleFactor > 0 && scaleFactor != 1.0) if (scaleFactor > 0 && scaleFactor != 1.0)

View File

@ -338,7 +338,7 @@ public:
virtual void movePoints(const pointField&); virtual void movePoints(const pointField&);
//- Scale points. A non-positive factor is ignored //- Scale points. A non-positive factor is ignored
virtual void scalePoints(const scalar&); virtual void scalePoints(const scalar);
//- Reset primitive data (points, faces and zones) //- Reset primitive data (points, faces and zones)
// Note, optimized to avoid overwriting data (with Xfer::null) // Note, optimized to avoid overwriting data (with Xfer::null)

View File

@ -33,8 +33,6 @@ License
#include "SortableList.H" #include "SortableList.H"
#include "PackedBoolList.H" #include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
@ -783,7 +781,6 @@ const Foam::labelList& Foam::triSurface::edgeOwner() const
} }
//- Move points
void Foam::triSurface::movePoints(const pointField& newPoints) void Foam::triSurface::movePoints(const pointField& newPoints)
{ {
// Remove all geometry dependent data // Remove all geometry dependent data
@ -797,8 +794,7 @@ void Foam::triSurface::movePoints(const pointField& newPoints)
} }
// scale points void Foam::triSurface::scalePoints(const scalar scaleFactor)
void Foam::triSurface::scalePoints(const scalar& scaleFactor)
{ {
// avoid bad scaling // avoid bad scaling
if (scaleFactor > 0 && scaleFactor != 1.0) if (scaleFactor > 0 && scaleFactor != 1.0)

View File

@ -324,7 +324,7 @@ public:
virtual void movePoints(const pointField&); virtual void movePoints(const pointField&);
//- Scale points. A non-positive factor is ignored //- Scale points. A non-positive factor is ignored
virtual void scalePoints(const scalar&); virtual void scalePoints(const scalar);
//- Check/remove duplicate/degenerate triangles //- Check/remove duplicate/degenerate triangles
void checkTriangles(const bool verbose); void checkTriangles(const bool verbose);