Interface MechanicsBackend

All Superinterfaces:
AlgorithmProvider, Backend, CollisionProvider, ComputeBackend
All Known Implementing Classes:
GenesisBackend, NativeBulletBackend, NativeCollisionBackend, NativeJBulletBackend, ODEBackend

public interface MechanicsBackend extends ComputeBackend, CollisionProvider
Service Provider Interface for Physics Engines.

This interface abstracts the using physics simulation engine (e.g. Bullet, JBullet, ODE). Use ServiceLoader or PhysicsBackendDiscovery to obtain an instance.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • getType

      default String getType()
      Description copied from interface: Backend
      Returns the backend type category (e.g., "plotting", "molecular", "tensor", "math").
      Specified by:
      getType in interface Backend
      Specified by:
      getType in interface ComputeBackend
    • shutdown

      default void shutdown()
      Description copied from interface: Backend
      Called when the application is shutting down or the backend is being replaced. Use this to release hardware resources, close file handles, or stop background threads.
      Specified by:
      shutdown in interface AlgorithmProvider
      Specified by:
      shutdown in interface Backend
    • createBackend

      default Object createBackend()
      Description copied from interface: Backend
      Creates and returns the backend instance (or returns self if it is the backend).
      Specified by:
      createBackend in interface Backend
      Specified by:
      createBackend in interface ComputeBackend
      Returns:
      The backend implementation object
    • createWorld

      PhysicsWorldBridge createWorld()
      Creates a new physics world (simulation environment).
      Returns:
      a new PhysicsWorld instance
    • createRigidBody

      RigidBodyBridge createRigidBody(RigidBody body)
      Creates a backend representation for a RigidBody.
      Parameters:
      body - the Episteme RigidBody definition
      Returns:
      the backend implementation
    • getAlgorithmType

      default String getAlgorithmType()
      Description copied from interface: AlgorithmProvider
      Returns the unique category of the algorithm.
      Specified by:
      getAlgorithmType in interface AlgorithmProvider
      Specified by:
      getAlgorithmType in interface CollisionProvider
    • isAvailable

      default boolean isAvailable()
      Description copied from interface: Backend
      Checks if this backend is currently available (libraries loaded, etc.).

      Default implementation checks Backend.isExplicitlyDisabled() and returns false if it is.

      Specified by:
      isAvailable in interface AlgorithmProvider
      Specified by:
      isAvailable in interface Backend
    • score

      default int score()
      Returns a quality score for this backend on the current hardware. Higher is better. Used by ProviderSelector to rank backends. Override to provide hardware-specific scoring.
    • getPriority

      default int getPriority()
      Description copied from interface: Backend
      Returns the priority for auto-selection (higher = preferred). Used when multiple backends are available.
      Specified by:
      getPriority in interface AlgorithmProvider
      Specified by:
      getPriority in interface Backend