version 0.4.1
Python bindings

Header for Python Bindings. More...

Collaboration diagram for Python bindings:

Functions

template<class Assembler , class... options>
void Ikarus::Python::registerFlatAssembler (pybind11::handle scope, pybind11::class_< Assembler, options... > cls)
 Register Python bindings for a assembler class.
. More...
 
template<class BasisHandler , class... options>
void Ikarus::Python::registerBasisHandler (pybind11::handle scope, pybind11::class_< BasisHandler, options... > cls)
 Register a Python wrapper for an Ikarus basis class. More...
 
template<class DirichletValues , class... options>
void Ikarus::Python::registerDirichletValues (pybind11::handle scope, pybind11::class_< DirichletValues, options... > cls)
 Register Python bindings for a DirichletValues class. More...
 
template<class FE , class... options>
void Ikarus::Python::registerFE (pybind11::handle scope, pybind11::class_< FE, options... > cls)
 Register Python bindings for the FE class. More...
 
template<class Writer , class... options>
void Ikarus::Python::registerVtkWriter (pybind11::handle scope, pybind11::class_< Writer, options... > cls)
 Register Python bindings for a VtkWriter class.
. More...
 

Detailed Description

Function Documentation

◆ registerBasisHandler()

template<class BasisHandler , class... options>
void Ikarus::Python::registerBasisHandler ( pybind11::handle  scope,
pybind11::class_< BasisHandler, options... >  cls 
)
Template Parameters
BasisHandlerThe Ikarus handler basis class to be registered.
optionsVariadic template parameters for additional options when defining the Python class.
Parameters
scopeA Pybind11 handle representing the Python scope where the class should be registered.
clsThe Pybind11 class template to be used for registering the Ikarus basis handler class.

◆ registerDirichletValues()

template<class DirichletValues , class... options>
void Ikarus::Python::registerDirichletValues ( pybind11::handle  scope,
pybind11::class_< DirichletValues, options... >  cls 
)

This function registers Python bindings for a DirichletValues class, allowing it to be used in Python scripts. The registered class will have an initializer that takes a Basis object. It exposes several member functions to Python:

  • fixBoundaryDOFs(f): Fixes boundary degrees of freedom using a user-defined function f than can be called with the following arguments:
    • with the boolean vector and the global index.
    • with the boolean vector, the local index and the LocalView.
    • with the boolean vector, the local index, the LocalView and the Intersection.
  • fixDOFs(f): Fixes boundary degrees of freedom using a user-defined function f with the basis and the boolean vector as arguments.
  • setSingleDOF(i, flag: bool): Fixes or unfixes DOF with index i -isConstrained(i): Checks whether index i is constrained -reset()`: Resets the whole container

The following properties can be accessed:

  • container: the underlying container of dirichlet flags (as a const reference)
  • size: the size of the underlying basis
  • fixedDOFsize: the amount of DOFs currently fixed
Template Parameters
DirichletValuesThe DirichletValues class to be registered.
optionsVariadic template parameters for additional options when defining the Python class.
Parameters
scopeA Pybind11 handle representing the Python scope where the class should be registered.
clsThe Pybind11 class template to be used for registering the DirichletValues class.

◆ registerFE()

template<class FE , class... options>
void Ikarus::Python::registerFE ( pybind11::handle  scope,
pybind11::class_< FE, options... >  cls 
)

This function registers Python bindings for a FE class, allowing it to be used in Python scripts.

Template Parameters
FEThe FE class to be registered.
optionsVariadic template parameters for additional options when defining the Python class.
Parameters
scopeA Pybind11 handle representing the Python scope where the class should be registered.
clsThe Pybind11 class template to be used for registering the KirchhoffLoveShell class.

◆ registerFlatAssembler()

template<class Assembler , class... options>
void Ikarus::Python::registerFlatAssembler ( pybind11::handle  scope,
pybind11::class_< Assembler, options... >  cls 
)

The registered class will have an initializer that takes a list of finite elements (fes) and a DirichletValuesType object.
It exposes several member functions to Python:

  • matrix(req): Returns a dense matrix based on the specified FERequirementType.
  • vector(req,affordance,dbcOption): Returns a vector based on the specified FERequirementType.
  • scalar(req,affordance): Returns a scalar based on the specified FERequirementType.
  • createFullVector(redVec): Creates a full vector from a reduced vector.
  • reducedSize(): Returns the size of the reduced space.


Template Parameters
AssemblerThe assembler class to be registered.
optionsVariadic template parameters for additional options when defining the Python class.
Parameters
scopeA Pybind11 handle representing the Python scope where the class should be registered.
clsThe Pybind11 class template to be used for registering the assembler class.
Here is the caller graph for this function:

◆ registerVtkWriter()

template<class Writer , class... options>
void Ikarus::Python::registerVtkWriter ( pybind11::handle  scope,
pybind11::class_< Writer, options... >  cls 
)

The registered VtkWriter class provides functionalities for writing VTK files from assembled data. This class supports adding result data as cell or point data and configuring VTK output formats.

This function registers the following methods for the VtkWriter class:

  • addAllResults(dataTag: DataTag)
  • addResult(resType: str, dataTag: ikarus.io.DataTag)
  • write(fileName), returns actual fileName
  • addInterpolation(writer, vals_::np.array, basis, name: str, dataTag: ikarus.io.DataTag)
  • addPointData() (multiple overloads)
  • addCellData() (multiple overloads)
  • setFormat(type: dune.vtk.FormatTypes)
  • setDatatype(type: dune.vtk.DataTypes)
  • setHeadertype(type: dune.vtk.DataTypes)
Template Parameters
WriterThe writer class type.
optionsAdditional options for the writer class.
Parameters
scopeThe scope in which to register the class.
clsThe class object to register the methods with.