Commit 5ebd672b authored by Yixin Hu's avatar Yixin Hu
Browse files

Merge branch 'dev' of https://github.com/wildmeshing/fTetWild into dev

parents b17c2a75 844720a4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -90,6 +90,11 @@ IF(NOT ${GMP_FOUND})
	MESSAGE(FATAL_ERROR "Cannot find GMP")
ENDIF()

# find_package(MPFR)
# IF(NOT ${MPFR_FOUND})
# 	MESSAGE(FATAL_ERROR "Cannot find MPFR")
# ENDIF()

# add_library() can only be called without any source since CMake 3.11 ...
add_library(${PROJECT_NAME} src/Logger.cpp)

@@ -131,6 +136,7 @@ target_link_libraries(${PROJECT_NAME}
		Threads::Threads
		fast_winding_number
		${GMP_LIBRARIES}
		# ${MPFR_LIBRARIES}
)
if(FLOAT_TETWILD_ENABLE_TBB)
	target_link_libraries(${PROJECT_NAME} PUBLIC tbb::tbb)
+15 −2
Original line number Diff line number Diff line
@@ -9,12 +9,25 @@ if (GMP_INCLUDE_DIRS AND GMP_LIBRARIES)
endif (GMP_INCLUDE_DIRS AND GMP_LIBRARIES)



#if(WIN32)
#	if(CYGWIN)
#		triwild_download_gmp_cygwin()
	#elseif(MINGW)
#		triwild_download_gmp_mingw()
	#else()
#		triwild_download_gmp_vc()
	#endif()

	#SET(GMP_WINDOWS_PATH ${THIRD_PARTY_DIR}/gmp)
#endif()


find_path(GMP_INCLUDE_DIRS NAMES gmp.h PATHS $ENV{GMP_INC} ${GMP_WINDOWS_PATH})
find_library(GMP_LIBRARIES NAMES gmp libgmp PATHS $ENV{GMP_LIB} ${GMP_WINDOWS_PATH})
find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx PATHS $ENV{GMP_LIB} ${GMP_WINDOWS_PATH})
#MESSAGE(STATUS "GMP libs: " ${GMP_LIBRARIES} " " ${GMPXX_LIBRARIES} )


include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIRS GMP_LIBRARIES)

cmake/FindMPFR.cmake

0 → 100644
+72 −0
Original line number Diff line number Diff line
# Try to find the MPFR library
# See http://www.mpfr.org/
#
# This module supports requiring a minimum version, e.g. you can do
#   find_package(MPFR 2.3.0)
# to require version 2.3.0 to newer of MPFR.
#
# Once done this will define
#
#  MPFR_FOUND - system has MPFR lib with correct version
#  MPFR_INCLUDES - the MPFR include directory
#  MPFR_LIBRARIES - the MPFR library
#  MPFR_VERSION - MPFR version

# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2010 Jitse Niesen, <jitse@maths.leeds.ac.uk>
# Copyright (c) 2015 Jack Poulson, <jack.poulson@gmail.com>
# Redistribution and use is allowed according to the terms of the BSD license.

find_path(MPFR_INCLUDES NAMES mpfr.h PATHS $ENV{GMPDIR} $ENV{MPFRDIR}
  ${INCLUDE_INSTALL_DIR})

# Set MPFR_FIND_VERSION to 1.0.0 if no minimum version is specified
if(NOT MPFR_FIND_VERSION)
  if(NOT MPFR_FIND_VERSION_MAJOR)
    set(MPFR_FIND_VERSION_MAJOR 1)
  endif()
  if(NOT MPFR_FIND_VERSION_MINOR)
    set(MPFR_FIND_VERSION_MINOR 0)
  endif()
  if(NOT MPFR_FIND_VERSION_PATCH)
    set(MPFR_FIND_VERSION_PATCH 0)
  endif()
  set(MPFR_FIND_VERSION
    "${MPFR_FIND_VERSION_MAJOR}.${MPFR_FIND_VERSION_MINOR}.${MPFR_FIND_VERSION_PATCH}")
endif()

