LILAC
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
example_rhs Class Reference

This class is a basic example of how to write an rhs class. More...

#include <example_rhs.h>

Inheritance diagram for example_rhs:
Inheritance graph
[legend]
Collaboration diagram for example_rhs:
Collaboration graph
[legend]

Public Member Functions

virtual std::string type () const
 This function returns the variable type.
virtual std::vector< std::stringdependencies () 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.
- Public Member Functions inherited from rhs_type< comp >
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/.
- Public Member Functions inherited from rhs
 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 ()
- Public Member Functions inherited from item_dim
size_t get_dimension () const
- Public Member Functions inherited from item
 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::stringname () const
const std::stringwrite_name () const
- Public Member Functions inherited from vartype
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
compvalue_holder

Additional Inherited Members

- Static Public Member Functions inherited from item
static std::shared_ptr< itemcreate (std::string name, engineimp *rval)
- Public Attributes inherited from item
engineimpholder
- Protected Member Functions inherited from item_dim
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)
- Protected Attributes inherited from item_dim
mempool memp
std::set< item_dim * > children
item_dimparent
size_t dimension

Detailed Description

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>.

See Also
example_rhs.cpp, example_rhs.h, rhs, and item

Definition at line 38 of file example_rhs.h.

Constructor & Destructor Documentation

example_rhs::~example_rhs ( )
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.

Member Function Documentation

std::vector< std::string > example_rhs::dependencies ( ) const
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.

Note
This class depends on val1, val2, and random_info
Returns
List of dependencies

Implements item_dim.

Definition at line 69 of file example_rhs.cpp.

Here is the call graph for this function:

int example_rhs::dxdt ( ptr_passer  _x,
ptr_passer  _dx,
double  t 
)
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.

Parameters
xThe current function value
dxThe array i which the derivative is stored
tThe current time

Implements rhs.

Definition at line 178 of file example_rhs.cpp.

Here is the call graph for this function:

void example_rhs::postprocess ( input dat)
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

Parameters
datThe data structure containing the variable names

Reimplemented from item_dim.

Definition at line 85 of file example_rhs.cpp.

Here is the call graph for this function:

std::string example_rhs::type ( ) const
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

Returns
Name of the class type

Implements item.

Definition at line 54 of file example_rhs.cpp.

void example_rhs::update ( )
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.

Member Data Documentation

std::string example_rhs::random_info
private

Definition at line 46 of file example_rhs.h.

comp example_rhs::something_useless
private

Definition at line 50 of file example_rhs.h.

double example_rhs::val1
private

Definition at line 43 of file example_rhs.h.

double example_rhs::val2
private

Definition at line 43 of file example_rhs.h.

comp* example_rhs::value_holder
private

Definition at line 56 of file example_rhs.h.


The documentation for this class was generated from the following files: