Designed for heterogeneous computing architecture, three layers, i.e. outer, kernel-shell and kernel, dependent on their distances to computing kernel, are used in SPHinXsys. Accordingly, the characteristics of data structure are different at each layer.

The outer layer is the problem-definition layer, at which the physical problem for the simulation or computing is defined. The global variables are defined, the preprocess is done by generating particles respect to geometric information. Third-parties environment and methods, e.g. Simbody environment and methods, are defined. The data structure from standard C++ library and other third-parties libraries can be directly used for this propose.

The kernel-shell layer is the SPH method-definition layer, which is used to define individual SPH method, including sub-methods, e.g. those for particle adaptation and material properties. At this layer, the interface data structures, namely, discrete and singular variables are used to transfer the outer-layer data to those used in computing kernel. These interface are also containers of the transformed data, which are trivially-copyable and can be used on a computing device, typically GPU.

The kernel layer defines all the computing via computing kernels running on the device, and only instantiates at the beginning of computing with the help of the kernel-shell layer interface and execution implementation. The data transformed from kernel-shell layer has the form of pointer. For that from discrete variable, it can be accessed just as arrays.

Still, one can copy directly constant trivially-copyable data structures through the 3 layers. Beside simple types, one typical more complex example is RiemannSolver, which is a trivially-copyable constant and can be copied to computing kernels directly.