Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizuki7fan committed Apr 5, 2020
1 parent 9fb6356 commit f720dea
Show file tree
Hide file tree
Showing 41 changed files with 2,053 additions and 6,918 deletions.
73 changes: 34 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,78 +1,73 @@
#设置cmake的最低版本
cmake_minimum_required(VERSION 3.7)
#设置项目名称
project(GreedyCut)
#识别使用的编译器
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message(STATUS "编译器是gcc")
message(STATUS "the compiler is gcc")
SET(CMAKE_CXX_FLAGS "-O2")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
message(STATUS "编译器是msvc")
#添加预处理器定义,/Db表示是MSVC的编译器
message(STATUS "the compiler is MSVC")
add_definitions(/D_USE_MATH_DEFINES)
endif()

#需要并行加速,调用OpenMP
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
message(STATUS "发现OpenMP")
message(STATUS "Find OpenMP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()

#指定线性方程组求解器,通过ON和OFF来控制
option(USE_PARDISO "Use Pardiso" OFF)
option(USE_MKL_PARDISO "Use MKL Pardiso" ON)
option(UST_EIGEN "Use Eigen" OFF)

#检测操作系统并且进行配置
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
message(STATUS "操作系统是Windows")
#指定Eigen的头文件目录
include_directories("D:/LIBRARY/Eigen")
#包含OpenMesh的头文件目录和库
include_directories("D:/LIBRARY/OpenMesh/src")
message(STATUS "the OS is windows")
include_directories("D:/LIBRARY/eigen-3.3.7/eigen-3.3.7")
include_directories("D:/LIBRARY/OpenMesh-8.0/src")

if (USE_MKL_PARDISO)
message(STATUS "使用MKL Pardiso")
message(STATUS "Using MKL Pardiso")
add_definitions(-DUSE_MKL_PARDISO)
include_directories("D:/LIBRARY/mkl/compilers_and_libraries_2019.4.245/windows/mkl/include")
link_directories("D:/LIBRARY/mkl/compilers_and_libraries_2019.4.245/windows/mkl/lib/intel64")
SET(PARDISO_LIBRARY mkl_rt)
SET(PARDISO_SOLVER MKLPardisoSolver.cpp)
include_directories("C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.0.166/windows/mkl/include")
link_directories("C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.0.166/windows/mkl/lib/intel64")
SET(SOLVER_LIBRARY mkl_rt)
SET(SOLVER MKLPardisoSolver.cpp)
elseif(USE_PARDISO)
message(STATUS "使用Pardiso")
message(STATUS "Using Pardiso")
add_definitions(-DUSE_PARDISO)
link_directories("D:/LIBRARY/Pardiso/")
SET(PARDISO_LIBRARY libpardiso600-WIN-X86-64.lib)
SET(PARDISO_SOLVER PardisoSolver.cpp)
SET(SOLVER_LIBRARY libpardiso600-WIN-X86-64.lib)
SET(SOLVER PardisoSolver.cpp)
elseif(USE_EIGEN)
message(STATUS "Using Eigen")
add_definitions(-DUSE_EIGEN)
SET(SOLVER EigenSolver.cpp)
endif()

#使用gcc编译的OpenMesh库
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
link_directories("D:/LIBRARY/OpenMesh/build_cmake/Build/lib")
#使用MSVC编译的OpenMesh库
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
link_directories("D:/LIBRARY/OpenMesh/build_vs/Build/lib")
link_directories("D:/LIBRARY/OpenMesh-8.0/build/Build/lib")
endif()

elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
message(STATUS "操作系统是Linux")
message(STATUS "the OS is Linux")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
message(STATUS "the OS is Darwin")

endif()

file (GLOB SRCFILES
src/main.cpp
src/MeshDefinition/MeshDefinition.cpp
src/MeshDefinition/MeshCache.cpp
src/Auxiliary/OptionReader.cpp
src/Auxiliary/Algorithm.cpp
src/PointSampling/PointSampling.cpp
src/MeshCut/MeshCut.cpp
src/KPNewton/KPNewton.cpp
src/Solver/${PARDISO_SOLVER}
src/PointFinding/PointFinding.cpp
src/AddAuxiliaryPoint/AddAuxiliaryPoint.cpp
src/GAP/GAP.cpp
src/Auxiliary.cpp
src/PointSampling.cpp
src/MeshCache.cpp
src/MeshCut.cpp
src/KPNewton.cpp
src/Solver/${SOLVER}
src/PointFinding.cpp
src/GAP.cpp
src/AddAuxiliaryPoint.cpp
)

add_executable(${PROJECT_NAME} ${SRCFILES})
Expand All @@ -83,4 +78,4 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_link_libraries(${PROJECT_NAME} OpenMeshTools OpenMeshCore)
endif()

target_link_libraries(${PROJECT_NAME} ${PARDISO_LIBRARY})
target_link_libraries(${PROJECT_NAME} ${SOLVER_LIBRARY})
79 changes: 26 additions & 53 deletions opt.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,31 @@
#结果输出目录
OutputDir=../Output/
#option

#==============InterResult==========
#是否进行中间结果的输出 Yes/NO
InterResultOutput=Yes
#==============PointSamplingCfg===========
#采样方法 RealDistance/GeodesicDistance/Dijkstra
SampleMethod=Dijkstra
#采样初始点的起点,可以指定也可以随机Random
SampleFirstPoint=0
#value: 0/1
isDebug=0
#value: 0/1
isHighGenus=1

#==============PointFindingCfg=======
#如何度量顶点的优先级? RealDis/Neighbourhood/
VertexPriorityMetric=Neighbourhood
#PointSampling
#value: Dijkstra/GeodesicDistance/RealDistance
PointSampling_method=Dijkstra

#==============禁止区域的半径,测地距离
Dn=10
#==============衰减系数
DecayRate=0.9
#==============BanAreaMethod
#算禁止区域的时候,要不要把找到的点连接到现有的Cut上?
BanAreaMethod=Connect
#==============MaxConnectedRegionArea
Alpha=0.1
#==============GAP 成为Fix点的阈值条件
FixThreshold=20
#==============GAP中每个点的禁止区域半径
GAPForbddenRadius=5
#==============GAPFilteringRate扭曲下降的阈值
GAPFilteringRate=0.01;
#==============GAP并行数
GAPParrCount=8
#==============AAP的并行数
AAPParrCount=8
#==============AAP停止条件
AAPTrimmingRate=0.01
#==============AAP最大加点数目
AAPMaxAddingCount=100
#VertexPriorityMetric
#value: RealDis/Neighbourhood
PointFinding_vertex_priority_metric=Neighbourhood

#BanAreaMethod
#value: NonConnect/Connect
BanArea_Method=NonConnect
BanArea_Dn=10
BanArea_Alpha=0.1
#value: Dijkstra/Neighbourhood
BanArea_Metric=Dijkstra
BanArea_ShrinkRate=0.9

#论文中的流程对应的配置:
#从网格中随机选取一个点Vi
#即:SampleFirstPoint=Random
#对于网格上其他的所有点计算到Vi的dijkstra距离,找与其最远的点Vj,将Dij作为初始的割缝
#即:SampleMethod=Dijkstra
#沿着割缝进行切割,做一个ACAP的参数化(KPNewton)
#计算每个顶点的等距扭曲,找所有局部极大值点(但不需要找顶点的等级)
#设定正数dn,计算禁止区域R,定义是距离极大值点和距离切缝距离都小于dn的区域为禁止区域
#即:Dn=10
#设定衰减系数,论文中是0.9
#从可行区域中挑选最大的连通区域,如果最大连通区域的面积比较小,则修改Dn进行回退
#即:Alpha=0.1
#GAP设置
#设定Fix点的筛选条件
#即FixThreshold=20
#lmk点的禁止区域半径,算所有lmk的禁止区域,在所有点的禁止区域之外
#即GAPForbddenRadius=5
#GAP
Influence_Threshold=20
Distortion_Threshold=0.01

#AAP
Trimming_Rate=0.01
Max_AddCount=30
58 changes: 0 additions & 58 deletions ori_opt.txt

This file was deleted.

Loading

0 comments on commit f720dea

Please sign in to comment.