00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035 #ifndef ACADO_TOOLKIT_DIRK_EXPORT_HPP
00036 #define ACADO_TOOLKIT_DIRK_EXPORT_HPP
00037
00038 #include <acado/code_generation/integrators/irk_export.hpp>
00039
00040
00041 BEGIN_NAMESPACE_ACADO
00042
00043
00054 class DiagonallyImplicitRKExport : public ForwardIRKExport
00055 {
00056
00057
00058
00059
00060 public:
00061
00067 DiagonallyImplicitRKExport( UserInteraction* _userInteraction = 0,
00068 const std::string& _commonHeaderName = ""
00069 );
00070
00075 DiagonallyImplicitRKExport( const DiagonallyImplicitRKExport& arg
00076 );
00077
00080 virtual ~DiagonallyImplicitRKExport( );
00081
00082
00087 DiagonallyImplicitRKExport& operator=( const DiagonallyImplicitRKExport& arg
00088 );
00089
00090
00100 virtual returnValue solveInputSystem( ExportStatementBlock* block,
00101 const ExportIndex& index1,
00102 const ExportIndex& index2,
00103 const ExportIndex& index3,
00104 const ExportIndex& tmp_index,
00105 const ExportVariable& Ah );
00106
00107
00114 virtual returnValue prepareInputSystem( ExportStatementBlock& code );
00115
00116
00125 virtual returnValue solveOutputSystem( ExportStatementBlock* block,
00126 const ExportIndex& index1,
00127 const ExportIndex& index2,
00128 const ExportIndex& index3,
00129 const ExportIndex& tmp_index,
00130 const ExportVariable& Ah,
00131 bool DERIVATIVES = false );
00132
00133
00144 virtual returnValue sensitivitiesOutputSystem( ExportStatementBlock* block,
00145 const ExportIndex& index1,
00146 const ExportIndex& index2,
00147 const ExportIndex& index3,
00148 const ExportIndex& index4,
00149 const ExportIndex& tmp_index1,
00150 const ExportIndex& tmp_index2,
00151 const ExportVariable& Ah,
00152 const ExportVariable& Bh,
00153 bool STATES,
00154 uint number );
00155
00156
00163 virtual returnValue prepareOutputSystem( ExportStatementBlock& code );
00164
00165
00173 virtual DMatrix formMatrix( const DMatrix& mass, const DMatrix& jacobian );
00174
00175
00184 virtual returnValue solveImplicitSystem( ExportStatementBlock* block,
00185 const ExportIndex& index1,
00186 const ExportIndex& index2,
00187 const ExportIndex& index3,
00188 const ExportIndex& tmp_index,
00189 const ExportVariable& Ah,
00190 const ExportVariable& C,
00191 const ExportVariable& det,
00192 bool DERIVATIVES = false );
00193
00194
00206 virtual returnValue sensitivitiesImplicitSystem( ExportStatementBlock* block,
00207 const ExportIndex& index1,
00208 const ExportIndex& index2,
00209 const ExportIndex& index3,
00210 const ExportIndex& tmp_index1,
00211 const ExportIndex& tmp_index2,
00212 const ExportVariable& Ah,
00213 const ExportVariable& Bh,
00214 const ExportVariable& det,
00215 bool STATES,
00216 uint number );
00217
00218
00230 virtual returnValue evaluateMatrix( ExportStatementBlock* block,
00231 const ExportIndex& index1,
00232 const ExportIndex& index2,
00233 const ExportIndex& tmp_index,
00234 const ExportVariable& Ah,
00235 const ExportVariable& C,
00236 bool evaluateB,
00237 bool DERIVATIVES );
00238
00239
00248 virtual returnValue evaluateStatesImplicitSystem( ExportStatementBlock* block,
00249 const ExportVariable& Ah,
00250 const ExportVariable& C,
00251 const ExportIndex& stage,
00252 const ExportIndex& i,
00253 const ExportIndex& j );
00254
00255
00263 virtual returnValue evaluateRhsImplicitSystem( ExportStatementBlock* block,
00264 const ExportIndex& stage );
00265
00266
00271 virtual returnValue setup( );
00272
00273
00274 protected:
00275
00276
00277
00278 protected:
00279
00280
00281 };
00282
00283
00284
00285
00286
00287 inline DiagonallyImplicitRKExport* createDiagonallyImplicitRKExport( UserInteraction* _userInteraction,
00288 const std::string &_commonHeaderName )
00289 {
00290 int sensGen;
00291 _userInteraction->get( DYNAMIC_SENSITIVITY, sensGen );
00292 if ( (ExportSensitivityType)sensGen == FORWARD ) {
00293 return new DiagonallyImplicitRKExport(_userInteraction, _commonHeaderName);
00294 }
00295 else {
00296 ACADOERROR( RET_INVALID_OPTION );
00297 return new DiagonallyImplicitRKExport(_userInteraction, _commonHeaderName);
00298 }
00299 }
00300
00301
00302 CLOSE_NAMESPACE_ACADO
00303
00304
00305 #endif // ACADO_TOOLKIT_DIRK_EXPORT_HPP
00306
00307