Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounding box fix #21

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/moab/mesh_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ std::vector<Vertex> 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<Vertex>(out.begin(), out.end());
}
Expand All @@ -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
Expand Down
53 changes: 27 additions & 26 deletions tools/particle_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading