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


C++ N_VDestroy_Serial函数代码示例

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


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

示例1: N_VDestroy_Serial

	OpenSMOKE_CVODE_Sundials<T>::~OpenSMOKE_CVODE_Sundials(void)
	{
		/* Free vectors */
		N_VDestroy_Serial(y0Sundials_);
		N_VDestroy_Serial(ySundials_);

		/* Free integrator memory */
		CVodeFree(&cvode_mem_);
		SUNLinSolFree(LS);
		SUNMatDestroy(A);

		delete[] this->y0_;
		delete[] this->y_;
	}
开发者ID:acuoci,项目名称:laminarSMOKE,代码行数:14,代码来源:OpenSMOKE_CVODE_Sundials.hpp

示例2: CVodeSensFree

CVodesIntegrator::~CVodesIntegrator()
{
    if (m_cvode_mem) {
        if (m_np > 0) {
            CVodeSensFree(m_cvode_mem);
        }
        CVodeFree(&m_cvode_mem);
    }
    if (m_y) {
        N_VDestroy_Serial(m_y);
    }
    if (m_abstol) {
        N_VDestroy_Serial(m_abstol);
    }
}
开发者ID:thomasfiala,项目名称:cantera,代码行数:15,代码来源:CVodesIntegrator.cpp

示例3: N_VNew_Serial

void CVodesIntegrator::sensInit(double t0, FuncEval& func)
{
    m_np = func.nparams();
    m_sens_ok = false;

    N_Vector y = N_VNew_Serial(static_cast<sd_size_t>(func.neq()));
    m_yS = N_VCloneVectorArray_Serial(static_cast<sd_size_t>(m_np), y);
    for (size_t n = 0; n < m_np; n++) {
        N_VConst(0.0, m_yS[n]);
    }
    N_VDestroy_Serial(y);

    int flag = CVodeSensInit(m_cvode_mem, static_cast<sd_size_t>(m_np),
                             CV_STAGGERED, CVSensRhsFn(0), m_yS);

    if (flag != CV_SUCCESS) {
        throw CanteraError("CVodesIntegrator::sensInit", "Error in CVodeSensInit");
    }
    vector_fp atol(m_np);
    for (size_t n = 0; n < m_np; n++) {
        // This scaling factor is tuned so that reaction and species enthalpy
        // sensitivities can be computed simultaneously with the same abstol.
        atol[n] = m_abstolsens / func.m_paramScales[n];
    }
    flag = CVodeSensSStolerances(m_cvode_mem, m_reltolsens, atol.data());
}
开发者ID:Niemeyer-Research-Group,项目名称:cantera,代码行数:26,代码来源:CVodesIntegrator.cpp

示例4: IntegratorInstance_freeIDASpecSolverStructures

/* frees only sensitivity structure, not used at the moment  */
static void
IntegratorInstance_freeIDASpecSolverStructures(integratorInstance_t *engine)
{
  /* Free sensitivity vector yS */
  N_VDestroy_Serial(engine->solver->dy);
  engine->solver->dy = NULL;
}
开发者ID:raim,项目名称:SBML_odeSolver,代码行数:8,代码来源:daeSolver.c

示例5: cvode_free

int cvode_free(solver_props *props){
  unsigned int modelid;
  /* // Debug code
  long int count;
  for(modelid=0; modelid<mem[0].props->num_models; modelid++){
    PRINTF( "Model number: %d\n", modelid);
    if (CVodeGetNumSteps(mem->cvmem, &count) == CV_SUCCESS)
      PRINTF( "  Total Number of steps: %ld\n", count);
    if (CVodeGetNumRhsEvals(mem->cvmem, &count) == CV_SUCCESS)
      PRINTF( "  RHS Evals: %ld\n", count);
    if (CVodeGetNumErrTestFails(mem->cvmem, &count) == CV_SUCCESS)
      PRINTF( "  Num of step errors: %ld\n", count);
  }
  */

  // Cleanup
  cvode_mem *mem = props->mem;
  for(modelid = 0; modelid<props->num_models; modelid++){
    N_VDestroy_Serial(((N_Vector)(mem[modelid].y0)));
    CVodeFree(&(mem[modelid].cvmem));
  }
  free(mem);

  return 0;
}
开发者ID:joshuaecook,项目名称:simengine,代码行数:25,代码来源:cvode.c

示例6: N_VDestroy_Serial

