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
#ifndef PROBDATA_HPP
#define PROBDATA_HPP

#ifdef USE_MPI
#include "CGMmpi.h"
#endif

class ProcData 
{
public:

  ~ProcData();
    // destructor; calls MPI_Finalize

  static ProcData *instance();
    // singleton instance
  
  int initialize(int &argc, char **&argv);
    // initialize some communication parameters for this run

  int is_master() const {return myRank == masterRank;};
    // return whether this processor is the master or not
  
  int numProcs;
    // number of processors in this run

  int myRank;
    // rank of this processor
  
  int masterRank;
    // rank of the master process

private:

  static ProcData *instance_;
    // static singleton instance

  static int isInitialized;
    // is this procdata initialized?

  ProcData() {};<--- Member variable 'ProcData::numProcs' is not initialized in the constructor.<--- Member variable 'ProcData::myRank' is not initialized in the constructor.<--- Member variable 'ProcData::masterRank' is not initialized in the constructor.<--- Member variable 'ProcData::numProcs' is not initialized in the constructor.<--- Member variable 'ProcData::myRank' is not initialized in the constructor.<--- Member variable 'ProcData::masterRank' is not initialized in the constructor.
    // private constructor, since this is a singleton

};

inline ProcData *ProcData::instance() 
{
   if (instance_ == 0 ) {
     instance_ = new ProcData;
   }
   return instance_;
}

#endif