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

#include <pythonfield.h>

Inheritance diagram for oofem::PythonField:
Collaboration diagram for oofem::PythonField:

Public Member Functions

 PythonField (void)
 Constructor.
void setFunctionName (std::string functionName)
void setModuleName (std::string moduleName)
int evaluateAt (FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep) override
int evaluateAt (FloatArray &answer, DofManager *dman, ValueModeType mode, TimeStep *tStep) override
void saveContext (DataStream &stream) override
void restoreContext (DataStream &stream) override
const char * giveClassName () const override
Public Member Functions inherited from oofem::Field
 Field (FieldType b=FieldType::FT_Unknown)
virtual ~Field ()
virtual int evaluateAt (FloatArray &answer, Element *elem, ValueModeType mode, TimeStep *tStep)
FieldType giveType ()
 Returns the type of receiver.
void setType (FieldType b)
 Sets the type of receiver.
void setSetsNumbers (const IntArray sets)
 Defines a list of sets used to impose a field on specific elements.
virtual bool hasElementInSets (int nElem, Domain *d)
 Searches if element number exist in IntArray regionSets for given domain.
std::string errorInfo (const char *func) const
 Returns string for prepending output (used by error reporting macros).
virtual void initializeFrom (InputRecord &ir)

Private Attributes

std::string moduleName
 Name of python module containing evaluating function function.
std::string functionName

Additional Inherited Members

Protected Attributes inherited from oofem::Field
FieldType type
IntArray regionSets

Detailed Description

Custom user supplied python scripts for field. The python module should contain the functions

evaluateAt(FloatArray &answer, const FloatArray &coords, ValueModeType mode, TimeStep *tStep) # returns int
Author
Vit Smilauer

Definition at line 64 of file pythonfield.h.

Constructor & Destructor Documentation

◆ PythonField()

oofem::PythonField::PythonField ( void )

Constructor.

Definition at line 58 of file pythonfield.C.

References oofem::Field::Field().

Member Function Documentation

◆ evaluateAt() [1/2]

int oofem::PythonField::evaluateAt ( FloatArray & answer,
const FloatArray & coords,
ValueModeType mode,
TimeStep * tStep )
overridevirtual

Evaluates the field at given point.

Parameters
coordsCoordinates of the point of interest
answerField evaluated at coordinate.
tStepTime step to evaluate for.
modeMode of value (total, velocity,...).
Returns
Zero if ok, otherwise nonzero.

Implements oofem::Field.

Definition at line 73 of file pythonfield.C.

References functionName, and moduleName.

◆ evaluateAt() [2/2]

int oofem::PythonField::evaluateAt ( FloatArray & answer,
DofManager * dman,
ValueModeType mode,
TimeStep * tStep )
overridevirtual

Evaluates the field at given DofManager. This potentially can be resolved quickly, as receiver data may be described using values at dofManagers. Here an additional issue exists: one needs to make sure, that passed dman is from the same domain, so that its number can be used to perform suggested quick evaluation.

If this is not the case (the field is described differently), the response can be evaluated using dofman coordinates in a standard way.

Parameters
[out]answerEvaluated field for dman.
dmanReference to dofManager.
modeMode of value (total, velocity,...).
tStepTime step to evaluate for.
Returns
Zero if ok, nonzero Error code (0-ok, 1-failed)

Implements oofem::Field.

Definition at line 97 of file pythonfield.C.

References OOFEM_ERROR.

◆ giveClassName()

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

Implements oofem::Field.

Definition at line 88 of file pythonfield.h.

◆ restoreContext()

void oofem::PythonField::restoreContext ( DataStream & stream)
inlineoverridevirtual

Restores the receiver state previously written in stream.

Parameters
streamInput stream.
Exceptions
Throwsan ContextIOERR exception if error encountered.

Implements oofem::Field.

Definition at line 86 of file pythonfield.h.

◆ saveContext()

void oofem::PythonField::saveContext ( DataStream & stream)
inlineoverridevirtual

Stores receiver state to output stream.

Parameters
streamOutput stream.
Exceptions
Throwsan ContextIOERR exception if error encountered.

Implements oofem::Field.

Definition at line 85 of file pythonfield.h.

◆ setFunctionName()

void oofem::PythonField::setFunctionName ( std::string functionName)

Definition at line 63 of file pythonfield.C.

References functionName.

◆ setModuleName()

void oofem::PythonField::setModuleName ( std::string moduleName)

Definition at line 68 of file pythonfield.C.

References moduleName.

Member Data Documentation

◆ functionName

std::string oofem::PythonField::functionName
private

Definition at line 69 of file pythonfield.h.

Referenced by evaluateAt(), and setFunctionName().

◆ moduleName

std::string oofem::PythonField::moduleName
private

Name of python module containing evaluating function function.

Definition at line 68 of file pythonfield.h.

Referenced by evaluateAt(), and setModuleName().


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