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

This commit is contained in:
henry
2010-01-28 16:08:17 +00:00
149 changed files with 2189 additions and 288989 deletions

View File

@ -109,7 +109,6 @@ struct HashTableCore
{
return iteratorEnd();
}
};
@ -139,6 +138,7 @@ class HashTable
//- Construct from key, next pointer and object
inline hashedEntry(const Key&, hashedEntry* next, const T&);
private:
//- Disallow default bitwise copy construct
hashedEntry(const hashedEntry&);
@ -209,9 +209,8 @@ public:
HashTable(const Xfer<HashTable<T, Key, Hash> >&);
// Destructor
~HashTable();
//- Destructor
~HashTable();
// Member Functions
@ -247,6 +246,7 @@ public:
//- Print information
Ostream& printInfo(Ostream&) const;
// Edit
//- Insert a new hashedEntry
@ -291,7 +291,7 @@ public:
void transfer(HashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container
inline Xfer< HashTable<T, Key, Hash> > xfer();
inline Xfer<HashTable<T, Key, Hash> > xfer();
// Member Operators
@ -356,9 +356,8 @@ public:
//- Current hash index
label hashIndex_;
protected:
// Protected Member Functions
protected:
// Constructors
@ -380,6 +379,8 @@ public:
);
// Protected Member Functions
//- Increment to the next position
inline void increment();
@ -392,6 +393,7 @@ public:
//- Return const access to referenced object
inline const T& cobject() const;
public:
// Member operators
@ -434,6 +436,7 @@ public:
const label hashIndex
);
public:
// Constructors
@ -444,13 +447,12 @@ public:
//- Construct end iterator
inline iterator(const iteratorEnd& unused);
// Member operators
//- Conversion to a const_iterator
inline operator const_iterator() const;
// Access
//- Return referenced hash value
inline T& operator*();
inline T& operator()();
@ -492,6 +494,7 @@ public:
const label hashIndex
);
public:
// Constructors
@ -502,9 +505,8 @@ public:
//- Construct end iterator
inline const_iterator(const iteratorEnd& unused);
// Member operators
// Access
// Member operators
//- Return referenced hash value
inline const T& operator*() const;
@ -536,7 +538,6 @@ public:
Ostream&,
const HashTable<T, Key, Hash>&
);
};

View File

