grid.hpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
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     // PUBLIC MEMBER FUNCTIONS:
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     // PROTECTED MEMBER FUNCTIONS:
00587     //
00588     protected:
00589 
00596                 returnValue setupEquidistant(   double _firstTime,
00597                                                                                 double _lastTime
00598                                                                                 );
00599 
00605                 int findNextIndex( ) const;
00606 
00607 
00608     //
00609     // DATA MEMBERS:
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  *      end of file
00626  */


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:37:16