Skip to content

Development

This document describes the design and implementation of the libuipc, providing a reference for developers who wish to contribute to the project. Here, we will mainly focus on the backend implementation of the framework.

Data Oriented Programming

The Partial Differential Equation (PDE) of the simulation problem is already an abstract representation of the real world. We don't need to make any conceptual abstraction using Object Oriented Programming (OOP) to represent the objects. Instead, we keep Data Oriented Programming (DOP) in mind to represent the data in a way that is cache-friendly and efficient. In some way, we organize the UIPC framework in a modified Entity Component System (ECS) pattern, which is called the Reporter-Manager-Receiver (RMR) model.

Reporter-Manager-Receiver Model

The model is a conceptual design pattern that organizes the data flow between different components of the framework in a safe, cache-friendly and flexible way.

Reporter-Manager-Receiver Model

Adding a constitution

A new constitution must provide its energy, state gradient, state Hessian, and the corresponding derivatives for the coupled adjoint. A state Hessian accounts for motion DoFs, not for a change in a physical input. List the supported parameter and reference-geometry bindings, then derive their residual derivatives from the same energy and discretization as the forward model. Accumulate local products with the existing frame adjoint rather than adding a separate solve per design variable.

For a model that updates internal state, record the quantities used by the converged forward frame and differentiate the update across frames. For a piecewise update, document the branch on which a derivative is defined. Keep derivative-only work out of ordinary forward runs. A new binding is not complete until a local derivative check and an end-to-end finite difference on converged trajectories agree with the adjoint.

Register each differentiable input in the CUDA binding support rules under src/backends/cuda/diff_sim/. Match its constitution, collection, and current/rest side. Add a validation test for a supported input and for a similar but unsupported selection. Use the parameter binding reference to document the inputs and limits.