Skip to content

Commit

Permalink
using test_state_recording
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiangyu-Hu committed Aug 28, 2023
1 parent e54c214 commit 9735c00
Show file tree
Hide file tree
Showing 177 changed files with 319 additions and 768 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D SPHINXSYS_CI=ON \
-D SPHINXSYS_USE_FLOAT=OFF \
-D SPHINXSYS_CLEAN_AFTER_TEST=ON \
-D TEST_STATE_RECORDING=OFF \
-D SPHINXSYS_MODULE_OPENCASCADE=ON \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
Expand Down Expand Up @@ -293,7 +293,7 @@ jobs:
-D CMAKE_TOOLCHAIN_FILE="${{github.workspace}}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache `
-D SPHINXSYS_CI=ON `
-D SPHINXSYS_CLEAN_AFTER_TEST=ON `
-D TEST_STATE_RECORDING=OFF `
-S ${{github.workspace}} `
-B C:\build
Expand Down Expand Up @@ -390,7 +390,7 @@ jobs:
-D CMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D SPHINXSYS_CI=ON \
-D SPHINXSYS_CLEAN_AFTER_TEST=ON \
-D TEST_STATE_RECORDING=OFF \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include(Common) # brings macro to current namespace
option(SPHINXSYS_2D "Build sphinxsys_2d library" ON)
option(SPHINXSYS_3D "Build sphinxsys_3d library" ON)
option(SPHINXSYS_BUILD_TESTS "Build tests" ON)
option(SPHINXSYS_CLEAN_AFTER_TEST "Delete Output files after run Ctest" OFF)
option(TEST_STATE_RECORDING "State recording when run Ctest" ON)
option(SPHINXSYS_DEVELOPER_MODE "Developer mode has more flags active for code quality" ON)
option(SPHINXSYS_USE_FLOAT "Build using float (single-precision floating-point format) as primary type" OFF)
option(SPHINXSYS_MODULE_OPENCASCADE "Build extension relying on OpenCASCADE" OFF)
Expand Down
4 changes: 2 additions & 2 deletions modules/opencascade/tests/test_3d_aortic_valve/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ target_link_libraries(${PROJECT_NAME} sphinxsys_opencascade)
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")

add_test(NAME ${PROJECT_NAME}
COMMAND ${PROJECT_NAME} --clean_after_run=${SPHINXSYS_CLEAN_AFTER_TEST}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
COMMAND ${PROJECT_NAME} --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,5 @@ int main(int ac, char *av[])
write_relaxed_particles.writeToFile(ite);
std::cout << "The physics relaxation process of surface particles finish !" << std::endl;

if (sph_system.CleanAfterRun())
{
io_environment.cleanOutput();
}

return 0;
}
9 changes: 0 additions & 9 deletions src/shared/io_system/io_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,6 @@ ParameterizationIO &IOEnvironment::defineParameterizationIO()
return parameterization_io_ptr_keeper_.createRef<ParameterizationIO>(input_folder_);
}
//=============================================================================================//
void IOEnvironment::cleanOutput()
{
if (fs::exists(output_folder_))
{
fs::remove_all(output_folder_);
fs::create_directory(output_folder_);
}
}
//=============================================================================================//
std::string BaseIO::convertPhysicalTimeToString(Real convertPhysicalTimeToStream)
{
int i_time = int(GlobalStaticVariables::physical_time_ * 1.0e6);
Expand Down
5 changes: 3 additions & 2 deletions src/shared/io_system/io_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class IOEnvironment
explicit IOEnvironment(SPHSystem &sph_system, bool delete_output = true);
virtual ~IOEnvironment(){};
ParameterizationIO &defineParameterizationIO();
void cleanOutput();
};

