MOAB: Mesh Oriented datABase  (version 5.4.1)
ProcConfig.hpp
Go to the documentation of this file.
00001 /**
00002  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003  * storing and accessing finite element mesh data.
00004  *
00005  * Copyright 2004 Sandia Corporation.  Under the terms of Contract
00006  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007  * retains certain rights in this software.
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  */
00015 
00016 #ifndef MOAB_PROC_CONFIG_HPP
00017 #define MOAB_PROC_CONFIG_HPP
00018 
00019 #include "moab_mpi.h"
00020 
00021 #include "moab/Types.hpp"
00022 #include "moab/Range.hpp"
00023 #include "moab/gs.hpp"
00024 
00025 namespace moab
00026 {
00027 
00028 class Interface;
00029 
00030 /**\brief Multi-CPU information for parallel MOAB */
00031 class ProcConfig
00032 {
00033   public:
00034     ProcConfig( MPI_Comm proc_comm );
00035 
00036     ~ProcConfig();
00037 
00038     //! Get the current processor number
00039     unsigned proc_rank() const
00040     {
00041         return procRank;
00042     }
00043 
00044     //! Get the number of processors
00045     unsigned proc_size() const
00046     {
00047         return procSize;
00048     }
00049 
00050     //! get a crystal router for this parallel job
00051     gs_data::crystal_data* crystal_router( bool construct_if_missing = true );
00052 
00053     //! get/set the communicator for this proc config
00054     MPI_Comm proc_comm() const
00055     {
00056         return procComm;
00057     }
00058     void proc_comm( MPI_Comm this_comm )
00059     {
00060         procComm = this_comm;
00061     }
00062 
00063     //! set rank/size; USED FOR TESTING ONLY!
00064     void proc_rank( unsigned r )
00065     {
00066         procRank = r;
00067     }
00068     void proc_size( unsigned s )
00069     {
00070         procSize = s;
00071     }
00072 
00073   private:
00074     //! MPI communicator set for this instance
00075     MPI_Comm procComm;
00076 
00077     //! rank of this processor
00078     unsigned procRank;
00079 
00080     //! number of processors
00081     unsigned procSize;
00082 
00083     //! crystal router for this parallel job
00084     gs_data::crystal_data* crystalData;
00085 };
00086 
00087 }  // namespace moab
00088 
00089 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines