Commit 8c5b3b92 authored by Heng Liu's avatar Heng Liu

initial commit

parents
libSCOF uses the cmake build system.
libSCOF depends on OpenVolumeMesh 2.0, which is available on www.openvolumemesh.org.
In order to build libSCOF, you can perform the following steps:
# Clone libSCOF
git clone https://www.graphics.rwth-aachen.de:9000/SCOF/SingularityConstrainedOctahedralFields libSCOF
cd libSCOF
# Create build directory
mkdir build
cd build
# Initialize the build directory
cmake -D OPENMESH_INCLUDE_DIR=/path/to/OpenMesh/src \
-D OPENMESH_CORE_LIBRARY=/path/to/OpenMesh/Core/binaries \
-D OPENMESH_TOOLS_LIBRARY=/path/to/OpenMesh/Tools/binaries \
-D OPENVOLUMEMESH_INCLUDE_DIR=/path/to/OpenVolumeMesh/src \
-D OPENVOLUMEMESH_LIBRARY_DIR=/path/to/OpenVolumeMesh/binaries \
-D EIGEN3_INCLUDE_DIR=/path/to/eigen3 \
-D GMM_INCLUDE_DIR=/path/to/gmm \
-D CHOLMOD_INCLUDE_DIR=/path/to/cholmod ..
# Build
make
# Try a demo
./demo/scof/scof ../demo/scof/ellipsoid.ovm ../demo/scof/ellipsoid_output.ovm
#
# Copyright 2013 Computer Graphics Group, RWTH Aachen University
# Authors:
#
# This file is part of SCOF.
#
# SCOF is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# SCOF is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with SCOF. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required (VERSION 2.6)
# Only set project name if not build from within another project.
if("${PROJECT_NAME}" STREQUAL "")
project (SCOF)
endif()
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
add_definitions(-DINCLUDE_TEMPLATES)
set (SOURCES "")
set (INCLUDE_DIRS "")
set (LIBRARIES "")
set (LIBRARY_DIRS "")
file(GLOB SRCS "${CMAKE_CURRENT_LIST_DIR}/src/*.cc" "${CMAKE_CURRENT_LIST_DIR}/src/*.c")
find_package (OpenVolumeMesh REQUIRED)
find_package (OpenMesh REQUIRED)
find_package (EIGEN3 REQUIRED)
find_package (GMM REQUIRED)
find_package (CHOLMOD)
#enable suitesparse
if(CHOLMOD_INCLUDES)
add_definitions(-DENABLE_SUITESPARSE)
list (APPEND EIGEN3_INCLUDE_DIR ${CHOLMOD_INCLUDES})
list (APPEND LIBRARIES ${CHOLMOD_LIBRARIES})
endif(CHOLMOD_INCLUDES)
list (APPEND SOURCES ${SRCS})
list (APPEND INCLUDE_DIRS ${OPENVOLUMEMESH_INCLUDE_DIR}
${OPENMESH_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${GMM_INCLUDE_DIR})
list (APPEND LIBRARY_DIRS ${OPENVOLUMEMESH_LIBRARY_DIR})
list (APPEND LIBRARIES ${OPENVOLUMEMESH_LIBRARY}
${OPENMESH_LIBRARIES})
include_directories (${INCLUDE_DIRS})
link_directories (${CMAKE_BINARY_DIR} ${LIBRARY_DIRS})
add_library (SCOF SHARED ${SOURCES})
add_library (SCOFStatic STATIC ${SOURCES})
target_link_libraries (SCOF ${LIBRARIES})
target_link_libraries (SCOFStatic ${LIBRARIES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -Wall -Wextra")
#
# Fake successful finder run if compiling as a dependent project.
#
if(NOT "${PROJECT_NAME}" MATCHES "SCOF")
set (SCOF_FOUND true PARENT_SCOPE)
set (SCOF_LIBRARIES SCOF PARENT_SCOPE)
set (SCOF_LIBRARY SCOF PARENT_SCOPE)
set (SCOF_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/" PARENT_SCOPE)
set (SCOF_LIBRARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory where the SCOF libraries can be found.")
endif()
if("${PROJECT_NAME}" MATCHES "SCOF")
add_subdirectory(demo/scof)
endif()
This diff is collapsed.
This diff is collapsed.
libSCOF – Singularity-Constrained Octahedral Fields for Hexahedral Meshing
======
`libSCOF` is an implementation of [SCOF](https://www.meshing.rwth-aachen.de/publication/017/) \[[Liu et al. 2018] distributed under GPLv3.
Note: this is a preliminary version without including the branching as in our paper. The complete version will be committed soon.
If you make use of `libSCOF` in your scientific work, please cite our paper.
## What is SCOF?
SCOF is an algorithm for generating octahedral fields with the prescribed hexmeshable singularity graphs.
The input to the algorithm is a tetrahedral mesh together with singularity graph constraints in OpenVolumeMesh file format. For more details about the input file format, please refer to the Readme.txt in [InputFiles.] () Additional constraints that are necessary to uniquely specify the field topology for models of higher genus, independent sub-singularity graphs or cavities, are not stored in the files yet.
The output of the algorithm are a topological octahedral field encoded as matchings and field alignment as well as a smooth geometrical octahedral field in the form of rotation matrix.
## Compiling
libSCOF can be compiled independently resulting in a command line tool or compiled together with OpenFlipper. For more details about compiling, please see BUILDING.
## License
`libSCOF` is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version. See [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
# Cholmod lib usually requires linking to a blas and lapack library.
# It is up to the user of this module to find a BLAS and link to it.
if (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES)
set(CHOLMOD_FIND_QUIETLY TRUE)
endif (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES)
find_path(CHOLMOD_INCLUDES
NAMES
cholmod.h
PATHS
$ENV{CHOLMODDIR}
${INCLUDE_INSTALL_DIR}
PATH_SUFFIXES
suitesparse
ufsparse
)
find_library(CHOLMOD_LIBRARIES cholmod PATHS $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if(CHOLMOD_LIBRARIES)
get_filename_component(CHOLMOD_LIBDIR ${CHOLMOD_LIBRARIES} PATH)
find_library(AMD_LIBRARY amd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (AMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${AMD_LIBRARY})
else ()
set(CHOLMOD_LIBRARIES FALSE)
endif ()
endif(CHOLMOD_LIBRARIES)
if(CHOLMOD_LIBRARIES)
find_library(COLAMD_LIBRARY colamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (COLAMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${COLAMD_LIBRARY})
else ()
set(CHOLMOD_LIBRARIES FALSE)
endif ()
endif(CHOLMOD_LIBRARIES)
if(CHOLMOD_LIBRARIES)
find_library(CAMD_LIBRARY camd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (CAMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CAMD_LIBRARY})
else ()
set(CHOLMOD_LIBRARIES FALSE)
endif ()
endif(CHOLMOD_LIBRARIES)
if(CHOLMOD_LIBRARIES)
find_library(CCOLAMD_LIBRARY ccolamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (CCOLAMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CCOLAMD_LIBRARY})
else ()
set(CHOLMOD_LIBRARIES FALSE)
endif ()
endif(CHOLMOD_LIBRARIES)
if(CHOLMOD_LIBRARIES)
find_library(CHOLMOD_METIS_LIBRARY metis PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (CHOLMOD_METIS_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CHOLMOD_METIS_LIBRARY})
endif ()
endif(CHOLMOD_LIBRARIES)
if(CHOLMOD_LIBRARIES)
find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (SUITESPARSE_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${SUITESPARSE_LIBRARY})
endif (SUITESPARSE_LIBRARY)
endif(CHOLMOD_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CHOLMOD DEFAULT_MSG
CHOLMOD_INCLUDES CHOLMOD_LIBRARIES)
mark_as_advanced(CHOLMOD_INCLUDES CHOLMOD_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY SUITESPARSE_LIBRARY CAMD_LIBRARY CCOLAMD_LIBRARY CHOLMOD_METIS_LIBRARY)
# - Try to find EIGEN3
# Once done this will define
# EIGEN3_FOUND - System has EIGEN3
# EIGEN3_INCLUDE_DIRS - The EIGEN3 include directories
if (EIGEN3_INCLUDE_DIR)
# in cache already
set(EIGEN3_FOUND TRUE)
set(EIGEN3_INCLUDE_DIRS "${EIGEN3_INCLUDE_DIR}" )
else (EIGEN3_INCLUDE_DIR)
# Check if the base path is set
if ( NOT CMAKE_WINDOWS_LIBS_DIR )
# This is the base directory for windows library search used in the finders we shipp.
set(CMAKE_WINDOWS_LIBS_DIR "c:/libs" CACHE STRING "Default Library search dir on windows." )
endif()
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x32/")
endif()
find_path( EIGEN3_INCLUDE_DIR
NAMES Eigen/Dense
PATHS $ENV{EIGEN_DIR}
/usr/include/eigen3
/usr/local/include
/usr/local/include/eigen3/
/opt/local/include/eigen3/
"${CMAKE_WINDOWS_LIBS_DIR}/general/Eigen-3.2.8"
"${CMAKE_WINDOWS_LIBS_DIR}/general/Eigen-3.2.6"
"${CMAKE_WINDOWS_LIBS_DIR}/Eigen-3.2.6"
"${CMAKE_WINDOWS_LIBS_DIR}/Eigen-3.2.6/include"
"${CMAKE_WINDOWS_LIBS_DIR}/Eigen-3.2.1"
"${CMAKE_WINDOWS_LIBS_DIR}/Eigen-3.2.1/include"
"${CMAKE_WINDOWS_LIBS_DIR}/Eigen-3.2/include"
"${CMAKE_WINDOWS_LIBS_DIR}/eigen3/include"
"${CMAKE_WINDOWS_LIBS_DIR}/eigen/include"
${PROJECT_SOURCE_DIR}/MacOS/Libs/eigen3/include
../../External/include
${module_file_path}/../../../External/include
)
set(EIGEN3_INCLUDE_DIRS "${EIGEN3_INCLUDE_DIR}" )
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBCPLEX_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(EIGEN3 DEFAULT_MSG
EIGEN3_INCLUDE_DIR)
mark_as_advanced(EIGEN3_INCLUDE_DIR)
endif(EIGEN3_INCLUDE_DIR)
# - Try to find GMM
# Once done this will define
# GMM_FOUND - System has GMM
# GMM_INCLUDE_DIRS - The GMM include directories
# GMM_COMPILER_FLAGS - Compiler flags that are necessary for GMM
if (GMM_INCLUDE_DIR)
# in cache already
set(GMM_FOUND TRUE)
set(GMM_INCLUDE_DIRS "${GMM_INCLUDE_DIR}" )
else (GMM_INCLUDE_DIR)
# Check if the base path is set
if ( NOT CMAKE_WINDOWS_LIBS_DIR )
# This is the base directory for windows library search used in the finders we shipp.
set(CMAKE_WINDOWS_LIBS_DIR "c:/libs" CACHE STRING "Default Library search dir on windows." )
endif()
find_path( GMM_INCLUDE_DIR
NAMES gmm/gmm.h
PATHS $ENV{GMM_DIR}
/usr/include
/usr/include
/usr/local/include
~/sw/gmm-5.0/include
~/sw/gmm-4.2/include
~/sw/gmm-4.1/include
"c:\\libs\\gmm-4.2\\include"
"c:\\libs\\gmm-4.1\\include"
"c:\\libs\\gmm-3.0\\include"
"${CMAKE_WINDOWS_LIBS_DIR}/general/gmm-5.0/include"
"${CMAKE_WINDOWS_LIBS_DIR}/general/gmm-4.2/include"
${PROJECT_SOURCE_DIR}/MacOS/Libs/gmm-3.1/include
../../External/include
/ACG/acgdev/gcc-4.3-i686/gmm-4.1/include/
/ACG/acgdev/gcc-4.3-i686/gmm-3/include/
${module_file_path}/../../../External/include
)
set(GMM_INCLUDE_DIRS "${GMM_INCLUDE_DIR}" )
# use c++ headers as default
IF (WIN32)
set(GMM_COMPILE_DEFINITIONS "_SCL_SECURE_NO_DEPRECATE" CACHE STRING "GMM Compiler Definitions")
# add_definitions(-D_SCL_SECURE_NO_DEPRECATE)
ELSE(WIN32)
set(GMM_COMPILE_DEFINITIONS "" CACHE STRING "GMM Compiler Definitions")
ENDIF(WIN32)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBCPLEX_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(GMM DEFAULT_MSG
GMM_INCLUDE_DIR)
mark_as_advanced(GMM_INCLUDE_DIR GMM_COMPILE_DEFINITIONS)
endif(GMM_INCLUDE_DIR)
#
# Try to find OPENMESH
# Once done this will define
#
# OPENMESH_FOUND - system has OPENMESH
# OPENMESH_INCLUDE_DIRS - the OPENMESH include directories
# OPENMESH_LIBRARIES - Link these to use OPENMESH
#
# Copyright 2013 Computer Graphics Group, RWTH Aachen University
# Authors: Jan Möbius <moebius@cs.rwth-aachen.de>
# Hans-Christian Ebke <ebke@cs.rwth-aachen.de>
# Max Lyon <lyon@cs.rwth-aachen.de>
#
# This file is part of HexEx.
#
# HexEx is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# HexEx is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with HexEx. If not, see <http://www.gnu.org/licenses/>.
#
IF (OPENMESH_INCLUDE_DIR)
# Already in cache, be silent
SET(OPENMESH_FIND_QUIETLY TRUE)
ENDIF (OPENMESH_INCLUDE_DIR)
FIND_PATH(OPENMESH_INCLUDE_DIR OpenMesh/Core/Mesh/PolyMeshT.hh
PATHS /usr/local/include
/usr/include
/usr/local/OpenMesh-2.0rc4/include
"${CMAKE_SOURCE_DIR}/OpenMesh/src"
"${CMAKE_SOURCE_DIR}/libs_required/OpenMesh/src"
"${CMAKE_SOURCE_DIR}/../OpenMesh/src"
/ACG/acgdev/gcc-4.0-x86_64/OM2/OpenMesh-2.0/installed/include
"C:\\Program Files\\OpenMesh 2.0\\include"
)
SET(OPENMESH_LIBRARY_DIR NOTFOUND CACHE PATH "The directory where the OpenMesh libraries can be found.")
SET(SEARCH_PATHS
"${OPENMESH_INCLUDE_DIR}/../lib"
"${OPENMESH_INCLUDE_DIR}/../lib/OpenMesh"
"${OPENMESH_LIBRARY_DIR}")
FIND_LIBRARY(OPENMESH_CORE_LIBRARY NAMES OpenMeshCored OpenMeshCore PATHS ${SEARCH_PATHS})
FIND_LIBRARY(OPENMESH_TOOLS_LIBRARY NAMES OpenMeshToolsd OpenMeshTools PATHS ${SEARCH_PATHS})
INCLUDE (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenMesh DEFAULT_MSG OPENMESH_CORE_LIBRARY OPENMESH_TOOLS_LIBRARY OPENMESH_INCLUDE_DIR)
IF (OPENMESH_FOUND)
SET(OPENMESH_LIBRARIES "${OPENMESH_CORE_LIBRARY}" "${OPENMESH_TOOLS_LIBRARY}")
SET(OPENMESH_INCLUDE_DIRS "${OPENMESH_INCLUDE_DIR}")
ENDIF (OPENMESH_FOUND)
#
# Try to find OPENVOLUMEMESH
# Once done this will define
#
# OPENVOLUMEMESH_FOUND - system has OPENVOLUMEMESH
# OPENVOLUMEMESH_INCLUDE_DIR - the OPENVOLUMEMESH include directory
# OPENVOLUMEMESH_LIBRARY - Link these to use OPENVOLUMEMESH
# OPENVOLUMEMESH_LIBRARY_DIR - Library DIR of OPENVOLUMEMESH
#
# Copyright 2013 Computer Graphics Group, RWTH Aachen University
# Authors: Jan Möbius <moebius@cs.rwth-aachen.de>
# Hans-Christian Ebke <ebke@cs.rwth-aachen.de>
# Max Lyon <lyon@cs.rwth-aachen.de>
#
# This file is part of SCOF.
#
# SCOF is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# SCOF is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with SCOF. If not, see <http://www.gnu.org/licenses/>.
#
IF (OPENVOLUMEMESH_INCLUDE_DIR)
# Already in cache, be silent
SET(OPENVOLUMEMESH_FIND_QUIETLY TRUE)
ENDIF (OPENVOLUMEMESH_INCLUDE_DIR)
FIND_PATH(OPENVOLUMEMESH_INCLUDE_DIR OpenVolumeMesh/Mesh/TetrahedralMesh.hh
PATHS /usr/local/include
/usr/include
/usr/local/OpenVolumeMesh/include
"${CMAKE_SOURCE_DIR}/OpenVolumeMesh/src"
"${CMAKE_SOURCE_DIR}/libs_required/OpenVolumeMesh/src"
"${CMAKE_SOURCE_DIR}/../OpenVolumeMesh/src"
/ACG/acgdev/gcc-4.0-x86_64/OVM/OpenVolumeMesh/installed/include
"C:\\Program Files\\OpenVolumeMesh\\include"
)
IF (OPENVOLUMEMESH_INCLUDE_DIR )
SET(OPENVOLUMEMESH_FOUND TRUE)
ADD_DEFINITIONS(-DENABLE_OPENVOLUMEMESH)
IF (WIN32)
IF(EXISTS "${OPENVOLUMEMESH_INCLUDE_DIR}/../lib")
SET(OPENVOLUMEMESH_LIBRARY_DIR "${OPENVOLUMEMESH_INCLUDE_DIR}/../lib")
ENDIF()
ELSE (WIN32)
IF(EXISTS "${OPENVOLUMEMESH_INCLUDE_DIR}/../lib/OpenVolumeMesh")
SET(OPENVOLUMEMESH_LIBRARY_DIR "${OPENVOLUMEMESH_INCLUDE_DIR}/../lib/OpenVolumeMesh")
ENDIF()
ENDIF (WIN32)
SET(OPENVOLUMEMESH_LIBRARY "OpenVolumeMesh")
ELSE (OPENVOLUMEMESH_INCLUDE_DIR)
SET(OPENVOLUMEMESH_FOUND FALSE )
ENDIF (OPENVOLUMEMESH_INCLUDE_DIR )
# This file is part of SCOF.
#
# SCOF is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# SCOF is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with SCOF. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 3.4)
find_package (OpenVolumeMesh REQUIRED)
find_package (OpenMesh REQUIRED)
find_package (GMM REQUIRED)
find_package (EIGEN3 REQUIRED)
# disable OpenVolumeMesh debug output
add_definitions(-DNDEBUG)
set (CMDLINE_TOOL_SOURCES "")
set (CMDLINE_TOOL_INCLUDE_DIRS "")
set (CMDLINE_TOOL_LIBRARIES "")
set (CMDLINE_TOOL_LIBRARY_DIRS "")
list (APPEND CMDLINE_TOOL_SOURCES main.cc)
list (APPEND CMDLINE_TOOL_INCLUDE_DIRS
${OPENVOLUMEMESH_INCLUDE_DIR}
${OPENMESH_INCLUDE_DIRS}
${GMM_INCLUDE_DIR}
${EIGEN3_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../../src
${SCOF_INCLUDE_DIRS}
)
list (APPEND CMDLINE_TOOL_LIBRARIES
${OPENVOLUMEMESH_LIBRARY}
${OPENMESH_LIBRARIES}
SCOFStatic
)
list (APPEND CMDLINE_TOOL_LIBRARY_DIRS ${OPENVOLUMEMESH_LIBRARY_DIR})
add_executable (scof ${CMDLINE_TOOL_SOURCES})
LINK_DIRECTORIES(scof ${CMDLINE_TOOL_LIBRARY_DIRS} )
target_link_libraries(scof ${CMDLINE_TOOL_LIBRARIES})
if (NOT WIN32 )
set(SCOF_COMPILE_FLAGS "-Wall -Wextra -pedantic -std=c++11 -O3 -Wno-long-long")
else()
set(SCOF_COMPILE_FLAGS "")
endif()
set_target_properties(scof
PROPERTIES
INCLUDE_DIRECTORIES "${CMDLINE_TOOL_INCLUDE_DIRS}"
COMPILE_FLAGS "${SCOF_COMPILE_FLAGS}"
)
This diff is collapsed.
#include <iostream>
#include <fstream>
#include <SingularityConstrainedOctahedralField.hh>
bool isInFileGood(const std::string& filename)
{
std::ifstream is(filename.c_str());
return is.good();
}
bool isOutFileGood(const std::string& filename)
{
std::ofstream os(filename.c_str());
return os.good();
}
void printUsage(const std::string& progname)
{
std::cout << "usage: " << progname << " <inFile> <outFile>" << std::endl
<< std::endl
<< "Reads input tet mesh with properties from <inFile> " << std::endl
<< "and writes the resulting tet mesh with properties to <outFile> in ovm format." << std::endl;
}
int main(int argc, const char* argv[])
{
if (argc != 3)
{
printUsage(argv[0]);
return 0;
}
auto inFilename = std::string(argv[1]);
auto outFilename = std::string(argv[2]);
if (!isInFileGood(inFilename))
{
std::cout << "Could not open input File " << inFilename << std::endl;
return 1;
}
if (!isOutFileGood(outFilename))
{
std::cout << "Could not open output File " << outFilename << std::endl;
return 1;
}
if (isInFileGood(inFilename) && isOutFileGood(outFilename))
SCOF::generateSCOF(inFilename, outFilename);
return 0;
}
//=============================================================================
//
// ENUM AxisAlignment
//
//=============================================================================
#ifndef AXISALIGNMENT_HH
#define AXISALIGNMENT_HH
//== INCLUDES =================================================================
#include <Eigen/Dense>
//== NAMESPACES ===============================================================
namespace SCOF {
//== ENUM DEFINITION =========================================================
/** \enum AxisAlignment AxisAlignment.hh
Brief Description.
A more elaborate description follows.
*/
enum AxisAlignment {Align_NONE = -1, Align_X = 0, Align_MX = 1, Align_Y = 2, Align_MY = 3, Align_Z = 4, Align_MZ = 5};
class AxisAlignmentHelpers
{
public:
static Eigen::Vector3d vector(const AxisAlignment _a)
{
switch(_a)
{
case Align_NONE: return Eigen::Vector3d( 0, 0, 0);
case Align_X : return Eigen::Vector3d( 1, 0, 0);
case Align_MX : return Eigen::Vector3d(-1, 0, 0);
case Align_Y : return Eigen::Vector3d( 0, 1, 0);
case Align_MY : return Eigen::Vector3d( 0,-1, 0);
case Align_Z : return Eigen::Vector3d( 0, 0, 1);
case Align_MZ : return Eigen::Vector3d( 0, 0,-1);
}
}
static AxisAlignment get_dominant_axis(const Eigen::Vector3d& _v)
{
int idx(0);
if(std::abs(_v[1]) > std::abs(_v[idx]))
idx = 1;
if(std::abs(_v[2]) > std::abs(_v[idx]))
idx = 2;
if(_v[idx] >= 0.0)
idx = 2*idx; // positive
else
idx = 2*idx + 1; // negative
return AxisAlignment(idx);
}
};
//=============================================================================
} // namespace SCOF
//=============================================================================
//=============================================================================
#endif // AXISALIGNMENT_HH defined
//=============================================================================
This diff is collapsed.
This diff is collapsed.
//=============================================================================
//
// CLASS FrameFieldGeneratorT
//
//=============================================================================
#ifndef FRAMEFIELDGENERATORT_HH
#define FRAMEFIELDGENERATORT_HH
//== INCLUDES =================================================================
#include <map>
#include <vector>
#include <queue>
#include <iostream>
#include <iomanip>
#include <float.h>
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <OpenVolumeMesh/Mesh/TetrahedralMesh.hh>
#include <OpenVolumeMesh/Core/PropertyDefines.hh>
#include <OpenVolumeMesh/Mesh/TetrahedralGeometryKernel.hh>
#include "TransitionQuaternionEigen.hh"
#include "AxisAlignment.hh"
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace SCOF {
//== CLASS DEFINITION =========================================================
/** \class FrameFieldGeneratorT FrameFieldGeneratorT.hh
Brief Description.
A more elaborate description follows.
*/