Commit 9cb97640 authored by Praetorius, Simon's avatar Praetorius, Simon

Initfile parser - added support for general enums

parent bd3f3bbe
......@@ -110,7 +110,6 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/MeshStructure.cc
${SOURCE_DIR}/Operator.cc
${SOURCE_DIR}/OperatorTerm.cc
${SOURCE_DIR}/Parameters.cc
${SOURCE_DIR}/Parametric.cc
${SOURCE_DIR}/PeriodicBC.cc
${SOURCE_DIR}/ProblemImplicit.cc
......
......@@ -63,6 +63,7 @@
#include "FixVec.h"
#include "Flag.h"
#include "Global.h"
#include "Initfile.h" // replacement for Parameters.h
#include "ITL_Preconditioner.h"
#include "ITL_Solver.h"
#include "Lagrange.h"
......@@ -78,7 +79,6 @@
#include "OEMSolver.h"
#include "Operator.h"
#include "OperatorTerm.h"
#include "Parameters.h"
#include "Parametric.h"
#include "PeriodicMap.h"
#include "PeriodicBC.h"
......
......@@ -24,7 +24,7 @@
#define AMDIS_ADAPTINFO_H
#include "MatrixVector.h"
#include "Parameters.h"
#include "Initfile.h"
#include "Serializable.h"
namespace AMDiS {
......
......@@ -11,7 +11,7 @@
#include "AdaptInstationary.h"
#include "Parameters.h"
#include "Initfile.h"
#include "Estimator.h"
#include "ProblemIterationInterface.h"
#include "ProblemTimeInterface.h"
......
......@@ -11,7 +11,7 @@
#include "AdaptStationary.h"
#include "Parameters.h"
#include "Initfile.h"
#include "Estimator.h"
#include "ProblemIterationInterface.h"
#include <math.h>
......
......@@ -12,7 +12,7 @@
#include "Boundary.h"
#include "FixVec.h"
#include "Parameters.h"
#include "Initfile.h"
namespace AMDiS {
......
......@@ -32,7 +32,7 @@
#include "BoundaryManager.h"
#include "Assembler.h"
#include "Operator.h"
#include "Parameters.h"
#include "Initfile.h"
#include "Traverse.h"
// Defining the interface for MTL4
......
......@@ -12,7 +12,7 @@
#include "Estimator.h"
#include "Traverse.h"
#include "Parameters.h"
#include "Initfile.h"
#include "DualTraverse.h"
namespace AMDiS {
......@@ -27,7 +27,7 @@ namespace AMDiS {
{
FUNCNAME("Estimator::Estimator()");
Parameters::get(name + "->error norm", norm);
Parameters::get(name + "->error norm", norm);
}
......
......@@ -15,7 +15,7 @@
#include <sstream>
#include "Global.h"
#include "Parameters.h"
#include "Initfile.h"
#include "Element.h"
#include "Line.h"
#include "Triangle.h"
......@@ -268,7 +268,7 @@ namespace AMDiS {
// get dimension
TEST_EXIT(Parameters::initialized())("Parameters not initialized!\n");
Parameters::getGlobalParameter(0, "dimension of world","%d",&d);
Parameters::get("dimension of world",d,0);
TEST_EXIT(d > 0)("Cannot initialize dimension!\n");
TEST_EXIT((d == 1) || (d == 2) || (d == 3))("Invalid world dimension %d!\n",d);
......@@ -304,8 +304,7 @@ namespace AMDiS {
}
// set msgWait
Parameters::getGlobalParameter(0, "WAIT", "%d", &d);
Msg::setMsgWait(!(d == 0));
Msg::setMsgWait(!(Parameters::getMsgWait() == 0));
}
......
......@@ -15,6 +15,7 @@
#include <boost/algorithm/string/trim.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/type_traits.hpp>
namespace AMDiS {
......@@ -118,15 +119,32 @@ namespace AMDiS {
}
/// convert string to intrinsic type
template< typename T >
inline void convert(const std::string valStr, T& value) {
template< typename T >
inline void convert(const std::string valStr, T& value ,
typename boost::enable_if< boost::is_pod< T > >::type* p = NULL ,
typename boost::disable_if< boost::is_enum< T > >::type* p2 = NULL ) {
using boost::lexical_cast;
try {
value = lexical_cast< T >(trim(valStr));
}catch(boost::bad_lexical_cast e) {
throw WrongValueFormat< T >(valStr);
}
}
template< typename T >
inline void convert(const std::string valStr, T& value,
typename boost::enable_if< boost::is_enum< T > >::type* p = NULL) {
unsigned int swap= 0;
try {
swap = boost::lexical_cast< unsigned int >(trim(valStr));
}catch(boost::bad_lexical_cast e) {
throw WrongValueFormat< T >(valStr);
}
value = static_cast< T >(swap);
}
/// convert string to WorldVector
template< typename T >
inline void convert(const std::string valStr, WorldVector<T>& c) {
......@@ -378,5 +396,7 @@ protected:
};
typedef Initfile Parameters;
} // end namespace AMDiS
#endif
......@@ -28,7 +28,7 @@
#include "MacroElement.h"
#include "Mesh.h"
#include "Traverse.h"
#include "Parameters.h"
#include "Initfile.h"
#include "FixVec.h"
#include "DOFVector.h"
#include "CoarseningManager.h"
......
......@@ -34,7 +34,7 @@
#include "Global.h"
#include "AMDiS_fwd.h"
#include "Parameters.h"
#include "Initfile.h"
#include "SolverMatrix.h"
#include "DOFVector.h"
#include "SystemVector.h"
......
......@@ -27,7 +27,7 @@
#include <list>
#include "AMDiS_fwd.h"
#include "ProblemStatBase.h"
#include "Parameters.h"
#include "Initfile.h"
#include "Boundary.h"
#include "MatrixVector.h"
#include "StandardProblemIteration.h"
......
......@@ -11,7 +11,7 @@
#include "RecoveryEstimator.h"
#include "Parameters.h"
#include "Initfile.h"
namespace AMDiS {
......
......@@ -16,7 +16,7 @@
#include "DOFVector.h"
#include "Assembler.h"
#include "Traverse.h"
#include "Parameters.h"
#include "Initfile.h"
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include <mpi.h>
......
......@@ -31,7 +31,7 @@
#include <boost/lexical_cast.hpp>
#include "Global.h"
#include "Parameters.h"
#include "Initfile.h"
#include "AdaptInfo.h"
#include "io/FileWriter.h"
......
......@@ -29,7 +29,7 @@
#include <map>
#include "DOFVector.h"
#include "SystemVector.h"
#include "Parameters.h"
#include "Initfile.h"
namespace AMDiS {
......
......@@ -17,7 +17,7 @@
#include "FiniteElemSpace.h"
#include "Global.h"
#include "Mesh.h"
#include "Parameters.h"
#include "Initfile.h"
#include "Traverse.h"
#include "CompositeFEMMethods.h"
......
......@@ -25,7 +25,7 @@
#include "ElementFunction.h"
#include "FixVec.h"
#include "Parameters.h"
#include "Initfile.h"
namespace AMDiS {
class Element;
......
......@@ -17,7 +17,7 @@
#include "ElementFileWriter.h"
#include "BasisFunction.h"
#include "Parameters.h"
#include "Initfile.h"
#include "Traverse.h"
#include "AdaptInfo.h"
......
......@@ -13,7 +13,7 @@
#include "boost/lexical_cast.hpp"
#include "FileWriter.h"
#include "SystemVector.h"
#include "Parameters.h"
#include "Initfile.h"
#include "ValueWriter.h"
#include "MacroWriter.h"
#include "VtkWriter.h"
......
......@@ -21,7 +21,7 @@
#include "FixVec.h"
#include "PeriodicMap.h"
#include "ElInfo.h"
#include "Parameters.h"
#include "Initfile.h"
#include "DOFIterator.h"
#include "LeafData.h"
#include "VertexVector.h"
......
......@@ -29,7 +29,7 @@
#include "AMDiS_fwd.h"
#include "Global.h"
#include "Parameters.h"
#include "Initfile.h"
#include "DOFMatrix.h"
#include "parallel/MeshDistributor.h"
......
......@@ -25,7 +25,7 @@
#include "AMDiS_fwd.h"
#include "ElementFunction.h"
#include "FixVec.h"
#include "Parameters.h"
#include "Initfile.h"
using namespace AMDiS;
using namespace std;
......
......@@ -29,7 +29,7 @@
#include "io/FileWriter.h"
#include "FixVec.h"
#include "Flag.h"
#include "Parameters.h"
#include "Initfile.h"
#include "ElementLevelSet.h"
#include "BoundaryElementDist.h"
#include "BoundaryElementLevelSetDist.h"
......
......@@ -24,7 +24,7 @@
#include "FixVec.h"
#include "Global.h"
#include "Parameters.h"
#include "Initfile.h"
using namespace AMDiS;
......
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