本文整理汇总了C++中VEC_V函数的典型用法代码示例。如果您正苦于以下问题:C++ VEC_V函数的具体用法?C++ VEC_V怎么用?C++ VEC_V使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VEC_V函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
static void update(NrnThread* _nt)
{
int i, i1, i2;
i1 = 0;
i2 = _nt->end;
#if CACHEVEC
if (use_cachevec) {
/* do not need to worry about linmod or extracellular*/
if (secondorder) {
for (i=i1; i < i2; ++i) {
VEC_V(i) += 2.*VEC_RHS(i);
}
}else{
for (i=i1; i < i2; ++i) {
VEC_V(i) += VEC_RHS(i);
}
}
}else
#endif
{ /* use original non-vectorized update */
if (secondorder) {
#if _CRAY
#pragma _CRI ivdep
#endif
for (i=i1; i < i2; ++i) {
NODEV(_nt->_v_node[i]) += 2.*NODERHS(_nt->_v_node[i]);
}
}else{
#if _CRAY
#pragma _CRI ivdep
#endif
for (i=i1; i < i2; ++i) {
NODEV(_nt->_v_node[i]) += NODERHS(_nt->_v_node[i]);
}
if (use_sparse13) {
nrndae_update();
}
}
} /* end of non-vectorized update */
#if EXTRACELLULAR
nrn_update_2d(_nt);
#endif
#if I_MEMBRANE
if (_nt->tml) {
assert(_nt->tml->index == CAP);
nrn_capacity_current(_nt, _nt->tml->ml);
}
#endif
}
示例2: nrn_init
static void nrn_init(_NrnThread* _nt, _Memb_list* _ml, int _type){
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
v = _v;
cai = _ion_cai;
cao = _ion_cao;
cai = _ion_cai;
ki = _ion_ki;
ko = _ion_ko;
nai = _ion_nai;
nao = _ion_nao;
initmodel();
_ion_cai = cai;
nrn_wrote_conc(_ca_sym, (&(_ion_cai)) - 1, _style_ca);
}}
示例3: nrn_state
static void nrn_state(_NrnThread* _nt, _Memb_list* _ml, int _type) {
double _break, _save;
double* _p; Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
_thread = _ml->_thread;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
_nd = _ml->_nodelist[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
_break = t + .5*dt; _save = t;
v=_v;
{
ek = _ion_ek;
{ {
for (; t < _break; t += dt) {
states(_p, _ppvar, _thread, _nt);
}}
t = _save;
} }}
}
示例4: nrn_state
static void nrn_state(_NrnThread* _nt, _Memb_list* _ml, int _type) {
double* _p; Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
_thread = _ml->_thread;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
_nd = _ml->_nodelist[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
v=_v;
{
cai = _ion_cai;
{ _deriv1_advance = 1;
derivimplicit_thread(2, _slist1, _dlist1, _p, states, _ppvar, _thread, _nt);
_deriv1_advance = 0;
} }}
}
示例5: nrn_init
static void nrn_init(_NrnThread* _nt, _Memb_list* _ml, int _type){
double* _p; Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
_thread = _ml->_thread;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
v = _v;
iCa = _ion_iCa;
Cai = _ion_Cai;
Cai = _ion_Cai;
initmodel(_p, _ppvar, _thread, _nt);
_ion_Cai = Cai;
nrn_wrote_conc(_Ca_sym, (&(_ion_Cai)) - 1, _style_Ca);
}}
示例6: nrn_state
static void nrn_state(_NrnThread* _nt, _Memb_list* _ml, int _type){
double _break, _save;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
_nd = _ml->_nodelist[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
_break = t + .5*dt; _save = t;
v=_v;
{
ek = _ion_ek;
{ {
for (; t < _break; t += dt) {
error = states();
if(error){fprintf(stderr,"at line 64 in file KA_i1.mod:\n SOLVE states METHOD cnexp\n"); nrn_complain(_p); abort_run(error);}
}}
t = _save;
} }}
}
示例7: nrn_cur
static void nrn_cur(_NrnThread* _nt, _Memb_list* _ml, int _type) {
double* _p; Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
_thread = _ml->_thread;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
_g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001);
{ _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v);
}
_g = (_g - _rhs)/.001;
#if CACHEVEC
if (use_cachevec) {
VEC_RHS(_ni[_iml]) -= _rhs;
}else
#endif
{
NODERHS(_nd) -= _rhs;
}
}}
示例8: nrn_init
static void nrn_init(_NrnThread* _nt, _Memb_list* _ml, int _type){
double* _p; Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
_thread = _ml->_thread;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
#if 0
_check_rates(_p, _ppvar, _thread, _nt);
#endif
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
v = _v;
ena = _ion_ena;
initmodel(_p, _ppvar, _thread, _nt);
}}
示例9: nrn_finitialize
void nrn_finitialize(int setv, double v) {
int i;
NrnThread* _nt;
t = 0.;
dt2thread(-1.);
nrn_thread_table_check();
clear_event_queue();
nrn_spike_exchange_init();
#if VECTORIZE
nrn_play_init(); /* Vector.play */
///Play events should be executed before initializing events
for (i=0; i < nrn_nthread; ++i) {
nrn_deliver_events(nrn_threads + i); /* The play events at t=0 */
}
if (setv) {
for (_nt = nrn_threads; _nt < nrn_threads + nrn_nthread; ++_nt) {
for (i=0; i < _nt->end; ++i) {
VEC_V(i) = v;
}
}
}
for (i=0; i < nrn_nthread; ++i) {
nrn_ba(nrn_threads + i, BEFORE_INITIAL);
}
/* the INITIAL blocks are ordered so that mechanisms that write
concentrations are after ions and before mechanisms that read
concentrations.
*/
/* the memblist list in NrnThread is already so ordered */
for (i=0; i < nrn_nthread; ++i) {
NrnThread* nt = nrn_threads + i;
NrnThreadMembList* tml;
for (tml = nt->tml; tml; tml = tml->next) {
mod_f_t s = memb_func[tml->index].initialize;
if (s) {
(*s)(nt, tml->ml, tml->index);
}
}
}
#endif
init_net_events();
for (i = 0; i < nrn_nthread; ++i) {
nrn_ba(nrn_threads + i, AFTER_INITIAL);
}
for (i=0; i < nrn_nthread; ++i) {
nrn_deliver_events(nrn_threads + i); /* The INITIAL sent events at t=0 */
}
for (i=0; i < nrn_nthread; ++i) {
setup_tree_matrix_minimal(nrn_threads + i);
}
for (i=0; i < nrn_nthread; ++i) {
nrn_deliver_events(nrn_threads + i); /* The record events at t=0 */
}
#if NRNMPI
nrn_spike_exchange(nrn_threads);
#endif
}
示例10: KSPSetUp_AGMRES
PetscErrorCode KSPSetUp_AGMRES(KSP ksp)
{
PetscErrorCode ierr;
PetscInt hes;
PetscInt nloc;
KSP_AGMRES *agmres = (KSP_AGMRES*)ksp->data;
PetscInt neig = agmres->neig;
PetscInt max_k = agmres->max_k;
PetscInt N = MAXKSPSIZE;
PetscInt lwork = PetscMax(8 * N + 16, 4 * neig * (N - neig));
PetscFunctionBegin;
if (ksp->pc_side == PC_SYMMETRIC) SETERRQ(PetscObjectComm((PetscObject)ksp),PETSC_ERR_SUP,"no symmetric preconditioning for KSPAGMRES");
max_k = agmres->max_k;
N = MAXKSPSIZE;
/* Preallocate space during the call to KSPSetup_GMRES for the Krylov basis */
agmres->q_preallocate = PETSC_TRUE; /* No allocation on the fly */
/* Preallocate space to compute later the eigenvalues in GMRES */
ksp->calc_sings = PETSC_TRUE;
agmres->max_k = N; /* Set the augmented size to be allocated in KSPSetup_GMRES */
ierr = KSPSetUp_DGMRES(ksp);CHKERRQ(ierr);
agmres->max_k = max_k;
hes = (N + 1) * (N + 1);
/* Data for the Newton basis GMRES */
ierr = PetscMalloc4(max_k,PetscScalar,&agmres->Rshift,max_k,PetscScalar,&agmres->Ishift,hes,PetscScalar,&agmres->Rloc,((N+1)*4),PetscScalar,&agmres->wbufptr);CHKERRQ(ierr);
ierr = PetscMalloc7((N+1),PetscScalar,&agmres->Scale,(N+1),PetscScalar,&agmres->sgn,(N+1),PetscScalar,&agmres->tloc,(N+1),PetscScalar,&agmres->temp,(N+1),PetscScalar,&agmres->tau,lwork,PetscScalar,&agmres->work,(N+1),PetscScalar,&agmres->nrs);CHKERRQ(ierr);
ierr = PetscMemzero(agmres->Rshift, max_k*sizeof(PetscScalar));CHKERRQ(ierr);
ierr = PetscMemzero(agmres->Ishift, max_k*sizeof(PetscScalar));CHKERRQ(ierr);
ierr = PetscMemzero(agmres->Scale, (N+1)*sizeof(PetscScalar));CHKERRQ(ierr);
ierr = PetscMemzero(agmres->Rloc, (N+1)*(N+1)*sizeof(PetscScalar));CHKERRQ(ierr);
ierr = PetscMemzero(agmres->sgn, (N+1)*sizeof(PetscScalar));CHKERRQ(ierr);
ierr = PetscMemzero(agmres->tloc, (N+1)*sizeof(PetscScalar));CHKERRQ(ierr);
ierr = PetscMemzero(agmres->temp, (N+1)*sizeof(PetscScalar));CHKERRQ(ierr);
ierr = PetscMemzero(agmres->wbufptr, (N+1)*4*sizeof(PetscScalar));CHKERRQ(ierr);
/* Allocate space for the vectors in the orthogonalized basis*/
ierr = VecGetLocalSize(agmres->vecs[0], &nloc);CHKERRQ(ierr);
ierr = PetscMalloc(nloc*(N+1)*sizeof(PetscScalar), &agmres->Qloc);CHKERRQ(ierr);
/* Init the ring of processors for the roddec orthogonalization */
ierr = KSPAGMRESRoddecInitNeighboor(ksp);CHKERRQ(ierr);
if (agmres->neig < 1) PetscFunctionReturn(0);
/* Allocate space for the deflation */
ierr = PetscMalloc(N*sizeof(PetscScalar), &agmres->select);CHKERRQ(ierr);
ierr = VecDuplicateVecs(VEC_V(0), N, &agmres->TmpU);CHKERRQ(ierr);
ierr = PetscMalloc2(N*N, PetscScalar, &agmres->MatEigL, N*N, PetscScalar, &agmres->MatEigR);CHKERRQ(ierr);
/* ierr = PetscMalloc6(N*N, PetscScalar, &agmres->Q, N*N, PetscScalar, &agmres->Z, N, PetscScalar, &agmres->wr, N, PetscScalar, &agmres->wi, N, PetscScalar, &agmres->beta, N, PetscScalar, &agmres->modul);CHKERRQ(ierr); */
ierr = PetscMalloc3(N*N, PetscScalar, &agmres->Q, N*N, PetscScalar, &agmres->Z, N, PetscScalar, &agmres->beta);CHKERRQ(ierr);
ierr = PetscMalloc2((N+1),PetscInt,&agmres->perm,(2*neig*N),PetscInt,&agmres->iwork);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例11: nrn_cur
static void nrn_cur(_NrnThread* _nt, _Memb_list* _ml, int _type){
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
cai = _ion_cai;
cao = _ion_cao;
cai = _ion_cai;
ki = _ion_ki;
ko = _ion_ko;
nai = _ion_nai;
nao = _ion_nao;
_g = _nrn_current(_v + .001);
{ double _dina;
double _dik;
double _dica;
_dica = ica;
_dik = ik;
_dina = ina;
_rhs = _nrn_current(_v);
_ion_dicadv += (_dica - ica)/.001 ;
_ion_dikdv += (_dik - ik)/.001 ;
_ion_dinadv += (_dina - ina)/.001 ;
}
_g = (_g - _rhs)/.001;
_ion_ica += ica ;
_ion_cai = cai;
_ion_ik += ik ;
_ion_ina += ina ;
#if CACHEVEC
if (use_cachevec) {
VEC_RHS(_ni[_iml]) -= _rhs;
}else
#endif
{
NODERHS(_nd) -= _rhs;
}
}}
示例12: nrn_state
static void nrn_state(_NrnThread* _nt, _Memb_list* _ml, int _type){
double _break, _save;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
_nd = _ml->_nodelist[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
_break = t + .5*dt; _save = t;
v=_v;
{
ica = _ion_ica;
cai = _ion_cai;
cai = _ion_cai;
{ {
for (; t < _break; t += dt) {
error = _deriv1_advance = 1;
derivimplicit(_ninits, 1, _slist1, _dlist1, _p, &t, dt, state, &_temp1);
_deriv1_advance = 0;
if(error){fprintf(stderr,"at line 72 in file cad_0403.mod:\n SOLVE state METHOD derivimplicit\n"); nrn_complain(_p); abort_run(error);}
}}
t = _save;
} {
/*VERBATIM*/
/* printf("CAD.MOD cai:%.10lf\t",cai);*/
}
_ion_cai = cai;
}}
}
示例13: nrn_state
static void nrn_state(_NrnThread* _nt, _Memb_list* _ml, int _type) {
double _break, _save;
double* _p; Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
_thread = _ml->_thread;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
_nd = _ml->_nodelist[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
_break = t + .5*dt; _save = t;
v=_v;
{
ik = _ion_ik;
ko = _ion_ko;
ina = _ion_ina;
nai = _ion_nai;
{ {
for (; t < _break; t += dt) {
_deriv1_advance = 1;
derivimplicit_thread(2, _slist1, _dlist1, _p, state, _ppvar, _thread, _nt);
_deriv1_advance = 0;
}}
t = _save;
} {
}
_ion_ko = ko;
_ion_nai = nai;
}}
}
示例14: nrn_cur
static void nrn_cur(_NrnThread* _nt, _Memb_list* _ml, int _type){
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
}}
示例15: nrn_state
static void nrn_state(_NrnThread* _nt, _Memb_list* _ml, int _type){
double _break, _save;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
#if CACHEVEC
_ni = _ml->_nodeindices;
#endif
_cntml = _ml->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
_p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
_nd = _ml->_nodelist[_iml];
#if CACHEVEC
if (use_cachevec) {
_v = VEC_V(_ni[_iml]);
}else
#endif
{
_nd = _ml->_nodelist[_iml];
_v = NODEV(_nd);
}
_break = t + .5*dt; _save = t;
v=_v;
{
cai = _ion_cai;
cao = _ion_cao;
cai = _ion_cai;
ki = _ion_ki;
ko = _ion_ko;
nai = _ion_nai;
nao = _ion_nao;
{ {
for (; t < _break; t += dt) {
error = states();
if(error){fprintf(stderr,"at line 131 in file pGPeA_fukuda.mod:\n \n"); nrn_complain(_p); abort_run(error);}
}}
t = _save;
} _ion_cai = cai;
}}
}