A suite of tools for representing and solving electromagnetic simulation problems.
Find a file
Sofus Albert Høgsbro Rose affbd8f988
feat(miniexpr): added traits enabling generic expression evaluation
This was restored from old code, then checked and decorated with extra documentation.
The purpose is to provide standardized internal traits, which any
potential type `T` must implement all of in order to be usable in the upcoming `Expr<T>`
`struct`.

Whenever possible, blanket-`impl` are provided, particularly for `T:
num_traits::real::Real`. This is done in order to make it easy to use a
wide variety of "normal" types by default, while still allowing _any_ more
exotic type to be made compatible by implementing these traits.

One pain-point is `HasPhysicalConstants`: The issue is that the
`physical_constants` crate only provides these constants in `f64`.
There is no widely-used trait that expresses an **infallible and lossy** conversion
from `T` (or, in particular, `f64`). We can use the `as` operator, but
this requires us to explicitly define every single type that we
anticipate might be used.

One considered alternative was to `impl` `FromPrimitive` and accept that the resulting
`.unwrap()` might panic (it would be wrong to have the methods of
`HasPhysicalConstants` return `Result<>`s, since there shouldn't be
ambiguity!). However, this also has downsides: Because there's the
opportunity for panic, types that do not _actually_ have an infallible and lossy
conversion from `f64` might end up having `HasPhysicalConstants`
defined!

In the end, this is also why `ordered-float` needs feature-gating:
Because we know that we'll need that later, so we need to give it an
`impl` for `HasPhysicalConstants`.
2026-07-16 15:30:52 +00:00
pkgs feat(miniexpr): added traits enabling generic expression evaluation 2026-07-16 15:30:52 +00:00
.editorconfig init: cleanly (re)initialized the project 2026-07-16 13:15:55 +00:00
.gitignore init: cleanly (re)initialized the project 2026-07-16 13:15:55 +00:00
.licensesnip init: cleanly (re)initialized the project 2026-07-16 13:15:55 +00:00
.pre-commit-config.yaml deps(miniexpr): added optional dependency on ordered-float 2026-07-16 14:20:04 +00:00
Cargo.lock deps(miniexpr): added optional dependency on ordered-float 2026-07-16 14:20:04 +00:00
Cargo.toml deps(miniexpr): added optional dependency on ordered-float 2026-07-16 14:20:04 +00:00
cog.toml init: cleanly (re)initialized the project 2026-07-16 13:15:55 +00:00
LICENSE init: cleanly (re)initialized the project 2026-07-16 13:15:55 +00:00
README.md deps(miniexpr): added optional dependency on ordered-float 2026-07-16 14:20:04 +00:00
rustfmt.toml init: cleanly (re)initialized the project 2026-07-16 13:15:55 +00:00

hopsim

A suite of tools for representing and solving electromagnetic simulation problems.

Policies

Developer Tooling

  • Testing (cargo test): Run the test suite for the entire workspace.

    • Usage: Run cargo test.
  • Micro-Benchmarking (criterion): Microbenchmarking to track performance changes over time.

    • Usage: Run cargo bench (criterion is an internal library).
  • License Headers (licensesnip): Add license headers to all source files.

    • Installation: cargo install licensesnip.
    • Usage: Use licensesnip to add headers. Use licensesnip remove to remove headers.
    • Alternative: Manually add license headers (prek checks this).
  • Pre-Commit Checks (prek): Simple checks run before every commit.

    • Installation: cargo install --locked prek.
    • Usage: Use prek install to install hooks, running prek before every commit in this local git repo (undo w/prek uninstall).
    • Alternative: Manually enforce all rules in .pre-commit-config.yml (CI will run prek)
  • Commit Message Hygiene (cocogitto): Enforce conventional commits, automatic versioning, and changelog management.

    • Installation: cargo install cocogitto
    • Usage: Use cog commit instead of git commit.
    • Alternative: Manually write messages w/conventional commits syntax (prek checks this).
  • CI (not yet implemented): Enforces all of the above

Commit-Message Policy

The following types must be represented in cog.toml and .pre-commit-config.yaml:

  • Standard: fix, feat, refactor, perf, ux, revert.
  • Auxiliary: deps, docs, test, lang.
  • DX: style, build, tool, ci.
  • Workflow: hotfix, dump, wip, experiment, chore.
  • Purpose: init, merge.

The following scopes must be represented in .pre-commit-config.yaml:

  • Interfaces: cli.
  • Support: emsim, miniexpr, minigrid.
  • Solvers: fdtd-cpu, fdtd-cuda, fdtd-naive.
  • Sim Data: simdata-hdf5.