OOFEM 3.0
Loading...
Searching...
No Matches
oofem::CalculatorFunction Class Reference

#include <calculatorfunction.h>

Inheritance diagram for oofem::CalculatorFunction:
Collaboration diagram for oofem::CalculatorFunction:

Public Member Functions

 CalculatorFunction (int n, Domain *d)
virtual ~CalculatorFunction ()
 Destructor.
void initializeFrom (InputRecord &ir) override
void giveInputRecord (DynamicInputRecord &ir) override
void evaluate (FloatArray &answer, const std ::map< std ::string, FunctionArgument > &valDict, GaussPoint *gp=nullptr, double param=0.) override
double evaluateAtTime (double t) override
double evaluateVelocityAtTime (double t) override
double evaluateAccelerationAtTime (double t) override
const char * giveClassName () const override
const char * giveInputRecordName () const override
Public Member Functions inherited from oofem::Function
 Function (int n, Domain *d)
virtual ~Function ()
 Destructor.
virtual double evaluate (TimeStep *tStep, ValueModeType mode)
virtual double evaluate (const std ::map< std ::string, FunctionArgument > &valDict)
double giveFunctionParameter (int paramID)
void saveContext (DataStream &stream, ContextMode mode) override
void restoreContext (DataStream &stream, ContextMode mode) override
Public Member Functions inherited from oofem::FEMComponent
 FEMComponent (int n, Domain *d)
virtual ~FEMComponent ()=default
 Virtual destructor.
DomaingiveDomain () const
virtual void setDomain (Domain *d)
int giveNumber () const
void setNumber (int num)
virtual void updateLocalNumbering (EntityRenumberingFunctor &f)
virtual void initializeFrom (InputRecord &ir, int priority)
virtual void initializeFinish ()
virtual void postInitialize ()
 Performs post initialization steps. Called after all components are created and initialized.
virtual int checkConsistency ()
virtual void printOutputAt (FILE *file, TimeStep *tStep)
virtual void printYourself ()
 Prints receiver state on stdout. Useful for debugging.
virtual InterfacegiveInterface (InterfaceType t)
std::string errorInfo (const char *func) const
 Returns string for prepending output (used by error reporting macros).

Private Attributes

std::string fExpression
 Expression for the function value.
std::string dfdtExpression
 Expression for first time derivative.
std::string d2fdt2Expression
 Expression for second time derivative.

Additional Inherited Members

Public Attributes inherited from oofem::Function
DomainfuncDomain
int parameterType
Protected Attributes inherited from oofem::FEMComponent
int number
 Component number.
Domaindomain
 Link to domain object, useful for communicating with other FEM components.

Detailed Description

Class representing user defined load time function. User input is function expression. Uses Parser class to parse given expression. Slow but useful. Load time function typically belongs to domain and is attribute of one or more loads. Generally load time function is real function of time ( \( y=f(t) \)).

Definition at line 56 of file calculatorfunction.h.

Constructor & Destructor Documentation

◆ CalculatorFunction()

oofem::CalculatorFunction::CalculatorFunction ( int n,
Domain * d )

Constructor. Creates load time function with given number, belonging to given domain.

Parameters
nLoad time function number.
dDomain to which new object will belongs..

Definition at line 46 of file calculatorfunction.C.

References oofem::Function::Function().

◆ ~CalculatorFunction()

virtual oofem::CalculatorFunction::~CalculatorFunction ( )
inlinevirtual

Destructor.

Definition at line 74 of file calculatorfunction.h.

Member Function Documentation

◆ evaluate()

void oofem::CalculatorFunction::evaluate ( FloatArray & answer,
const std ::map< std ::string, FunctionArgument > & valDict,
GaussPoint * gp = nullptr,
double param = 0. )
overridevirtual

◆ evaluateAccelerationAtTime()

double oofem::CalculatorFunction::evaluateAccelerationAtTime ( double t)
overridevirtual

Returns the second time derivative of the function at given time.

Parameters
tTime.
Returns
\( f''(t) \).

Implements oofem::Function.

Definition at line 139 of file calculatorfunction.C.

References d2fdt2Expression, oofem::Parser::eval(), and OOFEM_ERROR.

◆ evaluateAtTime()

double oofem::CalculatorFunction::evaluateAtTime ( double t)
overridevirtual

Returns the value of the function at given time.

Parameters
tTime.
Returns
\( f(t) \).

Reimplemented from oofem::Function.

Definition at line 101 of file calculatorfunction.C.

References oofem::Parser::eval(), fExpression, and OOFEM_ERROR.

◆ evaluateVelocityAtTime()

double oofem::CalculatorFunction::evaluateVelocityAtTime ( double t)
overridevirtual

Returns the first time derivative of the function at given time.

Parameters
tTime.
Returns
\( f'(t) \).

Implements oofem::Function.

Definition at line 117 of file calculatorfunction.C.

References dfdtExpression, oofem::Parser::eval(), and OOFEM_ERROR.

◆ giveClassName()

const char * oofem::CalculatorFunction::giveClassName ( ) const
inlineoverridevirtual
Returns
Class name of the receiver.

Implements oofem::FEMComponent.

Definition at line 90 of file calculatorfunction.h.

◆ giveInputRecord()

void oofem::CalculatorFunction::giveInputRecord ( DynamicInputRecord & input)
overridevirtual

Setups the input record string of receiver.

Parameters
inputDynamic input record to be filled by receiver.

Reimplemented from oofem::FEMComponent.

Definition at line 60 of file calculatorfunction.C.

References _IFT_CalculatorFunction_d2fdt2, _IFT_CalculatorFunction_dfdt, _IFT_CalculatorFunction_f, d2fdt2Expression, dfdtExpression, fExpression, and oofem::DynamicInputRecord::setField().

◆ giveInputRecordName()

const char * oofem::CalculatorFunction::giveInputRecordName ( ) const
inlineoverridevirtual
Returns
Input record name of the receiver.

Implements oofem::FEMComponent.

Definition at line 91 of file calculatorfunction.h.

References _IFT_CalculatorFunction_Name.

◆ initializeFrom()

void oofem::CalculatorFunction::initializeFrom ( InputRecord & ir)
overridevirtual

Reads the fields

  • f(t) (required)
  • dfdt(t) (optional)
  • d2fdt2(t) (optional)

Reimplemented from oofem::FEMComponent.

Definition at line 49 of file calculatorfunction.C.

References _IFT_CalculatorFunction_d2fdt2, _IFT_CalculatorFunction_dfdt, _IFT_CalculatorFunction_f, d2fdt2Expression, dfdtExpression, fExpression, IR_GIVE_FIELD, and IR_GIVE_OPTIONAL_FIELD.

Member Data Documentation

◆ d2fdt2Expression

std::string oofem::CalculatorFunction::d2fdt2Expression
private

Expression for second time derivative.

Definition at line 64 of file calculatorfunction.h.

Referenced by evaluateAccelerationAtTime(), giveInputRecord(), and initializeFrom().

◆ dfdtExpression

std::string oofem::CalculatorFunction::dfdtExpression
private

Expression for first time derivative.

Definition at line 62 of file calculatorfunction.h.

Referenced by evaluateVelocityAtTime(), giveInputRecord(), and initializeFrom().

◆ fExpression

std::string oofem::CalculatorFunction::fExpression
private

Expression for the function value.

Definition at line 60 of file calculatorfunction.h.

Referenced by evaluate(), evaluateAtTime(), giveInputRecord(), and initializeFrom().


The documentation for this class was generated from the following files:

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011