LILAC
|
This class is a basic example of how to write an rhs class. More...
#include <example_rhs.h>
Public Member Functions | |
virtual std::string | type () const |
This function returns the variable type. | |
virtual std::vector< std::string > | dependencies () const |
This function returns a list of the dependencies needed to initialize the class. | |
virtual void | postprocess (input &indat) |
This function processes the input data for the class. | |
virtual void | update () |
Update function for example_rhs. | |
virtual int | dxdt (ptr_passer x, ptr_passer dx, double t) |
This is the rhs function that calculates the derivative. | |
virtual | ~example_rhs () |
Destructor for example_rhs. | |
![]() | |
virtual const std::type_info & | vtype () const |
returns the type of the current variable | |
virtual void | initial_condition (ptr_passer in, size_t len) |
Generic initial condition, call default constructor for each element/. | |
![]() | |
rhs () | |
Creates the base rhs class with a dimension=dimen. | |
void | initial_condition (ptr_passer x) |
Wrapper for intial_condition that assumes the length is equal to dimension. | |
virtual | ~rhs () |
![]() | |
size_t | get_dimension () const |
![]() | |
item () | |
virtual | ~item () |
virtual void | print () const |
Standard print function. | |
void | setname (const std::string n) |
void | set_write_name (std::string wname) |
const std::string & | name () const |
const std::string & | write_name () const |
![]() | |
bool | compare (const vartype *in) const |
bool | compare (const vartype &in) const |
bool | compare (const std::type_info &tinf) |
template<typename T > | |
bool | compare () const |
template<typename T > | |
bool | compare (const T &in) const |
std::string | vname () const |
virtual const std::type_info & | vtype_internal () const |
bool | compare_internal (const vartype *in) const |
bool | compare_internal (const vartype &in) const |
bool | compare_internal (const std::type_info &tinf) |
template<typename T > | |
bool | compare_internal () const |
template<typename T > | |
bool | compare_internal (const T &in) const |
std::string | vname_internal () const |
virtual | ~vartype () |
Private Attributes | |
double | val1 |
double | val2 |
std::string | random_info |
comp | something_useless |
comp * | value_holder |
Additional Inherited Members | |
![]() | |
static std::shared_ptr< item > | create (std::string name, engineimp *rval) |
![]() | |
engineimp * | holder |
![]() | |
void | print_upstream () |
virtual void | _do_mem_update (size_t dim_old) |
void | add_as_parent (item_dim *p) |
void | add_as_parent (std::shared_ptr< item_dim > p) |
void | update_dim (size_t dim_new) |
![]() | |
mempool | memp |
std::set< item_dim * > | children |
item_dim * | parent |
size_t | dimension |
This class is a basic example of how to write an rhs class.
This class is an example of a function rhs class. It implements all of the functions needed, and can even be called from the input file. Make sure to read the source file, as it contains a large amount of documentations that is not present in the documentation Notice that it inherits from rhs_type<comp>, since it is a complex value rhs. An rhs that dealt with real variables would inherit from rhs_type<double>.
Definition at line 38 of file example_rhs.h.
|
virtual |
Destructor for example_rhs.
This is the destructor for example_rhs. Whenever the class is deleted by the engine, this frees resources. The destructor for the memory pool is called here, so don't worry about deallocations
Definition at line 163 of file example_rhs.cpp.
|
virtual |
This function returns a list of the dependencies needed to initialize the class.
The engine ensures that these variables will themselves be initialized when they are used to initialize the class. An error occurs if the variables are not found in the input or there is a loop of dependencies, this is a depends on b, which depends on c, which in turn depends back on a.
Implements item_dim.
Definition at line 69 of file example_rhs.cpp.
|
virtual |
This is the rhs function that calculates the derivative.
This functions calculates a derivative given the current time and function value it takes in a pointer to x, which is the function value, and stores that data in dx.
x | The current function value |
dx | The array i which the derivative is stored |
t | The current time |
Implements rhs.
Definition at line 178 of file example_rhs.cpp.
|
virtual |
This function processes the input data for the class.
This function process data that has been generated from an input file All of the names returned in the dependencies file exist and have been processed
dat | The data structure containing the variable names |
Reimplemented from item_dim.
Definition at line 85 of file example_rhs.cpp.
|
virtual |
This function returns the variable type.
This function returns a string that has the typename of your variable. If the variable is meant to be instantiated in an input script, then this function must return the name which corresponds to this class. See rhs_CNLS for a case where that differs from the class name
Implements item.
Definition at line 54 of file example_rhs.cpp.
|
virtual |
Update function for example_rhs.
This function updates the values held by this class in case one of them is a variable that is being controlled. We don't re-allocate memory, since integers like dimension cannot be controlled. However, we must re-evaluate the array value_holder. The values val1, val2, etc are controlled themselves by the controller
Reimplemented from item.
Definition at line 151 of file example_rhs.cpp.
|
private |
Definition at line 46 of file example_rhs.h.
|
private |
Definition at line 50 of file example_rhs.h.
|
private |
Definition at line 43 of file example_rhs.h.
|
private |
Definition at line 43 of file example_rhs.h.
|
private |
Definition at line 56 of file example_rhs.h.