Skip to content

Changing pipapo backend#20

Open
gilrrei wants to merge 1 commit intoparticles-pipapo:mainfrom
gilrrei:refactor_pipapo
Open

Changing pipapo backend#20
gilrrei wants to merge 1 commit intoparticles-pipapo:mainfrom
gilrrei:refactor_pipapo

Conversation

@gilrrei
Copy link
Copy Markdown
Collaborator

@gilrrei gilrrei commented Dec 3, 2025

This PR does some major stuff.

Metastuff

  • Bump Python version to 3.12
  • Introduces type hinting
  • Introduces checks in the workflows

Pipapo containers

  • The backend container for the container data classes was completely rewritten. To access the data of a container (particles, voxels, ...) use particles.data[<field_name>] (reduced a lot of code)
  • There is no field ids anymore. This was confusing and introduced some unnecessary complications. (The ids can still be stored as a data array)
  • Removal of the object dataclasses. There is now no Particle object anymore
  • ParticleParticle and ParticleWall containers were merged into InterfaceContainer
  • No difference between list and numpy containers anymore
  • Numpy arrays are not reshaped anymore into 2d

Geometries

  • Added Domain object, currently only Box
  • Added Boundary object, currently only Plane

Misc

  • Added some tests
  • Improved plotting
  • Added a _safe attribute. If set to false, the lengths of the arrays are no longer checked; this might be nice for performance

@c-p-schmidt this will change some stuff for other codes, but for the better :)

This was referenced Dec 3, 2025
@gilrrei gilrrei force-pushed the refactor_pipapo branch 2 times, most recently from c719cf2 to cf4a165 Compare December 11, 2025 16:50
if not lengths_property:
return 0

if len(set(lengths_property)) == 1:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(set(lengths_property)) == 1:
if len(lengths_property) == 1:

lengths_property already is a set, right?

def get_contacts(self, n_particles: int) -> dict[int, set[int]]:
"""Get contacts of the interface container.

Only works in particle index is two dimensional.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Only works in particle index is two dimensional.
Only works if particle index is two dimensional.

def get_connected_clusters(self, n_particles: int) -> list[list[int]]:
"""Get the connected clusters.

I.e. particle sets which a in contact with each other.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
I.e. particle sets which a in contact with each other.
I.e. particle sets which are in contact with each other.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants