Skip to content

ODEData Class

Jacob Fields edited this page Jun 10, 2020 · 1 revision

The ODEData class is a basic data structure to store data for equations in ODE.

Protected Fields

Field Description
unsigned int nEq The number of equations for the data stored here.
double **data The raw data for each equation, organized as [variable][point].
double **line An empty array that can be used to store a single line of data. It is organized as [var][point], where the [point] dimension is the same size as the largest dimension of the Grid. This is useful for certain PDEs, such as fluids, which may need to loop over a single dimension several times. Loading the data into a line can sometimes simplify indexing operations and allow for sequential memory access in the y-direction.
const Grid& mGrid The Grid this data corresponds to.

Public Methods

Method Description
ODEData(unsigned int eqCount, const Grid& grid) The constructor for ODEData. It sets the number of equations and the Grid and allocates all the memory for ODEData.
virtual ~ODEData() The destructor for ODEData. It simply releases all allocated memory. It is virtual so that derived classes can behave correctly.
double** getData() const Get the data array.
double** getLine() const Get the line array.
unsigned int getEqCount() const Get the number of equations stored in this ODEData object.
const Grid& getGrid() const Get the Grid that data corresponds to.

Derived Classes

SolverData

SolverData is the ODEData class used by evolved fields. It stores additional memory to facilitate use with the Solver class.

Additional Public Methods

Method Description
SolverData(unsigned int eqCount, unsigned int stages, const Grid& grid) The constructor for SolverData. In addition to needing an equation count and a Grid, it also needs to know the number of stages for the Solver it will be used with. This allows it to allocate the correct amount of memory for the work arrays.
virtual ~SolverData() Again, like ~ODEData(), this is virtual, and it simply releases any allocated memory.
double** getIntermediateData const Get the array where the intermediate solution should be stored.
double*** getWorkData() const Get the work data array, which ideally contains the right-hand side for each stage of the Solver used in ODE.
double** getCurrentRHS() const Get the particular work array/right-hand side corresponding to the current stage of the Solver, which is also set in the SolverData object.
unsigned int getCurrentStage() const Get the current stage in the SolverData object. This should be kept consistent with the Solver object.
void setCurrentStage(unsigned int stage) Set the current stage in the SolverData object. This should be kept consistent with the Solver object.

Clone this wiki locally