diff --git a/src/2d/barrel/describe_scanner_cmd.cpp b/src/2d/barrel/describe_scanner_cmd.cpp index 4721fac..d7d8aa3 100644 --- a/src/2d/barrel/describe_scanner_cmd.cpp +++ b/src/2d/barrel/describe_scanner_cmd.cpp @@ -40,6 +40,8 @@ int main(int argc, char* argv[]) { world = Gate::D2::build_new_full_scanner_volume(); } else if (cl.exist("ideal")) { world = Gate::D2::build_ideal_scanner_volume(); + } else { + throw("you need to select one of: big-barrel, full, new-module"); } const int n_detectors = Gate::D2::count_cristals(world); diff --git a/src/2d/barrel/detector_set_test.cpp b/src/2d/barrel/detector_set_test.cpp index 71517f3..de1a678 100644 --- a/src/2d/barrel/detector_set_test.cpp +++ b/src/2d/barrel/detector_set_test.cpp @@ -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(); @@ -56,7 +56,7 @@ TEST("Serialise") { PET2D::Barrel::SymmetryDescriptor::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(); diff --git a/src/2d/barrel/matrix_cmd.cpp b/src/2d/barrel/matrix_cmd.cpp index b32d8de..8025d3c 100644 --- a/src/2d/barrel/matrix_cmd.cpp +++ b/src/2d/barrel/matrix_cmd.cpp @@ -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("n-pixels"); auto& m_pixel = cl.get("m-pixel"); auto& s_pixel = cl.get("s-pixel"); diff --git a/src/2d/barrel/monte_carlo_test.cpp b/src/2d/barrel/monte_carlo_test.cpp index a750750..fd95efb 100644 --- a/src/2d/barrel/monte_carlo_test.cpp +++ b/src/2d/barrel/monte_carlo_test.cpp @@ -30,6 +30,6 @@ F strip_length = 0.300; } TEST("2d/barrel/phantom_monte_carlo") { - auto scanner2d = PET2D::Barrel::ScannerBuilder::build_single_ring( + PET2D::Barrel::ScannerBuilder::build_single_ring( inner_radius, 32, strip_width, strip_height); } diff --git a/src/2d/barrel/symmetry_descriptor_test.cpp b/src/2d/barrel/symmetry_descriptor_test.cpp index 6c2dacc..9d0cbe5 100644 --- a/src/2d/barrel/symmetry_descriptor_test.cpp +++ b/src/2d/barrel/symmetry_descriptor_test.cpp @@ -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)); diff --git a/src/2d/gate/gate_macros.h b/src/2d/gate/gate_macros.h index e077bc4..e9f31ba 100644 --- a/src/2d/gate/gate_macros.h +++ b/src/2d/gate/gate_macros.h @@ -10,7 +10,10 @@ namespace D2 { template 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* volume() { return new Gate::D2::Box(2.0, 1.0); }; }; } diff --git a/src/2d/gate/gate_volume.h b/src/2d/gate/gate_volume.h index 2ce6611..eb32543 100644 --- a/src/2d/gate/gate_volume.h +++ b/src/2d/gate/gate_volume.h @@ -82,7 +82,7 @@ template class Volume { using VolumeList = std::list; using Transformation = PET2D::Transformation; - Volume() : is_sd_(false), transformation_(new Transformation()) {} + Volume() : transformation_(new Transformation()), is_sd_(false) {} bool is_sd() const { return is_sd_; } @@ -130,7 +130,6 @@ template class Volume { std::unique_ptr> repeater_; // Material std::unique_ptr transformation_; - bool is_sd_; }; diff --git a/src/2d/gate/gate_volume_test.cpp b/src/2d/gate/gate_volume_test.cpp index eb52f96..e0aee78 100644 --- a/src/2d/gate/gate_volume_test.cpp +++ b/src/2d/gate/gate_volume_test.cpp @@ -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)); } diff --git a/src/2d/geometry/find_symmetry.h b/src/2d/geometry/find_symmetry.h index e374fd8..afc249c 100644 --- a/src/2d/geometry/find_symmetry.h +++ b/src/2d/geometry/find_symmetry.h @@ -9,6 +9,7 @@ PET2D::Transformation symmetry_transformation(S symmetry) { using Vector = typename Transformation::Vector; switch (symmetry) { + default: case 0: return Transformation(); case 1: @@ -29,17 +30,16 @@ PET2D::Transformation symmetry_transformation(S symmetry) { } template -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(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; } @@ -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) diff --git a/src/2d/geometry/point_test.cpp b/src/2d/geometry/point_test.cpp index 143c72b..c968716 100644 --- a/src/2d/geometry/point_test.cpp +++ b/src/2d/geometry/point_test.cpp @@ -8,7 +8,6 @@ TEST("Transforming and comparing points") { using Point = PET2D::Point; using Transformation = PET2D::Transformation; - using Vector = typename Point::Vector; Point p(0, 1); Point q(0, 1); diff --git a/src/2d/geometry/polygon.h b/src/2d/geometry/polygon.h index 4a61929..9e0a8c9 100644 --- a/src/2d/geometry/polygon.h +++ b/src/2d/geometry/polygon.h @@ -32,7 +32,7 @@ class Polygon : public util::array> { return *this; } - Polygon& transformed(Transformation tr) { + Polygon transformed(Transformation tr) { Polygon tmp(*this); return tmp.transform(tr); } @@ -148,7 +148,7 @@ class Polygon : public util::array> { 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; diff --git a/src/2d/strip/cuda/gpu_events_soa.h b/src/2d/strip/cuda/gpu_events_soa.h index 9891c7f..c149910 100644 --- a/src/2d/strip/cuda/gpu_events_soa.h +++ b/src/2d/strip/cuda/gpu_events_soa.h @@ -20,7 +20,7 @@ template 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; diff --git a/src/2d/strip/cuda/reconstruction.cu b/src/2d/strip/cuda/reconstruction.cu index fa81a39..3d9962d 100644 --- a/src/2d/strip/cuda/reconstruction.cu +++ b/src/2d/strip/cuda/reconstruction.cu @@ -115,8 +115,8 @@ void run(Scanner& scanner, template void fill_with_sensitivity(F* sensitivity, Scanner& 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) { diff --git a/src/3d/full/scanner.h b/src/3d/full/scanner.h index 85cb1a0..fc030ee 100644 --- a/src/3d/full/scanner.h +++ b/src/3d/full/scanner.h @@ -83,7 +83,7 @@ template class Scanner { util::array 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) { diff --git a/src/3d/hybrid/reconstruction_cmd.cpp b/src/3d/hybrid/reconstruction_cmd.cpp index 69e8ece..bf933c3 100644 --- a/src/3d/hybrid/reconstruction_cmd.cpp +++ b/src/3d/hybrid/reconstruction_cmd.cpp @@ -115,10 +115,8 @@ using Pixel = PET2D::Pixel; using LOR = PET2D::Barrel::LOR; using Matrix = PET2D::Barrel::SparseMatrix; -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, @@ -245,7 +243,7 @@ int main(int argc, char* argv[]) { util::ibstream in_geometry(cl.get("geometry")); ENSURE_IS_OPEN(in_geometry, "geometry", cl.get("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")) { @@ -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 { @@ -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 @@ -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, " diff --git a/src/util/gate_parser.h b/src/util/gate_parser.h index b5e20d2..ed846a1 100644 --- a/src/util/gate_parser.h +++ b/src/util/gate_parser.h @@ -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);