Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
smartalecH committed Aug 9, 2022
2 parents 35ec6d8 + 9793cf5 commit c88ca4a
Show file tree
Hide file tree
Showing 304 changed files with 29,666 additions and 17,020 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ tests/* linguist-documentation
scheme/examples/* linguist-documentation
python/numpy.i linguist-vendored
src/support/mt19937ar.c linguist-vendored
src/support/meep_mt.h linguist-language=C++
src/support/meep_mt.h linguist-language=C++
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/" # Location of package manifests
schedule:
interval: "daily"

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
10 changes: 5 additions & 5 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: CI
name: run tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
push:
schedule:
- cron: 0 2 * * * # run at 2 AM UTC
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
- name: Upload coverage to Codecov
if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.7 }}
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
files: ${{ github.workspace }}/python/coverage.xml

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: pre-commit

on:
pull_request:
push:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: pre-commit/action@v3.0.0
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
_build
.vscode
.idea
python/examples/.ipynb_checkpoints/
h5utils/
hdf5/
extra/
configure~

# autotools stuff
Makefile
Expand Down
112 changes: 112 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "08b4be84be2d74173246b7c9b6c22212a6c15a2d"
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

# - repo: https://github.com/hakancelik96/unimport
# rev: df8eb1a4c91acb84da197828af8157708968b596
# hooks:
# - id: unimport
# args: [--remove, --include-star-import]
# - repo: https://github.com/pycqa/isort
# rev: "12cc5fbd67eebf92eb2213b03c07b138ae1fb448"
# hooks:
# - id: isort
# files: "python/.*"
# args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/psf/black
rev: "4f1772e2aed8356e57b923eacf45f813ec3324a0"
hooks:
- id: black

# - repo: https://gitlab.com/pycqa/flake8
# rev: "21d3c70d676007470908d39b73f0521d39b3b997"
# hooks:
# - id: flake8

# - repo: https://github.com/kynan/nbstripout
# rev: 8cafdcc393232045208137698dbeb42d6e0dd9e8
# hooks:
# - id: nbstripout
# files: ".ipynb"

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing]

# - repo: https://github.com/codespell-project/codespell
# rev: 4d782511b3999c243feb3858cd7062270eb13291
# hooks:
# - id: codespell
# args: ["-L TE,TE/TM,te,ba,FPR,fpr_spacing,ro"]

# - repo: https://github.com/shellcheck-py/shellcheck-py
# rev: f87a493c6596a5338d69395905a4e13ed65584f6
# hooks:
# - id: shellcheck

- repo: https://github.com/pre-commit/pygrep-hooks
rev: dc89c436469616a7c48293ec60c8e21e9d95be08 # Use the ref you want to point at
hooks:
- id: python-use-type-annotations

- repo: https://github.com/PyCQA/bandit
rev: 97501817e621db9975dfa6a2a1d36370942d1812
hooks:
- id: bandit
args: [--exit-zero]
# ignore all tests, not just tests data
exclude: ^tests/
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v14.0.6' # Use the sha / tag you want to point at
hooks:
- id: clang-format
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: "214c33306afe17f1cc7d2d55e4da705b6ebe0627"
# hooks:
# - id: mypy
# exclude: ^(docs/|example-plugin/|tests/fixtures)
# additional_dependencies:
# - "pydantic"
# - repo: https://github.com/terrencepreilly/darglint
# rev: master
# hooks:
# - id: darglint

# - repo: https://github.com/pycqa/pydocstyle
# rev: ""
# hooks:
# - id: pydocstyle
# - repo: https://github.com/asottile/reorder_python_imports
# rev: 2b2f0c74acdb3de316e23ceb7dd0d7945c354050
# hooks:
# - id: reorder-python-imports
# - repo: https://github.com/PyCQA/pylint
# rev: v2.14.1
# hooks:
# - id: pylint
# args: [--exit-zero]
# - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
# rev: 6565d773ca281682d7062d4c0be74538cc474cc9
# hooks:
# - id: pretty-format-java
# args: [--autofix]
# - id: pretty-format-kotlin
# args: [--autofix]
# - id: pretty-format-yaml
# args: [--autofix, --indent, "2"]
# - repo: https://github.com/adrienverge/yamllint.git
# rev: v1.21.0 # or higher tag
# hooks:
# - id: yamllint
# args: [--format, parsable, --strict]
# - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
# rev: 0.1.0 # or specific tag
# hooks:
# - id: yamlfmt
2 changes: 2 additions & 0 deletions .sourcery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
refactor:
python_version: '3.7'
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Ian Williamson <iwill@google.com>
Andreas Hoenselaar <ahoens@google.com>
Ben Bartlett <benbartlett@stanford.edu>
Krishna Gadepalli <kkg4theweb@gmail.com>
Mo Chen <mochen@mit.edu>
Mo Chen <mochen@mit.edu>
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Meep Release Notes

## Meep 1.24.0

7/21/2022

* Support for adjoint gradients of local density of states (LDOS) ([#2077]).

* Improvements to memory usage of adjoint solver ([#1855]).

* Various bugfixes ([#1959], [#2044], [#2066], [#2073], [#2079], [#2091], [#2095], [#2114]) and additional unit tests ([#2032], [#2049], [#2053], [#2076], [#2082]).

## Meep 1.23.0

4/6/2022
Expand Down
15 changes: 10 additions & 5 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"name": "Meep",
"description": "Meep is a free and open-source software package for electromagnetics simulation via the finite-difference time-domain (FDTD) method spanning a broad range of applications.",
"description":
"Meep is a free and open-source software package for electromagnetics simulation via the finite-difference time-domain (FDTD) method spanning a broad range of applications.",
"url": "https://github.com/NanoComp/meep",
"codeRepository": "https://github.com/NanoComp/meep",
"issueTracker": "https://github.com/NanoComp/issues",
Expand Down Expand Up @@ -87,8 +88,12 @@
],
"developmentStatus": "active",
"downloadUrl": "https://github.com/NanoComp/releases",
"version":"1.11",
"dateCreated":"2003-02-12",
"datePublished":"2006-04-01",
"programmingLanguage": ["C++", "Python", "Scheme"]
"version": "1.11",
"dateCreated": "2003-02-12",
"datePublished": "2006-04-01",
"programmingLanguage": [
"C++",
"Python",
"Scheme"
]
}
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Process this file with autoconf to produce a configure script.

AC_INIT([meep],[m4_esyscmd(./version.sh 1.24.0-beta)])
AC_INIT([meep],[m4_esyscmd(./version.sh 1.25.0-beta)])
AC_CONFIG_SRCDIR(src/step.cpp)

# Shared-library version number; indicates api compatibility, and is
# not the same as the "public" version number. (Don't worry about this
# except for public releases.) Note that any change to a C++ class
# definition (in the .hpp file) generally breaks binary compatibility.
SHARED_VERSION_INFO="28:0:0" # CURRENT:REVISION:AGE
SHARED_VERSION_INFO="29:0:0" # CURRENT:REVISION:AGE

AM_INIT_AUTOMAKE([foreign color-tests parallel-tests silent-rules 1.11])
AM_SILENT_RULES(yes)
Expand Down
1 change: 0 additions & 1 deletion doc/_api_snippets/class_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ class {class_name}({base_classes}):
{docstring}

</div>

2 changes: 1 addition & 1 deletion doc/_api_snippets/function_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ def {function_name}{parameters}:{other_signatures}

{docstring}

</div>
</div>
2 changes: 1 addition & 1 deletion doc/_api_snippets/method_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ def {method_name}{parameters}:{other_signatures}

</div>

</div>
</div>
2 changes: 1 addition & 1 deletion doc/docs/2d_Cell_Special_kz.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ The Meep results are identical to within six decimal digits and agree well with

```
refl:, 0.3272338236967464 (real/imag), 0.3272338244372344 (complex), 0.3272330216564413 (3d), 0.3293821216165117 (analytic)
```
```
3 changes: 2 additions & 1 deletion doc/docs/Build_From_Source.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ chmod +x build-meep.sh
#### Ubuntu 16.04 and 18.04

There are a few differences in building for 16.04 and 18.04, so be sure to read the script and adjust appropriately.
(Ubuntu 20.04 will not work without a few changes.)

```bash
#!/bin/bash
Expand Down Expand Up @@ -371,7 +372,7 @@ pip3 install --user matplotlib>3.0.0
pip3 install --user ffmpeg

cd ~/install
git clone git://github.com/stevengj/nlopt.git
git clone https://github.com/stevengj/nlopt.git
cd nlopt/
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 && make && sudo make install

Expand Down
2 changes: 1 addition & 1 deletion doc/docs/C++_Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const double half_cavity_width = d2;
const int N = 5;
```

Meep supports perfectly matching layers (PML) as absorbing boundary conditions. The PML begins at the edge of the computational volume and works inwards. Hence, we specify the size of the cell as follows:
Meep supports perfectly matching layers (PML) as absorbing boundary conditions. The PML begins at the edge of the computational volume and works inwards. Hence, we specify the size of the cell as follows:

```c++
const double pml_thickness = 1.0;
Expand Down
2 changes: 1 addition & 1 deletion doc/docs/Developer_Codes/Makefile.manual
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ LIBS = -lmeepgeom -lmeep -lctlgeom
WriteChunkInfo: WriteChunkInfo.o
$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)

clean:
clean:
rm *.o *.a
5 changes: 3 additions & 2 deletions doc/docs/Developer_Codes/WriteChunkInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ structure create_structure(double resolution, int symmetries) {
geometry_lattice.size.z = 0.0;
grid_volume gv = voltwo(sx, sy, resolution);
gv.center_origin();
symmetry S = (symmetries == 1 ? mirror(Y, gv)
: symmetries == 2 ? mirror(X, gv) + mirror(Y, gv) : symmetry());
symmetry S = (symmetries == 1 ? mirror(Y, gv)
: symmetries == 2 ? mirror(X, gv) + mirror(Y, gv)
: symmetry());
structure the_structure(gv, dummy_eps, pml(dpml), S);

vector3 e1 = v3(1.0, 0.0, 0.0);
Expand Down
2 changes: 1 addition & 1 deletion doc/docs/Download.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ You will also be able to install the [parallel version of Meep](https://packages
sudo apt-get install python3-meep-openmpi
```

These upcoming Meep packages for Ubuntu 21.04 are derived from the Debian 11 ("Bullseye") packages ([serial](https://packages.debian.org/bullseye/python3-meep) and [parallel](https://packages.debian.org/bullseye/python3-meep-openmpi)). Debian 11 is currently the testing distribution.
These upcoming Meep packages for Ubuntu 21.04 are derived from the Debian 11 ("Bullseye") packages ([serial](https://packages.debian.org/bullseye/python3-meep) and [parallel](https://packages.debian.org/bullseye/python3-meep-openmpi)). Debian 11 is currently the testing distribution.
2 changes: 1 addition & 1 deletion doc/docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Only the [harmonic mean](https://en.wikipedia.org/wiki/Harmonic_mean) of eigenva

### How do I model graphene or other 2d materials with single-atom thickness?

Typically, graphene and similar "2d" materials are mathematically represented as a [delta function](https://en.wikipedia.org/wiki/Dirac_delta_function) conductivity in Maxwell's equations because their thickness is negligible compared to the wavelength, where the conductivity is furthermore usually anisotropic (producing surface-parallel currents in response to the surface-parallel components of the electric field). In a discretized computer model like Meep, this is approximated by an anisotropic volume conductivity (or other polarizable dispersive material) whose thickness is proportional to (`1/resolution`) *and* whose amplitude is proportional `resolution`. For example, this could be represented by a one-pixel-thick [conductor](Materials.md#conductivity-and-complex) can be represented by e.g. a [`Block`](Python_User_Interface.md#block) with `size=meep.Vector3(x,y,1/resolution)` in a 3d cell, with the value of the conductivity explicitly multiplied by `resolution`.
Typically, graphene and similar "2d" materials are mathematically represented as a [delta function](https://en.wikipedia.org/wiki/Dirac_delta_function) conductivity in Maxwell's equations because their thickness is negligible compared to the wavelength, where the conductivity is furthermore usually anisotropic (producing surface-parallel currents in response to the surface-parallel components of the electric field). In a discretized computer model like Meep, this is approximated by an anisotropic volume conductivity (or other polarizable dispersive material) whose thickness is proportional to (`1/resolution`) *and* whose amplitude is proportional `resolution`. For example, this could be represented by a one-pixel-thick [conductor](Materials.md#conductivity-and-complex) can be represented by e.g. a [`Block`](Python_User_Interface.md#block) with `size=meep.Vector3(x,y,1/resolution)` in a 3d cell, with the value of the conductivity explicitly multiplied by `resolution`.
### How do I model a continuously varying permittivity?

You can use a [material function](Python_User_Interface.md#medium) to model any arbitrary, position-dependent permittivity/permeability function $\varepsilon(\vec{r})$/$\mu(\vec{r})$ including anisotropic, [dispersive](Materials.md#material-dispersion), and [nonlinear](Materials.md#nonlinearity) media. For an example involving a non-dispersive, anisotropic material, see [Tutorial/Mode Decomposition/Diffraction Spectrum of Liquid-Crystal Polarization Gratings](Python_Tutorials/Mode_Decomposition.md#diffraction-spectrum-of-liquid-crystal-polarization-gratings). The material function construct can also be used to specify arbitrary *shapes* (e.g., curves such as parabolas, sinusoids, etc.) within: (1) the interior boundary of a [`GeometricObject`](Python_User_Interface.md#geometricobject) (e.g., `Block`, `Sphere`, `Cylinder`, etc.), (2) the entire cell via the [`material_function`](Python_User_Interface.md#material-function) parameter of the `Simulation` constructor, or (3) a combination of the two.
Expand Down
2 changes: 1 addition & 1 deletion doc/docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ There are upcoming packages for [Meep version 1.17.1](https://github.com/NanoCom

In the meantime, the following dependencies are already available as precompiled packages: BLAS and LAPACK possibly as part of a package for [Atlas BLAS](https://en.wikipedia.org/wiki/Automatically_Tuned_Linear_Algebra_Software), Guile, MPI, and HDF5. One thing to be careful of is that many distributions split packages into two parts: one main package for the libraries and programs, and a **devel** package for [header files](https://en.wikipedia.org/wiki/Header_file) and other things needed to compile software using those libraries. You will need to install **both**. So, for example, you will probably need both a `guile` package (probably installed by default) and a `guile-dev` or `guile-devel` package (probably *not* installed by default), and similarly for HDF5 etcetera. You will probably also want to install a `libpng-dev` or `libpng-devel` package in order to compile the `h5topng` utility in [h5utils](https://github.com/NanoComp/h5utils/blob/master/README.md).

Installation from source on macOS
Installation from source on macOS
---------------------------------
Most macOS users will probably want to install via the Conda packages as described above. It is also possible to compile Meep from source, however.

Expand Down
2 changes: 1 addition & 1 deletion doc/docs/Materials.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Similar relationships can be found for systems with more than two atomic levels
### Natural Units for Saturable Media

A conversion chart for different choices of parameter nomenclature for the saturable medium.

There is no standard convention in the literature on lasers and saturable gain media for defining the various constants in the equations above. The following are the relationships among these constants for the three different groups of work discussed in this section:

$$ \omega_n \; (\textrm{Meep}) = \omega_{ba} \; (\textrm{Boyd}) = \omega_a \; (\textrm{SALT}) $$
Expand Down
4 changes: 2 additions & 2 deletions doc/docs/Python_Tutorials/Adjoint_Solver.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ There are six Jupyter notebooks that demonstrate the main features of the adjoin

- [Design of a Symmetric Broadband Splitter](https://nbviewer.jupyter.org/github/NanoComp/meep/blob/master/python/examples/adjoint_optimization/04-Splitter.ipynb)

- [Broadband Objective Function using Epigraph Formulation](https://nbviewer.jupyter.org/github/NanoComp/meep/blob/master/python/examples/adjoint_optimization/05-Minimax.ipynb)
- [Metalens Optimization with Near2Far](https://nbviewer.jupyter.org/github/NanoComp/meep/blob/master/python/examples/adjoint_optimization/05-Near2Far.ipynb)

- [Objective Function based on Near to Far-Field Transformation](https://nbviewer.jupyter.org/github/NanoComp/meep/blob/master/python/examples/adjoint_optimization/Near2Far-Epigraph.ipynb)
- [Near2Far Optimization with Epigraph Formulation](https://nbviewer.jupyter.org/github/NanoComp/meep/blob/master/python/examples/adjoint_optimization/06-Near2Far-Epigraph.ipynb)

More documentation will be available soon.

0 comments on commit c88ca4a

Please sign in to comment.