phdMesh Version of the Day
ParallelIndex.hpp
00001 /*------------------------------------------------------------------------*/
00002 /*      phdMesh : Parallel Heterogneous Dynamic unstructured Mesh         */
00003 /*                Copyright (2007) Sandia Corporation                     */
00004 /*                                                                        */
00005 /*  Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive   */
00006 /*  license for use of this work by or on behalf of the U.S. Government.  */
00007 /*                                                                        */
00008 /*  This library is free software; you can redistribute it and/or modify  */
00009 /*  it under the terms of the GNU Lesser General Public License as        */
00010 /*  published by the Free Software Foundation; either version 2.1 of the  */
00011 /*  License, or (at your option) any later version.                       */
00012 /*                                                                        */
00013 /*  This library is distributed in the hope that it will be useful,       */
00014 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of        */
00015 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     */
00016 /*  Lesser General Public License for more details.                       */
00017 /*                                                                        */
00018 /*  You should have received a copy of the GNU Lesser General Public      */
00019 /*  License along with this library; if not, write to the Free Software   */
00020 /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307   */
00021 /*  USA                                                                   */
00022 /*------------------------------------------------------------------------*/
00027 #ifndef util_ParallelIndex_hpp
00028 #define util_ParallelIndex_hpp
00029 
00030 #include <utility>
00031 #include <vector>
00032 
00033 #include <util/Basics.hpp>
00034 #include <util/Parallel.hpp>
00035 
00036 namespace phdmesh {
00037 
00045 class ParallelIndex {
00046 public:
00047 
00048   typedef uint64_type key_type ;
00049 
00050   typedef std::pair< key_type , key_type > KeyProc ;
00051 
00052   struct LessKeyProc {
00053     bool operator()( const KeyProc & lhs , const KeyProc & rhs ) const
00054       { return lhs < rhs ; }
00055 
00056     bool operator()( const KeyProc & lhs , const key_type rhs ) const
00057       { return lhs.first < rhs ; }
00058   };
00059 
00060   ~ParallelIndex();
00061 
00062   ParallelIndex( ParallelMachine , const std::vector<key_type> & );
00063 
00067   void query( std::vector<KeyProc> & ) const ;
00068 
00072   void query( const std::vector<key_type> & , std::vector<KeyProc> & ) const ;
00073 
00074 private:
00075   ParallelIndex();
00076   ParallelIndex( const ParallelIndex & );
00077   ParallelIndex & operator = ( const ParallelIndex & );
00078 
00079   ParallelMachine      m_comm ;
00080   std::vector<KeyProc> m_key_proc ;
00081 };
00082 
00083 }
00084 
00085 //----------------------------------------------------------------------
00086 
00087 #endif
00088 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator