mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -14,10 +14,15 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// #include "codeStreamDefaults"
|
// values from outer-scope
|
||||||
|
begIter 0;
|
||||||
|
endIter 200;
|
||||||
|
|
||||||
writeInterval #codeStream
|
writeInterval #codeStream
|
||||||
{
|
{
|
||||||
|
// values from inner-scope
|
||||||
|
nDumps 5;
|
||||||
|
|
||||||
codeInclude
|
codeInclude
|
||||||
#{
|
#{
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
@ -30,14 +35,15 @@ writeInterval #codeStream
|
|||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
scalar start = 0;
|
label interval = ($endIter - $begIter);
|
||||||
scalar end = 100;
|
label nDumps = $nDumps;
|
||||||
label nDumps = 5;
|
os << (interval / nDumps);
|
||||||
label interval = end - start;
|
|
||||||
Info<<"on-the-fly: " << ((interval)/nDumps) << endl;
|
|
||||||
os << ((interval)/nDumps);
|
|
||||||
#};
|
#};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// play with cleanup
|
||||||
|
#remove begIter
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
|
||||||
| ========= | |
|
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
||||||
| \\ / O peration | Version: Any |
|
|
||||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
|
||||||
| \\/ M anipulation | |
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
FoamFile
|
|
||||||
{
|
|
||||||
version 2.0;
|
|
||||||
format ascii;
|
|
||||||
class dictionary;
|
|
||||||
object testDictCalc;
|
|
||||||
}
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
flowRatePerHour 720;
|
|
||||||
|
|
||||||
x 10;
|
|
||||||
y 20;
|
|
||||||
z t s v;
|
|
||||||
p #calc{ 1 + 2 + 10 * 15 + $x - $y };
|
|
||||||
|
|
||||||
// this calculation is in-place, but does not work inside a string:
|
|
||||||
flowRate "The flow rate " #calc{ $flowRatePerHour / 3600 } "kg/s";
|
|
||||||
|
|
||||||
// this is also okay
|
|
||||||
x #calc{ $x * 1E-3 };
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
|
||||||
| ========= | |
|
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
||||||
| \\ / O peration | Version: Any |
|
|
||||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
|
||||||
| \\/ M anipulation | |
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
FoamFile
|
|
||||||
{
|
|
||||||
version 2.0;
|
|
||||||
format ascii;
|
|
||||||
class dictionary;
|
|
||||||
object testDictCalcError;
|
|
||||||
}
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
flowRatePerHour 720;
|
|
||||||
|
|
||||||
x 10;
|
|
||||||
y 20;
|
|
||||||
z t s v;
|
|
||||||
// z #test{ // this
|
|
||||||
// 123 - 456
|
|
||||||
// // comments // are
|
|
||||||
// /* stripped
|
|
||||||
// * 10
|
|
||||||
// * {}
|
|
||||||
// */
|
|
||||||
// + 1 /*100 */ 10
|
|
||||||
// };
|
|
||||||
|
|
||||||
p this calculation #calc{
|
|
||||||
1xxx1 + 2 + 10 * 15 +
|
|
||||||
$x - $y
|
|
||||||
// $x + $y
|
|
||||||
}
|
|
||||||
is done inplace;
|
|
||||||
|
|
||||||
|
|
||||||
flowRate #calc{ $flowRatePerHour / 3600};
|
|
||||||
|
|
||||||
xxx yyy;
|
|
||||||
foo 30;
|
|
||||||
bar 15;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
@ -22,11 +22,13 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Test some string functionality
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "string.H"
|
#include "string.H"
|
||||||
#include "stringOps.H"
|
#include "stringOps.H"
|
||||||
|
#include "dictionary.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
@ -38,9 +40,19 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
string test
|
string test
|
||||||
(
|
(
|
||||||
" $HOME kjhkjhkjh \" \\$HOME/tyetyery ${FOAM_RUN} \n ; hkjh ;$ "
|
" $HOME kjhkjhkjh \" \\$HOME/tyetyery ${FOAM_RUN} \n ; hkjh ;$ with "
|
||||||
|
" $(DONOTSUBST) some other ${USER} entries "
|
||||||
);
|
);
|
||||||
|
|
||||||
|
dictionary dict;
|
||||||
|
dict.add("HOME", "myHome");
|
||||||
|
|
||||||
|
dictionary subDict;
|
||||||
|
subDict.add("value1", "test1");
|
||||||
|
subDict.add("value2", "test2");
|
||||||
|
dict.add("FOAM_RUN", subDict);
|
||||||
|
|
||||||
|
|
||||||
Info<< "string:" << test << nl << "hash:"
|
Info<< "string:" << test << nl << "hash:"
|
||||||
<< unsigned(string::hash()(test)) << endl;
|
<< unsigned(string::hash()(test)) << endl;
|
||||||
|
|
||||||
@ -73,7 +85,10 @@ int main(int argc, char *argv[])
|
|||||||
Info<< string(test).replaceAll("kj", "zzz") << endl;
|
Info<< string(test).replaceAll("kj", "zzz") << endl;
|
||||||
Info<< string(test).replaceAll("kj", "z") << endl;
|
Info<< string(test).replaceAll("kj", "z") << endl;
|
||||||
|
|
||||||
Info<< string(test).expand() << endl;
|
Info<< "expanded: " << string(test).expand() << endl;
|
||||||
|
|
||||||
|
Info<<"dictionary-based substitution: " << dict << endl;
|
||||||
|
Info<< "expandDict: " << stringOps::expandDict(test, dict) << endl;
|
||||||
|
|
||||||
string test2("~OpenFOAM/controlDict");
|
string test2("~OpenFOAM/controlDict");
|
||||||
Info<< test2 << " => " << test2.expand() << endl;
|
Info<< test2 << " => " << test2.expand() << endl;
|
||||||
|
|||||||
@ -49,13 +49,14 @@
|
|||||||
- it copies a template file
|
- it copies a template file
|
||||||
=($FOAM_CODESTREAM_TEMPLATES/codeStreamTemplate.C)=, substituting all
|
=($FOAM_CODESTREAM_TEMPLATES/codeStreamTemplate.C)=, substituting all
|
||||||
occurences of =code=, =codeInclude=, =codeOptions=.
|
occurences of =code=, =codeInclude=, =codeOptions=.
|
||||||
- it writes library source files to =constant/codeStream/<sha1>= and compiles
|
- it writes library source files to =codeStream/<SHA1>= and compiles
|
||||||
it using =wmake libso=.
|
it using =wmake libso=.
|
||||||
- the resulting library gets loaded (=dlopen=, =dlsym=) and the function
|
- the resulting library is generated under
|
||||||
executed
|
=codeStream/platforms/$WM_OPTIONS/lib= and is loaded (=dlopen=, =dlsym=)
|
||||||
|
and the function executed
|
||||||
- the function will have written its output into the Ostream which then gets
|
- the function will have written its output into the Ostream which then gets
|
||||||
used to construct the entry to replace the whole =#codeStream= section.
|
used to construct the entry to replace the whole =#codeStream= section.
|
||||||
- using the sha1 means that same code will only be compiled and loaded once.
|
- using the SHA1 means that same code will only be compiled and loaded once.
|
||||||
|
|
||||||
* Boundary condition: =codedFixedValue=
|
* Boundary condition: =codedFixedValue=
|
||||||
This uses the code from codeStream to have an in-line specialised
|
This uses the code from codeStream to have an in-line specialised
|
||||||
|
|||||||
@ -35,6 +35,20 @@ ${codeInclude}
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
// unique function name that can be checked if the correct library version
|
||||||
|
// has been loaded
|
||||||
|
bool ${typeName}_${SHA1sum}()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
${typeName}FixedValueFvPatchScalarField::
|
${typeName}FixedValueFvPatchScalarField::
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\ / O peration | Version: 1.7 |
|
| \\ / O peration | Version: 2.0 |
|
||||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -24,6 +24,7 @@ Documentation
|
|||||||
"$WM_PROJECT_USER_DIR/html"
|
"$WM_PROJECT_USER_DIR/html"
|
||||||
"~OpenFOAM/html"
|
"~OpenFOAM/html"
|
||||||
"$WM_PROJECT_DIR/doc/Doxygen/html"
|
"$WM_PROJECT_DIR/doc/Doxygen/html"
|
||||||
|
"$WM_PROJECT_DIR/doc/doxygen/html"
|
||||||
);
|
);
|
||||||
doxySourceFileExts
|
doxySourceFileExts
|
||||||
(
|
(
|
||||||
@ -32,6 +33,34 @@ Documentation
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InfoSwitches
|
||||||
|
{
|
||||||
|
writePrecision 6;
|
||||||
|
writeJobInfo 0;
|
||||||
|
|
||||||
|
// Allow case-supplied c++ code (#codeStream, codedFixedValue)
|
||||||
|
allowSystemOperations 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OptimisationSwitches
|
||||||
|
{
|
||||||
|
fileModificationSkew 10;
|
||||||
|
|
||||||
|
//- Modification checking:
|
||||||
|
// - timeStamp : use modification time on file
|
||||||
|
// - inotify : use inotify framework
|
||||||
|
// - timeStampMaster : do time stamp (and file reading) only on master.
|
||||||
|
// - inotifyMaster : do inotify (and file reading) only on master.
|
||||||
|
fileModificationChecking timeStampMaster;//inotify;timeStamp;inotifyMaster;
|
||||||
|
|
||||||
|
commsType nonBlocking; //scheduled; //blocking;
|
||||||
|
floatTransfer 0;
|
||||||
|
nProcsSimpleSum 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DebugSwitches
|
DebugSwitches
|
||||||
{
|
{
|
||||||
Analytical 0;
|
Analytical 0;
|
||||||
@ -864,30 +893,6 @@ DebugSwitches
|
|||||||
zoneToPoint 0;
|
zoneToPoint 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoSwitches
|
|
||||||
{
|
|
||||||
writePrecision 6;
|
|
||||||
writeJobInfo 0;
|
|
||||||
|
|
||||||
// Allow case-supplied c++ code (#codeStream, codedFixedValue)
|
|
||||||
allowSystemOperations 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
OptimisationSwitches
|
|
||||||
{
|
|
||||||
fileModificationSkew 10;
|
|
||||||
|
|
||||||
//- Modification checking:
|
|
||||||
// - timeStamp : use modification time on file
|
|
||||||
// - inotify : use inotify framework
|
|
||||||
// - timeStampMaster : do time stamp (and file reading) only on master.
|
|
||||||
// - inotifyMaster : do inotify (and file reading) only on master.
|
|
||||||
fileModificationChecking timeStampMaster;//inotify;timeStamp;inotifyMaster;
|
|
||||||
|
|
||||||
commsType nonBlocking; //scheduled; //blocking;
|
|
||||||
floatTransfer 0;
|
|
||||||
nProcsSimpleSum 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DimensionedConstants
|
DimensionedConstants
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,28 +63,28 @@ defineTypeNameAndDebug(Foam::POSIX, 0);
|
|||||||
|
|
||||||
pid_t Foam::pid()
|
pid_t Foam::pid()
|
||||||
{
|
{
|
||||||
return getpid();
|
return ::getpid();
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t Foam::ppid()
|
pid_t Foam::ppid()
|
||||||
{
|
{
|
||||||
return getppid();
|
return ::getppid();
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t Foam::pgid()
|
pid_t Foam::pgid()
|
||||||
{
|
{
|
||||||
return getpgrp();
|
return ::getpgrp();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Foam::env(const word& envName)
|
bool Foam::env(const word& envName)
|
||||||
{
|
{
|
||||||
return getenv(envName.c_str()) != NULL;
|
return ::getenv(envName.c_str()) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::string Foam::getEnv(const word& envName)
|
Foam::string Foam::getEnv(const word& envName)
|
||||||
{
|
{
|
||||||
char* env = getenv(envName.c_str());
|
char* env = ::getenv(envName.c_str());
|
||||||
|
|
||||||
if (env)
|
if (env)
|
||||||
{
|
{
|
||||||
@ -113,12 +113,12 @@ bool Foam::setEnv
|
|||||||
Foam::word Foam::hostName(bool full)
|
Foam::word Foam::hostName(bool full)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
gethostname(buf, sizeof(buf));
|
::gethostname(buf, sizeof(buf));
|
||||||
|
|
||||||
// implementation as per hostname from net-tools
|
// implementation as per hostname from net-tools
|
||||||
if (full)
|
if (full)
|
||||||
{
|
{
|
||||||
struct hostent *hp = gethostbyname(buf);
|
struct hostent *hp = ::gethostbyname(buf);
|
||||||
if (hp)
|
if (hp)
|
||||||
{
|
{
|
||||||
return hp->h_name;
|
return hp->h_name;
|
||||||
@ -132,13 +132,13 @@ Foam::word Foam::hostName(bool full)
|
|||||||
Foam::word Foam::domainName()
|
Foam::word Foam::domainName()
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
gethostname(buf, sizeof(buf));
|
::gethostname(buf, sizeof(buf));
|
||||||
|
|
||||||
// implementation as per hostname from net-tools
|
// implementation as per hostname from net-tools
|
||||||
struct hostent *hp = gethostbyname(buf);
|
struct hostent *hp = ::gethostbyname(buf);
|
||||||
if (hp)
|
if (hp)
|
||||||
{
|
{
|
||||||
char *p = strchr(hp->h_name, '.');
|
char *p = ::strchr(hp->h_name, '.');
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
++p;
|
++p;
|
||||||
@ -152,7 +152,7 @@ Foam::word Foam::domainName()
|
|||||||
|
|
||||||
Foam::word Foam::userName()
|
Foam::word Foam::userName()
|
||||||
{
|
{
|
||||||
struct passwd* pw = getpwuid(getuid());
|
struct passwd* pw = ::getpwuid(::getuid());
|
||||||
|
|
||||||
if (pw != NULL)
|
if (pw != NULL)
|
||||||
{
|
{
|
||||||
@ -167,14 +167,14 @@ Foam::word Foam::userName()
|
|||||||
|
|
||||||
bool Foam::isAdministrator()
|
bool Foam::isAdministrator()
|
||||||
{
|
{
|
||||||
return (geteuid() == 0);
|
return (::geteuid() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// use $HOME environment variable or passwd info
|
// use $HOME environment variable or passwd info
|
||||||
Foam::fileName Foam::home()
|
Foam::fileName Foam::home()
|
||||||
{
|
{
|
||||||
char* env = getenv("HOME");
|
char* env = ::getenv("HOME");
|
||||||
|
|
||||||
if (env != NULL)
|
if (env != NULL)
|
||||||
{
|
{
|
||||||
@ -182,7 +182,7 @@ Foam::fileName Foam::home()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct passwd* pw = getpwuid(getuid());
|
struct passwd* pw = ::getpwuid(getuid());
|
||||||
|
|
||||||
if (pw != NULL)
|
if (pw != NULL)
|
||||||
{
|
{
|
||||||
@ -202,18 +202,18 @@ Foam::fileName Foam::home(const word& userName)
|
|||||||
|
|
||||||
if (userName.size())
|
if (userName.size())
|
||||||
{
|
{
|
||||||
pw = getpwnam(userName.c_str());
|
pw = ::getpwnam(userName.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* env = getenv("HOME");
|
char* env = ::getenv("HOME");
|
||||||
|
|
||||||
if (env != NULL)
|
if (env != NULL)
|
||||||
{
|
{
|
||||||
return fileName(env);
|
return fileName(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
pw = getpwuid(getuid());
|
pw = ::getpwuid(::getuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw != NULL)
|
if (pw != NULL)
|
||||||
@ -230,7 +230,7 @@ Foam::fileName Foam::home(const word& userName)
|
|||||||
Foam::fileName Foam::cwd()
|
Foam::fileName Foam::cwd()
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
if (getcwd(buf, sizeof(buf)))
|
if (::getcwd(buf, sizeof(buf)))
|
||||||
{
|
{
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@ -247,7 +247,7 @@ Foam::fileName Foam::cwd()
|
|||||||
|
|
||||||
bool Foam::chDir(const fileName& dir)
|
bool Foam::chDir(const fileName& dir)
|
||||||
{
|
{
|
||||||
return chdir(dir.c_str()) == 0;
|
return ::chdir(dir.c_str()) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
|
|||||||
// abort if the file is mandatory, otherwise return null
|
// abort if the file is mandatory, otherwise return null
|
||||||
if (mandatory)
|
if (mandatory)
|
||||||
{
|
{
|
||||||
cerr<< "--> FOAM FATAL ERROR in Foam::findEtcFile() :"
|
std::cerr<< "--> FOAM FATAL ERROR in Foam::findEtcFile() :"
|
||||||
" could not find mandatory file\n '"
|
" could not find mandatory file\n '"
|
||||||
<< name.c_str() << "'\n\n" << std::endl;
|
<< name.c_str() << "'\n\n" << std::endl;
|
||||||
::exit(1);
|
::exit(1);
|
||||||
@ -591,7 +591,7 @@ Foam::fileNameList Foam::readDir
|
|||||||
label nEntries = 0;
|
label nEntries = 0;
|
||||||
|
|
||||||
// Attempt to open directory and set the structure pointer
|
// Attempt to open directory and set the structure pointer
|
||||||
if ((source = opendir(directory.c_str())) == NULL)
|
if ((source = ::opendir(directory.c_str())) == NULL)
|
||||||
{
|
{
|
||||||
dirEntries.setSize(0);
|
dirEntries.setSize(0);
|
||||||
|
|
||||||
@ -605,7 +605,7 @@ Foam::fileNameList Foam::readDir
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Read and parse all the entries in the directory
|
// Read and parse all the entries in the directory
|
||||||
while ((list = readdir(source)) != NULL)
|
while ((list = ::readdir(source)) != NULL)
|
||||||
{
|
{
|
||||||
fileName fName(list->d_name);
|
fileName fName(list->d_name);
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ Foam::fileNameList Foam::readDir
|
|||||||
// Reset the length of the entries list
|
// Reset the length of the entries list
|
||||||
dirEntries.setSize(nEntries);
|
dirEntries.setSize(nEntries);
|
||||||
|
|
||||||
closedir(source);
|
::closedir(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dirEntries;
|
return dirEntries;
|
||||||
@ -781,7 +781,7 @@ bool Foam::ln(const fileName& src, const fileName& dst)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symlink(src.c_str(), dst.c_str()) == 0)
|
if (::symlink(src.c_str(), dst.c_str()) == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -810,11 +810,11 @@ bool Foam::mv(const fileName& src, const fileName& dst)
|
|||||||
{
|
{
|
||||||
const fileName dstName(dst/src.name());
|
const fileName dstName(dst/src.name());
|
||||||
|
|
||||||
return rename(src.c_str(), dstName.c_str()) == 0;
|
return ::rename(src.c_str(), dstName.c_str()) == 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return rename(src.c_str(), dst.c_str()) == 0;
|
return ::rename(src.c_str(), dst.c_str()) == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,7 +846,7 @@ bool Foam::mvBak(const fileName& src, const std::string& ext)
|
|||||||
// possible index where we have no choice
|
// possible index where we have no choice
|
||||||
if (!exists(dstName, false) || n == maxIndex)
|
if (!exists(dstName, false) || n == maxIndex)
|
||||||
{
|
{
|
||||||
return rename(src.c_str(), dstName.c_str()) == 0;
|
return ::rename(src.c_str(), dstName.c_str()) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -873,7 +873,7 @@ bool Foam::rm(const fileName& file)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return remove(string(file + ".gz").c_str()) == 0;
|
return ::remove(string(file + ".gz").c_str()) == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,7 +892,7 @@ bool Foam::rmDir(const fileName& directory)
|
|||||||
struct dirent *list;
|
struct dirent *list;
|
||||||
|
|
||||||
// Attempt to open directory and set the structure pointer
|
// Attempt to open directory and set the structure pointer
|
||||||
if ((source = opendir(directory.c_str())) == NULL)
|
if ((source = ::opendir(directory.c_str())) == NULL)
|
||||||
{
|
{
|
||||||
WarningIn("rmDir(const fileName&)")
|
WarningIn("rmDir(const fileName&)")
|
||||||
<< "cannot open directory " << directory << endl;
|
<< "cannot open directory " << directory << endl;
|
||||||
@ -902,7 +902,7 @@ bool Foam::rmDir(const fileName& directory)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Read and parse all the entries in the directory
|
// Read and parse all the entries in the directory
|
||||||
while ((list = readdir(source)) != NULL)
|
while ((list = ::readdir(source)) != NULL)
|
||||||
{
|
{
|
||||||
fileName fName(list->d_name);
|
fileName fName(list->d_name);
|
||||||
|
|
||||||
@ -919,7 +919,7 @@ bool Foam::rmDir(const fileName& directory)
|
|||||||
<< " while removing directory " << directory
|
<< " while removing directory " << directory
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
closedir(source);
|
::closedir(source);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -933,7 +933,7 @@ bool Foam::rmDir(const fileName& directory)
|
|||||||
<< " while removing directory " << directory
|
<< " while removing directory " << directory
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
closedir(source);
|
::closedir(source);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -947,12 +947,12 @@ bool Foam::rmDir(const fileName& directory)
|
|||||||
WarningIn("rmDir(const fileName&)")
|
WarningIn("rmDir(const fileName&)")
|
||||||
<< "failed to remove directory " << directory << endl;
|
<< "failed to remove directory " << directory << endl;
|
||||||
|
|
||||||
closedir(source);
|
::closedir(source);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(source);
|
::closedir(source);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -990,7 +990,7 @@ bool Foam::ping
|
|||||||
struct sockaddr_in destAddr; // will hold the destination addr
|
struct sockaddr_in destAddr; // will hold the destination addr
|
||||||
u_int addr;
|
u_int addr;
|
||||||
|
|
||||||
if ((hostPtr = gethostbyname(destName.c_str())) == NULL)
|
if ((hostPtr = ::gethostbyname(destName.c_str())) == NULL)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
@ -1003,7 +1003,7 @@ bool Foam::ping
|
|||||||
addr = (reinterpret_cast<struct in_addr*>(*(hostPtr->h_addr_list)))->s_addr;
|
addr = (reinterpret_cast<struct in_addr*>(*(hostPtr->h_addr_list)))->s_addr;
|
||||||
|
|
||||||
// Allocate socket
|
// Allocate socket
|
||||||
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
sockfd = ::socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (sockfd < 0)
|
if (sockfd < 0)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
@ -1031,7 +1031,7 @@ bool Foam::ping
|
|||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
connect
|
::connect
|
||||||
(
|
(
|
||||||
sockfd,
|
sockfd,
|
||||||
reinterpret_cast<struct sockaddr*>(&destAddr),
|
reinterpret_cast<struct sockaddr*>(&destAddr),
|
||||||
@ -1074,19 +1074,19 @@ int Foam::system(const std::string& command)
|
|||||||
|
|
||||||
void* Foam::dlOpen(const fileName& lib)
|
void* Foam::dlOpen(const fileName& lib)
|
||||||
{
|
{
|
||||||
return dlopen(lib.c_str(), RTLD_LAZY|RTLD_GLOBAL);
|
return ::dlopen(lib.c_str(), RTLD_LAZY|RTLD_GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::dlClose(void* handle)
|
bool Foam::dlClose(void* handle)
|
||||||
{
|
{
|
||||||
return dlclose(handle) == 0;
|
return ::dlclose(handle) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* Foam::dlSym(void* handle, const std::string& symbol)
|
void* Foam::dlSym(void* handle, const std::string& symbol)
|
||||||
{
|
{
|
||||||
void* fun = dlsym(handle, symbol.c_str());
|
void* fun = ::dlsym(handle, symbol.c_str());
|
||||||
|
|
||||||
char *error;
|
char *error;
|
||||||
if ((error = dlerror()) != NULL)
|
if ((error = dlerror()) != NULL)
|
||||||
|
|||||||
@ -477,7 +477,8 @@ public:
|
|||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
void write(Ostream&, bool subDict=true) const;
|
//- Write dictionary, normally with sub-dictionary formatting
|
||||||
|
void write(Ostream&, const bool subDict=true) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -146,7 +146,7 @@ public:
|
|||||||
//- Return non-const access to dictionary
|
//- Return non-const access to dictionary
|
||||||
dictionary& dict();
|
dictionary& dict();
|
||||||
|
|
||||||
// Write
|
//- Write
|
||||||
void write(Ostream&) const;
|
void write(Ostream&) const;
|
||||||
|
|
||||||
//- Return info proxy.
|
//- Return info proxy.
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -35,9 +35,9 @@ License
|
|||||||
#include "dlLibraryTable.H"
|
#include "dlLibraryTable.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "Pstream.H"
|
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -71,30 +71,27 @@ bool Foam::functionEntries::codeStream::execute
|
|||||||
Istream& is
|
Istream& is
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (isAdministrator())
|
codeStreamTools::checkSecurity
|
||||||
{
|
(
|
||||||
FatalIOErrorIn
|
"functionEntries::codeStream::execute(..)",
|
||||||
(
|
parentDict
|
||||||
"functionEntries::codeStream::execute(..)",
|
);
|
||||||
parentDict
|
|
||||||
) << "This code should not be executed by someone with administrator"
|
// get code dictionary
|
||||||
<< " rights due to security reasons." << endl
|
// must reference parent for stringOps::expand to work nicely
|
||||||
<< "(it writes a shared library which then gets loaded "
|
dictionary codeDict("#codeStream", parentDict, is);
|
||||||
<< "using dlopen)"
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Read three sections of code.
|
// Read three sections of code.
|
||||||
// Remove any leading whitespace - necessary for compilation options,
|
// Remove any leading whitespace - necessary for compilation options,
|
||||||
// convenience for includes and body.
|
// convenience for includes and body.
|
||||||
dictionary codeDict(is);
|
|
||||||
|
|
||||||
// "codeInclude" is optional
|
// "codeInclude" is optional
|
||||||
string codeInclude;
|
string codeInclude;
|
||||||
if (codeDict.found("codeInclude"))
|
if (codeDict.found("codeInclude"))
|
||||||
{
|
{
|
||||||
codeInclude = stringOps::trim(codeDict["codeInclude"]);
|
codeInclude = stringOps::trim(codeDict["codeInclude"]);
|
||||||
|
stringOps::inplaceExpand(codeInclude, codeDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "codeOptions" is optional
|
// "codeOptions" is optional
|
||||||
@ -102,10 +99,13 @@ bool Foam::functionEntries::codeStream::execute
|
|||||||
if (codeDict.found("codeOptions"))
|
if (codeDict.found("codeOptions"))
|
||||||
{
|
{
|
||||||
codeOptions = stringOps::trim(codeDict["codeOptions"]);
|
codeOptions = stringOps::trim(codeDict["codeOptions"]);
|
||||||
|
stringOps::inplaceExpand(codeOptions, codeDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "code" is mandatory
|
// "code" is mandatory
|
||||||
string code = stringOps::trim(codeDict["code"]);
|
string code = stringOps::trim(codeDict["code"]);
|
||||||
|
stringOps::inplaceExpand(code, codeDict);
|
||||||
|
|
||||||
|
|
||||||
// Create SHA1 digest from the contents
|
// Create SHA1 digest from the contents
|
||||||
SHA1Digest sha;
|
SHA1Digest sha;
|
||||||
@ -169,6 +169,7 @@ bool Foam::functionEntries::codeStream::execute
|
|||||||
copyFiles[0].file() = fileCsrc;
|
copyFiles[0].file() = fileCsrc;
|
||||||
copyFiles[0].set("codeInclude", codeInclude);
|
copyFiles[0].set("codeInclude", codeInclude);
|
||||||
copyFiles[0].set("code", code);
|
copyFiles[0].set("code", code);
|
||||||
|
copyFiles[0].set("SHA1sum", sha.str());
|
||||||
|
|
||||||
List<codeStreamTools::fileAndContent> filesContents(2);
|
List<codeStreamTools::fileAndContent> filesContents(2);
|
||||||
|
|
||||||
@ -212,6 +213,7 @@ bool Foam::functionEntries::codeStream::execute
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// all processes must wait for compile
|
||||||
bool dummy = true;
|
bool dummy = true;
|
||||||
reduce(dummy, orOp<bool>());
|
reduce(dummy, orOp<bool>());
|
||||||
|
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -168,6 +168,9 @@ public:
|
|||||||
//- Write
|
//- Write
|
||||||
void write(Ostream&) const;
|
void write(Ostream&) const;
|
||||||
|
|
||||||
|
//- Write, optionally with contents only (no keyword, etc)
|
||||||
|
void write(Ostream&, const bool contentsOnly) const;
|
||||||
|
|
||||||
//- Return info proxy.
|
//- Return info proxy.
|
||||||
// Used to print token information to a stream
|
// Used to print token information to a stream
|
||||||
InfoProxy<primitiveEntry> info() const
|
InfoProxy<primitiveEntry> info() const
|
||||||
|
|||||||
@ -210,31 +210,43 @@ Foam::primitiveEntry::primitiveEntry(const keyType& key, Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::primitiveEntry::write(Ostream& os) const
|
void Foam::primitiveEntry::write(Ostream& os, const bool contentsOnly) const
|
||||||
{
|
{
|
||||||
os.writeKeyword(keyword());
|
if (!contentsOnly)
|
||||||
|
{
|
||||||
|
os.writeKeyword(keyword());
|
||||||
|
}
|
||||||
|
|
||||||
for (label i=0; i<size(); ++i)
|
for (label i=0; i<size(); ++i)
|
||||||
{
|
{
|
||||||
const token& t = operator[](i);
|
const token& t = operator[](i);
|
||||||
if (t.type() == token::VERBATIMSTRING)
|
if (t.type() == token::VERBATIMSTRING)
|
||||||
{
|
{
|
||||||
os << token::HASH << token::BEGIN_BLOCK;
|
os << token::HASH << token::BEGIN_BLOCK;
|
||||||
os.writeQuoted(t.stringToken(), false);
|
os.writeQuoted(t.stringToken(), false);
|
||||||
os << token::HASH << token::END_BLOCK;
|
os << token::HASH << token::END_BLOCK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os << t;
|
os << t;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < size()-1)
|
if (i < size()-1)
|
||||||
{
|
{
|
||||||
os << token::SPACE;
|
os << token::SPACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
os << token::END_STATEMENT << endl;
|
if (!contentsOnly)
|
||||||
|
{
|
||||||
|
os << token::END_STATEMENT << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::primitiveEntry::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
this->write(os, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -49,30 +49,37 @@ const Foam::fileName Foam::codeStreamTools::codeTemplateDirName
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fileName Foam::codeStreamTools::baseDir()
|
void Foam::codeStreamTools::checkSecurity
|
||||||
|
(
|
||||||
|
const char* title,
|
||||||
|
const dictionary& context
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return stringOps::expandEnv("$FOAM_CASE/codeStream");
|
if (isAdministrator())
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
title,
|
||||||
|
context
|
||||||
|
) << "This code should not be executed by someone with administrator"
|
||||||
|
<< " rights due to security reasons." << nl
|
||||||
|
<< "(it writes a shared library which then gets loaded "
|
||||||
|
<< "using dlopen)"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::codeStreamTools::libSubDir()
|
|
||||||
{
|
|
||||||
return stringOps::expandEnv("platforms/$WM_OPTIONS/lib");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::codeStreamTools::codePath(const word& subDirName)
|
Foam::fileName Foam::codeStreamTools::codePath(const word& subDirName)
|
||||||
{
|
{
|
||||||
return stringOps::expandEnv
|
return stringOps::expand("$FOAM_CASE/codeStream/" + subDirName);
|
||||||
(
|
|
||||||
"$FOAM_CASE/codeStream/" + subDirName
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::codeStreamTools::libPath(const word& codeName)
|
Foam::fileName Foam::codeStreamTools::libPath(const word& codeName)
|
||||||
{
|
{
|
||||||
return stringOps::expandEnv
|
return stringOps::expand
|
||||||
(
|
(
|
||||||
"$FOAM_CASE/codeStream/platforms/$WM_OPTIONS/lib/lib"
|
"$FOAM_CASE/codeStream/platforms/$WM_OPTIONS/lib/lib"
|
||||||
+ codeName + ".so"
|
+ codeName + ".so"
|
||||||
@ -159,12 +166,11 @@ void Foam::codeStreamTools::copyAndExpand
|
|||||||
{
|
{
|
||||||
is.getLine(line);
|
is.getLine(line);
|
||||||
|
|
||||||
// normal expansion according to mapping
|
// expand according to mapping
|
||||||
|
// expanding according to env variables might cause too many
|
||||||
|
// surprises
|
||||||
stringOps::inplaceExpand(line, mapping);
|
stringOps::inplaceExpand(line, mapping);
|
||||||
|
|
||||||
// expand according to env variables
|
|
||||||
stringOps::inplaceExpandEnv(line, true, true);
|
|
||||||
|
|
||||||
os << line.c_str() << nl;
|
os << line.c_str() << nl;
|
||||||
}
|
}
|
||||||
while (is.good());
|
while (is.good());
|
||||||
@ -269,6 +275,13 @@ bool Foam::codeStreamTools::copyFilesContents(const fileName& dir) const
|
|||||||
// variables mapping
|
// variables mapping
|
||||||
HashTable<string> mapping(copyFiles_[i]);
|
HashTable<string> mapping(copyFiles_[i]);
|
||||||
mapping.set("typeName", name_);
|
mapping.set("typeName", name_);
|
||||||
|
|
||||||
|
// provide a zero digest if not otherwise specified
|
||||||
|
if (!mapping.found("SHA1sum"))
|
||||||
|
{
|
||||||
|
mapping.insert("SHA1sum", SHA1Digest().str());
|
||||||
|
}
|
||||||
|
|
||||||
copyAndExpand(is, os, mapping);
|
copyAndExpand(is, os, mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -145,13 +145,12 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Directory for compile/link (case-specific)
|
//- Check security for creating dynamic code
|
||||||
// Expanded from \$FOAM_CASE/codeStream
|
static void checkSecurity
|
||||||
static fileName baseDir();
|
(
|
||||||
|
const char* title,
|
||||||
//- Subdirectory name for library
|
const dictionary& context
|
||||||
// Expanded from platforms/\$WM_OPTIONS/lib
|
);
|
||||||
static fileName libSubDir();
|
|
||||||
|
|
||||||
//- Local path for specified code name
|
//- Local path for specified code name
|
||||||
// Expanded from \$FOAM_CASE/codeStream
|
// Expanded from \$FOAM_CASE/codeStream
|
||||||
|
|||||||
@ -93,8 +93,7 @@ Foam::string& Foam::string::replaceAll
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Expand all occurences of environment variables and initial tilde sequences
|
Foam::string& Foam::string::expand(const bool allowEmpty)
|
||||||
Foam::string& Foam::string::expand(const bool recurse, const bool allowEmptyVar)
|
|
||||||
{
|
{
|
||||||
size_type begVar = 0;
|
size_type begVar = 0;
|
||||||
|
|
||||||
@ -134,20 +133,15 @@ Foam::string& Foam::string::expand(const bool recurse, const bool allowEmptyVar)
|
|||||||
|
|
||||||
if (endVar != npos && endVar != begVar)
|
if (endVar != npos && endVar != begVar)
|
||||||
{
|
{
|
||||||
string varName = substr
|
const string varName = substr
|
||||||
(
|
(
|
||||||
begVar + 1 + delim,
|
begVar + 1 + delim,
|
||||||
endVar - begVar - 2*delim
|
endVar - begVar - 2*delim
|
||||||
);
|
);
|
||||||
|
|
||||||
string varValue = getEnv(varName);
|
const string varValue = getEnv(varName);
|
||||||
|
|
||||||
if (varValue.size())
|
if (varValue.size())
|
||||||
{
|
{
|
||||||
if (recurse)
|
|
||||||
{
|
|
||||||
varValue.expand(recurse, allowEmptyVar);
|
|
||||||
}
|
|
||||||
std::string::replace
|
std::string::replace
|
||||||
(
|
(
|
||||||
begVar,
|
begVar,
|
||||||
@ -156,7 +150,7 @@ Foam::string& Foam::string::expand(const bool recurse, const bool allowEmptyVar)
|
|||||||
);
|
);
|
||||||
begVar += varValue.size();
|
begVar += varValue.size();
|
||||||
}
|
}
|
||||||
else if (allowEmptyVar)
|
else if (allowEmpty)
|
||||||
{
|
{
|
||||||
std::string::replace
|
std::string::replace
|
||||||
(
|
(
|
||||||
|
|||||||
@ -180,13 +180,10 @@ public:
|
|||||||
// - leading "~user" : home directory for specified user
|
// - leading "~user" : home directory for specified user
|
||||||
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
||||||
//
|
//
|
||||||
|
// Any unknown entries are removed silently if allowEmpty is true
|
||||||
// \sa
|
// \sa
|
||||||
// Foam::findEtcFile
|
// Foam::findEtcFile
|
||||||
string& expand
|
string& expand(const bool allowEmpty = false);
|
||||||
(
|
|
||||||
const bool recurse=false,
|
|
||||||
const bool allowEmptyVar = false
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Remove repeated characters returning true if string changed
|
//- Remove repeated characters returning true if string changed
|
||||||
bool removeRepeated(const char);
|
bool removeRepeated(const char);
|
||||||
|
|||||||
@ -24,7 +24,9 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "stringOps.H"
|
#include "stringOps.H"
|
||||||
|
#include "typeInfo.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
#include "OStringStream.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -73,10 +75,17 @@ Foam::string& Foam::stringOps::inplaceExpand
|
|||||||
{
|
{
|
||||||
string::iterator iter = s.begin() + begVar + 1;
|
string::iterator iter = s.begin() + begVar + 1;
|
||||||
|
|
||||||
|
// more generous in accepting keywords than for env variables
|
||||||
while
|
while
|
||||||
(
|
(
|
||||||
iter != s.end()
|
iter != s.end()
|
||||||
&& (isalnum(*iter) || *iter == '_')
|
&&
|
||||||
|
(
|
||||||
|
isalnum(*iter)
|
||||||
|
|| *iter == '.'
|
||||||
|
|| *iter == ':'
|
||||||
|
|| *iter == '_'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
++iter;
|
++iter;
|
||||||
@ -86,10 +95,14 @@ Foam::string& Foam::stringOps::inplaceExpand
|
|||||||
|
|
||||||
if (endVar != string::npos && endVar != begVar)
|
if (endVar != string::npos && endVar != begVar)
|
||||||
{
|
{
|
||||||
string varName = s.substr
|
const word varName
|
||||||
(
|
(
|
||||||
begVar + 1 + delim,
|
s.substr
|
||||||
endVar - begVar - 2*delim
|
(
|
||||||
|
begVar + 1 + delim,
|
||||||
|
endVar - begVar - 2*delim
|
||||||
|
),
|
||||||
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
HashTable<string, word, string::hash>::const_iterator fnd =
|
HashTable<string, word, string::hash>::const_iterator fnd =
|
||||||
@ -130,24 +143,145 @@ Foam::string& Foam::stringOps::inplaceExpand
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::string Foam::stringOps::expandEnv
|
Foam::string Foam::stringOps::expand
|
||||||
(
|
(
|
||||||
const string& original,
|
const string& original,
|
||||||
const bool recurse,
|
const dictionary& dict,
|
||||||
const bool allowEmptyVar
|
const char sigil
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
string s(original);
|
string s(original);
|
||||||
return inplaceExpandEnv(s, recurse, allowEmptyVar);
|
return inplaceExpand(s, dict, sigil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Expand all occurences of environment variables and initial tilde sequences
|
Foam::string& Foam::stringOps::inplaceExpand
|
||||||
Foam::string& Foam::stringOps::inplaceExpandEnv
|
|
||||||
(
|
(
|
||||||
string& s,
|
string& s,
|
||||||
const bool recurse,
|
const dictionary& dict,
|
||||||
const bool allowEmptyVar
|
const char sigil
|
||||||
|
)
|
||||||
|
{
|
||||||
|
string::size_type begVar = 0;
|
||||||
|
|
||||||
|
// Expand $VAR or ${VAR}
|
||||||
|
// Repeat until nothing more is found
|
||||||
|
while
|
||||||
|
(
|
||||||
|
(begVar = s.find(sigil, begVar)) != string::npos
|
||||||
|
&& begVar < s.size()-1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (begVar == 0 || s[begVar-1] != '\\')
|
||||||
|
{
|
||||||
|
// Find end of first occurrence
|
||||||
|
string::size_type endVar = begVar;
|
||||||
|
string::size_type delim = 0;
|
||||||
|
|
||||||
|
if (s[begVar+1] == '{')
|
||||||
|
{
|
||||||
|
endVar = s.find('}', begVar);
|
||||||
|
delim = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string::iterator iter = s.begin() + begVar + 1;
|
||||||
|
|
||||||
|
// more generous in accepting keywords than for env variables
|
||||||
|
while
|
||||||
|
(
|
||||||
|
iter != s.end()
|
||||||
|
&&
|
||||||
|
(
|
||||||
|
isalnum(*iter)
|
||||||
|
|| *iter == '.'
|
||||||
|
|| *iter == ':'
|
||||||
|
|| *iter == '_'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
++iter;
|
||||||
|
++endVar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endVar != string::npos && endVar != begVar)
|
||||||
|
{
|
||||||
|
const word varName
|
||||||
|
(
|
||||||
|
s.substr
|
||||||
|
(
|
||||||
|
begVar + 1 + delim,
|
||||||
|
endVar - begVar - 2*delim
|
||||||
|
),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// lookup in the dictionary
|
||||||
|
const entry* ePtr = dict.lookupEntryPtr(varName, true, true);
|
||||||
|
|
||||||
|
// if defined - copy its entries
|
||||||
|
if (ePtr)
|
||||||
|
{
|
||||||
|
OStringStream buf;
|
||||||
|
if (ePtr->isDict())
|
||||||
|
{
|
||||||
|
ePtr->dict().write(buf, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// fail for other types
|
||||||
|
dynamicCast<const primitiveEntry>
|
||||||
|
(
|
||||||
|
*ePtr
|
||||||
|
).write(buf, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
s.std::string::replace
|
||||||
|
(
|
||||||
|
begVar,
|
||||||
|
endVar - begVar + 1,
|
||||||
|
buf.str()
|
||||||
|
);
|
||||||
|
begVar += buf.str().size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// not defined - leave original string untouched
|
||||||
|
begVar = endVar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++begVar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::string Foam::stringOps::expand
|
||||||
|
(
|
||||||
|
const string& original,
|
||||||
|
const bool allowEmpty
|
||||||
|
)
|
||||||
|
{
|
||||||
|
string s(original);
|
||||||
|
return inplaceExpand(s, allowEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::string& Foam::stringOps::inplaceExpand
|
||||||
|
(
|
||||||
|
string& s,
|
||||||
|
const bool allowEmpty
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
string::size_type begVar = 0;
|
string::size_type begVar = 0;
|
||||||
@ -188,20 +322,19 @@ Foam::string& Foam::stringOps::inplaceExpandEnv
|
|||||||
|
|
||||||
if (endVar != string::npos && endVar != begVar)
|
if (endVar != string::npos && endVar != begVar)
|
||||||
{
|
{
|
||||||
string varName = s.substr
|
const word varName
|
||||||
(
|
(
|
||||||
begVar + 1 + delim,
|
s.substr
|
||||||
endVar - begVar - 2*delim
|
(
|
||||||
|
begVar + 1 + delim,
|
||||||
|
endVar - begVar - 2*delim
|
||||||
|
),
|
||||||
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
string varValue = getEnv(varName);
|
const string varValue = getEnv(varName);
|
||||||
|
|
||||||
if (varValue.size())
|
if (varValue.size())
|
||||||
{
|
{
|
||||||
if (recurse)
|
|
||||||
{
|
|
||||||
varValue.expand(recurse, allowEmptyVar);
|
|
||||||
}
|
|
||||||
s.std::string::replace
|
s.std::string::replace
|
||||||
(
|
(
|
||||||
begVar,
|
begVar,
|
||||||
@ -210,7 +343,7 @@ Foam::string& Foam::stringOps::inplaceExpandEnv
|
|||||||
);
|
);
|
||||||
begVar += varValue.size();
|
begVar += varValue.size();
|
||||||
}
|
}
|
||||||
else if (allowEmptyVar)
|
else if (allowEmpty)
|
||||||
{
|
{
|
||||||
s.std::string::replace
|
s.std::string::replace
|
||||||
(
|
(
|
||||||
@ -221,7 +354,10 @@ Foam::string& Foam::stringOps::inplaceExpandEnv
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn("string::expand(const bool, const bool)")
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"stringOps::inplaceExpand(string&, const bool)"
|
||||||
|
)
|
||||||
<< "Unknown variable name " << varName << '.'
|
<< "Unknown variable name " << varName << '.'
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -294,7 +430,7 @@ Foam::string Foam::stringOps::trimLeft(const string& s)
|
|||||||
if (!s.empty())
|
if (!s.empty())
|
||||||
{
|
{
|
||||||
string::size_type beg = 0;
|
string::size_type beg = 0;
|
||||||
while (isspace(s[beg]))
|
while (beg < s.size() && isspace(s[beg]))
|
||||||
{
|
{
|
||||||
++beg;
|
++beg;
|
||||||
}
|
}
|
||||||
@ -314,7 +450,7 @@ Foam::string& Foam::stringOps::inplaceTrimLeft(string& s)
|
|||||||
if (!s.empty())
|
if (!s.empty())
|
||||||
{
|
{
|
||||||
string::size_type beg = 0;
|
string::size_type beg = 0;
|
||||||
while (isspace(s[beg]))
|
while (beg < s.size() && isspace(s[beg]))
|
||||||
{
|
{
|
||||||
++beg;
|
++beg;
|
||||||
}
|
}
|
||||||
@ -380,4 +516,5 @@ Foam::string& Foam::stringOps::inplaceTrim(string& s)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -36,6 +36,7 @@ SourceFiles
|
|||||||
#define stringOps_H
|
#define stringOps_H
|
||||||
|
|
||||||
#include "string.H"
|
#include "string.H"
|
||||||
|
#include "dictionary.H"
|
||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -54,6 +55,8 @@ namespace stringOps
|
|||||||
// -# variables
|
// -# variables
|
||||||
// - "$VAR", "${VAR}"
|
// - "$VAR", "${VAR}"
|
||||||
//
|
//
|
||||||
|
// Any unknown entries are removed
|
||||||
|
//
|
||||||
// \note the leading sigil can be changed to avoid conflicts with other
|
// \note the leading sigil can be changed to avoid conflicts with other
|
||||||
// string expansions
|
// string expansions
|
||||||
string expand
|
string expand
|
||||||
@ -69,6 +72,8 @@ namespace stringOps
|
|||||||
// -# variables
|
// -# variables
|
||||||
// - "$VAR", "${VAR}"
|
// - "$VAR", "${VAR}"
|
||||||
//
|
//
|
||||||
|
// Any unknown entries are removed
|
||||||
|
//
|
||||||
// \note the leading sigil can be changed to avoid conflicts with other
|
// \note the leading sigil can be changed to avoid conflicts with other
|
||||||
// string expansions
|
// string expansions
|
||||||
string& inplaceExpand
|
string& inplaceExpand
|
||||||
@ -78,6 +83,39 @@ namespace stringOps
|
|||||||
const char sigil = '$'
|
const char sigil = '$'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Expand occurences of variables according to the dictionary
|
||||||
|
// Expansion includes:
|
||||||
|
// -# variables
|
||||||
|
// - "$VAR", "${VAR}"
|
||||||
|
//
|
||||||
|
// Any unknown entries are left as-is
|
||||||
|
//
|
||||||
|
// \note the leading sigil can be changed to avoid conflicts with other
|
||||||
|
// string expansions
|
||||||
|
string expand
|
||||||
|
(
|
||||||
|
const string&,
|
||||||
|
const dictionary& dict,
|
||||||
|
const char sigil = '$'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Inplace expand occurences of variables according to the dictionary
|
||||||
|
// Expansion includes:
|
||||||
|
// -# variables
|
||||||
|
// - "$VAR", "${VAR}"
|
||||||
|
//
|
||||||
|
// Any unknown entries are left as-is
|
||||||
|
//
|
||||||
|
// \note the leading sigil can be changed to avoid conflicts with other
|
||||||
|
// string expansions
|
||||||
|
string& inplaceExpand
|
||||||
|
(
|
||||||
|
string&,
|
||||||
|
const dictionary& dict,
|
||||||
|
const char sigil = '$'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Expand initial tildes and all occurences of environment variables
|
//- Expand initial tildes and all occurences of environment variables
|
||||||
// Expansion includes:
|
// Expansion includes:
|
||||||
@ -90,13 +128,13 @@ namespace stringOps
|
|||||||
// - leading "~user" : home directory for specified user
|
// - leading "~user" : home directory for specified user
|
||||||
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
||||||
//
|
//
|
||||||
|
// Any unknown entries are removed silently if allowEmpty is true
|
||||||
// \sa
|
// \sa
|
||||||
// Foam::findEtcFile
|
// Foam::findEtcFile
|
||||||
string expandEnv
|
string expand
|
||||||
(
|
(
|
||||||
const string&,
|
const string&,
|
||||||
const bool recurse=false,
|
const bool allowEmpty = false
|
||||||
const bool allowEmptyVar = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -111,13 +149,13 @@ namespace stringOps
|
|||||||
// - leading "~user" : home directory for specified user
|
// - leading "~user" : home directory for specified user
|
||||||
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
|
||||||
//
|
//
|
||||||
|
// Any unknown entries are removed silently if allowEmpty is true
|
||||||
// \sa
|
// \sa
|
||||||
// Foam::findEtcFile
|
// Foam::findEtcFile
|
||||||
string& inplaceExpandEnv
|
string& inplaceExpand
|
||||||
(
|
(
|
||||||
string&,
|
string&,
|
||||||
const bool recurse=false,
|
const bool allowEmpty = false
|
||||||
const bool allowEmptyVar = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -128,23 +166,18 @@ namespace stringOps
|
|||||||
string& inplaceTrimLeft(string&);
|
string& inplaceTrimLeft(string&);
|
||||||
|
|
||||||
//- Return string trimmed of trailing whitespace
|
//- Return string trimmed of trailing whitespace
|
||||||
// NOT IMPLEMENTED
|
|
||||||
string trimRight(const string&);
|
string trimRight(const string&);
|
||||||
|
|
||||||
//- Trim trailing whitespace inplace
|
//- Trim trailing whitespace inplace
|
||||||
// NOT IMPLEMENTED
|
|
||||||
string& inplaceTrimRight(string&);
|
string& inplaceTrimRight(string&);
|
||||||
|
|
||||||
//- Return string trimmed of leading and trailing whitespace
|
//- Return string trimmed of leading and trailing whitespace
|
||||||
// NOT IMPLEMENTED
|
|
||||||
string trim(const string&);
|
string trim(const string&);
|
||||||
|
|
||||||
//- Trim leading and trailing whitespace inplace
|
//- Trim leading and trailing whitespace inplace
|
||||||
// NOT IMPLEMENTED
|
|
||||||
string& inplaceTrim(string&);
|
string& inplaceTrim(string&);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // End namespace stringOps
|
} // End namespace stringOps
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -96,6 +96,7 @@ void Foam::codedFixedValueFvPatchScalarField::writeLibrary
|
|||||||
if (dict.found("codeInclude"))
|
if (dict.found("codeInclude"))
|
||||||
{
|
{
|
||||||
codeInclude = stringOps::trim(dict["codeInclude"]);
|
codeInclude = stringOps::trim(dict["codeInclude"]);
|
||||||
|
stringOps::inplaceExpand(codeInclude, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "codeOptions" is optional
|
// "codeOptions" is optional
|
||||||
@ -103,10 +104,13 @@ void Foam::codedFixedValueFvPatchScalarField::writeLibrary
|
|||||||
if (dict.found("codeOptions"))
|
if (dict.found("codeOptions"))
|
||||||
{
|
{
|
||||||
codeOptions = stringOps::trim(dict["codeOptions"]);
|
codeOptions = stringOps::trim(dict["codeOptions"]);
|
||||||
|
stringOps::inplaceExpand(codeOptions, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "code" is mandatory
|
// "code" is mandatory
|
||||||
string code = stringOps::trim(dict["code"]);
|
string code = stringOps::trim(dict["code"]);
|
||||||
|
stringOps::inplaceExpand(code, dict);
|
||||||
|
|
||||||
|
|
||||||
// Create SHA1 digest from the contents
|
// Create SHA1 digest from the contents
|
||||||
SHA1Digest sha;
|
SHA1Digest sha;
|
||||||
@ -120,7 +124,9 @@ void Foam::codedFixedValueFvPatchScalarField::writeLibrary
|
|||||||
// <<"new SHA1: " << sha << endl;
|
// <<"new SHA1: " << sha << endl;
|
||||||
|
|
||||||
|
|
||||||
// (void) codeStreamTools::upToDate(codePath, sha)
|
// only use side-effect of writing SHA1Digest for now
|
||||||
|
(void) codeStreamTools::upToDate(codePath, sha);
|
||||||
|
|
||||||
// TODO: compile on-demand
|
// TODO: compile on-demand
|
||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
@ -148,6 +154,7 @@ void Foam::codedFixedValueFvPatchScalarField::writeLibrary
|
|||||||
copyFiles[0].file() = fileCsrc;
|
copyFiles[0].file() = fileCsrc;
|
||||||
copyFiles[0].set("codeInclude", codeInclude);
|
copyFiles[0].set("codeInclude", codeInclude);
|
||||||
copyFiles[0].set("code", code);
|
copyFiles[0].set("code", code);
|
||||||
|
copyFiles[0].set("SHA1sum", sha.str());
|
||||||
|
|
||||||
copyFiles[1].file() = fileHsrc;
|
copyFiles[1].file() = fileHsrc;
|
||||||
|
|
||||||
@ -186,18 +193,11 @@ void Foam::codedFixedValueFvPatchScalarField::writeLibrary
|
|||||||
|
|
||||||
void Foam::codedFixedValueFvPatchScalarField::updateLibrary()
|
void Foam::codedFixedValueFvPatchScalarField::updateLibrary()
|
||||||
{
|
{
|
||||||
if (isAdministrator())
|
codeStreamTools::checkSecurity
|
||||||
{
|
(
|
||||||
FatalIOErrorIn
|
"codedFixedValueFvPatchScalarField::updateLibrary()",
|
||||||
(
|
dict_
|
||||||
"codedFixedValueFvPatchScalarField::updateLibrary()",
|
);
|
||||||
dict_
|
|
||||||
) << "This code should not be executed by someone with administrator"
|
|
||||||
<< " rights due to security reasons." << endl
|
|
||||||
<< "(it writes a shared library which then gets loaded "
|
|
||||||
<< "using dlopen)"
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
// write code into redirectType_ subdir
|
// write code into redirectType_ subdir
|
||||||
const fileName codePath = codeStreamTools::codePath(redirectType_);
|
const fileName codePath = codeStreamTools::codePath(redirectType_);
|
||||||
@ -216,6 +216,16 @@ void Foam::codedFixedValueFvPatchScalarField::updateLibrary()
|
|||||||
|
|
||||||
void* lib = dlLibraryTable::findLibrary(libPath);
|
void* lib = dlLibraryTable::findLibrary(libPath);
|
||||||
|
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
// calculate old/new SHA1 for code
|
||||||
|
// check if the correct library version was already loaded.
|
||||||
|
// Find the library handle.
|
||||||
|
//
|
||||||
|
// string signatureName(redirectType_ + "_" + sha().str());
|
||||||
|
// void (*signatureFunction)();
|
||||||
|
// signatureFunction = reinterpret_cast<void(*)()>(dlSym(lib, signatureName));
|
||||||
|
|
||||||
if (dict_.found("code"))
|
if (dict_.found("code"))
|
||||||
{
|
{
|
||||||
if (!lib)
|
if (!lib)
|
||||||
@ -270,6 +280,7 @@ void Foam::codedFixedValueFvPatchScalarField::updateLibrary()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// all processes must wait for compile
|
||||||
bool dummy = true;
|
bool dummy = true;
|
||||||
reduce(dummy, orOp<bool>());
|
reduce(dummy, orOp<bool>());
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ void Foam::systemCall::execute()
|
|||||||
{
|
{
|
||||||
forAll(executeCalls_, callI)
|
forAll(executeCalls_, callI)
|
||||||
{
|
{
|
||||||
Foam::system(executeCalls_[callI].c_str());
|
Foam::system(executeCalls_[callI]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ void Foam::systemCall::end()
|
|||||||
{
|
{
|
||||||
forAll(endCalls_, callI)
|
forAll(endCalls_, callI)
|
||||||
{
|
{
|
||||||
Foam::system(endCalls_[callI].c_str());
|
Foam::system(endCalls_[callI]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ void Foam::systemCall::write()
|
|||||||
{
|
{
|
||||||
forAll(writeCalls_, callI)
|
forAll(writeCalls_, callI)
|
||||||
{
|
{
|
||||||
Foam::system(writeCalls_[callI].c_str());
|
Foam::system(writeCalls_[callI]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\ / O peration | Version: dev.olesenm |
|
| \\ / O peration | Version: dev |
|
||||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -4,7 +4,7 @@ include $(GENERAL_RULES)/sourceToDep
|
|||||||
|
|
||||||
include $(GENERAL_RULES)/flex
|
include $(GENERAL_RULES)/flex
|
||||||
include $(GENERAL_RULES)/flex++
|
include $(GENERAL_RULES)/flex++
|
||||||
include $(GENERAL_RULES)/coco-cpp
|
## include $(GENERAL_RULES)/coco-cpp
|
||||||
## include $(GENERAL_RULES)/byacc
|
## include $(GENERAL_RULES)/byacc
|
||||||
## include $(GENERAL_RULES)/btyacc++
|
## include $(GENERAL_RULES)/btyacc++
|
||||||
include $(GENERAL_RULES)/bison
|
include $(GENERAL_RULES)/bison
|
||||||
|
|||||||
Reference in New Issue
Block a user