DPsim
OpenMPLevelScheduler.h
1 /* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2  * EONERC, RWTH Aachen University
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7  *********************************************************************************/
8 
9 #pragma once
10 
11 #include <dpsim/Scheduler.h>
12 
13 #include <vector>
14 
15 namespace DPsim {
17 public:
18  OpenMPLevelScheduler(Int threads = -1, String outMeasurementFile = String());
19  void createSchedule(const CPS::Task::List &tasks, const Edges &inEdges,
20  const Edges &outEdges);
21  void step(Real time, Int timeStepCount);
22  void stop();
23 
24 private:
25  Int mNumThreads;
26  String mOutMeasurementFile;
27  std::vector<CPS::Task::List> mLevels;
28 };
29 }; // namespace DPsim
void step(Real time, Int timeStepCount)
Performs a single simulation step.
void stop()
Called on simulation stop to reliably clean up e.g. running helper threads.
void createSchedule(const CPS::Task::List &tasks, const Edges &inEdges, const Edges &outEdges)
Creates the schedule for the given dependency graph.
std::unordered_map< CPS::Task::Ptr, std::deque< CPS::Task::Ptr > > Edges
Definition: Scheduler.h:31