@ -97,11 +97,10 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
{}
template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
(
const Xfer< StaticHashTable<T, Key, Hash> >& ht
const Xfer<StaticHashTable<T, Key, Hash> >& ht
)
:
StaticHashTableCore(),
@ -452,7 +451,6 @@ void Foam::StaticHashTable<T, Key, Hash>::clearStorage()
}
template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::transfer
(

View File

@ -72,10 +72,6 @@ template<class T, class Key, class Hash> Ostream& operator<<
);
/*---------------------------------------------------------------------------*\
Class StaticHashTableName Declaration
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
Class StaticHashTableCore Declaration
\*---------------------------------------------------------------------------*/
@ -100,7 +96,6 @@ struct StaticHashTableCore
iteratorEnd()
{}
};
};
@ -135,6 +130,7 @@ class StaticHashTable
//- Assign a new hashed entry to a possibly already existing key
bool set(const Key&, const T& newElmt, bool protect);
public:
@ -183,11 +179,11 @@ public:
StaticHashTable(const StaticHashTable<T, Key, Hash>&);
//- Construct by transferring the parameter contents
StaticHashTable(const Xfer< StaticHashTable<T, Key, Hash> >&);
StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash> >&);
// Destructor
~StaticHashTable();
//- Destructor
~StaticHashTable();
// Member Functions
@ -251,7 +247,7 @@ public:
void transfer(StaticHashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container
inline Xfer< StaticHashTable<T, Key, Hash> > xfer();
inline Xfer<StaticHashTable<T, Key, Hash> > xfer();
// Member Operators
@ -275,6 +271,7 @@ public:
//- The opposite of the equality operation.
bool operator!=(const StaticHashTable<T, Key, Hash>&) const;
// STL type definitions
//- Type of values the StaticHashTable contains.
@ -317,6 +314,7 @@ public:
//- Index of current element at hashIndex
label elemIndex_;
public:
// Constructors

View File

@ -79,7 +79,7 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::set
template<class T, class Key, class Hash>
inline Foam::Xfer< Foam::StaticHashTable<T, Key, Hash> >
inline Foam::Xfer<Foam::StaticHashTable<T, Key, Hash> >
Foam::StaticHashTable<T, Key, Hash>::xfer()
{
return xferMove(*this);
@ -417,6 +417,4 @@ Foam::StaticHashTable<T, Key, Hash>::end() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -74,7 +74,7 @@ public:
(
const UList<T>& posList,
const UList<T>& negList,
const Xfer< List<label> >&
const Xfer<List<label> >&
);
@ -102,7 +102,7 @@ public:
//- Reset addressing
inline void resetAddressing(const UList<label>&);
inline void resetAddressing(const Xfer< List<label> >&);
inline void resetAddressing(const Xfer<List<label> >&);
// Member Operators

View File

@ -45,7 +45,7 @@ inline Foam::BiIndirectList<T>::BiIndirectList
(
const UList<T>& posList,
const UList<T>& negList,
const Xfer< List<label> >& addr
const Xfer<List<label> >& addr
)
:
posList_(const_cast<UList<T>&>(posList)),
@ -105,7 +105,7 @@ inline void Foam::BiIndirectList<T>::resetAddressing
template<class T>
inline void Foam::BiIndirectList<T>::resetAddressing
(
const Xfer< List<label> >& addr
const Xfer<List<label> >& addr
)
{
addressing_.transfer(addr());

View File

@ -224,7 +224,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[]
)
{
label start = offsets_[i];
return UList<T>(&m_[start], offsets_[i+1] - start);
return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
}
@ -238,7 +238,7 @@ Foam::CompactListList<T, Container>::operator[]
label start = offsets_[i];
return UList<T>
(
const_cast<T*>(&m_[start]),
(m_.size() ? const_cast<T*>(&m_[start]) : NULL),
offsets_[i+1] - start
);
}

View File

@ -84,7 +84,6 @@ class DynamicList
//- The capacity (allocated size) of the underlying list.
label capacity_;
// Private Member Functions
public:
@ -93,6 +92,7 @@ public:
//- Declare friendship with the List class
friend class List<T>;
// Constructors
//- Construct null
@ -115,7 +115,7 @@ public:
explicit inline DynamicList(const UIndirectList<T>&);
//- Construct by transferring the parameter contents
explicit inline DynamicList(const Xfer< List<T> >&);
explicit inline DynamicList(const Xfer<List<T> >&);
//- Construct from Istream. Size set to size of read list.
explicit DynamicList(Istream&);
@ -125,103 +125,105 @@ public:
// Access
//- Size of the underlying storage.
inline label capacity() const;
//- Size of the underlying storage.
inline label capacity() const;
// Edit
//- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched.
// Use this or reserve() in combination with append().
inline void setCapacity(const label);
//- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched.
// Use this or reserve() in combination with append().
inline void setCapacity(const label);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void setSize(const label);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void setSize(const label);
//- Alter the addressed list size and fill new space with a constant.
inline void setSize(const label, const T&);
//- Alter the addressed list size and fill new space with a constant.
inline void setSize(const label, const T&);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void resize(const label);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void resize(const label);
//- Alter the addressed list size and fill new space with a constant.
inline void resize(const label, const T&);
//- Alter the addressed list size and fill new space with a constant.
inline void resize(const label, const T&);
//- Reserve allocation space for at least this size.
// Never shrinks the allocated size, use setCapacity() for that.
inline void reserve(const label);
//- Reserve allocation space for at least this size.
// Never shrinks the allocated size, use setCapacity() for that.
inline void reserve(const label);
//- Clear the addressed list, i.e. set the size to zero.
// Allocated size does not change
inline void clear();
//- Clear the addressed list, i.e. set the size to zero.
// Allocated size does not change
inline void clear();
//- Clear the list and delete storage.
inline void clearStorage();
//- Clear the list and delete storage.
inline void clearStorage();
//- Shrink the allocated space to the number of elements used.
// Returns a reference to the DynamicList.
inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink();
//- Shrink the allocated space to the number of elements used.
// Returns a reference to the DynamicList.
inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink();
//- Transfer contents of the argument List into this DynamicList
inline void transfer(List<T>&);
//- Transfer contents of the argument List into this DynamicList
inline void transfer(List<T>&);
//- Transfer contents of the argument DynamicList into this DynamicList
inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
//- Transfer contents of the argument DynamicList into this DynamicList
inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
//- Transfer contents to the Xfer container as a plain List
inline Xfer< List<T> > xfer();
//- Transfer contents to the Xfer container as a plain List
inline Xfer<List<T> > xfer();
// Member Operators
//- Append an element at the end of the list
inline void append(const T&);
// Member Operators
//- Append a List at the end of this list
inline void append(const UList<T>&);
//- Append an element at the end of the list
inline void append(const T&);
//- Append a UIndirectList at the end of this list
inline void append(const UIndirectList<T>&);
//- Append a List at the end of this list
inline void append(const UList<T>&);
//- Remove and return the top element
inline T remove();
//- Append a UIndirectList at the end of this list
inline void append(const UIndirectList<T>&);
//- Return non-const access to an element, resizing list if necessary
inline T& operator()(const label);
//- Remove and return the top element
inline T remove();
//- Assignment of all addressed entries to the given value
inline void operator=(const T&);
//- Return non-const access to an element, resizing list if necessary
inline T& operator()(const label);
//- Assignment from DynamicList
inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Assignment of all addressed entries to the given value
inline void operator=(const T&);
//- Assignment from UList
inline void operator=(const UList<T>&);
//- Assignment from DynamicList
inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
// IOstream operators
//- Assignment from UList
inline void operator=(const UList<T>&);
// Write DynamicList to Ostream.
friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv>
(
Ostream&,
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Read from Istream, discarding contents of existing DynamicList.
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
(
Istream&,
DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
// IOstream operators
// Write DynamicList to Ostream.
friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv>
(
Ostream&,
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Read from Istream, discarding contents of existing DynamicList.
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
(
Istream&,
DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
};

View File

@ -298,7 +298,7 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline Foam::Xfer< Foam::List<T> >
inline Foam::Xfer<Foam::List<T> >
Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::xfer()
{
return xferMoveTo< List<T> >(*this);

View File

@ -64,7 +64,8 @@ public:
inline IndirectList(const UList<T>&, const UList<label>&);
//- Construct given the complete list and by transferring addressing
inline IndirectList(const UList<T>&, const Xfer< List<label> >&);
inline IndirectList(const UList<T>&, const Xfer<List<label> >&);
// Member Functions
@ -94,11 +95,12 @@ public:
//- Return the list addressing
inline const List<label>& addressing() const;
// Edit
//- Reset addressing
inline void resetAddressing(const UList<label>&);
inline void resetAddressing(const Xfer< List<label> >&);
inline void resetAddressing(const Xfer<List<label> >&);
// Member Operators

View File

@ -42,7 +42,7 @@ template<class T>
inline Foam::IndirectList<T>::IndirectList
(
const UList<T>& completeList,
const Xfer< List<label> >& addr
const Xfer<List<label> >& addr
)
:
completeList_(const_cast<UList<T>&>(completeList)),
@ -121,7 +121,7 @@ inline void Foam::IndirectList<T>::resetAddressing
template<class T>
inline void Foam::IndirectList<T>::resetAddressing
(
const Xfer< List<label> >& addr
const Xfer<List<label> >& addr
)
{
addressing_.transfer(addr());

View File

@ -114,7 +114,7 @@ Foam::List<T>::List(const List<T>& a)
// Construct by transferring the parameter contents
template<class T>
Foam::List<T>::List(const Xfer< List<T> >& lst)
Foam::List<T>::List(const Xfer<List<T> >& lst)
{
transfer(lst());
}

View File

@ -87,6 +87,7 @@ protected:
// Use with care.
inline void size(const label);
public:
// Static Member Functions
@ -109,7 +110,7 @@ public:
List(const List<T>&);
//- Construct by transferring the parameter contents
List(const Xfer< List<T> >&);
List(const Xfer<List<T> >&);
//- Construct as copy or re-use as specified.
List(List<T>&, bool reUse);
@ -147,9 +148,8 @@ public:
inline autoPtr<List<T> > clone() const;
// Destructor
~List();
//- Destructor
~List();
// Related types
@ -201,7 +201,7 @@ public:
void transfer(SortableList<T>&);
//- Transfer contents to the Xfer container
inline Xfer< List<T> > xfer();
inline Xfer<List<T> > xfer();
//- Return subscript-checked element of UList.
inline T& newElmt(const label);

View File

@ -88,7 +88,7 @@ inline Foam::label Foam::List<T>::size() const
template<class T>
inline Foam::Xfer< Foam::List<T> > Foam::List<T>::xfer()
inline Foam::Xfer<Foam::List<T> > Foam::List<T>::xfer()
{
return xferMove(*this);
}

View File

@ -132,6 +132,7 @@ class PackedList
//- Calculate the list length when packed
inline static label packedLength(const label);
public:
// Public data
@ -150,12 +151,14 @@ public:
//- Masking for all bits below the offset
inline static unsigned int maskLower(unsigned offset);
// Forward declaration of iterators
class iteratorBase;
class iterator;
class const_iterator;
// Constructors
//- Null constructor
@ -171,7 +174,7 @@ public:
inline PackedList(const PackedList<nBits>&);
//- Construct by transferring the parameter contents
inline PackedList(const Xfer< PackedList<nBits> >&);
inline PackedList(const Xfer<PackedList<nBits> >&);
//- Construct from a list of labels
explicit PackedList(const UList<label>&);
@ -179,123 +182,126 @@ public:
//- Clone
inline autoPtr< PackedList<nBits> > clone() const;
// Member Functions
// Access
//- The number of elements that can be stored before reallocating
inline label capacity() const;
//- The number of elements that can be stored before reallocating
inline label capacity() const;
//- Number of entries.
inline label size() const;
//- Number of entries.
inline label size() const;
//- Return true if the list is empty (ie, size() is zero).
inline bool empty() const;
//- Return true if the list is empty (ie, size() is zero).
inline bool empty() const;
//- Get value at index I.
// Never auto-vivify entries.
inline unsigned int get(const label) const;
//- Get value at index I.
// Never auto-vivify entries.
inline unsigned int get(const label) const;
//- Set value at index I. Return true if value changed.
// Does auto-vivify for non-existent entries.
// Default value set is the max_value.
inline bool set(const label, const unsigned int val = ~0u);
//- Set value at index I. Return true if value changed.
// Does auto-vivify for non-existent entries.
// Default value set is the max_value.
inline bool set(const label, const unsigned int val = ~0u);
//- Unset the entry at index I. Return true if value changed.
// Never auto-vivify entries.
inline bool unset(const label);
//- Unset the entry at index I. Return true if value changed.
// Never auto-vivify entries.
inline bool unset(const label);
//- Return the underlying packed storage
inline List<unsigned int>& storage();
//- Return the underlying packed storage
inline List<unsigned int>& storage();
//- Return the underlying packed storage
inline const List<unsigned int>& storage() const;
//- Return the underlying packed storage
inline const List<unsigned int>& storage() const;
//- Count number of bits set, O(log(n))
// Uses the Hamming weight (population count) method
// http://en.wikipedia.org/wiki/Hamming_weight
unsigned int count() const;
//- Count number of bits set, O(log(n))
// Uses the Hamming weight (population count) method
// http://en.wikipedia.org/wiki/Hamming_weight
unsigned int count() const;
//- Return the values as a labelList
labelList values() const;
//- Return the values as a labelList
labelList values() const;
//- Print values and information
Ostream& print(Ostream&) const;
//- Print values and information
Ostream& print(Ostream&) const;
// Edit
//- Trim any trailing zero elements
bool trim();
//- Trim any trailing zero elements
bool trim();
//- Invert the bits in the addressable region.
void flip();
//- Invert the bits in the addressable region.
void flip();
//- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched.
inline void setCapacity(const label);
//- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched.
inline void setCapacity(const label);
//- Reset addressable list size, does not shrink the allocated size.
// Optionally specify a value for new elements.
inline void resize(const label, const unsigned int& val = 0);
//- Reset addressable list size, does not shrink the allocated size.
// Optionally specify a value for new elements.
inline void resize(const label, const unsigned int& val = 0);
//- Alias for resize()
inline void setSize(const label, const unsigned int& val = 0);
//- Alias for resize()
inline void setSize(const label, const unsigned int& val = 0);
//- Reserve allocation space for at least this size.
// Never shrinks the allocated size.
// The list size is adjusted as per DynamicList with
// SizeInc=0, SizeMult=2, SizeDiv=1
inline void reserve(const label);
//- Reserve allocation space for at least this size.
// Never shrinks the allocated size.
// The list size is adjusted as per DynamicList with
// SizeInc=0, SizeMult=2, SizeDiv=1
inline void reserve(const label);
//- Clear the list, i.e. set addressable size to zero.
// Does not adjust the underlying storage
inline void clear();
//- Clear the list, i.e. set addressable size to zero.
// Does not adjust the underlying storage
inline void clear();
//- Clear the list and delete storage.
inline void clearStorage();
//- Clear the list and delete storage.
inline void clearStorage();
//- Shrink the allocated space to what is actually used.
inline void shrink();
//- Shrink the allocated space to what is actually used.
inline void shrink();
//- Transfer the contents of the argument list into this list
// and annul the argument list.
inline void transfer(PackedList<nBits>&);
//- Transfer the contents of the argument list into this list
// and annul the argument list.
inline void transfer(PackedList<nBits>&);
//- Transfer contents to the Xfer container
inline Xfer< PackedList<nBits> > xfer();
//- Transfer contents to the Xfer container
inline Xfer<PackedList<nBits> > xfer();
// Member operators
//- Append a value at the end of the list
inline void append(const unsigned int val);
//- Append a value at the end of the list
inline void append(const unsigned int val);
//- Remove and return the last element
inline unsigned int remove();
//- Remove and return the last element
inline unsigned int remove();
//- Get value at index I
// Never auto-vivify entries.
inline unsigned int operator[](const label) const;
//- Get value at index I
// Never auto-vivify entries.
inline unsigned int operator[](const label) const;
//- Set value at index I.
// Returns iterator to perform the actual operation.
// Does not auto-vivify entries, but will when assigned to.
inline iteratorBase operator[](const label);
//- Set value at index I.
// Returns iterator to perform the actual operation.
// Does not auto-vivify entries, but will when assigned to.
inline iteratorBase operator[](const label);
//- Assignment of all entries to the given value. Takes linear time.
inline void operator=(const unsigned int val);
//- Assignment of all entries to the given value. Takes linear time.
inline void operator=(const unsigned int val);
//- Assignment operator. Takes linear time.
void operator=(const PackedList<nBits>&);
//- Assignment operator. Takes linear time.
void operator=(const PackedList<nBits>&);
//- Assignment operator. Takes linear time.
void operator=(const UList<label>&);
//- Assignment operator. Takes linear time.
void operator=(const UList<label>&);
// Ostream operator
// // Write PackedList to Ostream.
// friend Ostream& operator<< <nBits> (Ostream&, const PackedList<nBits>&);
// Ostream operator
// // Write PackedList to Ostream.
// friend Ostream& operator<< <nBits> (Ostream&, const PackedList<nBits>&);
// Iterators and helpers
@ -317,6 +323,7 @@ public:
//- Element index
label index_;
// Protected Member Functions
//- Get value as unsigned, no range-checking
@ -325,6 +332,7 @@ public:
//- Set value, returning true if changed, no range-checking
inline bool set(unsigned int);
// Constructors
//- Construct null
@ -333,6 +341,7 @@ public:
//- Construct from base list and position index
inline iteratorBase(const PackedList*, const label);
public:
// Member Operators
@ -370,6 +379,7 @@ public:
//- Disallow assignment from const_iterator - violates const-ness!
void operator=(const const_iterator&);
public:
// Constructors
@ -385,6 +395,7 @@ public:
//- Construct from base list and position index
inline iterator(const PackedList*, const label);
// Member Operators
//- Compare positions (not values)
@ -445,6 +456,7 @@ public:
//- Construct from iterator
inline const_iterator(const iterator&);
// Member operators
//- Compare positions (not values)
@ -466,7 +478,6 @@ public:
inline const_iterator& operator--();
inline const_iterator operator--(int);
};

View File

@ -334,7 +334,6 @@ inline bool Foam::PackedList<nBits>::iterator::operator!=
}
template<unsigned nBits>
inline bool Foam::PackedList<nBits>::const_iterator::operator==
(
@ -355,7 +354,6 @@ inline bool Foam::PackedList<nBits>::const_iterator::operator!=
}
template<unsigned nBits>
inline typename Foam::PackedList<nBits>::iterator&
Foam::PackedList<nBits>::iterator::operator=(const iteratorBase& iter)
@ -712,16 +710,14 @@ inline void Foam::PackedList<nBits>::shrink()
}
template<unsigned nBits>
inline Foam::List<unsigned int>&
Foam::PackedList<nBits>::storage()
inline Foam::List<unsigned int>& Foam::PackedList<nBits>::storage()
{
return static_cast<StorageList&>(*this);
}
template<unsigned nBits>
inline const Foam::List<unsigned int>&
Foam::PackedList<nBits>::storage() const
inline const Foam::List<unsigned int>& Foam::PackedList<nBits>::storage() const
{
return static_cast<const StorageList&>(*this);
}
@ -738,8 +734,7 @@ inline void Foam::PackedList<nBits>::transfer(PackedList<nBits>& lst)
template<unsigned nBits>
inline Foam::Xfer< Foam::PackedList<nBits> >
Foam::PackedList<nBits>::xfer()
inline Foam::Xfer<Foam::PackedList<nBits> > Foam::PackedList<nBits>::xfer()
{
return xferMove(*this);
}

View File

@ -130,7 +130,7 @@ public:
PtrList(const PtrList<T>&, const CloneArg&);
//- Construct by transferring the parameter contents
PtrList(const Xfer< PtrList<T> >&);
PtrList(const Xfer<PtrList<T> >&);
//- Construct as copy or re-use as specified.
PtrList(PtrList<T>&, bool reUse);
@ -146,9 +146,8 @@ public:
PtrList(Istream&);
// Destructor
~PtrList();
//- Destructor
~PtrList();
// Member functions
@ -196,7 +195,7 @@ public:
void transfer(PtrList<T>&);
//- Transfer contents to the Xfer container
inline Xfer< PtrList<T> > xfer();
inline Xfer<PtrList<T> > xfer();
//- Is element set
inline bool set(const label) const;

View File

@ -170,30 +170,35 @@ inline Foam::PtrList<T>::iterator::iterator(T** ptr)
ptr_(ptr)
{}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator==(const iterator& iter) const
{
return ptr_ == iter.ptr_;
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator!=(const iterator& iter) const
{
return ptr_ != iter.ptr_;
}
template<class T>
inline T& Foam::PtrList<T>::iterator::operator*()
{
return **ptr_;
}
template<class T>
inline T& Foam::PtrList<T>::iterator::operator()()
{
return operator*();
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator++()
@ -202,6 +207,7 @@ Foam::PtrList<T>::iterator::operator++()
return *this;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator++(int)
@ -211,6 +217,7 @@ Foam::PtrList<T>::iterator::operator++(int)
return tmp;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator--()
@ -219,6 +226,7 @@ Foam::PtrList<T>::iterator::operator--()
return *this;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator--(int)
@ -228,6 +236,7 @@ Foam::PtrList<T>::iterator::operator--(int)
return tmp;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator+=(label n)
@ -236,6 +245,7 @@ Foam::PtrList<T>::iterator::operator+=(label n)
return *this;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::operator+(const typename PtrList<T>::iterator& iter, label n)
@ -244,6 +254,7 @@ Foam::operator+(const typename PtrList<T>::iterator& iter, label n)
return tmp += n;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::operator+(label n, const typename PtrList<T>::iterator& iter)
@ -252,6 +263,7 @@ Foam::operator+(label n, const typename PtrList<T>::iterator& iter)
return tmp += n;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator-=(label n)
@ -260,6 +272,7 @@ Foam::PtrList<T>::iterator::operator-=(label n)
return *this;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::operator-(const typename PtrList<T>::iterator& iter, label n)
@ -268,6 +281,7 @@ Foam::operator-(const typename PtrList<T>::iterator& iter, label n)
return tmp -= n;
}
template<class T>
inline Foam::label Foam::operator-
(
@ -278,46 +292,51 @@ inline Foam::label Foam::operator-
return (iter1.ptr_ - iter2.ptr_)/sizeof(T*);
}
template<class T>
inline T& Foam::PtrList<T>::iterator::operator[](label n)
{
return *(*this + n);
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator<(const iterator& iter) const
{
return ptr_ < iter.ptr_;
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator>(const iterator& iter) const
{
return ptr_ > iter.ptr_;
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator<=(const iterator& iter) const
{
return ptr_ <= iter.ptr_;
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator>=(const iterator& iter) const
{
return ptr_ >= iter.ptr_;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::begin()
inline typename Foam::PtrList<T>::iterator Foam::PtrList<T>::begin()
{
return ptrs_.begin();
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::end()
inline typename Foam::PtrList<T>::iterator Foam::PtrList<T>::end()
{
return ptrs_.end();
}

View File

@ -111,7 +111,7 @@ public:
explicit UPtrList(const label);
//- Construct by transferring the parameter contents
UPtrList(const Xfer< UPtrList<T> >&);
UPtrList(const Xfer<UPtrList<T> >&);
//- Construct as copy or re-use as specified.
UPtrList(UPtrList<T>&, bool reUse);
@ -160,7 +160,7 @@ public:
void transfer(UPtrList<T>&);
//- Transfer contents to the Xfer container
inline Xfer< UPtrList<T> > xfer();
inline Xfer<UPtrList<T> > xfer();
//- Is element set
inline bool set(const label) const;

View File

@ -89,7 +89,7 @@ public:
ITstream
(
const string& name,
const Xfer< List<token> >& tokens,
const Xfer<List<token> >& tokens,
streamFormat format=ASCII,
versionNumber version=currentVersion
)

View File

@ -107,7 +107,7 @@ Foam::primitiveEntry::primitiveEntry
Foam::primitiveEntry::primitiveEntry
(
const keyType& key,
const Xfer< List<token> >& tokens
const Xfer<List<token> >& tokens
)
:
entry(key),

View File

@ -114,7 +114,7 @@ public:
primitiveEntry(const keyType&, const UList<token>&);
//- Construct from keyword and by transferring a list of tokens
primitiveEntry(const keyType&, const Xfer< List<token> >&);
primitiveEntry(const keyType&, const Xfer<List<token> >&);
//- Construct from keyword and a T
template<class T>

View File

@ -1138,7 +1138,7 @@ void Foam::fvMeshDistribute::sendMesh
{
const cellZoneMesh& cellZones = mesh.cellZones();
labelList rowSizes(pointZoneNames.size(), 0);
labelList rowSizes(cellZoneNames.size(), 0);
forAll(cellZoneNames, nameI)
{

View File

@ -45,7 +45,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of friend functions and operators
// Forward declaration of classes
class IFstream;
class Time;
@ -61,10 +61,13 @@ class edgeFormatsCore
{
protected:
// Protected Member Functions
//- Read non-comment line
static string getLineNoComment(IFstream&);
public:
// Static Data
//- The file extension corresponding to 'native' edge format

View File

@ -29,7 +29,6 @@ License
#include "IFstream.H"
#include "clock.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileFormats::EMESHedgeFormat::EMESHedgeFormat
@ -119,8 +118,7 @@ bool Foam::fileFormats::EMESHedgeFormat::read
}
Foam::Ostream&
Foam::fileFormats::EMESHedgeFormat::write
Foam::Ostream& Foam::fileFormats::EMESHedgeFormat::write
(
Ostream& os,
const pointField& pointLst,

View File

@ -79,6 +79,7 @@ protected:
const edgeList&
);
public:
// Constructors

View File

@ -64,7 +64,7 @@ bool Foam::fileFormats::OBJedgeFormat::read
}
DynamicList<point> dynPoints;
DynamicList<edge> dynEdges;
DynamicList<edge> dynEdges;
DynamicList<label> dynUsedPoints;
while (is.good())
@ -195,7 +195,7 @@ void Foam::fileFormats::OBJedgeFormat::write
)
{
const pointField& pointLst = mesh.points();
const edgeList& edgeLst = mesh.edges();
const edgeList& edgeLst = mesh.edges();
OFstream os(filename);
if (!os.good())

View File

@ -160,7 +160,6 @@ bool Foam::fileFormats::STARCDedgeFormat::readPoints
}
void Foam::fileFormats::STARCDedgeFormat::writePoints
(
Ostream& os,
@ -177,8 +176,7 @@ void Foam::fileFormats::STARCDedgeFormat::writePoints
forAll(pointLst, ptI)
{
os
<< ptI + 1 << " "
os << ptI + 1 << " "
<< pointLst[ptI].x() << " "
<< pointLst[ptI].y() << " "
<< pointLst[ptI].z() << nl;
@ -367,7 +365,7 @@ void Foam::fileFormats::STARCDedgeFormat::write
)
{
const pointField& pointLst = mesh.points();
const edgeList& edgeLst = mesh.edges();
const edgeList& edgeLst = mesh.edges();
fileName baseName = filename.lessExt();

View File

@ -90,20 +90,21 @@ protected:
// Protected Member Functions
static bool readHeader(IFstream&, const word&);
static bool readHeader(IFstream&, const word&);
static void writeHeader(Ostream&, const char* filetype);
static void writeHeader(Ostream&, const char* filetype);
static bool readPoints(IFstream&, pointField&, labelList& ids);
static bool readPoints(IFstream&, pointField&, labelList& ids);
static void writePoints(Ostream&, const pointField&);
static void writePoints(Ostream&, const pointField&);
static void writeCase
(
Ostream&,
const pointField&,
const label nEdges
);
static void writeCase
(
Ostream&,
const pointField&,
const label nEdges
);
public:

View File

@ -60,8 +60,7 @@ void Foam::fileFormats::VTKedgeFormat::writeEdges
const UList<edge>& edgeLst
)
{
os << "LINES " << edgeLst.size() << ' '
<< 3*edgeLst.size() << nl;
os << "LINES " << edgeLst.size() << ' ' << 3*edgeLst.size() << nl;
forAll(edgeLst, edgeI)
{
@ -72,8 +71,6 @@ void Foam::fileFormats::VTKedgeFormat::writeEdges
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileFormats::VTKedgeFormat::VTKedgeFormat()
@ -104,4 +101,5 @@ void Foam::fileFormats::VTKedgeFormat::write
writeEdges(os, eMesh.edges());
}
// ************************************************************************* //

View File

@ -76,6 +76,7 @@ protected:
//- Write edges
static void writeEdges(Ostream&, const UList<edge>&);
public:
// Constructors

View File

@ -38,11 +38,13 @@ namespace Foam
defineMemberFunctionSelectionTable(edgeMesh,write,fileExtension);
}
Foam::wordHashSet Foam::edgeMesh::readTypes()
{
return wordHashSet(*fileExtensionConstructorTablePtr_);
}
Foam::wordHashSet Foam::edgeMesh::writeTypes()
{
return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
@ -66,6 +68,7 @@ bool Foam::edgeMesh::canReadType
);
}
bool Foam::edgeMesh::canWriteType
(
const word& ext,
@ -197,8 +200,8 @@ void Foam::edgeMesh::clear()
void Foam::edgeMesh::reset
(
const Xfer< pointField >& pointLst,
const Xfer< edgeList >& edgeLst
const Xfer<pointField>& pointLst,
const Xfer<edgeList>& edgeLst
)
{
// Take over new primitive data.
@ -215,7 +218,6 @@ void Foam::edgeMesh::reset
// connectivity likely changed
pointEdgesPtr_.clear();
}
}
@ -227,8 +229,7 @@ void Foam::edgeMesh::transfer(edgeMesh& mesh)
}
Foam::Xfer< Foam::edgeMesh >
Foam::edgeMesh::xfer()
Foam::Xfer<Foam::edgeMesh> Foam::edgeMesh::xfer()
{
return xferMove(*this);
}

View File

@ -101,6 +101,7 @@ public:
//- Runtime type information
TypeName("edgeMesh");
// Static
//- Can we read this file format?
@ -115,6 +116,7 @@ public:
static wordHashSet readTypes();
static wordHashSet writeTypes();
// Constructors
//- Construct null
@ -126,8 +128,8 @@ public:
//- Construct by transferring components (points, edges).
edgeMesh
(
const Xfer< pointField >&,
const Xfer< edgeList >&
const Xfer<pointField>&,
const Xfer<edgeList>&
);
//- Construct as copy
@ -142,6 +144,7 @@ public:
//- Construct from Istream
edgeMesh(Istream&);
// Declare run-time constructor selection table
declareRunTimeSelectionTable
@ -155,6 +158,7 @@ public:
(name)
);
// Selectors
//- Select constructed from filename (explicit extension)
@ -197,7 +201,7 @@ public:
void transfer(edgeMesh&);
//- Transfer contents to the Xfer container
Xfer< edgeMesh > xfer();
Xfer<edgeMesh > xfer();
// Read
@ -233,8 +237,8 @@ public:
// Note, optimized to avoid overwriting data (with Xfer::null)
virtual void reset
(
const Xfer< pointField >& points,
const Xfer< edgeList >& edges
const Xfer<pointField>& points,
const Xfer<edgeList>& edges
);
//- Scale points. A non-positive factor is ignored
@ -248,8 +252,6 @@ public:
void writeStats(Ostream&) const;
// Write
//- Generic write routine. Chooses writer based on extension.
virtual void write(const fileName& name) const
{
@ -261,10 +263,10 @@ public:
inline void operator=(const edgeMesh&);
// Ostream Operator
// Ostream Operator
friend Ostream& operator<<(Ostream&, const edgeMesh&);
friend Istream& operator>>(Istream&, edgeMesh&);
friend Ostream& operator<<(Ostream&, const edgeMesh&);
friend Istream& operator>>(Istream&, edgeMesh&);
};

View File

@ -28,7 +28,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr< Foam::edgeMesh >
Foam::edgeMesh::New(const fileName& name, const word& ext)
{
@ -62,4 +61,5 @@ Foam::edgeMesh::New(const fileName& name)
return New(name, ext);
}
// ************************************************************************* //

View File

@ -73,8 +73,8 @@ Foam::featureEdgeMesh::featureEdgeMesh
Foam::featureEdgeMesh::featureEdgeMesh
(
const IOobject& io,
const Xfer< pointField >& pointLst,
const Xfer< edgeList >& edgeLst
const Xfer<pointField>& pointLst,
const Xfer<edgeList>& edgeLst
)
:
regIOobject(io),

View File

@ -84,7 +84,7 @@ class pressureGradientExplicitSource
//- Name of cell source
word cellSource_;
//- The method by which the cells will be selecetd
//- The method by which the cells will be selected
autoPtr<topoSetSource> cellSelector_;
//- The set of selected cells

View File

@ -28,7 +28,7 @@ Class
Description
Base class for field sources. Provides:
- name
- references to mesh and time
- references to mesh and time databases
- dimensions
- volume type
- startTime

View File

@ -84,7 +84,7 @@ activeBaffleVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF),
pName_("p"),
pName_(dict.lookupOrDefault<word>("p", "p")),
cyclicPatchName_(dict.lookup("cyclicPatch")),
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),
orientation_(readLabel(dict.lookup("orientation"))),
@ -96,11 +96,6 @@ activeBaffleVelocityFvPatchVectorField
curTimeIndex_(-1)
{
fvPatchVectorField::operator=(vector::zero);
if (dict.found("p"))
{
dict.lookup("p") >> pName_;
}
}
@ -219,15 +214,21 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
}
openFraction_ =
max(min(
openFraction_
+ max
max
(
min
(
this->db().time().deltaTValue()/openingTime_,
maxOpenFractionDelta_
)
*(orientation_*sign(forceDiff)),
1 - 1e-6), 1e-6);
openFraction_
+ max
(
this->db().time().deltaTValue()/openingTime_,
maxOpenFractionDelta_
)
*(orientation_*sign(forceDiff)),
1 - 1e-6
),
1e-6
);
Info<< "openFraction = " << openFraction_ << endl;
@ -264,8 +265,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::write(Ostream& os) const
<< maxOpenFractionDelta_ << token::END_STATEMENT << nl;
os.writeKeyword("openFraction")
<< openFraction_ << token::END_STATEMENT << nl;
os.writeKeyword("p")
<< pName_ << token::END_STATEMENT << nl;
writeEntryIfDifferent<word>(os, "p", "p", pName_);
writeEntry("value", os);
}

View File

@ -46,7 +46,7 @@ directMappedVelocityFluxFixedValueFvPatchField
)
:
fixedValueFvPatchVectorField(p, iF),
phiName_("undefinedPhi")
phiName_("phi")
{}
@ -93,22 +93,22 @@ directMappedVelocityFluxFixedValueFvPatchField
)
:
fixedValueFvPatchVectorField(p, iF, dict),
phiName_(dict.lookup("phi"))
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"directMappedVelocityFluxFixedValueFvPatchField::"
"directMappedVelocityFluxFixedValueFvPatchField\n"
"(\n"
" const fvPatch& p,\n"
" const DimensionedField<vector, volMesh>& iF,\n"
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << p.type()
"directMappedVelocityFluxFixedValueFvPatchField"
"("
"const fvPatch&, "
"const DimensionedField<vector, volMesh>& iF, "
"const dictionary&"
")"
) << "patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
<< exit(FatalError);
@ -274,7 +274,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
void directMappedVelocityFluxFixedValueFvPatchField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
this->writeEntry("value", os);
}

