00001 #include <fstream>
00002 #include "util.h"
00003
00004
00005 void error(char* error_text)
00006 {
00007 std::cout << "\n" << error_text;
00008 exit(1);
00009 }
00010
00011
00012 safevector<double> interval(double start, double stop, double step) {
00013 assert(start <= stop && step > 0.0);
00014
00015 safevector<double> cc;
00016 cc.reserve(unsigned((stop - start) / step));
00017 for(double t = start; t <= stop; t += step) {
00018 cc.push_back(t);
00019 }
00020 return cc;
00021 }
00022
00023 safevector<float> getparm(std::string const& strval) {
00024
00025
00026 unsigned x;
00027 int oldpos = 0;
00028 std::string dummy;
00029 safevector<float> ft;
00030 x = strval.find(",");
00031 while(x < strval.size()) {
00032 dummy = strval.substr(oldpos,(x-oldpos));
00033 oldpos = x+1;
00034 x = strval.find(",", x + 1);
00035 ft.push_back(atof(dummy.c_str()));
00036 }
00037 dummy = strval.substr(oldpos,strval.length());
00038 ft.push_back(atof(dummy.c_str()));
00039
00040 return ft;
00041 }
00042
00043
00044 #ifdef TEST
00045
00046 int main() {
00047 try {
00048 std::cerr << "Nothing to test in util.cpp\n";
00049 } catch(std::string const& err) {
00050 std::cerr << err << std::endl;
00051 return 1;
00052 }
00053 return 0;
00054 }
00055
00056
00057 #endif//TEST
00058