Commit 68e86f97 authored by Henry Weller's avatar Henry Weller
Browse files

Info -> InfoInFunction and updated comments

parent 1bd1a493
......@@ -121,13 +121,12 @@ bool Foam::HashTable<T, Key, Hash>::found(const Key& key) const
}
}
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "HashTable<T, Key, Hash>::found(const Key& key) : "
<< "Entry " << key << " not found in hash table\n";
InfoInFunction << "Entry " << key << " not found in hash table\n";
}
# endif
#endif
return false;
}
......@@ -153,13 +152,12 @@ Foam::HashTable<T, Key, Hash>::find
}
}
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "HashTable<T, Key, Hash>::find(const Key& key) : "
<< "Entry " << key << " not found in hash table\n";
InfoInFunction << "Entry " << key << " not found in hash table\n";
}
# endif
#endif
return iterator();
}
......@@ -185,13 +183,12 @@ Foam::HashTable<T, Key, Hash>::find
}
}
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "HashTable<T, Key, Hash>::find(const Key& key) const : "
<< "Entry " << key << " not found in hash table\n";
InfoInFunction << "Entry " << key << " not found in hash table\n";
}
# endif
#endif
return const_iterator();
}
......@@ -250,7 +247,7 @@ bool Foam::HashTable<T, Key, Hash>::set
prev = ep;
}
// not found, insert it at the head
// Not found, insert it at the head
if (!existing)
{
table_[hashIdx] = new hashedEntry(key, table_[hashIdx], newEntry);
......@@ -258,39 +255,36 @@ bool Foam::HashTable<T, Key, Hash>::set
if (double(nElmts_)/tableSize_ > 0.8 && tableSize_ < maxTableSize)
{
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "HashTable<T, Key, Hash>::set"
"(const Key& key, T newEntry) : "
"Doubling table size\n";
InfoInFunction << "Doubling table size\n";
}
# endif
#endif
resize(2*tableSize_);
}
}
else if (protect)
{
// found - but protected from overwriting
// Found - but protected from overwriting
// this corresponds to the STL 'insert' convention
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "HashTable<T, Key, Hash>::set"
"(const Key& key, T newEntry, true) : "
"Cannot insert " << key << " already in hash table\n";
InfoInFunction
<< "Cannot insert " << key << " already in hash table\n";
}
# endif
#endif
return false;
}
else
{
// found - overwrite existing entry
// Found - overwrite existing entry
// this corresponds to the Perl convention
hashedEntry* ep = new hashedEntry(key, existing->next_, newEntry);
// replace existing element - within list or insert at the head
// Replace existing element - within list or insert at the head
if (prev)
{
prev->next_ = ep;
......@@ -310,7 +304,7 @@ bool Foam::HashTable<T, Key, Hash>::set
template<class T, class Key, class Hash>
bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
{
// note: entryPtr_ is NULL for end(), so this catches that too
// Note: entryPtr_ is NULL for end(), so this catches that too
if (entryPtr_)
{
// Search element before entryPtr_
......@@ -332,7 +326,7 @@ bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
if (prev)
{
// has an element before entryPtr - reposition to there
// Has an element before entryPtr - reposition to there
prev->next_ = entryPtr_->next_;
delete entryPtr_;
entryPtr_ = prev;
......@@ -343,7 +337,7 @@ bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
hashTable_->table_[hashIndex_] = entryPtr_->next_;
delete entryPtr_;
// assign any non-NULL pointer value so it doesn't look
// Assign any non-NULL pointer value so it doesn't look
// like end()/cend()
entryPtr_ = reinterpret_cast<hashedEntry*>(this);
......@@ -378,7 +372,7 @@ bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
template<class T, class Key, class Hash>
bool Foam::HashTable<T, Key, Hash>::erase(const iterator& iter)
{
// adjust iterator after erase
// Adjust iterator after erase
return const_cast<iterator&>(iter).erase();
}
......@@ -439,13 +433,12 @@ void Foam::HashTable<T, Key, Hash>::resize(const label sz)
if (newSize == tableSize_)
{
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "HashTable<T, Key, Hash>::resize(const label) : "
<< "new table size == old table size\n";
InfoInFunction << "New table size == old table size\n";
}
# endif
#endif
return;
}
......@@ -508,7 +501,7 @@ void Foam::HashTable<T, Key, Hash>::shrink()
if (newSize < tableSize_)
{
// avoid having the table disappear on us
// Avoid having the table disappear on us
resize(newSize ? newSize : 2);
}
}
......@@ -517,7 +510,7 @@ void Foam::HashTable<T, Key, Hash>::shrink()
template<class T, class Key, class Hash>
void Foam::HashTable<T, Key, Hash>::transfer(HashTable<T, Key, Hash>& ht)
{
// as per the Destructor
// As per the Destructor
if (table_)
{
clear();
......@@ -551,7 +544,7 @@ void Foam::HashTable<T, Key, Hash>::operator=
<< abort(FatalError);
}
// could be zero-sized from a previous transfer()
// Could be zero-sized from a previous transfer()
if (!tableSize_)
{
resize(rhs.tableSize_);
......@@ -574,7 +567,7 @@ bool Foam::HashTable<T, Key, Hash>::operator==
const HashTable<T, Key, Hash>& rhs
) const
{
// sizes (number of keys) must match
// Sizes (number of keys) must match
if (size() != rhs.size())
{
return false;
......
......@@ -39,12 +39,12 @@ Foam::label Foam::StaticHashTableCore::canonicalSize(const label size)
return 0;
}
// enforce power of two
// Enforce power of two
unsigned int goodSize = size;
if (goodSize & (goodSize - 1))
{
// brute-force is fast enough
// Brute-force is fast enough
goodSize = 1;
while (goodSize < unsigned(size))
{
......@@ -58,7 +58,6 @@ Foam::label Foam::StaticHashTableCore::canonicalSize(const label size)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct given initial table size
template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable(const label size)
:
......@@ -78,7 +77,6 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable(const label size)
}
// Construct as copy
template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
(
......@@ -137,13 +135,12 @@ bool Foam::StaticHashTable<T, Key, Hash>::found(const Key& key) const
}
}
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "StaticHashTable<T, Key, Hash>::found(const Key&) : "
<< "Entry " << key << " not found in hash table\n";
InfoInFunction << "Entry " << key << " not found in hash table\n";
}
# endif
#endif
return false;
}
......@@ -170,13 +167,12 @@ Foam::StaticHashTable<T, Key, Hash>::find
}
}
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "StaticHashTable<T, Key, Hash>::find(const Key&) : "
<< "Entry " << key << " not found in hash table\n";
InfoInFunction << "Entry " << key << " not found in hash table\n";
}
# endif
#endif
return end();
}
......@@ -203,19 +199,17 @@ Foam::StaticHashTable<T, Key, Hash>::find
}
}
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "StaticHashTable<T, Key, Hash>::find(const Key&) const : "
<< "Entry " << key << " not found in hash table\n";
InfoInFunction << "Entry " << key << " not found in hash table\n";
}
# endif
#endif
return cend();
}
// Return the table of contents
template<class T, class Key, class Hash>
Foam::List<Key> Foam::StaticHashTable<T, Key, Hash>::toc() const
{
......@@ -254,7 +248,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::set
if (existing == localKeys.size())
{
// not found, append
// Not found, append
List<T>& localObjects = objects_[hashIdx];
localKeys.setSize(existing+1);
......@@ -267,21 +261,20 @@ bool Foam::StaticHashTable<T, Key, Hash>::set
}
else if (protect)
{
// found - but protected from overwriting
// Found - but protected from overwriting
// this corresponds to the STL 'insert' convention
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "StaticHashTable<T, Key, Hash>::set"
"(const Key& key, T newEntry, true) : "
"Cannot insert " << key << " already in hash table\n";
InfoInFunction
<< "Cannot insert " << key << " already in hash table\n";
}
# endif
#endif
return false;
}
else
{
// found - overwrite existing entry
// Found - overwrite existing entry
// this corresponds to the Perl convention
objects_[hashIdx][existing] = newEntry;
}
......@@ -307,7 +300,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::erase(const iterator& cit)
localKeys.setSize(localKeys.size()-1);
localObjects.setSize(localObjects.size()-1);
// adjust iterator after erase
// Adjust iterator after erase
iterator& it = const_cast<iterator&>(cit);
it.elemIndex_--;
......@@ -321,25 +314,24 @@ bool Foam::StaticHashTable<T, Key, Hash>::erase(const iterator& cit)
nElmts_--;
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "StaticHashTable<T, Key, Hash>::erase(iterator&) : "
<< "hashedEntry removed.\n";
InfoInFunction << "hashedEntry removed.\n";
}
# endif
#endif
return true;
}
else
{
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "StaticHashTable<T, Key, Hash>::erase(iterator&) : "
<< "cannot remove hashedEntry from hash table\n";
InfoInFunction
<< "Cannot remove hashedEntry from hash table\n";
}
# endif
#endif
return false;
}
......@@ -391,13 +383,12 @@ void Foam::StaticHashTable<T, Key, Hash>::resize(const label sz)
if (newSize == keys_.size())
{
# ifdef FULLDEBUG
#ifdef FULLDEBUG
if (debug)
{
Info<< "StaticHashTable<T, Key, Hash>::resize(const label) : "
<< "new table size == old table size\n";
InfoInFunction << "New table size == old table size\n";
}
# endif
#endif
return;
}
......@@ -517,7 +508,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::operator==
const StaticHashTable<T, Key, Hash>& rhs
) const
{
// sizes (number of keys) must match
// Sizes (number of keys) must match
for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
{
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -31,7 +31,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(IFstream, 0);
defineTypeNameAndDebug(IFstream, 0);
}
......@@ -46,8 +46,7 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
{
if (IFstream::debug)
{
Info<< "IFstreamAllocator::IFstreamAllocator(const fileName&) : "
"cannot open null file " << endl;
InfoInFunction << "Cannot open null file " << endl;
}
}
......@@ -58,8 +57,7 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
{
if (IFstream::debug)
{
Info<< "IFstreamAllocator::IFstreamAllocator(const fileName&) : "
"decompressing " << pathname + ".gz" << endl;
InfoInFunction << "Decompressing " << pathname + ".gz" << endl;
}
delete ifPtr_;
......@@ -108,11 +106,8 @@ Foam::IFstream::IFstream
{
if (debug)
{
Info<< "IFstream::IFstream(const fileName&,"
"streamFormat=ASCII,"
"versionNumber=currentVersion) : "
"could not open file for input"
<< endl << info() << endl;
InfoInFunction
<< "Could not open file for input" << endl << info() << endl;
}
setBad();
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -49,8 +49,7 @@ Foam::OFstreamAllocator::OFstreamAllocator
{
if (OFstream::debug)
{
Info<< "OFstreamAllocator::OFstreamAllocator(const fileName&) : "
"cannot open null file " << endl;
InfoInFunction << "Cannot open null file " << endl;
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -42,8 +42,7 @@ Foam::instantList Foam::Time::findTimes
{
if (debug)
{
Info<< "Time::findTimes(const fileName&): finding times in directory "
<< directory << endl;
InfoInFunction << "Finding times in directory " << directory << endl;
}
// Read directory entries into a list
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -112,7 +112,7 @@ bool Foam::dictionary::read(Istream& is, const bool keepHeader)
if (is.bad())
{
Info<< "dictionary::read(Istream&, bool) : "
InfoInFunction
<< "Istream not OK after reading dictionary " << name()
<< endl;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -61,8 +61,8 @@ Foam::dlLibraryTable::~dlLibraryTable()
{
if (debug)
{
Info<< "dlLibraryTable::~dlLibraryTable() : closing "
<< libNames_[i]
InfoInFunction
<< "Closing " << libNames_[i]
<< " with handle " << uintptr_t(libPtrs_[i]) << endl;
}
dlClose(libPtrs_[i]);
......@@ -85,7 +85,8 @@ bool Foam::dlLibraryTable::open
if (debug)
{
Info<< "dlLibraryTable::open : opened " << functionLibName
InfoInFunction
<< "Opened " << functionLibName
<< " resulting in handle " << uintptr_t(functionLibPtr) << endl;
}
......@@ -134,7 +135,8 @@ bool Foam::dlLibraryTable::close
{
if (debug)
{
Info<< "dlLibraryTable::close : closing " << functionLibName
InfoInFunction
<< "Closing " << functionLibName
<< " with handle " << uintptr_t(libPtrs_[index]) << endl;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -28,15 +28,14 @@ License
#include "Time.H"
#include "Pstream.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::Istream& Foam::regIOobject::readStream()
{
if (IFstream::debug)
{
Info<< "regIOobject::readStream() : "
<< "reading object " << name()
InfoInFunction
<< "Reading object " << name()
<< " from file " << objectPath()
<< endl;
}
......@@ -112,8 +111,8 @@ Foam::Istream& Foam::regIOobject::readStream(const word& expectName)
{
if (IFstream::debug)
{
Info<< "regIOobject::readStream(const word&) : "
<< "reading object " << name()
InfoInFunction
<< "Reading object " << name()
<< " from file " << objectPath()
<< endl;
}
......@@ -149,8 +148,8 @@ void Foam::regIOobject::close()
{
if (IFstream::debug)
{
Info<< "regIOobject::close() : "
<< "finished reading " << filePath()
InfoInFunction
<< "Finished reading " << filePath()
<< endl;
}
......@@ -288,7 +287,8 @@ bool Foam::regIOobject::readIfModified()
if (modified())
{
const fileName& fName = time().getFile(watchIndex_);
Info<< "regIOobject::readIfModified() : " << nl
InfoInFunction
<< nl
<< " Re-reading object " << name()
<< " from file " << fName << endl;
return read();
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -74,8 +74,7 @@ bool Foam::regIOobject::writeObject
if (OFstream::debug)
{
Info<< "regIOobject::write() : "
<< "writing file " << objectPath();
InfoInFunction << "Writing file " << objectPath();
}
......