Peano
Loading...
Searching...
No Matches
parallel.cpp
Go to the documentation of this file.
1#include "parallel.h"
2
3#include "tarch/Assertions.h"
4#include "tarch/logging/Log.h"
5#include "tarch/mpi/Rank.h"
6
7
8namespace {
9 std::vector< std::string > classNamesForTaskType;
10}
11
12
13int peano4::parallel::getTaskType(const std::string& className) {
14 static int taskTypeCounter = -1;
15 taskTypeCounter++;
16
17 classNamesForTaskType.push_back( className );
18
19 #if PeanoDebug>0
20 std::cout << "assign task " << className << " id " << taskTypeCounter << std::endl;
21 #endif
22
23 return taskTypeCounter;
24}
25
26
27std::string peano4::parallel::getClassNameOfType(int taskType) {
28 assertion( taskType>=0 );
29 assertion( taskType<classNamesForTaskType.size() );
30 return classNamesForTaskType.at(taskType);
31}
32
#define assertion(expr)
std::string getClassNameOfType(int taskType)
Definition parallel.cpp:27
int getTaskType(const std::string &className)
Get unique number (id) for task.
Definition parallel.cpp:13