/**
Expand Down Expand Up @@ -101,7 +100,8 @@ class BodyStatesRecording : public BaseIO
{
public:
BodyStatesRecording(IOEnvironment &io_environment, SPHBodyVector bodies)
: BaseIO(io_environment), bodies_(bodies){};
: BaseIO(io_environment), bodies_(bodies),
state_recording_(io_environment.sph_system_.StateRecording()){};
BodyStatesRecording(IOEnvironment &io_environment, SPHBody &body)
: BodyStatesRecording(io_environment, {&body}){};
virtual ~BodyStatesRecording(){};
Expand All @@ -111,6 +111,7 @@ class BodyStatesRecording : public BaseIO

protected:
SPHBodyVector bodies_;
bool state_recording_;

virtual void writeWithFileName(const std::string &sequence) = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion src/shared/io_system/io_plt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void BodyStatesRecordingToPlt::writeWithFileName(const std::string &sequence)
{
for (SPHBody *body : bodies_)
{
if (body->checkNewlyUpdated())
if (body->checkNewlyUpdated() && state_recording_)
{
std::string filefullpath = io_environment_.output_folder_ +
"/SPHBody_" + body->getName() + "_" + sequence + ".plt";
Expand Down
4 changes: 2 additions & 2 deletions src/shared/io_system/io_vtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void BodyStatesRecordingToVtp::writeWithFileName(const std::string &sequence)
{
for (SPHBody *body : bodies_)
{
if (body->checkNewlyUpdated())
if (body->checkNewlyUpdated() && state_recording_)
{
std::string filefullpath = io_environment_.output_folder_ + "/" + body->getName() + "_" + sequence + ".vtp";
if (fs::exists(filefullpath))
Expand Down Expand Up @@ -84,7 +84,7 @@ void BodyStatesRecordingToVtpString::writeWithFileName(const std::string &sequen
{
for (SPHBody *body : bodies_)
{
if (body->checkNewlyUpdated())
if (body->checkNewlyUpdated() && state_recording_)
{
const auto &vtuName = body->getName() + "_" + sequence + ".vtu";
std::stringstream sstream;
Expand Down
12 changes: 6 additions & 6 deletions src/shared/sphinxsys_system/sph_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPHSystem::SPHSystem(BoundingBox system_domain_bounds, Real resolution_ref, size
resolution_ref_(resolution_ref),
tbb_global_control_(tbb::global_control::max_allowed_parallelism, number_of_threads),
io_environment_(nullptr), run_particle_relaxation_(false), reload_particles_(false),
restart_step_(0), generate_regression_data_(false), clean_after_run_(false) {}
restart_step_(0), generate_regression_data_(false), state_recording_(true) {}
//=================================================================================================//
void SPHSystem::initializeSystemCellLinkedLists()
{
Expand Down Expand Up @@ -57,7 +57,7 @@ void SPHSystem::handleCommandlineOptions(int ac, char *av[])
desc.add_options()("r", po::value<bool>(), "Particle relaxation.");
desc.add_options()("i", po::value<bool>(), "Particle reload from input file.");
desc.add_options()("rt", po::value<bool>(), "Regression test.");
desc.add_options()("clean_after_run", po::value<bool>(), "Delete all files in output folder after run.");
desc.add_options()("state_recording", po::value<bool>(), "State recording in output folder.");
desc.add_options()("restart_step", po::value<int>(), "Run form a restart file.");

po::variables_map vm;
Expand Down Expand Up @@ -106,16 +106,16 @@ void SPHSystem::handleCommandlineOptions(int ac, char *av[])
<< generate_regression_data_ << ").\n";
}

if (vm.count("clean_after_run"))
if (vm.count("state_recording"))
{
clean_after_run_ = vm["clean_after_run"].as<bool>();
state_recording_ = vm["state_recording"].as<bool>();
std::cout << "Delete all files in output folder after run was set to "
<< vm["clean_after_run"].as<bool>() << ".\n";
<< vm["state_recording"].as<bool>() << ".\n";
}
else
{
std::cout << "Delete all files in output folder after run was set to default ("
<< clean_after_run_ << ").\n";
<< state_recording_ << ").\n";
}

if (vm.count("restart_step"))
Expand Down
4 changes: 2 additions & 2 deletions src/shared/sphinxsys_system/sph_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SPHSystem
void setReloadParticles(bool reload_particles) { reload_particles_ = reload_particles; };
bool ReloadParticles() { return reload_particles_; };
bool GenerateRegressionData() { return generate_regression_data_; };
bool CleanAfterRun() { return clean_after_run_; };
bool StateRecording() { return state_recording_; };
void setRestartStep(size_t restart_step) { restart_step_ = restart_step; };
size_t RestartStep() { return restart_step_; };
BoundingBox system_domain_bounds_; /**< Lower and Upper domain bounds. */
Expand All @@ -97,7 +97,7 @@ class SPHSystem
bool reload_particles_; /**< start the simulation with relaxed particles. */
size_t restart_step_; /**< restart step */
bool generate_regression_data_; /**< run and generate or enhance the regression test data set. */
bool clean_after_run_; /**< Delete all files in output folder after run */
bool state_recording_; /**< Record state in output folder. */
};
} // namespace SPH
#endif // SPH_SYSTEM_H
4 changes: 1 addition & 3 deletions tests/2d_examples/test_1d_shock_tube/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SPHINXSYS_PROJECT_DIR}/cmake) # mai

