DotWriter.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010-2021, 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  * -------------------------------------------------------------------------- */
11 
19 #pragma once
20 
21 #include <gtsam/base/FastVector.h>
22 #include <gtsam/base/Vector.h>
23 #include <gtsam/inference/Key.h>
24 
25 #include <iosfwd>
26 #include <map>
27 #include <set>
28 #include <optional>
29 
30 namespace gtsam {
31 
36 struct GTSAM_EXPORT DotWriter {
41  bool binaryEdges;
43 
48  std::map<Key, Vector2> variablePositions;
49 
55  std::map<char, double> positionHints;
56 
58  std::set<Key> boxes;
59 
64  std::map<size_t, Vector2> factorPositions;
65 
66  explicit DotWriter(double figureWidthInches = 5,
67  double figureHeightInches = 5,
68  bool plotFactorPoints = true,
69  bool connectKeysToFactor = true, bool binaryEdges = false)
70  : figureWidthInches(figureWidthInches),
71  figureHeightInches(figureHeightInches),
72  plotFactorPoints(plotFactorPoints),
73  connectKeysToFactor(connectKeysToFactor),
74  binaryEdges(binaryEdges) {}
75 
77  void graphPreamble(std::ostream* os) const;
78 
80  void digraphPreamble(std::ostream* os) const;
81 
83  void drawVariable(Key key, const KeyFormatter& keyFormatter,
84  const std::optional<Vector2>& position,
85  std::ostream* os) const;
86 
88  static void DrawFactor(size_t i, const std::optional<Vector2>& position,
89  std::ostream* os);
90 
92  std::optional<Vector2> variablePos(Key key) const;
93 
95  void processFactor(size_t i, const KeyVector& keys,
96  const KeyFormatter& keyFormatter,
97  const std::optional<Vector2>& position,
98  std::ostream* os) const;
99 };
100 
101 } // namespace gtsam
gtsam::DotWriter::positionHints
std::map< char, double > positionHints
Definition: DotWriter.h:55
gtsam::DotWriter::variablePositions
std::map< Key, Vector2 > variablePositions
Definition: DotWriter.h:48
Vector.h
typedef and functions to augment Eigen's VectorXd
FastVector.h
A thin wrapper around std::vector that uses a custom allocator.
gtsam::DotWriter::boxes
std::set< Key > boxes
Definition: DotWriter.h:58
keys
const KeyVector keys
Definition: testRegularImplicitSchurFactor.cpp:40
gtsam::position
Point3_ position(const NavState_ &X)
Definition: navigation/expressions.h:37
gtsam::DotWriter::connectKeysToFactor
bool connectKeysToFactor
Definition: DotWriter.h:40
os
ofstream os("timeSchurFactors.csv")
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:92
gtsam::DotWriter::figureHeightInches
double figureHeightInches
The figure height on paper in inches.
Definition: DotWriter.h:38
Key.h
gtsam::DotWriter::figureWidthInches
double figureWidthInches
The figure width on paper in inches.
Definition: DotWriter.h:37
gtsam::KeyFormatter
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:35
key
const gtsam::Symbol key('X', 0)
gtsam
traits
Definition: chartTesting.h:28
gtsam::DotWriter::plotFactorPoints
bool plotFactorPoints
Plots each factor as a dot between the variables.
Definition: DotWriter.h:39
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
gtsam::DotWriter
DotWriter is a helper class for writing graphviz .dot files.
Definition: DotWriter.h:36
gtsam::DotWriter::factorPositions
std::map< size_t, Vector2 > factorPositions
Definition: DotWriter.h:64
gtsam::DotWriter::DotWriter
DotWriter(double figureWidthInches=5, double figureHeightInches=5, bool plotFactorPoints=true, bool connectKeysToFactor=true, bool binaryEdges=false)
Definition: DotWriter.h:66


gtsam
Author(s):
autogenerated on Thu Jun 13 2024 03:02:15