Skip to content

Commit 9be5026

Browse files
committed
clang-format
1 parent fe1afda commit 9be5026

File tree

10 files changed

+54
-28
lines changed

10 files changed

+54
-28
lines changed

include/amici/vector.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ class AmiVector {
7272
* @param rvec vector from which the data will be copied
7373
* @param sunctx SUNDIALS context
7474
*/
75-
explicit AmiVector(gsl::span<realtype const> const rvec, SUNContext const sunctx)
75+
explicit AmiVector(
76+
gsl::span<realtype const> const rvec, SUNContext const sunctx
77+
)
7678
: AmiVector(std::vector(rvec.begin(), rvec.end()), sunctx) {}
7779

7880
/**

src/cblas.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ void amici_dgemv(
5555
}
5656

5757
void amici_daxpy(
58-
int const n, double const alpha, double const* x, int const incx, double* y, int const incy
58+
int const n, double const alpha, double const* x, int const incx, double* y,
59+
int const incy
5960
) {
6061
BLAS_FUNC(daxpy)(n, alpha, x, incx, y, incy);
6162
}

src/edata.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ ExpData::ExpData(int const nytrue, int const nztrue, int const nmaxevent)
1818
}
1919

2020
ExpData::ExpData(
21-
int const nytrue, int const nztrue, int const nmaxevent, std::vector<realtype> ts
21+
int const nytrue, int const nztrue, int const nmaxevent,
22+
std::vector<realtype> ts
2223
)
2324
: SimulationParameters(ts)
2425
, nytrue_(nytrue)
@@ -28,8 +29,8 @@ ExpData::ExpData(
2829
}
2930

3031
ExpData::ExpData(
31-
int const nytrue, int const nztrue, int const nmaxevent, std::vector<realtype> ts,
32-
std::vector<realtype> fixedParameters
32+
int const nytrue, int const nztrue, int const nmaxevent,
33+
std::vector<realtype> ts, std::vector<realtype> fixedParameters
3334
)
3435
: SimulationParameters(ts)
3536
, nytrue_(nytrue)
@@ -40,8 +41,8 @@ ExpData::ExpData(
4041
}
4142

4243
ExpData::ExpData(
43-
int const nytrue, int const nztrue, int const nmaxevent, std::vector<realtype> ts,
44-
std::vector<realtype> const& observedData,
44+
int const nytrue, int const nztrue, int const nmaxevent,
45+
std::vector<realtype> ts, std::vector<realtype> const& observedData,
4546
std::vector<realtype> const& observedDataStdDev,
4647
std::vector<realtype> const& observedEvents,
4748
std::vector<realtype> const& observedEventsStdDev
@@ -69,7 +70,8 @@ ExpData::ExpData(Model const& model)
6970
}
7071

7172
ExpData::ExpData(
72-
ReturnData const& rdata, realtype const sigma_y, realtype const sigma_z, int const seed
73+
ReturnData const& rdata, realtype const sigma_y, realtype const sigma_z,
74+
int const seed
7375
)
7476
: ExpData(
7577
rdata, std::vector<realtype>(rdata.nytrue * rdata.nt, sigma_y),
@@ -261,7 +263,7 @@ void ExpData::setObservedEvents(
261263
observed_events_.at(iz + ie * nztrue_) = observedEvents.at(ie);
262264
}
263265

264-
bool ExpData::isSetObservedEvents(int const ie, int const iz) const {
266+
bool ExpData::isSetObservedEvents(int const ie, int const iz) const {
265267
return !observed_events_.empty()
266268
&& !isNaN(observed_events_.at(ie * nztrue_ + iz));
267269
}
@@ -270,7 +272,7 @@ std::vector<realtype> const& ExpData::getObservedEvents() const {
270272
return observed_events_;
271273
}
272274

273-
realtype const* ExpData::getObservedEventsPtr(int const ie) const {
275+
realtype const* ExpData::getObservedEventsPtr(int const ie) const {
274276
if (!observed_events_.empty())
275277
return &observed_events_.at(ie * nztrue_);
276278

@@ -370,7 +372,8 @@ void ExpData::checkDataDimension(
370372
void ExpData::checkEventsDimension(
371373
std::vector<realtype> const& input, char const* fieldname
372374
) const {
373-
if (input.size() != static_cast<unsigned>(nmaxevent_) * nztrue_ && !input.empty())
375+
if (input.size() != static_cast<unsigned>(nmaxevent_) * nztrue_
376+
&& !input.empty())
374377
throw AmiException(
375378
"Input %s did not match dimensions nt (%i) x nytrue (%i), was %i",
376379
fieldname, nmaxevent_, nztrue_, input.size()

src/hdf5.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ std::unique_ptr<ExpData> readSimulationExpData(
135135
}
136136

137137
if (locationExists(file, hdf5Root + "/Sigma_Y")) {
138-
auto const sigmay = getDoubleDataset2D(file, hdf5Root + "/Sigma_Y", m, n);
138+
auto const sigmay
139+
= getDoubleDataset2D(file, hdf5Root + "/Sigma_Y", m, n);
139140
checkMeasurementDimensionsCompatible(m, n, model);
140141
edata->setObservedDataStdDev(sigmay);
141142
} else {

src/misc.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ double getUnscaledParameter(
4141

4242
void unscaleParameters(
4343
gsl::span<realtype const> const bufferScaled,
44-
gsl::span<ParameterScaling const> const pscale, gsl::span<realtype> const bufferUnscaled
44+
gsl::span<ParameterScaling const> const pscale,
45+
gsl::span<realtype> const bufferUnscaled
4546
) {
4647
Expects(bufferScaled.size() == pscale.size());
4748
Expects(bufferScaled.size() == bufferUnscaled.size());
@@ -52,7 +53,9 @@ void unscaleParameters(
5253
}
5354
}
5455

55-
double getScaledParameter(double const unscaledParameter, ParameterScaling const scaling) {
56+
double getScaledParameter(
57+
double const unscaledParameter, ParameterScaling const scaling
58+
) {
5659
switch (scaling) {
5760
case ParameterScaling::log10:
5861
return log10(unscaledParameter);
@@ -67,7 +70,8 @@ double getScaledParameter(double const unscaledParameter, ParameterScaling const
6770

6871
void scaleParameters(
6972
gsl::span<realtype const> const bufferUnscaled,
70-
gsl::span<ParameterScaling const> const pscale, gsl::span<realtype> const bufferScaled
73+
gsl::span<ParameterScaling const> const pscale,
74+
gsl::span<realtype> const bufferScaled
7175
) {
7276
Expects(bufferScaled.size() == pscale.size());
7377
Expects(bufferScaled.size() == bufferUnscaled.size());
@@ -127,7 +131,8 @@ std::string backtraceString(int const maxFrames, int const first_frame) {
127131
return trace_buf.str();
128132
}
129133

130-
std::string regexErrorToString(std::regex_constants::error_type const err_type) {
134+
std::string
135+
regexErrorToString(std::regex_constants::error_type const err_type) {
131136
switch (err_type) {
132137
case std::regex_constants::error_collate:
133138
return "error_collate";
@@ -177,7 +182,8 @@ std::string printfToString(char const* fmt, va_list ap) {
177182
return str;
178183
}
179184

180-
std::pair<size_t, size_t> unravel_index(size_t const flat_idx, size_t const num_cols) {
185+
std::pair<size_t, size_t>
186+
unravel_index(size_t const flat_idx, size_t const num_cols) {
181187
return {flat_idx / num_cols, flat_idx % num_cols};
182188
}
183189

src/model_dae.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ void Model_DAE::fJSparse(
2828
}
2929

3030
void Model_DAE::fJSparse(
31-
realtype const t, realtype const cj, const_N_Vector x, const_N_Vector dx, SUNMatrix J
31+
realtype const t, realtype const cj, const_N_Vector x, const_N_Vector dx,
32+
SUNMatrix J
3233
) {
3334
auto const x_pos = computeX_pos(x);
3435
fdwdx(t, N_VGetArrayPointerConst(x_pos), false);
@@ -101,7 +102,8 @@ void Model_DAE::froot(
101102
}
102103

103104
void Model_DAE::froot(
104-
realtype const t, const_N_Vector x, const_N_Vector dx, gsl::span<realtype> root
105+
realtype const t, const_N_Vector x, const_N_Vector dx,
106+
gsl::span<realtype> root
105107
) {
106108
std::ranges::fill(root, 0.0);
107109
auto const x_pos = computeX_pos(x);
@@ -386,9 +388,9 @@ void Model_DAE::fJB(
386388
}
387389

388390
void Model_DAE::fJSparseB(
389-
realtype const t, realtype const cj, AmiVector const& x, AmiVector const& dx,
390-
AmiVector const& xB, AmiVector const& dxB, AmiVector const& /*xBdot*/,
391-
SUNMatrix JB
391+
realtype const t, realtype const cj, AmiVector const& x,
392+
AmiVector const& dx, AmiVector const& xB, AmiVector const& dxB,
393+
AmiVector const& /*xBdot*/, SUNMatrix JB
392394
) {
393395
fJSparseB(
394396
t, cj, x.getNVector(), dx.getNVector(), xB.getNVector(),

src/model_ode.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ void Model_ODE::froot(
8989
froot(t, x.getNVector(), root);
9090
}
9191

92-
void Model_ODE::froot(realtype const t, const_N_Vector x, gsl::span<realtype> root) {
92+
void Model_ODE::froot(
93+
realtype const t, const_N_Vector x, gsl::span<realtype> root
94+
) {
9395
auto const x_pos = computeX_pos(x);
9496
std::ranges::fill(root, 0.0);
9597
froot(

src/solver.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,9 @@ double Solver::getNewtonDampingFactorLowerBound() const {
813813
return newton_damping_factor_lower_bound_;
814814
}
815815

816-
void Solver::setNewtonDampingFactorLowerBound(double const dampingFactorLowerBound) {
816+
void Solver::setNewtonDampingFactorLowerBound(
817+
double const dampingFactorLowerBound
818+
) {
817819
newton_damping_factor_lower_bound_ = dampingFactorLowerBound;
818820
}
819821

src/solver_idas.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@ void IDASolver::getQuad(realtype& t) const {
631631
throw IDAException(status, "IDAGetQuad");
632632
}
633633

634-
void IDASolver::getQuadDkyB(realtype const t, int const k, int const which) const {
634+
void IDASolver::getQuadDkyB(
635+
realtype const t, int const k, int const which
636+
) const {
635637
int status = IDAGetQuadDky(
636638
IDAGetAdjIDABmem(solver_memory_.get(), which), t, k, xQB_.getNVector()
637639
);

src/vector.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ AmiVector::~AmiVector() {
7373
}
7474

7575
AmiVectorArray::AmiVectorArray(
76-
long int const length_inner, long int const length_outer, SUNContext const sunctx
76+
long int const length_inner, long int const length_outer,
77+
SUNContext const sunctx
7778
)
7879
: vec_array_(length_outer, AmiVector(length_inner, sunctx)) {
7980
nvec_array_.resize(length_outer);
@@ -115,13 +116,17 @@ realtype const& AmiVectorArray::at(int const ipos, int const jpos) const {
115116

116117
N_Vector* AmiVectorArray::getNVectorArray() { return nvec_array_.data(); }
117118

118-
N_Vector AmiVectorArray::getNVector(int const pos) { return nvec_array_.at(pos); }
119+
N_Vector AmiVectorArray::getNVector(int const pos) {
120+
return nvec_array_.at(pos);
121+
}
119122

120123
const_N_Vector AmiVectorArray::getNVector(int const pos) const {
121124
return nvec_array_.at(pos);
122125
}
123126

124-
AmiVector& AmiVectorArray::operator[](int const pos) { return vec_array_.at(pos); }
127+
AmiVector& AmiVectorArray::operator[](int const pos) {
128+
return vec_array_.at(pos);
129+
}
125130

126131
AmiVector const& AmiVectorArray::operator[](int const pos) const {
127132
return vec_array_.at(pos);

0 commit comments

Comments
 (0)