![]() |
User Guide
|
Helper class used by driver and parser while solving diff equation. More...
Helper class used by driver and parser while solving diff equation.
Definition at line 71 of file diffeq_context.hpp.
#include <diffeq_context.hpp>
Public Member Functions | |
DiffEqContext ()=default | |
DiffEqContext (std::string state, int, std::string rhs, std::string method) | |
const std::string & | state_variable () const |
return the state variable More... | |
std::string | get_solution (bool &cnexp_possible) |
return solution of the differential equation More... | |
std::string | get_expr_for_nonlinear () const |
return expression with Dstate added More... | |
void | print () const |
print the context (for debugging) More... | |
Public Attributes | |
Term | solution |
"final" solution of the equation More... | |
bool | deriv_invalid = false |
if derivative of the equation is invalid More... | |
bool | eqn_invalid = false |
if equation itself is invalid More... | |
Private Member Functions | |
std::string | get_cnexp_solution () const |
return solution for cnexp method More... | |
std::string | get_euler_derivate () const |
return only the derivate for euler method More... | |
std::string | get_non_cnexp_solution () const |
return solution for non-cnexp method More... | |
std::string | get_cvode_linear_diffeq () const |
for non-cnexp methods : return the solution based on if equation is linear or not More... | |
std::string | get_cvode_nonlinear_diffeq () const |
Return solution for non-cnexp method and when equation is non-linear. More... | |
std::string | cvode_deriv () const |
std::string | cvode_eqnrhs () const |
Private Attributes | |
std::string | method |
name of the solve method More... | |
std::string | state |
name of the state variable More... | |
std::string | rhs |
rhs of equation More... | |
|
default |
|
inline |
Definition at line 110 of file diffeq_context.hpp.
|
private |
Definition at line 47 of file diffeq_context.cpp.
|
private |
Definition at line 56 of file diffeq_context.cpp.
|
private |
return solution for cnexp method
Return solution for cnexp method.
a is zero typically when rhs doesn't have state variable in this case we have to remove "last" term "/(0.0)" from b and then return : state = state - dt*(b)
Definition at line 119 of file diffeq_context.cpp.
|
private |
for non-cnexp methods : return the solution based on if equation is linear or not
Return solution for non-cnexp method and when equation is linear.
Definition at line 99 of file diffeq_context.cpp.
|
private |
Return solution for non-cnexp method and when equation is non-linear.
Definition at line 108 of file diffeq_context.cpp.
|
private |
return only the derivate for euler method
Return solution for euler method.
Definition at line 142 of file diffeq_context.cpp.
std::string nmodl::parser::diffeq::DiffEqContext::get_expr_for_nonlinear | ( | ) | const |
return expression with Dstate added
When non-cnexp method is used, for solving non-linear equations we need original expression but with replacing every state variable with (state+0.001).
In order to do this we scan original expression and build new by replacing only state variable.
build lexer instance
scan entire expression
extract value of the token and check if it is a token
Definition at line 70 of file diffeq_context.cpp.
|
private |
return solution for non-cnexp method
Return solution for non-cnexp method.
Definition at line 150 of file diffeq_context.cpp.
std::string nmodl::parser::diffeq::DiffEqContext::get_solution | ( | bool & | cnexp_possible | ) |
return solution of the differential equation
Return the solution for differential equation based on method used.
Definition at line 170 of file diffeq_context.cpp.
void nmodl::parser::diffeq::DiffEqContext::print | ( | ) | const |
print the context (for debugging)
Definition at line 35 of file diffeq_context.cpp.
|
inline |
return the state variable
Definition at line 116 of file diffeq_context.hpp.
bool nmodl::parser::diffeq::DiffEqContext::deriv_invalid = false |
if derivative of the equation is invalid
Definition at line 103 of file diffeq_context.hpp.
bool nmodl::parser::diffeq::DiffEqContext::eqn_invalid = false |
if equation itself is invalid
Definition at line 106 of file diffeq_context.hpp.
|
private |
name of the solve method
Definition at line 73 of file diffeq_context.hpp.
|
private |
rhs of equation
Definition at line 79 of file diffeq_context.hpp.
Term nmodl::parser::diffeq::DiffEqContext::solution |
"final" solution of the equation
Definition at line 100 of file diffeq_context.hpp.
|
private |
name of the state variable
Definition at line 76 of file diffeq_context.hpp.