Commit e37ff495 authored by Michael Turner's avatar Michael Turner

fix

parent 8e433420
......@@ -19,6 +19,35 @@ if(NOT DEFINED OCE_DIR AND DEFINED TEST_ENV)
set(OCE_DIR $ENV{OCE_DIR})
endif()
SET(OCE_FIND_COMPONENTS
TKFillet
TKMesh
TKernel
TKG2d
TKG3d
TKMath
TKIGES
TKSTL
TKShHealing
TKXSBase
TKBool
TKBO
TKBRep
TKTopAlgo
TKGeomAlgo
TKGeomBase
TKOffset
TKPrim
TKSTEP
TKSTEPBase
TKSTEPAttr
TKHLR
TKFeat
TKXCAF
TKLCAF
TKXDESTEP
)
# First try to find OpenCASCADE Community Edition
if(NOT DEFINED OCE_DIR)
# Check for OSX needs to come first because UNIX evaluates to true on OSX
......@@ -30,23 +59,18 @@ if(NOT DEFINED OCE_DIR)
endif()
elseif(UNIX)
set(OCE_DIR "/usr/local/share/cmake/")
find_package(OCE 0.17 QUIET)
endif()
endif()
find_package(OCE 0.17 QUIET)
if(OCE_FOUND)
message(STATUS "OpenCASCADE Community Edition has been found.")
#check that the OCE package has CAF modules
FIND_LIBRARY(OCC_CAF_LIBRARY TKXCAF ${OCE_INCLUDE_DIRS}/../../lib )
if(OCC_CAF_LIBRARY)
set(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
else()
message(STATUS "-- OCE does not have CAF libraries, will build from source.")
endif()
SET(OCC_FOUND FALSE)
else(OCE_FOUND) #look for OpenCASCADE
if(OCE_FOUND AND OCE_ALL_FOUND)
message(STATUS "OpenCASCADE Community Edition has been found with all required components.")
SET(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
SET(OCC_FOUND TRUE)
else(OCE_FOUND AND OCE_ALL_FOUND) #look for OpenCASCADE
message(STATUS "OpenCASCADE Community Edition could not be found or has missing components.")
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
/usr/include/opencascade
......@@ -65,6 +89,7 @@ else(OCE_FOUND) #look for OpenCASCADE
if(OCC_LIBRARY)
message(STATUS "OpenCASCADE has been found.")
SET(OCC_FOUND TRUE)
GET_FILENAME_COMPONENT(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
IF(NOT OCC_INCLUDE_DIR)
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
......@@ -72,7 +97,7 @@ else(OCE_FOUND) #look for OpenCASCADE
)
ENDIF()
endif(OCC_LIBRARY)
endif(OCE_FOUND)
endif(OCE_FOUND AND OCE_ALL_FOUND)
if(OCC_INCLUDE_DIR)
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAJOR
......@@ -91,39 +116,8 @@ if(OCC_INCLUDE_DIR)
set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
endif(OCC_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set OCC_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OCC REQUIRED_VARS OCC_INCLUDE_DIR VERSION_VAR OCC_VERSION_STRING)
if(OCC_FOUND)
set(OCC_LIBRARIES
TKFillet
TKMesh
TKernel
TKG2d
TKG3d
TKMath
TKIGES
TKSTL
TKShHealing
TKXSBase
TKBool
TKBO
TKBRep
TKTopAlgo
TKGeomAlgo
TKGeomBase
TKOffset
TKPrim
TKSTEP
TKSTEPBase
TKSTEPAttr
TKHLR
TKFeat
TKXCAF
TKXDESTEP
)
set(OCC_LIBRARIES ${OCE_FIND_COMPONENTS})
if(OCC_VERSION_STRING VERSION_LESS 6.8)
MESSAGE(SEND_ERROR "OCC version too low")
endif(OCC_VERSION_STRING VERSION_LESS 6.8)
......
......@@ -22,7 +22,7 @@ IF(NEKTAR_USE_MESHGEN)
IF (THIRDPARTY_BUILD_OCE)
INCLUDE(ExternalProject)
SET(OCC_LIBRARIES_TMP
SET(OCC_LIB_LIST
TKFillet
TKMesh
TKernel
......@@ -47,13 +47,9 @@ IF(NEKTAR_USE_MESHGEN)
TKHLR
TKFeat
TKXCAF
TKLCAF
TKXDESTEP
)
FOREACH(OCC_LIB ${OCC_LIBRARIES_TMP})
LIST(APPEND OCC_LIBRARIES ${TPDIST}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${OCC_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX})
ENDFOREACH()
UNSET(OCC_LIBRARIES_TMP)
IF(WIN32)
MESSAGE(SEND_ERROR "Cannot currently use OpenCascade with Nektar++ on Windows")
......@@ -86,12 +82,12 @@ IF(NEKTAR_USE_MESHGEN)
DEPENDEES install)
ENDIF()
THIRDPARTY_LIBRARY(OCC_LIBRARIES SHARED ${OCC_LIB_LIST} DESCRIPTION "OpenCascade libs")
SET(OCC_INCLUDE_DIR ${TPDIST}/include/oce CACHE FILEPATH "OCC include" FORCE)
MESSAGE(STATUS "Build OpenCascade community edition: ${TPDIST}/lib")
LINK_DIRECTORIES(${TPDIST}/lib)
INCLUDE_DIRECTORIES(${TPDIST}/include/oce)
ELSE()
ADD_CUSTOM_TARGET(oce-0.17 ALL)
SET(OPENCASCADE_CONFIG_INCLUDE_DIR ${OCC_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${OCC_INCLUDE_DIR})
ENDIF()
ENDIF()
INCLUDE_DIRECTORIES(${OCC_INCLUDE_DIR})
......@@ -16,7 +16,7 @@
<metric type="Linf" id="2">
<value variable="rho" tolerance="1e-6">0.530796</value>
<value variable="rhou" tolerance="1e-6">92.5827</value>
<value variable="rhov" tolerance="2e-4">58.1851</value>
<value variable="rhov" tolerance="4e-4">58.1851</value>
<value variable="E" tolerance="1e-6">346912</value>
</metric>
</metrics>
......
......@@ -89,10 +89,11 @@ bool ProcessProjectCAD::findAndProject(bgi::rtree<boxI, bgi::quadratic<16> > &rt
int minsurf = 0;
NekDouble minDist = numeric_limits<double>::max();
NekDouble dist;
for (int j = 0; j < result.size(); j++)
{
NekDouble dist = m_mesh->m_cad->GetSurf(result[j].second)->DistanceTo(in);
m_mesh->m_cad->GetSurf(result[j].second)->locuv(in, dist);
if (dist < minDist)
{
......@@ -101,8 +102,7 @@ bool ProcessProjectCAD::findAndProject(bgi::rtree<boxI, bgi::quadratic<16> > &rt
}
}
Array<OneD, NekDouble> uv(2);
m_mesh->m_cad->GetSurf(minsurf)->ProjectTo(in, uv);
Array<OneD, NekDouble> uv = m_mesh->m_cad->GetSurf(minsurf)->locuv(in, dist);
return true;
}
......@@ -335,9 +335,8 @@ void ProcessProjectCAD::Process()
for (int j = 0; j < result.size(); j++)
{
NekDouble dist = m_mesh->m_cad->
GetSurf(result[j].second)->
DistanceTo((*i)->GetLoc());
NekDouble dist;
m_mesh->m_cad->GetSurf(result[j].second)->locuv((*i)->GetLoc(), dist);
distList.push_back(dist);
distId.push_back(result[j].second);
}
......@@ -392,9 +391,10 @@ void ProcessProjectCAD::Process()
shift = distList[j];
Array<OneD, NekDouble> uvt(2);
NekDouble dist = 0;
CADSurfSharedPtr s = m_mesh->m_cad->GetSurf(distId[j]);
Array<OneD, NekDouble> l = (*i)->GetLoc();
s->ProjectTo(l, uvt);
uvt = s->locuv(l, dist);
NekDouble tmpX = (*i)->m_x;
NekDouble tmpY = (*i)->m_y;
......@@ -435,10 +435,11 @@ void ProcessProjectCAD::Process()
}
CADSurfSharedPtr s = m_mesh->m_cad->GetSurf(distId[j]);
Array<OneD, NekDouble> uv(2);
Array<OneD, NekDouble> uv;
NekDouble dist=0;
Array<OneD, NekDouble> loc = (*i)->GetLoc();
s->ProjectTo(loc, uv);
(*i)->SetCADSurf(distId[j], s, uv);
uv = s->locuv(loc, dist);
(*i)->SetCADSurf(s, uv);
}
maxNodeCor = max(maxNodeCor, shift);
}
......@@ -494,17 +495,17 @@ void ProcessProjectCAD::Process()
{
continue;
}
vector<pair<int, CADSurfSharedPtr> > v1 = (*i)->m_n1->GetCADSurfs();
vector<pair<int, CADSurfSharedPtr> > v2 = (*i)->m_n2->GetCADSurfs();
vector<CADSurfSharedPtr> v1 = (*i)->m_n1->GetCADSurfs();
vector<CADSurfSharedPtr> v2 = (*i)->m_n2->GetCADSurfs();
vector<int> vi1, vi2;
for (int i = 0; i < v1.size();i++)
{
vi1.push_back(v1[i].first);
vi1.push_back(v1[i]->GetId());
}
for (int i = 0; i < v2.size();i++)
{
vi2.push_back(v2[i].first);
vi2.push_back(v2[i]->GetId());
}
sort(vi1.begin(), vi1.end());
......
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