View File

@ -161,18 +161,9 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
gradient().writeEntry("gradient", os);
}

View File

@ -45,7 +45,7 @@ fixedPressureCompressibleDensityFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF),
pName_("pNameIsUndefined")
pName_("p")
{}
@ -72,7 +72,7 @@ fixedPressureCompressibleDensityFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF, dict),
pName_(dict.lookup("p"))
pName_(dict.lookupOrDefault<word>("p", "p"))
{}
@ -134,7 +134,7 @@ void fixedPressureCompressibleDensityFvPatchScalarField::write
) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("p") << pName_ << token::END_STATEMENT << nl;
writeEntryIfDifferent<word>(os, "p", "p", pName_);
writeEntry("value", os);
}

View File

@ -143,14 +143,8 @@ void Foam::fluxCorrectedVelocityFvPatchVectorField::evaluate
void Foam::fluxCorrectedVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntry("value", os);
}

View File

@ -30,8 +30,6 @@ License
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::inletOutletTotalTemperatureFvPatchScalarField::
@ -193,18 +191,9 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os)
const
{
fvPatchScalarField::write(os);
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "psi")
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "psi", "psi", psiName_);
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
T0_.writeEntry("T0", os);
writeEntry("value", os);

View File

@ -43,7 +43,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(p, iF)
fixedValueFvPatchVectorField(p, iF),
UName_("U")
{}
@ -55,7 +56,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper)
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
UName_(ptf.UName_)
{}
@ -66,7 +68,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF)
fixedValueFvPatchVectorField(p, iF),
UName_(dict.lookupOrDefault<word>("U", "U"))
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
@ -74,20 +77,22 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
(
const movingWallVelocityFvPatchVectorField& pivpvf
const movingWallVelocityFvPatchVectorField& mwvpvf
)
:
fixedValueFvPatchVectorField(pivpvf)
fixedValueFvPatchVectorField(mwvpvf),
UName_(mwvpvf.UName_)
{}
movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
(
const movingWallVelocityFvPatchVectorField& pivpvf,
const movingWallVelocityFvPatchVectorField& mwvpvf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(pivpvf, iF)
fixedValueFvPatchVectorField(mwvpvf, iF),
UName_(mwvpvf.UName_)
{}
@ -114,7 +119,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs()
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaTValue();
const volVectorField& U = db().lookupObject<volVectorField>("U");
const volVectorField& U = db().lookupObject<volVectorField>(UName_);
scalarField phip =
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
@ -132,6 +137,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs()
void movingWallVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntry("value", os);
}

