Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
ProcConfig.hpp
Go to the documentation of this file.
1 /**
2  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
3  * storing and accessing finite element mesh data.
4  *
5  * Copyright 2004 Sandia Corporation. Under the terms of Contract
6  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
7  * retains certain rights in this software.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  */
15 
16 #ifndef MOAB_PROC_CONFIG_HPP
17 #define MOAB_PROC_CONFIG_HPP
18 
19 #include "moab_mpi.h"
20 
21 #include "moab/Types.hpp"
22 #include "moab/Range.hpp"
23 #include "moab/gs.hpp"
24 
25 namespace moab
26 {
27 
28 class Interface;
29 
30 /**\brief Multi-CPU information for parallel MOAB */
32 {
33  public:
34  ProcConfig( MPI_Comm proc_comm );
35 
36  ~ProcConfig();
37 
38  //! Get the current processor number
39  unsigned proc_rank() const
40  {
41  return procRank;
42  }
43 
44  //! Get the number of processors
45  unsigned proc_size() const
46  {
47  return procSize;
48  }
49 
50  //! get a crystal router for this parallel job
51  gs_data::crystal_data* crystal_router( bool construct_if_missing = true );
52 
53  //! get/set the communicator for this proc config
54  MPI_Comm proc_comm() const
55  {
56  return procComm;
57  }
58  void proc_comm( MPI_Comm this_comm )
59  {
60  procComm = this_comm;
61  }
62 
63  //! set rank/size; USED FOR TESTING ONLY!
64  void proc_rank( unsigned r )
65  {
66  procRank = r;
67  }
68  void proc_size( unsigned s )
69  {
70  procSize = s;
71  }
72 
73  private:
74  //! MPI communicator set for this instance
75  MPI_Comm procComm;
76 
77  //! rank of this processor
78  unsigned procRank;
79 
80  //! number of processors
81  unsigned procSize;
82 
83  //! crystal router for this parallel job
85 };
86 
87 } // namespace moab
88 
89 #endif