Skip to content

Commit

Permalink
Added download links in tutorial.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtav committed Feb 21, 2021
1 parent c067d66 commit 29243c0
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 3 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include README.rst
include requirements.txt
include h5utils/data/*.h5
include h5utils/data/*.ctl
25 changes: 22 additions & 3 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Tutorial
========

Using h5tovts to visualize geometry defined in MPB:
===================================================
.. Using h5tovts to visualize geometry defined in MPB:
.. ===================================================
This tutorial will show you how to use MPB to generate .h5 files, convert them to .vts and then view them using paraview.

Expand All @@ -12,4 +12,23 @@ Instructions for installing MPB can be found here: https://mpb.readthedocs.io/en
Paraview can be downloaded and installed from here: https://www.paraview.org/

.. note::
You can also find the corresponding .h5 file in `h5utils/data/lattice-non-cartesian-epsilon.h5`.
You can also find the corresponding .h5 file in :download:`h5utils/data/lattice-non-cartesian-epsilon.h5 <../h5utils/data/lattice-non-cartesian-epsilon.h5>`.

Define the geometry
===================

Create (or download) :download:`lattice-visualization.ctl <../h5utils/data/lattice-visualization.ctl>` with the following contents:

.. `h5utils/data/lattice-visualization.ctl`
.. Example code::
.. .. literalinclude:: conf.py
.. :language: python
..
.. .. literalinclude:: ../setup.py
.. :language: python
.. literalinclude:: ../h5utils/data/lattice-visualization.ctl
:language: scheme
.. .. include:: ../h5utils/data/lattice-visualization.ctl
72 changes: 72 additions & 0 deletions h5utils/data/lattice-visualization.ctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
(set! resolution 50)

(set! geometry (list
(make cylinder
(axis 1 0 0)
(center 0 -0.5 -0.5)
(height 1)
(radius 0.25)
(material (make dielectric (epsilon 2)) )
)
(make cylinder
(axis 0 1 0)
(center -0.5 0 -0.5)
(height 1)
(radius 0.25)
(material (make dielectric (epsilon 3)) )
)
(make cylinder
(axis 0 0 1)
(center -0.5 -0.5 0)
(height 1)
(radius 0.25)
(material (make dielectric (epsilon 4)) )
)
))

(set! filename-prefix "lattice-cartesian-")
(run)

(define a1 (vector3 0 2 3))
(define a2 (vector3 1 0 3))
(define a3 (vector3 1 2 0))

(define L1 (/ (vector3-norm a1) 2))
(define L2 (/ (vector3-norm a2) 2))
(define L3 (/ (vector3-norm a3) 2))

(set! geometry-lattice
(make lattice
(basis1 a1)
(basis2 a2)
(basis3 a3)
(basis-size L1 L2 L3)
)
)

(set! geometry (list
(make cylinder
(axis 1 0 0)
(center 0 -0.5 -0.5)
(height L1)
(radius 0.25)
(material (make dielectric (epsilon 2)) )
)
(make cylinder
(axis 0 1 0)
(center -0.5 0 -0.5)
(height L2)
(radius 0.25)
(material (make dielectric (epsilon 3)) )
)
(make cylinder
(axis 0 0 1)
(center -0.5 -0.5 0)
(height L3)
(radius 0.25)
(material (make dielectric (epsilon 4)) )
)
))

(set! filename-prefix "lattice-non-cartesian-")
(run)

0 comments on commit 29243c0

Please sign in to comment.