Last change
on this file since 286 was
286,
checked in by Maciej Komosinski, 10 years ago
|
Updated headers
|
-
Property svn:eol-style set to
native
|
File size:
1.1 KB
|
Line | |
---|
1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
2 | // Copyright (C) 1999-2015 Maciej Komosinski and Szymon Ulatowski. |
---|
3 | // See LICENSE.txt for details. |
---|
4 | |
---|
5 | #include "nn_layout_model.h" |
---|
6 | |
---|
7 | NNLayoutState_Model::NNLayoutState_Model(Model* m) |
---|
8 | { |
---|
9 | model = m; |
---|
10 | neuron_pos = (m->getNeuroCount() > 0) ? new NeuronPos[m->getNeuroCount()] : NULL; |
---|
11 | } |
---|
12 | |
---|
13 | NNLayoutState_Model::~NNLayoutState_Model() |
---|
14 | { |
---|
15 | if (neuron_pos) delete[] neuron_pos; |
---|
16 | } |
---|
17 | |
---|
18 | int NNLayoutState_Model::GetElements() |
---|
19 | { |
---|
20 | return model->getNeuroCount(); |
---|
21 | } |
---|
22 | |
---|
23 | int *NNLayoutState_Model::GetXYWH(int el) |
---|
24 | { |
---|
25 | return &neuron_pos[el].x; |
---|
26 | } |
---|
27 | |
---|
28 | void NNLayoutState_Model::SetXYWH(int el, int x, int y, int w, int h) |
---|
29 | { |
---|
30 | NeuronPos &np = neuron_pos[el]; |
---|
31 | np.x = x; np.y = y; np.w = w; np.h = h; |
---|
32 | } |
---|
33 | |
---|
34 | int NNLayoutState_Model::GetInputs(int el) |
---|
35 | { |
---|
36 | return model->getNeuro(el)->getInputCount(); |
---|
37 | } |
---|
38 | |
---|
39 | int NNLayoutState_Model::GetLink(int el, int i) |
---|
40 | { |
---|
41 | return model->getNeuro(el)->getInput(i)->refno; |
---|
42 | } |
---|
43 | |
---|
44 | int *NNLayoutState_Model::GetLinkXY(int el, int i) |
---|
45 | { |
---|
46 | static int XY[2]; |
---|
47 | int *xywh = GetXYWH(el); |
---|
48 | XY[0] = 0; |
---|
49 | XY[1] = ((1 + i)*xywh[3]) / (GetInputs(el) + 1); |
---|
50 | return XY; |
---|
51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.