Skip to content

Higher level API for constructing simulation entities #41

Description

@ElliotB256

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions