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

tol parameter for trace_particle_through_mesh #141

Closed
wants to merge 3 commits into from
Closed
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
13 changes: 10 additions & 3 deletions src/pumipic_adjacency.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ namespace pumipic {
* @param looplimit Maximum number of iterations
* @param debug True if debug information is printed
* @param func Callable object to handle particles at element sides or destination
* @param given_tol Tolerance for intersection. If not positive, it is computed from the minimum element area
* @return True if all particles are found at destination or left domain
*/
template <class ParticleType, typename Segment3d, typename SegmentInt, typename Func>
Expand All @@ -466,7 +467,8 @@ namespace pumipic {
o::Write<o::Real>& inter_points,
int looplimit,
bool debug,
Func& func) {
Func& func,
std::optional<o::Real> given_tol = std::nullopt) {
static_assert(
std::is_invocable_r_v<
void, Func, o::Mesh &, ParticleStructure<ParticleType> *,
Expand All @@ -488,7 +490,13 @@ namespace pumipic {
o::Write<o::LO> lastExit(psCapacity,-1, "search_last_exit");
const auto elmArea = measure_elements_real(&mesh);
bool useBcc = !requireIntersection;
o::Real tol = compute_tolerance_from_area(elmArea);

o::Real tol = 0;
if (!given_tol.has_value()) {
tol = compute_tolerance_from_area(elmArea);
} else {
tol = given_tol.value();
}

int rank;
MPI_Comm_rank(mesh.comm()->get_impl(), &rank);
Expand Down Expand Up @@ -648,7 +656,6 @@ namespace pumipic {
int looplimit,
int debug) {
RemoveParticleOnGeometricModelExit<ParticleType, Segment3d> native_handler(mesh, requireIntersection);

return trace_particle_through_mesh(mesh, ptcls, x_ps_orig, x_ps_tgt, pids, elem_ids, requireIntersection,
inter_faces, inter_points, looplimit, debug, native_handler);
}
Expand Down