if(MPFR_INCLUDES)
  # Query MPFR_VERSION
  file(READ "${MPFR_INCLUDES}/mpfr.h" _mpfr_version_header)

  string(REGEX MATCH "define[ \t]+MPFR_VERSION_MAJOR[ \t]+([0-9]+)"
    _mpfr_major_version_match "${_mpfr_version_header}")
  set(MPFR_MAJOR_VERSION "${CMAKE_MATCH_1}")
  string(REGEX MATCH "define[ \t]+MPFR_VERSION_MINOR[ \t]+([0-9]+)"
    _mpfr_minor_version_match "${_mpfr_version_header}")
  set(MPFR_MINOR_VERSION "${CMAKE_MATCH_1}")
  string(REGEX MATCH "define[ \t]+MPFR_VERSION_PATCHLEVEL[ \t]+([0-9]+)"
    _mpfr_patchlevel_version_match "${_mpfr_version_header}")
  set(MPFR_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}")

  set(MPFR_VERSION
    ${MPFR_MAJOR_VERSION}.${MPFR_MINOR_VERSION}.${MPFR_PATCHLEVEL_VERSION})

  # Check whether found version exceeds minimum required
  if(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION})
    set(MPFR_VERSION_OK FALSE)
    message(STATUS "MPFR version ${MPFR_VERSION} found in ${MPFR_INCLUDES}, "
                   "but at least version ${MPFR_FIND_VERSION} is required")
  else()
    set(MPFR_VERSION_OK TRUE)
  endif()
endif()

find_library(MPFR_LIBRARIES mpfr
  PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${LIB_INSTALL_DIR})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPFR DEFAULT_MSG
                                  MPFR_INCLUDES MPFR_LIBRARIES MPFR_VERSION_OK)
mark_as_advanced(MPFR_INCLUDES MPFR_LIBRARIES)
+13 −11
Original line number Diff line number Diff line
@@ -22,14 +22,14 @@ double time_get_intersecting_edges_and_points4 = 0;
igl::Timer timer;

void floatTetWild::print_times1(){
//    logger().info("\t\t\t- time_cut_mesh11 = {}s", time_cut_mesh11);
//    logger().info("\t\t\t- time_cut_mesh12 = {}s", time_cut_mesh12);
//    logger().info("\t\t\t- time_cut_mesh13 = {}s", time_cut_mesh13);
//    logger().info("\t\t\t- time_cut_mesh14 = {}s", time_cut_mesh14);
    logger().info("\t\t- time_get_intersecting_edges_and_points1 = {}s", time_get_intersecting_edges_and_points1);
    logger().info("\t\t- time_get_intersecting_edges_and_points2 = {}s", time_get_intersecting_edges_and_points2);
    logger().info("\t\t- time_get_intersecting_edges_and_points3 = {}s", time_get_intersecting_edges_and_points3);
    logger().info("\t\t- time_get_intersecting_edges_and_points4 = {}s", time_get_intersecting_edges_and_points4);
//    logger().debug("\t\t\t- time_cut_mesh11 = {}s", time_cut_mesh11);
//    logger().debug("\t\t\t- time_cut_mesh12 = {}s", time_cut_mesh12);
//    logger().debug("\t\t\t- time_cut_mesh13 = {}s", time_cut_mesh13);
//    logger().debug("\t\t\t- time_cut_mesh14 = {}s", time_cut_mesh14);
    logger().debug("\t\t- time_get_intersecting_edges_and_points1 = {}s", time_get_intersecting_edges_and_points1);
    logger().debug("\t\t- time_get_intersecting_edges_and_points2 = {}s", time_get_intersecting_edges_and_points2);
    logger().debug("\t\t- time_get_intersecting_edges_and_points3 = {}s", time_get_intersecting_edges_and_points3);
    logger().debug("\t\t- time_get_intersecting_edges_and_points4 = {}s", time_get_intersecting_edges_and_points4);
}

void floatTetWild::CutMesh::construct(const std::vector<int>& cut_t_ids) {
@@ -492,13 +492,15 @@ void floatTetWild::CutMesh::expand_new(std::vector<int> &cut_t_ids) {
//    //fortest
}

int floatTetWild::CutMesh::project_to_plane() {
int floatTetWild::CutMesh::project_to_plane(int input_vertices_size) {
    int cnt = 0;
    for (int i = 0; i < is_snapped.size(); i++) {
        if (!is_snapped[i])
            continue;
        if (v_ids[i] < input_vertices_size)
            continue;
        Scalar dist = get_to_plane_dist(mesh.tet_vertices[v_ids[i]].pos);
        if(std::abs(dist) <= 1e-10) {
        if (std::abs(dist) <= 1e-9) {
            cnt++;
            continue;
        }
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ namespace floatTetWild {
        void expand(std::vector<int> &cut_t_ids);
        void expand_new(std::vector<int> &cut_t_ids);

        int project_to_plane();
        int project_to_plane(int input_vertices_size);

        bool get_intersecting_edges_and_points(std::vector<Vector3> &points,
                                               std::map<std::array<int, 2>, int> &map_edge_to_intersecting_point,
Loading