Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Higher level API for constructing simulation entities #41

Open
ElliotB256 opened this issue May 18, 2021 · 0 comments
Open

Higher level API for constructing simulation entities #41

ElliotB256 opened this issue May 18, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ElliotB256
Copy link
Collaborator

I would like to see a high level API for creating entities in the simulation, using something like factory structs with a fluent interface. e.g.:

BeamBuilder()
   .in_direction(Vector3::x)
   .with_gaussian_profile(waist, power)
   .with_sigma_plus_polarisation()
   .for_cooling(Strontium)
   .with_detuning(-32.0)
   .build(&mut world);

The advantages of this are:

  • user doesn't need to know components required.
  • guarantees safe use/initialization of components.
  • prosaic code.
  • reduces redundancy for duplicate variables (e.g. wavevector)
  • nicer editor integration, e.g. autocomplete/prompting. Helpful for new atomecs users.

Disadvantages:

  • more code to maintain.
  • multiple ways to define things (though this can be alleviated by funnelling users towards higher-level functionality in an atomecs::prelude::* mod.

Originally posted by @ElliotB256 in #29 (comment)

@ElliotB256 ElliotB256 changed the title Higher level API for construction simulation entities Higher level API for constructing simulation entities May 18, 2021
@ElliotB256 ElliotB256 added the enhancement New feature or request label May 18, 2021
@ElliotB256 ElliotB256 added this to the Core upgrades milestone Jan 13, 2022
@ElliotB256 ElliotB256 self-assigned this Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant