diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 17be058..50e059c 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -103,7 +103,7 @@ the drop-down menu as follows:: Select the file and click on ``Import PLY``. You should now see something similar as to the image below. -.. figure:: _static/img/tutorials/genus2_blender_01.jpg +.. figure:: _static/img/tutorials/genus2_blender_01.JPG :alt: The imported Genus 2 isosurface in Blender. Finally, we assign a material to the object, tune the camera to bring the @@ -111,7 +111,7 @@ object fully into view, set the color of the background to black, add two sun-type light sources and set the film to transparent. For the material, we have used the settings as can be seen in the figure below. -.. figure:: _static/img/tutorials/genus2_blender_02.jpg +.. figure:: _static/img/tutorials/genus2_blender_02.JPG :alt: The imported Genus 2 isosurface in Blender. The only step that remains is to render the image, which will give the image @@ -174,7 +174,7 @@ Observe that two isosurfaces are created and stored as ``.ply`` files: Importing these two files in Blender gives us the following result -.. figure:: _static/img/tutorials/benzene_homo_blender_01.JPG +.. figure:: _static/img/tutorials/benzene_homo_blender_01.jpg :alt: HOMO orbital of benzene imported into Blender Of course, this result is rather blend and we would like to add @@ -253,7 +253,7 @@ This will generate all the atoms and bonds between them. Next, materials are assigned to all atoms and bonds and the final result looks as seen in the image below. -.. figure:: _static/img/tutorials/benzene_homo_blender_02.JPG +.. figure:: _static/img/tutorials/benzene_homo_blender_02.jpg :alt: HOMO orbital of benzene together with the atoms and bonds Finally, we can render the scene to create a nice picture of the molecular orbital. diff --git a/img/comparison_mc_mt.jpg b/img/comparison_mc_mt.jpg new file mode 100644 index 0000000..58aa4f4 Binary files /dev/null and b/img/comparison_mc_mt.jpg differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 641f31c..28981a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,7 +52,7 @@ execute_process( SET(PROGNAME "DEN2OBJ") SET(VERSION_MAJOR "1") SET(VERSION_MINOR "2") -SET(VERSION_MICRO "0") +SET(VERSION_MICRO "1") message(STATUS "Writing configuration file in: ${CMAKE_CURRENT_SOURCE_DIR}/config.h") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/den2obj.pc.in ${CMAKE_BINARY_DIR}/den2obj.pc @ONLY) diff --git a/src/den2obj.cpp b/src/den2obj.cpp index 646b21e..f0fc93a 100644 --- a/src/den2obj.cpp +++ b/src/den2obj.cpp @@ -62,8 +62,8 @@ int main(int argc, char* argv[]) { TCLAP::ValueArg arg_generator("g","dataset","Dataset name",false,"","string"); cmd.add(arg_generator); - // select compression algorithm - TCLAP::ValueArg arg_algo("a","algo","Compression algorithm",false,"","string"); + // select algorithm for either compression or for tesselation + TCLAP::ValueArg arg_algo("a","algo","Algorithm selection",false,"","string"); cmd.add(arg_algo); cmd.parse(argc, argv); @@ -237,7 +237,13 @@ int main(int argc, char* argv[]) { output_filename = stem.string().substr(0,stem.string().size()-4) + "_neg" + ext.string(); IsoSurface is_neg(sf.get()); - is_neg.marching_cubes(-isovalue); + if(arg_algo.getValue().empty() || arg_algo.getValue() == "marching-cubes") { + is_neg.marching_cubes(-isovalue); + } else if(arg_algo.getValue() == "marching-tetrahedra") { + is_neg.marching_tetrahedra(-isovalue); + } else { + throw std::runtime_error("Invalid isosurface generation algo: " + arg_algo.getValue()); + } IsoSurfaceMesh ism_neg(sf.get(), &is_neg); ism_neg.construct_mesh(arg_c.getValue()); diff --git a/src/generator.cpp b/src/generator.cpp index 2c66fcd..cb874a0 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -67,7 +67,7 @@ void Generator::build_dataset(const std::string& name, mo_id = 21; } - const unsigned int npts = 150; + const unsigned int npts = 100; const fpt sz = 6.0f; std::array grid_dimensions = {npts, npts, npts}; std::vector grid = this->benzene_molecular_orbital(sz, npts, mo_id); @@ -103,11 +103,12 @@ std::vector Generator::genus2(fpt sz, size_t npts) const { // build grid std::vector f(npts*npts*npts); - #pragma omp parallel for schedule(static) for(unsigned int i=0; i Generator::genus2(fpt sz, size_t npts) const { (x*x + y*y) * (x*x + y*y) - (9*z*z - 1) * (1 - z*z); } } + ++progress; } + std::cout << std::endl; return f; } @@ -140,18 +143,21 @@ std::vector Generator::benzene_molecular_orbital(fpt sz, size_t npts, // build grid std::vector f(npts*npts*npts); - #pragma omp parallel for schedule(static) + boost::timer::progress_display progress(npts); for(unsigned int i=0; icalculate_mo_amp(Vec3(x,y,z), mo_id); } } + ++progress; } + std::cout << std::endl; return f; } diff --git a/src/generator.h b/src/generator.h index 7dd3d97..5d64ec4 100644 --- a/src/generator.h +++ b/src/generator.h @@ -23,6 +23,7 @@ #include #include +#include #include "d2o_format.h" #include "generator_benzene_data.h"