Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ include(onetbb)
include(mshio)
include(metis)
include(gmp)
include(lagrange)
include(libigl)
include(spdlog)
include(paraviewo)
Expand Down Expand Up @@ -134,7 +133,6 @@ target_link_libraries(wildmeshing_toolkit PUBLIC
TBB::tbb
mshio::mshio
metis::metis
lagrange::core
nlohmann_json::nlohmann_json
nanoflann::nanoflann
paraviewo::paraviewo
Expand Down
11 changes: 0 additions & 11 deletions cmake/recipes/lagrange.cmake

This file was deleted.

18 changes: 5 additions & 13 deletions cmake/recipes/spdlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,20 @@
# OF ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
#

# MIT

if(TARGET spdlog::spdlog)
return()
endif()

message(STATUS "Third-party (external): creating target 'spdlog::spdlog'")

include(FetchContent)
FetchContent_Declare(
spdlog
URL https://github.com/gabime/spdlog/archive/refs/tags/v1.9.2.zip
URL_HASH MD5=a3d2fb9e5c811ba100380aa82d48f989
include(CPM)
CPMAddPackage(
NAME spdlog
GITHUB_REPOSITORY gabime/spdlog
GIT_TAG v1.17.0
)

option(SPDLOG_INSTALL "Generate the install target" ON)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "spdlog")
FetchContent_MakeAvailable(spdlog)

set_target_properties(spdlog PROPERTIES POSITION_INDEPENDENT_CODE ON)

set_target_properties(spdlog PROPERTIES FOLDER third_party)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR
Expand Down
2 changes: 1 addition & 1 deletion cmake/wmtk_data.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ExternalProject_Add(
SOURCE_DIR ${WMTK_DATA_ROOT}

GIT_REPOSITORY https://github.com/wildmeshing/data2.git
GIT_TAG f2bd8ed5e8af5a125ee4d92cd0af8f32cec60e02
GIT_TAG f21aa84d50a3ac6ffb3b04daf8a3e132b24803b0

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
Expand Down
2 changes: 1 addition & 1 deletion cmake/wmtk_warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(MY_FLAGS
-Werror=nonnull
-Werror=init-self
-Werror=main
-Werror=missing-braces
-Werror=no-missing-braces
-Werror=sequence-point
-Werror=return-type
-Werror=trigraphs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ bool ImageSimulationMesh::swap_face_before(const Tuple& t)
const size_t v2 = tt.switch_edge().switch_vertex().vid();
const size_t v3 = tt.switch_face().switch_edge().switch_vertex().vid();

std::array<size_t, 3> tri{v0, v1, v2};
std::array<size_t, 3> tri{{v0, v1, v2}};

for (auto i = 0; i < 3; i++) {
std::array<size_t, 4> new_tet = t1_vids;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include <wmtk/io/read_triangle_mesh.hpp>
#include <wmtk/utils/InsertTriangleUtils.hpp>
#include <wmtk/utils/Logger.hpp>
#include <wmtk/utils/ManifoldUtils.hpp>
#include <wmtk/utils/Reader.hpp>
#include <wmtk/utils/io.hpp>

#include <wmtk/components/shortest_edge_collapse/ShortestEdgeCollapse.h>
Expand Down Expand Up @@ -55,9 +53,7 @@ std::vector<std::array<size_t, 3>> triangulate_polygon_face(std::vector<wmtk::Ve
(b[0] * c[2] - b[2] * c[0]) != 0))) {
no_colinear = false;
std::array<size_t, 3> t = {
size_t(cur.second),
size_t(next.second),
size_t(nextnext.second)};
{size_t(cur.second), size_t(next.second), size_t(nextnext.second)}};
triangulated_faces.push_back(t);
points_vector.erase(points_vector.begin() + ((i + 1) % points_vector.size()));
break;
Expand All @@ -74,9 +70,9 @@ std::vector<std::array<size_t, 3>> triangulate_polygon_face(std::vector<wmtk::Ve
// cleanup convex polygon
while (points_vector.size() >= 3) {
std::array<size_t, 3> t = {
size_t(points_vector[0].second),
size_t(points_vector[1].second),
size_t(points_vector[points_vector.size() - 1].second)};
{size_t(points_vector[0].second),
size_t(points_vector[1].second),
size_t(points_vector[points_vector.size() - 1].second)}};
triangulated_faces.push_back(t);
points_vector.erase(points_vector.begin());
}
Expand Down Expand Up @@ -327,9 +323,7 @@ void embed_surface(
if (polygon_face.size() == 3) {
// already a triangle
std::array<size_t, 3> triangle_face = {
polygon_face[0],
polygon_face[1],
polygon_face[2]};
{polygon_face[0], polygon_face[1], polygon_face[2]}};
int idx = triangulated_faces.size();
triangulated_faces.push_back(triangle_face);
if (polygon_faces_on_input_surface[i]) {
Expand All @@ -348,9 +342,9 @@ void embed_surface(
for (int j = 0; j < clipped_indices.size(); j++) {
// need to map oldface index to new face indices
std::array<size_t, 3> triangle_face = {
polygon_face[clipped_indices[j][0]],
polygon_face[clipped_indices[j][1]],
polygon_face[clipped_indices[j][2]]};
{polygon_face[clipped_indices[j][0]],
polygon_face[clipped_indices[j][1]],
polygon_face[clipped_indices[j][2]]}};
int idx = triangulated_faces.size();
triangulated_faces.push_back(triangle_face);

Expand Down Expand Up @@ -404,14 +398,14 @@ void embed_surface(
}
}

std::array<size_t, 4> tetra = {v0, v1, v2, v3};
std::array<size_t, 4> tetra = {{v0, v1, v2, v3}};

// if inverted then fix the orientation
Vector3r v0v1 = v_rational[v1] - v_rational[v0];
Vector3r v0v2 = v_rational[v2] - v_rational[v0];
Vector3r v0v3 = v_rational[v3] - v_rational[v0];
if ((v0v1.cross(v0v2)).dot(v0v3) < 0) {
tetra = {v1, v0, v2, v3};
tetra = {{v1, v0, v2, v3}};
}

// push the tet to final queue;
Expand Down Expand Up @@ -467,20 +461,20 @@ void embed_surface(
for (const size_t f : polygon_cell) {
for (const size_t t : map_poly_to_tri_face[f]) {
std::array<size_t, 4> tetra = {
triangulated_faces[t][0],
triangulated_faces[t][1],
triangulated_faces[t][2],
centroid_idx};
{triangulated_faces[t][0],
triangulated_faces[t][1],
triangulated_faces[t][2],
centroid_idx}};
// check inverted tet and fix
Vector3r v0v1 = v_rational[tetra[1]] - v_rational[tetra[0]];
Vector3r v0v2 = v_rational[tetra[2]] - v_rational[tetra[0]];
Vector3r v0v3 = v_rational[tetra[3]] - v_rational[tetra[0]];
if ((v0v1.cross(v0v2)).dot(v0v3) < 0) {
tetra = {
triangulated_faces[t][1],
triangulated_faces[t][0],
triangulated_faces[t][2],
centroid_idx};
{triangulated_faces[t][1],
triangulated_faces[t][0],
triangulated_faces[t][2],
centroid_idx}};
}

tets_final.push_back(tetra);
Expand Down Expand Up @@ -605,9 +599,7 @@ EmbedSurface::EmbedSurface(

std::vector<Eigen::Vector3d> verts;
std::vector<std::array<size_t, 3>> tris;
verts.resize(V.rows());
tris.resize(F.rows());
wmtk::eigen_to_wmtk_input(verts, tris, V, F);
VF_to_vectors(V, F, verts, tris);

V_surf_from_vector(verts);
F_surf_from_vector(tris);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ size_t ImageSimulationMesh::get_order_of_vertex(const size_t vid) const

void ImageSimulationMesh::init_vertex_order()
{
std::array<size_t, 4> count{0, 0, 0, 0};
std::array<size_t, 4> count{{0, 0, 0, 0}};

for (const Tuple& t : get_vertices()) {
const size_t vid = t.vid(*this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ void ImageSimulationMeshTri::init_surfaces_and_boundaries()
const auto surf_edges = get_edges_by_condition([](auto& f) { return f.m_is_surface_fs; });
for (const auto& verts : surf_edges) {
std::array<Vector2d, 2> pp = {
m_vertex_attribute[verts[0]].m_pos,
m_vertex_attribute[verts[1]].m_pos};
{m_vertex_attribute[verts[0]].m_pos, m_vertex_attribute[verts[1]].m_pos}};
if (m_envelope->is_outside(pp)) {
log_and_throw_error("Edge {} is outside!", verts);
}
Expand Down Expand Up @@ -1239,7 +1238,7 @@ bool ImageSimulationMeshTri::collapse_edge_after(const Tuple& loc)
const Vector2d a = VA.at(vids[0]).m_pos;
const Vector2d b = VA.at(vids[1]).m_pos;
// surface envelope
bool is_out = m_envelope->is_outside(std::array<Vector2d, 2>{a, b});
bool is_out = m_envelope->is_outside(std::array<Vector2d, 2>{{a, b}});
if (is_out) {
return false;
}
Expand Down Expand Up @@ -1854,7 +1853,7 @@ std::tuple<double, double> ImageSimulationMeshTri::local_operations(
for (const auto& verts : faces) {
const auto& p0 = m_vertex_attribute[verts[0]].m_pos;
const auto& p1 = m_vertex_attribute[verts[1]].m_pos;
if (m_envelope->is_outside(std::array<Vector2d, 2>{p0, p1})) {
if (m_envelope->is_outside(std::array<Vector2d, 2>{{p0, p1}})) {
logger().error("Edge {} is outside!", verts);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include <jse/jse.h>

#include <wmtk/utils/getRSS.h>
#include <wmtk/utils/Reader.hpp>
#include <wmtk/Types.hpp>
#include <wmtk/io/read_triangle_mesh.hpp>
#include <wmtk/utils/resolve_path.hpp>

#include "IsotropicRemeshing.h"
Expand Down Expand Up @@ -78,15 +79,16 @@ void isotropic_remeshing(nlohmann::json json_params)
std::vector<Eigen::Vector3d> verts;
std::vector<std::array<size_t, 3>> tris;
std::pair<Eigen::Vector3d, Eigen::Vector3d> box_minmax;
double remove_duplicate_eps = 1e-5;
std::vector<size_t> modified_nonmanifold_v;
wmtk::stl_to_manifold_wmtk_input(
input_path,
remove_duplicate_eps,
box_minmax,
verts,
tris,
modified_nonmanifold_v);
{
double remove_duplicate_eps = 1e-5;
MatrixXd V;
MatrixXi F;
wmtk::io::read_triangle_mesh(input_path, V, F, remove_duplicate_eps);
box_minmax.first = V.colwise().minCoeff();
box_minmax.second = V.colwise().maxCoeff();
VF_to_vectors(V, F, verts, tris);
}

double diag = (box_minmax.first - box_minmax.second).norm();
const double envelope_size = env_rel * diag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <igl/remove_duplicate_vertices.h>
#include <wmtk/components/isotropic_remeshing/IsotropicRemeshing.h>
#include <catch2/catch_test_macros.hpp>
#include <wmtk/utils/ManifoldUtils.hpp>

using namespace wmtk;
using namespace components::isotropic_remeshing;
Expand Down Expand Up @@ -83,8 +82,12 @@ TEST_CASE("test_swap", "[test_remeshing]")
std::vector<TriMesh::Tuple> new_e;
int cnt = 0;
for (auto edge : edges) {
if (cnt > 200) break;
if (!edge.is_valid(m)) continue;
if (cnt > 200) {
break;
}
if (!edge.is_valid(m)) {
continue;
}
if (!(edge.switch_face(m)).has_value()) {
REQUIRE_FALSE(m.swap_edge(edge, new_e));
continue;
Expand Down Expand Up @@ -158,11 +161,6 @@ TEST_CASE("remeshing_hanging", "[test_remeshing]")
const double envelope_size = env_rel * diag;
Eigen::VectorXi dummy;
std::vector<size_t> modified_v;
if (!igl::is_edge_manifold(F) || !igl::is_vertex_manifold(F, dummy)) {
auto v1 = v;
auto tri1 = tri;
wmtk::separate_to_manifold(v1, tri1, v, tri, modified_v);
}

IsotropicRemeshing m(v, thread);
m.create_mesh(v.size(), tri, modified_v, envelope_size);
Expand Down
22 changes: 12 additions & 10 deletions components/qslim/wmtk/components/qslim/qslim.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "qslim.hpp"

#include <igl/Timer.h>
#include <igl/read_triangle_mesh.h>
#include <jse/jse.h>
#include <wmtk/utils/Reader.hpp>
#include <wmtk/Types.hpp>
#include <wmtk/io/read_triangle_mesh.hpp>
#include <wmtk/utils/resolve_path.hpp>

#include "QSlimMesh.h"
Expand Down Expand Up @@ -62,18 +62,20 @@ void qslim(nlohmann::json json_params)
const int num_thread = json_params["num_threads"];
double target_abs = json_params["target_abs"];

const double remove_duplicate_eps = 1e-5;
MatrixXd V;
MatrixXi F;
io::read_triangle_mesh(input_path, V, F, remove_duplicate_eps);

std::vector<Eigen::Vector3d> verts;
std::vector<std::array<size_t, 3>> tris;
std::pair<Eigen::Vector3d, Eigen::Vector3d> box_minmax;
const double remove_duplicate_esp = 1e-5;
std::vector<size_t> modified_nonmanifold_v;
stl_to_manifold_wmtk_input(
input_path,
remove_duplicate_esp,
box_minmax,
verts,
tris,
modified_nonmanifold_v);

box_minmax.first = V.colwise().minCoeff();
box_minmax.second = V.colwise().maxCoeff();
VF_to_vectors(V, F, verts, tris);


const double diag = (box_minmax.first - box_minmax.second).norm();
const double envelope_size = env_rel * diag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

#include <wmtk/utils/ManifoldUtils.hpp>

#include <CLI/CLI.hpp>

#include <igl/Timer.h>
Expand Down Expand Up @@ -91,11 +88,6 @@ void shortest_edge_collapse(nlohmann::json json_params)
const double envelope_size = env_rel * diag;
VectorXi dummy;
std::vector<size_t> modified_v;
// if (!igl::is_edge_manifold(F) || !igl::is_vertex_manifold(F, dummy)) {
// auto v1 = v;
// auto tri1 = tri;
// wmtk::separate_to_manifold(v1, tri1, v, tri, modified_v);
// }

ShortestEdgeCollapse m(v, num_threads, !use_sample_envelope);
m.create_mesh(v.size(), tri, modified_v, envelope_size);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <wmtk/utils/Logger.hpp>
#include <wmtk/utils/ManifoldUtils.hpp>

#include <igl/Timer.h>
#include <igl/is_edge_manifold.h>
Expand Down Expand Up @@ -28,10 +27,9 @@ TEST_CASE("separate-manifold-patch", "[test_sec]")
{{0, 1, 4}},
}};

std::vector<Eigen::Vector3d> out_v;
std::vector<std::array<size_t, 3>> out_f;
std::vector<Eigen::Vector3d> out_v = v;
std::vector<std::array<size_t, 3>> out_f = tris;
std::vector<size_t> freeze_v;
wmtk::separate_to_manifold(v, tris, out_v, out_f, freeze_v);
REQUIRE(out_v.size() == 9);
REQUIRE(out_f.size() == 3);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ bool TetWildMesh::swap_face_before(const Tuple& t)
const size_t v2 = tt.switch_edge().switch_vertex().vid();
const size_t v3 = tt.switch_face().switch_edge().switch_vertex().vid();

std::array<size_t, 3> tri{v0, v1, v2};
std::array<size_t, 3> tri{{v0, v1, v2}};

for (auto i = 0; i < 3; i++) {
std::array<size_t, 4> new_tet = t1_vids;
Expand Down
Loading
Loading