Skip to content

Commit

Permalink
Merge 2019-10-22 warning fixes back to 2018-05-15
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Strzelecki committed Oct 22, 2019
1 parent d570186 commit 4ed746f
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 35 deletions.
2 changes: 2 additions & 0 deletions src/2d/barrel/describe_scanner_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ int main(int argc, char* argv[]) {
world = Gate::D2::build_new_full_scanner_volume<F>();
} else if (cl.exist("ideal")) {
world = Gate::D2::build_ideal_scanner_volume<F>();
} else {
throw("you need to select one of: big-barrel, full, new-module");
}

const int n_detectors = Gate::D2::count_cristals<F, S>(world);
Expand Down
4 changes: 2 additions & 2 deletions src/2d/barrel/detector_set_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TEST("Serialise") {
std::ifstream in(name);
auto scanner_copy = Builder::deserialize(in);

for (int d = 0; d < scanner.size(); d++) {
for (size_t d = 0; d < scanner.size(); d++) {
REQUIRE(scanner[d].approx_equal_dihedral(scanner_copy[d], 1e-5));
}
in.close();
Expand All @@ -56,7 +56,7 @@ TEST("Serialise") {
PET2D::Barrel::SymmetryDescriptor<S>::deserialize(in_s));
in_s.close();
std::remove(name_s.c_str());
for (int d = 0; d < scanner.size(); d++) {
for (size_t d = 0; d < scanner.size(); d++) {
REQUIRE(scanner[d].approx_equal_dihedral(scanner_copy[d], 1e-5));
}
auto descriptor_copy = scanner_copy.symmetry_descriptor();
Expand Down
1 change: 0 additions & 1 deletion src/2d/barrel/matrix_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ static void run(cmdline::parser& cl, ModelArgs... args) {

ModelClass model(args...);

auto n_detectors = scanner.size();
auto& n_pixels = cl.get<int>("n-pixels");
auto& m_pixel = cl.get<int>("m-pixel");
auto& s_pixel = cl.get<double>("s-pixel");
Expand Down
2 changes: 1 addition & 1 deletion src/2d/barrel/monte_carlo_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ F strip_length = 0.300;
}

TEST("2d/barrel/phantom_monte_carlo") {
auto scanner2d = PET2D::Barrel::ScannerBuilder<Scanner>::build_single_ring(
PET2D::Barrel::ScannerBuilder<Scanner>::build_single_ring(
inner_radius, 32, strip_width, strip_height);
}
2 changes: 1 addition & 1 deletion src/2d/barrel/symmetry_descriptor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ TEST("Find symmetry") {
REQUIRE(symmetry_descriptor.symmetric_detector(6, 7) == 0);

for (S s = 0; s < SymmetryDescriptor::EIGHT; s++) {
for (S d = 0; d < detector.size(); d++) {
for (size_t d = 0; d < detector.size(); d++) {
INFO("s = " << s << " d = " << d);
REQUIRE(find_symmetric(detector, s, d, 1e-4) ==
symmetry_descriptor.symmetric_detector(d, s));
Expand Down
5 changes: 4 additions & 1 deletion src/2d/gate/gate_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ namespace D2 {
template <typename FType, typename SType> class GateMacrosInterpreter {
public:
using F = FType;
void interpret(const std::istream& macro){};
void interpret(const std::istream& macro) {
// FIXME: provide implementation
(void)macro; // mark as used (for now)
}
Gate::D2::Volume<F>* volume() { return new Gate::D2::Box<F>(2.0, 1.0); };
};
}
Expand Down
3 changes: 1 addition & 2 deletions src/2d/gate/gate_volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ template <typename FType> class Volume {
using VolumeList = std::list<Volume*>;
using Transformation = PET2D::Transformation<F>;

Volume() : is_sd_(false), transformation_(new Transformation()) {}
Volume() : transformation_(new Transformation()), is_sd_(false) {}

bool is_sd() const { return is_sd_; }

Expand Down Expand Up @@ -130,7 +130,6 @@ template <typename FType> class Volume {
std::unique_ptr<Repeater<F>> repeater_;
// Material
std::unique_ptr<Transformation> transformation_;

bool is_sd_;
};

Expand Down
2 changes: 1 addition & 1 deletion src/2d/gate/gate_volume_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ TEST("old multi ring") {
0.021);

for (S s = 0; s < 8; s++) {
for (S d = 0; d < scanner.size(); d++) {
for (size_t d = 0; d < scanner.size(); d++) {
REQUIRE(s_descriptor.symmetric_detector(d, s) ==
ref_scanner.symmetry_descriptor().symmetric_detector(d, s));
}
Expand Down
14 changes: 7 additions & 7 deletions src/2d/geometry/find_symmetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ PET2D::Transformation<F> symmetry_transformation(S symmetry) {

using Vector = typename Transformation::Vector;
switch (symmetry) {
default:
case 0:
return Transformation();
case 1:
Expand All @@ -29,17 +30,16 @@ PET2D::Transformation<F> symmetry_transformation(S symmetry) {
}

template <typename Scanner>
typename Scanner::S find_symmetric(Scanner scanner,
typename Scanner::S symmetry,
typename Scanner::S detector,
typename Scanner::F epsilon) {
size_t find_symmetric(Scanner scanner,
typename Scanner::S symmetry,
typename Scanner::S detector,
typename Scanner::F epsilon) {
using F = typename Scanner::F;
using S = typename Scanner::S;

auto t = symmetry_transformation<F>(symmetry);
auto t_detector = scanner[detector].transformed(t);

for (S d = 0; d < scanner.size(); d++) {
for (size_t d = 0; d < scanner.size(); d++) {
if (t_detector.approx_equal_dihedral(scanner[d], epsilon))
return d;
}
Expand All @@ -53,7 +53,7 @@ bool fill_symmetry_descriptor(
typename Scanner::F epsilon) {
using S = typename Scanner::S;

for (S d = 0; d < scanner.size(); d++) {
for (size_t d = 0; d < scanner.size(); d++) {
for (S s = 0; s < descriptor.n_symmetries; s++) {
auto symmetric = find_symmetric(scanner, s, d, epsilon);
if (symmetric < 0)
Expand Down
1 change: 0 additions & 1 deletion src/2d/geometry/point_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ TEST("Transforming and comparing points") {

using Point = PET2D::Point<F>;
using Transformation = PET2D::Transformation<F>;
using Vector = typename Point::Vector;

Point p(0, 1);
Point q(0, 1);
Expand Down
4 changes: 2 additions & 2 deletions src/2d/geometry/polygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Polygon : public util::array<NumPoints, Point<FType>> {
return *this;
}

Polygon& transformed(Transformation tr) {
Polygon transformed(Transformation tr) {
Polygon tmp(*this);
return tmp.transform(tr);
}
Expand Down Expand Up @@ -148,7 +148,7 @@ class Polygon : public util::array<NumPoints, Point<FType>> {

bool approx_equal_circular(const Polygon& rhs, F epsilon = 1e-5) {
Polygon p(rhs);
for (int i = 0; i < rhs.size(); i++) {
for (size_t i = 0; i < rhs.size(); i++) {
std::rotate(p.begin(), p.begin() + 1, p.end());
if (approx_equal(p, epsilon))
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/2d/strip/cuda/gpu_events_soa.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ template <typename FType> struct ResponsesSOA {
F* cpu_dl = new F[n_responses];

// fill CPU side SOA
for (int i = 0; i < n_responses; ++i) {
for (size_t i = 0; i < n_responses; ++i) {
cpu_z_u[i] = source[i].z_u;
cpu_z_d[i] = source[i].z_d;
cpu_dl[i] = source[i].dl;
Expand Down
4 changes: 2 additions & 2 deletions src/2d/strip/cuda/reconstruction.cu
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ void run(Scanner<F, S>& scanner,
template <typename F>
void fill_with_sensitivity(F* sensitivity, Scanner<F, S>& scanner) {

size_t width = scanner.n_z_pixels;
size_t height = scanner.n_y_pixels;
const int width = scanner.n_z_pixels;
const int height = scanner.n_y_pixels;

for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
Expand Down
2 changes: 1 addition & 1 deletion src/3d/full/scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ template <typename F, typename S, int MAX_VOLUMES = 2 << 9> class Scanner {
util::array<MAX_VOLUMES, intersection_t> intersected_volumes_;
int hits = 0;

for (int i = 0; i < volumes_.size(); i++) {
for (size_t i = 0; i < volumes_.size(); i++) {
auto v = volumes_[i];
auto hit = v->intersects_with(ray);
if (hit.intersected) {
Expand Down
16 changes: 6 additions & 10 deletions src/3d/hybrid/reconstruction_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ using Pixel = PET2D::Pixel<S>;
using LOR = PET2D::Barrel::LOR<S>;
using Matrix = PET2D::Barrel::SparseMatrix<Pixel, LOR, Hit>;

static void run_with_geometry(cmdline::parser& cl,
int argc,
Geometry& geometry);
static void run_with_matrix(cmdline::parser& cl, int argc, Matrix& matrix);
static void run_with_geometry(cmdline::parser& cl, Geometry& geometry);
static void run_with_matrix(cmdline::parser& cl, Matrix& matrix);
static void run_reconstruction(cmdline::parser& cl,
Reconstruction::Scanner& scanner,
Reconstruction::Grid& grid,
Expand Down Expand Up @@ -245,7 +243,7 @@ int main(int argc, char* argv[]) {
util::ibstream in_geometry(cl.get<std::string>("geometry"));
ENSURE_IS_OPEN(in_geometry, "geometry", cl.get<std::string>("geometry"));
Geometry geometry(in_geometry);
run_with_geometry(cl, argc, geometry);
run_with_geometry(cl, geometry);
}
// 3D reconstruction using system matrix only
else if (cl.exist("system")) {
Expand All @@ -260,7 +258,7 @@ int main(int argc, char* argv[]) {
matrix_cfg.close();
cmdline::load(cl, matrix_name, matrix_base_name + ".cfg");
}
run_with_matrix(cl, argc, matrix);
run_with_matrix(cl, matrix);
}
// bail out if no geometry or system matrix is given
else {
Expand All @@ -278,9 +276,7 @@ int main(int argc, char* argv[]) {
CMDLINE_CATCH
}

static void run_with_geometry(cmdline::parser& cl,
int argc,
Geometry& geometry) {
static void run_with_geometry(cmdline::parser& cl, Geometry& geometry) {
// FIXME: this is very very stupid way to set argument manually, so cmdline
// thinks it was provided via command line, but in fact we load it from
// geometry file
Expand Down Expand Up @@ -363,7 +359,7 @@ static void run_with_geometry(cmdline::parser& cl,
run_reconstruction(cl, scanner, grid, geometry_soa);
}

static void run_with_matrix(cmdline::parser& cl, int argc, Matrix& matrix) {
static void run_with_matrix(cmdline::parser& cl, Matrix& matrix) {
if (matrix.triangular()) {
throw(
"matrix must be in full form, "
Expand Down
2 changes: 0 additions & 2 deletions src/util/gate_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ class Parser {
}

start++;
bool another_command = true;
while (1) {
auto next_backslash = input.find_first_of("/ \t\n", start);
if (next_backslash == std::string::npos) {
fprintf(stderr, "`%s' is not a gate command ", input.c_str());
chain.is_valid_ = false;
another_command = false;
return std::string::npos;
}
auto command = input.substr(start, next_backslash - start);
Expand Down

0 comments on commit 4ed746f

Please sign in to comment.