Skip to content

Commit

Permalink
added ability to skip linear geometries
Browse files Browse the repository at this point in the history
  • Loading branch information
jfussbro committed Jul 24, 2023
1 parent a749eb8 commit 41e22fa
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/t8_cmesh/t8_cmesh_readmshfile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1194,8 +1194,8 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp,
}
}
}
/* Abort if not all nodes are on the surface */
if (!all_nodes_on_surface)
/* Abort if not all nodes are on the surface or if the surface is a plane */
if (!all_nodes_on_surface || occ_geometry->t8_geom_is_plane(surface_index))
{
continue;
}
Expand Down Expand Up @@ -1369,6 +1369,13 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp,
edge_nodes[i_edge_node].entity_dim = 1;
}
}

/* Abort if the edge is a line */
if (occ_geometry->t8_geom_is_line(edge_geometry_tag))
{
continue;
}

edge_geometries[i_tree_edges] = edge_geometry_tag;
tree_is_linked = 1;
parameters[0] = edge_nodes[0].parameters[0];
Expand Down Expand Up @@ -1432,6 +1439,13 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp,
edge_nodes[i_edge_node].entity_dim = 2;
}
}

/* Abort if the edge is a line */
if (occ_geometry->t8_geom_is_line(edge_geometry_tag))
{
continue;
}

edge_geometries[i_tree_edges + t8_eclass_num_edges[eclass]] = edge_geometry_tag;
tree_is_linked = 1;
parameters[0] = edge_nodes[0].parameters[0];
Expand Down
20 changes: 20 additions & 0 deletions src/t8_geometry/t8_geometry_implementations/t8_geometry_occ.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ t8_geometry_occ::t8_geom_evaluate_occ_hex (t8_cmesh_t cmesh,
active_tree_vertices, ref_coords,
out_coords);

int tree_is_linear = 1;
const int num_edges = t8_eclass_num_edges[active_tree_class];
const int num_faces = t8_eclass_num_faces[active_tree_class];
double interpolated_coords[3],
Expand All @@ -213,6 +214,9 @@ t8_geometry_occ::t8_geom_evaluate_occ_hex (t8_cmesh_t cmesh,
/* Check if only a surface or a curve is present. Abort if both is true. */
T8_ASSERT (!(edges[i_edge] > 0) != !(edges[i_edge + num_edges] > 0));

/* tree carries a surface or an edge and is therefore not */
tree_is_linear = 0;

/* Interpolate coordinates between edge vertices. Due to the indices i_edge of the edges, the edges point in
* direction of ref_coord i_edge / 4. Therefore, we can use ref_coords[i_edge / 4] for the interpolation.
* 6 -------E3------- 7
Expand Down Expand Up @@ -789,6 +793,22 @@ t8_geometry_occ::t8_geom_evaluate_occ_quad (t8_cmesh_t cmesh,

/* Our indent skript has huge problems with c++ */
/* *INDENT-OFF* */
int
t8_geometry_occ::t8_geom_is_line(const int curve_index) const
{
const Handle_Geom_Curve curve = t8_geom_get_occ_curve(curve_index);
const GeomAdaptor_Curve curve_adaptor (curve);
return curve_adaptor.GetType() == GeomAbs_Line;
}

int
t8_geometry_occ::t8_geom_is_plane(const int surface_index) const
{
const Handle_Geom_Surface surface = t8_geom_get_occ_surface (surface_index);
const GeomAdaptor_Surface surface_adaptor (surface);
return surface_adaptor.GetType() == GeomAbs_Plane;
}

const gp_Pnt
t8_geometry_occ::t8_geom_get_occ_point (const int index) const
{
Expand Down
14 changes: 14 additions & 0 deletions src/t8_geometry/t8_geometry_implementations/t8_geometry_occ.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ public:
virtual void
t8_geom_load_tree_data (t8_cmesh_t cmesh,
t8_gloidx_t gtreeid);

/** Check if a occ_curve is a line.
* \param [in] curve_index The index of the occ_curve.
* \return 1 if curve is a line, 0 if curve is not a line.
*/
int
t8_geom_is_line(const int curve_index) const;

/** Check if a occ_surface is a plane.
* \param [in] surface_index The index of the occ_surface.
* \return 1 if surface is a plane linear, 0 if surface is not a plane.
*/
int
t8_geom_is_plane(const int surface_index) const;

/** Get an occ point from the occ_shape.
* \param [in] index The index of the point in the occ_shape.
Expand Down

0 comments on commit 41e22fa

Please sign in to comment.