Added acMeshRandomize to astaroth.h to keep core and utils separate
This commit is contained in:
@@ -590,6 +590,9 @@ AcResult acUpdateBuiltinParams(AcMeshInfo* config);
|
||||
/** Creates a mesh stored in host memory */
|
||||
AcResult acMeshCreate(const AcMeshInfo mesh_info, AcMesh* mesh);
|
||||
|
||||
/** Randomizes a host mesh */
|
||||
AcResult acMeshRandomize(AcMesh* mesh);
|
||||
|
||||
/** Destroys a mesh stored in host memory */
|
||||
AcResult acMeshDestroy(AcMesh* mesh);
|
||||
|
||||
|
@@ -50,9 +50,6 @@ AcResult acVertexBufferSet(const VertexBufferHandle handle, const AcReal value,
|
||||
/** */
|
||||
AcResult acMeshSet(const AcReal value, AcMesh* mesh);
|
||||
|
||||
/** */
|
||||
AcResult acMeshRandomize(AcMesh* mesh);
|
||||
|
||||
/** */
|
||||
AcResult acMeshApplyPeriodicBounds(AcMesh* mesh);
|
||||
|
||||
|
@@ -2,7 +2,7 @@ find_package(CUDAToolkit)
|
||||
|
||||
## Astaroth Core
|
||||
add_library(astaroth_core STATIC device.cc node.cc astaroth.cc astaroth_fortran.cc)
|
||||
target_link_libraries(astaroth_core astaroth_utils astaroth_kernels CUDA::cudart CUDA::cuda_driver)
|
||||
target_link_libraries(astaroth_core astaroth_kernels CUDA::cudart CUDA::cuda_driver)
|
||||
|
||||
## Options
|
||||
if (MPI_ENABLED)
|
||||
|
@@ -221,6 +221,23 @@ acMeshCreate(const AcMeshInfo info, AcMesh* mesh)
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
static AcReal
|
||||
randf(void)
|
||||
{
|
||||
return (AcReal)rand() / (AcReal)RAND_MAX;
|
||||
}
|
||||
|
||||
AcResult
|
||||
acMeshRandomize(AcMesh* mesh)
|
||||
{
|
||||
const int n = acVertexBufferSize(mesh->info);
|
||||
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w)
|
||||
for (int i = 0; i < n; ++i)
|
||||
mesh->vertex_buffer[w][i] = randf();
|
||||
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
AcResult
|
||||
acMeshDestroy(AcMesh* mesh)
|
||||
{
|
||||
|
@@ -1242,8 +1242,6 @@ acGridSynchronizeStream(const Stream stream)
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#include "astaroth_utils.h" // HACK TO RANDOMIZE
|
||||
AcResult
|
||||
acGridRandomize(void)
|
||||
{
|
||||
|
@@ -38,23 +38,6 @@ acMeshSet(const AcReal value, AcMesh* mesh)
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
static AcReal
|
||||
randf(void)
|
||||
{
|
||||
return (AcReal)rand() / (AcReal)RAND_MAX;
|
||||
}
|
||||
|
||||
AcResult
|
||||
acMeshRandomize(AcMesh* mesh)
|
||||
{
|
||||
const int n = acVertexBufferSize(mesh->info);
|
||||
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w)
|
||||
for (int i = 0; i < n; ++i)
|
||||
mesh->vertex_buffer[w][i] = randf();
|
||||
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
AcResult
|
||||
acMeshApplyPeriodicBounds(AcMesh* mesh)
|
||||
{
|
||||
|
Reference in New Issue
Block a user