当前位置: 首页>>代码示例>>C++>>正文


C++ N_VDestroy函数代码示例

本文整理汇总了C++中N_VDestroy函数的典型用法代码示例。如果您正苦于以下问题:C++ N_VDestroy函数的具体用法?C++ N_VDestroy怎么用?C++ N_VDestroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了N_VDestroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: N_VDestroy

void Cvode::init_prepare() {
	if (init_global()) {
		if (y_) {
			N_VDestroy(y_);
			y_ = nil;
		}
		if (mem_) {
			CVodeFree(mem_);
			mem_ = nil;
		}
		if (atolnvec_) {
			N_VDestroy(atolnvec_);
			atolnvec_ = nil;
		}
		if (daspk_) {
			delete daspk_;
			daspk_ = nil;
		}
		init_eqn();
		if (neq_ > 0) {
			y_ = nvnew(neq_);
			if (use_daspk_) {
				alloc_daspk();
			}else{
				alloc_cvode();
			}
			if (maxstate_) {
				activate_maxstate(false);
				activate_maxstate(true);
			}
		}
	}
}
开发者ID:nrnhines,项目名称:nrn,代码行数:33,代码来源:cvodeobj.cpp

示例2: CVAckpntDelete

static void CVAckpntDelete(CkpntMem *ck_memPtr)
{
  CkpntMem tmp;
  int j;

  if (*ck_memPtr != NULL) {

    /* store head of list */
    tmp = *ck_memPtr;

    /* move head of list */
    *ck_memPtr = (*ck_memPtr)->ck_next;

    /* free N_Vectors in tmp */
    for (j=0;j<=tmp->ck_q;j++) N_VDestroy(tmp->ck_zn[j]);
    if (tmp->ck_zqm != 0) N_VDestroy(tmp->ck_zn[tmp->ck_zqm]);

    /* free N_Vectors for quadratures in tmp 
     Note that at the check point at t_initial, only znQ_[0] 
     was allocated*/
    if(tmp->ck_quadr) {
      if(tmp->ck_next != NULL) {
        for (j=0;j<=tmp->ck_q;j++) N_VDestroy(tmp->ck_znQ[j]);
        if (tmp->ck_zqm != 0) N_VDestroy(tmp->ck_znQ[tmp->ck_zqm]);
      } else {
        N_VDestroy(tmp->ck_znQ[0]);
      }
    }

    free(tmp);

  }
}
开发者ID:igemsoftware,项目名称:USTC-Software_2011,代码行数:33,代码来源:cvodea.c

示例3: FIDA_SETVIN

void FIDA_SETVIN(char key_name[], realtype *vval, int *ier)
{
  N_Vector Vec;

  *ier = 0;

  if (!strncmp(key_name,"ID_VEC",6)) {
    Vec = NULL;
    Vec = N_VCloneEmpty(F2C_IDA_vec);
    if (Vec == NULL) {
      *ier = -1;
      return;
    }
    N_VSetArrayPointer(vval, Vec);
    IDASetId(IDA_idamem, Vec);
    N_VDestroy(Vec);
  } else if (!strncmp(key_name,"CONSTR_VEC",10)) {
    Vec = NULL;
    Vec = N_VCloneEmpty(F2C_IDA_vec);
    if (Vec == NULL) {
      *ier = -1;
      return;
    }
    N_VSetArrayPointer(vval, Vec);
    IDASetConstraints(IDA_idamem, Vec);
    N_VDestroy(Vec);
  } else {
    *ier = -99;
    printf("FIDASETVIN: Unrecognized key.\n\n");
  }

}
开发者ID:ladlung,项目名称:CERENA,代码行数:32,代码来源:fida.c

示例4: CVAallocVectors

static booleantype CVAallocVectors(CVadjMem ca_mem)
{

  CVodeMem cv_mem;

  cv_mem = ca_mem->cv_mem;

  Y0 = N_VClone(tempv);
  if (Y0 == NULL) {
    return(FALSE);
  }

  Y1 = N_VClone(tempv);
  if (Y1 == NULL) {
    N_VDestroy(Y0);
    return(FALSE);
  }

  ytmp = N_VClone(tempv);
  if (ytmp == NULL) {
    N_VDestroy(Y0);
    N_VDestroy(Y1);
    return(FALSE);
  }

  return(TRUE);

}
开发者ID:igemsoftware,项目名称:USTC-Software_2011,代码行数:28,代码来源:cvodea.c

