Commit 60cb3c5a authored by Christof Metzger-Kraus's avatar Christof Metzger-Kraus
Browse files

background color in export to web can be chosen

parent 869d877e
......@@ -65,7 +65,7 @@ set (BOOSTROOT $ENV{BOOST_DIR})
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED OFF)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package (Boost 1.55.0 REQUIRED COMPONENTS filesystem system iostreams regex)
find_package (Boost 1.54.0 REQUIRED COMPONENTS filesystem system iostreams regex)
if (Boost_INCLUDE_DIRS)
message (STATUS "Found boost include dir: ${Boost_INCLUDE_DIR}")
message (STATUS "Found boost library dir: ${Boost_LIBRARY_DIR}")
......@@ -124,21 +124,21 @@ ENDIF (USE_H5HUT2)
IF (ENABLE_AMR)
MESSAGE (STATUS "Enable AMR_SOLVER " ${ENABLE_AMR})
ENABLE_LANGUAGE (Fortran)
find_package (AMReX CONFIG REQUIRED HINTS $ENV{AMREX_HOME}/cmake $ENV{AMREX_DIR}/cmake $ENV{AMREX_PREFIX}/cmake)
MESSAGE (STATUS "Found AMReX include dir: ${AMREX_INCLUDE_DIR}")
MESSAGE (STATUS "Found AMReX library dir: ${AMREX_LIBRARY_DIR}")
MESSAGE (STATUS "Found AMReX libraries: ${AMREX_LIBRARIES}")
MESSAGE (STATUS "AMReX built with: ${AMREX_DEFINES}")
# We need to replace the quotes of the AMREX_GIT_VERSION flag in AMREX_DEFINES
# otherwise IpplVersions.h complains
STRING(REPLACE "\"" "'" AMREX_DEFINES ${AMREX_DEFINES})
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_AMR ${AMREX_DEFINES}")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -Wno-unused-but-set-variable -Wno-maybe-uninitialized")
ENDIF (ENABLE_AMR)
# remove digits from hostname: edison03 -> edison
......
......@@ -52,7 +52,7 @@ set (BOOSTROOT $ENV{BOOST_DIR})
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED OFF)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package (Boost 1.55.0 REQUIRED COMPONENTS regex filesystem system)
find_package (Boost 1.54.0 REQUIRED COMPONENTS regex filesystem system)
if (Boost_INCLUDE_DIRS)
message (STATUS "Found boost include dir: ${Boost_INCLUDE_DIR}")
message (STATUS "Found boost library dir: ${Boost_LIBRARY_DIR}")
......@@ -97,15 +97,15 @@ OPTION (NO_FIELD_ASSIGN_OPTIMIZATION "Disable compiler optimization of IPPL fiel
IF (ENABLE_AMR)
MESSAGE (STATUS "Enable AMR_SOLVER " ${ENABLE_AMR})
ENABLE_LANGUAGE (Fortran)
find_package (AMReX CONFIG REQUIRED HINTS $ENV{AMREX_HOME}/cmake $ENV{AMREX_DIR}/cmake $ENV{AMREX_PREFIX}/cmake)
MESSAGE (STATUS "Found AMReX include dir: ${AMREX_INCLUDE_DIR}")
MESSAGE (STATUS "Found AMReX library dir: ${AMREX_LIBRARY_DIR}")
MESSAGE (STATUS "Found AMReX libraries: ${AMREX_LIBRARIES}")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_AMR")
ENDIF (ENABLE_AMR)
if (ENABLE_SAAMG_SOLVER)
......@@ -339,4 +339,4 @@ IF (LINUXGCC)
RENAME ${PROJECT_NAME}Config.cmake
)
ENDIF (NOT IPPL_USED_FROM_OPAL)
ENDIF (NOT IPPL_USED_FROM_OPAL)
\ No newline at end of file
......@@ -49,7 +49,7 @@ set(Boost_USE_STATIC_LIBS ON)
set(BOOST_NO_SYSTEM_PATHS TRUE)
set(BOOST_INCLUDEDIR $ENV{BOOST_HOME})
set(BOOST_LIBRARYDIR $ENV{BOOST_HOME}}/lib)
find_package (Boost 1.55.0 REQUIRED chrono filesystem regex serialization system iostreams)
find_package (Boost 1.54.0 REQUIRED chrono filesystem regex serialization system iostreams)
if (Boost_INCLUDE_DIRS)
message (STATUS "Boost include dirs: ${Boost_INCLUDE_DIRS}")
include_directories (${Boost_INCLUDE_DIRS})
......
......@@ -400,7 +400,7 @@ void MeshGenerator::write(const std::string &fname) {
out << indent << " tri_vertices[2][2] - tri_vertices[0][2]]\n";
out << indent << "return normalize(cross(vec1,vec2))\n\n";
out << "def exportWeb():\n";
out << "def exportWeb(bgcolor):\n";
// out << indent << "if not os.path.exists('scenes'):\n";
// out << indent << indent << "os.makedirs('scenes')\n";
// out << indent << "fh = open('scenes/" << fname << "_ElementPositions.babylon','w')\n";
......@@ -508,6 +508,9 @@ void MeshGenerator::write(const std::string &fname) {
out << indent << "index_compressed = base64.b64decode(index_base64)\n";
out << indent << "index = str(zlib.decompress(index_compressed))\n";
out << indent << "if (len(bgcolor) == 3):\n";
out << indent << indent << "mesh += \";\\n \"\n";
out << indent << indent << "mesh += \"scene.clearColor = new BABYLON.Color3(%f, %f, %f)\" % (bgcolor[0], bgcolor[1], bgcolor[2])\n\n";
out << indent << "index = index.replace('##DATA##', mesh)\n";
out << indent << "fh = open('" << fname << "_ElementPositions.html','w')\n";
out << indent << "fh.write(index)\n";
......@@ -836,14 +839,25 @@ void MeshGenerator::write(const std::string &fname) {
out << "parser = argparse.ArgumentParser()\n";
out << "parser.add_argument('--export-vtk', action='store_true')\n";
out << "parser.add_argument('--export-web', action='store_true')\n";
out << "parser.add_argument('--project-to-plane', nargs=3, type=float)\n";
out << "parser.add_argument('--project-to-plane', action='store_true')\n";
out << "parser.add_argument('--normal', nargs=3, type=float)\n";
out << "parser.add_argument('--background', nargs=3, type=float)\n";
out << "args = parser.parse_args()\n\n";
out << "if (args.export_vtk):\n";
out << indent << "exportVTK()\n\n";
out << "if (args.export_web):\n";
out << indent << "exportWeb()\n\n";
out << indent << "bgcolor = []\n";
out << indent << "if (args.background):\n";
out << indent << indent << "validBackground = True\n";
out << indent << indent << "for comp in bgcolor:\n";
out << indent << indent << indent << "if comp < 0.0 or comp > 1.0:\n";
out << indent << indent << indent << indent << "validBackground = False\n";
out << indent << indent << indent << indent << "break\n";
out << indent << indent << "if (validBackground):\n";
out << indent << indent << indent << "bgcolor = args.background\n";
out << indent << "exportWeb(bgcolor)\n\n";
out << "if (args.project_to_plane):\n";
out << indent << "projectToPlane(args.project_to_plane)";
......
......@@ -229,9 +229,15 @@ void H5PartWrapper::copyFile(const std::string &sourceFile, int lastStep, h5_int
numSteps_m = numStepsInSource;
} else {
copyHeader(source);
if (lastStep < 0) {
if (-lastStep > numStepsInSource) {
lastStep = 0;
} else {
lastStep = numStepsInSource + lastStep;
}
}
// don't copy the whole file, it takes very long
copyStep(source, lastStep);
++ numSteps_m;
......
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