Commits (2)
......@@ -25,9 +25,9 @@ endif ()
message(STATUS "Compiler option " ${CMAKE_CXX_FLAGS_DISTRIBUTION})
if (NO_DEPRECATED)
set(CMAKE_CXX_FLAGS "-fPIC -g -Wno-deprecated -std=c++11")
set(CMAKE_CXX_FLAGS "-fPIC -g -Wno-deprecated -std=c++17")
else ()
set(CMAKE_CXX_FLAGS "-fPIC -g -std=c++11")
set(CMAKE_CXX_FLAGS "-fPIC -g -std=c++17")
endif()
#---------------------------------------------------------------------------------------#
......
......@@ -735,10 +735,20 @@ RowBndValues::RowBndValues(Vector &u, const tcell &tc) : BF(u.GetSTMesh(), tc),
/*******************/
/* extra functions */
/*******************/
// Upgrade to c++17:
// This operator is only used in the function RandomVector, where it throws a compiler error...
template<class F>
Vector &operator<<(Vector &u, const F &f) {
for (row r = u.rows(); r != u.rows_end(); ++r)
u(r, 0) = eval(f(r()));
// Upgrade to c++17: Changed line to ensure this works.
// Note that this operator is not flexible, as it only creates Scalar Random Vectors.
u(r, 0) = eval(f());
// LEGACY ========================================================================
// The evaluation of an arbitrary function at an object of type row seems unstable
// Upgrade to c++17: This throws an error from RandomVector, because "rand" is a
// function with zero input arguments.
//u(r, 0) = eval(f(r()));
// ===============================================================================
return u;
}
......@@ -757,6 +767,8 @@ void RandomVector(Vector &u, Operator &B, Operator &IA) {
double s = sqrt(std::real(b * v));
b /= s;
u = IA * b;
// See comments above on the operator <<
Exit("RandomVector should be refactored.")
}
void RandomVectors(Vectors &u, Operator &B, Operator &IA) {
......@@ -772,6 +784,8 @@ void RandomVectors(Vectors &u, Operator &B, Operator &IA) {
b[i] /= s;
}
u = IA * b;
// See comments above on the operator <<
Exit("RandomVectors should be refactored.")
}
/****************/
......