CodedFunction1: Updated documentation
This commit is contained in:
@ -31,7 +31,10 @@ License
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList Foam::Function1s::Coded<Type>::codeKeys_ =
|
||||
{"code", "codeInclude"};
|
||||
{
|
||||
"code",
|
||||
"codeInclude"
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -85,7 +88,7 @@ void Foam::Function1s::Coded<Type>::prepare
|
||||
template<class Type>
|
||||
Foam::string Foam::Function1s::Coded<Type>::description() const
|
||||
{
|
||||
return "Function1 " + name_;
|
||||
return Function1<Type>::typeName_() + " " + name_;
|
||||
}
|
||||
|
||||
|
||||
@ -112,6 +115,19 @@ const Foam::wordList& Foam::Function1s::Coded<Type>::codeKeys() const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::autoPtr<Foam::Function1<Type>>
|
||||
Foam::Function1s::Coded<Type>::compileAndLink()
|
||||
{
|
||||
updateLibrary(name_);
|
||||
|
||||
dictionary redirectDict(dict_);
|
||||
redirectDict.set(name_, name_);
|
||||
|
||||
return Function1<Type>::New(name_, redirectDict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -129,14 +145,8 @@ Foam::Function1s::Coded<Type>::Coded
|
||||
? dict.lookup("redirectType")
|
||||
: dict.lookup("name")
|
||||
),
|
||||
redirectFunction1Ptr_()
|
||||
{
|
||||
updateLibrary(name_);
|
||||
|
||||
dictionary redirectDict(dict_);
|
||||
redirectDict.set(name_, name_);
|
||||
redirectFunction1Ptr_ = Function1<Type>::New(name_, redirectDict);
|
||||
}
|
||||
redirectFunction1Ptr_(compileAndLink())
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -146,14 +156,9 @@ Foam::Function1s::Coded<Type>::Coded(const Coded<Type>& cf1)
|
||||
Function1<Type>(cf1),
|
||||
codedBase(),
|
||||
dict_(cf1.dict_),
|
||||
name_(cf1.name_)
|
||||
{
|
||||
updateLibrary(name_);
|
||||
|
||||
dictionary redirectDict(dict_);
|
||||
redirectDict.set(name_, name_);
|
||||
redirectFunction1Ptr_ = Function1<Type>::New(name_, redirectDict);
|
||||
}
|
||||
name_(cf1.name_),
|
||||
redirectFunction1Ptr_(compileAndLink())
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -25,44 +25,31 @@ Class
|
||||
Foam::Function1s::Coded
|
||||
|
||||
Description
|
||||
Constructs on-the-fly a Function1 which is then used to evaluate.
|
||||
Constructs a dynamically compiled Function1.
|
||||
|
||||
Usage
|
||||
Example:
|
||||
Example of a cosine bell shaped pulse inlet:
|
||||
\verbatim
|
||||
<patchName>
|
||||
inlet
|
||||
{
|
||||
type codedFixedValue;
|
||||
value uniform 0;
|
||||
name rampedFixedValue; // name of generated BC
|
||||
type uniformFixedValue;
|
||||
uniformValue coded;
|
||||
|
||||
code
|
||||
name pulse;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
operator==(min(10, 0.1*this->db().time().value()));
|
||||
#include "mathematicalConstants.H"
|
||||
#};
|
||||
|
||||
// codeInclude
|
||||
//#{
|
||||
// #include "fvCFD.H"
|
||||
//#};
|
||||
|
||||
// codeOptions
|
||||
//#{
|
||||
// -I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
//#};
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
A special form is if the 'code' section is not supplied. In this case
|
||||
the code is read from a (runTimeModifiable!) dictionary system/codeDict
|
||||
which would have a corresponding entry:
|
||||
|
||||
\verbatim
|
||||
<patchName>
|
||||
{
|
||||
code
|
||||
#{
|
||||
operator==(min(10, 0.1*this->db().time().value()));
|
||||
return vector
|
||||
(
|
||||
0.5*(1 - cos(constant::mathematical::twoPi*min(x/0.3, 1))),
|
||||
0,
|
||||
0
|
||||
);
|
||||
#};
|
||||
}
|
||||
\endverbatim
|
||||
@ -72,8 +59,8 @@ See also
|
||||
Foam::functionEntries::codeStream
|
||||
|
||||
SourceFiles
|
||||
CodedI.H
|
||||
Coded.C
|
||||
CodedFunction1I.H
|
||||
CodedFunction1.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -135,6 +122,8 @@ class Coded
|
||||
//- Get the keywords associated with source code
|
||||
virtual const wordList& codeKeys() const;
|
||||
|
||||
autoPtr<Function1<Type>> compileAndLink();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user