Added loading and storing functions to the fortran interface
This commit is contained in:
@@ -23,9 +23,11 @@ void acupdatebuiltinparams_(AcMeshInfo* info);
|
||||
|
||||
void acdeviceswapbuffers_(const Device* device);
|
||||
|
||||
void acdeviceloadmesh_(const Device* device, const Stream* stream, const AcMesh* host_mesh);
|
||||
void acdeviceloadmesh_(const Device* device, const Stream* stream, const AcMeshInfo* info,
|
||||
const int* num_farrays, AcReal* farray);
|
||||
|
||||
void acdevicestoremesh_(const Device* device, const Stream* stream, AcMesh* host_mesh);
|
||||
void acdevicestoremesh_(const Device* device, const Stream* stream, const AcMeshInfo* info,
|
||||
const int* num_farrays, AcReal* farray);
|
||||
|
||||
void acdeviceintegratesubstep_(const Device* device, const Stream* stream, const int* step_number,
|
||||
const int3* start, const int3* end, const AcReal* dt);
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "astaroth.h"
|
||||
#include "astaroth_utils.h"
|
||||
#include "errchk.h"
|
||||
|
||||
void
|
||||
acdevicecreate_(const int* id, const AcMeshInfo* info, Device* handle)
|
||||
@@ -38,17 +39,33 @@ acdeviceswapbuffers_(const Device* device)
|
||||
}
|
||||
|
||||
void
|
||||
acdeviceloadmesh_(const Device* device, const Stream* stream, const AcMesh* host_mesh)
|
||||
acdeviceloadmesh_(const Device* device, const Stream* stream, const AcMeshInfo* info,
|
||||
const int* num_farrays, AcReal* farray)
|
||||
{
|
||||
// TODO construct AcMesh from fortran farray
|
||||
acDeviceLoadMesh(*device, *stream, *host_mesh);
|
||||
ERRCHK_ALWAYS(*num_farrays == NUM_VTXBUF_HANDLES);
|
||||
const size_t mxyz = info->int_params[AC_mx] * info->int_params[AC_mx] * info->int_params[AC_mx];
|
||||
|
||||
AcMesh mesh;
|
||||
mesh.info = *info;
|
||||
for (int i = 0; i < *num_farrays; ++i)
|
||||
mesh.vertex_buffer[i] = &farray[i * mxyz];
|
||||
|
||||
acDeviceLoadMesh(*device, *stream, mesh);
|
||||
}
|
||||
|
||||
void
|
||||
acdevicestoremesh_(const Device* device, const Stream* stream, AcMesh* host_mesh)
|
||||
acdevicestoremesh_(const Device* device, const Stream* stream, const AcMeshInfo* info,
|
||||
const int* num_farrays, AcReal* farray)
|
||||
{
|
||||
// TODO construct AcMesh from fortran farray
|
||||
acDeviceStoreMesh(*device, *stream, host_mesh);
|
||||
ERRCHK_ALWAYS(*num_farrays == NUM_VTXBUF_HANDLES);
|
||||
AcMesh mesh;
|
||||
mesh.info = *info;
|
||||
|
||||
const size_t mxyz = info->int_params[AC_mx] * info->int_params[AC_mx] * info->int_params[AC_mx];
|
||||
for (int i = 0; i < *num_farrays; ++i)
|
||||
mesh.vertex_buffer[i] = &farray[i * mxyz];
|
||||
|
||||
acDeviceStoreMesh(*device, *stream, &mesh);
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user