Hello. I have a C module with one C structure. Here is:
#import <simd/simd.h>
#define STENCIL 8
#define STENCIL3D STENCIL * 3
struct Stencil3x3 {
simd_float3 offsets[STENCIL3D];
};
Also I have a Swift module which uses that structure
import CoreStructures
struct CArrayQuestion {
static var count2d = 8
static var count3d = count2d * 3
func makeStencil() {
let array = Array(repeating: SIMD3<Float>.random(in: 0...1), count: CArrayQuestion.count3d)
let cStencil = Stencil3x3(offsets: <#T##(simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3, simd_float3)#>)
}
func run() {
makeStencil()
}
}
As you can see, to initialize that structure I need somehow convert my array of type [SIMD3] to a tuple of type (SIMD3, SIMD3, SIMD3 ... size). My question is: is there any best practices to use such api? Also I attach a package with this example
Thanks for any advices.