CoreNEURON
newton_thread.cpp
Go to the documentation of this file.
1 /*
2 # =============================================================================
3 # Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
4 #
5 # See top-level LICENSE file for details.
6 # =============================================================================
7 */
8 #include <math.h>
9 #include <stdlib.h>
10 
13 
14 namespace coreneuron {
15 NewtonSpace* nrn_cons_newtonspace(int n, int n_instance) {
16  NewtonSpace* ns = (NewtonSpace*) emalloc(sizeof(NewtonSpace));
17  ns->n = n;
18  ns->n_instance = n_instance;
19  ns->delta_x = makevector(n * n_instance * sizeof(double));
20  ns->jacobian = makematrix(n, n * n_instance);
21  ns->perm = (int*) emalloc((unsigned) (n * n_instance * sizeof(int)));
22  ns->high_value = makevector(n * n_instance * sizeof(double));
23  ns->low_value = makevector(n * n_instance * sizeof(double));
24  ns->rowmax = makevector(n * n_instance * sizeof(double));
26  return ns;
27 }
28 
31  free((char*) ns->perm);
32  freevector(ns->delta_x);
33  freematrix(ns->jacobian);
35  freevector(ns->low_value);
36  freevector(ns->rowmax);
37  free((char*) ns);
38 }
39 } // namespace coreneuron
coreneuron::NewtonSpace::high_value
double * high_value
Definition: newton_struct.h:20
coreneuron::NewtonSpace::perm
int * perm
Definition: newton_struct.h:19
coreneuron::nrn_destroy_newtonspace
void nrn_destroy_newtonspace(NewtonSpace *ns)
Definition: newton_thread.cpp:29
coreneuron::NewtonSpace
Definition: newton_struct.h:14
nrnoc_aux.hpp
coreneuron::NewtonSpace::delta_x
double * delta_x
Definition: newton_struct.h:17
coreneuron::NewtonSpace::jacobian
double ** jacobian
Definition: newton_struct.h:18
coreneuron::NewtonSpace::n_instance
int n_instance
Definition: newton_struct.h:16
coreneuron::makematrix
double ** makematrix(size_t nrows, size_t ncols)
Definition: nrnoc_aux.cpp:58
coreneuron
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
Definition: corenrn_parameters.cpp:12
coreneuron::nrn_newtonspace_delete_from_device
void nrn_newtonspace_delete_from_device(NewtonSpace *ns)
Definition: nrn_acc_manager.cpp:1290
newton_thread.hpp
coreneuron::makevector
double * makevector(size_t size)
Definition: nrnoc_aux.cpp:48
coreneuron::nrn_newtonspace_copyto_device
void nrn_newtonspace_copyto_device(NewtonSpace *ns)
Definition: nrn_acc_manager.cpp:1248
coreneuron::NewtonSpace::low_value
double * low_value
Definition: newton_struct.h:21
coreneuron::emalloc
static void * emalloc(size_t size)
Definition: mpispike.cpp:30
coreneuron::NewtonSpace::rowmax
double * rowmax
Definition: newton_struct.h:22
coreneuron::freevector
void freevector(double *p)
Definition: nrnoc_aux.cpp:52
coreneuron::NewtonSpace::n
int n
Definition: newton_struct.h:15
coreneuron::nrn_cons_newtonspace
NewtonSpace * nrn_cons_newtonspace(int n, int n_instance)
Definition: newton_thread.cpp:15
coreneuron::freematrix
void freematrix(double **matrix)
Definition: nrnoc_aux.cpp:66