Moved the definition of acForcingVec to host_forcing.cc since it depends on user parameters that may not be defined in all projects
This commit is contained in:
@@ -272,15 +272,9 @@ AcResult acQuit(void);
|
|||||||
unless otherwise stated. */
|
unless otherwise stated. */
|
||||||
AcResult acSynchronize(void);
|
AcResult acSynchronize(void);
|
||||||
|
|
||||||
/** */
|
/** Loads a parameter to the constant memory of all devices */
|
||||||
AcResult acLoadDeviceConstant(const AcRealParam param, const AcReal value);
|
AcResult acLoadDeviceConstant(const AcRealParam param, const AcReal value);
|
||||||
|
|
||||||
/** Tool for loading forcing vector information into the device memory
|
|
||||||
*/
|
|
||||||
AcResult acForcingVec(const AcReal forcing_magnitude, const AcReal3 k_force,
|
|
||||||
const AcReal3 ff_hel_re, const AcReal3 ff_hel_im, const AcReal forcing_phase,
|
|
||||||
const AcReal kaver);
|
|
||||||
|
|
||||||
/* End extern "C" */
|
/* End extern "C" */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -515,35 +515,3 @@ acLoadDeviceConstant(const AcRealParam param, const AcReal value)
|
|||||||
}
|
}
|
||||||
return AC_SUCCESS;
|
return AC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tool for loading forcing vector information into the device memory
|
|
||||||
// %JP: Added a generic function for loading device constants (acLoadDeviceConstant).
|
|
||||||
// This acForcingVec should go outside the core library since it references user-defined
|
|
||||||
// parameters such as AC_forcing_magnitude which may not be defined in all projects.
|
|
||||||
// host_forcing.cc is probably a good place for this.
|
|
||||||
AcResult
|
|
||||||
acForcingVec(const AcReal forcing_magnitude, const AcReal3 k_force, const AcReal3 ff_hel_re,
|
|
||||||
const AcReal3 ff_hel_im, const AcReal forcing_phase, const AcReal kaver)
|
|
||||||
{
|
|
||||||
|
|
||||||
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(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(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);
|
|
||||||
|
|
||||||
loadDeviceConstant(devices[i], AC_kaver, kaver);
|
|
||||||
}
|
|
||||||
|
|
||||||
return AC_SUCCESS;
|
|
||||||
}
|
|
||||||
|
@@ -175,3 +175,32 @@ helical_forcing_special_vector(AcReal3* ff_hel_re, AcReal3* ff_hel_im, const AcR
|
|||||||
*ff_hel_im = (AcReal3){relhel * k_cross_k_cross_e.x / denominator, relhel * k_cross_k_cross_e.y,
|
*ff_hel_im = (AcReal3){relhel * k_cross_k_cross_e.x / denominator, relhel * k_cross_k_cross_e.y,
|
||||||
relhel * k_cross_k_cross_e.z};
|
relhel * k_cross_k_cross_e.z};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tool for loading forcing vector information into the device memory
|
||||||
|
// %JP: Added a generic function for loading device constants (acLoadDeviceConstant).
|
||||||
|
// This acForcingVec should go outside the core library since it references user-defined
|
||||||
|
// parameters such as AC_forcing_magnitude which may not be defined in all projects.
|
||||||
|
// host_forcing.cc is probably a good place for this.
|
||||||
|
// %JP update: moved this here out of astaroth.cu. Should be renamed such that it cannot be
|
||||||
|
// confused with actual interface functions.
|
||||||
|
void
|
||||||
|
acForcingVec(const AcReal forcing_magnitude, const AcReal3 k_force, const AcReal3 ff_hel_re,
|
||||||
|
const AcReal3 ff_hel_im, const AcReal forcing_phase, const AcReal kaver)
|
||||||
|
{
|
||||||
|
acLoadDeviceConstant(AC_forcing_magnitude, forcing_magnitude);
|
||||||
|
acLoadDeviceConstant(AC_forcing_phase, forcing_phase);
|
||||||
|
|
||||||
|
acLoadDeviceConstant(AC_k_forcex, k_force.x);
|
||||||
|
acLoadDeviceConstant(AC_k_forcey, k_force.y);
|
||||||
|
acLoadDeviceConstant(AC_k_forcez, k_force.z);
|
||||||
|
|
||||||
|
acLoadDeviceConstant(AC_ff_hel_rex, ff_hel_re.x);
|
||||||
|
acLoadDeviceConstant(AC_ff_hel_rey, ff_hel_re.y);
|
||||||
|
acLoadDeviceConstant(AC_ff_hel_rez, ff_hel_re.z);
|
||||||
|
|
||||||
|
acLoadDeviceConstant(AC_ff_hel_imx, ff_hel_im.x);
|
||||||
|
acLoadDeviceConstant(AC_ff_hel_imy, ff_hel_im.y);
|
||||||
|
acLoadDeviceConstant(AC_ff_hel_imz, ff_hel_im.z);
|
||||||
|
|
||||||
|
acLoadDeviceConstant(AC_kaver, kaver);
|
||||||
|
}
|
||||||
|
@@ -42,4 +42,10 @@ AcReal3 helical_forcing_k_generator(const AcReal kmax, const AcReal kmin);
|
|||||||
|
|
||||||
void helical_forcing_e_generator(AcReal3* e_force, const AcReal3 k_force);
|
void helical_forcing_e_generator(AcReal3* e_force, const AcReal3 k_force);
|
||||||
|
|
||||||
void helical_forcing_special_vector(AcReal3* ff_hel_re, AcReal3* ff_hel_im, const AcReal3 k_force, const AcReal3 e_force, const AcReal relhel);
|
void helical_forcing_special_vector(AcReal3* ff_hel_re, AcReal3* ff_hel_im, const AcReal3 k_force,
|
||||||
|
const AcReal3 e_force, const AcReal relhel);
|
||||||
|
|
||||||
|
/** Tool for loading forcing vector information into the device memory
|
||||||
|
*/
|
||||||
|
void acForcingVec(const AcReal forcing_magnitude, const AcReal3 k_force, const AcReal3 ff_hel_re,
|
||||||
|
const AcReal3 ff_hel_im, const AcReal forcing_phase, const AcReal kaver);
|
||||||
|
Reference in New Issue
Block a user