Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

SEGV_ForceModel.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Array.h>
35 #include <ogdf/basic/geometry.h>
38 
39 #include <functional>
40 
41 namespace ogdf {
42 template<class E>
43 class Array2D;
44 template<class E>
45 class ListPure;
46 
48  : public spring_embedder::CommonForceModelBase<NodeInfo> {
49 public:
50  ForceModelBase(const Array<NodeInfo>& vInfo, const Array<int>& adjLists,
51  const Array2D<ListPure<int>>& gridCell, double idealEdgeLength)
52  : spring_embedder::CommonForceModelBase<NodeInfo>(vInfo, adjLists, idealEdgeLength)
53  , m_gridCell(gridCell) { }
54 
55  virtual ~ForceModelBase() { }
56 
57  virtual DPoint computeDisplacement(int j, double boxLength) const = 0;
58 
59 protected:
61 
62  DPoint computeRepulsiveForce(int j, double boxLength, int idealExponent,
63  int normExponent = 1) const;
64  DPoint computeMixedForcesDisplacement(int j, int boxLength,
65  std::function<DPoint(double, const DPoint&)> attractiveChange,
66  std::function<double()> attractiveFinal) const;
67 };
68 
70 public:
71  ForceModelFR(const Array<NodeInfo>& vInfo, const Array<int>& adjLists,
72  const Array2D<ListPure<int>>& gridCell, double idealEdgeLength)
73  : ForceModelBase(vInfo, adjLists, gridCell, idealEdgeLength) { }
74 
75  DPoint computeDisplacement(int j, double boxLength) const override;
76 };
77 
79 public:
80  ForceModelFRModAttr(const Array<NodeInfo>& vInfo, const Array<int>& adjLists,
81  const Array2D<ListPure<int>>& gridCell, double idealEdgeLength)
82  : ForceModelBase(vInfo, adjLists, gridCell, idealEdgeLength) { }
83 
84  DPoint computeDisplacement(int j, double boxLength) const override;
85 };
86 
88 public:
89  ForceModelFRModRep(const Array<NodeInfo>& vInfo, const Array<int>& adjLists,
90  const Array2D<ListPure<int>>& gridCell, double idealEdgeLength)
91  : ForceModelBase(vInfo, adjLists, gridCell, idealEdgeLength) { }
92 
93  DPoint computeDisplacement(int j, double boxLength) const override;
94 };
95 
97 public:
98  ForceModelEades(const Array<NodeInfo>& vInfo, const Array<int>& adjLists,
99  const Array2D<ListPure<int>>& gridCell, double idealEdgeLength)
100  : ForceModelBase(vInfo, adjLists, gridCell, idealEdgeLength) { }
101 
102  DPoint computeDisplacement(int j, double boxLength) const override;
103 };
104 
106 public:
107  ForceModelHachul(const Array<NodeInfo>& vInfo, const Array<int>& adjLists,
108  const Array2D<ListPure<int>>& gridCell, double idealEdgeLength)
109  : ForceModelBase(vInfo, adjLists, gridCell, idealEdgeLength) { }
110 
111  DPoint computeDisplacement(int j, double boxLength) const override;
112 };
113 
115 public:
116  ForceModelGronemann(const Array<NodeInfo>& vInfo, const Array<int>& adjLists,
117  const Array2D<ListPure<int>>& gridCell, double idealEdgeLength)
118  : ForceModelBase(vInfo, adjLists, gridCell, idealEdgeLength) { }
119 
120  DPoint computeDisplacement(int j, double boxLength) const override;
121 };
122 
123 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::SpringEmbedderGridVariant::ForceModelBase::computeRepulsiveForce
DPoint computeRepulsiveForce(int j, double boxLength, int idealExponent, int normExponent=1) const
ogdf::SpringEmbedderGridVariant::ForceModelBase::computeMixedForcesDisplacement
DPoint computeMixedForcesDisplacement(int j, int boxLength, std::function< DPoint(double, const DPoint &)> attractiveChange, std::function< double()> attractiveFinal) const
ogdf::SpringEmbedderGridVariant::ForceModelGronemann
Definition: SEGV_ForceModel.h:114
ogdf::GenericPoint< double >
ogdf::SpringEmbedderGridVariant::ForceModelFRModRep
Definition: SEGV_ForceModel.h:87
ogdf::SpringEmbedderGridVariant::ForceModelEades
Definition: SEGV_ForceModel.h:96
geometry.h
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
ogdf::spring_embedder::CommonForceModelBase
Definition: common.h:43
ogdf::SpringEmbedderGridVariant::ForceModelFRModAttr
Definition: SEGV_ForceModel.h:78
ogdf::SpringEmbedderGridVariant::ForceModelBase
Definition: SEGV_ForceModel.h:47
ogdf::SpringEmbedderGridVariant::ForceModelBase::ForceModelBase
ForceModelBase(const Array< NodeInfo > &vInfo, const Array< int > &adjLists, const Array2D< ListPure< int >> &gridCell, double idealEdgeLength)
Definition: SEGV_ForceModel.h:50
ogdf::SpringEmbedderGridVariant::ForceModelHachul::computeDisplacement
DPoint computeDisplacement(int j, double boxLength) const override
ogdf::SpringEmbedderGridVariant::ForceModelFRModRep::computeDisplacement
DPoint computeDisplacement(int j, double boxLength) const override
ogdf::SpringEmbedderGridVariant::ForceModelBase::computeDisplacement
virtual DPoint computeDisplacement(int j, double boxLength) const =0
ogdf::Array2D
The parameterized class Array2D implements dynamic two-dimensional arrays.
Definition: Array2D.h:53
ogdf::SpringEmbedderGridVariant::ForceModelHachul::ForceModelHachul
ForceModelHachul(const Array< NodeInfo > &vInfo, const Array< int > &adjLists, const Array2D< ListPure< int >> &gridCell, double idealEdgeLength)
Definition: SEGV_ForceModel.h:107
ogdf::SpringEmbedderGridVariant::ForceModelHachul
Definition: SEGV_ForceModel.h:105
ogdf::SpringEmbedderGridVariant::ForceModelBase::m_gridCell
const Array2D< ListPure< int > > & m_gridCell
Definition: SEGV_ForceModel.h:60
ogdf::SpringEmbedderGridVariant::ForceModelFRModRep::ForceModelFRModRep
ForceModelFRModRep(const Array< NodeInfo > &vInfo, const Array< int > &adjLists, const Array2D< ListPure< int >> &gridCell, double idealEdgeLength)
Definition: SEGV_ForceModel.h:89
SpringEmbedderGridVariant.h
Declaration of ogdf::SpringEmbedderGridVariant.
ogdf::SpringEmbedderGridVariant::ForceModelFR
Definition: SEGV_ForceModel.h:69
ogdf::SpringEmbedderGridVariant::ForceModelBase::~ForceModelBase
virtual ~ForceModelBase()
Definition: SEGV_ForceModel.h:55
ogdf::SpringEmbedderGridVariant::ForceModelGronemann::computeDisplacement
DPoint computeDisplacement(int j, double boxLength) const override
ogdf::SpringEmbedderGridVariant::NodeInfo
Definition: SpringEmbedderGridVariant.h:91
ogdf::Array< NodeInfo >
ogdf::SpringEmbedderGridVariant::ForceModelFRModAttr::ForceModelFRModAttr
ForceModelFRModAttr(const Array< NodeInfo > &vInfo, const Array< int > &adjLists, const Array2D< ListPure< int >> &gridCell, double idealEdgeLength)
Definition: SEGV_ForceModel.h:80
ogdf::SpringEmbedderGridVariant::ForceModelEades::computeDisplacement
DPoint computeDisplacement(int j, double boxLength) const override
common.h
Common implementations of force models for SpringEmbedder algorithms.
ogdf::SpringEmbedderGridVariant::ForceModelGronemann::ForceModelGronemann
ForceModelGronemann(const Array< NodeInfo > &vInfo, const Array< int > &adjLists, const Array2D< ListPure< int >> &gridCell, double idealEdgeLength)
Definition: SEGV_ForceModel.h:116
ogdf::ListPure< int >
ogdf::SpringEmbedderGridVariant::ForceModelFRModAttr::computeDisplacement
DPoint computeDisplacement(int j, double boxLength) const override
ogdf::DPoint
GenericPoint< double > DPoint
Representing two-dimensional point with real coordinates.
Definition: geometry.h:244
ogdf::SpringEmbedderGridVariant::ForceModelFR::computeDisplacement
DPoint computeDisplacement(int j, double boxLength) const override
ogdf::SpringEmbedderGridVariant::ForceModelFR::ForceModelFR
ForceModelFR(const Array< NodeInfo > &vInfo, const Array< int > &adjLists, const Array2D< ListPure< int >> &gridCell, double idealEdgeLength)
Definition: SEGV_ForceModel.h:71
ogdf::spring_embedder::SpringEmbedderBase::idealEdgeLength
double idealEdgeLength() const
Returns the current setting of ideal edge length.
Definition: SpringEmbedderBase.h:240
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::SpringEmbedderGridVariant::ForceModelEades::ForceModelEades
ForceModelEades(const Array< NodeInfo > &vInfo, const Array< int > &adjLists, const Array2D< ListPure< int >> &gridCell, double idealEdgeLength)
Definition: SEGV_ForceModel.h:98
ogdf::spring_embedder::CommonForceModelBase::CommonForceModelBase
CommonForceModelBase(const Array< NodeInfo > &vInfo, const Array< int > &adjLists, double idealEdgeLength)
Definition: common.h:45