MetisIndex.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9  * -------------------------------------------------------------------------- */
10 
17 #pragma once
18 
19 
20 #include <gtsam/inference/Key.h>
22 #include <gtsam/base/types.h>
23 #include <gtsam/base/timing.h>
24 
25 // Boost bimap generates many ugly warnings in CLANG
26 #ifdef __clang__
27 # pragma clang diagnostic push
28 # pragma clang diagnostic ignored "-Wredeclared-class-member"
29 #endif
30 #include <boost/bimap.hpp>
31 #ifdef __clang__
32 # pragma clang diagnostic pop
33 #endif
34 
35 #include <vector>
36 
37 namespace gtsam {
45 class GTSAM_EXPORT MetisIndex {
46 public:
47  typedef boost::shared_ptr<MetisIndex> shared_ptr;
48  typedef boost::bimap<Key, int32_t> bm_type;
49 
50 private:
51  std::vector<int32_t> xadj_; // Index of node's adjacency list in adj
52  std::vector<int32_t> adj_; // Stores ajacency lists of all nodes, appended into a single vector
53  boost::bimap<Key, int32_t> intKeyBMap_; // Stores Key <-> integer value relationship
54  size_t nKeys_;
55 
56 public:
59 
62  nKeys_(0) {
63  }
64 
65  template<class FG>
66  MetisIndex(const FG& factorGraph) :
67  nKeys_(0) {
68  augment(factorGraph);
69  }
70 
72  }
76 
81  template<class FACTOR>
82  void augment(const FactorGraph<FACTOR>& factors);
83 
84  const std::vector<int32_t>& xadj() const {
85  return xadj_;
86  }
87  const std::vector<int32_t>& adj() const {
88  return adj_;
89  }
90  size_t nValues() const {
91  return nKeys_;
92  }
94  assert(value >= 0);
95  return intKeyBMap_.right.find(value)->second;
96  }
97 
99 };
100 
101 } // \ namesace gtsam
102 
Typedefs for easier changing of types.
std::vector< int32_t > adj_
Definition: MetisIndex.h:52
GaussianFactorGraph factors(list_of(factor1)(factor2)(factor3))
Key intToKey(int32_t value) const
Definition: MetisIndex.h:93
MetisIndex(const FG &factorGraph)
Definition: MetisIndex.h:66
std::vector< int32_t > xadj_
Definition: MetisIndex.h:51
size_t nValues() const
Definition: MetisIndex.h:90
boost::shared_ptr< MetisIndex > shared_ptr
Definition: MetisIndex.h:47
const std::vector< int32_t > & xadj() const
Definition: MetisIndex.h:84
signed int int32_t
Definition: ms_stdint.h:82
traits
Definition: chartTesting.h:28
boost::bimap< Key, int32_t > intKeyBMap_
Definition: MetisIndex.h:53
Factor Graph Base Class.
boost::bimap< Key, int32_t > bm_type
Definition: MetisIndex.h:48
const std::vector< int32_t > & adj() const
Definition: MetisIndex.h:87
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61
Timing utilities.


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:43:00