Last change
on this file since 135 was
135,
checked in by sz, 10 years ago
|
neuron layout algorithm (for schematic drawing), usage example in frams/_demos/neuro_layout_test.cpp
|
-
Property svn:eol-style set to
native
|
File size:
1.4 KB
|
Rev | Line | |
---|
[135] | 1 | #ifndef _NN_LAYOUT_H_ |
---|
| 2 | #define _NN_LAYOUT_H_ |
---|
| 3 | |
---|
| 4 | /// abstract neural network layout state |
---|
| 5 | class NNLayoutState |
---|
| 6 | { |
---|
| 7 | public: |
---|
| 8 | |
---|
| 9 | // layout function calls these to inquire about neuron connections: |
---|
| 10 | virtual int GetElements() = 0; ///< @return number of elements (neurons) |
---|
| 11 | virtual int GetInputs(int el) = 0; ///< @return number of inputs in element 'el' (referred to as 'N' in subsequent descriptions) |
---|
| 12 | virtual int GetLink(int el, int i) = 0; ///< @return index of element connected with i-th input of el-th element, or -1 if there is no connection |
---|
| 13 | |
---|
| 14 | // could be useful to refine element placement, but not really used by any layout function: |
---|
| 15 | virtual int *GetLinkXY(int el, int i) = 0; ///< @return relative coordinates of i-th input (or output when i==number of inputs) in el-th element (ret[0],[1]=x,y). unlike other methods, this information depends on the specific neuron drawing code, that's why NNLayoutState is abstract and can be implemented in context of a network drawing component. |
---|
| 16 | |
---|
| 17 | // layout function calls this to place neurons: |
---|
| 18 | virtual void SetXYWH(int el, int x, int y, int w, int h) = 0; // set element position and size |
---|
| 19 | |
---|
| 20 | // layout function user can use this to retrieve the resulting element layout: |
---|
| 21 | virtual int *GetXYWH(int el) = 0; ///< @return current element (el=0..N-1) position and size ret[0],[1],[2],[3]=x,y,w,h |
---|
| 22 | }; |
---|
| 23 | |
---|
| 24 | struct NNLayoutFunction |
---|
| 25 | { |
---|
| 26 | const char *name; |
---|
| 27 | void(*doLayout)(NNLayoutState*); |
---|
| 28 | }; |
---|
| 29 | |
---|
| 30 | extern struct NNLayoutFunction nn_layout_functions[]; |
---|
| 31 | |
---|
| 32 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.