Skip to content

Commit 96605a6

Browse files
authored
Merge pull request #921 from wildmeshing/dzint/remove_lagrange
remove Lagrange
2 parents 6aa103f + 8668bda commit 96605a6

36 files changed

Lines changed: 189 additions & 614 deletions

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ include(onetbb)
7575
include(mshio)
7676
include(metis)
7777
include(gmp)
78-
include(lagrange)
7978
include(libigl)
8079
include(spdlog)
8180
include(paraviewo)
@@ -134,7 +133,6 @@ target_link_libraries(wildmeshing_toolkit PUBLIC
134133
TBB::tbb
135134
mshio::mshio
136135
metis::metis
137-
lagrange::core
138136
nlohmann_json::nlohmann_json
139137
nanoflann::nanoflann
140138
paraviewo::paraviewo

cmake/recipes/lagrange.cmake

Lines changed: 0 additions & 11 deletions
This file was deleted.

cmake/recipes/spdlog.cmake

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,20 @@
99
# OF ANY KIND, either express or implied. See the License for the specific language
1010
# governing permissions and limitations under the License.
1111
#
12-
13-
# MIT
14-
1512
if(TARGET spdlog::spdlog)
1613
return()
1714
endif()
1815

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

21-
include(FetchContent)
22-
FetchContent_Declare(
23-
spdlog
24-
URL https://github.com/gabime/spdlog/archive/refs/tags/v1.9.2.zip
25-
URL_HASH MD5=a3d2fb9e5c811ba100380aa82d48f989
18+
include(CPM)
19+
CPMAddPackage(
20+
NAME spdlog
21+
GITHUB_REPOSITORY gabime/spdlog
22+
GIT_TAG v1.17.0
2623
)
2724

28-
option(SPDLOG_INSTALL "Generate the install target" ON)
29-
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "spdlog")
30-
FetchContent_MakeAvailable(spdlog)
31-
3225
set_target_properties(spdlog PROPERTIES POSITION_INDEPENDENT_CODE ON)
33-
3426
set_target_properties(spdlog PROPERTIES FOLDER third_party)
3527

3628
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR

cmake/wmtk_data.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ExternalProject_Add(
1616
SOURCE_DIR ${WMTK_DATA_ROOT}
1717

1818
GIT_REPOSITORY https://github.com/wildmeshing/data2.git
19-
GIT_TAG f2bd8ed5e8af5a125ee4d92cd0af8f32cec60e02
19+
GIT_TAG f21aa84d50a3ac6ffb3b04daf8a3e132b24803b0
2020

2121
CONFIGURE_COMMAND ""
2222
BUILD_COMMAND ""

cmake/wmtk_warnings.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ set(MY_FLAGS
2929
-Werror=nonnull
3030
-Werror=init-self
3131
-Werror=main
32-
-Werror=missing-braces
32+
-Werror=no-missing-braces
3333
-Werror=sequence-point
3434
-Werror=return-type
3535
-Werror=trigraphs

components/image_simulation/wmtk/components/image_simulation/EdgeSwapping.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ bool ImageSimulationMesh::swap_face_before(const Tuple& t)
251251
const size_t v2 = tt.switch_edge().switch_vertex().vid();
252252
const size_t v3 = tt.switch_face().switch_edge().switch_vertex().vid();
253253

254-
std::array<size_t, 3> tri{v0, v1, v2};
254+
std::array<size_t, 3> tri{{v0, v1, v2}};
255255

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

components/image_simulation/wmtk/components/image_simulation/EmbedSurface.cpp

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include <wmtk/io/read_triangle_mesh.hpp>
1818
#include <wmtk/utils/InsertTriangleUtils.hpp>
1919
#include <wmtk/utils/Logger.hpp>
20-
#include <wmtk/utils/ManifoldUtils.hpp>
21-
#include <wmtk/utils/Reader.hpp>
2220
#include <wmtk/utils/io.hpp>
2321

2422
#include <wmtk/components/shortest_edge_collapse/ShortestEdgeCollapse.h>
@@ -55,9 +53,7 @@ std::vector<std::array<size_t, 3>> triangulate_polygon_face(std::vector<wmtk::Ve
5553
(b[0] * c[2] - b[2] * c[0]) != 0))) {
5654
no_colinear = false;
5755
std::array<size_t, 3> t = {
58-
size_t(cur.second),
59-
size_t(next.second),
60-
size_t(nextnext.second)};
56+
{size_t(cur.second), size_t(next.second), size_t(nextnext.second)}};
6157
triangulated_faces.push_back(t);
6258
points_vector.erase(points_vector.begin() + ((i + 1) % points_vector.size()));
6359
break;
@@ -74,9 +70,9 @@ std::vector<std::array<size_t, 3>> triangulate_polygon_face(std::vector<wmtk::Ve
7470
// cleanup convex polygon
7571
while (points_vector.size() >= 3) {
7672
std::array<size_t, 3> t = {
77-
size_t(points_vector[0].second),
78-
size_t(points_vector[1].second),
79-
size_t(points_vector[points_vector.size() - 1].second)};
73+
{size_t(points_vector[0].second),
74+
size_t(points_vector[1].second),
75+
size_t(points_vector[points_vector.size() - 1].second)}};
8076
triangulated_faces.push_back(t);
8177
points_vector.erase(points_vector.begin());
8278
}
@@ -327,9 +323,7 @@ void embed_surface(
327323
if (polygon_face.size() == 3) {
328324
// already a triangle
329325
std::array<size_t, 3> triangle_face = {
330-
polygon_face[0],
331-
polygon_face[1],
332-
polygon_face[2]};
326+
{polygon_face[0], polygon_face[1], polygon_face[2]}};
333327
int idx = triangulated_faces.size();
334328
triangulated_faces.push_back(triangle_face);
335329
if (polygon_faces_on_input_surface[i]) {
@@ -348,9 +342,9 @@ void embed_surface(
348342
for (int j = 0; j < clipped_indices.size(); j++) {
349343
// need to map oldface index to new face indices
350344
std::array<size_t, 3> triangle_face = {
351-
polygon_face[clipped_indices[j][0]],
352-
polygon_face[clipped_indices[j][1]],
353-
polygon_face[clipped_indices[j][2]]};
345+
{polygon_face[clipped_indices[j][0]],
346+
polygon_face[clipped_indices[j][1]],
347+
polygon_face[clipped_indices[j][2]]}};
354348
int idx = triangulated_faces.size();
355349
triangulated_faces.push_back(triangle_face);
356350

@@ -404,14 +398,14 @@ void embed_surface(
404398
}
405399
}
406400

407-
std::array<size_t, 4> tetra = {v0, v1, v2, v3};
401+
std::array<size_t, 4> tetra = {{v0, v1, v2, v3}};
408402

409403
// if inverted then fix the orientation
410404
Vector3r v0v1 = v_rational[v1] - v_rational[v0];
411405
Vector3r v0v2 = v_rational[v2] - v_rational[v0];
412406
Vector3r v0v3 = v_rational[v3] - v_rational[v0];
413407
if ((v0v1.cross(v0v2)).dot(v0v3) < 0) {
414-
tetra = {v1, v0, v2, v3};
408+
tetra = {{v1, v0, v2, v3}};
415409
}
416410

417411
// push the tet to final queue;
@@ -467,20 +461,20 @@ void embed_surface(
467461
for (const size_t f : polygon_cell) {
468462
for (const size_t t : map_poly_to_tri_face[f]) {
469463
std::array<size_t, 4> tetra = {
470-
triangulated_faces[t][0],
471-
triangulated_faces[t][1],
472-
triangulated_faces[t][2],
473-
centroid_idx};
464+
{triangulated_faces[t][0],
465+
triangulated_faces[t][1],
466+
triangulated_faces[t][2],
467+
centroid_idx}};
474468
// check inverted tet and fix
475469
Vector3r v0v1 = v_rational[tetra[1]] - v_rational[tetra[0]];
476470
Vector3r v0v2 = v_rational[tetra[2]] - v_rational[tetra[0]];
477471
Vector3r v0v3 = v_rational[tetra[3]] - v_rational[tetra[0]];
478472
if ((v0v1.cross(v0v2)).dot(v0v3) < 0) {
479473
tetra = {
480-
triangulated_faces[t][1],
481-
triangulated_faces[t][0],
482-
triangulated_faces[t][2],
483-
centroid_idx};
474+
{triangulated_faces[t][1],
475+
triangulated_faces[t][0],
476+
triangulated_faces[t][2],
477+
centroid_idx}};
484478
}
485479

486480
tets_final.push_back(tetra);
@@ -605,9 +599,7 @@ EmbedSurface::EmbedSurface(
605599

606600
std::vector<Eigen::Vector3d> verts;
607601
std::vector<std::array<size_t, 3>> tris;
608-
verts.resize(V.rows());
609-
tris.resize(F.rows());
610-
wmtk::eigen_to_wmtk_input(verts, tris, V, F);
602+
VF_to_vectors(V, F, verts, tris);
611603

612604
V_surf_from_vector(verts);
613605
F_surf_from_vector(tris);

components/image_simulation/wmtk/components/image_simulation/ImageSimulationMesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ size_t ImageSimulationMesh::get_order_of_vertex(const size_t vid) const
12381238

12391239
void ImageSimulationMesh::init_vertex_order()
12401240
{
1241-
std::array<size_t, 4> count{0, 0, 0, 0};
1241+
std::array<size_t, 4> count{{0, 0, 0, 0}};
12421242

12431243
for (const Tuple& t : get_vertices()) {
12441244
const size_t vid = t.vid(*this);

components/image_simulation/wmtk/components/image_simulation/ImageSimulationMeshTri.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ void ImageSimulationMeshTri::init_surfaces_and_boundaries()
279279
const auto surf_edges = get_edges_by_condition([](auto& f) { return f.m_is_surface_fs; });
280280
for (const auto& verts : surf_edges) {
281281
std::array<Vector2d, 2> pp = {
282-
m_vertex_attribute[verts[0]].m_pos,
283-
m_vertex_attribute[verts[1]].m_pos};
282+
{m_vertex_attribute[verts[0]].m_pos, m_vertex_attribute[verts[1]].m_pos}};
284283
if (m_envelope->is_outside(pp)) {
285284
log_and_throw_error("Edge {} is outside!", verts);
286285
}
@@ -1239,7 +1238,7 @@ bool ImageSimulationMeshTri::collapse_edge_after(const Tuple& loc)
12391238
const Vector2d a = VA.at(vids[0]).m_pos;
12401239
const Vector2d b = VA.at(vids[1]).m_pos;
12411240
// surface envelope
1242-
bool is_out = m_envelope->is_outside(std::array<Vector2d, 2>{a, b});
1241+
bool is_out = m_envelope->is_outside(std::array<Vector2d, 2>{{a, b}});
12431242
if (is_out) {
12441243
return false;
12451244
}
@@ -1854,7 +1853,7 @@ std::tuple<double, double> ImageSimulationMeshTri::local_operations(
18541853
for (const auto& verts : faces) {
18551854
const auto& p0 = m_vertex_attribute[verts[0]].m_pos;
18561855
const auto& p1 = m_vertex_attribute[verts[1]].m_pos;
1857-
if (m_envelope->is_outside(std::array<Vector2d, 2>{p0, p1})) {
1856+
if (m_envelope->is_outside(std::array<Vector2d, 2>{{p0, p1}})) {
18581857
logger().error("Edge {} is outside!", verts);
18591858
}
18601859
}

components/isotropic_remeshing/wmtk/components/isotropic_remeshing/isotropic_remeshing.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#include <jse/jse.h>
55

66
#include <wmtk/utils/getRSS.h>
7-
#include <wmtk/utils/Reader.hpp>
7+
#include <wmtk/Types.hpp>
8+
#include <wmtk/io/read_triangle_mesh.hpp>
89
#include <wmtk/utils/resolve_path.hpp>
910

1011
#include "IsotropicRemeshing.h"
@@ -78,15 +79,16 @@ void isotropic_remeshing(nlohmann::json json_params)
7879
std::vector<Eigen::Vector3d> verts;
7980
std::vector<std::array<size_t, 3>> tris;
8081
std::pair<Eigen::Vector3d, Eigen::Vector3d> box_minmax;
81-
double remove_duplicate_eps = 1e-5;
8282
std::vector<size_t> modified_nonmanifold_v;
83-
wmtk::stl_to_manifold_wmtk_input(
84-
input_path,
85-
remove_duplicate_eps,
86-
box_minmax,
87-
verts,
88-
tris,
89-
modified_nonmanifold_v);
83+
{
84+
double remove_duplicate_eps = 1e-5;
85+
MatrixXd V;
86+
MatrixXi F;
87+
wmtk::io::read_triangle_mesh(input_path, V, F, remove_duplicate_eps);
88+
box_minmax.first = V.colwise().minCoeff();
89+
box_minmax.second = V.colwise().maxCoeff();
90+
VF_to_vectors(V, F, verts, tris);
91+
}
9092

9193
double diag = (box_minmax.first - box_minmax.second).norm();
9294
const double envelope_size = env_rel * diag;

0 commit comments

Comments
 (0)