mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use dynamicCode/ instead of codeStream/ for dynamically generated code
This commit is contained in:
@ -140,7 +140,7 @@
|
||||
+ only files that can be re-read are being checked. Drastic reduction of
|
||||
number of files to check.
|
||||
*** *New* #codeStream dictionary entry
|
||||
Uses on-the-fly compilation of OpenFOAM C++ code to construct dictionary.
|
||||
Uses dynamic compilation of OpenFOAM C++ code to construct dictionary.
|
||||
E.g. in blockMeshDict:
|
||||
#+BEGIN_SRC c++
|
||||
convertToMeters 0.001;
|
||||
@ -160,7 +160,7 @@
|
||||
#};
|
||||
}
|
||||
#+END_SRC
|
||||
See also ./[[doc/changes/codeStream.org]]
|
||||
See also ./[[doc/changes/dynamicCode.org]]
|
||||
|
||||
* Solvers
|
||||
A number of new solvers have been developed for a range of engineering
|
||||
@ -191,7 +191,7 @@
|
||||
+ takes optional fieldName to sample
|
||||
+ directMapped patch added 'normal' method to calculate sample points
|
||||
to e.g. sample fields just above wall (e.g. for streaklines)
|
||||
+ *New* codedFixedValue: Uses the on-the-fly code compilation from #codeStream
|
||||
+ *New* codedFixedValue: Uses the dynamic code compilation from #codeStream
|
||||
to provide an in-line fixedValueFvPatchScalarField. E.g.
|
||||
#+BEGIN_SRC c++
|
||||
outlet
|
||||
@ -206,7 +206,7 @@
|
||||
#};
|
||||
}
|
||||
#+END_SRC
|
||||
See also [[./doc/changes/codeStream.org]]
|
||||
See also [[./doc/changes/dynamicCode.org]]
|
||||
|
||||
* Utilities
|
||||
There have been some utilities added and updated in this release.
|
||||
|
||||
@ -57,13 +57,13 @@ cleanTimeDirectories()
|
||||
|
||||
|
||||
#
|
||||
# Remove codeStream subdirectory if it looks appropriate
|
||||
# Remove dynamicCode subdirectory if it looks appropriate
|
||||
#
|
||||
cleanCodeStream()
|
||||
cleanDynamicCode()
|
||||
{
|
||||
if [ -d system -a -d codeStream ]
|
||||
if [ -d system -a -d dynamicCode ]
|
||||
then
|
||||
rm -rf codeStream > /dev/null 2>&1
|
||||
rm -rf dynamicCode > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ cleanCodeStream()
|
||||
cleanCase()
|
||||
{
|
||||
cleanTimeDirectories
|
||||
cleanCodeStream
|
||||
cleanDynamicCode
|
||||
|
||||
rm -rf processor* > /dev/null 2>&1
|
||||
rm -rf probes* > /dev/null 2>&1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# -*- mode: org; -*-
|
||||
#
|
||||
#+TITLE: =codeStream=: On-the-fly code compilation
|
||||
#+TITLE: =dynamicCode=: Dynamic code compilation
|
||||
#+AUTHOR: OpenCFD Ltd.
|
||||
#+DATE: TBA
|
||||
#+LINK: http://www.openfoam.com
|
||||
@ -47,12 +47,13 @@
|
||||
=code=, =codeInclude=, =codeOptions= sections (these are just strings) and
|
||||
calculates the SHA1 checksum of the contents.
|
||||
- it copies a template file
|
||||
=($FOAM_CODESTREAM_TEMPLATES/codeStreamTemplate.C)=, substituting all
|
||||
=(~OpenFOAM/codeTemplates/dynamicCode/codeStreamTemplate.C)= or
|
||||
=($FOAM_CODE_TEMPLATES/codeStreamTemplate.C)=, substituting all
|
||||
occurences of =code=, =codeInclude=, =codeOptions=.
|
||||
- it writes library source files to =codeStream/<SHA1>= and compiles
|
||||
- it writes library source files to =dynamicCode/<SHA1>= and compiles
|
||||
it using =wmake libso=.
|
||||
- the resulting library is generated under
|
||||
=codeStream/platforms/$WM_OPTIONS/lib= and is loaded (=dlopen=, =dlsym=)
|
||||
=dynamicCode/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
|
||||
used to construct the entry to replace the whole =#codeStream= section.
|
||||
@ -39,7 +39,7 @@ InfoSwitches
|
||||
writePrecision 6;
|
||||
writeJobInfo 0;
|
||||
|
||||
// Allow case-supplied c++ code (#codeStream, codedFixedValue)
|
||||
// Allow case-supplied C++ code (#codeStream, codedFixedValue)
|
||||
allowSystemOperations 0;
|
||||
}
|
||||
|
||||
|
||||
@ -63,8 +63,9 @@ setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/
|
||||
setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
|
||||
setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
|
||||
|
||||
# codeStream templates
|
||||
setenv FOAM_CODESTREAM_TEMPLATE_DIR $WM_PROJECT_DIR/etc/codeTemplates/codeStream
|
||||
# dynamicCode templates
|
||||
# - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
|
||||
# setenv FOAM_CODE_TEMPLATES $WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
|
||||
|
||||
# convenience
|
||||
setenv FOAM_APP $WM_PROJECT_DIR/applications
|
||||
|
||||
@ -86,8 +86,9 @@ export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/
|
||||
export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
|
||||
export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
|
||||
|
||||
# codeStream templates
|
||||
export FOAM_CODESTREAM_TEMPLATE_DIR=$WM_PROJECT_DIR/etc/codeTemplates/codeStream
|
||||
# dynamicCode templates
|
||||
# - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
|
||||
# export FOAM_CODE_TEMPLATES=$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
|
||||
|
||||
# convenience
|
||||
export FOAM_APP=$WM_PROJECT_DIR/applications
|
||||
|
||||
@ -41,10 +41,10 @@ int Foam::codeStreamTools::allowSystemOperations
|
||||
|
||||
|
||||
const Foam::word Foam::codeStreamTools::codeTemplateEnvName
|
||||
= "FOAM_CODESTREAM_TEMPLATES";
|
||||
= "FOAM_CODE_TEMPLATES";
|
||||
|
||||
const Foam::fileName Foam::codeStreamTools::codeTemplateDirName
|
||||
= "codeTemplates/codeStream";
|
||||
= "codeTemplates/dynamicCode";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
@ -73,7 +73,7 @@ void Foam::codeStreamTools::checkSecurity
|
||||
|
||||
Foam::fileName Foam::codeStreamTools::codePath(const word& subDirName)
|
||||
{
|
||||
return stringOps::expand("$FOAM_CASE/codeStream/" + subDirName);
|
||||
return stringOps::expand("$FOAM_CASE/dynamicCode/" + subDirName);
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ Foam::fileName Foam::codeStreamTools::libPath(const word& codeName)
|
||||
{
|
||||
return stringOps::expand
|
||||
(
|
||||
"$FOAM_CASE/codeStream/platforms/$WM_OPTIONS/lib/lib"
|
||||
"$FOAM_CASE/dynamicCode/platforms/$WM_OPTIONS/lib/lib"
|
||||
+ codeName + ".so"
|
||||
);
|
||||
}
|
||||
@ -95,7 +95,7 @@ Foam::string Foam::codeStreamTools::libTarget(const word& codeName)
|
||||
|
||||
Foam::fileName Foam::codeStreamTools::findTemplate(const word& templateFile)
|
||||
{
|
||||
// try to get template from FOAM_CODESTREAM_TEMPLATES
|
||||
// try to get template from FOAM_CODE_TEMPLATES
|
||||
fileName templateDir(Foam::getEnv(codeTemplateEnvName));
|
||||
|
||||
fileName file;
|
||||
|
||||
Reference in New Issue
Block a user