set(CMAKE_VERBOSE_MAKEFILE on)



set(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin/")
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

aux_source_directory(. DIR_SRCS)
add_executable(${PROJECT_NAME} ${DIR_SRCS})
target_link_libraries(${PROJECT_NAME} extra_sources_2d)

add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --clean_after_run=${SPHINXSYS_CLEAN_AFTER_TEST})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --state_recording=${TEST_STATE_RECORDING})
set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary, Eulerian")
3 changes: 0 additions & 3 deletions tests/2d_examples/test_1d_shock_tube/src/shock_tube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,5 @@ int main(int ac, char *av[])
tt = t4 - t1 - interval;
std::cout << "Total wall time for computation: " << tt.seconds() << " seconds." << std::endl;

if (sph_system.CleanAfterRun())
io_environment.cleanOutput();

return 0;
}
8 changes: 3 additions & 5 deletions tests/2d_examples/test_2d_T_shaped_pipe/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SPHINXSYS_PROJECT_DIR}/cmake) # mai

set(CMAKE_VERBOSE_MAKEFILE on)



SET(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin/")
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

aux_source_directory(. DIR_SRCS)
ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS})

add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --clean_after_run=${SPHINXSYS_CLEAN_AFTER_TEST})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --state_recording=${TEST_STATE_RECORDING})
set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary, inlet, outlet")

set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
target_link_libraries(${PROJECT_NAME} sphinxsys_2d)
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
target_link_libraries(${PROJECT_NAME} sphinxsys_2d)
4 changes: 0 additions & 4 deletions tests/2d_examples/test_2d_T_shaped_pipe/src/T_shaped_pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,6 @@ int main(int ac, char *av[])
std::cout << "Total wall time for computation: " << tt.seconds()
<< " seconds." << std::endl;

if (sph_system.CleanAfterRun())
{
io_environment.cleanOutput();
}

return 0;
}
13 changes: 6 additions & 7 deletions tests/2d_examples/test_2d_airfoil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SPHINXSYS_PROJECT_DIR}/cmake) # mai

set(CMAKE_VERBOSE_MAKEFILE on)

STRING( REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} )
STRING(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
PROJECT("${CURRENT_FOLDER}")


SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin/")
SET(BUILD_INPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/input")
SET(BUILD_RELOAD_PATH "${EXECUTABLE_OUTPUT_PATH}/reload")

file(MAKE_DIRECTORY ${BUILD_INPUT_PATH})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data/
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data/
DESTINATION ${BUILD_INPUT_PATH})

aux_source_directory(. DIR_SRCS)
ADD_EXECUTABLE(${PROJECT_NAME} ${EXECUTABLE_OUTPUT_PATH} ${DIR_SRCS} )
ADD_EXECUTABLE(${PROJECT_NAME} ${EXECUTABLE_OUTPUT_PATH} ${DIR_SRCS})
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
target_link_libraries(${PROJECT_NAME} sphinxsys_2d)

add_test(NAME ${PROJECT_NAME}_particle_relaxation
COMMAND ${PROJECT_NAME} --r=true --clean_after_run=${SPHINXSYS_CLEAN_AFTER_TEST}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME}_particle_relaxation
COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
set_tests_properties(${PROJECT_NAME}_particle_relaxation PROPERTIES LABELS "particle relaxation")
3 changes: 0 additions & 3 deletions tests/2d_examples/test_2d_airfoil/airfoil_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,5 @@ int main(int ac, char *av[])
}
std::cout << "The physics relaxation process finished !" << std::endl;

if (sph_system.CleanAfterRun())
io_environment.cleanOutput();

return 0;
}
13 changes: 5 additions & 8 deletions tests/2d_examples/test_2d_ball_shell_collision/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SPHINXSYS_PROJECT_DIR}/cmake) # mai

set(CMAKE_VERBOSE_MAKEFILE on)

STRING( REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} )
STRING(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
PROJECT("${CURRENT_FOLDER}")



SET(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin/")
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(BUILD_INPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/input")
Expand All @@ -21,10 +19,9 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS})
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
target_link_libraries(${PROJECT_NAME} sphinxsys_2d)

add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --clean_after_run=${SPHINXSYS_CLEAN_AFTER_TEST}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})

set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "particle_relaxation, thick_surface, solid_dynamics, contact")

Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,5 @@ int main(int ac, char *av[])
write_ball_center_displacement.testResult();
}

if (sph_system.CleanAfterRun())
io_environment.cleanOutput();

return 0;
}
19 changes: 5 additions & 14 deletions tests/2d_examples/test_2d_collision/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SPHINXSYS_PROJECT_DIR}/cmake) # mai

set(CMAKE_VERBOSE_MAKEFILE on)

STRING( REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} )
STRING(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
PROJECT("${CURRENT_FOLDER}")



SET(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin/")
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(BUILD_INPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/input")
Expand All @@ -21,14 +19,7 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS})
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
target_link_libraries(${PROJECT_NAME} sphinxsys_2d)

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --clean_after_run=${SPHINXSYS_CLEAN_AFTER_TEST}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
else()
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh
DESTINATION ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND bash ${EXECUTABLE_OUTPUT_PATH}/run_test.sh
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
endif()
add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
3 changes: 0 additions & 3 deletions tests/2d_examples/test_2d_collision/collision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,5 @@ int main(int ac, char *av[])
free_ball_displacement_recording.testResult();
damping_ball_displacement_recording.testResult();

if (sph_system.CleanAfterRun())
io_environment.cleanOutput();

return 0;
}
2 changes: 0 additions & 2 deletions tests/2d_examples/test_2d_collision/run_test.sh

This file was deleted.

12 changes: 6 additions & 6 deletions tests/2d_examples/test_2d_dambreak/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) # main (to

set(CMAKE_VERBOSE_MAKEFILE on)

STRING( REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} )
STRING(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
PROJECT("${CURRENT_FOLDER}")

SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
Expand All @@ -15,11 +15,11 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${BUILD_INPUT_PATH})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool/ DESTINATION ${BUILD_INPUT_PATH})

aux_source_directory(. DIR_SRCS)
add_executable(${PROJECT_NAME} ${EXECUTABLE_OUTPUT_PATH} ${DIR_SRCS} )
add_executable(${PROJECT_NAME} ${EXECUTABLE_OUTPUT_PATH} ${DIR_SRCS})
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
target_link_libraries(${PROJECT_NAME} sphinxsys_2d)

add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME}_restart COMMAND ${PROJECT_NAME} --restart_step=4000 --clean_after_run=${SPHINXSYS_CLEAN_AFTER_TEST}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME}_restart COMMAND ${PROJECT_NAME} --restart_step=4000 --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
3 changes: 0 additions & 3 deletions tests/2d_examples/test_2d_dambreak/Dambreak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,5 @@ int main(int ac, char *av[])
write_recorded_water_pressure.testResult();
}

if (sph_system.CleanAfterRun())
io_environment.cleanOutput();

return 0;
};
Loading

0 comments on commit 9735c00

Please sign in to comment.