示例5: PcgMalloc

/*---------------------------------------------------------------
 Function : PcgMalloc
 --------------------------------------------------------------*/
PcgMem PcgMalloc(int l_max, N_Vector vec_tmpl)
{
  PcgMem mem;
  N_Vector r, p, z, Ap;

  /* Check the input parameters */
  if (l_max <= 0) return(NULL);

  /* Create temporary arrays */
  r = N_VClone(vec_tmpl);
  if (r == NULL) {
    return(NULL);
  }

  p = N_VClone(vec_tmpl);
  if (p == NULL) {
    N_VDestroy(r);
    return(NULL);
  }

  z = N_VClone(vec_tmpl);
  if (z == NULL) {
    N_VDestroy(r);
    N_VDestroy(p);
    return(NULL);
  }

  Ap = N_VClone(vec_tmpl);
  if (Ap == NULL) {
    N_VDestroy(r);
    N_VDestroy(p);
    N_VDestroy(z);
    return(NULL);
  }

  /* Get memory for an PcgMemRec containing PCG vectors */
  mem = NULL;
  mem = (PcgMem) malloc(sizeof(PcgMemRec));
  if (mem == NULL) {
    N_VDestroy(r);
    N_VDestroy(p);
    N_VDestroy(z);
    N_VDestroy(Ap);
    return(NULL);
  }

  /* Set the structure fields */
  mem->l_max = l_max;
  mem->r     = r;
  mem->p     = p;
  mem->z     = z;
  mem->Ap    = Ap;

  /* Return the pointer to PCG memory */
  return(mem);
}
开发者ID:MaveriQ,项目名称:AMICI,代码行数:59,代码来源:sundials_pcg.c

示例6: PcgFree

/*---------------------------------------------------------------
 Function : PcgFree
 --------------------------------------------------------------*/
void PcgFree(PcgMem mem)
{
  if (mem == NULL) return;

  N_VDestroy(mem->r);
  N_VDestroy(mem->p);
  N_VDestroy(mem->z);
  N_VDestroy(mem->Ap);

  free(mem); mem = NULL;
}
开发者ID:MaveriQ,项目名称:AMICI,代码行数:14,代码来源:sundials_pcg.c

示例7: CVSpgmrFree

static void CVSpgmrFree(CVodeMem cv_mem)
{
  CVSpgmrMem cvspgmr_mem;

  cvspgmr_mem = (CVSpgmrMem) lmem;
  
  N_VDestroy(ytemp);
  N_VDestroy(x);
  SpgmrFree(spgmr_mem);
  free(cvspgmr_mem);
}
开发者ID:igemsoftware,项目名称:USTC-Software_2011,代码行数:11,代码来源:cvspgmr.c

示例8: CVDiagFree

static void CVDiagFree(CVodeMem cv_mem)
{
  CVDiagMem cvdiag_mem;
  
  cvdiag_mem = (CVDiagMem) lmem;

  N_VDestroy(M);
  N_VDestroy(bit);
  N_VDestroy(bitcomp);
  free(cvdiag_mem); cvdiag_mem = NULL;
}
开发者ID:AidanRocke,项目名称:CelegansNeuromechanicalGaitModulation,代码行数:11,代码来源:cvode_diag.c

示例9: CVAhermiteFree

static void CVAhermiteFree(DtpntMem *dt_mem, long int steps)
{
  long int i;
  HermiteDataMem content;

  for (i=0; i<=steps; i++) {
    content = (HermiteDataMem) (dt_mem[i]->content);
    N_VDestroy(content->y);
    N_VDestroy(content->yd);
    free(dt_mem[i]->content);
    free(dt_mem[i]);
  }
}
开发者ID:igemsoftware,项目名称:USTC-Software_2011,代码行数:13,代码来源:cvodea.c

示例10: FreeUserData

