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
|