Skip to content

Commit

Permalink
Include inner surfaces in the output msh
Browse files Browse the repository at this point in the history
Outer surfaces are tagged with 2^n where n is the respective
triangle's surface tag. Inner surfaces are tagged with 2^n*3^m
where n and m are the scalars from the current and opposite
tets, respectively.
  • Loading branch information
nmnobre committed Aug 18, 2023
1 parent 4c4c169 commit d01b400
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/MeshImprovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2629,17 +2629,28 @@ void floatTetWild::get_surface(const Mesh& mesh, std::vector<Vector3i>& b_faces,
if (faces.empty())
return;
//
#define NL i > 0
#define NU i < faces.size() - 1
#define OB(n) std::make_tuple(faces[i ][0], faces[i ][1], faces[i ][2]) != \
std::make_tuple(faces[i + n][0], faces[i + n][1], faces[i + n][2])
#define IB(n) tets[faces[i][3]].scalar != tets[faces[i + n][3]].scalar
bool is_boundary = true;
for (int i = 0; i < faces.size(); i++) {
if (i < faces.size() - 1 &&
std::make_tuple(faces[i][0], faces[i][1], faces[i][2])
== std::make_tuple(faces[i + 1][0], faces[i + 1][1], faces[i + 1][2])) {
if ((NU) && !(OB(+1)) && !(IB(+1))) {
is_boundary = false;
} else {
if (is_boundary) {
b_colors.push_back(tets[faces[i][3]].quality);
b_tags.push_back(tets[faces[i][3]].surface_tags[faces[i][4]]);
b_faces.push_back(Vector3i(faces[i][0], faces[i][1], faces[i][2]));
if ((NL) && !(OB(-1)) && (IB(-1)))
b_tags.push_back(std::pow(2, tets[faces[i ][3]].scalar) *
std::pow(3, tets[faces[i - 1][3]].scalar));
else if ((NU) && !(OB(+1)) && (IB(+1)))
b_tags.push_back(std::pow(2, tets[faces[i ][3]].scalar) *
std::pow(3, tets[faces[i + 1][3]].scalar));
else
b_tags.push_back(std::pow(2, tets[faces[i ][3]].surface_tags[faces[i][4]]) *
std::pow(3, 0) );
bool is_inv = is_inverted(tet_vertices[tets[faces[i][3]][faces[i][4]]],
tet_vertices[faces[i][0]],
tet_vertices[faces[i][1]],
Expand Down

0 comments on commit d01b400

Please sign in to comment.