Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
ProcConfig.cpp
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 #include "moab/ProcConfig.hpp"
17 #include "moab/gs.hpp"
18 
19 namespace moab
20 {
21 
22 //! Constructor
23 ProcConfig::ProcConfig( MPI_Comm proc_comm1 ) : procComm( proc_comm1 ), crystalData( 0 )
24 {
25 #ifdef MOAB_HAVE_MPI
26  int rank, size;
27  MPI_Comm_rank( procComm, &rank );
28  procRank = (unsigned int)rank;
29  MPI_Comm_size( procComm, &size );
30  procSize = (unsigned int)size;
31 #else
32  procRank = 0;
33  procSize = 1;
34 #endif
35 }
36 
38 {
39 #ifdef MOAB_HAVE_MPI
40  if( !crystalData && construct_if_missing )
41  {
43  }
44 #endif
45 
46  return crystalData;
47 }
48 
50 {
51  if( crystalData )
52  {
53 #ifdef MOAB_HAVE_MPI
54  crystalData->reset();
55 #endif
56  delete crystalData;
57  crystalData = 0;
58  }
59 }
60 
61 } // namespace moab