Skip to content

Commit

Permalink
Merging
Browse files Browse the repository at this point in the history
  • Loading branch information
ifilot committed Apr 17, 2024
2 parents 6e612f2 + e667eb4 commit 814ac45
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 15 deletions.
45 changes: 35 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,60 @@ name: docs

on:
push:
branches: [ "master"]
branches: [ "docs" ]
pull_request:
branches: [ "master"]
branches: [ "docs" ]

jobs:
build-docs:
runs-on: ubuntu-latest
container: ghcr.io/ifilot/sphinx:v0.9.0
steps:
- uses: actions/checkout@v3
- name: Install packages
run: sudo apt update && sudo apt install -y git build-essential curl wget python3 python3-pip texlive texlive-pictures texlive-latex-extra pdf2svg poppler-utils netpbm imagemagick ghostscript
- name: Install Python packages
run: sudo pip install sphinx sphinx-rtd-theme sphinxcontrib-tikz
- name: Build documentation
run: cd docs && make html
- name: Upload math result for job 1
- name: Upload documentation as artifact
uses: actions/upload-artifact@v3
with:
name: html-docs
path: ./docs/_build/html

deploy:
runs-on: [self-hosted, linux, x64]
runs-on: ubuntu-latest
needs: build-docs
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download docs
uses: actions/download-artifact@v3
with:
name: html-docs
path: html-docs
- name: Deploy
run: touch ${{ secrets.DEPLOY_PATH }}/html && rm -r ${{ secrets.DEPLOY_PATH }}/html/* && cp -rv html-docs/* ${{ secrets.DEPLOY_PATH }}/html

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/ifilot/den2obj-docs-nginx
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: .
file: doc.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 2 additions & 0 deletions doc.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM nginx:latest
COPY html-docs/ /usr/share/nginx/html/
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ looks as follows::
cmake ../src
make -j9

To install :program:`EDP`, you can in addition run::
To install :program:`Den2Obj`, you can in addition run::

sudo make install

Expand Down
6 changes: 3 additions & 3 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ 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
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
Expand Down Expand Up @@ -259,4 +259,4 @@ looks as seen in the image below.
Finally, we can render the scene to create a nice picture of the molecular orbital.

.. figure:: _static/img/tutorials/benzene_homo_result.png
:alt: Benzene highest occupied molecular orbital
:alt: Benzene highest occupied molecular orbital
85 changes: 85 additions & 0 deletions paper/paper.jats
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.2 20190208//EN"
"JATS-publishing1.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">
<front>
<journal-meta>
<journal-id></journal-id>
<journal-title-group>
<journal-title>Journal of Open Source Software</journal-title>
<abbrev-journal-title>JOSS</abbrev-journal-title>
</journal-title-group>
<issn publication-format="electronic">2475-9066</issn>
<publisher>
<publisher-name>Open Journals</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="publisher-id">0</article-id>
<article-id pub-id-type="doi">N/A</article-id>
<title-group>
<article-title>Den2Obj: A command line program for producing isosurfaces
from density files</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author" corresp="yes">
<contrib-id contrib-id-type="orcid">https://orcid.org/0000-0003-1403-8379</contrib-id>
<name>
<surname>Filot</surname>
<given-names>I. A. W.</given-names>
</name>
<xref ref-type="aff" rid="aff-1"/>
<xref ref-type="corresp" rid="cor-1"><sup>*</sup></xref>
</contrib>
<aff id="aff-1">
<institution-wrap>
<institution>Inorganic Materials and Catalysis, Department of Chemical
Engineering and Chemistry, Eindhoven University of Technology,
Eindhoven, The Netherlands</institution>
</institution-wrap>
</aff>
</contrib-group>
<author-notes>
<corresp id="cor-1">* E-mail: <email></email></corresp>
</author-notes>
<pub-date date-type="pub" publication-format="electronic" iso-8601-date="2024-04-10">
<day>10</day>
<month>4</month>
<year>2024</year>
</pub-date>
<volume>¿VOL?</volume>
<issue>¿ISSUE?</issue>
<fpage>¿PAGE?</fpage>
<permissions>
<copyright-statement>Authors of papers retain copyright and release the
work under a Creative Commons Attribution 4.0 International License (CC
BY 4.0)</copyright-statement>
<copyright-year>2022</copyright-year>
<copyright-holder>The article authors</copyright-holder>
<license license-type="open-access" xlink:href="https://creativecommons.org/licenses/by/4.0/">
<license-p>Authors of papers retain copyright and release the work under
a Creative Commons Attribution 4.0 International License (CC BY
4.0)</license-p>
</license>
</permissions>
</article-meta>
</front>
<body>
<sec id="summary">
<title>Summary</title>
</sec>
<sec id="statement-of-need">
<title>Statement of need</title>
</sec>
<sec id="acknowledgements">
<title>Acknowledgements</title>
<p>This work was supported by the Netherlands Center for Multiscale
Catalytic Energy Conversion, and NWO Gravitation program funded by the
Ministry of Education, Culture and Science of the government of the
Netherlands. The Netherlands Organization for Scientific Research is
acknowledged for providing access to computational resources.</p>
</sec>
</body>
<back>
</back>
</article>
65 changes: 65 additions & 0 deletions scripts/genus2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
<<<<<<< HEAD
# -*- coding: utf-8 -*-

#
# Generate the "genus-2" scalar field. The function has
# been taken from: https://doi.org/10.1109/3DV.2015.36
#

import numpy as np
import gzip

def main():
dim = 2
grid = generate_grid(dim = dim)
store_d2o(grid,dim)

def store_d2o(grid, dim):
"""
Store Genus2 scalar field as a d2o file. See
https://den2obj.imc-tue.nl/d2o_fileformat.html
for the specifications of the d2o file type.
"""
f = open('genus2.d2o', 'wb')

# write header
f.write('D2O'.encode('utf-8'))

# write protocol identifier
f.write(np.uint32(1).tobytes())

# write unit cell matrix
unitcell = np.diag(np.ones(3, dtype=np.float32) * dim * 2)
f.write(unitcell.flatten().tobytes())

# write grid dimensions
f.write(np.array(grid.shape, dtype=np.uint32).tobytes())

# write floating point bytesize
f.write(np.uint8(4).tobytes())

# write data stream
compressed_data = gzip.compress(np.array(grid.flatten(), dtype=np.float32).tobytes(),
compresslevel=9)
f.write(np.uint64(len(compressed_data)).tobytes())
f.write(compressed_data)

f.close()

def generate_grid(dim = 2, npts = 100):
x = np.linspace(-dim, dim, npts)
y = np.linspace(-dim, dim, npts)
z = np.linspace(-dim, dim, npts)

xx, yy, zz = np.meshgrid(x, y, z, indexing='ij')

return genus2(xx,yy,zz)

def genus2(x,y,z):
F = 2*y*(y**2 - 3*x**2) * (1 - z**2) + \
(x**2 + y**2)**2 - (9*z**2 - 1) * (1 - z**2)
return F

if __name__ == '__main__':
=======
# -*- coding: utf-8 -*-

#
Expand Down Expand Up @@ -60,4 +124,5 @@ def genus2(x,y,z):
return F

if __name__ == '__main__':
>>>>>>> master
main()
3 changes: 2 additions & 1 deletion src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
add_library(unittest STATIC unittest.cpp)

# set executables
SET(EXECUTABLES TestIsosurface TestScalarField TestD2OFileFormat)
SET(EXECUTABLES TestIsosurface TestScalarField TestD2OFileFormat TestGenerator)

# only add this test when not using GCOV
if(NOT USE_GCOV)
Expand All @@ -39,6 +39,7 @@ endif()
add_executable(TestIsosurface test_isosurface.cpp)
add_executable(TestScalarField test_scalarfield.cpp)
add_executable(TestD2OFileFormat test_d2o_fileformat.cpp)
add_executable(TestGenerator test_generator.cpp)

# only add this test when not using GCOV
if(NOT USE_GCOV)
Expand Down
1 change: 1 addition & 0 deletions src/test/test_d2o_fileformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TestD2OFileFormat : public CppUnit::TestFixture

public:
void setUp();

void tearDown();

void test_gzip_compression();
Expand Down

0 comments on commit 814ac45

Please sign in to comment.