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
00027
00034 #include <acado_integrators.hpp>
00035
00036 using namespace std;
00037
00038 USING_NAMESPACE_ACADO
00039
00040
00041 int main( )
00042 {
00043
00044
00045 double tStart = 0.0;
00046 double tEnd = 2.0;
00047
00048 VariablesGrid equidistantGrid(2, tStart, tEnd, 5);
00049
00050 equidistantGrid.setZero();
00051
00052 DVector v(2);
00053 v(0) = 1.0;
00054 v(1) = 2.0;
00055 equidistantGrid.setVector(1, v);
00056 equidistantGrid.setVector(2, v);
00057
00058 v.setAll(5.0);
00059 equidistantGrid.setVector(3, v);
00060 equidistantGrid.setVector(4, v);
00061
00062 cout << "The grid consists of the following grid points:\n"
00063 << equidistantGrid
00064 << "Its number of grid points is: " << equidistantGrid.getNumPoints() << endl
00065 << "Each vector has dimension: " << equidistantGrid.getNumValues() << endl;
00066
00067
00068 VariablesGrid gridFromFile;
00069 gridFromFile.read( "./data.txt" );
00070
00071 cout << "\nThe second grid consists of the following grid points:\n"
00072 << gridFromFile;
00073
00074
00075 equidistantGrid.appendTimes(gridFromFile);
00076
00077 cout << "\nNow, the grid consists of the following grid points:\n"
00078 << equidistantGrid
00079 << "Its number of grid points is: " << equidistantGrid.getNumPoints() << endl
00080 << "Each vector has dimension: " << equidistantGrid.getNumValues() << endl;
00081
00082
00083
00084 VariablesGrid thirdGrid(1, equidistantGrid);
00085
00086
00087 for (unsigned int i = 0; i < thirdGrid.getNumPoints(); ++i)
00088 thirdGrid(i, 0) = (double) i;
00089
00090 cout << "\nThe third grid consists of the following grid points:\n" << thirdGrid;
00091
00092
00093 equidistantGrid.appendValues(thirdGrid);
00094
00095 cout << "\nNow, the grid consists of the following grid points:\n";
00096 equidistantGrid.print();
00097 cout << "Its number of grid points is: " << equidistantGrid.getNumPoints() << endl;
00098 cout << "Each vector has dimension: " << equidistantGrid.getNumValues() << endl;
00099
00100 return 0;
00101 }
00102
00103
00104