Added a new function for the legacy Astaroth layer: acGetNode(). This functions returns a Node, which can be used to access acNode layer functions

This commit is contained in:
jpekkila
2020-01-13 11:33:15 +02:00
parent f0208c66a6
commit 794e4393c3
2 changed files with 15 additions and 2 deletions

View File

@@ -99,6 +99,8 @@ AcResult acLoadWithOffset(const AcMesh host_mesh, const int3 src, const int num_
/** */
int acGetNumDevicesPerNode(void);
Node acGetNode(void);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@@ -34,8 +34,10 @@ const char* scalararray_names[] = {AC_FOR_SCALARARRAY_HANDLES(AC_GEN_STR)};
const char* vtxbuf_names[] = {AC_FOR_VTXBUF_HANDLES(AC_GEN_STR)};
#undef AC_GEN_STR
static const int num_nodes = 1;
static Node nodes[num_nodes];
static const int max_num_nodes = 1;
static Node nodes[max_num_nodes] = {0};
static int num_nodes = 0;
void
acPrintMeshInfo(const AcMeshInfo config)
@@ -55,12 +57,14 @@ acPrintMeshInfo(const AcMeshInfo config)
AcResult
acInit(const AcMeshInfo mesh_info)
{
num_nodes = 1;
return acNodeCreate(0, mesh_info, &nodes[0]);
}
AcResult
acQuit(void)
{
num_nodes = 0;
return acNodeDestroy(nodes[0]);
}
@@ -176,3 +180,10 @@ acGetNumDevicesPerNode(void)
ERRCHK_CUDA_ALWAYS(cudaGetDeviceCount(&num_devices));
return num_devices;
}
Node
acGetNode(void)
{
ERRCHK_ALWAYS(num_nodes > 0);
return nodes[0];
}