src/matrix_assembly_library/purkinje_coupling_matrix_assembly.c
static void fill_discretization_matrix_elements_purkinje (real_cpu sigma_x, struct cell_node **grid_cells, uint32_t num_active_cells,
                                                        struct node *pk_node) 
{
    
    struct edge *e;
    struct element **cell_elements;
    real_cpu dx;

    real_cpu sigma_x1 = (2.0f * sigma_x * sigma_x) / (sigma_x + sigma_x);

    int i;

    for (i = 0; i < num_active_cells; i++, pk_node = pk_node->next)
    {
        cell_elements = &grid_cells[i]->elements;
        dx = grid_cells[i]->discretization.x;

        e = pk_node->list_edges;

        // Do the mapping of the edges from the graph to the sparse matrix data structure ...
        while (e != NULL)
        {
            struct element new_element;

            // Neighbour elements ...
            new_element.column = e->id;
            new_element.value = -sigma_x1 * dx;
            new_element.cell = grid_cells[e->id];

            // Diagonal element ...
            cell_elements[0]->value += (sigma_x1 * dx);

            arrput(grid_cells[i]->elements,new_element);

            e = e->next;         
        }
    }
}
// For the Purkinje fibers we only need to solve the 1D Monodomain equation
For the Purkinje fibers we only need to solve the 1D Monodomain equation
For the Purkinje fibers we only need to solve the 1D Monodomain equation
static void fill_discretization_matrix_elements_purkinje (real_cpu sigma_x, struct cell_node **grid_cells, uint32_t num_active_cells,
                                                        struct node *pk_node) 
{
    struct edge *e;
    struct element **cell_elements;
    real_cpu dx;
    real_cpu sigma_x1 = (2.0f * sigma_x * sigma_x) / (sigma_x + sigma_x);
    int i;
    for (i = 0; i < num_active_cells; i++, pk_node = pk_node->next)
    {
        cell_elements = &grid_cells[i]->elements;
        dx = grid_cells[i]->discretization.x;
        e = pk_node->list_edges;
        while (e != NULL)
        {
            struct element new_element;
            new_element.column = e->id;
            new_element.value = -sigma_x1 * dx;
            new_element.cell = grid_cells[e->id];
            cell_elements[0]->value += (sigma_x1 * dx);
            arrput(grid_cells[i]->elements,new_element);
            e = e->next;         
        }
    }
}
static void fill_discretization_matrix_elements_purkinje ( real_cpu sigma_x , struct cell_node * * grid_cells , uint32_t num_active_cells , struct node * pk_node ) { struct edge * e ; struct element * * cell_elements ; real_cpu dx ; real_cpu sigma_x1 = ( 2.0f * sigma_x * sigma_x ) / ( sigma_x + sigma_x ) ; int i ; for ( i = 0 ; i < num_active_cells ; i ++ , pk_node = pk_node -> next ) { cell_elements = & grid_cells [ i ] -> elements ; dx = grid_cells [ i ] -> discretization . x ; e = pk_node -> list_edges ; while ( e != NULL ) { struct element new_element ; new_element . column = e -> id ; new_element . value = - sigma_x1 * dx ; new_element . cell = grid_cells [ e -> id ] ; cell_elements [ 0 ] -> value += ( sigma_x1 * dx ) ; arrput ( grid_cells [ i ] -> elements , new_element ) ; e = e -> next ; } } }
For the Purkinje fibers we only need to solve the 1D Monodomain equation
For the Purkinje fibers we only need to solve the 1D Monodomain equation
// Do the mapping of the edges from the graph to the sparse matrix data structure ... // Neighbour elements ... // Diagonal element ...