Skip to content

Commit 8a4d418

Browse files
authored
Merge pull request #546 from UWB-Biocomputing/issue-515-remove-const-parameters-primitive
Remove 'const' qualifiers for primitive datatypes
2 parents 3082b1b + db99438 commit 8a4d418

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+206
-227
lines changed

Simulator/Connections/Connections.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ bool Connections::updateConnections(AllVertices &vertices)
8989
}
9090

9191
#if defined(USE_GPU)
92-
void Connections::updateSynapsesWeights(const int numVertices, AllVertices &vertices,
93-
AllEdges &synapses,
92+
void Connections::updateSynapsesWeights(int numVertices, AllVertices &vertices, AllEdges &synapses,
9493
AllSpikingNeuronsDeviceProperties *allVerticesDevice,
9594
AllSpikingSynapsesDeviceProperties *allEdgesDevice,
9695
Layout &layout)

Simulator/Connections/Connections.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ class Connections {
8585
/// @param allVerticesDevice GPU address of the allVertices struct on device memory.
8686
/// @param allEdgesDevice GPU address of the allEdges struct on device memory.
8787
/// @param layout Layout information of the neural network.
88-
virtual void updateSynapsesWeights(const int numVertices, AllVertices &vertices,
89-
AllEdges &synapses,
88+
virtual void updateSynapsesWeights(int numVertices, AllVertices &vertices, AllEdges &synapses,
9089
AllSpikingNeuronsDeviceProperties *allVerticesDevice,
9190
AllSpikingSynapsesDeviceProperties *allEdgesDevice,
9291
Layout &layout);

Simulator/Connections/Neuro/ConnGrowth.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ class ConnGrowth : public Connections {
130130
/// @param allVerticesDevice GPU address of the AllVertices struct in device memory.
131131
/// @param allEdgesDevice GPU address of the AllEdges struct in device memory.
132132
/// @param layout The Layout object.
133-
virtual void updateSynapsesWeights(const int numVertices, AllVertices &neurons,
134-
AllEdges &synapses,
133+
virtual void updateSynapsesWeights(int numVertices, AllVertices &neurons, AllEdges &synapses,
135134
AllSpikingNeuronsDeviceProperties *allVerticesDevice,
136135
AllSpikingSynapsesDeviceProperties *allEdgesDevice,
137136
Layout &layout) override;

Simulator/Connections/Neuro/ConnGrowth_d.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
* @param allEdgesDevice GPU address to the AllEdges struct in device memory.
2727
* @param layout The Layout object.
2828
*/
29-
void ConnGrowth::updateSynapsesWeights(const int numVertices, AllVertices &vertices,
30-
AllEdges &synapses,
29+
void ConnGrowth::updateSynapsesWeights(int numVertices, AllVertices &vertices, AllEdges &synapses,
3130
AllSpikingNeuronsDeviceProperties *allVerticesDevice,
3231
AllSpikingSynapsesDeviceProperties *allEdgesDevice,
3332
Layout &layout)

Simulator/Core/GPUModel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ class GPUModel : public Model {
141141
void updateHistory();
142142

143143
// TODO
144-
void eraseEdge(AllEdges &synapses, const int neuronIndex, const int synapseIndex);
144+
void eraseEdge(AllEdges &synapses, int neuronIndex, int synapseIndex);
145145

146146
// TODO
147-
void addEdge(AllEdges &synapses, edgeType type, const int srcVertex, const int destVertex,
147+
void addEdge(AllEdges &synapses, edgeType type, int srcVertex, int destVertex,
148148
Coordinate &source, Coordinate &dest, BGFLOAT deltaT);
149149

150150
// TODO
151-
void createEdge(AllEdges &synapses, const int neuronIndex, const int synapseIndex,
152-
Coordinate source, Coordinate dest, BGFLOAT deltaT, edgeType type);
151+
void createEdge(AllEdges &synapses, int neuronIndex, int synapseIndex, Coordinate source,
152+
Coordinate dest, BGFLOAT deltaT, edgeType type);
153153
};
154154

155155
#if defined(__CUDACC__)

Simulator/Core/Simulator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void Simulator::simulate()
191191
/// Helper for #simulate(). Advance simulation until ready for next growth cycle.
192192
/// This should simulate all neuron and synapse activity for one epoch.
193193
/// @param currentStep the current epoch in which the network is being simulated.
194-
void Simulator::advanceEpoch(const int &currentEpoch) const
194+
void Simulator::advanceEpoch(int currentEpoch) const
195195
{
196196
uint64_t count = 0;
197197
// Compute step number at end of this simulation epoch

Simulator/Core/Simulator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class Simulator {
4747

4848
void simulate();
4949

50-
void advanceEpoch(const int &currentEpoch) const; /// Advance simulation to next growth
51-
/// cycle. Helper for #simulate().
50+
void advanceEpoch(int currentEpoch) const; /// Advance simulation to next growth
51+
/// cycle. Helper for #simulate().
5252

5353
void saveResults() const; /// Writes simulation results to an output destination.
5454

Simulator/Edges/AllEdges.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ AllEdges::AllEdges() : totalEdgeCount_(0), maxEdgesPerVertex_(0), countVertices_
3030
edgeLogger_ = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("edge"));
3131
}
3232

33-
AllEdges::AllEdges(const int numVertices, const int maxEdges)
33+
AllEdges::AllEdges(int numVertices, int maxEdges)
3434
{
3535
setupEdges(numVertices, maxEdges);
3636
}
@@ -66,7 +66,7 @@ void AllEdges::setupEdges()
6666
///
6767
/// @param numVertices Total number of vertices in the network.
6868
/// @param maxEdges Maximum number of edges per vertex.
69-
void AllEdges::setupEdges(const int numVertices, const int maxEdges)
69+
void AllEdges::setupEdges(int numVertices, int maxEdges)
7070
{
7171
BGSIZE maxTotalEdges = maxEdges * numVertices;
7272

@@ -90,7 +90,7 @@ void AllEdges::setupEdges(const int numVertices, const int maxEdges)
9090
///
9191
/// @param input istream to read from.
9292
/// @param iEdg Index of the edge to set.
93-
void AllEdges::readEdge(istream &input, const BGSIZE iEdg)
93+
void AllEdges::readEdge(istream &input, BGSIZE iEdg)
9494
{
9595
int synapse_type(0);
9696

@@ -113,7 +113,7 @@ void AllEdges::readEdge(istream &input, const BGSIZE iEdg)
113113
///
114114
/// @param output stream to print out to.
115115
/// @param iEdg Index of the edge to print out.
116-
void AllEdges::writeEdge(ostream &output, const BGSIZE iEdg) const
116+
void AllEdges::writeEdge(ostream &output, BGSIZE iEdg) const
117117
{
118118
output << sourceVertexIndex_[iEdg] << ends;
119119
output << destVertexIndex_[iEdg] << ends;
@@ -126,7 +126,7 @@ void AllEdges::writeEdge(ostream &output, const BGSIZE iEdg) const
126126
///
127127
/// @param typeOrdinal Integer that correspond with a edgeType.
128128
/// @return the SynapseType that corresponds with the given integer.
129-
edgeType AllEdges::edgeOrdinalToType(const int typeOrdinal)
129+
edgeType AllEdges::edgeOrdinalToType(int typeOrdinal)
130130
{
131131
switch (typeOrdinal) {
132132
case 0:
@@ -238,7 +238,7 @@ void AllEdges::advanceEdges(AllVertices &vertices, EdgeIndexMap &edgeIndexMap)
238238
///
239239
/// @param iVert Index of a vertex to remove from.
240240
/// @param iEdg Index of a edge to remove.
241-
void AllEdges::eraseEdge(const int iVert, const BGSIZE iEdg)
241+
void AllEdges::eraseEdge(int iVert, BGSIZE iEdg)
242242
{
243243
edgeCounts_[iVert]--;
244244
inUse_[iEdg] = false;
@@ -255,8 +255,7 @@ void AllEdges::eraseEdge(const int iVert, const BGSIZE iEdg)
255255
/// @param destVertex The Vertex that receives from the edge.
256256
/// @param deltaT Inner simulation step duration
257257
/// @return iEdg Index of the edge to be added.
258-
BGSIZE AllEdges::addEdge(edgeType type, const int srcVertex, const int destVertex,
259-
const BGFLOAT deltaT)
258+
BGSIZE AllEdges::addEdge(edgeType type, int srcVertex, int destVertex, BGFLOAT deltaT)
260259
{
261260
BGSIZE iEdg;
262261
if (edgeCounts_[destVertex] >= maxEdgesPerVertex_) {

Simulator/Edges/AllEdges.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AllVertices;
2020
class AllEdges {
2121
public:
2222
AllEdges();
23-
AllEdges(const int numVertices, const int maxEdges);
23+
AllEdges(int numVertices, int maxEdges);
2424
virtual ~AllEdges() = default;
2525

2626
/// Setup the internal structure of the class (allocate memories and initialize them).
@@ -41,8 +41,7 @@ class AllEdges {
4141
/// @param destVertex The Vertex that receives from the Edge.
4242
/// @param deltaT Inner simulation step duration
4343
/// @return iEdg Index of the edge to be added.
44-
virtual BGSIZE addEdge(edgeType type, const int srcVertex, const int destVertex,
45-
const BGFLOAT deltaT);
44+
virtual BGSIZE addEdge(edgeType type, int srcVertex, int destVertex, BGFLOAT deltaT);
4645

4746
/// Create a Edge and connect it to the model.
4847
///
@@ -51,7 +50,7 @@ class AllEdges {
5150
/// @param destVertex Coordinates of the destination Vertex.
5251
/// @param deltaT Inner simulation step duration.
5352
/// @param type Type of the Edge to create.
54-
virtual void createEdge(const BGSIZE iEdg, int srcVertex, int destVertex, const BGFLOAT deltaT,
53+
virtual void createEdge(BGSIZE iEdg, int srcVertex, int destVertex, BGFLOAT deltaT,
5554
edgeType type)
5655
= 0;
5756

@@ -71,25 +70,25 @@ class AllEdges {
7170
///
7271
/// @param numVertices Total number of vertices in the network.
7372
/// @param maxEdges Maximum number of edges per vertex.
74-
virtual void setupEdges(const int numVertices, const int maxEdges);
73+
virtual void setupEdges(int numVertices, int maxEdges);
7574

7675
/// Sets the data for Edge to input's data.
7776
///
7877
/// @param input istream to read from.
7978
/// @param iEdg Index of the edge to set.
80-
virtual void readEdge(istream &input, const BGSIZE iEdg);
79+
virtual void readEdge(istream &input, BGSIZE iEdg);
8180

8281
/// Write the edge data to the stream.
8382
///
8483
/// @param output stream to print out to.
8584
/// @param iEdg Index of the edge to print out.
86-
virtual void writeEdge(ostream &output, const BGSIZE iEdg) const;
85+
virtual void writeEdge(ostream &output, BGSIZE iEdg) const;
8786

8887
/// Returns an appropriate edgeType object for the given integer.
8988
///
9089
/// @param typeOrdinal Integer that correspond with a edgeType.
9190
/// @return the SynapseType that corresponds with the given integer.
92-
edgeType edgeOrdinalToType(const int typeOrdinal);
91+
edgeType edgeOrdinalToType(int typeOrdinal);
9392

9493
/// Loggers used to print to using log4cplus logging macros, prints to Results/Debug/logging.txt
9594
log4cplus::Logger fileLogger_;
@@ -186,13 +185,13 @@ class AllEdges {
186185
///
187186
/// @param iEdg Index of the Edge to connect to.
188187
/// @param vertices The Vertex list to search from.
189-
virtual void advanceEdge(const BGSIZE iEdg, AllVertices &vertices) = 0;
188+
virtual void advanceEdge(BGSIZE iEdg, AllVertices &vertices) = 0;
190189

191190
/// Remove a edge from the network.
192191
///
193192
/// @param neuronIndex Index of a vertex to remove from.
194193
/// @param iEdg Index of a edge to remove.
195-
virtual void eraseEdge(const int neuronIndex, const BGSIZE iEdg);
194+
virtual void eraseEdge(int neuronIndex, BGSIZE iEdg);
196195
#endif // defined(USE_GPU)
197196

198197
/// The location of the edge.

Simulator/Edges/NG911/All911Edges.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include "All911Edges.h"
1010

11-
All911Edges::All911Edges(const int numVertices, const int maxEdges)
11+
All911Edges::All911Edges(int numVertices, int maxEdges)
1212
{
1313
}
1414

@@ -31,7 +31,7 @@ void All911Edges::setupEdges()
3131
}
3232
}
3333

34-
void All911Edges::createEdge(const BGSIZE iEdg, int srcVertex, int destVertex, const BGFLOAT deltaT,
34+
void All911Edges::createEdge(BGSIZE iEdg, int srcVertex, int destVertex, BGFLOAT deltaT,
3535
edgeType type)
3636
{
3737
inUse_[iEdg] = true;
@@ -101,7 +101,7 @@ void All911Edges::advanceEdges(AllVertices &vertices, EdgeIndexMap &edgeIndexMap
101101
///
102102
/// @param iEdg Index of the edge to connect to.
103103
/// @param vertices The vertex list to search from.
104-
void All911Edges::advance911Edge(const BGSIZE iEdg, All911Vertices &vertices)
104+
void All911Edges::advance911Edge(BGSIZE iEdg, All911Vertices &vertices)
105105
{
106106
// edge
107107
// source node --> destination node

0 commit comments

Comments
 (0)