IdaSolver::~IdaSolver()
{
    if (!mSolver)
        // The solver hasn't been initialised, so...

        return;

    // Delete some internal objects

    N_VDestroy_Serial(mStatesVector);
    N_VDestroy_Serial(mRatesVector);

    IDAFree(&mSolver);

    delete mUserData;
}
开发者ID:nickerso,项目名称:original-opencor,代码行数:16,代码来源:idasolver.cpp

示例7: N_VClone_Serial

N_Vector N_VClone_Serial(N_Vector w)
{
  N_Vector v;
  realtype *data;
  long int length;

  v = NULL;
  v = N_VCloneEmpty_Serial(w);
  if (v == NULL) return(NULL);

  length = NV_LENGTH_S(w);

  /* Create data */
  if (length > 0) {

    /* Allocate memory */
    data = NULL;
    data = (realtype *) malloc(length * sizeof(realtype));
    if(data == NULL) { N_VDestroy_Serial(v); return(NULL); }

    /* Attach data */
    NV_OWN_DATA_S(v) = TRUE;
    NV_DATA_S(v)     = data;

  }

  return(v);
}
开发者ID:A1kmm,项目名称:modml-solver,代码行数:28,代码来源:nvector_serial.c

示例8: Problem2

static void Problem2(void)
{
  void *fct;
  void *cpode_mem;
  N_Vector y, yp;
  realtype reltol=RTOL, abstol=ATOL, t, tout, erm, hu;
  int flag, iout, qu;

  y = NULL;
  yp = NULL;
  cpode_mem = NULL;

  y = N_VNew_Serial(P2_NEQ);
  N_VConst(ZERO, y);
  NV_Ith_S(y,0) = ONE;

  yp = N_VNew_Serial(P2_NEQ);

  if (ODE == CP_EXPL) {
    fct = (void *)f2;
  } else {
    fct = (void *)res2;
    f2(P2_T0, y, yp, NULL);
  }

  cpode_mem = CPodeCreate(ODE, CP_ADAMS, CP_FUNCTIONAL);
  /*  flag = CPodeSetInitStep(cpode_mem, 2.0e-9);*/
  flag = CPodeInit(cpode_mem, fct, NULL, P2_T0, y, yp, CP_SS, reltol, &abstol);

  printf("\n      t        max.err      qu     hu \n");
  for(iout=1, tout=P2_T1; iout <= P2_NOUT; iout++, tout*=P2_TOUT_MULT) {
    flag = CPode(cpode_mem, tout, &t, y, yp, CP_NORMAL);
    if (flag != CP_SUCCESS) break;
    erm = MaxError(y, t);
    flag = CPodeGetLastOrder(cpode_mem, &qu);
    flag = CPodeGetLastStep(cpode_mem, &hu);
    printf("%10.3f  %12.4le   %2d   %12.4le\n", t, erm, qu, hu);
  }

  PrintFinalStats(cpode_mem);

  CPodeFree(&cpode_mem);
  N_VDestroy_Serial(y);
  N_VDestroy_Serial(yp);

  return;
}
开发者ID:thomasklau,项目名称:simbody,代码行数:47,代码来源:cpsadamsx.c

示例9: main

int main()
{
  void *fct;
  void *cpode_mem;
  N_Vector y, yp;
  realtype reltol=RTOL, abstol=ATOL, t, tout, hu;
  int flag, iout, qu;

  y = NULL;
  yp = NULL;
  cpode_mem = NULL;

  y = N_VNew_Serial(P1_NEQ);
  NV_Ith_S(y,0) = TWO;
  NV_Ith_S(y,1) = ZERO;

  yp = N_VNew_Serial(P1_NEQ);
  
  if (ODE == CP_EXPL) {
    fct = (void *)f;
  } else {
    fct = (void *)res;
    f(P1_T0, y, yp, NULL);
  }

  cpode_mem = CPodeCreate(ODE, CP_ADAMS, CP_FUNCTIONAL);
  /*  flag = CPodeSetInitStep(cpode_mem, 4.0e-9);*/
  flag = CPodeInit(cpode_mem, fct, NULL, P1_T0, y, yp, CP_SS, reltol, &abstol);

  printf("\n     t           x              xdot         qu     hu \n");
  for(iout=1, tout=P1_T1; iout <= P1_NOUT; iout++, tout += P1_DTOUT) {
    flag = CPode(cpode_mem, tout, &t, y, yp, CP_NORMAL);
    if (flag != CP_SUCCESS)  break;
    flag = CPodeGetLastOrder(cpode_mem, &qu);
    flag = CPodeGetLastStep(cpode_mem, &hu);    
    printf("%10.5f    %12.5le   %12.5le   %2d    %6.4le\n", t, NV_Ith_S(y,0), NV_Ith_S(y,1), qu, hu);
  }
  
  PrintFinalStats(cpode_mem);

  CPodeFree(&cpode_mem);
  N_VDestroy_Serial(y);
  N_VDestroy_Serial(yp);

  return 0;
}
开发者ID:AyMaN-GhOsT,项目名称:simbody,代码行数:46,代码来源:cpsVanDPol_non.c

