diff --git a/.gitignore b/.gitignore index 5b2a2e58a..9d0e23327 100644 --- a/.gitignore +++ b/.gitignore @@ -89,6 +89,7 @@ lib/ # log4cplus logging files build/Output/Debug/*.txt +build/Output/Debug/*.txt* # Result files build/Output/*.xml diff --git a/Simulator/Connections/NG911/Connections911.cpp b/Simulator/Connections/NG911/Connections911.cpp index a32162969..e30d3f466 100644 --- a/Simulator/Connections/NG911/Connections911.cpp +++ b/Simulator/Connections/NG911/Connections911.cpp @@ -106,7 +106,7 @@ bool Connections911::erasePSAP(AllVertices &vertices, Layout &layout) // Find all psaps for (int i = 0; i < numVertices; i++) { - if (layout.vertexTypeMap_[i] == vertexType::PSAP) { + if (layout.getVertices().vertexTypeMap_[i] == vertexType::PSAP) { psaps.push_back(i); } } @@ -150,14 +150,14 @@ bool Connections911::erasePSAP(AllVertices &vertices, Layout &layout) edges_->eraseEdge(destVertex, iEdg); // Identify all psap-less callers - if (layout.vertexTypeMap_[srcVertex] == vertexType::CALR) { + if (layout.getVertices().vertexTypeMap_[srcVertex] == vertexType::CALR) { callersToReroute.push_back(srcVertex); } // Identify all psap-less responders - if (layout.vertexTypeMap_[destVertex] == vertexType::LAW - || layout.vertexTypeMap_[destVertex] == vertexType::FIRE - || layout.vertexTypeMap_[destVertex] == vertexType::EMS) { + if (layout.getVertices().vertexTypeMap_[destVertex] == vertexType::LAW + || layout.getVertices().vertexTypeMap_[destVertex] == vertexType::FIRE + || layout.getVertices().vertexTypeMap_[destVertex] == vertexType::EMS) { respsToReroute.push_back(destVertex); } } @@ -166,7 +166,7 @@ bool Connections911::erasePSAP(AllVertices &vertices, Layout &layout) if (changesMade) { // This is here so that we don't delete the vertex if we can't find any edges verticesErased_.push_back(randPSAP); - layout.vertexTypeMap_[randPSAP] = vertexType::VTYPE_UNDEF; + layout.getVertices().vertexTypeMap_[randPSAP] = vertexType::VTYPE_UNDEF; } // Failsafe @@ -243,9 +243,9 @@ bool Connections911::eraseRESP(AllVertices &vertices, Layout &layout) // Find all resps for (int i = 0; i < numVertices; i++) { - if (layout.vertexTypeMap_[i] == vertexType::LAW - || layout.vertexTypeMap_[i] == vertexType::FIRE - || layout.vertexTypeMap_[i] == vertexType::EMS) { + if (layout.getVertices().vertexTypeMap_[i] == vertexType::LAW + || layout.getVertices().vertexTypeMap_[i] == vertexType::FIRE + || layout.getVertices().vertexTypeMap_[i] == vertexType::EMS) { resps.push_back(i); } } @@ -288,7 +288,7 @@ bool Connections911::eraseRESP(AllVertices &vertices, Layout &layout) if (changesMade) { // This is here so that we don't delete the vertex if we can't find any edges verticesErased_.push_back(randRESP); - layout.vertexTypeMap_[randRESP] = vertexType::VTYPE_UNDEF; + layout.getVertices().vertexTypeMap_[randRESP] = vertexType::VTYPE_UNDEF; } return changesMade; diff --git a/Simulator/Connections/Neuro/ConnGrowth_d.cpp b/Simulator/Connections/Neuro/ConnGrowth_d.cpp index 1854bfe83..c1b49a20b 100644 --- a/Simulator/Connections/Neuro/ConnGrowth_d.cpp +++ b/Simulator/Connections/Neuro/ConnGrowth_d.cpp @@ -59,7 +59,7 @@ void ConnGrowth::updateEdgesWeights(int numVertices, AllVertices &vertices, AllE HANDLE_ERROR(cudaMemcpy(W_d, W_h, W_d_size, cudaMemcpyHostToDevice)); - HANDLE_ERROR(cudaMemcpy(neuronTypeMapD, layout.vertexTypeMap_.data(), + HANDLE_ERROR(cudaMemcpy(neuronTypeMapD, layout.getVertices().vertexTypeMap_.data(), simulator.getTotalVertices() * sizeof(vertexType), cudaMemcpyHostToDevice)); diff --git a/Simulator/Layouts/Layout.cpp b/Simulator/Layouts/Layout.cpp index 359980e04..533106c55 100644 --- a/Simulator/Layouts/Layout.cpp +++ b/Simulator/Layouts/Layout.cpp @@ -12,8 +12,6 @@ #include "OperationManager.h" #include "ParameterManager.h" #include "ParseParamError.h" -#include "RecordableBase.h" -#include "Simulator.h" #include "Util.h" /// Constructor @@ -83,59 +81,23 @@ void Layout::registerGraphProperties() void Layout::registerHistoryVariables() { - // Register vertex type map - Recorder &recorder = Simulator::getInstance().getModel().getRecorder(); - recorder.registerVariable("vertexTypeMap", vertexTypeMap_, Recorder::UpdatedType::CONSTANT); } - /// Setup the internal structure of the class. /// Allocate memories to store all layout state, no sequential dependency in this method void Layout::setup() { dist2_ = CompleteMatrix(MATRIX_TYPE, MATRIX_INIT, numVertices_, numVertices_); dist_ = CompleteMatrix(MATRIX_TYPE, MATRIX_INIT, numVertices_, numVertices_); - // Allocation of internal memory - vertexTypeMap_.assign(numVertices_, vertexType::VTYPE_UNDEF); } -/// Prints out all parameters to logging file. Registered to OperationManager as Operation::printParameters -void Layout::printParameters() const -{ - GraphManager::VertexIterator vi, vi_end; - GraphManager &gm = GraphManager::getInstance(); - stringstream output; - output << "\nLAYOUT PARAMETERS" << endl; - output << "\tEndogenously active neuron positions: "; - - for (boost::tie(vi, vi_end) = gm.vertices(); vi != vi_end; ++vi) { - assert(*vi < numVertices_); - if (gm[*vi].active) { - output << *vi << " "; - } - } - output << endl; - - output << "\tInhibitory neuron positions: "; - - for (boost::tie(vi, vi_end) = gm.vertices(); vi != vi_end; ++vi) { - assert(*vi < numVertices_); - if (gm[*vi].type == "INH") { - output << *vi << " "; - } - } - output << endl; - - LOG4CPLUS_DEBUG(fileLogger_, output.str()); -} - /// Creates a vertex type map. /// @param numVertices number of the vertices to have in the type map. void Layout::generateVertexTypeMap() { DEBUG(cout << "\nInitializing vertex type map: VTYPE_UNDEF" << endl;); - vertexTypeMap_.assign(numVertices_, vertexType::VTYPE_UNDEF); + getVertices().vertexTypeMap_.assign(numVertices_, vertexType::VTYPE_UNDEF); } void Layout::initStarterMap() diff --git a/Simulator/Layouts/Layout.h b/Simulator/Layouts/Layout.h index d604bf2fc..6268f77e8 100644 --- a/Simulator/Layouts/Layout.h +++ b/Simulator/Layouts/Layout.h @@ -14,7 +14,6 @@ #pragma once #include "AllVertices.h" -#include "RecordableVector.h" #include "Utils/Global.h" #include #include @@ -49,8 +48,9 @@ class Layout { /// Load member variables from configuration files. Registered to OperationManager as Operation::loadParameters virtual void loadParameters(); - /// Prints out all parameters to logging file. Registered to OperationManager as Operation::printParameters - virtual void printParameters() const; + /// Prints out model-specific parameters to the logging file. Registered to OperationManager as + /// Operation::printParameters. Implemented only on concrete layouts (same pattern as loadParameters). + virtual void printParameters() const = 0; /// Creates a neurons type map virtual void generateVertexTypeMap(); @@ -71,11 +71,6 @@ class Layout { CompleteMatrix dist_; ///< The true inter-neuron distance. - vector - probedVertexList_; ///< Probed neurons list. // ToDo: Move this to Hdf5 recorder once its implemented in project -chris - - RecordableVector vertexTypeMap_; ///< The vertex type mao, (INH, EXC). - /// Cereal serialization method template void serialize(Archive &archive); @@ -90,7 +85,6 @@ class Layout { /// Cereal serialization method template void Layout::serialize(Archive &archive) { - archive(cereal::make_nvp("vertexTypeMap", vertexTypeMap_), cereal::make_nvp("dist2", dist2_), - cereal::make_nvp("dist", dist_), cereal::make_nvp("probedVertexList", probedVertexList_), + archive(cereal::make_nvp("dist2", dist2_), cereal::make_nvp("dist", dist_), cereal::make_nvp("vertices", vertices_), cereal::make_nvp("numVertices", numVertices_)); } diff --git a/Simulator/Layouts/NG911/Layout911.cpp b/Simulator/Layouts/NG911/Layout911.cpp index d024e2ea1..69dd0c96f 100644 --- a/Simulator/Layouts/NG911/Layout911.cpp +++ b/Simulator/Layouts/NG911/Layout911.cpp @@ -98,12 +98,34 @@ void Layout911::generateVertexTypeMap() // Add all vertices GraphManager::VertexIterator vi, vi_end; GraphManager &gm = GraphManager::getInstance(); + callerVertexList_.clear(); + psapVertexList_.clear(); + responderVertexList_.clear(); + LOG4CPLUS_DEBUG(fileLogger_, "\nvertices in graph: " << gm.numVertices()); for (boost::tie(vi, vi_end) = gm.vertices(); vi != vi_end; ++vi) { assert(*vi < numVertices_); - vertexTypeMap_[*vi] = vTypeMap[gm[*vi].type]; + vertexType vt = vTypeMap[gm[*vi].type]; + getVertices().vertexTypeMap_[*vi] = vt; vTypeCount[gm[*vi].type] += 1; + + switch (vt) { + case vertexType::CALR: + callerVertexList_.push_back(*vi); + break; + case vertexType::PSAP: + psapVertexList_.push_back(*vi); + break; + case vertexType::LAW: + case vertexType::FIRE: + case vertexType::EMS: + responderVertexList_.push_back(*vi); + break; + default: + break; + } } + numCallerVertices_ = static_cast(callerVertexList_.size()); LOG4CPLUS_DEBUG(fileLogger_, "\nVERTEX TYPE MAP" << endl @@ -120,29 +142,24 @@ void Layout911::generateVertexTypeMap() // Returns the type of synapse at the given coordinates edgeType Layout911::edgType(int srcVertex, int destVertex) { - if (vertexTypeMap_[srcVertex] == vertexType::CALR - && vertexTypeMap_[destVertex] == vertexType::PSAP) + auto &vtypes = getVertices().vertexTypeMap_; + if (vtypes[srcVertex] == vertexType::CALR && vtypes[destVertex] == vertexType::PSAP) return edgeType::CP; - else if (vertexTypeMap_[srcVertex] == vertexType::PSAP - && (vertexTypeMap_[destVertex] == vertexType::LAW - || vertexTypeMap_[destVertex] == vertexType::FIRE - || vertexTypeMap_[destVertex] == vertexType::EMS)) + else if (vtypes[srcVertex] == vertexType::PSAP + && (vtypes[destVertex] == vertexType::LAW || vtypes[destVertex] == vertexType::FIRE + || vtypes[destVertex] == vertexType::EMS)) return edgeType::PR; - else if (vertexTypeMap_[srcVertex] == vertexType::PSAP - && vertexTypeMap_[destVertex] == vertexType::CALR) + else if (vtypes[srcVertex] == vertexType::PSAP && vtypes[destVertex] == vertexType::CALR) return edgeType::PC; - else if (vertexTypeMap_[srcVertex] == vertexType::PSAP - && vertexTypeMap_[destVertex] == vertexType::PSAP) + else if (vtypes[srcVertex] == vertexType::PSAP && vtypes[destVertex] == vertexType::PSAP) return edgeType::PP; - else if ((vertexTypeMap_[srcVertex] == vertexType::LAW - || vertexTypeMap_[destVertex] == vertexType::FIRE - || vertexTypeMap_[destVertex] == vertexType::EMS) - && vertexTypeMap_[destVertex] == vertexType::PSAP) + else if ((vtypes[srcVertex] == vertexType::LAW || vtypes[srcVertex] == vertexType::FIRE + || vtypes[srcVertex] == vertexType::EMS) + && vtypes[destVertex] == vertexType::PSAP) return edgeType::RP; - else if ((vertexTypeMap_[srcVertex] == vertexType::LAW - || vertexTypeMap_[destVertex] == vertexType::FIRE - || vertexTypeMap_[destVertex] == vertexType::EMS) - && vertexTypeMap_[destVertex] == vertexType::CALR) + else if ((vtypes[srcVertex] == vertexType::LAW || vtypes[srcVertex] == vertexType::FIRE + || vtypes[srcVertex] == vertexType::EMS) + && vtypes[destVertex] == vertexType::CALR) return edgeType::RC; else return edgeType::ETYPE_UNDEF; diff --git a/Simulator/Layouts/NG911/Layout911.h b/Simulator/Layouts/NG911/Layout911.h index 3b912391a..c2f80ed88 100644 --- a/Simulator/Layouts/NG911/Layout911.h +++ b/Simulator/Layouts/NG911/Layout911.h @@ -83,6 +83,14 @@ class Layout911 : public Layout { /// @return The distance between the given vertex and the (x, y) coordinates of a point double getDistance(int vertexId, double x, double y); + /// Caller vertex count (set during \ref generateVertexTypeMap). + BGSIZE numCallerVertices_ = 0; + + /// Vertex indices grouped by NG911 role; filled in \ref generateVertexTypeMap. + vector callerVertexList_; + vector psapVertexList_; + vector responderVertexList_; + DeviceVector xloc_; DeviceVector yloc_; }; diff --git a/Simulator/Layouts/Neuro/LayoutNeuro.cpp b/Simulator/Layouts/Neuro/LayoutNeuro.cpp index 3c2c14ea3..f5e5b6473 100644 --- a/Simulator/Layouts/Neuro/LayoutNeuro.cpp +++ b/Simulator/Layouts/Neuro/LayoutNeuro.cpp @@ -12,6 +12,7 @@ #include "ParameterManager.h" #include "ParseParamError.h" #include "Util.h" +#include // TODO: I don't think that either of the constructor or destructor is needed here LayoutNeuro::LayoutNeuro() : Layout() @@ -87,9 +88,23 @@ void LayoutNeuro::registerHistoryVariables() /// Registered to OperationManager as Operation::printParameters void LayoutNeuro::printParameters() const { - Layout::printParameters(); + stringstream output; + output << "\nLAYOUT PARAMETERS" << endl; + output << "\tEndogenously active neuron positions: "; + for (int idx : endogenouslyActiveNeuronList_) { + output << idx << " "; + } + output << endl; + + output << "\tInhibitory neuron positions: "; + for (int idx : inhibitoryNeuronLayout_) { + output << idx << " "; + } + output << endl; + + output << "\n\tLayout type: LayoutNeuro" << endl << endl; - LOG4CPLUS_DEBUG(fileLogger_, "\n\tLayout type: LayoutNeuro" << endl << endl); + LOG4CPLUS_DEBUG(fileLogger_, output.str()); } /// Creates a randomly ordered distribution with the specified numbers of vertex types. @@ -99,9 +114,11 @@ void LayoutNeuro::generateVertexTypeMap() { LOG4CPLUS_DEBUG(fileLogger_, "\nInitializing vertex type map" << endl); - int numInhibitoryNeurons; + int numInhibitoryNeurons = 0; int numExcititoryNeurons; + inhibitoryNeuronLayout_.clear(); + // Set Neuron Type from GraphML File GraphManager::VertexIterator vi, vi_end; GraphManager &gm = GraphManager::getInstance(); @@ -109,12 +126,13 @@ void LayoutNeuro::generateVertexTypeMap() for (boost::tie(vi, vi_end) = gm.vertices(); vi != vi_end; ++vi) { assert(*vi < numVertices_); if (gm[*vi].type == "INH") { - vertexTypeMap_[*vi] = vertexType::INH; + getVertices().vertexTypeMap_[*vi] = vertexType::INH; + inhibitoryNeuronLayout_.push_back(*vi); numInhibitoryNeurons++; } // Default Type is Excitatory else { - vertexTypeMap_[*vi] = vertexType::EXC; + getVertices().vertexTypeMap_[*vi] = vertexType::EXC; } } @@ -133,6 +151,9 @@ void LayoutNeuro::generateVertexTypeMap() /// @param numVertices number of vertices to have in the map. void LayoutNeuro::initStarterMap() { + endogenouslyActiveNeuronList_.clear(); + numEndogenouslyActiveNeurons_ = 0; + // Set Neuron Activity from GraphML File GraphManager::VertexIterator vi, vi_end; GraphManager &gm = GraphManager::getInstance(); @@ -143,6 +164,7 @@ void LayoutNeuro::initStarterMap() assert(*vi < numVertices_); if (gm[*vi].active) { starterMap_[*vi] = true; + endogenouslyActiveNeuronList_.push_back(*vi); numEndogenouslyActiveNeurons_++; } } @@ -155,17 +177,14 @@ void LayoutNeuro::initStarterMap() /// @return type of the synapse. edgeType LayoutNeuro::edgType(int srcVertex, int destVertex) { - if (vertexTypeMap_[srcVertex] == vertexType::INH - && vertexTypeMap_[destVertex] == vertexType::INH) + auto &vtypes = getVertices().vertexTypeMap_; + if (vtypes[srcVertex] == vertexType::INH && vtypes[destVertex] == vertexType::INH) return edgeType::II; - else if (vertexTypeMap_[srcVertex] == vertexType::INH - && vertexTypeMap_[destVertex] == vertexType::EXC) + else if (vtypes[srcVertex] == vertexType::INH && vtypes[destVertex] == vertexType::EXC) return edgeType::IE; - else if (vertexTypeMap_[srcVertex] == vertexType::EXC - && vertexTypeMap_[destVertex] == vertexType::INH) + else if (vtypes[srcVertex] == vertexType::EXC && vtypes[destVertex] == vertexType::INH) return edgeType::EI; - else if (vertexTypeMap_[srcVertex] == vertexType::EXC - && vertexTypeMap_[destVertex] == vertexType::EXC) + else if (vtypes[srcVertex] == vertexType::EXC && vtypes[destVertex] == vertexType::EXC) return edgeType::EE; return edgeType::ETYPE_UNDEF; diff --git a/Simulator/Layouts/Neuro/LayoutNeuro.h b/Simulator/Layouts/Neuro/LayoutNeuro.h index b31e2f21a..2c46c3b09 100644 --- a/Simulator/Layouts/Neuro/LayoutNeuro.h +++ b/Simulator/Layouts/Neuro/LayoutNeuro.h @@ -70,6 +70,15 @@ class LayoutNeuro : public Layout { BGSIZE numEndogenouslyActiveNeurons_; ///< Number of endogenously active neurons. + /// Indices of endogenously active (starter) neurons; filled in \ref initStarterMap. + vector endogenouslyActiveNeuronList_; + + /// Indices of inhibitory neurons; filled in \ref generateVertexTypeMap. + vector inhibitoryNeuronLayout_; + + /// Indices of probed neurons for recording (HDF5 / future recorders). + vector probedVertexList_; + /// Cereal serialization method template void serialize(Archive &archive); }; @@ -81,5 +90,8 @@ template void LayoutNeuro::serialize(Archive &archive) { archive(cereal::virtual_base_class(this), cereal::make_nvp("xloc", xloc_), cereal::make_nvp("yloc", yloc_), cereal::make_nvp("starterMap", starterMap_), - cereal::make_nvp("numEndogenouslyActiveNeurons", numEndogenouslyActiveNeurons_)); + cereal::make_nvp("numEndogenouslyActiveNeurons", numEndogenouslyActiveNeurons_), + cereal::make_nvp("endogenouslyActiveNeuronList", endogenouslyActiveNeuronList_), + cereal::make_nvp("inhibitoryNeuronLayout", inhibitoryNeuronLayout_), + cereal::make_nvp("probedVertexList", probedVertexList_)); } diff --git a/Simulator/Recorders/NG911/Xml911Recorder.cpp b/Simulator/Recorders/NG911/Xml911Recorder.cpp index cc7535cfe..f7d058be3 100644 --- a/Simulator/Recorders/NG911/Xml911Recorder.cpp +++ b/Simulator/Recorders/NG911/Xml911Recorder.cpp @@ -42,7 +42,8 @@ void Xml911Recorder::saveSimData() for (int i = 0; i < Simulator::getInstance().getTotalVertices(); i++) { vertexTypes[i] - = static_cast(Simulator::getInstance().getModel().getLayout().vertexTypeMap_[i]); + = static_cast( + Simulator::getInstance().getModel().getLayout().getVertices().vertexTypeMap_[i]); oldTypes[i] = static_cast(conns911.oldTypeMap_[i]); } diff --git a/Simulator/Utils/Inputs/SInputPoisson.cpp b/Simulator/Utils/Inputs/SInputPoisson.cpp index 3878f7352..61a5a1695 100644 --- a/Simulator/Utils/Inputs/SInputPoisson.cpp +++ b/Simulator/Utils/Inputs/SInputPoisson.cpp @@ -67,7 +67,7 @@ SInputPoisson::SInputPoisson(TiXmlElement *parms) : TiXmlDocument simDoc(maskNListFileName.c_str()); if (!simDoc.LoadFile()) { cerr << "Failed loading positions of stimulus input mask neurons list file " - << maskNListFileName << ":" << "\n\t" << simDoc.ErrorDesc() << endl; + << maskNListFileName << ":\n\t" << simDoc.ErrorDesc() << endl; cerr << " error: " << simDoc.ErrorRow() << ", " << simDoc.ErrorCol() << endl; break; } @@ -107,10 +107,11 @@ void SInputPoisson::init() for (int neuronIndex = 0; neuronIndex < Simulator::getInstance().getTotalVertices(); neuronIndex++) { edgeType type; - if (Simulator::getInstance().getModel().getLayout().vertexTypeMap_[neuronIndex] == INH) - type = EI; + if (Simulator::getInstance().getModel().getLayout().getVertices().vertexTypeMap_[neuronIndex] + == vertexType::INH) + type = edgeType::EI; else - type = EE; + type = edgeType::EE; BGSIZE iEdg = Simulator::getInstance().getMaxEdgesPerVertex() * neuronIndex; diff --git a/Simulator/Vertices/AllVertices.cpp b/Simulator/Vertices/AllVertices.cpp index db82979b7..da3a7b769 100644 --- a/Simulator/Vertices/AllVertices.cpp +++ b/Simulator/Vertices/AllVertices.cpp @@ -8,6 +8,7 @@ #include "AllVertices.h" #include "OperationManager.h" +#include "Recorder.h" // Utility function to convert a vertexType into a string. // MODEL INDEPENDENT FUNCTION NMV-BEGIN { @@ -79,6 +80,13 @@ AllVertices::AllVertices() : size_(0) void AllVertices::setupVertices() { size_ = Simulator::getInstance().getTotalVertices(); + vertexTypeMap_.assign(size_, vertexType::VTYPE_UNDEF); +} + +void AllVertices::registerHistoryVariables() +{ + Recorder &recorder = Simulator::getInstance().getModel().getRecorder(); + recorder.registerVariable("vertexTypeMap", vertexTypeMap_, Recorder::UpdatedType::CONSTANT); } /// Prints out all parameters of the vertices to logging file. diff --git a/Simulator/Vertices/AllVertices.h b/Simulator/Vertices/AllVertices.h index 2316cf920..050002736 100644 --- a/Simulator/Vertices/AllVertices.h +++ b/Simulator/Vertices/AllVertices.h @@ -26,8 +26,9 @@ using namespace std; #include "AllEdges.h" #include "BGTypes.h" #include "Core/EdgeIndexMap.h" -#include "Layout.h" +#include "RecordableVector.h" #include "Simulator.h" +#include "VertexType.h" #include #include // cereal @@ -88,11 +89,16 @@ class AllVertices { /// Helper function for recorder to register spike history variables for all vertices. /// Option 1: Register vertex information in vertexEvents_ one by one. /// Option 2: Register a vector of EventBuffer variables. - virtual void registerHistoryVariables() = 0; + /// Base implementation registers \c vertexTypeMap_; subclasses should call + /// \c AllVertices::registerHistoryVariables() first when overriding. + virtual void registerHistoryVariables(); /// Cereal serialization method template void serialize(Archive &archive); + /// Excitatory / inhibitory (neuro) or NG911 role per vertex index. + RecordableVector vertexTypeMap_; + protected: /// Total number of vertices. int size_; @@ -179,5 +185,5 @@ struct AllVerticesDeviceProperties {}; template void AllVertices::serialize(Archive &archive) { - archive(cereal::make_nvp("size", size_)); + archive(cereal::make_nvp("size", size_), cereal::make_nvp("vertexTypeMap", vertexTypeMap_)); } \ No newline at end of file diff --git a/Simulator/Vertices/NG911/All911Vertices.cpp b/Simulator/Vertices/NG911/All911Vertices.cpp index 705bab50f..b0b142537 100644 --- a/Simulator/Vertices/NG911/All911Vertices.cpp +++ b/Simulator/Vertices/NG911/All911Vertices.cpp @@ -158,7 +158,7 @@ void All911Vertices::loadEpochInputsToVertices(uint64_t currentStep, uint64_t en // Load all the calls into the Caller Regions queue by getting the input events // from the InputManager. for (int idx = 0; idx < simulator.getTotalVertices(); ++idx) { - if (layout.vertexTypeMap_[idx] == vertexType::CALR) { + if (layout.getVertices().vertexTypeMap_[idx] == vertexType::CALR) { // If this is a Caller Region get all calls scheduled for the current epoch, // loading them into the aproppriate index of the vertexQueues_ vector inputManager_.getEvents(idx, currentStep, endStep, vertexQueues_[idx]); @@ -168,6 +168,8 @@ void All911Vertices::loadEpochInputsToVertices(uint64_t currentStep, uint64_t en void All911Vertices::registerHistoryVariables() { + AllVertices::registerHistoryVariables(); + Recorder &recorder = Simulator::getInstance().getModel().getRecorder(); // Registering the following variables to be recorded @@ -243,7 +245,8 @@ void All911Vertices::integrateVertexInputs(AllEdges &edges, EdgeIndexMap &edgeIn int start = edgeIndexMap.incomingEdgeBegin_[vertex]; int count = edgeIndexMap.incomingEdgeCount_[vertex]; - if (simulator.getModel().getLayout().vertexTypeMap_[vertex] == vertexType::CALR) { + if (simulator.getModel().getLayout().getVertices().vertexTypeMap_[vertex] + == vertexType::CALR) { continue; // TODO911: Caller Regions will have different behaviour } @@ -315,13 +318,13 @@ void All911Vertices::advanceVertices(AllEdges &edges, const EdgeIndexMap &edgeIn // Advance vertices for (int vertex = 0; vertex < simulator.getTotalVertices(); ++vertex) { - if (layout.vertexTypeMap_[vertex] == vertexType::CALR) { + if (layout.getVertices().vertexTypeMap_[vertex] == vertexType::CALR) { advanceCALR(vertex, edges911, edgeIndexMap); - } else if (layout.vertexTypeMap_[vertex] == vertexType::PSAP) { + } else if (layout.getVertices().vertexTypeMap_[vertex] == vertexType::PSAP) { advancePSAP(vertex, edges911, edgeIndexMap); - } else if (layout.vertexTypeMap_[vertex] == vertexType::EMS - || layout.vertexTypeMap_[vertex] == vertexType::FIRE - || layout.vertexTypeMap_[vertex] == vertexType::LAW) { + } else if (layout.getVertices().vertexTypeMap_[vertex] == vertexType::EMS + || layout.getVertices().vertexTypeMap_[vertex] == vertexType::FIRE + || layout.getVertices().vertexTypeMap_[vertex] == vertexType::LAW) { advanceRESP(vertex, edges911, edgeIndexMap); } } @@ -624,7 +627,7 @@ BGSIZE All911Vertices::getEdgeToClosestResponder(const Call &call, BGSIZE vertex assert(edges911.inUse_[outEdg]); // Edge must be in use BGSIZE dstVertex = edges911.destVertexIndex_[outEdg]; - if (layout911.vertexTypeMap_[dstVertex] == requiredType) { + if (layout911.getVertices().vertexTypeMap_[dstVertex] == requiredType) { double distance = layout911.getDistance(dstVertex, call.x, call.y); if (distance < minDistance) { @@ -637,7 +640,7 @@ BGSIZE All911Vertices::getEdgeToClosestResponder(const Call &call, BGSIZE vertex // We must have found the closest responder of the right type assert(minDistance < numeric_limits::max()); - assert(layout911.vertexTypeMap_[resp] == requiredType); + assert(layout911.getVertices().vertexTypeMap_[resp] == requiredType); return respEdge; } #endif \ No newline at end of file diff --git a/Simulator/Vertices/Neuro/AllIFNeurons.cpp b/Simulator/Vertices/Neuro/AllIFNeurons.cpp index 85057b0b2..09e5eac3f 100644 --- a/Simulator/Vertices/Neuro/AllIFNeurons.cpp +++ b/Simulator/Vertices/Neuro/AllIFNeurons.cpp @@ -128,7 +128,7 @@ void AllIFNeurons::createNeuron(int i, Layout &layout) initNeuronConstsFromParamValues(i, Simulator::getInstance().getDeltaT()); - switch (layoutNeuro.vertexTypeMap_[i]) { + switch (layout.getVertices().vertexTypeMap_[i]) { case vertexType::INH: LOG4CPLUS_DEBUG(vertexLogger_, "Setting inhibitory neuron: " << i); // set inhibitory absolute refractory period @@ -142,8 +142,8 @@ void AllIFNeurons::createNeuron(int i, Layout &layout) break; default: - LOG4CPLUS_DEBUG(vertexLogger_, - "ERROR: unknown neuron type: " << layout.vertexTypeMap_[i] << "@" << i); + LOG4CPLUS_DEBUG(vertexLogger_, "ERROR: unknown neuron type: " + << layout.getVertices().vertexTypeMap_[i] << "@" << i); assert(false); break; } diff --git a/Simulator/Vertices/Neuro/AllIZHNeurons.cpp b/Simulator/Vertices/Neuro/AllIZHNeurons.cpp index 50d368658..72d75696e 100644 --- a/Simulator/Vertices/Neuro/AllIZHNeurons.cpp +++ b/Simulator/Vertices/Neuro/AllIZHNeurons.cpp @@ -72,7 +72,7 @@ void AllIZHNeurons::createNeuron(int i, Layout &layout) AllIFNeurons::createNeuron(i, layout); // TODO: we may need another distribution mode besides flat distribution - if (layout.vertexTypeMap_[i] == vertexType::EXC) { + if (layout.getVertices().vertexTypeMap_[i] == vertexType::EXC) { // excitatory neuron Aconst_[i] = initRNG.inRange(excAconst_[0], excAconst_[1]); Bconst_[i] = initRNG.inRange(excBconst_[0], excBconst_[1]); diff --git a/Simulator/Vertices/Neuro/AllSpikingNeurons.cpp b/Simulator/Vertices/Neuro/AllSpikingNeurons.cpp index a2769fa0a..c8daf29f1 100644 --- a/Simulator/Vertices/Neuro/AllSpikingNeurons.cpp +++ b/Simulator/Vertices/Neuro/AllSpikingNeurons.cpp @@ -28,6 +28,8 @@ void AllSpikingNeurons::setupVertices() /// Option 2: Register a vector of EventBuffer variables. void AllSpikingNeurons::registerHistoryVariables() { + AllVertices::registerHistoryVariables(); + Recorder &recorder = Simulator::getInstance().getModel().getRecorder(); string baseName = "Neuron_";