Commit da5b2831 authored by Dave Moxey's avatar Dave Moxey
Browse files

Move (and definitely break) MeshUtils into its own library

parent 34ed0605
......@@ -178,6 +178,7 @@ INCLUDE (ThirdPartyPETSc)
INCLUDE (ThirdPartyVTK)
INCLUDE (ThirdPartyQT4)
INCLUDE (ThirdPartySMV)
INCLUDE (ThirdPartyTriangle)
INCLUDE (Doxygen)
......@@ -267,7 +268,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
# Build active components
IF (NEKTAR_BUILD_LIBRARY)
SET(NEKTAR++_LIBRARIES SolverUtils LibUtilities StdRegions SpatialDomains LocalRegions
MultiRegions Collections)
MultiRegions Collections MeshUtils)
INCLUDE_DIRECTORIES(library)
ADD_SUBDIRECTORY(library)
INSTALL(EXPORT Nektar++Libraries DESTINATION ${LIB_DIR}/cmake)
......
########################################################################
#
# ThirdParty configuration for Nektar++
#
# Triangle
#
########################################################################
# First search for system Triangle installs. Hint /opt/local for MacPorts.
FIND_PATH (TRIANGLE_INCLUDE_DIR triangle.h PATHS /opt/local/include)
FIND_LIBRARY(TRIANGLE_LIBRARY NAMES "triangle" PATHS /opt/local/lib)
# If we have our library then don't build Triangle
IF (TRIANGLE_INCLUDE_DIR AND TRIANGLE_LIBRARY)
SET(BUILD_TRIANGLE OFF)
ELSE()
SET(BUILD_TRIANGLE ON)
ENDIF ()
OPTION(THIRDPARTY_BUILD_TRIANGLE
"Build Triangle library from ThirdParty." ${BUILD_TRIANGLE})
IF (THIRDPARTY_BUILD_TRIANGLE)
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
triangle-1.6
PREFIX ${TPSRC}
URL ${TPURL}/triangle.zip
URL_MD5 ebc48aa34d79b2a03080c8647e8164a6
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/triangle-1.6
BINARY_DIR ${TPBUILD}/triangle-1.6
TMP_DIR ${TPBUILD}/triangle-1.6-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
${TPSRC}/triangle-1.6
)
SET(TRIANGLE_LIBRARY triangle CACHE FILEPATH
"Triangle library" FORCE)
SET(TRIANGLE_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"Triangle include" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
IF (WIN32)
MESSAGE(STATUS
"Build Triangle: ${TPDIST}/${LIB_DIR}/${TRIANGLE_LIBRARY}.dll")
ELSE ()
MESSAGE(STATUS
"Build Triangle: ${TPDIST}/${LIB_DIR}/lib${TRIANGLE_LIBRARY}.a")
ENDIF ()
SET(TRIANGLE_CONFIG_INCLUDE_DIR ${TPINC})
ELSE()
ADD_CUSTOM_TARGET(triangle-1.6 ALL)
MESSAGE(STATUS "Found Triangle: ${TRIANGLE_LIBRARY}")
SET(TRIANGLE_CONFIG_INCLUDE_DIR ${TRIANGLE_INCLUDE_DIR})
ENDIF (THIRDPARTY_BUILD_TRIANGLE)
INCLUDE_DIRECTORIES(SYSTEM ${TRIANGLE_INCLUDE_DIR})
MARK_AS_ADVANCED(TRIANGLE_INCLUDE_DIR)
MARK_AS_ADVANCED(TRIANGLE_LIBRARY)
SET(LibrarySubDirs LibUtilities LocalRegions Collections
SET(LibrarySubDirs LibUtilities LocalRegions Collections MeshUtils
MultiRegions SpatialDomains StdRegions SolverUtils)
SET(UnitTestSubDirs UnitTests)
SET(DemoSubDirs Demos)
......
......@@ -326,29 +326,6 @@ IF(NEKTAR_USE_OCC)
SOURCE_GROUP("CAD System Headers" FILES ${CADSystemHeaders})
SOURCE_GROUP("CAD System Sources" FILES ${CADSystemSources})
SET(MeshUtilsSources
./MeshUtils/Octree.cpp
./MeshUtils/Octant.cpp
./MeshUtils/SurfaceMeshing.cpp
./MeshUtils/SurfaceMesh.cpp
./MeshUtils/CurveMesh.cpp
./MeshUtils/TriangleInterface.cpp
)
SET(MeshUtilsHeaders
./MeshUtils/Octree.h
./MeshUtils/CurvaturePoint.h
./MeshUtils/Octant.h
./MeshUtils/SurfaceMeshing.h
./MeshUtils/SurfaceMesh.h
./MeshUtils/CurveMesh.h
./MeshUtils/TriangleInterface.h
./MeshUtils/ExternalLib/triangle.h
)
SOURCE_GROUP("Mesh utilities headers" FILES ${MeshUtilsHeaders})
SOURCE_GROUP("Mesh utilities sources" FILES ${MeshUtilsSources})
ENDIF(NEKTAR_USE_OCC)
SOURCE_GROUP("Base" FILES ${BaseHeaders})
......@@ -361,7 +338,6 @@ SET(LibUtilityHeaders
${CommunicationHeaders}
${FoundationHeaders}
${CADSystemHeaders}
${MeshUtilsHeaders}
${LinearAlgebraHeaders}
${BasicConstHeaders}
${InterpreterHeaders}
......@@ -382,7 +358,6 @@ SET(LibUtilitySources
${BasicUtilsSources}
${FoundationSources}
${CADSystemSources}
${MeshUtilsSources}
${PolylibSources}
${CommunicationSources}
${LinearAlgebraSources}
......@@ -507,7 +482,6 @@ IF(NEKTAR_USE_OCC)
)
SET_TARGET_PROPERTIES(LibUtilities PROPERTIES COMPILE_DEFINITIONS "${OCC_DEF}")
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${OCC_LIBS})
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${TRILIB})
ENDIF(NEKTAR_USE_OCC)
INSTALL(FILES ${ExpressionTemplates} DESTINATION ${NEKTAR_INCLUDE_DIR}/ExpressionTemplates COMPONENT dev)
......
SET(MESHUTILS_SOURCES
CurveMesh.cpp
Octant.cpp
Octree.cpp
SurfaceMesh.cpp
SurfaceMeshing.cpp
TriangleInterface.cpp
)
SET(MESHUTILS_HEADERS
CurvaturePoint.hpp
CurveMesh.h
Octant.h
Octree.h
SurfaceMesh.h
SurfaceMeshing.h
TriangleInterface.h
)
ADD_NEKTAR_LIBRARY(MeshUtils lib ${NEKTAR_LIBRARY_TYPE}
${MESHUTILS_SOURCES} ${MESHUTILS_HEADERS})
TARGET_LINK_LIBRARIES(MeshUtils LINK_PUBLIC LibUtilities)
INSTALL(DIRECTORY ./
DESTINATION ${NEKTAR_INCLUDE_DIR}/MeshUtils
COMPONENT dev
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")
......@@ -40,7 +40,6 @@
#include <LibUtilities/Memory/NekMemoryManager.hpp>
namespace Nektar {
namespace LibUtilities {
namespace MeshUtils {
class CurvaturePoint {
......@@ -123,7 +122,6 @@ namespace Nektar {
typedef boost::shared_ptr<CurvaturePoint> CurvaturePointSharedPtr;
}
}
}
#endif
\ No newline at end of file
#endif
......@@ -35,11 +35,10 @@
#include <string>
#include <LibUtilities/MeshUtils/CurveMesh.h>
#include <MeshUtils/CurveMesh.h>
using namespace std;
namespace Nektar{
namespace LibUtilities{
namespace MeshUtils {
void CurveMesh::Mesh()
......@@ -243,5 +242,4 @@ namespace MeshUtils {
}
}
}
......@@ -40,7 +40,7 @@
#include <boost/shared_ptr.hpp>
#include <LibUtilities/CADSystem/CADCurve.h>
#include <LibUtilities/MeshUtils/Octree.h>
#include <MeshUtils/Octree.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/LibUtilitiesDeclspec.h>
......@@ -48,7 +48,6 @@
namespace Nektar {
namespace LibUtilities {
namespace MeshUtils {
class CurveMesh
......@@ -94,6 +93,5 @@ namespace MeshUtils {
typedef boost::shared_ptr<CurveMesh> CurveMeshSharedPtr;
}
}
}
#endif
......@@ -33,11 +33,10 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <LibUtilities/MeshUtils/Octant.h>
#include <MeshUtils/Octant.h>
using namespace std;
namespace Nektar {
namespace LibUtilities {
namespace MeshUtils {
Octant::Octant(NekDouble x, NekDouble y, NekDouble z,
......@@ -229,4 +228,3 @@ namespace MeshUtils {
}
}
}
\ No newline at end of file
......@@ -34,10 +34,10 @@
////////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_LIB_UTILITIES_MESHUTILS_OCTREE_OCTANT_H
#define NEKTAR_LIB_UTILITIES_MESHUTILS_OCTREE_OCTANT_H
#ifndef NEKTAR_MESHUTILS_OCTREE_OCTANT_H
#define NEKTAR_MESHUTILS_OCTREE_OCTANT_H
#include <LibUtilities/MeshUtils/CurvaturePoint.h>
#include <MeshUtils/CurvaturePoint.hpp>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/LibUtilitiesDeclspec.h>
......@@ -45,7 +45,6 @@
namespace Nektar {
namespace LibUtilities {
namespace MeshUtils {
class Octant; //have to forward declare the class for the sharedptr
......@@ -137,8 +136,7 @@ namespace Nektar {
};
}
}
}
#endif
\ No newline at end of file
#endif
......@@ -36,11 +36,10 @@
#include <string>
#include <fstream>
#include <LibUtilities/MeshUtils/Octree.h>
#include <MeshUtils/Octree.h>
using namespace std;
namespace Nektar{
namespace LibUtilities{
namespace MeshUtils {
......@@ -900,4 +899,3 @@ namespace MeshUtils {
}
}
}
......@@ -40,8 +40,8 @@
#include <boost/shared_ptr.hpp>
#include <LibUtilities/CADSystem/CADSystem.h>
#include <LibUtilities/MeshUtils/CurvaturePoint.h>
#include <LibUtilities/MeshUtils/Octant.h>
#include <MeshUtils/CurvaturePoint.hpp>
#include <MeshUtils/Octant.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/LibUtilitiesDeclspec.h>
......@@ -49,52 +49,51 @@
namespace Nektar {
namespace LibUtilities {
namespace MeshUtils {
class Octree
{
public:
friend class MemoryManager<Octree>;
LIB_UTILITIES_EXPORT Octree(const CADSystemSharedPtr &cad) : m_cad(cad)
{
};
LIB_UTILITIES_EXPORT void Build(const NekDouble &min,
const NekDouble &max,
const NekDouble &eps);
LIB_UTILITIES_EXPORT NekDouble Query(Array<OneD, NekDouble> loc);
NekDouble GetMinDelta(){return m_minDelta;}
private:
void CompileCuravturePointList();
void subdivide(int parent);
void SmoothOctants();
void SubDivideLevel(int parent);
void SmoothSurfaceOctants();
void PropagateDomain();
void SmoothAllOctants();
int CountElemt();
NekDouble ddx(int i, int j);
NekDouble m_minDelta;
NekDouble m_maxDelta;
NekDouble m_eps;
CADSystemSharedPtr m_cad;
Array<OneD, NekDouble> BoundingBox;
std::vector<CurvaturePointSharedPtr> m_cpList;
std::vector<OctantSharedPtr> OctantList;
int m_totNotDividing;
};
typedef boost::shared_ptr<Octree> OctreeSharedPtr;
}
}
namespace MeshUtils {
class Octree
{
public:
friend class MemoryManager<Octree>;
LIB_UTILITIES_EXPORT Octree(const CADSystemSharedPtr &cad) : m_cad(cad)
{
};
LIB_UTILITIES_EXPORT void Build(const NekDouble &min,
const NekDouble &max,
const NekDouble &eps);
LIB_UTILITIES_EXPORT NekDouble Query(Array<OneD, NekDouble> loc);
NekDouble GetMinDelta(){return m_minDelta;}
private:
void CompileCuravturePointList();
void subdivide(int parent);
void SmoothOctants();
void SubDivideLevel(int parent);
void SmoothSurfaceOctants();
void PropagateDomain();
void SmoothAllOctants();
int CountElemt();
NekDouble ddx(int i, int j);
NekDouble m_minDelta;
NekDouble m_maxDelta;
NekDouble m_eps;
CADSystemSharedPtr m_cad;
Array<OneD, NekDouble> BoundingBox;
std::vector<CurvaturePointSharedPtr> m_cpList;
std::vector<OctantSharedPtr> OctantList;
int m_totNotDividing;
};
typedef boost::shared_ptr<Octree> OctreeSharedPtr;
}
}
#endif
......@@ -36,12 +36,11 @@
#include <string>
#include <fstream>
#include <LibUtilities/MeshUtils/SurfaceMesh.h>
#include <LibUtilities/MeshUtils/TriangleInterface.h>
#include <MeshUtils/SurfaceMesh.h>
#include <MeshUtils/TriangleInterface.h>
using namespace std;
namespace Nektar{
namespace LibUtilities{
namespace MeshUtils {
void SurfaceMesh::Mesh()
......@@ -457,5 +456,4 @@ namespace MeshUtils {
}
}
}
......@@ -39,10 +39,9 @@
#include <boost/shared_ptr.hpp>
#include <LibUtilities/MeshUtils/Octree.h>
#include <LibUtilities/CADSystem/CADSurf.h>
#include <LibUtilities/MeshUtils/CurveMesh.h>
#include <MeshUtils/Octree.h>
#include <MeshUtils/CurveMesh.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/LibUtilitiesDeclspec.h>
......@@ -50,7 +49,6 @@
namespace Nektar {
namespace LibUtilities {
namespace MeshUtils {
class SurfaceMesh
......@@ -97,6 +95,5 @@ namespace MeshUtils {
typedef boost::shared_ptr<SurfaceMesh> SurfaceMeshSharedPtr;
}
}
}
#endif
......@@ -36,11 +36,10 @@
#include <string>
#include <fstream>
#include <LibUtilities/MeshUtils/SurfaceMeshing.h>
#include <MeshUtils/SurfaceMeshing.h>
using namespace std;
namespace Nektar{
namespace LibUtilities{
namespace MeshUtils {
void SurfaceMeshing::Mesh()
......@@ -79,5 +78,4 @@ namespace MeshUtils {
}
}
}
......@@ -40,17 +40,15 @@
#include <boost/shared_ptr.hpp>
#include <LibUtilities/CADSystem/CADSystem.h>
#include <LibUtilities/MeshUtils/Octree.h>
#include <LibUtilities/MeshUtils/SurfaceMesh.h>
#include <LibUtilities/MeshUtils/CurveMesh.h>
#include <MeshUtils/Octree.h>
#include <MeshUtils/SurfaceMesh.h>
#include <MeshUtils/CurveMesh.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/LibUtilitiesDeclspec.h>
#include <LibUtilities/Memory/NekMemoryManager.hpp>
namespace Nektar {
namespace LibUtilities {
namespace MeshUtils {
class SurfaceMeshing
......@@ -81,6 +79,5 @@ namespace MeshUtils {
typedef boost::shared_ptr<SurfaceMeshing> SurfaceMeshingSharedPtr;
}
}
}
#endif
......@@ -36,11 +36,10 @@
#include <string>
#include <fstream>
#include <LibUtilities/MeshUtils/TriangleInterface.h>
#include <MeshUtils/TriangleInterface.h>
using namespace std;
namespace Nektar{
namespace LibUtilities{
namespace MeshUtils {
void TriangleInterface::Mesh(bool Quiet, bool Quality)
......@@ -193,5 +192,4 @@ namespace MeshUtils {
}
}
}
......@@ -49,7 +49,7 @@
#define TRILIBRARY
#define VOID int
#include <LibUtilities/MeshUtils/ExternalLib/triangle.h>
#include <triangle.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/LibUtilitiesDeclspec.h>
......@@ -57,7 +57,6 @@
namespace Nektar {
namespace LibUtilities {
namespace MeshUtils {
class TriangleInterface
......@@ -127,7 +126,6 @@ namespace Nektar {
typedef boost::shared_ptr<TriangleInterface>
TriangleInterfaceSharedPtr;
}
}
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment