Go to the documentation of this file.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
00033 #ifndef ACADO_TOOLKIT_GRID_HPP
00034 #define ACADO_TOOLKIT_GRID_HPP
00035
00036
00037 #include <acado/utils/acado_utils.hpp>
00038 #include <acado/matrix_vector/matrix_vector.hpp>
00039
00040
00041 BEGIN_NAMESPACE_ACADO
00042
00043
00044
00058 class Grid
00059 {
00060
00061
00062
00063 public:
00064
00066 Grid( );
00067
00075 Grid( uint nPoints_,
00076 double* times_ = 0
00077 );
00078
00084 Grid( const DVector& times_
00085 );
00086
00095 Grid( double _firstTime,
00096 double _lastTime,
00097 uint _nPoints = 2
00098 );
00099
00104 Grid( const Grid& rhs
00105 );
00106
00109 ~Grid( );
00110
00115 Grid& operator=( const Grid& rhs
00116 );
00117
00118
00127 returnValue init( uint _nPoints = 0,
00128 const double* const _times = 0
00129 );
00130
00138 returnValue init( const DVector& times_
00139 );
00140
00151 returnValue init( double _firstTime,
00152 double _lastTime,
00153 uint _nPoints = 2
00154 );
00155
00165 returnValue init( const Grid& rhs
00166 );
00167
00168
00177 inline BooleanType operator==( const Grid& arg
00178 ) const;
00179
00188 inline BooleanType operator!=( const Grid& arg
00189 ) const;
00190
00200 inline BooleanType operator<( const Grid& arg
00201 ) const;
00202
00211 inline BooleanType operator<=( const Grid& arg
00212 ) const;
00213
00223 inline BooleanType operator>( const Grid& arg
00224 ) const;
00225
00234 inline BooleanType operator>=( const Grid& arg
00235 ) const;
00236
00237
00244 Grid& operator&( const Grid& arg
00245 );
00246
00247
00256 returnValue equalizeGrids( Grid& arg
00257 );
00258
00259
00268 returnValue setTime( double _time
00269 );
00270
00279 returnValue setTime( uint pointIdx,
00280 double _time
00281 );
00282
00290 returnValue addTime( double _time
00291 );
00292
00293
00307 returnValue merge( const Grid& arg,
00308 MergeMethod _mergeMethod = MM_DUPLICATE,
00309 BooleanType keepOverlap = BT_TRUE
00310 );
00311
00312
00318 inline BooleanType isEmpty( ) const;
00319
00324 inline uint getNumPoints( ) const;
00325
00330 inline uint getNumIntervals( ) const;
00331
00332
00337 inline double getFirstTime( ) const;
00338
00343 inline double getLastTime( ) const;
00344
00351 inline double getTime( uint pointIdx
00352 ) const;
00353
00354
00361 Grid& shiftTimes( double timeShift
00362 );
00363
00364
00370 inline BooleanType isEquidistant( ) const;
00371
00376 inline double getIntervalLength( ) const;
00377
00384 inline double getIntervalLength( uint pointIdx
00385 ) const;
00386
00394 returnValue scaleTimes( double scaling
00395 );
00396
00397
00406 returnValue refineGrid( uint factor
00407 );
00408
00417 returnValue coarsenGrid( uint factor
00418 );
00419
00420
00428 BooleanType hasTime( double _time
00429 ) const;
00430
00431
00441 int findTime( double _time,
00442 uint startIdx = 0
00443 ) const;
00444
00454 int findFirstTime( double _time,
00455 uint startIdx = 0
00456 ) const;
00457
00467 int findLastTime( double _time,
00468 uint startIdx = 0
00469 ) const;
00470
00471
00479 uint getFloorIndex( double time
00480 ) const;
00481
00489 uint getCeilIndex ( double time
00490 ) const;
00491
00492
00497 inline uint getLastIndex ( ) const;
00498
00499
00507 inline BooleanType isLast( uint pointIdx
00508 ) const;
00509
00510
00518 inline BooleanType isInInterval( double _time
00519 ) const;
00520
00530 inline BooleanType isInInterval( uint pointIdx,
00531 double _time
00532 ) const;
00533
00543 inline BooleanType isInUpperHalfOpenInterval( uint pointIdx,
00544 double _time
00545 ) const;
00546
00556 inline BooleanType isInLowerHalfOpenInterval( uint pointIdx,
00557 double _time
00558 ) const;
00559
00560
00571 returnValue getSubGrid( double tStart,
00572 double tEnd,
00573 Grid& _subGrid
00574 ) const;
00575
00576
00581 returnValue print( ) const;
00582
00583
00584
00585
00586
00587
00588 protected:
00589
00596 returnValue setupEquidistant( double _firstTime,
00597 double _lastTime
00598 );
00599
00605 int findNextIndex( ) const;
00606
00607
00608
00609
00610
00611 protected:
00612
00613 uint nPoints;
00614 double* times;
00615 };
00616
00617
00618 CLOSE_NAMESPACE_ACADO
00619
00620 #include <acado/variables_grid/grid.ipp>
00621
00622 #endif // ACADO_TOOLKIT_GRID_HPP
00623
00624
00625
00626