Skip to content

Commit

Permalink
Fix compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lamyj committed Oct 2, 2023
1 parent 92ab9b1 commit 321ffc9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion examples/epg/discrete.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <chrono>
#include <cmath>
#include <iostream>

#include <sycomore/epg/Discrete.h>
Expand Down Expand Up @@ -32,7 +33,7 @@ int main()
sycomore::epg::Discrete(species), sycomore::epg::Discrete(species)};
models[1].threshold = 1e-6;

std::size_t repetitions = 4*species.T1()/TR;
std::size_t repetitions = std::lround(4*species.T1()/TR);

sycomore::TensorC<2> S_plus({models.size(), repetitions}, 0);
sycomore::TensorC<2> S_minus({models.size(), repetitions}, 0);
Expand Down
4 changes: 3 additions & 1 deletion examples/epg/regular.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <cmath>

#include <sycomore/epg/Regular.h>
#include <sycomore/Species.h>
#include <sycomore/sycomore.h>
Expand All @@ -13,7 +15,7 @@ int main()
auto flip_angle=30*deg, TE=5*ms, TR=25*ms;
std::vector<sycomore::Quantity> phase_steps{0*deg, 90*deg, 117*deg, 180*deg};
auto slice_thickness=1*mm, tau_readout=1*ms;
std::size_t repetitions = 5*species.T1()/TR;
std::size_t repetitions = std::lround(5*species.T1()/TR);

// Motion to k-space extremity and its associated gradient amplitude
auto k_max = 0.5 * 2*M_PI / slice_thickness;
Expand Down
8 changes: 4 additions & 4 deletions examples/isochromat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ int main()
auto idle = model.build_time_interval(10*ms);

std::vector<std::pair<sycomore::Quantity, sycomore::Vector3R>> record{
{0*s, xt::view(model.magnetization(), 0)}};
{0*s, xt::view(model.magnetization(), 0UL)}};

for(std::size_t i=0; i!=10; ++i)
{
model.apply(idle);
record.emplace_back(
record.back().first+step, xt::view(model.magnetization(), 0));
record.back().first+step, xt::view(model.magnetization(), 0UL));
}

model.apply(pulse);
record.emplace_back(
record.back().first+step, xt::view(model.magnetization(), 0));
record.back().first+step, xt::view(model.magnetization(), 0UL));

for(std::size_t i=0; i!=100; ++i)
{
model.apply(idle);
record.emplace_back(
record.back().first+step, xt::view(model.magnetization(), 0));
record.back().first+step, xt::view(model.magnetization(), 0UL));
}

return 0;
Expand Down
8 changes: 4 additions & 4 deletions tests/cpp/isochromat/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ BOOST_AUTO_TEST_CASE(TimeIntervalUniform)

auto combined = model.build_phase_accumulation(2*M_PI*400*10e-3);
combined.pre_multiply(model.build_relaxation(10*ms));
BOOST_TEST(xt::allclose(xt::view(op.array(), 0), combined.array()));
BOOST_TEST(xt::allclose(xt::view(op.array(), 0UL), combined.array()));

combined = model.build_phase_accumulation(
2*M_PI*400*10e-3 + sycomore::gamma.magnitude*50e-6*10e-3);
combined.pre_multiply(model.build_relaxation(10*ms));
BOOST_TEST(xt::allclose(xt::view(op.array(), 1), combined.array()));
BOOST_TEST(xt::allclose(xt::view(op.array(), 1UL), combined.array()));

auto default_frequency_and_gradient = model.build_time_interval(10_ms);
BOOST_TEST(xt::allclose(
Expand All @@ -144,12 +144,12 @@ BOOST_AUTO_TEST_CASE(TimeIntervalVariable)
auto combined = model.build_phase_accumulation(
2*M_PI*400*10e-3 + sycomore::gamma.magnitude*10e-6*10e-3);
combined.pre_multiply(model.build_relaxation(10*ms));
BOOST_TEST(xt::allclose(xt::view(op.array(), 0), combined.array()));
BOOST_TEST(xt::allclose(xt::view(op.array(), 0UL), combined.array()));

combined = model.build_phase_accumulation(
2*M_PI*600*10e-3 + sycomore::gamma.magnitude*15e-6*10e-3);
combined.pre_multiply(model.build_relaxation(10*ms));
BOOST_TEST(xt::allclose(xt::view(op.array(), 1), combined.array()));
BOOST_TEST(xt::allclose(xt::view(op.array(), 1UL), combined.array()));

auto default_gradient = model.build_time_interval(10_ms, {400*Hz, 600*Hz});
BOOST_TEST(xt::allclose(
Expand Down

0 comments on commit 321ffc9

Please sign in to comment.