Commit 5b8520ff authored by Michael Turner's avatar Michael Turner
Browse files

added levmar optimstaion library

parent 8ae42765
......@@ -183,6 +183,7 @@ INCLUDE (ThirdPartyVTK)
INCLUDE (ThirdPartyQT4)
INCLUDE (ThirdPartySMV)
INCLUDE (ThirdPartyTriangle)
INCLUDE (ThirdPartyLevmar)
INCLUDE (ThirdPartyTetGen)
INCLUDE (ThirdPartyCCM)
......
########################################################################
#
# ThirdParty configuration for Nektar++
#
# Levmar
#
########################################################################
IF(NEKTAR_USE_MESH)
SET(BUILD_LEVMAR ON)
OPTION(THIRDPARTY_BUILD_LEVMAR
"Build Levmar library from ThirdParty." ${BUILD_LEVMAR})
IF (THIRDPARTY_BUILD_LEVMAR)
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
levmar-5.2
PREFIX ${TPSRC}
URL http://ae-nektar.ae.ic.ac.uk/~mt4313/levmar.zip
URL_MD5 7139c9790e3ed4cb5fe2d5be6b1e30d5
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/levmar-5.2
BINARY_DIR ${TPBUILD}/levmar-5.2
TMP_DIR ${TPBUILD}/levmar-5.2-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}/levmar-5.2
)
SET(LEVMAR_LIBRARY levmar CACHE FILEPATH
"Levmar library" FORCE)
SET(LEVMAR_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"Levmar include" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
IF (WIN32)
MESSAGE(STATUS
"Build Levmar: ${TPDIST}/${LIB_DIR}/${LEVMAR_LIBRARY}.dll")
ELSE ()
MESSAGE(STATUS
"Build Levmar: ${TPDIST}/${LIB_DIR}/lib${LEVMAR_LIBRARY}.a")
ENDIF ()
SET(TRIANGLE_CONFIG_INCLUDE_DIR ${TPINC})
ELSE()
ADD_CUSTOM_TARGET(levmar-5.2 ALL)
MESSAGE(STATUS "Found Levmar: ${LEVMAR_LIBRARY}")
SET(TRIANGLE_CONFIG_INCLUDE_DIR ${LEVMAR_INCLUDE_DIR})
ENDIF (THIRDPARTY_BUILD_LEVMAR)
INCLUDE_DIRECTORIES(SYSTEM ${LEVMAR_INCLUDE_DIR})
ENDIF(NEKTAR_USE_MESH)
......@@ -27,6 +27,7 @@ ADD_NEKTAR_LIBRARY(MeshUtils lib ${NEKTAR_LIBRARY_TYPE}
TARGET_LINK_LIBRARIES(MeshUtils LINK_PUBLIC LibUtilities)
TARGET_LINK_LIBRARIES(MeshUtils LINK_PRIVATE ${TRIANGLE_LIBRARY})
TARGET_LINK_LIBRARIES(MeshUtils LINK_PRIVATE ${TETGEN_LIBRARY})
TARGET_LINK_LIBRARIES(MeshUtils LINK_PRIVATE ${LEVMAR_LIBRARY})
INSTALL(DIRECTORY ./
DESTINATION ${NEKTAR_INCLUDE_DIR}/MeshUtils
......
......@@ -34,6 +34,7 @@
////////////////////////////////////////////////////////////////////////////////
#include <MeshUtils/SurfaceMeshing.h>
#include <levmar.h>
using namespace std;
namespace Nektar{
......@@ -85,6 +86,11 @@ namespace MeshUtils {
nodeinlinearmesh = Nodes.size();
}
void EnergyEval(double *p, double *x, int m, int n, void *data)
{
}
void SurfaceMeshing::HOSurf()
{
if(m_verbose)
......@@ -169,35 +175,9 @@ namespace MeshUtils {
}
NekDouble dz = 2.0/m_order;
for(int i = 1; i < m_order+1 -1; i++)
{
NekDouble zim = -1.0 + (i-1)*dz;
NekDouble zi = -1.0 + i*dz;
NekDouble zip = -1.0 + (i+1)*dz;
Array<OneD, NekDouble> uvim = Nodes[honodes[i-2]]->GetS(e->GetSurf());
Array<OneD, NekDouble> uvi = Nodes[honodes[i-1]]->GetS(e->GetSurf());
Array<OneD, NekDouble> uvip = Nodes[honodes[i]]->GetS(e->GetSurf());
Array<OneD, NekDouble> rim = s->D2(uvim);
Array<OneD, NekDouble> ri = s->D2(uvi);
Array<OneD, NekDouble> rip = s->D2(uvip);
NekDouble fu = 1.0/(zi-zim)*(2.0*(ri[0]-rim[0])*(ri[3]-rim[3])
+2.0*(ri[1]-rim[1])*(ri[4]-rim[4])
+2.0*(ri[2]-rim[2])*(ri[5]-rim[5])) +
1.0/(zip-zi)*(2.0*(rip[0]-ri[0])*(rip[3]-ri[3])
+2.0*(rip[1]-ri[1])*(rip[4]-ri[4])
+2.0*(rip[2]-ri[2])*(rip[5]-ri[5]));
NekDouble fv = 1.0/(zi-zim)*(2.0*(ri[0]-rim[0])*(ri[6]-rim[6])
+2.0*(ri[1]-rim[1])*(ri[7]-rim[7])
+2.0*(ri[2]-rim[2])*(ri[8]-rim[8])) +
1.0/(zip-zi)*(2.0*(rip[0]-ri[0])*(rip[6]-ri[6])
+2.0*(rip[1]-ri[1])*(rip[7]-ri[7])
+2.0*(rip[2]-ri[2])*(rip[8]-ri[8]));
}
double opts[LM_OPTS_SZ], info[LM_INFO_SZ];
opts[0]=LM_INIT_MU; opts[1]=1E-15; opts[2]=1E-15; opts[3]=1E-20;
opts[4]= LM_DIFF_DELTA;
e->SetHONodes(honodes);
}
......
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