Commit 084a4722 authored by Naumann, Andreas's avatar Naumann, Andreas

updates for gcc-4.7

parent 255c2ef3
......@@ -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);
......
......@@ -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
///_________________________________________________________________________________________
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment