Merge branch 'hannes-philipp' of git.gfz-potsdam.de:naaice/tug into hannes-philipp

This commit is contained in:
philippun 2023-07-28 10:51:15 +02:00
commit 10bb5f5012
3 changed files with 18 additions and 8 deletions

View File

@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD 17)
find_package(Eigen3 REQUIRED NO_MODULE)
find_package(OpenMP)
find_package(easy_profiler REQUIRED)
## SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfma")
option(TUG_USE_OPENMP "Compile with OpenMP support" ON)
@ -39,4 +40,4 @@ if(TUG_ENABLE_TESTING)
add_subdirectory(test)
endif()
add_subdirectory(examples)
add_subdirectory(examples)

View File

@ -8,4 +8,5 @@ target_link_libraries(first_example tug)
target_link_libraries(second_example tug)
target_link_libraries(boundary_example1D tug)
target_link_libraries(FTCS_2D_proto_example tug)
target_link_libraries(FTCS_1D_proto_example tug)
target_link_libraries(FTCS_1D_proto_example tug)
target_link_libraries(FTCS_2D_proto_example easy_profiler)

View File

@ -7,13 +7,17 @@
*/
#include <tug/Simulation.hpp>
#include <easy/profiler.h>
#define EASY_PROFILER_ENABLE ::profiler::setEnabled(true);
int main(int argc, char *argv[]) {
EASY_PROFILER_ENABLE;
profiler::startListen();
// **************
// **** GRID ****
// **************
profiler::startListen();
// create a grid with a 20 x 20 field
int row = 20;
int col = 20;
@ -25,7 +29,7 @@ int main(int argc, char *argv[]) {
// (optional) set the concentrations, e.g.:
// MatrixXd concentrations = MatrixXd::Constant(20,20,1000); // #row,#col,value
// grid.setConcentrations(concentrations);
MatrixXd concentrations = MatrixXd::Constant(20,20,0);
MatrixXd concentrations = MatrixXd::Constant(row, col,1);
concentrations(0,0) = 2000;
grid.setConcentrations(concentrations);
@ -65,14 +69,18 @@ int main(int argc, char *argv[]) {
simulation.setTimestep(0.1); // timestep
// (optional) set the number of iterations
simulation.setIterations(1000);
simulation.setIterations(2);
// (optional) set kind of output [CSV_OUTPUT_OFF (default), CSV_OUTPUT_ON, CSV_OUTPUT_VERBOSE]
simulation.setOutputCSV(CSV_OUTPUT_VERBOSE);
// **** RUN SIMULATION ****
// run the simulation
simulation.run();
EASY_BLOCK("SIMULATION")
simulation.run();
EASY_END_BLOCK;
profiler::dumpBlocksToFile("test_profile.prof");
profiler::stopListen();
}