mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,11 +2,8 @@
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
# update version string if under Git
|
||||
git describe 2> /dev/null | \
|
||||
(read project_string \
|
||||
&& sed -e 's/WM_PROJECT_VERSION/\"'"${project_string}"'"/' \
|
||||
OpenFOAM/global/global_raw.C >OpenFOAM/global/global.C)
|
||||
# update Foam::FOAMversion string if required
|
||||
wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
|
||||
|
||||
wmakeLnInclude -f OpenFOAM
|
||||
wmakeLnInclude -f OSspecific/$WM_OS
|
||||
|
||||
@ -211,7 +211,7 @@ bool Foam::chDir(const fileName& dir)
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::dotFoam(const fileName& name)
|
||||
Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
|
||||
{
|
||||
// Search user files:
|
||||
// ~~~~~~~~~~~~~~~~~~
|
||||
@ -268,6 +268,15 @@ Foam::fileName Foam::dotFoam(const fileName& name)
|
||||
}
|
||||
|
||||
// Not found
|
||||
// abort if the file is mandatory, otherwise return null
|
||||
if (mandatory)
|
||||
{
|
||||
cerr<< "--> FOAM FATAL ERROR in Foam::findEtcFile() :"
|
||||
" could not find mandatory file\n '"
|
||||
<< name.c_str() << "'\n\n" << std::endl;
|
||||
::exit(1);
|
||||
}
|
||||
|
||||
return fileName::null;
|
||||
}
|
||||
|
||||
|
||||
@ -37,15 +37,20 @@ License
|
||||
void Foam::regExp::compile(const char* pat) const
|
||||
{
|
||||
clear();
|
||||
preg_ = new regex_t;
|
||||
|
||||
if (regcomp(preg_, pat, REG_EXTENDED) != 0)
|
||||
// avoid NULL and zero-length patterns
|
||||
if (pat && *pat)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"regExp::compile(const char*)"
|
||||
) << "Failed to compile regular expression '" << pat << "'"
|
||||
<< exit(FatalError);
|
||||
preg_ = new regex_t;
|
||||
|
||||
if (regcomp(preg_, pat, REG_EXTENDED) != 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"regExp::compile(const char*)"
|
||||
) << "Failed to compile regular expression '" << pat << "'"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,6 +65,7 @@ void Foam::regExp::clear() const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regExp::regExp()
|
||||
@ -83,6 +89,7 @@ Foam::regExp::regExp(const char* pat)
|
||||
compile(pat);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regExp::~regExp()
|
||||
@ -90,6 +97,7 @@ Foam::regExp::~regExp()
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
int Foam::regExp::ngroups() const
|
||||
@ -110,6 +118,7 @@ bool Foam::regExp::match
|
||||
regmatch_t pmatch[1];
|
||||
|
||||
// match and also verify that the entire string was matched
|
||||
// pmatch[0] is the entire match
|
||||
if
|
||||
(
|
||||
regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
|
||||
@ -141,6 +150,8 @@ bool Foam::regExp::match
|
||||
regmatch_t pmatch[nmatch];
|
||||
|
||||
// match and also verify that the entire string was matched
|
||||
// pmatch[0] is the entire match
|
||||
// pmatch[1..] are the (...) sub-groups
|
||||
if
|
||||
(
|
||||
regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
|
||||
@ -179,8 +190,8 @@ bool Foam::regExp::match
|
||||
return false;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::regExp::operator=(const string& pat)
|
||||
{
|
||||
@ -193,4 +204,5 @@ void Foam::regExp::operator=(const char* pat)
|
||||
compile(pat);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
global/global.C
|
||||
|
||||
global/global.Cver
|
||||
global/dimensionedConstants/dimensionedConstants.C
|
||||
global/argList/argList.C
|
||||
global/clock/clock.C
|
||||
@ -290,7 +289,6 @@ $(tetCell)/tetCell.C
|
||||
|
||||
cellModeller = $(meshShapes)/cellModeller
|
||||
$(cellModeller)/cellModeller.C
|
||||
$(cellModeller)/cellModellerIO.C
|
||||
|
||||
cellModel = $(meshShapes)/cellModel
|
||||
$(cellModel)/cellModel.C
|
||||
|
||||
@ -28,22 +28,15 @@ Description
|
||||
|
||||
#include "Dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Null constructor
|
||||
template<class T>
|
||||
Dictionary<T>::Dictionary()
|
||||
Foam::Dictionary<T>::Dictionary()
|
||||
{}
|
||||
|
||||
|
||||
// Copy constructor
|
||||
template<class T>
|
||||
Dictionary<T>::Dictionary(const Dictionary& dict)
|
||||
Foam::Dictionary<T>::Dictionary(const Dictionary& dict)
|
||||
:
|
||||
DictionaryBase<IDLList<T>, T>(dict)
|
||||
{}
|
||||
@ -52,10 +45,10 @@ Dictionary<T>::Dictionary(const Dictionary& dict)
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
bool Dictionary<T>::erase(const word& Keyword)
|
||||
bool Foam::Dictionary<T>::erase(const word& keyword)
|
||||
{
|
||||
T* tPtr;
|
||||
if ((tPtr = this->remove(Keyword)))
|
||||
if (tPtr = this->remove(keyword))
|
||||
{
|
||||
delete tPtr;
|
||||
return true;
|
||||
@ -69,6 +62,4 @@ bool Dictionary<T>::erase(const word& Keyword)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,8 +27,10 @@ Class
|
||||
|
||||
Description
|
||||
Gerneral purpose template dictionary class which manages the storage
|
||||
associated with it. It is derived from DictionaryBase instantiated on
|
||||
a memory managed form of intrusive doubly-linked list of \<T\>.
|
||||
associated with it.
|
||||
|
||||
It is derived from DictionaryBase instantiated on a memory managed form
|
||||
of intrusive doubly-linked list of \<T\>.
|
||||
|
||||
SourceFiles
|
||||
Dictionary.C
|
||||
@ -47,7 +49,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Dictionary Declaration
|
||||
Class Dictionary Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
@ -69,11 +71,9 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Editing
|
||||
|
||||
//- Remove an entry specified by keyword from the dictionary
|
||||
// and delete it
|
||||
bool erase(const word& keyword);
|
||||
//- Remove an entry specified by keyword and delete the pointer.
|
||||
// Returns true if the keyword was found
|
||||
bool erase(const word& keyword);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -26,15 +26,10 @@ License
|
||||
|
||||
#include "DictionaryBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class IDLListType, class T>
|
||||
void DictionaryBase<IDLListType, T>::addEntries()
|
||||
void Foam::DictionaryBase<IDLListType, T>::addEntries()
|
||||
{
|
||||
for
|
||||
(
|
||||
@ -51,12 +46,15 @@ void DictionaryBase<IDLListType, T>::addEntries()
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class IDLListType, class T>
|
||||
DictionaryBase<IDLListType, T>::DictionaryBase()
|
||||
Foam::DictionaryBase<IDLListType, T>::DictionaryBase()
|
||||
{}
|
||||
|
||||
|
||||
template<class IDLListType, class T>
|
||||
DictionaryBase<IDLListType, T>::DictionaryBase(const DictionaryBase& dict)
|
||||
Foam::DictionaryBase<IDLListType, T>::DictionaryBase
|
||||
(
|
||||
const DictionaryBase& dict
|
||||
)
|
||||
:
|
||||
IDLListType(dict)
|
||||
{
|
||||
@ -66,17 +64,20 @@ DictionaryBase<IDLListType, T>::DictionaryBase(const DictionaryBase& dict)
|
||||
|
||||
template<class IDLListType, class T>
|
||||
template<class INew>
|
||||
DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is, const INew& inewt)
|
||||
Foam::DictionaryBase<IDLListType, T>::DictionaryBase
|
||||
(
|
||||
Istream& is,
|
||||
const INew& iNew
|
||||
)
|
||||
:
|
||||
IDLListType(is, inewt)
|
||||
IDLListType(is, iNew)
|
||||
{
|
||||
addEntries();
|
||||
}
|
||||
|
||||
|
||||
// Istream constructor
|
||||
template<class IDLListType, class T>
|
||||
DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
|
||||
Foam::DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
|
||||
:
|
||||
IDLListType(is)
|
||||
{
|
||||
@ -88,25 +89,60 @@ DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
|
||||
|
||||
// Find and return T
|
||||
template<class IDLListType, class T>
|
||||
bool DictionaryBase<IDLListType, T>::found(const word& keyword) const
|
||||
bool Foam::DictionaryBase<IDLListType, T>::found(const word& keyword) const
|
||||
{
|
||||
return hashedTs_.found(keyword);
|
||||
}
|
||||
|
||||
|
||||
// Find and return T*
|
||||
// Find and return T*, return NULL if not found
|
||||
template<class IDLListType, class T>
|
||||
const T* DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
||||
const T* Foam::DictionaryBase<IDLListType, T>::lookupPtr
|
||||
(
|
||||
const word& keyword
|
||||
) const
|
||||
{
|
||||
typename HashTable<T*>::const_iterator iter = hashedTs_.find(keyword);
|
||||
|
||||
if (iter != hashedTs_.end())
|
||||
{
|
||||
return *iter;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Find and return T*, return NULL if not found
|
||||
template<class IDLListType, class T>
|
||||
T* Foam::DictionaryBase<IDLListType, T>::lookupPtr(const word& keyword)
|
||||
{
|
||||
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
||||
|
||||
if (iter != hashedTs_.end())
|
||||
{
|
||||
return *iter;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Find and return T*, FatalError if keyword not found
|
||||
template<class IDLListType, class T>
|
||||
const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
||||
{
|
||||
typename HashTable<T*>::const_iterator iter = hashedTs_.find(keyword);
|
||||
|
||||
if (iter == hashedTs_.end())
|
||||
{
|
||||
// If keyword not found print error message ...
|
||||
FatalErrorIn
|
||||
(
|
||||
"DictionaryBase<IDLListType, T>::"
|
||||
"lookup(const word& keyword) const"
|
||||
"DictionaryBase<IDLListType, T>::lookup(const word&) const"
|
||||
) << keyword << " is undefined"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -115,18 +151,17 @@ const T* DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
||||
}
|
||||
|
||||
|
||||
// Find and return T*
|
||||
// Find and return T*, FatalError if keyword not found
|
||||
template<class IDLListType, class T>
|
||||
T* DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
||||
T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
||||
{
|
||||
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
||||
|
||||
if (iter == hashedTs_.end())
|
||||
{
|
||||
// If keyword not found print error message ...
|
||||
FatalErrorIn
|
||||
(
|
||||
"DictionaryBase<IDLListType, T>::lookup(const word& keyword)"
|
||||
"DictionaryBase<IDLListType, T>::lookup(const word&)"
|
||||
) << keyword << " is undefined"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -137,7 +172,7 @@ T* DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
||||
|
||||
// Return the table of contents
|
||||
template<class IDLListType, class T>
|
||||
wordList DictionaryBase<IDLListType, T>::toc() const
|
||||
Foam::wordList Foam::DictionaryBase<IDLListType, T>::toc() const
|
||||
{
|
||||
wordList keywords(this->size());
|
||||
|
||||
@ -158,26 +193,28 @@ wordList DictionaryBase<IDLListType, T>::toc() const
|
||||
|
||||
// Add at head of dictionary
|
||||
template<class IDLListType, class T>
|
||||
void DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
||||
void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
||||
{
|
||||
IDLListType::insert(tPtr);
|
||||
// NOTE: we should probably check that HashTable::insert actually worked
|
||||
hashedTs_.insert(keyword, tPtr);
|
||||
IDLListType::insert(tPtr);
|
||||
}
|
||||
|
||||
|
||||
// Add at tail of dictionary
|
||||
template<class IDLListType, class T>
|
||||
void DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
|
||||
void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
|
||||
{
|
||||
IDLListType::append(tPtr);
|
||||
// NOTE: we should probably check that HashTable::insert actually worked
|
||||
hashedTs_.insert(keyword, tPtr);
|
||||
IDLListType::append(tPtr);
|
||||
}
|
||||
|
||||
|
||||
template<class IDLListType, class T>
|
||||
T* DictionaryBase<IDLListType, T>::remove(const word& Keyword)
|
||||
T* Foam::DictionaryBase<IDLListType, T>::remove(const word& keyword)
|
||||
{
|
||||
typename HashTable<T*>::iterator iter = hashedTs_.find(Keyword);
|
||||
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
||||
|
||||
if (iter != hashedTs_.end())
|
||||
{
|
||||
@ -192,19 +229,29 @@ T* DictionaryBase<IDLListType, T>::remove(const word& Keyword)
|
||||
}
|
||||
|
||||
|
||||
//- Clear the dictionary
|
||||
template<class IDLListType, class T>
|
||||
void DictionaryBase<IDLListType, T>::clear()
|
||||
void Foam::DictionaryBase<IDLListType, T>::clear()
|
||||
{
|
||||
IDLListType::clear();
|
||||
hashedTs_.clear();
|
||||
}
|
||||
|
||||
|
||||
template<class IDLListType, class T>
|
||||
void Foam::DictionaryBase<IDLListType, T>::transfer
|
||||
(
|
||||
DictionaryBase<IDLListType, T>& dict
|
||||
)
|
||||
{
|
||||
IDLListType::transfer(dict);
|
||||
hashedTs_.transfer(dict.hashedTs_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class IDLListType, class T>
|
||||
void DictionaryBase<IDLListType, T>::operator=
|
||||
void Foam::DictionaryBase<IDLListType, T>::operator=
|
||||
(
|
||||
const DictionaryBase<IDLListType, T>& dict
|
||||
)
|
||||
@ -218,25 +265,11 @@ void DictionaryBase<IDLListType, T>::operator=
|
||||
}
|
||||
|
||||
IDLListType::operator=(dict);
|
||||
|
||||
this->hashedTs_.clear();
|
||||
|
||||
for
|
||||
(
|
||||
typename IDLListType::iterator iter = this->begin();
|
||||
iter != this->end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
this->hashedTs_.insert((*iter).keyword(), &(*iter));
|
||||
}
|
||||
this->addEntries();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "DictionaryBaseIO.C"
|
||||
|
||||
@ -29,12 +29,12 @@ Description
|
||||
Base dictionary class templated on both the form of doubly-linked list
|
||||
it uses as well as the type it holds.
|
||||
|
||||
The double templating allows for the instantiation of forms with and
|
||||
The double templating allows for the instantiation of forms with or
|
||||
without storage management.
|
||||
|
||||
Note
|
||||
The IDLListType parameter should itself be a template but this confused
|
||||
gcc 2.95.2 so it has to be instantiated for T when an intantiation of
|
||||
gcc 2.95.2 so it has to be instantiated for T when an instantiation of
|
||||
DictionaryBase is requested
|
||||
|
||||
See Also
|
||||
@ -67,7 +67,7 @@ Ostream& operator<<(Ostream&, const DictionaryBase<IDLListType, T>&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DictionaryBase Declaration
|
||||
Class DictionaryBase Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class IDLListType, class T>
|
||||
@ -77,7 +77,7 @@ class DictionaryBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- HashTable of the enries held on the DL-list for quick lookup
|
||||
//- HashTable of the entries held on the IDLListType for quick lookup
|
||||
HashTable<T*> hashedTs_;
|
||||
|
||||
|
||||
@ -99,10 +99,10 @@ public:
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
DictionaryBase(Istream& is, const INew& inewt);
|
||||
DictionaryBase(Istream&, const INew&);
|
||||
|
||||
//- Construct from Istream
|
||||
DictionaryBase(Istream& is);
|
||||
//- Construct from Istream using default Istream constructor class
|
||||
DictionaryBase(Istream&);
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -110,7 +110,13 @@ public:
|
||||
// Search and lookup
|
||||
|
||||
//- Search DictionaryBase for given keyword
|
||||
bool found(const word& keyword) const;
|
||||
bool found(const word&) const;
|
||||
|
||||
//- Find and return an entry if present, otherwise return NULL
|
||||
const T* lookupPtr(const word&) const;
|
||||
|
||||
//- Find and return an entry if present, otherwise return NULL
|
||||
T* lookupPtr(const word&);
|
||||
|
||||
//- Find and return entry
|
||||
const T* lookup(const word&) const;
|
||||
@ -125,17 +131,21 @@ public:
|
||||
// Editing
|
||||
|
||||
//- Add at head of dictionary
|
||||
void insert(const word& keyword, T*);
|
||||
void insert(const word&, T*);
|
||||
|
||||
//- Add at tail of dictionary
|
||||
void append(const word& keyword, T*);
|
||||
void append(const word&, T*);
|
||||
|
||||
//- Remove and return entry specified by keyword
|
||||
T* remove(const word& keyword);
|
||||
//- Remove and return entry specified by keyword.
|
||||
// Return NULL if the keyword was not found.
|
||||
T* remove(const word&);
|
||||
|
||||
//- Clear the dictionary
|
||||
void clear();
|
||||
|
||||
//- Transfer the contents of the argument into this DictionaryBase
|
||||
// and annull the argument.
|
||||
void transfer(DictionaryBase<IDLListType, T>&);
|
||||
|
||||
// Member operators
|
||||
|
||||
|
||||
@ -30,15 +30,13 @@ Description
|
||||
#include "DictionaryBase.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
|
||||
|
||||
template<class IDLListType, class T>
|
||||
Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const DictionaryBase<IDLListType, T>& dict)
|
||||
{
|
||||
for
|
||||
(
|
||||
@ -53,7 +51,7 @@ Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
|
||||
if (!os.good())
|
||||
{
|
||||
Info
|
||||
<< "operator<<(Ostream& os, const DictionaryBase&) : "
|
||||
<< "operator<<(Ostream&, const DictionaryBase&) : "
|
||||
<< "Can't write entry for DictionaryBase"
|
||||
<< endl;
|
||||
|
||||
@ -67,6 +65,4 @@ Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,20 +26,15 @@ License
|
||||
|
||||
#include "PtrDictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
PtrDictionary<T>::PtrDictionary()
|
||||
Foam::PtrDictionary<T>::PtrDictionary()
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
|
||||
Foam::PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(dict)
|
||||
{}
|
||||
@ -47,14 +42,14 @@ PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
|
||||
|
||||
template<class T>
|
||||
template<class INew>
|
||||
PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
|
||||
Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(is, iNew)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
PtrDictionary<T>::PtrDictionary(Istream& is)
|
||||
Foam::PtrDictionary<T>::PtrDictionary(Istream& is)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(is)
|
||||
{}
|
||||
@ -62,6 +57,4 @@ PtrDictionary<T>::PtrDictionary(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,8 +27,10 @@ Class
|
||||
|
||||
Description
|
||||
Template dictionary class which does not manages the storage
|
||||
associated with it. It is derived from DictionaryBase instantiated on
|
||||
a non-memory managed form of intrusive doubly-linked list of T.
|
||||
associated with it.
|
||||
|
||||
It is derived from DictionaryBase instantiated on a non-memory managed
|
||||
form of intrusive doubly-linked list of T.
|
||||
|
||||
SourceFiles
|
||||
PtrDictionary.C
|
||||
@ -47,7 +49,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class PtrDictionary Declaration
|
||||
Class PtrDictionary Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
|
||||
@ -26,22 +26,15 @@ License
|
||||
|
||||
#include "UDictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Null constructor
|
||||
template<class T>
|
||||
UDictionary<T>::UDictionary()
|
||||
Foam::UDictionary<T>::UDictionary()
|
||||
{}
|
||||
|
||||
|
||||
// Copy constructor
|
||||
template<class T>
|
||||
UDictionary<T>::UDictionary(const UDictionary& dict)
|
||||
Foam::UDictionary<T>::UDictionary(const UDictionary& dict)
|
||||
:
|
||||
DictionaryBase<UIDLList<T>, T>(dict)
|
||||
{}
|
||||
@ -49,6 +42,4 @@ UDictionary<T>::UDictionary(const UDictionary& dict)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -49,7 +49,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class UDictionary Declaration
|
||||
Class UDictionary Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
|
||||
@ -26,22 +26,15 @@ License
|
||||
|
||||
#include "UPtrDictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Null constructor
|
||||
template<class T>
|
||||
UPtrDictionary<T>::UPtrDictionary()
|
||||
Foam::UPtrDictionary<T>::UPtrDictionary()
|
||||
{}
|
||||
|
||||
|
||||
// Copy constructor
|
||||
template<class T>
|
||||
UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
|
||||
Foam::UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(dict)
|
||||
{}
|
||||
@ -49,6 +42,4 @@ UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,8 +27,10 @@ Class
|
||||
|
||||
Description
|
||||
Template dictionary class which does not manages the storage
|
||||
associated with it. It is derived from DictionaryBase instantiated on
|
||||
a non-memory managed form of intrusive doubly-linked list of \<T\>.
|
||||
associated with it.
|
||||
|
||||
It is derived from DictionaryBase instantiated on a non-memory managed
|
||||
form of intrusive doubly-linked list of \<T\>.
|
||||
|
||||
SourceFiles
|
||||
UPtrDictionary.C
|
||||
@ -47,7 +49,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class UPtrDictionary Declaration
|
||||
Class UPtrDictionary Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
|
||||
@ -456,6 +456,14 @@ void HashTable<T, Key, Hash>::clear()
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
void HashTable<T, Key, Hash>::clearStorage()
|
||||
{
|
||||
clear();
|
||||
resize(0);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
void HashTable<T, Key, Hash>::transfer(HashTable<T, Key, Hash>& ht)
|
||||
{
|
||||
|
||||
@ -54,6 +54,7 @@ template<class T>
|
||||
class List;
|
||||
|
||||
template<class T, class Key, class Hash> class HashTable;
|
||||
template<class T, class Key, class Hash> class HashPtrTable;
|
||||
|
||||
template<class T, class Key, class Hash> Istream& operator>>
|
||||
(
|
||||
@ -102,7 +103,7 @@ class HashTable
|
||||
//- Construct given key, next pointer and object
|
||||
inline hashedEntry
|
||||
(
|
||||
const Key& key,
|
||||
const Key&,
|
||||
hashedEntry* next,
|
||||
const T& newEntry
|
||||
);
|
||||
@ -127,7 +128,7 @@ class HashTable
|
||||
// Private Member Functions
|
||||
|
||||
//- Assign a new hashedEntry to a possibly already existing key
|
||||
bool set(const Key& key, const T& newElmt, bool protect);
|
||||
bool set(const Key&, const T& newElmt, bool protect);
|
||||
|
||||
public:
|
||||
|
||||
@ -173,15 +174,15 @@ public:
|
||||
inline label size() const;
|
||||
|
||||
//- Return true if hashedEntry is found in table
|
||||
bool found(const Key& key) const;
|
||||
bool found(const Key&) const;
|
||||
|
||||
//- Find and return an iterator set at the hashedEntry
|
||||
// If not found iterator = end()
|
||||
iterator find(const Key& key);
|
||||
iterator find(const Key&);
|
||||
|
||||
//- Find and return an const_iterator set at the hashedEntry
|
||||
// If not found iterator = end()
|
||||
const_iterator find(const Key& key) const;
|
||||
const_iterator find(const Key&) const;
|
||||
|
||||
//- Return the table of contents
|
||||
List<Key> toc() const;
|
||||
@ -190,16 +191,16 @@ public:
|
||||
// Edit
|
||||
|
||||
//- Insert a new hashedEntry
|
||||
inline bool insert(const Key& key, const T& newElmt);
|
||||
inline bool insert(const Key&, const T& newElmt);
|
||||
|
||||
//- Assign a new hashedEntry, overwriting existing entries
|
||||
inline bool set(const Key& key, const T& newElmt);
|
||||
inline bool set(const Key&, const T& newElmt);
|
||||
|
||||
//- Erase an hashedEntry specified by given iterator
|
||||
bool erase(const iterator& it);
|
||||
bool erase(const iterator&);
|
||||
|
||||
//- Erase an hashedEntry specified by given key if in table
|
||||
bool erase(const Key& key);
|
||||
bool erase(const Key&);
|
||||
|
||||
//- Resize the hash table for efficiency
|
||||
void resize(const label newSize);
|
||||
@ -207,6 +208,10 @@ public:
|
||||
//- Clear all entries from table
|
||||
void clear();
|
||||
|
||||
//- Clear the table entries and the table itself.
|
||||
// Equivalent to clear() followed by resize(0)
|
||||
void clearStorage();
|
||||
|
||||
//- Transfer the contents of the argument table into this table
|
||||
// and annull the argument table.
|
||||
void transfer(HashTable<T, Key, Hash>&);
|
||||
@ -215,14 +220,14 @@ public:
|
||||
// Member Operators
|
||||
|
||||
//- Find and return an hashedEntry
|
||||
inline T& operator[](const Key& key);
|
||||
inline T& operator[](const Key&);
|
||||
|
||||
//- Find and return an hashedEntry
|
||||
inline const T& operator[](const Key& key) const;
|
||||
inline const T& operator[](const Key&) const;
|
||||
|
||||
//- Find and return an hashedEntry and
|
||||
// if it is not present create it null.
|
||||
inline T& operator()(const Key& key);
|
||||
inline T& operator()(const Key&);
|
||||
|
||||
//- Assignment
|
||||
void operator=(const HashTable<T, Key, Hash>&);
|
||||
@ -290,13 +295,13 @@ public:
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator=(const iterator& iter);
|
||||
inline void operator=(const iterator&);
|
||||
|
||||
inline bool operator==(const iterator& iter) const;
|
||||
inline bool operator!=(const iterator& iter) const;
|
||||
inline bool operator==(const iterator&) const;
|
||||
inline bool operator!=(const iterator&) const;
|
||||
|
||||
inline bool operator==(const const_iterator& iter) const;
|
||||
inline bool operator!=(const const_iterator& iter) const;
|
||||
inline bool operator==(const const_iterator&) const;
|
||||
inline bool operator!=(const const_iterator&) const;
|
||||
|
||||
inline T& operator*();
|
||||
inline T& operator()();
|
||||
@ -352,13 +357,13 @@ public:
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator=(const const_iterator& iter);
|
||||
inline void operator=(const const_iterator&);
|
||||
|
||||
inline bool operator==(const const_iterator& iter) const;
|
||||
inline bool operator!=(const const_iterator& iter) const;
|
||||
inline bool operator==(const const_iterator&) const;
|
||||
inline bool operator!=(const const_iterator&) const;
|
||||
|
||||
inline bool operator==(const iterator& iter) const;
|
||||
inline bool operator!=(const iterator& iter) const;
|
||||
inline bool operator==(const iterator&) const;
|
||||
inline bool operator!=(const iterator&) const;
|
||||
|
||||
inline const T& operator*();
|
||||
inline const T& operator()();
|
||||
|
||||
@ -26,22 +26,17 @@ License
|
||||
|
||||
#include "ILList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
ILList<LListBase, T>::ILList(const ILList<LListBase, T>& slpl)
|
||||
Foam::ILList<LListBase, T>::ILList(const ILList<LListBase, T>& lst)
|
||||
:
|
||||
UILList<LListBase, T>()
|
||||
{
|
||||
for
|
||||
(
|
||||
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
|
||||
iter != slpl.end();
|
||||
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||
iter != lst.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
@ -53,9 +48,9 @@ ILList<LListBase, T>::ILList(const ILList<LListBase, T>& slpl)
|
||||
#ifndef __INTEL_COMPILER
|
||||
template<class LListBase, class T>
|
||||
template<class CloneArg>
|
||||
ILList<LListBase, T>::ILList
|
||||
Foam::ILList<LListBase, T>::ILList
|
||||
(
|
||||
const ILList<LListBase, T>& slpl,
|
||||
const ILList<LListBase, T>& lst,
|
||||
const CloneArg& cloneArg
|
||||
)
|
||||
:
|
||||
@ -63,8 +58,8 @@ ILList<LListBase, T>::ILList
|
||||
{
|
||||
for
|
||||
(
|
||||
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
|
||||
iter != slpl.end();
|
||||
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||
iter != lst.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
@ -77,7 +72,7 @@ ILList<LListBase, T>::ILList
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
ILList<LListBase, T>::~ILList()
|
||||
Foam::ILList<LListBase, T>::~ILList()
|
||||
{
|
||||
this->clear();
|
||||
}
|
||||
@ -85,9 +80,8 @@ ILList<LListBase, T>::~ILList()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//- Return and remove head
|
||||
template<class LListBase, class T>
|
||||
bool ILList<LListBase, T>::eraseHead()
|
||||
bool Foam::ILList<LListBase, T>::eraseHead()
|
||||
{
|
||||
T* tPtr;
|
||||
if ((tPtr = this->removeHead()))
|
||||
@ -101,9 +95,8 @@ bool ILList<LListBase, T>::eraseHead()
|
||||
}
|
||||
}
|
||||
|
||||
//- Return and remove element
|
||||
template<class LListBase, class T>
|
||||
bool ILList<LListBase, T>::erase(T* p)
|
||||
bool Foam::ILList<LListBase, T>::erase(T* p)
|
||||
{
|
||||
T* tPtr;
|
||||
if ((tPtr = remove(p)))
|
||||
@ -119,7 +112,7 @@ bool ILList<LListBase, T>::erase(T* p)
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
void ILList<LListBase, T>::clear()
|
||||
void Foam::ILList<LListBase, T>::clear()
|
||||
{
|
||||
label oldSize = this->size();
|
||||
for (label i=0; i<oldSize; i++)
|
||||
@ -131,17 +124,25 @@ void ILList<LListBase, T>::clear()
|
||||
}
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
void Foam::ILList<LListBase, T>::transfer(ILList<LListBase, T>& lst)
|
||||
{
|
||||
clear();
|
||||
LListBase::transfer(lst);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
void ILList<LListBase, T>::operator=(const ILList<LListBase, T>& slpl)
|
||||
void Foam::ILList<LListBase, T>::operator=(const ILList<LListBase, T>& lst)
|
||||
{
|
||||
this->clear();
|
||||
|
||||
for
|
||||
(
|
||||
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
|
||||
iter != slpl.end();
|
||||
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||
iter != lst.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
@ -149,11 +150,6 @@ void ILList<LListBase, T>::operator=(const ILList<LListBase, T>& slpl)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "ILListIO.C"
|
||||
|
||||
@ -71,7 +71,7 @@ class ILList
|
||||
|
||||
//- Read from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
void read(Istream&, const INew& inewt);
|
||||
void read(Istream&, const INew&);
|
||||
|
||||
|
||||
public:
|
||||
@ -96,7 +96,7 @@ public:
|
||||
|
||||
//- Copy constructor with additional argument for clone
|
||||
template<class CloneArg>
|
||||
ILList(const ILList<LListBase, T>& slpl, const CloneArg& cloneArg)
|
||||
ILList(const ILList<LListBase, T>& lst, const CloneArg& cloneArg)
|
||||
#ifdef __INTEL_COMPILER
|
||||
:
|
||||
UILList<LListBase, T>()
|
||||
@ -104,8 +104,8 @@ public:
|
||||
for
|
||||
(
|
||||
typename UILList<LListBase, T>::const_iterator iter =
|
||||
slpl.begin();
|
||||
iter != slpl.end();
|
||||
lst.begin();
|
||||
iter != lst.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
@ -118,7 +118,7 @@ public:
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
ILList(Istream&, const INew& inewt);
|
||||
ILList(Istream&, const INew&);
|
||||
|
||||
|
||||
// Destructor
|
||||
@ -139,6 +139,10 @@ public:
|
||||
//- Clear the contents of the list
|
||||
void clear();
|
||||
|
||||
//- Transfer the contents of the argument into this List
|
||||
// and annull the argument list.
|
||||
void transfer(ILList<LListBase, T>&);
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
|
||||
@ -30,24 +30,19 @@ Description
|
||||
#include "Istream.H"
|
||||
#include "INew.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
template<class INew>
|
||||
void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
|
||||
{
|
||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
||||
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||
|
||||
token firstToken(is);
|
||||
|
||||
is.fatalCheck
|
||||
(
|
||||
"operator>>(Istream& is, ILList<LListBase, T>& L) : reading first token"
|
||||
"operator>>(Istream&, ILList<LListBase, T>&) : reading first token"
|
||||
);
|
||||
|
||||
if (firstToken.isLabel())
|
||||
@ -63,26 +58,26 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
{
|
||||
for (label i=0; i<s; i++)
|
||||
{
|
||||
append(inewt(is).ptr());
|
||||
|
||||
append(iNew(is).ptr());
|
||||
|
||||
is.fatalCheck
|
||||
(
|
||||
"operator>>(Istream& is, ILList<LListBase, T>& L) : "
|
||||
"operator>>(Istream&, ILList<LListBase, T>&) : "
|
||||
"reading entry"
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
T* tPtr = inewt(is).ptr();
|
||||
T* tPtr = iNew(is).ptr();
|
||||
append(tPtr);
|
||||
|
||||
is.fatalCheck
|
||||
(
|
||||
"operator>>(Istream& is, ILList<LListBase, T>& L) : "
|
||||
"operator>>(Istream&, ILList<LListBase, T>&) : "
|
||||
"reading entry"
|
||||
);
|
||||
|
||||
|
||||
for (label i=1; i<s; i++)
|
||||
{
|
||||
append(new T(*tPtr));
|
||||
@ -99,14 +94,14 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"operator>>(Istream& is, ILList<LListBase, T>& L)",
|
||||
"operator>>(Istream&, ILList<LListBase, T>&)",
|
||||
is
|
||||
) << "incorrect first token, '(', found " << firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
token lastToken(is);
|
||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
||||
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||
|
||||
while
|
||||
(
|
||||
@ -117,36 +112,34 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
)
|
||||
{
|
||||
is.putBack(lastToken);
|
||||
append(inewt(is).ptr());
|
||||
append(iNew(is).ptr());
|
||||
|
||||
is >> lastToken;
|
||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
||||
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn("operator>>(Istream& is, ILList<LListBase, T>& L)", is)
|
||||
FatalIOErrorIn("operator>>(Istream&, ILList<LListBase, T>&)", is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
||||
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||
}
|
||||
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class LListBase, class T>
|
||||
template<class INew>
|
||||
ILList<LListBase, T>::ILList(Istream& is, const INew& inewt)
|
||||
Foam::ILList<LListBase, T>::ILList(Istream& is, const INew& iNew)
|
||||
{
|
||||
read(is, inewt);
|
||||
read(is, iNew);
|
||||
}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
template<class LListBase, class T>
|
||||
ILList<LListBase, T>::ILList(Istream& is)
|
||||
Foam::ILList<LListBase, T>::ILList(Istream& is)
|
||||
{
|
||||
read(is, INew<T>());
|
||||
}
|
||||
@ -155,7 +148,7 @@ ILList<LListBase, T>::ILList(Istream& is)
|
||||
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
Istream& operator>>(Istream& is, ILList<LListBase, T>& L)
|
||||
Foam::Istream& Foam::operator>>(Istream& is, ILList<LListBase, T>& L)
|
||||
{
|
||||
L.clear();
|
||||
L.read(is, INew<T>());
|
||||
@ -166,6 +159,4 @@ Istream& operator>>(Istream& is, ILList<LListBase, T>& L)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,22 +27,16 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "LList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
LList<LListBase, T>::LList(const LList<LListBase, T>& slpl)
|
||||
Foam::LList<LListBase, T>::LList(const LList<LListBase, T>& lst)
|
||||
:
|
||||
LListBase()
|
||||
{
|
||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
||||
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||
{
|
||||
append(iter());
|
||||
}
|
||||
@ -50,7 +44,7 @@ LList<LListBase, T>::LList(const LList<LListBase, T>& slpl)
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
LList<LListBase, T>::~LList()
|
||||
Foam::LList<LListBase, T>::~LList()
|
||||
{
|
||||
this->clear();
|
||||
}
|
||||
@ -59,7 +53,7 @@ LList<LListBase, T>::~LList()
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
void LList<LListBase, T>::clear()
|
||||
void Foam::LList<LListBase, T>::clear()
|
||||
{
|
||||
label oldSize = this->size();
|
||||
for (label i=0; i<oldSize; i++)
|
||||
@ -71,24 +65,28 @@ void LList<LListBase, T>::clear()
|
||||
}
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
void Foam::LList<LListBase, T>::transfer(LList<LListBase, T>& lst)
|
||||
{
|
||||
clear();
|
||||
LListBase::transfer(lst);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
void LList<LListBase, T>::operator=(const LList<LListBase, T>& slpl)
|
||||
void Foam::LList<LListBase, T>::operator=(const LList<LListBase, T>& lst)
|
||||
{
|
||||
this->clear();
|
||||
|
||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
||||
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||
{
|
||||
append(iter());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "LListIO.C"
|
||||
|
||||
@ -67,7 +67,7 @@ Ostream& operator<<
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class LList Declaration
|
||||
Class LList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class LListBase, class T>
|
||||
@ -200,6 +200,9 @@ public:
|
||||
//- Delete contents of list
|
||||
void clear();
|
||||
|
||||
//- Transfer the contents of the argument into this List
|
||||
// and annull the argument list.
|
||||
void transfer(LList<LListBase, T>&);
|
||||
|
||||
// Member operators
|
||||
|
||||
|
||||
@ -30,16 +30,10 @@ Description
|
||||
#include "Istream.H"
|
||||
#include "Ostream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from Istream
|
||||
template<class LListBase, class T>
|
||||
LList<LListBase, T>::LList(Istream& is)
|
||||
Foam::LList<LListBase, T>::LList(Istream& is)
|
||||
{
|
||||
operator>>(is, *this);
|
||||
}
|
||||
@ -48,18 +42,18 @@ LList<LListBase, T>::LList(Istream& is)
|
||||
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
||||
Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
|
||||
{
|
||||
// Anull list
|
||||
L.clear();
|
||||
|
||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
||||
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
|
||||
|
||||
token firstToken(is);
|
||||
|
||||
is.fatalCheck
|
||||
(
|
||||
" operator>>(Istream& is, LList<LListBase, T>& L) : reading first token"
|
||||
" operator>>(Istream&, LList<LListBase, T>&) : reading first token"
|
||||
);
|
||||
|
||||
if (firstToken.isLabel())
|
||||
@ -101,14 +95,14 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
" operator>>(Istream& is, LList<LListBase, T>& L)",
|
||||
" operator>>(Istream&, LList<LListBase, T>&)",
|
||||
is
|
||||
) << "incorrect first token, '(', found " << firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
token lastToken(is);
|
||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
||||
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
|
||||
|
||||
while
|
||||
(
|
||||
@ -124,19 +118,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
||||
L.append(element);
|
||||
|
||||
is >> lastToken;
|
||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
||||
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn(" operator>>(Istream& is, LList<LListBase, T>& L)", is)
|
||||
FatalIOErrorIn(" operator>>(Istream&, LList<LListBase, T>&)", is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// Check state of IOstream
|
||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
||||
is.fatalCheck(" operator>>(Istream&, LList<LListBase,>&)");
|
||||
|
||||
return is;
|
||||
}
|
||||
@ -145,19 +139,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
Ostream& operator<<(Ostream& os, const LList<LListBase, T>& ll)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const LList<LListBase, T>& lst)
|
||||
{
|
||||
// Write size of LList
|
||||
os << nl << ll.size();
|
||||
// Write size
|
||||
os << nl << lst.size();
|
||||
|
||||
// Write beginning of contents
|
||||
os << nl << token::BEGIN_LIST << nl;
|
||||
|
||||
// Write LList contents
|
||||
// Write contents
|
||||
for
|
||||
(
|
||||
typename LList<LListBase, T>::const_iterator iter = ll.begin();
|
||||
iter != ll.end();
|
||||
typename LList<LListBase, T>::const_iterator iter = lst.begin();
|
||||
iter != lst.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
@ -168,14 +162,10 @@ Ostream& operator<<(Ostream& os, const LList<LListBase, T>& ll)
|
||||
os << token::END_LIST;
|
||||
|
||||
// Check state of IOstream
|
||||
os.check("Ostream& operator<<(Ostream&, const LList&)");
|
||||
os.check("Ostream& operator<<(Ostream&, const LList<LListBase, T>&)");
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,19 +26,14 @@ License
|
||||
|
||||
#include "LPtrList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& slpl)
|
||||
Foam::LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& lst)
|
||||
:
|
||||
LList<LListBase, T*>()
|
||||
{
|
||||
for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
||||
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||
{
|
||||
append(iter().clone().ptr());
|
||||
}
|
||||
@ -48,7 +43,7 @@ LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& slpl)
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
LPtrList<LListBase, T>::~LPtrList()
|
||||
Foam::LPtrList<LListBase, T>::~LPtrList()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@ -56,9 +51,8 @@ LPtrList<LListBase, T>::~LPtrList()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//- Return and remove head
|
||||
template<class LListBase, class T>
|
||||
bool LPtrList<LListBase, T>::eraseHead()
|
||||
bool Foam::LPtrList<LListBase, T>::eraseHead()
|
||||
{
|
||||
T* tPtr;
|
||||
if ((tPtr = this->removeHead()))
|
||||
@ -74,7 +68,7 @@ bool LPtrList<LListBase, T>::eraseHead()
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
void LPtrList<LListBase, T>::clear()
|
||||
void Foam::LPtrList<LListBase, T>::clear()
|
||||
{
|
||||
label oldSize = this->size();
|
||||
for (label i=0; i<oldSize; i++)
|
||||
@ -86,24 +80,28 @@ void LPtrList<LListBase, T>::clear()
|
||||
}
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
void Foam::LPtrList<LListBase, T>::transfer(LPtrList<LListBase, T>& lst)
|
||||
{
|
||||
clear();
|
||||
LList<LListBase, T*>::transfer(lst);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
void LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& slpl)
|
||||
void Foam::LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& lst)
|
||||
{
|
||||
clear();
|
||||
|
||||
for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
||||
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||
{
|
||||
append(iter().clone().ptr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "LPtrListIO.C"
|
||||
|
||||
@ -149,12 +149,16 @@ public:
|
||||
|
||||
// Edit
|
||||
|
||||
//- Remove the head element specified from the list and delete it
|
||||
//- Remove the head element from the list and delete the pointer
|
||||
bool eraseHead();
|
||||
|
||||
//- Remove the specified element from the list and delete it
|
||||
//- Clear the contents of the list
|
||||
void clear();
|
||||
|
||||
//- Transfer the contents of the argument into this List
|
||||
// and annull the argument list.
|
||||
void transfer(LPtrList<LListBase, T>&);
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
|
||||
@ -29,16 +29,11 @@ License
|
||||
#include "Ostream.H"
|
||||
#include "INew.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
template<class INew>
|
||||
void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
|
||||
{
|
||||
is.fatalCheck
|
||||
(
|
||||
@ -66,8 +61,8 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
{
|
||||
for (label i=0; i<s; i++)
|
||||
{
|
||||
append(inewt(is).ptr());
|
||||
|
||||
append(iNew(is).ptr());
|
||||
|
||||
is.fatalCheck
|
||||
(
|
||||
"LPtrList<LListBase, T>::read(Istream&, const INew&) : "
|
||||
@ -77,7 +72,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
}
|
||||
else
|
||||
{
|
||||
T* tPtr = inewt(is).ptr();
|
||||
T* tPtr = iNew(is).ptr();
|
||||
append(tPtr);
|
||||
|
||||
is.fatalCheck
|
||||
@ -85,7 +80,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
"LPtrList<LListBase, T>::read(Istream&, const INew&) : "
|
||||
"reading entry"
|
||||
);
|
||||
|
||||
|
||||
for (label i=1; i<s; i++)
|
||||
{
|
||||
append(tPtr->clone().ptr());
|
||||
@ -120,7 +115,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
)
|
||||
{
|
||||
is.putBack(lastToken);
|
||||
append(inewt(is).ptr());
|
||||
append(iNew(is).ptr());
|
||||
|
||||
is >> lastToken;
|
||||
is.fatalCheck
|
||||
@ -148,14 +143,14 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
||||
|
||||
template<class LListBase, class T>
|
||||
template<class INew>
|
||||
LPtrList<LListBase, T>::LPtrList(Istream& is, const INew& inewt)
|
||||
Foam::LPtrList<LListBase, T>::LPtrList(Istream& is, const INew& iNew)
|
||||
{
|
||||
read(is, inewt);
|
||||
read(is, iNew);
|
||||
}
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
LPtrList<LListBase, T>::LPtrList(Istream& is)
|
||||
Foam::LPtrList<LListBase, T>::LPtrList(Istream& is)
|
||||
{
|
||||
read(is, INew<T>());
|
||||
}
|
||||
@ -164,11 +159,10 @@ LPtrList<LListBase, T>::LPtrList(Istream& is)
|
||||
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
Istream& operator>>(Istream& is, LPtrList<LListBase, T>& L)
|
||||
Foam::Istream& Foam::operator>>(Istream& is, LPtrList<LListBase, T>& L)
|
||||
{
|
||||
// Anull list
|
||||
L.clear();
|
||||
|
||||
L.read(is, INew<T>());
|
||||
|
||||
return is;
|
||||
}
|
||||
@ -177,19 +171,19 @@ Istream& operator>>(Istream& is, LPtrList<LListBase, T>& L)
|
||||
// * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
Ostream& operator<<(Ostream& os, const LPtrList<LListBase, T>& slpl)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const LPtrList<LListBase, T>& lst)
|
||||
{
|
||||
// Write size of LPtrList
|
||||
os << nl << slpl.size();
|
||||
// Write size
|
||||
os << nl << lst.size();
|
||||
|
||||
// Write beginning of contents
|
||||
os << nl << token::BEGIN_LIST << nl;
|
||||
|
||||
// Write LPtrList contents
|
||||
// Write contents
|
||||
for
|
||||
(
|
||||
typename LPtrList<LListBase, T>::const_iterator iter = slpl.begin();
|
||||
iter != slpl.end();
|
||||
typename LPtrList<LListBase, T>::const_iterator iter = lst.begin();
|
||||
iter != lst.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
@ -200,14 +194,9 @@ Ostream& operator<<(Ostream& os, const LPtrList<LListBase, T>& slpl)
|
||||
os << token::END_LIST;
|
||||
|
||||
// Check state of IOstream
|
||||
os.check("Ostream& operator<<(Ostream&, const LPtrList&)");
|
||||
os.check("Ostream& operator<<(Ostream&, const LPtrList<LListBase, T>&)");
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -28,17 +28,12 @@ Description
|
||||
|
||||
#include "UILList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
UILList<LListBase, T>::UILList(const UILList<LListBase, T>& slpl)
|
||||
Foam::UILList<LListBase, T>::UILList(const UILList<LListBase, T>& lst)
|
||||
{
|
||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
||||
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||
{
|
||||
append(&iter());
|
||||
}
|
||||
@ -48,22 +43,24 @@ UILList<LListBase, T>::UILList(const UILList<LListBase, T>& slpl)
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
void UILList<LListBase, T>::operator=(const UILList<LListBase, T>& slpl)
|
||||
void Foam::UILList<LListBase, T>::operator=(const UILList<LListBase, T>& rhs)
|
||||
{
|
||||
LListBase::clear();
|
||||
|
||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
||||
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
|
||||
{
|
||||
append(&iter());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Comparison for equality
|
||||
template<class LListBase, class T>
|
||||
bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
|
||||
bool Foam::UILList<LListBase, T>::operator==
|
||||
(
|
||||
const UILList<LListBase, T>& rhs
|
||||
) const
|
||||
{
|
||||
if (this->size() != slpl.size())
|
||||
if (this->size() != rhs.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -71,7 +68,7 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
|
||||
bool equal = true;
|
||||
|
||||
const_iterator iter1 = this->begin();
|
||||
const_iterator iter2 = slpl.begin();
|
||||
const_iterator iter2 = rhs.begin();
|
||||
|
||||
for (; iter1 != this->end(); ++iter1, ++iter2)
|
||||
{
|
||||
@ -84,16 +81,15 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
|
||||
|
||||
// Comparison for inequality
|
||||
template<class LListBase, class T>
|
||||
bool UILList<LListBase, T>::operator!=(const UILList<LListBase, T>& slpl) const
|
||||
bool Foam::UILList<LListBase, T>::operator!=
|
||||
(
|
||||
const UILList<LListBase, T>& rhs
|
||||
) const
|
||||
{
|
||||
return !operator==(slpl);
|
||||
return !operator==(rhs);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "UILListIO.C"
|
||||
|
||||
@ -245,7 +245,7 @@ public:
|
||||
|
||||
const T& operator*()
|
||||
{
|
||||
return
|
||||
return
|
||||
static_cast<const T&>
|
||||
(LListBase_const_iterator::operator*());
|
||||
}
|
||||
@ -266,7 +266,7 @@ public:
|
||||
// STL member operators
|
||||
|
||||
//- Equality operation on ULists of the same type.
|
||||
// Returns true when the ULists are elementwise equal
|
||||
// Returns true when the ULists are element-wise equal
|
||||
// (using UList::value_type::operator==). Takes linear time.
|
||||
bool operator==(const UILList<LListBase, T>&) const;
|
||||
|
||||
|
||||
@ -30,27 +30,22 @@ Description
|
||||
#include "Ostream.H"
|
||||
#include "token.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class LListBase, class T>
|
||||
Ostream& operator<<(Ostream& os, const UILList<LListBase, T>& ill)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const UILList<LListBase, T>& lst)
|
||||
{
|
||||
// Write size of UILList
|
||||
os << nl << ill.size();
|
||||
// Write size
|
||||
os << nl << lst.size();
|
||||
|
||||
// Write beginning of contents
|
||||
os << nl << token::BEGIN_LIST << nl;
|
||||
|
||||
// Write UILList contents
|
||||
// Write contents
|
||||
for
|
||||
(
|
||||
typename UILList<LListBase, T>::const_iterator iter = ill.begin();
|
||||
iter != ill.end();
|
||||
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||
iter != lst.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
@ -61,14 +56,9 @@ Ostream& operator<<(Ostream& os, const UILList<LListBase, T>& ill)
|
||||
os << token::END_LIST;
|
||||
|
||||
// Check state of IOstream
|
||||
os.check("Ostream& operator<<(Ostream&, const UILList&)");
|
||||
os.check("Ostream& operator<<(Ostream&, const UILList<LListBase, T>&)");
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -32,17 +32,12 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
DLListBase::iterator DLListBase::endIter
|
||||
Foam::DLListBase::iterator Foam::DLListBase::endIter
|
||||
(
|
||||
const_cast<DLListBase&>(static_cast<const DLListBase&>(DLListBase()))
|
||||
);
|
||||
|
||||
DLListBase::const_iterator DLListBase::endConstIter
|
||||
Foam::DLListBase::const_iterator Foam::DLListBase::endConstIter
|
||||
(
|
||||
static_cast<const DLListBase&>(DLListBase()),
|
||||
reinterpret_cast<const link*>(NULL)
|
||||
@ -51,7 +46,7 @@ DLListBase::const_iterator DLListBase::endConstIter
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void DLListBase::insert(DLListBase::link* a)
|
||||
void Foam::DLListBase::insert(DLListBase::link* a)
|
||||
{
|
||||
nElmts_++;
|
||||
|
||||
@ -71,7 +66,7 @@ void DLListBase::insert(DLListBase::link* a)
|
||||
}
|
||||
|
||||
|
||||
void DLListBase::append(DLListBase::link* a)
|
||||
void Foam::DLListBase::append(DLListBase::link* a)
|
||||
{
|
||||
nElmts_++;
|
||||
|
||||
@ -91,7 +86,7 @@ void DLListBase::append(DLListBase::link* a)
|
||||
}
|
||||
|
||||
|
||||
bool DLListBase::swapUp(DLListBase::link* a)
|
||||
bool Foam::DLListBase::swapUp(DLListBase::link* a)
|
||||
{
|
||||
if (first_ != a)
|
||||
{
|
||||
@ -132,7 +127,7 @@ bool DLListBase::swapUp(DLListBase::link* a)
|
||||
}
|
||||
|
||||
|
||||
bool DLListBase::swapDown(DLListBase::link* a)
|
||||
bool Foam::DLListBase::swapDown(DLListBase::link* a)
|
||||
{
|
||||
if (last_ != a)
|
||||
{
|
||||
@ -173,7 +168,7 @@ bool DLListBase::swapDown(DLListBase::link* a)
|
||||
}
|
||||
|
||||
|
||||
DLListBase::link* DLListBase::removeHead()
|
||||
Foam::DLListBase::link* Foam::DLListBase::removeHead()
|
||||
{
|
||||
nElmts_--;
|
||||
|
||||
@ -197,7 +192,7 @@ DLListBase::link* DLListBase::removeHead()
|
||||
}
|
||||
|
||||
|
||||
DLListBase::link* DLListBase::remove(DLListBase::link* l)
|
||||
Foam::DLListBase::link* Foam::DLListBase::remove(DLListBase::link* l)
|
||||
{
|
||||
nElmts_--;
|
||||
|
||||
@ -229,7 +224,7 @@ DLListBase::link* DLListBase::remove(DLListBase::link* l)
|
||||
}
|
||||
|
||||
|
||||
DLListBase::link* DLListBase::replace
|
||||
Foam::DLListBase::link* Foam::DLListBase::replace
|
||||
(
|
||||
DLListBase::link* oldLink,
|
||||
DLListBase::link* newLink
|
||||
@ -266,8 +261,4 @@ DLListBase::link* DLListBase::replace
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -167,6 +167,9 @@ public:
|
||||
//- Clear the list
|
||||
inline void clear();
|
||||
|
||||
//- Transfer the contents of the argument into this List
|
||||
// and annull the argument list.
|
||||
inline void transfer(DLListBase&);
|
||||
|
||||
// STL iterator
|
||||
|
||||
|
||||
@ -26,21 +26,16 @@ License
|
||||
|
||||
#include "error.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
inline DLListBase::link::link()
|
||||
inline Foam::DLListBase::link::link()
|
||||
:
|
||||
prev_(0),
|
||||
next_(0)
|
||||
{}
|
||||
|
||||
|
||||
inline DLListBase::DLListBase()
|
||||
inline Foam::DLListBase::DLListBase()
|
||||
:
|
||||
first_(0),
|
||||
last_(0),
|
||||
@ -48,7 +43,7 @@ inline DLListBase::DLListBase()
|
||||
{}
|
||||
|
||||
|
||||
inline DLListBase::DLListBase(link* a)
|
||||
inline Foam::DLListBase::DLListBase(link* a)
|
||||
:
|
||||
first_(a),
|
||||
last_(a),
|
||||
@ -61,32 +56,33 @@ inline DLListBase::DLListBase(link* a)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
inline DLListBase::~DLListBase()
|
||||
inline Foam::DLListBase::~DLListBase()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline bool DLListBase::link::registered() const
|
||||
inline bool Foam::DLListBase::link::registered() const
|
||||
{
|
||||
return prev_ != 0 && next_ != 0;
|
||||
}
|
||||
|
||||
|
||||
inline void DLListBase::link::deregister()
|
||||
inline void Foam::DLListBase::link::deregister()
|
||||
{
|
||||
prev_ = 0;
|
||||
next_ = 0;
|
||||
}
|
||||
|
||||
|
||||
inline label DLListBase::size() const
|
||||
inline Foam::label Foam::DLListBase::size() const
|
||||
{
|
||||
return nElmts_;
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::link* DLListBase::first()
|
||||
inline Foam::DLListBase::link*
|
||||
Foam::DLListBase::first()
|
||||
{
|
||||
if (!nElmts_)
|
||||
{
|
||||
@ -98,7 +94,8 @@ inline DLListBase::link* DLListBase::first()
|
||||
}
|
||||
|
||||
|
||||
inline const DLListBase::link* DLListBase::first() const
|
||||
inline const Foam::DLListBase::link*
|
||||
Foam::DLListBase::first() const
|
||||
{
|
||||
if (!nElmts_)
|
||||
{
|
||||
@ -110,7 +107,8 @@ inline const DLListBase::link* DLListBase::first() const
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::link* DLListBase::last()
|
||||
inline Foam::DLListBase::link*
|
||||
Foam::DLListBase::last()
|
||||
{
|
||||
if (!nElmts_)
|
||||
{
|
||||
@ -122,7 +120,8 @@ inline DLListBase::link* DLListBase::last()
|
||||
}
|
||||
|
||||
|
||||
inline const DLListBase::link* DLListBase::last() const
|
||||
inline const Foam::DLListBase::link*
|
||||
Foam::DLListBase::last() const
|
||||
{
|
||||
if (!nElmts_)
|
||||
{
|
||||
@ -134,21 +133,36 @@ inline const DLListBase::link* DLListBase::last() const
|
||||
}
|
||||
|
||||
|
||||
inline void DLListBase::clear()
|
||||
inline void Foam::DLListBase::clear()
|
||||
{
|
||||
nElmts_ = 0;
|
||||
first_ = 0;
|
||||
last_ = 0;
|
||||
last_ = 0;
|
||||
nElmts_ = 0;
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::link* DLListBase::remove(DLListBase::iterator& it)
|
||||
inline void Foam::DLListBase::transfer(DLListBase& lst)
|
||||
{
|
||||
first_ = lst.first_;
|
||||
last_ = lst.last_;
|
||||
nElmts_ = lst.nElmts_;
|
||||
|
||||
lst.clear();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::DLListBase::link*
|
||||
Foam::DLListBase::remove
|
||||
(
|
||||
DLListBase::iterator& it
|
||||
)
|
||||
{
|
||||
return remove(it.curElmt_);
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::link* DLListBase::replace
|
||||
inline Foam::DLListBase::link*
|
||||
Foam::DLListBase::replace
|
||||
(
|
||||
DLListBase::iterator& oldIter,
|
||||
DLListBase::link* newLink
|
||||
@ -160,7 +174,7 @@ inline DLListBase::link* DLListBase::replace
|
||||
|
||||
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
||||
|
||||
inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)
|
||||
inline Foam::DLListBase::iterator::iterator(DLListBase& s, link* elmt)
|
||||
:
|
||||
curList_(s),
|
||||
curElmt_(elmt),
|
||||
@ -168,7 +182,7 @@ inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)
|
||||
{}
|
||||
|
||||
|
||||
inline DLListBase::iterator::iterator(DLListBase& s)
|
||||
inline Foam::DLListBase::iterator::iterator(DLListBase& s)
|
||||
:
|
||||
curList_(s),
|
||||
curElmt_(NULL),
|
||||
@ -176,32 +190,34 @@ inline DLListBase::iterator::iterator(DLListBase& s)
|
||||
{}
|
||||
|
||||
|
||||
inline void DLListBase::iterator::operator=(const iterator& iter)
|
||||
inline void Foam::DLListBase::iterator::operator=(const iterator& iter)
|
||||
{
|
||||
curElmt_ = iter.curElmt_;
|
||||
curLink_ = iter.curLink_;
|
||||
}
|
||||
|
||||
|
||||
inline bool DLListBase::iterator::operator==(const iterator& iter) const
|
||||
inline bool Foam::DLListBase::iterator::operator==(const iterator& iter) const
|
||||
{
|
||||
return curElmt_ == iter.curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline bool DLListBase::iterator::operator!=(const iterator& iter) const
|
||||
inline bool Foam::DLListBase::iterator::operator!=(const iterator& iter) const
|
||||
{
|
||||
return curElmt_ != iter.curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::link& DLListBase::iterator::operator*()
|
||||
inline Foam::DLListBase::link&
|
||||
Foam::DLListBase::iterator::operator*()
|
||||
{
|
||||
return *curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::iterator& DLListBase::iterator::operator++()
|
||||
inline Foam::DLListBase::iterator&
|
||||
Foam::DLListBase::iterator::operator++()
|
||||
{
|
||||
// Check if the curElmt_ is the last element (if it points to itself)
|
||||
// or if the list is empty because the last element may have been removed
|
||||
@ -219,7 +235,8 @@ inline DLListBase::iterator& DLListBase::iterator::operator++()
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::iterator DLListBase::iterator::operator++(int)
|
||||
inline Foam::DLListBase::iterator
|
||||
Foam::DLListBase::iterator::operator++(int)
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++*this;
|
||||
@ -227,7 +244,8 @@ inline DLListBase::iterator DLListBase::iterator::operator++(int)
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::iterator DLListBase::begin()
|
||||
inline Foam::DLListBase::iterator
|
||||
Foam::DLListBase::begin()
|
||||
{
|
||||
if (size())
|
||||
{
|
||||
@ -240,7 +258,7 @@ inline DLListBase::iterator DLListBase::begin()
|
||||
}
|
||||
|
||||
|
||||
inline const DLListBase::iterator& DLListBase::end()
|
||||
inline const Foam::DLListBase::iterator& Foam::DLListBase::end()
|
||||
{
|
||||
return endIter;
|
||||
}
|
||||
@ -248,7 +266,7 @@ inline const DLListBase::iterator& DLListBase::end()
|
||||
|
||||
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
||||
|
||||
inline DLListBase::const_iterator::const_iterator
|
||||
inline Foam::DLListBase::const_iterator::const_iterator
|
||||
(
|
||||
const DLListBase& s,
|
||||
const link* elmt
|
||||
@ -259,20 +277,23 @@ inline DLListBase::const_iterator::const_iterator
|
||||
{}
|
||||
|
||||
|
||||
inline DLListBase::const_iterator::const_iterator(const iterator& iter)
|
||||
inline Foam::DLListBase::const_iterator::const_iterator(const iterator& iter)
|
||||
:
|
||||
curList_(iter.curList_),
|
||||
curElmt_(iter.curElmt_)
|
||||
{}
|
||||
|
||||
|
||||
inline void DLListBase::const_iterator::operator=(const const_iterator& iter)
|
||||
inline void Foam::DLListBase::const_iterator::operator=
|
||||
(
|
||||
const const_iterator& iter
|
||||
)
|
||||
{
|
||||
curElmt_ = iter.curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline bool DLListBase::const_iterator::operator==
|
||||
inline bool Foam::DLListBase::const_iterator::operator==
|
||||
(
|
||||
const const_iterator& iter
|
||||
) const
|
||||
@ -281,7 +302,7 @@ inline bool DLListBase::const_iterator::operator==
|
||||
}
|
||||
|
||||
|
||||
inline bool DLListBase::const_iterator::operator!=
|
||||
inline bool Foam::DLListBase::const_iterator::operator!=
|
||||
(
|
||||
const const_iterator& iter
|
||||
) const
|
||||
@ -290,13 +311,15 @@ inline bool DLListBase::const_iterator::operator!=
|
||||
}
|
||||
|
||||
|
||||
inline const DLListBase::link& DLListBase::const_iterator::operator*()
|
||||
inline const Foam::DLListBase::link&
|
||||
Foam::DLListBase::const_iterator::operator*()
|
||||
{
|
||||
return *curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::const_iterator& DLListBase::const_iterator::operator++()
|
||||
inline Foam::DLListBase::const_iterator&
|
||||
Foam::DLListBase::const_iterator::operator++()
|
||||
{
|
||||
if (curElmt_ == curList_.last_)
|
||||
{
|
||||
@ -311,7 +334,8 @@ inline DLListBase::const_iterator& DLListBase::const_iterator::operator++()
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::const_iterator DLListBase::const_iterator::operator++(int)
|
||||
inline Foam::DLListBase::const_iterator
|
||||
Foam::DLListBase::const_iterator::operator++(int)
|
||||
{
|
||||
const_iterator tmp = *this;
|
||||
++*this;
|
||||
@ -319,7 +343,8 @@ inline DLListBase::const_iterator DLListBase::const_iterator::operator++(int)
|
||||
}
|
||||
|
||||
|
||||
inline DLListBase::const_iterator DLListBase::begin() const
|
||||
inline Foam::DLListBase::const_iterator
|
||||
Foam::DLListBase::begin() const
|
||||
{
|
||||
if (size())
|
||||
{
|
||||
@ -332,14 +357,11 @@ inline DLListBase::const_iterator DLListBase::begin() const
|
||||
}
|
||||
|
||||
|
||||
inline const DLListBase::const_iterator& DLListBase::end() const
|
||||
inline const Foam::DLListBase::const_iterator&
|
||||
Foam::DLListBase::end() const
|
||||
{
|
||||
return endConstIter;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -25,22 +25,16 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "SLListBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
SLListBase::iterator SLListBase::endIter
|
||||
Foam::SLListBase::iterator Foam::SLListBase::endIter
|
||||
(
|
||||
const_cast<SLListBase&>(static_cast<const SLListBase&>(SLListBase()))
|
||||
);
|
||||
|
||||
SLListBase::const_iterator SLListBase::endConstIter
|
||||
Foam::SLListBase::const_iterator Foam::SLListBase::endConstIter
|
||||
(
|
||||
static_cast<const SLListBase&>(SLListBase()),
|
||||
reinterpret_cast<const link*>(NULL)
|
||||
@ -49,7 +43,7 @@ SLListBase::const_iterator SLListBase::endConstIter
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void SLListBase::insert(SLListBase::link* a)
|
||||
void Foam::SLListBase::insert(SLListBase::link* a)
|
||||
{
|
||||
nElmts_++;
|
||||
|
||||
@ -66,7 +60,7 @@ void SLListBase::insert(SLListBase::link* a)
|
||||
}
|
||||
|
||||
|
||||
void SLListBase::append(SLListBase::link* a)
|
||||
void Foam::SLListBase::append(SLListBase::link* a)
|
||||
{
|
||||
nElmts_++;
|
||||
|
||||
@ -82,7 +76,7 @@ void SLListBase::append(SLListBase::link* a)
|
||||
}
|
||||
|
||||
|
||||
SLListBase::link* SLListBase::removeHead()
|
||||
Foam::SLListBase::link* Foam::SLListBase::removeHead()
|
||||
{
|
||||
nElmts_--;
|
||||
|
||||
@ -108,7 +102,7 @@ SLListBase::link* SLListBase::removeHead()
|
||||
}
|
||||
|
||||
|
||||
SLListBase::link* SLListBase::remove(SLListBase::link* it)
|
||||
Foam::SLListBase::link* Foam::SLListBase::remove(SLListBase::link* it)
|
||||
{
|
||||
SLListBase::iterator iter = begin();
|
||||
SLListBase::link *prev = &(*iter);
|
||||
@ -143,8 +137,4 @@ SLListBase::link* SLListBase::remove(SLListBase::link* it)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -152,6 +152,9 @@ public:
|
||||
//- Clear the list
|
||||
inline void clear();
|
||||
|
||||
//- Transfer the contents of the argument into this List
|
||||
// and annull the argument list.
|
||||
inline void transfer(SLListBase&);
|
||||
|
||||
// STL iterator
|
||||
|
||||
|
||||
@ -29,33 +29,28 @@ Description
|
||||
|
||||
#include "error.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
inline SLListBase::link::link()
|
||||
inline Foam::SLListBase::link::link()
|
||||
:
|
||||
next_(0)
|
||||
{}
|
||||
|
||||
|
||||
inline SLListBase::link::link(link* p)
|
||||
inline Foam::SLListBase::link::link(link* p)
|
||||
:
|
||||
next_(p)
|
||||
{}
|
||||
|
||||
|
||||
inline SLListBase::SLListBase()
|
||||
inline Foam::SLListBase::SLListBase()
|
||||
:
|
||||
last_(0),
|
||||
nElmts_(0)
|
||||
{}
|
||||
|
||||
|
||||
inline SLListBase::SLListBase(link* a)
|
||||
inline Foam::SLListBase::SLListBase(link* a)
|
||||
:
|
||||
last_(a->next_ = a),
|
||||
nElmts_(1)
|
||||
@ -64,19 +59,20 @@ inline SLListBase::SLListBase(link* a)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
inline SLListBase::~SLListBase()
|
||||
inline Foam::SLListBase::~SLListBase()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline label SLListBase::size() const
|
||||
inline Foam::label Foam::SLListBase::size() const
|
||||
{
|
||||
return nElmts_;
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::link* SLListBase::first()
|
||||
inline Foam::SLListBase::link*
|
||||
Foam::SLListBase::first()
|
||||
{
|
||||
if (!nElmts_)
|
||||
{
|
||||
@ -88,7 +84,8 @@ inline SLListBase::link* SLListBase::first()
|
||||
}
|
||||
|
||||
|
||||
inline const SLListBase::link* SLListBase::first() const
|
||||
inline const Foam::SLListBase::link*
|
||||
Foam::SLListBase::first() const
|
||||
{
|
||||
if (!nElmts_)
|
||||
{
|
||||
@ -100,7 +97,8 @@ inline const SLListBase::link* SLListBase::first() const
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::link* SLListBase::last()
|
||||
inline Foam::SLListBase::link*
|
||||
Foam::SLListBase::last()
|
||||
{
|
||||
if (!nElmts_)
|
||||
{
|
||||
@ -112,7 +110,8 @@ inline SLListBase::link* SLListBase::last()
|
||||
}
|
||||
|
||||
|
||||
inline const SLListBase::link* SLListBase::last() const
|
||||
inline const Foam::SLListBase::link*
|
||||
Foam::SLListBase::last() const
|
||||
{
|
||||
if (!nElmts_)
|
||||
{
|
||||
@ -124,14 +123,26 @@ inline const SLListBase::link* SLListBase::last() const
|
||||
}
|
||||
|
||||
|
||||
inline void SLListBase::clear()
|
||||
inline void Foam::SLListBase::clear()
|
||||
{
|
||||
nElmts_ = 0;
|
||||
last_ = 0;
|
||||
nElmts_ = 0;
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::link* SLListBase::remove(SLListBase::iterator& it)
|
||||
inline void Foam::SLListBase::transfer(SLListBase& lst)
|
||||
{
|
||||
last_ = lst.last_;
|
||||
nElmts_ = lst.nElmts_;
|
||||
|
||||
lst.clear();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::SLListBase::link* Foam::SLListBase::remove
|
||||
(
|
||||
SLListBase::iterator& it
|
||||
)
|
||||
{
|
||||
return remove(it.curElmt_);
|
||||
}
|
||||
@ -139,7 +150,7 @@ inline SLListBase::link* SLListBase::remove(SLListBase::iterator& it)
|
||||
|
||||
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
||||
|
||||
inline SLListBase::iterator::iterator(SLListBase& s, link* elmt)
|
||||
inline Foam::SLListBase::iterator::iterator(SLListBase& s, link* elmt)
|
||||
:
|
||||
curList_(s),
|
||||
curElmt_(elmt),
|
||||
@ -147,7 +158,7 @@ inline SLListBase::iterator::iterator(SLListBase& s, link* elmt)
|
||||
{}
|
||||
|
||||
|
||||
inline SLListBase::iterator::iterator(SLListBase& s)
|
||||
inline Foam::SLListBase::iterator::iterator(SLListBase& s)
|
||||
:
|
||||
curList_(s),
|
||||
curElmt_(NULL),
|
||||
@ -155,32 +166,32 @@ inline SLListBase::iterator::iterator(SLListBase& s)
|
||||
{}
|
||||
|
||||
|
||||
inline void SLListBase::iterator::operator=(const iterator& iter)
|
||||
inline void Foam::SLListBase::iterator::operator=(const iterator& iter)
|
||||
{
|
||||
curElmt_ = iter.curElmt_;
|
||||
curLink_ = iter.curLink_;
|
||||
}
|
||||
|
||||
|
||||
inline bool SLListBase::iterator::operator==(const iterator& iter) const
|
||||
inline bool Foam::SLListBase::iterator::operator==(const iterator& iter) const
|
||||
{
|
||||
return curElmt_ == iter.curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline bool SLListBase::iterator::operator!=(const iterator& iter) const
|
||||
inline bool Foam::SLListBase::iterator::operator!=(const iterator& iter) const
|
||||
{
|
||||
return curElmt_ != iter.curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::link& SLListBase::iterator::operator*()
|
||||
inline Foam::SLListBase::link& Foam::SLListBase::iterator::operator*()
|
||||
{
|
||||
return *curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::iterator& SLListBase::iterator::operator++()
|
||||
inline Foam::SLListBase::iterator& Foam::SLListBase::iterator::operator++()
|
||||
{
|
||||
if (curElmt_ == curList_.last_ || curList_.last_ == 0)
|
||||
{
|
||||
@ -196,7 +207,8 @@ inline SLListBase::iterator& SLListBase::iterator::operator++()
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::iterator SLListBase::iterator::operator++(int)
|
||||
inline Foam::SLListBase::iterator
|
||||
Foam::SLListBase::iterator::operator++(int)
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++*this;
|
||||
@ -204,7 +216,8 @@ inline SLListBase::iterator SLListBase::iterator::operator++(int)
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::iterator SLListBase::begin()
|
||||
inline Foam::SLListBase::iterator
|
||||
Foam::SLListBase::begin()
|
||||
{
|
||||
if (size())
|
||||
{
|
||||
@ -217,7 +230,8 @@ inline SLListBase::iterator SLListBase::begin()
|
||||
}
|
||||
|
||||
|
||||
inline const SLListBase::iterator& SLListBase::end()
|
||||
inline const Foam::SLListBase::iterator&
|
||||
Foam::SLListBase::end()
|
||||
{
|
||||
return endIter;
|
||||
}
|
||||
@ -225,7 +239,7 @@ inline const SLListBase::iterator& SLListBase::end()
|
||||
|
||||
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
||||
|
||||
inline SLListBase::const_iterator::const_iterator
|
||||
inline Foam::SLListBase::const_iterator::const_iterator
|
||||
(
|
||||
const SLListBase& s,
|
||||
const link* elmt
|
||||
@ -236,20 +250,23 @@ inline SLListBase::const_iterator::const_iterator
|
||||
{}
|
||||
|
||||
|
||||
inline SLListBase::const_iterator::const_iterator(const iterator& iter)
|
||||
inline Foam::SLListBase::const_iterator::const_iterator(const iterator& iter)
|
||||
:
|
||||
curList_(iter.curList_),
|
||||
curElmt_(iter.curElmt_)
|
||||
{}
|
||||
|
||||
|
||||
inline void SLListBase::const_iterator::operator=(const const_iterator& iter)
|
||||
inline void Foam::SLListBase::const_iterator::operator=
|
||||
(
|
||||
const const_iterator& iter
|
||||
)
|
||||
{
|
||||
curElmt_ = iter.curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline bool SLListBase::const_iterator::operator==
|
||||
inline bool Foam::SLListBase::const_iterator::operator==
|
||||
(
|
||||
const const_iterator& iter
|
||||
) const
|
||||
@ -258,7 +275,7 @@ inline bool SLListBase::const_iterator::operator==
|
||||
}
|
||||
|
||||
|
||||
inline bool SLListBase::const_iterator::operator!=
|
||||
inline bool Foam::SLListBase::const_iterator::operator!=
|
||||
(
|
||||
const const_iterator& iter
|
||||
) const
|
||||
@ -267,13 +284,15 @@ inline bool SLListBase::const_iterator::operator!=
|
||||
}
|
||||
|
||||
|
||||
inline const SLListBase::link& SLListBase::const_iterator::operator*()
|
||||
inline const Foam::SLListBase::link&
|
||||
Foam::SLListBase::const_iterator::operator*()
|
||||
{
|
||||
return *curElmt_;
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::const_iterator& SLListBase::const_iterator::operator++()
|
||||
inline Foam::SLListBase::const_iterator&
|
||||
Foam::SLListBase::const_iterator::operator++()
|
||||
{
|
||||
if (curElmt_ == curList_.last_)
|
||||
{
|
||||
@ -288,7 +307,8 @@ inline SLListBase::const_iterator& SLListBase::const_iterator::operator++()
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::const_iterator SLListBase::const_iterator::operator++(int)
|
||||
inline Foam::SLListBase::const_iterator
|
||||
Foam::SLListBase::const_iterator::operator++(int)
|
||||
{
|
||||
const_iterator tmp = *this;
|
||||
++*this;
|
||||
@ -296,7 +316,8 @@ inline SLListBase::const_iterator SLListBase::const_iterator::operator++(int)
|
||||
}
|
||||
|
||||
|
||||
inline SLListBase::const_iterator SLListBase::begin() const
|
||||
inline Foam::SLListBase::const_iterator
|
||||
Foam::SLListBase::begin() const
|
||||
{
|
||||
if (size())
|
||||
{
|
||||
@ -309,14 +330,11 @@ inline SLListBase::const_iterator SLListBase::begin() const
|
||||
}
|
||||
|
||||
|
||||
inline const SLListBase::const_iterator& SLListBase::end() const
|
||||
inline const Foam::SLListBase::const_iterator&
|
||||
Foam::SLListBase::end() const
|
||||
{
|
||||
return endConstIter;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -31,13 +31,22 @@ License
|
||||
template<class Stream>
|
||||
inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
||||
{
|
||||
static bool spacesSet = false;
|
||||
static bool spacesSet(false);
|
||||
static char spaces[40];
|
||||
|
||||
if (!spacesSet)
|
||||
{
|
||||
memset(spaces, ' ', 40);
|
||||
spaces[38 - strlen(Foam::FOAMversion)] = '\0';
|
||||
|
||||
size_t len = strlen(Foam::FOAMversion);
|
||||
if (len < 38)
|
||||
{
|
||||
spaces[38 - len] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
spaces[0] = '\0';
|
||||
}
|
||||
spacesSet = true;
|
||||
}
|
||||
|
||||
@ -56,8 +65,8 @@ inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
||||
"| ========= | |\n"
|
||||
"| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n"
|
||||
"| \\\\ / O peration | Version: " << FOAMversion << spaces << "|\n"
|
||||
"| \\\\ / A nd | Web: http://www.OpenFOAM.org |\n"
|
||||
"| \\\\/ M anipulation | |\n"
|
||||
"| \\\\ / A nd | |\n"
|
||||
"| \\\\/ M anipulation | www.OpenFOAM.org |\n"
|
||||
"\\*---------------------------------------------------------------------------*/\n";
|
||||
}
|
||||
|
||||
|
||||
@ -32,22 +32,22 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//- Write keyType
|
||||
Foam::Ostream& Foam::Ostream::write(const keyType& s)
|
||||
// Write keyType
|
||||
Foam::Ostream& Foam::Ostream::write(const keyType& kw)
|
||||
{
|
||||
// Write as word?
|
||||
if (s.isWildCard())
|
||||
// Write as word or string
|
||||
if (kw.isPattern())
|
||||
{
|
||||
return write(static_cast<const string&>(s));
|
||||
return write(static_cast<const string&>(kw));
|
||||
}
|
||||
else
|
||||
{
|
||||
return write(static_cast<const word&>(s));
|
||||
return write(static_cast<const word&>(kw));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Decrememt the indent level
|
||||
// Decrement the indent level
|
||||
void Foam::Ostream::decrIndent()
|
||||
{
|
||||
if (indentLevel_ == 0)
|
||||
@ -62,15 +62,26 @@ void Foam::Ostream::decrIndent()
|
||||
}
|
||||
|
||||
|
||||
// Write the keyword to the Ostream followed by appropriate indentation
|
||||
Foam::Ostream& Foam::Ostream::writeKeyword(const Foam::keyType& keyword)
|
||||
// Write the keyword followed by appropriate indentation
|
||||
Foam::Ostream& Foam::Ostream::writeKeyword(const keyType& kw)
|
||||
{
|
||||
indent();
|
||||
write(keyword);
|
||||
write(kw);
|
||||
|
||||
label nSpaces = max(entryIndentation_ - label(keyword.size()), 1);
|
||||
label nSpaces = entryIndentation_ - label(kw.size());
|
||||
|
||||
for (label i=0; i<nSpaces; i++)
|
||||
// pattern is surrounded by quotes
|
||||
if (kw.isPattern())
|
||||
{
|
||||
nSpaces -= 2;
|
||||
}
|
||||
|
||||
if (nSpaces < 1)
|
||||
{
|
||||
nSpaces = 1;
|
||||
}
|
||||
|
||||
while (nSpaces--)
|
||||
{
|
||||
write(char(token::SPACE));
|
||||
}
|
||||
|
||||
@ -60,12 +60,11 @@ protected:
|
||||
//- Number of spaces per indent level
|
||||
static const unsigned short indentSize_ = 4;
|
||||
|
||||
//- Current indent level
|
||||
unsigned short indentLevel_;
|
||||
|
||||
//- Indentation of the entry from the start of the keyword
|
||||
static const unsigned short entryIndentation_ = 16;
|
||||
|
||||
//- Current indent level
|
||||
unsigned short indentLevel_;
|
||||
|
||||
public:
|
||||
|
||||
@ -148,9 +147,8 @@ public:
|
||||
//- Decrememt the indent level
|
||||
void decrIndent();
|
||||
|
||||
//- Write the keyword to the Ostream followed by
|
||||
// appropriate indentation
|
||||
Ostream& writeKeyword(const keyType& keyword);
|
||||
//- Write the keyword followed by an appropriate indentation
|
||||
Ostream& writeKeyword(const keyType&);
|
||||
|
||||
|
||||
// Stream state functions
|
||||
|
||||
@ -47,7 +47,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class OPstream Declaration
|
||||
Class OPstream Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class OPstream
|
||||
@ -160,7 +160,7 @@ public:
|
||||
void flush()
|
||||
{}
|
||||
|
||||
//- Add '\n' and flush stream
|
||||
//- Add newline and flush stream
|
||||
void endl()
|
||||
{}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class OSstream Declaration
|
||||
Class OSstream Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class OSstream
|
||||
@ -162,20 +162,20 @@ public:
|
||||
//- Flush stream
|
||||
virtual void flush();
|
||||
|
||||
//- Add '\n' and flush stream
|
||||
//- Add newline and flush stream
|
||||
virtual void endl();
|
||||
|
||||
//- Get width of output field
|
||||
virtual int width() const;
|
||||
|
||||
//- Set width of output field (and return old width)
|
||||
virtual int width(const int w);
|
||||
virtual int width(const int);
|
||||
|
||||
//- Get precision of output field
|
||||
virtual int precision() const;
|
||||
|
||||
//- Set precision of output field (and return old precision)
|
||||
virtual int precision(const int p);
|
||||
virtual int precision(const int);
|
||||
|
||||
|
||||
// Print
|
||||
|
||||
@ -38,23 +38,23 @@ const Foam::dictionary Foam::dictionary::null;
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::dictionary::findInWildcards
|
||||
bool Foam::dictionary::findInPatterns
|
||||
(
|
||||
const bool wildCardMatch,
|
||||
const bool patternMatch,
|
||||
const word& Keyword,
|
||||
DLList<entry*>::const_iterator& wcLink,
|
||||
DLList<autoPtr<regExp> >::const_iterator& reLink
|
||||
) const
|
||||
{
|
||||
if (wildCardEntries_.size() > 0)
|
||||
if (patternEntries_.size() > 0)
|
||||
{
|
||||
while (wcLink != wildCardEntries_.end())
|
||||
while (wcLink != patternEntries_.end())
|
||||
{
|
||||
if (!wildCardMatch && wcLink()->keyword() == Keyword)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (wildCardMatch && reLink()->match(Keyword))
|
||||
if
|
||||
(
|
||||
patternMatch ? reLink()->match(Keyword)
|
||||
: wcLink()->keyword() == Keyword
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -68,23 +68,23 @@ bool Foam::dictionary::findInWildcards
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::findInWildcards
|
||||
bool Foam::dictionary::findInPatterns
|
||||
(
|
||||
const bool wildCardMatch,
|
||||
const bool patternMatch,
|
||||
const word& Keyword,
|
||||
DLList<entry*>::iterator& wcLink,
|
||||
DLList<autoPtr<regExp> >::iterator& reLink
|
||||
)
|
||||
{
|
||||
if (wildCardEntries_.size() > 0)
|
||||
if (patternEntries_.size() > 0)
|
||||
{
|
||||
while (wcLink != wildCardEntries_.end())
|
||||
while (wcLink != patternEntries_.end())
|
||||
{
|
||||
if (!wildCardMatch && wcLink()->keyword() == Keyword)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (wildCardMatch && reLink()->match(Keyword))
|
||||
if
|
||||
(
|
||||
patternMatch ? reLink()->match(Keyword)
|
||||
: wcLink()->keyword() == Keyword
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -125,10 +125,10 @@ Foam::dictionary::dictionary
|
||||
{
|
||||
hashedEntries_.insert(iter().keyword(), &iter());
|
||||
|
||||
if (iter().keyword().isWildCard())
|
||||
if (iter().keyword().isPattern())
|
||||
{
|
||||
wildCardEntries_.insert(&iter());
|
||||
wildCardRegexps_.insert
|
||||
patternEntries_.insert(&iter());
|
||||
patternRegexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||
);
|
||||
@ -155,10 +155,10 @@ Foam::dictionary::dictionary
|
||||
{
|
||||
hashedEntries_.insert(iter().keyword(), &iter());
|
||||
|
||||
if (iter().keyword().isWildCard())
|
||||
if (iter().keyword().isPattern())
|
||||
{
|
||||
wildCardEntries_.insert(&iter());
|
||||
wildCardRegexps_.insert
|
||||
patternEntries_.insert(&iter());
|
||||
patternRegexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||
);
|
||||
@ -217,14 +217,14 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wildCardEntries_.size() > 0)
|
||||
if (patternEntries_.size() > 0)
|
||||
{
|
||||
DLList<entry*>::const_iterator wcLink = wildCardEntries_.begin();
|
||||
DLList<entry*>::const_iterator wcLink = patternEntries_.begin();
|
||||
DLList<autoPtr<regExp> >::const_iterator reLink =
|
||||
wildCardRegexps_.begin();
|
||||
patternRegexps_.begin();
|
||||
|
||||
// Find in wildcards using regular expressions only
|
||||
if (findInWildcards(true, keyword, wcLink, reLink))
|
||||
// Find in patterns using regular expressions only
|
||||
if (findInPatterns(true, keyword, wcLink, reLink))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -246,22 +246,22 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
(
|
||||
const word& keyword,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
HashTable<entry*>::const_iterator iter = hashedEntries_.find(keyword);
|
||||
|
||||
if (iter == hashedEntries_.end())
|
||||
{
|
||||
if (wildCardMatch && wildCardEntries_.size() > 0)
|
||||
if (patternMatch && patternEntries_.size() > 0)
|
||||
{
|
||||
DLList<entry*>::const_iterator wcLink =
|
||||
wildCardEntries_.begin();
|
||||
patternEntries_.begin();
|
||||
DLList<autoPtr<regExp> >::const_iterator reLink =
|
||||
wildCardRegexps_.begin();
|
||||
patternRegexps_.begin();
|
||||
|
||||
// Find in wildcards using regular expressions only
|
||||
if (findInWildcards(wildCardMatch, keyword, wcLink, reLink))
|
||||
// Find in patterns using regular expressions only
|
||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||
{
|
||||
return wcLink();
|
||||
}
|
||||
@ -269,7 +269,7 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
|
||||
if (recursive && &parent_ != &dictionary::null)
|
||||
{
|
||||
return parent_.lookupEntryPtr(keyword, recursive, wildCardMatch);
|
||||
return parent_.lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -285,21 +285,22 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
(
|
||||
const word& keyword,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
)
|
||||
{
|
||||
HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
|
||||
|
||||
if (iter == hashedEntries_.end())
|
||||
{
|
||||
if (wildCardMatch && wildCardEntries_.size() > 0)
|
||||
if (patternMatch && patternEntries_.size() > 0)
|
||||
{
|
||||
DLList<entry*>::iterator wcLink =
|
||||
wildCardEntries_.begin();
|
||||
patternEntries_.begin();
|
||||
DLList<autoPtr<regExp> >::iterator reLink =
|
||||
wildCardRegexps_.begin();
|
||||
// Find in wildcards using regular expressions only
|
||||
if (findInWildcards(wildCardMatch, keyword, wcLink, reLink))
|
||||
patternRegexps_.begin();
|
||||
|
||||
// Find in patterns using regular expressions only
|
||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||
{
|
||||
return wcLink();
|
||||
}
|
||||
@ -311,7 +312,7 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
(
|
||||
keyword,
|
||||
recursive,
|
||||
wildCardMatch
|
||||
patternMatch
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -328,10 +329,10 @@ const Foam::entry& Foam::dictionary::lookupEntry
|
||||
(
|
||||
const word& keyword,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
|
||||
if (entryPtr == NULL)
|
||||
{
|
||||
@ -352,16 +353,16 @@ Foam::ITstream& Foam::dictionary::lookup
|
||||
(
|
||||
const word& keyword,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
return lookupEntry(keyword, recursive, wildCardMatch).stream();
|
||||
return lookupEntry(keyword, recursive, patternMatch).stream();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::isDict(const word& keyword) const
|
||||
{
|
||||
// Find non-recursive with wildcards
|
||||
// Find non-recursive with patterns
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, false, true);
|
||||
|
||||
if (entryPtr)
|
||||
@ -430,7 +431,7 @@ Foam::wordList Foam::dictionary::toc() const
|
||||
{
|
||||
wordList keys(size());
|
||||
|
||||
label i = 0;
|
||||
label nKeys = 0;
|
||||
for
|
||||
(
|
||||
IDLList<entry>::const_iterator iter = begin();
|
||||
@ -438,13 +439,36 @@ Foam::wordList Foam::dictionary::toc() const
|
||||
++iter
|
||||
)
|
||||
{
|
||||
keys[i++] = iter().keyword();
|
||||
keys[nKeys++] = iter().keyword();
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
Foam::List<Foam::keyType> Foam::dictionary::keys(bool patterns) const
|
||||
{
|
||||
List<keyType> keys(size());
|
||||
|
||||
label nKeys = 0;
|
||||
for
|
||||
(
|
||||
IDLList<entry>::const_iterator iter = begin();
|
||||
iter != end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
if (iter().keyword().isPattern() ? patterns : !patterns)
|
||||
{
|
||||
keys[nKeys++] = iter().keyword();
|
||||
}
|
||||
}
|
||||
keys.setSize(nKeys);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
{
|
||||
HashTable<entry*>::iterator iter = hashedEntries_.find
|
||||
@ -473,10 +497,10 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
{
|
||||
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
||||
|
||||
if (entryPtr->keyword().isWildCard())
|
||||
if (entryPtr->keyword().isPattern())
|
||||
{
|
||||
wildCardEntries_.insert(entryPtr);
|
||||
wildCardRegexps_.insert
|
||||
patternEntries_.insert(entryPtr);
|
||||
patternRegexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||
);
|
||||
@ -502,10 +526,10 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
||||
IDLList<entry>::append(entryPtr);
|
||||
|
||||
if (entryPtr->keyword().isWildCard())
|
||||
if (entryPtr->keyword().isPattern())
|
||||
{
|
||||
wildCardEntries_.insert(entryPtr);
|
||||
wildCardRegexps_.insert
|
||||
patternEntries_.insert(entryPtr);
|
||||
patternRegexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||
);
|
||||
@ -597,16 +621,15 @@ bool Foam::dictionary::remove(const word& Keyword)
|
||||
|
||||
if (iter != hashedEntries_.end())
|
||||
{
|
||||
// Delete from wildcards first
|
||||
DLList<entry*>::iterator wcLink =
|
||||
wildCardEntries_.begin();
|
||||
DLList<autoPtr<regExp> >::iterator reLink = wildCardRegexps_.begin();
|
||||
// Delete from patterns first
|
||||
DLList<entry*>::iterator wcLink = patternEntries_.begin();
|
||||
DLList<autoPtr<regExp> >::iterator reLink = patternRegexps_.begin();
|
||||
|
||||
// Find in wildcards using exact match only
|
||||
if (findInWildcards(false, Keyword, wcLink, reLink))
|
||||
// Find in pattern using exact match only
|
||||
if (findInPatterns(false, Keyword, wcLink, reLink))
|
||||
{
|
||||
wildCardEntries_.remove(wcLink);
|
||||
wildCardRegexps_.remove(reLink);
|
||||
patternEntries_.remove(wcLink);
|
||||
patternRegexps_.remove(reLink);
|
||||
}
|
||||
|
||||
IDLList<entry>::remove(iter());
|
||||
@ -643,14 +666,14 @@ bool Foam::dictionary::changeKeyword
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iter()->keyword().isWildCard())
|
||||
if (iter()->keyword().isPattern())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"dictionary::changeKeyword(const word&, const word&, bool)"
|
||||
) << "Old keyword "<< oldKeyword
|
||||
<< " is a wildcard."
|
||||
<< "Wildcard replacement not yet implemented."
|
||||
<< " is a pattern."
|
||||
<< "Pattern replacement not yet implemented."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -662,19 +685,19 @@ bool Foam::dictionary::changeKeyword
|
||||
{
|
||||
if (forceOverwrite)
|
||||
{
|
||||
if (iter2()->keyword().isWildCard())
|
||||
if (iter2()->keyword().isPattern())
|
||||
{
|
||||
// Delete from wildcards first
|
||||
// Delete from patterns first
|
||||
DLList<entry*>::iterator wcLink =
|
||||
wildCardEntries_.begin();
|
||||
patternEntries_.begin();
|
||||
DLList<autoPtr<regExp> >::iterator reLink =
|
||||
wildCardRegexps_.begin();
|
||||
patternRegexps_.begin();
|
||||
|
||||
// Find in wildcards using exact match only
|
||||
if (findInWildcards(false, iter2()->keyword(), wcLink, reLink))
|
||||
// Find in patterns using exact match only
|
||||
if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
|
||||
{
|
||||
wildCardEntries_.remove(wcLink);
|
||||
wildCardRegexps_.remove(reLink);
|
||||
patternEntries_.remove(wcLink);
|
||||
patternRegexps_.remove(reLink);
|
||||
}
|
||||
}
|
||||
|
||||
@ -701,10 +724,10 @@ bool Foam::dictionary::changeKeyword
|
||||
hashedEntries_.erase(oldKeyword);
|
||||
hashedEntries_.insert(newKeyword, iter());
|
||||
|
||||
if (newKeyword.isWildCard())
|
||||
if (newKeyword.isPattern())
|
||||
{
|
||||
wildCardEntries_.insert(iter());
|
||||
wildCardRegexps_.insert
|
||||
patternEntries_.insert(iter());
|
||||
patternRegexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(newKeyword))
|
||||
);
|
||||
@ -770,8 +793,8 @@ void Foam::dictionary::clear()
|
||||
{
|
||||
IDLList<entry>::clear();
|
||||
hashedEntries_.clear();
|
||||
wildCardEntries_.clear();
|
||||
wildCardRegexps_.clear();
|
||||
patternEntries_.clear();
|
||||
patternRegexps_.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,12 +27,12 @@ Class
|
||||
|
||||
Description
|
||||
A list of keyword definitions, which are a keyword followed by any number
|
||||
of values (e.g. words and numbers). The keywords can represent wildcards
|
||||
of values (e.g. words and numbers). The keywords can represent patterns
|
||||
which are matched using Posix regular expressions. The general order for
|
||||
searching is
|
||||
searching is as follows:
|
||||
- exact match
|
||||
- wildcard match (in reverse order)
|
||||
- optional recursion into subdictionaries
|
||||
- pattern match (in reverse order)
|
||||
- optional recursion into the enclosing (parent) dictionaries
|
||||
|
||||
The dictionary class is the base class for IOdictionary.
|
||||
It also serves as a bootstrap dictionary for the objectRegistry data
|
||||
@ -92,29 +92,27 @@ class dictionary
|
||||
//- Parent dictionary
|
||||
const dictionary& parent_;
|
||||
|
||||
//- Wildcard entries
|
||||
DLList<entry*> wildCardEntries_;
|
||||
//- Entries of matching patterns
|
||||
DLList<entry*> patternEntries_;
|
||||
|
||||
//- Wildcard precompiled regular expressions
|
||||
DLList<autoPtr<regExp> > wildCardRegexps_;
|
||||
//- Patterns as precompiled regular expressions
|
||||
DLList<autoPtr<regExp> > patternRegexps_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Search wildcard table either for exact match or for regular
|
||||
// expression match.
|
||||
bool findInWildcards
|
||||
//- Search patterns table for exact match or regular expression match
|
||||
bool findInPatterns
|
||||
(
|
||||
const bool wildCardMatch,
|
||||
const bool patternMatch,
|
||||
const word& Keyword,
|
||||
DLList<entry*>::const_iterator& wcLink,
|
||||
DLList<autoPtr<regExp> >::const_iterator& reLink
|
||||
) const;
|
||||
|
||||
//- Search wildcard table either for exact match or for regular
|
||||
// expression match.
|
||||
bool findInWildcards
|
||||
//- Search patterns table for exact match or regular expression match
|
||||
bool findInPatterns
|
||||
(
|
||||
const bool wildCardMatch,
|
||||
const bool patternMatch,
|
||||
const word& Keyword,
|
||||
DLList<entry*>::iterator& wcLink,
|
||||
DLList<autoPtr<regExp> >::iterator& reLink
|
||||
@ -210,83 +208,88 @@ public:
|
||||
// Search and lookup
|
||||
|
||||
//- Search dictionary for given keyword
|
||||
// If recursive search parent dictionaries
|
||||
// If recursive, search parent dictionaries
|
||||
bool found(const word&, bool recursive=false) const;
|
||||
|
||||
//- Find and return an entry data stream pointer if present
|
||||
// otherwise return NULL.
|
||||
// If recursive search parent dictionaries.
|
||||
// If wildCardMatch use wildcards.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions
|
||||
const entry* lookupEntryPtr
|
||||
(
|
||||
const word&,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
) const;
|
||||
|
||||
//- Find and return an entry data stream pointer for manipulation
|
||||
// if present otherwise return NULL.
|
||||
// If recursive search parent dictionaries.
|
||||
// If wildCardMatch use wildcards.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
entry* lookupEntryPtr
|
||||
(
|
||||
const word&,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
);
|
||||
|
||||
//- Find and return an entry data stream if present otherwise error.
|
||||
// If recursive search parent dictionaries.
|
||||
// If wildCardMatch use wildcards.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
const entry& lookupEntry
|
||||
(
|
||||
const word&,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
) const;
|
||||
|
||||
//- Find and return an entry data stream
|
||||
// If recursive search parent dictionaries
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
ITstream& lookup
|
||||
(
|
||||
const word&,
|
||||
bool recursive=false,
|
||||
bool wildCardMatch=true
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T,
|
||||
// if not found return the given default value
|
||||
// If recursive search parent dictionaries
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
T lookupOrDefault
|
||||
(
|
||||
const word&,
|
||||
const T&,
|
||||
bool recursive=false,
|
||||
bool wildCardMatch=true
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T, if not found return the given
|
||||
// default value, and add to dictionary.
|
||||
// If recursive search parent dictionaries
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
T lookupOrAddDefault
|
||||
(
|
||||
const word&,
|
||||
const T&,
|
||||
bool recursive=false,
|
||||
bool wildCardMatch=true
|
||||
bool patternMatch=true
|
||||
);
|
||||
|
||||
//- Find an entry if present, and assign to T
|
||||
// Returns true if the entry was found
|
||||
// Returns true if the entry was found.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
bool readIfPresent
|
||||
(
|
||||
const word&,
|
||||
T&,
|
||||
bool recursive=false,
|
||||
bool wildCardMatch=true
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Check if entry is a sub-dictionary
|
||||
@ -305,6 +308,9 @@ public:
|
||||
//- Return the table of contents
|
||||
wordList toc() const;
|
||||
|
||||
//- Return the list of available keys or patterns
|
||||
List<keyType> keys(bool patterns=false) const;
|
||||
|
||||
// Editing
|
||||
|
||||
//- Add a new entry
|
||||
@ -393,7 +399,7 @@ public:
|
||||
void operator=(const dictionary&);
|
||||
|
||||
//- Include entries from the given dictionary.
|
||||
// Warn, but do not overwrite existing entries
|
||||
// Warn, but do not overwrite existing entries.
|
||||
void operator+=(const dictionary&);
|
||||
|
||||
//- Conditionally include entries from the given dictionary.
|
||||
@ -417,13 +423,13 @@ public:
|
||||
|
||||
// Global Operators
|
||||
|
||||
//- Combine dictionaries starting from the entries in dict1 and then including
|
||||
// those from dict2.
|
||||
//- Combine dictionaries.
|
||||
// Starting from the entries in dict1 and then including those from dict2.
|
||||
// Warn, but do not overwrite the entries from dict1.
|
||||
dictionary operator+(const dictionary& dict1, const dictionary& dict2);
|
||||
|
||||
//- Combine dictionaries starting from the entries in dict1 and then including
|
||||
// those from dict2.
|
||||
//- Combine dictionaries.
|
||||
// Starting from the entries in dict1 and then including those from dict2.
|
||||
// Do not overwrite the entries from dict1.
|
||||
dictionary operator|(const dictionary& dict1, const dictionary& dict2);
|
||||
|
||||
|
||||
@ -74,20 +74,20 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from the parent dictionary and Istream
|
||||
dictionaryEntry(const dictionary& parentDict, Istream& is);
|
||||
dictionaryEntry(const dictionary& parentDict, Istream&);
|
||||
|
||||
//- Construct from the keyword, parent dictionary and a Istream
|
||||
dictionaryEntry
|
||||
(
|
||||
const keyType& keyword,
|
||||
const keyType&,
|
||||
const dictionary& parentDict,
|
||||
Istream& is
|
||||
Istream&
|
||||
);
|
||||
|
||||
//- Construct from the keyword, parent dictionary and a dictionary
|
||||
dictionaryEntry
|
||||
(
|
||||
const keyType& keyword,
|
||||
const keyType&,
|
||||
const dictionary& parentDict,
|
||||
const dictionary& dict
|
||||
);
|
||||
@ -96,7 +96,7 @@ public:
|
||||
dictionaryEntry
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
const dictionaryEntry& dictEnt
|
||||
const dictionaryEntry&
|
||||
);
|
||||
|
||||
autoPtr<entry> clone(const dictionary& parentDict) const
|
||||
@ -158,10 +158,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#if defined (__GNUC__)
|
||||
template<>
|
||||
#endif
|
||||
Ostream& operator<<(Ostream& os, const InfoProxy<dictionaryEntry>& ip);
|
||||
Ostream& operator<<(Ostream&, const InfoProxy<dictionaryEntry>&);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,18 +35,18 @@ T Foam::dictionary::lookupOrDefault
|
||||
const word& keyword,
|
||||
const T& deflt,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
|
||||
if (entryPtr == NULL)
|
||||
if (entryPtr)
|
||||
{
|
||||
return deflt;
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
return deflt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,19 +57,19 @@ T Foam::dictionary::lookupOrAddDefault
|
||||
const word& keyword,
|
||||
const T& deflt,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
)
|
||||
{
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
|
||||
if (entryPtr == NULL)
|
||||
if (entryPtr)
|
||||
{
|
||||
add(new primitiveEntry(keyword, deflt));
|
||||
return deflt;
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
add(new primitiveEntry(keyword, deflt));
|
||||
return deflt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,20 +80,20 @@ bool Foam::dictionary::readIfPresent
|
||||
const word& k,
|
||||
T& val,
|
||||
bool recursive,
|
||||
bool wildCardMatch
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
const entry* entryPtr = lookupEntryPtr(k, recursive, wildCardMatch);
|
||||
const entry* entryPtr = lookupEntryPtr(k, recursive, patternMatch);
|
||||
|
||||
if (entryPtr == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (entryPtr)
|
||||
{
|
||||
entryPtr->stream() >> val;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -92,20 +92,20 @@ public:
|
||||
|
||||
//- Construct on freestore as copy with reference to the
|
||||
// dictionary the copy belongs to
|
||||
virtual Foam::autoPtr<entry> clone
|
||||
virtual autoPtr<entry> clone
|
||||
(
|
||||
const dictionary& parentDict
|
||||
) const = 0;
|
||||
|
||||
//- Construct on freestore as copy
|
||||
// Note: the parent directory is set to dictionary::null
|
||||
virtual Foam::autoPtr<entry> clone() const;
|
||||
virtual autoPtr<entry> clone() const;
|
||||
|
||||
//- Construct from Istream and insert into dictionary
|
||||
static bool New(dictionary& parentDict, Istream& is);
|
||||
|
||||
//- Construct on freestore from Istream and return
|
||||
static Foam::autoPtr<entry> New(Istream& is);
|
||||
static autoPtr<entry> New(Istream& is);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
@ -75,32 +75,32 @@ public:
|
||||
void append
|
||||
(
|
||||
const token& currToken,
|
||||
const dictionary& dict,
|
||||
Istream& is
|
||||
const dictionary&,
|
||||
Istream&
|
||||
);
|
||||
|
||||
//- Append the given tokens starting at the current tokenIndex
|
||||
void append(const tokenList& varTokens);
|
||||
void append(const tokenList&);
|
||||
|
||||
//- Expand the given variable (keyword starts with $)
|
||||
bool expandVariable(const word& keyword, const dictionary& dict);
|
||||
bool expandVariable(const word&, const dictionary&);
|
||||
|
||||
//- Expand the given function (keyword starts with #)
|
||||
bool expandFunction
|
||||
(
|
||||
const word& keyword,
|
||||
const dictionary& dict,
|
||||
Istream& is
|
||||
const word&,
|
||||
const dictionary&,
|
||||
Istream&
|
||||
);
|
||||
|
||||
//- Read tokens from the given stream
|
||||
bool read(const dictionary& dict, Istream&);
|
||||
bool read(const dictionary&, Istream&);
|
||||
|
||||
//- Read the complete entry from the given stream
|
||||
void readEntry(const dictionary& dict, Istream&);
|
||||
void readEntry(const dictionary&, Istream&);
|
||||
|
||||
//- Insert the given tokens at token i
|
||||
void insert(const tokenList& varTokens, const label i);
|
||||
void insert(const tokenList&, const label i);
|
||||
|
||||
|
||||
public:
|
||||
@ -108,13 +108,13 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from keyword and a Istream
|
||||
primitiveEntry(const keyType& keyword, Istream&);
|
||||
primitiveEntry(const keyType&, Istream&);
|
||||
|
||||
//- Construct from keyword, parent dictionary and a Istream
|
||||
primitiveEntry(const keyType& keyword, const dictionary&, Istream&);
|
||||
//- Construct from keyword, parent dictionary and Istream
|
||||
primitiveEntry(const keyType&, const dictionary& parentDict, Istream&);
|
||||
|
||||
//- Construct from keyword and a ITstream
|
||||
primitiveEntry(const keyType& keyword, const ITstream&);
|
||||
primitiveEntry(const keyType&, const ITstream&);
|
||||
|
||||
//- Construct from keyword and a token
|
||||
primitiveEntry(const keyType&, const token&);
|
||||
@ -182,7 +182,7 @@ public:
|
||||
|
||||
|
||||
template<>
|
||||
Ostream& operator<<(Ostream& os, const InfoProxy<primitiveEntry>& ip);
|
||||
Ostream& operator<<(Ostream&, const InfoProxy<primitiveEntry>&);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -27,6 +27,26 @@ License
|
||||
#include "functionObjectList.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObject* Foam::functionObjectList::remove(const word& key)
|
||||
{
|
||||
functionObject* ptr = 0;
|
||||
|
||||
// Find index of existing functionObject
|
||||
HashTable<label>::iterator fnd = indices_.find(key);
|
||||
|
||||
if (fnd != indices_.end())
|
||||
{
|
||||
// remove the pointer from the old list
|
||||
ptr = functions_.set(fnd(), 0).ptr();
|
||||
indices_.erase(fnd);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectList::functionObjectList
|
||||
@ -35,24 +55,28 @@ Foam::functionObjectList::functionObjectList
|
||||
const bool execution
|
||||
)
|
||||
:
|
||||
HashPtrTable<functionObject>(),
|
||||
functions_(),
|
||||
indices_(),
|
||||
time_(t),
|
||||
foDict_(t.controlDict()),
|
||||
execution_(execution)
|
||||
parentDict_(t.controlDict()),
|
||||
execution_(execution),
|
||||
updated_(false)
|
||||
{}
|
||||
|
||||
|
||||
Foam::functionObjectList::functionObjectList
|
||||
(
|
||||
const Time& t,
|
||||
const dictionary& foDict,
|
||||
const dictionary& parentDict,
|
||||
const bool execution
|
||||
)
|
||||
:
|
||||
HashPtrTable<functionObject>(),
|
||||
functions_(),
|
||||
indices_(),
|
||||
time_(t),
|
||||
foDict_(foDict),
|
||||
execution_(execution)
|
||||
parentDict_(parentDict),
|
||||
execution_(execution),
|
||||
updated_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -66,52 +90,28 @@ Foam::functionObjectList::~functionObjectList()
|
||||
|
||||
bool Foam::functionObjectList::start()
|
||||
{
|
||||
if (execution_)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
if (foDict_.found("functions"))
|
||||
{
|
||||
HashPtrTable<functionObject> functions
|
||||
(
|
||||
foDict_.lookup("functions"),
|
||||
functionObject::iNew(time_)
|
||||
);
|
||||
|
||||
transfer(functions);
|
||||
|
||||
forAllIter(HashPtrTable<functionObject>, *this, iter)
|
||||
{
|
||||
ok = iter()->start() && ok;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return read();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjectList::execute()
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if (execution_)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
forAllIter(HashPtrTable<functionObject>, *this, iter)
|
||||
if (!updated_)
|
||||
{
|
||||
ok = iter()->execute() && ok;
|
||||
read();
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
forAllIter(PtrList<functionObject>, functions_, iter)
|
||||
{
|
||||
ok = iter().execute() && ok;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
@ -129,46 +129,108 @@ void Foam::functionObjectList::off()
|
||||
|
||||
bool Foam::functionObjectList::read()
|
||||
{
|
||||
bool read = false;
|
||||
bool ok = true;
|
||||
updated_ = execution_;
|
||||
|
||||
if (foDict_.found("functions"))
|
||||
// avoid reading/initializing if execution is off
|
||||
if (!execution_)
|
||||
{
|
||||
HashPtrTable<dictionary> functionDicts(foDict_.lookup("functions"));
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Update existing and add new functionObjects
|
||||
forAllConstIter(HashPtrTable<dictionary>, functionDicts, iter)
|
||||
// Update existing and add new functionObjects
|
||||
const entry* entryPtr = parentDict_.lookupEntryPtr("functions",false,false);
|
||||
if (entryPtr)
|
||||
{
|
||||
PtrList<functionObject> newPtrs;
|
||||
HashTable<label> newIndices;
|
||||
|
||||
label nFunc = 0;
|
||||
|
||||
if (entryPtr->isDict())
|
||||
{
|
||||
if (found(iter.key()))
|
||||
// a dictionary of functionObjects
|
||||
const dictionary& functionDicts = entryPtr->dict();
|
||||
newPtrs.setSize(functionDicts.size());
|
||||
|
||||
forAllConstIter(dictionary, functionDicts, iter)
|
||||
{
|
||||
read = find(iter.key())()->read(*iter()) && read;
|
||||
// safety:
|
||||
if (!iter().isDict())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const word& key = iter().keyword();
|
||||
const dictionary& dict = iter().dict();
|
||||
|
||||
functionObject* objPtr = remove(key);
|
||||
if (objPtr)
|
||||
{
|
||||
// existing functionObject
|
||||
ok = objPtr->read(dict) && ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
// new functionObject
|
||||
objPtr = functionObject::New(key, time_, dict).ptr();
|
||||
ok = objPtr->start() && ok;
|
||||
}
|
||||
|
||||
newPtrs.set(nFunc, objPtr);
|
||||
newIndices.insert(key, nFunc);
|
||||
nFunc++;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// a list of functionObjects
|
||||
PtrList<entry> functionDicts(entryPtr->stream());
|
||||
newPtrs.setSize(functionDicts.size());
|
||||
|
||||
forAllIter(PtrList<entry>, functionDicts, iter)
|
||||
{
|
||||
functionObject* functionObjectPtr =
|
||||
functionObject::New(iter.key(), time_, *iter()).ptr();
|
||||
// safety:
|
||||
if (!iter().isDict())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const word& key = iter().keyword();
|
||||
const dictionary& dict = iter().dict();
|
||||
|
||||
functionObjectPtr->start();
|
||||
functionObject* objPtr = remove(key);
|
||||
if (objPtr)
|
||||
{
|
||||
// existing functionObject
|
||||
ok = objPtr->read(dict) && ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
// new functionObject
|
||||
objPtr = functionObject::New(key, time_, dict).ptr();
|
||||
ok = objPtr->start() && ok;
|
||||
}
|
||||
|
||||
insert(iter.key(), functionObjectPtr);
|
||||
newPtrs.set(nFunc, objPtr);
|
||||
newIndices.insert(key, nFunc);
|
||||
nFunc++;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove deleted functionObjects
|
||||
forAllIter(HashPtrTable<functionObject>, *this, iter)
|
||||
{
|
||||
if (!functionDicts.found(iter.key()))
|
||||
{
|
||||
erase(iter);
|
||||
}
|
||||
}
|
||||
// safety:
|
||||
newPtrs.setSize(nFunc);
|
||||
|
||||
// update PtrList of functionObjects
|
||||
// also deletes existing, unused functionObjects
|
||||
functions_.transfer(newPtrs);
|
||||
indices_.transfer(newIndices);
|
||||
}
|
||||
else
|
||||
{
|
||||
clear();
|
||||
read = true;
|
||||
functions_.clear();
|
||||
indices_.clear();
|
||||
}
|
||||
|
||||
return read;
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ Class
|
||||
Foam::functionObjectList
|
||||
|
||||
Description
|
||||
List of function objects with execute function which is called for
|
||||
each object.
|
||||
List of function objects with execute() function that is called for each
|
||||
object.
|
||||
|
||||
See Also
|
||||
Foam::functionObject and Foam::OutputFilterFunctionObject
|
||||
@ -41,7 +41,8 @@ SourceFiles
|
||||
#define functionObjectList_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "HashTable.H"
|
||||
#include "PtrList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -49,26 +50,41 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObjectList Declaration
|
||||
Class functionObjectList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class functionObjectList
|
||||
:
|
||||
public HashPtrTable<functionObject>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- A list of function objects
|
||||
// Avoid 'is-a' relationship for protection
|
||||
PtrList<functionObject> functions_;
|
||||
|
||||
//- Quick lookup of the index into the PtrList<functionObject>
|
||||
// Currently only used to manage rereading/deletion
|
||||
HashTable<label> indices_;
|
||||
|
||||
const Time& time_;
|
||||
|
||||
//- Dictionary containing the list of function object specifications
|
||||
const dictionary& foDict_;
|
||||
//- Dictionary containing the "functions" entry
|
||||
// This entry can either be a list or a dictionary of
|
||||
// functionObject specifications.
|
||||
const dictionary& parentDict_;
|
||||
|
||||
//- Switch for the execution of the functionObjects
|
||||
bool execution_;
|
||||
|
||||
//- Tracks if read() was called while execution was turned off
|
||||
bool updated_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Remove and return the function object pointer by name.
|
||||
// Return NULL if it didn't exist.
|
||||
functionObject* remove(const word&);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
functionObjectList(const functionObjectList&);
|
||||
|
||||
@ -85,17 +101,17 @@ public:
|
||||
functionObjectList
|
||||
(
|
||||
const Time&,
|
||||
const bool execution = true
|
||||
const bool execution=true
|
||||
);
|
||||
|
||||
|
||||
//- Construct from Time, functionObject dictionary and the execution
|
||||
// setting
|
||||
//- Construct from Time, dictionary with "functions" entry
|
||||
// and the execution setting
|
||||
functionObjectList
|
||||
(
|
||||
const Time&,
|
||||
const dictionary& foDict,
|
||||
const bool execution = true
|
||||
const dictionary& parentDict,
|
||||
const bool execution=true
|
||||
);
|
||||
|
||||
|
||||
@ -118,7 +134,7 @@ public:
|
||||
//- Switch the function objects off
|
||||
virtual void off();
|
||||
|
||||
//- Read and set the function objects if their data has changed
|
||||
//- Read and set the function objects if their data have changed
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
@ -51,7 +51,6 @@ Foam::scalarRanges::scalarRanges(Istream& is)
|
||||
}
|
||||
}
|
||||
|
||||
lst.shrink();
|
||||
transfer(lst);
|
||||
}
|
||||
|
||||
|
||||
@ -36,19 +36,16 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace debug
|
||||
{
|
||||
|
||||
//! @cond ignoreDocumentation - local scope
|
||||
dictionary* controlDictPtr_(NULL);
|
||||
dictionary* debugSwitchesPtr_(NULL);
|
||||
dictionary* infoSwitchesPtr_(NULL);
|
||||
dictionary* optimisationSwitchesPtr_(NULL);
|
||||
|
||||
//- Class to ensure controlDictPtr_ is deleted at the end of the run
|
||||
// @cond ignore documentation for this class
|
||||
// to ensure controlDictPtr_ is deleted at the end of the run
|
||||
class deleteControlDictPtr
|
||||
{
|
||||
public:
|
||||
@ -61,135 +58,110 @@ public:
|
||||
if (controlDictPtr_)
|
||||
{
|
||||
delete controlDictPtr_;
|
||||
controlDictPtr_ = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
//! @endcond
|
||||
|
||||
deleteControlDictPtr deleteControlDictPtr_;
|
||||
//! @endcond ignoreDocumentation
|
||||
|
||||
|
||||
dictionary& switchSet(const char* switchSetName, dictionary* switchSetPtr)
|
||||
{
|
||||
if (!switchSetPtr)
|
||||
{
|
||||
if (!controlDict().found(switchSetName))
|
||||
{
|
||||
cerr<< "debug::switchSet(const char*, dictionary*): " << std::endl
|
||||
<< " Cannot find " << switchSetName
|
||||
<< " in dictionary " << controlDictPtr_->name().c_str()
|
||||
<< std::endl << std::endl;
|
||||
|
||||
::exit(1);
|
||||
}
|
||||
|
||||
switchSetPtr =
|
||||
const_cast<dictionary*>(&(controlDict().subDict(switchSetName)));
|
||||
}
|
||||
|
||||
return *switchSetPtr;
|
||||
}
|
||||
|
||||
|
||||
int debugSwitch
|
||||
(
|
||||
dictionary& switchSet,
|
||||
const char* switchName,
|
||||
const int defaultValue
|
||||
)
|
||||
{
|
||||
if (switchSet.found(switchName))
|
||||
{
|
||||
return readInt(switchSet.lookup(switchName));
|
||||
}
|
||||
else
|
||||
{
|
||||
switchSet.add(switchName, defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // End namespace debug
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dictionary& debug::controlDict()
|
||||
Foam::dictionary& Foam::debug::controlDict()
|
||||
{
|
||||
if (!controlDictPtr_)
|
||||
{
|
||||
fileName controlDictFileName(dotFoam("controlDict"));
|
||||
|
||||
IFstream dictFile(controlDictFileName);
|
||||
|
||||
if (!dictFile.good())
|
||||
{
|
||||
cerr<< "debug::controlDict(): "
|
||||
<< "Cannot open essential file " << controlDictFileName.c_str()
|
||||
<< std::endl << std::endl;
|
||||
::exit(1);
|
||||
}
|
||||
|
||||
controlDictPtr_ = new dictionary(dictFile);
|
||||
controlDictPtr_ = new dictionary
|
||||
(
|
||||
IFstream(findEtcFile("controlDict", true))()
|
||||
);
|
||||
}
|
||||
|
||||
return *controlDictPtr_;
|
||||
}
|
||||
|
||||
|
||||
dictionary& debug::debugSwitches()
|
||||
Foam::dictionary& Foam::debug::switchSet
|
||||
(
|
||||
const char* subDictName,
|
||||
dictionary*& subDictPtr
|
||||
)
|
||||
{
|
||||
if (!subDictPtr)
|
||||
{
|
||||
entry* ePtr = controlDict().lookupEntryPtr
|
||||
(
|
||||
subDictName, false, false
|
||||
);
|
||||
|
||||
if (!ePtr || !ePtr->isDict())
|
||||
{
|
||||
cerr<< "debug::switchSet(const char*, dictionary*&):\n"
|
||||
<< " Cannot find " << subDictName << " in dictionary "
|
||||
<< controlDict().name().c_str()
|
||||
<< std::endl << std::endl;
|
||||
|
||||
::exit(1);
|
||||
}
|
||||
|
||||
subDictPtr = &ePtr->dict();
|
||||
}
|
||||
|
||||
return *subDictPtr;
|
||||
}
|
||||
|
||||
|
||||
Foam::dictionary& Foam::debug::debugSwitches()
|
||||
{
|
||||
return switchSet("DebugSwitches", debugSwitchesPtr_);
|
||||
}
|
||||
|
||||
|
||||
int debug::debugSwitch(const char* switchName, const int defaultValue)
|
||||
{
|
||||
return debugSwitch
|
||||
(
|
||||
debugSwitches(),
|
||||
switchName,
|
||||
defaultValue
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
dictionary& debug::infoSwitches()
|
||||
Foam::dictionary& Foam::debug::infoSwitches()
|
||||
{
|
||||
return switchSet("InfoSwitches", infoSwitchesPtr_);
|
||||
}
|
||||
|
||||
|
||||
int debug::infoSwitch(const char* switchName, const int defaultValue)
|
||||
{
|
||||
return debugSwitch
|
||||
(
|
||||
infoSwitches(),
|
||||
switchName,
|
||||
defaultValue
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
dictionary& debug::optimisationSwitches()
|
||||
Foam::dictionary& Foam::debug::optimisationSwitches()
|
||||
{
|
||||
return switchSet("OptimisationSwitches", optimisationSwitchesPtr_);
|
||||
}
|
||||
|
||||
|
||||
int debug::optimisationSwitch(const char* switchName, const int defaultValue)
|
||||
int Foam::debug::debugSwitch(const char* name, const int defaultValue)
|
||||
{
|
||||
return debugSwitch
|
||||
return debugSwitches().lookupOrAddDefault
|
||||
(
|
||||
optimisationSwitches(),
|
||||
switchName,
|
||||
defaultValue
|
||||
name, defaultValue, false, false
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
int Foam::debug::infoSwitch(const char* name, const int defaultValue)
|
||||
{
|
||||
return infoSwitches().lookupOrAddDefault
|
||||
(
|
||||
name, defaultValue, false, false
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
|
||||
{
|
||||
return optimisationSwitches().lookupOrAddDefault
|
||||
(
|
||||
name, defaultValue, false, false
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -41,44 +41,40 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class dictionary;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace debug
|
||||
{
|
||||
//- The central control dictionary.
|
||||
// Located in ~/.OpenFOAM/VERSION or $WM_PROJECT_DIR/etc
|
||||
// @sa Foam::findEtcFile()
|
||||
dictionary& controlDict();
|
||||
|
||||
|
||||
dictionary& switchSet(const char* switchSetName, dictionary* switchSetPtr);
|
||||
|
||||
|
||||
//- The DebugSwitches sub-dictionary in the central controlDict.
|
||||
dictionary& debugSwitches();
|
||||
|
||||
int debugSwitch
|
||||
(
|
||||
const char* switchName,
|
||||
const int defaultValue = 0
|
||||
);
|
||||
|
||||
|
||||
//- The InfoSwitches sub-dictionary in the central controlDict.
|
||||
dictionary& infoSwitches();
|
||||
|
||||
int infoSwitch
|
||||
(
|
||||
const char* switchName,
|
||||
const int defaultValue = 0
|
||||
);
|
||||
|
||||
|
||||
//- The OptimisationSwitches sub-dictionary in the central controlDict.
|
||||
dictionary& optimisationSwitches();
|
||||
|
||||
int optimisationSwitch
|
||||
(
|
||||
const char* switchName,
|
||||
const int defaultValue = 0
|
||||
);
|
||||
}
|
||||
//- Lookup debug switch or add default value.
|
||||
int debugSwitch(const char* name, const int defaultValue=0);
|
||||
|
||||
//- Lookup info switch or add default value.
|
||||
int infoSwitch(const char* name, const int defaultValue=0);
|
||||
|
||||
//- Lookup optimisation switch or add default value.
|
||||
int optimisationSwitch(const char* name, const int defaultValue=0);
|
||||
|
||||
//- Internal function to lookup a sub-dictionary from controlDict.
|
||||
dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr);
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -23,19 +23,24 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Define the globals used in the FOAM library. It is important that these
|
||||
are constructed in the appropriate order to avoid the use of unconstructed
|
||||
data in the global namespace.
|
||||
Define the globals used in the OpenFOAM library.
|
||||
It is important that these are constructed in the appropriate order to
|
||||
avoid the use of unconstructed data in the global namespace.
|
||||
|
||||
This file gets preprocessed by the Allwmake script to replace
|
||||
PROJECT_VERSION with the appropriate version number string.
|
||||
This file has the extension .Cver to trigger a Makefile rule that converts
|
||||
WM_PROJECT_VERSION into the appropriate version string.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#include "foamVersion.H"
|
||||
|
||||
const char* const Foam::FOAMversion = "dev_2008-10-29-197-gc1bfee3";
|
||||
const char* const Foam::FOAMversion = "WM_PROJECT_VERSION";
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Static initializers for string::null, word::null and fileName::null
|
||||
|
||||
#include "stringsGlobals.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Setup an error handler for the global new operator
|
||||
@ -50,7 +55,7 @@ const char* const Foam::FOAMversion = "dev_2008-10-29-197-gc1bfee3";
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "JobInfo.H"
|
||||
bool Foam::JobInfo::constructed = false;
|
||||
bool Foam::JobInfo::constructed(false);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Global error definitions (initialised by construction)
|
||||
@ -1,78 +0,0 @@
|
||||
/*-------------------------------*- C++ -*-----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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
|
||||
Define the globals used in the FOAM library. It is important that these
|
||||
are constructed in the appropriate order to avoid the use of unconstructed
|
||||
data in the global namespace.
|
||||
|
||||
This file gets preprocessed by the Allwmake script to replace
|
||||
PROJECT_VERSION with the appropriate version number string.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#include "foamVersion.H"
|
||||
|
||||
const char* const Foam::FOAMversion = WM_PROJECT_VERSION;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Setup an error handler for the global new operator
|
||||
|
||||
#include "new.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Global IO streams
|
||||
|
||||
#include "IOstreams.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "JobInfo.H"
|
||||
bool Foam::JobInfo::constructed = false;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Global error definitions (initialised by construction)
|
||||
|
||||
#include "messageStream.C"
|
||||
#include "error.C"
|
||||
#include "IOerror.C"
|
||||
#include "token.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Read the debug and info switches
|
||||
|
||||
#include "debug.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Read and set cell models
|
||||
|
||||
#include "globalCellModeller.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Create the jobInfo file in the $FOAM_JOB_DIR/runningJobs directory
|
||||
|
||||
#include "JobInfo.C"
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -102,7 +102,8 @@ bool chDir(const fileName& dir);
|
||||
// - $WM_PROJECT_DIR/etc/
|
||||
//
|
||||
// @return the full path name or fileName::null if the name cannot be found
|
||||
fileName dotFoam(const fileName& name);
|
||||
// Optionally abort if the file cannot be found
|
||||
fileName findEtcFile(const fileName& name, bool mandatory=false);
|
||||
|
||||
//- Make a directory and return an error if it could not be created
|
||||
// and does not already exist
|
||||
|
||||
@ -27,14 +27,9 @@ License
|
||||
#include "cellModel.H"
|
||||
#include "pyramid.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
vector cellModel::centre
|
||||
Foam::vector Foam::cellModel::centre
|
||||
(
|
||||
const labelList& pointLabels,
|
||||
const pointField& points
|
||||
@ -91,7 +86,7 @@ vector cellModel::centre
|
||||
}
|
||||
|
||||
|
||||
scalar cellModel::mag
|
||||
Foam::scalar Foam::cellModel::mag
|
||||
(
|
||||
const labelList& pointLabels,
|
||||
const pointField& points
|
||||
@ -143,9 +138,4 @@ scalar cellModel::mag
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -29,12 +29,58 @@ Description
|
||||
|
||||
#include "cellModeller.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
Foam::cellModeller::cellModeller()
|
||||
{
|
||||
if (modelPtrs_.size())
|
||||
{
|
||||
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
||||
<< "attempt to re-construct cellModeller when it already exists"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
cellModeller::~cellModeller()
|
||||
label maxIndex = 0;
|
||||
forAll(models_, i)
|
||||
{
|
||||
if (models_[i].index() > maxIndex) maxIndex = models_[i].index();
|
||||
}
|
||||
|
||||
modelPtrs_.setSize(maxIndex + 1);
|
||||
modelPtrs_ = NULL;
|
||||
|
||||
// For all the words in the wordlist, set the details of the model
|
||||
// to those specified by the word name and the other parameters
|
||||
// given. This should result in an automatic 'read' of the model
|
||||
// from its File (see cellModel class).
|
||||
forAll(models_, i)
|
||||
{
|
||||
if (modelPtrs_[models_[i].index()])
|
||||
{
|
||||
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
||||
<< "more than one model share the index "
|
||||
<< models_[i].index()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
modelPtrs_[models_[i].index()] = &models_[i];
|
||||
|
||||
if (modelDictionary_.found(models_[i].name()))
|
||||
{
|
||||
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
||||
<< "more than one model share the name "
|
||||
<< models_[i].name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
modelDictionary_.insert(models_[i].name(), &models_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellModeller::~cellModeller()
|
||||
{}
|
||||
|
||||
|
||||
@ -43,9 +89,9 @@ cellModeller::~cellModeller()
|
||||
// Returns a pointer to a model which matches the string symbol
|
||||
// supplied. A null pointer is returned if there is no suitable match.
|
||||
|
||||
const cellModel* cellModeller::lookup(const word& symbol)
|
||||
const Foam::cellModel* Foam::cellModeller::lookup(const word& name)
|
||||
{
|
||||
HashTable<const cellModel*>::iterator iter = modelDictionary_.find(symbol);
|
||||
HashTable<const cellModel*>::iterator iter = modelDictionary_.find(name);
|
||||
|
||||
if (iter != modelDictionary_.end())
|
||||
{
|
||||
@ -57,9 +103,7 @@ const cellModel* cellModeller::lookup(const word& symbol)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellModeller Declaration
|
||||
Class cellModeller Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cellModeller
|
||||
@ -69,10 +69,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given file name
|
||||
//- Construct from central "cellModels" file
|
||||
cellModeller();
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~cellModeller();
|
||||
@ -80,12 +79,10 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Look up a model given name and return ptr to model if good
|
||||
// else zero
|
||||
//- Look up a model by name and return a pointer to the model or NULL
|
||||
static const cellModel* lookup(const word&);
|
||||
|
||||
//- Look up a model given label and return ptr to model if good
|
||||
// else zero
|
||||
//- Look up a model by index and return a pointer to the model or NULL
|
||||
static const cellModel* lookup(const label i)
|
||||
{
|
||||
return modelPtrs_[i];
|
||||
|
||||
@ -1,91 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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
|
||||
Reads the data portion of a model catalogue File.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cellModeller.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
cellModeller::cellModeller()
|
||||
{
|
||||
if (modelPtrs_.size())
|
||||
{
|
||||
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
||||
<< "attempt to re-construct cellModeller when it already exists"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
label maxIndex = 0;
|
||||
forAll(models_, i)
|
||||
{
|
||||
if (models_[i].index() > maxIndex) maxIndex = models_[i].index();
|
||||
}
|
||||
|
||||
modelPtrs_.setSize(maxIndex + 1);
|
||||
modelPtrs_ = NULL;
|
||||
|
||||
// For all the words in the wordlist, set the details of the model
|
||||
// to those specified by the word name and the other parameters
|
||||
// given. This should result in an automatic 'read' of the model
|
||||
// from its File (see cellModel class).
|
||||
forAll(models_, i)
|
||||
{
|
||||
if (modelPtrs_[models_[i].index()])
|
||||
{
|
||||
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
||||
<< "more than one model share the index "
|
||||
<< models_[i].index()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
modelPtrs_[models_[i].index()] = &models_[i];
|
||||
|
||||
if (modelDictionary_.found(models_[i].name()))
|
||||
{
|
||||
FatalErrorIn("cellModeller::cellModeller(const fileName&)")
|
||||
<< "more than one model share the name "
|
||||
<< models_[i].name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
modelDictionary_.insert(models_[i].name(), &models_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -23,6 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
cellModeller global initializations
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -30,25 +31,26 @@ Description
|
||||
#include "OSspecific.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Static data * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// PtrList of models
|
||||
Foam::PtrList<Foam::cellModel> Foam::cellModeller::models_
|
||||
(
|
||||
IFstream(findEtcFile("cellModels", true))()
|
||||
);
|
||||
|
||||
// List of model pointers
|
||||
Foam::List<Foam::cellModel*> Foam::cellModeller::modelPtrs_;
|
||||
|
||||
// HashTable of model pointers
|
||||
Foam::HashTable<const Foam::cellModel*> Foam::cellModeller::modelDictionary_;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Static data * * * * * * * * * * * * * * * * //
|
||||
|
||||
// PtrList of models
|
||||
PtrList<cellModel> cellModeller::models_
|
||||
(
|
||||
(IFstream(dotFoam("cellModels"))())
|
||||
);
|
||||
|
||||
// List of model pointers
|
||||
List<cellModel*> cellModeller::modelPtrs_;
|
||||
|
||||
// HashTable of model pointers
|
||||
HashTable<const cellModel*> cellModeller::modelDictionary_;
|
||||
|
||||
// Construct a dummy cellModeller which reads the models and fills
|
||||
// the above tables
|
||||
cellModeller globalCellModeller_;
|
||||
|
||||
@ -393,12 +393,11 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
}
|
||||
}
|
||||
}
|
||||
dynSharedEdgeLabels.shrink();
|
||||
|
||||
sharedEdgeLabelsPtr_ = new labelList();
|
||||
labelList& sharedEdgeLabels = *sharedEdgeLabelsPtr_;
|
||||
sharedEdgeLabels.transfer(dynSharedEdgeLabels);
|
||||
|
||||
dynSharedEdgeAddr.shrink();
|
||||
sharedEdgeAddrPtr_ = new labelList();
|
||||
labelList& sharedEdgeAddr = *sharedEdgeAddrPtr_;
|
||||
sharedEdgeAddr.transfer(dynSharedEdgeAddr);
|
||||
|
||||
@ -467,10 +467,8 @@ void Foam::globalPoints::remove(const Map<label>& directNeighbours)
|
||||
Map<label> oldMeshToProcPoint(meshToProcPoint_);
|
||||
meshToProcPoint_.clear();
|
||||
|
||||
procPoints_.shrink();
|
||||
List<procPointList> oldProcPoints;
|
||||
oldProcPoints.transfer(procPoints_);
|
||||
procPoints_.clear();
|
||||
|
||||
// Go through all equivalences
|
||||
for
|
||||
@ -535,7 +533,7 @@ void Foam::globalPoints::remove(const Map<label>& directNeighbours)
|
||||
{
|
||||
// This happens for 'wedge' like cyclics where the two halves
|
||||
// come together in the same point so share the same meshPoint.
|
||||
// So this meshPoint will have info of size one only.
|
||||
// So this meshPoint will have info of size one only.
|
||||
if
|
||||
(
|
||||
pointInfo[0][0] != Pstream::myProcNo()
|
||||
@ -968,7 +966,7 @@ Foam::globalPoints::globalPoints(const polyMesh& mesh)
|
||||
// Pout<< " pointI:" << meshPointI << ' '
|
||||
// << mesh.points()[meshPointI]
|
||||
// << " connected to proc " << pointInfo[i][0]
|
||||
// << " point:" << pointInfo[i][1]
|
||||
// << " point:" << pointInfo[i][1]
|
||||
// << endl;
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -64,7 +64,7 @@ Foam::labelListList Foam::polyMesh::cellShapePointCells
|
||||
|
||||
forAll (pc, pointI)
|
||||
{
|
||||
pointCellAddr[pointI].transfer(pc[pointI].shrink());
|
||||
pointCellAddr[pointI].transfer(pc[pointI]);
|
||||
}
|
||||
|
||||
return pointCellAddr;
|
||||
|
||||
@ -298,7 +298,7 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcAddressing()
|
||||
|
||||
forAll (faceFaces, faceI)
|
||||
{
|
||||
faceFaces[faceI].transfer(ff[faceI].shrink());
|
||||
faceFaces[faceI].transfer(ff[faceI]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -151,8 +151,6 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcEdgeLoops()
|
||||
while (currentEdgeI != -1);
|
||||
|
||||
// Done all for current loop. Transfer to edgeLoops.
|
||||
loop.shrink();
|
||||
|
||||
edgeLoops[loopI].transfer(loop);
|
||||
|
||||
loopI++;
|
||||
|
||||
@ -108,7 +108,7 @@ void Foam::primitiveMesh::calcCellEdges() const
|
||||
// reset the size
|
||||
forAll (ce, cellI)
|
||||
{
|
||||
cellEdgeAddr[cellI].transfer(ce[cellI].shrink());
|
||||
cellEdgeAddr[cellI].transfer(ce[cellI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,6 @@ License
|
||||
|
||||
const char* const Foam::fileName::typeName = "fileName";
|
||||
int Foam::fileName::debug(debug::debugSwitch(fileName::typeName, 0));
|
||||
const Foam::fileName Foam::fileName::null;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -28,8 +28,8 @@ Class
|
||||
Description
|
||||
A class for handling keywords in dictionaries.
|
||||
|
||||
A keyType is the keyword of a dictionary. It differs from word in that
|
||||
it accepts wildcards.
|
||||
A keyType is the keyword of a dictionary.
|
||||
It differs from word in that it accepts patterns (regular expressions).
|
||||
|
||||
SourceFiles
|
||||
keyType.C
|
||||
@ -53,7 +53,7 @@ class Ostream;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class keyType Declaration
|
||||
Class keyType Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class keyType
|
||||
@ -62,7 +62,8 @@ class keyType
|
||||
{
|
||||
// Private member data
|
||||
|
||||
bool isWildCard_;
|
||||
//- Is the keyType a pattern (regular expression)
|
||||
bool isPattern_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -78,22 +79,22 @@ public:
|
||||
inline keyType();
|
||||
|
||||
//- Construct as copy
|
||||
inline keyType(const keyType& s);
|
||||
inline keyType(const keyType&);
|
||||
|
||||
//- Construct as copy of word
|
||||
inline keyType(const word& s);
|
||||
inline keyType(const word&);
|
||||
|
||||
//- Construct as copy of string. Expect it to be regular expression.
|
||||
inline keyType(const string& s);
|
||||
inline keyType(const string&);
|
||||
|
||||
//- Construct as copy of character array
|
||||
inline keyType(const char* s);
|
||||
inline keyType(const char*);
|
||||
|
||||
//- Construct as copy of std::string
|
||||
inline keyType(const std::string& s, const bool isWildCard);
|
||||
inline keyType(const std::string&, const bool isPattern);
|
||||
|
||||
//- Construct from Istream
|
||||
keyType(Istream& is);
|
||||
keyType(Istream&);
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -101,29 +102,25 @@ public:
|
||||
//- Is this character valid for a keyType
|
||||
inline static bool valid(char c);
|
||||
|
||||
//- Is the type a wildcard?
|
||||
inline bool isWildCard() const;
|
||||
|
||||
//- Should be treated as a match rather than a literal string
|
||||
inline bool isPattern() const;
|
||||
|
||||
// Member operators
|
||||
|
||||
// Assignment
|
||||
|
||||
inline void operator=(const keyType& s);
|
||||
inline void operator=(const keyType&);
|
||||
inline void operator=(const word&);
|
||||
|
||||
//- Assign from regular expression.
|
||||
inline void operator=(const string& s);
|
||||
|
||||
inline void operator=(const word& s);
|
||||
|
||||
inline void operator=(const string&);
|
||||
inline void operator=(const char*);
|
||||
|
||||
|
||||
// IOstream operators
|
||||
|
||||
friend Istream& operator>>(Istream& is, keyType& w);
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const keyType& w);
|
||||
friend Istream& operator>>(Istream&, keyType&);
|
||||
friend Ostream& operator<<(Ostream&, const keyType&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -30,43 +30,40 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
//- Construct null
|
||||
inline Foam::keyType::keyType()
|
||||
:
|
||||
word(),
|
||||
isWildCard_(false)
|
||||
isPattern_(false)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct as copy
|
||||
inline Foam::keyType::keyType(const keyType& s)
|
||||
:
|
||||
word(s, false),
|
||||
isWildCard_(s.isWildCard())
|
||||
isPattern_(s.isPattern())
|
||||
{}
|
||||
|
||||
|
||||
//- Construct as copy of word
|
||||
inline Foam::keyType::keyType(const word& s)
|
||||
:
|
||||
word(s, false),
|
||||
isWildCard_(false)
|
||||
isPattern_(false)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct as copy of string. Expect it to be regular expression
|
||||
// Construct as copy of string. Expect it to be regular expression
|
||||
inline Foam::keyType::keyType(const string& s)
|
||||
:
|
||||
word(s, false),
|
||||
isWildCard_(true)
|
||||
isPattern_(true)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct as copy of character array
|
||||
// Construct as copy of character array
|
||||
inline Foam::keyType::keyType(const char* s)
|
||||
:
|
||||
word(s, false),
|
||||
isWildCard_(false)
|
||||
isPattern_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -74,11 +71,11 @@ inline Foam::keyType::keyType(const char* s)
|
||||
inline Foam::keyType::keyType
|
||||
(
|
||||
const std::string& s,
|
||||
const bool isWildCard
|
||||
const bool isPattern
|
||||
)
|
||||
:
|
||||
word(s, false),
|
||||
isWildCard_(isWildCard)
|
||||
isPattern_(isPattern)
|
||||
{}
|
||||
|
||||
|
||||
@ -90,9 +87,9 @@ inline bool Foam::keyType::valid(char c)
|
||||
}
|
||||
|
||||
|
||||
bool Foam::keyType::isWildCard() const
|
||||
bool Foam::keyType::isPattern() const
|
||||
{
|
||||
return isWildCard_;
|
||||
return isPattern_;
|
||||
}
|
||||
|
||||
|
||||
@ -102,14 +99,14 @@ inline void Foam::keyType::operator=(const keyType& s)
|
||||
{
|
||||
// Bypass checking
|
||||
string::operator=(s);
|
||||
isWildCard_ = s.isWildCard();
|
||||
isPattern_ = s.isPattern_;
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::keyType::operator=(const word& s)
|
||||
{
|
||||
word::operator=(s);
|
||||
isWildCard_ = false;
|
||||
isPattern_ = false;
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +114,7 @@ inline void Foam::keyType::operator=(const string& s)
|
||||
{
|
||||
// Bypass checking
|
||||
string::operator=(s);
|
||||
isWildCard_ = true;
|
||||
isPattern_ = true;
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +122,7 @@ inline void Foam::keyType::operator=(const char* s)
|
||||
{
|
||||
// Bypass checking
|
||||
string::operator=(s);
|
||||
isWildCard_ = false;
|
||||
isPattern_ = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@ License
|
||||
|
||||
const char* const Foam::string::typeName = "string";
|
||||
int Foam::string::debug(debug::debugSwitch(string::typeName, 0));
|
||||
const Foam::string Foam::string::null;
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -202,7 +201,7 @@ Foam::string& Foam::string::expand()
|
||||
// otherwise add extra test
|
||||
if (user == "OpenFOAM")
|
||||
{
|
||||
*this = dotFoam(file);
|
||||
*this = findEtcFile(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -34,7 +34,7 @@ Description
|
||||
Used as a base class for word and fileName.
|
||||
|
||||
See Also
|
||||
Foam::dotFoam() for information about the site/user OpenFOAM
|
||||
Foam::findEtcFile() for information about the site/user OpenFOAM
|
||||
configuration directory
|
||||
|
||||
SourceFiles
|
||||
@ -176,7 +176,7 @@ public:
|
||||
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
||||
//
|
||||
// @sa
|
||||
// Foam::dotFoam
|
||||
// Foam::findEtcFile
|
||||
string& expand();
|
||||
|
||||
//- Remove repeated characters returning true if string changed
|
||||
|
||||
45
src/OpenFOAM/primitives/strings/stringsGlobals.C
Normal file
45
src/OpenFOAM/primitives/strings/stringsGlobals.C
Normal file
@ -0,0 +1,45 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 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
|
||||
Static initializers for
|
||||
Foam::string::null
|
||||
Foam::word::null
|
||||
Foam::fileName::null.
|
||||
This file is included in global.Cver since these members are required by
|
||||
debug.C.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "string.H"
|
||||
#include "word.H"
|
||||
#include "fileName.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::string Foam::string::null;
|
||||
const Foam::word Foam::word::null;
|
||||
const Foam::fileName Foam::fileName::null;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -31,6 +31,5 @@ License
|
||||
|
||||
const char* const Foam::word::typeName = "word";
|
||||
int Foam::word::debug(Foam::debug::debugSwitch(word::typeName, 0));
|
||||
const Foam::word Foam::word::null;
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -87,7 +87,7 @@ public:
|
||||
inline word(const word&);
|
||||
|
||||
//- Construct as copy of character array
|
||||
inline word(const char*, const bool doStripInvalid = true);
|
||||
inline word(const char*, const bool doStripInvalid=true);
|
||||
|
||||
//- Construct as copy with a maximum number of characters
|
||||
inline word
|
||||
@ -98,10 +98,10 @@ public:
|
||||
);
|
||||
|
||||
//- Construct as copy of string
|
||||
inline word(const string&, const bool doStripInvalid = true);
|
||||
inline word(const string&, const bool doStripInvalid=true);
|
||||
|
||||
//- Construct as copy of std::string
|
||||
inline word(const std::string&, const bool doStripInvalid = true);
|
||||
inline word(const std::string&, const bool doStripInvalid=true);
|
||||
|
||||
//- Construct from Istream
|
||||
word(Istream&);
|
||||
|
||||
@ -44,7 +44,6 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Return a string representation of an uint
|
||||
word name(const unsigned int i)
|
||||
{
|
||||
std::ostringstream osBuffer;
|
||||
@ -66,7 +65,7 @@ Istream& operator>>(Istream& is, unsigned int& i)
|
||||
|
||||
if (t.isLabel())
|
||||
{
|
||||
i = uint(t.labelToken());
|
||||
i = unsigned(t.labelToken());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -5,7 +5,11 @@ set -x
|
||||
wmake libso dummy
|
||||
|
||||
case "$WM_MPLIB" in
|
||||
LAM | OPENMPI | MPI | MPICH | MPICH-GM | HPMPI )
|
||||
GAMMA)
|
||||
wmake libso gamma
|
||||
;;
|
||||
|
||||
LAM | *MPI* )
|
||||
export WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB
|
||||
set +x
|
||||
echo
|
||||
@ -13,10 +17,6 @@ LAM | OPENMPI | MPI | MPICH | MPICH-GM | HPMPI )
|
||||
set -x
|
||||
wmake libso mpi
|
||||
;;
|
||||
|
||||
GAMMA)
|
||||
wmake libso gamma
|
||||
;;
|
||||
esac
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -546,7 +546,7 @@ void Foam::meshRefinement::calcLocalRegions
|
||||
}
|
||||
}
|
||||
}
|
||||
localCc.shrink();
|
||||
|
||||
localPoints.transfer(localCc);
|
||||
|
||||
if (localPoints.size() != globalToLocalRegion.size())
|
||||
|
||||
@ -412,11 +412,9 @@ void Foam::polyDualMesh::collectPatchInternalFace
|
||||
}
|
||||
}
|
||||
|
||||
dualFace2.transfer(dualFace.shrink());
|
||||
dualFace.clear();
|
||||
dualFace2.transfer(dualFace);
|
||||
|
||||
featEdgeIndices2.transfer(featEdgeIndices.shrink());
|
||||
featEdgeIndices.clear();
|
||||
featEdgeIndices2.transfer(featEdgeIndices);
|
||||
|
||||
if (reverseFace)
|
||||
{
|
||||
@ -1590,8 +1588,7 @@ void Foam::polyDualMesh::calcFeatures
|
||||
allFeaturePoints.append(allBoundary.meshPoints()[pointI]);
|
||||
}
|
||||
}
|
||||
featurePoints.transfer(allFeaturePoints.shrink());
|
||||
allFeaturePoints.clear();
|
||||
featurePoints.transfer(allFeaturePoints);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -1633,8 +1630,7 @@ void Foam::polyDualMesh::calcFeatures
|
||||
allFeatureEdges.append(meshEdges[edgeI]);
|
||||
}
|
||||
}
|
||||
featureEdges.transfer(allFeatureEdges.shrink());
|
||||
allFeatureEdges.clear();
|
||||
featureEdges.transfer(allFeatureEdges);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -165,8 +165,7 @@ void Foam::decompositionMethod::calcCellCells
|
||||
cellCells.setSize(dynCellCells.size());
|
||||
forAll(dynCellCells, coarseI)
|
||||
{
|
||||
cellCells[coarseI].transfer(dynCellCells[coarseI].shrink());
|
||||
dynCellCells[coarseI].clear();
|
||||
cellCells[coarseI].transfer(dynCellCells[coarseI]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -794,8 +794,7 @@ Foam::labelList Foam::parMetisDecomp::decompose
|
||||
globalRegionRegions.setSize(dynRegionRegions.size());
|
||||
forAll(dynRegionRegions, i)
|
||||
{
|
||||
globalRegionRegions[i].transfer(dynRegionRegions[i].shrink());
|
||||
dynRegionRegions[i].clear();
|
||||
globalRegionRegions[i].transfer(dynRegionRegions[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -859,7 +858,7 @@ Foam::labelList Foam::parMetisDecomp::decompose
|
||||
// Check for user supplied weights and decomp options
|
||||
if (decompositionDict_.found("metisCoeffs"))
|
||||
{
|
||||
const dictionary& metisCoeffs =
|
||||
const dictionary& metisCoeffs =
|
||||
decompositionDict_.subDict("metisCoeffs");
|
||||
word weightsFile;
|
||||
|
||||
|
||||
@ -1503,17 +1503,13 @@ void Foam::boundaryMesh::setExtraEdges(const label edgeI)
|
||||
{
|
||||
labelList minDistance(mesh().nEdges(), -1);
|
||||
|
||||
// All edge labels encountered
|
||||
|
||||
// All edge labels encountered
|
||||
DynamicList<label> visitedEdges;
|
||||
|
||||
// Floodfill from edgeI starting from distance 0. Stop at distance.
|
||||
markEdges(8, edgeI, 0, minDistance, visitedEdges);
|
||||
|
||||
visitedEdges.shrink();
|
||||
|
||||
// Set edge labels to display
|
||||
//? Allowed to transfer from DynamicList to List
|
||||
extraEdges_.transfer(visitedEdges);
|
||||
}
|
||||
|
||||
|
||||
@ -787,9 +787,6 @@ bool Foam::topoCellLooper::cut
|
||||
}
|
||||
else
|
||||
{
|
||||
localLoop.shrink();
|
||||
localLoopWeights.shrink();
|
||||
|
||||
loop.transfer(localLoop);
|
||||
loopWeights.transfer(localLoopWeights);
|
||||
|
||||
@ -799,17 +796,16 @@ bool Foam::topoCellLooper::cut
|
||||
else
|
||||
{
|
||||
// Let parent handle poly case.
|
||||
return
|
||||
hexCellLooper::cut
|
||||
(
|
||||
refDir,
|
||||
cellI,
|
||||
vertIsCut,
|
||||
edgeIsCut,
|
||||
edgeWeight,
|
||||
loop,
|
||||
loopWeights
|
||||
);
|
||||
return hexCellLooper::cut
|
||||
(
|
||||
refDir,
|
||||
cellI,
|
||||
vertIsCut,
|
||||
edgeIsCut,
|
||||
edgeWeight,
|
||||
loop,
|
||||
loopWeights
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,11 +131,8 @@ Foam::face Foam::boundaryCutter::addEdgeCutsToFace
|
||||
}
|
||||
}
|
||||
|
||||
newFace.shrink();
|
||||
|
||||
face returnFace;
|
||||
returnFace.transfer(newFace);
|
||||
newFace.clear();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -361,9 +358,7 @@ bool Foam::boundaryCutter::splitFace
|
||||
{
|
||||
// Enough vertices to create a face from.
|
||||
face tmpFace;
|
||||
newFace.shrink();
|
||||
tmpFace.transfer(newFace);
|
||||
newFace.clear();
|
||||
|
||||
// Add face tmpFace
|
||||
addFace(faceI, tmpFace, modifiedFace, meshMod);
|
||||
@ -381,9 +376,7 @@ bool Foam::boundaryCutter::splitFace
|
||||
{
|
||||
// Enough vertices to create a face from.
|
||||
face tmpFace;
|
||||
newFace.shrink();
|
||||
tmpFace.transfer(newFace);
|
||||
newFace.clear();
|
||||
|
||||
// Add face tmpFace
|
||||
addFace(faceI, tmpFace, modifiedFace, meshMod);
|
||||
|
||||
@ -222,8 +222,6 @@ Foam::wallLayerCells::wallLayerCells
|
||||
}
|
||||
}
|
||||
|
||||
refineCells.shrink();
|
||||
|
||||
// Transfer refineCells storage to this.
|
||||
transfer(refineCells);
|
||||
}
|
||||
|
||||
@ -489,7 +489,6 @@ void Foam::polyMeshAdder::insertVertices
|
||||
|
||||
if (workFace.size() != allF.size())
|
||||
{
|
||||
workFace.shrink();
|
||||
allF.transfer(workFace);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1079,8 +1079,7 @@ Foam::label Foam::hexRef8::storeMidPointInfo
|
||||
}
|
||||
|
||||
face newFace;
|
||||
newFace.transfer(newFaceVerts.shrink());
|
||||
newFaceVerts.clear();
|
||||
newFace.transfer(newFaceVerts);
|
||||
|
||||
label anchorCell0 = getAnchorCell
|
||||
(
|
||||
@ -3687,8 +3686,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
);
|
||||
|
||||
// Convert dynamiclist to face.
|
||||
newFace.transfer(faceVerts.shrink());
|
||||
faceVerts.clear();
|
||||
newFace.transfer(faceVerts);
|
||||
|
||||
//Pout<< "Split face:" << faceI << " verts:" << f
|
||||
// << " into quad:" << newFace << endl;
|
||||
@ -3811,8 +3809,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
}
|
||||
|
||||
face newFace;
|
||||
newFace.transfer(newFaceVerts.shrink());
|
||||
|
||||
newFace.transfer(newFaceVerts);
|
||||
|
||||
// The point with the lowest level should be an anchor
|
||||
// point of the neighbouring cells.
|
||||
@ -3993,10 +3990,8 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
}
|
||||
}
|
||||
|
||||
pointLevel_.transfer(newPointLevel.shrink());
|
||||
newPointLevel.clear();
|
||||
cellLevel_.transfer(newCellLevel.shrink());
|
||||
newCellLevel.clear();
|
||||
pointLevel_.transfer(newPointLevel);
|
||||
cellLevel_.transfer(newCellLevel);
|
||||
|
||||
// Mark files as changed
|
||||
setInstance(mesh_.facesInstance());
|
||||
|
||||
@ -1964,21 +1964,15 @@ void Foam::polyTopoChange::compactAndReorder
|
||||
|
||||
// Clear inflation info
|
||||
{
|
||||
faceFromPoint_.clear();
|
||||
faceFromPoint_.resize(0);
|
||||
faceFromEdge_.clear();
|
||||
faceFromEdge_.resize(0);
|
||||
faceFromPoint_.clearStorage();
|
||||
faceFromEdge_.clearStorage();
|
||||
|
||||
cellFromPoint_.clear();
|
||||
cellFromPoint_.resize(0);
|
||||
cellFromEdge_.clear();
|
||||
cellFromEdge_.resize(0);
|
||||
cellFromFace_.clear();
|
||||
cellFromFace_.resize(0);
|
||||
cellFromPoint_.clearStorage();
|
||||
cellFromEdge_.clearStorage();
|
||||
cellFromFace_.clearStorage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
const polyBoundaryMesh& boundary = mesh.boundaryMesh();
|
||||
|
||||
// Grab patch mesh point maps
|
||||
@ -2092,10 +2086,8 @@ void Foam::polyTopoChange::clear()
|
||||
points_.clearStorage();
|
||||
pointMap_.clearStorage();
|
||||
reversePointMap_.clearStorage();
|
||||
pointZone_.clear();
|
||||
pointZone_.resize(0);
|
||||
retiredPoints_.clear();
|
||||
retiredPoints_.resize(0);
|
||||
pointZone_.clearStorage();
|
||||
retiredPoints_.clearStorage();
|
||||
|
||||
faces_.clearStorage();
|
||||
region_.clearStorage();
|
||||
@ -2103,27 +2095,19 @@ void Foam::polyTopoChange::clear()
|
||||
faceNeighbour_.clearStorage();
|
||||
faceMap_.clearStorage();
|
||||
reverseFaceMap_.clearStorage();
|
||||
faceFromPoint_.clear();
|
||||
faceFromPoint_.resize(0);
|
||||
faceFromEdge_.clear();
|
||||
faceFromEdge_.resize(0);
|
||||
flipFaceFlux_.clear();
|
||||
flipFaceFlux_.resize(0);
|
||||
faceZone_.clear();
|
||||
faceZone_.resize(0);
|
||||
faceZoneFlip_.clear();
|
||||
faceZoneFlip_.resize(0);
|
||||
faceFromPoint_.clearStorage();
|
||||
faceFromEdge_.clearStorage();
|
||||
flipFaceFlux_.clearStorage();
|
||||
faceZone_.clearStorage();
|
||||
faceZoneFlip_.clearStorage();
|
||||
nActiveFaces_ = 0;
|
||||
|
||||
cellMap_.clearStorage();
|
||||
reverseCellMap_.clearStorage();
|
||||
cellZone_.clearStorage();
|
||||
cellFromPoint_.clear();
|
||||
cellFromPoint_.resize(0);
|
||||
cellFromEdge_.clear();
|
||||
cellFromEdge_.resize(0);
|
||||
cellFromFace_.clear();
|
||||
cellFromFace_.resize(0);
|
||||
cellFromPoint_.clearStorage();
|
||||
cellFromEdge_.clearStorage();
|
||||
cellFromFace_.clearStorage();
|
||||
}
|
||||
|
||||
|
||||
@ -2996,8 +2980,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
|
||||
|
||||
// Clear out primitives
|
||||
{
|
||||
retiredPoints_.clear();
|
||||
retiredPoints_.resize(0);
|
||||
retiredPoints_.clearStorage();
|
||||
region_.clearStorage();
|
||||
}
|
||||
|
||||
@ -3053,15 +3036,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
|
||||
|
||||
// Clear zone info
|
||||
{
|
||||
pointZone_.clear();
|
||||
pointZone_.resize(0);
|
||||
|
||||
faceZone_.clear();
|
||||
faceZone_.resize(0);
|
||||
|
||||
faceZoneFlip_.clear();
|
||||
faceZoneFlip_.resize(0);
|
||||
|
||||
pointZone_.clearStorage();
|
||||
faceZone_.clearStorage();
|
||||
faceZoneFlip_.clearStorage();
|
||||
cellZone_.clearStorage();
|
||||
}
|
||||
|
||||
@ -3227,8 +3204,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh
|
||||
|
||||
// Clear out primitives
|
||||
{
|
||||
retiredPoints_.clear();
|
||||
retiredPoints_.resize(0);
|
||||
retiredPoints_.clearStorage();
|
||||
region_.clearStorage();
|
||||
}
|
||||
|
||||
@ -3346,15 +3322,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh
|
||||
|
||||
// Clear zone info
|
||||
{
|
||||
pointZone_.clear();
|
||||
pointZone_.resize(0);
|
||||
|
||||
faceZone_.clear();
|
||||
faceZone_.resize(0);
|
||||
|
||||
faceZoneFlip_.clear();
|
||||
faceZoneFlip_.resize(0);
|
||||
|
||||
pointZone_.clearStorage();
|
||||
faceZone_.clearStorage();
|
||||
faceZoneFlip_.clearStorage();
|
||||
cellZone_.clearStorage();
|
||||
}
|
||||
|
||||
|
||||
@ -365,8 +365,7 @@ void Foam::removeFaces::mergeFaces
|
||||
}
|
||||
|
||||
face mergedFace;
|
||||
mergedFace.transfer(faceVerts.shrink());
|
||||
faceVerts.clear();
|
||||
mergedFace.transfer(faceVerts);
|
||||
|
||||
if (reverseLoop)
|
||||
{
|
||||
@ -574,7 +573,7 @@ Foam::removeFaces::removeFaces
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Removing face connects cells. This function works out a consistent set of
|
||||
// cell regions.
|
||||
// cell regions.
|
||||
// - returns faces to remove. Can be extended with additional faces
|
||||
// (if owner would become neighbour)
|
||||
// - sets cellRegion to -1 or to region number
|
||||
@ -693,7 +692,7 @@ Foam::label Foam::removeFaces::compatibleRemoves
|
||||
|
||||
|
||||
// Various checks
|
||||
// - master is lowest numbered in any region
|
||||
// - master is lowest numbered in any region
|
||||
// - regions have more than 1 cell
|
||||
{
|
||||
labelList nCells(regionMaster.size(), 0);
|
||||
@ -763,8 +762,7 @@ Foam::label Foam::removeFaces::compatibleRemoves
|
||||
}
|
||||
}
|
||||
|
||||
newFacesToRemove.transfer(allFacesToRemove.shrink());
|
||||
allFacesToRemove.clear();
|
||||
newFacesToRemove.transfer(allFacesToRemove);
|
||||
|
||||
return nUsedRegions;
|
||||
}
|
||||
@ -1102,7 +1100,7 @@ void Foam::removeFaces::setRefinement
|
||||
else if (nFacesPerEdge[edgeI] == 1)
|
||||
{
|
||||
// 1: illegal. Tested above.
|
||||
}
|
||||
}
|
||||
else if (nFacesPerEdge[edgeI] == 2)
|
||||
{
|
||||
// 2: merge faces.
|
||||
@ -1219,7 +1217,7 @@ void Foam::removeFaces::setRefinement
|
||||
<< "The other side has region:" << nbrRegion
|
||||
<< endl
|
||||
<< "(region -1 means face is to be deleted)"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
else if (toNbrRegion[myRegion] == -1)
|
||||
@ -1240,9 +1238,9 @@ void Foam::removeFaces::setRefinement
|
||||
<< " with coupled neighbouring regions:"
|
||||
<< toNbrRegion[myRegion] << " and "
|
||||
<< nbrRegion
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1358,7 +1356,7 @@ void Foam::removeFaces::setRefinement
|
||||
pointsToRemove
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Now we know
|
||||
// - faceLabels : faces to remove (sync since no boundary faces)
|
||||
@ -1367,7 +1365,7 @@ void Foam::removeFaces::setRefinement
|
||||
// - faceRegion : connected face region of faces to be merged (sync)
|
||||
// - affectedFace : faces with points removed and/or owner/neighbour
|
||||
// changed (non sync)
|
||||
|
||||
|
||||
|
||||
// Start modifying mesh and keep track of faces changed.
|
||||
|
||||
|
||||
@ -372,7 +372,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
||||
// sliding intergace coupling in order to allow the point
|
||||
// projection to be done separately from the actual cutting.
|
||||
// Please change consistently with slidingInterfaceProjectPoints.C
|
||||
//
|
||||
//
|
||||
if (debug)
|
||||
{
|
||||
Pout << "Processing slave edges " << endl;
|
||||
@ -543,7 +543,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
||||
forAll (curFaces, faceI)
|
||||
{
|
||||
// Pout<< "face: " << curFaces[faceI] << " "
|
||||
// << masterPatch[curFaces[faceI]]
|
||||
// << masterPatch[curFaces[faceI]]
|
||||
// << " local: "
|
||||
// << masterPatch.localFaces()[curFaces[faceI]]
|
||||
// << endl;
|
||||
@ -566,7 +566,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
||||
// The edge cutting code is repeated in
|
||||
// slidingInterface::modifyMotionPoints. This is done for
|
||||
// efficiency reasons and avoids multiple creation of cutting
|
||||
// planes. Please update both simultaneously.
|
||||
// planes. Please update both simultaneously.
|
||||
|
||||
const point& a = projectedSlavePoints[curEdge.start()];
|
||||
const point& b = projectedSlavePoints[curEdge.end()];
|
||||
@ -623,7 +623,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
||||
if (slaveCut.hit())
|
||||
{
|
||||
// Strict checking of slave cut to avoid capturing
|
||||
// end points.
|
||||
// end points.
|
||||
scalar cutOnSlave =
|
||||
(
|
||||
(
|
||||
@ -747,14 +747,14 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
||||
|
||||
forAll (pointsIntoMasterEdges, i)
|
||||
{
|
||||
pime[i].transfer(pointsIntoMasterEdges[i].shrink());
|
||||
pime[i].transfer(pointsIntoMasterEdges[i]);
|
||||
}
|
||||
|
||||
labelListList pise(pointsIntoSlaveEdges.size());
|
||||
|
||||
forAll (pointsIntoSlaveEdges, i)
|
||||
{
|
||||
pise[i].transfer(pointsIntoSlaveEdges[i].shrink());
|
||||
pise[i].transfer(pointsIntoSlaveEdges[i]);
|
||||
}
|
||||
|
||||
// Prepare the enriched faces
|
||||
@ -1398,7 +1398,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
||||
}
|
||||
|
||||
face newFace;
|
||||
newFace.transfer(newFaceLabels.shrink());
|
||||
newFace.transfer(newFaceLabels);
|
||||
|
||||
// Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
|
||||
|
||||
@ -1683,7 +1683,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
||||
}
|
||||
|
||||
face newFace;
|
||||
newFace.transfer(newFaceLabels.shrink());
|
||||
newFace.transfer(newFaceLabels);
|
||||
|
||||
// Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
|
||||
|
||||
|
||||
@ -227,7 +227,7 @@ void Foam::slidingInterface::decoupleInterface
|
||||
}
|
||||
|
||||
face newFace;
|
||||
newFace.transfer(newFaceLabels.shrink());
|
||||
newFace.transfer(newFaceLabels);
|
||||
|
||||
// Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
|
||||
|
||||
@ -350,7 +350,7 @@ void Foam::slidingInterface::decoupleInterface
|
||||
}
|
||||
|
||||
face newFace;
|
||||
newFace.transfer(newFaceLabels.shrink());
|
||||
newFace.transfer(newFaceLabels);
|
||||
|
||||
// Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
// The seed edges include all the edges of the original face + all edges
|
||||
// of other faces that have been used in the construction of the
|
||||
// facet. Edges from other faces can be considered as
|
||||
// internal to the current face if used only once.
|
||||
// internal to the current face if used only once.
|
||||
|
||||
// Track the edge usage to avoid duplicate faces and reset it to unused
|
||||
boolList usedFaceEdges(curLocalFace.size(), false);
|
||||
@ -304,12 +304,12 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
|
||||
// Append the face
|
||||
face cutFaceGlobal;
|
||||
cutFaceGlobal.transfer(cutFaceGlobalPoints.shrink());
|
||||
cutFaceGlobal.transfer(cutFaceGlobalPoints);
|
||||
|
||||
cf.append(cutFaceGlobal);
|
||||
|
||||
face cutFaceLocal;
|
||||
cutFaceLocal.transfer(cutFaceLocalPoints.shrink());
|
||||
cutFaceLocal.transfer(cutFaceLocalPoints);
|
||||
// Pout << "\ncutFaceLocal: " << cutFaceLocal.points(lp) << endl;
|
||||
// Go through all edges of the cut faces.
|
||||
// If the edge corresponds to a starting face edge,
|
||||
@ -358,7 +358,7 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
edgeSeeds.append(curCutFaceEdge.reverseEdge());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Find out what the other side is
|
||||
|
||||
@ -596,20 +596,19 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
|
||||
// Re-pack the list into compact storage
|
||||
cutFacesPtr_ = new faceList();
|
||||
cutFacesPtr_->transfer(cf.shrink());
|
||||
cutFacesPtr_->transfer(cf);
|
||||
|
||||
cutFaceMasterPtr_ = new labelList();
|
||||
cutFaceMasterPtr_->transfer(cfMaster.shrink());
|
||||
cutFaceMasterPtr_->transfer(cfMaster);
|
||||
|
||||
cutFaceSlavePtr_ = new labelList();
|
||||
cutFaceSlavePtr_->transfer(cfSlave.shrink());
|
||||
cutFaceSlavePtr_->transfer(cfSlave);
|
||||
}
|
||||
|
||||
|
||||
void Foam::enrichedPatch::clearCutFaces()
|
||||
{
|
||||
deleteDemandDrivenData(cutFacesPtr_);
|
||||
|
||||
deleteDemandDrivenData(cutFaceMasterPtr_);
|
||||
deleteDemandDrivenData(cutFaceSlavePtr_);
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ void Foam::enrichedPatch::calcEnrichedFaces
|
||||
|
||||
// For correct functioning of the enrichedPatch class, the slave
|
||||
// faces need to be inserted first. See comments in
|
||||
// enrichedPatch.H
|
||||
// enrichedPatch.H
|
||||
|
||||
// Get reference to the point merge map
|
||||
const Map<label>& pmm = pointMergeMap();
|
||||
@ -233,10 +233,10 @@ void Foam::enrichedPatch::calcEnrichedFaces
|
||||
}
|
||||
}
|
||||
}
|
||||
// Info << "New slave face " << faceI << ": " << newFace << endl;
|
||||
// Info<< "New slave face " << faceI << ": " << newFace << endl;
|
||||
|
||||
// Add the new face to the list
|
||||
enrichedFaces[nEnrichedFaces].transfer(newFace.shrink());
|
||||
enrichedFaces[nEnrichedFaces].transfer(newFace);
|
||||
nEnrichedFaces++;
|
||||
}
|
||||
|
||||
@ -384,10 +384,10 @@ void Foam::enrichedPatch::calcEnrichedFaces
|
||||
}
|
||||
}
|
||||
}
|
||||
// Info << "New master face: " << newFace << endl;
|
||||
// Info<< "New master face: " << newFace << endl;
|
||||
|
||||
// Add the new face to the list
|
||||
enrichedFaces[nEnrichedFaces].transfer(newFace.shrink());
|
||||
enrichedFaces[nEnrichedFaces].transfer(newFace);
|
||||
nEnrichedFaces++;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user