Commit 93a3a4fc authored by Mark Olesen's avatar Mark Olesen
Browse files

replace const List with UList in some constructors

parent a2f5eab5
......@@ -67,7 +67,7 @@ public:
(
const UList<T>& posList,
const UList<T>& negList,
const List<label>&
const UList<label>&
);
......
......@@ -31,7 +31,7 @@ inline Foam::BiIndirectList<T>::BiIndirectList
(
const UList<T>& posList,
const UList<T>& negList,
const List<label>& addr
const UList<label>& addr
)
:
posList_(const_cast<UList<T>&>(posList)),
......
......@@ -88,11 +88,11 @@ public:
inline Hash();
//- Rotating Hash. From http://burtleburtle.net/bob/hash/doobs.html.
label operator()(const FixedList<T, Size>& fl) const;
label operator()(const FixedList<T, Size>&) const;
label operator()
(
const FixedList<T, Size>& fl,
const FixedList<T, Size>&,
const label tableSize
) const;
};
......@@ -160,6 +160,9 @@ public:
// needed to make FixedList consistent with List
inline void setSize(const label);
//- Copy (not transfer) the argument contents
// needed to make FixedList consistent with List
void transfer(const FixedList<T, Size>&);
//- Write the FixedList as a dictionary entry
void writeEntry(Ostream& os) const;
......
......@@ -33,6 +33,7 @@ template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList()
{}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const T v[Size])
{
......@@ -42,6 +43,7 @@ inline Foam::FixedList<T, Size>::FixedList(const T v[Size])
}
}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const T& t)
{
......@@ -51,27 +53,29 @@ inline Foam::FixedList<T, Size>::FixedList(const T& t)
}
}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const UList<T>& ul)
inline Foam::FixedList<T, Size>::FixedList(const UList<T>& lst)
{
checkSize(ul.size());
checkSize(lst.size());
for (register label i=0; i<Size; i++)
{
v_[i] = ul[i];
v_[i] = lst[i];
}
}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const SLList<T>& sll)
inline Foam::FixedList<T, Size>::FixedList(const SLList<T>& lst)
{
checkSize(sll.size());
checkSize(lst.size());
register label i = 0;
for
(
typename SLList<T>::const_iterator iter = sll.begin();
iter != sll.end();
typename SLList<T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
......@@ -79,15 +83,17 @@ inline Foam::FixedList<T, Size>::FixedList(const SLList<T>& sll)
}
}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const FixedList<T, Size>& fl)
inline Foam::FixedList<T, Size>::FixedList(const FixedList<T, Size>& lst)
{
for (register label i=0; i<Size; i++)
{
v_[i] = fl[i];
v_[i] = lst[i];
}
}
template<class T, Foam::label Size>
inline Foam::autoPtr<Foam::FixedList<T, Size> >
Foam::FixedList<T, Size>::clone() const
......@@ -101,14 +107,14 @@ Foam::FixedList<T, Size>::clone() const
template<class T, Foam::label Size>
inline Foam::label Foam::FixedList<T, Size>::fcIndex(const label i) const
{
return (i == Size-1 ? 0 : i+1);
return (i == Size-1 ? 0 : i+1);
}
template<class T, Foam::label Size>
inline Foam::label Foam::FixedList<T, Size>::rcIndex(const label i) const
{
return (i == 0 ? Size-1 : i-1);
return (i == 0 ? Size-1 : i-1);
}
......@@ -165,6 +171,14 @@ inline void Foam::FixedList<T, Size>::setSize(const label s)
# endif
}
template<class T, Foam::label Size>
inline void Foam::FixedList<T, Size>::transfer(const FixedList<T, Size>& lst)
{
for (register label i=0; i<Size; i++)
{
v_[i] = lst[i];
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
......@@ -191,35 +205,35 @@ inline const T& Foam::FixedList<T, Size>::operator[](const label i) const
template<class T, Foam::label Size>
inline void Foam::FixedList<T, Size>::operator=(const T v[Size])
inline void Foam::FixedList<T, Size>::operator=(const T lst[Size])
{
for (register label i=0; i<Size; i++)
{
v_[i] = v[i];
v_[i] = lst[i];
}
}
template<class T, Foam::label Size>
inline void Foam::FixedList<T, Size>::operator=(const UList<T>& ul)
inline void Foam::FixedList<T, Size>::operator=(const UList<T>& lst)
{
checkSize(ul.size());
checkSize(lst.size());
for (register label i=0; i<Size; i++)
{
v_[i] = ul[i];
v_[i] = lst[i];
}
}
template<class T, Foam::label Size>
inline void Foam::FixedList<T, Size>::operator=(const SLList<T>& sll)
inline void Foam::FixedList<T, Size>::operator=(const SLList<T>& lst)
{
checkSize(sll.size());
checkSize(lst.size());
register label i = 0;
for
(
typename SLList<T>::const_iterator iter = sll.begin();
iter != sll.end();
typename SLList<T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
......@@ -329,12 +343,12 @@ template<class HashT>
inline Foam::FixedList<T, Size>::Hash<HashT>::Hash()
{}
//- Rotating Hash. From http://burtleburtle.net/bob/hash/doobs.html.
//- Rotating Hash. From http://burtleburtle.net/bob/hash/doobs.html
template<class T, Foam::label Size>
template<class HashT>
inline Foam::label Foam::FixedList<T, Size>::Hash<HashT>::operator()
(
const FixedList<T, Size>& fl
const FixedList<T, Size>& lst
) const
{
static const label farbit(8*sizeof(label)-4);
......@@ -343,7 +357,7 @@ inline Foam::label Foam::FixedList<T, Size>::Hash<HashT>::operator()
for (register int i=0; i<Size; i++)
{
val = (val<<4)^(val>>farbit)^HashT()(fl[i]);
val = (val<<4)^(val>>farbit)^HashT()(lst[i]);
}
return val;
......@@ -353,11 +367,11 @@ template<class T, Foam::label Size>
template<class HashT>
inline Foam::label Foam::FixedList<T, Size>::Hash<HashT>::operator()
(
const FixedList<T, Size>& fl,
const FixedList<T, Size>& lst,
const label tableSize
) const
{
return mag(operator()(fl)) % tableSize;
return mag(operator()(lst)) % tableSize;
}
#endif
......
......@@ -61,7 +61,7 @@ public:
// Constructors
//- Construct given the complete list and the addressing array
inline IndirectList(const UList<T>&, const List<label>&);
inline IndirectList(const UList<T>&, const UList<label>&);
// Member Functions
......@@ -75,7 +75,7 @@ public:
// Edit
//- Reset addressing
void resetAddressing(const List<label>& addr);
void resetAddressing(const UList<label>&);
// Member Operators
......
......@@ -30,7 +30,7 @@ template<class T>
inline Foam::IndirectList<T>::IndirectList
(
const UList<T>& completeList,
const List<label>& addr
const UList<label>& addr
)
:
completeList_(const_cast<UList<T>&>(completeList)),
......@@ -64,7 +64,7 @@ inline const Foam::List<Foam::label>& Foam::IndirectList<T>::addressing() const
template<class T>
inline void Foam::IndirectList<T>::resetAddressing
(
const List<label>& addr
const UList<label>& addr
)
{
addressing_ = addr;
......
......@@ -206,7 +206,7 @@ Foam::List<T>::List(InputIterator first, InputIterator last)
// Construct as copy of FixedList<T, Size>
template<class T>
template<Foam::label Size>
Foam::List<T>::List(const FixedList<T, Size>& fl)
Foam::List<T>::List(const FixedList<T, Size>& lst)
:
UList<T>(NULL, Size)
{
......@@ -216,7 +216,7 @@ Foam::List<T>::List(const FixedList<T, Size>& fl)
forAll(*this, i)
{
this->operator[](i) = fl[i];
this->operator[](i) = lst[i];
}
}
else
......@@ -228,9 +228,9 @@ Foam::List<T>::List(const FixedList<T, Size>& fl)
// Construct as copy of PtrList<T>
template<class T>
Foam::List<T>::List(const PtrList<T>& sptrl)
Foam::List<T>::List(const PtrList<T>& lst)
:
UList<T>(NULL, sptrl.size())
UList<T>(NULL, lst.size())
{
if (this->size_)
{
......@@ -238,7 +238,7 @@ Foam::List<T>::List(const PtrList<T>& sptrl)
forAll(*this, i)
{
this->operator[](i) = sptrl[i];
this->operator[](i) = lst[i];
}
}
else
......@@ -250,9 +250,9 @@ Foam::List<T>::List(const PtrList<T>& sptrl)
// Construct as copy of SLList<T>
template<class T>
Foam::List<T>::List(const SLList<T>& sll)
Foam::List<T>::List(const SLList<T>& lst)
:
UList<T>(NULL, sll.size())
UList<T>(NULL, lst.size())
{
if (this->size_)
{
......@@ -261,8 +261,8 @@ Foam::List<T>::List(const SLList<T>& sll)
label i = 0;
for
(
typename SLList<T>::const_iterator iter = sll.begin();
iter != sll.end();
typename SLList<T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
......@@ -278,9 +278,9 @@ Foam::List<T>::List(const SLList<T>& sll)
// Construct as copy of IndirectList<T>
template<class T>
Foam::List<T>::List(const IndirectList<T>& idl)
Foam::List<T>::List(const IndirectList<T>& lst)
:
UList<T>(NULL, idl.size())
UList<T>(NULL, lst.size())
{
if (this->size_)
{
......@@ -288,7 +288,7 @@ Foam::List<T>::List(const IndirectList<T>& idl)
forAll(*this, i)
{
this->operator[](i) = idl[i];
this->operator[](i) = lst[i];
}
}
else
......@@ -300,9 +300,9 @@ Foam::List<T>::List(const IndirectList<T>& idl)
// Construct as copy of BiIndirectList<T>
template<class T>
Foam::List<T>::List(const BiIndirectList<T>& idl)
Foam::List<T>::List(const BiIndirectList<T>& lst)
:
UList<T>(NULL, idl.size())
UList<T>(NULL, lst.size())
{
if (this->size_)
{
......@@ -310,7 +310,7 @@ Foam::List<T>::List(const BiIndirectList<T>& idl)
forAll(*this, i)
{
this->operator[](i) = idl[i];
this->operator[](i) = lst[i];
}
}
else
......@@ -522,13 +522,13 @@ void Foam::List<T>::operator=(const List<T>& a)
// Assignment operator. Takes linear time.
template<class T>
void Foam::List<T>::operator=(const SLList<T>& sll)
void Foam::List<T>::operator=(const SLList<T>& lst)
{
if (sll.size() != this->size_)
if (lst.size() != this->size_)
{
if (this->v_) delete[] this->v_;
this->v_ = 0;
this->size_ = sll.size();
this->size_ = lst.size();
if (this->size_) this->v_ = new T[this->size_];
}
......@@ -537,8 +537,8 @@ void Foam::List<T>::operator=(const SLList<T>& sll)
label i = 0;
for
(
typename SLList<T>::const_iterator iter = sll.begin();
iter != sll.end();
typename SLList<T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
......@@ -550,13 +550,13 @@ void Foam::List<T>::operator=(const SLList<T>& sll)
// Assignment operator. Takes linear time.
template<class T>
void Foam::List<T>::operator=(const IndirectList<T>& idl)
void Foam::List<T>::operator=(const IndirectList<T>& lst)
{
if (idl.size() != this->size_)
if (lst.size() != this->size_)
{
if (this->v_) delete[] this->v_;
this->v_ = 0;
this->size_ = idl.size();
this->size_ = lst.size();
if (this->size_) this->v_ = new T[this->size_];
}
......@@ -564,7 +564,7 @@ void Foam::List<T>::operator=(const IndirectList<T>& idl)
{
forAll(*this, i)
{
this->operator[](i) = idl[i];
this->operator[](i) = lst[i];
}
}
}
......@@ -572,13 +572,13 @@ void Foam::List<T>::operator=(const IndirectList<T>& idl)
// Assignment operator. Takes linear time.
template<class T>
void Foam::List<T>::operator=(const BiIndirectList<T>& idl)
void Foam::List<T>::operator=(const BiIndirectList<T>& lst)
{
if (idl.size() != this->size_)
if (lst.size() != this->size_)
{
if (this->v_) delete[] this->v_;
this->v_ = 0;
this->size_ = idl.size();
this->size_ = lst.size();
if (this->size_) this->v_ = new T[this->size_];
}
......@@ -586,7 +586,7 @@ void Foam::List<T>::operator=(const BiIndirectList<T>& idl)
{
forAll(*this, i)
{
this->operator[](i) = idl[i];
this->operator[](i) = lst[i];
}
}
}
......
......@@ -125,7 +125,7 @@ void Foam::ParSortableList<Type>::checkAndSend
// Construct from List, sorting the elements
template <class Type>
Foam::ParSortableList<Type>::ParSortableList(const List<Type>& values)
Foam::ParSortableList<Type>::ParSortableList(const UList<Type>& values)
:
List<Type>(values),
indices_(0),
......
......@@ -173,7 +173,7 @@ public:
// Constructors
//- Construct from List, sorting the elements.
ParSortableList(const List<Type>&);
ParSortableList(const UList<Type>&);
//- Construct given size. Sort later on.
ParSortableList(const label size);
......@@ -181,10 +181,9 @@ public:
// Member Functions
//- Sort the list (if changed after construction time)
//- (stable) sort the list (if changed after construction time)
void sort();
//- Return the list of sorted point indices
const labelList& indices() const
{
......
......@@ -118,7 +118,6 @@ public:
//- (stable) sort the list (if changed after construction time)
void sort();
// Member Operators
void operator=(const SortableList<Type>&);
......
......@@ -27,14 +27,9 @@ License
#include "boundBox.H"
#include "PstreamReduceOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
boundBox::boundBox(const pointField& points, const bool doReduce)
Foam::boundBox::boundBox(const pointField& points, const bool doReduce)
:
min_(vector::zero),
max_(vector::zero)
......@@ -78,7 +73,7 @@ boundBox::boundBox(const pointField& points, const bool doReduce)
}
boundBox::boundBox(Istream& is)
Foam::boundBox::boundBox(Istream& is)
{
operator>>(is, *this);
}
......@@ -86,7 +81,7 @@ boundBox::boundBox(Istream& is)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Ostream& operator<<(Ostream& os, const boundBox& bb)
Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
{
if (os.format() == IOstream::ASCII)
{
......@@ -108,7 +103,7 @@ Ostream& operator<<(Ostream& os, const boundBox& bb)
}
Istream& operator>>(Istream& is, boundBox& bb)
Foam::Istream& Foam::operator>>(Istream& is, boundBox& bb)
{
if (is.format() == IOstream::ASCII)
{
......@@ -129,9 +124,4 @@ Istream& operator>>(Istream& is, boundBox& bb)
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -75,8 +75,8 @@ public:
//- Construct given size
explicit inline cell(label);
//- Construct from components
explicit inline cell(const labelList&);
//- Construct from list of labels
explicit inline cell(const UList<label>&);
//- Construct by transferring the parameter contents
explicit inline cell(const xfer<labelList>&);
......
......@@ -41,7 +41,7 @@ inline Foam::cell::cell(label s)
// Construct from components
inline Foam::cell::cell(const labelList& lst)
inline Foam::cell::cell(const UList<label>& lst)
:
labelList(lst)
{}
......
......@@ -89,21 +89,21 @@ public:
// Access
//- Return ith face
inline triFace face(const label facei) const;
//- Return i-th face
inline triFace face(const label faceI) const;
//- Return fisrt face adjacent to the given edge
inline label edgeFace(const label edgei) const;
//- Return first face adjacent to the given edge
inline label edgeFace(const label edgeI) const;
//- Return face adjacent to the given face sharing the same edge
inline label edgeAdjacentFace
(
const label edgei,
const label facei
const label edgeI,
const label faceI
) const;
//- Return ith edge
inline edge tetEdge(const label edgei) const;
//- Return i-th edge
inline edge tetEdge(const label edgeI) const;
// Operations
......
......@@ -28,20 +28,13 @@ Description
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct null
inline tetCell::tetCell()
inline Foam::tetCell::tetCell()
{}
//- Construct from components
inline tetCell::tetCell