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

#include <stepfunction.h>

Inheritance diagram for oofem::StepFunction:
Collaboration diagram for oofem::StepFunction:

Public Member Functions

 StepFunction (int i, Domain *d)
 StepFunction (int i, Domain *d, const std::vector< std::tuple< double, double > > &datevalues)
virtual ~StepFunction ()
void initializeFrom (InputRecord &ir) override
void giveInputRecord (DynamicInputRecord &input) override
const char * giveClassName () const override
const char * giveInputRecordName () const override
void saveContext (DataStream &stream, ContextMode mode) override
void restoreContext (DataStream &stream, ContextMode mode) override
double evaluateAtTime (double t) override
double evaluateVelocityAtTime (double t) override
double evaluateAccelerationAtTime (double t) override
Public Member Functions inherited from oofem::Function
 Function (int n, Domain *d)
virtual ~Function ()
 Destructor.
virtual double evaluate (TimeStep *tStep, ValueModeType mode)
virtual void evaluate (FloatArray &answer, const std ::map< std ::string, FunctionArgument > &valDict, GaussPoint *gp=nullptr, double param=0.)
virtual double evaluate (const std ::map< std ::string, FunctionArgument > &valDict)
double giveFunctionParameter (int paramID)
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).

Protected Attributes

std::vector< std::tuple< double, double > > datevalues
Protected Attributes inherited from oofem::FEMComponent
int number
 Component number.
Domaindomain
 Link to domain object, useful for communicating with other FEM components.

Additional Inherited Members

Public Attributes inherited from oofem::Function
DomainfuncDomain
int parameterType

Detailed Description

This class implements a step function, which is a piecewise constant function having only finitely many pieces. The function is defined by 'numberOfPoints' points. 'dates' and 'values'. The function is defined as:

\[f(t) = \begin{cases} v_1, & t < t_2 \\ v_i, & t_i \leq t < t_{i+1}, i= 2, \ldots, n-1 \\ v_n, & t \geq t_n \end{cases} \]

where \( (t_i, v_i), i=1,\ldots,n \) are the points stored in 'dates' and 'values'.

Definition at line 64 of file stepfunction.h.

Constructor & Destructor Documentation

◆ StepFunction() [1/2]

oofem::StepFunction::StepFunction ( int i,
Domain * d )

Definition at line 48 of file stepfunction.C.

References datevalues, and oofem::Function::Function().

◆ StepFunction() [2/2]

oofem::StepFunction::StepFunction ( int i,
Domain * d,
const std::vector< std::tuple< double, double > > & datevalues )
inline

Definition at line 71 of file stepfunction.h.

References datevalues, and oofem::Function::Function().

◆ ~StepFunction()

virtual oofem::StepFunction::~StepFunction ( )
inlinevirtual

Definition at line 73 of file stepfunction.h.

Member Function Documentation

◆ evaluateAccelerationAtTime()

double oofem::StepFunction::evaluateAccelerationAtTime ( double t)
inlineoverridevirtual

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

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

Implements oofem::Function.

Definition at line 85 of file stepfunction.h.

◆ evaluateAtTime()

double oofem::StepFunction::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 51 of file stepfunction.C.

References datevalues, and OOFEM_ERROR.

◆ evaluateVelocityAtTime()

double oofem::StepFunction::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 112 of file stepfunction.C.

◆ giveClassName()

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

Implements oofem::FEMComponent.

Definition at line 77 of file stepfunction.h.

◆ giveInputRecord()

void oofem::StepFunction::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 168 of file stepfunction.C.

References _IFT_StepFunction_ft, _IFT_StepFunction_t, datevalues, and oofem::DynamicInputRecord::setField().

◆ giveInputRecordName()

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

Implements oofem::FEMComponent.

Definition at line 78 of file stepfunction.h.

References _IFT_StepFunction_Name.

◆ initializeFrom()

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

Initializes receiver according to object description stored in input record. This function is called immediately after creating object using constructor. Input record can be imagined as data record in component database belonging to receiver. Receiver may use value-name extracting functions to extract particular field from record. Note that initializeFrom may be called mutiple times.

See also
IR_GIVE_FIELD
IR_GIVE_OPTIONAL_FIELD
Parameters
irInput record to initialize from.
priorityPriority of the input record. This is used to determine the order of initialization

Reimplemented from oofem::FEMComponent.

Definition at line 121 of file stepfunction.C.

References _IFT_StepFunction_dataFile, _IFT_StepFunction_ft, _IFT_StepFunction_t, datevalues, oofem::InputRecord::hasField(), IR_GIVE_FIELD, IR_GIVE_OPTIONAL_FIELD, OOFEM_ERROR, and oofem::FloatArray::size().

◆ restoreContext()

void oofem::StepFunction::restoreContext ( DataStream & stream,
ContextMode mode )
overridevirtual

Restores the receiver state previously written in stream.

See also
saveContext
Parameters
streamInput stream.
modeDetermines amount of info available in stream (state, definition, ...).
Exceptions
throwsan ContextIOERR exception if error encountered.

Reimplemented from oofem::Function.

Definition at line 202 of file stepfunction.C.

References CM_Definition, datevalues, OOFEM_ERROR, oofem::FloatArray::restoreYourself(), and oofem::FloatArray::size().

◆ saveContext()

void oofem::StepFunction::saveContext ( DataStream & stream,
ContextMode mode )
overridevirtual

Stores receiver state to output stream.

Parameters
streamOutput stream.
modeDetermines amount of info required in stream (state, definition, ...).
Exceptions
throwsan ContextIOERR exception if error encountered.

Reimplemented from oofem::Function.

Definition at line 186 of file stepfunction.C.

References CM_Definition, datevalues, and oofem::FloatArray::storeYourself().

Member Data Documentation

◆ datevalues

std::vector<std::tuple<double,double> > oofem::StepFunction::datevalues
protected

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