Can move forcing vector information now from the host to device.

next step in to generate random waves in the CPU with a chosen degree of helicity etc.
This commit is contained in:
Miikka Vaisala
2019-06-26 17:41:39 +08:00
parent 231a8aa06e
commit be0e46c814
4 changed files with 41 additions and 22 deletions

View File

@@ -494,28 +494,29 @@ acSynchronize(void)
return AC_SUCCESS;
}
//Tool for loadin forcing vector information into the device memory
//Tool for loading forcing vector information into the device memory
AcResult
acForcingVec(const AcReal magnitude, const AcReal3 k_force, const AcReal3 ff_hel_re,
const AcReal3 ff_hel_im, const AcReal phase)
acForcingVec(const AcReal forcing_magnitude, const AcReal3 k_force, const AcReal3 ff_hel_re,
const AcReal3 ff_hel_im, const AcReal forcing_phase)
{
loadDeviceConstant(device[i], AC_forcing_magnitude, AC_forcing_magnitude);
loadDeviceConstant(device[i], AC_forcing_phase, AC_forcing_phase );
for (int i = 0; i < num_devices; ++i) {
loadDeviceConstant(devices[i], AC_forcing_magnitude, forcing_magnitude);
loadDeviceConstant(devices[i], AC_forcing_phase, forcing_phase );
loadDeviceConstant(device[i], AC_k_forcex, k_force.x);
loadDeviceConstant(device[i], AC_k_forcey, k_force.y);
loadDeviceConstant(device[i], AC_k_forcez, k_force.z);
loadDeviceConstant(devices[i], AC_k_forcex, k_force.x);
loadDeviceConstant(devices[i], AC_k_forcey, k_force.y);
loadDeviceConstant(devices[i], AC_k_forcez, k_force.z);
loadDeviceConstant(devices[i], AC_ff_hel_rex, ff_hel_re.x);
loadDeviceConstant(devices[i], AC_ff_hel_rey, ff_hel_re.y);
loadDeviceConstant(devices[i], AC_ff_hel_rez, ff_hel_re.z);
loadDeviceConstant(device[i], AC_ff_hel_rex, ff_hel_re.x);
loadDeviceConstant(device[i], AC_ff_hel_rey, ff_hel_re.y);
loadDeviceConstant(device[i], AC_ff_hel_rez, ff_hel_re.z);
loadDeviceConstant(device[i], AC_ff_hel_imx, ff_hel_im.x);
loadDeviceConstant(device[i], AC_ff_hel_imy, ff_hel_im.y);
loadDeviceConstant(device[i], AC_ff_hel_imz, ff_hel_im.z);
loadDeviceConstant(devices[i], AC_ff_hel_imx, ff_hel_im.x);
loadDeviceConstant(devices[i], AC_ff_hel_imy, ff_hel_im.y);
loadDeviceConstant(devices[i], AC_ff_hel_imz, ff_hel_im.z);
}
return AC_SUCCESS;
}

View File

@@ -247,7 +247,7 @@ run_simulation(void)
//Generate a forcing vectors before canculating an integration step.
//Placeholders until determined properly
AcReal magnitude = 0.05;
AcReal phase = Scalar(0.79);
AcReal phase = 0.79;
AcReal3 k_force = (AcReal3){2.0, 0.0, 0.0};
AcReal3 ff_hel_re = (AcReal3){0.0, 0.5, 0.0};
AcReal3 ff_hel_im = (AcReal3){0.0, 0.8666, 0.0};