View File

@ -52,6 +52,11 @@ class movingWallVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Name of velocity field
word UName_;
public:

View File

@ -196,14 +196,8 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::
write(Ostream& os) const
{
fvPatchVectorField::write(os);
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os);
}

View File

@ -184,14 +184,8 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs()
void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os);
}

View File

@ -188,10 +188,7 @@ void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs()
void pressureInletOutletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
if (tangentialVelocity_.size())
{
tangentialVelocity_.writeEntry("tangentialVelocity", os);

View File

@ -146,14 +146,8 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs()
void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntry("value", os);
}

View File

@ -218,14 +218,8 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::
write(Ostream& os) const
{
fvPatchScalarField::write(os);
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;

View File

@ -30,8 +30,6 @@ License
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
@ -180,18 +178,9 @@ void Foam::totalTemperatureFvPatchScalarField::updateCoeffs()
void Foam::totalTemperatureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (psiName_ != "psi")
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "psi", "psi", psiName_);
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
T0_.writeEntry("T0", os);
writeEntry("value", os);

View File

@ -40,6 +40,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF),
UName_("U"),
intensity_(0.05)
{}
@ -53,6 +54,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
UName_(ptf.UName_),
intensity_(ptf.intensity_)
{}
@ -65,6 +67,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF, dict),
UName_(dict.lookupOrDefault<word>("U", "U")),
intensity_(readScalar(dict.lookup("intensity")))
{
if (intensity_ < 0 || intensity_ > 1)
@ -92,6 +95,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(ptf),
UName_(ptf.UName_),
intensity_(ptf.intensity_)
{}
@ -104,6 +108,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(ptf, iF),
UName_(ptf.UName_),
intensity_(ptf.intensity_)
{}
@ -119,7 +124,7 @@ updateCoeffs()
}
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>("U");
patch().lookupPatchField<volVectorField, vector>(UName_);
operator==(1.5*sqr(intensity_)*magSqr(Up));
@ -133,6 +138,7 @@ void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::write
) const
{
fvPatchField<scalar>::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
os.writeKeyword("intensity") << intensity_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -34,6 +34,7 @@ Description
inlet
{
type turbulentIntensityKineticEnergyInlet;
U U; // Name of U field (optional)
intensity 0.05; // 5% turbulence
value uniform 1; // placeholder
}
@ -64,6 +65,9 @@ class turbulentIntensityKineticEnergyInletFvPatchScalarField
{
// Private data
//- Name of belocity field
word UName_;
//- Turbulent intensity as fraction of mean velocity
scalar intensity_;

View File

@ -87,6 +87,12 @@ class Cloud
//- Initialise cloud on IO constructor
void initCloud(const bool checkClass);
//- Read cloud properties dictionary
void readCloudUniformProperties();
//- Write cloud properties dictionary
void writeCloudUniformProperties() const;
public:
@ -104,6 +110,12 @@ public:
TypeName("Cloud");
// Static data
//- Name of cloud properties dictionary
static word cloudPropertiesName;
// Constructors
//- Construct from mesh and a list of particles

View File

@ -29,11 +29,85 @@ License
#include "Time.H"
#include "IOPosition.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType>
Foam::word Foam::Cloud<ParticleType>::cloudPropertiesName("cloudProperties");
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class ParticleType>
void Foam::Cloud<ParticleType>::readCloudUniformProperties()
{
IOobject uniformPropsDictHeader
(
cloudPropertiesName,
time().timeName(),
"uniform"/cloud::prefix/name(),
db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (uniformPropsDictHeader.headerOk())
{
const IOdictionary uniformPropsDict(uniformPropsDictHeader);
word procName("processor" + Foam::name(Pstream::myProcNo()));
if (uniformPropsDict.found(procName))
{
uniformPropsDict.subDict(procName).lookup("particleCount")
>> particleCount_;
}
}
else
{
particleCount_ = 0;
}
}
template<class ParticleType>
void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
{
IOdictionary uniformPropsDict
(
IOobject
(
cloudPropertiesName,
time().timeName(),
"uniform"/cloud::prefix/name(),
db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
labelList np(Pstream::nProcs(), 0);
np[Pstream::myProcNo()] = particleCount_;
Pstream::listCombineGather(np, maxEqOp<label>());
Pstream::listCombineScatter(np);
forAll(np, i)
{
word procName("processor" + Foam::name(i));
uniformPropsDict.add(procName, dictionary());
uniformPropsDict.subDict(procName).add("particleCount", np[i]);
}
uniformPropsDict.regIOobject::write();
}
template<class ParticleType>
void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
{
readCloudUniformProperties();
IOPosition<ParticleType> ioP(*this);
if (ioP.headerOk())
@ -156,6 +230,8 @@ bool Foam::Cloud<ParticleType>::writeObject
IOstream::compressionType cmp
) const
{
writeCloudUniformProperties();
if (this->size())
{
writeFields();

View File

@ -26,70 +26,6 @@ License
#include "IOPosition.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType>
Foam::word Foam::IOPosition<ParticleType>::particlePropertiesName
(
"particleProperties"
);
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
void Foam::IOPosition<ParticleType>::readParticleProperties()
{
IOobject propsDictHeader
(
particlePropertiesName,
cloud_.db().time().timeName(),
"uniform"/cloud::prefix/cloud_.name(),
cloud_.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (propsDictHeader.headerOk())
{
const IOdictionary propsDict(propsDictHeader);
word procName("processor" + Foam::name(Pstream::myProcNo()));
if (propsDict.found(procName))
{
propsDict.subDict(procName).lookup("particleCount")
>> cloud_.particleCount_;
}
}
}
template<class ParticleType>
void Foam::IOPosition<ParticleType>::writeParticleProperties() const
{
IOdictionary propsDict
(
IOobject
(
particlePropertiesName,
cloud_.db().time().timeName(),
"uniform"/cloud::prefix/cloud_.name(),
cloud_.db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
word procName("processor" + Foam::name(Pstream::myProcNo()));
propsDict.add(procName, dictionary());
propsDict.subDict(procName).add("particleCount", cloud_.particleCount_);
propsDict.regIOobject::write();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
@ -132,9 +68,6 @@ bool Foam::IOPosition<ParticleType>::write() const
template<class ParticleType>
bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const
{
// Write global cloud data
writeParticleProperties();
os<< cloud_.size() << nl << token::BEGIN_LIST << nl;
forAllConstIter(typename Cloud<ParticleType>, cloud_, iter)
@ -161,9 +94,6 @@ void Foam::IOPosition<ParticleType>::readData
bool checkClass
)
{
// Read global cloud data. Resets count on cloud.
readParticleProperties();
Istream& is = readStream(checkClass ? typeName : "");
token firstToken(is);

View File

@ -59,15 +59,6 @@ class IOPosition
const Cloud<ParticleType>& cloud_;
// Private member functions
//- Read particle properties dictionary
void readParticleProperties();
//- Write particle properties dictionary
void writeParticleProperties() const;
public:
// Static data
@ -78,9 +69,6 @@ public:
return cloud_.type();
}
//- Name of particle properties dictionary
static word particlePropertiesName;
// Constructors

View File

@ -60,10 +60,6 @@ Foam::Particle<ParticleType>::Particle
{
is >> origProc_ >> origId_;
}
else
{
origId_ = cloud_.getNewParticleID();
}
}
else
{
@ -91,7 +87,6 @@ Foam::Particle<ParticleType>::Particle
+ sizeof(facei_)
+ sizeof(stepFraction_)
);
origId_ = cloud_.getNewParticleID();
}
}

View File

@ -27,7 +27,6 @@ License
#ifndef createCoalParcelTypes_H
#define createCoalParcelTypes_H
#include "makeParcelIOList.H"
#include "thermoPhysicsTypes.H"
#include "CoalCloud.H"
@ -56,8 +55,6 @@ License
\
typedef ParcelType<ThermoType> ParcelType##ThermoType; \
\
makeParcelIOList(ParcelType##ThermoType); \
\
defineTemplateTypeNameAndDebug(ParcelType##ThermoType, 0); \
defineTemplateTypeNameAndDebug(Particle<ParcelType##ThermoType>, 0); \
defineTemplateTypeNameAndDebug(Cloud<ParcelType##ThermoType>, 0); \

View File

@ -103,6 +103,8 @@ void Foam::parcel::readFields(Cloud<parcel>& c)
return;
}
Particle<parcel>::readFields(c);
IOField<scalar> d(c.fieldIOobject("d", IOobject::MUST_READ));
c.checkFieldIOobject(c, d);

View File

@ -81,6 +81,8 @@ void Foam::DsmcParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
return;
}
Particle<ParcelType>::readFields(c);
IOField<vector> U(c.fieldIOobject("U", IOobject::MUST_READ));
c.checkFieldIOobject(c, U);

View File

@ -269,11 +269,9 @@ void Foam::KinematicCloud<ParcelType>::info() const
{
Info<< "Cloud: " << this->name() << nl
<< " Total number of parcels added = "
<< returnReduce(this->injection().parcelsAddedTotal(), sumOp<label>())
<< nl
<< this->injection().parcelsAddedTotal() << nl
<< " Total mass introduced = "
<< returnReduce(this->injection().massInjected(), sumOp<scalar>())
<< nl
<< this->injection().massInjected() << nl
<< " Current number of parcels = "
<< returnReduce(this->size(), sumOp<label>()) << nl
<< " Current mass in system = "

View File

@ -40,7 +40,7 @@ Foam::string Foam::KinematicParcel<ParcelType>::propHeader =
+ " (Ux Uy Uz)"
+ " rho"
+ " tTurb"
+ " UTurb";
+ " (UTurbx UTurby UTurbz)";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -110,6 +110,8 @@ void Foam::KinematicParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
return;
}
Particle<ParcelType>::readFields(c);
IOField<label> typeId(c.fieldIOobject("typeId", IOobject::MUST_READ));
c.checkFieldIOobject(c, typeId);

View File

@ -26,7 +26,6 @@ License
#include "basicKinematicParcel.H"
#include "KinematicCloud.H"
#include "makeParcelIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -35,8 +34,6 @@ namespace Foam
defineTemplateTypeNameAndDebug(Cloud<basicKinematicParcel>, 0);
defineParcelTypeNameAndDebug(KinematicCloud<basicKinematicParcel>, 0);
makeParcelIOList(basicKinematicParcel);
};

View File

@ -26,7 +26,6 @@ License
#include "basicThermoParcel.H"
#include "ThermoCloud.H"
#include "makeParcelIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -41,8 +40,6 @@ namespace Foam
defineParcelTypeNameAndDebug(KinematicCloud<basicThermoParcel>, 0);
defineParcelTypeNameAndDebug(ThermoCloud<basicThermoParcel>, 0);
makeParcelIOList(basicThermoParcel);
};

View File

@ -27,7 +27,6 @@ License
#ifndef createReactingMultiphaseParcelTypes_H
#define createReactingMultiphaseParcelTypes_H
#include "makeParcelIOList.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,8 +54,6 @@ License
\
typedef ParcelType<ThermoType> ParcelType##ThermoType; \
\
makeParcelIOList(ParcelType##ThermoType); \
\
defineTemplateTypeNameAndDebug(ParcelType##ThermoType, 0); \
defineTemplateTypeNameAndDebug(Particle<ParcelType##ThermoType>, 0); \
defineTemplateTypeNameAndDebug(Cloud<ParcelType##ThermoType>, 0); \

View File

@ -27,7 +27,6 @@ License
#ifndef createReactingParcelTypes_H
#define createReactingParcelTypes_H
#include "makeParcelIOList.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,8 +42,6 @@ License
\
typedef ParcelType<ThermoType> ParcelType##ThermoType; \
\
makeParcelIOList(ParcelType##ThermoType); \
\
defineTemplateTypeNameAndDebug(ParcelType##ThermoType, 0); \
defineTemplateTypeNameAndDebug(Particle<ParcelType##ThermoType>, 0); \
defineTemplateTypeNameAndDebug(Cloud<ParcelType##ThermoType>, 0); \

View File

@ -1,53 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Macros for defining parcel IOLists
\*---------------------------------------------------------------------------*/
#ifndef makeParcelIOList_H
#define makeParcelIOList_H
#include "IOPtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeParcelIOList(ParcelType) \
\
typedef IOPtrList<ParcelType> IOPtrList##ParcelType; \
\
defineTemplateTypeNameAndDebugWithName \
( \
IOPtrList##ParcelType, \
"IOPtrList<"#ParcelType">", \
0 \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -216,11 +216,10 @@ Foam::scalar Foam::InjectionModel<CloudType>::setNumberOfParticles
"Foam::scalar "
"Foam::InjectionModel<CloudType>::setNumberOfParticles"
"("
" const label, "
" const scalar, "
" const scalar, "
" const scalar, "
" const scalar"
"const label, "
"const scalar, "
"const scalar, "
"const scalar"
")"
)<< "Unknown parcelBasis type" << nl
<< exit(FatalError);
@ -232,18 +231,26 @@ Foam::scalar Foam::InjectionModel<CloudType>::setNumberOfParticles
template<class CloudType>
void Foam::InjectionModel<CloudType>::postInjectCheck(const label parcelsAdded)
void Foam::InjectionModel<CloudType>::postInjectCheck
(
const label parcelsAdded,
const scalar massAdded
)
{
if (parcelsAdded > 0)
const label allParcelsAdded = returnReduce(parcelsAdded, sumOp<label>());
if (allParcelsAdded > 0)
{
Pout<< nl
Info<< nl
<< "--> Cloud: " << owner_.name() << nl
<< " Added " << parcelsAdded
<< " new parcels" << nl << endl;
<< " Added " << allParcelsAdded << " new parcels" << nl << endl;
}
// Increment total number of parcels added
parcelsAddedTotal_ += parcelsAdded;
parcelsAddedTotal_ += allParcelsAdded;
// Increment total mass injected
massInjected_ += returnReduce(massAdded, sumOp<scalar>());
// Update time for start of next injection
time0_ = owner_.db().time().value();
@ -355,16 +362,12 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
const polyMesh& mesh = owner_.mesh();
// Prepare for next time step
label parcelsAdded = 0;
scalar massAdded = 0.0;
label newParcels = 0;
scalar newVolume = 0.0;
prepareForNextTimeStep(time, newParcels, newVolume);
// Return if no parcels are required
if (newParcels == 0)
{
postInjectCheck(0);
return;
}
prepareForNextTimeStep(time, newParcels, newVolume);
// Duration of injection period during this timestep
const scalar deltaT =
@ -374,7 +377,6 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
const scalar padTime = max(0.0, SOI_ - time0_);
// Introduce new parcels linearly across carrier phase timestep
label parcelsAdded = 0;
for (label parcelI=0; parcelI<newParcels; parcelI++)
{
if (validInjection(parcelI))
@ -425,13 +427,13 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
// Add the new parcel
td.cloud().addParticle(pPtr);
massInjected_ += pPtr->nParticle()*pPtr->mass();
massAdded += pPtr->nParticle()*pPtr->mass();
parcelsAdded++;
}
}
}
postInjectCheck(parcelsAdded);
postInjectCheck(parcelsAdded, massAdded);
}

View File

@ -188,7 +188,11 @@ protected:
);
//- Post injection checks
virtual void postInjectCheck(const label parcelsAdded);
virtual void postInjectCheck
(
const label parcelsAdded,
const scalar massAdded
);
public:

View File

@ -25,7 +25,8 @@ License
\*---------------------------------------------------------------------------*/
#include "PatchPostProcessing.H"
#include "IOPtrList.H"
#include "Pstream.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -54,34 +55,57 @@ void Foam::PatchPostProcessing<CloudType>::write()
{
forAll(patchData_, patchI)
{
IOPtrList<parcelType> postObject
(
IOobject
(
patchNames_[patchI] + ".post",
this->owner().time().timeName(),
"postProcessing",
this->owner(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
patchData_[patchI].size()
);
List<List<string> > procData(Pstream::nProcs());
procData[Pstream::myProcNo()] = patchData_[patchI];
forAll(postObject, ptrI)
Pstream::gatherList(procData);
if (Pstream::master())
{
postObject.set(ptrI, patchData_[patchI][ptrI].ptr());
fileName outputDir;
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir =
mesh_.time().path()/".."/"postProcessing"/cloud::prefix/
this->owner().name()/this->owner().time().timeName();
}
else
{
outputDir =
mesh_.time().path()/"postProcessing"/cloud::prefix/
this->owner().name()/this->owner().time().timeName();
}
// Create directory if it doesn't exist
mkDir(outputDir);
OFstream patchOutFile
(
outputDir/patchNames_[patchI] + ".post",
IOstream::ASCII,
IOstream::currentVersion,
mesh_.time().writeCompression()
);
List<string> globalData;
globalData = ListListOps::combine<List<string> >
(
procData,
accessOp<List<string> >()
);
sort(globalData);
patchOutFile<< "# Time " + parcelType::propHeader << nl;
forAll(globalData, i)
{
patchOutFile<< globalData[i].c_str() << nl;
}
}
postObject.note() = parcelType::propHeader;
postObject.writeObject
(
IOstream::ASCII,
IOstream::currentVersion,
mesh_.time().writeCompression()
);
patchData_[patchI].clearStorage();
}
}
@ -98,6 +122,7 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
:
PostProcessingModel<CloudType>(dict, owner, typeName),
mesh_(owner.mesh()),
maxStoredParcels_(readLabel(this->coeffDict().lookup("maxStoredParcels"))),
patchNames_(this->coeffDict().lookup("patches")),
patchData_(patchNames_.size()),
patchIds_(patchNames_.size())
@ -149,7 +174,9 @@ void Foam::PatchPostProcessing<CloudType>::postPatch
label localPatchI = applyToPatch(patchI);
if (localPatchI >= 0 && patchData_[localPatchI].size() < maxStoredParcels_)
{
patchData_[localPatchI].append(p.clone());
OStringStream data;
data<< this->owner().time().timeName() << ' ' << p;
patchData_[localPatchI].append(data.str());
}
}

View File

@ -65,8 +65,8 @@ class PatchPostProcessing
//- List of patch names
wordList patchNames_;
//- List of parcel data per patch
List<DynamicList<autoPtr<parcelType> > > patchData_;
//- List of output data per patch
List<DynamicList<string> > patchData_;
//- Mapping from local to global patch ids
labelList patchIds_;

View File

@ -450,8 +450,17 @@ bool Foam::interactionLists::testPointFaceDistance
// if the algorithm hasn't returned anything by now then something has
// gone wrong.
FatalErrorIn("interactionLists.C") << nl
<< "point " << p << " to face " << faceToTest
FatalErrorIn
(
"interactionLists::testPointFaceDistance"
"("
"const vector&, "
"const labelList&, "
"const vectorList&, "
"const vector&, "
"const vector&"
") const"
) << "point " << p << " to face " << faceToTest
<< " comparison did not find a nearest point"
<< " to be inside or outside face."
<< abort(FatalError);

View File

@ -121,8 +121,10 @@ void Foam::referredCellList::buildReferredCellList
}
else
{
FatalErrorIn ("referredCellList.C")
<< nl << "unable to read undecomposed boundary file from "
FatalErrorIn
(
"referredCellList::buildReferredCellList(bool)"
) << "unable to read undecomposed boundary file from "
<< "constant/polyMesh" << nl
<< abort(FatalError);
}
@ -333,9 +335,10 @@ void Foam::referredCellList::buildReferredCellList
> interactionLists::transTol
)
{
FatalErrorIn ("referredCellList.C")
<< nl << "Face pairs on patch "
<< patch.name()
FatalErrorIn
(
"referredCellList::buildReferredCellList(bool)"
) << "Face pairs on patch " << patch.name()
<< ", segment " << patchNames[nUP]
<< " do not give the same referring "
<< " transformations to within tolerance of "
@ -423,9 +426,10 @@ void Foam::referredCellList::buildReferredCellList
> interactionLists::transTol
)
{
FatalErrorIn ("referredCellList.C")
<< nl << "Face pairs on patch "
<< patch.name()
FatalErrorIn
(
"referredCellList::buildReferredCellList(bool)"
) << "Face pairs on patch " << patch.name()
<< " do not give the same referring "
<< " transformations to within tolerance of "
<< interactionLists::transTol << nl
@ -1022,8 +1026,10 @@ void Foam::referredCellList::buildReferredCellList
{
if (faceT == -1)
{
FatalErrorIn ("referredCellList.C")
<< nl << "faceT == -1 encountered but "
FatalErrorIn
(
"referredCellList::buildReferredCellList(bool)"
) << "faceT == -1 encountered but "
<< meshFacesOnThisSegment.size()
<< " faces found on patch segment."
<< abort(FatalError);

View File

@ -105,6 +105,8 @@ void Foam::molecule::readFields(Cloud<molecule>& mC)
return;
}
Particle<molecule>::readFields(mC);
IOField<tensor> Q(mC.fieldIOobject("Q", IOobject::MUST_READ));
mC.checkFieldIOobject(mC, Q);

View File

@ -81,7 +81,7 @@ void Foam::moleculeCloud::buildConstProps()
if (siteIds[sI] == -1)
{
FatalErrorIn("moleculeCloud.C") << nl
FatalErrorIn("moleculeCloud::buildConstProps()")
<< siteId << " site not found."
<< nl << abort(FatalError);
}

View File

@ -101,7 +101,7 @@ Foam::scalar Foam::pairPotential::force(const scalar r) const
if (k < 0)
{
FatalErrorIn("pairPotential.C") << nl
FatalErrorIn("pairPotential::force(const scalar) const")
<< "r less than rMin in pair potential " << name_ << nl
<< abort(FatalError);
}
@ -138,7 +138,7 @@ Foam::scalar Foam::pairPotential::energy(const scalar r) const
if (k < 0)
{
FatalErrorIn("pairPotential.C") << nl
FatalErrorIn("pairPotential::energy(const scalar) const")
<< "r less than rMin in pair potential " << name_ << nl
<< abort(FatalError);
}

View File

@ -40,7 +40,7 @@ void Foam::potential::setSiteIdList(const IOdictionary& moleculePropertiesDict)
if (!moleculePropertiesDict.found(id))
{
FatalErrorIn("potential.C") << nl
FatalErrorIn("potential::setSiteIdList(const IOdictionary&)")
<< id << " molecule subDict not found"
<< nl << abort(FatalError);
}
@ -67,7 +67,7 @@ void Foam::potential::setSiteIdList(const IOdictionary& moleculePropertiesDict)
if (findIndex(siteIdNames, siteId) == -1)
{
FatalErrorIn("potential.C") << nl
FatalErrorIn("potential::setSiteIdList(const IOdictionary&)")
<< siteId << " in pairPotentialSiteIds is not in siteIds: "
<< siteIdNames << nl << abort(FatalError);
}
@ -174,7 +174,7 @@ void Foam::potential::potential::readPotentialDict()
if (removalOrder_[rO] == -1)
{
FatalErrorIn("potentials.C") << nl
FatalErrorIn("potential::readPotentialDict()")
<< "removalOrder entry: " << remOrd[rO]
<< " not found in idList."
<< nl << abort(FatalError);
@ -187,7 +187,7 @@ void Foam::potential::potential::readPotentialDict()
if (!potentialDict.found("pair"))
{
FatalErrorIn("potentials.C") << nl
FatalErrorIn("potential::readPotentialDict()")
<< "pair potential specification subDict not found"
<< abort(FatalError);
}
@ -208,7 +208,7 @@ void Foam::potential::potential::readPotentialDict()
{
if (!potentialDict.found("tether"))
{
FatalErrorIn("potential.C") << nl
FatalErrorIn("potential::readPotentialDict()")
<< "tether potential specification subDict not found"
<< abort(FatalError);
}
@ -289,11 +289,15 @@ void Foam::potential::potential::readMdInitialiseDict
if (!moleculePropertiesDict.found(id))
{
FatalErrorIn("potential.C") << nl
<< "Molecule type "
<< id
<< " not found in moleculeProperties dictionary."
<< nl
FatalErrorIn
(
"potential::readMdInitialiseDict"
"("
"const IOdictionary&, "
"IOdictionary&"
")"
) << "Molecule type " << id
<< " not found in moleculeProperties dictionary." << nl
<< abort(FatalError);
}
@ -340,11 +344,15 @@ void Foam::potential::potential::readMdInitialiseDict
}
else
{
FatalErrorIn("potential.C") << nl
<< "Tether id "
<< tetherSiteId
<< " not found as a site of any molecule in zone."
<< nl
FatalErrorIn
(
"potential::readMdInitialiseDict"
"("
"const IOdictionary&, "
"IOdictionary&"
")"
) << "Tether id " << tetherSiteId
<< " not found as a site of any molecule in zone." << nl
<< abort(FatalError);
}
}

View File

@ -670,7 +670,6 @@ void Foam::refinementSurfaces::findHigherIntersection
haveLevelField = true;
}
if (haveLevelField)
{
forAll(intersectionInfo, i)
@ -741,8 +740,8 @@ void Foam::refinementSurfaces::findHigherIntersection
}
else
{
p0[missI] = p0[pointI];
p1[missI] = p1[pointI];
p0[missI] = start[pointI];
p1[missI] = end[pointI];
intersectionToPoint[missI] = pointI;
missI++;
}

View File

@ -623,6 +623,27 @@ Foam::directMappedPatchBase::directMappedPatchBase
{}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode mode,
const word& samplePatch,
const vector& offset
)
:
patch_(pp),
sampleRegion_(sampleRegion),
mode_(mode),
samplePatch_(samplePatch),
uniformOffset_(true),
offset_(offset),
offsets_(0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL)
{}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,

View File

@ -157,6 +157,16 @@ public:
const vectorField& offset
);
//- Construct from components
directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const vector& offset
);
//- Construct from dictionary
directMappedPatchBase(const polyPatch&, const dictionary&);

View File

@ -82,6 +82,31 @@ Foam::directMappedPolyPatch::directMappedPolyPatch
{}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
)
:
polyPatch(name, size, start, index, bm),
directMappedPatchBase
(
static_cast<const polyPatch&>(*this),
sampleRegion,
mode,
samplePatch,
offset
)
{}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const word& name,

View File

@ -115,6 +115,20 @@ public:
const polyBoundaryMesh& bm
);
//- Construct from components. Uniform offset.
directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
directMappedPolyPatch
(

View File

@ -87,6 +87,31 @@ Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
{}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
)
:
wallPolyPatch(name, size, start, index, bm),
directMappedPatchBase
(
static_cast<const polyPatch&>(*this),
sampleRegion,
mode,
samplePatch,
offset
)
{}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const word& name,

View File

@ -115,6 +115,20 @@ public:
const polyBoundaryMesh& bm
);
//- Construct from components. Uniform offset.
directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
directMappedWallPolyPatch
(

View File

@ -141,7 +141,7 @@ Foam::fileName topoSet::topoSet::localPath
const word& name
)
{
return mesh.pointsInstance()/polyMesh::meshSubDir/"sets"/name;
return mesh.facesInstance()/polyMesh::meshSubDir/"sets"/name;
}
@ -362,7 +362,7 @@ topoSet::topoSet
IOobject
(
name,
mesh.pointsInstance(),
mesh.facesInstance(),
polyMesh::meshSubDir/"sets",
mesh,
r,
@ -402,7 +402,7 @@ topoSet::topoSet
IOobject
(
name,
mesh.pointsInstance(),
mesh.facesInstance(),
polyMesh::meshSubDir/"sets",
mesh,
NO_READ,
@ -426,7 +426,7 @@ topoSet::topoSet
IOobject
(
name,
mesh.pointsInstance(),
mesh.facesInstance(),
polyMesh::meshSubDir/"sets",
mesh,
NO_READ,

View File

@ -57,7 +57,7 @@ void Foam::fieldValue::movePoints(const Field<point>&)
void Foam::fieldValue::makeFile()
{
// Create the forces file if not already created
// Create the output file if not already created
if (outputFilePtr_.empty())
{
if (debug)

View File

@ -171,9 +171,9 @@ Foam::MeshedSurface<Face>::MeshedSurface()
template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface
(
const Xfer< pointField >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer< surfZoneList >& zoneLst
const Xfer<pointField>& pointLst,
const Xfer<List<Face> >& faceLst,
const Xfer<surfZoneList>& zoneLst
)
:
ParentType(List<Face>(), pointField()),
@ -186,8 +186,8 @@ Foam::MeshedSurface<Face>::MeshedSurface
template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface
(
const Xfer< pointField >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer<pointField>& pointLst,
const Xfer<List<Face> >& faceLst,
const UList<label>& zoneSizes,
const UList<word>& zoneNames
)
@ -397,7 +397,7 @@ Foam::MeshedSurface<Face>::MeshedSurface
template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface
(
const Xfer< UnsortedMeshedSurface<Face> >& surf
const Xfer<UnsortedMeshedSurface<Face> >& surf
)
:
ParentType(List<Face>(), pointField())
@ -409,7 +409,7 @@ Foam::MeshedSurface<Face>::MeshedSurface
template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface
(
const Xfer< MeshedSurface<Face> >& surf
const Xfer<MeshedSurface<Face> >& surf
)
:
ParentType(List<Face>(), pointField())
@ -426,9 +426,6 @@ Foam::MeshedSurface<Face>::~MeshedSurface()
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Face>
@ -526,9 +523,9 @@ void Foam::MeshedSurface<Face>::scalePoints(const scalar scaleFactor)
template<class Face>
void Foam::MeshedSurface<Face>::reset
(
const Xfer< pointField >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer< surfZoneList >& zoneLst
const Xfer<pointField>& pointLst,
const Xfer<List<Face> >& faceLst,
const Xfer<surfZoneList>& zoneLst
)
{
ParentType::clearOut();
@ -555,9 +552,9 @@ void Foam::MeshedSurface<Face>::reset
template<class Face>
void Foam::MeshedSurface<Face>::reset
(
const Xfer< List<point> >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer< surfZoneList >& zoneLst
const Xfer<List<point> >& pointLst,
const Xfer<List<Face> >& faceLst,
const Xfer<surfZoneList>& zoneLst
)
{
ParentType::clearOut();
@ -1038,8 +1035,7 @@ Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
template<class Face>
Foam::MeshedSurface<Face>
Foam::MeshedSurface<Face>::subsetMesh
Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
(
const labelHashSet& include
) const
@ -1109,8 +1105,7 @@ void Foam::MeshedSurface<Face>::transfer
template<class Face>
Foam::Xfer< Foam::MeshedSurface<Face> >
Foam::MeshedSurface<Face>::xfer()
Foam::Xfer<Foam::MeshedSurface<Face> > Foam::MeshedSurface<Face>::xfer()
{
return xferMove(*this);
}
@ -1159,6 +1154,7 @@ void Foam::MeshedSurface<Face>::write
MeshedSurfaceProxy<Face>(*this).write(t, surfName);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Face>
@ -1173,8 +1169,7 @@ void Foam::MeshedSurface<Face>::operator=(const MeshedSurface& surf)
template<class Face>
Foam::MeshedSurface<Face>::operator
Foam::MeshedSurfaceProxy<Face>() const
Foam::MeshedSurface<Face>::operator Foam::MeshedSurfaceProxy<Face>() const
{
return MeshedSurfaceProxy<Face>
(
@ -1184,9 +1179,6 @@ Foam::MeshedSurfaceProxy<Face>() const
);
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -90,9 +90,10 @@ class MeshedSurface
template<class Face2> friend class UnsortedMeshedSurface;
friend class surfMesh;
private:
//- Private typedefs for convenience
// Private typedefs for convenience
typedef PrimitivePatch
<
@ -106,6 +107,7 @@ private:
typedef UnsortedMeshedSurface<Face> FriendType;
typedef MeshedSurfaceProxy<Face> ProxyType;
// Private Member Data
//- Zone information
@ -113,8 +115,6 @@ private:
List<surfZone> zones_;
// Private member functions
protected:
// Protected Member functions
@ -146,19 +146,21 @@ protected:
//- sort faces by zones and store sorted faces
void sortFacesAndStore
(
const Xfer< List<Face> >& unsortedFaces,
const Xfer< List<label> >& zoneIds,
const Xfer<List<Face> >& unsortedFaces,
const Xfer<List<label> >& zoneIds,
const bool sorted
);
//- Set new zones from faceMap
virtual void remapFaces(const UList<label>& faceMap);
public:
//- Runtime type information
ClassName("MeshedSurface");
// Static
//- Face storage only handles triangulated faces
@ -176,6 +178,7 @@ public:
static wordHashSet readTypes();
static wordHashSet writeTypes();
// Constructors
//- Construct null
@ -184,17 +187,17 @@ public:
//- Construct by transferring components (points, faces, zones).
MeshedSurface
(
const Xfer< pointField >&,
const Xfer< List<Face> >&,
const Xfer< surfZoneList >&
const Xfer<pointField>&,
const Xfer<List<Face> >&,
const Xfer<surfZoneList>&
);
//- Construct by transferring components (points, faces).
// Use zone information if available
MeshedSurface
(
const Xfer< pointField >&,
const Xfer< List<Face> >&,
const Xfer<pointField>&,
const Xfer<List<Face> >&,
const UList<label>& zoneSizes = UList<label>(),
const UList<word>& zoneNames = UList<word>()
);
@ -230,6 +233,7 @@ public:
//- Construct from database
MeshedSurface(const Time&, const word& surfName="");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
@ -243,6 +247,7 @@ public:
(name)
);
// Selectors
//- Select constructed from filename (explicit extension)
@ -255,6 +260,7 @@ public:
//- Select constructed from filename (implicit extension)
static autoPtr<MeshedSurface> New(const fileName&);
// Destructor
virtual ~MeshedSurface();
@ -281,151 +287,152 @@ public:
// Member Functions
// Access
// Access
//- The surface size is the number of faces
label size() const
{
return ParentType::size();
}
//- The surface size is the number of faces
label size() const
{
return ParentType::size();
}
//- Return const access to the faces
inline const List<Face>& faces() const
{
return static_cast<const List<Face> &>(*this);
}
//- Return const access to the faces
inline const List<Face>& faces() const
{
return static_cast<const List<Face> &>(*this);
}
//- Const access to the surface zones.
// If zones are defined, they must be contiguous and cover the entire
// surface.
const List<surfZone>& surfZones() const
{
return zones_;
}
//- Const access to the surface zones.
// If zones are defined, they must be contiguous and cover the
// entire surface
const List<surfZone>& surfZones() const
{
return zones_;
}
//- Add surface zones
virtual void addZones
(
const UList<surfZone>&,
const bool cullEmpty=false
);
//- Add surface zones
virtual void addZones
(
const UList<surfZone>&,
const bool cullEmpty=false
);
//- Add surface zones
virtual void addZones
(
const UList<label>& sizes,
const UList<word>& names,
const bool cullEmpty=false
);
//- Add surface zones
virtual void addZones
(
const UList<label>& sizes,
const UList<word>& names,
const bool cullEmpty=false
);
//- Add surface zones
virtual void addZones
(
const UList<label>& sizes,
const bool cullEmpty=false
);
//- Add surface zones
virtual void addZones
(
const UList<label>& sizes,
const bool cullEmpty=false
);
//- Remove surface zones
virtual void removeZones();
//- Remove surface zones
virtual void removeZones();
// Edit
// Edit
//- Clear all storage
virtual void clear();
//- Clear all storage
virtual void clear();
//- Move points
virtual void movePoints(const pointField&);
//- Move points
virtual void movePoints(const pointField&);
//- Scale points. A non-positive factor is ignored
virtual void scalePoints(const scalar);
//- Scale points. A non-positive factor is ignored
virtual void scalePoints(const scalar);
//- Reset primitive data (points, faces and zones)
// Note, optimized to avoid overwriting data (with Xfer::null)
virtual void reset
(
const Xfer< pointField >& points,
const Xfer< List<Face> >& faces,
const Xfer< surfZoneList >& zones
);
//- Reset primitive data (points, faces and zones)
// Note, optimized to avoid overwriting data (with Xfer::null)
virtual void reset
(
const Xfer<pointField >& points,
const Xfer<List<Face> >& faces,
const Xfer<surfZoneList>& zones
);
//- Reset primitive data (points, faces and zones)
// Note, optimized to avoid overwriting data (with Xfer::null)
virtual void reset
(
const Xfer< List<point> >& points,
const Xfer< List<Face> >& faces,
const Xfer< surfZoneList >& zones
);
//- Reset primitive data (points, faces and zones)
// Note, optimized to avoid overwriting data (with Xfer::null)
virtual void reset
(
const Xfer<List<point> >& points,
const Xfer<List<Face> >& faces,
const Xfer<surfZoneList >& zones
);
//- Remove invalid faces
virtual void cleanup(const bool verbose);
//- Remove invalid faces
virtual void cleanup(const bool verbose);
virtual bool stitchFaces
(
const scalar tol=SMALL,
const bool verbose=false
);
virtual bool stitchFaces
(
const scalar tol=SMALL,
const bool verbose=false
);
virtual bool checkFaces
(
const bool verbose=false
);
virtual bool checkFaces
(
const bool verbose=false
);
//- Triangulate in-place, returning the number of triangles added
virtual label triangulate();
//- Triangulate in-place, returning the number of triangles added
virtual label triangulate();
//- Triangulate in-place, returning the number of triangles added
// and setting a map of original face Ids.
// The faceMap is zero-sized when no triangulation was done.
virtual label triangulate(List<label>& faceMap);
//- Triangulate in-place, returning the number of triangles added
// and setting a map of original face Ids.
// The faceMap is zero-sized when no triangulation was done.
virtual label triangulate(List<label>& faceMap);
//- Return new surface.
// Returns return pointMap, faceMap from subsetMeshMap
MeshedSurface subsetMesh
(
const labelHashSet& include,
labelList& pointMap,
labelList& faceMap
) const;
//- Return new surface.
// Returns return pointMap, faceMap from subsetMeshMap
MeshedSurface subsetMesh
(
const labelHashSet& include,
labelList& pointMap,
labelList& faceMap
) const;
//- Return new surface.
MeshedSurface subsetMesh
(
const labelHashSet& include
) const;
//- Return new surface.
MeshedSurface subsetMesh
(
const labelHashSet& include
) const;
//- Transfer the contents of the argument and annul the argument
void transfer(MeshedSurface<Face>&);
//- Transfer the contents of the argument and annul the argument
void transfer(MeshedSurface<Face>&);
//- Transfer the contents of the argument and annul the argument
void transfer(UnsortedMeshedSurface<Face>&);
//- Transfer the contents of the argument and annul the argument
void transfer(UnsortedMeshedSurface<Face>&);
//- Transfer contents to the Xfer container
Xfer< MeshedSurface<Face> > xfer();
// Read
//- Read from file. Chooses reader based on explicit extension
bool read(const fileName&, const word& ext);
//- Read from file. Chooses reader based on detected extension
virtual bool read(const fileName&);
//- Transfer contents to the Xfer container
Xfer<MeshedSurface<Face> > xfer();
// Write
// Read
void writeStats(Ostream& os) const;
//- Read from file. Chooses reader based on explicit extension
bool read(const fileName&, const word& ext);
//- Generic write routine. Chooses writer based on extension.
virtual void write(const fileName& name) const
{
write(name, *this);
}
//- Read from file. Chooses reader based on detected extension
virtual bool read(const fileName&);
//- Write to database
void write(const Time&, const word& surfName="") const;
// Write
void writeStats(Ostream& os) const;
//- Generic write routine. Chooses writer based on extension.
virtual void write(const fileName& name) const
{
write(name, *this);
}
//- Write to database
void write(const Time&, const word& surfName="") const;
// Member operators
@ -434,7 +441,6 @@ public:
//- Conversion operator to MeshedSurfaceProxy
operator MeshedSurfaceProxy<Face>() const;
};
@ -447,6 +453,7 @@ inline bool MeshedSurface<triFace>::isTri()
return true;
}
//- Specialization for holding triangulated information
template<>
inline label MeshedSurface<triFace>::triangulate()
@ -454,6 +461,7 @@ inline label MeshedSurface<triFace>::triangulate()
return 0;
}
//- Specialization for holding triangulated information
template<>
inline label MeshedSurface<triFace>::triangulate(List<label>& faceMap)
@ -466,6 +474,7 @@ inline label MeshedSurface<triFace>::triangulate(List<label>& faceMap)
return 0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -71,8 +71,8 @@ void Foam::MeshedSurface<Face>::checkZones()
template<class Face>
void Foam::MeshedSurface<Face>::sortFacesAndStore
(
const Xfer< List<Face> >& unsortedFaces,
const Xfer< List<label> >& zoneIds,
const Xfer<List<Face> >& unsortedFaces,
const Xfer<List<label> >& zoneIds,
const bool sorted
)
{

View File

@ -26,7 +26,6 @@ License
#include "MeshedSurfaceIOAllocator.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
@ -61,11 +60,11 @@ Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
(
const IOobject& ioPoints,
const Xfer< pointField >& points,
const Xfer<pointField>& points,
const IOobject& ioFaces,
const Xfer< faceList >& faces,
const Xfer<faceList>& faces,
const IOobject& ioZones,
const Xfer< surfZoneList >& zones
const Xfer<surfZoneList>& zones
)
:
points_(ioPoints, points),
@ -74,8 +73,6 @@ Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::MeshedSurfaceIOAllocator::clear()
@ -88,8 +85,8 @@ void Foam::MeshedSurfaceIOAllocator::clear()
void Foam::MeshedSurfaceIOAllocator::resetFaces
(
const Xfer< List<face> >& faces,
const Xfer< surfZoneList >& zones
const Xfer<List<face> >& faces,
const Xfer<surfZoneList>& zones
)
{
if (&faces)
@ -106,9 +103,9 @@ void Foam::MeshedSurfaceIOAllocator::resetFaces
void Foam::MeshedSurfaceIOAllocator::reset
(
const Xfer< pointField >& points,
const Xfer< faceList >& faces,
const Xfer< surfZoneList >& zones
const Xfer<pointField>& points,
const Xfer<faceList>& faces,
const Xfer<surfZoneList>& zones
)
{
// Take over new primitive data.
@ -124,9 +121,9 @@ void Foam::MeshedSurfaceIOAllocator::reset
void Foam::MeshedSurfaceIOAllocator::reset
(
const Xfer< List<point> >& points,
const Xfer< faceList >& faces,
const Xfer< surfZoneList >& zones
const Xfer<List<point> >& points,
const Xfer<faceList>& faces,
const Xfer<surfZoneList>& zones
)
{
// Take over new primitive data.

View File

@ -49,16 +49,15 @@ namespace Foam
Class MeshedSurfaceIOAllocator Declaration
\*---------------------------------------------------------------------------*/
//- A helper class for storing points, faces and zones
class MeshedSurfaceIOAllocator
{
// Private data
//- Points
pointIOField points_;
pointIOField points_;
//- Faces
faceIOList faces_;
faceIOList faces_;
//- Surface zones
surfZoneIOList zones_;
@ -100,15 +99,13 @@ public:
MeshedSurfaceIOAllocator
(
const IOobject& ioPoints,
const Xfer< pointField >& points,
const Xfer<pointField>& points,
const IOobject& ioFaces,
const Xfer< faceList >& faces,
const Xfer<faceList>& faces,
const IOobject& ioZones,
const Xfer< surfZoneList >& zones
const Xfer<surfZoneList>& zones
);
// Destructor
// Member Functions
@ -160,26 +157,26 @@ public:
// Note, optimized to avoid overwriting data (with Xfer::null)
void resetFaces
(
const Xfer< faceList >& faces,
const Xfer< surfZoneList >& zones
const Xfer<faceList>& faces,
const Xfer<surfZoneList>& zones
);
//- Reset primitive data (points, faces and zones)
// Note, optimized to avoid overwriting data (with Xfer::null)
void reset
(
const Xfer< pointField >& points,
const Xfer< faceList >& faces,
const Xfer< surfZoneList >& zones
const Xfer<pointField>& points,
const Xfer<faceList>& faces,
const Xfer<surfZoneList>& zones
);
//- Reset primitive data (points, faces and zones)
// Note, optimized to avoid overwriting data (with Xfer::null)
void reset
(
const Xfer< List<point> >& points,
const Xfer< faceList >& faces,
const Xfer< surfZoneList >& zones
const Xfer<List<point> >& points,
const Xfer<faceList>& faces,
const Xfer<surfZoneList>& zones
);
};

View File

@ -159,10 +159,10 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface()
template<class Face>
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
(
const Xfer< pointField >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer< List<label> >& zoneIds,
const Xfer< surfZoneIdentifierList >& zoneTofc
const Xfer<pointField>& pointLst,
const Xfer<List<Face> >& faceLst,
const Xfer<List<label> >& zoneIds,
const Xfer<surfZoneIdentifierList>& zoneTofc
)
:
ParentType(pointLst, faceLst),
@ -174,8 +174,8 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
template<class Face>
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
(
const Xfer< pointField >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer<pointField>& pointLst,
const Xfer<List<Face> >& faceLst,
const UList<label>& zoneSizes,
const UList<word>& zoneNames
)
@ -235,7 +235,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
template<class Face>
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
(
const Xfer< UnsortedMeshedSurface<Face> >& surf
const Xfer<UnsortedMeshedSurface<Face> >& surf
)
:
ParentType()
@ -247,7 +247,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
template<class Face>
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
(
const Xfer< MeshedSurface<Face> >& surf
const Xfer<MeshedSurface<Face> >& surf
)
:
ParentType()
@ -601,9 +601,9 @@ Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
template<class Face>
void Foam::UnsortedMeshedSurface<Face>::reset
(
const Xfer< pointField >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer< List<label> >& zoneIds
const Xfer<pointField>& pointLst,
const Xfer<List<Face> >& faceLst,
const Xfer<List<label> >& zoneIds
)
{
ParentType::reset
@ -623,9 +623,9 @@ void Foam::UnsortedMeshedSurface<Face>::reset
template<class Face>
void Foam::UnsortedMeshedSurface<Face>::reset
(
const Xfer< List<point> >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer< List<label> >& zoneIds
const Xfer<List<point> >& pointLst,
const Xfer<List<Face> >& faceLst,
const Xfer<List<label> >& zoneIds
)
{
ParentType::reset
@ -681,7 +681,7 @@ void Foam::UnsortedMeshedSurface<Face>::transfer
template<class Face>
Foam::Xfer< Foam::UnsortedMeshedSurface<Face> >
Foam::Xfer<Foam::UnsortedMeshedSurface<Face> >
Foam::UnsortedMeshedSurface<Face>::xfer()
{
return xferMove(*this);

View File

@ -85,7 +85,7 @@ class UnsortedMeshedSurface
private:
//- Private typedefs for convenience
// Private typedefs for convenience
typedef MeshedSurface<Face> ParentType;
typedef MeshedSurface<Face> FriendType;
@ -161,10 +161,10 @@ public:
// (points, faces, zone ids, zone info).
UnsortedMeshedSurface
(
const Xfer< pointField >&,
const Xfer< List<Face> >&,
const Xfer< List<label> >& zoneIds,
const Xfer< surfZoneIdentifierList >&
const Xfer<pointField>&,
const Xfer<List<Face> >&,
const Xfer<List<label> >& zoneIds,
const Xfer<surfZoneIdentifierList>&
);
//- Construct by transferring points, faces.
@ -226,9 +226,8 @@ public:
static autoPtr<UnsortedMeshedSurface> New(const fileName&);
// Destructor
virtual ~UnsortedMeshedSurface();
//- Destructor
virtual ~UnsortedMeshedSurface();
// Member Function Selectors
@ -315,17 +314,17 @@ public:
//- Transfer components (points, faces, zone ids).
virtual void reset
(
const Xfer< pointField >&,
const Xfer< List<Face> >&,
const Xfer< List<label> >& zoneIds
const Xfer<pointField>&,
const Xfer<List<Face> >&,
const Xfer<List<label> >& zoneIds
);
//- Transfer components (points, faces, zone ids).
virtual void reset
(
const Xfer< List<point> >&,
const Xfer< List<Face> >&,
const Xfer< List<label> >& zoneIds
const Xfer<List<point> >&,
const Xfer<List<Face> >&,
const Xfer<List<label> >& zoneIds
);
//- Transfer the contents of the argument and annul the argument
@ -335,7 +334,7 @@ public:
void transfer(MeshedSurface<Face>&);
//- Transfer contents to the Xfer container
Xfer< UnsortedMeshedSurface<Face> > xfer();
Xfer<UnsortedMeshedSurface<Face> > xfer();
// Read

View File

@ -110,8 +110,8 @@ Foam::surfMesh::surfMesh(const IOobject& io, const word& surfName)
Foam::surfMesh::surfMesh
(
const IOobject& io,
const Xfer< pointField >& pointLst,
const Xfer< faceList >& faceLst,
const Xfer<pointField>& pointLst,
const Xfer<faceList>& faceLst,
const word& surfName
)
:
@ -156,7 +156,7 @@ Foam::surfMesh::surfMesh
Foam::surfMesh::surfMesh
(
const IOobject& io,
const Xfer< MeshedSurface<face> >& surf,
const Xfer<MeshedSurface<face> >& surf,
const word& surfName
)
:
@ -252,9 +252,9 @@ void Foam::surfMesh::updateRefs()
void Foam::surfMesh::resetPrimitives
(
const Xfer< pointField >& points,
const Xfer< faceList >& faces,
const Xfer< surfZoneList >& zones,
const Xfer<pointField>& points,
const Xfer<faceList>& faces,
const Xfer<surfZoneList>& zones,
const bool validate
)
{
@ -287,10 +287,9 @@ void Foam::surfMesh::transfer
}
Foam::Xfer< Foam::MeshedSurface<Foam::face> >
Foam::surfMesh::xfer()
Foam::Xfer<Foam::MeshedSurface<Foam::face> > Foam::surfMesh::xfer()
{
Xfer< MeshedSurface<face> > xf;
Xfer<MeshedSurface<face> > xf;
xf().storedPoints().transfer(this->storedPoints());
xf().storedFaces().transfer(this->storedFaces());

View File

@ -172,7 +172,7 @@ public:
surfMesh
(
const IOobject&,
const Xfer< MeshedSurface<face> >& surf,
const Xfer<MeshedSurface<face> >& surf,
const word& surfName=""
);
@ -250,9 +250,9 @@ public:
//- Reset mesh primitive data.
void resetPrimitives
(
const Xfer< pointField >& points,
const Xfer< faceList >& faces,
const Xfer< surfZoneList >& zones,
const Xfer<pointField>& points,
const Xfer<faceList>& faces,
const Xfer<surfZoneList>& zones,
const bool validate = true
);
@ -273,7 +273,7 @@ public:
// Storage management
//- Transfer contents to the Xfer container as a MeshedSurface
Xfer< MeshedSurface<face> > xfer();
Xfer<MeshedSurface<face> > xfer();
//- Clear geometry
void clearGeom();

View File

@ -551,7 +551,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::dQ() const
dimensionedScalar
(
"zero",
dimensionSet(1, -3, -1 , 0, 0, 0, 0),
dimensionSet(0, 2, -3 , 0, 0, 0, 0),
0.0
)
)
@ -561,20 +561,21 @@ Foam::ODEChemistryModel<CompType, ThermoType>::dQ() const
{
scalarField& dQ = tdQ();
scalarField cp(dQ.size(), 0.0);
scalarField rhoEff(dQ.size(), 0.0);
forAll(Y_, i)
{
forAll(dQ, cellI)
{
scalar Ti = this->thermo().T()[cellI];
cp[cellI] += Y_[i][cellI]*specieThermo_[i].Cp(Ti);
scalar hi = specieThermo_[i].h(Ti);
scalar pi = this->thermo().p()[cellI];
rhoEff[cellI] += Y_[i][cellI]*specieThermo_[i].rho(pi, Ti);
scalar hi = specieThermo_[i].H(Ti);
dQ[cellI] -= hi*RR_[i][cellI];
}
}
dQ /= cp;
dQ /= rhoEff;
}
return tdQ;

View File

@ -90,7 +90,7 @@ protected:
//- Chemistry solver
autoPtr<chemistrySolver<CompType, ThermoType> > solver_;
//- Chemical source term
//- Chemical source term [kg/m3/s]
PtrList<scalarField> RR_;
@ -180,7 +180,7 @@ public:
//- Return the chemical time scale
virtual tmp<volScalarField> tc() const;
//- Return the heat release
//- Return the heat release, i.e. enthalpy/sec [m2/s3]
virtual tmp<volScalarField> dQ() const;

View File

@ -76,21 +76,24 @@ Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField
TName_(dict.lookup("T")),
emissivity_(readScalar(dict.lookup("emissivity")))
{
const scalarField& Tp =
patch().lookupPatchField<volScalarField, scalar>(TName_);
refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp);
refGrad() = 0.0;
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{
const scalarField& Tp =
patch().lookupPatchField<volScalarField, scalar>(TName_);
refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp);
refGrad() = 0.0;
fvPatchScalarField::operator=(refValue());
}
}
@ -169,10 +172,9 @@ void Foam::MarshakRadiationFvPatchScalarField::updateCoeffs()
void Foam::MarshakRadiationFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
mixedFvPatchScalarField::write(os);
os.writeKeyword("T") << TName_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -79,18 +79,22 @@ MarshakRadiationFixedTMixedFvPatchScalarField
Trad_("Trad", dict, p.size()),
emissivity_(readScalar(dict.lookup("emissivity")))
{
refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Trad_);
refGrad() = 0.0;
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{
refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Trad_);
refGrad() = 0.0;
valueFraction() = 1.0;
fvPatchScalarField::operator=(refValue());
}
}
@ -128,7 +132,7 @@ void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::autoMap
const fvPatchFieldMapper& m
)
{
scalarField::autoMap(m);
mixedFvPatchScalarField::autoMap(m);
Trad_.autoMap(m);
}
@ -173,10 +177,9 @@ void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::updateCoeffs()
void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
mixedFvPatchScalarField::write(os);
Trad_.writeEntry("Trad", os);
os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

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