Skip to content

Commit b444f33

Browse files
committed
add more braces
1 parent 43fda0b commit b444f33

File tree

4 files changed

+50
-28
lines changed

4 files changed

+50
-28
lines changed

multi_physics/QED/QED_tests/test_picsar_chi_functions.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ void test_chi_photons(
7272

7373
const auto exp_res = static_cast<RealType>(t_exp_res);
7474

75-
if(exp_res != static_cast<RealType>(0.0))
75+
if(exp_res != static_cast<RealType>(0.0)){
7676
BOOST_CHECK_SMALL((res-exp_res)/exp_res, tolerance<RealType>());
77-
else
77+
}
78+
else{
7879
BOOST_CHECK_SMALL(res, tolerance<RealType>());
80+
}
7981
}
8082

8183
BOOST_AUTO_TEST_CASE( chi_photons_1 )
@@ -277,10 +279,12 @@ void test_chi_ele_pos(
277279

278280
const auto exp_res = static_cast<RealType>(t_exp_res);
279281

280-
if(exp_res != static_cast<RealType>(0.0))
282+
if(exp_res != static_cast<RealType>(0.0)){
281283
BOOST_CHECK_SMALL((res-exp_res)/exp_res, tolerance<RealType>());
282-
else
284+
}
285+
else{
283286
BOOST_CHECK_SMALL(res, tolerance<RealType>());
287+
}
284288
}
285289

286290
BOOST_AUTO_TEST_CASE( chi_ele_pos_1 )

multi_physics/QED/QED_tests/test_picsar_gamma_functions.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ void test_gamma_photons(
5656

5757
const auto exp_res = static_cast<RealType>(t_exp_res);
5858

59-
if(exp_res != static_cast<RealType>(0.0))
59+
if(exp_res != static_cast<RealType>(0.0)){
6060
BOOST_CHECK_SMALL((res-exp_res)/exp_res, tolerance<RealType>());
61-
else
61+
}
62+
else{
6263
BOOST_CHECK_SMALL(res, tolerance<RealType>());
64+
}
6365
}
6466