static void FreeUserData(WebData wdata)
{
  int i, ngrp;

  ngrp = wdata->ngrp;
  for(i=0; i < ngrp; i++) {
    destroyMat((wdata->P)[i]);
    destroyArray((wdata->pivot)[i]);
  }
  N_VDestroy(wdata->rewt);
  N_VDestroy(wdata->vtemp);
  free(wdata);
}
开发者ID:polymec,项目名称:polymec-dev,代码行数:13,代码来源:cvsFoodWeb_ASAi_kry.c

示例11: CVDiagFree

static int CVDiagFree(CVodeMem cv_mem)
{
  CVDiagMem cvdiag_mem;
  
  cvdiag_mem = (CVDiagMem) lmem;

  N_VDestroy(M);
  N_VDestroy(bit);
  N_VDestroy(bitcomp);
  free(cvdiag_mem);
  cv_mem->cv_lmem = NULL;
  
  return(0);
}
开发者ID:stan-dev,项目名称:math,代码行数:14,代码来源:cvodes_diag.c

示例12: CVSpbcgFree

static void CVSpbcgFree(CVodeMem cv_mem)
{
  CVSpilsMem cvspils_mem;
  SpbcgMem spbcg_mem;

  cvspils_mem = (CVSpilsMem) lmem;

  spbcg_mem = (SpbcgMem) spils_mem;

  N_VDestroy(ytemp);
  N_VDestroy(x);
  SpbcgFree(spbcg_mem);
  free(cvspils_mem); cvspils_mem = NULL;
}
开发者ID:DachengXiao,项目名称:MM-PIHM-EnKF,代码行数:14,代码来源:cvodes_spbcgs.c

示例13: cpSpbcgFree

static void cpSpbcgFree(CPodeMem cp_mem)
{
  CPSpilsMem cpspils_mem;
  SpbcgMem spbcg_mem;

  cpspils_mem = (CPSpilsMem) lmem;

  spbcg_mem = (SpbcgMem) spils_mem;

  SpbcgFree(spbcg_mem);
  N_VDestroy(x);
  N_VDestroy(ytemp);
  if (ode_type == CP_EXPL) N_VDestroy(yptemp);
  free(cpspils_mem); cpspils_mem = NULL;
}
开发者ID:AyMaN-GhOsT,项目名称:simbody,代码行数:15,代码来源:cpodes_spbcgs.c

示例14: IDASpgmrFree

static int IDASpgmrFree(IDAMem IDA_mem)
{
  IDASpilsMem idaspils_mem;
  SpgmrMem spgmr_mem;

  idaspils_mem = (IDASpilsMem) lmem;
  
  spgmr_mem = (SpgmrMem) spils_mem;

  N_VDestroy(ytemp);
  N_VDestroy(xx);
  SpgmrFree(spgmr_mem);
  free(lmem); lmem = NULL;

  return(0);
}
开发者ID:AidanRocke,项目名称:CelegansNeuromechanicalGaitModulation,代码行数:16,代码来源:ida_spgmr.c

示例15: cvDlsFree

/*-----------------------------------------------------------------
  cvDlsFree
  -----------------------------------------------------------------
  This routine frees memory associates with the CVDls solver 
  interface.
  -----------------------------------------------------------------*/
int cvDlsFree(CVodeMem cv_mem)
{
  CVDlsMem cvdls_mem;

  /* Return immediately if cv_mem or cv_mem->cv_lmem are NULL */
  if (cv_mem == NULL)  return (CVDLS_SUCCESS);
  if (cv_mem->cv_lmem == NULL)  return(CVDLS_SUCCESS);
  cvdls_mem = (CVDlsMem) cv_mem->cv_lmem;

  /* Free x vector */
  if (cvdls_mem->x) {
    N_VDestroy(cvdls_mem->x);
    cvdls_mem->x = NULL;
  }

  /* Free savedJ memory */
  if (cvdls_mem->savedJ) {
    SUNMatDestroy(cvdls_mem->savedJ);
    cvdls_mem->savedJ = NULL;
  }

  /* Nullify other SUNMatrix pointer */
  cvdls_mem->A = NULL;

  /* free CVDls interface structure */
  free(cv_mem->cv_lmem);
  
  return(CVDLS_SUCCESS);
}
开发者ID:sn248,项目名称:Rcppsbmod,代码行数:35,代码来源:cvode_direct.c


注:本文中的N_VDestroy函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。