Cleaned up samples and removed old unused stuff. Simplified CMake files.
This commit is contained in:
@@ -1,10 +1,3 @@
|
||||
## C++ standard
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
## Compilation flags
|
||||
add_compile_options(-Wall -Wextra -Werror -Wdouble-promotion -Wfloat-conversion -Wshadow)
|
||||
|
||||
## Compile and link
|
||||
## cpptest
|
||||
add_executable(cpptest main.cc)
|
||||
target_link_libraries(cpptest PRIVATE astaroth_core astaroth_utils)
|
||||
|
@@ -21,17 +21,18 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "astaroth.h"
|
||||
|
||||
// From Astaroth Utils
|
||||
#include "src/utils/config_loader.h"
|
||||
#include "src/utils/memory.h"
|
||||
#include "src/utils/verification.h"
|
||||
#include "astaroth_utils.h"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
AcMeshInfo info;
|
||||
acLoadConfig(AC_DEFAULT_CONFIG, &info);
|
||||
// Some real params must be calculated (for the MHD case) // TODO DANGEROUS
|
||||
info.real_params[AC_inv_dsx] = (AcReal)(1.0) / info.real_params[AC_dsx];
|
||||
info.real_params[AC_inv_dsy] = (AcReal)(1.0) / info.real_params[AC_dsy];
|
||||
info.real_params[AC_inv_dsz] = (AcReal)(1.0) / info.real_params[AC_dsz];
|
||||
info.real_params[AC_cs2_sound] = info.real_params[AC_cs_sound] * info.real_params[AC_cs_sound];
|
||||
|
||||
// Alloc
|
||||
AcMesh model, candidate;
|
||||
@@ -42,17 +43,26 @@ main(void)
|
||||
acMeshRandomize(&model);
|
||||
acMeshApplyPeriodicBounds(&model);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Verify that the mesh was loaded and stored correctly
|
||||
acInit(info);
|
||||
acLoad(model);
|
||||
acStore(&candidate);
|
||||
acQuit();
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Verify and destroy
|
||||
acVerifyMesh(model, candidate);
|
||||
|
||||
// Attempt to integrate and check max and min
|
||||
printf("Integrating... ");
|
||||
acIntegrate(FLT_EPSILON);
|
||||
printf("Done.\nVTXBUF ranges after one integration step:\n");
|
||||
for (size_t i = 0; i < NUM_VTXBUF_HANDLES; ++i)
|
||||
printf("\t%-15s... [%.3g, %.3g]\n", vtxbuf_names[i],
|
||||
(double)acReduceScal(RTYPE_MIN, (VertexBufferHandle)i),
|
||||
(double)acReduceScal(RTYPE_MAX, (VertexBufferHandle)i));
|
||||
|
||||
// Destroy
|
||||
acQuit();
|
||||
acMeshDestroy(&model);
|
||||
acMeshDestroy(&candidate);
|
||||
|
||||
puts("cpptest complete.");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user