Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

Conflicts:
	src/turbulenceModels/Allwmake

Conflicts:
	src/turbulenceModels/Allwmake

Conflicts:
	src/turbulenceModels/Allwmake

Conflicts:
	src/turbulenceModels/Allwmake
This commit is contained in:
henry
2008-11-20 21:08:34 +00:00
283 changed files with 12956 additions and 8346 deletions

View File

@ -4,7 +4,7 @@ set -x
wmakeLnInclude -f OpenFOAM
wmakeLnInclude -f OSspecific/$WM_OS
( cd Pstream && ./Allwmake )
Pstream/Allwmake
wmake libo OSspecific/$WM_OS
wmake libso OpenFOAM
@ -17,7 +17,7 @@ wmake libso surfMesh
wmake libso meshTools
wmake libso finiteVolume
( cd decompositionAgglomeration && ./Allwmake )
decompositionAgglomeration/Allwmake
wmake libso sampling
@ -30,12 +30,12 @@ wmake libso engine
wmake libso ODE
wmake libso randomProcesses
( cd thermophysicalModels && ./Allwmake )
( cd transportModels && ./Allwmake )
( cd turbulenceModels && ./Allwmake )
( cd lagrangian && ./Allwmake )
( cd postProcessing && ./Allwmake )
( cd conversion && ./Allwmake )
thermophysicalModels/Allwmake
transportModels/Allwmake
turbulenceModels/Allwmake
lagrangian/Allwmake
postProcessing/Allwmake
conversion/Allwmake
wmake libso autoMesh
wmake libso errorEstimation

View File

@ -29,62 +29,161 @@ License
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
namespace Foam
template<class Key, class Hash>
template<class T>
Foam::HashSet<Key, Hash>::HashSet(const HashTable<T, Key, Hash>& ht)
:
HashTable<empty, Key, Hash>(ht.size())
{
for
(
typename HashTable<T, Key, Hash>::const_iterator iter = ht.begin();
iter != ht.end();
++iter
)
{
insert(iter.key());
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Key, class Hash>
bool HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& ht) const
bool Foam::HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& rhs) const
{
const HashTable<empty, Key, Hash>& a = *this;
// Are all my elements in ht?
for
(
typename HashTable<empty, Key, Hash>::const_iterator iter = a.begin();
iter != a.end();
++iter
)
// Are all lhs elements in rhs?
for (const_iterator iter = this->begin(); iter != this->end(); ++iter)
{
if (!ht.found(iter.key()))
if (!rhs.found(iter.key()))
{
return false;
}
}
// Are all ht elements in me?
for
(
typename HashTable<empty, Key, Hash>::const_iterator iter = ht.begin();
iter != ht.end();
++iter
)
// Are all rhs elements in lhs?
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
if (!found(iter.key()))
{
return false;
}
}
return true;
}
template<class Key, class Hash>
bool HashSet<Key, Hash>::operator!=(const HashSet<Key, Hash>& ht) const
bool Foam::HashSet<Key, Hash>::operator!=(const HashSet<Key, Hash>& rhs) const
{
return !(operator==(ht));
return !(operator==(rhs));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator|=(const HashSet<Key, Hash>& rhs)
{
// Add rhs elements into lhs
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
insert(iter.key());
}
}
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator&=(const HashSet<Key, Hash>& rhs)
{
// Remove elements not also found in rhs
for (iterator iter = this->begin(); iter != this->end(); ++iter)
{
if (!rhs.found(iter.key()))
{
erase(iter);
}
}
}
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator^=(const HashSet<Key, Hash>& rhs)
{
// Add missed rhs elements, remove duplicate elements
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
if (found(iter.key()))
{
erase(iter.key());
}
else
{
insert(iter.key());
}
}
}
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
{
// Remove rhs elements from lhs
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
erase(iter.key());
}
}
} // End namespace Foam
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
/* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
template<class Key, class Hash>
Foam::HashSet<Key, Hash>
Foam::operator|
(
const HashSet<Key, Hash>& hash1,
const HashSet<Key, Hash>& hash2
)
{
HashSet<Key, Hash> out(hash1);
out |= hash2;
return out;
}
template<class Key, class Hash>
Foam::HashSet<Key, Hash>
Foam::operator&
(
const HashSet<Key, Hash>& hash1,
const HashSet<Key, Hash>& hash2
)
{
HashSet<Key, Hash> out(hash1);
out &= hash2;
return out;
}
template<class Key, class Hash>
Foam::HashSet<Key, Hash>
Foam::operator^
(
const HashSet<Key, Hash>& hash1,
const HashSet<Key, Hash>& hash2
)
{
HashSet<Key, Hash> out(hash1);
out ^= hash2;
return out;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -26,7 +26,7 @@ Class
Foam::HashSet
Description
A HashTable with word keys but without contents.
A HashTable with keys but without contents.
Typedef
Foam::wordHashSet
@ -34,6 +34,12 @@ Typedef
Description
A HashSet with (the default) word keys.
Typedef
Foam::labelHashSet
Description
A HashSet with label keys.
\*---------------------------------------------------------------------------*/
#ifndef HashSet_H
@ -48,7 +54,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class HashSet Declaration
Class HashSet Declaration
\*---------------------------------------------------------------------------*/
template<class Key=word, class Hash=string::hash>
@ -59,9 +65,13 @@ class HashSet
public:
typedef typename HashTable<empty, Key, Hash>::iterator iterator;
typedef typename HashTable<empty, Key, Hash>::const_iterator const_iterator;
// Constructors
//- Construct given initial map size
//- Construct given initial size
HashSet(label size = 100)
:
HashTable<empty, Key, Hash>(size)
@ -74,13 +84,13 @@ public:
{}
//- Construct from UList of Key
HashSet(const UList<Key>& ul)
HashSet(const UList<Key>& lst)
:
HashTable<empty, Key, Hash>(2*ul.size())
HashTable<empty, Key, Hash>(2*lst.size())
{
forAll (ul, i)
forAll(lst, i)
{
insert(ul[i]);
insert(lst[i]);
}
}
@ -90,32 +100,99 @@ public:
HashTable<empty, Key, Hash>(hs)
{}
//- Construct by transferring the parameter contents
HashSet(const xfer<HashSet<Key, Hash> >& hs)
:
HashTable<empty, Key, Hash>(hs)
{}
//- Construct from table of contents of the HashTable
template<class T>
HashSet(const HashTable<T, Key, Hash>& ht);
// Member Functions
// Edit
//- Insert a new hashedEntry
bool insert(const Key& key)
{
return HashTable<empty, Key, Hash>::insert(key, empty());
}
//- Insert a new entry
bool insert(const Key& key)
{
return HashTable<empty, Key, Hash>::insert(key, empty());
}
//- Same as insert (cannot overwrite empty content)
bool set(const Key& key)
{
return HashTable<empty, Key, Hash>::insert(key, empty());
}
// Member Operators
//- Equality. Two hashtables are equal if all contents of first are
// also in second and vice versa. So does not depend on table size or
// order!
//- Equality. Two hashtables are equal when their contents are equal.
// Independent of table size or order.
bool operator==(const HashSet<Key, Hash>&) const;
//- The opposite of the equality operation.
bool operator!=(const HashSet<Key, Hash>&) const;
//- Combine entries from HashSets
void operator|=(const HashSet<Key, Hash>&);
//- Only retain entries found in both HashSets
void operator&=(const HashSet<Key, Hash>&);
//- Only retain unique entries (xor)
void operator^=(const HashSet<Key, Hash>&);
//- Add entries listed in the given HashSet to this HashSet
inline void operator+=(const HashSet<Key, Hash>& rhs)
{
this->operator|=(rhs);
}
//- Remove entries listed in the given HashSet from this HashSet
void operator-=(const HashSet<Key, Hash>&);
};
// Global Operators
//- Combine entries from HashSets
template<class Key, class Hash>
HashSet<Key,Hash> operator|
(
const HashSet<Key,Hash>& hash1,
const HashSet<Key,Hash>& hash2
);
//- Create a HashSet that only contains entries found in both HashSets
template<class Key, class Hash>
HashSet<Key,Hash> operator&
(
const HashSet<Key,Hash>& hash1,
const HashSet<Key,Hash>& hash2
);
//- Create a HashSet that only contains unique entries (xor)
template<class Key, class Hash>
HashSet<Key,Hash> operator^
(
const HashSet<Key,Hash>& hash1,
const HashSet<Key,Hash>& hash2
);
//- A HashSet with word keys.
typedef HashSet<> wordHashSet;
//- A HashSet with label keys.
typedef HashSet<label, Hash<label> > labelHashSet;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -54,9 +54,15 @@ class Map
{
public:
typedef typename HashTable<T, label, Hash<label> >::iterator iterator;
typedef typename HashTable<T, label, Hash<label> >::const_iterator
const_iterator;
// Constructors
//- Construct given initial map size
//- Construct given initial size
Map(label size = 100)
:
HashTable<T, label, Hash<label> >(size)
@ -74,6 +80,12 @@ public:
HashTable<T, label, Hash<label> >(map)
{}
//- Construct by transferring the parameter contents
Map(const xfer<Map<T> >& map)
:
HashTable<T, label, Hash<label> >(map)
{}
//- Return a null Map
static const Map<T>& null()

View File

@ -67,7 +67,7 @@ public:
(
const UList<T>& posList,
const UList<T>& negList,
const List<label>&
const UList<label>&
);

View File

@ -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)),

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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];
}
}
}

View File

