mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
src/OpenFOAM/containers: Updated formatting and comments
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -88,7 +88,6 @@ Foam::DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Find and return T
|
||||
template<class IDLListType, class T>
|
||||
bool Foam::DictionaryBase<IDLListType, T>::found(const word& keyword) const
|
||||
{
|
||||
@ -96,7 +95,6 @@ bool Foam::DictionaryBase<IDLListType, T>::found(const word& keyword) const
|
||||
}
|
||||
|
||||
|
||||
// Find and return T*, return NULL if not found
|
||||
template<class IDLListType, class T>
|
||||
const T* Foam::DictionaryBase<IDLListType, T>::lookupPtr
|
||||
(
|
||||
@ -116,7 +114,6 @@ const T* Foam::DictionaryBase<IDLListType, T>::lookupPtr
|
||||
}
|
||||
|
||||
|
||||
// Find and return T*, return NULL if not found
|
||||
template<class IDLListType, class T>
|
||||
T* Foam::DictionaryBase<IDLListType, T>::lookupPtr(const word& keyword)
|
||||
{
|
||||
@ -133,7 +130,6 @@ T* Foam::DictionaryBase<IDLListType, T>::lookupPtr(const word& keyword)
|
||||
}
|
||||
|
||||
|
||||
// Find and return T*, FatalError if keyword not found
|
||||
template<class IDLListType, class T>
|
||||
const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
||||
{
|
||||
@ -150,7 +146,6 @@ const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
||||
}
|
||||
|
||||
|
||||
// Find and return T*, FatalError if keyword not found
|
||||
template<class IDLListType, class T>
|
||||
T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
||||
{
|
||||
@ -167,7 +162,6 @@ T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
||||
}
|
||||
|
||||
|
||||
// Return the table of contents
|
||||
template<class IDLListType, class T>
|
||||
Foam::wordList Foam::DictionaryBase<IDLListType, T>::toc() const
|
||||
{
|
||||
@ -188,7 +182,6 @@ Foam::wordList Foam::DictionaryBase<IDLListType, T>::toc() const
|
||||
}
|
||||
|
||||
|
||||
// Add at head of dictionary
|
||||
template<class IDLListType, class T>
|
||||
void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
||||
{
|
||||
@ -198,7 +191,6 @@ void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
||||
}
|
||||
|
||||
|
||||
// Add at tail of dictionary
|
||||
template<class IDLListType, class T>
|
||||
void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,7 +28,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct given initial table size
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::HashPtrTable<T, Key, Hash>::HashPtrTable(const label size)
|
||||
:
|
||||
@ -36,7 +35,6 @@ Foam::HashPtrTable<T, Key, Hash>::HashPtrTable(const label size)
|
||||
{}
|
||||
|
||||
|
||||
// Construct as copy
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::HashPtrTable<T, Key, Hash>::HashPtrTable
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -166,7 +166,6 @@ void Foam::HashSet<Key, Hash>::operator^=(const HashSet<Key, Hash>& rhs)
|
||||
}
|
||||
|
||||
|
||||
// same as HashTable::erase()
|
||||
template<class Key, class Hash>
|
||||
void Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
|
||||
{
|
||||
|
||||
@ -363,15 +363,13 @@ bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// NOTE:
|
||||
// We use (const iterator&) here, but manipulate its contents anyhow.
|
||||
// The parameter should be (iterator&), but then the compiler doesn't find
|
||||
// it correctly and tries to call as (iterator) instead.
|
||||
//
|
||||
template<class T, class Key, class Hash>
|
||||
bool Foam::HashTable<T, Key, Hash>::erase(const iterator& iter)
|
||||
{
|
||||
// NOTE: We use (const iterator&) here, but manipulate its contents anyhow.
|
||||
// The parameter should be (iterator&), but then the compiler doesn't find
|
||||
// it correctly and tries to call as (iterator) instead.
|
||||
//
|
||||
// Adjust iterator after erase
|
||||
return const_cast<iterator&>(iter).erase();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,7 +76,6 @@ bool Foam::UILList<LListBase, T>::operator==
|
||||
}
|
||||
|
||||
|
||||
// Comparison for inequality
|
||||
template<class LListBase, class T>
|
||||
bool Foam::UILList<LListBase, T>::operator!=
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -44,7 +44,7 @@ inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList
|
||||
List<T>(nElem),
|
||||
capacity_(nElem)
|
||||
{
|
||||
// we could also enforce SizeInc granularity when (!SizeMult || !SizeDiv)
|
||||
// We could also enforce SizeInc granularity when (!SizeMult || !SizeDiv)
|
||||
List<T>::size(0);
|
||||
}
|
||||
|
||||
@ -115,10 +115,11 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setCapacity
|
||||
|
||||
if (nextFree > capacity_)
|
||||
{
|
||||
// truncate addressed sizes too
|
||||
// Truncate addressed sizes too
|
||||
nextFree = capacity_;
|
||||
}
|
||||
// we could also enforce SizeInc granularity when (!SizeMult || !SizeDiv)
|
||||
|
||||
// We could also enforce SizeInc granularity when (!SizeMult || !SizeDiv)
|
||||
|
||||
List<T>::setSize(capacity_);
|
||||
List<T>::size(nextFree);
|
||||
@ -131,7 +132,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::reserve
|
||||
const label nElem
|
||||
)
|
||||
{
|
||||
// allocate more capacity?
|
||||
// Allocate more capacity?
|
||||
if (nElem > capacity_)
|
||||
{
|
||||
// TODO: convince the compiler that division by zero does not occur
|
||||
@ -154,7 +155,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::reserve
|
||||
);
|
||||
}
|
||||
|
||||
// adjust allocated size, leave addressed size untouched
|
||||
// Adjust allocated size, leave addressed size untouched
|
||||
label nextFree = List<T>::size();
|
||||
List<T>::setSize(capacity_);
|
||||
List<T>::size(nextFree);
|
||||
@ -168,7 +169,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
|
||||
const label nElem
|
||||
)
|
||||
{
|
||||
// allocate more capacity?
|
||||
// Allocate more capacity?
|
||||
if (nElem > capacity_)
|
||||
{
|
||||
// TODO: convince the compiler that division by zero does not occur
|
||||
@ -194,7 +195,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
|
||||
List<T>::setSize(capacity_);
|
||||
}
|
||||
|
||||
// adjust addressed size
|
||||
// Adjust addressed size
|
||||
List<T>::size(nElem);
|
||||
}
|
||||
|
||||
@ -209,7 +210,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
|
||||
label nextFree = List<T>::size();
|
||||
setSize(nElem);
|
||||
|
||||
// set new elements to constant value
|
||||
// Set new elements to constant value
|
||||
while (nextFree < nElem)
|
||||
{
|
||||
this->operator[](nextFree++) = t;
|
||||
@ -260,10 +261,10 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::shrink()
|
||||
label nextFree = List<T>::size();
|
||||
if (capacity_ > nextFree)
|
||||
{
|
||||
// use the full list when resizing
|
||||
// Use the full list when resizing
|
||||
List<T>::size(capacity_);
|
||||
|
||||
// the new size
|
||||
// The new size
|
||||
capacity_ = nextFree;
|
||||
List<T>::setSize(capacity_);
|
||||
List<T>::size(nextFree);
|
||||
@ -277,7 +278,7 @@ inline void
|
||||
Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer(List<T>& lst)
|
||||
{
|
||||
capacity_ = lst.size();
|
||||
List<T>::transfer(lst); // take over storage, clear addressing for lst.
|
||||
List<T>::transfer(lst); // Take over storage, clear addressing for lst.
|
||||
}
|
||||
|
||||
|
||||
@ -288,7 +289,7 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer
|
||||
DynamicList<T, SizeInc, SizeMult, SizeDiv>& lst
|
||||
)
|
||||
{
|
||||
// take over storage as-is (without shrink), clear addressing for lst.
|
||||
// Take over storage as-is (without shrink), clear addressing for lst.
|
||||
capacity_ = lst.capacity_;
|
||||
lst.capacity_ = 0;
|
||||
|
||||
@ -421,13 +422,13 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
|
||||
if (capacity_ >= lst.size())
|
||||
{
|
||||
// can copy w/o reallocating, match initial size to avoid reallocation
|
||||
// Can copy w/o reallocating, match initial size to avoid reallocation
|
||||
List<T>::size(lst.size());
|
||||
List<T>::operator=(lst);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make everything available for the copy operation
|
||||
// Make everything available for the copy operation
|
||||
List<T>::size(capacity_);
|
||||
|
||||
List<T>::operator=(lst);
|
||||
@ -444,13 +445,13 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
{
|
||||
if (capacity_ >= lst.size())
|
||||
{
|
||||
// can copy w/o reallocating, match initial size to avoid reallocation
|
||||
// Can copy w/o reallocating, match initial size to avoid reallocation
|
||||
List<T>::size(lst.size());
|
||||
List<T>::operator=(lst);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make everything available for the copy operation
|
||||
// Make everything available for the copy operation
|
||||
List<T>::size(capacity_);
|
||||
|
||||
List<T>::operator=(lst);
|
||||
@ -467,13 +468,13 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
{
|
||||
if (capacity_ >= lst.size())
|
||||
{
|
||||
// can copy w/o reallocating, match initial size to avoid reallocation
|
||||
// Can copy w/o reallocating, match initial size to avoid reallocation
|
||||
List<T>::size(lst.size());
|
||||
List<T>::operator=(lst);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make everything available for the copy operation
|
||||
// Make everything available for the copy operation
|
||||
List<T>::size(capacity_);
|
||||
|
||||
List<T>::operator=(lst);
|
||||
@ -481,4 +482,5 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -125,7 +125,6 @@ inline Foam::label Foam::FixedList<T, Size>::rcIndex(const label i) const
|
||||
}
|
||||
|
||||
|
||||
// Check start is within valid range (0 ... size-1).
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::checkStart(const label start) const
|
||||
{
|
||||
@ -138,7 +137,6 @@ inline void Foam::FixedList<T, Size>::checkStart(const label start) const
|
||||
}
|
||||
|
||||
|
||||
// Check size is within valid range (0 ... size).
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::checkSize(const label size) const
|
||||
{
|
||||
@ -151,8 +149,6 @@ inline void Foam::FixedList<T, Size>::checkSize(const label size) const
|
||||
}
|
||||
|
||||
|
||||
// Check index i is within valid range (0 ... size-1)
|
||||
// The check for zero-sized list is already done in static assert
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::checkIndex(const label i) const
|
||||
{
|
||||
@ -237,7 +233,6 @@ inline const T& Foam::FixedList<T, Size>::last() const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
// element access
|
||||
template<class T, unsigned Size>
|
||||
inline T& Foam::FixedList<T, Size>::operator[](const label i)
|
||||
{
|
||||
@ -248,7 +243,6 @@ inline T& Foam::FixedList<T, Size>::operator[](const label i)
|
||||
}
|
||||
|
||||
|
||||
// const element access
|
||||
template<class T, unsigned Size>
|
||||
inline const T& Foam::FixedList<T, Size>::operator[](const label i) const
|
||||
{
|
||||
@ -435,12 +429,12 @@ inline unsigned Foam::FixedList<T, Size>::Hash<HashT>::operator()
|
||||
{
|
||||
if (contiguous<T>())
|
||||
{
|
||||
// hash directly
|
||||
// Hash directly
|
||||
return Hasher(lst.v_, sizeof(lst.v_), seed);
|
||||
}
|
||||
else
|
||||
{
|
||||
// hash incrementally
|
||||
// Hash incrementally
|
||||
unsigned val = seed;
|
||||
|
||||
for (unsigned i=0; i<Size; i++)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -411,8 +411,6 @@ void Foam::inplaceSubset
|
||||
}
|
||||
|
||||
|
||||
// As clarification:
|
||||
// coded as inversion from pointEdges to edges but completely general.
|
||||
template<class InList, class OutList>
|
||||
void Foam::invertManyToMany
|
||||
(
|
||||
|
||||
@ -52,7 +52,7 @@ inline unsigned int Foam::PackedList<nBits>::packing()
|
||||
template<unsigned nBits>
|
||||
inline unsigned int Foam::PackedList<nBits>::maskLower(unsigned offset)
|
||||
{
|
||||
// return (1u << (nBits * offset)) - 1;
|
||||
// Return (1u << (nBits * offset)) - 1;
|
||||
// The next one works more reliably with overflows
|
||||
// eg, when compiled without optimization
|
||||
return (~0u >> ( sizeof(StorageType)*CHAR_BIT - nBits * offset));
|
||||
@ -266,8 +266,6 @@ Foam::PackedList<nBits>::clone() const
|
||||
|
||||
// * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
|
||||
|
||||
// iteratorBase
|
||||
|
||||
template<unsigned nBits>
|
||||
inline Foam::PackedList<nBits>::iteratorBase::iteratorBase()
|
||||
:
|
||||
@ -315,7 +313,7 @@ Foam::PackedList<nBits>::iteratorBase::set(const unsigned int val)
|
||||
|
||||
if (val >= max_value())
|
||||
{
|
||||
// overflow is max_value, fill everything
|
||||
// Overflow is max_value, fill everything
|
||||
stored |= mask;
|
||||
}
|
||||
else
|
||||
@ -372,7 +370,7 @@ inline void Foam::PackedList<nBits>::iteratorBase::operator=
|
||||
const unsigned int val
|
||||
)
|
||||
{
|
||||
// lazy evaluation - increase size on assigment
|
||||
// Lazy evaluation - increase size on assigment
|
||||
if (index_ >= list_->size_)
|
||||
{
|
||||
list_->resize(index_ + 1);
|
||||
@ -386,7 +384,7 @@ template<unsigned nBits>
|
||||
inline Foam::PackedList<nBits>::iteratorBase::operator
|
||||
unsigned int () const
|
||||
{
|
||||
// lazy evaluation - return 0 for out-of-range
|
||||
// Lazy evaluation - return 0 for out-of-range
|
||||
if (index_ >= list_->size_)
|
||||
{
|
||||
return 0;
|
||||
@ -396,8 +394,6 @@ unsigned int () const
|
||||
}
|
||||
|
||||
|
||||
// const_iterator, iterator
|
||||
|
||||
template<unsigned nBits>
|
||||
inline Foam::PackedList<nBits>::iterator::iterator()
|
||||
:
|
||||
@ -420,7 +416,7 @@ inline Foam::PackedList<nBits>::iterator::iterator
|
||||
:
|
||||
iteratorBase(iter)
|
||||
{
|
||||
// avoid going past end()
|
||||
// Avoid going past end()
|
||||
// eg, iter = iterator(list, Inf)
|
||||
if (this->index_ > this->list_->size_)
|
||||
{
|
||||
@ -437,7 +433,7 @@ inline Foam::PackedList<nBits>::const_iterator::const_iterator
|
||||
:
|
||||
iteratorBase(iter)
|
||||
{
|
||||
// avoid going past end()
|
||||
// Avoid going past end()
|
||||
// eg, iter = iterator(list, Inf)
|
||||
if (this->index_ > this->list_->size_)
|
||||
{
|
||||
@ -527,7 +523,7 @@ inline void Foam::PackedList<nBits>::iterator::operator=
|
||||
this->list_ = iter.list_;
|
||||
this->index_ = iter.index_;
|
||||
|
||||
// avoid going past end()
|
||||
// Avoid going past end()
|
||||
// eg, iter = iterator(list, Inf)
|
||||
if (this->index_ > this->list_->size_)
|
||||
{
|
||||
@ -545,7 +541,7 @@ inline void Foam::PackedList<nBits>::const_iterator::operator=
|
||||
this->list_ = iter.list_;
|
||||
this->index_ = iter.index_;
|
||||
|
||||
// avoid going past end()
|
||||
// Avoid going past end()
|
||||
// eg, iter = iterator(list, Inf)
|
||||
if (this->index_ > this->list_->size_)
|
||||
{
|
||||
@ -742,15 +738,15 @@ inline void Foam::PackedList<nBits>::resize
|
||||
|
||||
if (size_ > oldSize)
|
||||
{
|
||||
// fill new elements or newly exposed elements
|
||||
// Fill new elements or newly exposed elements
|
||||
if (val)
|
||||
{
|
||||
// fill value for complete segments
|
||||
// Fill value for complete segments
|
||||
unsigned int fill = val;
|
||||
|
||||
if (val >= max_value())
|
||||
{
|
||||
// fill everything
|
||||
// Fill everything
|
||||
fill = maskLower(packing());
|
||||
}
|
||||
else
|
||||
@ -761,7 +757,7 @@ inline void Foam::PackedList<nBits>::resize
|
||||
}
|
||||
}
|
||||
|
||||
// fill in complete segments
|
||||
// Fill in complete segments
|
||||
const label oldLen = packedLength(oldSize);
|
||||
const label newLen = packedLength(size_);
|
||||
for (label i=oldLen; i < newLen; ++i)
|
||||
@ -769,7 +765,7 @@ inline void Foam::PackedList<nBits>::resize
|
||||
StorageList::operator[](i) = fill;
|
||||
}
|
||||
|
||||
// finish previous partial segment, preserve existing value
|
||||
// Finish previous partial segment, preserve existing value
|
||||
{
|
||||
const unsigned int off = oldSize % packing();
|
||||
if (off)
|
||||
@ -783,7 +779,7 @@ inline void Foam::PackedList<nBits>::resize
|
||||
}
|
||||
|
||||
|
||||
// mask off the (new) final partial segment
|
||||
// Mask off the (new) final partial segment
|
||||
{
|
||||
const unsigned int off = size_ % packing();
|
||||
if (off)
|
||||
@ -797,10 +793,10 @@ inline void Foam::PackedList<nBits>::resize
|
||||
}
|
||||
else if (size_ < oldSize)
|
||||
{
|
||||
// resize shrinking
|
||||
// Resize shrinking
|
||||
// - clear newly exposed elements
|
||||
|
||||
// fill in complete segments
|
||||
// Fill in complete segments
|
||||
const label oldLen = packedLength(oldSize);
|
||||
const label newLen = packedLength(size_);
|
||||
for (label i=newLen; i < oldLen; ++i)
|
||||
@ -808,7 +804,7 @@ inline void Foam::PackedList<nBits>::resize
|
||||
StorageList::operator[](i) = 0u;
|
||||
}
|
||||
|
||||
// mask off the final partial segment
|
||||
// Mask off the final partial segment
|
||||
{
|
||||
const unsigned int off = size_ % packing();
|
||||
if (off)
|
||||
@ -846,12 +842,12 @@ inline void Foam::PackedList<nBits>::setCapacity(const label nElem)
|
||||
{
|
||||
StorageList::setSize(packedLength(nElem), 0u);
|
||||
|
||||
// truncate addressed size too
|
||||
// Truncate addressed size too
|
||||
if (size_ > nElem)
|
||||
{
|
||||
size_ = nElem;
|
||||
|
||||
// mask off the final partial segment
|
||||
// Mask off the final partial segment
|
||||
const unsigned int off = size_ % packing();
|
||||
if (off)
|
||||
{
|
||||
@ -868,7 +864,7 @@ inline void Foam::PackedList<nBits>::reserve(const label nElem)
|
||||
{
|
||||
const label len = packedLength(nElem);
|
||||
|
||||
// need more capacity?
|
||||
// Need more capacity?
|
||||
if (len > StorageList::size())
|
||||
{
|
||||
// Like DynamicList with SizeInc=0, SizeMult=2, SizeDiv=1
|
||||
@ -911,7 +907,7 @@ inline void Foam::PackedList<nBits>::clearStorage()
|
||||
template<unsigned nBits>
|
||||
inline void Foam::PackedList<nBits>::shrink()
|
||||
{
|
||||
// any uneed space allocated?
|
||||
// Any uneed space allocated?
|
||||
const label len = packedLength();
|
||||
if (len < StorageList::size())
|
||||
{
|
||||
@ -967,7 +963,7 @@ inline Foam::Xfer<Foam::PackedList<nBits>> Foam::PackedList<nBits>::xfer()
|
||||
template<unsigned nBits>
|
||||
inline unsigned int Foam::PackedList<nBits>::get(const label i) const
|
||||
{
|
||||
// lazy evaluation - return 0 for out-of-range
|
||||
// Lazy evaluation - return 0 for out-of-range
|
||||
if (i < 0 || i >= size_)
|
||||
{
|
||||
return 0;
|
||||
@ -982,7 +978,7 @@ inline unsigned int Foam::PackedList<nBits>::get(const label i) const
|
||||
template<unsigned nBits>
|
||||
inline unsigned int Foam::PackedList<nBits>::operator[](const label i) const
|
||||
{
|
||||
// lazy evaluation - return 0 for out-of-range
|
||||
// Lazy evaluation - return 0 for out-of-range
|
||||
if (i < 0 || i >= size_)
|
||||
{
|
||||
return 0;
|
||||
@ -1003,12 +999,12 @@ inline bool Foam::PackedList<nBits>::set
|
||||
{
|
||||
if (i < 0)
|
||||
{
|
||||
// lazy evaluation - ignore out-of-bounds
|
||||
// Lazy evaluation - ignore out-of-bounds
|
||||
return false;
|
||||
}
|
||||
else if (i >= size_)
|
||||
{
|
||||
// lazy evaluation - increase size on assigment
|
||||
// Lazy evaluation - increase size on assigment
|
||||
resize(i + 1);
|
||||
}
|
||||
|
||||
@ -1080,7 +1076,7 @@ inline void Foam::PackedList<nBits>::operator=(const unsigned int val)
|
||||
|
||||
if (val >= max_value())
|
||||
{
|
||||
// fill everything
|
||||
// Fill everything
|
||||
fill = maskLower(packing());
|
||||
}
|
||||
else
|
||||
@ -1096,7 +1092,7 @@ inline void Foam::PackedList<nBits>::operator=(const unsigned int val)
|
||||
StorageList::operator[](i) = fill;
|
||||
}
|
||||
|
||||
// mask off the final partial segment
|
||||
// Mask off the final partial segment
|
||||
{
|
||||
const unsigned int off = size_ % packing();
|
||||
if (off)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -48,7 +48,6 @@ void Foam::ParSortableList<Type>::write
|
||||
}
|
||||
|
||||
|
||||
// Copy src, starting at destI into dest.
|
||||
template<class Type>
|
||||
void Foam::ParSortableList<Type>::copyInto
|
||||
(
|
||||
@ -122,7 +121,6 @@ void Foam::ParSortableList<Type>::checkAndSend
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from List, sorting the elements
|
||||
template<class Type>
|
||||
Foam::ParSortableList<Type>::ParSortableList(const UList<Type>& values)
|
||||
:
|
||||
@ -134,7 +132,6 @@ Foam::ParSortableList<Type>::ParSortableList(const UList<Type>& values)
|
||||
}
|
||||
|
||||
|
||||
// Construct given size. Sort later on.
|
||||
template<class Type>
|
||||
Foam::ParSortableList<Type>::ParSortableList(const label size)
|
||||
:
|
||||
@ -146,7 +143,6 @@ Foam::ParSortableList<Type>::ParSortableList(const label size)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Sort
|
||||
template<class Type>
|
||||
void Foam::ParSortableList<Type>::sort()
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -68,7 +68,6 @@ inline Foam::label Foam::UList<T>::rcIndex(const label i) const
|
||||
}
|
||||
|
||||
|
||||
// Check start is within valid range (0 ... size-1).
|
||||
template<class T>
|
||||
inline void Foam::UList<T>::checkStart(const label start) const
|
||||
{
|
||||
@ -81,7 +80,6 @@ inline void Foam::UList<T>::checkStart(const label start) const
|
||||
}
|
||||
|
||||
|
||||
// Check size is within valid range (0 ... size).
|
||||
template<class T>
|
||||
inline void Foam::UList<T>::checkSize(const label size) const
|
||||
{
|
||||
@ -94,7 +92,6 @@ inline void Foam::UList<T>::checkSize(const label size) const
|
||||
}
|
||||
|
||||
|
||||
// Check index i is within valid range (0 ... size-1).
|
||||
template<class T>
|
||||
inline void Foam::UList<T>::checkIndex(const label i) const
|
||||
{
|
||||
@ -158,7 +155,6 @@ inline T* Foam::UList<T>::data()
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// element access
|
||||
template<class T>
|
||||
inline T& Foam::UList<T>::operator[](const label i)
|
||||
{
|
||||
@ -171,7 +167,6 @@ inline T& Foam::UList<T>::operator[](const label i)
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Template specialization for bool
|
||||
template<>
|
||||
inline const bool& Foam::UList<bool>::operator[](const label i) const
|
||||
@ -186,11 +181,9 @@ namespace Foam
|
||||
return Foam::pTraits<bool>::zero;
|
||||
}
|
||||
}
|
||||
|
||||
} // end of namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// const element access
|
||||
template<class T>
|
||||
inline const T& Foam::UList<T>::operator[](const label i) const
|
||||
{
|
||||
@ -201,7 +194,6 @@ inline const T& Foam::UList<T>::operator[](const label i) const
|
||||
}
|
||||
|
||||
|
||||
// Allow cast to a const List<T>&
|
||||
template<class T>
|
||||
inline Foam::UList<T>::operator const Foam::List<T>&() const
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
Reference in New Issue
Block a user