| 36 | |
| 37 | #if BOUT_USE_MSGSTACK |
| 38 | int MsgStack::push(std::string message) { |
| 39 | |
| 40 | #if BOUT_USE_OPENMP |
| 41 | // This is temporary fix: no messages from OMP regions if there's |
| 42 | // more than one thread |
| 43 | if (omp_get_num_threads() > 1) { |
| 44 | return position; |
| 45 | } |
| 46 | #endif |
| 47 | |
| 48 | if (position >= stack.size()) { |
| 49 | stack.push_back(std::move(message)); |
| 50 | } else { |
| 51 | stack[position] = message; |
| 52 | } |
| 53 | |
| 54 | return position++; |
| 55 | } |
| 56 | |
| 57 | void MsgStack::pop() { |
| 58 | if (position <= 0) { |