コード例 #1
0
ファイル: radau5_interface.c プロジェクト: bcmd/BCMD
/* Invocation */
int radau5_solve ( double startx, double endx, double* starty,
                   RadauRHS rhs, RadauOut out )
{
    int ii;
    
    int N = (int) N_VARS;
    
    /* initialise */
    x = startx;
    xend = endx;
    
    /* client can pass a NULL y if initialising elsewhere (or
       indeed if happy with all ys starting at 0 */
    if ( starty )
    {
        for ( ii = 0; ii < N_VARS; ++ii )
            y[ii] = starty[ii];
    }
    
    /* we may need to clear out some leftovers from a previous run
       (the bounds on these loops have been identified empirically) */
    for ( ii = 7; ii < 20; ++ii )
        work[ii] = 0;
    
    for ( ii = 6; ii < 20; ++ii )
        iwork[ii] = 0;
    
    if ( ! rhs )
        rhs = dummy_RHS;
    
    if ( ! out )
        out = dummy_out;
    
#ifdef RADAU_DEBUG
    printf("\n*** RADUA5_SOLVE ***\n");
    dump_all();
    printf("\n");
#endif

#ifdef RADAU_SUPER_DEBUG
    super_dump_all( startx, endx );
#endif
    
    RADAU5 ( &N, rhs, &x, y, &xend, &h, rtol, atoler, &itol,
             dummy_jac, &ijac, &mljac, &mujac,
             DIAGONAL ? diag_mass : full_mass, &imas, &mlmas, &mumas,
             out, &iout, work, &lwork, iwork, &liwork,
             rpar, ipar, &idid );
    
    return idid;
}
コード例 #2
0
ファイル: OpenSMOKE_RADAU.hpp プロジェクト: acuoci/edcSMOKE
	void OpenSMOKE_RADAU<T>::Solve(const double xend)
	{
		AnalyzeUserOptions();

		this->x_ = this->x0_;
		this->xend_ = xend;
		memcpy(this->y_, this->y0_, this->n_*sizeof(double));
	
		this->tStart_ =  this->GetClockTime();

		#if defined(_WIN32) || defined(_WIN64) 
			if (iSolver_ == solver_radau5)
			RADAU5(	&this->n_, this->odeSystem_->GetSystemFunctionsStatic, &this->x_, this->y_, &this->xend_, 
					&this->firstStep_, &this->relTolerance_[0], &this->absTolerance_[0],&this->iTolerance_,
					this->odeSystem_->GetAnalyticalJacobianStatic, &this->iJacobian_, &this->mLower_, &this->mUpper_,
					ptMassMatrix_, &imas_, &mlmas_, &mumas_,
					this->odeSystem_->GetWriteFunctionStatic, &this->iOutput_,
					rwork_, &lwork_, iwork_, &liwork_, rpar_, ipar_, &idid_);

			else if (iSolver_ == solver_radau)
			RADAU(	&this->n_, this->odeSystem_->GetSystemFunctionsStatic, &this->x_, this->y_, &this->xend_, 
					&this->firstStep_, &this->relTolerance_[0], &this->absTolerance_[0],&this->iTolerance_,
					this->odeSystem_->GetAnalyticalJacobianStatic, &this->iJacobian_, &this->mLower_, &this->mUpper_,
					ptMassMatrix_, &imas_, &mlmas_, &mumas_,
					this->odeSystem_->GetWriteFunctionStatic, &this->iOutput_,
					rwork_, &lwork_, iwork_, &liwork_, rpar_, ipar_, &idid_);
		#else
			if (iSolver_ == solver_radau5)
			radau5_(	&this->n_, this->odeSystem_->GetSystemFunctionsStatic, &this->x_, this->y_, &this->xend_, 
					&this->firstStep_, &this->relTolerance_[0], &this->absTolerance_[0],&this->iTolerance_,
					this->odeSystem_->GetAnalyticalJacobianStatic, &this->iJacobian_, &this->mLower_, &this->mUpper_,
					ptMassMatrix_, &imas_, &mlmas_, &mumas_,
					this->odeSystem_->GetWriteFunctionStatic, &this->iOutput_,
					rwork_, &lwork_, iwork_, &liwork_, rpar_, ipar_, &idid_);

			else if (iSolver_ == solver_radau)
			radau_(	&this->n_, this->odeSystem_->GetSystemFunctionsStatic, &this->x_, this->y_, &this->xend_, 
					&this->firstStep_, &this->relTolerance_[0], &this->absTolerance_[0],&this->iTolerance_,
					this->odeSystem_->GetAnalyticalJacobianStatic, &this->iJacobian_, &this->mLower_, &this->mUpper_,
					ptMassMatrix_, &imas_, &mlmas_, &mumas_,
					this->odeSystem_->GetWriteFunctionStatic, &this->iOutput_,
					rwork_, &lwork_, iwork_, &liwork_, rpar_, ipar_, &idid_);
		#endif

		this->tEnd_ =  this->GetClockTime();

		this->x0_ = this->x_;
		memcpy(this->y0_, this->y_, this->n_*sizeof(double));

	}