Commit 182cfe92 authored by Dave Moxey's avatar Dave Moxey

Fix libANN using file from other branch, replace OCC with v6.9, add ability to...

Fix libANN using file from other branch, replace OCC with v6.9, add ability to compile OCC from source
parent 524a0de2
......@@ -97,7 +97,9 @@ MARK_AS_ADVANCED(NEKTAR_BUILD_PACKAGES)
OPTION(NEKTAR_TEST_ALL "Include full set of regression tests to this build." OFF)
# Meshing utilities and library
OPTION(NEKTAR_USE_MESHGEN "Build mesh generation utilities." OFF)
IF (NOT WIN32)
OPTION(NEKTAR_USE_MESHGEN "Build mesh generation utilities." OFF)
ENDIF()
# Build options
OPTION(NEKTAR_FULL_DEBUG "Enable Full Debugging." OFF)
......@@ -180,13 +182,13 @@ INCLUDE (ThirdPartyScotch)
INCLUDE (ThirdPartyZlib)
INCLUDE (ThirdPartyBoost)
INCLUDE (ThirdPartyFFTW)
INCLUDE (ThirdPartyOCC)
INCLUDE (ThirdPartyArpack)
INCLUDE (ThirdPartyMPI)
INCLUDE (ThirdPartyPETSc)
INCLUDE (ThirdPartyVTK)
INCLUDE (ThirdPartyQT4)
INCLUDE (ThirdPartySMV)
INCLUDE (ThirdPartyOCC)
INCLUDE (ThirdPartyTetGen)
INCLUDE (ThirdPartyANN)
INCLUDE (ThirdPartyCCM)
......
# Try to find OCE / OCC
# Once done this will define
#
# OCC_FOUND - system has OCC - OpenCASCADE
# OCC_INCLUDE_DIR - where the OCC include directory can be found
# OCC_LIBRARY_DIR - where the OCC library directory can be found
# OCC_LIBRARIES - Link this to use OCC
# OCC_OCAF_LIBRARIES - Link this to use OCC OCAF framework
# 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
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(DEFINED MACPORTS_PREFIX)
find_package(OCE HINTS ${MACPORTS_PREFIX}/Library/Frameworks)
elseif(DEFINED HOMEBREW_PREFIX)
find_package(OCE HINTS ${HOMEBREW_PREFIX}/Cellar/oce/*)
endif()
elseif(UNIX)
set(OCE_DIR "/usr/local/share/cmake/")
elseif(WIN32)
set(OCE_DIR "c:/OCE-0.4.0/share/cmake")
endif()
endif()
find_package(OCE QUIET)
if(OCE_FOUND)
message(STATUS "-- OpenCASCADE Community Edition has been found.")
# Disable this define. For more details see bug #0001872
#add_definitions (-DHAVE_CONFIG_H)
set(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
#set(OCC_LIBRARY_DIR ${OCE_LIBRARY_DIR})
else(OCE_FOUND) #look for OpenCASCADE
if(WIN32)
if(CYGWIN OR MINGW)
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
/usr/include/opencascade
/usr/local/include/opencascade
/usr/local/opt/opencascade/include
/opt/opencascade/include
/opt/opencascade/inc
)
FIND_LIBRARY(OCC_LIBRARY TKernel
/usr/lib
/usr/local/lib
/usr/local/opt/opencascade/lib
/opt/opencascade/lib
)
else(CYGWIN OR MINGW)
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\OCC\\2;Installation Path]/include"
)
FIND_LIBRARY(OCC_LIBRARY TKernel
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\OCC\\2;Installation Path]/lib"
)
endif(CYGWIN OR MINGW)
else(WIN32)
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
/usr/include/opencascade
/usr/local/include/opencascade
/usr/local/opt/opencascade/include
/opt/opencascade/include
/opt/opencascade/inc
)
FIND_LIBRARY(OCC_LIBRARY TKernel
/usr/lib
/usr/local/lib
/usr/local/opt/opencascade/lib
/opt/opencascade/lib
)
endif(WIN32)
if(OCC_LIBRARY)
GET_FILENAME_COMPONENT(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
IF(NOT OCC_INCLUDE_DIR)
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
${OCC_LIBRARY_DIR}/../inc
)
ENDIF()
endif(OCC_LIBRARY)
endif(OCE_FOUND)
if(OCC_INCLUDE_DIR)
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAJOR
REGEX "#define OCC_VERSION_MAJOR.*"
)
string(REGEX MATCH "[0-9]+" OCC_MAJOR ${OCC_MAJOR})
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MINOR
REGEX "#define OCC_VERSION_MINOR.*"
)
string(REGEX MATCH "[0-9]+" OCC_MINOR ${OCC_MINOR})
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAINT
REGEX "#define OCC_VERSION_MAINTENANCE.*"
)
string(REGEX MATCH "[0-9]+" OCC_MAINT ${OCC_MAINT})
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
TKBin
TKBool
TKBO
TKBRep
TKTopAlgo
TKGeomAlgo
TKGeomBase
TKOffset
TKPrim
TKSTEP
TKSTEPBase
TKSTEPAttr
TKHLR
TKFeat
)
set(OCC_OCAF_LIBRARIES
TKCAF
TKXCAF
TKLCAF
TKXDESTEP
TKXDEIGES
TKMeshVS
)
if(OCC_VERSION_STRING VERSION_LESS 6.7.3)
list(APPEND OCC_OCAF_LIBRARIES TKAdvTools)
endif(OCC_VERSION_STRING VERSION_LESS 6.7.3)
message(STATUS "-- Found OCE/OpenCASCADE version: ${OCC_VERSION_STRING}")
message(STATUS "-- OCE/OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
message(STATUS "-- OCE/OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
else(OCC_FOUND)
#message(SEND_ERROR "Neither OpenCASCADE Community Edition nor OpenCasCade were found: will not build CAD modules!")
endif(OCC_FOUND)
\ No newline at end of file
......@@ -139,17 +139,6 @@ MACRO(ADD_NEKTAR_LIBRARY name component type)
SET_COMMON_PROPERTIES(${name})
# Set properties for building shared libraries
IF( ${type} STREQUAL "SHARED" )
# Properties specific to Mac OSX
IF( ${CMAKE_SYSTEM} MATCHES "Darwin-*")
# We allow undefined symbols to be looked up dynamically at runtime
# from the boost libraries linked by the executables.
SET_TARGET_PROPERTIES(${name}
PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
ENDIF( ${CMAKE_SYSTEM} MATCHES "Darwin-*")
ENDIF( ${type} STREQUAL "SHARED" )
INSTALL(TARGETS ${name}
EXPORT Nektar++Libraries
RUNTIME DESTINATION ${NEKTAR_BIN_DIR} COMPONENT ${component} OPTIONAL
......
......@@ -2,27 +2,91 @@
#
# ThirdParty configuration for Nektar++
#
# ANN
# libann partitioner
#
########################################################################
IF (NOT WIN32)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_ANN
"Use ANN routines for performing the Approximate Nearest Neighbour searches." OFF
"NEKTAR_USE_MESHGEN" ON)
ENDIF(NOT WIN32)
IF (NEKTAR_USE_ANN)
# First search for system ANN installs. Hint /opt/local for MacPorts.
FIND_LIBRARY(ANN_LIBRARY NAMES ANN PATHS /opt/local/lib /usr/local/opt/ann/lib)
FIND_PATH (ANN_INCLUDE_DIR ANN.h PATHS /opt/local/include /usr/local/opt/ann/include/ANN)
GET_FILENAME_COMPONENT(ANN_LIBRARY_PATH ${ANN_LIBRARY} PATH)
IF(NEKTAR_USE_MESHGEN)
IF (ANN_LIBRARY AND ANN_INCLUDE_DIR)
SET(BUILD_ANN OFF)
ELSE()
SET(BUILD_ANN ON)
ENDIF ()
find_library(LIB_ANN ANN
PATHS /opt/local/lib)
CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_ANN
"Build ANN library from ThirdParty" ${BUILD_ANN}
"NEKTAR_USE_ANN" OFF)
FIND_PATH(ANN_INCLUDE_DIR ANN.h
HINTS /opt/local/include/ANN/
)
IF (THIRDPARTY_BUILD_ANN)
FIND_PATH(ANN_LIB_DIR libANN.a
HINTS /opt/local/lib/
)
# Note that ANN is compiled in the source-tree, so we unpack the
# source code in the ThirdParty builds directory.
SET(ANN_DIR ${TPBUILD}/ann-1.1.2)
SET(ANN_SRC ${ANN_DIR}/src)
LINK_DIRECTORIES(${ANN_LIB_DIR})
IF (APPLE)
SET(ANN_CFLAGS "-O3")
SET(ANN_MAKELIB "libtool -static -o")
ELSE ()
SET(ANN_CFLAGS "-O3")
SET(ANN_MAKELIB "ar ruv")
ENDIF ()
INCLUDE_DIRECTORIES(SYSTEM ${ANN_INCLUDE_DIR})
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
ann-1.1.2
PREFIX ${TPSRC}
URL ${TPURL}/ann_1.1.2.tar.gz
URL_MD5 "9f99653b76798ecb1cfadc88950c4707"
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPBUILD}/ann-1.1.2
BINARY_DIR ${TPBUILD}/ann-1.1.2
TMP_DIR ${TPBUILD}/ann-1.1.2-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E remove -f ${ANN_DIR}/Makefile
BUILD_COMMAND cd src
COMMAND $(MAKE) -C ${ANN_SRC} targets
"ANNLIB = libANN.a"
"C++ = ${CMAKE_CXX_COMPILER}"
"CFLAGS = ${ANN_CFLAGS}"
"MAKELIB = ${ANN_MAKELIB}"
"RANLIB = true"
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${TPDIST}/lib
COMMAND ${CMAKE_COMMAND} -E copy ${ANN_DIR}/lib/libANN.a
${TPDIST}/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${ANN_DIR}/include
${TPDIST}/include
)
ENDIF(NEKTAR_USE_MESHGEN)
SET(ANN_LIBRARY ANN CACHE FILEPATH
"ANN library" FORCE)
SET(ANN_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"ANN include directory" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
MESSAGE(STATUS "Build ANN: ${TPDIST}/lib/lib${ANN_LIBRARY}.a")
SET(ANN_CONFIG_INCLUDE_DIR ${TPINC})
ELSE (THIRDPARTY_BUILD_ANN)
ADD_CUSTOM_TARGET(ann-1.1.2 ALL)
MESSAGE(STATUS "Found ANN: ${ANN_LIBRARY}")
SET(ANN_CONFIG_INCLUDE_DIR ${ANN_INCLUDE_DIR})
ENDIF (THIRDPARTY_BUILD_ANN)
INCLUDE_DIRECTORIES(${ANN_INCLUDE_DIR})
MARK_AS_ADVANCED(ANN_LIBRARY)
MARK_AS_ADVANCED(ANN_INCLUDE_DIR)
ENDIF()
......@@ -7,63 +7,75 @@
########################################################################
IF(NEKTAR_USE_MESHGEN)
SET(BUILD_OCC ON)
OPTION(THIRDPARTY_DOWNLOAD_OCC
"Download pre-compiled versions of OpenCascade." ${BUILD_OCC})
# Try to find installed version of OpenCascade
INCLUDE(FindOCC)
IF (THIRDPARTY_DOWNLOAD_OCC)
IF (OCC_FOUND)
SET(BUILD_OCC OFF)
ELSE()
SET(BUILD_OCC ON)
ENDIF()
OPTION(THIRDPARTY_BUILD_OCC "Build OpenCascade library from ThirdParty."
${BUILD_OCC})
IF (THIRDPARTY_BUILD_OCC)
INCLUDE(ExternalProject)
SET(OCC_LIBS_TMP PTKernel TKernel TKMath TKBRep TKIGES TKSTEP TKSTEPAttr
SET(OCC_LIBRARIES_TMP PTKernel TKernel TKMath TKBRep TKIGES TKSTEP TKSTEPAttr
TKSTEP209 TKSTEPBase TKShapeSchema TKGeomBase TKGeomAlgo TKG3d TKG2d
TKXSBase TKPShape TKTopAlgo)
FOREACH(OCC_LIB ${OCC_LIBS_TMP})
LIST(APPEND OCC_LIBS ${TPDIST}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${OCC_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX})
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")
ELSEIF(APPLE)
EXTERNALPROJECT_ADD(
opencascade-6.8
PREFIX ${TPSRC}
URL ${TPURL}/OCC680osx64.tgz
URL_MD5 626292523b0691304f0fa271989fbc44
STAMP_DIR ${TPBUILD}/stamp
BINARY_DIR ${TPBUILD}/opencascade-6.8
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/opencascade-6.8
INSTALL_DIR ${TPDIST}
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND cp -a ${TPSRC}/opencascade-6.8/i686/lib/. ${TPDIST}/lib/ COMMAND cp -a ${TPSRC}/opencascade-6.8/i686/inc/. ${TPDIST}/include/
)
ENDIF()
EXTERNALPROJECT_ADD(
opencascade-6.9
PREFIX ${TPSRC}
URL http://files.opencascade.com/OCCT/OCC_6.9.0_release/opencascade-6.9.0.tgz
URL_MD5 ba87fe9f5ca47e3dfd62aad7223f0e7f
STAMP_DIR ${TPBUILD}/stamp
BINARY_DIR ${TPBUILD}/opencascade-6.9
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/opencascade-6.9
INSTALL_DIR ${TPBUILD}/opencascade-6.9/dist
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DINSTALL_DIR:PATH=${TPDIST}
-DCMAKE_CXX_FLAGS:STRING=-DTIXML_USE_STL
${TPSRC}/opencascade-6.9
)
# Patch OS X libraries to fix install name problems.
EXTERNALPROJECT_ADD_STEP(opencascade-6.8 patch-install-path
COMMAND bash ${CMAKE_SOURCE_DIR}/cmake/scripts/patch-occ.sh ${TPSRC}/opencascade-6.8/i686/lib ${CMAKE_INSTALL_PREFIX}/${NEKTAR_LIB_DIR}
DEPENDEES build
DEPENDERS install)
ELSE()
EXTERNALPROJECT_ADD(
opencascade-6.8
PREFIX ${TPSRC}
URL ${TPURL}/OCC680lin64.tgz
URL_MD5 d655b6f50998bb9600e081907c247793
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/opencascade-6.8
INSTALL_DIR ${TPDIST}
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND cp -a ${TPSRC}/opencascade-6.8/lib/. ${TPDIST}/lib/ COMMAND cp -a ${TPSRC}/opencascade-6.8/inc/. ${TPDIST}/include/
)
IF (APPLE)
SET(OCC_LIBDIR ${TPBUILD}/opencascade-6.9/mac64/clang/)
ENDIF()
EXTERNALPROJECT_ADD_STEP(opencascade-6.9 post-install
COMMAND ${CMAKE_COMMAND} -E make_directory ${TPDIST}/lib
COMMAND ${CMAKE_COMMAND} -E make_directory ${TPDIST}/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${TPBUILD}/opencascade-6.9/dist/inc ${TPDIST}/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${OCC_LIBDIR} ${TPDIST}/lib
DEPENDEES install)
# Patch OS X libraries to fix install name problems.
#EXTERNALPROJECT_ADD_STEP(opencascade-6.9 patch-install-path
# COMMAND bash ${CMAKE_SOURCE_DIR}/cmake/scripts/patch-occ.sh ${TPSRC}/opencascade-6.8/i686/lib ${CMAKE_INSTALL_PREFIX}/${NEKTAR_LIB_DIR}
# DEPENDEES build
# DEPENDERS install)
MESSAGE(STATUS "Build OpenCascade: download binaries")
MESSAGE(STATUS "Build OpenCascade: ${TPDIST}/lib")
LINK_DIRECTORIES(${TPDIST}/lib)
INCLUDE_DIRECTORIES(SYSTEM ${TPDIST}/include)
ENDIF (THIRDPARTY_DOWNLOAD_OCC)
ENDIF(NEKTAR_USE_MESHGEN)
ELSE()
ADD_CUSTOM_TARGET(opencascade-6.9 ALL)
MESSAGE(STATUS "Found OpenCASCADE: ${OCC_LIBRARY_DIR}")
SET(OPENCASCADE_CONFIG_INCLUDE_DIR ${OCC_INCLUDE_DIR})
ENDIF()
ENDIF()
......@@ -84,12 +84,12 @@ TARGET_LINK_LIBRARIES(NekMeshUtils LINK_PUBLIC LocalRegions)
IF(NEKTAR_USE_MESHGEN)
TARGET_LINK_LIBRARIES(NekMeshUtils LINK_PRIVATE ${TETGEN_LIBRARY})
TARGET_LINK_LIBRARIES(NekMeshUtils LINK_PRIVATE ${LIB_ANN})
TARGET_LINK_LIBRARIES(NekMeshUtils LINK_PUBLIC ${OCC_LIBS})
TARGET_LINK_LIBRARIES(NekMeshUtils LINK_PRIVATE ${ANN_LIBRARY})
TARGET_LINK_LIBRARIES(NekMeshUtils LINK_PUBLIC ${OCC_LIBRARIES})
SET(OCC_DEF LIN LININTEL HAVE_WOK_CONFIG_H HAVE_CONFIG_H CSFDB)
SET_PROPERTY(TARGET NekMeshUtils APPEND PROPERTY COMPILE_DEFINITIONS ${OCC_DEF})
ADD_DEPENDENCIES(NekMeshUtils opencascade-6.8 tetgen-1.5)
ADD_DEPENDENCIES(NekMeshUtils opencascade-6.9 tetgen-1.5)
ENDIF()
INSTALL(DIRECTORY ./
......
......@@ -2,10 +2,6 @@ MACRO(ADD_UTILITIES_EXECUTABLE name component source)
ADD_EXECUTABLE(${name} ${source} ${ARGN})
SET_COMMON_PROPERTIES(${name})
TARGET_LINK_LIBRARIES(${name} MultiRegions)
IF( ${CMAKE_SYSTEM} MATCHES "Darwin-*")
SET_TARGET_PROPERTIES(${name}
PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup -Wl,-rpath,${CMAKE_INSTALL_PREFIX}/${LIB_DIR} -Wl,-rpath,${Boost_LIBRARY_DIRS}")
ENDIF( ${CMAKE_SYSTEM} MATCHES "Darwin-*")
SET_PROPERTY(TARGET ${name} PROPERTY FOLDER ${component})
INSTALL(TARGETS ${name}
RUNTIME DESTINATION ${NEKTAR_BIN_DIR} COMPONENT ${component})
......
......@@ -41,7 +41,6 @@ SET(FieldConvertHeaders
ProcessModules/ProcessC0Projection.h
ProcessModules/ProcessQCriterion.h
ProcessModules/ProcessQualityMetric.h
ProcessModules/ProcessFilterForMeshing.h
)
SET(FieldConvertSources
......@@ -87,7 +86,6 @@ SET(FieldConvertSources
ProcessModules/ProcessC0Projection.cpp
ProcessModules/ProcessQCriterion.cpp
ProcessModules/ProcessQualityMetric.cpp
ProcessModules/ProcessFilterForMeshing.cpp
)
ADD_UTILITIES_EXECUTABLE(FieldConvert util ${FieldConvertSources} ${FieldConvertHeaders})
......
////////////////////////////////////////////////////////////////////////////////
//
// File: ProcessQCriterion.cpp
//
// For more information, please see: http://www.nektar.info/
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Computes Q Criterion field.
//
////////////////////////////////////////////////////////////////////////////////
#include <string>
#include <iostream>
using namespace std;
#include "ProcessFilterForMeshing.h"
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/ParseUtils.hpp>
namespace Nektar
{
namespace Utilities
{
ModuleKey ProcessFilterForMeshing::className =
GetModuleFactory().RegisterCreatorFunction(
ModuleKey(eProcessModule, "filterformeshing"),
ProcessFilterForMeshing::create, "Extracts points for use in meshing");
ProcessFilterForMeshing::ProcessFilterForMeshing(FieldSharedPtr f)
: ProcessModule(f)
{
}
ProcessFilterForMeshing::~ProcessFilterForMeshing()
{
}
void ProcessFilterForMeshing::Process(po::variables_map &vm)
{
if (m_f->m_verbose)
{
cout << "ProcessFilterForMeshing: obtaining points for adaptive meshing..." << endl;
}
int ct = 0;
ASSERTL0(m_f->m_exp.size() == 3,"not correct number of fields");
Array<OneD, NekDouble> U = m_f->m_exp[0]->UpdatePhys();
Array<OneD, NekDouble> V = m_f->m_exp[1]->UpdatePhys();
Array<OneD, NekDouble> W = m_f->m_exp[2]->UpdatePhys();
Array<OneD, NekDouble> x(m_f->m_exp[0]->GetTotPoints()),
y(m_f->m_exp[0]->GetTotPoints()),
z(m_f->m_exp[0]->GetTotPoints());
m_f->m_exp[0]->GetCoords(x,y,z);
ofstream file;
file.open("refinment_pts.txt");
for(int i = 0; i < m_f->m_exp[0]->GetNumElmts(); i++)
{
int offset = m_f->m_exp[0]->GetPhys_Offset(i);
LocalRegions::ExpansionSharedPtr el = m_f->m_exp[0]->GetExp(i);
if(el->GetGeom()->GetShapeType() == LibUtilities::ePrism)
{
continue;
}
for(int j = 0; j < el->GetTotPoints(); j++)
{
if(fabs(U[j+offset]*U[j+offset] +
V[j+offset]*V[j+offset] +
W[j+offset]*W[j+offset] - 2.0) < 1e-2)
{
file << x[j+offset] << " " << y[j+offset] << " " << z[j+offset] << endl;
ct++;
}
}
}
file.close();
cout << ct << " points" << endl;
exit(-1);
}
}
}
////////////////////////////////////////////////////////////////////////////////
//
// File: ProcessQCriterion.h
//
// For more information, please see: http://www.nektar.info/
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Computes Q Criterion field.
//
////////////////////////////////////////////////////////////////////////////////
#ifndef UTILITIES_PREPROCESSING_FIELDCONVERT_PROCESSFILTERFORMESHING
#define UTILITIES_PREPROCESSING_FIELDCONVERT_PROCESSFILTERFORMESHING
#include "../Module.h"
namespace Nektar
{
namespace Utilities
{
/**
* @brief This processing module calculates the Q Criterion and adds it
* as an extra-field to the output file.
*/
class ProcessFilterForMeshing : public ProcessModule
{
public:
/// Creates an instance of this class
static boost::shared_ptr<Module> create(FieldSharedPtr f) {
return MemoryManager<ProcessFilterForMeshing>::AllocateSharedPtr(f);
}
static ModuleKey className;
ProcessFilterForMeshing(FieldSharedPtr f);
virtual ~ProcessFilterForMeshing();
/// Write mesh to output file.
virtual void Process(po::variables_map &vm);
};
}
}
#endif
......@@ -48,7 +48,6 @@
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <LibUtilities/Communication/CommSerial.h>
#include "../../FieldConvert/Field.hpp"
#include "InputCAD.h"
......
......@@ -61,7 +61,7 @@ public:
private:
NekDouble m_minDelta, m_maxDelta, m_eps, m_blthick;
int m_order;
string m_CADName;
std::string m_CADName;
bool m_makeBL, m_writeoctree;
};
}
......
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