BioDynaMo  v1.05.120-25dc9790
multi_simulation.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 #ifndef CORE_MULTI_SIMULATION_MULTI_SIMULATION_H_
16 #define CORE_MULTI_SIMULATION_MULTI_SIMULATION_H_
17 
18 #ifdef USE_MPI
19 
20 #include <functional>
21 #include <string>
22 
24 #include "core/param/param.h"
25 
26 namespace bdm {
27 namespace experimental {
28 
29 using experimental::TimeSeries;
30 
31 // Signature of the Simulate() call
32 using TSimulate = std::function<void(int, const char**, TimeSeries*, Param*)>;
33 
34 class MultiSimulation {
35  public:
36  MultiSimulation(int argc, const char** argv);
37 
38  MultiSimulation(int argc, const char** argv, TimeSeries* real);
39 
40  ~MultiSimulation();
41 
42  void DeleteResultFiles(const std::string& dir);
43 
44  void MergeResultFiles(const std::string& dir);
45 
46  int Execute(const TSimulate& simulate_call);
47 
48  private:
49  int argc_ = 0;
50  const char** argv_ = nullptr;
51  char** argv_copy_ = nullptr;
52 };
53 
54 } // namespace experimental
55 } // namespace bdm
56 
57 #endif // USE_MPI
58 
59 #endif // CORE_MULTI_SIMULATION_MULTI_SIMULATION_H_
bdm
Definition: agent.cc:39
time_series.h
param.h