mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
resolving merge conflict
This commit is contained in:
@ -213,25 +213,13 @@ bool Foam::chDir(const fileName& dir)
|
||||
|
||||
Foam::fileName Foam::dotFoam(const fileName& name)
|
||||
{
|
||||
// Search for file 'name' in:
|
||||
// 1) ~/.OpenFOAM-VERSION/, ~/.OpenFOAM/VERSION/ or ~/.OpenFOAM/
|
||||
// 2) $WM_PROJECT_INST_DIR/site/VERSION or $WM_PROJECT_INST_DIR/site/
|
||||
// 3) $WM_PROJECT_DIR/etc/
|
||||
|
||||
// Search user files:
|
||||
// ~~~~~~~~~~~~~~~~~~
|
||||
// Check for user file in ~/.OpenFOAM-VERSION/
|
||||
fileName fullName = home()/(word(".OpenFOAM-") + FOAMversion)/name;
|
||||
if (exists(fullName))
|
||||
{
|
||||
return fullName;
|
||||
}
|
||||
|
||||
fileName searchDir = home()/".OpenFOAM";
|
||||
if (dir(searchDir))
|
||||
{
|
||||
// Check for user file in ~/.OpenFOAM/VERSION
|
||||
fullName = searchDir/FOAMversion/name;
|
||||
fileName fullName = searchDir/FOAMversion/name;
|
||||
if (exists(fullName))
|
||||
{
|
||||
return fullName;
|
||||
@ -252,7 +240,7 @@ Foam::fileName Foam::dotFoam(const fileName& name)
|
||||
if (dir(searchDir))
|
||||
{
|
||||
// Check for site file in $WM_PROJECT_INST_DIR/site/VERSION
|
||||
fullName = searchDir/"site"/FOAMversion/name;
|
||||
fileName fullName = searchDir/"site"/FOAMversion/name;
|
||||
if (exists(fullName))
|
||||
{
|
||||
return fullName;
|
||||
@ -272,14 +260,14 @@ Foam::fileName Foam::dotFoam(const fileName& name)
|
||||
if (dir(searchDir))
|
||||
{
|
||||
// Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc
|
||||
fullName = searchDir/"etc"/name;
|
||||
fileName fullName = searchDir/"etc"/name;
|
||||
if (exists(fullName))
|
||||
{
|
||||
return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing found
|
||||
// Not found
|
||||
return fileName::null;
|
||||
}
|
||||
|
||||
|
||||
@ -122,6 +122,7 @@ functionEntries = $(dictionary)/functionEntries
|
||||
$(functionEntries)/functionEntry/functionEntry.C
|
||||
$(functionEntries)/includeEntry/includeEntry.C
|
||||
$(functionEntries)/inputModeEntry/inputModeEntry.C
|
||||
$(functionEntries)/removeEntry/removeEntry.C
|
||||
|
||||
IOdictionary = db/IOobjects/IOdictionary
|
||||
$(IOdictionary)/IOdictionary.C
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/zlib-1.2.3
|
||||
-I$(WM_THIRD_PARTY_DIR)/zlib-1.2.3
|
||||
|
||||
LIB_LIBS = \
|
||||
$(FOAM_LIBBIN)/libOSspecific.o \
|
||||
|
||||
@ -329,12 +329,9 @@ public:
|
||||
// Writing
|
||||
|
||||
//- Write the standard OpenFOAM file/dictionary banner
|
||||
// Optionally without -*- C++ -*- editor hint (eg, for logs)
|
||||
template<class Stream>
|
||||
static inline void writeBanner(Stream& os);
|
||||
|
||||
//- Write the standard OpenFOAM log banner
|
||||
template<class Stream>
|
||||
static inline void writeLogBanner(Stream& os);
|
||||
static inline void writeBanner(Stream& os, bool noHint=false);
|
||||
|
||||
//- Write the standard file section divider
|
||||
template<class Stream>
|
||||
|
||||
@ -29,48 +29,34 @@ License
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Stream>
|
||||
inline void Foam::IOobject::writeBanner(Stream& os)
|
||||
inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
||||
{
|
||||
static bool spacesSet = false;
|
||||
static char spaces[80];
|
||||
static char spaces[40];
|
||||
|
||||
if (!spacesSet)
|
||||
{
|
||||
memset(spaces, ' ', 80);
|
||||
memset(spaces, ' ', 40);
|
||||
spaces[38 - strlen(Foam::FOAMversion)] = '\0';
|
||||
spacesSet = true;
|
||||
}
|
||||
|
||||
os <<
|
||||
"/*--------------------------------*- C++ -*----------------------------------*\\\n"
|
||||
"| ========= | |\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"
|
||||
"\\*---------------------------------------------------------------------------*/\n";
|
||||
}
|
||||
|
||||
|
||||
template<class Stream>
|
||||
inline void Foam::IOobject::writeLogBanner(Stream& os)
|
||||
{
|
||||
static bool spacesSet = false;
|
||||
static char spaces[80];
|
||||
|
||||
if (!spacesSet)
|
||||
if (noHint)
|
||||
{
|
||||
memset(spaces, ' ', 80);
|
||||
spaces[38 - strlen(Foam::FOAMversion)] = '\0';
|
||||
spacesSet = true;
|
||||
os <<
|
||||
"/*---------------------------------------------------------------------------*\\\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
os <<
|
||||
"/*--------------------------------*- C++ -*----------------------------------*\\\n";
|
||||
}
|
||||
|
||||
os <<
|
||||
"/*---------------------------------------------------------------------------*\\\n"
|
||||
"| ========= | |\n"
|
||||
"| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n"
|
||||
"| \\\\ / O peration | Version: " << FOAMversion << spaces << "|\n"
|
||||
"| \\\\ / A nd | Web: http://www.openfoam.org |\n"
|
||||
"| \\\\ / A nd | Web: http://www.OpenFOAM.org |\n"
|
||||
"| \\\\/ M anipulation | |\n"
|
||||
"\\*---------------------------------------------------------------------------*/\n";
|
||||
}
|
||||
|
||||
@ -37,8 +37,8 @@ bool Foam::IOobject::writeHeader(Ostream& os) const
|
||||
if (!os.good())
|
||||
{
|
||||
Info<< "IOobject::writeHeader(Ostream&) : "
|
||||
<< "no stream open for write"
|
||||
<< endl << os.info() << endl;
|
||||
<< "no stream open for write" << nl
|
||||
<< os.info() << endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -49,16 +49,14 @@ bool Foam::IOobject::writeHeader(Ostream& os) const
|
||||
<< " format " << os.format() << ";\n"
|
||||
<< " class " << type() << ";\n";
|
||||
|
||||
// outdent for visibility and more space
|
||||
if (note().size())
|
||||
{
|
||||
os << " note " << note() << ";\n";
|
||||
os << " note " << note() << ";\n";
|
||||
}
|
||||
|
||||
// writing without quotes would look nicer
|
||||
os << " object " << name() << ";\n"
|
||||
//<< " instance " << instance()/local() << ";\n"
|
||||
//<< " local " << local() << ";\n"
|
||||
<< " location " << instance()/local() << ";\n"
|
||||
os << " location " << instance()/local() << ";\n"
|
||||
<< " object " << name() << ";\n"
|
||||
<< "}" << nl;
|
||||
|
||||
writeDivider(os);
|
||||
|
||||
@ -34,74 +34,6 @@ defineTypeNameAndDebug(Foam::dictionary, 0);
|
||||
|
||||
const Foam::dictionary Foam::dictionary::null;
|
||||
|
||||
#define DICTIONARY_INPLACE_MERGE
|
||||
|
||||
// * * * * * * * * * * * * * Private member functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::dictionary::add(entry* ePtr, bool mergeEntry)
|
||||
{
|
||||
HashTable<entry*>::iterator iter = hashedEntries_.find(ePtr->keyword());
|
||||
|
||||
if (mergeEntry && iter != hashedEntries_.end())
|
||||
{
|
||||
// merge dictionary with dictionary
|
||||
if (iter()->isDict() && ePtr->isDict())
|
||||
{
|
||||
iter()->dict().merge(ePtr->dict());
|
||||
delete ePtr;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// replace existing dictionary with entry or vice versa
|
||||
#ifdef DICTIONARY_INPLACE_MERGE
|
||||
IDLList<entry>::replace(iter(), ePtr);
|
||||
delete iter();
|
||||
hashedEntries_.erase(iter);
|
||||
|
||||
if (hashedEntries_.insert(ePtr->keyword(), ePtr))
|
||||
{
|
||||
ePtr->name() = name_ + "::" + ePtr->keyword();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IOWarningIn("dictionary::add(entry* ePtr)", (*this))
|
||||
<< "problem replacing entry "<< ePtr->keyword()
|
||||
<< " in dictionary " << name()
|
||||
<< endl;
|
||||
|
||||
IDLList<entry>::remove(ePtr);
|
||||
delete ePtr;
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
remove(ePtr->keyword());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (hashedEntries_.insert(ePtr->keyword(), ePtr))
|
||||
{
|
||||
ePtr->name() = name_ + "::" + ePtr->keyword();
|
||||
IDLList<entry>::append(ePtr);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IOWarningIn("dictionary::add(entry* ePtr)", (*this))
|
||||
<< "attempt to add entry "<< ePtr->keyword()
|
||||
<< " which already exists in dictionary " << name()
|
||||
<< endl;
|
||||
|
||||
delete ePtr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dictionary::dictionary()
|
||||
@ -195,15 +127,15 @@ Foam::label Foam::dictionary::endLineNumber() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::found(const word& keyword, bool recusive) const
|
||||
bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
{
|
||||
if (hashedEntries_.found(keyword))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (recusive && &parent_ != &dictionary::null)
|
||||
else if (recursive && &parent_ != &dictionary::null)
|
||||
{
|
||||
return parent_.found(keyword, recusive);
|
||||
return parent_.found(keyword, recursive);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -215,16 +147,16 @@ bool Foam::dictionary::found(const word& keyword, bool recusive) const
|
||||
const Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
(
|
||||
const word& keyword,
|
||||
bool recusive
|
||||
bool recursive
|
||||
) const
|
||||
{
|
||||
HashTable<entry*>::const_iterator iter = hashedEntries_.find(keyword);
|
||||
|
||||
if (iter == hashedEntries_.end())
|
||||
{
|
||||
if (recusive && &parent_ != &dictionary::null)
|
||||
if (recursive && &parent_ != &dictionary::null)
|
||||
{
|
||||
return parent_.lookupEntryPtr(keyword, recusive);
|
||||
return parent_.lookupEntryPtr(keyword, recursive);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -239,19 +171,19 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
(
|
||||
const word& keyword,
|
||||
bool recusive
|
||||
bool recursive
|
||||
)
|
||||
{
|
||||
HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
|
||||
|
||||
if (iter == hashedEntries_.end())
|
||||
{
|
||||
if (recusive && &parent_ != &dictionary::null)
|
||||
if (recursive && &parent_ != &dictionary::null)
|
||||
{
|
||||
return const_cast<dictionary&>(parent_).lookupEntryPtr
|
||||
(
|
||||
keyword,
|
||||
recusive
|
||||
recursive
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -267,14 +199,13 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
const Foam::entry& Foam::dictionary::lookupEntry
|
||||
(
|
||||
const word& keyword,
|
||||
bool recusive
|
||||
bool recursive
|
||||
) const
|
||||
{
|
||||
const entry* ePtr = lookupEntryPtr(keyword, recusive);
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive);
|
||||
|
||||
if (ePtr == NULL)
|
||||
if (entryPtr == NULL)
|
||||
{
|
||||
// If keyword not found print error message ...
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dictionary::lookupEntry(const word& keyword) const",
|
||||
@ -284,23 +215,25 @@ const Foam::entry& Foam::dictionary::lookupEntry
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return *ePtr;
|
||||
return *entryPtr;
|
||||
}
|
||||
|
||||
|
||||
Foam::ITstream& Foam::dictionary::lookup
|
||||
(
|
||||
const word& keyword,
|
||||
bool recusive
|
||||
bool recursive
|
||||
) const
|
||||
{
|
||||
return lookupEntry(keyword, recusive).stream();
|
||||
return lookupEntry(keyword, recursive).stream();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::isDict(const word& keyword) const
|
||||
{
|
||||
if (const entry* entryPtr = lookupEntryPtr(keyword))
|
||||
const entry* entryPtr = lookupEntryPtr(keyword);
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
return entryPtr->isDict();
|
||||
}
|
||||
@ -313,7 +246,9 @@ bool Foam::dictionary::isDict(const word& keyword) const
|
||||
|
||||
const Foam::dictionary* Foam::dictionary::subDictPtr(const word& keyword) const
|
||||
{
|
||||
if (const entry* entryPtr = lookupEntryPtr(keyword))
|
||||
const entry* entryPtr = lookupEntryPtr(keyword);
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
return &entryPtr->dict();
|
||||
}
|
||||
@ -326,13 +261,9 @@ const Foam::dictionary* Foam::dictionary::subDictPtr(const word& keyword) const
|
||||
|
||||
const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
|
||||
{
|
||||
if (const entry* entryPtr = lookupEntryPtr(keyword))
|
||||
const entry* entryPtr = lookupEntryPtr(keyword);
|
||||
if (entryPtr == NULL)
|
||||
{
|
||||
return entryPtr->dict();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If keyword not found print error message ...
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dictionary::subDict(const word& keyword) const",
|
||||
@ -340,37 +271,31 @@ const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
|
||||
) << " keyword " << keyword << " is undefined in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return entryPtr->dict();
|
||||
}
|
||||
return entryPtr->dict();
|
||||
}
|
||||
|
||||
|
||||
Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
|
||||
{
|
||||
if (entry* entryPtr = lookupEntryPtr(keyword))
|
||||
entry* entryPtr = lookupEntryPtr(keyword);
|
||||
if (entryPtr == NULL)
|
||||
{
|
||||
return entryPtr->dict();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If keyword not found print error message ...
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dictionary::subDict(const word& keyword) const",
|
||||
"dictionary::subDict(const word& keyword)",
|
||||
*this
|
||||
) << " keyword " << keyword << " is undefined in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return entryPtr->dict();
|
||||
}
|
||||
return entryPtr->dict();
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::dictionary::toc() const
|
||||
{
|
||||
wordList keywords(size());
|
||||
wordList keys(size());
|
||||
|
||||
label i = 0;
|
||||
for
|
||||
@ -380,56 +305,124 @@ Foam::wordList Foam::dictionary::toc() const
|
||||
++iter
|
||||
)
|
||||
{
|
||||
keywords[i++] = iter().keyword();
|
||||
keys[i++] = iter().keyword();
|
||||
}
|
||||
|
||||
return keywords;
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
void Foam::dictionary::add(const entry& e)
|
||||
bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
{
|
||||
add(e.clone(*this).ptr());
|
||||
HashTable<entry*>::iterator iter = hashedEntries_.find(entryPtr->keyword());
|
||||
|
||||
if (mergeEntry && iter != hashedEntries_.end())
|
||||
{
|
||||
// merge dictionary with dictionary
|
||||
if (iter()->isDict() && entryPtr->isDict())
|
||||
{
|
||||
iter()->dict().merge(entryPtr->dict());
|
||||
delete entryPtr;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// replace existing dictionary with entry or vice versa
|
||||
IDLList<entry>::replace(iter(), entryPtr);
|
||||
delete iter();
|
||||
hashedEntries_.erase(iter);
|
||||
|
||||
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
||||
{
|
||||
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IOWarningIn("dictionary::add(entry*)", (*this))
|
||||
<< "problem replacing entry "<< entryPtr->keyword()
|
||||
<< " in dictionary " << name() << endl;
|
||||
|
||||
IDLList<entry>::remove(entryPtr);
|
||||
delete entryPtr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
||||
{
|
||||
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
||||
IDLList<entry>::append(entryPtr);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IOWarningIn("dictionary::add(entry* entryPtr)", (*this))
|
||||
<< "attempt to add entry "<< entryPtr->keyword()
|
||||
<< " which already exists in dictionary " << name()
|
||||
<< endl;
|
||||
|
||||
delete entryPtr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Foam::dictionary::add(const word& keyword, const token& t)
|
||||
|
||||
void Foam::dictionary::add(const entry& e, bool mergeEntry)
|
||||
{
|
||||
add(new primitiveEntry(keyword, t));
|
||||
add(e.clone(*this).ptr(), mergeEntry);
|
||||
}
|
||||
|
||||
void Foam::dictionary::add(const word& keyword, const word& w)
|
||||
void Foam::dictionary::add(const word& k, const word& w, bool overwrite)
|
||||
{
|
||||
add(new primitiveEntry(keyword, token(w)));
|
||||
add(new primitiveEntry(k, token(w)), overwrite);
|
||||
}
|
||||
|
||||
void Foam::dictionary::add(const word& keyword, const Foam::string& s)
|
||||
void Foam::dictionary::add(const word& k, const Foam::string& s, bool overwrite)
|
||||
{
|
||||
add(new primitiveEntry(keyword, token(s)));
|
||||
add(new primitiveEntry(k, token(s)), overwrite);
|
||||
}
|
||||
|
||||
void Foam::dictionary::add(const word& keyword, const label l)
|
||||
void Foam::dictionary::add(const word& k, const label l, bool overwrite)
|
||||
{
|
||||
add(new primitiveEntry(keyword, token(l)));
|
||||
add(new primitiveEntry(k, token(l)), overwrite);
|
||||
}
|
||||
|
||||
void Foam::dictionary::add(const word& keyword, const scalar s)
|
||||
void Foam::dictionary::add(const word& k, const scalar s, bool overwrite)
|
||||
{
|
||||
add(new primitiveEntry(keyword, token(s)));
|
||||
add(new primitiveEntry(k, token(s)), overwrite);
|
||||
}
|
||||
|
||||
void Foam::dictionary::add(const word& keyword, const ITstream& tokens)
|
||||
void Foam::dictionary::add(const word& k, const dictionary& d, bool mergeEntry)
|
||||
{
|
||||
add(new primitiveEntry(keyword, tokens));
|
||||
add(new dictionaryEntry(k, *this, d), mergeEntry);
|
||||
}
|
||||
|
||||
void Foam::dictionary::add(const word& keyword, const tokenList& tokens)
|
||||
|
||||
void Foam::dictionary::set(entry* entryPtr)
|
||||
{
|
||||
add(new primitiveEntry(keyword, tokens));
|
||||
entry* existingPtr = lookupEntryPtr(entryPtr->keyword());
|
||||
|
||||
// clear dictionary so merge acts like overwrite
|
||||
if (existingPtr && existingPtr->isDict())
|
||||
{
|
||||
existingPtr->dict().clear();
|
||||
}
|
||||
add(entryPtr, true);
|
||||
}
|
||||
|
||||
void Foam::dictionary::add(const word& keyword, const dictionary& dict)
|
||||
|
||||
void Foam::dictionary::set(const entry& e)
|
||||
{
|
||||
add(new dictionaryEntry(keyword, *this, dict));
|
||||
set(e.clone(*this).ptr());
|
||||
}
|
||||
|
||||
void Foam::dictionary::set(const word& k, const dictionary& d)
|
||||
{
|
||||
set(new dictionaryEntry(k, *this, d));
|
||||
}
|
||||
|
||||
|
||||
@ -486,7 +479,10 @@ bool Foam::dictionary::changeKeyword
|
||||
}
|
||||
else
|
||||
{
|
||||
// could issue warning if desired
|
||||
WarningIn("dictionary::changeKeyword(const word& old, const word& new)")
|
||||
<< "cannot rename keyword "<< oldKeyword
|
||||
<< " to existing keyword " << newKeyword
|
||||
<< " in dictionary " << name() << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -527,34 +523,24 @@ bool Foam::dictionary::merge(const dictionary& dict)
|
||||
if (iter2 != hashedEntries_.end())
|
||||
{
|
||||
// Recursively merge sub-dictionaries
|
||||
// TODO: merge without copying
|
||||
if (iter2()->isDict() && iter().isDict())
|
||||
{
|
||||
// without copying and without remove/add?
|
||||
// this certainly looks ugly and doesn't necessarily
|
||||
// retain the original sort order (perhaps nice to have)
|
||||
if
|
||||
(
|
||||
iter2()->dict().merge(iter().dict())
|
||||
)
|
||||
if (iter2()->dict().merge(iter().dict()))
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DICTIONARY_INPLACE_MERGE
|
||||
add(iter().clone(*this).ptr(), true);
|
||||
#else
|
||||
remove(keyword);
|
||||
add(iter().clone(*this)());
|
||||
#endif
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// not found - just add
|
||||
add(iter().clone(*this)());
|
||||
add(iter().clone(*this).ptr());
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@ -588,8 +574,8 @@ void Foam::dictionary::operator=(const dictionary& dict)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Clear the current entries
|
||||
IDLList<entry>::clear();
|
||||
name_ = dict.name();
|
||||
clear();
|
||||
|
||||
// Create clones of the entries in the given dictionary
|
||||
// resetting the parentDict to this dictionary
|
||||
@ -603,10 +589,6 @@ void Foam::dictionary::operator=(const dictionary& dict)
|
||||
IDLList<entry>::append(iter().clone(*this).ptr());
|
||||
}
|
||||
|
||||
name_ = dict.name();
|
||||
|
||||
hashedEntries_.clear();
|
||||
|
||||
for
|
||||
(
|
||||
IDLList<entry>::iterator iter = begin();
|
||||
@ -636,7 +618,7 @@ void Foam::dictionary::operator+=(const dictionary& dict)
|
||||
++iter
|
||||
)
|
||||
{
|
||||
add(iter().clone(*this)());
|
||||
add(iter().clone(*this).ptr());
|
||||
}
|
||||
}
|
||||
|
||||
@ -660,7 +642,7 @@ void Foam::dictionary::operator|=(const dictionary& dict)
|
||||
{
|
||||
if (!found(iter().keyword()))
|
||||
{
|
||||
add(iter().clone(*this)());
|
||||
add(iter().clone(*this).ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -683,8 +665,7 @@ void Foam::dictionary::operator<<=(const dictionary& dict)
|
||||
++iter
|
||||
)
|
||||
{
|
||||
remove(iter().keyword());
|
||||
add(iter().clone(*this)());
|
||||
set(iter().clone(*this).ptr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,8 +31,12 @@ Description
|
||||
|
||||
The dictionary class is the base class for IOdictionary.
|
||||
It serves the purpose of a bootstrap dictionary for the objectRegistry
|
||||
data dictionaries, since unlike the IOdictionary class, it does not use a
|
||||
objectRegistry itself to work.
|
||||
data dictionaries, since unlike the IOdictionary class, it does not use
|
||||
a objectRegistry itself to work.
|
||||
|
||||
ToDo
|
||||
A merge() member function with a non-const dictionary parameter.
|
||||
This would avoid unnecessary cloning in the add(entry*,bool) method
|
||||
|
||||
SourceFiles
|
||||
dictionary.C
|
||||
@ -171,31 +175,31 @@ public:
|
||||
// Search and lookup
|
||||
|
||||
//- Search dictionary for given keyword
|
||||
// If recusive search parent dictionaries
|
||||
bool found(const word& keyword, bool recusive=false) const;
|
||||
// If recursive search parent dictionaries
|
||||
bool found(const word& keyword, bool recursive=false) const;
|
||||
|
||||
//- Find and return an entry data stream pointer if present
|
||||
// otherwise return NULL.
|
||||
// If recusive search parent dictionaries
|
||||
const entry* lookupEntryPtr(const word&, bool recusive=false) const;
|
||||
// If recursive search parent dictionaries
|
||||
const entry* lookupEntryPtr(const word&, bool recursive=false) const;
|
||||
|
||||
//- Find and return an entry data stream pointer for manipulation
|
||||
// if present otherwise return NULL.
|
||||
// If recusive search parent dictionaries
|
||||
entry* lookupEntryPtr(const word&, bool recusive=false);
|
||||
// If recursive search parent dictionaries
|
||||
entry* lookupEntryPtr(const word&, bool recursive=false);
|
||||
|
||||
//- Find and return an entry data stream if present otherwise error.
|
||||
// If recusive search parent dictionaries
|
||||
const entry& lookupEntry(const word&, bool recusive=false) const;
|
||||
// If recursive search parent dictionaries
|
||||
const entry& lookupEntry(const word&, bool recursive=false) const;
|
||||
|
||||
//- Find and return an entry data stream
|
||||
// If recusive search parent dictionaries
|
||||
ITstream& lookup(const word&, bool recusive=false) const;
|
||||
// If recursive search parent dictionaries
|
||||
ITstream& lookup(const word&, bool recursive=false) const;
|
||||
|
||||
//- Find and return a T, if not found return the given default value
|
||||
// If recusive search parent dictionaries
|
||||
// If recursive search parent dictionaries
|
||||
template<class T>
|
||||
T lookupOrDefault(const word&, const T&, bool recusive=false) const;
|
||||
T lookupOrDefault(const word&, const T&, bool recursive=false) const;
|
||||
|
||||
//- Find and return a T, if not found return the given default value,
|
||||
// and add to dictionary. If recusive search parent dictionaries
|
||||
@ -236,38 +240,57 @@ public:
|
||||
// Editing
|
||||
|
||||
//- Add a new entry
|
||||
bool add(entry*, bool mergeEntry = false);
|
||||
// With the merge option, dictionaries are interwoven and
|
||||
// primitive entries are overwritten
|
||||
bool add(entry*, bool mergeEntry=false);
|
||||
|
||||
//- Add an entry
|
||||
void add(const entry&);
|
||||
|
||||
//- Add a token entry
|
||||
void add(const word& keyword, const token&);
|
||||
// With the merge option, dictionaries are interwoven and
|
||||
// primitive entries are overwritten
|
||||
void add(const entry&, bool mergeEntry=false);
|
||||
|
||||
//- Add a word entry
|
||||
void add(const word& keyword, const word&);
|
||||
// optionally overwrite an existing entry
|
||||
void add(const word& keyword, const word&, bool overwrite=false);
|
||||
|
||||
//- Add a string entry
|
||||
void add(const word& keyword, const string&);
|
||||
// optionally overwrite an existing entry
|
||||
void add(const word& keyword, const string&, bool overwrite=false);
|
||||
|
||||
//- Add a label entry
|
||||
void add(const word& keyword, const label);
|
||||
// optionally overwrite an existing entry
|
||||
void add(const word& keyword, const label, bool overwrite=false);
|
||||
|
||||
//- Add a scalar entry
|
||||
void add(const word& keyword, const scalar);
|
||||
|
||||
//- Add an entry constructed from a ITstream
|
||||
void add(const word& keyword, const ITstream&);
|
||||
|
||||
//- Add an entry constructed from a tokenList
|
||||
void add(const word& keyword, const tokenList& tokens);
|
||||
|
||||
//- Add a T entry
|
||||
template<class T>
|
||||
void add(const word& keyword, const T&);
|
||||
// optionally overwrite an existing entry
|
||||
void add (const word& keyword, const scalar, bool overwrite=false);
|
||||
|
||||
//- Add a dictionary entry
|
||||
void add(const word& keyword, const dictionary&);
|
||||
// optionally merge with an existing sub-dictionary
|
||||
void add
|
||||
(
|
||||
const word& keyword,
|
||||
const dictionary&,
|
||||
bool mergeEntry=false
|
||||
);
|
||||
|
||||
//- Add a T entry
|
||||
// optionally overwrite an existing entry
|
||||
template<class T>
|
||||
void add(const word& keyword, const T&, bool overwrite=false);
|
||||
|
||||
//- Assign a new entry, overwrite any existing entry
|
||||
void set(entry*);
|
||||
|
||||
//- Assign a new entry, overwrite any existing entry
|
||||
void set(const entry&);
|
||||
|
||||
//- Assign a dictionary entry, overwrite any existing entry
|
||||
void set(const word& keyword, const dictionary&);
|
||||
|
||||
//- Assign a T entry, overwrite any existing entry
|
||||
template<class T>
|
||||
void set(const word& keyword, const T&);
|
||||
|
||||
//- Remove an entry specified by keyword
|
||||
bool remove(const word& keyword);
|
||||
@ -326,14 +349,12 @@ public:
|
||||
|
||||
// Global Operators
|
||||
|
||||
// Combine dictionaries starting from the entries in dict one and then including
|
||||
// those from dict2.
|
||||
// Warn, but do not overwrite the entries from dict1.
|
||||
//- 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 dict one and then including
|
||||
// those from dict2.
|
||||
// Do not overwrite the entries from dict1.
|
||||
//- 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);
|
||||
|
||||
|
||||
|
||||
@ -33,19 +33,19 @@ template<class T>
|
||||
T Foam::dictionary::lookupOrDefault
|
||||
(
|
||||
const word& keyword,
|
||||
const T& deft,
|
||||
bool recusive
|
||||
const T& deflt,
|
||||
bool recursive
|
||||
) const
|
||||
{
|
||||
const entry* ePtr = lookupEntryPtr(keyword, recusive);
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive);
|
||||
|
||||
if (ePtr == NULL)
|
||||
if (entryPtr == NULL)
|
||||
{
|
||||
return deft;
|
||||
return deflt;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pTraits<T>(ePtr->stream());
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,12 +93,16 @@ void Foam::dictionary::readIfPresent
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::dictionary::add(const word& keyword, const T& t)
|
||||
void Foam::dictionary::add(const word& k, const T& t, bool overwrite)
|
||||
{
|
||||
entry* ePtr = new primitiveEntry(keyword, t);
|
||||
append(ePtr);
|
||||
hashedEntries_.insert(ePtr->keyword(), ePtr);
|
||||
add(new primitiveEntry(k, t), overwrite);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::dictionary::set(const word& k, const T& t)
|
||||
{
|
||||
set(new primitiveEntry(k, t));
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -96,7 +96,7 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
|
||||
if (keyword[0] == '#') // ... Function entry
|
||||
{
|
||||
word functionName = keyword(1, keyword.size()-1);
|
||||
return functionEntry::insert(functionName, parentDict, is);
|
||||
return functionEntry::execute(functionName, parentDict, is);
|
||||
}
|
||||
else if (keyword[0] == '$') // ... Substitution entry
|
||||
{
|
||||
@ -105,7 +105,7 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
|
||||
}
|
||||
else if (keyword == "include") // ... For backward compatibility
|
||||
{
|
||||
return functionEntries::includeEntry::insert(parentDict, is);
|
||||
return functionEntries::includeEntry::execute(parentDict, is);
|
||||
}
|
||||
else // ... Data entries
|
||||
{
|
||||
@ -114,12 +114,18 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
|
||||
|
||||
// Deal with duplicate entries
|
||||
bool mergeEntry = false;
|
||||
if (parentDict.found(keyword))
|
||||
|
||||
entry* existingPtr = parentDict.lookupEntryPtr(keyword);
|
||||
if (existingPtr)
|
||||
{
|
||||
if (functionEntries::inputModeEntry::overwrite())
|
||||
{
|
||||
// silently drop previous entries
|
||||
parentDict.remove(keyword);
|
||||
// clear dictionary so merge acts like overwrite
|
||||
if (existingPtr->isDict())
|
||||
{
|
||||
existingPtr->dict().clear();
|
||||
}
|
||||
mergeEntry = true;
|
||||
}
|
||||
else if (functionEntries::inputModeEntry::merge())
|
||||
{
|
||||
|
||||
@ -33,22 +33,66 @@ namespace Foam
|
||||
defineMemberFunctionSelectionTable
|
||||
(
|
||||
functionEntry,
|
||||
insert,
|
||||
primitiveEntryIstream
|
||||
execute,
|
||||
dictionaryIstream
|
||||
);
|
||||
|
||||
defineMemberFunctionSelectionTable
|
||||
(
|
||||
functionEntry,
|
||||
insert,
|
||||
dictionaryIstream
|
||||
execute,
|
||||
primitiveEntryIstream
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Member Function Selectors * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionEntry::insert
|
||||
bool Foam::functionEntry::execute
|
||||
(
|
||||
const word& functionName,
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
is.fatalCheck
|
||||
(
|
||||
"functionEntry::execute"
|
||||
"(const word& functionName, dictionary& parentDict, Istream& is)"
|
||||
);
|
||||
|
||||
if (!executedictionaryIstreamMemberFunctionTablePtr_)
|
||||
{
|
||||
cerr<<"functionEntry::execute"
|
||||
<< "(const word&, dictionary&, Istream&)"
|
||||
<< " not yet initialized, function = "
|
||||
<< functionName.c_str() << std::endl;
|
||||
|
||||
// Return true to keep reading
|
||||
return true;
|
||||
}
|
||||
|
||||
executedictionaryIstreamMemberFunctionTable::iterator mfIter =
|
||||
executedictionaryIstreamMemberFunctionTablePtr_->find(functionName);
|
||||
|
||||
if (mfIter == executedictionaryIstreamMemberFunctionTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"functionEntry::execute"
|
||||
"(const word& functionName, dictionary& parentDict, Istream&)"
|
||||
) << "Unknown functionEntry " << functionName
|
||||
<< endl << endl
|
||||
<< "Valid functionEntries are :" << endl
|
||||
<< executedictionaryIstreamMemberFunctionTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return mfIter()(parentDict, is);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionEntry::execute
|
||||
(
|
||||
const word& functionName,
|
||||
const dictionary& parentDict,
|
||||
@ -58,14 +102,14 @@ bool Foam::functionEntry::insert
|
||||
{
|
||||
is.fatalCheck
|
||||
(
|
||||
"functionEntry::insert"
|
||||
"functionEntry::execute"
|
||||
"(const word& functionName, const dictionary& parentDict, "
|
||||
"primitiveEntry& entry, Istream& is)"
|
||||
"primitiveEntry&, Istream&)"
|
||||
);
|
||||
|
||||
if (!insertprimitiveEntryIstreamMemberFunctionTablePtr_)
|
||||
if (!executeprimitiveEntryIstreamMemberFunctionTablePtr_)
|
||||
{
|
||||
cerr<<"functionEntry::insert"
|
||||
cerr<<"functionEntry::execute"
|
||||
<< "(const word&, dictionary&, primitiveEntry&, Istream&)"
|
||||
<< " not yet initialized, function = "
|
||||
<< functionName.c_str() << std::endl;
|
||||
@ -74,69 +118,24 @@ bool Foam::functionEntry::insert
|
||||
return true;
|
||||
}
|
||||
|
||||
insertprimitiveEntryIstreamMemberFunctionTable::iterator mfIter =
|
||||
insertprimitiveEntryIstreamMemberFunctionTablePtr_->find(functionName);
|
||||
executeprimitiveEntryIstreamMemberFunctionTable::iterator mfIter =
|
||||
executeprimitiveEntryIstreamMemberFunctionTablePtr_->find(functionName);
|
||||
|
||||
if (mfIter == insertprimitiveEntryIstreamMemberFunctionTablePtr_->end())
|
||||
if (mfIter == executeprimitiveEntryIstreamMemberFunctionTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"functionEntry::insert"
|
||||
"functionEntry::execute"
|
||||
"(const word& functionName, const dictionary& parentDict, "
|
||||
"primitiveEntry& entry, Istream& is)"
|
||||
"primitiveEntry&, Istream&)"
|
||||
) << "Unknown functionEntry " << functionName
|
||||
<< endl << endl
|
||||
<< "Valid functionEntries are :" << endl
|
||||
<< insertprimitiveEntryIstreamMemberFunctionTablePtr_->toc()
|
||||
<< executeprimitiveEntryIstreamMemberFunctionTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return mfIter()(parentDict, entry, is);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionEntry::insert
|
||||
(
|
||||
const word& functionName,
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
is.fatalCheck
|
||||
(
|
||||
"functionEntry::insert"
|
||||
"(const word& functionName, dictionary& parentDict, Istream& is)"
|
||||
);
|
||||
|
||||
if (!insertdictionaryIstreamMemberFunctionTablePtr_)
|
||||
{
|
||||
cerr<<"functionEntry::insert"
|
||||
<< "(const word&, dictionary&, Istream&)"
|
||||
<< " not yet initialized, function = "
|
||||
<< functionName.c_str() << std::endl;
|
||||
|
||||
// Return true to keep reading
|
||||
return true;
|
||||
}
|
||||
|
||||
insertdictionaryIstreamMemberFunctionTable::iterator mfIter =
|
||||
insertdictionaryIstreamMemberFunctionTablePtr_->find(functionName);
|
||||
|
||||
if (mfIter == insertdictionaryIstreamMemberFunctionTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"functionEntry::insert"
|
||||
"(const word& functionName, dictionary& parentDict, Istream& is)"
|
||||
) << "Unknown functionEntry " << functionName
|
||||
<< endl << endl
|
||||
<< "Valid functionEntries are :" << endl
|
||||
<< insertdictionaryIstreamMemberFunctionTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return mfIter()(parentDict, is);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -33,13 +33,10 @@ Class
|
||||
Foam::functionEntry
|
||||
|
||||
Description
|
||||
A function entry causes entries to be added/manipulated on the specified
|
||||
A functionEntry causes entries to be added/manipulated on the specified
|
||||
dictionary given an input stream.
|
||||
|
||||
In dictionaries, a @c \# sigil is typically used for a functionEntry.
|
||||
|
||||
See Also
|
||||
functionEntries::includeEntry and functionEntries::inputModeEntry
|
||||
In dictionaries, a @c '\#' sigil is typically used for a functionEntry.
|
||||
|
||||
SourceFiles
|
||||
functionEntry.C
|
||||
@ -84,7 +81,28 @@ public:
|
||||
(
|
||||
bool,
|
||||
functionEntry,
|
||||
insert,
|
||||
execute,
|
||||
dictionaryIstream,
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
),
|
||||
(parentDict, is)
|
||||
);
|
||||
|
||||
//- Execute the functionEntry in a sub-dict context
|
||||
static bool execute
|
||||
(
|
||||
const word& functionName,
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
);
|
||||
|
||||
declareMemberFunctionSelectionTable
|
||||
(
|
||||
bool,
|
||||
functionEntry,
|
||||
execute,
|
||||
primitiveEntryIstream,
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
@ -94,7 +112,8 @@ public:
|
||||
(parentDict, entry, is)
|
||||
);
|
||||
|
||||
static bool insert
|
||||
//- Execute the functionEntry in a primitiveEntry context
|
||||
static bool execute
|
||||
(
|
||||
const word& functionName,
|
||||
const dictionary& parentDict,
|
||||
@ -103,25 +122,6 @@ public:
|
||||
);
|
||||
|
||||
|
||||
declareMemberFunctionSelectionTable
|
||||
(
|
||||
bool,
|
||||
functionEntry,
|
||||
insert,
|
||||
dictionaryIstream,
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
),
|
||||
(parentDict, is)
|
||||
);
|
||||
|
||||
static bool insert
|
||||
(
|
||||
const word& functionName,
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -48,16 +48,16 @@ namespace functionEntries
|
||||
(
|
||||
functionEntry,
|
||||
includeEntry,
|
||||
insert,
|
||||
primitiveEntryIstream
|
||||
execute,
|
||||
dictionaryIstream
|
||||
);
|
||||
|
||||
addToMemberFunctionSelectionTable
|
||||
(
|
||||
functionEntry,
|
||||
includeEntry,
|
||||
insert,
|
||||
dictionaryIstream
|
||||
execute,
|
||||
primitiveEntryIstream
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,35 @@ Foam::fileName Foam::functionEntries::includeEntry::includeFileName
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionEntries::includeEntry::insert
|
||||
bool Foam::functionEntries::includeEntry::execute
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
IFstream fileStream(includeFileName(is));
|
||||
|
||||
if (fileStream)
|
||||
{
|
||||
parentDict.read(fileStream);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"functionEntries::includeEntry::includeEntry"
|
||||
"(dictionary& parentDict,Istream& is)",
|
||||
is
|
||||
) << "Cannot open include file " << fileStream.name()
|
||||
<< " while reading dictionary " << parentDict.name()
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Foam::functionEntries::includeEntry::execute
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry& entry,
|
||||
@ -111,34 +139,4 @@ bool Foam::functionEntries::includeEntry::insert
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionEntries::includeEntry::insert
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
IFstream fileStream(includeFileName(is));
|
||||
|
||||
if (fileStream)
|
||||
{
|
||||
parentDict.read(fileStream);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"functionEntries::includeEntry::includeEntry"
|
||||
"(dictionary& parentDict,Istream& is)",
|
||||
is
|
||||
) << "Cannot open include file " << fileStream.name()
|
||||
<< " while reading dictionary " << parentDict.name()
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -29,9 +29,9 @@ Description
|
||||
Specify an include file when reading dictionaries, expects a
|
||||
single string to follow.
|
||||
|
||||
An example of @c \#include directive:
|
||||
An example of the @c \#include directive:
|
||||
@verbatim
|
||||
\#include "includefile"
|
||||
#include "includeFile"
|
||||
@endverbatim
|
||||
|
||||
The usual expansion of environment variables and other constructs (eg,
|
||||
@ -85,18 +85,21 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
static bool insert
|
||||
//- Execute the functionEntry in a sub-dict context
|
||||
static bool execute
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
);
|
||||
|
||||
//- Execute the functionEntry in a primitiveEntry context
|
||||
static bool execute
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry& entry,
|
||||
Istream& is
|
||||
);
|
||||
|
||||
static bool insert
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -47,15 +47,7 @@ namespace functionEntries
|
||||
(
|
||||
functionEntry,
|
||||
inputModeEntry,
|
||||
insert,
|
||||
primitiveEntryIstream
|
||||
);
|
||||
|
||||
addToMemberFunctionSelectionTable
|
||||
(
|
||||
functionEntry,
|
||||
inputModeEntry,
|
||||
insert,
|
||||
execute,
|
||||
dictionaryIstream
|
||||
);
|
||||
}
|
||||
@ -63,10 +55,11 @@ namespace functionEntries
|
||||
|
||||
// * * * * * * * * * * * * * * * * Private Data * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::functionEntries::inputModeEntry::inputMode_ = imError;
|
||||
Foam::label Foam::functionEntries::inputModeEntry::mode_ = imError;
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// we could combine this into execute() directly, but leave it here for now
|
||||
void Foam::functionEntries::inputModeEntry::setMode(Istream& is)
|
||||
{
|
||||
clear();
|
||||
@ -74,15 +67,15 @@ void Foam::functionEntries::inputModeEntry::setMode(Istream& is)
|
||||
word mode(is);
|
||||
if (mode == "merge")
|
||||
{
|
||||
inputMode_ = imMerge;
|
||||
mode_ = imMerge;
|
||||
}
|
||||
else if (mode == "overwrite")
|
||||
{
|
||||
inputMode_ = imOverwrite;
|
||||
mode_ = imOverwrite;
|
||||
}
|
||||
else if (mode == "error" || mode == "default")
|
||||
{
|
||||
inputMode_ = imError;
|
||||
mode_ = imError;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -95,19 +88,7 @@ void Foam::functionEntries::inputModeEntry::setMode(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionEntries::inputModeEntry::insert
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry& entry,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
setMode(is);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionEntries::inputModeEntry::insert
|
||||
bool Foam::functionEntries::inputModeEntry::execute
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
@ -120,13 +101,13 @@ bool Foam::functionEntries::inputModeEntry::insert
|
||||
|
||||
void Foam::functionEntries::inputModeEntry::clear()
|
||||
{
|
||||
inputMode_ = imError;
|
||||
mode_ = imError;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionEntries::inputModeEntry::merge()
|
||||
{
|
||||
if (inputMode_ & imMerge)
|
||||
if (mode_ & imMerge)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -139,7 +120,7 @@ bool Foam::functionEntries::inputModeEntry::merge()
|
||||
|
||||
bool Foam::functionEntries::inputModeEntry::overwrite()
|
||||
{
|
||||
if (inputMode_ & imOverwrite)
|
||||
if (mode_ & imOverwrite)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -74,11 +74,12 @@ class inputModeEntry
|
||||
};
|
||||
|
||||
//- current input mode
|
||||
static label inputMode_;
|
||||
static label mode_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Read the mode as a word and set enum appropriately
|
||||
static void setMode(Istream&);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -96,23 +97,20 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
static bool insert
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry&,
|
||||
Istream&
|
||||
);
|
||||
|
||||
static bool insert
|
||||
//- Execute the functionEntry in a sub-dict context
|
||||
static bool execute
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream&
|
||||
);
|
||||
|
||||
//- Reset the inputMode to 'default'
|
||||
static void clear();
|
||||
|
||||
//- Return true if the inputMode is 'merge'
|
||||
static bool merge();
|
||||
|
||||
//- Return true if the inputMode is 'overwrite'
|
||||
static bool overwrite();
|
||||
|
||||
};
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "removeEntry.H"
|
||||
#include "dictionary.H"
|
||||
#include "IStringStream.H"
|
||||
#include "OStringStream.H"
|
||||
#include "addToMemberFunctionSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word Foam::functionEntries::removeEntry::typeName
|
||||
(
|
||||
Foam::functionEntries::removeEntry::typeName_()
|
||||
);
|
||||
|
||||
// Don't lookup the debug switch here as the debug switch dictionary
|
||||
// might include removeEntry
|
||||
int Foam::functionEntries::removeEntry::debug(0);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionEntries
|
||||
{
|
||||
addToMemberFunctionSelectionTable
|
||||
(
|
||||
functionEntry,
|
||||
removeEntry,
|
||||
execute,
|
||||
dictionaryIstream
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionEntries::removeEntry::execute
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
token currToken(is);
|
||||
is.putBack(currToken);
|
||||
|
||||
if (currToken == token::BEGIN_LIST)
|
||||
{
|
||||
wordList keys(is);
|
||||
|
||||
forAll(keys, keyI)
|
||||
{
|
||||
parentDict.remove(keys[keyI]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
word key(is);
|
||||
parentDict.remove(key);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Class
|
||||
Foam::functionEntries::removeEntry
|
||||
|
||||
Description
|
||||
Remove a dictionary entry.
|
||||
|
||||
The @c \#remove directive takes a word or a list of words. For example,
|
||||
@verbatim
|
||||
#remove entry0
|
||||
#remove ( entry1 entry2 entry3 )
|
||||
@endverbatim
|
||||
|
||||
The removable only occurs in the current context.
|
||||
Removing sub-entries or parent entries is not supported.
|
||||
|
||||
SourceFiles
|
||||
removeEntry.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef removeEntry_H
|
||||
#define removeEntry_H
|
||||
|
||||
#include "functionEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionEntries
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class removeEntry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class removeEntry
|
||||
:
|
||||
public functionEntry
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
removeEntry(const removeEntry&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const removeEntry&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("remove");
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Execute the functionEntry in a sub-dict context
|
||||
static bool execute
|
||||
(
|
||||
dictionary& parentDict,
|
||||
Istream& is
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionEntries
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -115,7 +115,7 @@ bool Foam::primitiveEntry::expandFunction
|
||||
)
|
||||
{
|
||||
word functionName = keyword(1, keyword.size()-1);
|
||||
return functionEntry::insert(functionName, parentDict, *this, is);
|
||||
return functionEntry::execute(functionName, parentDict, *this, is);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ Foam::argList::argList
|
||||
// Print the banner once only for parallel runs
|
||||
if (Pstream::master())
|
||||
{
|
||||
IOobject::writeLogBanner(Info);
|
||||
IOobject::writeBanner(Info, true);
|
||||
}
|
||||
|
||||
// convert argv -> args_ and capture ( ... ) lists
|
||||
@ -252,19 +252,30 @@ Foam::argList::argList
|
||||
|
||||
args_.setSize(nArgs);
|
||||
|
||||
// Help options:
|
||||
// -doc display the documentation in browser
|
||||
// -help print the usage
|
||||
if (options_.found("doc") || options_.found("help"))
|
||||
// Help/documentation options:
|
||||
// -help print the usage
|
||||
// -doc display application documentation in browser
|
||||
// -srcDoc display source code in browser
|
||||
if
|
||||
(
|
||||
options_.found("help")
|
||||
|| options_.found("doc")
|
||||
|| options_.found("srcDoc")
|
||||
)
|
||||
{
|
||||
if (options_.found("help"))
|
||||
{
|
||||
printUsage();
|
||||
}
|
||||
|
||||
if (options_.found("doc"))
|
||||
// only display one or the other
|
||||
if (options_.found("srcDoc"))
|
||||
{
|
||||
displayDoc();
|
||||
displayDoc(true);
|
||||
}
|
||||
else if (options_.found("doc"))
|
||||
{
|
||||
displayDoc(false);
|
||||
}
|
||||
|
||||
::exit(0);
|
||||
@ -578,12 +589,9 @@ void Foam::argList::printUsage() const
|
||||
++iter
|
||||
)
|
||||
{
|
||||
Info<< ' ' << '<' << iter().c_str() << '>';
|
||||
Info<< " <" << iter().c_str() << '>';
|
||||
}
|
||||
|
||||
// place -doc and -help up front
|
||||
Info<< " [-doc] [-help]";
|
||||
|
||||
for
|
||||
(
|
||||
HashTable<string>::iterator iter = validOptions.begin();
|
||||
@ -601,16 +609,27 @@ void Foam::argList::printUsage() const
|
||||
Info<< ']';
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
// place help/doc options of the way at the end,
|
||||
// but with an extra space to separate it a little
|
||||
Info<< " [-help] [-doc] [-srcDoc]" << endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::displayDoc() const
|
||||
void Foam::argList::displayDoc(bool source) const
|
||||
{
|
||||
const dictionary& docDict = debug::controlDict().subDict("Documentation");
|
||||
List<fileName> docDirs(docDict.lookup("doxyDocDirs"));
|
||||
List<fileName> docExts(docDict.lookup("doxySourceFileExts"));
|
||||
|
||||
// for source code: change foo_8C.html to foo_8C-source.html
|
||||
if (source)
|
||||
{
|
||||
forAll(docExts, extI)
|
||||
{
|
||||
docExts[extI].replace(".", "-source.");
|
||||
}
|
||||
}
|
||||
|
||||
fileName docFile;
|
||||
bool found = false;
|
||||
|
||||
@ -618,7 +637,7 @@ void Foam::argList::displayDoc() const
|
||||
{
|
||||
forAll(docExts, extI)
|
||||
{
|
||||
docFile = docDirs[dirI]/executable() + docExts[extI];
|
||||
docFile = docDirs[dirI]/executable_ + docExts[extI];
|
||||
docFile.expand();
|
||||
|
||||
if (exists(docFile))
|
||||
|
||||
@ -27,18 +27,18 @@ Class
|
||||
|
||||
Description
|
||||
Extract command arguments and options from the supplied
|
||||
@a argc and @a argv.
|
||||
@a argc and @a argv parameters.
|
||||
|
||||
Sequences with "(" ... ")" are transformed into a stringList.
|
||||
For example,
|
||||
@verbatim
|
||||
program -listFiles \( *.txt \)
|
||||
@endverbatim
|
||||
in which the backslash-escaping has been used to avoid shell expansions,
|
||||
would create a stringList:
|
||||
@verbatim
|
||||
( "file1.txt" "file2.txt" ... "fileN.txt" )
|
||||
@endverbatim
|
||||
The backslash-escaping has been used to avoid shell expansions.
|
||||
|
||||
@par Default command-line options
|
||||
@param -case \<dir\> \n
|
||||
@ -47,6 +47,8 @@ Description
|
||||
specify case as a parallel job
|
||||
@param -doc \n
|
||||
display the documentation in browser
|
||||
@param -srcDoc \n
|
||||
display the source documentation in browser
|
||||
@param -help \n
|
||||
print the usage
|
||||
|
||||
@ -130,14 +132,14 @@ public:
|
||||
//- A list of valid parallel options
|
||||
static HashTable<string> validParOptions;
|
||||
|
||||
//! @cond ignore documentation for this class
|
||||
//! @cond ignoreDocumentation
|
||||
class initValidTables
|
||||
{
|
||||
public:
|
||||
|
||||
initValidTables();
|
||||
};
|
||||
//! @endcond
|
||||
//! @endcond ignoreDocumentation
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -148,8 +150,8 @@ public:
|
||||
(
|
||||
int& argc,
|
||||
char**& argv,
|
||||
bool checkArgs = true,
|
||||
bool checkOpts = true
|
||||
bool checkArgs=true,
|
||||
bool checkOpts=true
|
||||
);
|
||||
|
||||
|
||||
@ -196,8 +198,7 @@ public:
|
||||
return globalCase_;
|
||||
}
|
||||
|
||||
//- Return case name for parallel run
|
||||
// or the global case for a serial run
|
||||
//- Return case name for parallel run or the global case for a serial run
|
||||
const fileName& caseName() const
|
||||
{
|
||||
return case_;
|
||||
@ -222,13 +223,14 @@ public:
|
||||
void printUsage() const;
|
||||
|
||||
//- Display documentation in browser
|
||||
void displayDoc() const;
|
||||
// Optionally display the application source code
|
||||
void displayDoc(bool source=false) const;
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
//- Check argument list
|
||||
bool check(bool checkArgs = true, bool checkOpts = true) const;
|
||||
bool check(bool checkArgs=true, bool checkOpts=true) const;
|
||||
|
||||
//- Check root path and case path
|
||||
bool checkRootCase() const;
|
||||
|
||||
@ -89,8 +89,6 @@ bool chDir(const fileName& dir);
|
||||
|
||||
//- Search for @em name in the following hierarchy:
|
||||
// -# personal settings:
|
||||
// - ~/.OpenFOAM-\<VERSION\>
|
||||
// <em>(old style)</em>
|
||||
// - ~/.OpenFOAM/\<VERSION\>/
|
||||
// <em>for version-specific files</em>
|
||||
// - ~/.OpenFOAM/
|
||||
|
||||
@ -73,8 +73,7 @@ void Foam::processorLduInterface::send
|
||||
else
|
||||
{
|
||||
FatalErrorIn("processorLduInterface::send")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[commsType]
|
||||
<< "Unsupported communications type " << commsType
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -104,8 +103,7 @@ void Foam::processorLduInterface::receive
|
||||
else
|
||||
{
|
||||
FatalErrorIn("processorLduInterface::receive")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[commsType]
|
||||
<< "Unsupported communications type " << commsType
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -184,8 +182,7 @@ void Foam::processorLduInterface::compressedSend
|
||||
else
|
||||
{
|
||||
FatalErrorIn("processorLduInterface::compressedSend")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[commsType]
|
||||
<< "Unsupported communications type " << commsType
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -225,8 +222,7 @@ void Foam::processorLduInterface::compressedReceive
|
||||
else if (commsType != Pstream::nonBlocking)
|
||||
{
|
||||
FatalErrorIn("processorLduInterface::compressedReceive")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[commsType]
|
||||
<< "Unsupported communications type " << commsType
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,10 @@ wmake libso dummy
|
||||
case "$WM_MPLIB" in
|
||||
LAM | OPENMPI | MPI | MPICH | MPICH-GM | MPIGAMMA )
|
||||
export WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB
|
||||
set +x
|
||||
echo
|
||||
echo "Note: ignore spurious warnings about missing mpicxx.h headers"
|
||||
set -x
|
||||
wmake libso mpi
|
||||
;;
|
||||
|
||||
|
||||
@ -32,12 +32,9 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||
|
||||
IPstream::IPstream
|
||||
Foam::IPstream::IPstream
|
||||
(
|
||||
const commsTypes commsType,
|
||||
const int fromProcNo,
|
||||
@ -53,13 +50,12 @@ IPstream::IPstream
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"IPstream::IPstream"
|
||||
"IPsream::IPstream"
|
||||
"("
|
||||
"const commsTypes commsType,"
|
||||
"const int fromProcNo,"
|
||||
"const commsTypes,"
|
||||
"const int fromProcNo,"
|
||||
"const label bufSize,"
|
||||
"streamFormat format,"
|
||||
"versionNumber version"
|
||||
"streamFormat, versionNumber"
|
||||
")"
|
||||
);
|
||||
}
|
||||
@ -67,7 +63,7 @@ IPstream::IPstream
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
int IPstream::read
|
||||
int Foam::IPstream::read
|
||||
(
|
||||
const commsTypes commsType,
|
||||
const int fromProcNo,
|
||||
@ -75,33 +71,32 @@ int IPstream::read
|
||||
const std::streamsize bufSize
|
||||
)
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"IPstream::read"
|
||||
"("
|
||||
"const commsTypes commsType,"
|
||||
"const int fromProcNo,"
|
||||
"char* buf,"
|
||||
"const label bufSize"
|
||||
")"
|
||||
notImplemented
|
||||
(
|
||||
"IPstream::read"
|
||||
"("
|
||||
"const commsTypes,"
|
||||
"const int fromProcNo,"
|
||||
"char* buf,"
|
||||
"const label bufSize"
|
||||
")"
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void IPstream::waitRequests()
|
||||
void Foam::IPstream::waitRequests()
|
||||
{}
|
||||
|
||||
|
||||
bool IPstream::finishedRequest(const label)
|
||||
bool Foam::IPstream::finishedRequest(const label)
|
||||
{
|
||||
notImplemented("IPstream::finishedRequest()");
|
||||
notImplemented("IPstream::finishedRequest()");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -32,12 +32,9 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
OPstream::~OPstream()
|
||||
Foam::OPstream::~OPstream()
|
||||
{
|
||||
notImplemented("OPstream::~OPstream()");
|
||||
}
|
||||
@ -45,7 +42,7 @@ OPstream::~OPstream()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool OPstream::write
|
||||
bool Foam::OPstream::write
|
||||
(
|
||||
const commsTypes commsType,
|
||||
const int toProcNo,
|
||||
@ -68,11 +65,11 @@ bool OPstream::write
|
||||
}
|
||||
|
||||
|
||||
void OPstream::waitRequests()
|
||||
void Foam::OPstream::waitRequests()
|
||||
{}
|
||||
|
||||
|
||||
bool OPstream::finishedRequest(const label)
|
||||
bool Foam::OPstream::finishedRequest(const label)
|
||||
{
|
||||
notImplemented("OPstream::finishedRequest()");
|
||||
return false;
|
||||
@ -81,6 +78,4 @@ bool OPstream::finishedRequest(const label)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -29,16 +29,13 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Pstream::addValidParOptions(HashTable<string>& validParOptions)
|
||||
void Foam::Pstream::addValidParOptions(HashTable<string>& validParOptions)
|
||||
{}
|
||||
|
||||
|
||||
bool Pstream::init(int& argc, char**& argv)
|
||||
bool Foam::Pstream::init(int& argc, char**& argv)
|
||||
{
|
||||
FatalErrorIn("Pstream::init(int& argc, char**& argv)")
|
||||
<< "Trying to use the dummy Pstream library." << nl
|
||||
@ -49,24 +46,21 @@ bool Pstream::init(int& argc, char**& argv)
|
||||
}
|
||||
|
||||
|
||||
void Pstream::exit(int errnum)
|
||||
void Foam::Pstream::exit(int errnum)
|
||||
{
|
||||
notImplemented("Pstream::exit(int errnum)");
|
||||
}
|
||||
|
||||
|
||||
void Pstream::abort()
|
||||
void Foam::Pstream::abort()
|
||||
{
|
||||
notImplemented("Pstream::abort()");
|
||||
}
|
||||
|
||||
|
||||
void reduce(scalar&, const sumOp<scalar>&)
|
||||
void Foam::reduce(scalar&, const sumOp<scalar>&)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Write primitive and binary block from OPstream
|
||||
Write primitive and binary block from OPstream gamma-mpi
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -46,8 +46,10 @@ namespace Foam
|
||||
|
||||
// Largest message sent so far. This tracks the size of the receive
|
||||
// buffer on the receiving end. Done so we only send out resize messages
|
||||
// if nessecary
|
||||
// if necessary
|
||||
//! @cond fileScope
|
||||
labelList maxSendSize;
|
||||
//! @endcond fileScope
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -26,7 +26,8 @@ Namespace
|
||||
Foam::PstreamGlobals
|
||||
|
||||
Description
|
||||
Global functions and variables for working with parallel streams.
|
||||
Global functions and variables for working with parallel streams,
|
||||
but principally for gamma/mpi
|
||||
|
||||
SourceFiles
|
||||
PstreamGlobals.C
|
||||
|
||||
@ -33,18 +33,16 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
// Outstanding non-blocking operations.
|
||||
DynamicList<MPI_Request> IPstream_outstandingRequests_;
|
||||
|
||||
//! @cond fileScope
|
||||
Foam::DynamicList<MPI_Request> IPstream_outstandingRequests_;
|
||||
//! @endcond fileScope
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||
|
||||
IPstream::IPstream
|
||||
Foam::IPstream::IPstream
|
||||
(
|
||||
const commsTypes commsType,
|
||||
const int fromProcNo,
|
||||
@ -89,7 +87,7 @@ IPstream::IPstream
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
label IPstream::read
|
||||
Foam::label Foam::IPstream::read
|
||||
(
|
||||
const commsTypes commsType,
|
||||
const int fromProcNo,
|
||||
@ -192,7 +190,7 @@ label IPstream::read
|
||||
}
|
||||
|
||||
|
||||
void IPstream::waitRequests()
|
||||
void Foam::IPstream::waitRequests()
|
||||
{
|
||||
if (IPstream_outstandingRequests_.size() > 0)
|
||||
{
|
||||
@ -219,7 +217,7 @@ void IPstream::waitRequests()
|
||||
}
|
||||
|
||||
|
||||
bool IPstream::finishedRequest(const label i)
|
||||
bool Foam::IPstream::finishedRequest(const label i)
|
||||
{
|
||||
if (i >= IPstream_outstandingRequests_.size())
|
||||
{
|
||||
@ -244,6 +242,4 @@ bool IPstream::finishedRequest(const label i)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -31,20 +31,16 @@ Description
|
||||
|
||||
#include "OPstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
// Outstanding non-blocking operations.
|
||||
DynamicList<MPI_Request> OPstream_outstandingRequests_;
|
||||
|
||||
//! @cond fileScope
|
||||
Foam::DynamicList<MPI_Request> OPstream_outstandingRequests_;
|
||||
//! @endcond fileScope
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
OPstream::~OPstream()
|
||||
Foam::OPstream::~OPstream()
|
||||
{
|
||||
if
|
||||
(
|
||||
@ -66,7 +62,7 @@ OPstream::~OPstream()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool OPstream::write
|
||||
bool Foam::OPstream::write
|
||||
(
|
||||
const commsTypes commsType,
|
||||
const int toProcNo,
|
||||
@ -80,7 +76,7 @@ bool OPstream::write
|
||||
{
|
||||
transferFailed = MPI_Bsend
|
||||
(
|
||||
(char*)buf,
|
||||
const_cast<char*>(buf),
|
||||
bufSize,
|
||||
MPI_PACKED,
|
||||
procID(toProcNo),
|
||||
@ -92,7 +88,7 @@ bool OPstream::write
|
||||
{
|
||||
transferFailed = MPI_Send
|
||||
(
|
||||
(char*)buf,
|
||||
const_cast<char*>(buf),
|
||||
bufSize,
|
||||
MPI_PACKED,
|
||||
procID(toProcNo),
|
||||
@ -106,7 +102,7 @@ bool OPstream::write
|
||||
|
||||
transferFailed = MPI_Isend
|
||||
(
|
||||
(char*)buf,
|
||||
const_cast<char*>(buf),
|
||||
bufSize,
|
||||
MPI_PACKED,
|
||||
procID(toProcNo),
|
||||
@ -132,7 +128,7 @@ bool OPstream::write
|
||||
}
|
||||
|
||||
|
||||
void OPstream::waitRequests()
|
||||
void Foam::OPstream::waitRequests()
|
||||
{
|
||||
if (OPstream_outstandingRequests_.size() > 0)
|
||||
{
|
||||
@ -159,7 +155,7 @@ void OPstream::waitRequests()
|
||||
}
|
||||
|
||||
|
||||
bool OPstream::finishedRequest(const label i)
|
||||
bool Foam::OPstream::finishedRequest(const label i)
|
||||
{
|
||||
if (i >= OPstream_outstandingRequests_.size())
|
||||
{
|
||||
@ -184,6 +180,4 @@ bool OPstream::finishedRequest(const label i)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -42,12 +42,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Pstream::addValidParOptions(HashTable<string>& validParOptions)
|
||||
// NOTE:
|
||||
// valid parallel options vary between implementations, but flag common ones.
|
||||
// if they are not removed by MPI_Init(), the subsequent argument processing
|
||||
// will notice that they are wrong
|
||||
void Foam::Pstream::addValidParOptions(HashTable<string>& validParOptions)
|
||||
{
|
||||
validParOptions.insert("np", "");
|
||||
validParOptions.insert("p4pg", "PI file");
|
||||
@ -59,7 +61,7 @@ void Pstream::addValidParOptions(HashTable<string>& validParOptions)
|
||||
}
|
||||
|
||||
|
||||
bool Pstream::init(int& argc, char**& argv)
|
||||
bool Foam::Pstream::init(int& argc, char**& argv)
|
||||
{
|
||||
MPI_Init(&argc, &argv);
|
||||
|
||||
@ -119,7 +121,7 @@ bool Pstream::init(int& argc, char**& argv)
|
||||
}
|
||||
|
||||
|
||||
void Pstream::exit(int errnum)
|
||||
void Foam::Pstream::exit(int errnum)
|
||||
{
|
||||
# ifndef SGIMPI
|
||||
int size;
|
||||
@ -140,13 +142,13 @@ void Pstream::exit(int errnum)
|
||||
}
|
||||
|
||||
|
||||
void Pstream::abort()
|
||||
void Foam::Pstream::abort()
|
||||
{
|
||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
}
|
||||
|
||||
|
||||
void reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
@ -426,6 +428,4 @@ void reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -653,7 +653,7 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
const edge& e = mesh().edges()[edgeI];
|
||||
|
||||
// Check if there is any cell using this edge.
|
||||
if (debug & findCutCell(cuts, mesh().edgeCells()[edgeI]) == -1)
|
||||
if (debug && findCutCell(cuts, mesh().edgeCells()[edgeI]) == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
|
||||
@ -601,7 +601,7 @@ void Foam::meshCutter::setRefinement
|
||||
const edge& e = mesh().edges()[edgeI];
|
||||
|
||||
// Check if there is any cell using this edge.
|
||||
if (debug & findCutCell(cuts, mesh().edgeCells()[edgeI]) == -1)
|
||||
if (debug && findCutCell(cuts, mesh().edgeCells()[edgeI]) == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
|
||||
@ -140,7 +140,7 @@ Foam::sampledPatch::sampledPatch
|
||||
patchFaceLabels_(0)
|
||||
{
|
||||
// default: non-triangulated
|
||||
triangulate() = getBool(dict, "triangulate", false);
|
||||
triangulate() = dict.lookupOrDefault("triangulate", false);
|
||||
createGeometry();
|
||||
}
|
||||
|
||||
|
||||
@ -151,25 +151,6 @@ Foam::sampledSurface::New
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::sampledSurface::getBool
|
||||
(
|
||||
const dictionary& dict,
|
||||
const word& key,
|
||||
const bool defaultVal
|
||||
)
|
||||
{
|
||||
if (dict.found(key))
|
||||
{
|
||||
return readBool(dict.lookup(key));
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultVal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sampledSurface::sampledSurface
|
||||
@ -200,8 +181,8 @@ Foam::sampledSurface::sampledSurface
|
||||
:
|
||||
name_(name),
|
||||
mesh_(mesh),
|
||||
triangulate_(getBool(dict, "triangulate", true)),
|
||||
interpolate_(getBool(dict, "interpolate", false)),
|
||||
triangulate_(dict.lookupOrDefault("triangulate", true)),
|
||||
interpolate_(dict.lookupOrDefault("interpolate", false)),
|
||||
SfPtr_(NULL),
|
||||
magSfPtr_(NULL),
|
||||
CfPtr_(NULL),
|
||||
|
||||
@ -128,11 +128,6 @@ class sampledSurface
|
||||
|
||||
protected:
|
||||
|
||||
// Protected static functions
|
||||
|
||||
//- Read bool from dictionary. Return provided value if not found
|
||||
static bool getBool(const dictionary&, const word&, const bool);
|
||||
|
||||
// Protected Member functions
|
||||
|
||||
virtual void clearGeom() const;
|
||||
|
||||
Reference in New Issue
Block a user