Exemplo n.º 1
0
static void
local_copyParticleDataToStais(const float *partData,
                              uint64_t    pos,
                              stai_t      *data)
{
	for (int i = 0; i < 6; i++) {
		if (data[i] != NULL) {
			if (stai_getSizeOfElementInBytes(data[i]) == sizeof(float)) {
				stai_setElement(data[i], pos, partData + i);
			} else if (stai_getSizeOfElementInBytes(data[i])
			           == sizeof(double)) {
				double d = (double)(partData[i]);
				stai_setElement(data[i], pos, &d);
			} else {
				diediedie(EXIT_FAILURE);
			}
		}
	}
}
Exemplo n.º 2
0
static void
local_copyBufferToStai(const float *buffer, stai_t stai, int numValues)
{
	if (stai_getSizeOfElementInBytes(stai) == sizeof(float)) {
		stai_setElementsMulti(stai, 0, buffer, numValues);
	} else if (stai_getSizeOfElementInBytes(stai) == sizeof(double)) {
		double d;
		for (int i = 0; i < numValues; i++) {
			d = (double)(buffer[i]);
			stai_setElement(stai, i, &d);
		}
	} else {
		diediedie(EXIT_FAILURE);
	}
}