void FIDA_GETDKY(realtype *t, int *k, realtype *dky, int *ier) { /* Attach user data to vectors */ N_VSetArrayPointer(dky, F2C_IDA_vec); *ier = 0; *ier = IDAGetDky(IDA_idamem, *t, *k, F2C_IDA_vec); /* Reset data pointers */ N_VSetArrayPointer(NULL, F2C_IDA_vec); return; }
void FIDA_GETDKY(realtype *t, int *k, realtype *dky, int *ier) { /* Store existing F2C_IDA_vec data pointer */ realtype *f2c_data = N_VGetArrayPointer(F2C_IDA_vec); /* Attach user data to vectors */ N_VSetArrayPointer(dky, F2C_IDA_vec); *ier = 0; *ier = IDAGetDky(IDA_idamem, *t, *k, F2C_IDA_vec); /* Reset data pointers */ N_VSetArrayPointer(f2c_data, F2C_IDA_vec); return; }
void Ida::writeIDAOutput(const double &time, const double &h, const int &stp) { #ifdef RUNTIME_PROFILING MEASURETIME_REGION_DEFINE(idaWriteOutputHandler, "IDAWriteOutput"); if(MeasureTime::getInstance() != NULL) { MEASURETIME_START(measuredFunctionStartValues, idaWriteOutputHandler, "IDAWriteOutput"); } #endif if (stp > 0) { if (_idasettings->getDenseOutput()) { _bWritten = false; double *oldValues = NULL; //We have to find all output-points within the last solver step while (_tLastWrite + dynamic_cast<ISolverSettings*>(_idasettings)->getGlobalSettings()->gethOutput() <= time) { if (!_bWritten) { //Rescue the calculated derivatives oldValues = new double[_continuous_system->getDimRHS()]; _continuous_system->getRHS(oldValues); } _bWritten = true; _tLastWrite = _tLastWrite + dynamic_cast<ISolverSettings*>(_idasettings)->getGlobalSettings()->gethOutput(); //Get the state vars at the output-point (interpolated) _idid = IDAGetDky(_idaMem, _tLastWrite, 0, _CV_yWrite); _time_system->setTime(_tLastWrite); _continuous_system->setContinuousStates(NV_DATA_S(_CV_yWrite)); if(_dimAE>0) { _mixed_system->setAlgebraicDAEVars(NV_DATA_S(_CV_y)+_dimStates); _idid = IDAGetDky(_idaMem, _tLastWrite, 1, _CV_ypWrite); _continuous_system->setStateDerivatives(NV_DATA_S(_CV_ypWrite)); _continuous_system->evaluateDAE(IContinuous::CONTINUOUS); } else { _continuous_system->evaluateAll(IContinuous::CONTINUOUS); } #ifdef RUNTIME_PROFILING if(MeasureTime::getInstance() != NULL) { MEASURETIME_END(measuredFunctionStartValues, measuredFunctionEndValues, (*measureTimeFunctionsArray)[2], idaWriteOutputHandler); } #endif SolverDefaultImplementation::writeToFile(stp, _tLastWrite, h); #ifdef RUNTIME_PROFILING MEASURETIME_REGION_DEFINE(idaWriteOutputHandler, "IDAWriteOutput"); if(MeasureTime::getInstance() != NULL) { (*measureTimeFunctionsArray)[2]->_sumMeasuredValues->_numCalcs--; MEASURETIME_START(measuredFunctionStartValues, idaWriteOutputHandler, "IDAWriteOutput"); } #endif } //end if time -_tLastWritten if (_bWritten) { _time_system->setTime(time); _continuous_system->setContinuousStates(_y); _continuous_system->setStateDerivatives(oldValues); if(_dimAE>0) { _mixed_system->setAlgebraicDAEVars(_y+_dimStates); } delete[] oldValues; } else if (time == _tEnd && _tLastWrite != time) { _idid = IDAGetDky(_idaMem, time, 0, _CV_y); _idid = IDAGetDky(_idaMem, time, 1, _CV_yp); _time_system->setTime(time); _continuous_system->setContinuousStates(NV_DATA_S(_CV_y)); if(_dimAE>0) { _mixed_system->setAlgebraicDAEVars(NV_DATA_S(_CV_y)+_dimStates); _continuous_system->setStateDerivatives(NV_DATA_S(_CV_yp)); _continuous_system->evaluateDAE(IContinuous::CONTINUOUS); } else { _continuous_system->evaluateAll(IContinuous::CONTINUOUS); } #ifdef RUNTIME_PROFILING if(MeasureTime::getInstance() != NULL) { MEASURETIME_END(measuredFunctionStartValues, measuredFunctionEndValues, (*measureTimeFunctionsArray)[2], idaWriteOutputHandler); } #endif SolverDefaultImplementation::writeToFile(stp, _tEnd, h); } } else { #ifdef RUNTIME_PROFILING if(MeasureTime::getInstance() != NULL) { MEASURETIME_END(measuredFunctionStartValues, measuredFunctionEndValues, (*measureTimeFunctionsArray)[2], idaWriteOutputHandler); } #endif SolverDefaultImplementation::writeToFile(stp, time, h); } } }