diff --git a/.github/workflows/build-openvdb.yml b/.github/workflows/build-openvdb.yml
deleted file mode 100644
index df1bc13..0000000
--- a/.github/workflows/build-openvdb.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: OpenVDB module
-
-on:
- push:
- branches: [ "master", "develop" ]
- pull_request:
- branches: [ "master", "develop" ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
- - name: Install dependencies
- run: sudo apt install -y build-essential cmake libglm-dev libtclap-dev libboost-all-dev libopenvdb-dev libtbb-dev libcppunit-dev libeigen3-dev wget liblzma-dev zlib1g-dev libbz2-dev
- - name: Get sources OpenVDB 8.2
- run: wget https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v8.2.0.tar.gz && tar -xvzf v8.2.0.tar.gz
- - name: Compile and install OpenVDB 8.02
- run: mkdir openvdb-build && cd openvdb-build && cmake ../openvdb-8.2.0 -DCMAKE_INSTALL_PREFIX=/opt/openvdb && make -j3 && sudo make install
- - name: Configure CMake
- run: mkdir build && cd build && cmake -DMOD_OPENVDB=1 ../src
- - name: Build
- run: cd build && make -j3
- - name: Perform unit tests
- run: cd build && make test
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 71cf495..20c5fd4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,52 +8,86 @@ on:
jobs:
build:
-
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
- - name: Install dependencies
- run: sudo apt install -y build-essential cmake libglm-dev libtclap-dev libboost-all-dev libopenvdb-dev libtbb-dev libcppunit-dev libeigen3-dev liblzma-dev zlib1g-dev libbz2-dev gcovr
- - name: Configure CMake
- run: mkdir build && cd build && cmake ../src -DUSE_GCOV=1
- - name: Build
- run: cd build && make -j
- - name: Perform unit tests
- run: cd build && make test
- - name: Perform code coverage
- run: |
- cd build
- gcovr -r ../ . --xml-pretty -e ".*\.h" > coverage.xml
- gcovr -r ../ . --html -e ".*\.h" > report.html
- - name: Upload coverage report
- uses: actions/upload-artifact@v4
- with:
- name: code-coverage-report
- path: ./build/report.html
- - name: Upload coverage reports to Codecov
- uses: codecov/codecov-action@v3
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- files: ./build/coverage.xml
-
- test-shared:
+ - uses: actions/checkout@v4
+ - name: Install dependencies
+ run: |
+ sudo apt update
+ sudo apt install -y \
+ build-essential \
+ cmake \
+ libglm-dev \
+ libtclap-dev \
+ libboost-all-dev \
+ libopenvdb-dev \
+ libtbb-dev \
+ libcppunit-dev \
+ libeigen3-dev \
+ liblzma-dev \
+ zlib1g-dev \
+ libbz2-dev \
+ libzstd-dev \
+ libblosc-dev \
+ pkg-config \
+ gcovr
+ - name: Configure CMake
+ run: cmake -S src -B build -DUSE_GCOV=ON
+ - name: Build
+ run: cmake --build build --parallel
+ - name: Run unit tests
+ run: ctest --test-dir build --output-on-failure
+ - name: Collect coverage report
+ run: |
+ gcovr -r . build --xml-pretty -e ".*\\.h" > build/coverage.xml
+ gcovr -r . build --html -e ".*\\.h" > build/report.html
+ - name: Upload coverage report
+ uses: actions/upload-artifact@v4
+ with:
+ name: code-coverage-report
+ path: ./build/report.html
+ - name: Upload coverage reports to Codecov
+ uses: codecov/codecov-action@v4
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: ./build/coverage.xml
+ test-shared:
runs-on: ubuntu-latest
needs: build
steps:
- - uses: actions/checkout@v3
- - name: Install dependencies
- run: sudo apt install -y build-essential cmake libglm-dev libtclap-dev libboost-all-dev libopenvdb-dev libtbb-dev libcppunit-dev libeigen3-dev liblzma-dev zlib1g-dev libbz2-dev gcovr
- - name: Configure CMake
- run: mkdir build && cd build && cmake ../src
- - name: Build
- run: cd build && make -j && sudo make install
- - name: Produce compilation using shared library
- run: |
- cd examples && mkdir build && cd build
- cmake ../shared
- make -j
- ldd ./den2obj-shared-example
- LD_LIBRARY_PATH=/usr/local/lib ./den2obj-shared-example
+ - uses: actions/checkout@v4
+ - name: Install dependencies
+ run: |
+ sudo apt update
+ sudo apt install -y \
+ build-essential \
+ cmake \
+ libglm-dev \
+ libtclap-dev \
+ libboost-all-dev \
+ libopenvdb-dev \
+ libtbb-dev \
+ libcppunit-dev \
+ libeigen3-dev \
+ liblzma-dev \
+ zlib1g-dev \
+ libbz2-dev \
+ libzstd-dev \
+ libblosc-dev \
+ pkg-config \
+ gcovr
+ - name: Configure CMake
+ run: cmake -S src -B build
+ - name: Build and install
+ run: |
+ cmake --build build --parallel
+ sudo cmake --install build
+ - name: Produce compilation using shared library
+ run: |
+ cmake -S examples/shared -B examples/shared/build
+ cmake --build examples/shared/build --parallel
+ ldd examples/shared/build/den2obj-shared-example
+ LD_LIBRARY_PATH=/usr/local/lib ./examples/shared/build/den2obj-shared-example
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 15cee1a..236c574 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -9,21 +9,27 @@ on:
- master
permissions:
- contents: write # Grants write access to the repository contents
+ contents: read
+ pages: write
+ id-token: write
+
+concurrency:
+ group: pages
+ cancel-in-progress: false
jobs:
build:
- name: Build and Deploy Sphinx Documentation
+ name: Build Sphinx Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Set up Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
- python-version: 3.13.1
+ python-version: "3.13"
- name: Install Dependencies
run: |
@@ -34,13 +40,33 @@ jobs:
sphinx_design \
sphinx_subfigure \
myst_parser
+
- name: Build Documentation
run: |
cd docs
make html
- - name: Deploy to GitHub Pages
- uses: peaceiris/actions-gh-pages@v3
+ - name: Configure GitHub Pages
+ if: github.event_name == 'push'
+ uses: actions/configure-pages@v5
+
+ - name: Upload GitHub Pages artifact
+ if: github.event_name == 'push'
+ uses: actions/upload-pages-artifact@v3
with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: docs/_build/html
\ No newline at end of file
+ path: docs/_build/html
+
+ deploy:
+ name: Deploy GitHub Pages
+ if: github.event_name == 'push'
+ needs: build
+ runs-on: ubuntu-latest
+
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/.gitignore b/.gitignore
index 876e008..6ba8496 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,7 +27,7 @@
*.out
*.app
-build/*
+build*/*
CHGCAR*
*.png
src/config.h
diff --git a/README.md b/README.md
index 482bf68..7b9518a 100644
--- a/README.md
+++ b/README.md
@@ -8,121 +8,223 @@
[](https://www.gnu.org/licenses/gpl-3.0)
## Purpose
-Den2Obj is a command-line tool that construct isosurfaces from densely packed
-scalar fields. Den2Obj supports VASP charge files such as CHGCAR and PARCHG,
-Gaussian .cube files as well as its own .d2o format.
+
+Den2Obj is a command-line tool for computational chemists and materials
+scientists who want to visualize volumetric scalar fields from ab initio
+calculations as 3D isosurface meshes.
+
+It reads scalar field data produced by [VASP](https://www.vasp.at/) (CHGCAR,
+PARCHG, LOCPOT) and [Gaussian](https://gaussian.com/) (`.cub`) and extracts
+isosurfaces using the marching cubes or marching tetrahedra algorithm. The
+resulting surfaces — representing quantities such as electron density, partial
+charge density, or electrostatic potential — are written to standard 3D mesh
+formats (`.obj`, `.ply`, `.stl`) that can be directly imported into tools like
+Blender or MeshLab for high-quality rendering.
+
+Den2Obj also supports format conversion: VASP and Gaussian files can be
+converted to the native `.d2o` compressed binary format or to OpenVDB (`.vdb`)
+for volumetric rendering workflows. When writing `.d2o`, Den2Obj benchmarks all
+supported compression algorithms (gzip, lzma, bzip2, zstd, blosc) and
+automatically selects the one that produces the smallest file, so no manual
+tuning is needed.
## Example images
+

+## Quick start
+
+No VASP or Gaussian files needed. Den2Obj ships with built-in datasets so you
+can try it immediately after compiling:
+
+```bash
+# Generate a built-in scalar field and extract an isosurface from it
+./den2obj -g genus2 -o genus2.d2o
+./den2obj -i genus2.d2o -o genus2.obj -v 0.5
+```
+
+The first command writes the `genus2` dataset to a `.d2o` file. The second
+extracts an isosurface at isovalue 0.5 and writes a Wavefront `.obj` mesh that
+can be opened directly in Blender or MeshLab. See
+[Built-in datasets](#built-in-dataset-generation) for the full list.
+
## Compilation instructions
-### Debian Latest
+### Debian-based systems (Ubuntu, Debian)
-Getting the dependencies
+Tested on Ubuntu 24.04 LTS (Noble) and Debian 12 (Bookworm). Install the
+dependencies:
```bash
-sudo apt install build-essential cmake libtclap-dev libboost-all-dev libopenvdb-dev libtbb-dev \
-pkg-config libcppunit-dev libeigen3-dev liblzma-dev zlib1g-dev libbz2-dev libssl-dev
+sudo apt install build-essential cmake libtclap-dev libboost-all-dev \
+libopenvdb-dev libtbb-dev pkg-config libcppunit-dev libeigen3-dev liblzma-dev \
+zlib1g-dev libbz2-dev libzstd-dev libblosc-dev
```
-To compile, run the following commands:
+Compile:
```bash
git clone https://github.com/ifilot/den2obj.git
cd den2obj
-mkdir build
-cd build
+mkdir build && cd build
cmake -DMOD_OPENVDB=1 ../src
make -j5
```
-### Ubuntu Latest
-The stable OpenVDB library (`libopenvdb`) under Ubuntu is incompatible with the
-Threading Building Blocks (`libtbb`) library. To solve this, manually compile
-and install OpenVDB 8.2 using the following instructions.
+## Usage
+
+### Isosurfaces
-Getting the dependencies
+Reads a scalar field from `` and extracts a surface at the given
+isovalue, writing a 3D mesh to `