6567
void test_gamma_photons_all_cases(
@@ -172,10 +174,12 @@ void test_gamma_ele_pos(
172174

173175
const auto exp_res = static_cast<RealType>(t_exp_res);
174176

175-
if(exp_res != static_cast<RealType>(0.0))
177+
if(exp_res != static_cast<RealType>(0.0)){
176178
BOOST_CHECK_SMALL((res-exp_res)/exp_res, tolerance<RealType>());
177-
else
179+
}
180+
else{
178181
BOOST_CHECK_SMALL(res, tolerance<RealType>());
182+
}
179183
}
180184

181185
void test_gamma_ele_pos_all_cases(

multi_physics/QED/include/picsar_qed/containers/picsar_tables.hpp

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,9 @@ namespace details{
311311

312312
const auto idx_left = static_cast<int>(
313313
m_floor((m_how_many_x-1)*(where_x-m_x_min)/m_x_size));
314-
if (idx_left == (m_how_many_x-1))
314+
if (idx_left == (m_how_many_x-1)){
315315
return m_values[m_how_many_x-1];
316+
}
316317
const auto idx_right = idx_left + 1;
317318

318319
const auto xleft = get_x_coord(idx_left);
@@ -371,8 +372,9 @@ namespace details{
371372
utils::serialization::put_in(m_x_max, raw_data);
372373
utils::serialization::put_in(m_how_many_x, raw_data);
373374
utils::serialization::put_in(m_dx, raw_data);
374-
for (auto val : m_values)
375+
for (auto val : m_values){
375376
utils::serialization::put_in(val, raw_data);
377+
}
376378

377379
return raw_data;
378380
}
@@ -473,21 +475,25 @@ namespace details{
473475
m_y_max = serialization::get_out<decltype(m_y_max)>(it_raw_data);
474476
m_x_size = m_x_max - m_x_min;
475477
m_y_size = m_y_max - m_y_min;
476-
if(m_x_size < 0)
478+
if(m_x_size < 0){
477479
throw std::runtime_error("raw_data contains invalid data.");
478-
if(m_y_size < 0)
480+
}
481+
if(m_y_size < 0){
479482
throw std::runtime_error("raw_data contains invalid data.");
483+
}
480484

481485
m_how_many_x =
482486
serialization::get_out<decltype(m_how_many_x)>(it_raw_data);
483487
m_how_many_y =
484488
serialization::get_out<decltype(m_how_many_y)>(it_raw_data);
485489
m_dx = serialization::get_out<decltype(m_dx)>(it_raw_data);
486490
m_dy = serialization::get_out<decltype(m_dy)>(it_raw_data);
487-
if(m_how_many_x <= 0)
491+
if(m_how_many_x <= 0){
488492
throw std::runtime_error("raw_data contains invalid data.");
489-
if(m_how_many_y <= 0)
493+
}
494+
if(m_how_many_y <= 0){
490495
throw std::runtime_error("raw_data contains invalid data.");
496+
}
491497
m_values = VectorType(m_how_many_x*m_how_many_y);
492498
auto vals = serialization::get_n_out<RealType>(
493499
it_raw_data,
@@ -755,8 +761,9 @@ namespace details{
755761

756762
auto idx_left = static_cast<int>(
757763
m_floor((m_how_many_x-1)*(where_x-m_x_min)/m_x_size));
758-
if (idx_left == (m_how_many_x-1))
764+
if (idx_left == (m_how_many_x-1)){
759765
idx_left = m_how_many_x-2;
766+
}
760767
const auto idx_right = idx_left + 1;
761768

762769
const auto xleft = idx_left*m_dx + m_x_min;
@@ -863,8 +870,9 @@ namespace details{
863870
utils::serialization::put_in(m_how_many_y, raw_data);
864871
utils::serialization::put_in(m_dx, raw_data);
865872
utils::serialization::put_in(m_dy, raw_data);
866-
for (auto val : m_values)
873+
for (auto val : m_values){
867874
utils::serialization::put_in(val, raw_data);
875+
}
868876

869877
return raw_data;
870878
}
@@ -1269,8 +1277,9 @@ namespace details{
12691277
using namespace picsar::multi_physics::math;
12701278

12711279
auto idx_left = m_ix_map_functor(where_x);
1272-
if (idx_left == (m_how_many_x-1))
1280+
if (idx_left == (m_how_many_x-1)){
12731281
idx_left = m_how_many_x-2;
1282+
}
12741283
const auto idx_right = idx_left + 1;
12751284

12761285
const auto xleft = get_x_coord(idx_left);
@@ -1370,16 +1379,21 @@ namespace details{
13701379
static_cast<char>(sizeof(RealType)), raw_data);
13711380
utils::serialization::put_in(m_how_many_x, raw_data);
13721381
utils::serialization::put_in(m_how_many_y, raw_data);
1373-
for (const auto val : m_values)
1382+
for (const auto val : m_values){
13741383
utils::serialization::put_in(val, raw_data);
1375-
for (const auto dd : m_x_map_functor.serialize())
1384+
}
1385+
for (const auto dd : m_x_map_functor.serialize()){
13761386
utils::serialization::put_in(dd, raw_data);
1377-
for (const auto dd : m_y_map_functor.serialize())
1387+
}
1388+
for (const auto dd : m_y_map_functor.serialize()){
13781389
utils::serialization::put_in(dd, raw_data);
1379-
for (const auto dd : m_ix_map_functor.serialize())
1390+
}
1391+
for (const auto dd : m_ix_map_functor.serialize()){
13801392
utils::serialization::put_in(dd, raw_data);
1381-
for (const auto dd : m_iy_map_functor.serialize())
1393+
}
1394+
for (const auto dd : m_iy_map_functor.serialize()){
13821395
utils::serialization::put_in(dd, raw_data);
1396+
}
13831397

13841398
return raw_data;
13851399
}

multi_physics/QED/include/picsar_qed/physics/breit_wheeler/breit_wheeler_engine_tabulated_functions.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ namespace breit_wheeler{
9898
auto prod = (two<RealType>-chi_phot*xx_3_2)
9999
*k_v(two_thirds<RealType>,
100100
two_thirds<RealType>*xx_3_2);
101-
if(std::isnan(prod)) prod = zero<RealType>;
101+
if(std::isnan(prod)) { prod = zero<RealType>; }
102102

103103
return (inner_integral-prod);
104104
}
@@ -117,7 +117,7 @@ namespace breit_wheeler{
117117
inline RealType compute_T_function(const RealType chi_phot)
118118
{
119119
using namespace math;
120-
if(chi_phot <= math::zero<RealType>) return math::zero<RealType>;
120+
if(chi_phot <= math::zero<RealType>) { return math::zero<RealType>; }
121121
constexpr auto coeff = static_cast<RealType>(1./math::pi<>);
122122
return coeff*math::quad_a_b_s<RealType>(
123123
[=](RealType cc){
@@ -147,11 +147,11 @@ namespace breit_wheeler{
147147
{
148148
using namespace math;
149149

150-
if(chi_photon <= zero<RealType>) return zero<RealType>;
151-
if(chi_ele_end <= zero<RealType>) return zero<RealType>;
150+
if(chi_photon <= zero<RealType>) { return zero<RealType>; }
151+
if(chi_ele_end <= zero<RealType>) { return zero<RealType>; }
152152

153-
if(chi_ele_end > chi_photon) chi_ele_end = chi_photon;
154-
if(chi_ele_start >= chi_ele_end) return zero<RealType>;
153+
if(chi_ele_end > chi_photon) { chi_ele_end = chi_photon; }
154+
if(chi_ele_start >= chi_ele_end) { return zero<RealType>; }
155155

156156
constexpr auto coeff = static_cast<RealType>(1./pi<>);
157157

0 commit comments

Comments
 (0)