OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ossimMpi Class Reference

#include <ossimMpi.h>

Public Member Functions

ossim_float64 getTime () const
 
void initialize (int *argc, char ***argv)
 
void finalize ()
 
int getRank () const
 
int getNumberOfProcessors () const
 
void setEnabledFlag (bool flag)
 
bool isEnabled () const
 
void barrier ()
 MPI Barrier method. More...
 

Static Public Member Functions

static ossimMpiinstance ()
 

Protected Member Functions

 ossimMpi ()
 
 ossimMpi (const ossimMpi &)
 
void operator= (const ossimMpi &)
 

Protected Attributes

bool theEnabledFlag
 

Static Protected Attributes

static ossimMpitheInstance =0
 

Detailed Description

Definition at line 16 of file ossimMpi.h.

Constructor & Destructor Documentation

◆ ossimMpi() [1/2]

ossimMpi::ossimMpi ( )
protected

Definition at line 168 of file ossimMpi.cpp.

Referenced by instance().

169  : theEnabledFlag(false)
170 {
171  if(traceDebug())
172  {
174  << "ossimMpi::ossimMpi entered..."
175  << std::endl;
176 #ifdef OSSIM_ID_ENABLED
178  << "OSSIM_ID = " << OSSIM_ID << std::endl;
179 #endif
180  }
181 }
bool theEnabledFlag
Definition: ossimMpi.h:57
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ossimMpi() [2/2]

ossimMpi::ossimMpi ( const ossimMpi obj)
protected

Definition at line 183 of file ossimMpi.cpp.

185 {}
bool theEnabledFlag
Definition: ossimMpi.h:57

Member Function Documentation

◆ barrier()

void ossimMpi::barrier ( )

MPI Barrier method.

Blocks until all processes have reached this routine.

If MPI is enabled this will call: MPI_Barrier( MPI_COMM_WORLD ); else it will simply return.

Definition at line 42 of file ossimMpi.cpp.

References theEnabledFlag.

43 {
44 #if OSSIM_HAS_MPI
45  if(theEnabledFlag)
46  {
47  // Blocks until all processes have reached this routine.
48  MPI_Barrier( MPI_COMM_WORLD );
49  }
50 #endif
51 }
bool theEnabledFlag
Definition: ossimMpi.h:57

◆ finalize()

void ossimMpi::finalize ( )

Called only once when we would like to shutdown mpi

Definition at line 115 of file ossimMpi.cpp.

References theEnabledFlag.

116 {
117 #if OSSIM_HAS_MPI
118  if(theEnabledFlag)
119  {
120  int success;
121  success = MPI_Finalize();
122  if(traceDebug())
123  {
124  if(success == MPI_SUCCESS)
125  {
127  << "DEBUG ossimMpi::finalize(): mpi is finalized" << std::endl;
128  }
129  else
130  {
132  << "DEBUG ossimMpi::finalize(): "
133  << "mpi is not finalized successfully" << std::endl;
134  }
135  }
136  }
137 #endif
138 }
bool theEnabledFlag
Definition: ossimMpi.h:57
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getNumberOfProcessors()

int ossimMpi::getNumberOfProcessors ( ) const

Definition at line 154 of file ossimMpi.cpp.

References theEnabledFlag.

155 {
156  int result = 1;
157 
158 #if OSSIM_HAS_MPI
159  if(theEnabledFlag)
160  {
161  MPI_Comm_size(MPI_COMM_WORLD, &result);
162  }
163 #endif
164 
165  return result;
166 }
bool theEnabledFlag
Definition: ossimMpi.h:57

◆ getRank()

int ossimMpi::getRank ( ) const

Definition at line 140 of file ossimMpi.cpp.

References theEnabledFlag.

Referenced by ossimIgen::slaveSetup().

141 {
142  int result = 0;
143 
144 #if OSSIM_HAS_MPI
145  if(theEnabledFlag)
146  {
147  MPI_Comm_rank(MPI_COMM_WORLD, &result);
148  }
149 #endif
150 
151  return result;
152 }
bool theEnabledFlag
Definition: ossimMpi.h:57

◆ getTime()

ossim_float64 ossimMpi::getTime ( ) const

Definition at line 53 of file ossimMpi.cpp.

References theEnabledFlag.

54 {
55 #if OSSIM_HAS_MPI
56  if(theEnabledFlag)
57  {
58  return MPI_Wtime();
59  }
60  else
61  {
62  return time(0);
63  }
64 #else
65  return time(0);
66 #endif
67 }
bool theEnabledFlag
Definition: ossimMpi.h:57

◆ initialize()

void ossimMpi::initialize ( int *  argc,
char ***  argv 
)

Typically called only one time

Definition at line 99 of file ossimMpi.cpp.

100 {
101  if(traceDebug())
102  {
104  << "DEBUG ossimMpi::initialize: Not compiled with mpi!"
105  << std::endl;
106  }
107 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ instance()

ossimMpi * ossimMpi::instance ( )
static

Definition at line 27 of file ossimMpi.cpp.

References ossimMpi(), and theInstance.

Referenced by ossimIgen::initialize(), ossimIgen::initializeAttributes(), ossimIgen::outputProduct(), ossimIgen::slaveSetup(), and ossimIgen::writeToFile().

28 {
29  if(!theInstance)
30  {
31  theInstance = new ossimMpi;
32  }
33 
34  return theInstance;
35 }
static ossimMpi * theInstance
Definition: ossimMpi.h:56

◆ isEnabled()

bool ossimMpi::isEnabled ( ) const

Definition at line 37 of file ossimMpi.cpp.

References theEnabledFlag.

38 {
39  return theEnabledFlag;
40 }
bool theEnabledFlag
Definition: ossimMpi.h:57

◆ operator=()

void ossimMpi::operator= ( const ossimMpi rhs)
protected

Definition at line 187 of file ossimMpi.cpp.

References theEnabledFlag.

188 {
190 }
bool theEnabledFlag
Definition: ossimMpi.h:57

◆ setEnabledFlag()

void ossimMpi::setEnabledFlag ( bool  flag)

Definition at line 110 of file ossimMpi.cpp.

References theEnabledFlag.

111 {
112  theEnabledFlag = flag;
113 }
bool theEnabledFlag
Definition: ossimMpi.h:57

Member Data Documentation

◆ theEnabledFlag

bool ossimMpi::theEnabledFlag
protected

◆ theInstance

ossimMpi * ossimMpi::theInstance =0
staticprotected

We will have only a single instance of this class.

Definition at line 56 of file ossimMpi.h.

Referenced by instance().


The documentation for this class was generated from the following files: