Added missing functions to fix backwards compatibility with the version interfaced with Pencil Code

This commit is contained in:
jpekkila
2019-08-08 19:49:57 +03:00
parent 168cdc9109
commit 8a9099d75e
2 changed files with 34 additions and 2 deletions

View File

@@ -66,8 +66,8 @@ AcResult acStore(AcMesh* host_mesh);
* substep and the user is responsible for calling acBoundcondStep before reading the data. */
AcResult acIntegrate(const AcReal dt);
/** Applies periodic boundary conditions for the Mesh distributed among the devices visible to the
* caller*/
/** Applies periodic boundary conditions for the Mesh distributed among the devices visible to
* the caller*/
AcResult acBoundcondStep(void);
/** Does a scalar reduction with the data stored in some vertex buffer */
@@ -81,6 +81,13 @@ AcReal acReduceVec(const ReductionType rtype, const VertexBufferHandle a,
*/
AcResult acStoreWithOffset(const int3 dst, const size_t num_vertices, AcMesh* host_mesh);
/** Will potentially be deprecated in later versions. Added only to fix backwards compatibility with
* PC for now.*/
AcResult acIntegrateStep(const int isubstep, const AcReal& dt);
AcResult acIntegrateStepWithOffset(const int isubstep, const AcReal dt, const int3 start,
const int3 end);
AcResult acSynchronize(void);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@@ -19,6 +19,8 @@
// #include "astaroth_defines.h"
#include "astaroth.h"
#include "math_utils.h" // int3 + int3
#define AC_GEN_STR(X) #X
const char* intparam_names[] = {AC_FOR_BUILTIN_INT_PARAM_TYPES(AC_GEN_STR) //
AC_FOR_USER_INT_PARAM_TYPES(AC_GEN_STR)};
@@ -33,10 +35,13 @@ const char* vtxbuf_names[] = {AC_FOR_VTXBUF_HANDLES(AC_GEN_STR)};
static const int num_nodes = 1;
static Node nodes[num_nodes];
static int3 grid_n;
AcResult
acInit(const AcMeshInfo mesh_info)
{
grid_n = (int3){mesh_info.int_params[AC_nx], mesh_info.int_params[AC_ny],
mesh_info.int_params[AC_nz]};
return acNodeCreate(0, mesh_info, &nodes[0]);
}
@@ -46,6 +51,12 @@ acQuit(void)
return acNodeDestroy(nodes[0]);
}
AcResult
acSynchronize(void)
{
return acNodeSynchronizeStream(nodes[0], STREAM_ALL);
}
AcResult
acSynchronizeStream(const Stream stream)
{
@@ -80,6 +91,20 @@ acIntegrate(const AcReal dt)
return acNodeIntegrate(nodes[0], dt);
}
AcResult
acIntegrateStep(const int& isubstep, const AcReal dt)
{
const int3 start = (int3){NGHOST, NGHOST, NGHOST};
const int3 end = start + grid_n;
return acNodeIntegrateSubstep(nodes[0], STREAM_DEFAULT, isubstep, start, end, dt);
}
AcResult
acIntegrateStepWithOffset(const int isubstep, const AcReal dt, const int3 start, const int3 end)
{
return acNodeIntegrateSubstep(nodes[0], STREAM_DEFAULT, isubstep, start, end, dt);
}
AcResult
acBoundcondStep(void)
{