CAMP 1.0.0
Chemistry Across Multiple Phases
|
Header for the Jacobian structure and related functions. More...
Go to the source code of this file.
Classes | |
struct | JacobianColumnElements |
struct | Jacobian |
Macros | |
#define | JACOBIAN_PRODUCTION 0 |
#define | JACOBIAN_LOSS 1 |
Functions | |
int | jacobian_initialize_empty (Jacobian *jac, unsigned int num_spec) |
Initialize the Jacobian. | |
int | jacobian_initialize (Jacobian *jac, unsigned int num_spec, unsigned int **jac_struct) |
Initialize the Jacobian. | |
void | jacobian_register_element (Jacobian *jac, unsigned int dep_id, unsigned int ind_id) |
Adds an element to the sparse matrix. | |
unsigned int | jacobian_build_matrix (Jacobian *jac) |
Builds the sparse matrix with the registered elements. | |
unsigned int | jacobian_number_of_elements (Jacobian jac) |
Returns the number of elements in the Jacobian. | |
unsigned int | jacobian_column_pointer_value (Jacobian jac, unsigned int col_id) |
Returns the value of a column pointer. | |
unsigned int | jacobian_row_index (Jacobian jac, unsigned int elem_id) |
Returns the row for a given Jacobian element. | |
unsigned int | jacobian_get_element_id (Jacobian jac, unsigned int dep_id, unsigned int ind_id) |
Get an element id in the Jacobian data arrays. | |
void | jacobian_reset (Jacobian jac) |
Reset the Jacobian. | |
void | jacobian_output (Jacobian jac, double *dest_array) |
Output the Jacobian. | |
void | jacobian_add_value (Jacobian jac, unsigned int elem_id, unsigned int prod_or_loss, long double jac_contribution) |
Add a contribution to the Jacobian. | |
void | jacobian_print (Jacobian jac) |
Prints the Jacobian structure. | |
void | jacobian_column_elements_free (JacobianColumnElements *column) |
Free memory associated with a JacobianColumnElements. | |
void | jacobian_free (Jacobian *jac) |
Free memory associated with a Jacobian. | |
Header for the Jacobian structure and related functions.
Definition in file Jacobian.h.
#define JACOBIAN_LOSS 1 |
Definition at line 19 of file Jacobian.h.
#define JACOBIAN_PRODUCTION 0 |
Definition at line 18 of file Jacobian.h.
void jacobian_add_value | ( | Jacobian | jac, |
unsigned int | elem_id, | ||
unsigned int | prod_or_loss, | ||
long double | jac_contribution | ||
) |
Add a contribution to the Jacobian.
jac | Jacobian object |
elem_id | Index of the element to update in the data array |
prod_or_loss | Flag indicating whether to update the (0) production or (1) loss elements |
jac_contribution | Value to add to the Jacobian element (contributions to loss elements should be positive if the contribution increases the loss) |
Definition at line 234 of file Jacobian.c.
unsigned int jacobian_build_matrix | ( | Jacobian * | jac | ) |
Builds the sparse matrix with the registered elements.
Definition at line 129 of file Jacobian.c.
void jacobian_column_elements_free | ( | JacobianColumnElements * | column | ) |
Free memory associated with a JacobianColumnElements.
column | Jacobian column elements |
Definition at line 274 of file Jacobian.c.
unsigned int jacobian_column_pointer_value | ( | Jacobian | jac, |
unsigned int | col_id | ||
) |
Returns the value of a column pointer.
jac | Jacobian object |
col_id | Column index (0...number of columns) |
Definition at line 192 of file Jacobian.c.
void jacobian_free | ( | Jacobian * | jac | ) |
Free memory associated with a Jacobian.
jac | Jacobian object |
Definition at line 281 of file Jacobian.c.
unsigned int jacobian_get_element_id | ( | Jacobian | jac, |
unsigned int | dep_id, | ||
unsigned int | ind_id | ||
) |
Get an element id in the Jacobian data arrays.
If the element is not included in the sparse matrix, -1 is returned.
jac | Jacobian object |
dep_id | Dependent species index |
ind_id | Independent species index |
Definition at line 200 of file Jacobian.c.
int jacobian_initialize | ( | Jacobian * | jac, |
unsigned int | num_spec, | ||
unsigned int ** | jac_struct | ||
) |
Initialize the Jacobian.
jac | Pointer to the Jacobian object |
num_spec | Number of species |
jac_struct | Dense matrix of flags indicating whether an element is (1) potentially non-zero or (0) not. |
Definition at line 46 of file Jacobian.c.
int jacobian_initialize_empty | ( | Jacobian * | jac, |
unsigned int | num_spec | ||
) |
Initialize the Jacobian.
Sets up a sparse matrix (num_spec x num_spec) containing zero elements. Elements can be added using the jacobian_register_element
function.
jac | Jacobian object |
num_spec | Number of species |
Definition at line 20 of file Jacobian.c.
unsigned int jacobian_number_of_elements | ( | Jacobian | jac | ) |
Returns the number of elements in the Jacobian.
jac | Jacobian object |
Definition at line 190 of file Jacobian.c.
void jacobian_output | ( | Jacobian | jac, |
double * | dest_array | ||
) |
Output the Jacobian.
Definition at line 223 of file Jacobian.c.
void jacobian_print | ( | Jacobian | jac | ) |
Prints the Jacobian structure.
jac | Jacobian object |
Definition at line 243 of file Jacobian.c.
void jacobian_register_element | ( | Jacobian * | jac, |
unsigned int | dep_id, | ||
unsigned int | ind_id | ||
) |
Adds an element to the sparse matrix.
jac | Jacobian object |
dep_id | Dependent species index |
ind_id | Independent species index |
Definition at line 105 of file Jacobian.c.
void jacobian_reset | ( | Jacobian | jac | ) |
Reset the Jacobian.
jac | Jacobian matrix |
Definition at line 216 of file Jacobian.c.
unsigned int jacobian_row_index | ( | Jacobian | jac, |
unsigned int | elem_id | ||
) |
Returns the row for a given Jacobian element.
Definition at line 196 of file Jacobian.c.