@ -28,7 +28,11 @@ License
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
Foam::labelList Foam::invert(const label len, const labelList& map)
Foam::labelList Foam::invert
(
const label len,
const UList<label>& map
)
{
labelList inverse(len, -1);
@ -40,8 +44,8 @@ Foam::labelList Foam::invert(const label len, const labelList& map)
{
if (inverse[newPos] >= 0)
{
FatalErrorIn("invert(const label, const labelList&)")
<< "Map is not one to one. At index " << i
FatalErrorIn("invert(const label, const UList<label>&)")
<< "Map is not one-to-one. At index " << i
<< " element " << newPos << " has already occurred before"
<< nl << "Please use invertOneToMany instead"
<< abort(FatalError);
@ -54,7 +58,11 @@ Foam::labelList Foam::invert(const label len, const labelList& map)
}
Foam::labelListList Foam::invertOneToMany(const label len, const labelList& map)
Foam::labelListList Foam::invertOneToMany
(
const label len,
const UList<label>& map
)
{
labelList nElems(len, 0);

View File

@ -44,56 +44,62 @@ SourceFiles
namespace Foam
{
//- Renumber the values (not the indices) of a list. List elements <= 0 are
// left as is.
template<class List>
List renumber(const labelList& oldToNew, const List&);
//- Renumber the values (not the indices) of a list.
// Negative ListType elements are left as is.
template<class ListType>
ListType renumber(const UList<label>& oldToNew, const ListType&);
//- Inplace renumber the values of a list. List elements <= 0 are
// left as is.
template<class List>
void inplaceRenumber(const labelList& oldToNew, List&);
//- Inplace renumber the values of a list.
// Negative ListType elements are left as is.
template<class ListType>
void inplaceRenumber(const UList<label>& oldToNew, ListType&);
//- Reorder the elements (indices, not values) of a list.
// List elements <= 0 are left as is.
template<class List>
List reorder(const labelList& oldToNew, const List&);
// Negative ListType elements are left as is.
template<class ListType>
ListType reorder(const UList<label>& oldToNew, const ListType&);
//- Inplace reorder the elements of a list.
// List elements <= 0 are left as is.
template<class List>
void inplaceReorder(const labelList& oldToNew, List&);
// Negative ListType elements are left as is.
template<class ListType>
void inplaceReorder(const UList<label>& oldToNew, ListType&);
// Variants to work with iterators and sparse tables. Need to have iterators
// and insert()
// Variants to work with iterators and sparse tables.
// Need to have iterators and insert()
//- Map values. Do not map negative values.
template<class Container>
void inplaceMapValue(const labelList& oldToNew, Container&);
void inplaceMapValue(const UList<label>& oldToNew, Container&);
//- Recreate with mapped keys. Remove elements with negative key.
template<class Container>
void inplaceMapKey(const labelList& oldToNew, Container&);
void inplaceMapKey(const UList<label>& oldToNew, Container&);
//- Extract elements of List whose region is certain value. Use e.g.
// to extract all selected elements:
// subset<boolList, labelList>(selectedElems, true, lst);
template<class T, class List>
List subset(const UList<T>& regions, const T& region, const List&);
//- Generate the (stable) sort order for the list
template<class T>
void sortedOrder(const UList<T>&, labelList& order);
//- Extract elements of List whose region is certain value.
// Use e.g. to extract all selected elements:
// subset<boolList, labelList>(selectedElems, true, lst);
template<class T, class ListType>
ListType subset(const UList<T>& regions, const T& region, const ListType&);
//- Inplace extract elements of List whose region is certain value. Use e.g.
// to extract all selected elements:
// inplaceSubset<boolList, labelList>(selectedElems, true, lst);
template<class T, class List>
void inplaceSubset(const UList<T>& regions, const T& region, List&);
template<class T, class ListType>
void inplaceSubset(const UList<T>& regions, const T& region, ListType&);
//- Invert one-to-one map. Unmapped elements will be -1.
labelList invert(const label len, const labelList& oldToNew);
labelList invert(const label len, const UList<label>&);
//- Invert one-to-many map. Unmapped elements will be size 0.
labelListList invertOneToMany(const label len, const labelList&);
labelListList invertOneToMany(const label len, const UList<label>&);
//- Invert many-to-many. Input and output types need to be inherited
// from List. E.g. faces to pointFaces.
@ -113,72 +119,72 @@ labelList identity(const label len);
//- Find first occurence of given element and return index,
// return -1 if not found. Linear search.
template<class List>
template<class ListType>
label findIndex
(
const List&,
typename List::const_reference,
const ListType&,
typename ListType::const_reference,
const label start=0
);
//- Find all occurences of given element. Linear search.
template<class List>
template<class ListType>
labelList findIndices
(
const List&,
typename List::const_reference,
const ListType&,
typename ListType::const_reference,
const label start=0
);
//- Opposite of findIndices: set values at indices to given value
template<class List>
template<class ListType>
void setValues
(
List&,
const labelList& indices,
typename List::const_reference
ListType&,
const UList<label>& indices,
typename ListType::const_reference
);
//- Opposite of findIndices: set values at indices to given value
template<class List>
List createWithValues
template<class ListType>
ListType createWithValues
(
const label sz,
const typename List::const_reference initValue,
const labelList& indices,
typename List::const_reference setValue
const typename ListType::const_reference initValue,
const UList<label>& indices,
typename ListType::const_reference setValue
);
//- Find index of max element (and larger than given element).
// return -1 if not found. Linear search.
template<class List>
label findMax(const List&, const label start=0);
template<class ListType>
label findMax(const ListType&, const label start=0);
//- Find index of min element (and less than given element).
// return -1 if not found. Linear search.
template<class List>
label findMin(const List&, const label start=0);
template<class ListType>
label findMin(const ListType&, const label start=0);
//- Find first occurence of given element in sorted list and return index,
// return -1 if not found. Binary search.
template<class List>
template<class ListType>
label findSortedIndex
(
const List&,
typename List::const_reference,
const ListType&,
typename ListType::const_reference,
const label start=0
);
//- Find last element < given value in sorted list and return index,
// return -1 if not found. Binary search.
template<class List>
template<class ListType>
label findLower
(
const List&,
typename List::const_reference,
const ListType&,
typename ListType::const_reference,
const label start=0
);

View File

@ -28,15 +28,15 @@ License
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class List>
List Foam::renumber
template<class ListType>
ListType Foam::renumber
(
const labelList& oldToNew,
const List& lst
const UList<label>& oldToNew,
const ListType& lst
)
{
// Create copy
List newLst(lst.size());
ListType newLst(lst.size());
forAll(lst, elemI)
{
@ -50,11 +50,11 @@ List Foam::renumber
}
template<class List>
template<class ListType>
void Foam::inplaceRenumber
(
const labelList& oldToNew,
List& lst
const UList<label>& oldToNew,
ListType& lst
)
{
forAll(lst, elemI)
@ -67,15 +67,15 @@ void Foam::inplaceRenumber
}
template<class List>
List Foam::reorder
template<class ListType>
ListType Foam::reorder
(
const labelList& oldToNew,
const List& lst
const UList<label>& oldToNew,
const ListType& lst
)
{
// Create copy
List newLst(lst.size());
ListType newLst(lst.size());
forAll(lst, elemI)
{
@ -92,15 +92,15 @@ List Foam::reorder
}
template<class List>
template<class ListType>
void Foam::inplaceReorder
(
const labelList& oldToNew,
List& lst
const UList<label>& oldToNew,
ListType& lst
)
{
// Create copy
List newLst(lst.size());
ListType newLst(lst.size());
forAll(lst, elemI)
{
@ -121,7 +121,7 @@ void Foam::inplaceReorder
template<class Container>
void Foam::inplaceMapValue
(
const labelList& oldToNew,
const UList<label>& oldToNew,
Container& lst
)
{
@ -143,7 +143,7 @@ void Foam::inplaceMapValue
template<class Container>
void Foam::inplaceMapKey
(
const labelList& oldToNew,
const UList<label>& oldToNew,
Container& lst
)
{
@ -161,23 +161,46 @@ void Foam::inplaceMapKey
newLst.insert(oldToNew[iter.key()], iter());
}
}
lst.transfer(newLst);
}
template<class T, class List>
List Foam::subset(const UList<T>& regions, const T& region, const List& lst)
template<class T>
void Foam::sortedOrder
(
const UList<T>& lst,
labelList& order
)
{
order.setSize(lst.size());
forAll(order, elemI)
{
order[elemI] = elemI;
}
Foam::stableSort(order, typename UList<T>::less(lst));
}
template<class T, class ListType>
ListType Foam::subset
(
const UList<T>& regions,
const T& region,
const ListType& lst
)
{
if (regions.size() < lst.size())
{
FatalErrorIn("subset(const UList<T>&, const T&, const List&)")
FatalErrorIn("subset(const UList<T>&, const T&, const ListType&)")
<< "Regions is of size " << regions.size()
<< "; list it is supposed to index is of size " << lst.size()
<< abort(FatalError);
}
List newLst(lst.size());
ListType newLst(lst.size());
label nElem = 0;
forAll(lst, elemI)
@ -193,12 +216,17 @@ List Foam::subset(const UList<T>& regions, const T& region, const List& lst)
}
template<class T, class List>
void Foam::inplaceSubset(const UList<T>& regions, const T& region, List& lst)
template<class T, class ListType>
void Foam::inplaceSubset
(
const UList<T>& regions,
const T& region,
ListType& lst
)
{
if (regions.size() < lst.size())
{
FatalErrorIn("inplaceSubset(const UList<T>&, const T&, List&)")
FatalErrorIn("inplaceSubset(const UList<T>&, const T&, ListType&)")
<< "Regions is of size " << regions.size()
<< "; list it is supposed to index is of size " << lst.size()
<< abort(FatalError);
@ -221,8 +249,8 @@ void Foam::inplaceSubset(const UList<T>& regions, const T& region, List& lst)
}
// As clarification coded as inversion from pointEdges to edges but completely
// general.
// As clarification:
// coded as inversion from pointEdges to edges but completely general.
template<class InList, class OutList>
void Foam::invertManyToMany
(
@ -268,11 +296,11 @@ void Foam::invertManyToMany
}
template<class List>
template<class ListType>
Foam::label Foam::findIndex
(
const List& l,
typename List::const_reference t,
const ListType& l,
typename ListType::const_reference t,
const label start
)
{
@ -291,11 +319,11 @@ Foam::label Foam::findIndex
}
template<class List>
template<class ListType>
Foam::labelList Foam::findIndices
(
const List& l,
typename List::const_reference t,
const ListType& l,
typename ListType::const_reference t,
const label start
)
{
@ -326,12 +354,12 @@ Foam::labelList Foam::findIndices
}
template<class List>
template<class ListType>
void Foam::setValues
(
List& l,
const labelList& indices,
typename List::const_reference t
ListType& l,
const UList<label>& indices,
typename ListType::const_reference t
)
{
forAll(indices, i)
@ -341,23 +369,23 @@ void Foam::setValues
}
template<class List>
List Foam::createWithValues
template<class ListType>
ListType Foam::createWithValues
(
const label sz,
const typename List::const_reference initValue,
const labelList& indices,
typename List::const_reference setValue
const typename ListType::const_reference initValue,
const UList<label>& indices,
typename ListType::const_reference setValue
)
{
List l(sz, initValue);
ListType l(sz, initValue);
setValues(l, indices, setValue);
return l;
}
template<class List>
Foam::label Foam::findMax(const List& l, const label start)
template<class ListType>
Foam::label Foam::findMax(const ListType& l, const label start)
{
if (start >= l.size())
{
@ -378,8 +406,8 @@ Foam::label Foam::findMax(const List& l, const label start)
}
template<class List>
Foam::label Foam::findMin(const List& l, const label start)
template<class ListType>
Foam::label Foam::findMin(const ListType& l, const label start)
{
if (start >= l.size())
{
@ -400,11 +428,11 @@ Foam::label Foam::findMin(const List& l, const label start)
}
template<class List>
template<class ListType>
Foam::label Foam::findSortedIndex
(
const List& l,
typename List::const_reference t,
const ListType& l,
typename ListType::const_reference t,
const label start
)
{
@ -438,11 +466,11 @@ Foam::label Foam::findSortedIndex
}
template<class List>
template<class ListType>
Foam::label Foam::findLower
(
const List& l,
typename List::const_reference t,
const ListType& l,
typename ListType::const_reference t,
const label start
)
{
@ -489,31 +517,31 @@ Foam::label Foam::findLower
template<class Container, class T, int nRows>
Foam::List<Container> Foam::initList(const T elems[nRows])
{
List<Container> faces(nRows);
List<Container> lst(nRows);
forAll(faces, faceI)
forAll(lst, rowI)
{
faces[faceI] = Container(elems[faceI]);
lst[rowI] = Container(elems[rowI]);
}
return faces;
return lst;
}
template<class Container, class T, int nRows, int nColumns>
Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns])
{
List<Container> faces(nRows);
List<Container> lst(nRows);
Container f(nColumns);
forAll(faces, faceI)
Container cols(nColumns);
forAll(lst, rowI)
{
forAll(f, i)
forAll(cols, colI)
{
f[i] = elems[faceI][i];
cols[colI] = elems[rowI][colI];
}
faces[faceI] = f;
lst[rowI] = cols;
}
return faces;
return lst;
}

View File

@ -26,16 +26,10 @@ License
#include "PackedList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct with given size and value for all elements.
template<int nBits>
PackedList<nBits>::PackedList(const label size, const unsigned int val)
Foam::PackedList<nBits>::PackedList(const label size, const unsigned int val)
:
List<unsigned int>(intSize(size)),
size_(size)
@ -44,26 +38,23 @@ PackedList<nBits>::PackedList(const label size, const unsigned int val)
}
//- Copy constructor.
template<int nBits>
PackedList<nBits>::PackedList(const PackedList<nBits>& PList)
Foam::PackedList<nBits>::PackedList(const PackedList<nBits>& lst)
:
List<unsigned int>(PList),
size_(PList.size())
List<unsigned int>(lst),
size_(lst.size())
{}
template<int nBits>
PackedList<nBits>::PackedList(const xfer<PackedList<nBits> >& lst)
Foam::PackedList<nBits>::PackedList(const xfer<PackedList<nBits> >& lst)
{
transfer(lst());
}
//- Construct from labelList
template<int nBits>
PackedList<nBits>::PackedList(const labelList& lst)
Foam::PackedList<nBits>::PackedList(const UList<label>& lst)
:
List<unsigned int>(intSize(lst.size()), 0),
size_(lst.size())
@ -76,7 +67,7 @@ PackedList<nBits>::PackedList(const labelList& lst)
template<int nBits>
autoPtr<PackedList<nBits> > PackedList<nBits>::clone() const
Foam::autoPtr<Foam::PackedList<nBits> > Foam::PackedList<nBits>::clone() const
{
return autoPtr<PackedList<nBits> >(new PackedList<nBits>(*this));
}
@ -84,24 +75,24 @@ autoPtr<PackedList<nBits> > PackedList<nBits>::clone() const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <int nBits>
void PackedList<nBits>::setSize(const label size)
template<int nBits>
void Foam::PackedList<nBits>::setSize(const label size)
{
List<unsigned int>::setSize(intSize(size));
size_ = size;
}
template <int nBits>
void PackedList<nBits>::clear()
template<int nBits>
void Foam::PackedList<nBits>::clear()
{
List<unsigned int>::clear();
size_ = 0;
}
template <int nBits>
void PackedList<nBits>::transfer(PackedList<nBits>& lst)
template<int nBits>
void Foam::PackedList<nBits>::transfer(PackedList<nBits>& lst)
{
size_ = lst.size();
List<unsigned int>::transfer(lst);
@ -111,16 +102,16 @@ void PackedList<nBits>::transfer(PackedList<nBits>& lst)
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// Assignment.
template <int nBits>
void PackedList<nBits>::operator=(const PackedList<nBits>& pl)
template<int nBits>
void Foam::PackedList<nBits>::operator=(const PackedList<nBits>& lst)
{
setSize(pl.size());
List<unsigned int>::operator=(pl);
setSize(lst.size());
List<unsigned int>::operator=(lst);
}
template <int nBits>
labelList PackedList<nBits>::operator()() const
template<int nBits>
Foam::labelList Foam::PackedList<nBits>::operator()() const
{
labelList elems(size());
@ -134,17 +125,14 @@ labelList PackedList<nBits>::operator()() const
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
//template <int nBits>
//Ostream& ::Foam::operator<<(Ostream& os, const PackedList<nBits>& PL)
//template<int nBits>
//Foam::Ostream& ::Foam::operator<<(Ostream& os, const PackedList<nBits>& lst)
//{
// os << PL();
// os << lst();
// return os;
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,7 +26,8 @@ Class
Foam::PackedList
Description
List of packed unsigned ints. Gets given the number of bits per item.
List of packed unsigned ints.
Gets given the number of bits per item.
SourceFiles
PackedListI.H
@ -47,14 +48,14 @@ namespace Foam
/*---------------------------------------------------------------------------*\
Class PackedListName Declaration
Class PackedListName Declaration
\*---------------------------------------------------------------------------*/
TemplateName(PackedList);
/*---------------------------------------------------------------------------*\
Class PackedList Declaration
Class PackedList Declaration
\*---------------------------------------------------------------------------*/
//- For PackedList
@ -137,8 +138,8 @@ public:
//- Construct by transferring the parameter contents
PackedList(const xfer<PackedList<nBits> >&);
//- Construct from labelList.
PackedList(const labelList&);
//- Construct from a list of labels
PackedList(const UList<label>&);
//- Clone
inline autoPtr<PackedList<nBits> > clone() const;

View File

@ -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),

View File

@ -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
{

View File

@ -24,53 +24,45 @@ License
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from List
template <class Type>
Foam::SortableList<Type>::SortableList()
{}
template <class Type>
Foam::SortableList<Type>::SortableList(const UList<Type>& values)
:
List<Type>(values),
indices_(values.size())
List<Type>(values)
{
sort();
}
// Construct from List by transferring
template <class Type>
Foam::SortableList<Type>::SortableList(const xfer<List<Type> >& values)
:
List<Type>(),
indices_(values->size())
List<Type>(values)
{
List<Type>::transfer(values());
sort();
}
// Construct given size. Sort later on.
template <class Type>
Foam::SortableList<Type>::SortableList(const label size)
:
List<Type>(size),
indices_(size)
List<Type>(size)
{}
// Construct given size and initial value. Sort later on.
template <class Type>
Foam::SortableList<Type>::SortableList(const label size, const Type& val)
:
List<Type>(size, val),
indices_(size)
List<Type>(size, val)
{}
// Construct as copy.
template <class Type>
Foam::SortableList<Type>::SortableList(const SortableList<Type>& lst)
:
@ -85,34 +77,59 @@ template <class Type>
void Foam::SortableList<Type>::setSize(const label newSize)
{
List<Type>::setSize(newSize);
indices_.setSize(newSize);
indices_.setSize(newSize, -1);
}
template <class Type>
void Foam::SortableList<Type>::clear()
{
List<Type>::clear();
indices_.clear();
}
template <class Type>
Foam::List<Type>& Foam::SortableList<Type>::shrink()
{
indices_.clear();
return static_cast<List<Type>&>(*this);
}
template <class Type>
void Foam::SortableList<Type>::sort()
{
// list lengths must be identical
indices_.setSize(this->size());
forAll(indices_, i)
{
indices_[i] = i;
}
// Foam::sort(indices_, less(*this));
Foam::stableSort(indices_, less(*this));
List<Type> tmpValues(this->size());
Foam::stableSort(indices_, typename UList<Type>::less(*this));
List<Type> lst(this->size());
forAll(indices_, i)
{
tmpValues[i] = this->operator[](indices_[i]);
lst[i] = this->operator[](indices_[i]);
}
List<Type>::transfer(tmpValues);
List<Type>::transfer(lst);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template <class Type>
void Foam::SortableList<Type>::operator=(const UList<Type>& rhs)
{
List<Type>::operator=(rhs);
indices_.clear();
}
template <class Type>
void Foam::SortableList<Type>::operator=(const SortableList<Type>& rhs)
{
@ -120,7 +137,6 @@ void Foam::SortableList<Type>::operator=(const SortableList<Type>& rhs)
indices_ = rhs.indices();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -60,44 +60,25 @@ class SortableList
//- Original indices
labelList indices_;
public:
// Public classes
//- Less function class used by the sort function
class less
{
const UList<Type>& values_;
public:
less(const UList<Type>& values)
:
values_(values)
{}
bool operator()(const label a, const label b)
{
return values_[a] < values_[b];
}
};
// Constructors
//- Construct from List, sorting the elements.
// Starts with indices set to index in argument
//- Null constructor, sort later (eg, after assignment or transfer)
SortableList();
//- Construct from UList, sorting immediately.
explicit SortableList(const UList<Type>&);
//- Construct from tranferred List, sorting the elements.
// Starts with indices set to index in argument
//- Construct from transferred List, sorting immediately.
explicit SortableList(const xfer<List<Type> >&);
//- Construct given size. Sort later on.
// The indices remain empty until the list is sorted
explicit SortableList(const label size);
//- Construct given size and initial value. Sort later on.
// The indices remain empty until the list is sorted
SortableList(const label size, const Type&);
//- Construct as copy.
@ -112,15 +93,31 @@ public:
return indices_;
}
//- Size the list. If grow can cause undefined indices (until next sort)
//- Return non-const access to the sorted indices. Updated every sort.
labelList& indices()
{
return indices_;
}
//- Size the list. Growing can cause undefined indices (until next sort)
void setSize(const label);
//- (stable) sort the list (if changed after construction time)
void sort();
//- Clear the list and the indices
void clear();
//- Clear the indices and return a reference to the underlying List
List<Type>& shrink();
//- (stable) sort the list (if changed after construction time)
// also resizes the indices as required
void sort();
// Member Operators
//- Assignment from UList operator. Takes linear time.
void operator=(const UList<Type>&);
//- Assignment operator. Takes linear time.
void operator=(const SortableList<Type>&);
};

View File

@ -92,6 +92,26 @@ public:
//- Declare friendship with the SubList class
friend class SubList<T>;
// Public classes
//- Less function class that can be used for sorting
class less
{
const UList<T>& values_;
public:
less(const UList<T>& values)
:
values_(values)
{}
bool operator()(const label a, const label b)
{
return values_[a] < values_[b];
}
};
// Constructors

View File

@ -35,28 +35,88 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
#define addToMemberFunctionSelectionTable\
(baseType,thisType,memberFunction,argNames) \
\
/* Add the thisType constructor function to the table */ \
/* Add the thisType memberFunction to the table */ \
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType> \
add##thisType##memberFunction##argNames##MemberFunctionTo##baseType##Table_
// add to hash-table of functions with 'lookup' as the key
#define addNamedToMemberFunctionSelectionTable\
(baseType,thisType,memberFunction,argNames,lookup) \
\
/* Add the thisType constructor function to the table */ \
/* Add the thisType memberFunction to the table, find by lookup name */ \
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType> \
add_##lookup##_##thisType##memberFunction##argNames##MemberFunctionTo##baseType##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
// use when baseType doesn't need a template argument (eg, is a typedef)
#define addTemplateToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames) \
\
/* Add the thisType constructor function to the table */ \
/* Add the thisType memberFunction to the table */ \
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Table_
// add to hash-table of functions with 'lookup' as the key
// use when baseType doesn't need a template argument (eg, is a typedef)
#define addNamedTemplateToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames,lookup) \
\
/* Add the thisType memberFunction to the table, find by lookup name */ \
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Table_(#lookup)
// use when baseType requires the Targ template argument as well
#define addTemplatedToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames) \
\
/* Add the thisType memberFunction to the table */ \
baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_
// use when baseType requires the Targ template argument as well
#define addNamedTemplatedToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames,lookup) \
\
/* Add the thisType memberFunction to the table, find by lookup name */ \
baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
// use when baseType requires the Targ template argument as well
#define addTemplatedToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames) \
\
/* Add the thisType memberFunction to the table */ \
baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_
// add to hash-table of functions with 'lookup' as the key
// use when baseType requires the Targ template argument as well
#define addNamedTemplatedToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames,lookup) \
\
/* Add the thisType memberFunction to the table, find by lookup name */ \
baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -39,6 +39,10 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// external use:
// ~~~~~~~~~~~~~
// declare a run-time selection:
#define declareMemberFunctionSelectionTable\
(returnType,baseType,memberFunction,argNames,argList,parList) \
\
@ -79,17 +83,19 @@ Description
} \
}; \
\
/* Table MemberFunction called from the table add function */ \
/* Table memberFunction called from the table add function */ \
static void construct##memberFunction##argNames##MemberFunctionTables(); \
\
/* Table destructor called from the table add function destructor */ \
static void destroy##memberFunction##argNames##MemberFunctionTables()
// internal use:
// constructor aid
#define defineMemberFunctionSelectionTableMemberFunction\
(baseType,memberFunction,argNames) \
\
/* Table MemberFunction called from the table add function */ \
/* Table memberFunction called from the table add function */ \
void baseType::construct##memberFunction##argNames##MemberFunctionTables()\
{ \
static bool constructed = false; \
@ -103,6 +109,9 @@ Description
} \
}
// internal use:
// destructor aid
#define defineMemberFunctionSelectionTableDestructor\
(baseType,memberFunction,argNames) \
\
@ -116,21 +125,33 @@ Description
} \
}
// internal use:
// create pointer to hash-table of functions
#define defineMemberFunctionSelectionTablePtr\
(baseType,memberFunction,argNames) \
\
/* Define the constructor function table */ \
/* Define the memberFunction table */ \
baseType::memberFunction##argNames##MemberFunctionTable* \
baseType::memberFunction##argNames##MemberFunctionTablePtr_ = NULL
// not much in use:
#define defineTemplateMemberFunctionSelectionTablePtr\
(baseType,memberFunction,argNames) \
\
/* Define the constructor function table */ \
/* Define the memberFunction table */ \
typename baseType::memberFunction##argNames##MemberFunctionTable* \
baseType::memberFunction##argNames##MemberFunctionTablePtr_ = NULL
#define defineMemberFunctionSelectionTable(baseType,memberFunction,argNames) \
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table
#define defineMemberFunctionSelectionTable\
(baseType,memberFunction,argNames) \
\
defineMemberFunctionSelectionTablePtr \
(baseType,memberFunction,argNames); \
@ -139,6 +160,11 @@ Description
defineMemberFunctionSelectionTableDestructor \
(baseType,memberFunction,argNames)
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table for template classes
// use when baseType doesn't need a template argument (eg, is a typedef)
#define defineTemplateMemberFunctionSelectionTable\
(baseType,memberFunction,argNames) \
\
@ -155,6 +181,74 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// internal use:
// constructor aid
// use when baseType requires the Targ template argument
#define defineTemplatedMemberFunctionSelectionTableMemberFunction\
(baseType,memberFunction,argNames,Targ) \
\
/* Table memberFunction called from the table add function */ \
void baseType<Targ>::construct##memberFunction##argNames##MemberFunctionTables()\
{ \
static bool constructed = false; \
\
if (!constructed) \
{ \
baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_ \
= new baseType<Targ>::memberFunction##argNames##MemberFunctionTable;\
\
constructed = true; \
} \
}
// internal use:
// destructor aid
// use when baseType requires the Targ template argument
#define defineTemplatedMemberFunctionSelectionTableDestructor\
(baseType,memberFunction,argNames,Targ) \
\
/* Table destructor called from the table add function destructor */ \
void baseType<Targ>::destroy##memberFunction##argNames##MemberFunctionTables() \
{ \
if (baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_) \
{ \
delete baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_;\
baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_ = NULL;\
} \
}
// internal use:
// create pointer to hash-table of functions
// use when baseType requires the Targ template argument
#define defineTemplatedMemberFunctionSelectionTablePtr\
(baseType,memberFunction,argNames,Targ) \
\
/* Define the memberFunction table */ \
baseType<Targ>::memberFunction##argNames##MemberFunctionTable* \
baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_ = NULL
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table for template classes
// use when baseType requires the Targ template argument
#define defineTemplatedMemberFunctionSelectionTable\
(baseType,memberFunction,argNames,Targ) \
\
template<> \
defineTemplatedMemberFunctionSelectionTablePtr \
(baseType,memberFunction,argNames,Targ); \
template<> \
defineTemplatedMemberFunctionSelectionTableMemberFunction \
(baseType,memberFunction,argNames,Targ) \
template<> \
defineTemplatedMemberFunctionSelectionTableDestructor \
(baseType,memberFunction,argNames,Targ)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -35,24 +35,70 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define addToRunTimeSelectionTable(baseType,thisType,argNames) \
// add to hash-table of functions with typename as the key
#define addToRunTimeSelectionTable\
(baseType,thisType,argNames) \
\
/* Add the thisType constructor function to the table */ \
baseType::add##argNames##ConstructorToTable<thisType> \
add##thisType##argNames##ConstructorTo##baseType##Table_
#define addNamedToRunTimeSelectionTable(baseType,thisType,argNames,lookup) \
// add to hash-table of functions with 'lookup' as the key
#define addNamedToRunTimeSelectionTable\
(baseType,thisType,argNames,lookup) \
\
/* Add the thisType constructor function to the table */ \
/* Add the thisType constructor function to the table, find by lookup */ \
baseType::add##argNames##ConstructorToTable<thisType> \
add_##lookup##_##thisType##argNames##ConstructorTo##baseType##Table_(#lookup)
#define addTemplateToRunTimeSelectionTable(baseType,thisType,Targ,argNames) \
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
// use when baseType doesn't need a template argument (eg, is a typedef)
#define addTemplateToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames) \
\
/* Add the thisType constructor function to the table */ \
baseType::add##argNames##ConstructorToTable<thisType<Targ> > \
add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
// add to hash-table of functions with 'lookup' as the key
// use when baseType doesn't need a template argument (eg, is a typedef)
#define addNamedTemplateToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames,lookup) \
\
/* Add the thisType constructor function to the table, find by lookup */ \
baseType::add##argNames##ConstructorToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
// use when baseType requires the Targ template argument as well
#define addTemplatedToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames) \
\
/* Add the thisType constructor function to the table */ \
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ> > \
add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
// add to hash-table of functions with 'lookup' as the key
// use when baseType requires the Targ template argument as well
#define addNamedTemplatedToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames,lookup) \
\
/* Add the thisType constructor function to the table, find by lookup */ \
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -46,158 +46,259 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// external use:
// ~~~~~~~~~~~~~
// declare a run-time selection:
#define declareRunTimeSelectionTable\
(autoPtr,baseType,argNames,argList,parList) \
\
/* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
\
/* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \
argNames##ConstructorTable; \
\
/* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\
/* Class to add constructor from argList to table */ \
template<class baseType##Type> \
class add##argNames##ConstructorToTable \
{ \
public: \
\
static autoPtr<baseType> New argList \
{ \
return autoPtr<baseType>(new baseType##Type parList); \
} \
\
add##argNames##ConstructorToTable \
( \
const word& lookup = baseType##Type::typeName \
) \
{ \
construct##argNames##ConstructorTables(); \
argNames##ConstructorTablePtr_->insert(lookup, New); \
} \
\
~add##argNames##ConstructorToTable() \
{ \
destroy##argNames##ConstructorTables(); \
} \
}; \
\
/* Table Constructor called from the table add function */ \
static void construct##argNames##ConstructorTables(); \
\
/* Table destructor called from the table add function destructor */\
(autoPtr,baseType,argNames,argList,parList) \
\
/* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
\
/* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \
argNames##ConstructorTable; \
\
/* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\
/* Class to add constructor from argList to table */ \
template<class baseType##Type> \
class add##argNames##ConstructorToTable \
{ \
public: \
\
static autoPtr<baseType> New argList \
{ \
return autoPtr<baseType>(new baseType##Type parList); \
} \
\
add##argNames##ConstructorToTable \
( \
const word& lookup = baseType##Type::typeName \
) \
{ \
construct##argNames##ConstructorTables(); \
argNames##ConstructorTablePtr_->insert(lookup, New); \
} \
\
~add##argNames##ConstructorToTable() \
{ \
destroy##argNames##ConstructorTables(); \
} \
}; \
\
/* Table constructor called from the table add function */ \
static void construct##argNames##ConstructorTables(); \
\
/* Table destructor called from the table add function destructor */ \
static void destroy##argNames##ConstructorTables()
// external use:
// ~~~~~~~~~~~~~
// declare a run-time selection for derived classes:
#define declareRunTimeNewSelectionTable\
(autoPtr,baseType,argNames,argList,parList) \
\
/* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
\
/* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \
argNames##ConstructorTable; \
\
/* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\
/* Class to add constructor from argList to table */ \
template<class baseType##Type> \
class add##argNames##ConstructorToTable \
{ \
public: \
\
static autoPtr<baseType> New##baseType argList \
{ \
return autoPtr<baseType>(baseType##Type::New parList.ptr());\
} \
\
add##argNames##ConstructorToTable \
( \
const word& lookup = baseType##Type::typeName \
) \
{ \
construct##argNames##ConstructorTables(); \
argNames##ConstructorTablePtr_->insert \
( \
lookup, \
New##baseType \
); \
} \
\
~add##argNames##ConstructorToTable() \
{ \
destroy##argNames##ConstructorTables(); \
} \
}; \
\
/* Table Constructor called from the table add function */ \
static void construct##argNames##ConstructorTables(); \
\
/* Table destructor called from the table add function destructor */\
(autoPtr,baseType,argNames,argList,parList) \
\
/* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
\
/* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \
argNames##ConstructorTable; \
\
/* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\
/* Class to add constructor from argList to table */ \
template<class baseType##Type> \
class add##argNames##ConstructorToTable \
{ \
public: \
\
static autoPtr<baseType> New##baseType argList \
{ \
return autoPtr<baseType>(baseType##Type::New parList.ptr()); \
} \
\
add##argNames##ConstructorToTable \
( \
const word& lookup = baseType##Type::typeName \
) \
{ \
construct##argNames##ConstructorTables(); \
argNames##ConstructorTablePtr_->insert \
( \
lookup, \
New##baseType \
); \
} \
\
~add##argNames##ConstructorToTable() \
{ \
destroy##argNames##ConstructorTables(); \
} \
}; \
\
/* Table constructor called from the table add function */ \
static void construct##argNames##ConstructorTables(); \
\
/* Table destructor called from the table add function destructor */ \
static void destroy##argNames##ConstructorTables()
#define defineRunTimeSelectionTableConstructor(baseType,argNames) \
\
/* Table Constructor called from the table add function */ \
void baseType::construct##argNames##ConstructorTables() \
{ \
static bool constructed = false; \
\
if (!constructed) \
{ \
baseType::argNames##ConstructorTablePtr_ \
= new baseType::argNames##ConstructorTable; \
\
constructed = true; \
} \
// internal use:
// constructor aid
#define defineRunTimeSelectionTableConstructor\
(baseType,argNames) \
\
/* Table constructor called from the table add function */ \
void baseType::construct##argNames##ConstructorTables() \
{ \
static bool constructed = false; \
\
if (!constructed) \
{ \
baseType::argNames##ConstructorTablePtr_ \
= new baseType::argNames##ConstructorTable; \
\
constructed = true; \
} \
}
#define defineRunTimeSelectionTableDestructor(baseType,argNames) \
\
/* Table destructor called from the table add function destructor */\
void baseType::destroy##argNames##ConstructorTables() \
{ \
if (baseType::argNames##ConstructorTablePtr_) \
{ \
delete baseType::argNames##ConstructorTablePtr_; \
baseType::argNames##ConstructorTablePtr_ = NULL; \
} \
// internal use:
// destructor aid
#define defineRunTimeSelectionTableDestructor\
(baseType,argNames) \
\
/* Table destructor called from the table add function destructor */ \
void baseType::destroy##argNames##ConstructorTables() \
{ \
if (baseType::argNames##ConstructorTablePtr_) \
{ \
delete baseType::argNames##ConstructorTablePtr_; \
baseType::argNames##ConstructorTablePtr_ = NULL; \
} \
}
#define defineRunTimeSelectionTablePtr(baseType,argNames) \
\
/* Define the constructor function table */ \
baseType::argNames##ConstructorTable* \
// internal use:
// create pointer to hash-table of functions
#define defineRunTimeSelectionTablePtr\
(baseType,argNames) \
\
/* Define the constructor function table */ \
baseType::argNames##ConstructorTable* \
baseType::argNames##ConstructorTablePtr_ = NULL
#define defineTemplateRunTimeSelectionTablePtr(baseType,argNames) \
\
/* Define the constructor function table */ \
typename baseType::argNames##ConstructorTable* \
// not much in use:
#define defineTemplateRunTimeSelectionTablePtr(baseType,argNames) \
\
/* Define the constructor function table */ \
typename baseType::argNames##ConstructorTable* \
baseType::argNames##ConstructorTablePtr_ = NULL
#define defineRunTimeSelectionTable(baseType,argNames) \
\
defineRunTimeSelectionTablePtr(baseType,argNames); \
defineRunTimeSelectionTableConstructor(baseType,argNames) \
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table
#define defineRunTimeSelectionTable\
(baseType,argNames) \
\
defineRunTimeSelectionTablePtr(baseType,argNames); \
defineRunTimeSelectionTableConstructor(baseType,argNames) \
defineRunTimeSelectionTableDestructor(baseType,argNames)
#define defineTemplateRunTimeSelectionTable(baseType,argNames) \
\
template<> \
defineRunTimeSelectionTablePtr(baseType,argNames); \
template<> \
defineRunTimeSelectionTableConstructor(baseType,argNames) \
template<> \
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table for template classes
// use when baseType doesn't need a template argument (eg, is a typedef)
#define defineTemplateRunTimeSelectionTable\
(baseType,argNames) \
\
template<> \
defineRunTimeSelectionTablePtr(baseType,argNames); \
template<> \
defineRunTimeSelectionTableConstructor(baseType,argNames) \
template<> \
defineRunTimeSelectionTableDestructor(baseType,argNames)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// internal use:
// constructor aid
// use when baseType requires the Targ template argument
#define defineTemplatedRunTimeSelectionTableConstructor\
(baseType,argNames,Targ) \
\
/* Table constructor called from the table add function */ \
void baseType<Targ>::construct##argNames##ConstructorTables() \
{ \
static bool constructed = false; \
\
if (!constructed) \
{ \
baseType<Targ>::argNames##ConstructorTablePtr_ \
= new baseType<Targ>::argNames##ConstructorTable; \
\
constructed = true; \
} \
}
// internal use:
// destructor aid
// use when baseType requires the Targ template argument
#define defineTemplatedRunTimeSelectionTableDestructor\
(baseType,argNames,Targ) \
\
/* Table destructor called from the table add function destructor */ \
void baseType<Targ>::destroy##argNames##ConstructorTables() \
{ \
if (baseType<Targ>::argNames##ConstructorTablePtr_) \
{ \
delete baseType<Targ>::argNames##ConstructorTablePtr_; \
baseType<Targ>::argNames##ConstructorTablePtr_ = NULL; \
} \
}
// internal use:
// create pointer to hash-table of functions
// use when baseType requires the Targ template argument
#define defineTemplatedRunTimeSelectionTablePtr\
(baseType,argNames,Targ) \
\
/* Define the constructor function table */ \
baseType<Targ>::argNames##ConstructorTable* \
baseType<Targ>::argNames##ConstructorTablePtr_ = NULL
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table for template classes
// use when baseType requires the Targ template argument
#define defineTemplatedRunTimeSelectionTable\
(baseType,argNames,Targ) \
\
template<> \
defineTemplatedRunTimeSelectionTablePtr(baseType,argNames,Targ); \
template<> \
defineTemplatedRunTimeSelectionTableConstructor(baseType,argNames,Targ) \
template<> \
defineTemplatedRunTimeSelectionTableDestructor(baseType,argNames,Targ)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -181,10 +181,7 @@ inline void Foam::autoPtr<T>::operator=(const autoPtr<T>& ap)
{
if (this != &ap)
{
const_cast<autoPtr<T>&>(*this).reset
(
const_cast<autoPtr<T>&>(ap).ptr()
);
reset(const_cast<autoPtr<T>&>(ap).ptr());
}
}

View File

@ -90,10 +90,10 @@ public:
inline explicit xfer(T* = 0);
//- Construct by copying or by transferring the parameter contents
inline xfer(T&, bool allowTransfer=false);
inline explicit xfer(T&, bool allowTransfer=false);
//- Construct by copying the parameter contents
inline xfer(const T&);
inline explicit xfer(const T&);
//- Construct by transferring the contents
inline xfer(const xfer<T>&);

View File

@ -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
// ************************************************************************* //

View File

@ -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>&);

View File

@ -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)
{}

View File

@ -25,6 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "face.H"
#include "triFace.H"
#include "triPointRef.H"
#include "mathematicalConstants.H"
@ -283,6 +284,14 @@ void Foam::face::split
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::face::face(const triFace& f)
:
labelList(f)
{}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //

View File

@ -56,6 +56,7 @@ namespace Foam
// Forward declaration of friend functions and operators
class face;
class triFace;
inline bool operator==(const face& a, const face& b);
inline bool operator!=(const face& a, const face& b);
inline Istream& operator>>(Istream&, face&);
@ -135,12 +136,18 @@ public:
//- Construct given size
explicit inline face(label);
//- Construct from labelList
//- Construct from list of labels
explicit inline face(const UList<label>&);
//- Construct from list of labels
explicit inline face(const labelList&);
//- Construct by transferring the parameter contents
explicit inline face(const xfer<labelList>&);
//- Copy construct from triFace
face(const triFace&);
//- Construct from Istream
inline face(Istream&);

View File

@ -42,32 +42,34 @@ inline Foam::label Foam::face::left(const label i) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct NULL
inline Foam::face::face()
{}
// Construct given size
inline Foam::face::face(label s)
:
labelList(s, -1)
{}
// Construct from components
inline Foam::face::face(const UList<label>& lst)
:
labelList(lst)
{}
inline Foam::face::face(const labelList& lst)
:
labelList(lst)
{}
// Construct from components
inline Foam::face::face(const xfer<labelList>& lst)
:
labelList(lst)
{}
// Construct from Istream
inline Foam::face::face(Istream& is)
{
is >> *this;

View File

@ -26,15 +26,14 @@ License
#include "face.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type face::average(const pointField& meshPoints, const Field<Type>& f) const
Type Foam::face::average
(
const pointField& meshPoints,
const Field<Type>& f
) const
{
// Calculate the average by breaking the face into triangles and
// area-weighted averaging their averages
@ -42,7 +41,7 @@ Type face::average(const pointField& meshPoints, const Field<Type>& f) const
// If the face is a triangle, do a direct calculation
if (size() == 3)
{
return
return
(1.0/3.0)
*(
f[operator[](0)]
@ -71,7 +70,7 @@ Type face::average(const pointField& meshPoints, const Field<Type>& f) const
for (register label pI=0; pI<nPoints; pI++)
{
// Calculate 3*triangle centre field value
Type ttcf =
Type ttcf =
(
f[operator[](pI)]
+ f[operator[]((pI + 1) % nPoints)]
@ -99,9 +98,4 @@ Type face::average(const pointField& meshPoints, const Field<Type>& f) const
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -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

View File

@ -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
inline Foam::tetCell::tetCell
(
const label a,
const label b,
@ -56,13 +49,13 @@ inline tetCell::tetCell
}
inline tetCell::tetCell(const FixedList<label, 4>& lst)
inline Foam::tetCell::tetCell(const FixedList<label, 4>& lst)
:
FixedList<label, 4>(lst)
{}
inline tetCell::tetCell(Istream& is)
inline Foam::tetCell::tetCell(Istream& is)
:
FixedList<label, 4>(is)
{}
@ -70,7 +63,7 @@ inline tetCell::tetCell(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline triFace tetCell::face(const label facei) const
inline Foam::triFace Foam::tetCell::face(const label faceI) const
{
// Warning. Ordering of faces needs to be the same for a tetrahedron
// class, a tetrahedron cell shape model and a tetCell
@ -79,24 +72,24 @@ inline triFace tetCell::face(const label facei) const
static const label c[] = {3, 2, 3, 1};
# ifdef FULLDEBUG
if (facei >= 4)
if (faceI >= 4)
{
FatalErrorIn("tetCell::tetEdge(const label facei) const")
<< "index out of range 0 -> 3. facei = " << facei
FatalErrorIn("tetCell::tetEdge(const label faceI) const")
<< "index out of range 0 -> 3. faceI = " << faceI
<< abort(FatalError);
}
# endif
return triFace
(
operator[](a[facei]),
operator[](b[facei]),
operator[](c[facei])
operator[](a[faceI]),
operator[](b[faceI]),
operator[](c[faceI])
);
}
inline label tetCell::edgeFace(const label edgei) const
inline Foam::label Foam::tetCell::edgeFace(const label edgeI) const
{
// Warning. Ordering of faces needs to be the same for a tetrahedron
// class, a tetrahedron cell shape model and a tetCell
@ -104,25 +97,25 @@ inline label tetCell::edgeFace(const label edgei) const
static const label edgeFaces[6] = {2, 3, 1, 0, 0, 1};
# ifdef FULLDEBUG
if (edgei >= 6)
if (edgeI >= 6)
{
FatalErrorIn
(
"tetCell::edgeFace(const label edgei, const label facei)"
"tetCell::edgeFace(const label edgeI)"
"const"
) << "edge index out of range 0 -> 5. edgei = " << edgei
) << "edge index out of range 0 -> 5. edgeI = " << edgeI
<< abort(FatalError);
}
# endif
return edgeFaces[edgei];
return edgeFaces[edgeI];
}
inline label tetCell::edgeAdjacentFace
inline Foam::label Foam::tetCell::edgeAdjacentFace
(
const label edgei,
const label facei
const label edgeI,
const label faceI
) const
{
// Warning. Ordering of faces needs to be the same for a tetrahedron
@ -138,32 +131,32 @@ inline label tetCell::edgeAdjacentFace
};
# ifdef FULLDEBUG
if (facei >= 4)
if (faceI >= 4)
{
FatalErrorIn
(
"tetCell::edgeAdjacentFace(const label edgei, const label facei)"
"tetCell::edgeAdjacentFace(const label edgeI, const label faceI)"
"const"
) << "face index out of range 0 -> 3. facei = " << facei
) << "face index out of range 0 -> 3. faceI = " << faceI
<< abort(FatalError);
}
if (edgei >= 6)
if (edgeI >= 6)
{
FatalErrorIn
(
"tetCell::edgeAdjacentFace(const label edgei, const label facei)"
"tetCell::edgeAdjacentFace(const label edgeI, const label faceI)"
"const"
) << "edge index out of range 0 -> 5. edgei = " << edgei
) << "edge index out of range 0 -> 5. edgeI = " << edgeI
<< abort(FatalError);
}
# endif
return adjacentFace[edgei][facei];
return adjacentFace[edgeI][faceI];
}
inline edge tetCell::tetEdge(const label edgei) const
inline Foam::edge Foam::tetCell::tetEdge(const label edgeI) const
{
// Warning. Ordering of edges needs to be the same for a tetrahedron
// class, a tetrahedron cell shape model and a tetCell
@ -172,19 +165,19 @@ inline edge tetCell::tetEdge(const label edgei) const
static const label end[] = {1, 2, 3, 1, 2, 2};
# ifdef FULLDEBUG
if (edgei >= 6)
if (edgeI >= 6)
{
FatalErrorIn("tetCell::tetEdge(const label edgei) const")
<< "index out of range 0 -> 5. edgei = " << edgei
FatalErrorIn("tetCell::tetEdge(const label edgeI) const")
<< "index out of range 0 -> 5. edgeI = " << edgeI
<< abort(FatalError);
}
# endif
return edge(operator[](start[edgei]), operator[](end[edgei]));
return edge(operator[](start[edgeI]), operator[](end[edgeI]));
}
inline tetPointRef tetCell::tet(const pointField& points) const
inline Foam::tetPointRef Foam::tetCell::tet(const pointField& points) const
{
return tetPointRef
(
@ -196,8 +189,4 @@ inline tetPointRef tetCell::tet(const pointField& points) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -58,7 +58,7 @@ inline bool operator!=(const triFace&, const triFace&);
/*---------------------------------------------------------------------------*\
class triFace Declaration
class triFace Declaration
\*---------------------------------------------------------------------------*/
class triFace

View File

@ -39,7 +39,7 @@ SourceFiles
#define faceMapper_H
#include "morphFieldMapper.H"
#include "labelHashSet.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -143,7 +143,7 @@ SourceFiles
#include "labelList.H"
#include "objectMap.H"
#include "pointField.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -39,7 +39,7 @@ SourceFiles
#include "List.H"
#include "IndirectList.H"
#include "regIOobject.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "pointFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -57,7 +57,7 @@ SourceFiles
#include "edgeList.H"
#include "point.H"
#include "intersection.H"
#include "labelHashSet.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -27,7 +27,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "PrimitivePatch.H"
#include "labelHashSet.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,18 +38,18 @@ License
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
PrimitivePatchExtra
(
const ListType<Face>& faces,
const pointField& points
const FaceList<Face>& faces,
const Field<PointType>& points
)
:
PrimitivePatch<Face, ListType, PointField, PointType>(faces, points),
ParentType(faces, points),
sortedEdgeFacesPtr_(NULL),
edgeOwnerPtr_(NULL)
{}
@ -59,17 +59,17 @@ PrimitivePatchExtra
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
PrimitivePatchExtra
(
const PrimitivePatchExtra<Face, ListType, PointField, PointType>& pp
const PrimitivePatchExtra<Face, FaceList, PointField, PointType>& pp
)
:
PrimitivePatch<Face, ListType, PointField, PointType>(pp),
ParentType(pp),
sortedEdgeFacesPtr_(NULL),
edgeOwnerPtr_(NULL)
{}
@ -80,11 +80,11 @@ PrimitivePatchExtra
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
~PrimitivePatchExtra()
{
clearOut();
@ -95,14 +95,14 @@ Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
clearOut()
{
PrimitivePatch<Face, ListType, PointField, PointType>::clearOut();
ParentType::clearOut();
clearTopology();
}
@ -110,14 +110,14 @@ clearOut()
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
clearTopology()
{
PrimitivePatch<Face, ListType, PointField, PointType>::clearTopology();
ParentType::clearTopology();
deleteDemandDrivenData(sortedEdgeFacesPtr_);
deleteDemandDrivenData(edgeOwnerPtr_);
}
@ -126,12 +126,12 @@ clearTopology()
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelListList&
Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
sortedEdgeFaces() const
{
if (!sortedEdgeFacesPtr_)
@ -146,12 +146,12 @@ sortedEdgeFaces() const
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelList&
Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
edgeOwner() const
{
if (!edgeOwnerPtr_)

View File

@ -50,13 +50,13 @@ namespace Foam
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType=point
>
class PrimitivePatchExtra
:
public PrimitivePatch<Face, ListType, PointField, PointType>
public PrimitivePatch<Face, FaceList, PointField, PointType>
{
public:
@ -64,13 +64,13 @@ public:
// Public typedefs
typedef Face FaceType;
typedef ListType<Face> FaceListType;
typedef FaceList<Face> FaceListType;
typedef PointField PointFieldType;
private:
// Private typedefs
typedef PrimitivePatch<Face, ListType, PointField, PointType> TemplateType;
typedef PrimitivePatch<Face, FaceList, PointField, PointType> ParentType;
// Private data
@ -99,14 +99,14 @@ public:
//- Construct from components
PrimitivePatchExtra
(
const ListType<Face>& faces,
const pointField& points
const FaceList<Face>& faces,
const Field<PointType>& points
);
//- Construct as copy
PrimitivePatchExtra
(
const PrimitivePatchExtra<Face, ListType, PointField, PointType>&
const PrimitivePatchExtra<Face, FaceList, PointField, PointType>&
);
@ -161,7 +161,7 @@ public:
// Note: faceZone has to be sized nFaces before calling.
void markZone
(
const boolList& borderEdge,
const UList<bool>& borderEdge,
const label faceI,
const label currentZone,
labelList& faceZone
@ -172,17 +172,17 @@ public:
// (bool for every edge in surface). Returns number of zones.
label markZones
(
const boolList& borderEdge,
const UList<bool>& borderEdge,
labelList& faceZone
) const;
//- Determine the mapping for a sub-mesh.
// Only include faces for which boolList entry is true
// Only include faces for which bool List entry is true
// @param[out] pointMap mapping new to old localPoints
// @param[out] faceMap mapping new to old faces
void subsetMap
(
const boolList& include,
const UList<bool>& include,
labelList& pointMap,
labelList& faceMap
) const;

View File

@ -40,24 +40,28 @@ Description
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
calcSortedEdgeFaces() const
{
if (sortedEdgeFacesPtr_)
{
FatalErrorIn("PrimitivePatchExtra<Face, ListType, PointField>::calcSortedEdgeFaces()")
FatalErrorIn
(
"PrimitivePatchExtra<Face, FaceList, PointField>::"
"calcSortedEdgeFaces()"
)
<< "sortedEdgeFacesPtr_ already set"
<< abort(FatalError);
}
const labelListList& eFaces = TemplateType::edgeFaces();
const edgeList& edgeLst = TemplateType::edges();
const pointField& locPointLst = TemplateType::localPoints();
const List<FaceType>& locFaceLst = TemplateType::localFaces();
const labelListList& eFaces = this->edgeFaces();
const edgeList& edgeLst = this->edges();
const Field<PointType>& locPointLst = this->localPoints();
const List<Face>& locFaceLst = this->localFaces();
// create the lists for the various results. (resized on completion)
sortedEdgeFacesPtr_ = new labelListList(eFaces.size());
@ -101,7 +105,7 @@ calcSortedEdgeFaces() const
for (label nbI = 1; nbI < myFaceNbs.size(); nbI++)
{
// Get opposite vertex
const FaceType& f = locFaceLst[myFaceNbs[nbI]];
const Face& f = locFaceLst[myFaceNbs[nbI]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
@ -137,30 +141,31 @@ calcSortedEdgeFaces() const
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
calcEdgeOwner() const
{
if (edgeOwnerPtr_)
{
FatalErrorIn("PrimitivePatchExtra<Face, ListType, PointField>::calcEdgeOwner()")
FatalErrorIn
(
"PrimitivePatchExtra<Face, FaceList, PointField>::"
"calcEdgeOwner()"
)
<< "edgeOwnerPtr_ already set"
<< abort(FatalError);
}
// create the owner list
edgeOwnerPtr_ = new labelList
(
TemplateType::nEdges()
);
edgeOwnerPtr_ = new labelList(this->nEdges());
labelList& edgeOwner = *edgeOwnerPtr_;
const edgeList& edgeLst = TemplateType::edges();
const labelListList& eFaces = TemplateType::edgeFaces();
const List<FaceType>& locFaceLst = TemplateType::localFaces();
const edgeList& edgeLst = this->edges();
const labelListList& eFaces = this->edgeFaces();
const List<Face>& locFaceLst = this->localFaces();
forAll(edgeLst, edgeI)
@ -181,7 +186,7 @@ calcEdgeOwner() const
forAll(myFaces, i)
{
const FaceType& f = locFaceLst[myFaces[i]];
const Face& f = locFaceLst[myFaces[i]];
if (f.findEdge(e) > 0)
{
@ -192,11 +197,15 @@ calcEdgeOwner() const
if (edgeOwner[edgeI] == -1)
{
FatalErrorIn("PrimitivePatchExtra<Face, ListType, PointField>::calcEdgeOwner()")
FatalErrorIn
(
"PrimitivePatchExtra<Face, FaceList, PointField>::"
"calcEdgeOwner()"
)
<< "Edge " << edgeI << " vertices:" << e
<< " is used by faces " << myFaces
<< " vertices:"
<< IndirectList<FaceType>(locFaceLst, myFaces)()
<< IndirectList<Face>(locFaceLst, myFaces)()
<< " none of which use the edge vertices in the same order"
<< nl << "I give up" << abort(FatalError);
}

View File

@ -34,18 +34,18 @@ License
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
checkEdges
(
const bool verbose
) const
{
const labelListList& eFaces = TemplateType::edgeFaces();
const edgeList& edgeLst = TemplateType::edges();
const labelListList& eFaces = this->edgeFaces();
const edgeList& edgeLst = this->edges();
forAll(eFaces, edgeI)
{
@ -55,7 +55,10 @@ checkEdges
// interior edges have two faces
if (myFaces.size() == 0)
{
FatalErrorIn("PrimitivePatchExtra::checkEdges(bool verbose)")
FatalErrorIn
(
"PrimitivePatchExtra::checkEdges(bool verbose)"
)
<< "Edge " << edgeI << " with vertices " << edgeLst[edgeI]
<< " has no edgeFaces"
<< exit(FatalError);
@ -65,7 +68,8 @@ checkEdges
WarningIn
(
"PrimitivePatchExtra::checkEdges(bool verbose)"
) << "Edge " << edgeI << " with vertices " << edgeLst[edgeI]
)
<< "Edge " << edgeI << " with vertices " << edgeLst[edgeI]
<< " has more than 2 faces connected to it : " << myFaces
<< endl;
}
@ -77,23 +81,23 @@ checkEdges
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::boolList
Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
checkOrientation
(
const bool verbose
) const
{
const ListType<FaceType>& faceLst = *this;
const edgeList& edgeLst = TemplateType::edges();
const labelListList& faceEs = TemplateType::faceEdges();
const label numEdges = TemplateType::nEdges();
const pointField& pointLst = TemplateType::points();
const vectorField& normLst = TemplateType::faceNormals();
const FaceList<Face>& faceLst = *this;
const edgeList& edgeLst = this->edges();
const labelListList& faceEs = this->faceEdges();
const label numEdges = this->nEdges();
const Field<PointType>& pointLst = this->points();
const vectorField& normLst = this->faceNormals();
// Check edge normals, face normals, point normals.
forAll(faceEs, faceI)
@ -102,7 +106,10 @@ checkOrientation
if (edgeLabels.size() < 3)
{
FatalErrorIn("PrimitivePatchExtra::checkOrientation(bool)")
FatalErrorIn
(
"PrimitivePatchExtra::checkOrientation(bool)"
)
<< "face " << faceLst[faceI]
<< " has fewer than 3 edges. Edges:" << edgeLabels
<< exit(FatalError);
@ -116,9 +123,10 @@ checkOrientation
WarningIn
(
"PrimitivePatchExtra::checkOrientation(bool)"
) << "edge number " << edgeLabels[i] << " on face " << faceI
)
<< "edge number " << edgeLabels[i] << " on face " << faceI
<< " out-of-range\n"
<< "This usually means that the input surface has "
<< "This usually means the input surface has "
<< "edges with more than 2 faces connected.\n"
<< endl;
valid = false;
@ -133,7 +141,7 @@ checkOrientation
//
//- Compute normal from 3 points, use the first as the origin
// minor warpage should not be a problem
const FaceType& f = faceLst[faceI];
const Face& f = faceLst[faceI];
const point p0(pointLst[f[0]]);
const point p1(pointLst[f[1]]);
const point p2(pointLst[f[f.size()-1]]);
@ -141,23 +149,26 @@ checkOrientation
const vector pointNormal((p1 - p0) ^ (p2 - p0));
if ((pointNormal & normLst[faceI]) < 0)
{
FatalErrorIn("PrimitivePatchExtra::checkOrientation(bool)")
<< "Normal calculated from points not consistent with"
" faceNormal" << endl
<< "face: " << f << endl
<< "points: " << p0 << ' ' << p1 << ' ' << p2 << endl
<< "pointNormal:" << pointNormal << endl
FatalErrorIn
(
"PrimitivePatchExtra::checkOrientation(bool)"
)
<< "Normal calculated from points not consistent with "
<< "faceNormal" << nl
<< "face: " << f << nl
<< "points: " << p0 << ' ' << p1 << ' ' << p2 << nl
<< "pointNormal:" << pointNormal << nl
<< "faceNormal:" << normLst[faceI]
<< exit(FatalError);
}
}
const labelListList& eFaces = TemplateType::edgeFaces();
const pointField& locPointsLst = TemplateType::localPoints();
const labelListList& eFaces = this->edgeFaces();
const pointField& locPointsLst = this->localPoints();
// Storage for holding status of edge. True if normal flips across this
// edge
// Storage for holding status of edge.
// True if normal flips across this edge
boolList borderEdge(numEdges, false);
forAll(edgeLst, edgeI)
@ -167,8 +178,8 @@ checkOrientation
if (neighbours.size() == 2)
{
const FaceType& faceA = faceLst[neighbours[0]];
const FaceType& faceB = faceLst[neighbours[1]];
const Face& faceA = faceLst[neighbours[0]];
const Face& faceB = faceLst[neighbours[1]];
// The edge cannot be going in the same direction if both faces
// are oriented counterclockwise.
@ -182,7 +193,10 @@ checkOrientation
borderEdge[edgeI] = true;
if (verbose)
{
WarningIn("PrimitivePatchExtra::checkOrientation(bool)")
WarningIn
(
"PrimitivePatchExtra::checkOrientation(bool)"
)
<< "face orientation incorrect." << nl
<< "edge[" << edgeI << "] " << e
<< " between faces " << neighbours << ":" << nl
@ -195,10 +209,13 @@ checkOrientation
{
if (verbose)
{
WarningIn("PrimitivePatchExtra::checkOrientation(bool)")
<< "Wrong number of edge neighbours." << endl
WarningIn
(
"PrimitivePatchExtra::checkOrientation(bool)"
)
<< "Wrong number of edge neighbours." << nl
<< "edge[" << edgeI << "] " << e
<< "with points:" << locPointsLst[e.start()]
<< " with points:" << locPointsLst[e.start()]
<< ' ' << locPointsLst[e.end()]
<< " has neighbours:" << neighbours << endl;
}

View File

@ -33,13 +33,13 @@ License
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::markZone
(
const boolList& borderEdge,
const UList<bool>& borderEdge,
const label faceI,
const label currentZone,
labelList& faceZone
@ -48,8 +48,8 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone
// List of faces whose faceZone has been set.
labelList changedFaces(1, faceI);
const labelListList& faceEs = TemplateType::faceEdges();
const labelListList& eFaces = TemplateType::edgeFaces();
const labelListList& faceEs = this->faceEdges();
const labelListList& eFaces = this->edgeFaces();
while (true)
{
@ -62,9 +62,9 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone
const labelList& fEdges = faceEs[faceI];
forAll(fEdges, i)
forAll(fEdges, fEdgeI)
{
label edgeI = fEdges[i];
label edgeI = fEdges[fEdgeI];
if (!borderEdge[edgeI])
{
@ -83,7 +83,7 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone
{
FatalErrorIn
(
"PrimitivePatchExtra<Face, ListType, PointField>::markZone"
"PrimitivePatchExtra<Face, FaceList, PointField>::markZone"
"(const boolList&, const label, const label, labelList&) const"
)
<< "Zones " << faceZone[nbrFaceI]
@ -113,28 +113,25 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::label Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
Foam::label Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
markZones
(
const boolList& borderEdge,
const UList<bool>& borderEdge,
labelList& faceZone
) const
{
const label numEdges = TemplateType::nEdges();
const label numFaces = TemplateType::size();
faceZone.setSize(numFaces);
faceZone = -1;
const label numEdges = this->nEdges();
const label numFaces = this->size();
if (borderEdge.size() != numEdges)
{
FatalErrorIn
(
"PrimitivePatchExtra<Face, ListType, PointField>::markZones"
"PrimitivePatchExtra<Face, FaceList, PointField>::markZones"
"(const boolList&, labelList&)"
)
<< "borderEdge boolList not same size as number of edges" << endl
@ -143,28 +140,32 @@ markZones
<< exit(FatalError);
}
faceZone.setSize(numFaces);
faceZone = -1;
label zoneI = 0;
label startFaceI = 0;
for (;;zoneI++)
while (true)
{
// Find first non-coloured face
// Find first non-visited face
for (; startFaceI < numFaces; startFaceI++)
{
if (faceZone[startFaceI] == -1)
{
faceZone[startFaceI] = zoneI;
markZone(borderEdge, startFaceI, zoneI, faceZone);
break;
}
}
if (startFaceI >= numFaces)
{
// Finished
break;
}
faceZone[startFaceI] = zoneI;
markZone(borderEdge, startFaceI, zoneI, faceZone);
zoneI++;
}
return zoneI;
@ -177,20 +178,20 @@ markZones
template
<
class Face,
template<class> class ListType,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
subsetMap
(
const boolList& include,
const UList<bool>& include,
labelList& pointMap,
labelList& faceMap
) const
{
const List<FaceType>& locFaces = TemplateType::localFaces();
const label numPoints = TemplateType::nPoints();
const List<Face>& locFaces = this->localFaces();
const label numPoints = this->nPoints();
label faceI = 0;
label pointI = 0;
@ -208,7 +209,7 @@ subsetMap
faceMap[faceI++] = oldFaceI;
// Renumber labels for face
const FaceType& f = locFaces[oldFaceI];
const Face& f = locFaces[oldFaceI];
forAll(f, fp)
{

View File

@ -64,7 +64,7 @@ SourceFiles
#include "cellShapeList.H"
#include "labelList.H"
#include "boolList.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
#include "EdgeMap.H"

View File

@ -1403,9 +1403,9 @@ Foam::polyDualMesh::polyDualMesh
polyMesh
(
mesh,
pointField(0),
faceList(0),
cellList(0)
xferCopy(pointField()), // to prevent any warnings "points not allocated"
xferCopy(faceList()), // to prevent any warnings "faces not allocated"
xferCopy(cellList())
),
cellPoint_
(
@ -1448,9 +1448,9 @@ Foam::polyDualMesh::polyDualMesh
polyMesh
(
mesh,
pointField(0), // to prevent any warnings "points not allocated"
faceList(0), // ,, faces ,,
cellList(0)
xferCopy(pointField()), // to prevent any warnings "points not allocated"
xferCopy(faceList()), // to prevent any warnings "faces not allocated"
xferCopy(cellList())
),
cellPoint_
(
@ -1482,7 +1482,6 @@ Foam::polyDualMesh::polyDualMesh
labelList featureEdges, featurePoints;
calcFeatures(mesh, featureCos, featureEdges, featurePoints);
calcDual(mesh, featureEdges, featurePoints);
}

View File

@ -133,7 +133,7 @@ Foam::labelList Foam::simpleGeomDecomp::decompose(const pointField& points)
sort
(
pointIndices,
SortableList<scalar>::less(rotatedPoints.component(vector::X))
UList<scalar>::less(rotatedPoints.component(vector::X))
);
assignToProcessorGroup(processorGroups, n_.x());
@ -149,7 +149,7 @@ Foam::labelList Foam::simpleGeomDecomp::decompose(const pointField& points)
sort
(
pointIndices,
SortableList<scalar>::less(rotatedPoints.component(vector::Y))
UList<scalar>::less(rotatedPoints.component(vector::Y))
);
assignToProcessorGroup(processorGroups, n_.y());
@ -165,7 +165,7 @@ Foam::labelList Foam::simpleGeomDecomp::decompose(const pointField& points)
sort
(
pointIndices,
SortableList<scalar>::less(rotatedPoints.component(vector::Z))
UList<scalar>::less(rotatedPoints.component(vector::Z))
);
assignToProcessorGroup(processorGroups, n_.z());

View File

@ -45,14 +45,6 @@ Foam::boundaryPatch::boundaryPatch
{}
Foam::boundaryPatch::boundaryPatch(const boundaryPatch& sp)
:
patchIdentifier(sp.name(), sp.index(), sp.physicalType()),
size_(sp.size()),
start_(sp.start())
{}
Foam::boundaryPatch::boundaryPatch
(
const word& name,
@ -66,6 +58,22 @@ Foam::boundaryPatch::boundaryPatch
{}
Foam::boundaryPatch::boundaryPatch(const boundaryPatch& p)
:
patchIdentifier(p.name(), p.index(), p.physicalType()),
size_(p.size()),
start_(p.start())
{}
Foam::boundaryPatch::boundaryPatch(const boundaryPatch& p, const label index)
:
patchIdentifier(p.name(), index, p.physicalType()),
size_(p.size()),
start_(p.start())
{}
Foam::autoPtr<Foam::boundaryPatch> Foam::boundaryPatch::clone() const
{
return autoPtr<boundaryPatch>(new boundaryPatch(*this));
@ -90,9 +98,9 @@ void Foam::boundaryPatch::write(Ostream& os) const
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const boundaryPatch& sp)
Foam::Ostream& Foam::operator<<(Ostream& os, const boundaryPatch& p)
{
sp.write(os);
p.write(os);
os.check("Ostream& operator<<(Ostream& f, const boundaryPatch&)");
return os;
}

View File

@ -83,6 +83,9 @@ public:
//- Construct as copy
boundaryPatch(const boundaryPatch&);
//- Construct as copy, resetting the index
boundaryPatch(const boundaryPatch&, const label index);
//- Clone
autoPtr<boundaryPatch> clone() const;

View File

@ -1259,10 +1259,10 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
runTime,
IOobject::NO_READ
),
domainPoints,
domainFaces,
domainAllOwner,
domainAllNeighbour,
xferMove(domainPoints),
xferMove(domainFaces),
xferMove(domainAllOwner),
xferMove(domainAllNeighbour),
false // no parallel comms
)
);

View File

@ -31,7 +31,7 @@ License
#include "meshTools.H"
#include "SortableList.H"
#include "triSurfaceTools.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "ListOps.H"
#include "transform.H"

View File

@ -75,7 +75,7 @@ SourceFiles
#define motionSmoother_H
#include "pointFields.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "PackedList.H"
#include "indirectPrimitivePatch.H"
#include "className.H"

View File

@ -40,7 +40,7 @@ SourceFiles
#define polyMeshGeometry_H
#include "pointFields.H"
#include "labelHashSet.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -56,7 +56,7 @@ SourceFiles
#include "labelList.H"
#include "point.H"
#include "Map.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "typeInfo.H"
#include "edgeList.H"

View File

@ -38,7 +38,7 @@ SourceFiles
#include "labelIOList.H"
#include "face.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "DynamicList.H"
#include "primitivePatch.H"
#include "removeFaces.H"

View File

@ -46,7 +46,7 @@ SourceFiles
#include "typeInfo.H"
#include "Map.H"
#include "labelList.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "faceList.H"
#include "boolList.H"

View File

@ -73,7 +73,7 @@ SourceFiles
#include "PtrList.H"
#include "cellList.H"
#include "Map.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "mapPolyMesh.H"
#include "CompactListList.H"
#include "PackedList.H"

View File

@ -40,7 +40,7 @@ SourceFiles
#define removeFaces_H
#include "Pstream.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
#include "boolList.H"
#include "indirectPrimitivePatch.H"

View File

@ -63,16 +63,16 @@ void Foam::porousZone::adjustNegativeResistance(dimensionedVector& resist)
Foam::porousZone::porousZone
(
const fvMesh& mesh,
const word& name,
const fvMesh& mesh,
const dictionary& dict
)
:
mesh_(mesh),
name_(name),
mesh_(mesh),
dict_(dict),
cellZoneID_(mesh_.cellZones().findZoneID(name)),
coordSys_(dict),
coordSys_(dict, mesh),
porosity_(1),
C0_(0),
C1_(0),
@ -372,25 +372,21 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
if (dict_.found("porosity"))
{
os.writeKeyword("porosity")
<< porosity()
<< token::END_STATEMENT << nl;
os.writeKeyword("porosity") << porosity() << token::END_STATEMENT << nl;
}
if (dict_.found("powerLaw"))
// powerLaw coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{
const dictionary& subDict = dict_.subDict("powerLaw");
os << indent << "powerLaw";
subDict.write(os);
dictPtr->write(os);
}
if (dict_.found("Darcy"))
// Darcy-Forchheimer coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("Darcy"))
{
const dictionary& subDict = dict_.subDict("Darcy");
os << indent << "Darcy";
subDict.write(os);
dictPtr->write(os);
}
os << decrIndent << indent << token::END_BLOCK << endl;

View File

@ -92,19 +92,19 @@ class porousZone
{
// Private data
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
//- Name of this zone
word name_;
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
//- Dictionary containing the parameters
dictionary dict_;
//- Cell zone ID
label cellZoneID_;
//- Coordinate system (Cartesian)
//- Coordinate system used for the zone (Cartesian)
coordinateSystem coordSys_;
//- porosity of the zone (0 < porosity <= 1)
@ -189,7 +189,7 @@ public:
// Constructors
//- Construct from components
porousZone(const fvMesh&, const word& name, const dictionary&);
porousZone(const word& name, const fvMesh&, const dictionary&);
//- Return clone
autoPtr<porousZone> clone() const
@ -199,12 +199,8 @@ public:
}
//- Return a pointer to a new porousZone created on freestore
// from Istream
// Has the ability to rewrite coordinate systems as required
//- Return pointer to new porousZone created on freestore from Istream
class iNew
:
public coordinateSystems
{
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
@ -213,13 +209,6 @@ public:
iNew(const fvMesh& mesh)
:
coordinateSystems(),
mesh_(mesh)
{}
iNew(const fvMesh& mesh, const coordinateSystems& cs)
:
coordinateSystems(cs),
mesh_(mesh)
{}
@ -227,9 +216,8 @@ public:
{
word name(is);
dictionary dict(is);
rewriteDict(dict, true);
return autoPtr<porousZone>(new porousZone(mesh_, name, dict));
return autoPtr<porousZone>(new porousZone(name, mesh_, dict));
}
};

View File

@ -37,29 +37,6 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousZones::porousZones
(
const fvMesh& mesh,
const coordinateSystems& cs
)
:
IOPtrList<porousZone>
(
IOobject
(
"porousZones",
mesh.time().constant(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
porousZone::iNew(mesh)
),
mesh_(mesh),
csList_(cs)
{}
Foam::porousZones::porousZones
(
const fvMesh& mesh
@ -72,32 +49,14 @@ Foam::porousZones::porousZones
"porousZones",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
porousZone::iNew(mesh)
),
mesh_(mesh),
csList_(mesh)
{
clear();
mesh_(mesh)
{}
IOPtrList<porousZone> newList
(
IOobject
(
"porousZones",
mesh_.time().constant(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false // Don't register new zones with objectRegistry
),
porousZone::iNew(mesh_, csList_)
);
transfer(newList);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -134,7 +93,7 @@ bool Foam::porousZones::readData(Istream& is)
{
clear();
IOPtrList<porousZone> newList
IOPtrList<porousZone> newLst
(
IOobject
(
@ -143,12 +102,12 @@ bool Foam::porousZones::readData(Istream& is)
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // Don't register new zones with objectRegistry
false // Don't re-register new zones with objectRegistry
),
porousZone::iNew(mesh_, csList_)
porousZone::iNew(mesh_)
);
transfer(newList);
transfer(newLst);
return is.good();
}

View File

@ -40,7 +40,7 @@ Description
cat1
{
coordinateSystem system_10;
porosity 0.781;
porosity 0.781;
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
@ -84,9 +84,6 @@ class porousZones
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
//- Reference to constant coordinate systems
coordinateSystems csList_;
// Private Member Functions
//- Disallow default bitwise copy construct
@ -104,12 +101,9 @@ public:
// Constructors
//- Construct from fvMesh and coordinate systems list
porousZones(const fvMesh& mesh, const coordinateSystems& cs);
//- Construct from fvMesh
// with automatically constructed coordinate systems list
porousZones(const fvMesh& mesh);
porousZones(const fvMesh&);
// Member Functions

View File

@ -37,7 +37,7 @@ SourceFiles
#include "faceStencil.H"
#include "boolList.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
#include "EdgeMap.H"

View File

@ -37,7 +37,7 @@ SourceFiles
#include "faceStencil.H"
#include "boolList.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,7 +38,7 @@ SourceFiles
#include "faceStencil.H"
#include "boolList.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
#include "EdgeMap.H"

View File

@ -38,7 +38,7 @@ SourceFiles
#include "globalIndex.H"
#include "boolList.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -39,7 +39,7 @@ SourceFiles
#include "morphFieldMapper.H"
#include "fvMesh.H"
#include "faceMapper.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -675,9 +675,9 @@ void Foam::fvMeshSubset::setCellSubset
IOobject::NO_READ,
IOobject::NO_WRITE
),
newPoints,
newFaces,
newCells
xferMove(newPoints),
xferMove(newFaces),
xferMove(newCells)
)
);
@ -1173,9 +1173,9 @@ void Foam::fvMeshSubset::setLargeCellSubset
IOobject::NO_READ,
IOobject::NO_WRITE
),
newPoints,
newFaces,
newCells,
xferMove(newPoints),
xferMove(newFaces),
xferMove(newCells),
syncPar // parallel synchronisation
)
);

View File

@ -60,7 +60,7 @@ SourceFiles
#include "fvPatchFieldMapper.H"
#include "pointPatchFieldMapper.H"
#include "GeometricField.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -27,7 +27,7 @@ License
#include "inverseDistanceDiffusivity.H"
#include "addToRunTimeSelectionTable.H"
#include "patchWave.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "surfaceInterpolate.H"
#include "zeroGradientFvPatchFields.H"

View File

@ -26,7 +26,7 @@ License
#include "inverseFaceDistanceDiffusivity.H"
#include "addToRunTimeSelectionTable.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "wallPoint.H"
#include "MeshWave.H"
@ -98,7 +98,7 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
const polyPatch& patch = bdry[iter.key()];
const vectorField::subField fc = patch.faceCentres();
forAll(fc, patchFaceI)
{
changedFaces[nPatchFaces] = patch.start() + patchFaceI;
@ -134,7 +134,7 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
fvsPatchScalarField& bfld = faceDiffusivity_.boundaryField()[patchI];
const unallocLabelList& faceCells = bfld.patch().faceCells();
if (patchSet.found(patchI))
{
forAll(bfld, i)

View File

@ -26,7 +26,7 @@ License
#include "inversePointDistanceDiffusivity.H"
#include "addToRunTimeSelectionTable.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "pointEdgePoint.H"
#include "PointEdgeWave.H"
@ -133,7 +133,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
mesh,
seedPoints,
seedInfo,
pointWallDist,
edgeWallDist,
mesh.globalData().nTotalPoints() // max iterations
@ -167,7 +167,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
forAll(bfld, i)
{
const cell& ownFaces = mesh.cells()[faceCells[i]];
labelHashSet cPoints(4*ownFaces.size());
scalar dist = 0;
@ -185,7 +185,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
}
}
dist /= cPoints.size();
bfld[i] = 1.0/dist;
}
}

View File

@ -27,7 +27,7 @@ License
#include "inverseVolumeDiffusivity.H"
#include "addToRunTimeSelectionTable.H"
#include "patchWave.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "surfaceInterpolate.H"
#include "zeroGradientFvPatchFields.H"

View File

@ -6,7 +6,7 @@ wmake libso basic
wmake libso solidParticle
wmake libso intermediate
wmake libso dieselSpray
(cd molecularDynamics && wmake libso potential)
(cd molecularDynamics && wmake libso molecule)
molecularDynamics/Allwmake
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso potential
wmake libso molecule
# ----------------------------------------------------------------- end-of-file

View File

@ -37,7 +37,7 @@ SourceFiles
#define cellDistFuncs_H
#include "scalarField.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
#include "wordList.H"
#include "scalarField.H"

View File

@ -28,7 +28,7 @@ Description
#include "cellFeatures.H"
#include "primitiveMesh.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
#include "demandDrivenData.H"
#include "ListOps.H"

View File

@ -44,7 +44,7 @@ SourceFiles
#include "faceList.H"
#include "labelList.H"
#include "boolList.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
#include "DynamicList.H"

View File

@ -78,11 +78,11 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Construct from dictionary
cartesianCS(const word& name, const dictionary& dict);
cartesianCS(const word& name, const dictionary&);
};

View File

@ -120,7 +120,7 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation
:
coordinateRotation()
{
calcTransform( phiAngle, thetaAngle, psiAngle, inDegrees );
calcTransform(phiAngle, thetaAngle, psiAngle, inDegrees);
}

View File

@ -74,7 +74,7 @@ class EulerCoordinateRotation
const scalar phiAngle,
const scalar thetaAngle,
const scalar psiAngle,
const bool inDegrees = true
const bool inDegrees=true
);
@ -93,7 +93,7 @@ public:
EulerCoordinateRotation
(
const vector& phiThetaPsi,
const bool inDegrees = true
const bool inDegrees=true
);
//- Construct from components of rotation vector
@ -102,7 +102,7 @@ public:
const scalar phiAngle,
const scalar thetaAngle,
const scalar psiAngle,
const bool inDegrees = true
const bool inDegrees=true
);
//- Construct from dictionary

View File

@ -121,7 +121,7 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
:
coordinateRotation()
{
calcTransform( rotZ, rotX, rotY, inDegrees );
calcTransform(rotZ, rotX, rotY, inDegrees);
}

View File

@ -71,7 +71,7 @@ class STARCDCoordinateRotation
const scalar rotZ,
const scalar rotX,
const scalar rotY,
const bool inDegrees = true
const bool inDegrees=true
);
@ -90,7 +90,7 @@ public:
STARCDCoordinateRotation
(
const vector& rotZrotXrotY,
const bool inDegrees = true
const bool inDegrees=true
);
//- Construct from components of rotation vector
@ -99,7 +99,7 @@ public:
const scalar rotZ,
const scalar rotX,
const scalar rotY,
const bool inDegrees = true
const bool inDegrees=true
);
//- Construct from dictionary

View File

@ -26,6 +26,7 @@ License
#include "IOstream.H"
#include "coordinateSystem.H"
#include "coordinateSystems.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -43,6 +44,7 @@ namespace Foam
Foam::coordinateSystem::coordinateSystem()
:
name_(type()),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
@ -58,6 +60,7 @@ Foam::coordinateSystem::coordinateSystem
)
:
name_(name),
note_(),
origin_(origin),
R_(axis, dir),
Rtr_(R_.T())
@ -72,26 +75,13 @@ Foam::coordinateSystem::coordinateSystem
)
:
name_(name),
note_(),
origin_(origin),
R_(cr),
Rtr_(R_.T())
{}
Foam::coordinateSystem::coordinateSystem
(
const dictionary& dict
)
:
name_(type()),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
{
operator=(dict);
}
Foam::coordinateSystem::coordinateSystem
(
const word& name,
@ -99,6 +89,7 @@ Foam::coordinateSystem::coordinateSystem
)
:
name_(name),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
@ -107,9 +98,79 @@ Foam::coordinateSystem::coordinateSystem
}
Foam::coordinateSystem::coordinateSystem
(
const dictionary& dict
)
:
name_(type()),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
{
operator=(dict);
}
Foam::coordinateSystem::coordinateSystem
(
const dictionary& dict,
const objectRegistry& obr
)
:
name_(type()),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
{
const entry* entryPtr = dict.lookupEntryPtr(typeName_(), false, false);
// a simple entry is a lookup into global coordinateSystems
if (entryPtr && !entryPtr->isDict())
{
word csName;
entryPtr->stream() >> csName;
const coordinateSystems& csLst = coordinateSystems::New(obr);
label csId = csLst.find(csName);
if (debug)
{
Info<< "coordinateSystem::coordinateSystem"
"(const dictionary&, const objectRegistry&):"
<< nl << "using global coordinate system: "
<< csName << "=" << csId << endl;
}
if (csId < 0)
{
FatalErrorIn
(
"coordinateSystem::coordinateSystem"
"(const dictionary&, const objectRegistry&)"
) << "could not find coordinate system: " << csName << nl
<< "available coordinate systems: " << csLst.toc() << nl << nl
<< exit(FatalError);
}
// copy coordinateSystem, but assign the name as the typeName
// to avoid strange things in writeDict()
operator=(csLst[csId]);
name_ = typeName_();
}
else
{
operator=(dict);
}
}
Foam::coordinateSystem::coordinateSystem(Istream& is)
:
name_(is),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
@ -119,7 +180,6 @@ Foam::coordinateSystem::coordinateSystem(Istream& is)
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::coordinateSystem::~coordinateSystem()
@ -140,6 +200,12 @@ Foam::dictionary Foam::coordinateSystem::dict(bool ignoreType) const
dict.add("type", type());
}
// The note entry is optional
if (note_.size())
{
dict.add("note", note_);
}
dict.add("origin", origin_);
dict.add("e1", e1());
dict.add("e3", e3());
@ -219,8 +285,7 @@ Foam::tmp<Foam::vectorField> Foam::coordinateSystem::globalToLocal
void Foam::coordinateSystem::write(Ostream& os) const
{
os << type()
<< " origin: " << origin()
<< " e1: " << e1() << " e3: " << e3();
<< " origin: " << origin() << " e1: " << e1() << " e3: " << e3();
}
@ -235,7 +300,13 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const
// only write type for derived types
if (type() != typeName_())
{
os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
}
// The note entry is optional
if (note_.size())
{
os.writeKeyword("note") << note_ << token::END_STATEMENT << nl;
}
os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
@ -267,10 +338,14 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs)
);
// unspecified origin is (0 0 0)
origin_ = vector::zero;
origin_ = point::zero;
dict.readIfPresent("origin", origin_);
// specify via coordinateRotation
// The note entry is optional
note_.clear();
rhs.readIfPresent("note", note_);
// specify via coordinateRotation sub-dictionary
if (dict.found("coordinateRotation"))
{
autoPtr<coordinateRotation> cr =
@ -280,7 +355,7 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs)
}
else
{
// no sub-dictionary - specify via axes
// let coordinateRotation constructor extract the axes specification
R_ = coordinateRotation(dict);
}
@ -292,18 +367,11 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs)
bool Foam::operator!=(const coordinateSystem& a, const coordinateSystem& b)
{
if (a.origin() != b.origin() || a.R() != b.R() || a.type() != b.type())
{
return true;
}
else
{
return false;
}
return (a.origin() != b.origin() || a.R() != b.R() || a.type() != b.type());
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const coordinateSystem& cs)
{

View File

@ -26,8 +26,8 @@ Class
Foam::coordinateSystem
Description
A cartesian coordinate system and the base class for
other coordinate system specifications
A cartesian coordinate system and the base class for other coordinate
system specifications
All systems are defined by an origin point and a coordinateRotation.
For convenience, the dictionary constructor forms allow a few shortcuts:
@ -99,6 +99,29 @@ Description
)
@endverbatim
- additionally, if the coordinateSystem points to a plain entry,
it can be used to reference one of the global coordinateSystems
@verbatim
1
(
cat1
{
coordinateSystem system_10;
porosity 0.781;
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
f f [0 -1 0 0 0] (-1000 -1000 12.83);
}
}
)
@endverbatim
For this to work correctly, the coordinateSystem constructor must be
supplied with both a dictionary and an objectRegistry.
See Also
coordinateSystems and coordinateSystems::New
SourceFiles
coordinateSystem.C
newCoordinateSystem.C
@ -132,6 +155,9 @@ class coordinateSystem
//- Name of coordinate system
mutable word name_;
//- Optional note
mutable string note_;
//- Origin
mutable point origin_;
@ -177,7 +203,7 @@ public:
// Constructors
//- Construct null
//- Construct null. This is equivalent to an identity coordinateSystem
coordinateSystem();
//- Construct from origin and 2 axes
@ -197,11 +223,15 @@ public:
const coordinateRotation&
);
//- Construct from dictionary with a given name
coordinateSystem(const word& name, const dictionary&);
//- Construct from dictionary with default name
coordinateSystem(const dictionary&);
//- Construct from dictionary
coordinateSystem(const word& name, const dictionary&);
//- Construct from dictionary (default name)
// With the ability to reference global coordinateSystems
coordinateSystem(const dictionary&, const objectRegistry&);
//- Construct from Istream
// The Istream contains a word followed by a dictionary
@ -281,14 +311,14 @@ public:
const word& coordType,
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Select constructed from dictionary
static autoPtr<coordinateSystem> New
(
const word& name,
const dictionary& dict
const dictionary&
);
//- Select constructed from Istream
@ -309,6 +339,18 @@ public:
return name_;
}
//- Return non-constant access to the optional note
string& note()
{
return note_;
}
//- Return the optional note
const string& note() const
{
return note_;
}
//- Return origin
const point& origin() const
{
@ -362,7 +404,7 @@ public:
//- Return as dictionary of entries
// @param [in] ignoreType drop type (cartesian, cylindrical, etc)
// when generating the dictionary
virtual dictionary dict(bool ignoreType = false) const;
virtual dictionary dict(bool ignoreType=false) const;
// Edit
@ -385,7 +427,7 @@ public:
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
virtual void writeDict(Ostream&, bool subDict=true) const;
// Transformations
@ -446,7 +488,11 @@ public:
// friend Operators
friend bool operator!=(const coordinateSystem&, const coordinateSystem&);
friend bool operator!=
(
const coordinateSystem&,
const coordinateSystem&
);
// IOstream Operators

View File

@ -26,59 +26,78 @@ License
#include "coordinateSystems.H"
#include "IOPtrList.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(coordinateSystems, 0);
defineTemplateTypeNameAndDebug(IOPtrList<coordinateSystem>, 0);
}
const Foam::word Foam::coordinateSystems::dataType("coordinateSystem");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::coordinateSystems::coordinateSystems()
Foam::coordinateSystems::coordinateSystems(const IOobject& io)
:
IOPtrList<coordinateSystem>(io)
{}
Foam::coordinateSystems::coordinateSystems
(
const objectRegistry& registry,
const word& name,
const fileName& instance
const IOobject& io,
const PtrList<coordinateSystem>& lst
)
{
IOPtrList<coordinateSystem> newList
(
IOobject
(
name,
instance,
registry,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false // don't register
)
);
transfer(newList);
}
:
IOPtrList<coordinateSystem>(io, lst)
{}
Foam::coordinateSystems::coordinateSystems
(
const IOobject& io
const IOobject& io,
const xfer<PtrList<coordinateSystem> >& lst
)
:
IOPtrList<coordinateSystem>(io, lst)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
// Read construct from registry, or return previously registered
const Foam::coordinateSystems& Foam::coordinateSystems::New
(
const objectRegistry& obr
)
{
IOPtrList<coordinateSystem> newList(io);
transfer(newList);
if (obr.foundObject<coordinateSystems>(typeName))
{
return obr.lookupObject<coordinateSystems>(typeName);
}
else
{
return obr.store
(
new coordinateSystems
(
IOobject
(
typeName,
"constant",
obr,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
)
);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::coordinateSystems::find(const word& keyword) const
{
forAll(*this, i)
@ -112,55 +131,19 @@ Foam::wordList Foam::coordinateSystems::toc() const
}
bool Foam::coordinateSystems::rewriteDict(dictionary& dict, bool noType) const
{
if (dict.found(dataType) && !dict.isDict(dataType))
{
word name(dict.lookup(dataType));
label i = find(name);
if (i >= 0)
{
dict.remove(dataType);
dict.add(dataType, operator[](i).dict(noType));
return true;
}
FatalErrorIn
(
"Foam::coordinateSystems::rewriteDict(dictionary&, bool) const"
) << "could not rewrite " << dataType << " " << name << nl
<< "available coordinate systems: " << toc() << nl << nl
<< "context: " << nl
<< dict << nl
<< exit(FatalError);
}
return false;
}
bool Foam::coordinateSystems::writeData(Ostream& os, bool subDict) const
{
// Write size of list
os << nl << size();
os << nl << size() << nl << token::BEGIN_LIST;
// Write beginning of contents
os << nl << token::BEGIN_LIST;
// Write list contents
forAll(*this, i)
{
os << nl;
operator[](i).writeDict(os, subDict);
}
// Write end of contents
os << token::END_LIST << nl;
// Check state of IOstream
return os.good();
}
// ************************************************************************* //

View File

@ -28,6 +28,10 @@ Class
Description
Provides a centralized coordinateSystem collection.
Note
Mixing normal constructors and the coordinateSystems::New constructor
may yield unexpected results.
SourceFiles
coordinateSystems.C
@ -36,7 +40,7 @@ SourceFiles
#define coordinateSystems_H
#include "coordinateSystem.H"
#include "PtrList.H"
#include "IOPtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,44 +53,49 @@ namespace Foam
class coordinateSystems
:
public PtrList<coordinateSystem>
public IOPtrList<coordinateSystem>
{
// Private Member Functions
//- Disallow default bitwise copy construct
coordinateSystems(const coordinateSystems&);
//- Disallow default bitwise assignment
void operator=(const coordinateSystems&);
public:
// Static data members
//- Type name of list contents
static const word dataType;
// Public Member Functions
//- Runtime type information
TypeName("coordinateSystems");
// Constructors
//- Construct null
coordinateSystems();
//- Read construct from IOobject
explicit coordinateSystems(const IOobject&);
//- Read construct from registry, name. instance
//- Construct from IOobject and a PtrList
coordinateSystems
(
const objectRegistry& registry,
const word& name = "coordinateSystems",
const fileName& instance = "constant"
const IOobject&,
const PtrList<coordinateSystem>&
);
//- Read construct from IOobject
coordinateSystems(const IOobject&);
//- Construct from IOobject and transferring the PtrList contents
coordinateSystems
(
const IOobject&,
const xfer<PtrList<coordinateSystem> >&
);
// Selectors
//- Return previously registered or read construct from "constant"
static const coordinateSystems& New(const objectRegistry&);
// Member Functions
//- Find and return index for a given keyword, returns -1 if not found
//- Find and return index for a given keyword, returns -1 if not found
label find(const word& key) const;
//- Search for given keyword
@ -95,47 +104,8 @@ public:
//- Return the table of contents (list of all keywords)
wordList toc() const;
//- Rewrite coordinateSystem entry with appropriate dictionary entry
//
// This replaces coordinateSystems entries with their contents.
// For example,
// @verbatim
// cat1
// {
// coordinateSystem system_10;
// porosity 0.781;
// Darcy
// {
// d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
// f f [0 -1 0 0 0] (-1000 -1000 12.83);
// }
// }
// @endverbatim
// might get re-written as the following (depending on the value of
// @c system_10 in the @c constant/coordinateSystems file):
// @verbatim
// cat1
// {
// coordinateSystem
// {
// origin (0 0 0);
// e3 (1 0 0);
// e1 (0 0 -1);
// }
// porosity 0.781;
// Darcy
// {
// d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
// f f [0 -1 0 0 0] (-1000 -1000 12.83);
// }
// }
// @endverbatim
// When this form of re-writing is used, the coordinateRotation is
// reduced to the axes specification.
bool rewriteDict(dictionary& dict, bool noType = false) const;
//- write data
bool writeData(Ostream&, bool subDict = true) const;
bool writeData(Ostream&, bool subDict=true) const;
};

View File

@ -106,14 +106,11 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Construct from dictionary
cylindricalCS(const word& name, const dictionary& dict);
// Member Functions
cylindricalCS(const word& name, const dictionary&);
};

View File

@ -40,7 +40,6 @@ namespace Foam
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::parabolicCylindricalCS::parabolicCylindricalCS()
@ -113,6 +112,7 @@ Foam::vector Foam::parabolicCylindricalCS::localToGlobal
);
}
Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::localToGlobal
(
const vectorField& local,
@ -123,7 +123,8 @@ Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::localToGlobal
{
FatalErrorIn
(
"parabolicCylindricalCS::localToGlobal(const vectorField&, bool) const"
"parabolicCylindricalCS::localToGlobal"
"(const vectorField&, bool) const"
) << "parabolic cylindrical coordinates v < 0"
<< abort(FatalError);
}

View File

@ -107,18 +107,11 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Construct from dictionary
parabolicCylindricalCS
(
const word& name,
const dictionary& dict
);
// Member Functions
parabolicCylindricalCS(const word&, const dictionary&);
};

View File

@ -45,6 +45,7 @@ Foam::sphericalCS::sphericalCS()
coordinateSystem()
{}
Foam::sphericalCS::sphericalCS
(
const word& name,
@ -96,6 +97,7 @@ Foam::vector Foam::sphericalCS::localToGlobal
);
}
Foam::tmp<Foam::vectorField> Foam::sphericalCS::localToGlobal
(
const vectorField& local,
@ -174,5 +176,4 @@ Foam::tmp<Foam::vectorField> Foam::sphericalCS::globalToLocal
return tresult;
}
// ************************************************************************* //

View File

@ -105,19 +105,16 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Construct from dictionary
sphericalCS(const word& name, const dictionary& dict);
sphericalCS(const word& name, const dictionary&);
// Member Functions
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -36,7 +36,6 @@ namespace Foam
addToRunTimeSelectionTable(coordinateSystem, toroidalCS, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::toroidalCS::toroidalCS
@ -105,6 +104,7 @@ Foam::vector Foam::toroidalCS::localToGlobal
);
}
Foam::tmp<Foam::vectorField> Foam::toroidalCS::localToGlobal
(
const vectorField& local,
@ -129,6 +129,7 @@ Foam::tmp<Foam::vectorField> Foam::toroidalCS::localToGlobal
return coordinateSystem::localToGlobal(lc, translate);
}
Foam::vector Foam::toroidalCS::globalToLocal
(
const vector& global,
@ -143,6 +144,7 @@ Foam::vector Foam::toroidalCS::globalToLocal
return vector::zero;
}
Foam::tmp<Foam::vectorField> Foam::toroidalCS::globalToLocal
(
const vectorField& global,
@ -182,5 +184,4 @@ void Foam::toroidalCS::writeDict(Ostream& os, bool subDict) const
}
}
// ************************************************************************* //

View File

@ -106,12 +106,12 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr,
const coordinateRotation&,
const scalar radius
);
//- Construct from dictionary
toroidalCS(const word& name, const dictionary& dict);
toroidalCS(const word& name, const dictionary&);
// Member Functions
@ -126,7 +126,7 @@ public:
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
virtual void writeDict(Ostream&, bool subDict=true) const;
};

View File

@ -40,7 +40,7 @@ SourceFiles
#include "pointIndexHit.H"
#include "FixedList.H"
#include "Ostream.H"
#include "labelHashSet.H"
#include "HashSet.H"
#include "labelBits.H"
#include "PackedList.H"

Some files were not shown because too many files have changed in this diff Show More