本文整理汇总了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);
}
}
}
}
示例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);
}
}
示例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");
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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]);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}