From 084a4722c2425a79a33325d34b91023e9bbd40fc Mon Sep 17 00:00:00 2001 From: Andreas Naumann <andreas.naumann@tu-dresden.de> Date: Wed, 26 Sep 2012 20:46:46 +0000 Subject: [PATCH] updates for gcc-4.7 --- AMDiS/src/DOFVector.hh | 2 +- AMDiS/src/Initfile.h | 146 ++++++++++++++++++++--------------------- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/AMDiS/src/DOFVector.hh b/AMDiS/src/DOFVector.hh index e0cc3865..91df10cc 100644 --- a/AMDiS/src/DOFVector.hh +++ b/AMDiS/src/DOFVector.hh @@ -1918,7 +1918,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda(); - getLocalVector(elInfo->getElement(), localUh); + this->getLocalVector(elInfo->getElement(), localUh); basFcts->evalGrdUh(bary, grdLambda, localUh, grd); basFcts->getLocalIndices(elInfo->getElement(), feSpace->getAdmin(), localIndices); diff --git a/AMDiS/src/Initfile.h b/AMDiS/src/Initfile.h index 09eca5c9..9442f478 100644 --- a/AMDiS/src/Initfile.h +++ b/AMDiS/src/Initfile.h @@ -118,57 +118,6 @@ namespace AMDiS { } - /** parse an container from tag tag. The Container must have the properties: - * - type value_type - * - member function push_back - */ - template< typename Container > - inline void getContainer(const std::string val_, Container& c) - { - // accepted brackets and delimiters for vector input - std::string begBrackets= "{[("; - std::string endBrackets= "}])"; - std::string delims= ";,"; - - c.clear(); - std::string val = trim(val_); - bool hasBrackets = true; - size_t pos = begBrackets.find(val[0]); - if (pos == std::string::npos) - hasBrackets = false; -/* if (hasBrackets && val[val.length() - 1] != endBrackets[pos]) */ -/* throw WrongVectorFormat("begin and end bracket are different in" */ -/* " value '" + val + "'"); */ - size_t oldPos = (hasBrackets ? 1 : 0); - size_t curDelim = 0; - typedef typename Container::value_type ValueType; - ValueType swap; - try { - curDelim = checkDelim(val, delims); - pos = val.find(delims[curDelim], oldPos); - while (pos != std::string::npos) { - std::string curWord = val.substr(oldPos, pos - oldPos); - oldPos = pos + 1; - convert(curWord, swap); - c.push_back(swap); - pos = val.find(delims[curDelim], oldPos); - } - //last entry - std::string curWord = val.substr(oldPos, val.length() - (hasBrackets ? 1 : 0) - oldPos); - convert(curWord, swap); - c.push_back(swap); - } catch (NoDelim nd) { - std::string curWord = val.substr(oldPos, val.length() - (hasBrackets ? 2 : 0)); - curWord = trim(curWord); - if (curWord.length() > 0) { - // container with one entry - convert(curWord, swap); - c.push_back(swap); - } - } - } - - /// convert string to string inline void convert(const std::string valStr, std::string& value) { @@ -235,6 +184,79 @@ namespace AMDiS { } + /// convert value of arbitrary type to string using stringstream and + /// operator<< for type + template<typename T> + inline void convert(const T value, std::string& valStr) + { + std::stringstream ss; + ss.precision(6); + ss << value; + valStr = ss.str(); + } + + + /// convert WorldVector to string + template<typename T> + inline void convert(const WorldVector<T>& c, std::string& valStr) + { + std::vector<T> temp_vec(c.getSize()); + for (unsigned i = 0; i < temp_vec.size(); i++) + temp_vec[i] = c[i]; + convert(temp_vec, valStr); + } + + /** parse an container from tag tag. The Container must have the properties: + * - type value_type + * - member function push_back + */ + template< typename Container > + inline void getContainer(const std::string val_, Container& c) + { + // accepted brackets and delimiters for vector input + std::string begBrackets= "{[("; + std::string endBrackets= "}])"; + std::string delims= ";,"; + + c.clear(); + std::string val = trim(val_); + bool hasBrackets = true; + size_t pos = begBrackets.find(val[0]); + if (pos == std::string::npos) + hasBrackets = false; +/* if (hasBrackets && val[val.length() - 1] != endBrackets[pos]) */ +/* throw WrongVectorFormat("begin and end bracket are different in" */ +/* " value '" + val + "'"); */ + size_t oldPos = (hasBrackets ? 1 : 0); + size_t curDelim = 0; + typedef typename Container::value_type ValueType; + ValueType swap; + try { + curDelim = checkDelim(val, delims); + pos = val.find(delims[curDelim], oldPos); + while (pos != std::string::npos) { + std::string curWord = val.substr(oldPos, pos - oldPos); + oldPos = pos + 1; + convert(curWord, swap); + c.push_back(swap); + pos = val.find(delims[curDelim], oldPos); + } + //last entry + std::string curWord = val.substr(oldPos, val.length() - (hasBrackets ? 1 : 0) - oldPos); + convert(curWord, swap); + c.push_back(swap); + } catch (NoDelim nd) { + std::string curWord = val.substr(oldPos, val.length() - (hasBrackets ? 2 : 0)); + curWord = trim(curWord); + if (curWord.length() > 0) { + // container with one entry + convert(curWord, swap); + c.push_back(swap); + } + } + } + + /// convert string to WorldVector template< typename T > inline void convert(const std::string valStr, WorldVector<T>& c) @@ -248,7 +270,6 @@ namespace AMDiS { c[i] = temp_vec[i]; } - /// convert string to std::list using begBrackets, endBrackets and delims template<typename T> inline void convert(const std::string valStr, std::list<T>& value) @@ -265,27 +286,6 @@ namespace AMDiS { } - /// convert value of arbitrary type to string using stringstream and - /// operator<< for type - template<typename T> - inline void convert(const T value, std::string& valStr) - { - std::stringstream ss; - ss.precision(6); - ss << value; - valStr = ss.str(); - } - - - /// convert WorldVector to string - template<typename T> - inline void convert(const WorldVector<T>& c, std::string& valStr) - { - std::vector<T> temp_vec(c.getSize()); - for (unsigned i = 0; i < temp_vec.size(); i++) - temp_vec[i] = c[i]; - convert(temp_vec, valStr); - } } // end namespace details ///_________________________________________________________________________________________ -- GitLab