diff --git a/src/moab/mesh_manager.cpp b/src/moab/mesh_manager.cpp index 19be979..a22ef71 100644 --- a/src/moab/mesh_manager.cpp +++ b/src/moab/mesh_manager.cpp @@ -187,6 +187,7 @@ std::vector MOABMeshManager::element_vertices(MeshID element) const { moab::EntityHandle element_handle; this->moab_interface()->handle_from_id(moab::MBTRI, element, element_handle); + // if (rval == moab::MB_ENTITY_NOT_FOUND) fatal_error("Could not find entity with ID in the mesh database {}", element); auto out = this->mb_direct()->get_mb_coords(element_handle); return std::vector(out.begin(), out.end()); } @@ -206,11 +207,7 @@ Direction MOABMeshManager::triangle_normal(MeshID element) const BoundingBox MOABMeshManager::element_bounding_box(MeshID element) const { auto vertices = this->element_vertices(element); - BoundingBox bb; - for (const auto& v : vertices) { - bb.update(v); - } - return bb; + return BoundingBox::from_points(vertices); } BoundingBox diff --git a/tools/particle_sim.cpp b/tools/particle_sim.cpp index 57e3985..39976ef 100644 --- a/tools/particle_sim.cpp +++ b/tools/particle_sim.cpp @@ -141,30 +141,31 @@ const int n_particles {100}; const int max_events {1000}; -bool verbose = true; - - for (int i = 0; i < n_particles; i++) { - write_message("Starting particle {}", i); - Particle p(xdg, i, verbose); - p.initialize(); - while (true) { - p.surf_dist(); - // terminate for leakage - if (!p.alive_) break; - p.sample_collision_distance(); - p.advance(); - if (p.surface_intersection_.first < p.collision_distance_) - p.cross_surface(); - else - p.collide(); - if (!p.alive_) break; - - if (p.n_events_ > max_events) { - write_message("Maximum number of events ({}) reached", max_events); - break; - } - } - } - - return 0; +bool verbose = false; + +for (int i = 0; i < n_particles; i++) { + int particle_id = i+1; + write_message("Starting particle {}", particle_id); + Particle p(xdg, particle_id, verbose); + p.initialize(); + while (true) { + p.surf_dist(); + // terminate for leakage + if (!p.alive_) break; + p.sample_collision_distance(); + p.advance(); + if (p.surface_intersection_.first < p.collision_distance_) + p.cross_surface(); + else + p.collide(); + if (!p.alive_) break; + + if (p.n_events_ > max_events) { + write_message("Maximum number of events ({}) reached", max_events); + break; + } + } +} + +return 0; }