|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | #include "FixedLayout.h" |
| 10 | +#include "ConnGrowth.h" |
10 | 11 | #include "ParameterManager.h" |
11 | 12 | #include "ParseParamError.h" |
12 | 13 | #include "Util.h" |
@@ -129,11 +130,10 @@ void FixedLayout::loadParameters() |
129 | 130 | + inhibitoryNListFilePath); |
130 | 131 | } |
131 | 132 |
|
132 | | - // Get the total number of vertices |
133 | | - int width, height; |
134 | | - ParameterManager::getInstance().getIntByXpath("//PoolSize/x/text()", width); |
135 | | - ParameterManager::getInstance().getIntByXpath("//PoolSize/y/text()", height); |
136 | | - numVertices_ = width * height; |
| 133 | + // Get width, height and total number of vertices |
| 134 | + ParameterManager::getInstance().getIntByXpath("//PoolSize/x/text()", width_); |
| 135 | + ParameterManager::getInstance().getIntByXpath("//PoolSize/y/text()", height_); |
| 136 | + numVertices_ = width_ * height_; |
137 | 137 | } |
138 | 138 |
|
139 | 139 | /// Returns the type of synapse at the given coordinates |
@@ -164,14 +164,64 @@ void FixedLayout::initVerticesLocs() |
164 | 164 | if (gridLayout_) { |
165 | 165 | // grid layout |
166 | 166 | for (int i = 0; i < numVertices; i++) { |
167 | | - xloc_[i] = i % Simulator::getInstance().getHeight(); |
168 | | - yloc_[i] = i / Simulator::getInstance().getHeight(); |
| 167 | + xloc_[i] = i % height_; |
| 168 | + yloc_[i] = i / height_; |
169 | 169 | } |
170 | 170 | } else { |
171 | 171 | // random layout |
172 | 172 | for (int i = 0; i < numVertices; i++) { |
173 | | - xloc_[i] = initRNG.inRange(0, Simulator::getInstance().getWidth()); |
174 | | - yloc_[i] = initRNG.inRange(0, Simulator::getInstance().getHeight()); |
| 173 | + xloc_[i] = initRNG.inRange(0, width_); |
| 174 | + yloc_[i] = initRNG.inRange(0, height_); |
175 | 175 | } |
176 | 176 | } |
177 | 177 | } |
| 178 | + |
| 179 | +// Note: This code was previously used for debugging, but it is now dead code left behind |
| 180 | +// and it is never executed. |
| 181 | +void FixedLayout::printLayout() |
| 182 | +{ |
| 183 | + ConnGrowth &pConnGrowth |
| 184 | + = dynamic_cast<ConnGrowth &>(Simulator::getInstance().getModel().getConnections()); |
| 185 | + |
| 186 | + cout << "format:\ntype,radius,firing rate" << endl; |
| 187 | + |
| 188 | + for (int y = 0; y < height_; y++) { |
| 189 | + stringstream ss; |
| 190 | + ss << fixed; |
| 191 | + ss.precision(1); |
| 192 | + |
| 193 | + for (int x = 0; x < width_; x++) { |
| 194 | + switch (vertexTypeMap_[x + y * width_]) { |
| 195 | + case EXC: |
| 196 | + if (starterMap_[x + y * width_]) |
| 197 | + ss << "s"; |
| 198 | + else |
| 199 | + ss << "e"; |
| 200 | + break; |
| 201 | + case INH: |
| 202 | + ss << "i"; |
| 203 | + break; |
| 204 | + case VTYPE_UNDEF: |
| 205 | + assert(false); |
| 206 | + break; |
| 207 | + } |
| 208 | + |
| 209 | + ss << " " << pConnGrowth.radii_[x + y * width_]; |
| 210 | + |
| 211 | + if (x + 1 < width_) { |
| 212 | + ss.width(2); |
| 213 | + ss << "|"; |
| 214 | + ss.width(2); |
| 215 | + } |
| 216 | + } |
| 217 | + |
| 218 | + ss << endl; |
| 219 | + |
| 220 | + for (int i = ss.str().length() - 1; i >= 0; i--) { |
| 221 | + ss << "_"; |
| 222 | + } |
| 223 | + |
| 224 | + ss << endl; |
| 225 | + cout << ss.str(); |
| 226 | + } |
| 227 | +} |
0 commit comments