Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 1b55b2f

Browse files
authored
Minor code format wih [email protected] (#73)
1 parent 307016b commit 1b55b2f

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

coreneuron/coreneuron.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
3030
* Includes all headers required to communicate and run all methods
3131
* described in CoreNeuron, neurox, and mod2c C-generated mechanisms
3232
* functions.
33-
**/
33+
**/
3434

3535
#ifndef CORENEURON_H
3636
#define CORENEURON_H

coreneuron/nrniv/multisend.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ of spikes sent is equal to the number of spikes sent.
4242
// which has the greatest amount of overlap between computation
4343
// and communication.
4444

45-
4645
int use_multisend_;
4746
int use_phase2_;
4847
int n_multisend_interval = 2;
@@ -104,7 +103,6 @@ class Multisend_ReceiveBuffer {
104103
Phase2Buffer* phase2_buffer_;
105104
};
106105

107-
108106
#define MULTISEND_INTERVAL 2
109107
static Multisend_ReceiveBuffer* multisend_receive_buffer[MULTISEND_INTERVAL];
110108
static int current_rbuf, next_rbuf;
@@ -468,4 +466,4 @@ void nrn_multisend_setup() {
468466
#endif
469467
}
470468

471-
#endif //NRN_MULTISEND
469+
#endif // NRN_MULTISEND

coreneuron/nrniv/multisend_setup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,4 +703,4 @@ static int setup_target_lists(int use_phase2, int** r_return) {
703703
return sz;
704704
}
705705

706-
#endif //NRN_MULTISEND
706+
#endif // NRN_MULTISEND

coreneuron/nrniv/output_spikes.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
2929
#include <iostream>
3030
#include <sstream>
3131
#include <string.h>
32-
#include <stdexcept> // std::lenght_error
32+
#include <stdexcept> // std::lenght_error
3333
#include <vector>
3434
#include "coreneuron/nrnconf.h"
3535
#include "coreneuron/nrniv/nrniv_decl.h"
@@ -47,10 +47,10 @@ static MUTDEC
4747
void
4848
mk_spikevec_buffer(int sz) {
4949
try {
50-
spikevec_time.reserve(sz);
51-
spikevec_gid.reserve(sz);
50+
spikevec_time.reserve(sz);
51+
spikevec_gid.reserve(sz);
5252
} catch (const std::length_error& le) {
53-
std::cerr << "Lenght error" << le.what() << std::endl;
53+
std::cerr << "Lenght error" << le.what() << std::endl;
5454
}
5555
MUTCONSTRUCT(1);
5656
}
@@ -74,7 +74,7 @@ void output_spikes_parallel(const char* outpath) {
7474
std::string fname = ss.str();
7575

7676
// remove if file already exist
77-
if(nrnmpi_myid == 0) {
77+
if (nrnmpi_myid == 0) {
7878
remove(fname.c_str());
7979
}
8080
nrnmpi_barrier();
@@ -83,9 +83,9 @@ void output_spikes_parallel(const char* outpath) {
8383
const int SPIKE_RECORD_LEN = 64;
8484
unsigned num_spikes = spikevec_gid.size();
8585
unsigned num_bytes = (sizeof(char) * num_spikes * SPIKE_RECORD_LEN);
86-
char *spike_data = (char*) malloc(num_bytes);
86+
char* spike_data = (char*)malloc(num_bytes);
8787

88-
if(spike_data == NULL) {
88+
if (spike_data == NULL) {
8989
printf("Error while writing spikes due to memory allocation\n");
9090
return;
9191
}
@@ -95,7 +95,7 @@ void output_spikes_parallel(const char* outpath) {
9595

9696
// populate buffer with all spike entries
9797
char spike_entry[SPIKE_RECORD_LEN];
98-
for(unsigned i = 0; i < num_spikes; i++) {
98+
for (unsigned i = 0; i < num_spikes; i++) {
9999
snprintf(spike_entry, 64, "%.8g\t%d\n", spikevec_time[i], spikevec_gid[i]);
100100
strcat(spike_data, spike_entry);
101101
}
@@ -113,14 +113,15 @@ void output_spikes_parallel(const char* outpath) {
113113
MPI_Status status;
114114

115115
// ibm mpi (bg-q) expects char* instead of const char* (even though it's standard)
116-
int op_status = MPI_File_open(MPI_COMM_WORLD, (char*) fname.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh);
117-
if(op_status != MPI_SUCCESS && nrnmpi_myid == 0) {
116+
int op_status = MPI_File_open(MPI_COMM_WORLD, (char*)fname.c_str(),
117+
MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh);
118+
if (op_status != MPI_SUCCESS && nrnmpi_myid == 0) {
118119
std::cerr << "Error while opening spike output file " << fname << std::endl;
119120
abort();
120121
}
121122

122123
op_status = MPI_File_write_at_all(fh, offset, spike_data, num_chars, MPI_BYTE, &status);
123-
if(op_status != MPI_SUCCESS && nrnmpi_myid == 0) {
124+
if (op_status != MPI_SUCCESS && nrnmpi_myid == 0) {
124125
std::cerr << "Error while writing spike output " << std::endl;
125126
abort();
126127
}
@@ -152,7 +153,7 @@ void output_spikes_serial(const char* outpath) {
152153

153154
void output_spikes(const char* outpath) {
154155
#if NRNMPI
155-
if(nrnmpi_initialized()) {
156+
if (nrnmpi_initialized()) {
156157
output_spikes_parallel(outpath);
157158
} else {
158159
output_spikes_serial(outpath);
@@ -162,7 +163,6 @@ void output_spikes(const char* outpath) {
162163
#endif
163164
}
164165

165-
166166
void validation(std::vector<std::pair<double, int> >& res) {
167167
for (unsigned i = 0; i < spikevec_gid.size(); ++i)
168168
if (spikevec_gid[i] > -1)

coreneuron/nrniv/patternstim.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void nrn_mkPatternStim(const char* fname) {
8585
}
8686

8787
// if there is empty thread then return, don't need patternstim
88-
if(nrn_threads == NULL || nrn_threads->ncell == 0) {
88+
if (nrn_threads == NULL || nrn_threads->ncell == 0) {
8989
return;
9090
}
9191

@@ -120,7 +120,7 @@ void nrn_mkPatternStim(const char* fname) {
120120
// comparator to sort spikes based on time
121121
typedef std::pair<double, int> spike_type;
122122
static bool spike_comparator(const spike_type& l, const spike_type& r) {
123-
return l.first < r.first;
123+
return l.first < r.first;
124124
}
125125

126126
size_t read_raster_file(const char* fname, double** tvec, int** gidvec) {
@@ -146,15 +146,15 @@ size_t read_raster_file(const char* fname, double** tvec, int** gidvec) {
146146
// pattern.mod expects sorted spike raster (this is to avoid
147147
// injecting all events at the begining of the simulation).
148148
// sort spikes according to time
149-
std::sort(spikes.begin(), spikes.end(), spike_comparator);
149+
std::sort(spikes.begin(), spikes.end(), spike_comparator);
150150

151151
// fill gid and time vectors
152152
*tvec = (double*)emalloc(spikes.size() * sizeof(double));
153153
*gidvec = (int*)emalloc(spikes.size() * sizeof(int));
154154

155-
for(size_t i = 0; i < spikes.size(); i++) {
156-
(*tvec)[i] = spikes[i].first;
157-
(*gidvec)[i] = spikes[i].second;
155+
for (size_t i = 0; i < spikes.size(); i++) {
156+
(*tvec)[i] = spikes[i].first;
157+
(*gidvec)[i] = spikes[i].second;
158158
}
159159

160160
return spikes.size();
@@ -171,7 +171,7 @@ Point_process* nrn_artcell_instantiate(const char* mechname) {
171171
int type = nrn_get_mechtype(mechname);
172172
NrnThread* nt = nrn_threads + 0;
173173

174-
//printf("nrn_artcell_instantiate %s type=%d\n", mechname, type);
174+
// printf("nrn_artcell_instantiate %s type=%d\n", mechname, type);
175175

176176
// see nrn_setup.cpp:read_phase2 for how it creates NrnThreadMembList instances.
177177
// create and append to nt.tml

coreneuron/nrnoc/solve_core.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
3232

3333
int use_solve_interleave;
3434

35-
static void triang(NrnThread *), bksub(NrnThread *);
35+
static void triang(NrnThread*), bksub(NrnThread*);
3636

3737
/* solve the matrix equation */
3838
void nrn_solve_minimal(NrnThread* _nt) {
@@ -63,9 +63,12 @@ static void triang(NrnThread* _nt) {
6363
#endif
6464

6565
/** @todo: just for benchmarking, otherwise produces wrong results */
66-
#pragma acc parallel loop seq present( \
67-
vec_a[0 : i3], vec_b[0 : i3], vec_d[0 : i3], vec_rhs[0 : i3], parent_index[0 : i3]) \
68-
async(stream_id) if (_nt->compute_gpu)
66+
// clang-format off
67+
#pragma acc parallel loop seq present( \
68+
vec_a[0:i3], vec_b[0:i3], vec_d[0:i3], \
69+
vec_rhs[0:i3], parent_index[0:i3]) \
70+
async(stream_id) if (_nt->compute_gpu)
71+
// clang-format on
6972
for (i = i3 - 1; i >= i2; --i) {
7073
p = vec_a[i] / vec_d[i];
7174
vec_d[parent_index[i]] -= p * vec_b[i];

coreneuron/scopmath_core/dimplic.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* time.
1111
* \todo: eulerfun/difun are legacy macros and can be replaced with
1212
* actual steer function for euler/derivimplicit methods.
13-
*/
13+
*/
1414

1515
#include "coreneuron/mech/cfile/scoplib.h"
1616
#include "coreneuron/mech/mod2c_core_thread.h"
@@ -44,16 +44,15 @@ int nrn_kinetic_steer(int fun, SparseObj* so, double* rhs, _threadargsproto_) {
4444
// derived from nrn/src/scopmath/euler.c
4545
// updated for aos/soa layout index
4646
int euler_thread(int neqn, int* var, int* der, DIFUN fun, _threadargsproto_) {
47-
4847
double dt = _nt->_dt;
4948
int i;
5049

5150
/* calculate the derivatives */
52-
eulerfun(fun);
51+
eulerfun(fun);
5352

5453
/* update dependent variables */
5554
for (i = 0; i < neqn; i++)
56-
_p[var[i]*_STRIDE] += dt * (_p[der[i]*_STRIDE]);
55+
_p[var[i] * _STRIDE] += dt * (_p[der[i] * _STRIDE]);
5756

5857
return 0;
5958
}

0 commit comments

Comments
 (0)