Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
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 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_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 {
00027 
00028 /**\brief Represent a set of processes using a bit vector.
00029  *
00030  * This is used by the mesh refiner when determining where to record
00031  * split vertices so that labeling can be inferred across process
00032  * boundaries without communicating anything other than the number of
00033  * entities in a given partition.
00034  */
00035 class ProcessSet
00036 {
00037   public:
00038     enum
00039     {
00040         SHARED_PROC_BYTES = ( MAX_SHARING_PROCS / 8 + ( MAX_SHARING_PROCS % 8 ? 1 : 0 ) )
00041     };
00042 
00043     ProcessSet();
00044     ProcessSet( const unsigned char* psetbits );
00045     ~ProcessSet();
00046 
00047     void unite( const ProcessSet& other );
00048     void intersect( const ProcessSet& other );
00049 
00050     void clear();
00051 
00052     void set_process_member( int i );
00053     void set_process_members( const std::vector< int >& procs );
00054 
00055     bool get_process_members( int rank, std::vector< int >& procs );
00056     bool is_process_member( int i ) const;
00057 
00058     const unsigned char* data() const;
00059 
00060     bool operator<( const ProcessSet& other ) const;
00061 
00062     friend std::ostream& operator<<( std::ostream& os, const ProcessSet& pset );
00063 
00064   protected:
00065     unsigned char processes[SHARED_PROC_BYTES];
00066 };
00067 
00068 }  // namespace moab
00069 
00070 #endif /* MOAB_PROCESS_SET_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines