File: anetmodel.h

package info (click to toggle)
nam 1.15-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 29,240 kB
  • sloc: cpp: 17,338; tcl: 10,655; sh: 2,997; ansic: 1,252; makefile: 139; perl: 66
file content (81 lines) | stat: -rw-r--r-- 1,893 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * Network model with automatic layout
 *
 * $Header: /cvsroot/nsnam/nam-1/anetmodel.h,v 1.12 2000/11/12 23:19:39 mehringe Exp $
 */

#ifndef nam_anetmodel_h
#define nam_anetmodel_h

#include "netmodel.h"

class AutoNetModel : public NetModel {
public:
	AutoNetModel(const char *animator);
	virtual ~AutoNetModel();

	static int RANDOM_SEED_;
	static int AUTO_ITERATIONS_;
	static int INCR_ITERATIONS_;
	static int recalc_;
	static double INIT_TEMP_; // follow Elan's 
	static double MINX_; 
	static double MAXX_;
	static double MINY_;
	static double MAXY_;
	static double min(double a, double b) {
		return (a < b) ? a : b;
	}
	static double max(double a, double b) {
		return (a > b) ? a : b;
	}

	void handle(const TraceEvent& e, double now, int direction);
	virtual void recalc() {
		scale_estimate();
		placeEverything();
	}
	//virtual void moveNode(Node *n);

  void relayoutNode(Node * v);

protected:
	void reset_layout();
	void layout();
	void relayout();
	virtual void embed_phase1();
	virtual void embed_phase2();
	virtual void embed_phase1(Node * v);
	virtual void embed_phase2(Node * v);
	virtual void scale_estimate();
	virtual void placeEverything();
	void placeAllAgents(Node *src) const;
        void weigh_subtrees();
        void place_subtrees();
        void bifucate_graph();
        int mark_to_depth(Node *n, int depth);

	// attractive and repulsive forces
	double ATT (double d, double k) { return d * d / k; }
	double ATT2 (double d, double k) { return d * d * d / k; }
	double REP (double d, double k) { return k * k / d; }
	void cool();
	void initEmbedding();
	
	// we need our own 'cmd layout'
	int command(int argc, const char*const* argv); 

private:
	int iterations_;
	int nNodes_;
	double optk_;    // k used in computing att/rep forces
	double optka_;
	double optkr_;
	double temp_;
	double kc_;
	double kca_;
	double kcr_;
};


#endif // nam_anetmodel_h