Updated code comments

This commit is contained in:
Henry Weller
2016-05-19 09:40:17 +01:00
parent ae9889697e
commit 08e22d3af0
3 changed files with 21 additions and 20 deletions

View File

@ -92,7 +92,7 @@ void Foam::dynamicCode::checkSecurity
Foam::word Foam::dynamicCode::libraryBaseName(const fileName& libPath) Foam::word Foam::dynamicCode::libraryBaseName(const fileName& libPath)
{ {
word libName(libPath.name(true)); word libName(libPath.name(true));
libName.erase(0, 3); // remove leading 'lib' from name libName.erase(0, 3); // Remove leading 'lib' from name
return libName; return libName;
} }
@ -127,8 +127,8 @@ void Foam::dynamicCode::copyAndFilter
{ {
is.getLine(line); is.getLine(line);
// expand according to mapping // Expand according to mapping.
// expanding according to env variables might cause too many // Expanding according to env variables might cause too many
// surprises // surprises
stringOps::inplaceExpand(line, mapping); stringOps::inplaceExpand(line, mapping);
os.writeQuoted(line, false) << nl; os.writeQuoted(line, false) << nl;
@ -144,7 +144,7 @@ bool Foam::dynamicCode::resolveTemplates
DynamicList<fileName>& badFiles DynamicList<fileName>& badFiles
) )
{ {
// try to get template from FOAM_CODESTREAM_TEMPLATES // Try to get template from FOAM_CODESTREAM_TEMPLATES
const fileName templateDir(Foam::getEnv(codeTemplateEnvName)); const fileName templateDir(Foam::getEnv(codeTemplateEnvName));
bool allOkay = true; bool allOkay = true;
@ -162,7 +162,7 @@ bool Foam::dynamicCode::resolveTemplates
} }
} }
// not found - fallback to ~OpenFOAM expansion // Not found - fallback to ~OpenFOAM expansion
if (file.empty()) if (file.empty())
{ {
file = findEtcFile(codeTemplateDirName/templateName); file = findEtcFile(codeTemplateDirName/templateName);
@ -329,7 +329,7 @@ void Foam::dynamicCode::clear()
filterVars_.set("typeName", codeName_); filterVars_.set("typeName", codeName_);
filterVars_.set("SHA1sum", SHA1Digest().str()); filterVars_.set("SHA1sum", SHA1Digest().str());
// provide default Make/options // Provide default Make/options
makeOptions_ = makeOptions_ =
"EXE_INC = -g\n" "EXE_INC = -g\n"
"\n\nLIB_LIBS = "; "\n\nLIB_LIBS = ";
@ -408,7 +408,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
DynamicList<fileName> resolvedFiles(nFiles); DynamicList<fileName> resolvedFiles(nFiles);
DynamicList<fileName> badFiles(nFiles); DynamicList<fileName> badFiles(nFiles);
// resolve template, or add to bad-files // Resolve template, or add to bad-files
resolveTemplates(compileFiles_, resolvedFiles, badFiles); resolveTemplates(compileFiles_, resolvedFiles, badFiles);
resolveTemplates(copyFiles_, resolvedFiles, badFiles); resolveTemplates(copyFiles_, resolvedFiles, badFiles);

View File

@ -52,7 +52,7 @@ void Foam::codedFixedValuePointPatchField<Type>::setFieldTemplates
{ {
word fieldType(pTraits<Type>::typeName); word fieldType(pTraits<Type>::typeName);
// template type for pointPatchField // Template type for pointPatchField
dynCode.setFilterVariable("TemplateType", fieldType); dynCode.setFilterVariable("TemplateType", fieldType);
// Name for pointPatchField - eg, ScalarField, VectorField, ... // Name for pointPatchField - eg, ScalarField, VectorField, ...
@ -107,26 +107,26 @@ void Foam::codedFixedValuePointPatchField<Type>::prepare
const dynamicCodeContext& context const dynamicCodeContext& context
) const ) const
{ {
// take no chances - typeName must be identical to name_ // Take no chances - typeName must be identical to name_
dynCode.setFilterVariable("typeName", name_); dynCode.setFilterVariable("typeName", name_);
// set TemplateType and FieldType filter variables // Set TemplateType and FieldType filter variables
// (for pointPatchField) // (for pointPatchField)
setFieldTemplates(dynCode); setFieldTemplates(dynCode);
// compile filtered C template // Compile filtered C template
dynCode.addCompileFile(codeTemplateC); dynCode.addCompileFile(codeTemplateC);
// copy filtered H template // Copy filtered H template
dynCode.addCopyFile(codeTemplateH); dynCode.addCopyFile(codeTemplateH);
// debugging: make BC verbose // Debugging: make BC verbose
// dynCode.setFilterVariable("verbose", "true"); // dynCode.setFilterVariable("verbose", "true");
// Info<<"compile " << name_ << " sha1: " // Info<<"compile " << name_ << " sha1: "
// << context.sha1() << endl; // << context.sha1() << endl;
// define Make/options // Define Make/options
dynCode.setMakeOptions dynCode.setMakeOptions
( (
"EXE_INC = -g \\\n" "EXE_INC = -g \\\n"
@ -144,7 +144,7 @@ template<class Type>
const Foam::dictionary& Foam::codedFixedValuePointPatchField<Type>::codeDict() const Foam::dictionary& Foam::codedFixedValuePointPatchField<Type>::codeDict()
const const
{ {
// use system/codeDict or in-line // Use system/codeDict or in-line
return return
( (
dict_.found("code") dict_.found("code")
@ -168,7 +168,7 @@ Foam::string Foam::codedFixedValuePointPatchField<Type>::description() const
template<class Type> template<class Type>
void Foam::codedFixedValuePointPatchField<Type>::clearRedirect() const void Foam::codedFixedValuePointPatchField<Type>::clearRedirect() const
{ {
// remove instantiation of pointPatchField provided by library // Remove instantiation of pointPatchField provided by library
redirectPatchFieldPtr_.clear(); redirectPatchFieldPtr_.clear();
} }

View File

@ -114,6 +114,7 @@ class codedFixedValuePointPatchField
mutable autoPtr<pointPatchField<Type>> redirectPatchFieldPtr_; mutable autoPtr<pointPatchField<Type>> redirectPatchFieldPtr_;
// Private Member Functions // Private Member Functions
const IOdictionary& dict() const; const IOdictionary& dict() const;
@ -136,6 +137,7 @@ class codedFixedValuePointPatchField
// Get the dictionary to initialize the codeContext // Get the dictionary to initialize the codeContext
virtual const dictionary& codeDict() const; virtual const dictionary& codeDict() const;
public: public:
// Static data members // Static data members
@ -218,7 +220,6 @@ public:
} }
// Member functions // Member functions
//- Get reference to the underlying patch //- Get reference to the underlying patch