export_variable_internal.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 
00027 
00034 #ifndef ACADO_TOOLKIT_EXPORT_VARIABLE_INTERNAL_HPP
00035 #define ACADO_TOOLKIT_EXPORT_VARIABLE_INTERNAL_HPP
00036 
00037 #include <acado/utils/acado_utils.hpp>
00038 #include <acado/code_generation/export_argument_internal.hpp>
00039 #include <acado/code_generation/export_index.hpp>
00040 
00041 
00042 BEGIN_NAMESPACE_ACADO
00043 
00044 
00045 class ExportArithmeticStatement;
00046 
00047 
00063 class ExportVariableInternal : public ExportArgumentInternal
00064 {
00065         //
00066     // PUBLIC MEMBER FUNCTIONS:
00067     //
00068     public:
00069 
00072         ExportVariableInternal( );
00073 
00084                 ExportVariableInternal( const std::string& _name,
00085                                                                 const DMatrixPtr& _data,
00086                                                                 ExportType _type = REAL,
00087                                                                 ExportStruct _dataStruct = ACADO_LOCAL,
00088                                                                 bool _callItByValue = false,
00089                                                                 const std::string& _prefix = std::string()
00090                                                                 );
00091 
00094                 virtual ~ExportVariableInternal( );
00095 
00100                 virtual ExportVariableInternal* clone() const;
00101 
00110                 bool isZero( const ExportIndex& rowIdx,
00111                                                         const ExportIndex& colIdx
00112                                                         ) const;
00113 
00122                 bool isOne(     const ExportIndex& rowIdx,
00123                                                         const ExportIndex& colIdx
00124                                                         ) const;
00125 
00134                 bool isGiven(   const ExportIndex& rowIdx,
00135                                                                 const ExportIndex& colIdx
00136                                                                 ) const;
00137 
00138                 virtual bool isGiven() const;
00139 
00140 
00149                 const std::string get(  const ExportIndex& rowIdx,
00150                                                         const ExportIndex& colIdx
00151                                                         ) const;
00152 
00157                 virtual uint getNumRows( ) const;
00158 
00163                 virtual uint getNumCols( ) const;
00164 
00169                 virtual uint getDim( ) const;
00170 
00175                 ExportVariable getTranspose( ) const;
00176 
00183                 ExportVariable getRow(  const ExportIndex& idx
00184                                                                 ) const;
00185 
00192                 ExportVariable getCol(  const ExportIndex& idx
00193                                                                 ) const;
00194 
00202                 ExportVariable getRows( const ExportIndex& idx1,
00203                                                                 const ExportIndex& idx2
00204                                                                 ) const;
00205 
00213                 ExportVariable getCols( const ExportIndex& idx1,
00214                                                                 const ExportIndex& idx2
00215                                                                 ) const;
00216 
00226                 ExportVariable getSubMatrix(    const ExportIndex& _rowIdx1,
00227                                                                                 const ExportIndex& _rowIdx2,
00228                                                                                 const ExportIndex& _colIdx1,
00229                                                                                 const ExportIndex& _colIdx2
00230                                                                                 ) const;
00231 
00232 
00237                 ExportVariable makeRowVector( ) const;
00238 
00243                 ExportVariable makeColVector( ) const;
00244 
00245 
00251                 bool isVector( ) const;
00252 
00253 
00258                 const DMatrix& getGivenMatrix( ) const;
00259 
00260 
00265                 returnValue print( ) const;
00266 
00268                 bool isSubMatrix() const;
00269 
00271                 bool isDiagonal() const;
00272 
00273         //
00274     // PROTECTED MEMBER FUNCTIONS:
00275     //
00276     protected:
00277 
00282                 virtual uint getColDim( ) const;
00283 
00291                 virtual ExportIndex     getTotalIdx(    const ExportIndex& rowIdx,
00292                                                                                         const ExportIndex& colIdx
00293                                                                                         ) const;
00294 
00309                 returnValue setSubmatrixOffsets(        const ExportIndex& _rowOffset,
00310                                                                                         const ExportIndex& _colOffset,
00311                                                                                         unsigned _rowDim = 0,
00312                                                                                         unsigned _colDim = 0,
00313                                                                                         unsigned _nRows = 0,
00314                                                                                         unsigned _nCols = 0
00315                                                                                         );
00316 
00317 
00327                 bool hasValue(  const ExportIndex& _rowIdx,
00328                                                 const ExportIndex& _colIdx,
00329                                                 double _value
00330                                                 ) const;
00331 
00332         protected:
00333 
00334                 bool doAccessTransposed;                                
00336                 ExportIndex rowOffset;                                          
00337                 ExportIndex colOffset;                                          
00338                 unsigned rowDim;                                                        
00339                 unsigned colDim;                                                        
00340                 unsigned nRows;                                                         
00341                 unsigned nCols;                                                         
00342 };
00343 
00344 CLOSE_NAMESPACE_ACADO
00345 
00346 
00347 #endif  // ACADO_TOOLKIT_EXPORT_VARIABLE_INTERNAL_HPP
00348 
00349 // end of file.


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