expose SetCustomExcite() in Python (ported from PR #129)

pull/137/head
Tobias Oberstein 2023-12-16 12:13:56 +01:00 committed by Thorsten Liebig
parent e5db9de99b
commit 45c90c24e8
3 changed files with 18 additions and 0 deletions

View File

@ -882,6 +882,12 @@ void openEMS::SetStepExcite(double f_max)
m_Exc->SetupStepExcite(f_max);
}
void openEMS::SetCustomExcite(std::string str, double f0, double fmax)
{
this->InitExcitation();
m_Exc->SetupCustomExcite(str, f0, fmax);
}
Excitation* openEMS::InitExcitation()
{
delete m_Exc;

View File

@ -105,6 +105,7 @@ public:
void SetSinusExcite(double f0);
void SetDiracExcite(double f_max);
void SetStepExcite(double f_max);
void SetCustomExcite(std::string str, double f0, double fmax);
Excitation* InitExcitation();

View File

@ -259,6 +259,17 @@ cdef class openEMS:
"""
self.thisptr.SetStepExcite(f_max)
def SetCustomExcite(self, _str, f0, fmax):
""" SetCustomExcite(_str, f0, fmax)
Set a custom function as excitation signal. The custom function is supplied as a string which gets
parsed using `Function Parser for C++ <http://warp.povusers.org/FunctionParser/fparser.html>`_.
:param _str: str -- Custom function as string literal
:param f0: -- Base frequency.
:param fmax: -- Maximum frequency.
"""
self.thisptr.SetCustomExcite(_str, f0, fmax)
def SetBoundaryCond(self, BC):
""" SetBoundaryCond(BC)