Skip to content

Commit

Permalink
adds protection infrastructure to cavity
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Park authored and Mike Park committed Oct 22, 2021
1 parent 24e71d9 commit 831cc8f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
16 changes: 15 additions & 1 deletion src/ref_cavity.c
Expand Up @@ -787,7 +787,7 @@ REF_STATUS ref_cavity_form_ball(REF_CAVITY ref_cavity, REF_GRID ref_grid,
}

REF_STATUS ref_cavity_form_insert(REF_CAVITY ref_cavity, REF_GRID ref_grid,
REF_INT node, REF_INT site) {
REF_INT node, REF_INT site, REF_INT protect) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_CELL ref_cell;
REF_INT item, cell_face, face_node, cell;
Expand All @@ -810,6 +810,13 @@ REF_STATUS ref_cavity_form_insert(REF_CAVITY ref_cavity, REF_GRID ref_grid,

ref_cell = ref_grid_tet(ref_grid);
each_ref_cell_having_node(ref_cell, site, item, cell) {
REF_INT cell_node;
REF_BOOL protected = REF_FALSE;
each_ref_cell_cell_node(ref_cell, cell_node) {
protected
= protected || (protect == ref_cell_c2n(ref_cell, cell_node, cell));
}
if (protected) continue;
RSS(ref_list_contains(ref_cavity_tet_list(ref_cavity), cell,
&already_have_it),
"have tet?");
Expand All @@ -835,6 +842,13 @@ REF_STATUS ref_cavity_form_insert(REF_CAVITY ref_cavity, REF_GRID ref_grid,

ref_cell = ref_grid_tri(ref_grid);
each_ref_cell_having_node(ref_cell, site, item, cell) {
REF_INT cell_node;
REF_BOOL protected = REF_FALSE;
each_ref_cell_cell_node(ref_cell, cell_node) {
protected
= protected || (protect == ref_cell_c2n(ref_cell, cell_node, cell));
}
if (protected) continue;
RSS(ref_list_contains(ref_cavity_tri_list(ref_cavity), cell,
&already_have_it),
"have tet?");
Expand Down
2 changes: 1 addition & 1 deletion src/ref_cavity.h
Expand Up @@ -132,7 +132,7 @@ REF_STATUS ref_cavity_form_empty(REF_CAVITY ref_cavity, REF_GRID ref_grid,
REF_STATUS ref_cavity_form_ball(REF_CAVITY ref_cavity, REF_GRID ref_grid,
REF_INT node);
REF_STATUS ref_cavity_form_insert(REF_CAVITY ref_cavity, REF_GRID ref_grid,
REF_INT node, REF_INT site);
REF_INT node, REF_INT site, REF_INT protect);
REF_STATUS ref_cavity_form_edge_swap(REF_CAVITY ref_cavity, REF_GRID ref_grid,
REF_INT node0, REF_INT node1,
REF_INT node);
Expand Down
7 changes: 5 additions & 2 deletions src/ref_layer.c
Expand Up @@ -583,7 +583,8 @@ static REF_STATUS ref_layer_align_first_layer(REF_GRID ref_grid,
printf("new %d node %d close %d by %f of %f h %f\n", new_node, node,
closest_node, dist, close, h);
RSS(ref_cavity_create(&ref_cavity), "cav create");
RSS(ref_cavity_form_insert(ref_cavity, ref_grid, new_node, node),
RSS(ref_cavity_form_insert(ref_cavity, ref_grid, new_node, node,
REF_EMPTY),
"ball");
RSB(ref_cavity_enlarge_conforming(ref_cavity), "enlarge", {
ref_cavity_tec(ref_cavity, "cav-fail.tec");
Expand Down Expand Up @@ -658,7 +659,9 @@ static REF_STATUS ref_layer_align_quad_advance(REF_GRID ref_grid,
RSS(ref_geom_add(ref_geom, new_node, type, id, uv), "new geom");
RSS(ref_metric_interpolate_node(ref_grid, new_node), "metric interp");
RSS(ref_cavity_create(&ref_cavity), "cav create");
RSS(ref_cavity_form_insert(ref_cavity, ref_grid, new_node, node), "ball");
RSS(ref_cavity_form_insert(ref_cavity, ref_grid, new_node, node,
REF_EMPTY),
"ball");
RSB(ref_cavity_enlarge_conforming(ref_cavity), "enlarge", {
ref_cavity_tec(ref_cavity, "cav-fail.tec");
ref_export_by_extension(ref_grid, "mesh-fail.tec");
Expand Down

0 comments on commit 831cc8f

Please sign in to comment.