示例10: N_VDestroy_Serial

void ViCaRS::cleanup(void) {
	unsigned int		i;
	
	// Free y and abstol vectors
	N_VDestroy_Serial(_vars);

	for (i=0;i<_solvers.size();++i) delete _solvers[i];
}
开发者ID:eheien,项目名称:vicars,代码行数:8,代码来源:RateState.cpp

示例11: N_VDestroyVectorArray_Serial

void N_VDestroyVectorArray_Serial(N_Vector *vs, int count)
{
  int j;

  for (j = 0; j < count; j++) N_VDestroy_Serial(vs[j]);

  free(vs);
}
开发者ID:bhache,项目名称:pkg-neuron,代码行数:8,代码来源:nvector_serial.c

示例12: CVodeSensFree

CVodesIntegrator::~CVodesIntegrator()
{
    if (m_cvode_mem) {
        if (m_np > 0) {
            CVodeSensFree(m_cvode_mem);
        }
        CVodeFree(&m_cvode_mem);
    }
    if (m_y) {
        N_VDestroy_Serial(m_y);
    }
    if (m_abstol) {
        N_VDestroy_Serial(m_abstol);
    }
    if (m_yS) {
        N_VDestroyVectorArray_Serial(m_yS, static_cast<sd_size_t>(m_np));
    }
}
开发者ID:Niemeyer-Research-Group,项目名称:cantera,代码行数:18,代码来源:CVodesIntegrator.cpp

示例13: ode_solver_free

void ode_solver_free(ode_solver* solver){
  free(solver->params);
  CVodeFree(&(solver->cvode_mem));
  if (solver->yS != 0) {
    N_VDestroyVectorArray_Serial(solver->yS, solver->odeModel->P);
  }
  N_VDestroy_Serial(solver->y);
  free(solver);
}
开发者ID:BioinformaticsArchive,项目名称:mcmc_clib,代码行数:9,代码来源:ode_model.c

示例14: N_VDestroy_Serial

Ida::~Ida()
{
  if (_z)
    delete[] _z;
  if (_zInit)
    delete[] _zInit;
  if (_zeroSign)
    delete[] _zeroSign;
  if (_absTol)
    delete[] _absTol;
  if (_zWrite)
      delete[] _zWrite;
  if (_ida_initialized)
  {
    N_VDestroy_Serial(_CV_y0);
    N_VDestroy_Serial(_CV_y);
    N_VDestroy_Serial(_CV_yp);
    N_VDestroy_Serial(_CV_yWrite);
    N_VDestroy_Serial(_CV_absTol);
    IDAFree(&_idaMem);
  }

  if (_colorOfColumn)
    delete [] _colorOfColumn;
  if(_delta)
    delete [] _delta;
  if(_deltaInv)
    delete [] _deltaInv;
  if(_ysave)
    delete [] _ysave;

  #ifdef RUNTIME_PROFILING
  if(measuredFunctionStartValues)
    delete measuredFunctionStartValues;
  if(measuredFunctionEndValues)
    delete measuredFunctionEndValues;
  if(solveFunctionStartValues)
    delete solveFunctionStartValues;
  if(solveFunctionEndValues)
    delete solveFunctionEndValues;
  if(solverValues)
    delete solverValues;
  #endif
}
开发者ID:AntonDV235,项目名称:OMCompiler,代码行数:44,代码来源:IDA.cpp

示例15: 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_Serial(wdata->rewt);
    free(wdata);
}
开发者ID:aragilar,项目名称:debian-packaging-sundials,代码行数:12,代码来源:cvsKrylovDemo_prec.c


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