diff --git a/galaxy.kdevelop b/galaxy.kdevelop index 2549aab..0b0a1e2 100644 --- a/galaxy.kdevelop +++ b/galaxy.kdevelop @@ -22,7 +22,7 @@ src/galfast.x - debug + optimized /home/mjuric/projects/galaxy/debug/src/galfast.x @@ -79,16 +79,16 @@ kdevgccoptions kdevgppoptions kdevg77options - -O2 -g - --enable-debug=full --prefix=$HOME/projects/galaxy/workspace/staging --with-cuda --enable-cuda-devemu --with-libpeyton=$HOME/projects/libpeyton --with-libpeyton-libdir=$HOME/projects/libpeyton/lib-optimized - + -O2 -Wstrict-aliasing -fno-strict-aliasing + --with-cuda --enable-cuda-devemuX --with-sm=/usr/local --with-libpeyton=$HOME/projects/libpeyton --prefix=$HOME/projects/galaxy/workspace/staging --with-cfitsio-include=/usr/include/cfitsio --with-libpeyton-libdir=$HOME/projects/libpeyton/lib-optimized + -DDEBUGMODE=0 - - - - - - + -rdynamic -L/opt/cudatools/2.3/lib + + + + + diff --git a/src/common/textstream.h b/src/common/textstream.h index 2061bf5..f16630c 100644 --- a/src/common/textstream.h +++ b/src/common/textstream.h @@ -47,11 +47,12 @@ class itextstream : public textstream { public: int nread; std::string line; + int m_line; bool is_comment; public: public: - itextstream(std::istream &f_) : f(f_), nread(0), max_field(0), ret_comments(false) {} + itextstream(std::istream &f_) : f(f_), nread(0), max_field(0), ret_comments(false), m_line(0) {} void bind(std::string &s, int p) { fields[p] = field(p, s); max_field = std::max(max_field, p); } void bind(double &s, int p) { fields[p] = field(p, s); max_field = std::max(max_field, p); } @@ -77,7 +78,13 @@ class itextstream : public textstream { } bool returncomments(bool rc) { ret_comments = rc; } - + + void getline(std::istream &is, std::string &str) + { + std::getline(is, str); + m_line++; + } + itextstream &skip(int n = 1) { while(n > 0) @@ -102,6 +109,7 @@ class itextstream : public textstream { itextstream &next() { nread = -1; + is_comment = false; do { getline(f, line); // std::cerr << "LINE: [" << line << "] " << (bool)*this << "\n"; @@ -167,7 +175,11 @@ class itextstream : public textstream { return *this; }*/ - operator bool() { return nread != -1; } + int last_line_read() const { return m_line; } + + bool noerror() { return *this || f.eof(); } + operator bool() { return iscomment() || (nread == fields.size()); } + //operator bool() { return nread != -1; } bool iscomment() { return is_comment; } }; diff --git a/src/modules/photometry_host.cpp b/src/modules/photometry_host.cpp index 5949823..a2edcc6 100644 --- a/src/modules/photometry_host.cpp +++ b/src/modules/photometry_host.cpp @@ -182,7 +182,11 @@ bool os_photometry::construct(const Config &cfg, otable &t, opipeline &pipe) { v[FeH].push_back(mc); } - assert(!v.empty()); + if(v.empty() || !in.noerror()) + { + THROW(EAny, "Error reading color-metallicity-magnitude relations from '" + fname + "' around line " + str(in.last_line_read()) + + ". Is the formatted correctly, and does it contain " + str(2+ncolors) + " columns?"); + } #if 1 double dFeH, dMr;