moab
ProcessSet.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 2007 Sandia Corporation.  Under the terms of Contract
00006  * DE-AC04-94AL85000 with Sandia Coroporation, 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_PROCESS_SET_HPP
00017 #define MOAB_PROCESS_SET_HPP
00018 
00019 #include "moab/Types.hpp"
00020 #include "moab/ParallelComm.hpp"
00021 
00022 #include <iostream>
00023 #include <vector>
00024 
00025 namespace moab {
00026 
00034 class ProcessSet
00035 {
00036 public:
00037   enum
00038     {
00039     SHARED_PROC_BYTES = (MAX_SHARING_PROCS / 8 + (MAX_SHARING_PROCS % 8 ? 1 : 0))
00040     };
00041 
00042   ProcessSet();
00043   ProcessSet( const unsigned char* psetbits );
00044   ~ProcessSet();
00045 
00046   void unite( const ProcessSet& other );
00047   void intersect( const ProcessSet& other );
00048 
00049   void clear();
00050 
00051   void set_process_member( int i );
00052   void set_process_members( const std::vector<int>& procs );
00053 
00054   bool get_process_members( int rank, std::vector<int>& procs );
00055   bool is_process_member( int i ) const;
00056 
00057   const unsigned char* data() const;
00058 
00059   bool operator < ( const ProcessSet& other ) const;
00060 
00061   friend std::ostream& operator << ( std::ostream& os, const ProcessSet& pset );
00062 
00063 protected:
00064   unsigned char processes[SHARED_PROC_BYTES];
00065 };
00066 
00067 } // namespace moab
00068 
00069 #endif /* MOAB_PROCESS_SET_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines