Commit 7e87c6ed authored by Praetorius, Simon's avatar Praetorius, Simon

some corrections in CMakeLists

parent a4ec8f1e
......@@ -64,6 +64,8 @@ set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDIS_NEED_PNG @ENABLE_PNG@)
set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@)
set(AMDIS_NEED_MKL @ENABLE_MKL@)
set(AMDIS_NEED_EXTENSIONS @ENABLE_EXTENSIONS@)
set(AMDIS_NEED_BASE_PROBLEMS @ENABLE_BASE_PROBLEMS@)
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake)
set(AMDIS_COMPILEFLAGS "@COMPILEFLAGS@")
set(AMDIS_VERSION @CurrentRevision@)
......@@ -161,6 +163,18 @@ if(AMDIS_NEED_BDDCML)
list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LINK_LIST})
endif(AMDIS_NEED_BDDCML)
if(AMDIS_NEED_EXTENSIONS)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/time)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/nanoflann)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/pugixml/src)
list(APPEND AMDIS_LIBRARIES ${AMDIS_LIBRARY_DIR}/libextensions.so)
endif(AMDIS_NEED_EXTENSIONS)
if(AMDIS_NEED_BASE_PROBLEMS)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/base_problems)
list(APPEND AMDIS_LIBRARIES ${AMDIS_LIBRARY_DIR}/libbase_problems.so)
endif(AMDIS_NEED_BASE_PROBLEMS)
#add directories for reinit
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit)
......
......@@ -42,6 +42,7 @@ option(ENABLE_ZOLTAN false)
option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
option(ENABLE_PNG "use png reader/writer" false)
option(ENABLE_BDDCML "Use of BDDCML library" false)
option(ENABLE_EXTENSIONS "Use extensions" false)
find_package(Boost 1.42 REQUIRED)
if(Boost_FOUND)
......@@ -336,42 +337,100 @@ endif(ENABLE_BDDCML)
if(ENABLE_EXTENSIONS)
option(ENABLE_BASE_PROBLEMS "Use base_problems" false)
find_path(EXTENSIONS_DIR NAMES ${SOURCE_DIR}/../../extensions/Helpers.h DOC "Path to AMDiS extensions.")
if (EXTENSIONS_DIR)
if (NOT EXISTS ${EXTENSIONS_DIR}/Helpers.h OR NOT EXISTS ${EXTENSIONS_DIR}/base_problems/BaseProblem.h)
message(FATAL_ERROR "Wrong extensions directory! Directory must contain the 'Helpers.h' and the subdirectory 'base_problems'")
else()
SET(EXTENSIONS_SRC
${EXTENSIONS_DIR}/Helpers.cc
${EXTENSIONS_DIR}/BackgroundMesh.cc
${EXTENSIONS_DIR}/GeometryTools.cc
${EXTENSIONS_DIR}/POperators.cc
${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp)
list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1")
if(ENABLE_BASE_PROBLEMS)
SET(BASE_PROBLEMS_SRC
${EXTENSIONS_DIR}/base_problems/CahnHilliard.cc
# ${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_Chorin.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood_RB.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Base.cc
# ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc)
list(APPEND COMPILEFLAGS "-DHAVE_BASE_PROBLEMS=1")
SET(EXTENSIONS_SRC
${EXTENSIONS_DIR}/Helpers.cc
${EXTENSIONS_DIR}/BackgroundMesh.cc
${EXTENSIONS_DIR}/GeometryTools.cc
${EXTENSIONS_DIR}/POperators.cc
${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp)
list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1")
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR})
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/time)
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/nanoflann)
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/pugixml/src)
add_library(extensions SHARED ${EXTENSIONS_SRC})
list(APPEND AMDIS_LIBS extensions)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/)
list(APPEND deb_add_dirs "include/amdis/extensions")
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/time/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/time/)
list(APPEND deb_add_dirs "include/amdis/extensions/time")
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/nanoflann/*.hpp")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/nanoflann/)
list(APPEND deb_add_dirs "include/amdis/extensions/nanoflann")
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/pugixml/src/*.hpp")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/pugixml/)
list(APPEND deb_add_dirs "include/amdis/extensions/pugixml")
install(TARGETS extensions
LIBRARY DESTINATION lib/amdis/ )
# === baseProblems ====================================================================
if(ENABLE_BASE_PROBLEMS)
SET(BASE_PROBLEMS_SRC
${EXTENSIONS_DIR}/base_problems/CahnHilliard.cc
# ${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_Chorin.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood_RB.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Base.cc
# ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
# ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc)
list(APPEND COMPILEFLAGS "-DHAVE_BASE_PROBLEMS=1")
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/base_problems)
add_library(base_problems SHARED ${BASE_PROBLEMS_SRC})
list(APPEND AMDIS_LIBS base_problems)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/base_problems/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/base_problems/)
list(APPEND deb_add_dirs "include/amdis/base_problems")
install(TARGETS base_problems
LIBRARY DESTINATION lib/amdis/ )
endif(ENABLE_BASE_PROBLEMS)
endif(ENABLE_BASE_PROBLEMS)
endif()
endif()
endif(ENABLE_EXTENSIONS)
......@@ -401,13 +460,6 @@ list(APPEND AMDIS_INCLUDE_DIRS ${MTL_INCLUDE_DIR})
#include_directories(${MTL_INCLUDE_DIR})
list(APPEND AMDIS_INCLUDE_DIRS ${SOURCE_DIR})
if(ENABLE_EXTENSIONS)
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR})
if(ENABLE_BASE_PROBLEMS)
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/base_problems)
endif(ENABLE_BASE_PROBLEMS)
endif(ENABLE_EXTENSIONS)
#include_directories(${SOURCE_DIR})
include_directories(${AMDIS_INCLUDE_DIRS})
......@@ -416,22 +468,9 @@ add_library(compositeFEM SHARED ${COMPOSITE_FEM_SRC})
add_library(reinit SHARED ${REINIT_SRC})
add_library(muparser SHARED ${MUPARSER_SRC})
if(ENABLE_EXTENSIONS)
add_library(extensions SHARED ${EXTENSIONS_SRC})
if(ENABLE_BASE_PROBLEMS)
add_library(base_problems SHARED ${BASE_PROBLEMS_SRC})
endif(ENABLE_BASE_PROBLEMS)
endif(ENABLE_EXTENSIONS)
#target_link_libraries(compositeFEM amdis)
#target_link_libraries(reinit amdis)
list(APPEND AMDIS_LIBS amdis ${Boost_LIBRARIES})
if(ENABLE_EXTENSIONS)
list(APPEND AMDIS_LIBS extensions)
if(ENABLE_BASE_PROBLEMS)
list(APPEND AMDIS_LIBS base_problems)
endif(ENABLE_BASE_PROBLEMS)
endif(ENABLE_EXTENSIONS)
if(WIN32)
list(APPEND COMPILEFLAGS "-D_SCL_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_WARNINGS")
......@@ -489,52 +528,6 @@ FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/io)
# ========== (begin) extensions ==========================
if (ENABLE_EXTENSIONS)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/)
list(APPEND deb_add_dirs "include/amdis/extensions")
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/time/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/time/)
list(APPEND deb_add_dirs "include/amdis/extensions/time")
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/nanoflann/*.hpp")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/nanoflann/)
list(APPEND deb_add_dirs "include/amdis/extensions/nanoflann")
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/pugixml/src/*.hpp")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/extensions/pugixml/)
list(APPEND deb_add_dirs "include/amdis/extensions/pugixml")
if(ENABLE_BASE_PROBLEMS)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/base_problems/)
FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.hh")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/base_problems/)
list(APPEND deb_add_dirs "include/amdis/base_problems")
endif(ENABLE_BASE_PROBLEMS)
endif(ENABLE_EXTENSIONS)
# ========== (end) extensions ==========================
FILE(GLOB HEADERS "${REINIT_SOURCE_DIR}/*.h")
INSTALL(FILES ${HEADERS}
DESTINATION include/amdis/reinit)
......@@ -554,17 +547,6 @@ list(APPEND deb_add_dirs "lib/amdis")
install(TARGETS amdis compositeFEM reinit muparser
LIBRARY DESTINATION lib/amdis/ )
if (ENABLE_EXTENSIONS)
list(APPEND deb_add_dirs "lib/amdis/extensions")
install(TARGETS extensions
LIBRARY DESTINATION lib/amdis/extensions/ )
if(ENABLE_BASE_PROBLEMS)
list(APPEND deb_add_dirs "lib/amdis/extensions/base_problems")
install(TARGETS base_problems
LIBRARY DESTINATION lib/amdis/base_problems/ )
endif(ENABLE_BASE_PROBLEMS)
endif(ENABLE_EXTENSIONS)
configure_file(${AMDIS_SOURCE_DIR}/AMDISConfig.cmake.in
${AMDIS_BINARY_DIR}/AMDISConfig.cmake
@ONLY
......
......@@ -6,6 +6,7 @@
#include "AMDiS.h"
#include "time/RosenbrockStationary.h"
#include "CouplingTimeInterface.h"
#include "VtuReader.h"
using namespace AMDiS;
......@@ -41,7 +42,7 @@ public:
fillBoundaryConditions();
};
/// read solution DOFVectors from .arh or .dat files
/// read solution DOFVectors from .arh, .dat or .vtu files
virtual Flag initDataFromFile(AdaptInfo *adaptInfo);
/// calls \ref initDataFromFile
......
......@@ -39,28 +39,28 @@ Flag BaseProblem<ProblemType>::initDataFromFile(AdaptInfo *adaptInfo)
Initfile::get(name + "->read data from file", readDataFromFile, 2);
if (!readDataFromFile)
return initFlag;
Initfile::get(name + "->read arh files", readArhFiles, 2);
Initfile::get(name + "->read dat files", readDatFiles, 2);
if (readArhFiles && readDatFiles) {
WARNING("You can not read data from both formats, .arh and .dat! The .arh-format is selected.\n");
}
std::string data_file="", phase_file="";
std::string readFormat = "arh";
Initfile::get(name + "->read format", readFormat, 2);
if (readFormat != "arh" && readFormat != "dat" && readFormat != "vtu") {
WARNING("You can not read data from formats other than .arh, .dat or .vtu! The .arh-format is selected.\n");
}
// read data and mesh from arh-files/dat-files
MSG("read data from file...\n");
if (readArhFiles) {
Initfile::get(name + "->data file", data_file);
if (data_file.size() == 0) return initFlag;
if (!file_exists(data_file))
throw(std::runtime_error("The file '" + data_file + "' does not exist!"));
if (readFormat == "arh") {
std::string filename = "";
Initfile::get(name + "->value file", filename);
if (filename.size() == 0) return initFlag;
if (!file_exists(filename))
throw(std::runtime_error("The file '" + filename + "' does not exist!"));
std::vector<DOFVector<double>*> solutions;
for (size_t i = 0; i < prob->getNumComponents(); i++)
solutions.push_back(prob->getSolution()->getDOFVector(i));
ArhReader::read(data_file, prob->getMesh(), solutions);
} else if(readDatFiles) {
ArhReader::read(filename, prob->getMesh(), solutions);
}
else if (readFormat == "dat") {
bool preserveMacroFileInfo = false;
Parameters::get(prob->getMesh()->getName() + "->preserve macroFileInfo", preserveMacroFileInfo);
if (prob->getMesh()->getMacroFileInfo() == NULL || !preserveMacroFileInfo)
......@@ -73,8 +73,40 @@ Flag BaseProblem<ProblemType>::initDataFromFile(AdaptInfo *adaptInfo)
throw(std::runtime_error("The file '" + filename + "'does not exist!"));
ValueReader::readValue(filename,prob->getMesh(),prob->getSolution()->getDOFVector(i),prob->getMesh()->getMacroFileInfo());
}
} else
throw(std::runtime_error("Parameter 'read data from file' set to 'true', but no input format specified!"));
}
else if (readFormat == "vtu") {
std::vector<std::string> filenames;
Initfile::get(name + "->value file", filenames);
if (filenames.size() == 0)
return initFlag;
int arh_idx = -1, vtu_idx = -1;
for (size_t i = 0; i < filenames.size(); i++) {
if (!file_exists(filenames[i]))
throw(std::runtime_error("The file '" + filenames[i] + "' does not exist!"));
if (filenames[i].find(".vtu") != std::string::npos)
vtu_idx = i;
else if (filenames[i].find(".arh") != std::string::npos)
arh_idx = i;
else
throw(std::runtime_error("The file '" + filenames[i] + "' must have the extension .arh or .vtu!"));
}
if (arh_idx >= 0) {
ArhReader::read(filenames[arh_idx], prob->getMesh());
}
if (vtu_idx >= 0) {
std::vector<DOFVector<double>*> solutions;
std::vector<std::string> names;
for (size_t i = 0; i < prob->getNumComponents(); i++) {
solutions.push_back(prob->getSolution()->getDOFVector(i));
names.push_back(prob->getComponentName(i));
}
VtuReader::readValue(filenames[vtu_idx], prob->getMesh(), solutions, names);
} else
throw(std::runtime_error("You have to specify a .vtu file!"));
}
else {
throw(std::runtime_error("Parameter 'read data from file' set to 'true', but no parameter 'read format' specified!"));
}
initFlag.setFlag(DATA_ADOPTED);
initFlag.setFlag(MESH_ADOPTED);
......
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