Skip to content

Commit

Permalink
Merge pull request #7 from cpmech/improve-marked-faces-o2
Browse files Browse the repository at this point in the history
Improve marked faces o2
  • Loading branch information
cpmech authored Oct 15, 2023
2 parents 550603b + d00ba16 commit 80cc767
Show file tree
Hide file tree
Showing 10 changed files with 2,138 additions and 209 deletions.
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ fn main() {
.flag("-Wno-sign-compare")
.flag("-Wno-unused-parameter")
.flag("-Wno-unused-but-set-variable")
.flag("-Wno-maybe-uninitialized")
.compile("c_code_interface_triangle");
cc::Build::new()
.cpp(true)
Expand All @@ -16,6 +17,7 @@ fn main() {
.flag("-Wno-int-to-pointer-cast")
.flag("-Wno-unused-parameter")
.flag("-Wno-unused-but-set-variable")
.flag("-Wno-maybe-uninitialized")
.compile("c_code_interface_tetgen");
}

Expand Down
16 changes: 7 additions & 9 deletions c_code/interface_tetgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,20 +400,18 @@ int32_t tet_out_n_marked_face(struct ExtTetgen *tetgen) {
return static_cast<int>(tetgen->output.marked_faces.size());
}

void tet_out_marked_face(struct ExtTetgen *tetgen, int32_t index, int32_t *a, int32_t *b, int32_t *c, int32_t *marker, int32_t *cell) {
*a = 0;
*b = 0;
*c = 0;
*marker = 0;
*cell = 0;
void tet_out_marked_face(struct ExtTetgen *tetgen, int32_t index, int32_t *points_len_6, int32_t *marker, int32_t *cell) {
if (tetgen == NULL) {
*marker = 0;
*cell = 0;
return;
}
if (index >= 0 && index < static_cast<int>(tetgen->output.marked_faces.size())) {
auto marked_face = tetgen->output.marked_faces[index];
*a = marked_face.key[0];
*b = marked_face.key[1];
*c = marked_face.key[2];
int npoint = tetgen->output.numberofcorners == 10 ? 6 : 3;
for (int i = 0; i < npoint; i++) {
points_len_6[i] = marked_face.points[i];
}
*marker = marked_face.marker;
*cell = marked_face.cell;
} else {
Expand Down
2 changes: 1 addition & 1 deletion c_code/interface_tetgen.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ int32_t tet_out_cell_attribute(struct ExtTetgen *tetgen, int32_t index);

int32_t tet_out_n_marked_face(struct ExtTetgen *tetgen);

void tet_out_marked_face(struct ExtTetgen *tetgen, int32_t index, int32_t *a, int32_t *b, int32_t *c, int32_t *marker, int32_t *cell);
void tet_out_marked_face(struct ExtTetgen *tetgen, int32_t index, int32_t *points_len_6, int32_t *marker, int32_t *cell);

#endif // INTERFACE_TETGEN_H
1 change: 0 additions & 1 deletion c_code/interface_triangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ int32_t tri_run_triangulate(struct ExtTrigen *trigen, int32_t verbose, int32_t q
// * `o2` -- generates second-order elements with six nodes each
// * `Y` -- prohibits the insertion of Steiner points on the mesh boundary
char command[128];
// strcpy(command, "pzAY");
strcpy(command, "pzA");
if (verbose == TRITET_FALSE) {
strcat(command, "Q");
Expand Down
12 changes: 8 additions & 4 deletions c_code/tetgen.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29208,12 +29208,16 @@ void tetgenmesh::outfaces(tetgenio* out)
// add marked face to vector of marked faces // dorival
if (out != (tetgenio *) NULL) { // dorival
tetgenio::marked_face_t marked_face; // dorival
marked_face.key[0] = pointmark(torg) - shift; // dorival
marked_face.key[1] = pointmark(tdest) - shift; // dorival
marked_face.key[2] = pointmark(tapex) - shift; // dorival
marked_face.points[0] = pointmark(torg) - shift; // dorival
marked_face.points[1] = pointmark(tdest) - shift; // dorival
marked_face.points[2] = pointmark(tapex) - shift; // dorival
if (b->order == 2) { // -o2
marked_face.points[4] = pointmark(pp[0]) - shift;
marked_face.points[5] = pointmark(pp[1]) - shift;
marked_face.points[3] = pointmark(pp[2]) - shift;
}
marked_face.marker = marker; // dorival
marked_face.cell = elemindex(tface.tet); // dorival
sort_3(&marked_face.key[0], &marked_face.key[1], &marked_face.key[2]); // dorival
out->marked_faces.push_back(marked_face); // dorival
} // dorival

Expand Down
4 changes: 3 additions & 1 deletion c_code/tetgen.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,14 @@ class tetgenio {
int *adjtetlist;
int numberoftrifaces;

// dorival ///////////////////////////////////////////////////////////////////////////
typedef struct {
int key[3]; // sorted face key with three global point ids
int points[6]; // global IDs of points; 3 or 6 points (if o2)
int marker; // the marker inherited from the PLC
int cell; // the global ID of "a" tetrahedron touching this face
} marked_face_t;
std::vector<marked_face_t> marked_faces; // dorival
// dorival ///////////////////////////////////////////////////////////////////////////

// 'edgelist': An array of edge endpoints. The first edge's endpoints
// are at indices [0] and [1], followed by the remaining edges.
Expand Down
Loading

0 comments on commit 80cc767

Please sign in to comment.