mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: refactor codeStreamTools, use for codedFixedValueFvPatchScalarField
This commit is contained in:
@ -49,7 +49,7 @@ Example: Look up dictionary entries and do some calculation
|
|||||||
code, codeInclude, codeOptions sections (these are just strings) and
|
code, codeInclude, codeOptions sections (these are just strings) and
|
||||||
calculates the SHA1 checksum of the contents.
|
calculates the SHA1 checksum of the contents.
|
||||||
- it copies a template file
|
- it copies a template file
|
||||||
($FOAM_CODESTREAM_TEMPLATE_DIR/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
|
- it writes library source files to constant/codeStream/<sha1> and compiles it
|
||||||
using 'wmake libso'.
|
using 'wmake libso'.
|
||||||
|
|||||||
@ -102,7 +102,7 @@ Foam::string Foam::getEnv(const word& envName)
|
|||||||
bool Foam::setEnv
|
bool Foam::setEnv
|
||||||
(
|
(
|
||||||
const word& envName,
|
const word& envName,
|
||||||
const string& value,
|
const std::string& value,
|
||||||
const bool overwrite
|
const bool overwrite
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -1066,7 +1066,7 @@ bool Foam::ping(const word& hostname, const label timeOut)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Foam::system(const string& command)
|
int Foam::system(const std::string& command)
|
||||||
{
|
{
|
||||||
return ::system(command.c_str());
|
return ::system(command.c_str());
|
||||||
}
|
}
|
||||||
@ -1084,14 +1084,14 @@ bool Foam::dlClose(void* handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* Foam::dlSym(void* handle, const 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)
|
||||||
{
|
{
|
||||||
WarningIn("dlSym(void*, const string&)")
|
WarningIn("dlSym(void*, const std::string&)")
|
||||||
<< "Cannot lookup symbol " << symbol << " : " << error
|
<< "Cannot lookup symbol " << symbol << " : " << error
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,15 +57,9 @@ namespace functionEntries
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::word Foam::functionEntries::codeStream::codeTemplateName
|
const Foam::word Foam::functionEntries::codeStream::codeTemplateC
|
||||||
= "codeStreamTemplate.C";
|
= "codeStreamTemplate.C";
|
||||||
|
|
||||||
const Foam::word Foam::functionEntries::codeStream::codeTemplateEnvName
|
|
||||||
= "FOAM_CODESTREAM_TEMPLATES";
|
|
||||||
|
|
||||||
const Foam::fileName Foam::functionEntries::codeStream::codeTemplateDirName
|
|
||||||
= "codeTemplates/codeStream";
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -148,49 +142,30 @@ bool Foam::functionEntries::codeStream::execute
|
|||||||
{
|
{
|
||||||
Info<< "Creating new library in " << libPath << endl;
|
Info<< "Creating new library in " << libPath << endl;
|
||||||
|
|
||||||
fileName srcFile;
|
const fileName fileCsrc
|
||||||
|
|
||||||
// try to get template from FOAM_CODESTREAM_TEMPLATES
|
|
||||||
fileName templateDir
|
|
||||||
(
|
(
|
||||||
Foam::getEnv(codeTemplateEnvName)
|
codeStreamTools::findTemplate
|
||||||
|
(
|
||||||
|
codeTemplateC
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!templateDir.empty())
|
// not found!
|
||||||
{
|
if (fileCsrc.empty())
|
||||||
srcFile = templateDir/codeTemplateName;
|
|
||||||
if (!isFile(srcFile, false))
|
|
||||||
{
|
|
||||||
srcFile.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// not found - fallback to ~OpenFOAM expansion
|
|
||||||
if (srcFile.empty())
|
|
||||||
{
|
|
||||||
srcFile = findEtcFile
|
|
||||||
(
|
|
||||||
codeTemplateDirName/codeTemplateName
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (srcFile.empty())
|
|
||||||
{
|
{
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
"functionEntries::codeStream::execute(..)",
|
"functionEntries::codeStream::execute(..)",
|
||||||
parentDict
|
parentDict
|
||||||
) << "Could not find the code template: "
|
) << "Could not find the code template: "
|
||||||
<< codeTemplateName << nl
|
<< codeTemplateC << nl
|
||||||
<< "Under the $FOAM_CODESTREAM_TEMPLATES directory"
|
<< codeStreamTools::searchedLocations()
|
||||||
<< " via via the ~OpenFOAM/" / codeTemplateDirName
|
|
||||||
<< " expansion"
|
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<codeStreamTools::fileAndVars> copyFiles(1);
|
List<codeStreamTools::fileAndVars> copyFiles(1);
|
||||||
copyFiles[0].file() = srcFile;
|
copyFiles[0].file() = fileCsrc;
|
||||||
copyFiles[0].set("codeInclude", codeInclude);
|
copyFiles[0].set("codeInclude", codeInclude);
|
||||||
copyFiles[0].set("code", code);
|
copyFiles[0].set("code", code);
|
||||||
|
|
||||||
@ -199,7 +174,7 @@ bool Foam::functionEntries::codeStream::execute
|
|||||||
// Write Make/files
|
// Write Make/files
|
||||||
filesContents[0].first() = "Make/files";
|
filesContents[0].first() = "Make/files";
|
||||||
filesContents[0].second() =
|
filesContents[0].second() =
|
||||||
codeTemplateName + "\n"
|
codeTemplateC + "\n\n"
|
||||||
"LIB = $(FOAM_USER_LIBBIN)/lib" + name;
|
"LIB = $(FOAM_USER_LIBBIN)/lib" + name;
|
||||||
|
|
||||||
// Write Make/options
|
// Write Make/options
|
||||||
@ -214,7 +189,7 @@ bool Foam::functionEntries::codeStream::execute
|
|||||||
(
|
(
|
||||||
"functionEntries::codeStream::execute(..)",
|
"functionEntries::codeStream::execute(..)",
|
||||||
parentDict
|
parentDict
|
||||||
) << "Failed writing " << endl
|
) << "Failed writing " <<nl
|
||||||
<< copyFiles << endl
|
<< copyFiles << endl
|
||||||
<< filesContents
|
<< filesContents
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
|
|||||||
@ -114,16 +114,8 @@ public:
|
|||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
//- Name of the code template to be used
|
//- Name of the C code template to be used
|
||||||
const static word codeTemplateName;
|
const static word codeTemplateC;
|
||||||
|
|
||||||
//- Name of the code template environment variable
|
|
||||||
// Used to located the codeTemplateName
|
|
||||||
const static word codeTemplateEnvName;
|
|
||||||
|
|
||||||
//- Name of the code template sub-directory
|
|
||||||
// Used when locating the codeTemplateName via Foam::findEtcFile
|
|
||||||
const static fileName codeTemplateDirName;
|
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -40,6 +40,53 @@ int Foam::codeStreamTools::allowSystemOperations
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::word Foam::codeStreamTools::codeTemplateEnvName
|
||||||
|
= "FOAM_CODESTREAM_TEMPLATES";
|
||||||
|
|
||||||
|
const Foam::fileName Foam::codeStreamTools::codeTemplateDirName
|
||||||
|
= "codeTemplates/codeStream";
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fileName Foam::codeStreamTools::findTemplate(const word& templateFile)
|
||||||
|
{
|
||||||
|
// try to get template from FOAM_CODESTREAM_TEMPLATES
|
||||||
|
fileName templateDir(Foam::getEnv(codeTemplateEnvName));
|
||||||
|
|
||||||
|
fileName file;
|
||||||
|
if (!templateDir.empty() && isDir(templateDir))
|
||||||
|
{
|
||||||
|
file = templateDir/templateFile;
|
||||||
|
if (!isFile(file, false))
|
||||||
|
{
|
||||||
|
file.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found - fallback to ~OpenFOAM expansion
|
||||||
|
if (file.empty())
|
||||||
|
{
|
||||||
|
file = findEtcFile(codeTemplateDirName/templateFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::string Foam::codeStreamTools::searchedLocations()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
"Under the $"
|
||||||
|
+ codeTemplateDirName
|
||||||
|
+ " directory or via via the ~OpenFOAM/"
|
||||||
|
+ codeTemplateDirName
|
||||||
|
+ " expansion"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::codeStreamTools::copyAndExpand
|
void Foam::codeStreamTools::copyAndExpand
|
||||||
|
|||||||
@ -109,6 +109,17 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
//- Name of the code template environment variable
|
||||||
|
// Used to located the codeTemplateName
|
||||||
|
const static word codeTemplateEnvName;
|
||||||
|
|
||||||
|
//- Name of the code template sub-directory
|
||||||
|
// Used when locating the codeTemplateName via Foam::findEtcFile
|
||||||
|
const static fileName codeTemplateDirName;
|
||||||
|
|
||||||
|
|
||||||
static int allowSystemOperations;
|
static int allowSystemOperations;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -150,6 +161,15 @@ public:
|
|||||||
|
|
||||||
bool copyFilesContents(const fileName& dir) const;
|
bool copyFilesContents(const fileName& dir) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Find a code-template via the codeTemplateEnvName
|
||||||
|
// alternatively in the codeTemplateDirName via Foam::findEtcFile
|
||||||
|
static fileName findTemplate(const word& templateName);
|
||||||
|
|
||||||
|
//- List searched locations in a format suitable for display an error
|
||||||
|
static string searchedLocations();
|
||||||
|
|
||||||
|
|
||||||
static void* findLibrary(const fileName& libPath);
|
static void* findLibrary(const fileName& libPath);
|
||||||
|
|
||||||
static bool writeDigest(const fileName& dir, const SHA1Digest& sha1);
|
static bool writeDigest(const fileName& dir, const SHA1Digest& sha1);
|
||||||
|
|||||||
@ -65,7 +65,7 @@ bool env(const word&);
|
|||||||
string getEnv(const word&);
|
string getEnv(const word&);
|
||||||
|
|
||||||
//- Set an environment variable
|
//- Set an environment variable
|
||||||
bool setEnv(const word& name, const string& value, const bool overwrite);
|
bool setEnv(const word& name, const std::string& value, const bool overwrite);
|
||||||
|
|
||||||
//- Return the system's host name, as per hostname(1)
|
//- Return the system's host name, as per hostname(1)
|
||||||
// Optionally with the full name (as per the '-f' option)
|
// Optionally with the full name (as per the '-f' option)
|
||||||
@ -182,7 +182,7 @@ bool ping(const word&, const label port, const label timeOut);
|
|||||||
bool ping(const word&, const label timeOut=10);
|
bool ping(const word&, const label timeOut=10);
|
||||||
|
|
||||||
//- Execute the specified command
|
//- Execute the specified command
|
||||||
int system(const string& command);
|
int system(const std::string& command);
|
||||||
|
|
||||||
//- open a shared library. Return handle to library
|
//- open a shared library. Return handle to library
|
||||||
void* dlOpen(const fileName& lib);
|
void* dlOpen(const fileName& lib);
|
||||||
@ -191,7 +191,7 @@ void* dlOpen(const fileName& lib);
|
|||||||
bool dlClose(void*);
|
bool dlClose(void*);
|
||||||
|
|
||||||
//- Lookup a symbol in a dlopened library using handle
|
//- Lookup a symbol in a dlopened library using handle
|
||||||
void* dlSym(void* handle, const string& symbol);
|
void* dlSym(void* handle, const std::string& symbol);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -34,6 +34,16 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "codeStreamTools.H"
|
#include "codeStreamTools.H"
|
||||||
#include "codeProperties.H"
|
#include "codeProperties.H"
|
||||||
|
#include "stringOps.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::word Foam::codedFixedValueFvPatchScalarField::codeTemplateC
|
||||||
|
= "fixedValueFvPatchScalarFieldTemplate.C";
|
||||||
|
|
||||||
|
const Foam::word Foam::codedFixedValueFvPatchScalarField::codeTemplateH
|
||||||
|
= "fixedValueFvPatchScalarFieldTemplate.H";
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -68,65 +78,83 @@ Foam::codedFixedValueFvPatchScalarField::dict() const
|
|||||||
|
|
||||||
void Foam::codedFixedValueFvPatchScalarField::writeLibrary
|
void Foam::codedFixedValueFvPatchScalarField::writeLibrary
|
||||||
(
|
(
|
||||||
const fileName dir,
|
const fileName& dir,
|
||||||
const fileName libPath,
|
const fileName& libPath,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Write files for new library
|
||||||
|
if (!Pstream::master())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// "codeInclude" is optional
|
||||||
|
string codeInclude;
|
||||||
|
if (dict.found("codeInclude"))
|
||||||
|
{
|
||||||
|
codeInclude = stringOps::trimLeft(dict["codeInclude"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "codeOptions" is optional
|
||||||
|
string codeOptions;
|
||||||
|
if (dict.found("codeOptions"))
|
||||||
|
{
|
||||||
|
codeOptions = stringOps::trimLeft(dict["codeOptions"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "code" is mandatory
|
||||||
|
string code = stringOps::trimLeft(dict["code"]);
|
||||||
|
|
||||||
|
|
||||||
Info<< "Creating new library in " << libPath << endl;
|
Info<< "Creating new library in " << libPath << endl;
|
||||||
|
|
||||||
// Write files for new library
|
const fileName fileCsrc
|
||||||
if (Pstream::master())
|
(
|
||||||
{
|
codeStreamTools::findTemplate
|
||||||
fileName templates(Foam::getEnv("FOAM_CODESTREAM_TEMPLATE_DIR"));
|
(
|
||||||
if (!templates.size())
|
codeTemplateC
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const fileName fileHsrc
|
||||||
|
(
|
||||||
|
codeStreamTools::findTemplate
|
||||||
|
(
|
||||||
|
codeTemplateH
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fileCsrc.empty() || fileHsrc.empty())
|
||||||
{
|
{
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
"codedFixedValueFvPatchScalarField::writeLibrary(..)",
|
"codedFixedValueFvPatchScalarField::writeLibrary(..)",
|
||||||
dict
|
dict
|
||||||
) << "Please set environment variable"
|
) << "Could not find one or both code templates: "
|
||||||
<< " FOAM_CODESTREAM_TEMPLATE_DIR"
|
<< codeTemplateC << ", " << codeTemplateH << nl
|
||||||
<< " to point to the location of "
|
<< codeStreamTools::searchedLocations()
|
||||||
<< "fixedValueFvPatchScalarFieldTemplate.C"
|
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Extract sections of code
|
|
||||||
string codeInclude = "";
|
|
||||||
if (dict.found("codeInclude"))
|
|
||||||
{
|
|
||||||
codeInclude = codeStreamTools::stripLeading(dict["codeInclude"]);
|
|
||||||
}
|
|
||||||
string code = codeStreamTools::stripLeading(dict["code"]);
|
|
||||||
|
|
||||||
string codeOptions = "";
|
List<codeStreamTools::fileAndVars> copyFiles(2);
|
||||||
if (dict.found("codeOptions"))
|
copyFiles[0].file() = fileCsrc;
|
||||||
{
|
copyFiles[0].set("codeInclude", codeInclude);
|
||||||
codeOptions = codeStreamTools::stripLeading(dict["codeOptions"]);
|
copyFiles[0].set("code", code);
|
||||||
}
|
|
||||||
|
copyFiles[1].file() = fileHsrc;
|
||||||
|
|
||||||
|
|
||||||
List<fileAndVars> copyFiles(2);
|
List<codeStreamTools::fileAndContent> filesContents(2);
|
||||||
copyFiles[0].first() =
|
|
||||||
templates/"fixedValueFvPatchScalarFieldTemplate.C";
|
|
||||||
|
|
||||||
copyFiles[0].second().setSize(2);
|
|
||||||
copyFiles[0].second()[0] = Pair<string>("codeInclude", codeInclude);
|
|
||||||
copyFiles[0].second()[1] = Pair<string>("code", code);
|
|
||||||
|
|
||||||
copyFiles[1].first() =
|
|
||||||
templates/"fixedValueFvPatchScalarFieldTemplate.H";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<fileAndContent> filesContents(2);
|
|
||||||
// Write Make/files
|
// Write Make/files
|
||||||
filesContents[0].first() = "Make/files";
|
filesContents[0].first() = "Make/files";
|
||||||
filesContents[0].second() =
|
filesContents[0].second() =
|
||||||
"fixedValueFvPatchScalarFieldTemplate.C \n\n"
|
codeTemplateC + "\n\n"
|
||||||
"LIB = $(FOAM_USER_LIBBIN)/lib" + redirectType_;
|
"LIB = $(FOAM_USER_LIBBIN)/lib" + redirectType_;
|
||||||
|
|
||||||
// Write Make/options
|
// Write Make/options
|
||||||
filesContents[1].first() = "Make/options";
|
filesContents[1].first() = "Make/options";
|
||||||
filesContents[1].second() =
|
filesContents[1].second() =
|
||||||
@ -141,13 +169,12 @@ void Foam::codedFixedValueFvPatchScalarField::writeLibrary
|
|||||||
(
|
(
|
||||||
"codedFixedValueFvPatchScalarField::writeLibrary(..)",
|
"codedFixedValueFvPatchScalarField::writeLibrary(..)",
|
||||||
dict
|
dict
|
||||||
) << "Failed writing " << endl
|
) << "Failed writing " << nl
|
||||||
<< copyFiles << endl
|
<< copyFiles << nl
|
||||||
<< filesContents
|
<< filesContents
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::codedFixedValueFvPatchScalarField::updateLibrary()
|
void Foam::codedFixedValueFvPatchScalarField::updateLibrary()
|
||||||
@ -221,7 +248,7 @@ void Foam::codedFixedValueFvPatchScalarField::updateLibrary()
|
|||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
Foam::string wmakeCmd("wmake libso " + dir);
|
const Foam::string wmakeCmd("wmake libso " + dir);
|
||||||
Info<< "Invoking " << wmakeCmd << endl;
|
Info<< "Invoking " << wmakeCmd << endl;
|
||||||
if (Foam::system(wmakeCmd))
|
if (Foam::system(wmakeCmd))
|
||||||
{
|
{
|
||||||
@ -229,7 +256,8 @@ void Foam::codedFixedValueFvPatchScalarField::updateLibrary()
|
|||||||
(
|
(
|
||||||
"codedFixedValueFvPatchScalarField::updateLibrary()",
|
"codedFixedValueFvPatchScalarField::updateLibrary()",
|
||||||
dict_
|
dict_
|
||||||
) << "Failed " << wmakeCmd << exit(FatalIOError);
|
) << "Failed " << wmakeCmd
|
||||||
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +270,8 @@ void Foam::codedFixedValueFvPatchScalarField::updateLibrary()
|
|||||||
(
|
(
|
||||||
"codedFixedValueFvPatchScalarField::updateLibrary()",
|
"codedFixedValueFvPatchScalarField::updateLibrary()",
|
||||||
dict_
|
dict_
|
||||||
) << "Failed loading library " << libPath << exit(FatalIOError);
|
) << "Failed loading library " << libPath
|
||||||
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ Description
|
|||||||
See also codeStream.
|
See also codeStream.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
\verbatim
|
||||||
movingWall
|
movingWall
|
||||||
{
|
{
|
||||||
type codedFixedValue<scalar>;
|
type codedFixedValue<scalar>;
|
||||||
@ -53,13 +53,14 @@ Description
|
|||||||
//#{
|
//#{
|
||||||
// -I$(LIB_SRC)/finiteVolume/lnInclude
|
// -I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
//#};
|
//#};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
A special form is if the 'code' section is not supplied. In this case
|
A special form is if the 'code' section is not supplied. In this case
|
||||||
the code gets read from a (runTimeModifiable!) dictionary system/codeDict
|
the code gets read from a (runTimeModifiable!) dictionary system/codeDict
|
||||||
which would have an entry
|
which would have an entry
|
||||||
|
|
||||||
|
\verbatim
|
||||||
rampedFixedValue
|
rampedFixedValue
|
||||||
{
|
{
|
||||||
code
|
code
|
||||||
@ -67,6 +68,10 @@ Description
|
|||||||
operator==(min(10, 0.1*this->db().time().value()));
|
operator==(min(10, 0.1*this->db().time().value()));
|
||||||
#};
|
#};
|
||||||
}
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::codeStreamTools for constant paths used
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
codedFixedValueFvPatchScalarField.C
|
codedFixedValueFvPatchScalarField.C
|
||||||
@ -108,8 +113,8 @@ class codedFixedValueFvPatchScalarField
|
|||||||
|
|
||||||
void writeLibrary
|
void writeLibrary
|
||||||
(
|
(
|
||||||
const fileName dir,
|
const fileName& dir,
|
||||||
const fileName libPath,
|
const fileName& libPath,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -117,6 +122,15 @@ class codedFixedValueFvPatchScalarField
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
//- Name of the C code template to be used
|
||||||
|
const static word codeTemplateC;
|
||||||
|
|
||||||
|
//- Name of the H code template to be used
|
||||||
|
const static word codeTemplateH;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("codedFixedValue<scalar>");
|
TypeName("codedFixedValue<scalar>");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user