74#ifndef Foam_Function1_H
75#define Foam_Function1_H
103 const word& entryName,
106 const word& redirectType,
138 const
word& entryName,
142 (entryName,
dict, obrPtr)
151 const
word& entryName,
159 const
word& entryName,
174 template<class Derived>
183 const word& entryName,
185 const word& redirectType,
187 const bool mandatory =
true
193 const word& entryName,
194 std::initializer_list<std::pair<const char*,int>> compat,
198 const bool mandatory =
true
204 const word& entryName,
207 const bool mandatory =
true
213 const word& entryName,
215 const word& redirectType,
222 const word& entryName,
235 const word& entryName,
239 const bool mandatory =
true
263 virtual bool constant()
const {
return false; }
266 virtual bool good()
const {
return true; }
272 virtual Type
value(
const scalar
x)
const;
278 virtual Type
integrate(
const scalar x1,
const scalar x2)
const;
291 friend Ostream& operator<< <Type>
311template<
class Function1Type>
318 typedef typename Function1Type::returnType Type;
326 const word& entryName,
344 using Function1Type::value;
345 using Function1Type::integrate;
366#define makeFunction1(Type) \
368 defineNamedTemplateTypeNameAndDebug(Function1<Type>, 0); \
370 defineTemplateRunTimeSelectionTable \
378#define makeFunction1Type(SS, Type) \
380 defineNamedTemplateTypeNameAndDebug(Function1Types::SS<Type>, 0); \
382 Function1<Type>::adddictionaryConstructorToTable \
383 <FieldFunction1<Function1Types::SS<Type>>> \
384 add##SS##Type##ConstructorToTable_;
388#define makeConcreteFunction1(SS, Type) \
390 defineTypeNameAndDebug(SS, 0); \
392 Function1<Type>::adddictionaryConstructorToTable \
393 <FieldFunction1<SS>> \
394 add##SS##Type##ConstructorToTable_;
398#define makeScalarFunction1(SS) \
400 makeConcreteFunction1(SS, scalar);
virtual tmp< Function1< Type > > clone() const
Return a clone.
virtual tmp< Field< Type > > integrate(const scalarField &x1, const scalarField &x2) const
Integrate between two (scalar) values.
virtual tmp< Field< Type > > value(const scalarField &x) const
Return value as a function of (scalar) independent variable.
virtual ~FieldFunction1()=default
Destructor.
Function1Type::returnType Type
FieldFunction1(const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
Construct from entry name and dictionary.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
static autoPtr< Function1< Type > > NewIfPresent(const word &entryName, const dictionary &dict, const word &redirectType, const objectRegistry *obrPtr=nullptr)
An optional selector, with fallback redirection.
static autoPtr< Function1< Type > > New(const word &entryName, const dictionary &dict, const word &redirectType, const objectRegistry *obrPtr=nullptr, const bool mandatory=true)
Selector, with fallback redirection.
virtual tmp< Field< Type > > value(const scalarField &x) const
Return value as a function of (scalar) independent variable.
static autoPtr< Function1< Type > > NewCompat(const word &entryName, std::initializer_list< std::pair< const char *, int > > compat, const dictionary &dict, const word &redirectType=word::null, const objectRegistry *obrPtr=nullptr, const bool mandatory=true)
Compatibility selector, with fallback redirection.
virtual void writeData(Ostream &os) const
Write in dictionary format.
virtual bool constant() const
Is value constant (i.e. independent of x).
Function1(const word &entryName, const objectRegistry *obrPtr=nullptr)
Construct from entry name.
virtual void writeEntries(Ostream &os) const
Write coefficient entries in dictionary format.
virtual bool good() const
Can function be evaluated?
Type returnType
The return type.
virtual tmp< Field< Type > > integrate(const scalarField &x1, const scalarField &x2) const
Integrate between two (scalar) values.
static autoPtr< Function1< Type > > New(const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr, const bool mandatory=true)
Selector, without fallback redirection.
virtual tmp< Function1< label > > clone() const=0
void operator=(const Function1< Type > &)=delete
No copy assignment.
virtual Type value(const scalar x) const
Return value as a function of (scalar) independent variable.
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values.
static refPtr< Function1< Type > > New(HashPtrTable< Function1< Type > > &cache, const word &entryName, const dictionary &dict, enum keyType::option matchOpt=keyType::LITERAL, const objectRegistry *obrPtr=nullptr, const bool mandatory=true)
Selector with external storage of Function1. This also allows wildcard matches in a dictionary.
virtual ~Function1()=default
Destructor.
static tmp< Function1< label > > Clone(const Derived &fun)
static autoPtr< Function1< Type > > NewIfPresent(const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
An optional selector, without fallback redirection.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A keyword and a list of tokens is an 'entry'.
function1Base(const word &entryName, const objectRegistry *obrPtr=nullptr)
Construct from entry name and optional registry.
option
Enumeration for the data type and search/match modes (bitmask).
Registry of regIOobjects.
A class for managing references or pointers (no reference counting).
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
OBJstream os(runTime.globalPath()/outputName)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.