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 */1516#include"moab/ProcConfig.hpp"17#include"moab/gs.hpp"1819namespace moab
20 {
2122//! Constructor23 ProcConfig::ProcConfig( MPI_Comm proc_comm1 ) : procComm( proc_comm1 ), crystalData( 0 )
24 {
25#ifdef MOAB_HAVE_MPI26int rank, size;
27MPI_Comm_rank( procComm, &rank );
28 procRank = (unsignedint)rank;
29MPI_Comm_size( procComm, &size );
30 procSize = (unsignedint)size;
31#else32 procRank = 0;
33 procSize = 1;
34#endif35 }
3637gs_data::crystal_data* ProcConfig::crystal_router( bool construct_if_missing )
38 {
39#ifdef MOAB_HAVE_MPI40if( !crystalData && construct_if_missing )
41 {
42 crystalData = new gs_data::crystal_data( procComm );
43 }
44#endif4546return crystalData;
47 }
4849 ProcConfig::~ProcConfig()
50 {
51if( crystalData )
52 {
53#ifdef MOAB_HAVE_MPI54 crystalData->reset();
55#endif56delete crystalData;
57 crystalData = 0;
58 }
59 }
6061 } // namespace moab