mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge remote-tracking branch 'origin/develop' into develop-pre-release
This commit is contained in:
@ -14,8 +14,8 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#includeIfPresent "someUnknownFile"
|
#sinclude "someUnknownFile"
|
||||||
#includeIfPresent "$FOAM_CASE/someUnknownFile"
|
#sinclude "$FOAM_CASE/someUnknownFile"
|
||||||
#includeIfPresent "$FOAM_CASE/someUnknownFile-$FOAM_CASENAME"
|
#includeIfPresent "$FOAM_CASE/someUnknownFile-$FOAM_CASENAME"
|
||||||
|
|
||||||
internalField uniform 1;
|
internalField uniform 1;
|
||||||
|
|||||||
@ -59,7 +59,7 @@ Usage
|
|||||||
the resulting dictionary to standard output.
|
the resulting dictionary to standard output.
|
||||||
|
|
||||||
- \par -includes
|
- \par -includes
|
||||||
List the \c \#include and \c \#includeIfPresent files to standard output
|
List the \c \#include and \c \#sinclude files to standard output
|
||||||
|
|
||||||
- \par -disableFunctionEntries
|
- \par -disableFunctionEntries
|
||||||
Do not expand macros or directives (\#include etc)
|
Do not expand macros or directives (\#include etc)
|
||||||
@ -307,7 +307,7 @@ int main(int argc, char *argv[])
|
|||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"includes",
|
"includes",
|
||||||
"List the #include/#includeIfPresent files to standard output"
|
"List the #include/#sinclude files to standard output"
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
|
|||||||
@ -49,6 +49,11 @@ alias util 'cd $FOAM_UTILITIES'
|
|||||||
alias tut 'cd $FOAM_TUTORIALS'
|
alias tut 'cd $FOAM_TUTORIALS'
|
||||||
alias run 'cd $FOAM_RUN'
|
alias run 'cd $FOAM_RUN'
|
||||||
|
|
||||||
|
alias ufoam 'cd $WM_PROJECT_USER_DIR'
|
||||||
|
alias uapp 'cd $WM_PROJECT_USER_DIR/applications'
|
||||||
|
alias usol 'cd $WM_PROJECT_USER_DIR/applications/solvers'
|
||||||
|
alias uutil 'cd $WM_PROJECT_USER_DIR/applications/utilities'
|
||||||
|
|
||||||
|
|
||||||
# Refresh the environment
|
# Refresh the environment
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|||||||
@ -175,6 +175,11 @@ unalias util
|
|||||||
unalias tut
|
unalias tut
|
||||||
unalias run
|
unalias run
|
||||||
|
|
||||||
|
unalias ufoam
|
||||||
|
unalias uapp
|
||||||
|
unalias usol
|
||||||
|
unalias uutil
|
||||||
|
|
||||||
unalias wmRefresh
|
unalias wmRefresh
|
||||||
unalias foamVersion
|
unalias foamVersion
|
||||||
unalias foamPV
|
unalias foamPV
|
||||||
|
|||||||
@ -47,6 +47,11 @@ alias util='cd $FOAM_UTILITIES'
|
|||||||
alias tut='cd $FOAM_TUTORIALS'
|
alias tut='cd $FOAM_TUTORIALS'
|
||||||
alias run='cd $FOAM_RUN'
|
alias run='cd $FOAM_RUN'
|
||||||
|
|
||||||
|
alias ufoam='cd $WM_PROJECT_USER_DIR'
|
||||||
|
alias uapp='cd $WM_PROJECT_USER_DIR/applications'
|
||||||
|
alias usol='cd $WM_PROJECT_USER_DIR/applications/solvers'
|
||||||
|
alias uutil='cd $WM_PROJECT_USER_DIR/applications/utilities'
|
||||||
|
|
||||||
|
|
||||||
# Refresh the environment
|
# Refresh the environment
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -106,4 +111,22 @@ foamPV()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# OpenFOAM working directory with basic env replacements
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
unset -f foamPwd 2>/dev/null
|
||||||
|
foamPwd()
|
||||||
|
{
|
||||||
|
if [ -d "$WM_PROJECT_DIR" ]
|
||||||
|
then
|
||||||
|
echo $PWD | sed \
|
||||||
|
-e "s#^${FOAM_RUN}#\$FOAM_RUN#;" \
|
||||||
|
-e "s#^${WM_PROJECT_DIR}#\$WM_PROJECT_DIR#;" \
|
||||||
|
-e "s#^${WM_PROJECT_USER_DIR}#\$WM_PROJECT_USER_DIR#;" \
|
||||||
|
-e "s#^${HOME}#\$HOME#";
|
||||||
|
else
|
||||||
|
echo $PWD | sed -e "s#^${HOME}#\$HOME#;"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -170,10 +170,19 @@ unalias util 2>/dev/null
|
|||||||
unalias tut 2>/dev/null
|
unalias tut 2>/dev/null
|
||||||
unalias run 2>/dev/null
|
unalias run 2>/dev/null
|
||||||
|
|
||||||
|
unalias ufoam 2>/dev/null
|
||||||
|
unalias uapp 2>/dev/null
|
||||||
|
unalias usol 2>/dev/null
|
||||||
|
unalias uutil 2>/dev/null
|
||||||
|
|
||||||
unset -f wmRefresh 2>/dev/null
|
unset -f wmRefresh 2>/dev/null
|
||||||
|
unset -f foamPwd 2>/dev/null
|
||||||
unset -f foamVersion 2>/dev/null
|
unset -f foamVersion 2>/dev/null
|
||||||
unset -f foamPV 2>/dev/null
|
unset -f foamPV 2>/dev/null
|
||||||
|
|
||||||
|
# NB: no good way to remove foamPwd reference in PS1.
|
||||||
|
|
||||||
|
|
||||||
# Remove old completions, which look like
|
# Remove old completions, which look like
|
||||||
# "complete ... -F _of_complete_ APPNAME
|
# "complete ... -F _of_complete_ APPNAME
|
||||||
# For economy, obtain list first
|
# For economy, obtain list first
|
||||||
|
|||||||
@ -50,7 +50,7 @@ string pOpen(const string& cmd, label line=0)
|
|||||||
char *buf = nullptr;
|
char *buf = nullptr;
|
||||||
|
|
||||||
// Read line number of lines
|
// Read line number of lines
|
||||||
for (label cnt = 0; cnt <= line; cnt++)
|
for (label cnt = 0; cnt <= line; ++cnt)
|
||||||
{
|
{
|
||||||
size_t linecap = 0;
|
size_t linecap = 0;
|
||||||
ssize_t linelen = ::getline(&buf, &linecap, cmdPipe);
|
ssize_t linelen = ::getline(&buf, &linecap, cmdPipe);
|
||||||
@ -96,6 +96,14 @@ inline word addressToWord(const uintptr_t addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline string& shorterPath(string& s)
|
||||||
|
{
|
||||||
|
s.replace(cwd() + '/', "");
|
||||||
|
s.replace(home(), "~");
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void printSourceFileAndLine
|
void printSourceFileAndLine
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
@ -132,14 +140,12 @@ void printSourceFileAndLine
|
|||||||
}
|
}
|
||||||
else if (line == "??:0")
|
else if (line == "??:0")
|
||||||
{
|
{
|
||||||
os << " in " << filename;
|
line = filename;
|
||||||
|
os << " in " << shorterPath(line).c_str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string cwdLine(line.replaceAll(cwd() + '/', ""));
|
os << " at " << shorterPath(line).c_str();
|
||||||
string homeLine(cwdLine.replaceAll(home(), "~"));
|
|
||||||
|
|
||||||
os << " at " << homeLine.c_str();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +208,7 @@ void Foam::error::safePrintStack(std::ostream& os)
|
|||||||
|
|
||||||
// See if they contain function between () e.g. "(__libc_start_main+0xd0)"
|
// See if they contain function between () e.g. "(__libc_start_main+0xd0)"
|
||||||
// and see if cplus_demangle can make sense of part before +
|
// and see if cplus_demangle can make sense of part before +
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
string msg(strings[i]);
|
string msg(strings[i]);
|
||||||
fileName programFile;
|
fileName programFile;
|
||||||
@ -226,7 +232,7 @@ void Foam::error::printStack(Ostream& os)
|
|||||||
fileName fname = "???";
|
fileName fname = "???";
|
||||||
word address;
|
word address;
|
||||||
|
|
||||||
for(size_t i=0; i<size; i++)
|
for (size_t i=0; i<size; ++i)
|
||||||
{
|
{
|
||||||
int st = dladdr(callstack[i], info);
|
int st = dladdr(callstack[i], info);
|
||||||
|
|
||||||
|
|||||||
@ -233,7 +233,6 @@ $(functionEntries)/functionEntry/functionEntry.C
|
|||||||
$(functionEntries)/includeEntry/includeEntry.C
|
$(functionEntries)/includeEntry/includeEntry.C
|
||||||
$(functionEntries)/includeEtcEntry/includeEtcEntry.C
|
$(functionEntries)/includeEtcEntry/includeEtcEntry.C
|
||||||
$(functionEntries)/includeFuncEntry/includeFuncEntry.C
|
$(functionEntries)/includeFuncEntry/includeFuncEntry.C
|
||||||
$(functionEntries)/includeIfPresentEntry/includeIfPresentEntry.C
|
|
||||||
$(functionEntries)/inputMode/inputMode.C
|
$(functionEntries)/inputMode/inputMode.C
|
||||||
$(functionEntries)/removeEntry/removeEntry.C
|
$(functionEntries)/removeEntry/removeEntry.C
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,9 @@
|
|||||||
#remove | dict | keyType or List<keyType>
|
#remove | dict | keyType or List<keyType>
|
||||||
| |
|
| |
|
||||||
#include | dict/primitive | string
|
#include | dict/primitive | string
|
||||||
#includeEtc | dict/primitive | string
|
#sinclude | dict/primitive | string
|
||||||
#includeIfPresent | dict/primitive | string
|
#includeIfPresent | dict/primitive | string
|
||||||
|
#includeEtc | dict/primitive | string
|
||||||
#includeFunc | dict | word
|
#includeFunc | dict | word
|
||||||
| |
|
| |
|
||||||
#calc | dict/primitive | string
|
#calc | dict/primitive | string
|
||||||
@ -27,4 +28,4 @@ Pending future extensions
|
|||||||
#undef | dict | keyType or List<keyType>
|
#undef | dict | keyType or List<keyType>
|
||||||
|
|
||||||
|
|
||||||
2017-11-26
|
2018-05-28
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -57,9 +57,47 @@ namespace functionEntries
|
|||||||
primitiveEntryIstream,
|
primitiveEntryIstream,
|
||||||
include
|
include
|
||||||
);
|
);
|
||||||
|
|
||||||
|
addNamedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
functionEntry,
|
||||||
|
sincludeEntry,
|
||||||
|
execute,
|
||||||
|
dictionaryIstream,
|
||||||
|
sinclude
|
||||||
|
);
|
||||||
|
|
||||||
|
addNamedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
functionEntry,
|
||||||
|
sincludeEntry,
|
||||||
|
execute,
|
||||||
|
primitiveEntryIstream,
|
||||||
|
sinclude
|
||||||
|
);
|
||||||
|
|
||||||
|
// Compat 1712 and earlier
|
||||||
|
addNamedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
functionEntry,
|
||||||
|
sincludeEntry,
|
||||||
|
execute,
|
||||||
|
dictionaryIstream,
|
||||||
|
includeIfPresent
|
||||||
|
);
|
||||||
|
|
||||||
|
addNamedToMemberFunctionSelectionTable
|
||||||
|
(
|
||||||
|
functionEntry,
|
||||||
|
sincludeEntry,
|
||||||
|
execute,
|
||||||
|
primitiveEntryIstream,
|
||||||
|
includeIfPresent
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fileName Foam::functionEntries::includeEntry::resolveFile
|
Foam::fileName Foam::functionEntries::includeEntry::resolveFile
|
||||||
@ -97,7 +135,7 @@ bool Foam::functionEntries::includeEntry::execute
|
|||||||
const fileName fName(resolveFile(is.name().path(), rawName, parentDict));
|
const fileName fName(resolveFile(is.name().path(), rawName, parentDict));
|
||||||
|
|
||||||
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
||||||
ISstream& ifs = ifsPtr();
|
auto& ifs = *ifsPtr;
|
||||||
|
|
||||||
if (ifs)
|
if (ifs)
|
||||||
{
|
{
|
||||||
@ -144,7 +182,7 @@ bool Foam::functionEntries::includeEntry::execute
|
|||||||
const fileName fName(resolveFile(is.name().path(), rawName, parentDict));
|
const fileName fName(resolveFile(is.name().path(), rawName, parentDict));
|
||||||
|
|
||||||
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
||||||
ISstream& ifs = ifsPtr();
|
auto& ifs = *ifsPtr;
|
||||||
|
|
||||||
if (ifs)
|
if (ifs)
|
||||||
{
|
{
|
||||||
@ -180,4 +218,79 @@ bool Foam::functionEntries::includeEntry::execute
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionEntries::sincludeEntry::execute
|
||||||
|
(
|
||||||
|
dictionary& parentDict,
|
||||||
|
Istream& is
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const fileName rawName(is);
|
||||||
|
const fileName fName(resolveFile(is.name().path(), rawName, parentDict));
|
||||||
|
|
||||||
|
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
||||||
|
auto& ifs = *ifsPtr;
|
||||||
|
|
||||||
|
if (ifs)
|
||||||
|
{
|
||||||
|
if (Foam::functionEntries::includeEntry::log)
|
||||||
|
{
|
||||||
|
Info<< fName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add watch on included file
|
||||||
|
const dictionary& top = parentDict.topDict();
|
||||||
|
if (isA<regIOobject>(top))
|
||||||
|
{
|
||||||
|
regIOobject& rio = const_cast<regIOobject&>
|
||||||
|
(
|
||||||
|
dynamic_cast<const regIOobject&>(top)
|
||||||
|
);
|
||||||
|
rio.addWatch(fName);
|
||||||
|
}
|
||||||
|
|
||||||
|
parentDict.read(ifs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // Never fails
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionEntries::sincludeEntry::execute
|
||||||
|
(
|
||||||
|
const dictionary& parentDict,
|
||||||
|
primitiveEntry& entry,
|
||||||
|
Istream& is
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const fileName rawName(is);
|
||||||
|
const fileName fName(resolveFile(is.name().path(), rawName, parentDict));
|
||||||
|
|
||||||
|
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
||||||
|
auto& ifs = *ifsPtr;
|
||||||
|
|
||||||
|
if (ifs)
|
||||||
|
{
|
||||||
|
if (Foam::functionEntries::includeEntry::log)
|
||||||
|
{
|
||||||
|
Info<< fName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add watch on included file
|
||||||
|
const dictionary& top = parentDict.topDict();
|
||||||
|
if (isA<regIOobject>(top))
|
||||||
|
{
|
||||||
|
regIOobject& rio = const_cast<regIOobject&>
|
||||||
|
(
|
||||||
|
dynamic_cast<const regIOobject&>(top)
|
||||||
|
);
|
||||||
|
rio.addWatch(fName);
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.read(parentDict, ifs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // Never fails
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,19 +25,25 @@ Class
|
|||||||
Foam::functionEntries::includeEntry
|
Foam::functionEntries::includeEntry
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Specify an include file when reading dictionaries, expects a
|
A dictionary directive for including a file, expects a single string
|
||||||
single string to follow.
|
to follow.
|
||||||
|
|
||||||
An example of the \c \#include directive:
|
An example of the \c \#include directive to include a file:
|
||||||
\verbatim
|
\verbatim
|
||||||
#include "includeFile"
|
#include "includeFileMustExist"
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
The usual expansion of environment variables and other constructs
|
An example of the \c \#sinclude directive to conditionally include a file
|
||||||
(eg, the \c ~OpenFOAM/ expansion) is retained.
|
when it exists.
|
||||||
|
\verbatim
|
||||||
|
#sinclude "includeFileCanBeMissing"
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
The usual expansion of environment variables and other expansions
|
||||||
|
(eg, a leading "<case>/", "<system>/", "<etc>/", ...) are retained.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
fileName, string::expand()
|
fileName, string::expand(), functionEntries::sincludeEntry
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
includeEntry.C
|
includeEntry.C
|
||||||
@ -97,7 +103,35 @@ public:
|
|||||||
primitiveEntry& entry,
|
primitiveEntry& entry,
|
||||||
Istream& is
|
Istream& is
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class sincludeEntry Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//- A dictionary directive for conditionally including a file,
|
||||||
|
//- expects a single string to follow.
|
||||||
|
//
|
||||||
|
// The \c \#sinclude directive (and the \c \#includeIfPresent alias) behaves
|
||||||
|
// identically to the \c \#include directive, but does not generate an error
|
||||||
|
// if the file does not exist.
|
||||||
|
class sincludeEntry
|
||||||
|
:
|
||||||
|
public includeEntry
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Include file (if it exists) in a sub-dict context
|
||||||
|
static bool execute(dictionary& parentDict, Istream& is);
|
||||||
|
|
||||||
|
//- Include file (if it exists) in a primitiveEntry context
|
||||||
|
static bool execute
|
||||||
|
(
|
||||||
|
const dictionary& parentDict,
|
||||||
|
primitiveEntry& entry,
|
||||||
|
Istream& is
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,7 @@ bool Foam::functionEntries::includeEtcEntry::execute
|
|||||||
const fileName fName(resolveEtcFile(rawName, parentDict));
|
const fileName fName(resolveEtcFile(rawName, parentDict));
|
||||||
|
|
||||||
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
||||||
ISstream& ifs = ifsPtr();
|
auto& ifs = *ifsPtr;
|
||||||
|
|
||||||
if (ifs)
|
if (ifs)
|
||||||
{
|
{
|
||||||
@ -131,7 +131,7 @@ bool Foam::functionEntries::includeEtcEntry::execute
|
|||||||
const fileName fName(resolveEtcFile(rawName, parentDict));
|
const fileName fName(resolveEtcFile(rawName, parentDict));
|
||||||
|
|
||||||
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
||||||
ISstream& ifs = ifsPtr();
|
auto& ifs = *ifsPtr;
|
||||||
|
|
||||||
if (ifs)
|
if (ifs)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,6 +25,9 @@ Class
|
|||||||
Foam::functionEntries::includeEtcEntry
|
Foam::functionEntries::includeEtcEntry
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
A dictionary directive for including a file found using the findEtcFile()
|
||||||
|
mechanism.
|
||||||
|
|
||||||
Specify an etc file to include when reading dictionaries, expects a
|
Specify an etc file to include when reading dictionaries, expects a
|
||||||
single string to follow.
|
single string to follow.
|
||||||
|
|
||||||
|
|||||||
@ -1,136 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "includeIfPresentEntry.H"
|
|
||||||
#include "dictionary.H"
|
|
||||||
#include "IFstream.H"
|
|
||||||
#include "regIOobject.H"
|
|
||||||
#include "addToMemberFunctionSelectionTable.H"
|
|
||||||
#include "fileOperation.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
namespace functionEntries
|
|
||||||
{
|
|
||||||
addNamedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
functionEntry,
|
|
||||||
includeIfPresentEntry,
|
|
||||||
execute,
|
|
||||||
dictionaryIstream,
|
|
||||||
includeIfPresent
|
|
||||||
);
|
|
||||||
|
|
||||||
addNamedToMemberFunctionSelectionTable
|
|
||||||
(
|
|
||||||
functionEntry,
|
|
||||||
includeIfPresentEntry,
|
|
||||||
execute,
|
|
||||||
primitiveEntryIstream,
|
|
||||||
includeIfPresent
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::functionEntries::includeIfPresentEntry::execute
|
|
||||||
(
|
|
||||||
dictionary& parentDict,
|
|
||||||
Istream& is
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const fileName rawName(is);
|
|
||||||
const fileName fName(resolveFile(is.name().path(), rawName, parentDict));
|
|
||||||
|
|
||||||
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
|
||||||
ISstream& ifs = ifsPtr();
|
|
||||||
|
|
||||||
if (ifs)
|
|
||||||
{
|
|
||||||
if (Foam::functionEntries::includeEntry::log)
|
|
||||||
{
|
|
||||||
Info<< fName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add watch on included file
|
|
||||||
const dictionary& top = parentDict.topDict();
|
|
||||||
if (isA<regIOobject>(top))
|
|
||||||
{
|
|
||||||
regIOobject& rio = const_cast<regIOobject&>
|
|
||||||
(
|
|
||||||
dynamic_cast<const regIOobject&>(top)
|
|
||||||
);
|
|
||||||
rio.addWatch(fName);
|
|
||||||
}
|
|
||||||
|
|
||||||
parentDict.read(ifs);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionEntries::includeIfPresentEntry::execute
|
|
||||||
(
|
|
||||||
const dictionary& parentDict,
|
|
||||||
primitiveEntry& entry,
|
|
||||||
Istream& is
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const fileName rawName(is);
|
|
||||||
const fileName fName(resolveFile(is.name().path(), rawName, parentDict));
|
|
||||||
|
|
||||||
autoPtr<ISstream> ifsPtr(fileHandler().NewIFstream(fName));
|
|
||||||
ISstream& ifs = ifsPtr();
|
|
||||||
|
|
||||||
if (ifs)
|
|
||||||
{
|
|
||||||
if (Foam::functionEntries::includeEntry::log)
|
|
||||||
{
|
|
||||||
Info<< fName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add watch on included file
|
|
||||||
const dictionary& top = parentDict.topDict();
|
|
||||||
if (isA<regIOobject>(top))
|
|
||||||
{
|
|
||||||
regIOobject& rio = const_cast<regIOobject&>
|
|
||||||
(
|
|
||||||
dynamic_cast<const regIOobject&>(top)
|
|
||||||
);
|
|
||||||
rio.addWatch(fName);
|
|
||||||
}
|
|
||||||
|
|
||||||
entry.read(parentDict, ifs);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::functionEntries::includeIfPresentEntry
|
|
||||||
|
|
||||||
Description
|
|
||||||
Specify a file to include if it exists. Expects a single string to follow.
|
|
||||||
|
|
||||||
The \c \#includeIfPresent directive is similar to the \c \#include
|
|
||||||
directive, but does not generate an error if the file does not exist.
|
|
||||||
|
|
||||||
See also
|
|
||||||
Foam::functionEntries::includeEntry
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
includeIfPresentEntry.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef includeIfPresentEntry_H
|
|
||||||
#define includeIfPresentEntry_H
|
|
||||||
|
|
||||||
#include "includeEntry.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
namespace functionEntries
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class includeIfPresentEntry Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class includeIfPresentEntry
|
|
||||||
:
|
|
||||||
public includeEntry
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Include (if present) in a sub-dict context
|
|
||||||
static bool execute(dictionary& parentDict, Istream& is);
|
|
||||||
|
|
||||||
//- Include (if present) in a primitiveEntry context
|
|
||||||
static bool execute
|
|
||||||
(
|
|
||||||
const dictionary& parentDict,
|
|
||||||
primitiveEntry& entry,
|
|
||||||
Istream& is
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace functionEntries
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,8 +32,10 @@ License
|
|||||||
//
|
//
|
||||||
// These could be exposed too (if required), but are fairly special purpose.
|
// These could be exposed too (if required), but are fairly special purpose.
|
||||||
//
|
//
|
||||||
//! \cond fileScope
|
|
||||||
//
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
// Assign 'queried' parameter to the user resource directory.
|
// Assign 'queried' parameter to the user resource directory.
|
||||||
// Return true if this directory exists.
|
// Return true if this directory exists.
|
||||||
//
|
//
|
||||||
@ -62,9 +64,15 @@ static inline bool groupResourceDir(Foam::fileName& queried)
|
|||||||
return Foam::isDir(queried);
|
return Foam::isDir(queried);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback (when WM_PROJECT_SITE is unset)
|
// When WM_PROJECT_SITE is unset:
|
||||||
queried = Foam::getEnv("WM_PROJECT_INST_DIR")/"site";
|
queried = Foam::getEnv("WM_PROJECT_INST_DIR")/"site";
|
||||||
return (queried.size() > 5 && Foam::isDir(queried));
|
return (queried.size() > 4 && Foam::isDir(queried));
|
||||||
|
|
||||||
|
// NOTE: this alternative bit of code corresponds to how we patch things
|
||||||
|
// for spack (and EasyBuild?) to avoid leaking out to the parent directory
|
||||||
|
//
|
||||||
|
// queried = Foam::getEnv("WM_PROJECT_DIR")/"site";
|
||||||
|
// return (queried.size() > 4 && Foam::isDir(queried));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -77,87 +85,100 @@ static inline bool groupResourceDir(Foam::fileName& queried)
|
|||||||
static inline bool projectResourceDir(Foam::fileName& queried)
|
static inline bool projectResourceDir(Foam::fileName& queried)
|
||||||
{
|
{
|
||||||
queried = Foam::getEnv("WM_PROJECT_DIR")/"etc";
|
queried = Foam::getEnv("WM_PROJECT_DIR")/"etc";
|
||||||
return (queried.size() > 4 && Foam::isDir(queried));
|
return (queried.size() > 3 && Foam::isDir(queried));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \endcond
|
|
||||||
|
Foam::fileNameList searchEtc
|
||||||
|
(
|
||||||
|
const Foam::fileName& name,
|
||||||
|
const bool findFirst,
|
||||||
|
bool (*accept)(const Foam::fileName&)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Foam::fileNameList list;
|
||||||
|
Foam::fileName dir, candidate;
|
||||||
|
|
||||||
|
// User resource directories
|
||||||
|
if (userResourceDir(dir))
|
||||||
|
{
|
||||||
|
candidate = dir/Foam::FOAMversion/name;
|
||||||
|
if (accept(candidate))
|
||||||
|
{
|
||||||
|
list.append(std::move(candidate));
|
||||||
|
if (findFirst)
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
candidate = dir/name;
|
||||||
|
if (accept(candidate))
|
||||||
|
{
|
||||||
|
list.append(std::move(candidate));
|
||||||
|
if (findFirst)
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Group resource directories
|
||||||
|
if (groupResourceDir(dir))
|
||||||
|
{
|
||||||
|
candidate = dir/Foam::FOAMversion/name;
|
||||||
|
if (accept(candidate))
|
||||||
|
{
|
||||||
|
list.append(std::move(candidate));
|
||||||
|
if (findFirst)
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
candidate = dir/name;
|
||||||
|
if (accept(candidate))
|
||||||
|
{
|
||||||
|
list.append(std::move(candidate));
|
||||||
|
if (findFirst)
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other (project) resource directory
|
||||||
|
if (projectResourceDir(dir))
|
||||||
|
{
|
||||||
|
candidate = dir/name;
|
||||||
|
if (accept(candidate))
|
||||||
|
{
|
||||||
|
list.append(std::move(candidate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
Foam::fileNameList Foam::findEtcDirs
|
Foam::fileNameList Foam::findEtcDirs
|
||||||
(
|
(
|
||||||
const fileName& name,
|
const fileName& name,
|
||||||
const bool findFirst
|
const bool findFirst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fileNameList results;
|
return
|
||||||
|
searchEtc
|
||||||
do
|
(
|
||||||
{
|
name,
|
||||||
fileName dir, candidate;
|
findFirst,
|
||||||
|
[](const fileName& f){ return isDir(f); }
|
||||||
// User resource directories
|
);
|
||||||
if (userResourceDir(dir))
|
|
||||||
{
|
|
||||||
candidate = dir/FOAMversion/name;
|
|
||||||
if (isDir(candidate))
|
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
if (findFirst)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
candidate = dir/name;
|
|
||||||
if (isDir(candidate))
|
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
if (findFirst)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Group resource directories
|
|
||||||
if (groupResourceDir(dir))
|
|
||||||
{
|
|
||||||
candidate = dir/FOAMversion/name;
|
|
||||||
if (isDir(candidate))
|
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
if (findFirst)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
candidate = dir/name;
|
|
||||||
if (isDir(candidate))
|
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
if (findFirst)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Other (project) resource directory
|
|
||||||
if (projectResourceDir(dir))
|
|
||||||
{
|
|
||||||
candidate = dir/name;
|
|
||||||
if (isDir(dir) && isDir(candidate))
|
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (false); // Run exactly once
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -168,79 +189,20 @@ Foam::fileNameList Foam::findEtcFiles
|
|||||||
const bool findFirst
|
const bool findFirst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fileNameList results;
|
fileNameList list;
|
||||||
|
|
||||||
do
|
if (name.size())
|
||||||
{
|
{
|
||||||
fileName dir, candidate;
|
// A file must have a name!
|
||||||
|
list = searchEtc
|
||||||
// User resource directories
|
(
|
||||||
if (userResourceDir(dir))
|
name,
|
||||||
{
|
findFirst,
|
||||||
candidate = dir/FOAMversion/name;
|
[](const fileName& f){ return isFile(f); }
|
||||||
if (isFile(candidate))
|
);
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
if (findFirst)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
candidate = dir/name;
|
|
||||||
if (isFile(candidate))
|
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
if (findFirst)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Group resource directories
|
|
||||||
if (groupResourceDir(dir))
|
|
||||||
{
|
|
||||||
candidate = dir/FOAMversion/name;
|
|
||||||
if (isFile(candidate))
|
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
if (findFirst)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
candidate = dir/name;
|
|
||||||
if (isFile(candidate))
|
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
if (findFirst)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Other (project) resource directory
|
|
||||||
if (projectResourceDir(dir))
|
|
||||||
{
|
|
||||||
candidate = dir/name;
|
|
||||||
if (isDir(dir) && isFile(candidate))
|
|
||||||
{
|
|
||||||
results.append(candidate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (false); // Run exactly once
|
|
||||||
|
|
||||||
// No name? It cannot be a file!
|
|
||||||
if (name.empty())
|
|
||||||
{
|
|
||||||
results.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mandatory && results.empty())
|
if (mandatory && list.empty())
|
||||||
{
|
{
|
||||||
// Abort if file is mandatory but not found
|
// Abort if file is mandatory but not found
|
||||||
std::cerr
|
std::cerr
|
||||||
@ -250,21 +212,21 @@ Foam::fileNameList Foam::findEtcFiles
|
|||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::findEtcFile(const fileName& name, const bool mandatory)
|
Foam::fileName Foam::findEtcFile(const fileName& name, const bool mandatory)
|
||||||
{
|
{
|
||||||
fileNameList results(findEtcFiles(name, mandatory, true));
|
fileName file;
|
||||||
|
|
||||||
if (results.size())
|
fileNameList list(findEtcFiles(name, mandatory, true));
|
||||||
|
if (list.size())
|
||||||
{
|
{
|
||||||
return results[0];
|
file = std::move(list.first());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return null-constructed fileName rather than fileName::null
|
return file;
|
||||||
return fileName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -45,19 +45,8 @@ namespace Foam
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Search for directories from user/group/other directories.
|
//- Search for directories from user/group/other directories.
|
||||||
// The search scheme allows for version-specific and
|
//
|
||||||
// version-independent files using the following hierarchy:
|
// \note Uses search hierarchy as per findEtcFiles().
|
||||||
// - \b user settings:
|
|
||||||
// - ~/.OpenFOAM/\<VERSION\>
|
|
||||||
// - ~/.OpenFOAM/
|
|
||||||
// - \b group (site) settings (when $WM_PROJECT_SITE is set):
|
|
||||||
// - $WM_PROJECT_SITE/\<VERSION\>
|
|
||||||
// - $WM_PROJECT_SITE
|
|
||||||
// - \b group (site) settings (when $WM_PROJECT_SITE is not set):
|
|
||||||
// - $WM_PROJECT_INST_DIR/site/\<VERSION\>
|
|
||||||
// - $WM_PROJECT_INST_DIR/site/
|
|
||||||
// - \b other (project) settings:
|
|
||||||
// - $WM_PROJECT_DIR/etc/
|
|
||||||
//
|
//
|
||||||
// \return The list of full paths of all the matching directories or
|
// \return The list of full paths of all the matching directories or
|
||||||
// an empty list if the name cannot be found.
|
// an empty list if the name cannot be found.
|
||||||
@ -68,19 +57,22 @@ fileNameList findEtcDirs
|
|||||||
const bool findFirst = false
|
const bool findFirst = false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Search for files from user/group/other directories.
|
//- Search for files from user/group/other directories.
|
||||||
// The search scheme allows for version-specific and
|
//
|
||||||
// version-independent files using the following hierarchy:
|
// \note
|
||||||
|
// The following search hierarchy is also used by the foamEtcFile shell
|
||||||
|
// script, which allows for version-specific and version-independent files:
|
||||||
// - \b user settings:
|
// - \b user settings:
|
||||||
// - ~/.OpenFOAM/\<VERSION\>
|
// - ~/.OpenFOAM/\<VERSION\>
|
||||||
// - ~/.OpenFOAM/
|
// - ~/.OpenFOAM/
|
||||||
// - \b group (site) settings (when $WM_PROJECT_SITE is set):
|
// - \b group settings (when $WM_PROJECT_SITE is set):
|
||||||
// - $WM_PROJECT_SITE/\<VERSION\>
|
// - $WM_PROJECT_SITE/\<VERSION\>
|
||||||
// - $WM_PROJECT_SITE
|
// - $WM_PROJECT_SITE
|
||||||
// - \b group (site) settings (when $WM_PROJECT_SITE is not set):
|
// - \b group settings (when $WM_PROJECT_SITE is not set):
|
||||||
// - $WM_PROJECT_INST_DIR/site/\<VERSION\>
|
// - $WM_PROJECT_INST_DIR/site/\<VERSION\>
|
||||||
// - $WM_PROJECT_INST_DIR/site/
|
// - $WM_PROJECT_INST_DIR/site/
|
||||||
// - \b other (project) settings:
|
// - \b other (shipped) settings:
|
||||||
// - $WM_PROJECT_DIR/etc/
|
// - $WM_PROJECT_DIR/etc/
|
||||||
//
|
//
|
||||||
// \return The list of full paths of all the matching files or
|
// \return The list of full paths of all the matching files or
|
||||||
@ -94,7 +86,9 @@ fileNameList findEtcFiles
|
|||||||
const bool findFirst = false
|
const bool findFirst = false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Search for a single file using findEtcFiles.
|
|
||||||
|
//- Search for a single file using findEtcFiles().
|
||||||
|
//
|
||||||
// \return The full path name of the first file found in the
|
// \return The full path name of the first file found in the
|
||||||
// search hierarchy or an empty fileName if the name cannot be found.
|
// search hierarchy or an empty fileName if the name cannot be found.
|
||||||
// Optionally abort if the file cannot be found but is mandatory.
|
// Optionally abort if the file cannot be found but is mandatory.
|
||||||
|
|||||||
@ -53,13 +53,15 @@ bool Foam::functionObjects::reference::calcType()
|
|||||||
{
|
{
|
||||||
cellValue.value() = -pTraits<Type>::one*GREAT;
|
cellValue.value() = -pTraits<Type>::one*GREAT;
|
||||||
|
|
||||||
|
// Might trigger parallel comms (e.g. volPointInterpolation, if
|
||||||
|
// result is not yet cached) so have all processors do it
|
||||||
|
autoPtr<interpolation<Type>> interpolator
|
||||||
|
(
|
||||||
|
interpolation<Type>::New(interpolationScheme_, vf)
|
||||||
|
);
|
||||||
|
|
||||||
if (celli_ != -1)
|
if (celli_ != -1)
|
||||||
{
|
{
|
||||||
autoPtr<interpolation<Type>> interpolator
|
|
||||||
(
|
|
||||||
interpolation<Type>::New(interpolationScheme_, vf)
|
|
||||||
);
|
|
||||||
|
|
||||||
cellValue.value() =
|
cellValue.value() =
|
||||||
interpolator().interpolate(position_, celli_, -1);
|
interpolator().interpolate(position_, celli_, -1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -548,10 +548,13 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI
|
|||||||
if (nFace)
|
if (nFace)
|
||||||
{
|
{
|
||||||
scalarField srcWghtSum(size(), 0);
|
scalarField srcWghtSum(size(), 0);
|
||||||
scalarField tgtWghtSum(size(), 0);
|
forAll(srcWghtSum, faceI)
|
||||||
forAll(*this, faceI)
|
|
||||||
{
|
{
|
||||||
srcWghtSum[faceI] = sum(AMIPtr_->srcWeights()[faceI]);
|
srcWghtSum[faceI] = sum(AMIPtr_->srcWeights()[faceI]);
|
||||||
|
}
|
||||||
|
scalarField tgtWghtSum(neighbPatch().size(), 0);
|
||||||
|
forAll(tgtWghtSum, faceI)
|
||||||
|
{
|
||||||
tgtWghtSum[faceI] = sum(AMIPtr_->tgtWeights()[faceI]);
|
tgtWghtSum[faceI] = sum(AMIPtr_->tgtWeights()[faceI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -58,7 +58,7 @@ Foam::decompositionModel::decompositionModel
|
|||||||
"decomposeParDict",
|
"decomposeParDict",
|
||||||
mesh.time().system(),
|
mesh.time().system(),
|
||||||
mesh.local(),
|
mesh.local(),
|
||||||
mesh.db(),
|
mesh.thisDb(),
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false, //io.registerObject(),
|
false, //io.registerObject(),
|
||||||
@ -92,7 +92,7 @@ Foam::decompositionModel::decompositionModel
|
|||||||
"decomposeParDict",
|
"decomposeParDict",
|
||||||
mesh.time().system(),
|
mesh.time().system(),
|
||||||
mesh.local(),
|
mesh.local(),
|
||||||
mesh.db(),
|
mesh.thisDb(),
|
||||||
(dict.size() ? IOobject::NO_READ : IOobject::MUST_READ),
|
(dict.size() ? IOobject::NO_READ : IOobject::MUST_READ),
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false, //io.registerObject(),
|
false, //io.registerObject(),
|
||||||
|
|||||||
@ -52,6 +52,6 @@ maxAlphaCo 1;
|
|||||||
|
|
||||||
maxDeltaT 1;
|
maxDeltaT 1;
|
||||||
|
|
||||||
#includeIfPresent "sampling"
|
#sinclude "sampling"
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -31,7 +31,7 @@ FILES = $(OBJECTS_DIR)/files
|
|||||||
VARS = $(OBJECTS_DIR)/variables
|
VARS = $(OBJECTS_DIR)/variables
|
||||||
SFILES = $(OBJECTS_DIR)/sourceFiles
|
SFILES = $(OBJECTS_DIR)/sourceFiles
|
||||||
|
|
||||||
-include $(OPTIONS)
|
sinclude $(OPTIONS)
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -212,7 +212,7 @@ dep: $(DEPENDENCIES)
|
|||||||
updatedep: dep
|
updatedep: dep
|
||||||
|
|
||||||
ifeq ($(findstring lnInclude,$(MAKECMDGOALS))$(findstring updatedep,$(MAKECMDGOALS)),)
|
ifeq ($(findstring lnInclude,$(MAKECMDGOALS))$(findstring updatedep,$(MAKECMDGOALS)),)
|
||||||
-include $(DEPENDENCIES)
|
sinclude $(DEPENDENCIES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user