00001 /************************************************************************************* 00002 * MechSys - A C++ library to simulate (Continuum) Mechanical Systems * 00003 * Copyright (C) 2005 Dorival de Moraes Pedroso <dorival.pedroso at gmail.com> * 00004 * Copyright (C) 2005 Raul Dario Durand Farfan <raul.durand at gmail.com> * 00005 * * 00006 * This file is part of MechSys. * 00007 * * 00008 * MechSys is free software; you can redistribute it and/or modify it under the * 00009 * terms of the GNU General Public License as published by the Free Software * 00010 * Foundation; either version 2 of the License, or (at your option) any later * 00011 * version. * 00012 * * 00013 * MechSys is distributed in the hope that it will be useful, but WITHOUT ANY * 00014 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 00015 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License along with * 00018 * MechSys; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, * 00019 * Fifth Floor, Boston, MA 02110-1301, USA * 00020 *************************************************************************************/ 00021 00022 #include <iostream> 00023 #include <iomanip> 00024 #include <cmath> 00025 00026 #include "util/numstreams.h" 00027 #include "numerical/spline.h" 00028 00029 using Util::_6_3; 00030 using std::cout; 00031 using std::endl; 00032 00033 int main(int argc, char **argv) try 00034 { 00035 int n = 21; 00036 REAL X[] = { 0.9, 1.3, 1.9 , 2.1, 2.6, 3.0, 3.9, 4.4 , 4.7 , 5.0, 6.0 , 7.0, 8.0 , 9.2 , 10.5, 11.3, 11.6, 12.0, 12.6, 13.0, 13.3 }; 00037 REAL Y[] = { 1.3, 1.5, 1.85, 2.1, 2.6, 2.7, 2.4, 2.15, 2.05, 2.1, 2.25, 2.3, 2.25, 1.95, 1.4, 0.9, 0.7, 0.6, 0.5, 0.4, 0.25 }; 00038 Spline S(X,Y,n); 00039 cout << S << endl; 00040 00041 cout << _6_3()<< "x" << _6_3()<< "y" << endl; 00042 for (double x=0.9; x<13.3; x+=0.1) 00043 cout << _6_3()<< x << _6_3()<< S.Eval(x) << endl; 00044 00045 return 0; 00046 } 00047 catch (Exception * e) 00048 { 00049 e->Cout(); 00050 if (e->IsFatal()) {delete e; exit(1);} 00051 delete e; 00052 } 00053 catch (...) 00054 { 00055 std::cout << "Some exception (...) ocurred\n"; 00056 }