TraverseParallel.h 2.16 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file TraverseParallel.h */

#ifndef AMDIS_TRAVERSEPARALLEL_H
#define AMDIS_TRAVERSEPARALLEL_H

#ifdef _OPENMP

#include "OpenMP.h"
#include "Traverse.h"
#include <vector>

namespace AMDiS {

  /** \ingroup Traverse
   * \brief
   */
  class TraverseParallelStack 
  {
  public: 
    TraverseParallelStack(int nThreads = 0);

    ~TraverseParallelStack();

    ElInfo* traverseFirst(Mesh *mesh, int level, Flag fill_flag);

    inline ElInfo* traverseNext(ElInfo* elinfo_old) {
      return stacks_[omp_get_thread_num()]->traverseNext(elinfo_old);
    }

  private:
    /** \brief
     * Number of threads using the stack in parallel.
     */
    int nThreads_;

55
    std::vector<TraverseStack*> stacks_;
56
57
58
59
60
61
62
63
  };

}

#endif  // _OPENMP

#endif  // AMDIS_TRAVERSEPARALLEL_H