phdMesh  Version of the Day
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
ParallelIndex.hpp
1 /*------------------------------------------------------------------------*/
2 /* phdMesh : Parallel Heterogneous Dynamic unstructured Mesh */
3 /* Copyright (2007) Sandia Corporation */
4 /* */
5 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
6 /* license for use of this work by or on behalf of the U.S. Government. */
7 /* */
8 /* This library is free software; you can redistribute it and/or modify */
9 /* it under the terms of the GNU Lesser General Public License as */
10 /* published by the Free Software Foundation; either version 2.1 of the */
11 /* License, or (at your option) any later version. */
12 /* */
13 /* This library is distributed in the hope that it will be useful, */
14 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
16 /* Lesser General Public License for more details. */
17 /* */
18 /* You should have received a copy of the GNU Lesser General Public */
19 /* License along with this library; if not, write to the Free Software */
20 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 */
21 /* USA */
22 /*------------------------------------------------------------------------*/
27 #ifndef util_ParallelIndex_hpp
28 #define util_ParallelIndex_hpp
29 
30 #include <utility>
31 #include <vector>
32 
33 #include <util/Basics.hpp>
34 #include <util/Parallel.hpp>
35 
36 namespace phdmesh {
37 
46 public:
47 
48  typedef uint64_type key_type ;
49 
50  typedef std::pair< key_type , key_type > KeyProc ;
51 
52  struct LessKeyProc {
53  bool operator()( const KeyProc & lhs , const KeyProc & rhs ) const
54  { return lhs < rhs ; }
55 
56  bool operator()( const KeyProc & lhs , const key_type rhs ) const
57  { return lhs.first < rhs ; }
58  };
59 
60  ~ParallelIndex();
61 
62  ParallelIndex( ParallelMachine , const std::vector<key_type> & );
63 
67  void query( std::vector<KeyProc> & ) const ;
68 
72  void query( const std::vector<key_type> & , std::vector<KeyProc> & ) const ;
73 
74 private:
75  ParallelIndex();
76  ParallelIndex( const ParallelIndex & );
77  ParallelIndex & operator = ( const ParallelIndex & );
78 
79  ParallelMachine m_comm ;
80  std::vector<KeyProc> m_key_proc ;
81 };
82 
83 }
84 
85 //----------------------------------------------------------------------
86 
87 #endif
88 
void query(std::vector< KeyProc > &) const