Interface MechanicsBackend
- All Superinterfaces:
AlgorithmProvider, Backend, CollisionProvider, ComputeBackend
- All Known Implementing Classes:
GenesisBackend, NativeBulletBackend, NativeCollisionBackend, NativeJBulletBackend, ODEBackend
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 Summary
Modifier and TypeMethodDescriptiondefault ObjectCreates and returns the backend instance (or returns self if it is the backend).createRigidBody(RigidBody body) Creates a backend representation for a RigidBody.Creates a new physics world (simulation environment).default StringReturns the unique category of the algorithm.default intReturns the priority for auto-selection (higher = preferred).default StringgetType()Returns the backend type category (e.g., "plotting", "molecular", "tensor", "math").default booleanChecks if this backend is currently available (libraries loaded, etc.).default intscore()Returns a quality score for this backend on the current hardware.default voidshutdown()Called when the application is shutting down or the backend is being replaced.Methods inherited from interface AlgorithmProvider
description, getMetadata, getName, scoreMethods inherited from interface Backend
getAlgorithmProviders, getName, getStatusMessage, isExplicitlyDisabledMethods inherited from interface CollisionProvider
detectSphereCollisions, detectSphereCollisions, detectSphereCollisions, detectSphereCollisions, resolveCollisions, resolveCollisions, resolveCollisions, resolveCollisionsMethods inherited from interface ComputeBackend
createContext, getAcceleratorType, getDescription, getId, supportsComplexNumbers, supportsFloatingPoint, supportsParallelOps
-
Method Details
-
getType
-
shutdown
default void shutdown()Description copied from interface:BackendCalled 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:
shutdownin interfaceAlgorithmProvider- Specified by:
shutdownin interfaceBackend
-
createBackend
Description copied from interface:BackendCreates and returns the backend instance (or returns self if it is the backend).- Specified by:
createBackendin interfaceBackend- Specified by:
createBackendin interfaceComputeBackend- Returns:
- The backend implementation object
-
createWorld
PhysicsWorldBridge createWorld()Creates a new physics world (simulation environment).- Returns:
- a new PhysicsWorld instance
-
createRigidBody
Creates a backend representation for a RigidBody.- Parameters:
body- the Episteme RigidBody definition- Returns:
- the backend implementation
-
getAlgorithmType
Description copied from interface:AlgorithmProviderReturns the unique category of the algorithm.- Specified by:
getAlgorithmTypein interfaceAlgorithmProvider- Specified by:
getAlgorithmTypein interfaceCollisionProvider
-
isAvailable
default boolean isAvailable()Description copied from interface:BackendChecks if this backend is currently available (libraries loaded, etc.).Default implementation checks
Backend.isExplicitlyDisabled()and returns false if it is.- Specified by:
isAvailablein interfaceAlgorithmProvider- Specified by:
isAvailablein interfaceBackend
-
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:BackendReturns the priority for auto-selection (higher = preferred). Used when multiple backends are available.- Specified by:
getPriorityin interfaceAlgorithmProvider- Specified by:
getPriorityin interfaceBackend
-