Commit 31febd6d authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

merge of trunk with arhfile2 branch: 'using namespace' removed from header...

merge of trunk with arhfile2 branch: 'using namespace' removed from header files, file readers/writer moved to subnamespace AMDiS::io, test for arh2writer added
parent 9c91bc29
......@@ -55,14 +55,28 @@ else()
endif()
unset(_AMDIS_LIB CACHE)
# Boost libraries
# ---------------
set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@)
set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSIN@)
set(BOOST_LIBS_REQUIRED system iostreams filesystem program_options date_time)
if(AMDIS_NEED_COMPRESSION)
list(APPEND BOOST_LIBS_REQUIRED zlib bzip2)
endif(AMDIS_NEED_COMPRESSION)
set(BOOST_VERSION "1.42")
if(AMDIS_HAS_PARALLEL_DOMAIN)
set(BOOST_VERSION "1.48")
endif(AMDIS_HAS_PARALLEL_DOMAIN)
if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.42 REQUIRED system iostreams filesystem program_options date_time zlib bzip2)
find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED})
else()
set(Boost_USE_STATIC_LIBS OFF)
find_package(Boost 1.42 REQUIRED system iostreams filesystem program_options date_time)
find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED})
endif()
if(Boost_FOUND)
list(APPEND AMDIS_LIBRARIES ${Boost_LIBRARIES})
......@@ -81,11 +95,10 @@ list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser)
# ------------------------------------------------------------------
set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@)
set(AMDIS_OPENMP @ENABLE_OPENMP@)
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDIS_NEED_HYPRE @ENABLE_HYPRE@)
set(AMDIS_NEED_PETSC @ENABLE_PETSC@)
set(AMDIS_NEED_SEQ_PETSC @ENABLE_SEQ_PETSC@)
set(AMDIS_NEED_PNG @ENABLE_PNG@)
set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@)
set(AMDIS_NEED_MKL @ENABLE_MKL@)
......
......@@ -41,13 +41,14 @@ endif()
SET(ENABLE_PARALLEL_DOMAIN "OFF" CACHE STRING "use parallel domain decomposition. please set to one of: PMTL, PETSC, OFF" )
option(USE_PETSC_DEV false)
option(ENABLE_ZOLTAN false)
option(ENABLE_PETSC "Use sequential PETSc solvers" false)
option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false)
option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
option(ENABLE_HYPRE "Use HYPRE AMG solver" false)
option(ENABLE_PNG "use png reader/writer" false)
option(ENABLE_BDDCML "Use of BDDCML library" false)
option(ENABLE_EXTENSIONS "Use extensions" false)
option(ENABLE_OPENMP "Use OpenMP" false)
option(ENABLE_COMPRESSION "Use output compression" false)
option(ENABLE_OUTPUT "AMDiS output printing, disable only for debugging!" true)
......@@ -160,7 +161,11 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/est/ResidualEstimator.cc
${SOURCE_DIR}/est/SimpleResidualEstimator.cc
${SOURCE_DIR}/io/ArhReader.cc
${SOURCE_DIR}/io/ArhWriter.cc
${SOURCE_DIR}/io/detail/ArhReader.cc
${SOURCE_DIR}/io/Arh2Reader.cc
${SOURCE_DIR}/io/detail/Arh2Reader.cc
${SOURCE_DIR}/io/detail/ArhWriter.cc
${SOURCE_DIR}/io/detail/Arh2Writer.cc
${SOURCE_DIR}/io/DofWriter.cc
${SOURCE_DIR}/io/ElementFileWriter.cc
${SOURCE_DIR}/io/FileWriter.cc
......@@ -176,6 +181,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/io/ValueWriter.cc
${SOURCE_DIR}/io/VtkWriter.cc
${SOURCE_DIR}/io/VtkVectorWriter.cc
${SOURCE_DIR}/io/detail/VtkWriter.cc
${SOURCE_DIR}/nonlin/ProblemNonLin.cc
${SOURCE_DIR}/solver/SolverMatrix.cc
${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc
......@@ -257,7 +263,7 @@ if(ENABLE_PARALLEL_DOMAIN)
set(PETSC_EXECUTABLE_RUNS ON)
find_package(PETSc REQUIRED)
include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_PETSC")
list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}")
list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
list(APPEND PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
......@@ -297,7 +303,7 @@ if(ENABLE_PARALLEL_DOMAIN)
endif(ENABLE_PARALLEL_DOMAIN)
if(ENABLE_PETSC)
if(ENABLE_SEQ_PETSC)
find_package(MPI REQUIRED)
if(MPI_FOUND)
list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}")
......@@ -309,12 +315,12 @@ if(ENABLE_PETSC)
find_package(PETSc REQUIRED)
include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
list(APPEND COMPILEFLAGS "-DHAVE_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}")
list(APPEND COMPILEFLAGS "-DHAVE_SEQ_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}")
list(APPEND AMDIS_SRC
${SOURCE_DIR}/solver/PetscSolver.cc
${SOURCE_DIR}/solver/PetscTypes.cc)
endif(ENABLE_PETSC)
endif(ENABLE_SEQ_PETSC)
if(ENABLE_UMFPACK)
find_file(UMFPACK_H umfpack.h
......@@ -362,6 +368,9 @@ if(ENABLE_PNG)
endif()
endif(ENABLE_PNG)
if(ENABLE_COMPRESSION)
list(APPEND COMPILEFLAGS "-DHAVE_COMPRESSION=1")
endif(ENABLE_COMPRESSION)
if(NOT ENABLE_OUTPUT)
message(WARNING "AMDiS cout output disabled!")
......@@ -421,11 +430,11 @@ if(ENABLE_EXTENSIONS)
${EXTENSIONS_DIR}/preconditioner/PhaseFieldCrystal_.cc
${EXTENSIONS_DIR}/preconditioner/CahnHilliard_.cc)
if(ENABLE_PETSC)
if(ENABLE_SEQ_PETSC)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
endif(ENABLE_PETSC)
endif(ENABLE_SEQ_PETSC)
if(ENABLE_PARALLEL_DOMAIN)
list(APPEND EXTENSIONS_SRC
......@@ -651,6 +660,11 @@ FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/io)
FILE(GLOB HEADERS "${SOURCE_DIR}/io/detail/*h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/io/detail)
list(APPEND deb_add_dirs "include/amdis/io/detail")
FILE(GLOB HEADERS "${REINIT_SOURCE_DIR}/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/reinit)
......
......@@ -36,7 +36,7 @@ namespace AMDiS {
void init(int argc, char **argv, std::string initFileName)
{
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_PETSC)
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) || defined(HAVE_SEQ_PETSC)
#ifdef HAVE_PARALLEL_MTL4
mtl_environment = new mtl::par::environment(argc, argv);
#else
......@@ -142,12 +142,10 @@ namespace AMDiS {
#ifdef HAVE_PARALLEL_MTL4
if (mtl_environment)
delete mtl_environment;
#else
PetscFinalize();
#endif
#endif
#ifdef HAVE_PETSC
#if (defined HAVE_SEQ_PETSC) || (defined HAVE_PARALLEL_PETSC)
PetscFinalize();
#endif
......
......@@ -113,7 +113,9 @@
#include "est/Estimator.h"
#include "io/ArhReader.h"
#include "io/Arh2Reader.h"
#include "io/ArhWriter.h"
#include "io/Arh2Writer.h"
#include "io/DataCollector.h"
#include "io/FileWriter.h"
#include "io/GNUPlotWriter.h"
......@@ -126,6 +128,11 @@
#include "io/ValueWriter.h"
#include "io/VtkWriter.h"
#include "io/VtkVectorWriter.h"
#ifdef HAVE_EXTENSIONS
#include "io/VtkReader.h"
#endif
#include "io/Reader.h"
#include "io/Writer.h"
#include "nonlin/ProblemNonLin.h"
#include "nonlin/NonLinSolver.h"
......
......@@ -100,6 +100,16 @@ namespace AMDiS {
class VertexInfo;
class VertexVector;
namespace io {
class ElementFileWriter;
class GNUPlotWriter;
class MacroReader;
class MacroWriter;
class PngWriter;
class PovrayWriter;
class Spreadsheet;
}
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
namespace Parallel {
class ElementObjectDatabase;
......
......@@ -31,14 +31,12 @@
namespace AMDiS {
using namespace std;
/// Interface for adaption loops.
class AdaptBase
{
public:
/// Constructor
AdaptBase(string sname,
AdaptBase(std::string sname,
ProblemIterationInterface *problemIteration_,
AdaptInfo *adapt,
ProblemTimeInterface *problemTime_ = nullptr,
......@@ -60,7 +58,7 @@ namespace AMDiS {
virtual int adapt() = 0;
/// Returns \ref name
inline string getName() const
inline std::string getName() const
{
return name;
}
......@@ -103,7 +101,7 @@ namespace AMDiS {
protected:
/// Name of the adaption loop
string name;
std::string name;
/// Problem iteration interface
ProblemIterationInterface *problemIteration;
......
......@@ -33,6 +33,8 @@
#endif
#endif
using namespace std;
namespace AMDiS {
AdaptInstationary::AdaptInstationary(std::string name,
......
......@@ -35,8 +35,6 @@
namespace AMDiS {
using namespace std;
/** \ingroup Adaption
* \brief
* AdaptInstationary implements the adaptive procdure for time dependent
......@@ -48,21 +46,21 @@ namespace AMDiS {
public:
/// Creates a AdaptInstationary object with the given name for the time
/// dependent problem problemInstat. TODO: Make obsolete!
AdaptInstationary(string name,
AdaptInstationary(std::string name,
ProblemIterationInterface *problemStat,
AdaptInfo *info,
ProblemTimeInterface *problemInstat,
AdaptInfo *initialInfo,
time_t initialTimestampSet = 0);
std::time_t initialTimestampSet = 0);
/// Creates a AdaptInstationary object with the given name for the time
/// dependent problem problemInstat.
AdaptInstationary(string name,
AdaptInstationary(std::string name,
ProblemIterationInterface &problemStat,
AdaptInfo &info,
ProblemTimeInterface &problemInstat,
AdaptInfo &initialInfo,
time_t initialTimestampSet = 0);
std::time_t initialTimestampSet = 0);
/** \brief
* This funciton is used only to avoid double code in both constructors. If the
......@@ -73,7 +71,7 @@ namespace AMDiS {
void initConstructor(ProblemIterationInterface *problemStat,
AdaptInfo *info,
AdaptInfo *initialInfo,
time_t initialTimestampSet);
std::time_t initialTimestampSet);
/// Destructor
virtual ~AdaptInstationary() {}
......@@ -94,10 +92,10 @@ namespace AMDiS {
int adapt() override;
/// Serialization
virtual void serialize(ostream &out);
virtual void serialize(std::ostream &out);
/// deserialization
virtual void deserialize(istream &in);
virtual void deserialize(std::istream &in);
protected:
......@@ -113,7 +111,7 @@ namespace AMDiS {
virtual void oneTimestep();
/// Initialisation of this AdaptInstationary object
void initialize(string aName);
void initialize(std::string aName);
/// Implements the explit time strategy. Used by \ref oneTimestep().
virtual void explicitTimeStrategy();
......@@ -160,18 +158,18 @@ namespace AMDiS {
int queueRuntime;
/// Name of the file used to automatically serialize the problem.
string queueSerializationFilename;
std::string queueSerializationFilename;
/// Timestamp at the beginning of all calculations. It is used to calculate the
/// overall runtime of the problem.
time_t initialTimestamp;
std::time_t initialTimestamp;
/// Timestamp at the beginning of the last timestep iteration. Is is used to
/// calculate the runtime of the last timestep.
time_t iterationTimestamp;
std::time_t iterationTimestamp;
/// Stores the runtime (in seconds) of some last timestep iterations.
queue<int> lastIterationsDuration;
std::queue<int> lastIterationsDuration;
/// In debug mode, the adapt loop will print information about timestep decreasing
/// and increasing.
......
......@@ -40,8 +40,6 @@
namespace AMDiS {
using namespace std;
/** \ingroup Adaption
* \brief
* AdaptStationary contains information about the adaptive procedure and the
......@@ -51,12 +49,12 @@ namespace AMDiS {
{
public:
/// Creates a AdaptStationary object with given name. TODO: Make obsolete!
AdaptStationary(string name,
AdaptStationary(std::string name,
ProblemIterationInterface *prob,
AdaptInfo *info);
/// Creates a AdaptStationary object with given name.
AdaptStationary(string name,
AdaptStationary(std::string name,
ProblemIterationInterface &prob,
AdaptInfo &info);
......
......@@ -34,8 +34,6 @@
namespace AMDiS {
using namespace std;
/// Function interface for evaluating basis functions.
class BasFctType
{
......@@ -91,7 +89,7 @@ namespace AMDiS {
{
protected:
/// Creates a BasisFunction object of given dim and degree
BasisFunction(string name, int dim, int degree);
BasisFunction(std::string name, int dim, int degree);
/// destructor
virtual ~BasisFunction();
......@@ -145,7 +143,7 @@ namespace AMDiS {
}
/// Returns \ref name of BasisFunction
inline string getName() const
inline std::string getName() const
{
return name;
}
......@@ -271,13 +269,13 @@ namespace AMDiS {
/// Returns local dof indices of the element for the given fe space.
virtual void getLocalIndices(const Element *el,
const DOFAdmin *admin,
vector<DegreeOfFreedom> &indices) const
std::vector<DegreeOfFreedom> &indices) const
{}
///
virtual void getLocalDofPtrVec(const Element *el,
const DOFAdmin *admin,
vector<const DegreeOfFreedom*>& vec) const
std::vector<const DegreeOfFreedom*>& vec) const
{}
......@@ -315,7 +313,7 @@ namespace AMDiS {
protected:
/// Textual description
string name;
std::string name;
/// Number of basisfunctions on one Element
int nBasFcts;
......@@ -333,13 +331,13 @@ namespace AMDiS {
DimVec<int> *nDOF;
/// Vector of the local functions
vector<BasFctType*> *phi;
std::vector<BasFctType*> *phi;
/// Vector of gradients
vector<GrdBasFctType*> *grdPhi;
std::vector<GrdBasFctType*> *grdPhi;
/// Vector of second derivatives
vector<D2BasFctType*> *d2Phi;
std::vector<D2BasFctType*> *d2Phi;
};
}
......
......@@ -33,9 +33,7 @@
namespace AMDiS {
using namespace std;
typedef vector<pair<GeoIndex, int> > ExcludeList;
typedef std::vector<std::pair<GeoIndex, int> > ExcludeList;
/// Defines the geometrical objects that forms the boundary;
struct BoundaryObject {
......
......@@ -30,6 +30,8 @@
#include "DOFIndexed.h"
#include "Debug.h"
using namespace std;
namespace AMDiS {
void CoarseningManager3d::coarsenFunction(ElInfo *elInfo)
......
......@@ -24,19 +24,18 @@
#include "MTL4Types.h"
namespace AMDiS {
template< typename T >
template<typename T>
struct Collection {};
using namespace MTLTypes;
template< >
struct Collection< MTLMatrix > {
typedef mtl::matrix::inserter< MTLMatrix > Inserter;
template<>
struct Collection< MTLTypes::MTLMatrix > {
typedef mtl::matrix::inserter< MTLTypes::MTLMatrix > Inserter;
};
template< >
struct Collection< MTLVector > {
typedef mtl::vector::inserter< MTLVector > Inserter;
typedef MTLMatrix PreconditionMatrix;
template<>
struct Collection< MTLTypes::MTLVector > {
typedef mtl::vector::inserter< MTLTypes::MTLVector > Inserter;
typedef MTLTypes::MTLMatrix PreconditionMatrix;
};
}
#endif
......@@ -35,19 +35,19 @@
namespace AMDiS {
using namespace std;
namespace detail
{
/** \brief
* This class defines a coupled stationary problem definition in sequential
* computations.
*/
template<typename ProblemStatType>
class CouplingProblemStatImpl
class CouplingProblemStat
{
public:
/// Constructor
CouplingProblemStatImpl(std::string name_)
CouplingProblemStat(std::string name_)
: name(name_),
nComponents(0),
nMeshes(0),
......@@ -56,7 +56,7 @@ namespace AMDiS {
{}
/// Destructor
virtual ~CouplingProblemStatImpl() {}
virtual ~CouplingProblemStat() {}
/// add problem by number
virtual void addProblem(ProblemStatType* prob)
......@@ -96,14 +96,14 @@ namespace AMDiS {
name.c_str());
std::map<std::string, Mesh*> meshByName;
std::vector< std::set<Mesh*> > meshesForProblems(problems.size());
std::vector<std::set<Mesh*> > meshesForProblems(problems.size());
std::map<std::pair<Mesh*, int>, FiniteElemSpace*> feSpaceMap;
for (size_t i = 0; i < problems.size(); ++i) {
TEST_EXIT(problems[i])("problem[%d] does not exist!\n",i);
for (size_t j = 0; j < problems[i]->getNumComponents(); j++) {
// mesh
string meshName("");
std::string meshName("");
Parameters::get(problems[i]->getName() + "->mesh", meshName);
TEST_EXIT(meshName != "")("No mesh name specified for \"%s->mesh\"!\n",
problems[i]->getName().c_str());
......@@ -123,26 +123,26 @@ namespace AMDiS {
// feSpace
int degree = 1;
Parameters::get(problems[i]->getName() + "->polynomial degree[" +
boost::lexical_cast<string>(j) + "]", degree);
boost::lexical_cast<std::string>(j) + "]", degree);
if (feSpaceMap[pair<Mesh*, int>(meshByName[meshName], degree)] == nullptr) {
stringstream s;
if (feSpaceMap[std::pair<Mesh*, int>(meshByName[meshName], degree)] == nullptr) {
std::stringstream s;
s << problems[i]->getName() << "->feSpace[" << j << "]";
FiniteElemSpace *newFeSpace =
FiniteElemSpace::provideFeSpace(nullptr, Lagrange::getLagrange(dim, degree),
meshByName[meshName], s.str());
feSpaceMap[pair<Mesh*, int>(meshByName[meshName], degree)] = newFeSpace;
feSpaceMap[std::pair<Mesh*, int>(meshByName[meshName], degree)] = newFeSpace;
feSpaces.push_back(newFeSpace);
}
// problems[i]->setComponentSpace(j, feSpaceMap[pair<Mesh*, int>(meshByName[meshName], degree)]);
// problems[i]->setComponentSpace(j, feSpaceMap[std::pair<Mesh*, int>(meshByName[meshName], degree)]);
}
}
for (size_t i = 0; i < problems.size(); i++) {
vector<Mesh*> problemMeshes(meshesForProblems[i].begin(), meshesForProblems[i].end());
std::vector<Mesh*> problemMeshes(meshesForProblems[i].begin(), meshesForProblems[i].end());
problems[i]->setMeshes(problemMeshes);
problems[i]->setRefinementManager(refinementManager);
problems[i]->setCoarseningManager(coarseningManager);
......@@ -155,10 +155,10 @@ namespace AMDiS {
// If AMDiS is compiled for parallel computations, the global refinements are
// ignored here. Later, each rank will add the global refinements to its
// private mesh.
#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
Parameters::get(meshes[i]->getName() + "->global refinements",
globalRefinements);
#endif
#endif
bool initMesh = initFlag.isSet(INIT_MESH);
......@@ -225,7 +225,7 @@ namespace AMDiS {
}
/// Returns \ref meshes
inline vector<Mesh*> getMeshes()
inline std::vector<Mesh*> getMeshes()
{
return meshes;
}
......@@ -243,7 +243,7 @@ namespace AMDiS {
}
/// Returns the name of the problem
inline virtual string getName()
inline virtual std::string getName()
{
return name;
}
......@@ -251,7 +251,7 @@ namespace AMDiS {
protected:
/// Name of this problem.
string name;
std::string name;
/// Number of problem components
int nComponents;
......@@ -264,10 +264,10 @@ namespace AMDiS {
int nMeshes;
/// FE spaces of this problem.
vector<FiniteElemSpace*> feSpaces;
std::vector<FiniteElemSpace*> feSpaces;
/// Meshes of this problem.
vector<Mesh*> meshes;
std::vector<Mesh*> meshes;
/** \brief
* All actions of mesh refinement are performed by refinementManager.
......@@ -283,11 +283,13 @@ namespace AMDiS {
*/
CoarseningManager *coarseningManager;
vector<ProblemStatType*> problems;
std::vector<ProblemStatType*> problems;
};
} // end namespace detail
typedef detail::CouplingProblemStat<ProblemStat> CouplingProblemStat;
typedef CouplingProblemStatImpl<ProblemStat> CouplingProblemStat;
}
} // end namespace AMDiS
#endif