diff --git a/cMake/UseLibPack8x.cmake b/cMake/UseLibPack8x.cmake index 45f3b2afeb..0008e3fe57 100644 --- a/cMake/UseLibPack8x.cmake +++ b/cMake/UseLibPack8x.cmake @@ -56,32 +56,32 @@ set(ZLIB_LIBRARIES zdll.lib) set(ZLIB_FOUND TRUE) # SMESH -set(SMESH_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/smesh) -set(SMESH_LIBRARIES - optimized StdMeshers.lib - optimized MEFISTO2.lib - optimized SMESH.lib - optimized DriverUNV.lib - optimized SMESHDS.lib - optimized NETGENPlugin.lib - optimized DriverSTL.lib - optimized DriverDAT.lib - optimized Driver.lib - optimized SMDS.lib - ) -set(SMESH_DEBUG_LIBRARIES - debug StdMeshersd.lib - debug MEFISTO2d.lib - debug SMESHd.lib - debug DriverUNVd.lib - debug SMESHDSd.lib - debug NETGENPlugind.lib - debug DriverSTLd.lib - debug DriverDATd.lib - debug Driverd.lib - debug SMDSd.lib -) -set(SMESH_FOUND TRUE) +#set(SMESH_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/smesh) +#set(SMESH_LIBRARIES +# optimized StdMeshers.lib +# optimized MEFISTO2.lib +# optimized SMESH.lib +# optimized DriverUNV.lib +# optimized SMESHDS.lib +# optimized NETGENPlugin.lib +# optimized DriverSTL.lib +# optimized DriverDAT.lib +# optimized Driver.lib +# optimized SMDS.lib +#) +#set(SMESH_DEBUG_LIBRARIES +# debug StdMeshersd.lib +# debug MEFISTO2d.lib +# debug SMESHd.lib +# debug DriverUNVd.lib +# debug SMESHDSd.lib +# debug NETGENPlugind.lib +# debug DriverSTLd.lib +# debug DriverDATd.lib +# debug Driverd.lib +# debug SMDSd.lib +#) +#set(SMESH_FOUND TRUE) # Coin3D set(COIN3D_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/coin) @@ -293,6 +293,21 @@ set(OPENCV_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/opencv) set(OPENCV_LIBRARIES cv.lib cvaux.lib cxcore.lib cxts.lib highgui.lib) set(OPENCV_FOUND TRUE) +# NGLIB (NetGen) + +set(NGLIB_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/nglib/Include) +set(NGLIB_LIBRARY_DIR + ${FREECAD_LIBPACK_DIR}/lib +) +set(NGLIB_LIBRARIES + optimized nglib +) +set(NGLIB_DEBUG_LIBRARIES + debug nglibd +) + + + # OCC set(OCC_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/OpenCascade) set(OCC_LIBRARY_DIR diff --git a/src/3rdParty/CMakeLists.txt b/src/3rdParty/CMakeLists.txt index 456c1f3253..1027fc5f5b 100644 --- a/src/3rdParty/CMakeLists.txt +++ b/src/3rdParty/CMakeLists.txt @@ -34,8 +34,6 @@ elseif(FREECAD_BUILD_GUI) endif (NOT FREECAD_USE_EXTERNAL_PIVY) endif(FREECAD_BUILD_GUI AND FREECAD_LIBPACK_CHECKFILE6X) -# For Windows we have all stuff in the LibPack -if(CMAKE_COMPILER_IS_GNUCXX) - add_subdirectory(salomesmesh) -endif(CMAKE_COMPILER_IS_GNUCXX) +# Build SalomeMesh for all Platforms since heavily patched +add_subdirectory(salomesmesh) diff --git a/src/3rdParty/salomesmesh/CMakeLists.txt b/src/3rdParty/salomesmesh/CMakeLists.txt index 6169725705..a1e3cea5f5 100644 --- a/src/3rdParty/salomesmesh/CMakeLists.txt +++ b/src/3rdParty/salomesmesh/CMakeLists.txt @@ -8,19 +8,61 @@ SET(SMESH_VERSION_TWEAK 2) CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(CMAKE_BUILD_TYPE "Release") # By default, build in release mode -SET(BUILD_SHARED_LIBS ON) +include_directories( + ${CMAKE_BINARY_DIR}/src + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_CURRENT_BINARY_DIR} + ${Boost_INCLUDE_DIRS} + ${OCC_INCLUDE_DIR} + ${NGLIB_INCLUDE_DIR} + src/SMDS + src/Driver + src/DriverUNV + src/DriverDAT + src/DriverSTL + src/StdMeshers + inc + ) + +if(MSVC) + set(SMESH_LIBS + debug MSVCRTD.LIB + debug MSVCPRTD.LIB + optimized MSVCRT.LIB + optimized MSVCPRT.LIB + Rpcrt4.lib + ${NGLIB_LIBRARIES} + ${NGLIB_DEBUG_LIBRARIES} + ${OCC_LIBRARIES} + ${OCC_DEBUG_LIBRARIES} + ${OCC_OCAF_DEBUG_LIBRARIES} + ${OCC_OCAF_LIBRARIES} + optimized TKMeshVS.lib + debug TKMeshVSd.lib + optimized TKAdvTools.lib + debug TKAdvToolsd.lib + ) +else(MSVC) + set(SMESH_LIBS + ${OCC_LIBRARIES} + ${OCC_DEBUG_LIBRARIES} + ) +endif(MSVC) + + +#SET(CMAKE_BUILD_TYPE "Release") # By default, build in release mode +#SET(BUILD_SHARED_LIBS ON) #SET(LIBRARY_OUTPUT_PATH cmake-build) SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE_DIRECTORIES(inc) +#INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +#INCLUDE_DIRECTORIES(inc) ############# # FindBoost # ############# -FIND_PACKAGE(Boost REQUIRED) -MESSAGE("-- Boost found: ${Boost_FOUND}") -INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) +#FIND_PACKAGE(Boost REQUIRED) +#MESSAGE("-- Boost found: ${Boost_FOUND}") +#INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) #MESSAGE("Popo: ${Boost_INCLUDE_DIR}") ################ @@ -32,12 +74,12 @@ INCLUDE(CMakeDetermineFortranCompiler) # OpenCASCADE include and lib location # ######################################## # Find OpenCASCADE library, set include and lib path -SET(OCC_INCLUDE_PATH ${OCC_INCLUDE_DIR}) -SET(OCC_LIB_PATH ${OCC_LIBRARY_DIR}) +#SET(OCC_INCLUDE_PATH ${OCC_INCLUDE_DIR}) +#SET(OCC_LIB_PATH ${OCC_LIBRARY_DIR}) # Tells CMake where are the required headers -INCLUDE_DIRECTORIES(${OCC_INCLUDE_PATH}) -LINK_DIRECTORIES(${OCC_LIB_PATH}) +#INCLUDE_DIRECTORIES(${OCC_INCLUDE_PATH}) +#LINK_DIRECTORIES(${OCC_LIB_PATH}) ############################ @@ -45,9 +87,9 @@ LINK_DIRECTORIES(${OCC_LIB_PATH}) ############################ IF (${CMAKE_SIZEOF_VOID_P} MATCHES "8") # It is 64bit, 32 bit systems returns 4 ADD_DEFINITIONS(-D_OCC64) - MESSAGE("-- Build 64bit") + #MESSAGE("-- Build 64bit") ELSE (${CMAKE_SIZEOF_VOID_P} MATCHES "8") - MESSAGE("-- Build 32bit") + #MESSAGE("-- Build 32bit") ENDIF(${CMAKE_SIZEOF_VOID_P} MATCHES "8") ###################################################### @@ -59,7 +101,7 @@ IF(UNIX) ELSE(UNIX) IF(WIN32) ######### Windows ########### - MESSAGE("-- Windows system detected") + #MESSAGE("-- Windows system detected") IF(MSVC) ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB /wd4290 /wd4251 /wd4018 /wd4800 /wd4996 /wd4244 /wd4806 /wd4275) ELSE(MSVC) @@ -73,141 +115,333 @@ ENDIF(UNIX) ######### # SMDS # ######### -FILE(GLOB SMDS_source_files src/SMDS/*.cpp) -INCLUDE_DIRECTORIES(src/SMDS) +FILE(GLOB SMDS_source_files src/SMDS/*.cpp inc/SMDS*.hxx) ADD_LIBRARY(SMDS SHARED ${SMDS_source_files}) -TARGET_LINK_LIBRARIES(SMDS TKernel) -IF(WIN32) - SET_TARGET_PROPERTIES(SMDS PROPERTIES COMPILE_FLAGS "-DSMDS_EXPORTS") -ENDIF(WIN32) -IF(MINGW) - SET_TARGET_PROPERTIES(SMDS PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ENDIF(MINGW) +TARGET_LINK_LIBRARIES(SMDS ${SMESH_LIBS}) + +if(MSVC) + set_target_properties(SMDS PROPERTIES COMPILE_FLAGS "-DSMDS_EXPORTS") + set_target_properties(SMDS PROPERTIES DEBUG_OUTPUT_NAME "SMDSd") + set_target_properties(SMDS PROPERTIES OUTPUT_NAME "SMDS") + set_target_properties(SMDS PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(SMDS PROPERTIES PREFIX "../") +elseif(MINGW) + set_target_properties(SMDS PROPERTIES DEBUG_OUTPUT_NAME "SMDSd") + set_target_properties(SMDS PROPERTIES OUTPUT_NAME "SMDS") + set_target_properties(SMDS PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(SMDS PROPERTIES PREFIX "") +else(MSVC) + set_target_properties(SMDS PROPERTIES OUTPUT_NAME "SMDS") + set_target_properties(SMDS PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(SMDS PROPERTIES PREFIX "") + set_target_properties(SMDS PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) ########## # Driver # ########## -FILE(GLOB Driver_source_files src/Driver/*.cpp) -INCLUDE_DIRECTORIES(src/Driver) +FILE(GLOB Driver_source_files src/Driver/*.cpp inc/Driver_*.hxx) ADD_LIBRARY(Driver SHARED ${Driver_source_files}) -IF(WIN32) - SET_TARGET_PROPERTIES(Driver PROPERTIES COMPILE_FLAGS "-DMESHDRIVER_EXPORTS") -ENDIF(WIN32) -IF(MINGW) - SET_TARGET_PROPERTIES(Driver PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ENDIF(MINGW) +TARGET_LINK_LIBRARIES(Driver ${SMESH_LIBS}) + +if(MSVC) + set_target_properties(Driver PROPERTIES COMPILE_FLAGS "-DMESHDRIVER_EXPORTS") + set_target_properties(Driver PROPERTIES DEBUG_OUTPUT_NAME "Driverd") + set_target_properties(Driver PROPERTIES OUTPUT_NAME "Driver") + set_target_properties(Driver PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(Driver PROPERTIES PREFIX "../") +elseif(MINGW) + set_target_properties(Driver PROPERTIES DEBUG_OUTPUT_NAME "Driverd") + set_target_properties(Driver PROPERTIES OUTPUT_NAME "Driver") + set_target_properties(Driver PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(Driver PROPERTIES PREFIX "") +else(MSVC) + set_target_properties(Driver PROPERTIES OUTPUT_NAME "Driver") + set_target_properties(Driver PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(Driver PROPERTIES PREFIX "") + set_target_properties(Driver PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) + + + +#IF(WIN32) +# SET_TARGET_PROPERTIES(Driver PROPERTIES COMPILE_FLAGS "-DMESHDRIVER_EXPORTS") +#ENDIF(WIN32) +#IF(MINGW) +# SET_TARGET_PROPERTIES(Driver PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#ENDIF(MINGW) ############# # DriverSTL # ############# -FILE(GLOB DriverSTL_source_files src/DriverSTL/*.cpp) -INCLUDE_DIRECTORIES(src/DriverSTL) +FILE(GLOB DriverSTL_source_files src/DriverSTL/*.cpp inc/DriverSTL*.h*) ADD_LIBRARY(DriverSTL SHARED ${DriverSTL_source_files}) -TARGET_LINK_LIBRARIES(DriverSTL TKernel TKMath Driver SMDS) -IF(WIN32) - SET_TARGET_PROPERTIES(DriverSTL PROPERTIES COMPILE_FLAGS "-DMESHDRIVERSTL_EXPORTS") -ENDIF(WIN32) -IF(MINGW) - SET_TARGET_PROPERTIES(DriverSTL PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ENDIF(MINGW) +TARGET_LINK_LIBRARIES(DriverSTL ${SMESH_LIBS} Driver SMDS) + +if(MSVC) + set_target_properties(DriverSTL PROPERTIES COMPILE_FLAGS "-DMESHDRIVERSTL_EXPORTS") + set_target_properties(DriverSTL PROPERTIES DEBUG_OUTPUT_NAME "DriverSTLd") + set_target_properties(DriverSTL PROPERTIES OUTPUT_NAME "DriverSTL") + set_target_properties(DriverSTL PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(DriverSTL PROPERTIES PREFIX "../") +elseif(MINGW) + set_target_properties(DriverSTL PROPERTIES DEBUG_OUTPUT_NAME "Driverd") + set_target_properties(DriverSTL PROPERTIES OUTPUT_NAME "DriverSTL") + set_target_properties(DriverSTL PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(DriverSTL PROPERTIES PREFIX "") +else(MSVC) + set_target_properties(DriverSTL PROPERTIES OUTPUT_NAME "DriverSTL") + set_target_properties(DriverSTL PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(DriverSTL PROPERTIES PREFIX "") + set_target_properties(DriverSTL PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) + + +#TARGET_LINK_LIBRARIES(DriverSTL TKernel TKMath Driver SMDS) +#IF(WIN32) +# SET_TARGET_PROPERTIES(DriverSTL PROPERTIES COMPILE_FLAGS "-DMESHDRIVERSTL_EXPORTS") +#ENDIF(WIN32) +#IF(MINGW) +# SET_TARGET_PROPERTIES(DriverSTL PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#ENDIF(MINGW) ############# # DriverDAT # ############# -FILE(GLOB DriverDAT_source_files src/DriverDAT/*.cpp) -INCLUDE_DIRECTORIES(src/DriverDAT) +FILE(GLOB DriverDAT_source_files src/DriverDAT/*.cpp inc/DriverDAT*.h*) ADD_LIBRARY(DriverDAT SHARED ${DriverDAT_source_files}) -TARGET_LINK_LIBRARIES(DriverDAT SMDS Driver) -IF(WIN32) - SET_TARGET_PROPERTIES(DriverDAT PROPERTIES COMPILE_FLAGS "-DMESHDRIVERDAT_EXPORTS") -ENDIF(WIN32) -IF(MINGW) - SET_TARGET_PROPERTIES(DriverDAT PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ENDIF(MINGW) +TARGET_LINK_LIBRARIES(DriverDAT ${SMESH_LIBS} SMDS Driver) + +if(MSVC) + set_target_properties(DriverDAT PROPERTIES COMPILE_FLAGS "-DMESHDRIVERDAT_EXPORTS") + set_target_properties(DriverDAT PROPERTIES DEBUG_OUTPUT_NAME "DriverDATd") + set_target_properties(DriverDAT PROPERTIES OUTPUT_NAME "DriverDAT") + set_target_properties(DriverDAT PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(DriverDAT PROPERTIES PREFIX "../") +elseif(MINGW) + set_target_properties(DriverDAT PROPERTIES DEBUG_OUTPUT_NAME "DriverDATd") + set_target_properties(DriverDAT PROPERTIES OUTPUT_NAME "DriverDAT") + set_target_properties(DriverDAT PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(DriverDAT PROPERTIES PREFIX "") +else(MSVC) + set_target_properties(DriverDAT PROPERTIES OUTPUT_NAME "DriverDAT") + set_target_properties(DriverDAT PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(DriverDAT PROPERTIES PREFIX "") + set_target_properties(DriverDAT PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) + + + +#IF(WIN32) +# SET_TARGET_PROPERTIES(DriverDAT PROPERTIES COMPILE_FLAGS "-DMESHDRIVERDAT_EXPORTS") +#ENDIF(WIN32) +#IF(MINGW) +# SET_TARGET_PROPERTIES(DriverDAT PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#ENDIF(MINGW) ############# # DriverUNV # ############# -FILE(GLOB DriverUNV_source_files src/DriverUNV/*.cpp) -INCLUDE_DIRECTORIES(src/DriverUNV) +FILE(GLOB DriverUNV_source_files src/DriverUNV/*.cpp inc/DriverUNV*.h*) ADD_LIBRARY(DriverUNV SHARED ${DriverUNV_source_files}) -TARGET_LINK_LIBRARIES(DriverUNV SMDS Driver) -IF(WIN32) - SET_TARGET_PROPERTIES(DriverUNV PROPERTIES COMPILE_FLAGS "-DMESHDRIVERUNV_EXPORTS") -ENDIF(WIN32) -IF(MINGW) - SET_TARGET_PROPERTIES(DriverUNV PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ENDIF(MINGW) +TARGET_LINK_LIBRARIES(DriverUNV ${SMESH_LIBS} SMESHDS SMDS Driver) + +if(MSVC) + set_target_properties(DriverUNV PROPERTIES COMPILE_FLAGS "-DMESHDRIVERUNV_EXPORTS") + set_target_properties(DriverUNV PROPERTIES DEBUG_OUTPUT_NAME "DriverUNVd") + set_target_properties(DriverUNV PROPERTIES OUTPUT_NAME "DriverUNV") + set_target_properties(DriverUNV PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(DriverUNV PROPERTIES PREFIX "../") +elseif(MINGW) + set_target_properties(DriverUNV PROPERTIES DEBUG_OUTPUT_NAME "DriverUNVd") + set_target_properties(DriverUNV PROPERTIES OUTPUT_NAME "DriverUNV") + set_target_properties(DriverUNV PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(DriverUNV PROPERTIES PREFIX "") +else(MSVC) + set_target_properties(DriverUNV PROPERTIES OUTPUT_NAME "DriverUNV") + set_target_properties(DriverUNV PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(DriverUNV PROPERTIES PREFIX "") + set_target_properties(DriverUNV PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) + + + +#IF(WIN32) +# SET_TARGET_PROPERTIES(DriverUNV PROPERTIES COMPILE_FLAGS "-DMESHDRIVERUNV_EXPORTS") +#ENDIF(WIN32) +#IF(MINGW) +# SET_TARGET_PROPERTIES(DriverUNV PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#ENDIF(MINGW) ########### # SMESHDS # ########### -FILE(GLOB SMESHDS_source_files src/SMESHDS/*.cpp) -INCLUDE_DIRECTORIES(src/SMESHDS) +FILE(GLOB SMESHDS_source_files src/SMESHDS/*.cpp inc/SMESHDS_*.h*) ADD_LIBRARY(SMESHDS SHARED ${SMESHDS_source_files}) -TARGET_LINK_LIBRARIES(SMESHDS SMDS TKernel TKMath TKBRep) -IF(MINGW) - SET_TARGET_PROPERTIES(SMESHDS PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ENDIF(MINGW) +TARGET_LINK_LIBRARIES(SMESHDS ${SMESH_LIBS} SMDS ) + +if(MSVC) + set_target_properties(SMESHDS PROPERTIES DEBUG_OUTPUT_NAME "SMESHDSd") + set_target_properties(SMESHDS PROPERTIES OUTPUT_NAME "SMESHDS") + set_target_properties(SMESHDS PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(SMESHDS PROPERTIES PREFIX "../") +elseif(MINGW) + set_target_properties(SMESHDS PROPERTIES DEBUG_OUTPUT_NAME "SMESHDSd") + set_target_properties(SMESHDS PROPERTIES OUTPUT_NAME "SMESHDS") + set_target_properties(SMESHDS PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(SMESHDS PROPERTIES PREFIX "") +else(MSVC) + set_target_properties(SMESHDS PROPERTIES OUTPUT_NAME "SMESHDS") + set_target_properties(SMESHDS PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(SMESHDS PROPERTIES PREFIX "") + set_target_properties(SMESHDS PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) + + + +#IF(MINGW) +# SET_TARGET_PROPERTIES(SMESHDS PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#ENDIF(MINGW) ######### # SMESH # ######### -FILE(GLOB SMESH_source_files src/SMESH/*.cpp src/Controls/*.cpp) -INCLUDE_DIRECTORIES(src/SMESH) +FILE(GLOB SMESH_source_files src/SMESH/*.cpp src/Controls/*.cpp inc/SMESH_*.h*) ADD_LIBRARY(SMESH SHARED ${SMESH_source_files}) -TARGET_LINK_LIBRARIES(SMESH SMDS SMESHDS TKernel TKMath TKG2d TKG3d TKMeshVS - TKPrim TKGeomBase TKGeomAlgo TKBRep TKTopAlgo TKShHealing - Driver DriverSTL DriverDAT DriverUNV) -IF(WIN32) - SET_TARGET_PROPERTIES(SMESH PROPERTIES COMPILE_FLAGS "-DSMESHimpl_EXPORTS -DSMESHCONTROLS_EXPORTS") -ENDIF(WIN32) -IF(MINGW) - SET_TARGET_PROPERTIES(SMESH PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ENDIF(MINGW) +TARGET_LINK_LIBRARIES(SMESH SMDS SMESHDS Driver DriverSTL DriverDAT DriverUNV ${SMESH_LIBS}) + +if(MSVC) + set_target_properties(SMESH PROPERTIES COMPILE_FLAGS "-DSMESH_EXPORTS -DSMESHCONTROLS_EXPORTS -DSMESHimpl_EXPORTS") + set_target_properties(SMESH PROPERTIES DEBUG_OUTPUT_NAME "SMESHd") + set_target_properties(SMESH PROPERTIES OUTPUT_NAME "SMESH") + set_target_properties(SMESH PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(SMESH PROPERTIES PREFIX "../") +elseif(MINGW) + set_target_properties(SMESH PROPERTIES DEBUG_OUTPUT_NAME "SMESHd") + set_target_properties(SMESH PROPERTIES OUTPUT_NAME "SMESH") + set_target_properties(SMESH PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(SMESH PROPERTIES PREFIX "") +else(MSVC) + set_target_properties(SMESH PROPERTIES OUTPUT_NAME "SMESH") + set_target_properties(SMESH PROPERTIES PREFIX "") + set_target_properties(SMESH PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) + + +#IF(WIN32) +# SET_TARGET_PROPERTIES(SMESH PROPERTIES COMPILE_FLAGS "-DSMESHimpl_EXPORTS -DSMESHCONTROLS_EXPORTS") +#ENDIF(WIN32) +#IF(MINGW) +# SET_TARGET_PROPERTIES(SMESH PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#ENDIF(MINGW) + + +############## +# MEFISTO2 # +############## +FILE(GLOB MEFISTO2_source_files + src/MEFISTO2/*.cpp + src/MEFISTO2/MEFISTO2F.def + inc/Rn.h + inc/aptrte.h + ) + +ADD_LIBRARY(MEFISTO2 SHARED ${MEFISTO2_source_files}) + +if(MSVC) + TARGET_LINK_LIBRARIES(MEFISTO2 ${SMESH_LIBS} MEFISTO2f.lib) # in case of Windows link the prebuild Fortran lib + set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "-DMEFISTO2D_EXPORTS -D__WATCOM__") + set_target_properties(MEFISTO2 PROPERTIES DEBUG_OUTPUT_NAME "MEFISTO2d") + set_target_properties(MEFISTO2 PROPERTIES OUTPUT_NAME "MEFISTO2") + set_target_properties(MEFISTO2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(MEFISTO2 PROPERTIES PREFIX "../") +elseif(MINGW) + TARGET_LINK_LIBRARIES(MEFISTO2 ${SMESH_LIBS}) + set_target_properties(MEFISTO2 PROPERTIES DEBUG_OUTPUT_NAME "MEFISTO2d") + set_target_properties(MEFISTO2 PROPERTIES OUTPUT_NAME "MEFISTO2") + set_target_properties(MEFISTO2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(MEFISTO2 PROPERTIES PREFIX "") +else(MSVC) + TARGET_LINK_LIBRARIES(MEFISTO2 ${SMESH_LIBS} gfortran) + set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "${MEFISTO2_CFLAGS}") + set_target_properties(MEFISTO2 PROPERTIES OUTPUT_NAME "MEFISTO2") + set_target_properties(MEFISTO2 PROPERTIES PREFIX "") + set_target_properties(MEFISTO2 PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) + ############## # StdMeshers # ############## -FILE(GLOB StdMeshers_source_files src/StdMeshers/*.cpp src/MEFISTO2/*.cpp src/MEFISTO2/trte.f) -INCLUDE_DIRECTORIES(src/StdMeshers) - +FILE(GLOB StdMeshers_source_files src/StdMeshers/*.cpp inc/StdMeshers_*.h*) ADD_LIBRARY(StdMeshers SHARED ${StdMeshers_source_files}) -TARGET_LINK_LIBRARIES(StdMeshers SMESH TKernel TKMath TKAdvTools gfortran) -SET(StdMeshers_CFLAGS "") -IF(WIN32) - SET(StdMeshers_CFLAGS "-DSTDMESHERS_EXPORTS -DMEFISTO2D_EXPORTS") -ENDIF(WIN32) -# special compiler flag for g++ 64-bit -IF (${CMAKE_SIZEOF_VOID_P} MATCHES "8") - IF(CMAKE_COMPILER_IS_GNUCXX) - SET(StdMeshers_CFLAGS "${StdMeshers_CFLAGS} -DPCLINUX64") - ENDIF(CMAKE_COMPILER_IS_GNUCXX) -ENDIF(${CMAKE_SIZEOF_VOID_P} MATCHES "8") -SET_TARGET_PROPERTIES(StdMeshers PROPERTIES COMPILE_FLAGS "${StdMeshers_CFLAGS}") -IF(MINGW) - SET_TARGET_PROPERTIES(StdMeshers PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ENDIF(MINGW) -########### -# INSTALL # -########### +if(MSVC) + TARGET_LINK_LIBRARIES(StdMeshers SMESH ${SMESH_LIBS} MEFISTO2) + set_target_properties(StdMeshers PROPERTIES COMPILE_FLAGS "-DSTDMESHERS_EXPORTS") + set_target_properties(StdMeshers PROPERTIES DEBUG_OUTPUT_NAME "StdMeshersd") + set_target_properties(StdMeshers PROPERTIES OUTPUT_NAME "StdMeshers") + set_target_properties(StdMeshers PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(StdMeshers PROPERTIES PREFIX "../") +elseif(MINGW) + TARGET_LINK_LIBRARIES(StdMeshers SMESH ${SMESH_LIBS}) + set_target_properties(StdMeshers PROPERTIES DEBUG_OUTPUT_NAME "StdMeshersd") + set_target_properties(StdMeshers PROPERTIES OUTPUT_NAME "StdMeshers") + set_target_properties(StdMeshers PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(StdMeshers PROPERTIES PREFIX "") +else(MSVC) +TARGET_LINK_LIBRARIES(StdMeshers SMESH ${SMESH_LIBS} gfortran) + # special compiler flag for g++ 64-bit + IF (${CMAKE_SIZEOF_VOID_P} MATCHES "8") + IF(CMAKE_COMPILER_IS_GNUCXX) + SET(StdMeshers_CFLAGS "${StdMeshers_CFLAGS} -DPCLINUX64") + ENDIF(CMAKE_COMPILER_IS_GNUCXX) + ENDIF(${CMAKE_SIZEOF_VOID_P} MATCHES "8") + set_target_properties(StdMeshers PROPERTIES COMPILE_FLAGS "${StdMeshers_CFLAGS}") + set_target_properties(StdMeshers PROPERTIES OUTPUT_NAME "StdMeshers") + set_target_properties(StdMeshers PROPERTIES PREFIX "") + set_target_properties(StdMeshers PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) + +#SET(StdMeshers_CFLAGS "") +#IF(WIN32) +# SET(StdMeshers_CFLAGS "-DSTDMESHERS_EXPORTS -DMEFISTO2D_EXPORTS") +#ENDIF(WIN32) +#IF(MINGW) +# SET_TARGET_PROPERTIES(StdMeshers PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#ENDIF(MINGW) + +################ +# NETGENPlugin # +################ +FILE(GLOB NETGENPlugin_source_files src/NETGENPlugin/*.cpp inc/NETGENPlugin_*.h* ) +ADD_LIBRARY(NETGENPlugin SHARED ${NETGENPlugin_source_files}) +TARGET_LINK_LIBRARIES(NETGENPlugin SMDS SMESHD SMESH StdMeshers ${SMESH_LIBS} ) + +if(MSVC) + set_target_properties(NETGENPlugin PROPERTIES COMPILE_FLAGS "-DNETGENPLUGIN_EXPORTS -DNO_PARALLEL_THREADS -DOCCGEOMETRY") + set_target_properties(NETGENPlugin PROPERTIES DEBUG_OUTPUT_NAME "NETGENPlugind") + set_target_properties(NETGENPlugin PROPERTIES OUTPUT_NAME "NETGENPlugin") + set_target_properties(NETGENPlugin PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(NETGENPlugin PROPERTIES PREFIX "../") +elseif(MINGW) + set_target_properties(NETGENPlugin PROPERTIES DEBUG_OUTPUT_NAME "NETGENPlugind") + set_target_properties(NETGENPlugin PROPERTIES OUTPUT_NAME "NETGENPlugin") + set_target_properties(NETGENPlugin PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_target_properties(NETGENPlugin PROPERTIES PREFIX "") +else(MSVC) + set_target_properties(NETGENPlugin PROPERTIES OUTPUT_NAME "NETGENPlugin") + set_target_properties(NETGENPlugin PROPERTIES PREFIX "") + set_target_properties(NETGENPlugin PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/bin) +endif(MSVC) + + +#IF(WIN32) +# SET_TARGET_PROPERTIES(SMESH PROPERTIES COMPILE_FLAGS "-DNETGENPluginimpl_EXPORTS ") +#ENDIF(WIN32) +#IF(MINGW) +# SET_TARGET_PROPERTIES(SMESH PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#ENDIF(MINGW) + -# Path name install: for instance, SMESH-5.1.2.7 -SET(INSTALL_PATH_NAME SMESH-${SMESH_VERSION_MAJOR}.${SMESH_VERSION_MINOR}.${SMESH_VERSION_PATCH}.${SMESH_VERSION_TWEAK}) -IF(UNIX) - SET_TARGET_PROPERTIES(SMDS Driver DriverSTL DriverDAT DriverUNV - SMESHDS SMESH StdMeshers - PROPERTIES INSTALL_RPATH ${INSTALL_RPATH}) - # Libraries are installed by default in /usr/local/lib/SMESH-5.1.2.7 - INSTALL(TARGETS SMDS Driver DriverSTL DriverDAT DriverUNV - SMESHDS SMESH StdMeshers - DESTINATION lib - ) - # Headers are installed by default in /usr/local/include/SMESH-5.1.2.7 - INSTALL(DIRECTORY inc/ - DESTINATION include - FILES_MATCHING PATTERN "*.h*" - ) -ENDIF(UNIX) diff --git a/src/3rdParty/salomesmesh/inc/Driver_Mesh.h b/src/3rdParty/salomesmesh/inc/Driver_Mesh.h index 94d03ad5eb..9840ed0346 100644 --- a/src/3rdParty/salomesmesh/inc/Driver_Mesh.h +++ b/src/3rdParty/salomesmesh/inc/Driver_Mesh.h @@ -29,7 +29,7 @@ #include #ifdef WNT - #if defined MESHDRIVER_EXPORTS || defined MeshDriver_EXPORTS + #if defined MESHDRIVER_EXPORTS #define MESHDRIVER_EXPORT __declspec( dllexport ) #else #define MESHDRIVER_EXPORT __declspec( dllimport ) diff --git a/src/3rdParty/salomesmesh/inc/OpUtil.hxx b/src/3rdParty/salomesmesh/inc/OpUtil.hxx deleted file mode 100644 index 7d372e7953..0000000000 --- a/src/3rdParty/salomesmesh/inc/OpUtil.hxx +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _OpUtil_HXX_ -#define _OpUtil_HXX_ - -#endif diff --git a/src/3rdParty/salomesmesh/inc/SMDSAbs_ElementType.hxx b/src/3rdParty/salomesmesh/inc/SMDSAbs_ElementType.hxx index 1ffad0d928..2a5d8e3ba5 100644 --- a/src/3rdParty/salomesmesh/inc/SMDSAbs_ElementType.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDSAbs_ElementType.hxx @@ -22,7 +22,7 @@ // SMESH SMDS : implementaion of Salome mesh data structure // File : SMDSAbs_ElementType.hxx // Module : SMESH - +// #ifndef _SMDSAbs_ElementType_HeaderFile #define _SMDSAbs_ElementType_HeaderFile @@ -30,34 +30,33 @@ /// Type (node, edge, face or volume) of elements /////////////////////////////////////////////////////////////////////////////// enum SMDSAbs_ElementType - { - SMDSAbs_All, - SMDSAbs_Node, - SMDSAbs_Edge, - SMDSAbs_Face, - SMDSAbs_Volume, - SMDSAbs_0DElement, - SMDSAbs_NbElementTypes - }; +{ + SMDSAbs_All, + SMDSAbs_Node, + SMDSAbs_Edge, + SMDSAbs_Face, + SMDSAbs_Volume, + SMDSAbs_NbElementTypes +}; /*! enumeration for element geometry type */ enum SMDSAbs_GeometryType - { - // 0D element - SMDSGeom_POINT, - // 1D element - SMDSGeom_EDGE, - // 2D element - SMDSGeom_TRIANGLE, - SMDSGeom_QUADRANGLE, - SMDSGeom_POLYGON, - // 3D element - SMDSGeom_TETRA, - SMDSGeom_PYRAMID, - SMDSGeom_HEXA, - SMDSGeom_PENTA, - SMDSGeom_POLYHEDRA, - }; +{ + // 0D element + SMDSGeom_POINT, + // 1D element + SMDSGeom_EDGE, + // 2D element + SMDSGeom_TRIANGLE, + SMDSGeom_QUADRANGLE, + SMDSGeom_POLYGON, + // 3D element + SMDSGeom_TETRA, + SMDSGeom_PYRAMID, + SMDSGeom_HEXA, + SMDSGeom_PENTA, + SMDSGeom_POLYHEDRA, +}; enum SMDSAbs_ElementOrder { @@ -66,32 +65,4 @@ enum SMDSAbs_ElementOrder { ORDER_QUADRATIC /*! entities of 2nd order */ }; -/*! - * Enumeration of entity type uses in mesh info array, - * and should be synchronised with enum in SMDS - */ -enum SMDSAbs_EntityType { - SMDSEntity_Node, - SMDSEntity_0D, - SMDSEntity_Edge, - SMDSEntity_Quad_Edge, - SMDSEntity_Triangle, - SMDSEntity_Quad_Triangle, - SMDSEntity_Quadrangle, - SMDSEntity_Quad_Quadrangle, - SMDSEntity_Polygon, - SMDSEntity_Quad_Polygon, - SMDSEntity_Tetra, - SMDSEntity_Quad_Tetra, - SMDSEntity_Pyramid, - SMDSEntity_Quad_Pyramid, - SMDSEntity_Hexa, - SMDSEntity_Quad_Hexa, - SMDSEntity_Penta, - SMDSEntity_Quad_Penta, - SMDSEntity_Polyhedra, - SMDSEntity_Quad_Polyhedra, - SMDSEntity_Last -}; - #endif diff --git a/src/3rdParty/salomesmesh/inc/SMDS_ElemIterator.hxx b/src/3rdParty/salomesmesh/inc/SMDS_ElemIterator.hxx index 936fd2686d..511426e5d8 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_ElemIterator.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_ElemIterator.hxx @@ -22,9 +22,9 @@ // SMESH SMDS : implementaion of Salome mesh data structure // File : SMDS_MeshElement.hxx // Module : SMESH -// Created: 12.01.05 18:02:52 -// Author: Michael Sazonov - +// Created: 12.01.05 18:02:52 +// Author: Michael Sazonov +// #ifndef SMDS_ElemIterator_HeaderFile #define SMDS_ElemIterator_HeaderFile @@ -33,7 +33,6 @@ class SMDS_MeshElement; class SMDS_MeshNode; -class SMDS_Mesh0DElement; class SMDS_MeshEdge; class SMDS_MeshFace; class SMDS_MeshVolume; @@ -44,9 +43,6 @@ typedef boost::shared_ptr > SMDS_ElemIte typedef SMDS_Iterator SMDS_NodeIterator; typedef boost::shared_ptr > SMDS_NodeIteratorPtr; -typedef SMDS_Iterator SMDS_0DElementIterator; -typedef boost::shared_ptr > SMDS_0DElementIteratorPtr; - typedef SMDS_Iterator SMDS_EdgeIterator; typedef boost::shared_ptr > SMDS_EdgeIteratorPtr; diff --git a/src/3rdParty/salomesmesh/inc/SMDS_FaceOfEdges.hxx b/src/3rdParty/salomesmesh/inc/SMDS_FaceOfEdges.hxx index cd65213983..27cfe59e4c 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_FaceOfEdges.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_FaceOfEdges.hxx @@ -46,7 +46,6 @@ class SMDS_EXPORT SMDS_FaceOfEdges:public SMDS_MeshFace const SMDS_MeshEdge* edge4); SMDSAbs_ElementType GetType() const; - virtual SMDSAbs_EntityType GetEntityType() const; int NbNodes() const; int NbEdges() const; int NbFaces() const; diff --git a/src/3rdParty/salomesmesh/inc/SMDS_FaceOfNodes.hxx b/src/3rdParty/salomesmesh/inc/SMDS_FaceOfNodes.hxx index c00511851b..018d5778ac 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_FaceOfNodes.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_FaceOfNodes.hxx @@ -56,8 +56,6 @@ class SMDS_EXPORT SMDS_FaceOfNodes:public SMDS_MeshFace */ virtual const SMDS_MeshNode* GetNode(const int ind) const; - virtual SMDSAbs_EntityType GetEntityType() const; - protected: SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const; diff --git a/src/3rdParty/salomesmesh/inc/SMDS_Mesh.hxx b/src/3rdParty/salomesmesh/inc/SMDS_Mesh.hxx index 450146a002..bb6b9f0826 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_Mesh.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_Mesh.hxx @@ -22,14 +22,13 @@ // SMESH SMDS : implementaion of Salome mesh data structure // File : SMDS_Mesh.hxx // Module : SMESH - +// #ifndef _SMDS_Mesh_HeaderFile #define _SMDS_Mesh_HeaderFile #include "SMESH_SMDS.hxx" #include "SMDS_MeshNode.hxx" -#include "SMDS_Mesh0DElement.hxx" #include "SMDS_MeshEdge.hxx" #include "SMDS_MeshFace.hxx" #include "SMDS_MeshVolume.hxx" @@ -44,64 +43,59 @@ class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{ public: - + SMDS_Mesh(); - + SMDS_NodeIteratorPtr nodesIterator() const; - SMDS_0DElementIteratorPtr elements0dIterator() const; SMDS_EdgeIteratorPtr edgesIterator() const; SMDS_FaceIteratorPtr facesIterator() const; SMDS_VolumeIteratorPtr volumesIterator() const; - SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type=SMDSAbs_All) const; - + SMDS_ElemIteratorPtr elementsIterator() const; + SMDSAbs_ElementType GetElementType( const int id, const bool iselem ) const; SMDS_Mesh *AddSubMesh(); - + virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID); virtual SMDS_MeshNode* AddNode(double x, double y, double z); - - virtual SMDS_Mesh0DElement* Add0DElementWithID(int n, int ID); - virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * n, int ID); - virtual SMDS_Mesh0DElement* Add0DElement (const SMDS_MeshNode * n); - + virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID); virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - int ID); + const SMDS_MeshNode * n2, + int ID); virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2); - + const SMDS_MeshNode * n2); + // 2d order edge with 3 nodes: n12 - node between n1 and n2 virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID); virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n12, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n12, + int ID); virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1, const SMDS_MeshNode * n2, const SMDS_MeshNode * n12); virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID); virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + int ID); virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3); - + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3); + virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID); virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + int ID); virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4); - + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4); + virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1, const SMDS_MeshEdge * e2, const SMDS_MeshEdge * e3, int ID); @@ -122,100 +116,100 @@ public: virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n12,int n23,int n31, int ID); virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n31, + int ID); virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31); + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n31); // 2d order quadrangle virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int n12,int n23,int n34,int n41, int ID); virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n34, + const SMDS_MeshNode * n41, + int ID); virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41); + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n34, + const SMDS_MeshNode * n41); virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4); - + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4); + virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5); - + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5); + virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6); - + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6); + virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1, const SMDS_MeshFace * f2, @@ -255,24 +249,24 @@ public: int n12,int n23,int n31, int n14,int n24,int n34, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, - const SMDS_MeshNode * n14, - const SMDS_MeshNode * n24, - const SMDS_MeshNode * n34, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n31, + const SMDS_MeshNode * n14, + const SMDS_MeshNode * n24, + const SMDS_MeshNode * n34, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n31, - const SMDS_MeshNode * n14, + const SMDS_MeshNode * n14, const SMDS_MeshNode * n24, const SMDS_MeshNode * n34); @@ -282,28 +276,28 @@ public: int n15,int n25,int n35,int n45, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, - const SMDS_MeshNode * n15, - const SMDS_MeshNode * n25, - const SMDS_MeshNode * n35, - const SMDS_MeshNode * n45, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n34, + const SMDS_MeshNode * n41, + const SMDS_MeshNode * n15, + const SMDS_MeshNode * n25, + const SMDS_MeshNode * n35, + const SMDS_MeshNode * n45, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, + const SMDS_MeshNode * n41, const SMDS_MeshNode * n15, const SMDS_MeshNode * n25, const SMDS_MeshNode * n35, @@ -317,33 +311,33 @@ public: int n14,int n25,int n36, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, - const SMDS_MeshNode * n45, - const SMDS_MeshNode * n56, - const SMDS_MeshNode * n64, - const SMDS_MeshNode * n14, - const SMDS_MeshNode * n25, - const SMDS_MeshNode * n36, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n31, + const SMDS_MeshNode * n45, + const SMDS_MeshNode * n56, + const SMDS_MeshNode * n64, + const SMDS_MeshNode * n14, + const SMDS_MeshNode * n25, + const SMDS_MeshNode * n36, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, + const SMDS_MeshNode * n31, const SMDS_MeshNode * n45, const SMDS_MeshNode * n56, - const SMDS_MeshNode * n64, + const SMDS_MeshNode * n64, const SMDS_MeshNode * n14, const SMDS_MeshNode * n25, const SMDS_MeshNode * n36); @@ -356,42 +350,42 @@ public: int n15,int n26,int n37,int n48, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, - const SMDS_MeshNode * n56, - const SMDS_MeshNode * n67, - const SMDS_MeshNode * n78, - const SMDS_MeshNode * n85, - const SMDS_MeshNode * n15, - const SMDS_MeshNode * n26, - const SMDS_MeshNode * n37, - const SMDS_MeshNode * n48, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n34, + const SMDS_MeshNode * n41, + const SMDS_MeshNode * n56, + const SMDS_MeshNode * n67, + const SMDS_MeshNode * n78, + const SMDS_MeshNode * n85, + const SMDS_MeshNode * n15, + const SMDS_MeshNode * n26, + const SMDS_MeshNode * n37, + const SMDS_MeshNode * n48, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, + const SMDS_MeshNode * n41, const SMDS_MeshNode * n56, const SMDS_MeshNode * n67, const SMDS_MeshNode * n78, - const SMDS_MeshNode * n85, + const SMDS_MeshNode * n85, const SMDS_MeshNode * n15, const SMDS_MeshNode * n26, const SMDS_MeshNode * n37, @@ -422,10 +416,9 @@ public: virtual void RemoveElement(const SMDS_MeshElement * elem, std::list& removedElems, std::list& removedNodes, - bool removenodes = false); + bool removenodes = false); virtual void RemoveElement(const SMDS_MeshElement * elem, bool removenodes = false); virtual void RemoveNode(const SMDS_MeshNode * node); - virtual void Remove0DElement(const SMDS_Mesh0DElement * elem0d); virtual void RemoveEdge(const SMDS_MeshEdge * edge); virtual void RemoveFace(const SMDS_MeshFace * face); virtual void RemoveVolume(const SMDS_MeshVolume * volume); @@ -437,7 +430,7 @@ public: virtual void RemoveFreeElement(const SMDS_MeshElement * elem); virtual void Clear(); - + virtual bool RemoveFromParent(); virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh); @@ -452,7 +445,6 @@ public: // Renumber all nodes or elements. const SMDS_MeshNode *FindNode(int idnode) const; - const SMDS_Mesh0DElement* Find0DElement(int idnode) const; const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const; const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2, int idnode3) const; const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const; @@ -462,7 +454,6 @@ public: const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4, int idnode5, int idnode6, int idnode7, int idnode8) const; const SMDS_MeshElement *FindElement(int IDelem) const; - static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n); static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1, const SMDS_MeshNode * n2); static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1, @@ -508,13 +499,11 @@ public: const SMDS_MeshInfo& GetMeshInfo() const { return myInfo; } int NbNodes() const; - int Nb0DElements() const; int NbEdges() const; int NbFaces() const; int NbVolumes() const; int NbSubMesh() const; void DumpNodes() const; - void Dump0DElements() const; void DumpEdges() const; void DumpFaces() const; void DumpVolumes() const; @@ -538,7 +527,6 @@ public: bool Contains (const SMDS_MeshElement* elem) const; typedef NCollection_Map SetOfNodes; - typedef NCollection_Map SetOf0DElements; typedef NCollection_Map SetOfEdges; typedef NCollection_Map SetOfFaces; typedef NCollection_Map SetOfVolumes; @@ -546,34 +534,32 @@ public: private: SMDS_Mesh(SMDS_Mesh * parent); - SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2, - const SMDS_MeshNode * node3); + SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1, + const SMDS_MeshNode * node2, + const SMDS_MeshNode * node3); SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2, - const SMDS_MeshNode * node3, - const SMDS_MeshNode * node4); - SMDS_Mesh0DElement* Find0DElementOrCreate(const SMDS_MeshNode * n); + const SMDS_MeshNode * node2, + const SMDS_MeshNode * node3, + const SMDS_MeshNode * node4); SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2); + const SMDS_MeshNode * n2); SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1, - const SMDS_MeshNode *n2, - const SMDS_MeshNode *n3); + const SMDS_MeshNode *n2, + const SMDS_MeshNode *n3); SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1, - const SMDS_MeshNode *n2, - const SMDS_MeshNode *n3, - const SMDS_MeshNode *n4); + const SMDS_MeshNode *n2, + const SMDS_MeshNode *n3, + const SMDS_MeshNode *n4); bool registerElement(int ID, SMDS_MeshElement * element); - void addChildrenWithNodes(std::set& setOfChildren, - const SMDS_MeshElement * element, - std::set& nodes); + void addChildrenWithNodes(std::set& setOfChildren, + const SMDS_MeshElement * element, + std::set& nodes); // Fields PRIVATE - + SetOfNodes myNodes; - SetOf0DElements my0DElements; SetOfEdges myEdges; SetOfFaces myFaces; SetOfVolumes myVolumes; diff --git a/src/3rdParty/salomesmesh/inc/SMDS_Mesh0DElement.hxx b/src/3rdParty/salomesmesh/inc/SMDS_Mesh0DElement.hxx deleted file mode 100644 index b1be0b28fe..0000000000 --- a/src/3rdParty/salomesmesh/inc/SMDS_Mesh0DElement.hxx +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMDS : implementaion of Salome mesh data structure -// File : SMDS_Mesh0DElement.hxx -// Module : SMESH - -#ifndef _SMDS_Mesh0DElement_HeaderFile -#define _SMDS_Mesh0DElement_HeaderFile - -#include "SMESH_SMDS.hxx" - -#include "SMDS_MeshElement.hxx" - -#include - -class SMDS_EXPORT SMDS_Mesh0DElement: public SMDS_MeshElement -{ - public: - SMDS_Mesh0DElement (const SMDS_MeshNode * node); - bool ChangeNode (const SMDS_MeshNode * node); - void Print (std::ostream & OS) const; - - SMDSAbs_ElementType GetType() const; - SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_0D;} - int NbNodes() const; - int NbEdges() const; - friend bool operator< (const SMDS_Mesh0DElement& e1, const SMDS_Mesh0DElement& e2); - - /*! - * \brief Return node by its index - * \param ind - node index - * \retval const SMDS_MeshNode* - the node - */ - virtual const SMDS_MeshNode* GetNode (const int ind) const; - - protected: - SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const; - - protected: - const SMDS_MeshNode* myNode; -}; - -#endif diff --git a/src/3rdParty/salomesmesh/inc/SMDS_MeshEdge.hxx b/src/3rdParty/salomesmesh/inc/SMDS_MeshEdge.hxx index c0108c2e4d..84998e1294 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_MeshEdge.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_MeshEdge.hxx @@ -41,8 +41,7 @@ class SMDS_EXPORT SMDS_MeshEdge:public SMDS_MeshElement const SMDS_MeshNode * node2); void Print(std::ostream & OS) const; - virtual SMDSAbs_ElementType GetType() const; - virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Edge; } + SMDSAbs_ElementType GetType() const; int NbNodes() const; int NbEdges() const; friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2); diff --git a/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx b/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx index 5b52efbf71..13498092ab 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx @@ -64,8 +64,6 @@ public: virtual SMDSAbs_ElementType GetType() const = 0; virtual bool IsPoly() const { return false; }; virtual bool IsQuadratic() const; - //! Return type of entity - virtual SMDSAbs_EntityType GetEntityType() const = 0; virtual bool IsMediumNode(const SMDS_MeshNode* node) const; diff --git a/src/3rdParty/salomesmesh/inc/SMDS_MeshInfo.hxx b/src/3rdParty/salomesmesh/inc/SMDS_MeshInfo.hxx index 539fe67d78..b92c857dba 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_MeshInfo.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_MeshInfo.hxx @@ -26,11 +26,6 @@ #ifndef SMDS_MeshInfo_HeaderFile #define SMDS_MeshInfo_HeaderFile -#ifdef __BORLANDC__ -#pragma warn -8066 -#pragma warn -8012 -#endif - using namespace std; #include "SMESH_SMDS.hxx" @@ -45,10 +40,7 @@ public: inline void Clear(); int NbNodes() const { return myNbNodes; } - inline int NbElements(SMDSAbs_ElementType type=SMDSAbs_All) const; - inline int NbEntities(SMDSAbs_EntityType type) const; - int Nb0DElements() const { return myNb0DElements; } inline int NbEdges (SMDSAbs_ElementOrder order = ORDER_ANY) const; inline int NbFaces (SMDSAbs_ElementOrder order = ORDER_ANY) const; inline int NbTriangles (SMDSAbs_ElementOrder order = ORDER_ANY) const; @@ -68,7 +60,7 @@ private: // methods to count NOT POLY elements inline void remove(const SMDS_MeshElement* el); inline void add (const SMDS_MeshElement* el); - inline int index(SMDSAbs_ElementType type, int nbNodes) const; + inline int index(SMDSAbs_ElementType type, int nbNodes); // methods to remove elements of ANY kind inline void RemoveEdge(const SMDS_MeshElement* el); inline void RemoveFace(const SMDS_MeshElement* el); @@ -76,7 +68,6 @@ private: int myNbNodes; - int myNb0DElements; int myNbEdges , myNbQuadEdges ; int myNbTriangles , myNbQuadTriangles ; int myNbQuadrangles, myNbQuadQuadrangles; @@ -94,7 +85,6 @@ private: inline SMDS_MeshInfo::SMDS_MeshInfo(): myNbNodes(0), - myNb0DElements(0), myNbEdges (0), myNbQuadEdges (0), myNbTriangles (0), myNbQuadTriangles (0), myNbQuadrangles(0), myNbQuadQuadrangles(0), @@ -106,47 +96,40 @@ inline SMDS_MeshInfo::SMDS_MeshInfo(): myNbPolyhedrons(0) { // Number of nodes in standard element types - // n v f e 0 n - // o o a d d o - // d l c g d - // e e e e - // s - // ----------------- - // 0 * - // 1 . * + // n v f e + // o o a d + // d l c g + // e e e + // ----------- + // 1 // 2 * - // 3 . * - // 4 * . . - // 5 * - // 6 * . - // 7 - // 8 * . - // 9 - // 10 * - // 11 * - // 12 * - // 13 * - // 14 * - // 15 * - // 16 * - // 17 - // 18 - // 19 + // 3 * + // 4 * * * + // 5 * + // 6 * * + // 7 + // 8 * * + // 9 + // 10 * + // 11 + // 12 + // 13 * + // 14 + // 15 * + // 16 + // 17 + // 18 + // 19 // 20 * // // So to have a unique index for each type basing on nb of nodes, we use a shift: - myShift.resize(SMDSAbs_NbElementTypes, 0); - - myShift[ SMDSAbs_Face ] = +8; // 3->11, 4->12, 6->14, 8->16 - myShift[ SMDSAbs_Edge ] = -2; // 2->0, 4->2 - myShift[ SMDSAbs_0DElement ] = +2; // 1->3 + myShift.resize(SMDSAbs_Volume + 1, 0); + myShift[ SMDSAbs_Face ] = +8; // 3->11, 4->12, 6->14, 8->16 + myShift[ SMDSAbs_Edge ] = -2; // 2->0, 4->2 myNb.resize( index( SMDSAbs_Volume,20 ) + 1, NULL); - myNb[ index( SMDSAbs_Node,1 )] = & myNbNodes; - myNb[ index( SMDSAbs_0DElement,1 )] = & myNb0DElements; - myNb[ index( SMDSAbs_Edge,2 )] = & myNbEdges; myNb[ index( SMDSAbs_Edge,4 )] = & myNbQuadEdges; @@ -164,15 +147,13 @@ inline SMDS_MeshInfo::SMDS_MeshInfo(): myNb[ index( SMDSAbs_Volume, 15)] = & myNbQuadPrisms; myNb[ index( SMDSAbs_Volume, 20)] = & myNbQuadHexas; } - inline void // Clear SMDS_MeshInfo::Clear() { for ( int i=0; i myInverseElements; + private: + double myX, myY, myZ; + SMDS_PositionPtr myPosition; + NCollection_List myInverseElements; }; #endif diff --git a/src/3rdParty/salomesmesh/inc/SMDS_PolygonalFaceOfNodes.hxx b/src/3rdParty/salomesmesh/inc/SMDS_PolygonalFaceOfNodes.hxx index 34a7f4dab4..71b083a3fd 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_PolygonalFaceOfNodes.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_PolygonalFaceOfNodes.hxx @@ -40,7 +40,6 @@ class SMDS_EXPORT SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace SMDS_PolygonalFaceOfNodes (std::vector nodes); virtual SMDSAbs_ElementType GetType() const; - virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Polygon; } virtual bool IsPoly() const { return true; }; bool ChangeNodes (std::vector nodes); diff --git a/src/3rdParty/salomesmesh/inc/SMDS_PolyhedralVolumeOfNodes.hxx b/src/3rdParty/salomesmesh/inc/SMDS_PolyhedralVolumeOfNodes.hxx index 52d1358c1e..9cddb1f02b 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_PolyhedralVolumeOfNodes.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_PolyhedralVolumeOfNodes.hxx @@ -39,7 +39,6 @@ class SMDS_EXPORT SMDS_PolyhedralVolumeOfNodes:public SMDS_VolumeOfNodes //virtual ~SMDS_PolyhedralVolumeOfNodes(); virtual SMDSAbs_ElementType GetType() const; - virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Polyhedra; } virtual bool IsPoly() const { return true; }; bool ChangeNodes (const std::vector & nodes, diff --git a/src/3rdParty/salomesmesh/inc/SMDS_QuadraticEdge.hxx b/src/3rdParty/salomesmesh/inc/SMDS_QuadraticEdge.hxx index cdab680e21..83877d6a16 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_QuadraticEdge.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_QuadraticEdge.hxx @@ -47,8 +47,6 @@ public: int NbNodes() const; - virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Quad_Edge; } - virtual bool IsQuadratic() const { return true; } virtual bool IsMediumNode(const SMDS_MeshNode* node) const; diff --git a/src/3rdParty/salomesmesh/inc/SMDS_QuadraticFaceOfNodes.hxx b/src/3rdParty/salomesmesh/inc/SMDS_QuadraticFaceOfNodes.hxx index 2d374139b6..58c709f225 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_QuadraticFaceOfNodes.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_QuadraticFaceOfNodes.hxx @@ -49,7 +49,6 @@ public: const SMDS_MeshNode * n34, const SMDS_MeshNode * n41); - virtual SMDSAbs_EntityType GetEntityType() const; virtual bool IsQuadratic() const { return true; } virtual bool IsMediumNode(const SMDS_MeshNode* node) const; diff --git a/src/3rdParty/salomesmesh/inc/SMDS_QuadraticVolumeOfNodes.hxx b/src/3rdParty/salomesmesh/inc/SMDS_QuadraticVolumeOfNodes.hxx index f9ca633e48..3a004f4481 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_QuadraticVolumeOfNodes.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_QuadraticVolumeOfNodes.hxx @@ -99,7 +99,6 @@ public: const SMDS_MeshNode * n37, const SMDS_MeshNode * n48); - virtual SMDSAbs_EntityType GetEntityType() const; virtual bool IsQuadratic() const { return true; } virtual bool IsMediumNode(const SMDS_MeshNode* node) const; diff --git a/src/3rdParty/salomesmesh/inc/SMDS_VolumeOfFaces.hxx b/src/3rdParty/salomesmesh/inc/SMDS_VolumeOfFaces.hxx index 95b262faa9..074fbec23d 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_VolumeOfFaces.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_VolumeOfFaces.hxx @@ -54,7 +54,6 @@ class SMDS_EXPORT SMDS_VolumeOfFaces:public SMDS_MeshVolume const SMDS_MeshFace * face5, const SMDS_MeshFace * face6); - virtual SMDSAbs_EntityType GetEntityType() const; void Print(std::ostream & OS) const; int NbFaces() const; diff --git a/src/3rdParty/salomesmesh/inc/SMDS_VolumeOfNodes.hxx b/src/3rdParty/salomesmesh/inc/SMDS_VolumeOfNodes.hxx index ac62041f52..7f35af2a4d 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_VolumeOfNodes.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_VolumeOfNodes.hxx @@ -69,8 +69,7 @@ class SMDS_EXPORT SMDS_VolumeOfNodes:public SMDS_MeshVolume int NbFaces() const; int NbNodes() const; int NbEdges() const; - virtual SMDSAbs_ElementType GetType() const; - virtual SMDSAbs_EntityType GetEntityType() const; + SMDSAbs_ElementType GetType() const; /*! * \brief Return node by its index diff --git a/src/3rdParty/salomesmesh/inc/SMDS_VolumeTool.hxx b/src/3rdParty/salomesmesh/inc/SMDS_VolumeTool.hxx index 3b637c8395..b95bc8a620 100644 --- a/src/3rdParty/salomesmesh/inc/SMDS_VolumeTool.hxx +++ b/src/3rdParty/salomesmesh/inc/SMDS_VolumeTool.hxx @@ -93,8 +93,6 @@ class SMDS_EXPORT SMDS_VolumeTool bool GetBaryCenter (double & X, double & Y, double & Z) const; - bool IsOut(double X, double Y, double Z, double tol); - // Classify a point // ----------------------- // info on node connection diff --git a/src/3rdParty/salomesmesh/inc/SMESHDS_Command.hxx b/src/3rdParty/salomesmesh/inc/SMESHDS_Command.hxx index d425a054ac..09d720b9ac 100644 --- a/src/3rdParty/salomesmesh/inc/SMESHDS_Command.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESHDS_Command.hxx @@ -38,7 +38,6 @@ class SMESHDS_EXPORT SMESHDS_Command public: SMESHDS_Command(const SMESHDS_CommandType aType); void AddNode(int NewNodeID, double x, double y, double z); - void Add0DElement(int New0DElementID, int idnode); void AddEdge(int NewEdgeID, int idnode1, int idnode2); void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3); void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3, diff --git a/src/3rdParty/salomesmesh/inc/SMESHDS_CommandType.hxx b/src/3rdParty/salomesmesh/inc/SMESHDS_CommandType.hxx index 7279ba9320..bafaba8632 100644 --- a/src/3rdParty/salomesmesh/inc/SMESHDS_CommandType.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESHDS_CommandType.hxx @@ -53,9 +53,7 @@ enum SMESHDS_CommandType { SMESHDS_AddQuadTetrahedron, SMESHDS_AddQuadPyramid, SMESHDS_AddQuadPentahedron, - SMESHDS_AddQuadHexahedron, - // special type for 0D elements - SMESHDS_Add0DElement + SMESHDS_AddQuadHexahedron }; diff --git a/src/3rdParty/salomesmesh/inc/SMESHDS_Group.hxx b/src/3rdParty/salomesmesh/inc/SMESHDS_Group.hxx index 85d7d14c24..18fc37e4b6 100644 --- a/src/3rdParty/salomesmesh/inc/SMESHDS_Group.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESHDS_Group.hxx @@ -22,7 +22,7 @@ // SMESH SMESHDS : management of mesh data and SMESH document // File : SMESHDS_Group.hxx // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_Group.hxx,v 1.7.2.1 2008/11/27 12:31:37 abd Exp $ // #ifndef _SMESHDS_Group_HeaderFile #define _SMESHDS_Group_HeaderFile diff --git a/src/3rdParty/salomesmesh/inc/SMESHDS_GroupBase.hxx b/src/3rdParty/salomesmesh/inc/SMESHDS_GroupBase.hxx index ced9543fa5..b8a1773192 100644 --- a/src/3rdParty/salomesmesh/inc/SMESHDS_GroupBase.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESHDS_GroupBase.hxx @@ -22,7 +22,7 @@ // SMESH SMESHDS : management of mesh data and SMESH document // File : SMESHDS_Group.hxx // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_GroupBase.hxx,v 1.8.2.1 2008/11/27 12:31:37 abd Exp $ // #ifndef _SMESHDS_GroupBase_HeaderFile #define _SMESHDS_GroupBase_HeaderFile diff --git a/src/3rdParty/salomesmesh/inc/SMESHDS_Hypothesis.hxx b/src/3rdParty/salomesmesh/inc/SMESHDS_Hypothesis.hxx index 4478b4a0b9..3958324674 100644 --- a/src/3rdParty/salomesmesh/inc/SMESHDS_Hypothesis.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESHDS_Hypothesis.hxx @@ -23,7 +23,7 @@ // File : SMESHDS_Hypothesis.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_Hypothesis.hxx,v 1.10.2.1 2008/11/27 12:31:37 abd Exp $ // #ifndef _SMESHDS_HYPOTHESIS_HXX_ #define _SMESHDS_HYPOTHESIS_HXX_ diff --git a/src/3rdParty/salomesmesh/inc/SMESHDS_Mesh.hxx b/src/3rdParty/salomesmesh/inc/SMESHDS_Mesh.hxx index 116deb6070..d3df2e688e 100644 --- a/src/3rdParty/salomesmesh/inc/SMESHDS_Mesh.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESHDS_Mesh.hxx @@ -30,7 +30,6 @@ #include "SMDS_Mesh.hxx" #include "SMDS_MeshNode.hxx" -#include "SMDS_Mesh0DElement.hxx" #include "SMDS_MeshEdge.hxx" #include "SMDS_MeshFace.hxx" #include "SMDS_MeshVolume.hxx" @@ -67,164 +66,160 @@ public: bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H); virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID); - virtual SMDS_MeshNode* AddNode(double x, double y, double z); - - virtual SMDS_Mesh0DElement* Add0DElementWithID(int nodeID, int ID); - virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * node, int ID); - virtual SMDS_Mesh0DElement* Add0DElement (const SMDS_MeshNode * node); + virtual SMDS_MeshNode * AddNode(double x, double y, double z); virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID); virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - int ID); + const SMDS_MeshNode * n2, + int ID); virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2); + const SMDS_MeshNode * n2); // 2d order edge with 3 nodes: n12 - node between n1 and n2 virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID); virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n12, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n12, + int ID); virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1, const SMDS_MeshNode * n2, const SMDS_MeshNode * n12); virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID); virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + int ID); virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3); virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID); virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + int ID); virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4); // 2d order triangle of 6 nodes virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n12,int n23,int n31, int ID); virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n31, + int ID); virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31); + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n31); // 2d order quadrangle virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int n12,int n23,int n34,int n41, int ID); virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n34, + const SMDS_MeshNode * n41, + int ID); virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41); + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n34, + const SMDS_MeshNode * n41); virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4); virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5); virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6); virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8); // 2d order tetrahedron of 10 nodes virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n12,int n23,int n31, int n14,int n24,int n34, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, - const SMDS_MeshNode * n14, - const SMDS_MeshNode * n24, - const SMDS_MeshNode * n34, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n31, + const SMDS_MeshNode * n14, + const SMDS_MeshNode * n24, + const SMDS_MeshNode * n34, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n31, @@ -238,24 +233,24 @@ public: int n15,int n25,int n35,int n45, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, - const SMDS_MeshNode * n15, - const SMDS_MeshNode * n25, - const SMDS_MeshNode * n35, - const SMDS_MeshNode * n45, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n34, + const SMDS_MeshNode * n41, + const SMDS_MeshNode * n15, + const SMDS_MeshNode * n25, + const SMDS_MeshNode * n35, + const SMDS_MeshNode * n45, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n34, @@ -273,27 +268,27 @@ public: int n14,int n25,int n36, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, - const SMDS_MeshNode * n45, - const SMDS_MeshNode * n56, - const SMDS_MeshNode * n64, - const SMDS_MeshNode * n14, - const SMDS_MeshNode * n25, - const SMDS_MeshNode * n36, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n31, + const SMDS_MeshNode * n45, + const SMDS_MeshNode * n56, + const SMDS_MeshNode * n64, + const SMDS_MeshNode * n14, + const SMDS_MeshNode * n25, + const SMDS_MeshNode * n36, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n31, @@ -312,34 +307,34 @@ public: int n15,int n26,int n37,int n48, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8, - const SMDS_MeshNode * n12, - const SMDS_MeshNode * n23, - const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, - const SMDS_MeshNode * n56, - const SMDS_MeshNode * n67, - const SMDS_MeshNode * n78, - const SMDS_MeshNode * n85, - const SMDS_MeshNode * n15, - const SMDS_MeshNode * n26, - const SMDS_MeshNode * n37, - const SMDS_MeshNode * n48, - int ID); + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8, + const SMDS_MeshNode * n12, + const SMDS_MeshNode * n23, + const SMDS_MeshNode * n34, + const SMDS_MeshNode * n41, + const SMDS_MeshNode * n56, + const SMDS_MeshNode * n67, + const SMDS_MeshNode * n78, + const SMDS_MeshNode * n85, + const SMDS_MeshNode * n15, + const SMDS_MeshNode * n26, + const SMDS_MeshNode * n37, + const SMDS_MeshNode * n48, + int ID); virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n34, @@ -405,9 +400,9 @@ public: void SetNodeOnVertex(SMDS_MeshNode * aNode, const TopoDS_Vertex & S); void UnSetNodeOnShape(const SMDS_MeshNode * aNode); void SetMeshElementOnShape(const SMDS_MeshElement * anElt, - const TopoDS_Shape & S); + const TopoDS_Shape & S); void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt, - const TopoDS_Shape & S); + const TopoDS_Shape & S); bool HasMeshElements(const TopoDS_Shape & S); SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const; SMESHDS_SubMesh * MeshElements(const int Index); diff --git a/src/3rdParty/salomesmesh/inc/SMESHDS_Script.hxx b/src/3rdParty/salomesmesh/inc/SMESHDS_Script.hxx index 9e01fc01c9..808066bc3e 100644 --- a/src/3rdParty/salomesmesh/inc/SMESHDS_Script.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESHDS_Script.hxx @@ -44,7 +44,6 @@ class SMESHDS_EXPORT SMESHDS_Script bool IsModified(); void AddNode(int NewNodeID, double x, double y, double z); - void Add0DElement(int New0DElementID, int idnode); void AddEdge(int NewEdgeID, int idnode1, int idnode2); void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3); void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3, diff --git a/src/3rdParty/salomesmesh/inc/SMESH_0D_Algo.hxx b/src/3rdParty/salomesmesh/inc/SMESH_0D_Algo.hxx index 71f7476e6b..722dd9da1a 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_0D_Algo.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_0D_Algo.hxx @@ -22,7 +22,7 @@ // SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_0D_Algo.hxx // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_0D_Algo.hxx,v 1.2.2.1 2008/11/27 12:25:15 abd Exp $ // #ifndef _SMESH_0D_ALGO_HXX_ #define _SMESH_0D_ALGO_HXX_ diff --git a/src/3rdParty/salomesmesh/inc/SMESH_1D_Algo.hxx b/src/3rdParty/salomesmesh/inc/SMESH_1D_Algo.hxx index 9da4fd9858..2cdfd3c0fd 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_1D_Algo.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_1D_Algo.hxx @@ -23,7 +23,7 @@ // File : SMESH_1D_Algo.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_1D_Algo.hxx,v 1.8.2.1 2008/11/27 12:25:15 abd Exp $ // #ifndef _SMESH_1D_ALGO_HXX_ #define _SMESH_1D_ALGO_HXX_ diff --git a/src/3rdParty/salomesmesh/inc/SMESH_2D_Algo.hxx b/src/3rdParty/salomesmesh/inc/SMESH_2D_Algo.hxx index 41a8bc1afa..e52910d011 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_2D_Algo.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_2D_Algo.hxx @@ -23,7 +23,7 @@ // File : SMESH_2D_Algo.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_2D_Algo.hxx,v 1.9.2.1 2008/11/27 12:25:15 abd Exp $ // #ifndef _SMESH_2D_ALGO_HXX_ #define _SMESH_2D_ALGO_HXX_ diff --git a/src/3rdParty/salomesmesh/inc/SMESH_3D_Algo.hxx b/src/3rdParty/salomesmesh/inc/SMESH_3D_Algo.hxx index 9c47614088..b86b1d169f 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_3D_Algo.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_3D_Algo.hxx @@ -23,7 +23,7 @@ // File : SMESH_3D_Algo.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_3D_Algo.hxx,v 1.9.2.1 2008/11/27 12:25:15 abd Exp $ // #ifndef _SMESH_3D_ALGO_HXX_ #define _SMESH_3D_ALGO_HXX_ diff --git a/src/3rdParty/salomesmesh/inc/SMESH_Algo.hxx b/src/3rdParty/salomesmesh/inc/SMESH_Algo.hxx index b663f99fc5..4bad06a893 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_Algo.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_Algo.hxx @@ -23,8 +23,8 @@ // File : SMESH_Algo.hxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Algo.hxx,v 1.12.2.4 2008/11/27 12:25:15 abd Exp $ // - #ifndef _SMESH_ALGO_HXX_ #define _SMESH_ALGO_HXX_ @@ -54,9 +54,6 @@ class SMDS_MeshNode; class SMESH_subMesh; class SMESH_MesherHelper; -typedef std::map< SMESH_subMesh*, std::vector > MapShapeNbElems; -// vector must have size corresponding to EntityType_Last from SMDSAbs: -typedef std::map< SMESH_subMesh*, std::vector >::iterator MapShapeNbElemsItr; class SMESH_EXPORT SMESH_Algo:public SMESH_Hypothesis { @@ -125,16 +122,6 @@ public: */ virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper); - /*! - * \brief evaluates size of prospective mesh on a shape - * \param aMesh - the mesh - * \param aShape - the shape - * \param aNbElems - prospective number of elements by types - * \retval bool - is a success - */ - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap) = 0; - /*! * \brief Returns a list of compatible hypotheses used to mesh a shape * \param aMesh - the mesh @@ -176,10 +163,13 @@ public: bool InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter, const bool ignoreAuxiliary) const; /*! - * \brief Just return false as the algorithm does not hold parameters values + * \brief Initialize my parameter values by the mesh built on the geometry + * + * Just return false as the algorithm does not hold parameters values */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0); + /*! * \brief return compute error */ @@ -253,7 +243,8 @@ public: static bool GetNodeParamOnEdge(const SMESHDS_Mesh* theMesh, const TopoDS_Edge& theEdge, std::vector< double > & theParams); - /*! + + /*! * \brief Fill map of node parameter on geometrical edge to node it-self * \param theMesh - The mesh containing nodes * \param theEdge - The geometrical edge of interest @@ -265,6 +256,7 @@ public: const TopoDS_Edge& theEdge, const bool ignoreMediumNodes, std::map< double, const SMDS_MeshNode* > & theNodes); + /*! * \brief Find out elements orientation on a geometrical face * \param theFace - The face correctly oriented in the shape being meshed @@ -303,7 +295,7 @@ public: * \retval const SMDS_MeshNode* - found node or NULL */ static const SMDS_MeshNode* VertexNode(const TopoDS_Vertex& V, - const SMESHDS_Mesh* meshDS); + const SMESHDS_Mesh* meshDS); protected: diff --git a/src/3rdParty/salomesmesh/inc/SMESH_Block.hxx b/src/3rdParty/salomesmesh/inc/SMESH_Block.hxx index 97caf61161..20c18163b9 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_Block.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_Block.hxx @@ -276,14 +276,11 @@ public: static int GetOrderedEdges (const TopoDS_Face& theFace, TopoDS_Vertex theFirstVertex, std::list< TopoDS_Edge >& theEdges, - std::list< int > & theNbVertexInWires, - const bool theShapeAnalysisAlgo=false); + std::list< int > & theNbVertexInWires); // Return nb wires and a list of oredered edges. // It is used to assign indices to subshapes. // theFirstVertex may be NULL. // Always try to set a seam edge first - // if (theShapeAnalysisAlgo) then ShapeAnalysis::OuterWire() is used to find the outer - // wire else BRepTools::OuterWire() is used public: // ----------------------------------------------------------- diff --git a/src/3rdParty/salomesmesh/inc/SMESH_ControlsDef.hxx b/src/3rdParty/salomesmesh/inc/SMESH_ControlsDef.hxx index 4f81bbd72f..38a507c84b 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_ControlsDef.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_ControlsDef.hxx @@ -68,40 +68,30 @@ class gp_Pnt; namespace SMESH{ namespace Controls{ - class SMESHCONTROLS_EXPORT TSequenceOfXYZ + class SMESHCONTROLS_EXPORT TSequenceOfXYZ: public std::vector { - typedef std::vector::size_type size_type; - public: TSequenceOfXYZ(); TSequenceOfXYZ(size_type n); - TSequenceOfXYZ(size_type n, const gp_XYZ& t); + TSequenceOfXYZ(size_type n, const value_type& t); TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ); template TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd); - ~TSequenceOfXYZ(); - TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ); - gp_XYZ& operator()(size_type n); + reference operator()(size_type n); - const gp_XYZ& operator()(size_type n) const; - - void clear(); - - void reserve(size_type n); - - void push_back(const gp_XYZ& v); - - size_type size() const; + const_reference operator()(size_type n) const; private: - std::vector myArray; + reference operator[](size_type n); + + const_reference operator[](size_type n) const; }; /* @@ -132,9 +122,9 @@ namespace SMESH{ void SetPrecision( const long thePrecision ); bool GetPoints(const int theId, - TSequenceOfXYZ& theRes) const; + TSequenceOfXYZ& theRes) const; static bool GetPoints(const SMDS_MeshElement* theElem, - TSequenceOfXYZ& theRes); + TSequenceOfXYZ& theRes); protected: const SMDS_Mesh* myMesh; const SMDS_MeshElement* myCurrElement; @@ -263,10 +253,10 @@ namespace SMESH{ virtual double GetBadRate( double Value, int nbNodes ) const; virtual SMDSAbs_ElementType GetType() const; struct Value{ - double myLength; - long myPntId[2]; - Value(double theLength, long thePntId1, long thePntId2); - bool operator<(const Value& x) const; + double myLength; + long myPntId[2]; + Value(double theLength, long thePntId1, long thePntId2); + bool operator<(const Value& x) const; }; typedef std::set TValues; void GetValues(TValues& theValues); @@ -296,9 +286,9 @@ namespace SMESH{ virtual double GetBadRate( double Value, int nbNodes ) const; virtual SMDSAbs_ElementType GetType() const; struct Value{ - long myPntId[2]; - Value(long thePntId1, long thePntId2); - bool operator<(const Value& x) const; + long myPntId[2]; + Value(long thePntId1, long thePntId2); + bool operator<(const Value& x) const; }; typedef std::map MValues; @@ -364,10 +354,10 @@ namespace SMESH{ static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId ); typedef long TElemId; struct Border{ - TElemId myElemId; - TElemId myPntId[2]; - Border(long theElemId, long thePntId1, long thePntId2); - bool operator<(const Border& x) const; + TElemId myElemId; + TElemId myPntId[2]; + Border(long theElemId, long thePntId1, long thePntId2); + bool operator<(const Border& x) const; }; typedef std::set TBorders; void GetBoreders(TBorders& theBorders); @@ -797,13 +787,13 @@ namespace SMESH{ virtual void GetElementsId( const SMDS_Mesh* theMesh, - TIdSequence& theSequence ); + TIdSequence& theSequence ); static void GetElementsId( const SMDS_Mesh* theMesh, - PredicatePtr thePredicate, - TIdSequence& theSequence ); + PredicatePtr thePredicate, + TIdSequence& theSequence ); protected: PredicatePtr myPredicate; diff --git a/src/3rdParty/salomesmesh/inc/SMESH_DriverDAT.hxx b/src/3rdParty/salomesmesh/inc/SMESH_DriverDAT.hxx index 182fd11221..9020c6fc1b 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_DriverDAT.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_DriverDAT.hxx @@ -27,7 +27,7 @@ #define _SMESH_DriverDAT_HXX_ #ifdef WNT - #if defined MESHDRIVERDAT_EXPORTS || defined MeshDriverDAT_EXPORTS + #if defined MESHDRIVERDAT_EXPORTS #define MESHDRIVERDAT_EXPORT __declspec( dllexport ) #else #define MESHDRIVERDAT_EXPORT __declspec( dllimport ) diff --git a/src/3rdParty/salomesmesh/inc/SMESH_DriverSTL.hxx b/src/3rdParty/salomesmesh/inc/SMESH_DriverSTL.hxx index f30ef50fe6..4246d18adb 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_DriverSTL.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_DriverSTL.hxx @@ -27,7 +27,7 @@ #define _SMESH_DriverSTL_HXX_ #ifdef WNT - #if defined MESHDRIVERSTL_EXPORTS || defined MeshDriverSTL_EXPORTS + #if defined MESHDRIVERSTL_EXPORTS #define MESHDRIVERSTL_EXPORT __declspec( dllexport ) #else #define MESHDRIVERSTL_EXPORT __declspec( dllimport ) diff --git a/src/3rdParty/salomesmesh/inc/SMESH_DriverUNV.hxx b/src/3rdParty/salomesmesh/inc/SMESH_DriverUNV.hxx index 2127644293..106b6e9390 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_DriverUNV.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_DriverUNV.hxx @@ -27,7 +27,7 @@ #define _SMESH_DriverUNV_HXX_ #ifdef WNT - #if defined MESHDRIVERUNV_EXPORTS || defined MeshDriverUNV_EXPORTS + #if defined MESHDRIVERUNV_EXPORTS #define MESHDRIVERUNV_EXPORT __declspec( dllexport ) #else #define MESHDRIVERUNV_EXPORT __declspec( dllimport ) diff --git a/src/3rdParty/salomesmesh/inc/SMESH_ExceptHandlers.hxx b/src/3rdParty/salomesmesh/inc/SMESH_ExceptHandlers.hxx index a266a592c6..e610a8c1ea 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_ExceptHandlers.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_ExceptHandlers.hxx @@ -31,7 +31,19 @@ #include -#include +#if defined SMESH_EXPORTS +#if defined WIN32 +#define SMESH_EXPORT __declspec( dllexport ) +#else +#define SMESH_EXPORT +#endif +#else +#if defined WNT +#define SMESH_EXPORT __declspec( dllimport ) +#else +#define SMESH_EXPORT +#endif +#endif typedef void (*PVF)(); diff --git a/src/3rdParty/salomesmesh/inc/SMESH_Exception.hxx b/src/3rdParty/salomesmesh/inc/SMESH_Exception.hxx index 1718e5d218..564c376e48 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_Exception.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_Exception.hxx @@ -31,7 +31,19 @@ # define LOCALIZED(message) #message #endif -#include +#if defined SMESH_EXPORTS +#if defined WIN32 +#define SMESH_EXPORT __declspec( dllexport ) +#else +#define SMESH_EXPORT +#endif +#else +#if defined WNT +#define SMESH_EXPORT __declspec( dllimport ) +#else +#define SMESH_EXPORT +#endif +#endif class SMESH_EXPORT SMESH_Exception : public std::exception { diff --git a/src/3rdParty/salomesmesh/inc/SMESH_Gen.hxx b/src/3rdParty/salomesmesh/inc/SMESH_Gen.hxx index ab610a00a7..6857408f2e 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_Gen.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_Gen.hxx @@ -30,7 +30,7 @@ #include "SMESH_SMESH.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include "SMESH_Hypothesis.hxx" #include "SMESH_ComputeError.hxx" @@ -61,12 +61,12 @@ typedef std::set TSetOfInt; class SMESH_EXPORT SMESH_Gen { -public: + public: SMESH_Gen(); ~SMESH_Gen(); SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode) - throw(SALOME_Exception); + throw(SMESH_Exception); /*! * \brief Computes aMesh on aShape @@ -78,21 +78,8 @@ public: bool Compute(::SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool anUpward=false, - const ::MeshDimension aDim=::MeshDim_3D, - TSetOfInt* aShapesId=0); - - /*! - * \brief evaluates size of prospective mesh on a shape - * \param aMesh - the mesh - * \param aShape - the shape - * \param aResMap - map for prospective numbers of elements - * \retval bool - is a success - */ - bool Evaluate(::SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap, - const bool anUpward=false, - TSetOfInt* aShapesId=0); + const ::MeshDimension aDim=::MeshDim_3D, + TSetOfInt* aShapesId=0); bool CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); // notify on bad state of attached algos, return false @@ -109,7 +96,7 @@ public: */ void SetDefaultNbSegments(int nb) { _nbSegments = nb; } int GetDefaultNbSegments() const { return _nbSegments; } - + struct TAlgoStateError { TAlgoStateErrorName _name; @@ -138,6 +125,16 @@ public: SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0); static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh); + // inherited methods from SALOMEDS::Driver + +// void Save(int studyId, const char *aUrlOfFile); +// void Load(int studyId, const char *aUrlOfFile); +// void Close(int studyId); +// const char *ComponentDataType(); + +// const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile); +// const char *LocalPersistentIDToIOR(const char *aLocalPersistentID); + int GetANewId(); std::map < int, SMESH_Algo * >_mapAlgo; @@ -146,9 +143,9 @@ public: std::map < int, SMESH_2D_Algo * >_map2D_Algo; std::map < int, SMESH_3D_Algo * >_map3D_Algo; -private: + private: - int _localId; // unique Id of created objects, within SMESH_Gen entity + int _localId; // unique Id of created objects, within SMESH_Gen entity std::map < int, StudyContextStruct * >_mapStudyContext; // hypotheses managing diff --git a/src/3rdParty/salomesmesh/inc/SMESH_Group.hxx b/src/3rdParty/salomesmesh/inc/SMESH_Group.hxx index ab35308273..80a8276a91 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_Group.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_Group.hxx @@ -23,7 +23,7 @@ // File : SMESH_Group.hxx // Author : Michael Sazonov (OCC) // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Group.hxx,v 1.8.2.1 2008/11/27 12:25:15 abd Exp $ // #ifndef _SMESH_Group_HeaderFile #define _SMESH_Group_HeaderFile diff --git a/src/3rdParty/salomesmesh/inc/SMESH_HypoFilter.hxx b/src/3rdParty/salomesmesh/inc/SMESH_HypoFilter.hxx index c424f35562..801a46252a 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_HypoFilter.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_HypoFilter.hxx @@ -22,7 +22,7 @@ // SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_HypoFilter.hxx // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_HypoFilter.hxx,v 1.6.2.2 2008/11/27 12:25:15 abd Exp $ // #ifndef SMESH_HypoFilter_HeaderFile #define SMESH_HypoFilter_HeaderFile @@ -96,14 +96,10 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate std::list myPredicates; // private methods - #ifdef __BORLANDC__ public: - #endif enum Logical { AND, AND_NOT, OR, OR_NOT }; enum Comparison { EQUAL, NOT_EQUAL, MORE, LESS }; - #ifdef __BORLANDC__ protected: - #endif SMESH_HypoFilter(const SMESH_HypoFilter& other){} void add( Logical bool_op, SMESH_HypoPredicate* pred ) diff --git a/src/3rdParty/salomesmesh/inc/SMESH_IndexedDataMapOfShapeIndexedMapOfShape.hxx b/src/3rdParty/salomesmesh/inc/SMESH_IndexedDataMapOfShapeIndexedMapOfShape.hxx index e4c14638ce..64a7f2d709 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_IndexedDataMapOfShapeIndexedMapOfShape.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_IndexedDataMapOfShapeIndexedMapOfShape.hxx @@ -48,6 +48,8 @@ DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, TopoDS_Sh SMESH_DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, TopoDS_Shape) #endif + + #endif #ifndef SMESH_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile diff --git a/src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx b/src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx index 13b714d058..bb65e78212 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx @@ -23,6 +23,7 @@ // File : SMESH_Mesh.hxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Mesh.hxx,v 1.18.2.3 2008/11/27 12:25:15 abd Exp $ // #ifndef _SMESH_MESH_HXX_ #define _SMESH_MESH_HXX_ @@ -35,7 +36,7 @@ #include "SMESHDS_Command.hxx" #include "SMDSAbs_ElementType.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include #include @@ -55,10 +56,10 @@ class SMESH_EXPORT SMESH_Mesh { public: SMESH_Mesh(int theLocalId, - int theStudyId, - SMESH_Gen* theGen, - bool theIsEmbeddedMode, - SMESHDS_Document* theDocument); + int theStudyId, + SMESH_Gen* theGen, + bool theIsEmbeddedMode, + SMESHDS_Document* theDocument); virtual ~SMESH_Mesh(); @@ -74,7 +75,7 @@ public: * \brief Return true if there is a geometry to be meshed, not PseudoShape() */ bool HasShapeToMesh() const { return _isShapeToMesh; } - /*! + /*! * \brief Return diagonal size of bounding box of shape to mesh. */ double GetShapeDiagonalSize() const; @@ -93,7 +94,7 @@ public: */ void Clear(); - /*! + /*! * \brief Remove all nodes and elements of indicated shape */ void ClearSubMesh(const int theShapeId); @@ -110,15 +111,15 @@ public: SMESH_Hypothesis::Hypothesis_Status AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId) - throw(SALOME_Exception); + throw(SMESH_Exception); SMESH_Hypothesis::Hypothesis_Status RemoveHypothesis(const TopoDS_Shape & aSubShape, int anHypId) - throw(SALOME_Exception); + throw(SMESH_Exception); const std::list & GetHypothesisList(const TopoDS_Shape & aSubShape) const - throw(SALOME_Exception); + throw(SMESH_Exception); const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape & aSubShape, const SMESH_HypoFilter& aFilter, @@ -130,9 +131,9 @@ public: std::list & aHypList, const bool andAncestors) const; - const std::list & GetLog() throw(SALOME_Exception); + const std::list & GetLog() throw(SMESH_Exception); - void ClearLog() throw(SALOME_Exception); + void ClearLog() throw(SMESH_Exception); int GetId() { return _id; } @@ -141,30 +142,30 @@ public: SMESH_Gen *GetGen() { return _gen; } SMESH_subMesh *GetSubMesh(const TopoDS_Shape & aSubShape) - throw(SALOME_Exception); + throw(SMESH_Exception); SMESH_subMesh *GetSubMeshContaining(const TopoDS_Shape & aSubShape) const - throw(SALOME_Exception); + throw(SMESH_Exception); SMESH_subMesh *GetSubMeshContaining(const int aShapeID) const - throw(SALOME_Exception); + throw(SMESH_Exception); /*! * \brief Return submeshes of groups containing the given subshape */ std::list GetGroupSubMeshesContaining(const TopoDS_Shape & shape) const - throw(SALOME_Exception); + throw(SMESH_Exception); /*! * \brief Say all submeshes that theChangedHyp has been modified */ void NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* theChangedHyp); const std::list < SMESH_subMesh * >& - GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) throw(SALOME_Exception); + GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) throw(SMESH_Exception); /*! * \brief Return True if anHyp is used to mesh aSubShape */ bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp, - const SMESH_subMesh * aSubMesh); + const SMESH_subMesh * aSubMesh); /*! * \brief check if a hypothesis alowing notconform mesh is present */ @@ -177,9 +178,9 @@ public: */ const TopTools_ListOfShape& GetAncestors(const TopoDS_Shape& theSubShape) const; - void SetAutoColor(bool theAutoColor) throw(SALOME_Exception); + void SetAutoColor(bool theAutoColor) throw(SMESH_Exception); - bool GetAutoColor() throw(SALOME_Exception); + bool GetAutoColor() throw(SMESH_Exception); /*! * \brief Return data map of descendant to ancestor shapes @@ -193,48 +194,46 @@ public: bool HasDuplicatedGroupNamesMED(); void ExportMED(const char *file, - const char* theMeshName = NULL, - bool theAutoGroups = true, - int theVersion = 0) - throw(SALOME_Exception); + const char* theMeshName = NULL, + bool theAutoGroups = true, + int theVersion = 0) + throw(SMESH_Exception); - void ExportDAT(const char *file) throw(SALOME_Exception); - void ExportUNV(const char *file) throw(SALOME_Exception); - void ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception); + void ExportDAT(const char *file) throw(SMESH_Exception); + void ExportUNV(const char *file) throw(SMESH_Exception); + void ExportSTL(const char *file, const bool isascii) throw(SMESH_Exception); - int NbNodes() throw(SALOME_Exception); + int NbNodes() throw(SMESH_Exception); - int Nb0DElements() throw(SALOME_Exception); + int NbEdges(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception); - int NbEdges(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception); + int NbFaces(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception); - int NbFaces(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception); + int NbTriangles(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception); - int NbTriangles(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception); - - int NbQuadrangles(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception); + int NbQuadrangles(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception); - int NbPolygons() throw(SALOME_Exception); + int NbPolygons() throw(SMESH_Exception); - int NbVolumes(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception); + int NbVolumes(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception); - int NbTetras(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception); + int NbTetras(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception); - int NbHexas(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception); + int NbHexas(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception); - int NbPyramids(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception); + int NbPyramids(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception); - int NbPrisms(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception); + int NbPrisms(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception); - int NbPolyhedrons() throw(SALOME_Exception); + int NbPolyhedrons() throw(SMESH_Exception); - int NbSubMesh() throw(SALOME_Exception); + int NbSubMesh() throw(SMESH_Exception); int NbGroup() const { return _mapGroup.size(); } SMESH_Group* AddGroup (const SMDSAbs_ElementType theType, - const char* theName, - int& theId, + const char* theName, + int& theId, const TopoDS_Shape& theShape=TopoDS_Shape()); typedef boost::shared_ptr< SMDS_Iterator > GroupIteratorPtr; @@ -273,7 +272,7 @@ protected: bool _isAutoColor; double _shapeDiagonal; //!< diagonal size of bounding box of shape to mesh - + TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors; protected: diff --git a/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx b/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx index fba5047737..06896059b0 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx @@ -41,7 +41,6 @@ #include #include -#include class SMDS_MeshFace; class SMDS_MeshNode; @@ -55,38 +54,12 @@ typedef std::map > TElemOfElemListMap; typedef std::map TNodeNodeMap; -//!< Set of elements sorted by ID, to be used to assure predictability of edition + //!< Set of elements sorted by ID, to be used to assure predictability of edition typedef std::set< const SMDS_MeshElement*, TIDCompare > TIDSortedElemSet; typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* > NLink; -//======================================================================= -/*! - * \brief Searcher for the node closest to point - */ -//======================================================================= -struct SMESH_NodeSearcher -{ - virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0; - virtual void MoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt ) = 0; -}; - -//======================================================================= -/*! - * \brief Return elements of given type where the given point is IN or ON. - * - * 'ALL' type means elements of any type excluding nodes and 0D elements - */ -//======================================================================= - -struct SMESH_ElementSearcher -{ - virtual void FindElementsByPoint(const gp_Pnt& point, - SMDSAbs_ElementType type, - std::vector< const SMDS_MeshElement* >& foundElems)=0; -}; - //======================================================================= /*! * \brief A sorted pair of nodes @@ -99,56 +72,19 @@ struct SMESH_TLink: public NLink { if ( n1->GetID() < n2->GetID() ) std::swap( first, second ); } SMESH_TLink(const NLink& link ):NLink( link ) { if ( first->GetID() < second->GetID() ) std::swap( first, second ); } - const SMDS_MeshNode* node1() const { return first; } - const SMDS_MeshNode* node2() const { return second; } }; -//======================================================================= +// ============================================================ /*! - * auxiliary class + * \brief Searcher for the node closest to point */ -//======================================================================= -class SMESH_MeshEditor_PathPoint { -public: - SMESH_MeshEditor_PathPoint() { - myPnt.SetCoord(99., 99., 99.); - myTgt.SetCoord(1.,0.,0.); - myAngle=0.; - myPrm=0.; - } - void SetPnt(const gp_Pnt& aP3D){ - myPnt=aP3D; - } - void SetTangent(const gp_Dir& aTgt){ - myTgt=aTgt; - } - void SetAngle(const double& aBeta){ - myAngle=aBeta; - } - void SetParameter(const double& aPrm){ - myPrm=aPrm; - } - const gp_Pnt& Pnt()const{ - return myPnt; - } - const gp_Dir& Tangent()const{ - return myTgt; - } - double Angle()const{ - return myAngle; - } - double Parameter()const{ - return myPrm; - } +// ============================================================ -protected: - gp_Pnt myPnt; - gp_Dir myTgt; - double myAngle; - double myPrm; +struct SMESH_NodeSearcher +{ + virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0; }; - // ============================================================ /*! * \brief Editor of a mesh @@ -356,16 +292,6 @@ public: const SMDS_MeshNode* theNodeStart, const bool theHasAngles, std::list& theAngles, - const bool theLinearVariation, - const bool theHasRefPoint, - const gp_Pnt& theRefPoint, - const bool theMakeGroups); - Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet & theElements, - SMESH_Mesh* theTrackPattern, - const SMDS_MeshNode* theNodeStart, - const bool theHasAngles, - std::list& theAngles, - const bool theLinearVariation, const bool theHasRefPoint, const gp_Pnt& theRefPoint, const bool theMakeGroups); @@ -379,7 +305,6 @@ public: SMESH_Mesh* theTargetMesh=0); // Move or copy theElements applying theTrsf to their nodes - typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes; void FindCoincidentNodes (std::set & theNodes, @@ -393,16 +318,6 @@ public: */ SMESH_NodeSearcher* GetNodeSearcher(); - /*! - * \brief Return SMESH_ElementSearcher - */ - SMESH_ElementSearcher* GetElementSearcher(); - /*! - * \brief Return true if the point is IN or ON of the element - */ - static bool isOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol ); - - int SimplifyFace (const std::vector faceNodes, std::vector& poly_nodes, std::vector& quantities) const; @@ -416,7 +331,7 @@ public: typedef std::list< std::list< int > > TListOfListOfElementsID; void FindEqualElements(std::set & theElements, - TListOfListOfElementsID & theGroupsOfElementsID); + TListOfListOfElementsID & theGroupsOfElementsID); // Return list of group of elements build on the same nodes. // Search among theElements or in the whole mesh if theElements is empty. @@ -601,25 +516,10 @@ public: const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; } const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; } - + bool DoubleNodes( const std::list< int >& theListOfNodes, const std::list< int >& theListOfModifiedElems ); - - bool DoubleNodes( const TIDSortedElemSet& theElems, - const TIDSortedElemSet& theNodesNot, - const TIDSortedElemSet& theAffectedElems ); - bool DoubleNodesInRegion( const TIDSortedElemSet& theElems, - const TIDSortedElemSet& theNodesNot, - const TopoDS_Shape& theShape ); - - /*! - * \brief Generated skin mesh (containing 2D cells) from 3D mesh - * The created 2D mesh elements based on nodes of free faces of boundary volumes - * \return TRUE if operation has been completed successfully, FALSE otherwise - */ - bool Make2DMeshFrom3D(); - private: /*! @@ -683,32 +583,6 @@ private: TIDSortedElemSet& elemSet, const int nbSteps, SMESH_SequenceOfElemPtr& srcElements); - - /*! - * auxilary for ExtrusionAlongTrack - */ - Extrusion_Error MakeEdgePathPoints(std::list& aPrms, - const TopoDS_Edge& aTrackEdge, - bool FirstIsStart, - list& LPP); - Extrusion_Error MakeExtrElements(TIDSortedElemSet& theElements, - list& fullList, - const bool theHasAngles, - list& theAngles, - const bool theLinearVariation, - const bool theHasRefPoint, - const gp_Pnt& theRefPoint, - const bool theMakeGroups); - void LinearAngleVariation(const int NbSteps, - list& theAngles); - - bool doubleNodes( SMESHDS_Mesh* theMeshDS, - const TIDSortedElemSet& theElems, - const TIDSortedElemSet& theNodesNot, - std::map< const SMDS_MeshNode*, - const SMDS_MeshNode* >& theNodeNodeMap, - const bool theIsDoubleElem ); - private: SMESH_Mesh * myMesh; diff --git a/src/3rdParty/salomesmesh/inc/SMESH_MesherHelper.hxx b/src/3rdParty/salomesmesh/inc/SMESH_MesherHelper.hxx index 80bd0affa1..733cfa4a43 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_MesherHelper.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_MesherHelper.hxx @@ -32,15 +32,15 @@ #include #include -#include #include #include #include #include -typedef std::map TLinkNodeMap; -typedef std::map::iterator ItTLinkNode; +typedef std::pair NLink; +typedef std::map NLinkNodeMap; +typedef std::map::iterator ItNLinkNode; /*! * \brief It helps meshers to add elements @@ -91,8 +91,9 @@ public: * \param meshDS - mesh DS * \retval TopoDS_Shape - found support shape */ - static TopoDS_Shape GetSubShapeByNode(const SMDS_MeshNode* node, - SMESHDS_Mesh* meshDS); + static const TopoDS_Shape& GetSubShapeByNode(const SMDS_MeshNode* node, + SMESHDS_Mesh* meshDS) + { return meshDS->IndexToShape( node->GetPosition()->GetShapeId() ); } /*! * \brief Return a valid node index, fixing the given one if necessary @@ -125,7 +126,7 @@ public: /*! * Check submesh for given shape: if all elements on this shape are quadratic, - * quadratic elements will be created. Also fill myTLinkNodeMap + * quadratic elements will be created. Also fill myNLinkNodeMap */ bool IsQuadraticSubMesh(const TopoDS_Shape& theShape); /*! @@ -138,12 +139,6 @@ public: */ bool GetIsQuadratic() const { return myCreateQuadratic; } - /*! - * \brief Move medium nodes of faces and volumes to fix distorted elements - * \param volumeOnly - fix nodes on geom faces or not if the shape is solid - */ - void FixQuadraticElements(bool volumeOnly=true); - /*! * \brief To set created elements on the shape set by IsQuadraticSubMesh() * or the next methods. By defaul elements are set on the shape if @@ -184,7 +179,7 @@ public: const SMDS_MeshNode* n2, const SMDS_MeshNode* n3, const int id=0, - const bool force3d = false); + const bool force3d = false); /*! * Creates quadratic or linear quadrangle */ @@ -193,7 +188,7 @@ public: const SMDS_MeshNode* n3, const SMDS_MeshNode* n4, const int id = 0, - const bool force3d = false); + const bool force3d = false); /*! * Creates quadratic or linear tetraahedron */ @@ -202,7 +197,7 @@ public: const SMDS_MeshNode* n3, const SMDS_MeshNode* n4, const int id = 0, - const bool force3d = true); + const bool force3d = true); /*! * Creates quadratic or linear pyramid */ @@ -212,7 +207,7 @@ public: const SMDS_MeshNode* n4, const SMDS_MeshNode* n5, const int id = 0, - const bool force3d = true); + const bool force3d = true); /*! * Creates quadratic or linear pentahedron */ @@ -223,7 +218,7 @@ public: const SMDS_MeshNode* n5, const SMDS_MeshNode* n6, const int id = 0, - const bool force3d = true); + const bool force3d = true); /*! * Creates quadratic or linear hexahedron */ @@ -236,35 +231,19 @@ public: const SMDS_MeshNode* n7, const SMDS_MeshNode* n8, const int id = 0, - bool force3d = true); + bool force3d = true); /*! * \brief Return U of the given node on the edge */ double GetNodeU(const TopoDS_Edge& theEdge, - const SMDS_MeshNode* theNode, - bool* check=0); + const SMDS_MeshNode* theNode); /*! * \brief Return node UV on face - * \param inFaceNode - a node of element being created located inside a face + * \param inFaceNode - a node of element being created located inside a face */ gp_XY GetNodeUV(const TopoDS_Face& F, const SMDS_MeshNode* n, - const SMDS_MeshNode* inFaceNode=0, - bool* check=0) const; - /*! - * \brief Check and fix node UV on a face - * \retval bool - false if UV is bad and could not be fixed - */ - bool CheckNodeUV(const TopoDS_Face& F, - const SMDS_MeshNode* n, - gp_XY& uv, - const double tol) const; - /*! - * \brief Return middle UV taking in account surface period - */ - static gp_XY GetMiddleUV(const Handle(Geom_Surface)& surface, - const gp_XY& uv1, - const gp_XY& uv2); + const SMDS_MeshNode* inFaceNode=0) const; /*! * \brief Check if inFaceNode argument is necessary for call GetNodeUV(F,..) * \retval bool - return true if the face is periodic @@ -338,21 +317,21 @@ public: const SMDS_MeshNode* n2, const bool force3d); /*! - * Auxilary function for filling myTLinkNodeMap + * Auxilary function for filling myNLinkNodeMap */ - void AddTLinkNode(const SMDS_MeshNode* n1, + void AddNLinkNode(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2, const SMDS_MeshNode* n12); /** - * Auxilary function for filling myTLinkNodeMap + * Auxilary function for filling myNLinkNodeMap */ - void AddTLinkNodeMap(const TLinkNodeMap& aMap) - { myTLinkNodeMap.insert(aMap.begin(), aMap.end()); } + void AddNLinkNodeMap(const NLinkNodeMap& aMap) + { myNLinkNodeMap.insert(aMap.begin(), aMap.end()); } /** - * Returns myTLinkNodeMap + * Returns myNLinkNodeMap */ - const TLinkNodeMap& GetTLinkNodeMap() const { return myTLinkNodeMap; } + const NLinkNodeMap& GetNLinkNodeMap() const { return myNLinkNodeMap; } /** * Check mesh without geometry for: if all elements on this shape are quadratic, @@ -378,7 +357,7 @@ protected: SMESH_MesherHelper (const SMESH_MesherHelper& theOther) {}; // special map for using during creation of quadratic elements - TLinkNodeMap myTLinkNodeMap; + NLinkNodeMap myNLinkNodeMap; std::set< int > myDegenShapeIds; std::set< int > mySeamShapeIds; @@ -392,7 +371,6 @@ protected: // to create quadratic elements bool myCreateQuadratic; bool mySetElemOnShape; - std::set< int > myOkNodePosShapes; }; diff --git a/src/3rdParty/salomesmesh/inc/SMESH_Octree.hxx b/src/3rdParty/salomesmesh/inc/SMESH_Octree.hxx index 79a641dd4c..1d40b39e63 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_Octree.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_Octree.hxx @@ -20,12 +20,11 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // SMESH SMESH_Octree : global Octree implementation +// File : SMESH_Octree.hxx +// Created : Tue Jan 16 16:00:00 2007 +// Author : Nicolas Geimer & Aurélien Motteux (OCC) +// Module : SMESH // -// File : SMESH_Octree.hxx -// Created : Tue Jan 16 16:00:00 2007 -// Author : Nicolas Geimer & Aurélien Motteux (OCC) -// Module : SMESH - #ifndef _SMESH_OCTREE_HXX_ #define _SMESH_OCTREE_HXX_ @@ -34,90 +33,67 @@ class SMESH_Octree { public: - - // Data limiting the tree height - struct Limit { - // MaxLevel of the Octree - int myMaxLevel; - // Minimal size of the Box - double myMinBoxSize; - - // Default: - // maxLevel-> 8^8 = 16777216 terminal trees - // minSize -> box size not checked - Limit(int maxLevel=8, double minSize=0.):myMaxLevel(maxLevel),myMinBoxSize(minSize) {} - virtual ~Limit() {} // it can be inherited - }; - - // Constructor. limit must be provided at tree root construction. - // limit will be deleted by SMESH_Octree - SMESH_Octree (Limit* limit=0); + // Constructor + SMESH_Octree (const int maxLevel = -1, const double minBoxSize = 0.); // Destructor virtual ~SMESH_Octree (); - // Compute the Octree. Must be called by constructor of inheriting class - void compute(); + // Tell if Octree is a leaf or not (has to be implemented in inherited classes) + virtual const bool isLeaf() = 0; - // Tell if Octree is a leaf or not. - // An inheriting class can influence it via myIsLeaf protected field - bool isLeaf() const; + // Compute the Octree + void Compute(); + + // Set the maximal level of the Octree + void setMaxLevel(const int maxLevel); + + // Set the minimal size of the Box + void setMinBoxSize(const double minBoxSize){myMinBoxSize = minBoxSize;}; + + // Set the bounding box of the Octree + void setBox(const Bnd_B3d* box); + + // Set box to the 3d Bounding Box of the Octree + void getBox(Bnd_B3d & box); + + // Compute the bigger dimension of the box + static double maxSize(const Bnd_B3d* box); // Return its level int level() const { return myLevel; } - // Get box to the 3d Bounding Box of the Octree - const Bnd_B3d& getBox() const { return *myBox; } - - // Compute the bigger dimension of my box - double maxSize() const; - - // Return index of a child the given point is in - inline int getChildIndex(double x, double y, double z, const gp_XYZ& boxMiddle)const; - protected: - // Return box of the whole tree - virtual Bnd_B3d* buildRootBox() = 0; + // Constructor for children (has to be implemented in inherited classes) + virtual SMESH_Octree* allocateOctreeChild() = 0; - // Constructor for children - virtual SMESH_Octree* allocateOctreeChild() const = 0; + // Build the 8 children boxes + void buildChildren(); - // Build the data in the 8 children - virtual void buildChildrenData() = 0; + // Build the data in the 8 children (has to be implemented in inherited classes) + virtual void buildChildrenData() = 0; // members + // Box of the Octree + Bnd_B3d* myBox; + // Array of 8 Octree children SMESH_Octree** myChildren; // Point the father, set to NULL for the level 0 SMESH_Octree* myFather; - // Tell us if the Octree is a leaf or not - bool myIsLeaf; - - // Tree limit - const Limit* myLimit; - -private: - // Build the 8 children boxes recursively - void buildChildren(); - // Level of the Octree int myLevel; - Bnd_B3d* myBox; + // MaxLevel of the Octree + int myMaxLevel; + + // Minimal size of the Box + double myMinBoxSize; + + // Tell us if the Octree is a leaf or not (-1 if not initialized) + int myIsLeaf; }; - -//================================================================================ -/*! - * \brief Return index of a child the given point is in - */ -//================================================================================ - -inline int SMESH_Octree::getChildIndex(double x, double y, double z, const gp_XYZ& mid) const -{ - return (x > mid.X()) + ( y > mid.Y())*2 + (z > mid.Z())*4; -} - #endif diff --git a/src/3rdParty/salomesmesh/inc/SMESH_OctreeNode.hxx b/src/3rdParty/salomesmesh/inc/SMESH_OctreeNode.hxx index 7799765d00..6a3b0cb39a 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_OctreeNode.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_OctreeNode.hxx @@ -34,7 +34,6 @@ #include #include -#include #include "SMDS_ElemIterator.hxx" @@ -45,7 +44,7 @@ class SMESH_OctreeNode; typedef SMDS_Iterator SMESH_OctreeNodeIterator; typedef boost::shared_ptr SMESH_OctreeNodeIteratorPtr; -class SMESH_OctreeNode : public SMESH_Octree { +class SMESH_OctreeNode : public SMESH_Octree{ public: @@ -60,6 +59,9 @@ public: //============================= virtual ~SMESH_OctreeNode () {}; + // Tells us if SMESH_OctreeNode is a leaf or not (-1 = not initialiazed) + virtual const bool isLeaf(); + // Tells us if Node is inside the current box with the precision "precision" virtual const bool isInside(const SMDS_MeshNode * Node, const double precision = 0.); @@ -68,11 +70,6 @@ public: std::list* Result, const double precision = 0.); - // Return in dist2Nodes nodes mapped to their square distance from Node - bool NodesAround(const SMDS_MeshNode * Node, - std::map& dist2Nodes, - double precision); - // Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance // Search for all the nodes in nodes void FindCoincidentNodes ( std::set* nodes, @@ -81,15 +78,10 @@ public: // Static method that return in theGroupsOfNodes a list of group of nodes close to each other within // theTolerance search for all the nodes in nodes - static void FindCoincidentNodes ( std::set& nodes, + static void FindCoincidentNodes ( std::set nodes, std::list< std::list< const SMDS_MeshNode*> >* theGroupsOfNodes, - const double theTolerance = 0.00001, - const int maxLevel = -1, + const double theTolerance = 0.00001, const int maxLevel = -1, const int maxNbNodes = 5); - /*! - * \brief Update data according to node movement - */ - void UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt ); /*! * \brief Return iterator over children */ @@ -101,20 +93,25 @@ public: /*! * \brief Return nb nodes in a tree */ - int NbNodes() const { return myNodes.size(); } + int NbNodes() const { return myNbNodes; } protected: - SMESH_OctreeNode (int maxNbNodes ); - - // Compute the bounding box of the whole set of nodes myNodes - virtual Bnd_B3d* buildRootBox(); +//============================= +/*! + * \brief Empty constructor + */ +//============================= + SMESH_OctreeNode (){}; // Shares the father's data with each of his child virtual void buildChildrenData(); + // Compute the bounding box of the whole set of nodes myNodes (only used for OctreeNode level 0) + void computeBoxForFather(); + // Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren() - virtual SMESH_Octree* allocateOctreeChild() const; + virtual SMESH_Octree* allocateOctreeChild(); // Return in result a list of nodes closed to Node and remove it from SetOfNodes void FindCoincidentNodes( const SMDS_MeshNode * Node, @@ -123,11 +120,13 @@ protected: const double precision); // The max number of nodes a leaf box can contain - int myMaxNbNodes; + int myMaxNbNodes; // The set of nodes inside the box of the Octree (Empty if Octree is not a leaf) std::set myNodes; + // The number of nodes I have inside the box + int myNbNodes; }; #endif diff --git a/src/3rdParty/salomesmesh/inc/SMESH_Pattern.hxx b/src/3rdParty/salomesmesh/inc/SMESH_Pattern.hxx index 3954106fed..b13c7033ae 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_Pattern.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_Pattern.hxx @@ -299,7 +299,7 @@ private: const TListOfEdgesList::iterator& theFromWire, const TListOfEdgesList::iterator& theToWire, const int theFirstEdgeID, - std::list< std::list< TPoint* > >& theEdgesPointsList ); + std::list< std::list< TPoint* > >& theEdgesPointsList ); // sort wires in theWireList from theFromWire until theToWire, // the wires are set in the order to correspond to the order // of boundaries; after sorting, edges in the wires are put diff --git a/src/3rdParty/salomesmesh/inc/SMESH_SMESH.hxx b/src/3rdParty/salomesmesh/inc/SMESH_SMESH.hxx index 72923b2e99..249fc6a855 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_SMESH.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_SMESH.hxx @@ -27,7 +27,7 @@ #define _SMESH_SMESH_HXX_ #ifdef WNT - #if defined SMESHimpl_EXPORTS + #if defined SMESH_EXPORTS #define SMESH_EXPORT __declspec( dllexport ) #else #define SMESH_EXPORT __declspec( dllimport ) diff --git a/src/3rdParty/salomesmesh/inc/SMESH_StdMeshers.hxx b/src/3rdParty/salomesmesh/inc/SMESH_StdMeshers.hxx index aeee7480d0..be440c1bd3 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_StdMeshers.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_StdMeshers.hxx @@ -28,7 +28,7 @@ #define _SMESH_StdMeshers_HXX_ #ifdef WNT - #if defined STDMESHERS_EXPORTS || defined StdMeshers_EXPORTS + #if defined STDMESHERS_EXPORTS #define STDMESHERS_EXPORT __declspec( dllexport ) #else #define STDMESHERS_EXPORT __declspec( dllimport ) diff --git a/src/3rdParty/salomesmesh/inc/SMESH_subMesh.hxx b/src/3rdParty/salomesmesh/inc/SMESH_subMesh.hxx index 7653eb9d39..ed9b0d7239 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_subMesh.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_subMesh.hxx @@ -23,6 +23,7 @@ // File : SMESH_subMesh.hxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_subMesh.hxx,v 1.12.2.3 2008/11/27 12:25:15 abd Exp $ // #ifndef _SMESH_SUBMESH_HXX_ #define _SMESH_SUBMESH_HXX_ @@ -33,9 +34,8 @@ #include "SMESHDS_SubMesh.hxx" #include "SMESH_Hypothesis.hxx" #include "SMESH_ComputeError.hxx" -#include "SMESH_Algo.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include @@ -47,7 +47,7 @@ class SMESH_Hypothesis; class SMESH_Algo; class SMESH_Gen; class SMESH_subMeshEventListener; -struct SMESH_subMeshEventListenerData; +class SMESH_subMeshEventListenerData; class SMESH_subMesh; typedef SMESH_subMeshEventListener EventListener; @@ -60,7 +60,7 @@ class SMESH_EXPORT SMESH_subMesh { public: SMESH_subMesh(int Id, SMESH_Mesh * father, SMESHDS_Mesh * meshDS, - const TopoDS_Shape & aSubShape); + const TopoDS_Shape & aSubShape); virtual ~ SMESH_subMesh(); int GetId() const; @@ -192,8 +192,6 @@ public: bool ComputeStateEngine(int event); - bool Evaluate(MapShapeNbElems& aResMap); - bool IsConform(const SMESH_Algo* theAlgo); // check if a conform mesh will be produced by the Algo @@ -225,9 +223,10 @@ public: * none mesh entity is bound to it */ void SetIsAlwaysComputed(bool isAlCo); + bool IsAlwaysComputed() { return _alwaysComputed; } - + protected: // ================================================================== void InsertDependence(const TopoDS_Shape aSubShape); diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Arithmetic1D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Arithmetic1D.hxx index e3f3c37a8f..639c8ba019 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Arithmetic1D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Arithmetic1D.hxx @@ -23,18 +23,15 @@ // File : StdMeshers_Arithmetic1D.hxx // Author : Damien COQUERET, OCC // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Arithmetic1D.hxx,v 1.7.2.1 2008/11/27 13:03:50 abd Exp $ // #ifndef _SMESH_ARITHMETIC1D_HXX_ #define _SMESH_ARITHMETIC1D_HXX_ - - #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" - -#include +#include "SMESH_Exception.hxx" class STDMESHERS_EXPORT StdMeshers_Arithmetic1D: public SMESH_Hypothesis @@ -43,18 +40,10 @@ public: StdMeshers_Arithmetic1D(int hypId, int studyId, SMESH_Gen* gen); virtual ~StdMeshers_Arithmetic1D(); - void SetLength(double length, bool isStartLength) throw(SALOME_Exception); + void SetLength(double length, bool isStartLength) throw(SMESH_Exception); double GetLength(bool isStartLength) const; - void SetReversedEdges( std::vector& ids); - - void SetObjectEntry( const char* entry ) { _objEntry = entry; } - - const char* GetObjectEntry() { return _objEntry.c_str(); } - - const std::vector& GetReversedEdges() const { return _edgeIDs; } - virtual std::ostream & SaveTo(std::ostream & save); virtual std::istream & LoadFrom(std::istream & load); friend std::ostream& operator << (std::ostream & save, StdMeshers_Arithmetic1D & hyp); @@ -68,7 +57,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ @@ -76,8 +65,6 @@ public: protected: double _begLength, _endLength; - std::vector _edgeIDs; - std::string _objEntry; }; #endif diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_AutomaticLength.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_AutomaticLength.hxx index 627003aa60..236dc0ae2d 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_AutomaticLength.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_AutomaticLength.hxx @@ -23,14 +23,15 @@ // File : StdMeshers_AutomaticLength.hxx // Author : Edward AGAPOV, OCC // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_AutomaticLength.hxx,v 1.5.2.1 2008/11/27 13:03:49 abd Exp $ +// #ifndef _SMESH_AutomaticLength_HXX_ #define _SMESH_AutomaticLength_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include @@ -55,13 +56,13 @@ public: * \brief Computes segment for a given edge */ double GetLength(const SMESH_Mesh* aMesh, const TopoDS_Shape& anEdge) - throw(SALOME_Exception); + throw(SMESH_Exception); /*! * \brief Computes segment length for an edge of given length */ double GetLength(const SMESH_Mesh* aMesh, const double edgeLength) - throw(SALOME_Exception); + throw(SMESH_Exception); /*! * \brief Set Fineness @@ -74,7 +75,7 @@ public: * is divided by (0.5 + 4.5 x theFineness) */ void SetFineness(double theFineness) - throw(SALOME_Exception); + throw(SMESH_Exception); /*! * \brief Return mesh Fineness diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_CompositeHexa_3D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_CompositeHexa_3D.hxx index 8fd14ba067..09b687fc17 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_CompositeHexa_3D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_CompositeHexa_3D.hxx @@ -50,9 +50,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - virtual bool CheckHypothesis(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, Hypothesis_Status& aStatus); diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_CompositeSegment_1D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_CompositeSegment_1D.hxx index 1ec1603353..b18b4262ca 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_CompositeSegment_1D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_CompositeSegment_1D.hxx @@ -22,7 +22,7 @@ // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_CompositeSegment_1D.hxx // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $ // #ifndef _SMESH_CompositeSegment_1D_HXX_ #define _SMESH_CompositeSegment_1D_HXX_ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Deflection1D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Deflection1D.hxx index a3cf19b706..6ad69973de 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Deflection1D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Deflection1D.hxx @@ -22,15 +22,15 @@ // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_Deflection1D.hxx // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Deflection1D.hxx,v 1.7.2.1 2008/11/27 13:03:50 abd Exp $ // - #ifndef _StdMeshers_Deflection1D_HXX_ #define _StdMeshers_Deflection1D_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" class STDMESHERS_EXPORT StdMeshers_Deflection1D:public SMESH_Hypothesis { @@ -38,7 +38,7 @@ class STDMESHERS_EXPORT StdMeshers_Deflection1D:public SMESH_Hypothesis StdMeshers_Deflection1D(int hypId, int studyId, SMESH_Gen * gen); virtual ~ StdMeshers_Deflection1D(); - void SetDeflection(double value) throw(SALOME_Exception); + void SetDeflection(double value) throw(SMESH_Exception); double GetDeflection() const; @@ -55,13 +55,13 @@ class STDMESHERS_EXPORT StdMeshers_Deflection1D:public SMESH_Hypothesis */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0); -protected: + protected: double _value; }; diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Distribution.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Distribution.hxx index 373305b632..baad1667a0 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Distribution.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Distribution.hxx @@ -23,7 +23,7 @@ // File : StdMeshers_Distribution.hxx // Author : Alexandre SOLOVYOV // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Distribution.hxx,v 1.4.2.2 2008/11/27 13:03:49 abd Exp $ // #ifndef _STD_MESHERS_DISTRIBUTION_HXX_ #define _STD_MESHERS_DISTRIBUTION_HXX_ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_FaceSide.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_FaceSide.hxx index 099249e24b..976986a57c 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_FaceSide.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_FaceSide.hxx @@ -93,12 +93,7 @@ public: SMESH_Mesh* theMesh, const bool theIsForward, const bool theIgnoreMediumNodes); - /*! - * \brief Wrap for vertex using data from other FaceSide - */ - StdMeshers_FaceSide(const SMDS_MeshNode* theNode, - const gp_Pnt2d thePnt2d, - const StdMeshers_FaceSide* theSide); + /*! * \brief Return wires of a face as StdMeshers_FaceSide's */ @@ -207,7 +202,6 @@ protected: int myNbPonits, myNbSegments; SMESH_Mesh* myMesh; bool myMissingVertexNodes, myIgnoreMediumNodes; - gp_Pnt2d myDefaultPnt2d; }; diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_FixedPoints1D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_FixedPoints1D.hxx deleted file mode 100644 index b5126e1c3a..0000000000 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_FixedPoints1D.hxx +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMESH : implementaion of SMESH idl descriptions -// File : StdMeshers_FixedPoints1D.hxx -// Author : Damien COQUERET, OCC -// Module : SMESH -// -#ifndef _SMESH_FIXEDPOINTS1D_HXX_ -#define _SMESH_FIXEDPOINTS1D_HXX_ - - - -#include "SMESH_StdMeshers.hxx" - -#include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" - -#include - -class STDMESHERS_EXPORT StdMeshers_FixedPoints1D: - public SMESH_Hypothesis -{ -public: - StdMeshers_FixedPoints1D(int hypId, int studyId, SMESH_Gen* gen); - virtual ~StdMeshers_FixedPoints1D(); - - void SetPoints(std::vector& listParams) - throw(SALOME_Exception); - - void SetNbSegments(std::vector& listNbSeg) - throw(SALOME_Exception); - - const std::vector& GetPoints() const { return _params; } - - const std::vector& GetNbSegments() const { return _nbsegs; } - - void SetReversedEdges( std::vector& ids); - - void SetObjectEntry( const char* entry ) { _objEntry = entry; } - - const char* GetObjectEntry() { return _objEntry.c_str(); } - - const std::vector& GetReversedEdges() const { return _edgeIDs; } - - virtual std::ostream & SaveTo(std::ostream & save); - virtual std::istream & LoadFrom(std::istream & load); - friend std::ostream& operator << (std::ostream & save, StdMeshers_FixedPoints1D & hyp); - friend std::istream& operator >> (std::istream & load, StdMeshers_FixedPoints1D & hyp); - - /*! - * \brief Initialize start and end length by the mesh built on the geometry - * \param theMesh - the built mesh - * \param theShape - the geometry of interest - * \retval bool - true if parameter values have been successfully defined - */ - virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - - /*! - * \brief Initialize my parameter values by default parameters. - * \retval bool - true if parameter values have been successfully defined - */ - virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0); - -protected: - std::vector _params; - std::vector _nbsegs; - std::vector _edgeIDs; - std::string _objEntry; -}; - -#endif diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Hexa_3D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Hexa_3D.hxx index d34d812dd8..b912d60145 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Hexa_3D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Hexa_3D.hxx @@ -33,7 +33,7 @@ #include "SMESH_3D_Algo.hxx" #include "SMESH_Mesh.hxx" #include "StdMeshers_Quadrangle_2D.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include "SMESH_MesherHelper.hxx" @@ -75,10 +75,7 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) - /*throw (SALOME_Exception)*/; - - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); + /*throw (SMESH_Exception)*/; static TopoDS_Vertex OppositeVertex(const TopoDS_Vertex& aVertex, const TopTools_IndexedMapOfShape& aQuads0Vertices, diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_LayerDistribution.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_LayerDistribution.hxx index aca054d4fb..cfef8fbda9 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_LayerDistribution.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_LayerDistribution.hxx @@ -23,6 +23,7 @@ // File : StdMeshers_LayerDistribution.hxx // Author : Edward AGAPOV // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LayerDistribution.hxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $ // #ifndef _SMESH_LayerDistribution_HXX_ #define _SMESH_LayerDistribution_HXX_ @@ -30,7 +31,7 @@ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include @@ -59,7 +60,7 @@ public: * \param hyp1D - 1D hypothesis */ void SetLayerDistribution(SMESH_Hypothesis* hyp1D) - throw ( SALOME_Exception ); + throw ( SMESH_Exception ); /*! * \brief Returns 1D hypothesis specifying distribution of layers @@ -82,7 +83,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_LayerDistribution2D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_LayerDistribution2D.hxx deleted file mode 100644 index d06b6ead2c..0000000000 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_LayerDistribution2D.hxx +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMESH : idl implementation based on 'SMESH' unit's calsses -// File : StdMeshers_LayerDistribution2D.hxx -// Author : Edward AGAPOV -// Module : SMESH -// -#ifndef _SMESH_LayerDistribution2D_HXX_ -#define _SMESH_LayerDistribution2D_HXX_ - -#include "StdMeshers_LayerDistribution.hxx" - - -// ========================================================= -// ========================================================= -/*! - * This hypothesis is used by "Radial quadrangle" algorithm. - * It specifies 1D hypothesis defining distribution of segments - * between the internal and the external surfaces. - */ -// ========================================================= -// ========================================================= - -class STDMESHERS_EXPORT StdMeshers_LayerDistribution2D - :public StdMeshers_LayerDistribution -{ -public: - // Constructor - StdMeshers_LayerDistribution2D(int hypId, int studyId, SMESH_Gen* gen); - // Destructor - virtual ~StdMeshers_LayerDistribution2D(); - -}; - -#endif - diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_LengthFromEdges.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_LengthFromEdges.hxx index cb52638e57..7703079876 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_LengthFromEdges.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_LengthFromEdges.hxx @@ -24,15 +24,15 @@ // Moved here from SMESH_LengthFromEdges.hxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LengthFromEdges.hxx,v 1.8.2.1 2008/11/27 13:03:50 abd Exp $ // - #ifndef _SMESH_LENGTHFROMEDGES_HXX_ #define _SMESH_LENGTHFROMEDGES_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" class STDMESHERS_EXPORT StdMeshers_LengthFromEdges: public SMESH_Hypothesis @@ -42,7 +42,7 @@ public: virtual ~StdMeshers_LengthFromEdges(); void SetMode(int mode) - throw (SALOME_Exception); + throw (SMESH_Exception); int GetMode(); @@ -61,7 +61,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_LocalLength.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_LocalLength.hxx index 1c8d72b278..cbbf995a39 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_LocalLength.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_LocalLength.hxx @@ -24,15 +24,15 @@ // Moved here from SMESH_LocalLength.hxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LocalLength.hxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $ // - #ifndef _SMESH_LOCALLENGTH_HXX_ #define _SMESH_LOCALLENGTH_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" class STDMESHERS_EXPORT StdMeshers_LocalLength: public SMESH_Hypothesis { @@ -40,8 +40,8 @@ class STDMESHERS_EXPORT StdMeshers_LocalLength: public SMESH_Hypothesis StdMeshers_LocalLength(int hypId, int studyId, SMESH_Gen * gen); virtual ~ StdMeshers_LocalLength(); - void SetLength(double length) throw(SALOME_Exception); - void SetPrecision(double precision) throw(SALOME_Exception); + void SetLength(double length) throw(SMESH_Exception); + void SetPrecision(double precision) throw(SMESH_Exception); double GetLength() const; double GetPrecision() const; @@ -59,7 +59,7 @@ class STDMESHERS_EXPORT StdMeshers_LocalLength: public SMESH_Hypothesis */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_MEFISTO_2D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_MEFISTO_2D.hxx index 73075dc074..8b0d0a964a 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_MEFISTO_2D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_MEFISTO_2D.hxx @@ -24,7 +24,7 @@ // Moved here from SMESH_MEFISTO_2D.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx,v 1.9.2.2 2008/11/27 13:03:49 abd Exp $ // #ifndef _StdMeshers_MEFISTO_2D_HXX_ #define _StdMeshers_MEFISTO_2D_HXX_ @@ -57,9 +57,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - typedef boost::shared_ptr< StdMeshers_FaceSide> StdMeshers_FaceSidePtr; typedef std::vector< StdMeshers_FaceSidePtr > TWireVector; diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_MaxElementArea.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_MaxElementArea.hxx index 0950673639..ae2c34c77f 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_MaxElementArea.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_MaxElementArea.hxx @@ -24,6 +24,7 @@ // Moved here from SMESH_MaxElementArea.hxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MaxElementArea.hxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $ // #ifndef _SMESH_MAXELEMENTAREA_HXX_ #define _SMESH_MAXELEMENTAREA_HXX_ @@ -31,7 +32,7 @@ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" class STDMESHERS_EXPORT StdMeshers_MaxElementArea:public SMESH_Hypothesis { @@ -39,7 +40,7 @@ public: StdMeshers_MaxElementArea(int hypId, int studyId, SMESH_Gen * gen); virtual ~ StdMeshers_MaxElementArea(); - void SetMaxArea(double maxArea) throw(SALOME_Exception); + void SetMaxArea(double maxArea) throw(SMESH_Exception); double GetMaxArea() const; @@ -56,7 +57,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_MaxElementVolume.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_MaxElementVolume.hxx index 6395fd419e..e9dacb2370 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_MaxElementVolume.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_MaxElementVolume.hxx @@ -24,14 +24,15 @@ // Moved here from SMESH_MaxElementVolume.hxx // Author : Paul RASCLE, EDF // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MaxElementVolume.hxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $ +// #ifndef _SMESH_MAXELEMENTVOLUME_HXX_ #define _SMESH_MAXELEMENTVOLUME_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" class STDMESHERS_EXPORT StdMeshers_MaxElementVolume: public SMESH_Hypothesis @@ -41,7 +42,7 @@ public: virtual ~StdMeshers_MaxElementVolume(); void SetMaxVolume(double maxVolume) - throw (SALOME_Exception); + throw (SMESH_Exception); double GetMaxVolume() const; @@ -58,7 +59,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_MaxLength.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_MaxLength.hxx index 23d94a9f28..ead29f2aa9 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_MaxLength.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_MaxLength.hxx @@ -28,7 +28,7 @@ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" class STDMESHERS_EXPORT StdMeshers_MaxLength: public SMESH_Hypothesis { @@ -36,7 +36,7 @@ class STDMESHERS_EXPORT StdMeshers_MaxLength: public SMESH_Hypothesis StdMeshers_MaxLength(int hypId, int studyId, SMESH_Gen * gen); virtual ~ StdMeshers_MaxLength(); - void SetLength(double length) throw(SALOME_Exception); + void SetLength(double length) throw(SMESH_Exception); double GetLength() const; bool HavePreestimatedLength() const { return _preestimated > 0.; } diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_NotConformAllowed.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_NotConformAllowed.hxx index ddcfcb445d..371ed82e59 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_NotConformAllowed.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_NotConformAllowed.hxx @@ -23,6 +23,7 @@ // File : StdMeshers_NotConformAllowed.hxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NotConformAllowed.hxx,v 1.8.2.1 2008/11/27 13:03:50 abd Exp $ // #ifndef _StdMeshers_NotConformAllowed_HXX_ #define _StdMeshers_NotConformAllowed_HXX_ @@ -30,7 +31,7 @@ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" class STDMESHERS_EXPORT StdMeshers_NotConformAllowed: public SMESH_Hypothesis @@ -54,7 +55,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfLayers.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfLayers.hxx index ebaae84a91..fad0c69eba 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfLayers.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfLayers.hxx @@ -23,6 +23,7 @@ // File : StdMeshers_NumberOfLayers.hxx // Author : Edward AGAPOV // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NumberOfLayers.hxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $ // #ifndef _SMESH_NumberOfLayers_HXX_ #define _SMESH_NumberOfLayers_HXX_ @@ -30,7 +31,7 @@ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" class SMESH_Gen; @@ -53,7 +54,7 @@ public: virtual ~StdMeshers_NumberOfLayers(); // Sets parameter value - void SetNumberOfLayers(int numberOfLayers) throw ( SALOME_Exception ); + void SetNumberOfLayers(int numberOfLayers) throw ( SMESH_Exception ); // Returns parameter value int GetNumberOfLayers() const; @@ -73,7 +74,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfLayers2D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfLayers2D.hxx deleted file mode 100644 index 42690f0e5d..0000000000 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfLayers2D.hxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMESH : idl implementation based on 'SMESH' unit's calsses -// File : StdMeshers_NumberOfLayers2D.hxx -// Author : Edward AGAPOV -// Module : SMESH -// -#ifndef _SMESH_NumberOfLayers2D_HXX_ -#define _SMESH_NumberOfLayers2D_HXX_ - -#include "StdMeshers_NumberOfLayers.hxx" - - -// ========================================================= -// ========================================================= -/*! - * This hypothesis is used by "Radial quadrangle" algorithm. - * It specifies number of segments between the internal - * and the external surfaces. - */ -// ========================================================= -// ========================================================= - -class STDMESHERS_EXPORT StdMeshers_NumberOfLayers2D - : public StdMeshers_NumberOfLayers -{ -public: - // Constructor - StdMeshers_NumberOfLayers2D(int hypId, int studyId, SMESH_Gen* gen); - // Destructor - virtual ~StdMeshers_NumberOfLayers2D(); -}; - -#endif - diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfSegments.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfSegments.hxx index 985d192b22..73aa841e6c 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfSegments.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_NumberOfSegments.hxx @@ -24,6 +24,7 @@ // Moved here from SMESH_NumberOfSegments.hxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NumberOfSegments.hxx,v 1.12.2.1 2008/11/27 13:03:50 abd Exp $ // #ifndef _SMESH_NUMBEROFSEGMENTS_HXX_ #define _SMESH_NUMBEROFSEGMENTS_HXX_ @@ -31,7 +32,7 @@ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include /*! @@ -48,15 +49,15 @@ public: virtual ~StdMeshers_NumberOfSegments(); // Builds point distribution according to passed function - const std::vector& BuildDistributionExpr( const char*, int, int ) throw ( SALOME_Exception ); - const std::vector& BuildDistributionTab( const std::vector&, int, int ) throw ( SALOME_Exception ); + const std::vector& BuildDistributionExpr( const char*, int, int ) throw ( SMESH_Exception ); + const std::vector& BuildDistributionTab( const std::vector&, int, int ) throw ( SMESH_Exception ); /*! * \brief Set the number of segments * \param segmentsNumber - must be greater than zero */ void SetNumberOfSegments(int segmentsNumber) - throw (SALOME_Exception); + throw (SMESH_Exception); /*! * \brief Get the number of segments @@ -78,7 +79,7 @@ public: * \brief Set distribution type */ void SetDistrType(DistrType typ) - throw (SALOME_Exception); + throw (SMESH_Exception); /*! * \brief Get distribution type @@ -89,19 +90,19 @@ public: * \brief Set scale factor for scale distribution * \param scaleFactor - positive value different from 1 * - * Throws SALOME_Exception if distribution type is not DT_Scale, + * Throws SMESH_Exception if distribution type is not DT_Scale, * or scaleFactor is not a positive value different from 1 */ virtual void SetScaleFactor(double scaleFactor) - throw (SALOME_Exception); + throw (SMESH_Exception); /*! * \brief Get scale factor for scale distribution * - * Throws SALOME_Exception if distribution type is not DT_Scale + * Throws SMESH_Exception if distribution type is not DT_Scale */ double GetScaleFactor() const - throw (SALOME_Exception); + throw (SMESH_Exception); /*! * \brief Set table function for distribution DT_TabFunc @@ -110,36 +111,36 @@ public: * must be even. The parameters must be in range [0,1] and sorted in * increase order. The values of function must be positive. * - * Throws SALOME_Exception if distribution type is not DT_TabFunc + * Throws SMESH_Exception if distribution type is not DT_TabFunc */ void SetTableFunction(const std::vector& table) - throw (SALOME_Exception); + throw (SMESH_Exception); /*! * \brief Get table function for distribution DT_TabFunc * - * Throws SALOME_Exception if distribution type is not DT_TabFunc + * Throws SMESH_Exception if distribution type is not DT_TabFunc */ const std::vector& GetTableFunction() const - throw (SALOME_Exception); + throw (SMESH_Exception); /*! * \brief Set expression function for distribution DT_ExprFunc * \param expr - string containing the expression of the function * f(t), e.g. "sin(t)" * - * Throws SALOME_Exception if distribution type is not DT_ExprFunc + * Throws SMESH_Exception if distribution type is not DT_ExprFunc */ void SetExpressionFunction( const char* expr) - throw (SALOME_Exception); + throw (SMESH_Exception); /*! * \brief Get expression function for distribution DT_ExprFunc * - * Throws SALOME_Exception if distribution type is not DT_ExprFunc + * Throws SMESH_Exception if distribution type is not DT_ExprFunc */ const char* GetExpressionFunction() const - throw (SALOME_Exception); + throw (SMESH_Exception); /*! * \brief Set conversion mode. When it is 0, it means "exponent mode": @@ -148,26 +149,19 @@ public: * F(t), where F(t0)=f(t0), if f(t0)>=0, otherwise F(t0) = 0. * This mode is sensible only when function distribution is used (DT_TabFunc or DT_ExprFunc) * - * Throws SALOME_Exception if distribution type is not functional + * Throws SMESH_Exception if distribution type is not functional */ void SetConversionMode( int conv ) - throw (SALOME_Exception); + throw (SMESH_Exception); /*! * \brief Returns conversion mode * - * Throws SALOME_Exception if distribution type is not functional + * Throws SMESH_Exception if distribution type is not functional */ int ConversionMode() const - throw (SALOME_Exception); + throw (SMESH_Exception); - void SetReversedEdges( std::vector& ids); - - void SetObjectEntry( const char* entry ) { _objEntry = entry; } - - const char* GetObjectEntry() { return _objEntry.c_str(); } - - const std::vector& GetReversedEdges() const { return _edgeIDs; } /*! * \brief Initialize number of segments by the mesh built on the geometry @@ -177,7 +171,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ @@ -195,8 +189,6 @@ protected: std::vector _table, _distr; //!< the table for DT_TabFunc, a sequence of pairs of numbers std::string _func; //!< the expression of the function for DT_ExprFunc int _convMode; //!< flag of conversion mode: 0=exponent, 1=cut negative - std::vector _edgeIDs; //!< list of reversed edges ids - std::string _objEntry; //!< Entry of the main object to reverse edges }; #endif diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Penta_3D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Penta_3D.hxx index 882c3b4f34..9ca4b3d2bd 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Penta_3D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Penta_3D.hxx @@ -45,7 +45,6 @@ #include "SMESH_Block.hxx" #include "SMESH_ComputeError.hxx" #include "SMESH_MesherHelper.hxx" -#include "SMESH_3D_Algo.hxx" typedef std::map< double, std::vector > StdMeshers_IJNodeMap; @@ -205,9 +204,6 @@ class STDMESHERS_EXPORT StdMeshers_Penta_3D { // The key of theIJNodes map is a normalized parameter of each // 0-the node on theBaseEdge. - bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - protected: // methods @@ -217,8 +213,8 @@ class STDMESHERS_EXPORT StdMeshers_Penta_3D { void MakeNodes(); - double SetHorizEdgeXYZ(const gp_XYZ& aBNXYZ, - const int aFaceID, + double SetHorizEdgeXYZ(const gp_XYZ& aBNXYZ, + const int aFaceID, std::vector*& aCol1, std::vector*& aCol2); @@ -266,7 +262,7 @@ class STDMESHERS_EXPORT StdMeshers_Penta_3D { std::map < int, int > myConnectingMap; // std::vector myWallNodesMaps; // nodes on a face - std::vector myShapeXYZ; // point on each sub-shape + std::vector myShapeXYZ; // point on each sub-shape bool myCreateQuadratic; SMESH_MesherHelper* myTool; // tool building quadratic elements diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Prism_3D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Prism_3D.hxx index d258bb4328..5c29f63ecc 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Prism_3D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Prism_3D.hxx @@ -379,9 +379,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - /*! * \brief Enable removal of quadrangles from the bottom face and * triangles creation there by projection from the top diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource1D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource1D.hxx index 301dedf304..e3b7ca46ea 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource1D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource1D.hxx @@ -23,6 +23,7 @@ // File : StdMeshers_ProjectionSource1D.hxx // Author : Edward AGAPOV // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $ // #ifndef _SMESH_ProjectionSource1D_HXX_ #define _SMESH_ProjectionSource1D_HXX_ @@ -30,7 +31,7 @@ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include @@ -56,7 +57,7 @@ public: * Sets source to take a mesh pattern from */ void SetSourceEdge(const TopoDS_Shape& edge) - throw ( SALOME_Exception ); + throw ( SMESH_Exception ); /*! * Returns the source edge or a group containing edges @@ -85,7 +86,7 @@ public: */ void SetVertexAssociation(const TopoDS_Shape& sourceVertex, const TopoDS_Shape& targetVertex) - throw ( SALOME_Exception ); + throw ( SMESH_Exception ); /*! * Returns the vertex associated with the target vertex. @@ -136,7 +137,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource2D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource2D.hxx index a23d4c4948..1ea4f9eee3 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource2D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource2D.hxx @@ -23,14 +23,15 @@ // File : StdMeshers_ProjectionSource2D.hxx // Author : Edward AGAPOV // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $ +// #ifndef _SMESH_ProjectionSource2D_HXX_ #define _SMESH_ProjectionSource2D_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include @@ -56,7 +57,7 @@ public: * Sets a source to take a mesh pattern from */ void SetSourceFace(const TopoDS_Shape& face) - throw ( SALOME_Exception ); + throw ( SMESH_Exception ); /*! * Returns the source face or a group containing faces @@ -88,21 +89,21 @@ public: const TopoDS_Shape& sourceVertex2, const TopoDS_Shape& targetVertex1, const TopoDS_Shape& targetVertex2) - throw ( SALOME_Exception ); + throw ( SMESH_Exception ); /*! * Returns the -th source vertex associated with the -th target vertex. * Result may be nil if association not set. * Valid indices are 1 and 2 */ - TopoDS_Vertex GetSourceVertex(int i) const throw ( SALOME_Exception ); + TopoDS_Vertex GetSourceVertex(int i) const throw ( SMESH_Exception ); /*! * Returns the -th target vertex associated with the -th source vertex. * Result may be nil if association not set. * Valid indices are 1 and 2 */ - TopoDS_Vertex GetTargetVertex(int i) const throw ( SALOME_Exception ); + TopoDS_Vertex GetTargetVertex(int i) const throw ( SMESH_Exception ); /*! * \brief Test if vertex association defined diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource3D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource3D.hxx index fd6848aec6..011e2bdcbd 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource3D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionSource3D.hxx @@ -23,14 +23,15 @@ // File : StdMeshers_ProjectionSource3D.hxx // Author : Edward AGAPOV // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $ +// #ifndef _SMESH_ProjectionSource3D_HXX_ #define _SMESH_ProjectionSource3D_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include @@ -56,7 +57,7 @@ public: * Sets a source to take a mesh pattern from */ void SetSource3DShape(const TopoDS_Shape& shape) - throw ( SALOME_Exception ); + throw ( SMESH_Exception ); /*! * Returns the source shape @@ -82,19 +83,19 @@ public: const TopoDS_Shape& sourceVertex2, const TopoDS_Shape& targetVertex1, const TopoDS_Shape& targetVertex2) - throw ( SALOME_Exception ); + throw ( SMESH_Exception ); /*! * Returns the -th source vertex associated with the -th target vertex. * Result may be nil if association not set. */ - TopoDS_Vertex GetSourceVertex(int i) const throw ( SALOME_Exception ); + TopoDS_Vertex GetSourceVertex(int i) const throw ( SMESH_Exception ); /*! * Returns the -th target vertex associated with the -th source vertex. * Result may be nil if association not set. */ - TopoDS_Vertex GetTargetVertex(int i) const throw ( SALOME_Exception ); + TopoDS_Vertex GetTargetVertex(int i) const throw ( SMESH_Exception ); /*! * \brief Test if vertex association defined @@ -138,7 +139,7 @@ public: */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionUtils.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionUtils.hxx index dab5755037..1a02166c75 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionUtils.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionUtils.hxx @@ -81,10 +81,10 @@ class StdMeshers_ProjectionUtils * \param edges2 - out list of edges of face 2 * \retval int - nb of edges in an outer wire in a success case, else zero */ - static int FindFaceAssociation(const TopoDS_Face& face1, - TopoDS_Vertex VV1[2], - const TopoDS_Face& face2, - TopoDS_Vertex VV2[2], + static int FindFaceAssociation(const TopoDS_Face& face1, + TopoDS_Vertex VV1[2], + const TopoDS_Face& face2, + TopoDS_Vertex VV2[2], std::list< TopoDS_Edge > & edges1, std::list< TopoDS_Edge > & edges2); diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_1D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_1D.hxx index be003ed7b6..52f76e1704 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_1D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_1D.hxx @@ -46,9 +46,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - /*! * \brief Sets a default event listener to submesh of the source edge * \param whenSetToSubMesh - submesh where algo is set diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_2D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_2D.hxx index 26506e81a7..2619a0fb51 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_2D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_2D.hxx @@ -44,9 +44,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - /*! * \brief Sets a default event listener to submesh of the source face * \param whenSetToSubMesh - submesh where algo is set @@ -57,7 +54,7 @@ public: * the whenSetToSubMesh submesh. */ virtual void SetEventListener(SMESH_subMesh* whenSetToSubMesh); - + protected: const StdMeshers_ProjectionSource2D* _sourceHypo; diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_3D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_3D.hxx index 8f95545091..7f4200ef42 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_3D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Projection_3D.hxx @@ -44,9 +44,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - /*! * \brief Sets a default event listener to submesh of the source shape * \param whenSetToSubMesh - submesh where algo is set diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Propagation.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Propagation.hxx index b02f9aebe0..fc69cccf83 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Propagation.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Propagation.hxx @@ -30,7 +30,7 @@ #include "SMESH_Hypothesis.hxx" #include "SMESH_subMeshEventListener.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" #include diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_QuadToTriaAdaptor.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_QuadToTriaAdaptor.hxx index 89d747cbe0..02fe44321d 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_QuadToTriaAdaptor.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_QuadToTriaAdaptor.hxx @@ -27,7 +27,7 @@ #define _SMESH_QuadToTriaAdaptor_HXX_ #include -#include "SMESH_StdMeshers.hxx" +#include #include #include #include diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_QuadrangleParams.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_QuadrangleParams.hxx deleted file mode 100644 index ab1c56fabf..0000000000 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_QuadrangleParams.hxx +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMESH : implementaion of SMESH idl descriptions -// File : StdMeshers_QuadrangleParams.hxx -// Author : Sergey KUUL, OCC -// Module : SMESH -// -#ifndef _SMESH_QUADRANGLEPARAMS_HXX_ -#define _SMESH_QUADRANGLEPARAMS_HXX_ - - - -#include "SMESH_StdMeshers.hxx" - -#include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" - -class STDMESHERS_EXPORT StdMeshers_QuadrangleParams: - public SMESH_Hypothesis -{ -public: - StdMeshers_QuadrangleParams(int hypId, int studyId, SMESH_Gen* gen); - virtual ~StdMeshers_QuadrangleParams(); - - void SetTriaVertex(int id); - - void SetObjectEntry( const char* entry ) { _objEntry = entry; } - - const char* GetObjectEntry() { return _objEntry.c_str(); } - - int GetTriaVertex() const { return _triaVertexID; } - - virtual std::ostream & SaveTo(std::ostream & save); - virtual std::istream & LoadFrom(std::istream & load); - friend std::ostream& operator << (std::ostream & save, - StdMeshers_QuadrangleParams & hyp); - friend std::istream& operator >> (std::istream & load, - StdMeshers_QuadrangleParams & hyp); - - /*! - * \brief Initialize start and end length by the mesh built on the geometry - * \param theMesh - the built mesh - * \param theShape - the geometry of interest - * \retval bool - true if parameter values have been successfully defined - */ - virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, - const TopoDS_Shape& theShape); - - /*! - * \brief Initialize my parameter values by default parameters. - * \retval bool - true if parameter values have been successfully defined - */ - virtual bool SetParametersByDefaults(const TDefaults& dflts, - const SMESH_Mesh* theMesh=0); - -protected: - int _triaVertexID; - std::string _objEntry; -}; - -#endif diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_QuadranglePreference.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_QuadranglePreference.hxx index ec641d15a8..c8f87758d1 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_QuadranglePreference.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_QuadranglePreference.hxx @@ -22,14 +22,15 @@ // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_QuadranglePreference.hxx // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_QuadranglePreference.hxx,v 1.4.2.1 2008/11/27 13:03:49 abd Exp $ +// #ifndef _StdMeshers_QuadranglePreference_HXX_ #define _StdMeshers_QuadranglePreference_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" /*! * \brief Hypothesis for StdMeshers_Quadrangle_2D, forcing construction @@ -58,7 +59,7 @@ class STDMESHERS_EXPORT StdMeshers_QuadranglePreference:public SMESH_Hypothesis */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Quadrangle_2D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Quadrangle_2D.hxx index 25083af320..74cf8cf434 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Quadrangle_2D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Quadrangle_2D.hxx @@ -24,7 +24,7 @@ // Moved here from SMESH_Quadrangle_2D.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx,v 1.12.2.4 2008/11/27 13:03:50 abd Exp $ // #ifndef _SMESH_QUADRANGLE_2D_HXX_ #define _SMESH_QUADRANGLE_2D_HXX_ @@ -32,7 +32,7 @@ #include "SMESH_StdMeshers.hxx" #include "SMESH_2D_Algo.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" class SMESH_Mesh; class SMESH_MesherHelper; @@ -40,7 +40,6 @@ class StdMeshers_FaceSide; class SMDS_MeshNode; struct uvPtStruct; - enum TSideID { BOTTOM_SIDE=0, RIGHT_SIDE, TOP_SIDE, LEFT_SIDE, NB_SIDES }; typedef uvPtStruct UVPtStruct; @@ -65,9 +64,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, const bool CreateQuadratic); @@ -77,12 +73,6 @@ protected: FaceQuadStruct* CheckNbEdges(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - bool CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap, - std::vector& aNbNodes, - bool& IsQuadratic); - bool SetNormalizedGrid(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, FaceQuadStruct*& quad); @@ -101,12 +91,6 @@ protected: const TopoDS_Shape& aShape, FaceQuadStruct* quad); - bool EvaluateQuadPref(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - std::vector& aNbNodes, - MapShapeNbElems& aResMap, - bool IsQuadratic); - UVPtStruct* LoadEdgePoints2(SMESH_Mesh& aMesh, const TopoDS_Face& F, const TopoDS_Edge& E, bool IsReverse); @@ -121,14 +105,12 @@ protected: // true if QuadranglePreference hypothesis is assigned that forces // construction of quadrangles if the number of nodes on opposite edges - // is not the same in the case where the global number of nodes on edges - // is even + // is not the same in the case where the global number of nodes on edges is even bool myQuadranglePreference; bool myTrianglePreference; - int myTriaVertexID; - + SMESH_MesherHelper* myTool; // tool for working with quadratic elements }; diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_QuadraticMesh.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_QuadraticMesh.hxx index 9972469c0a..f0308fe2e0 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_QuadraticMesh.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_QuadraticMesh.hxx @@ -22,14 +22,15 @@ // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_QuadraticMesh.hxx // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_QuadraticMesh.hxx,v 1.4.2.1 2008/11/27 13:03:50 abd Exp $ +// #ifndef _StdMeshers_QuadraticMesh_HXX_ #define _StdMeshers_QuadraticMesh_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" /*! * \brief Hypothesis for StdMeshers_Regular_1D, forcing construction of quadratic edges. @@ -60,7 +61,7 @@ class STDMESHERS_EXPORT StdMeshers_QuadraticMesh:public SMESH_Hypothesis */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_RadialPrism_3D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_RadialPrism_3D.hxx index 21d8f8362f..d0c7835221 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_RadialPrism_3D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_RadialPrism_3D.hxx @@ -51,9 +51,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - protected: typedef std::vector TNodeColumn; diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_RadialQuadrangle_1D2D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_RadialQuadrangle_1D2D.hxx deleted file mode 100644 index 10a1203651..0000000000 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_RadialQuadrangle_1D2D.hxx +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMESH : implementaion of SMESH idl descriptions -// File : StdMeshers_RadialQuadrangle_1D2D.hxx -// Module : SMESH -// -#ifndef _SMESH_RadialQuadrangle_1D2D_HXX_ -#define _SMESH_RadialQuadrangle_1D2D_HXX_ - -#include "SMESH_StdMeshers.hxx" - -#include "SMESH_2D_Algo.hxx" -//#include "SMDS_MeshNode.hxx" - -//#include -//#include - -class StdMeshers_NumberOfLayers; -class StdMeshers_LayerDistribution; -class SMESH_MesherHelper; -class gp_Pnt; - -class STDMESHERS_EXPORT StdMeshers_RadialQuadrangle_1D2D: public SMESH_2D_Algo -{ -public: - StdMeshers_RadialQuadrangle_1D2D(int hypId, int studyId, SMESH_Gen* gen); - virtual ~StdMeshers_RadialQuadrangle_1D2D(); - - virtual bool CheckHypothesis(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - SMESH_Hypothesis::Hypothesis_Status& aStatus); - - virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - /*! - * \brief Allow algo to do something after persistent restoration - * \param subMesh - restored submesh - * - * This method is called only if a submesh has HYP_OK algo_state. - */ - virtual void SubmeshRestored(SMESH_subMesh* subMesh); - -protected: - - bool computeLayerPositions(const gp_Pnt& pIn, - const gp_Pnt& pOut); - - - const StdMeshers_NumberOfLayers* myNbLayerHypo; - const StdMeshers_LayerDistribution* myDistributionHypo; - SMESH_MesherHelper* myHelper; - std::vector< double > myLayerPositions; -}; - -#endif diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_Regular_1D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_Regular_1D.hxx index 86a573c549..7df8e45338 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_Regular_1D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_Regular_1D.hxx @@ -32,8 +32,6 @@ #include "SMESH_1D_Algo.hxx" -#include "StdMeshers_FixedPoints1D.hxx" - class Adaptor3d_Curve; class TopoDS_Vertex; class StdMeshers_SegmentLengthAroundVertex; @@ -51,9 +49,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); - virtual const std::list & GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool=true); @@ -99,7 +94,7 @@ protected: StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh & theMesh, const TopoDS_Vertex & theV); - enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, NONE }; + enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, NONE }; enum ValueIndex { SCALE_FACTOR_IND = 0, @@ -125,13 +120,10 @@ protected: HypothesisType _hypType; - const StdMeshers_FixedPoints1D* _fpHyp; - double _value[2]; int _ivalue[3]; std::vector _vvalue[1]; std::string _svalue[1]; - std::vector _revEdgesIDs; // a source of propagated hypothesis, is set by CheckHypothesis() // always called before Compute() diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_SegmentAroundVertex_0D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_SegmentAroundVertex_0D.hxx index a2f1bd579b..4054a715d5 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_SegmentAroundVertex_0D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_SegmentAroundVertex_0D.hxx @@ -46,8 +46,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); }; #endif diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_SegmentLengthAroundVertex.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_SegmentLengthAroundVertex.hxx index c7c54bbf68..ca56795248 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_SegmentLengthAroundVertex.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_SegmentLengthAroundVertex.hxx @@ -23,14 +23,15 @@ // File : StdMeshers_SegmentLengthAroundVertex.hxx // Author : Paul RASCLE, EDF // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $ +// #ifndef _SMESH_SegmentLengthAroundVertex_HXX_ #define _SMESH_SegmentLengthAroundVertex_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" /*! * \brief This hypothesis specifies length of segments adjacent to the vertex the @@ -42,7 +43,7 @@ class STDMESHERS_EXPORT StdMeshers_SegmentLengthAroundVertex:public SMESH_Hypoth StdMeshers_SegmentLengthAroundVertex(int hypId, int studyId, SMESH_Gen * gen); virtual ~ StdMeshers_SegmentLengthAroundVertex(); - void SetLength(double length) throw(SALOME_Exception); + void SetLength(double length) throw(SMESH_Exception); double GetLength() const; @@ -59,7 +60,7 @@ class STDMESHERS_EXPORT StdMeshers_SegmentLengthAroundVertex:public SMESH_Hypoth */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_StartEndLength.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_StartEndLength.hxx index 35ae4e0c45..1794fc0409 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_StartEndLength.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_StartEndLength.hxx @@ -22,16 +22,15 @@ // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_StartEndLength.hxx // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_StartEndLength.hxx,v 1.7.2.1 2008/11/27 13:03:50 abd Exp $ +// #ifndef _STDMESHERS_STARTENDLENGTH_HXX_ #define _STDMESHERS_STARTENDLENGTH_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" - -#include +#include "SMESH_Exception.hxx" class STDMESHERS_EXPORT StdMeshers_StartEndLength:public SMESH_Hypothesis { @@ -39,17 +38,9 @@ class STDMESHERS_EXPORT StdMeshers_StartEndLength:public SMESH_Hypothesis StdMeshers_StartEndLength(int hypId, int studyId, SMESH_Gen * gen); virtual ~ StdMeshers_StartEndLength(); - void SetLength(double length, bool isStartLength) throw(SALOME_Exception); + void SetLength(double length, bool isStartLength) throw(SMESH_Exception); double GetLength(bool isStartLength) const; - - void SetReversedEdges( std::vector& ids); - - const std::vector& GetReversedEdges() const { return _edgeIDs; } - - void SetObjectEntry( const char* entry ) { _objEntry = entry; } - - const char* GetObjectEntry() { return _objEntry.c_str(); } virtual std::ostream & SaveTo(std::ostream & save); virtual std::istream & LoadFrom(std::istream & load); @@ -65,7 +56,7 @@ class STDMESHERS_EXPORT StdMeshers_StartEndLength:public SMESH_Hypothesis */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ @@ -73,8 +64,6 @@ class STDMESHERS_EXPORT StdMeshers_StartEndLength:public SMESH_Hypothesis protected: double _begLength, _endLength; - std::vector _edgeIDs; - std::string _objEntry; }; #endif diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_TrianglePreference.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_TrianglePreference.hxx index 34ec364a16..1b26190cac 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_TrianglePreference.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_TrianglePreference.hxx @@ -22,14 +22,15 @@ // SMESH StdMeshers : implementaion of SMESH idl descriptions // File : StdMeshers_TrianglePreference.hxx // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/Attic/StdMeshers_TrianglePreference.hxx,v 1.1.4.2 2008/11/27 13:03:50 abd Exp $ +// #ifndef _StdMeshers_TrianglePreference_HXX_ #define _StdMeshers_TrianglePreference_HXX_ #include "SMESH_StdMeshers.hxx" #include "SMESH_Hypothesis.hxx" -#include "Utils_SALOME_Exception.hxx" +#include "SMESH_Exception.hxx" /*! * \brief Hypothesis for StdMeshers_Quadrangle_2D, forcing construction @@ -57,7 +58,7 @@ class STDMESHERS_EXPORT StdMeshers_TrianglePreference:public SMESH_Hypothesis */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); - /*! + /*! * \brief Initialize my parameter values by default parameters. * \retval bool - true if parameter values have been successfully defined */ diff --git a/src/3rdParty/salomesmesh/inc/StdMeshers_UseExisting_1D2D.hxx b/src/3rdParty/salomesmesh/inc/StdMeshers_UseExisting_1D2D.hxx index 961fb4ba96..6d5a5e495b 100644 --- a/src/3rdParty/salomesmesh/inc/StdMeshers_UseExisting_1D2D.hxx +++ b/src/3rdParty/salomesmesh/inc/StdMeshers_UseExisting_1D2D.hxx @@ -46,8 +46,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); }; class STDMESHERS_EXPORT StdMeshers_UseExisting_1D: public SMESH_1D_Algo @@ -61,8 +59,6 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); - virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap); }; #endif diff --git a/src/3rdParty/salomesmesh/inc/Utils_ExceptHandlers.hxx b/src/3rdParty/salomesmesh/inc/Utils_ExceptHandlers.hxx deleted file mode 100644 index 814ce729ba..0000000000 --- a/src/3rdParty/salomesmesh/inc/Utils_ExceptHandlers.hxx +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _Utils_ExceptHandlers_HXX_ -#define _Utils_ExceptHandlers_HXX_ - -#include -#define SalomeException SmeshException - -#endif diff --git a/src/3rdParty/salomesmesh/inc/Utils_SALOME_Exception.hxx b/src/3rdParty/salomesmesh/inc/Utils_SALOME_Exception.hxx deleted file mode 100644 index ab776fc112..0000000000 --- a/src/3rdParty/salomesmesh/inc/Utils_SALOME_Exception.hxx +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _Utils_SALOME_Exception_HXX_ -#define _Utils_SALOME_Exception_HXX_ - -#include -#define SALOME_Exception SMESH_Exception - -#endif diff --git a/src/3rdParty/salomesmesh/src/Controls/SMESH_Controls.cpp b/src/3rdParty/salomesmesh/src/Controls/SMESH_Controls.cpp index bba92104e1..43920da191 100644 --- a/src/3rdParty/salomesmesh/src/Controls/SMESH_Controls.cpp +++ b/src/3rdParty/salomesmesh/src/Controls/SMESH_Controls.cpp @@ -63,11 +63,6 @@ #include "SMESHDS_Mesh.hxx" #include "SMESHDS_GroupBase.hxx" -#include - -#ifndef PI -#define PI M_PI -#endif /* AUXILIARY METHODS @@ -154,21 +149,21 @@ namespace{ // SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator(); // if ( anIter != 0 ) { // while( anIter->more() ) { -// const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next(); -// if ( aNode == 0 ) -// return 0; -// SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator(); -// while( anElemIter->more() ) { -// const SMDS_MeshElement* anElem = anElemIter->next(); -// if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) { -// int anId = anElem->GetID(); +// const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next(); +// if ( aNode == 0 ) +// return 0; +// SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator(); +// while( anElemIter->more() ) { +// const SMDS_MeshElement* anElem = anElemIter->next(); +// if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) { +// int anId = anElem->GetID(); -// if ( anIter->more() ) // i.e. first node -// aMap.Add( anId ); -// else if ( aMap.Contains( anId ) ) -// aResult++; -// } -// } +// if ( anIter->more() ) // i.e. first node +// aMap.Add( anId ); +// else if ( aMap.Contains( anId ) ) +// aResult++; +// } +// } // } // } @@ -481,9 +476,9 @@ namespace{ inline double getArea(double theHalfPerim, double theTria[3]){ return sqrt(theHalfPerim* - (theHalfPerim-theTria[0])* - (theHalfPerim-theTria[1])* - (theHalfPerim-theTria[2])); + (theHalfPerim-theTria[0])* + (theHalfPerim-theTria[1])* + (theHalfPerim-theTria[2])); } inline double getVolume(double theLen[6]){ @@ -1041,160 +1036,160 @@ double Length2D::GetValue( long theElementId) case SMDSAbs_Node: case SMDSAbs_Edge: if (len == 2){ - aVal = getDistance( P( 1 ), P( 2 ) ); + aVal = getDistance( P( 1 ), P( 2 ) ); break; } else if (len == 3){ // quadratic edge - aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 )); + aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 )); break; } case SMDSAbs_Face: if (len == 3){ // triangles - double L1 = getDistance(P( 1 ),P( 2 )); - double L2 = getDistance(P( 2 ),P( 3 )); - double L3 = getDistance(P( 3 ),P( 1 )); - aVal = Max(L1,Max(L2,L3)); - break; + double L1 = getDistance(P( 1 ),P( 2 )); + double L2 = getDistance(P( 2 ),P( 3 )); + double L3 = getDistance(P( 3 ),P( 1 )); + aVal = Max(L1,Max(L2,L3)); + break; } else if (len == 4){ // quadrangles - double L1 = getDistance(P( 1 ),P( 2 )); - double L2 = getDistance(P( 2 ),P( 3 )); - double L3 = getDistance(P( 3 ),P( 4 )); - double L4 = getDistance(P( 4 ),P( 1 )); - aVal = Max(Max(L1,L2),Max(L3,L4)); - break; + double L1 = getDistance(P( 1 ),P( 2 )); + double L2 = getDistance(P( 2 ),P( 3 )); + double L3 = getDistance(P( 3 ),P( 4 )); + double L4 = getDistance(P( 4 ),P( 1 )); + aVal = Max(Max(L1,L2),Max(L3,L4)); + break; } if (len == 6){ // quadratic triangles - double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 )); - double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 )); - double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 )); - aVal = Max(L1,Max(L2,L3)); + double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 )); + double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 )); + double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 )); + aVal = Max(L1,Max(L2,L3)); //cout<<"L1="<myNodeIDFactory), - myElementIDFactory(parent->myElementIDFactory), - myHasConstructionEdges(false), myHasConstructionFaces(false), - myHasInverseElements(true) + :myParent(parent), myNodeIDFactory(parent->myNodeIDFactory), + myElementIDFactory(parent->myElementIDFactory), + myHasConstructionEdges(false), myHasConstructionFaces(false), + myHasInverseElements(true) { } @@ -137,9 +137,9 @@ SMDS_Mesh::SMDS_Mesh(SMDS_Mesh * parent) SMDS_Mesh *SMDS_Mesh::AddSubMesh() { - SMDS_Mesh *submesh = new SMDS_Mesh(this); - myChildren.insert(myChildren.end(), submesh); - return submesh; + SMDS_Mesh *submesh = new SMDS_Mesh(this); + myChildren.insert(myChildren.end(), submesh); + return submesh; } /////////////////////////////////////////////////////////////////////////////// @@ -173,58 +173,12 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID) return NULL; } -/////////////////////////////////////////////////////////////////////////////// -/// create a Mesh0DElement and add it to the current Mesh -/// @return : The created Mesh0DElement -/////////////////////////////////////////////////////////////////////////////// -SMDS_Mesh0DElement* SMDS_Mesh::Add0DElementWithID(int idnode, int ID) -{ - SMDS_MeshNode * node = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode); - if (!node) return NULL; - return SMDS_Mesh::Add0DElementWithID(node, ID); -} - -/////////////////////////////////////////////////////////////////////////////// -/// create a Mesh0DElement and add it to the current Mesh -/// @return : The created Mesh0DElement -/////////////////////////////////////////////////////////////////////////////// -SMDS_Mesh0DElement* SMDS_Mesh::Add0DElement(const SMDS_MeshNode * node) -{ - return SMDS_Mesh::Add0DElementWithID(node, myElementIDFactory->GetFreeID()); -} - -/////////////////////////////////////////////////////////////////////////////// -/// Create a new Mesh0DElement and at it to the mesh -/// @param idnode ID of the node -/// @param ID ID of the 0D element to create -/// @return The created 0D element or NULL if an element with this -/// ID already exists or if input node is not found. -/////////////////////////////////////////////////////////////////////////////// -SMDS_Mesh0DElement* SMDS_Mesh::Add0DElementWithID(const SMDS_MeshNode * n, int ID) -{ - if (!n) return 0; - - if (my0DElements.Extent() % CHECKMEMORY_INTERVAL == 0) CheckMemory(); - - SMDS_Mesh0DElement * el0d = new SMDS_Mesh0DElement(n); - if (myElementIDFactory->BindID(ID, el0d)) { - SMDS_MeshNode *node = const_cast(n); - node->AddInverseElement(el0d); - my0DElements.Add(el0d); - myInfo.myNb0DElements++; - return el0d; - } - - delete el0d; - return NULL; -} - /////////////////////////////////////////////////////////////////////////////// /// create a MeshEdge and add it to the current Mesh /// @return : The created MeshEdge /////////////////////////////////////////////////////////////////////////////// -SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID) +SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID) { SMDS_MeshNode * node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1); SMDS_MeshNode * node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2); @@ -238,7 +192,7 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID) /////////////////////////////////////////////////////////////////////////////// SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2) + const SMDS_MeshNode * node2) { return SMDS_Mesh::AddEdgeWithID(node1, node2, myElementIDFactory->GetFreeID()); } @@ -253,8 +207,8 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode * node1, /////////////////////////////////////////////////////////////////////////////// SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - int ID) + const SMDS_MeshNode * n2, + int ID) { if ( !n1 || !n2 ) return 0; @@ -266,11 +220,11 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, node1=const_cast(n1); node2=const_cast(n2); node1->AddInverseElement(edge); - node2->AddInverseElement(edge); + node2->AddInverseElement(edge); myEdges.Add(edge); myInfo.myNbEdges++; return edge; - } + } else { delete edge; return NULL; @@ -283,8 +237,8 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, /////////////////////////////////////////////////////////////////////////////// SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3) { return SMDS_Mesh::AddFaceWithID(n1,n2,n3, myElementIDFactory->GetFreeID()); } @@ -299,7 +253,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1, int idnode2, int idnode3, i SMDS_MeshNode * node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2); SMDS_MeshNode * node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3); if(!node1 || !node2 || !node3) return NULL; - return SMDS_Mesh::AddFaceWithID(node1, node2, node3, ID); + return SMDS_Mesh::AddFaceWithID(node1, node2, node3, ID); } /////////////////////////////////////////////////////////////////////////////// @@ -326,9 +280,9 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, /////////////////////////////////////////////////////////////////////////////// SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4) { return SMDS_Mesh::AddFaceWithID(n1,n2,n3, n4, myElementIDFactory->GetFreeID()); } @@ -337,11 +291,11 @@ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1, /// Add a quadrangle defined by its nodes IDs /////////////////////////////////////////////////////////////////////////////// -SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1, - int idnode2, - int idnode3, - int idnode4, - int ID) +SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1, + int idnode2, + int idnode3, + int idnode4, + int ID) { SMDS_MeshNode *node1, *node2, *node3, *node4; node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1); @@ -349,7 +303,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1, node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3); node4 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode4); if(!node1 || !node2 || !node3 || !node4) return NULL; - return SMDS_Mesh::AddFaceWithID(node1, node2, node3, node4, ID); + return SMDS_Mesh::AddFaceWithID(node1, node2, node3, node4, ID); } /////////////////////////////////////////////////////////////////////////////// @@ -453,14 +407,14 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshEdge * e1, } /////////////////////////////////////////////////////////////////////////////// -///Create a new tetrahedron and add it to the mesh. -///@return The created tetrahedron +///Create a new tetrahedron and add it to the mesh. +///@return The created tetrahedron /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4) { int ID = myElementIDFactory->GetFreeID(); SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, ID); @@ -469,17 +423,17 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, } /////////////////////////////////////////////////////////////////////////////// -///Create a new tetrahedron and add it to the mesh. +///Create a new tetrahedron and add it to the mesh. ///@param ID The ID of the new volume ///@return The created tetrahedron or NULL if an element with this ID already exists ///or if input nodes are not found. /////////////////////////////////////////////////////////////////////////////// -SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, - int idnode2, - int idnode3, - int idnode4, - int ID) +SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, + int idnode2, + int idnode3, + int idnode4, + int ID) { SMDS_MeshNode *node1, *node2, *node3, *node4; node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1); @@ -489,11 +443,11 @@ SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, if(!node1 || !node2 || !node3 || !node4) return NULL; return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, ID); } - + /////////////////////////////////////////////////////////////////////////////// -///Create a new tetrahedron and add it to the mesh. +///Create a new tetrahedron and add it to the mesh. ///@param ID The ID of the new volume -///@return The created tetrahedron +///@return The created tetrahedron /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, @@ -532,16 +486,16 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, } /////////////////////////////////////////////////////////////////////////////// -///Create a new pyramid and add it to the mesh. +///Create a new pyramid and add it to the mesh. ///Nodes 1,2,3 and 4 define the base of the pyramid -///@return The created pyramid +///@return The created pyramid /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5) { int ID = myElementIDFactory->GetFreeID(); SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, ID); @@ -550,19 +504,19 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, } /////////////////////////////////////////////////////////////////////////////// -///Create a new pyramid and add it to the mesh. +///Create a new pyramid and add it to the mesh. ///Nodes 1,2,3 and 4 define the base of the pyramid ///@param ID The ID of the new volume ///@return The created pyramid or NULL if an element with this ID already exists ///or if input nodes are not found. /////////////////////////////////////////////////////////////////////////////// -SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, - int idnode2, - int idnode3, - int idnode4, - int idnode5, - int ID) +SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, + int idnode2, + int idnode3, + int idnode4, + int idnode5, + int ID) { SMDS_MeshNode *node1, *node2, *node3, *node4, *node5; node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1); @@ -573,7 +527,7 @@ SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, if(!node1 || !node2 || !node3 || !node4 || !node5) return NULL; return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, ID); } - + /////////////////////////////////////////////////////////////////////////////// ///Create a new pyramid and add it to the mesh. ///Nodes 1,2,3 and 4 define the base of the pyramid @@ -618,17 +572,17 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, } /////////////////////////////////////////////////////////////////////////////// -///Create a new prism and add it to the mesh. +///Create a new prism and add it to the mesh. ///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle. -///@return The created prism +///@return The created prism /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6) { int ID = myElementIDFactory->GetFreeID(); SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, ID); @@ -637,20 +591,20 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, } /////////////////////////////////////////////////////////////////////////////// -///Create a new prism and add it to the mesh. +///Create a new prism and add it to the mesh. ///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle. ///@param ID The ID of the new volume ///@return The created prism or NULL if an element with this ID already exists ///or if input nodes are not found. /////////////////////////////////////////////////////////////////////////////// -SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, - int idnode2, - int idnode3, - int idnode4, - int idnode5, - int idnode6, - int ID) +SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, + int idnode2, + int idnode3, + int idnode4, + int idnode5, + int idnode6, + int ID) { SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6; node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1); @@ -662,7 +616,7 @@ SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, if(!node1 || !node2 || !node3 || !node4 || !node5 || !node6) return NULL; return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6, ID); } - + /////////////////////////////////////////////////////////////////////////////// ///Create a new prism and add it to the mesh. ///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle. @@ -709,19 +663,19 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, } /////////////////////////////////////////////////////////////////////////////// -///Create a new hexahedron and add it to the mesh. +///Create a new hexahedron and add it to the mesh. ///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges. -///@return The created hexahedron +///@return The created hexahedron /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8) { int ID = myElementIDFactory->GetFreeID(); SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, ID); @@ -730,22 +684,22 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, } /////////////////////////////////////////////////////////////////////////////// -///Create a new hexahedron and add it to the mesh. +///Create a new hexahedron and add it to the mesh. ///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges. ///@param ID The ID of the new volume ///@return The created hexahedron or NULL if an element with this ID already ///exists or if input nodes are not found. /////////////////////////////////////////////////////////////////////////////// -SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, - int idnode2, - int idnode3, - int idnode4, - int idnode5, - int idnode6, - int idnode7, - int idnode8, - int ID) +SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, + int idnode2, + int idnode3, + int idnode4, + int idnode5, + int idnode6, + int idnode7, + int idnode8, + int ID) { SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6, *node7, *node8; node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1); @@ -761,7 +715,7 @@ SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6, node7, node8, ID); } - + /////////////////////////////////////////////////////////////////////////////// ///Create a new hexahedron and add it to the mesh. ///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges. @@ -830,7 +784,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshFace * f1, /////////////////////////////////////////////////////////////////////////////// ///Create a new tetrahedron defined by its faces and add it to the mesh. ///@param ID The ID of the new volume -///@return The created tetrahedron +///@return The created tetrahedron /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1, @@ -873,7 +827,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshFace * f1, /////////////////////////////////////////////////////////////////////////////// ///Create a new pyramid defined by its faces and add it to the mesh. ///@param ID The ID of the new volume -///@return The created pyramid +///@return The created pyramid /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1, @@ -918,7 +872,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshFace * f1, /////////////////////////////////////////////////////////////////////////////// ///Create a new prism defined by its faces and add it to the mesh. ///@param ID The ID of the new volume -///@return The created prism +///@return The created prism /////////////////////////////////////////////////////////////////////////////// SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1, @@ -957,7 +911,7 @@ SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID (std::vector nodes_ids, nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]); if (!nodes[i]) return NULL; } - return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID); + return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID); } /////////////////////////////////////////////////////////////////////////////// @@ -1003,7 +957,7 @@ SMDS_MeshFace* SMDS_Mesh::AddPolygonalFace (std::vector no } /////////////////////////////////////////////////////////////////////////////// -/// Create a new polyhedral volume and add it to the mesh. +/// Create a new polyhedral volume and add it to the mesh. /// @param ID The ID of the new volume /// @return The created volume or NULL if an element with this ID already exists /// or if input nodes are not found. @@ -1024,7 +978,7 @@ SMDS_MeshVolume * SMDS_Mesh::AddPolyhedralVolumeWithID } /////////////////////////////////////////////////////////////////////////////// -/// Create a new polyhedral volume and add it to the mesh. +/// Create a new polyhedral volume and add it to the mesh. /// @param ID The ID of the new volume /// @return The created volume /////////////////////////////////////////////////////////////////////////////// @@ -1058,7 +1012,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolumeWithID } /////////////////////////////////////////////////////////////////////////////// -/// Create a new polyhedral volume and add it to the mesh. +/// Create a new polyhedral volume and add it to the mesh. /// @return The created volume /////////////////////////////////////////////////////////////////////////////// @@ -1133,9 +1087,9 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1, ///a ID to the create triangle. /////////////////////////////////////////////////////////////////////////////// SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2, - const SMDS_MeshNode * node3, - const SMDS_MeshNode * node4) + const SMDS_MeshNode * node2, + const SMDS_MeshNode * node3, + const SMDS_MeshNode * node4) { if ( !node1 || !node2 || !node3 || !node4 ) return 0; if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); @@ -1167,16 +1121,7 @@ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1, void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node) { - RemoveElement(node, true); -} - -/////////////////////////////////////////////////////////////////////////////// -/// Remove an edge and all the elements which own this edge -/////////////////////////////////////////////////////////////////////////////// - -void SMDS_Mesh::Remove0DElement(const SMDS_Mesh0DElement * elem0d) -{ - RemoveElement(elem0d,true); + RemoveElement(node, true); } /////////////////////////////////////////////////////////////////////////////// @@ -1185,7 +1130,7 @@ void SMDS_Mesh::Remove0DElement(const SMDS_Mesh0DElement * elem0d) void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge) { - RemoveElement(edge,true); + RemoveElement(edge,true); } /////////////////////////////////////////////////////////////////////////////// @@ -1194,7 +1139,7 @@ void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge) void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face) { - RemoveElement(face, true); + RemoveElement(face, true); } /////////////////////////////////////////////////////////////////////////////// @@ -1203,7 +1148,7 @@ void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face) void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume) { - RemoveElement(volume, true); + RemoveElement(volume, true); } //======================================================================= @@ -1213,8 +1158,8 @@ void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume) bool SMDS_Mesh::RemoveFromParent() { - if (myParent==NULL) return false; - else return (myParent->RemoveSubMesh(this)); + if (myParent==NULL) return false; + else return (myParent->RemoveSubMesh(this)); } //======================================================================= @@ -1224,25 +1169,25 @@ bool SMDS_Mesh::RemoveFromParent() bool SMDS_Mesh::RemoveSubMesh(const SMDS_Mesh * aMesh) { - bool found = false; + bool found = false; - list::iterator itmsh=myChildren.begin(); - for (; itmsh!=myChildren.end() && !found; itmsh++) - { - SMDS_Mesh * submesh = *itmsh; - if (submesh == aMesh) - { - found = true; - myChildren.erase(itmsh); - } - } + list::iterator itmsh=myChildren.begin(); + for (; itmsh!=myChildren.end() && !found; itmsh++) + { + SMDS_Mesh * submesh = *itmsh; + if (submesh == aMesh) + { + found = true; + myChildren.erase(itmsh); + } + } - return found; + return found; } //======================================================================= //function : ChangeElementNodes -//purpose : +//purpose : //======================================================================= bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * element, @@ -1263,11 +1208,6 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * element, SMDS_MeshElement* elem = const_cast(element); switch ( elem->GetType() ) { - case SMDSAbs_0DElement: { - if ( SMDS_Mesh0DElement* elem0d = dynamic_cast( elem )) - Ok = elem0d->ChangeNode( nodes[0] ); - break; - } case SMDSAbs_Edge: { if ( nbnodes == 2 ) { if ( SMDS_MeshEdge* edge = dynamic_cast( elem )) @@ -1293,7 +1233,7 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * element, case SMDSAbs_Volume: { if ( SMDS_VolumeOfNodes* vol = dynamic_cast( elem )) Ok = vol->ChangeNodes( nodes, nbnodes ); - else + else if ( SMDS_QuadraticVolumeOfNodes* QV = dynamic_cast( elem )) Ok = QV->ChangeNodes( nodes, nbnodes ); break; @@ -1389,50 +1329,6 @@ bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement * elem, } -//======================================================================= -//function : Find0DElement -//purpose : -//======================================================================= -const SMDS_Mesh0DElement* SMDS_Mesh::Find0DElement(int idnode) const -{ - const SMDS_MeshNode * node = FindNode(idnode); - if(node == NULL) return NULL; - return Find0DElement(node); -} - -const SMDS_Mesh0DElement* SMDS_Mesh::Find0DElement(const SMDS_MeshNode * node) -{ - if (!node) return 0; - const SMDS_Mesh0DElement* toReturn = NULL; - SMDS_ElemIteratorPtr it1 = node->GetInverseElementIterator(SMDSAbs_0DElement); - while (it1->more() && (toReturn == NULL)) { - const SMDS_MeshElement* e = it1->next(); - if (e->NbNodes() == 1) { - toReturn = static_cast(e); - } - } - return toReturn; -} - -//======================================================================= -//function : Find0DElementOrCreate -//purpose : -//======================================================================= -SMDS_Mesh0DElement* SMDS_Mesh::Find0DElementOrCreate(const SMDS_MeshNode * node) -{ - if (!node) return 0; - SMDS_Mesh0DElement * toReturn = NULL; - toReturn = const_cast(Find0DElement(node)); - if (toReturn == NULL) { - if (my0DElements.Extent() % CHECKMEMORY_INTERVAL == 0) CheckMemory(); - toReturn = new SMDS_Mesh0DElement(node); - my0DElements.Add(toReturn); - myInfo.myNb0DElements++; - } - return toReturn; -} - - //======================================================================= //function : FindEdge //purpose : @@ -1475,7 +1371,7 @@ const SMDS_MeshEdge* SMDS_Mesh::FindEdge(const SMDS_MeshNode * node1, //======================================================================= SMDS_MeshEdge* SMDS_Mesh::FindEdgeOrCreate(const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2) + const SMDS_MeshNode * node2) { if ( !node1 || !node2) return 0; SMDS_MeshEdge * toReturn=NULL; @@ -1538,7 +1434,7 @@ const SMDS_MeshEdge* SMDS_Mesh::FindEdge(const SMDS_MeshNode * node1, //======================================================================= const SMDS_MeshFace* SMDS_Mesh::FindFace(int idnode1, int idnode2, - int idnode3) const + int idnode3) const { const SMDS_MeshNode * node1=FindNode(idnode1); const SMDS_MeshNode * node2=FindNode(idnode2); @@ -1777,7 +1673,6 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace (std::vector nodes_ids) const for (int inode = 0; inode < nbnodes; inode++) { const SMDS_MeshNode * node = FindNode(nodes_ids[inode]); if (node == NULL) return NULL; - poly_nodes[inode] = node; } return FindFace(poly_nodes); } @@ -1806,111 +1701,100 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace (std::vector nod //======================================================================= //function : DumpNodes -//purpose : +//purpose : //======================================================================= void SMDS_Mesh::DumpNodes() const { - MESSAGE("dump nodes of mesh : "); - SMDS_NodeIteratorPtr itnode=nodesIterator(); - while(itnode->more()) MESSAGE(itnode->next()); -} - -//======================================================================= -//function : Dump0DElements -//purpose : -//======================================================================= -void SMDS_Mesh::Dump0DElements() const -{ - MESSAGE("dump 0D elements of mesh : "); - SMDS_0DElementIteratorPtr it0d = elements0dIterator(); - while(it0d->more()) MESSAGE(it0d->next()); + MESSAGE("dump nodes of mesh : "); + SMDS_NodeIteratorPtr itnode=nodesIterator(); + while(itnode->more()) MESSAGE(itnode->next()); } //======================================================================= //function : DumpEdges -//purpose : +//purpose : //======================================================================= void SMDS_Mesh::DumpEdges() const { - MESSAGE("dump edges of mesh : "); - SMDS_EdgeIteratorPtr itedge=edgesIterator(); - while(itedge->more()) MESSAGE(itedge->next()); + MESSAGE("dump edges of mesh : "); + SMDS_EdgeIteratorPtr itedge=edgesIterator(); + while(itedge->more()) MESSAGE(itedge->next()); } //======================================================================= //function : DumpFaces -//purpose : +//purpose : //======================================================================= void SMDS_Mesh::DumpFaces() const { - MESSAGE("dump faces of mesh : "); - SMDS_FaceIteratorPtr itface=facesIterator(); - while(itface->more()) MESSAGE(itface->next()); + MESSAGE("dump faces of mesh : "); + SMDS_FaceIteratorPtr itface=facesIterator(); + while(itface->more()) MESSAGE(itface->next()); } //======================================================================= //function : DumpVolumes -//purpose : +//purpose : //======================================================================= void SMDS_Mesh::DumpVolumes() const { - MESSAGE("dump volumes of mesh : "); - SMDS_VolumeIteratorPtr itvol=volumesIterator(); - while(itvol->more()) MESSAGE(itvol->next()); + MESSAGE("dump volumes of mesh : "); + SMDS_VolumeIteratorPtr itvol=volumesIterator(); + while(itvol->more()) MESSAGE(itvol->next()); } //======================================================================= //function : DebugStats -//purpose : +//purpose : //======================================================================= void SMDS_Mesh::DebugStats() const { - MESSAGE("Debug stats of mesh : "); + MESSAGE("Debug stats of mesh : "); - MESSAGE("===== NODES ====="<more()) + { + const SMDS_MeshNode *node = itnode->next(); - while(itnode->more()) - { - const SMDS_MeshNode *node = itnode->next(); + sizeofnodes += sizeof(*node); + + SMDS_ElemIteratorPtr it = node->GetInverseElementIterator(); + while(it->more()) + { + const SMDS_MeshElement *me = it->next(); + sizeofnodes += sizeof(me); + } - sizeofnodes += sizeof(*node); + } - SMDS_ElemIteratorPtr it = node->GetInverseElementIterator(); - while(it->more()) - { - const SMDS_MeshElement *me = it->next(); - sizeofnodes += sizeof(me); - } - } + SMDS_FaceIteratorPtr itface=facesIterator(); + while(itface->more()) + { + const SMDS_MeshElement *face = itface->next(); + sizeoffaces += sizeof(*face); - SMDS_FaceIteratorPtr itface=facesIterator(); - while(itface->more()) - { - const SMDS_MeshElement *face = itface->next(); - sizeoffaces += sizeof(*face); - } + } + MESSAGE("total size of node elements = " << sizeofnodes);; + MESSAGE("total size of face elements = " << sizeoffaces);; - MESSAGE("total size of node elements = " << sizeofnodes);; - MESSAGE("total size of face elements = " << sizeoffaces);; - - //#endif + //#endif } /////////////////////////////////////////////////////////////////////////////// @@ -1918,15 +1802,7 @@ void SMDS_Mesh::DebugStats() const /////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbNodes() const { - return myNodes.Size(); -} - -/////////////////////////////////////////////////////////////////////////////// -/// Return the number of 0D elements -/////////////////////////////////////////////////////////////////////////////// -int SMDS_Mesh::Nb0DElements() const -{ - return my0DElements.Size(); + return myNodes.Size(); } /////////////////////////////////////////////////////////////////////////////// @@ -1934,7 +1810,7 @@ int SMDS_Mesh::Nb0DElements() const /////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbEdges() const { - return myEdges.Size(); + return myEdges.Size(); } /////////////////////////////////////////////////////////////////////////////// @@ -1942,7 +1818,7 @@ int SMDS_Mesh::NbEdges() const /////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbFaces() const { - return myFaces.Size(); + return myFaces.Size(); } /////////////////////////////////////////////////////////////////////////////// @@ -1950,7 +1826,7 @@ int SMDS_Mesh::NbFaces() const /////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbVolumes() const { - return myVolumes.Size(); + return myVolumes.Size(); } /////////////////////////////////////////////////////////////////////////////// @@ -1960,7 +1836,7 @@ int SMDS_Mesh::NbVolumes() const /////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbSubMesh() const { - return myChildren.size(); + return myChildren.size(); } /////////////////////////////////////////////////////////////////////////////// @@ -1990,18 +1866,10 @@ SMDS_Mesh::~SMDS_Mesh() while (itn->more()) myNodeIDFactory->ReleaseID(itn->next()->GetID()); } - SetOfNodes::Iterator itn(myNodes); for (; itn.More(); itn.Next()) delete itn.Value(); - SetOf0DElements::Iterator it0d (my0DElements); - for (; it0d.More(); it0d.Next()) - { - SMDS_MeshElement* elem = it0d.Value(); - delete elem; - } - SetOfEdges::Iterator ite(myEdges); for (; ite.More(); ite.Next()) { @@ -2022,6 +1890,7 @@ SMDS_Mesh::~SMDS_Mesh() SMDS_MeshElement* elem = itv.Value(); delete elem; } + } //================================================================================ @@ -2044,7 +1913,6 @@ void SMDS_Mesh::Clear() myNodeIDFactory->Clear(); myElementIDFactory->Clear(); } - SMDS_VolumeIteratorPtr itv = volumesIterator(); while (itv->more()) delete itv->next(); @@ -2054,17 +1922,12 @@ void SMDS_Mesh::Clear() while (itf->more()) delete itf->next(); myFaces.Clear(); - + SMDS_EdgeIteratorPtr ite = edgesIterator(); while (ite->more()) delete ite->next(); myEdges.Clear(); - SMDS_0DElementIteratorPtr it0d = elements0dIterator(); - while (it0d->more()) - delete it0d->next(); - my0DElements.Clear(); - SMDS_NodeIteratorPtr itn = nodesIterator(); while (itn->more()) delete itn->next(); @@ -2084,7 +1947,7 @@ void SMDS_Mesh::Clear() /////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::hasConstructionEdges() { - return myHasConstructionEdges; + return myHasConstructionEdges; } /////////////////////////////////////////////////////////////////////////////// @@ -2096,7 +1959,7 @@ bool SMDS_Mesh::hasConstructionEdges() /////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::hasConstructionFaces() { - return myHasConstructionFaces; + return myHasConstructionFaces; } /////////////////////////////////////////////////////////////////////////////// @@ -2105,7 +1968,7 @@ bool SMDS_Mesh::hasConstructionFaces() /////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::hasInverseElements() { - return myHasInverseElements; + return myHasInverseElements; } /////////////////////////////////////////////////////////////////////////////// @@ -2114,7 +1977,7 @@ bool SMDS_Mesh::hasInverseElements() /////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::setConstructionEdges(bool b) { - myHasConstructionEdges=b; + myHasConstructionEdges=b; } /////////////////////////////////////////////////////////////////////////////// @@ -2123,7 +1986,7 @@ void SMDS_Mesh::setConstructionEdges(bool b) /////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::setConstructionFaces(bool b) { - myHasConstructionFaces=b; + myHasConstructionFaces=b; } /////////////////////////////////////////////////////////////////////////////// @@ -2132,19 +1995,55 @@ void SMDS_Mesh::setConstructionFaces(bool b) /////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::setInverseElements(bool b) { - if(!b) MESSAGE("Error : inverseElement=false not implemented"); - myHasInverseElements=b; + if(!b) MESSAGE("Error : inverseElement=false not implemented"); + myHasInverseElements=b; } /////////////////////////////////////////////////////////////////////////////// -///Iterator on NCollection_Map +/// Return an iterator on nodes of the current mesh factory /////////////////////////////////////////////////////////////////////////////// -template -struct MYNCollection_Map_Iterator: public FATHER +class SMDS_Mesh_MyNodeIterator:public SMDS_NodeIterator { - typename MAP::Iterator myIterator; + SMDS_ElemIteratorPtr myIterator; + public: + SMDS_Mesh_MyNodeIterator(const SMDS_ElemIteratorPtr& it):myIterator(it) + {} - MYNCollection_Map_Iterator(const MAP& map):myIterator(map){} + bool more() + { + return myIterator->more(); + } + + const SMDS_MeshNode* next() + { + return static_cast(myIterator->next()); + } +}; + +SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const +{ + return SMDS_NodeIteratorPtr + (new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->elementsIterator())); +} + +/////////////////////////////////////////////////////////////////////////////// +/// Return an iterator on elements of the current mesh factory +/////////////////////////////////////////////////////////////////////////////// +SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator() const +{ + return myElementIDFactory->elementsIterator(); +} + +/////////////////////////////////////////////////////////////////////////////// +///Return an iterator on edges of the current mesh. +/////////////////////////////////////////////////////////////////////////////// +class SMDS_Mesh_MyEdgeIterator:public SMDS_EdgeIterator +{ + typedef SMDS_Mesh::SetOfEdges SetOfEdges; + SetOfEdges::Iterator myIterator; + public: + SMDS_Mesh_MyEdgeIterator(const SetOfEdges& s):myIterator(s) + {} bool more() { @@ -2157,114 +2056,103 @@ struct MYNCollection_Map_Iterator: public FATHER return false; } - ELEM next() + const SMDS_MeshEdge* next() { - ELEM current = (ELEM) myIterator.Value(); + const SMDS_MeshEdge* current = myIterator.Value(); myIterator.Next(); return current; } }; -/////////////////////////////////////////////////////////////////////////////// -/// Return an iterator on nodes of the current mesh factory -/////////////////////////////////////////////////////////////////////////////// - -SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const -{ - //return SMDS_NodeIteratorPtr - // (new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->elementsIterator())); - typedef MYNCollection_Map_Iterator - < SetOfNodes, const SMDS_MeshNode*, SMDS_NodeIterator > TIterator; - return SMDS_NodeIteratorPtr(new TIterator(myNodes)); -} - -/////////////////////////////////////////////////////////////////////////////// -///Return an iterator on 0D elements of the current mesh. -/////////////////////////////////////////////////////////////////////////////// - -SMDS_0DElementIteratorPtr SMDS_Mesh::elements0dIterator() const -{ - typedef MYNCollection_Map_Iterator - < SetOf0DElements, const SMDS_Mesh0DElement*, SMDS_0DElementIterator > TIterator; - return SMDS_0DElementIteratorPtr(new TIterator(my0DElements)); -} - -/////////////////////////////////////////////////////////////////////////////// -///Return an iterator on edges of the current mesh. -/////////////////////////////////////////////////////////////////////////////// - SMDS_EdgeIteratorPtr SMDS_Mesh::edgesIterator() const { - typedef MYNCollection_Map_Iterator - < SetOfEdges, const SMDS_MeshEdge*, SMDS_EdgeIterator > TIterator; - return SMDS_EdgeIteratorPtr(new TIterator(myEdges)); + return SMDS_EdgeIteratorPtr(new SMDS_Mesh_MyEdgeIterator(myEdges)); } /////////////////////////////////////////////////////////////////////////////// ///Return an iterator on faces of the current mesh. /////////////////////////////////////////////////////////////////////////////// +class SMDS_Mesh_MyFaceIterator:public SMDS_FaceIterator +{ + typedef SMDS_Mesh::SetOfFaces SetOfFaces; + SetOfFaces::Iterator myIterator; + public: + SMDS_Mesh_MyFaceIterator(const SetOfFaces& s):myIterator(s) + {} + + bool more() + { + while(myIterator.More()) + { + if(myIterator.Value()->GetID()!=-1) + return true; + myIterator.Next(); + } + return false; + } + + const SMDS_MeshFace* next() + { + const SMDS_MeshFace* current = myIterator.Value(); + myIterator.Next(); + return current; + } +}; SMDS_FaceIteratorPtr SMDS_Mesh::facesIterator() const { - typedef MYNCollection_Map_Iterator - < SetOfFaces, const SMDS_MeshFace*, SMDS_FaceIterator > TIterator; - return SMDS_FaceIteratorPtr(new TIterator(myFaces)); + return SMDS_FaceIteratorPtr(new SMDS_Mesh_MyFaceIterator(myFaces)); } /////////////////////////////////////////////////////////////////////////////// ///Return an iterator on volumes of the current mesh. /////////////////////////////////////////////////////////////////////////////// +class SMDS_Mesh_MyVolumeIterator:public SMDS_VolumeIterator +{ + typedef SMDS_Mesh::SetOfVolumes SetOfVolumes; + SetOfVolumes::Iterator myIterator; + public: + SMDS_Mesh_MyVolumeIterator(const SetOfVolumes& s):myIterator(s) + {} + + bool more() + { + return myIterator.More() != Standard_False; + } + + const SMDS_MeshVolume* next() + { + const SMDS_MeshVolume* current = myIterator.Value(); + myIterator.Next(); + return current; + } +}; SMDS_VolumeIteratorPtr SMDS_Mesh::volumesIterator() const { - typedef MYNCollection_Map_Iterator - < SetOfVolumes, const SMDS_MeshVolume*, SMDS_VolumeIterator > TIterator; - return SMDS_VolumeIteratorPtr(new TIterator(myVolumes)); -} - -/////////////////////////////////////////////////////////////////////////////// -/// Return an iterator on elements of the current mesh factory -/////////////////////////////////////////////////////////////////////////////// -SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator(SMDSAbs_ElementType type) const -{ - switch (type) { - case SMDSAbs_All: - break; - case SMDSAbs_Volume: - return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfVolumes >(myVolumes)); - case SMDSAbs_Face: - return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfFaces >(myFaces)); - case SMDSAbs_Edge: - return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfEdges >(myEdges)); - case SMDSAbs_0DElement: - return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOf0DElements >(my0DElements)); - case SMDSAbs_Node: - return myNodeIDFactory->elementsIterator(); - default:; - } - return myElementIDFactory->elementsIterator(); + return SMDS_VolumeIteratorPtr(new SMDS_Mesh_MyVolumeIterator(myVolumes)); } /////////////////////////////////////////////////////////////////////////////// /// Do intersection of sets (more than 2) /////////////////////////////////////////////////////////////////////////////// static set * intersectionOfSets( - set vs[], int numberOfSets) + set vs[], int numberOfSets) { - set* rsetA=new set(vs[0]); - set* rsetB; + set* rsetA=new set(vs[0]); + set* rsetB; - for(int i=0; i(); - set_intersection( - rsetA->begin(), rsetA->end(), - vs[i+1].begin(), vs[i+1].end(), - inserter(*rsetB, rsetB->begin())); - delete rsetA; - rsetA=rsetB; - } - return rsetA; + for(int i=0; i(); + set_intersection( + rsetA->begin(), rsetA->end(), + vs[i+1].begin(), vs[i+1].end(), + std::inserter(*rsetB, rsetB->begin())); + delete rsetA; + rsetA=rsetB; + } + return rsetA; } /////////////////////////////////////////////////////////////////////////////// @@ -2272,122 +2160,118 @@ static set * intersectionOfSets( /////////////////////////////////////////////////////////////////////////////// static set * getFinitElements(const SMDS_MeshElement * element) { - int numberOfSets=element->NbNodes(); - set *initSet = new set[numberOfSets]; + int numberOfSets=element->NbNodes(); + set *initSet = new set[numberOfSets]; - SMDS_ElemIteratorPtr itNodes=element->nodesIterator(); + SMDS_ElemIteratorPtr itNodes=element->nodesIterator(); - int i=0; - while(itNodes->more()) - { - const SMDS_MeshNode * n=static_cast(itNodes->next()); - SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator(); + int i=0; + while(itNodes->more()) + { + const SMDS_MeshNode * n=static_cast(itNodes->next()); + SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator(); - //initSet[i]=set(); - while(itFe->more()) + //initSet[i]=set(); + while(itFe->more()) initSet[i].insert(itFe->next()); - i++; - } - set *retSet=intersectionOfSets(initSet, numberOfSets); + i++; + } + set *retSet=intersectionOfSets(initSet, numberOfSets); delete [] initSet; - return retSet; + return retSet; } /////////////////////////////////////////////////////////////////////////////// /// Return the list of nodes used only by the given elements /////////////////////////////////////////////////////////////////////////////// static set * getExclusiveNodes( - set& elements) + set& elements) { - set * toReturn=new set(); - set::iterator itElements=elements.begin(); + set * toReturn=new set(); + set::iterator itElements=elements.begin(); - while(itElements!=elements.end()) - { - SMDS_ElemIteratorPtr itNodes = (*itElements)->nodesIterator(); - itElements++; - - while(itNodes->more()) - { - const SMDS_MeshNode * n=static_cast(itNodes->next()); - SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator(); - set s; - while(itFe->more()) + while(itElements!=elements.end()) + { + SMDS_ElemIteratorPtr itNodes = (*itElements)->nodesIterator(); + itElements++; + + while(itNodes->more()) + { + const SMDS_MeshNode * n=static_cast(itNodes->next()); + SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator(); + set s; + while(itFe->more()) s.insert(itFe->next()); - if(s==elements) toReturn->insert(n); - } - } - return toReturn; + if(s==elements) toReturn->insert(n); + } + } + return toReturn; } /////////////////////////////////////////////////////////////////////////////// -///Find the children of an element that are made of given nodes +///Find the children of an element that are made of given nodes ///@param setOfChildren The set in which matching children will be inserted ///@param element The element were to search matching children ///@param nodes The nodes that the children must have to be selected /////////////////////////////////////////////////////////////////////////////// -void SMDS_Mesh::addChildrenWithNodes(set& setOfChildren, - const SMDS_MeshElement * element, - set& nodes) +void SMDS_Mesh::addChildrenWithNodes(set& setOfChildren, + const SMDS_MeshElement * element, set& nodes) { - switch(element->GetType()) - { - case SMDSAbs_Node: - MESSAGE("Internal Error: This should not happend"); - break; - case SMDSAbs_0DElement: - { - } - break; - case SMDSAbs_Edge: - { - SMDS_ElemIteratorPtr itn=element->nodesIterator(); - while(itn->more()) - { - const SMDS_MeshElement * e=itn->next(); - if(nodes.find(e)!=nodes.end()) + + switch(element->GetType()) + { + case SMDSAbs_Node: + MESSAGE("Internal Error: This should not append"); + break; + case SMDSAbs_Edge: + { + SMDS_ElemIteratorPtr itn=element->nodesIterator(); + while(itn->more()) + { + const SMDS_MeshElement * e=itn->next(); + if(nodes.find(e)!=nodes.end()) { setOfChildren.insert(element); break; } - } - } break; - case SMDSAbs_Face: - { - SMDS_ElemIteratorPtr itn=element->nodesIterator(); - while(itn->more()) - { - const SMDS_MeshElement * e=itn->next(); - if(nodes.find(e)!=nodes.end()) + } + } break; + case SMDSAbs_Face: + { + SMDS_ElemIteratorPtr itn=element->nodesIterator(); + while(itn->more()) + { + const SMDS_MeshElement * e=itn->next(); + if(nodes.find(e)!=nodes.end()) { setOfChildren.insert(element); break; } - } - if(hasConstructionEdges()) - { - SMDS_ElemIteratorPtr ite=element->edgesIterator(); - while(ite->more()) - addChildrenWithNodes(setOfChildren, ite->next(), nodes); - } - } break; - case SMDSAbs_Volume: - { - if(hasConstructionFaces()) - { - SMDS_ElemIteratorPtr ite=element->facesIterator(); - while(ite->more()) - addChildrenWithNodes(setOfChildren, ite->next(), nodes); - } - else if(hasConstructionEdges()) - { - SMDS_ElemIteratorPtr ite=element->edgesIterator(); - while(ite->more()) - addChildrenWithNodes(setOfChildren, ite->next(), nodes); - } - } - } + } + if(hasConstructionEdges()) + { + SMDS_ElemIteratorPtr ite=element->edgesIterator(); + while(ite->more()) + addChildrenWithNodes(setOfChildren, ite->next(), nodes); + } + } break; + case SMDSAbs_Volume: + { + if(hasConstructionFaces()) + { + SMDS_ElemIteratorPtr ite=element->facesIterator(); + while(ite->more()) + addChildrenWithNodes(setOfChildren, ite->next(), nodes); + } + else if(hasConstructionEdges()) + { + SMDS_ElemIteratorPtr ite=element->edgesIterator(); + while(ite->more()) + addChildrenWithNodes(setOfChildren, ite->next(), nodes); + } + } + } } /////////////////////////////////////////////////////////////////////////////// @@ -2395,13 +2279,13 @@ void SMDS_Mesh::addChildrenWithNodes(set& setOfChildren ///@param removenodes if true remaining nodes will be removed /////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem, - const bool removenodes) + const bool removenodes) { list removedElems; list removedNodes; RemoveElement( elem, removedElems, removedNodes, removenodes ); } - + /////////////////////////////////////////////////////////////////////////////// ///@param elem The element to delete ///@param removedElems contains all removed elements @@ -2415,9 +2299,8 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem, { // get finite elements built on elem set * s1; - if (elem->GetType() == SMDSAbs_0DElement || - elem->GetType() == SMDSAbs_Edge && !hasConstructionEdges() || - elem->GetType() == SMDSAbs_Face && !hasConstructionFaces() || + if (!hasConstructionEdges() && elem->GetType() == SMDSAbs_Edge || + !hasConstructionFaces() && elem->GetType() == SMDSAbs_Face || elem->GetType() == SMDSAbs_Volume) { s1 = new set(); @@ -2433,7 +2316,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem, // do not remove nodes except elem s2 = new set(); s2->insert(elem); - removenodes = true; + removenodes = true; } else s2 = getExclusiveNodes(*s1); @@ -2467,12 +2350,6 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem, case SMDSAbs_Node: MESSAGE("Internal Error: This should not happen"); break; - case SMDSAbs_0DElement: - my0DElements.Remove(static_cast - (const_cast(*it))); - //myInfo.Remove0DElement(*it); - myInfo.remove(*it); - break; case SMDSAbs_Edge: myEdges.Remove(static_cast (const_cast(*it))); @@ -2517,7 +2394,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem, delete s1; } - + /////////////////////////////////////////////////////////////////////////////// ///@param elem The element to delete /////////////////////////////////////////////////////////////////////////////// @@ -2549,12 +2426,6 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem) // in meshes without descendants elements are always free switch (aType) { - case SMDSAbs_0DElement: - my0DElements.Remove(static_cast - (const_cast(elem))); - //myInfo.Remove0DElement(elem); - myInfo.remove(elem); - break; case SMDSAbs_Edge: myEdges.Remove(static_cast (const_cast(elem))); @@ -2590,10 +2461,6 @@ bool SMDS_Mesh::Contains (const SMDS_MeshElement* elem) const while (itn->more()) if (elem == itn->next()) return true; - SMDS_0DElementIteratorPtr it0d = elements0dIterator(); - while (it0d->more()) - if (elem == it0d->next()) - return true; SMDS_EdgeIteratorPtr ite = edgesIterator(); while (ite->more()) if (elem == ite->next()) @@ -2611,7 +2478,7 @@ bool SMDS_Mesh::Contains (const SMDS_MeshElement* elem) const //======================================================================= //function : MaxNodeID -//purpose : +//purpose : //======================================================================= int SMDS_Mesh::MaxNodeID() const @@ -2621,7 +2488,7 @@ int SMDS_Mesh::MaxNodeID() const //======================================================================= //function : MinNodeID -//purpose : +//purpose : //======================================================================= int SMDS_Mesh::MinNodeID() const @@ -2631,7 +2498,7 @@ int SMDS_Mesh::MinNodeID() const //======================================================================= //function : MaxElementID -//purpose : +//purpose : //======================================================================= int SMDS_Mesh::MaxElementID() const @@ -2641,7 +2508,7 @@ int SMDS_Mesh::MaxElementID() const //======================================================================= //function : MinElementID -//purpose : +//purpose : //======================================================================= int SMDS_Mesh::MinElementID() const @@ -2703,7 +2570,7 @@ SMDSAbs_ElementType SMDS_Mesh::GetElementType( const int id, const bool iselem ) if( !elem ) { - //throw SALOME_Exception(LOCALIZED ("this element isn't exist")); + //throw SMESH_Exception(LOCALIZED ("this element isn't exist")); return SMDSAbs_All; } else @@ -2722,9 +2589,9 @@ SMDSAbs_ElementType SMDS_Mesh::GetElementType( const int id, const bool iselem ) //======================================================================= //function : AddEdgeWithID -//purpose : +//purpose : //======================================================================= -SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int n1, int n2, int n12, int ID) +SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int n1, int n2, int n12, int ID) { return SMDS_Mesh::AddEdgeWithID ((SMDS_MeshNode*) myNodeIDFactory->MeshElement(n1), @@ -2735,10 +2602,10 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int n1, int n2, int n12, int ID) //======================================================================= //function : AddEdge -//purpose : +//purpose : //======================================================================= SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode* n1, - const SMDS_MeshNode* n2, + const SMDS_MeshNode* n2, const SMDS_MeshNode* n12) { return SMDS_Mesh::AddEdgeWithID(n1, n2, n12, myElementIDFactory->GetFreeID()); @@ -2746,12 +2613,12 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode* n1, //======================================================================= //function : AddEdgeWithID -//purpose : +//purpose : //======================================================================= SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n12, - int ID) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n12, + int ID) { if ( !n1 || !n2 || !n12 ) return 0; SMDS_QuadraticEdge* edge = new SMDS_QuadraticEdge(n1,n2,n12); @@ -2766,7 +2633,7 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, myEdges.Add(edge); myInfo.myNbQuadEdges++; return edge; - } + } else { delete edge; return NULL; @@ -2776,11 +2643,11 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, //======================================================================= //function : AddFace -//purpose : +//purpose : //======================================================================= SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n31) @@ -2791,7 +2658,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1, //======================================================================= //function : AddFaceWithID -//purpose : +//purpose : //======================================================================= SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n12,int n23,int n31, int ID) @@ -2808,14 +2675,14 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3, //======================================================================= //function : AddFaceWithID -//purpose : +//purpose : //======================================================================= SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, const SMDS_MeshNode * n2, const SMDS_MeshNode * n3, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, + const SMDS_MeshNode * n31, int ID) { if ( !n1 || !n2 || !n3 || !n12 || !n23 || !n31) return 0; @@ -2838,12 +2705,12 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, //======================================================================= //function : AddFace -//purpose : +//purpose : //======================================================================= SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n34, @@ -2855,7 +2722,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1, //======================================================================= //function : AddFaceWithID -//purpose : +//purpose : //======================================================================= SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4, int n12,int n23,int n34,int n41, int ID) @@ -2874,7 +2741,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4, //======================================================================= //function : AddFaceWithID -//purpose : +//purpose : //======================================================================= SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, const SMDS_MeshNode * n2, @@ -2882,8 +2749,8 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, const SMDS_MeshNode * n4, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, - const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, + const SMDS_MeshNode * n34, + const SMDS_MeshNode * n41, int ID) { if ( !n1 || !n2 || !n3 || !n4 || !n12 || !n23 || !n34 || !n41) return 0; @@ -2905,16 +2772,16 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, //======================================================================= //function : AddVolume -//purpose : +//purpose : //======================================================================= SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n31, - const SMDS_MeshNode * n14, + const SMDS_MeshNode * n14, const SMDS_MeshNode * n24, const SMDS_MeshNode * n34) { @@ -2927,7 +2794,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, //======================================================================= //function : AddVolumeWithID -//purpose : +//purpose : //======================================================================= SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n12,int n23,int n31, @@ -2958,7 +2825,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n31, - const SMDS_MeshNode * n14, + const SMDS_MeshNode * n14, const SMDS_MeshNode * n24, const SMDS_MeshNode * n34, int ID) @@ -2984,18 +2851,18 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, //======================================================================= //function : AddVolume -//purpose : +//purpose : //======================================================================= SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n34, const SMDS_MeshNode * n41, - const SMDS_MeshNode * n15, + const SMDS_MeshNode * n15, const SMDS_MeshNode * n25, const SMDS_MeshNode * n35, const SMDS_MeshNode * n45) @@ -3010,7 +2877,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, //======================================================================= //function : AddVolumeWithID -//purpose : +//purpose : //======================================================================= SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n12,int n23,int n34,int n41, @@ -3041,12 +2908,12 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, const SMDS_MeshNode * n2, const SMDS_MeshNode * n3, const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, + const SMDS_MeshNode * n5, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n34, const SMDS_MeshNode * n41, - const SMDS_MeshNode * n15, + const SMDS_MeshNode * n15, const SMDS_MeshNode * n25, const SMDS_MeshNode * n35, const SMDS_MeshNode * n45, @@ -3075,20 +2942,20 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, //======================================================================= //function : AddVolume -//purpose : +//purpose : //======================================================================= SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, + const SMDS_MeshNode * n31, const SMDS_MeshNode * n45, const SMDS_MeshNode * n56, - const SMDS_MeshNode * n64, + const SMDS_MeshNode * n64, const SMDS_MeshNode * n14, const SMDS_MeshNode * n25, const SMDS_MeshNode * n36) @@ -3103,7 +2970,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, //======================================================================= //function : AddVolumeWithID -//purpose : +//purpose : //======================================================================= SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, @@ -3138,14 +3005,14 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, const SMDS_MeshNode * n2, const SMDS_MeshNode * n3, const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, - const SMDS_MeshNode * n31, + const SMDS_MeshNode * n31, const SMDS_MeshNode * n45, const SMDS_MeshNode * n56, - const SMDS_MeshNode * n64, + const SMDS_MeshNode * n64, const SMDS_MeshNode * n14, const SMDS_MeshNode * n25, const SMDS_MeshNode * n36, @@ -3174,24 +3041,24 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, //======================================================================= //function : AddVolume -//purpose : +//purpose : //======================================================================= SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8, + const SMDS_MeshNode * n8, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, + const SMDS_MeshNode * n41, const SMDS_MeshNode * n56, const SMDS_MeshNode * n67, const SMDS_MeshNode * n78, - const SMDS_MeshNode * n85, + const SMDS_MeshNode * n85, const SMDS_MeshNode * n15, const SMDS_MeshNode * n26, const SMDS_MeshNode * n37, @@ -3207,7 +3074,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1, //======================================================================= //function : AddVolumeWithID -//purpose : +//purpose : //======================================================================= SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, @@ -3247,18 +3114,18 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, const SMDS_MeshNode * n2, const SMDS_MeshNode * n3, const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8, + const SMDS_MeshNode * n8, const SMDS_MeshNode * n12, const SMDS_MeshNode * n23, const SMDS_MeshNode * n34, - const SMDS_MeshNode * n41, + const SMDS_MeshNode * n41, const SMDS_MeshNode * n56, const SMDS_MeshNode * n67, const SMDS_MeshNode * n78, - const SMDS_MeshNode * n85, + const SMDS_MeshNode * n85, const SMDS_MeshNode * n15, const SMDS_MeshNode * n26, const SMDS_MeshNode * n37, diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp deleted file mode 100644 index b4fbe8bc4c..0000000000 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMDS : implementaion of Salome mesh data structure -// File : SMDS_Mesh0DElement.cxx -// Author : Jean-Michel BOULCOURT -// Module : SMESH - -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif - -#include "SMDS_Mesh0DElement.hxx" -#include "SMDS_IteratorOfElements.hxx" -#include "SMDS_MeshNode.hxx" - -using namespace std; - -//======================================================================= -//function : SMDS_Mesh0DElement -//purpose : -//======================================================================= -SMDS_Mesh0DElement::SMDS_Mesh0DElement (const SMDS_MeshNode * node) -{ - myNode = node; -} - -//======================================================================= -//function : Print -//purpose : -//======================================================================= -void SMDS_Mesh0DElement::Print (ostream & OS) const -{ - OS << "0D Element <" << GetID() << "> : (" << myNode << ") " << endl; -} - -//======================================================================= -//function : NbNodes -//purpose : -//======================================================================= -int SMDS_Mesh0DElement::NbNodes() const -{ - return 1; -} - -//======================================================================= -//function : NbEdges -//purpose : -//======================================================================= -int SMDS_Mesh0DElement::NbEdges() const -{ - return 0; -} - -//======================================================================= -//function : GetType -//purpose : -//======================================================================= -SMDSAbs_ElementType SMDS_Mesh0DElement::GetType() const -{ - return SMDSAbs_0DElement; -} - -//======================================================================= -//function : elementsIterator -//purpose : -//======================================================================= -class SMDS_Mesh0DElement_MyNodeIterator: public SMDS_ElemIterator -{ - const SMDS_MeshNode * myNode; - int myIndex; - public: - SMDS_Mesh0DElement_MyNodeIterator(const SMDS_MeshNode * node): - myNode(node),myIndex(0) {} - - bool more() - { - return myIndex < 1; - } - - const SMDS_MeshElement* next() - { - myIndex++; - if (myIndex == 1) - return myNode; - return NULL; - } -}; - -SMDS_ElemIteratorPtr SMDS_Mesh0DElement::elementsIterator (SMDSAbs_ElementType type) const -{ - switch(type) - { - case SMDSAbs_0DElement: - return SMDS_MeshElement::elementsIterator(SMDSAbs_0DElement); - case SMDSAbs_Node: - return SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode)); - default: - return SMDS_ElemIteratorPtr - (new SMDS_IteratorOfElements - (this,type, SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode)))); - } -} - -//======================================================================= -//function : operator< -//purpose : -//======================================================================= -bool operator< (const SMDS_Mesh0DElement & e1, const SMDS_Mesh0DElement & e2) -{ - int id1 = e1.myNode->GetID(); - int id2 = e2.myNode->GetID(); - - return (id1 < id2); -} - -/*! - * \brief Return node by its index - * \param ind - node index - * \retval const SMDS_MeshNode* - the node - */ -const SMDS_MeshNode* SMDS_Mesh0DElement::GetNode(const int ind) const -{ - if (ind == 0) - return myNode; - return NULL; -} - -//======================================================================= -//function : ChangeNode -//purpose : -//======================================================================= -bool SMDS_Mesh0DElement::ChangeNode (const SMDS_MeshNode * node) -{ - myNode = node; - return true; -} diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshEdge.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshEdge.cpp index 526236e808..924a6c2e71 100644 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshEdge.cpp +++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshEdge.cpp @@ -156,3 +156,4 @@ bool SMDS_MeshEdge::ChangeNodes(const SMDS_MeshNode * node1, myNodes[1]=node2; return true; } + diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_PolygonalFaceOfNodes.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_PolygonalFaceOfNodes.cpp index d6c8fb5b16..96b7e261c4 100644 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_PolygonalFaceOfNodes.cpp +++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_PolygonalFaceOfNodes.cpp @@ -196,3 +196,4 @@ const SMDS_MeshNode* SMDS_PolygonalFaceOfNodes::GetNode(const int ind) const { return myNodes[ WrappedIndex( ind )]; } + diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticEdge.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticEdge.cpp index 147b62bf6a..d314cf281e 100644 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticEdge.cpp +++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticEdge.cpp @@ -182,3 +182,4 @@ SMDS_ElemIteratorPtr SMDS_QuadraticEdge::elementsIterator(SMDSAbs_ElementType ty (this,type, SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes)))); } } + diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticFaceOfNodes.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticFaceOfNodes.cpp index 168457cf50..472759fb95 100644 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticFaceOfNodes.cpp +++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticFaceOfNodes.cpp @@ -306,7 +306,3 @@ const SMDS_MeshNode* SMDS_QuadraticFaceOfNodes::GetNode(const int ind) const return myNodes[ ind ]; } -SMDSAbs_EntityType SMDS_QuadraticFaceOfNodes::GetEntityType() const -{ - return NbNodes() == 6 ? SMDSEntity_Quad_Triangle : SMDSEntity_Quad_Quadrangle; -} diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticVolumeOfNodes.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticVolumeOfNodes.cpp index 8d68ee4d06..2225bdcda8 100644 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticVolumeOfNodes.cpp +++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_QuadraticVolumeOfNodes.cpp @@ -368,16 +368,3 @@ const SMDS_MeshNode* SMDS_QuadraticVolumeOfNodes::GetNode(const int ind) const return myNodes[ ind ]; } -SMDSAbs_EntityType SMDS_QuadraticVolumeOfNodes::GetEntityType() const -{ - SMDSAbs_EntityType aType = SMDSEntity_Quad_Tetra; - switch(NbNodes()) - { - case 10: aType = SMDSEntity_Quad_Tetra; break; - case 13: aType = SMDSEntity_Quad_Pyramid; break; - case 15: aType = SMDSEntity_Quad_Penta; break; - case 20: - default: aType = SMDSEntity_Quad_Hexa; break; - } - return aType; -} diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeOfFaces.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeOfFaces.cpp index 76f47de39d..c993dcc66f 100644 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeOfFaces.cpp +++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeOfFaces.cpp @@ -135,16 +135,3 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1, myFaces[5]=face6; } -SMDSAbs_EntityType SMDS_VolumeOfFaces::GetEntityType() const -{ - SMDSAbs_EntityType aType = SMDSEntity_Tetra; - switch(myNbFaces) - { - case 4: aType = SMDSEntity_Tetra; break; - case 5: aType = SMDSEntity_Pyramid; break; - case 6: aType = SMDSEntity_Penta; break; - case 8: - default: aType = SMDSEntity_Hexa; break; - } - return aType; -} diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeOfNodes.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeOfNodes.cpp index 73b61ca3fb..eb5101e7a9 100644 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeOfNodes.cpp +++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeOfNodes.cpp @@ -40,73 +40,73 @@ using namespace std; /// 5,1 and 7,3 are an edges. /////////////////////////////////////////////////////////////////////////////// SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( - const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2, - const SMDS_MeshNode * node3, - const SMDS_MeshNode * node4, - const SMDS_MeshNode * node5, - const SMDS_MeshNode * node6, - const SMDS_MeshNode * node7, - const SMDS_MeshNode * node8) + const SMDS_MeshNode * node1, + const SMDS_MeshNode * node2, + const SMDS_MeshNode * node3, + const SMDS_MeshNode * node4, + const SMDS_MeshNode * node5, + const SMDS_MeshNode * node6, + const SMDS_MeshNode * node7, + const SMDS_MeshNode * node8) { - myNbNodes = 8; - myNodes = new const SMDS_MeshNode* [myNbNodes]; - myNodes[0]=node1; - myNodes[1]=node2; - myNodes[2]=node3; - myNodes[3]=node4; - myNodes[4]=node5; - myNodes[5]=node6; - myNodes[6]=node7; - myNodes[7]=node8; + myNbNodes = 8; + myNodes = new const SMDS_MeshNode* [myNbNodes]; + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node3; + myNodes[3]=node4; + myNodes[4]=node5; + myNodes[5]=node6; + myNodes[6]=node7; + myNodes[7]=node8; } SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( - const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2, - const SMDS_MeshNode * node3, - const SMDS_MeshNode * node4) + const SMDS_MeshNode * node1, + const SMDS_MeshNode * node2, + const SMDS_MeshNode * node3, + const SMDS_MeshNode * node4) { - myNbNodes = 4; - myNodes = new const SMDS_MeshNode* [myNbNodes]; - myNodes[0]=node1; - myNodes[1]=node2; - myNodes[2]=node3; - myNodes[3]=node4; + myNbNodes = 4; + myNodes = new const SMDS_MeshNode* [myNbNodes]; + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node3; + myNodes[3]=node4; } SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( - const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2, - const SMDS_MeshNode * node3, - const SMDS_MeshNode * node4, - const SMDS_MeshNode * node5) + const SMDS_MeshNode * node1, + const SMDS_MeshNode * node2, + const SMDS_MeshNode * node3, + const SMDS_MeshNode * node4, + const SMDS_MeshNode * node5) { - myNbNodes = 5; - myNodes = new const SMDS_MeshNode* [myNbNodes]; - myNodes[0]=node1; - myNodes[1]=node2; - myNodes[2]=node3; - myNodes[3]=node4; - myNodes[4]=node5; + myNbNodes = 5; + myNodes = new const SMDS_MeshNode* [myNbNodes]; + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node3; + myNodes[3]=node4; + myNodes[4]=node5; } SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( - const SMDS_MeshNode * node1, - const SMDS_MeshNode * node2, - const SMDS_MeshNode * node3, - const SMDS_MeshNode * node4, - const SMDS_MeshNode * node5, - const SMDS_MeshNode * node6) + const SMDS_MeshNode * node1, + const SMDS_MeshNode * node2, + const SMDS_MeshNode * node3, + const SMDS_MeshNode * node4, + const SMDS_MeshNode * node5, + const SMDS_MeshNode * node6) { - myNbNodes = 6; - myNodes = new const SMDS_MeshNode* [myNbNodes]; - myNodes[0]=node1; - myNodes[1]=node2; - myNodes[2]=node3; - myNodes[3]=node4; - myNodes[4]=node5; - myNodes[5]=node6; + myNbNodes = 6; + myNodes = new const SMDS_MeshNode* [myNbNodes]; + myNodes[0]=node1; + myNodes[1]=node2; + myNodes[2]=node3; + myNodes[3]=node4; + myNodes[4]=node5; + myNodes[5]=node6; } bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[], @@ -139,40 +139,40 @@ SMDS_VolumeOfNodes::~SMDS_VolumeOfNodes() void SMDS_VolumeOfNodes::Print(ostream & OS) const { - OS << "volume <" << GetID() << "> : "; - int i; - for (i = 0; i < NbNodes()-1; ++i) OS << myNodes[i] << ","; - OS << myNodes[NbNodes()-1]<< ") " << endl; + OS << "volume <" << GetID() << "> : "; + int i; + for (i = 0; i < NbNodes()-1; ++i) OS << myNodes[i] << ","; + OS << myNodes[NbNodes()-1]<< ") " << endl; } int SMDS_VolumeOfNodes::NbFaces() const { - switch(NbNodes()) - { - case 4: return 4; - case 5: return 5; - case 6: return 5; - case 8: return 6; - default: MESSAGE("invalid number of nodes"); - } + switch(NbNodes()) + { + case 4: return 4; + case 5: return 5; + case 6: return 5; + case 8: return 6; + default: MESSAGE("invalid number of nodes"); + } return 0; } int SMDS_VolumeOfNodes::NbNodes() const { - return myNbNodes; + return myNbNodes; } int SMDS_VolumeOfNodes::NbEdges() const { - switch(NbNodes()) - { - case 4: return 6; - case 5: return 8; - case 6: return 9; - case 8: return 12; - default: MESSAGE("invalid number of nodes"); - } + switch(NbNodes()) + { + case 4: return 6; + case 5: return 8; + case 6: return 9; + case 8: return 12; + default: MESSAGE("invalid number of nodes"); + } return 0; } @@ -234,7 +234,7 @@ SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::elementsIterator(SMDSAbs_ElementType ty SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const { - return SMDSAbs_Volume; + return SMDSAbs_Volume; } /*! @@ -246,17 +246,3 @@ const SMDS_MeshNode* SMDS_VolumeOfNodes::GetNode(const int ind) const { return myNodes[ ind ]; } - -SMDSAbs_EntityType SMDS_VolumeOfNodes::GetEntityType() const -{ - SMDSAbs_EntityType aType = SMDSEntity_Tetra; - switch(myNbNodes) - { - case 4: aType = SMDSEntity_Tetra; break; - case 5: aType = SMDSEntity_Pyramid; break; - case 6: aType = SMDSEntity_Penta; break; - case 8: - default: aType = SMDSEntity_Hexa; break; - } - return aType; -} diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeTool.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeTool.cpp index 24509b255f..0984cb5055 100644 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeTool.cpp +++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VolumeTool.cpp @@ -368,8 +368,6 @@ static int QuadHexa_nbN [] = { 8, 8, 8, 8, 8, 8 }; // ======================================================== // to perform some calculations without linkage to CASCADE // ======================================================== -namespace -{ struct XYZ { double x; double y; @@ -378,26 +376,25 @@ struct XYZ { XYZ( double X, double Y, double Z ) { x = X; y = Y; z = Z; } XYZ( const XYZ& other ) { x = other.x; y = other.y; z = other.z; } XYZ( const SMDS_MeshNode* n ) { x = n->X(); y = n->Y(); z = n->Z(); } - inline XYZ operator-( const XYZ& other ); - inline XYZ Crossed( const XYZ& other ); - inline double Dot( const XYZ& other ); - inline double Magnitude(); + XYZ operator-( const XYZ& other ); + XYZ Crossed( const XYZ& other ); + double Dot( const XYZ& other ); + double Magnitude(); }; -inline XYZ XYZ::operator-( const XYZ& Right ) { +XYZ XYZ::operator-( const XYZ& Right ) { return XYZ(x - Right.x, y - Right.y, z - Right.z); } -inline XYZ XYZ::Crossed( const XYZ& Right ) { +XYZ XYZ::Crossed( const XYZ& Right ) { return XYZ (y * Right.z - z * Right.y, z * Right.x - x * Right.z, x * Right.y - y * Right.x); } -inline double XYZ::Dot( const XYZ& Other ) { +double XYZ::Dot( const XYZ& Other ) { return(x * Other.x + y * Other.y + z * Other.z); } -inline double XYZ::Magnitude() { +double XYZ::Magnitude() { return sqrt (x * x + y * y + z * z); } -} //======================================================================= //function : SMDS_VolumeTool @@ -840,32 +837,6 @@ bool SMDS_VolumeTool::GetBaryCenter(double & X, double & Y, double & Z) const return true; } -//================================================================================ -/*! - * \brief Classify a point - * \param tol - thickness of faces - */ -//================================================================================ - -bool SMDS_VolumeTool::IsOut(double X, double Y, double Z, double tol) -{ - // LIMITATION: for convex volumes only - XYZ p( X,Y,Z ); - for ( int iF = 0; iF < myNbFaces; ++iF ) - { - XYZ faceNormal; - if ( !GetFaceNormal( iF, faceNormal.x, faceNormal.y, faceNormal.z )) - continue; - if ( !IsFaceExternal( iF )) - faceNormal = XYZ() - faceNormal; // reverse - - XYZ face2p( p - XYZ( myFaceNodes[0] )); - if ( face2p.Dot( faceNormal ) > tol ) - return true; - } - return false; -} - //======================================================================= //function : SetExternalNormal //purpose : Node order will be so that faces normals are external diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_0D_Algo.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_0D_Algo.cpp index f20074cc3d..1342ea42ce 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_0D_Algo.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_0D_Algo.cpp @@ -22,7 +22,7 @@ // SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_0D_Algo.cxx // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_0D_Algo.cxx,v 1.2.2.1 2008/11/27 12:25:15 abd Exp $ // #include "SMESH_0D_Algo.hxx" #include "SMESH_Gen.hxx" diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_1D_Algo.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_1D_Algo.cpp index ff6b9f7ff2..8e8c065cf1 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_1D_Algo.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_1D_Algo.cpp @@ -23,7 +23,7 @@ // File : SMESH_1D_Algo.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_1D_Algo.cxx,v 1.8.2.1 2008/11/27 12:25:15 abd Exp $ // #include "SMESH_1D_Algo.hxx" #include "SMESH_Gen.hxx" diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_2D_Algo.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_2D_Algo.cpp index 00723cbd72..525b3d60d7 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_2D_Algo.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_2D_Algo.cpp @@ -23,7 +23,7 @@ // File : SMESH_2D_Algo.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_2D_Algo.cxx,v 1.9.2.2 2008/11/27 12:25:15 abd Exp $ // #include "SMESH_2D_Algo.hxx" #include "SMESH_Gen.hxx" @@ -34,8 +34,6 @@ #include #include -using namespace std; - //============================================================================= /*! * diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_3D_Algo.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_3D_Algo.cpp index ee547368fd..641c505186 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_3D_Algo.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_3D_Algo.cpp @@ -23,7 +23,7 @@ // File : SMESH_3D_Algo.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_3D_Algo.cxx,v 1.9.2.1 2008/11/27 12:25:15 abd Exp $ // #include "SMESH_3D_Algo.hxx" #include "SMESH_Gen.hxx" diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Algo.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Algo.cpp index 8aad675b4c..c44010450c 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Algo.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Algo.cpp @@ -321,7 +321,7 @@ bool SMESH_Algo::GetNodeParamOnEdge(const SMESHDS_Mesh* theMesh, if ( !eSubMesh || !eSubMesh->GetElements()->more() ) return false; // edge is not meshed - //int nbEdgeNodes = 0; + int nbEdgeNodes = 0; set < double > paramSet; if ( eSubMesh ) { diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Block.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Block.cpp index 821d8fa9f7..fd4edab326 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Block.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Block.cpp @@ -952,39 +952,26 @@ int SMESH_Block::GetShapeIDByParams ( const gp_XYZ& theCoord ) return id + 1; // shape ids start at 1 } -//================================================================================ -/*! - * \brief Return number of wires and a list of oredered edges. - * \param theFace - the face to process - * \param theFirstVertex - the vertex of the outer wire to set first in the returned - * list ( theFirstVertex may be NULL ) - * \param theEdges - all ordered edges of theFace (outer edges goes first). - * \param theNbVertexInWires - nb of vertices (== nb of edges) in each wire - * \param theShapeAnalysisAlgo - if true, ShapeAnalysis::OuterWire() is used to find - * the outer wire else BRepTools::OuterWire() is used. - * \retval int - nb of wires - * - * Always try to set a seam edge first. - * BRepTools::OuterWire() fails e.g. in the case of issue 0020184, - * ShapeAnalysis::OuterWire() fails in the case of issue 0020452 - */ -//================================================================================ +//======================================================================= +//function : GetOrderedEdges +//purpose : return nb wires and a list of oredered edges +//======================================================================= int SMESH_Block::GetOrderedEdges (const TopoDS_Face& theFace, TopoDS_Vertex theFirstVertex, list< TopoDS_Edge >& theEdges, - list< int > & theNbVertexInWires, - const bool theShapeAnalysisAlgo) + list< int > & theNbVertexInWires) { // put wires in a list, so that an outer wire comes first list aWireList; - TopoDS_Wire anOuterWire = - theShapeAnalysisAlgo ? ShapeAnalysis::OuterWire( theFace ) : BRepTools::OuterWire( theFace ); + //TopoDS_Wire anOuterWire = BRepTools::OuterWire( theFace ); ### issue 0020184 + TopoDS_Wire anOuterWire = ShapeAnalysis::OuterWire( theFace ); + //aWireList.push_back( anOuterWire ); ### issue 0020184 for ( TopoDS_Iterator wIt (theFace); wIt.More(); wIt.Next() ) if ( !anOuterWire.IsSame( wIt.Value() )) aWireList.push_back( TopoDS::Wire( wIt.Value() )); else - aWireList.push_front( TopoDS::Wire( wIt.Value() )); + aWireList.push_front( TopoDS::Wire( wIt.Value() ));// ### issue 0020184 // loop on edges of wires theNbVertexInWires.clear(); @@ -996,8 +983,7 @@ int SMESH_Block::GetOrderedEdges (const TopoDS_Face& theFace, for ( iE = 0; wExp.More(); wExp.Next(), iE++ ) { TopoDS_Edge edge = wExp.Current(); - // commented for issue 0020557, other related ones: 0020526, PAL19080 - // edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() )); + edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() )); theEdges.push_back( edge ); } theNbVertexInWires.push_back( iE ); diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Gen.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Gen.cpp index 10ec57e1fa..657cffe2c3 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Gen.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Gen.cpp @@ -32,8 +32,8 @@ #include "SMDS_MeshNode.hxx" #include "utilities.h" -#include "OpUtil.hxx" -#include "Utils_ExceptHandlers.hxx" +//#include "OpUtil.hxx" +#include "SMESH_ExceptHandlers.hxx" #include #include @@ -50,9 +50,9 @@ using namespace std; SMESH_Gen::SMESH_Gen() { - MESSAGE("SMESH_Gen::SMESH_Gen"); - _localId = 0; - _hypId = 0; + MESSAGE("SMESH_Gen::SMESH_Gen"); + _localId = 0; + _hypId = 0; _segmentation = 10; } @@ -64,7 +64,7 @@ SMESH_Gen::SMESH_Gen() SMESH_Gen::~SMESH_Gen() { - MESSAGE("SMESH_Gen::~SMESH_Gen"); + MESSAGE("SMESH_Gen::~SMESH_Gen"); } //============================================================================= @@ -74,26 +74,26 @@ SMESH_Gen::~SMESH_Gen() //============================================================================= /*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId) - throw(SALOME_Exception) + throw(SALOME_Exception) { - MESSAGE("CreateHypothesis("<GetID(); - myStudyContext->mapHypothesis[hypId] = myHypothesis; - SCRUTE(studyId); - SCRUTE(hypId); + SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId); + int hypId = myHypothesis->GetID(); + myStudyContext->mapHypothesis[hypId] = myHypothesis; + SCRUTE(studyId); + SCRUTE(hypId); - // store hypothesis in SMESHDS document + // store hypothesis in SMESHDS document - myStudyContext->myDocument->AddHypothesis(myHypothesis); - return myHypothesis; + myStudyContext->myDocument->AddHypothesis(myHypothesis); + return myHypothesis; }*/ //============================================================================= @@ -103,9 +103,9 @@ SMESH_Gen::~SMESH_Gen() //============================================================================= SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode) - throw(SALOME_Exception) + throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); MESSAGE("SMESH_Gen::CreateMesh"); // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document @@ -113,10 +113,10 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode) // create a new SMESH_mesh object SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++, - theStudyId, - this, - theIsEmbeddedMode, - aStudyContext->myDocument); + theStudyId, + this, + theIsEmbeddedMode, + aStudyContext->myDocument); aStudyContext->mapMesh[_localId] = aMesh; return aMesh; @@ -131,8 +131,8 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode) bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool anUpward, - const ::MeshDimension aDim, - TSetOfInt* aShapesId) + const ::MeshDimension aDim, + TSetOfInt* aShapesId) { MESSAGE("SMESH_Gen::Compute"); @@ -166,7 +166,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, // clear compute state to not show previous compute errors // if preview invoked less dimension less than previous smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); - continue; + continue; } if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) @@ -176,7 +176,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE) ret = false; else if ( aShapesId ) - aShapesId->insert( smToCompute->GetId() ); + aShapesId->insert( smToCompute->GetId() ); } return ret; } @@ -201,7 +201,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, // check for preview dimension limitations if ( aShapesId && aShapeDim > (int)aDim ) - continue; + continue; SMESH_Algo* algo = GetAlgo( aMesh, aSubShape ); if ( algo && !algo->NeedDescretBoundary() ) @@ -209,11 +209,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, if ( algo->SupportSubmeshes() ) smWithAlgoSupportingSubmeshes.push_back( smToCompute ); else - { + { smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE ); - if ( aShapesId ) - aShapesId->insert( smToCompute->GetId() ); - } + if ( aShapesId ) + aShapesId->insert( smToCompute->GetId() ); + } } } // ------------------------------------------------------------ @@ -240,14 +240,14 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, SMESH_subMesh* smToCompute = smIt->next(); const TopoDS_Shape& aSubShape = smToCompute->GetSubShape(); - const int aShapeDim = GetShapeDim( aSubShape ); + const int aShapeDim = GetShapeDim( aSubShape ); //if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue; - if ( aShapeDim < 1 ) continue; + if ( aShapeDim < 1 ) continue; - // check for preview dimension limitations - if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim ) - continue; - + // check for preview dimension limitations + if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim ) + continue; + SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); filter .And( SMESH_HypoFilter::IsApplicableTo( aSubShape )) @@ -265,20 +265,18 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, // apply the algos that do not require descretized boundaries // ---------------------------------------------------------- for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt ) - { - sm = *subIt; if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) { - const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType(); - // check for preview dimension limitations - if ( aShapesId && GetShapeDim( aShType ) > (int)aDim ) - continue; + const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType(); + // check for preview dimension limitations + if ( aShapesId && GetShapeDim( aShType ) > (int)aDim ) + continue; sm->ComputeStateEngine( SMESH_subMesh::COMPUTE ); - if ( aShapesId ) - aShapesId->insert( sm->GetId() ); + if ( aShapesId ) + aShapesId->insert( sm->GetId() ); } - } + // ----------------------------------------------- // mesh the rest subshapes starting from vertices // ----------------------------------------------- @@ -289,141 +287,6 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, return ret; } - -//============================================================================= -/*! - * Evaluate a mesh - */ -//============================================================================= - -bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap, - const bool anUpward, - TSetOfInt* aShapesId) -{ - MESSAGE("SMESH_Gen::Evaluate"); - - bool ret = true; - - SMESH_subMesh *sm = aMesh.GetSubMesh(aShape); - - const bool includeSelf = true; - const bool complexShapeFirst = true; - SMESH_subMeshIteratorPtr smIt; - - if ( anUpward ) { // is called from below code here - // ----------------------------------------------- - // mesh all the subshapes starting from vertices - // ----------------------------------------------- - smIt = sm->getDependsOnIterator(includeSelf, !complexShapeFirst); - while ( smIt->more() ) { - SMESH_subMesh* smToCompute = smIt->next(); - - // do not mesh vertices of a pseudo shape - const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType(); - //if ( !aMesh.HasShapeToMesh() && aShType == TopAbs_VERTEX ) - // continue; - if ( !aMesh.HasShapeToMesh() ) { - if( aShType == TopAbs_VERTEX || aShType == TopAbs_WIRE || - aShType == TopAbs_SHELL ) - continue; - } - - smToCompute->Evaluate(aResMap); - if( aShapesId ) - aShapesId->insert( smToCompute->GetId() ); - } - return ret; - } - else { - // ----------------------------------------------------------------- - // apply algos that DO NOT require descretized boundaries and DO NOT - // support submeshes, starting from the most complex shapes - // and collect submeshes with algos that DO support submeshes - // ----------------------------------------------------------------- - list< SMESH_subMesh* > smWithAlgoSupportingSubmeshes; - smIt = sm->getDependsOnIterator(includeSelf, complexShapeFirst); - while ( smIt->more() ) { - SMESH_subMesh* smToCompute = smIt->next(); - const TopoDS_Shape& aSubShape = smToCompute->GetSubShape(); - const int aShapeDim = GetShapeDim( aSubShape ); - if ( aShapeDim < 1 ) break; - - SMESH_Algo* algo = GetAlgo( aMesh, aSubShape ); - if ( algo && !algo->NeedDescretBoundary() ) { - if ( algo->SupportSubmeshes() ) { - smWithAlgoSupportingSubmeshes.push_back( smToCompute ); - } - else { - smToCompute->Evaluate(aResMap); - if ( aShapesId ) - aShapesId->insert( smToCompute->GetId() ); - } - } - } - // ------------------------------------------------------------ - // compute submeshes under shapes with algos that DO NOT require - // descretized boundaries and DO support submeshes - // ------------------------------------------------------------ - list< SMESH_subMesh* >::reverse_iterator subIt, subEnd; - subIt = smWithAlgoSupportingSubmeshes.rbegin(); - subEnd = smWithAlgoSupportingSubmeshes.rend(); - // start from lower shapes - for ( ; subIt != subEnd; ++subIt ) { - sm = *subIt; - - // get a shape the algo is assigned to - TopoDS_Shape algoShape; - if ( !GetAlgo( aMesh, sm->GetSubShape(), & algoShape )) - continue; // strange... - - // look for more local algos - smIt = sm->getDependsOnIterator(!includeSelf, !complexShapeFirst); - while ( smIt->more() ) { - SMESH_subMesh* smToCompute = smIt->next(); - - const TopoDS_Shape& aSubShape = smToCompute->GetSubShape(); - const int aShapeDim = GetShapeDim( aSubShape ); - if ( aShapeDim < 1 ) continue; - - //const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType(); - - SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); - filter - .And( SMESH_HypoFilter::IsApplicableTo( aSubShape )) - .And( SMESH_HypoFilter::IsMoreLocalThan( algoShape )); - - if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) { - SMESH_Hypothesis::Hypothesis_Status status; - if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status )) - // mesh a lower smToCompute starting from vertices - Evaluate( aMesh, aSubShape, aResMap, /*anUpward=*/true, aShapesId ); - } - } - } - // ---------------------------------------------------------- - // apply the algos that do not require descretized boundaries - // ---------------------------------------------------------- - for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt ) - { - sm = *subIt; - sm->Evaluate(aResMap); - if ( aShapesId ) - aShapesId->insert( sm->GetId() ); - } - - // ----------------------------------------------- - // mesh the rest subshapes starting from vertices - // ----------------------------------------------- - ret = Evaluate( aMesh, aShape, aResMap, /*anUpward=*/true, aShapesId ); - } - - MESSAGE( "VSR - SMESH_Gen::Evaluate() finished, OK = " << ret); - return ret; -} - - //======================================================================= //function : checkConformIgnoredAlgos //purpose : @@ -434,7 +297,7 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh, const SMESH_Algo* aGlobIgnoAlgo, const SMESH_Algo* aLocIgnoAlgo, bool & checkConform, - set& aCheckedMap, + map& aCheckedMap, list< SMESH_Gen::TAlgoStateError > & theErrors) { ASSERT( aSubMesh ); @@ -489,15 +352,19 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh, } // sub-algos will be hidden by a local - SMESH_subMeshIteratorPtr revItSub = - aSubMesh->getDependsOnIterator( /*includeSelf=*/false, /*complexShapeFirst=*/true); + const map& smMap = aSubMesh->DependsOn(); + map::const_reverse_iterator revItSub; bool checkConform2 = false; - while ( revItSub->more() ) + for ( revItSub = smMap.rbegin(); revItSub != smMap.rend(); revItSub++) { - SMESH_subMesh* sm = revItSub->next(); - checkConformIgnoredAlgos (aMesh, sm, aGlobIgnoAlgo, + checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo, algo, checkConform2, aCheckedMap, theErrors); - aCheckedMap.insert( sm ); + int key = (*revItSub).first; + SMESH_subMesh* sm = (*revItSub).second; + if ( aCheckedMap.find( key ) == aCheckedMap.end() ) + { + aCheckedMap[ key ] = sm; + } } } } @@ -518,7 +385,7 @@ static bool checkMissing(SMESH_Gen* aGen, const int aTopAlgoDim, bool* globalChecked, const bool checkNoAlgo, - set& aCheckedMap, + map& aCheckedMap, list< SMESH_Gen::TAlgoStateError > & theErrors) { if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX) @@ -591,13 +458,15 @@ static bool checkMissing(SMESH_Gen* aGen, if (!algo->NeedDescretBoundary() || isTopLocalAlgo) { bool checkNoAlgo2 = ( algo->NeedDescretBoundary() ); - SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false, - /*complexShapeFirst=*/false); - while ( itsub->more() ) + const map& subMeshes = aSubMesh->DependsOn(); + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) { // sub-meshes should not be checked further more - SMESH_subMesh* sm = itsub->next(); - aCheckedMap.insert( sm ); + int key = (*itsub).first; + SMESH_subMesh* sm = (*itsub).second; + if ( aCheckedMap.find( key ) == aCheckedMap.end() ) + aCheckedMap[ key ] = sm; if (isTopLocalAlgo) { @@ -691,25 +560,39 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh, } } - set aCheckedSubs; + const map& smMap = sm->DependsOn(); + map::const_reverse_iterator revItSub = smMap.rbegin(); + map aCheckedMap; bool checkConform = ( !theMesh.IsNotConformAllowed() ); + int aKey = 1; + SMESH_subMesh* smToCheck = sm; // loop on theShape and its sub-shapes - SMESH_subMeshIteratorPtr revItSub = sm->getDependsOnIterator( /*includeSelf=*/true, - /*complexShapeFirst=*/true); - while ( revItSub->more() ) + while ( smToCheck ) { - SMESH_subMesh* smToCheck = revItSub->next(); if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX) break; - if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked + if ( aCheckedMap.find( aKey ) == aCheckedMap.end() ) if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo, - 0, checkConform, aCheckedSubs, theErrors)) + 0, checkConform, aCheckedMap, theErrors)) ret = false; if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO ) hasAlgo = true; + + // next subMesh + if (revItSub != smMap.rend()) + { + aKey = (*revItSub).first; + smToCheck = (*revItSub).second; + revItSub++; + } + else + { + smToCheck = 0; + } + } // ---------------------------------------------------------------- @@ -729,26 +612,36 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh, break; } } + aCheckedMap.clear(); + smToCheck = sm; + revItSub = smMap.rbegin(); bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false; bool globalChecked[] = { false, false, false, false }; // loop on theShape and its sub-shapes - aCheckedSubs.clear(); - revItSub = sm->getDependsOnIterator( /*includeSelf=*/true, /*complexShapeFirst=*/true); - while ( revItSub->more() ) + while ( smToCheck ) { - SMESH_subMesh* smToCheck = revItSub->next(); if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX) break; - if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked + if ( aCheckedMap.find( aKey ) == aCheckedMap.end() ) if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim, - globalChecked, checkNoAlgo, aCheckedSubs, theErrors)) + globalChecked, checkNoAlgo, aCheckedMap, theErrors)) { ret = false; if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO ) checkNoAlgo = false; } + + // next subMesh + if (revItSub != smMap.rend()) + { + aKey = (*revItSub).first; + smToCheck = (*revItSub).second; + revItSub++; + } + else + smToCheck = 0; } if ( !hasAlgo ) { @@ -797,16 +690,16 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId) { - // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document - if (_mapStudyContext.find(studyId) == _mapStudyContext.end()) - { - _mapStudyContext[studyId] = new StudyContextStruct; - _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId); - } - StudyContextStruct *myStudyContext = _mapStudyContext[studyId]; + if (_mapStudyContext.find(studyId) == _mapStudyContext.end()) + { + _mapStudyContext[studyId] = new StudyContextStruct; + _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId); + } + StudyContextStruct *myStudyContext = _mapStudyContext[studyId]; // ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end()); - return myStudyContext; + return myStudyContext; } // //============================================================================= @@ -871,6 +764,6 @@ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType) int SMESH_Gen::GetANewId() { - //MESSAGE("SMESH_Gen::GetANewId"); - return _hypId++; + //MESSAGE("SMESH_Gen::GetANewId"); + return _hypId++; } diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Group.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Group.cpp index a05204d31f..71c6f5343e 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Group.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Group.cpp @@ -23,7 +23,7 @@ // File : SMESH_Group.cxx // Author : Michael Sazonov (OCC) // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Group.cxx,v 1.7.2.1 2008/11/27 12:25:15 abd Exp $ // #include "SMESH_Group.hxx" #include "SMESH_Mesh.hxx" diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_HypoFilter.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_HypoFilter.cpp index d23f7cbe08..13682ce488 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_HypoFilter.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_HypoFilter.cpp @@ -22,7 +22,7 @@ // SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_HypoFilter.cxx // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_HypoFilter.cxx,v 1.6.2.2 2008/11/27 12:25:15 abd Exp $ // #include "SMESH_HypoFilter.hxx" diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Hypothesis.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Hypothesis.cpp index c731f60cf3..a3ed82fb1c 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Hypothesis.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Hypothesis.cpp @@ -23,6 +23,7 @@ // File : SMESH_Hypothesis.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Hypothesis.cxx,v 1.10 2009/02/17 05:27:39 vsr Exp $ // #include "SMESH_Hypothesis.hxx" #include "SMESH_Gen.hxx" @@ -38,8 +39,8 @@ using namespace std; //============================================================================= SMESH_Hypothesis::SMESH_Hypothesis(int hypId, - int studyId, - SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId) + int studyId, + SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId) { //MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis"); _gen = gen; diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp index f7113b44fe..be5f917ddd 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp @@ -23,6 +23,7 @@ // File : SMESH_Mesh.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Mesh.cxx,v 1.24.2.7 2008/11/27 12:25:15 abd Exp $ // #include "SMESH_Mesh.hxx" #include "SMESH_subMesh.hxx" @@ -58,7 +59,7 @@ #include #include -#include "Utils_ExceptHandlers.hxx" +#include "SMESH_ExceptHandlers.hxx" #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -66,6 +67,8 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; + #define cSMESH_Hyp(h) static_cast(h) typedef SMESH_HypoFilter THypType; @@ -77,10 +80,10 @@ typedef SMESH_HypoFilter THypType; //============================================================================= SMESH_Mesh::SMESH_Mesh(int theLocalId, - int theStudyId, - SMESH_Gen* theGen, - bool theIsEmbeddedMode, - SMESHDS_Document* theDocument): + int theStudyId, + SMESH_Gen* theGen, + bool theIsEmbeddedMode, + SMESHDS_Document* theDocument): _groupId( 0 ), _nbSubShapes( 0 ) { MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)"); @@ -133,8 +136,9 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape) if ( !aShape.IsNull() && _isShapeToMesh ) { if ( aShape.ShapeType() != TopAbs_COMPOUND && // group contents is allowed to change _myMeshDS->ShapeToMesh().ShapeType() != TopAbs_COMPOUND ) - throw SALOME_Exception(LOCALIZED ("a shape to mesh has already been defined")); + throw SMESH_Exception(LOCALIZED ("a shape to mesh has already been defined")); } + // clear current data if ( !_myMeshDS->ShapeToMesh().IsNull() ) { @@ -160,7 +164,6 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape) // clear SMESHDS TopoDS_Shape aNullShape; _myMeshDS->ShapeToMesh( aNullShape ); - _shapeDiagonal = 0.0; } @@ -321,14 +324,14 @@ void SMESH_Mesh::ClearSubMesh(const int theShapeId) if ( SMESH_subMesh *sm = GetSubMeshContaining( theShapeId ) ) { SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true, - /*complexShapeFirst=*/false); + /*complexShapeFirst=*/false); while ( smIt->more() ) { sm = smIt->next(); TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType(); if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID ) - // all other shapes depends on vertices so they are already cleaned - sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); + // all other shapes depends on vertices so they are already cleaned + sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); // to recompute even if failed sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); } @@ -344,7 +347,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName) { if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<GetType(), aName.c_str(), aId ); if ( aSMESHGroup ) { - if(MYDEBUG) MESSAGE("UNVToMesh - group added: "<( aSMESHGroup->GetGroupDS() ); - if ( aGroupDS ) { - aGroupDS->SetStoreName(aName.c_str()); - aSubGroup->InitIterator(); - const SMDS_MeshElement* aElement = 0; - while (aSubGroup->More()) { - aElement = aSubGroup->Next(); - if (aElement) { - aGroupDS->SMDSGroup().Add(aElement); - } - } - if (aElement) - aGroupDS->SetType(aElement->GetType()); - } + if(MYDEBUG) MESSAGE("UNVToMesh - group added: "<( aSMESHGroup->GetGroupDS() ); + if ( aGroupDS ) { + aGroupDS->SetStoreName(aName.c_str()); + aSubGroup->InitIterator(); + const SMDS_MeshElement* aElement = 0; + while (aSubGroup->More()) { + aElement = aSubGroup->Next(); + if (aElement) { + aGroupDS->SMDSGroup().Add(aElement); + } + } + if (aElement) + aGroupDS->SetType(aElement->GetType()); + } } } } @@ -397,7 +400,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName) int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName) { - throw SALOME_Exception(LOCALIZED ("Not implemented ...")); + throw SMESH_Exception(LOCALIZED ("Not implemented ...")); return 0; } @@ -410,7 +413,7 @@ int SMESH_Mesh::STLToMesh(const char* theFileName) { if(MYDEBUG) MESSAGE("STLToMesh - theFileName = "<mapHypothesis[anHypId]; @@ -570,9 +573,9 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape, - int anHypId)throw(SALOME_Exception) + int anHypId)throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); if(MYDEBUG) MESSAGE("SMESH_Mesh::RemoveHypothesis"); SMESH_subMesh *subMesh = GetSubMesh(aSubShape); @@ -603,7 +606,7 @@ SMESH_Hypothesis::Hypothesis_Status StudyContextStruct *sc = _gen->GetStudyContext(_studyId); if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end()) - throw SALOME_Exception(LOCALIZED("hypothesis does not exist")); + throw SMESH_Exception(LOCALIZED("hypothesis does not exist")); SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId]; int hypType = anHyp->GetType(); @@ -663,9 +666,9 @@ SMESH_Hypothesis::Hypothesis_Status const std::list& SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const - throw(SALOME_Exception) + throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetHypothesis(aSubShape); } @@ -792,9 +795,9 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape, */ //============================================================================= -const std::list & SMESH_Mesh::GetLog() throw(SALOME_Exception) +const std::list & SMESH_Mesh::GetLog() throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); if(MYDEBUG) MESSAGE("SMESH_Mesh::GetLog"); return _myMeshDS->GetScript()->GetCommands(); } @@ -804,9 +807,9 @@ const std::list & SMESH_Mesh::GetLog() throw(SALOME_Exception) * */ //============================================================================= -void SMESH_Mesh::ClearLog() throw(SALOME_Exception) +void SMESH_Mesh::ClearLog() throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); if(MYDEBUG) MESSAGE("SMESH_Mesh::ClearLog"); _myMeshDS->GetScript()->Clear(); } @@ -818,9 +821,9 @@ void SMESH_Mesh::ClearLog() throw(SALOME_Exception) //============================================================================= SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) - throw(SALOME_Exception) + throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); SMESH_subMesh *aSubMesh; int index = _myMeshDS->ShapeToIndex(aSubShape); @@ -828,10 +831,7 @@ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) if (( !index || index > _nbSubShapes ) && aSubShape.ShapeType() == TopAbs_COMPOUND ) { TopoDS_Iterator it( aSubShape ); if ( it.More() ) - { index = _myMeshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() ); - if ( index > _nbSubShapes ) _nbSubShapes = index; // not to create sm for this group again - } } // if ( !index ) // return NULL; // neither sub-shape nor a group @@ -857,9 +857,9 @@ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) //============================================================================= SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) const - throw(SALOME_Exception) + throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); SMESH_subMesh *aSubMesh = NULL; int index = _myMeshDS->ShapeToIndex(aSubShape); @@ -878,9 +878,9 @@ SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) //============================================================================= SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const int aShapeID) const -throw(SALOME_Exception) +throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); map ::const_iterator i_sm = _mapSubMesh.find(aShapeID); if (i_sm == _mapSubMesh.end()) @@ -895,9 +895,9 @@ throw(SALOME_Exception) std::list SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const - throw(SALOME_Exception) + throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); std::list found; SMESH_subMesh * subMesh = GetSubMeshContaining(aSubShape); @@ -969,9 +969,9 @@ bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp, const list < SMESH_subMesh * >& SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) - throw(SALOME_Exception) + throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); if(MYDEBUG) MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis"); map < int, SMESH_subMesh * >::iterator itsm; _subMeshesUsingHypothesisList.clear(); @@ -991,7 +991,7 @@ SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* hyp) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); const SMESH_Algo *foundAlgo = 0; SMESH_HypoFilter algoKind, compatibleHypoKind; @@ -1042,15 +1042,15 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h * Auto color functionality */ //============================================================================= -void SMESH_Mesh::SetAutoColor(bool theAutoColor) throw(SALOME_Exception) +void SMESH_Mesh::SetAutoColor(bool theAutoColor) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); _isAutoColor = theAutoColor; } -bool SMESH_Mesh::GetAutoColor() throw(SALOME_Exception) +bool SMESH_Mesh::GetAutoColor() throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _isAutoColor; } @@ -1062,22 +1062,22 @@ bool SMESH_Mesh::GetAutoColor() throw(SALOME_Exception) bool SMESH_Mesh::HasDuplicatedGroupNamesMED() { - throw SALOME_Exception(LOCALIZED ("Not implemented ...")); - return false; + throw SMESH_Exception(LOCALIZED ("Not implemented ...")); + return 0; } void SMESH_Mesh::ExportMED(const char *file, - const char* theMeshName, - bool theAutoGroups, - int theVersion) - throw(SALOME_Exception) + const char* theMeshName, + bool theAutoGroups, + int theVersion) + throw(SMESH_Exception) { - throw SALOME_Exception(LOCALIZED ("Not implemented ...")); + throw SMESH_Exception(LOCALIZED ("Not implemented ...")); } -void SMESH_Mesh::ExportDAT(const char *file) throw(SALOME_Exception) +void SMESH_Mesh::ExportDAT(const char *file) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); DriverDAT_W_SMDS_Mesh myWriter; myWriter.SetFile(string(file)); myWriter.SetMesh(_myMeshDS); @@ -1085,9 +1085,9 @@ void SMESH_Mesh::ExportDAT(const char *file) throw(SALOME_Exception) myWriter.Perform(); } -void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception) +void SMESH_Mesh::ExportUNV(const char *file) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); DriverUNV_W_SMDS_Mesh myWriter; myWriter.SetFile(string(file)); myWriter.SetMesh(_myMeshDS); @@ -1106,9 +1106,9 @@ void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception) myWriter.Perform(); } -void SMESH_Mesh::ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception) +void SMESH_Mesh::ExportSTL(const char *file, const bool isascii) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); DriverSTL_W_SMDS_Mesh myWriter; myWriter.SetFile(string(file)); myWriter.SetIsAscii( isascii ); @@ -1123,9 +1123,9 @@ void SMESH_Mesh::ExportSTL(const char *file, const bool isascii) throw(SALOME_Ex */ //================================================================================ -int SMESH_Mesh::NbNodes() throw(SALOME_Exception) +int SMESH_Mesh::NbNodes() throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->NbNodes(); } @@ -1135,21 +1135,9 @@ int SMESH_Mesh::NbNodes() throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::Nb0DElements() throw(SALOME_Exception) +int SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); - return _myMeshDS->GetMeshInfo().Nb0DElements(); -} - -//================================================================================ -/*! - * \brief Return number of edges of given order in the mesh - */ -//================================================================================ - -int SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) throw(SALOME_Exception) -{ - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbEdges(order); } @@ -1159,9 +1147,9 @@ int SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) throw(SALOME_Exception) +int SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbFaces(order); } @@ -1171,9 +1159,9 @@ int SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) throw(SALOME_Exception) +int SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbTriangles(order); } @@ -1183,9 +1171,9 @@ int SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) throw(SALOME_Exception) +int SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbQuadrangles(order); } @@ -1195,9 +1183,9 @@ int SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) throw(SALOME_Exception */ //================================================================================ -int SMESH_Mesh::NbPolygons() throw(SALOME_Exception) +int SMESH_Mesh::NbPolygons() throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbPolygons(); } @@ -1207,9 +1195,9 @@ int SMESH_Mesh::NbPolygons() throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) throw(SALOME_Exception) +int SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbVolumes(order); } @@ -1219,9 +1207,9 @@ int SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) throw(SALOME_Exception) +int SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbTetras(order); } @@ -1231,9 +1219,9 @@ int SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) throw(SALOME_Exception) +int SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbHexas(order); } @@ -1243,9 +1231,9 @@ int SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) throw(SALOME_Exception) +int SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbPyramids(order); } @@ -1255,9 +1243,9 @@ int SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbPrisms(SMDSAbs_ElementOrder order) throw(SALOME_Exception) +int SMESH_Mesh::NbPrisms(SMDSAbs_ElementOrder order) throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbPrisms(order); } @@ -1267,9 +1255,9 @@ int SMESH_Mesh::NbPrisms(SMDSAbs_ElementOrder order) throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbPolyhedrons() throw(SALOME_Exception) +int SMESH_Mesh::NbPolyhedrons() throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->GetMeshInfo().NbPolyhedrons(); } @@ -1279,9 +1267,9 @@ int SMESH_Mesh::NbPolyhedrons() throw(SALOME_Exception) */ //================================================================================ -int SMESH_Mesh::NbSubMesh() throw(SALOME_Exception) +int SMESH_Mesh::NbSubMesh() throw(SMESH_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SmeshException); return _myMeshDS->NbSubMesh(); } @@ -1316,7 +1304,7 @@ bool SMESH_Mesh::IsMainShape(const TopoDS_Shape& theShape) const SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType, const char* theName, - int& theId, + int& theId, const TopoDS_Shape& theShape) { if (_mapGroup.find(_groupId) != _mapGroup.end()) diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp index c0bb7e0f1d..8caae8f1e9 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp @@ -47,7 +47,6 @@ #include "utilities.h" #include -#include #include #include #include @@ -55,15 +54,11 @@ #include #include #include -#include -#include #include -#include #include #include #include #include -#include #include #include #include @@ -79,12 +74,6 @@ #include #include -#include -#include - -#ifndef PI -#define PI M_PI -#endif #define cast2Node(elem) static_cast( elem ) @@ -97,23 +86,8 @@ typedef map > TElemOfElem //typedef TNodeOfNodeVecMap::iterator TNodeOfNodeVecMapItr; //typedef map > TElemOfVecOfMapNodesMap; -//======================================================================= -/*! - * \brief SMDS_MeshNode -> gp_XYZ convertor - */ -//======================================================================= - -struct TNodeXYZ : public gp_XYZ -{ +struct TNodeXYZ : public gp_XYZ { TNodeXYZ( const SMDS_MeshNode* n ):gp_XYZ( n->X(), n->Y(), n->Z() ) {} - double Distance( const SMDS_MeshNode* n ) - { - return gp_Vec( *this, TNodeXYZ( n )).Magnitude(); - } - double SquareDistance( const SMDS_MeshNode* n ) - { - return gp_Vec( *this, TNodeXYZ( n )).SquareMagnitude(); - } }; //======================================================================= @@ -291,17 +265,17 @@ bool SMESH_MeshEditor::Remove (const list< int >& theIDs, smmap.insert( sm ); } // Find sub-meshes to notify about modification - // SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator(); - // while ( nodeIt->more() ) { - // const SMDS_MeshNode* node = static_cast( nodeIt->next() ); - // const SMDS_PositionPtr& aPosition = node->GetPosition(); - // if ( aPosition.get() ) { - // if ( int aShapeID = aPosition->GetShapeId() ) { - // if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( aShapeID ) ) - // smmap.insert( sm ); - // } - // } - // } +// SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator(); +// while ( nodeIt->more() ) { +// const SMDS_MeshNode* node = static_cast( nodeIt->next() ); +// const SMDS_PositionPtr& aPosition = node->GetPosition(); +// if ( aPosition.get() ) { +// if ( int aShapeID = aPosition->GetShapeId() ) { +// if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( aShapeID ) ) +// smmap.insert( sm ); +// } +// } +// } // Do remove if ( isNodes ) @@ -317,9 +291,9 @@ bool SMESH_MeshEditor::Remove (const list< int >& theIDs, (*smIt)->ComputeStateEngine( SMESH_subMesh::MESH_ENTITY_REMOVED ); } - // // Check if the whole mesh becomes empty - // if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( 1 ) ) - // sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); +// // Check if the whole mesh becomes empty +// if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( 1 ) ) +// sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); return true; } @@ -1433,7 +1407,7 @@ double getAngle(const SMDS_MeshElement * tr1, // and able to return nodes by that ID // ================================================= class LinkID_Gen { -public: + public: LinkID_Gen( const SMESHDS_Mesh* theMesh ) :myMesh( theMesh ), myMaxID( theMesh->MaxNodeID() + 1) @@ -1456,7 +1430,7 @@ public: return true; } -private: + private: LinkID_Gen(); const SMESHDS_Mesh* myMesh; long myMaxID; @@ -1765,15 +1739,15 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems, //============================================================================= static void swap( int i1, int i2, int idNodes[], gp_Pnt P[] ) { -if ( i1 == i2 ) -return; -int tmp = idNodes[ i1 ]; -idNodes[ i1 ] = idNodes[ i2 ]; -idNodes[ i2 ] = tmp; -gp_Pnt Ptmp = P[ i1 ]; -P[ i1 ] = P[ i2 ]; -P[ i2 ] = Ptmp; -DUMPSO( i1 << "(" << idNodes[ i2 ] << ") <-> " << i2 << "(" << idNodes[ i1 ] << ")"); + if ( i1 == i2 ) + return; + int tmp = idNodes[ i1 ]; + idNodes[ i1 ] = idNodes[ i2 ]; + idNodes[ i2 ] = tmp; + gp_Pnt Ptmp = P[ i1 ]; + P[ i1 ] = P[ i2 ]; + P[ i2 ] = Ptmp; + DUMPSO( i1 << "(" << idNodes[ i2 ] << ") <-> " << i2 << "(" << idNodes[ i1 ] << ")"); } //======================================================================= @@ -1784,7 +1758,7 @@ DUMPSO( i1 << "(" << idNodes[ i2 ] << ") <-> " << i2 << "(" << idNodes[ i1 ] << //======================================================================= int SMESH_MeshEditor::SortQuadNodes (const SMDS_Mesh * theMesh, -int idNodes[] ) + int idNodes[] ) { gp_Pnt P[4]; int i; @@ -1813,10 +1787,10 @@ int idNodes[] ) i = 1; swap ( i, i + 1, idNodes, P ); - // for ( int ii = 0; ii < 4; ii++ ) { - // const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] ); - // DUMPSO( ii << "(" << idNodes[ii] <<") : "<X()<<" "<Y()<<" "<Z()); - // } +// for ( int ii = 0; ii < 4; ii++ ) { +// const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] ); +// DUMPSO( ii << "(" << idNodes[ii] <<") : "<X()<<" "<Y()<<" "<Z()); +// } } return i; } @@ -1932,7 +1906,7 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh, faceNodes.insert( idNodes[ 2 ] ); faceNodes.insert( idNodes[ iMin ] ); DUMPSO( "loop " << iLoop2 << " id2 " << idNodes[ 1 ] << " id3 " << idNodes[ 2 ] - << " leastDist = " << leastDist); + << " leastDist = " << leastDist); if ( leastDist <= DBL_MIN ) break; } @@ -1970,11 +1944,11 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh, P[ i ] = P[ i+1 ]; P[ i+1 ] = Ptmp; } - // else - // for ( int ii = 0; ii < 4; ii++ ) { - // const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] ); - // DUMPSO( ii << "(" << idNodes[ii] <<") : "<X()<<" "<Y()<<" "<Z()); - // } +// else +// for ( int ii = 0; ii < 4; ii++ ) { +// const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] ); +// DUMPSO( ii << "(" << idNodes[ii] <<") : "<X()<<" "<Y()<<" "<Z()); +// } // Gravity center of the top and bottom faces gp_Pnt aGCb = ( P[0].XYZ() + P[1].XYZ() + P[2].XYZ() + P[3].XYZ() ) / 4.; @@ -2026,11 +2000,11 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh, swap( 5, 7, idNodes, P ); } - // DUMPSO( "OUTPUT: ========================================"); - // for ( i = 0; i < 8; i++ ) { - // float *p = ugrid->GetPoint(idNodes[i]); - // DUMPSO( i << "(" << idNodes[i] << ") : " << p[0] << " " << p[1] << " " << p[2]); - // } +// DUMPSO( "OUTPUT: ========================================"); +// for ( i = 0; i < 8; i++ ) { +// float *p = ugrid->GetPoint(idNodes[i]); +// DUMPSO( i << "(" << idNodes[i] << ") : " << p[0] << " " << p[1] << " " << p[2]); +// } return true; }*/ @@ -2038,11 +2012,11 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh, //================================================================================ /*! * \brief Return nodes linked to the given one - * \param theNode - the node - * \param linkedNodes - the found nodes - * \param type - the type of elements to check - * - * Medium nodes are ignored + * \param theNode - the node + * \param linkedNodes - the found nodes + * \param type - the type of elements to check + * + * Medium nodes are ignored */ //================================================================================ @@ -2210,13 +2184,8 @@ static bool getClosestUV (Extrema_GenExtPS& projector, if ( projector.IsDone() ) { double u, v, minVal = DBL_MAX; for ( int i = projector.NbExt(); i > 0; i-- ) -#if OCC_VERSION_HEX >= 0x060500 if ( projector.SquareDistance( i ) < minVal ) { minVal = projector.SquareDistance( i ); -#else - if ( projector.Value( i ) < minVal ) { - minVal = projector.Value( i ); -#endif projector.Point( i ).Parameter( u, v ); } result.SetCoord( u, v ); @@ -2327,14 +2296,14 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems, } int nbElemOnFace = 0; itElem = theElems.begin(); - // loop on not yet smoothed elements: look for elems on a face + // loop on not yet smoothed elements: look for elems on a face while ( itElem != theElems.end() ) { if ( faceSubMesh && nbElemOnFace == faceSubMesh->NbElements() ) break; // all elements found const SMDS_MeshElement* elem = *itElem; if ( !elem || elem->GetType() != SMDSAbs_Face || elem->NbNodes() < 3 || - ( faceSubMesh && !faceSubMesh->Contains( elem ))) { + ( faceSubMesh && !faceSubMesh->Contains( elem ))) { ++itElem; continue; } @@ -2393,19 +2362,19 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems, if ( uvMap.find( node ) == uvMap.end() ) uvCheckNodes.push_back( node ); // add nodes of elems sharing node - // SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator(SMDSAbs_Face); - // while ( eIt->more() ) { - // const SMDS_MeshElement* e = eIt->next(); - // if ( e != elem ) { - // SMDS_ElemIteratorPtr nIt = e->nodesIterator(); - // while ( nIt->more() ) { - // const SMDS_MeshNode* n = - // static_cast( nIt->next() ); - // if ( uvMap.find( n ) == uvMap.end() ) - // uvCheckNodes.push_back( n ); - // } - // } - // } +// SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator(SMDSAbs_Face); +// while ( eIt->more() ) { +// const SMDS_MeshElement* e = eIt->next(); +// if ( e != elem ) { +// SMDS_ElemIteratorPtr nIt = e->nodesIterator(); +// while ( nIt->more() ) { +// const SMDS_MeshNode* n = +// static_cast( nIt->next() ); +// if ( uvMap.find( n ) == uvMap.end() ) +// uvCheckNodes.push_back( n ); +// } +// } +// } } // check UV on face list< const SMDS_MeshNode* >::iterator n = uvCheckNodes.begin(); @@ -2811,51 +2780,47 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem, TNodeOfNodeListMapItr nnIt = newNodesItVec[ iNode ]; const SMDS_MeshNode* node = nnIt->first; const list< const SMDS_MeshNode* > & listNewNodes = nnIt->second; - if ( listNewNodes.empty() ) { + if ( listNewNodes.empty() ) return; - } - issimple[iNode] = (listNewNodes.size()==nbSteps); // is node medium + issimple[iNode] = (listNewNodes.size()==nbSteps); itNN[ iNode ] = listNewNodes.begin(); prevNod[ iNode ] = node; nextNod[ iNode ] = listNewNodes.front(); - if( !elem->IsQuadratic() || !issimple[iNode] ) { - if ( prevNod[ iNode ] != nextNod [ iNode ]) - iNotSameNode = iNode; - else { - iSameNode = iNode; - //nbSame++; - sames[nbSame++] = iNode; - } +//cout<<"iNode="<GetID() ); - //INFOS( " Too many same nodes of element " << elem->GetID() ); return; } - // if( elem->IsQuadratic() && nbSame>0 ) { - // MESSAGE( "Can not rotate quadratic element " << elem->GetID() ); - // return; - // } +// if( elem->IsQuadratic() && nbSame>0 ) { +// MESSAGE( "Can not rotate quadratic element " << elem->GetID() ); +// return; +// } int iBeforeSame = 0, iAfterSame = 0, iOpposSame = 0; - int nbBaseNodes = ( elem->IsQuadratic() ? nbNodes/2 : nbNodes ); if ( nbSame > 0 ) { - iBeforeSame = ( iSameNode == 0 ? nbBaseNodes - 1 : iSameNode - 1 ); - iAfterSame = ( iSameNode + 1 == nbBaseNodes ? 0 : iSameNode + 1 ); + iBeforeSame = ( iSameNode == 0 ? nbNodes - 1 : iSameNode - 1 ); + iAfterSame = ( iSameNode + 1 == nbNodes ? 0 : iSameNode + 1 ); iOpposSame = ( iSameNode - 2 < 0 ? iSameNode + 2 : iSameNode - 2 ); } - //if(nbNodes==8) - //cout<<" prevNod[0]="<< prevNod[0]<<" prevNod[1]="<< prevNod[1] - // <<" prevNod[2]="<< prevNod[2]<<" prevNod[3]="<< prevNod[4] - // <<" prevNod[4]="<< prevNod[4]<<" prevNod[5]="<< prevNod[5] - // <<" prevNod[6]="<< prevNod[6]<<" prevNod[7]="<< prevNod[7]<GetID() << " can not be created" ); - return; - } - else if(nbSame==2) { - // 2d order Pentahedron with 15 nodes - //SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, - // int n12,int n23,int n31,int n45,int n56,int n64, - // int n14,int n25,int n36, int ID); - int n1,n2,n4,n5; - if ( prevNod[ iBeforeSame ] == nextNod[ iBeforeSame ] ) { - // iBeforeSame is same too - n1 = iBeforeSame; - n2 = iOpposSame; - n4 = iSameNode; - n5 = iAfterSame; - } - else { - // iAfterSame is same too - n1 = iSameNode; - n2 = iBeforeSame; - n4 = iAfterSame; - n5 = iOpposSame; - } - int n12,n45,n14,n25; - if(i0>0) { //reversed case - n12 = n1 + 4; - n45 = n5 + 4; - n14 = n4 + 4; - n25 = n2 + 4; - } - else { - n12 = n2 + 4; - n45 = n4 + 4; - n14 = n1 + 4; - n25 = n5 + 4; - } - aNewElem = aMesh->AddVolume (prevNod[n1], prevNod[n2], nextNod[n2], - prevNod[n4], prevNod[n5], nextNod[n5], - prevNod[n12], midlNod[n2], nextNod[n12], - prevNod[n45], midlNod[n5], nextNod[n45], - prevNod[n14], prevNod[n25], nextNod[n25]); + else { // not reversed case + aNewElem = aMesh->AddVolume (prevNod[0], prevNod[1], prevNod[2], prevNod[3], + nextNod[0], nextNod[1], nextNod[2], nextNod[3], + prevNod[4], prevNod[5], prevNod[6], prevNod[7], + nextNod[4], nextNod[5], nextNod[6], nextNod[7], + midlNod[0], midlNod[1], midlNod[2], midlNod[3]); } break; } @@ -3432,40 +3293,20 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap & mapNewNodes, if(nbn==6) { /////// quadratic triangle const SMDS_MeshFace * f = aMesh->FindFace( nodes[0], nodes[2], nodes[4], nodes[1], nodes[3], nodes[5] ); - if ( !f ) { + if ( !f ) myLastCreatedElems.Append(aMesh->AddFace(nodes[0], nodes[2], nodes[4], nodes[1], nodes[3], nodes[5])); - } - else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) { - const SMDS_MeshNode** tmpnodes = new const SMDS_MeshNode*[6]; - tmpnodes[0] = nodes[0]; - tmpnodes[1] = nodes[2]; - tmpnodes[2] = nodes[4]; - tmpnodes[3] = nodes[1]; - tmpnodes[4] = nodes[3]; - tmpnodes[5] = nodes[5]; - aMesh->ChangeElementNodes( f, tmpnodes, nbn ); - } + else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) + aMesh->ChangeElementNodes( f, nodes, nbn ); } else { /////// quadratic quadrangle const SMDS_MeshFace * f = aMesh->FindFace( nodes[0], nodes[2], nodes[4], nodes[6], nodes[1], nodes[3], nodes[5], nodes[7] ); - if ( !f ) { + if ( !f ) myLastCreatedElems.Append(aMesh->AddFace(nodes[0], nodes[2], nodes[4], nodes[6], nodes[1], nodes[3], nodes[5], nodes[7])); - } - else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) { - const SMDS_MeshNode** tmpnodes = new const SMDS_MeshNode*[8]; - tmpnodes[0] = nodes[0]; - tmpnodes[1] = nodes[2]; - tmpnodes[2] = nodes[4]; - tmpnodes[3] = nodes[6]; - tmpnodes[4] = nodes[1]; - tmpnodes[5] = nodes[3]; - tmpnodes[6] = nodes[5]; - tmpnodes[7] = nodes[7]; - aMesh->ChangeElementNodes( f, tmpnodes, nbn ); - } + else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) + aMesh->ChangeElementNodes( f, nodes, nbn ); } } else { //////// polygon @@ -3586,25 +3427,20 @@ SMESH_MeshEditor::RotationSweep(TIDSortedElemSet & theElems, // loop on elem nodes SMDS_ElemIteratorPtr itN = elem->nodesIterator(); - while ( itN->more() ) { + while ( itN->more() ) + { // check if a node has been already sweeped const SMDS_MeshNode* node = cast2Node( itN->next() ); - - gp_XYZ aXYZ( node->X(), node->Y(), node->Z() ); - double coord[3]; - aXYZ.Coord( coord[0], coord[1], coord[2] ); - bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol ); - TNodeOfNodeListMapItr nIt = mapNewNodes.find( node ); if ( nIt == mapNewNodes.end() ) { nIt = mapNewNodes.insert( make_pair( node, list() )).first; list& listNewNodes = nIt->second; // make new nodes - //gp_XYZ aXYZ( node->X(), node->Y(), node->Z() ); - //double coord[3]; - //aXYZ.Coord( coord[0], coord[1], coord[2] ); - //bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol ); + gp_XYZ aXYZ( node->X(), node->Y(), node->Z() ); + double coord[3]; + aXYZ.Coord( coord[0], coord[1], coord[2] ); + bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol ); const SMDS_MeshNode * newNode = node; for ( int i = 0; i < theNbSteps; i++ ) { if ( !isOnAxis ) { @@ -3625,52 +3461,37 @@ SMESH_MeshEditor::RotationSweep(TIDSortedElemSet & theElems, newNode = aMesh->AddNode( coord[0], coord[1], coord[2] ); myLastCreatedNodes.Append(newNode); srcNodes.Append( node ); - listNewNodes.push_back( newNode ); } - else { - listNewNodes.push_back( newNode ); - if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) { + listNewNodes.push_back( newNode ); + } + } + else { + // if current elem is quadratic and current node is not medium + // we have to check - may be it is needed to insert additional nodes + if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) { + list< const SMDS_MeshNode* > & listNewNodes = nIt->second; + if(listNewNodes.size()==theNbSteps) { + listNewNodes.clear(); + // make new nodes + gp_XYZ aXYZ( node->X(), node->Y(), node->Z() ); + double coord[3]; + aXYZ.Coord( coord[0], coord[1], coord[2] ); + const SMDS_MeshNode * newNode = node; + for(int i = 0; iAddNode( coord[0], coord[1], coord[2] ); + myLastCreatedNodes.Append(newNode); + listNewNodes.push_back( newNode ); + srcNodes.Append( node ); + aTrsf2.Transforms( coord[0], coord[1], coord[2] ); + newNode = aMesh->AddNode( coord[0], coord[1], coord[2] ); + myLastCreatedNodes.Append(newNode); + srcNodes.Append( node ); listNewNodes.push_back( newNode ); } } } } - /* - else { - // if current elem is quadratic and current node is not medium - // we have to check - may be it is needed to insert additional nodes - if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) { - list< const SMDS_MeshNode* > & listNewNodes = nIt->second; - if(listNewNodes.size()==theNbSteps) { - listNewNodes.clear(); - // make new nodes - //gp_XYZ aXYZ( node->X(), node->Y(), node->Z() ); - //double coord[3]; - //aXYZ.Coord( coord[0], coord[1], coord[2] ); - const SMDS_MeshNode * newNode = node; - if ( !isOnAxis ) { - for(int i = 0; iAddNode( coord[0], coord[1], coord[2] ); - cout<<" 3 AddNode: "<AddNode( coord[0], coord[1], coord[2] ); - cout<<" 4 AddNode: "<& theAngles, - const bool theLinearVariation, - const bool theHasRefPoint, - const gp_Pnt& theRefPoint, - const bool theMakeGroups) + SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements, + SMESH_subMesh* theTrack, + const SMDS_MeshNode* theN1, + const bool theHasAngles, + list& theAngles, + const bool theHasRefPoint, + const gp_Pnt& theRefPoint, + const bool theMakeGroups) { myLastCreatedElems.Clear(); myLastCreatedNodes.Clear(); - int aNbE; + // source elements for each generated one + SMESH_SequenceOfElemPtr srcElems, srcNodes; + + int j, aNbTP, aNbE, aNb; + double aT1, aT2, aT, aAngle, aX, aY, aZ; std::list aPrms; + std::list::iterator aItD; TIDSortedElemSet::iterator itElem; + Standard_Real aTx1, aTx2, aL2, aTolVec, aTolVec2; + gp_Pnt aP3D, aV0; + gp_Vec aVec; gp_XYZ aGC; + Handle(Geom_Curve) aC3D; TopoDS_Edge aTrackEdge; TopoDS_Vertex aV1, aV2; @@ -3988,6 +3816,11 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements, SMDSAbs_ElementType aTypeE; TNodeOfNodeListMap mapNewNodes; + TElemOfVecOfNnlmiMap mapElemNewNodes; + TElemOfElemListMap newElemsMap; + + aTolVec=1.e-7; + aTolVec2=aTolVec*aTolVec; // 1. Check data aNbE = theElements.size(); @@ -3998,7 +3831,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements, // 1.1 Track Pattern ASSERT( theTrack ); - SMESHDS_SubMesh* pSubMeshDS = theTrack->GetSubMeshDS(); + SMESHDS_SubMesh* pSubMeshDS=theTrack->GetSubMeshDS(); aItE = pSubMeshDS->GetElements(); while ( aItE->more() ) { @@ -4009,327 +3842,63 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements, return EXTR_PATH_NOT_EDGE; } - list fullList; - const TopoDS_Shape& aS = theTrack->GetSubShape(); - // Sub shape for the Pattern must be an Edge or Wire - if( aS.ShapeType() == TopAbs_EDGE ) { - aTrackEdge = TopoDS::Edge( aS ); - // the Edge must not be degenerated - if ( BRep_Tool::Degenerated( aTrackEdge ) ) - return EXTR_BAD_PATH_SHAPE; - TopExp::Vertices( aTrackEdge, aV1, aV2 ); - aItN = theTrack->GetFather()->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN1 = aItN->next(); - aItN = theTrack->GetFather()->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN2 = aItN->next(); - // starting node must be aN1 or aN2 - if ( !( aN1 == theN1 || aN2 == theN1 ) ) - return EXTR_BAD_STARTING_NODE; - aItN = pSubMeshDS->GetNodes(); - while ( aItN->more() ) { - const SMDS_MeshNode* pNode = aItN->next(); - const SMDS_EdgePosition* pEPos = - static_cast( pNode->GetPosition().get() ); - double aT = pEPos->GetUParameter(); - aPrms.push_back( aT ); - } - //Extrusion_Error err = - MakeEdgePathPoints(aPrms, aTrackEdge, (aN1==theN1), fullList); - } - else if( aS.ShapeType() == TopAbs_WIRE ) { - list< SMESH_subMesh* > LSM; - TopTools_SequenceOfShape Edges; - SMESH_subMeshIteratorPtr itSM = theTrack->getDependsOnIterator(false,true); - while(itSM->more()) { - SMESH_subMesh* SM = itSM->next(); - LSM.push_back(SM); - const TopoDS_Shape& aS = SM->GetSubShape(); - Edges.Append(aS); - } - list< list > LLPPs; - int startNid = theN1->GetID(); - TColStd_MapOfInteger UsedNums; - int NbEdges = Edges.Length(); - int i = 1; - for(; i<=NbEdges; i++) { - int k = 0; - list< SMESH_subMesh* >::iterator itLSM = LSM.begin(); - for(; itLSM!=LSM.end(); itLSM++) { - k++; - if(UsedNums.Contains(k)) continue; - aTrackEdge = TopoDS::Edge( Edges.Value(k) ); - SMESH_subMesh* locTrack = *itLSM; - SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS(); - TopExp::Vertices( aTrackEdge, aV1, aV2 ); - aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN1 = aItN->next(); - aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN2 = aItN->next(); - // starting node must be aN1 or aN2 - if ( !( aN1->GetID() == startNid || aN2->GetID() == startNid ) ) continue; - // 2. Collect parameters on the track edge - aPrms.clear(); - aItN = locMeshDS->GetNodes(); - while ( aItN->more() ) { - const SMDS_MeshNode* pNode = aItN->next(); - const SMDS_EdgePosition* pEPos = - static_cast( pNode->GetPosition().get() ); - double aT = pEPos->GetUParameter(); - aPrms.push_back( aT ); - } - list LPP; - //Extrusion_Error err = - MakeEdgePathPoints(aPrms, aTrackEdge,(aN1->GetID()==startNid), LPP); - LLPPs.push_back(LPP); - UsedNums.Add(k); - // update startN for search following egde - if( aN1->GetID() == startNid ) startNid = aN2->GetID(); - else startNid = aN1->GetID(); - break; - } - } - list< list >::iterator itLLPP = LLPPs.begin(); - list firstList = *itLLPP; - list::iterator itPP = firstList.begin(); - for(; itPP!=firstList.end(); itPP++) { - fullList.push_back( *itPP ); - } - SMESH_MeshEditor_PathPoint PP1 = fullList.back(); - fullList.pop_back(); - itLLPP++; - for(; itLLPP!=LLPPs.end(); itLLPP++) { - list currList = *itLLPP; - itPP = currList.begin(); - SMESH_MeshEditor_PathPoint PP2 = currList.front(); - gp_Dir D1 = PP1.Tangent(); - gp_Dir D2 = PP2.Tangent(); - gp_Dir Dnew( gp_Vec( (D1.X()+D2.X())/2, (D1.Y()+D2.Y())/2, - (D1.Z()+D2.Z())/2 ) ); - PP1.SetTangent(Dnew); - fullList.push_back(PP1); - itPP++; - for(; itPP!=firstList.end(); itPP++) { - fullList.push_back( *itPP ); - } - PP1 = fullList.back(); - fullList.pop_back(); - } - // if wire not closed - fullList.push_back(PP1); - // else ??? - } - else { + // Sub shape for the Pattern must be an Edge + if ( aS.ShapeType() != TopAbs_EDGE ) return EXTR_BAD_PATH_SHAPE; - } - return MakeExtrElements(theElements, fullList, theHasAngles, theAngles, theLinearVariation, - theHasRefPoint, theRefPoint, theMakeGroups); -} - - -//======================================================================= -//function : ExtrusionAlongTrack -//purpose : -//======================================================================= -SMESH_MeshEditor::Extrusion_Error -SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements, - SMESH_Mesh* theTrack, - const SMDS_MeshNode* theN1, - const bool theHasAngles, - list& theAngles, - const bool theLinearVariation, - const bool theHasRefPoint, - const gp_Pnt& theRefPoint, - const bool theMakeGroups) -{ - myLastCreatedElems.Clear(); - myLastCreatedNodes.Clear(); - - int aNbE; - std::list aPrms; - TIDSortedElemSet::iterator itElem; - - gp_XYZ aGC; - TopoDS_Edge aTrackEdge; - TopoDS_Vertex aV1, aV2; - - SMDS_ElemIteratorPtr aItE; - SMDS_NodeIteratorPtr aItN; - SMDSAbs_ElementType aTypeE; - - TNodeOfNodeListMap mapNewNodes; - - // 1. Check data - aNbE = theElements.size(); - // nothing to do - if ( !aNbE ) - return EXTR_NO_ELEMENTS; - - // 1.1 Track Pattern - ASSERT( theTrack ); - - SMESHDS_Mesh* pMeshDS = theTrack->GetMeshDS(); - - aItE = pMeshDS->elementsIterator(); - while ( aItE->more() ) { - const SMDS_MeshElement* pE = aItE->next(); - aTypeE = pE->GetType(); - // Pattern must contain links only - if ( aTypeE != SMDSAbs_Edge ) - return EXTR_PATH_NOT_EDGE; - } - - list fullList; - - const TopoDS_Shape& aS = theTrack->GetShapeToMesh(); - // Sub shape for the Pattern must be an Edge or Wire - if( aS.ShapeType() == TopAbs_EDGE ) { - aTrackEdge = TopoDS::Edge( aS ); - // the Edge must not be degenerated - if ( BRep_Tool::Degenerated( aTrackEdge ) ) - return EXTR_BAD_PATH_SHAPE; - TopExp::Vertices( aTrackEdge, aV1, aV2 ); - aItN = theTrack->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN1 = aItN->next(); - aItN = theTrack->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN2 = aItN->next(); - // starting node must be aN1 or aN2 - if ( !( aN1 == theN1 || aN2 == theN1 ) ) - return EXTR_BAD_STARTING_NODE; - aItN = pMeshDS->nodesIterator(); - while ( aItN->more() ) { - const SMDS_MeshNode* pNode = aItN->next(); - if( pNode==aN1 || pNode==aN2 ) continue; - const SMDS_EdgePosition* pEPos = - static_cast( pNode->GetPosition().get() ); - double aT = pEPos->GetUParameter(); - aPrms.push_back( aT ); - } - //Extrusion_Error err = - MakeEdgePathPoints(aPrms, aTrackEdge, (aN1==theN1), fullList); - } - else if( aS.ShapeType() == TopAbs_WIRE ) { - list< SMESH_subMesh* > LSM; - TopTools_SequenceOfShape Edges; - TopExp_Explorer eExp(aS, TopAbs_EDGE); - for(; eExp.More(); eExp.Next()) { - TopoDS_Edge E = TopoDS::Edge( eExp.Current() ); - if( BRep_Tool::Degenerated(E) ) continue; - SMESH_subMesh* SM = theTrack->GetSubMesh(E); - if(SM) { - LSM.push_back(SM); - Edges.Append(E); - } - } - list< list > LLPPs; - int startNid = theN1->GetID(); - TColStd_MapOfInteger UsedNums; - int NbEdges = Edges.Length(); - int i = 1; - for(; i<=NbEdges; i++) { - int k = 0; - list< SMESH_subMesh* >::iterator itLSM = LSM.begin(); - for(; itLSM!=LSM.end(); itLSM++) { - k++; - if(UsedNums.Contains(k)) continue; - aTrackEdge = TopoDS::Edge( Edges.Value(k) ); - SMESH_subMesh* locTrack = *itLSM; - SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS(); - TopExp::Vertices( aTrackEdge, aV1, aV2 ); - aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN1 = aItN->next(); - aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN2 = aItN->next(); - // starting node must be aN1 or aN2 - if ( !( aN1->GetID() == startNid || aN2->GetID() == startNid ) ) continue; - // 2. Collect parameters on the track edge - aPrms.clear(); - aItN = locMeshDS->GetNodes(); - while ( aItN->more() ) { - const SMDS_MeshNode* pNode = aItN->next(); - const SMDS_EdgePosition* pEPos = - static_cast( pNode->GetPosition().get() ); - double aT = pEPos->GetUParameter(); - aPrms.push_back( aT ); - } - list LPP; - //Extrusion_Error err = - MakeEdgePathPoints(aPrms, aTrackEdge,(aN1->GetID()==startNid), LPP); - LLPPs.push_back(LPP); - UsedNums.Add(k); - // update startN for search following egde - if( aN1->GetID() == startNid ) startNid = aN2->GetID(); - else startNid = aN1->GetID(); - break; - } - } - list< list >::iterator itLLPP = LLPPs.begin(); - list firstList = *itLLPP; - list::iterator itPP = firstList.begin(); - for(; itPP!=firstList.end(); itPP++) { - fullList.push_back( *itPP ); - } - SMESH_MeshEditor_PathPoint PP1 = fullList.back(); - fullList.pop_back(); - itLLPP++; - for(; itLLPP!=LLPPs.end(); itLLPP++) { - list currList = *itLLPP; - itPP = currList.begin(); - SMESH_MeshEditor_PathPoint PP2 = currList.front(); - gp_Pnt P1 = PP1.Pnt(); - //cout<<" PP1: Pnt("<& aPrms, - const TopoDS_Edge& aTrackEdge, - bool FirstIsStart, - list& LPP) -{ - Standard_Real aTx1, aTx2, aL2, aTolVec, aTolVec2; - aTolVec=1.e-7; - aTolVec2=aTolVec*aTolVec; - double aT1, aT2; - TopoDS_Vertex aV1, aV2; TopExp::Vertices( aTrackEdge, aV1, aV2 ); aT1=BRep_Tool::Parameter( aV1, aTrackEdge ); aT2=BRep_Tool::Parameter( aV2, aTrackEdge ); + + aItN = theTrack->GetFather()->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN1 = aItN->next(); + + aItN = theTrack->GetFather()->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN2 = aItN->next(); + + // starting node must be aN1 or aN2 + if ( !( aN1 == theN1 || aN2 == theN1 ) ) + return EXTR_BAD_STARTING_NODE; + + aNbTP = pSubMeshDS->NbNodes() + 2; + + // 1.2. Angles + vector aAngles( aNbTP ); + + for ( j=0; j < aNbTP; ++j ) { + aAngles[j] = 0.; + } + + if ( theHasAngles ) { + aItD = theAngles.begin(); + for ( j=1; (aItD != theAngles.end()) && (jGetNodes(); + while ( aItN->more() ) { + const SMDS_MeshNode* pNode = aItN->next(); + const SMDS_EdgePosition* pEPos = + static_cast( pNode->GetPosition().get() ); + aT = pEPos->GetUParameter(); + aPrms.push_back( aT ); + } + // sort parameters aPrms.sort(); - if( FirstIsStart ) { + if ( aN1 == theN1 ) { if ( aT1 > aT2 ) { aPrms.reverse(); } @@ -4339,86 +3908,33 @@ SMESH_MeshEditor::MakeEdgePathPoints(std::list& aPrms, aPrms.reverse(); } } + // 3. Path Points SMESH_MeshEditor_PathPoint aPP; - Handle(Geom_Curve) aC3D = BRep_Tool::Curve( aTrackEdge, aTx1, aTx2 ); - std::list::iterator aItD = aPrms.begin(); - for(; aItD != aPrms.end(); ++aItD) { - double aT = *aItD; - gp_Pnt aP3D; - gp_Vec aVec; + vector aPPs( aNbTP ); + // + aC3D = BRep_Tool::Curve( aTrackEdge, aTx1, aTx2 ); + // + aItD = aPrms.begin(); + for ( j=0; aItD != aPrms.end(); ++aItD, ++j ) { + aT = *aItD; aC3D->D1( aT, aP3D, aVec ); aL2 = aVec.SquareMagnitude(); if ( aL2 < aTolVec2 ) return EXTR_CANT_GET_TANGENT; + gp_Dir aTgt( aVec ); + aAngle = aAngles[j]; + aPP.SetPnt( aP3D ); aPP.SetTangent( aTgt ); + aPP.SetAngle( aAngle ); aPP.SetParameter( aT ); - LPP.push_back(aPP); + aPPs[j]=aPP; } - return EXTR_OK; -} - - -//======================================================================= -//function : MakeExtrElements -//purpose : auxilary for ExtrusionAlongTrack -//======================================================================= -SMESH_MeshEditor::Extrusion_Error -SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements, - list& fullList, - const bool theHasAngles, - list& theAngles, - const bool theLinearVariation, - const bool theHasRefPoint, - const gp_Pnt& theRefPoint, - const bool theMakeGroups) -{ - //cout<<"MakeExtrElements fullList.size() = "< aPPs(aNbTP); - // Angles - if( theHasAngles && theAngles.size()>0 && theLinearVariation ) { - LinearAngleVariation(aNbTP-1, theAngles); - } - vector aAngles( aNbTP ); - int j = 0; - for(; j::iterator aItD = theAngles.begin(); - for ( j=1; (aItD != theAngles.end()) && (j::iterator itPP = fullList.begin(); - for(; itPP!=fullList.end(); itPP++) { - j++; - SMESH_MeshEditor_PathPoint PP = *itPP; - PP.SetAngle(aAngles[j]); - aPPs[j] = PP; - } - - TNodeOfNodeListMap mapNewNodes; - TElemOfVecOfNnlmiMap mapElemNewNodes; - TElemOfElemListMap newElemsMap; - TIDSortedElemSet::iterator itElem; - double aX, aY, aZ; - int aNb; - SMDSAbs_ElementType aTypeE; - // source elements for each generated one - SMESH_SequenceOfElemPtr srcElems, srcNodes; // 3. Center of rotation aV0 - gp_Pnt aV0 = theRefPoint; - gp_XYZ aGC; + aV0 = theRefPoint; if ( !theHasRefPoint ) { aNb = 0; aGC.SetCoord( 0.,0.,0. ); @@ -4429,19 +3945,19 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements, SMDS_ElemIteratorPtr itN = elem->nodesIterator(); while ( itN->more() ) { - const SMDS_MeshNode* node = static_cast( itN->next() ); - aX = node->X(); - aY = node->Y(); - aZ = node->Z(); + const SMDS_MeshNode* node = static_cast( itN->next() ); + aX = node->X(); + aY = node->Y(); + aZ = node->Z(); - if ( mapNewNodes.find( node ) == mapNewNodes.end() ) { - list aLNx; - mapNewNodes[node] = aLNx; - // - gp_XYZ aXYZ( aX, aY, aZ ); - aGC += aXYZ; - ++aNb; - } + if ( mapNewNodes.find( node ) == mapNewNodes.end() ) { + list aLNx; + mapNewNodes[node] = aLNx; + // + gp_XYZ aXYZ( aX, aY, aZ ); + aGC += aXYZ; + ++aNb; + } } } aGC /= aNb; @@ -4470,66 +3986,65 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements, ++nodeIndex; // check if a node has been already processed const SMDS_MeshNode* node = - static_cast( itN->next() ); + static_cast( itN->next() ); TNodeOfNodeListMap::iterator nIt = mapNewNodes.find( node ); if ( nIt == mapNewNodes.end() ) { nIt = mapNewNodes.insert( make_pair( node, list() )).first; list& listNewNodes = nIt->second; - // make new nodes - aX = node->X(); aY = node->Y(); aZ = node->Z(); + // make new nodes + aX = node->X(); aY = node->Y(); aZ = node->Z(); - Standard_Real aAngle1x, aAngleT1T0, aTolAng; - gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x; - gp_Ax1 anAx1, anAxT1T0; - gp_Dir aDT1x, aDT0x, aDT1T0; + Standard_Real aAngle1x, aAngleT1T0, aTolAng; + gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x; + gp_Ax1 anAx1, anAxT1T0; + gp_Dir aDT1x, aDT0x, aDT1T0; - aTolAng=1.e-4; + aTolAng=1.e-4; - aV0x = aV0; - aPN0.SetCoord(aX, aY, aZ); + aV0x = aV0; + aPN0.SetCoord(aX, aY, aZ); - const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0]; - aP0x = aPP0.Pnt(); - aDT0x= aPP0.Tangent(); - //cout<<"j = 0 PP: Pnt("< aTolAng) { - aDT1T0=aDT1x^aDT0x; - anAxT1T0.SetLocation( aV1x ); - anAxT1T0.SetDirection( aDT1T0 ); - aTrsfRotT1T0.SetRotation( anAxT1T0, aAngleT1T0 ); + // rotation 1 [ T1,T0 ] + aAngleT1T0=-aDT1x.Angle( aDT0x ); + if (fabs(aAngleT1T0) > aTolAng) { + aDT1T0=aDT1x^aDT0x; + anAxT1T0.SetLocation( aV1x ); + anAxT1T0.SetDirection( aDT1T0 ); + aTrsfRotT1T0.SetRotation( anAxT1T0, aAngleT1T0 ); - aPN1 = aPN1.Transformed( aTrsfRotT1T0 ); - } + aPN1 = aPN1.Transformed( aTrsfRotT1T0 ); + } - // rotation 2 - if ( theHasAngles ) { - anAx1.SetLocation( aV1x ); - anAx1.SetDirection( aDT1x ); - aTrsfRot.SetRotation( anAx1, aAngle1x ); + // rotation 2 + if ( theHasAngles ) { + anAx1.SetLocation( aV1x ); + anAx1.SetDirection( aDT1x ); + aTrsfRot.SetRotation( anAx1, aAngle1x ); - aPN1 = aPN1.Transformed( aTrsfRot ); - } + aPN1 = aPN1.Transformed( aTrsfRot ); + } - // make new node + // make new node if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) { // create additional node double x = ( aPN1.X() + aPN0.X() )/2.; @@ -4540,19 +4055,19 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements, srcNodes.Append( node ); listNewNodes.push_back( newNode ); } - aX = aPN1.X(); - aY = aPN1.Y(); - aZ = aPN1.Z(); - const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ ); + aX = aPN1.X(); + aY = aPN1.Y(); + aZ = aPN1.Z(); + const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ ); myLastCreatedNodes.Append(newNode); srcNodes.Append( node ); - listNewNodes.push_back( newNode ); + listNewNodes.push_back( newNode ); - aPN0 = aPN1; - aP0x = aP1x; - aV0x = aV1x; - aDT0x = aDT1x; - } + aPN0 = aPN1; + aP0x = aP1x; + aV0x = aV1x; + aDT0x = aDT1x; + } } else { @@ -4601,56 +4116,6 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements, return EXTR_OK; } - -//======================================================================= -//function : LinearAngleVariation -//purpose : auxilary for ExtrusionAlongTrack -//======================================================================= -void SMESH_MeshEditor::LinearAngleVariation(const int nbSteps, - list& Angles) -{ - int nbAngles = Angles.size(); - if( nbSteps > nbAngles ) { - vector theAngles(nbAngles); - list::iterator it = Angles.begin(); - int i = -1; - for(; it!=Angles.end(); it++) { - i++; - theAngles[i] = (*it); - } - list res; - double rAn2St = double( nbAngles ) / double( nbSteps ); - double angPrev = 0, angle; - for ( int iSt = 0; iSt < nbSteps; ++iSt ) { - double angCur = rAn2St * ( iSt+1 ); - double angCurFloor = floor( angCur ); - double angPrevFloor = floor( angPrev ); - if ( angPrevFloor == angCurFloor ) - angle = rAn2St * theAngles[ int( angCurFloor ) ]; - else { - int iP = int( angPrevFloor ); - double angPrevCeil = ceil(angPrev); - angle = ( angPrevCeil - angPrev ) * theAngles[ iP ]; - - int iC = int( angCurFloor ); - if ( iC < nbAngles ) - angle += ( angCur - angCurFloor ) * theAngles[ iC ]; - - iP = int( angPrevCeil ); - while ( iC-- > iP ) - angle += theAngles[ iC ]; - } - res.push_back(angle); - angPrev = angCur; - } - Angles.clear(); - it = res.begin(); - for(; it!=res.end(); it++) - Angles.push_back( *it ); - } -} - - //======================================================================= //function : Transform //purpose : @@ -4692,7 +4157,7 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems, SMESH_MeshEditor targetMeshEditor( theTargetMesh ); SMESHDS_Mesh* aTgtMesh = theTargetMesh ? theTargetMesh->GetMeshDS() : 0; SMESHDS_Mesh* aMesh = GetMeshDS(); - + // map old node to new one TNodeNodeMap nodeMap; @@ -4774,7 +4239,7 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems, REV_FACE = 3, REV_HEXA = 4, // = nbNodes - 4 FORWARD = 5 - }; + }; int index[][8] = { { 2, 1, 0, 3, 4, 0, 0, 0 }, // REV_TETRA { 2, 1, 0, 3, 4, 0, 0, 0 }, // REV_PYRAMID @@ -4875,18 +4340,18 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems, } } break; - default:; - } - continue; + default:; } + continue; + } - // Regular elements - int* i = index[ FORWARD ]; - if ( needReverse && nbNodes > 2) // reverse mirrored faces and volumes - if ( elemType == SMDSAbs_Face ) - i = index[ REV_FACE ]; - else - i = index[ nbNodes - 4 ]; + // Regular elements + int* i = index[ FORWARD ]; + if ( needReverse && nbNodes > 2) // reverse mirrored faces and volumes + if ( elemType == SMDSAbs_Face ) + i = index[ REV_FACE ]; + else + i = index[ nbNodes - 4 ]; if(elem->IsQuadratic()) { static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; @@ -5013,7 +4478,7 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens, const SMESH_SequenceOfElemPtr& gens = isNodes ? nodeGens : elemGens; const SMESH_SequenceOfElemPtr& elems = isNodes ? myLastCreatedNodes : myLastCreatedElems; if ( gens.Length() != elems.Length() ) - throw SALOME_Exception(LOCALIZED("invalid args")); + throw SMESH_Exception(LOCALIZED("invalid args")); // loop on created elements for (int iElem = 1; iElem <= elems.Length(); ++iElem ) @@ -5093,13 +4558,12 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens, return newGroupIDs; } -//================================================================================ -/*! - * \brief Return list of group of nodes close to each other within theTolerance - * Search among theNodes or in the whole mesh if theNodes is empty using - * an Octree algorithm - */ -//================================================================================ +//======================================================================= +//function : FindCoincidentNodes +//purpose : Return list of group of nodes close to each other within theTolerance +// Search among theNodes or in the whole mesh if theNodes is empty using +// an Octree algorithm +//======================================================================= void SMESH_MeshEditor::FindCoincidentNodes (set & theNodes, const double theTolerance, @@ -5117,10 +4581,9 @@ void SMESH_MeshEditor::FindCoincidentNodes (set & theNodes } else nodes=theNodes; - SMESH_OctreeNode::FindCoincidentNodes ( nodes, &theGroupsOfNodes, theTolerance); -} +} //======================================================================= /*! @@ -5130,14 +4593,11 @@ void SMESH_MeshEditor::FindCoincidentNodes (set & theNodes struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher { - //--------------------------------------------------------------------- /*! * \brief Constructor */ SMESH_NodeSearcherImpl( const SMESHDS_Mesh* theMesh ) { - myMesh = ( SMESHDS_Mesh* ) theMesh; - set nodes; if ( theMesh ) { SMDS_NodeIteratorPtr nIt = theMesh->nodesIterator(); @@ -5145,43 +4605,19 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher nodes.insert( nodes.end(), nIt->next() ); } myOctreeNode = new SMESH_OctreeNode(nodes) ; - - // get max size of a leaf box - SMESH_OctreeNode* tree = myOctreeNode; - while ( !tree->isLeaf() ) - { - SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator(); - if ( cIt->more() ) - tree = cIt->next(); - } - myHalfLeafSize = tree->maxSize() / 2.; } - - //--------------------------------------------------------------------- - /*! - * \brief Move node and update myOctreeNode accordingly - */ - void MoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt ) - { - myOctreeNode->UpdateByMoveNode( node, toPnt ); - myMesh->MoveNode( node, toPnt.X(), toPnt.Y(), toPnt.Z() ); - } - - //--------------------------------------------------------------------- /*! * \brief Do it's job */ const SMDS_MeshNode* FindClosestTo( const gp_Pnt& thePnt ) { SMDS_MeshNode tgtNode( thePnt.X(), thePnt.Y(), thePnt.Z() ); - map dist2Nodes; - myOctreeNode->NodesAround( &tgtNode, dist2Nodes, myHalfLeafSize ); - if ( !dist2Nodes.empty() ) - return dist2Nodes.begin()->second; list nodes; - //myOctreeNode->NodesAround( &tgtNode, &nodes, myHalfLeafSize ); + const double precision = 1e-6; + //myOctreeNode->NodesAround( &tgtNode, &nodes, precision ); double minSqDist = DBL_MAX; + Bnd_B3d box; if ( nodes.empty() ) // get all nodes of OctreeNode's closest to thePnt { // sort leafs by their distance from thePnt @@ -5190,25 +4626,20 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher list< SMESH_OctreeNode* > treeList; list< SMESH_OctreeNode* >::iterator trIt; treeList.push_back( myOctreeNode ); - - SMDS_MeshNode pointNode( thePnt.X(), thePnt.Y(), thePnt.Z() ); for ( trIt = treeList.begin(); trIt != treeList.end(); ++trIt) { SMESH_OctreeNode* tree = *trIt; - if ( !tree->isLeaf() ) // put children to the queue - { - if ( !tree->isInside( &pointNode, myHalfLeafSize )) continue; + if ( !tree->isLeaf() ) { // put children to the queue SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator(); while ( cIt->more() ) treeList.push_back( cIt->next() ); } - else if ( tree->NbNodes() ) // put a tree to the treeMap - { - const Bnd_B3d& box = tree->getBox(); + else if ( tree->NbNodes() ) { // put tree to treeMap + tree->getBox( box ); double sqDist = thePnt.SquareDistance( 0.5 * ( box.CornerMin() + box.CornerMax() )); pair it_in = treeMap.insert( make_pair( sqDist, tree )); if ( !it_in.second ) // not unique distance to box center - treeMap.insert( it_in.first, make_pair( sqDist + 1e-13*treeMap.size(), tree )); + treeMap.insert( it_in.first, make_pair( sqDist - 1e-13*treeMap.size(), tree )); } } // find distance after which there is no sense to check tree's @@ -5216,7 +4647,7 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher TDistTreeMap::iterator sqDist_tree = treeMap.begin(); if ( treeMap.size() > 5 ) { SMESH_OctreeNode* closestTree = sqDist_tree->second; - const Bnd_B3d& box = closestTree->getBox(); + closestTree->getBox( box ); double limit = sqrt( sqDist_tree->first ) + sqrt ( box.SquareExtent() ); sqLimit = limit * limit; } @@ -5241,23 +4672,12 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher } return closestNode; } - - //--------------------------------------------------------------------- /*! * \brief Destructor */ ~SMESH_NodeSearcherImpl() { delete myOctreeNode; } - - //--------------------------------------------------------------------- - /*! - * \brief Return the node tree - */ - const SMESH_OctreeNode* getTree() const { return myOctreeNode; } - private: SMESH_OctreeNode* myOctreeNode; - SMESHDS_Mesh* myMesh; - double myHalfLeafSize; // max size of a leaf box }; //======================================================================= @@ -5271,404 +4691,6 @@ SMESH_NodeSearcher* SMESH_MeshEditor::GetNodeSearcher() return new SMESH_NodeSearcherImpl( GetMeshDS() ); } -// ======================================================================== -namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint() -{ - const int MaxNbElemsInLeaf = 10; // maximal number of elements in a leaf of tree - const int MaxLevel = 7; // maximal tree height -> nb terminal boxes: 8^7 = 2097152 - const double NodeRadius = 1e-9; // to enlarge bnd box of element - - //======================================================================= - /*! - * \brief Octal tree of bounding boxes of elements - */ - //======================================================================= - - class ElementBndBoxTree : public SMESH_Octree - { - public: - - ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType); - void getElementsNearPoint( const gp_Pnt& point, TIDSortedElemSet& foundElems); - ~ElementBndBoxTree(); - - protected: - ElementBndBoxTree() {} - SMESH_Octree* allocateOctreeChild() const { return new ElementBndBoxTree; } - void buildChildrenData(); - Bnd_B3d* buildRootBox(); - private: - //!< Bounding box of element - struct ElementBox : public Bnd_B3d - { - const SMDS_MeshElement* _element; - int _refCount; // an ElementBox can be included in several tree branches - ElementBox(const SMDS_MeshElement* elem); - }; - vector< ElementBox* > _elements; - }; - - //================================================================================ - /*! - * \brief ElementBndBoxTree creation - */ - //================================================================================ - - ElementBndBoxTree::ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType) - :SMESH_Octree( new SMESH_Octree::Limit( MaxLevel, /*minSize=*/0. )) - { - int nbElems = mesh.GetMeshInfo().NbElements( elemType ); - _elements.reserve( nbElems ); - - SMDS_ElemIteratorPtr elemIt = mesh.elementsIterator( elemType ); - while ( elemIt->more() ) - _elements.push_back( new ElementBox( elemIt->next() )); - - if ( _elements.size() > MaxNbElemsInLeaf ) - compute(); - else - myIsLeaf = true; - } - - //================================================================================ - /*! - * \brief Destructor - */ - //================================================================================ - - ElementBndBoxTree::~ElementBndBoxTree() - { - for ( int i = 0; i < _elements.size(); ++i ) - if ( --_elements[i]->_refCount <= 0 ) - delete _elements[i]; - } - - //================================================================================ - /*! - * \brief Return the maximal box - */ - //================================================================================ - - Bnd_B3d* ElementBndBoxTree::buildRootBox() - { - Bnd_B3d* box = new Bnd_B3d; - for ( int i = 0; i < _elements.size(); ++i ) - box->Add( *_elements[i] ); - return box; - } - - //================================================================================ - /*! - * \brief Redistrubute element boxes among children - */ - //================================================================================ - - void ElementBndBoxTree::buildChildrenData() - { - for ( int i = 0; i < _elements.size(); ++i ) - { - for (int j = 0; j < 8; j++) - { - if ( !_elements[i]->IsOut( myChildren[j]->getBox() )) - { - _elements[i]->_refCount++; - ((ElementBndBoxTree*)myChildren[j])->_elements.push_back( _elements[i]); - } - } - _elements[i]->_refCount--; - } - _elements.clear(); - - for (int j = 0; j < 8; j++) - { - ElementBndBoxTree* child = static_cast( myChildren[j]); - if ( child->_elements.size() <= MaxNbElemsInLeaf ) - child->myIsLeaf = true; - - if ( child->_elements.capacity() - child->_elements.size() > 1000 ) - child->_elements.resize( child->_elements.size() ); // compact - } - } - - //================================================================================ - /*! - * \brief Return elements which can include the point - */ - //================================================================================ - - void ElementBndBoxTree::getElementsNearPoint( const gp_Pnt& point, - TIDSortedElemSet& foundElems) - { - if ( level() && getBox().IsOut( point.XYZ() )) - return; - - if ( isLeaf() ) - { - for ( int i = 0; i < _elements.size(); ++i ) - if ( !_elements[i]->IsOut( point.XYZ() )) - foundElems.insert( _elements[i]->_element ); - } - else - { - for (int i = 0; i < 8; i++) - ((ElementBndBoxTree*) myChildren[i])->getElementsNearPoint( point, foundElems ); - } - } - - //================================================================================ - /*! - * \brief Construct the element box - */ - //================================================================================ - - ElementBndBoxTree::ElementBox::ElementBox(const SMDS_MeshElement* elem) - { - _element = elem; - _refCount = 1; - SMDS_ElemIteratorPtr nIt = elem->nodesIterator(); - while ( nIt->more() ) - Add( TNodeXYZ( cast2Node( nIt->next() ))); - Enlarge( NodeRadius ); - } - -} // namespace - -//======================================================================= -/*! - * \brief Implementation of search for the elements by point - */ -//======================================================================= - -struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher -{ - SMESHDS_Mesh* _mesh; - ElementBndBoxTree* _ebbTree; - SMESH_NodeSearcherImpl* _nodeSearcher; - SMDSAbs_ElementType _elementType; - - SMESH_ElementSearcherImpl( SMESHDS_Mesh& mesh ): _mesh(&mesh),_ebbTree(0),_nodeSearcher(0) {} - ~SMESH_ElementSearcherImpl() - { - if ( _ebbTree ) delete _ebbTree; _ebbTree = 0; - if ( _nodeSearcher ) delete _nodeSearcher; _nodeSearcher = 0; - } - - /*! - * \brief Return elements of given type where the given point is IN or ON. - * - * 'ALL' type means elements of any type excluding nodes and 0D elements - */ - void FindElementsByPoint(const gp_Pnt& point, - SMDSAbs_ElementType type, - vector< const SMDS_MeshElement* >& foundElements) - { - foundElements.clear(); - - const SMDS_MeshInfo& meshInfo = _mesh->GetMeshInfo(); - - // ----------------- - // define tolerance - // ----------------- - double tolerance = 0; - if ( _nodeSearcher && meshInfo.NbNodes() > 1 ) - { - double boxSize = _nodeSearcher->getTree()->maxSize(); - tolerance = 1e-8 * boxSize/* / meshInfo.NbNodes()*/; - } - else if ( _ebbTree && meshInfo.NbElements() > 0 ) - { - double boxSize = _ebbTree->maxSize(); - tolerance = 1e-8 * boxSize/* / meshInfo.NbElements()*/; - } - if ( tolerance == 0 ) - { - // define tolerance by size of a most complex element - int complexType = SMDSAbs_Volume; - while ( complexType > SMDSAbs_All && - meshInfo.NbElements( SMDSAbs_ElementType( complexType )) < 1 ) - --complexType; - if ( complexType == SMDSAbs_All ) return; // empty mesh - - double elemSize; - if ( complexType == int( SMDSAbs_Node )) - { - SMDS_NodeIteratorPtr nodeIt = _mesh->nodesIterator(); - elemSize = 1; - if ( meshInfo.NbNodes() > 2 ) - elemSize = TNodeXYZ( nodeIt->next() ).Distance( nodeIt->next() ); - } - else - { - const SMDS_MeshElement* elem = - _mesh->elementsIterator( SMDSAbs_ElementType( complexType ))->next(); - SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator(); - TNodeXYZ n1( cast2Node( nodeIt->next() )); - while ( nodeIt->more() ) - { - double dist = n1.Distance( cast2Node( nodeIt->next() )); - elemSize = max( dist, elemSize ); - } - } - tolerance = 1e-6 * elemSize; - } - - // ================================================================================= - if ( type == SMDSAbs_Node || type == SMDSAbs_0DElement ) - { - if ( !_nodeSearcher ) - _nodeSearcher = new SMESH_NodeSearcherImpl( _mesh ); - - const SMDS_MeshNode* closeNode = _nodeSearcher->FindClosestTo( point ); - if ( !closeNode ) return; - - if ( point.Distance( TNodeXYZ( closeNode )) > tolerance ) - return; // to far from any node - - if ( type == SMDSAbs_Node ) - { - foundElements.push_back( closeNode ); - } - else - { - SMDS_ElemIteratorPtr elemIt = closeNode->GetInverseElementIterator( SMDSAbs_0DElement ); - while ( elemIt->more() ) - foundElements.push_back( elemIt->next() ); - } - } - // ================================================================================= - else // elements more complex than 0D - { - if ( !_ebbTree || _elementType != type ) - { - if ( _ebbTree ) delete _ebbTree; - _ebbTree = new ElementBndBoxTree( *_mesh, _elementType = type ); - } - TIDSortedElemSet suspectElems; - _ebbTree->getElementsNearPoint( point, suspectElems ); - TIDSortedElemSet::iterator elem = suspectElems.begin(); - for ( ; elem != suspectElems.end(); ++elem ) - if ( !SMESH_MeshEditor::isOut( *elem, point, tolerance )) - foundElements.push_back( *elem ); - } - } -}; // struct SMESH_ElementSearcherImpl - -//======================================================================= -/*! - * \brief Return SMESH_ElementSearcher - */ -//======================================================================= - -SMESH_ElementSearcher* SMESH_MeshEditor::GetElementSearcher() -{ - return new SMESH_ElementSearcherImpl( *GetMeshDS() ); -} - -//======================================================================= -/*! - * \brief Return true if the point is IN or ON of the element - */ -//======================================================================= - -bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol ) -{ - if ( element->GetType() == SMDSAbs_Volume) - { - return SMDS_VolumeTool( element ).IsOut( point.X(), point.Y(), point.Z(), tol ); - } - - // get ordered nodes - - vector< gp_XYZ > xyz; - - SMDS_ElemIteratorPtr nodeIt = element->nodesIterator(); - if ( element->IsQuadratic() ) - if (const SMDS_QuadraticFaceOfNodes* f=dynamic_cast(element)) - nodeIt = f->interlacedNodesElemIterator(); - else if (const SMDS_QuadraticEdge* e =dynamic_cast(element)) - nodeIt = e->interlacedNodesElemIterator(); - - while ( nodeIt->more() ) - xyz.push_back( TNodeXYZ( cast2Node( nodeIt->next() ))); - - if ( element->GetType() == SMDSAbs_Face ) // -------------------------------------------------- - { - // gravity center - gp_XYZ gc(0,0,0); - gc = accumulate( xyz.begin(), xyz.end(), gc ); - gc /= element->NbNodes(); - - // compute face normal using gc - gp_Vec normal(0,0,0); - xyz.push_back( xyz.front() ); - for ( int i = 0; i < element->NbNodes(); ++i ) - { - gp_Vec edge( xyz[i], xyz[i+1]); - gp_Vec n2gc( xyz[i], gc ); - normal += edge ^ n2gc; - } - double faceDoubleArea = normal.Magnitude(); - if ( faceDoubleArea <= numeric_limits::min() ) - return true; // invalid face - normal /= faceDoubleArea; - - // check if the point lays on face plane - gp_Vec n2p( xyz[0], point ); - if ( fabs( n2p * normal ) > tol ) - return true; // not on face plane - - // check if point is out of face boundary - int i, out = false; - for ( i = 0; !out && i < element->NbNodes(); ++i ) - { - gp_Vec edge( xyz[i], xyz[i+1]); - gp_Vec n2p ( xyz[i], point ); - gp_Vec cross = edge ^ n2p; - out = ( cross * normal < -tol ); - } - if ( out && element->IsPoly() ) - { - // define point position by the closest edge - double minDist = numeric_limits::max(); - int iMinDist; - for ( i = 0; i < element->NbNodes(); ++i ) - { - gp_Vec edge( xyz[i], xyz[i+1]); - gp_Vec n1p ( xyz[i], point); - double dist = ( edge ^ n1p ).Magnitude() / edge.Magnitude(); - if ( dist < minDist ) - iMinDist = i; - } - gp_Vec edge( xyz[iMinDist], xyz[iMinDist+1]); - gp_Vec n2p ( xyz[iMinDist], point ); - gp_Vec cross = edge ^ n2p; - out = ( cross * normal < -tol ); - } - return out; - } - if ( element->GetType() == SMDSAbs_Edge ) // -------------------------------------------------- - { - for ( int i = 1; i < element->NbNodes(); ++i ) - { - gp_Vec edge( xyz[i-1], xyz[i]); - gp_Vec n1p ( xyz[i-1], point); - double dist = ( edge ^ n1p ).Magnitude() / edge.Magnitude(); - if ( dist > tol ) - return true; - gp_Vec n2p( xyz[i], point ); - if ( fabs( edge.Magnitude() - n1p.Magnitude() - n2p.Magnitude()) > tol ) - return true; - } - return false; - } - // Node or 0D element ------------------------------------------------------------------------- - { - gp_Vec n2p ( xyz[0], point ); - return n2p.Magnitude() <= tol; - } - return true; -} - //======================================================================= //function : SimplifyFace //purpose : @@ -5787,7 +4809,7 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes) SMDS_ElemIteratorPtr invElemIt = nToRemove->GetInverseElementIterator(); while ( invElemIt->more() ) { const SMDS_MeshElement* elem = invElemIt->next(); - elems.insert(elem); + elems.insert(elem); } } } @@ -6321,24 +5343,24 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes) // ======================================================== class SortableElement : public set { -public: + public: SortableElement( const SMDS_MeshElement* theElem ) - { - myElem = theElem; - SMDS_ElemIteratorPtr nodeIt = theElem->nodesIterator(); - while ( nodeIt->more() ) - this->insert( nodeIt->next() ); - } + { + myElem = theElem; + SMDS_ElemIteratorPtr nodeIt = theElem->nodesIterator(); + while ( nodeIt->more() ) + this->insert( nodeIt->next() ); + } const SMDS_MeshElement* Get() const - { return myElem; } + { return myElem; } void Set(const SMDS_MeshElement* e) const - { myElem = e; } + { myElem = e; } -private: + private: mutable const SMDS_MeshElement* myElem; }; @@ -6348,7 +5370,7 @@ private: // Search among theElements or in the whole mesh if theElements is empty //======================================================================= void SMESH_MeshEditor::FindEqualElements(set & theElements, - TListOfListOfElementsID & theGroupsOfElementsID) + TListOfListOfElementsID & theGroupsOfElementsID) { myLastCreatedElems.Clear(); myLastCreatedNodes.Clear(); @@ -6446,7 +5468,7 @@ void SMESH_MeshEditor::MergeElements(TListOfListOfElementsID & theGroupsOfElemen void SMESH_MeshEditor::MergeEqualElements() { set aMeshElements; /* empty input - - to merge equal elements in the whole mesh */ + to merge equal elements in the whole mesh */ TListOfListOfElementsID aGroupsOfElementsID; FindEqualElements(aMeshElements, aGroupsOfElementsID); MergeElements(aGroupsOfElementsID); @@ -6460,10 +5482,10 @@ void SMESH_MeshEditor::MergeEqualElements() //======================================================================= const SMDS_MeshElement* -SMESH_MeshEditor::FindFaceInSet(const SMDS_MeshNode* n1, - const SMDS_MeshNode* n2, - const TIDSortedElemSet& elemSet, - const TIDSortedElemSet& avoidSet) + SMESH_MeshEditor::FindFaceInSet(const SMDS_MeshNode* n1, + const SMDS_MeshNode* n2, + const TIDSortedElemSet& elemSet, + const TIDSortedElemSet& avoidSet) { SMDS_ElemIteratorPtr invElemIt = n1->GetInverseElementIterator(SMDSAbs_Face); @@ -6577,7 +5599,7 @@ bool SMESH_MeshEditor::FindFreeBorder (const SMDS_MeshNode* theFirst //vector nodes; const SMDS_MeshNode *nIgnore = theFirstNode, *nStart = theSecondNode; - TIDSortedElemSet foundElems; + set < const SMDS_MeshElement* > foundElems; bool needTheLast = ( theLastNode != 0 ); while ( nStart != theLastNode ) { @@ -6596,7 +5618,7 @@ bool SMESH_MeshEditor::FindFreeBorder (const SMDS_MeshNode* theFirst int iNode = 0, nbNodes = e->NbNodes(); //const SMDS_MeshNode* nodes[nbNodes+1]; vector nodes(nbNodes+1); - + if(e->IsQuadratic()) { const SMDS_QuadraticFaceOfNodes* F = static_cast(e); @@ -6716,15 +5738,15 @@ bool SMESH_MeshEditor::CheckFreeBorderNodes(const SMDS_MeshNode* theNode1, //======================================================================= SMESH_MeshEditor::Sew_Error -SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode, - const SMDS_MeshNode* theBordSecondNode, - const SMDS_MeshNode* theBordLastNode, - const SMDS_MeshNode* theSideFirstNode, - const SMDS_MeshNode* theSideSecondNode, - const SMDS_MeshNode* theSideThirdNode, - const bool theSideIsFreeBorder, - const bool toCreatePolygons, - const bool toCreatePolyedrs) + SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode, + const SMDS_MeshNode* theBordSecondNode, + const SMDS_MeshNode* theBordLastNode, + const SMDS_MeshNode* theSideFirstNode, + const SMDS_MeshNode* theSideSecondNode, + const SMDS_MeshNode* theSideThirdNode, + const bool theSideIsFreeBorder, + const bool toCreatePolygons, + const bool toCreatePolyedrs) { myLastCreatedElems.Clear(); myLastCreatedNodes.Clear(); @@ -6978,7 +6000,7 @@ SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode, TListOfListOfNodes nodeGroupsToMerge; if ( nbNodes[0] == nbNodes[1] || - ( theSideIsFreeBorder && !theSideThirdNode)) { + ( theSideIsFreeBorder && !theSideThirdNode)) { // all nodes are to be merged @@ -7629,47 +6651,44 @@ int SMESH_MeshEditor::convertElemToQuadratic(SMESHDS_SubMesh * theSm, switch( aType ) { case SMDSAbs_Edge : - { - NewElem = theHelper.AddEdge(aNds[0], aNds[1], id, theForce3d); - break; - } + { + NewElem = theHelper.AddEdge(aNds[0], aNds[1], id, theForce3d); + break; + } case SMDSAbs_Face : + { + switch(nbNodes) { - switch(nbNodes) - { - case 3: - NewElem = theHelper.AddFace(aNds[0], aNds[1], aNds[2], id, theForce3d); - break; - case 4: - NewElem = theHelper.AddFace(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d); - break; - default: - continue; - } - break; + case 3: + NewElem = theHelper.AddFace(aNds[0], aNds[1], aNds[2], id, theForce3d); + break; + case 4: + NewElem = theHelper.AddFace(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d); + break; + default: + continue; } + break; + } case SMDSAbs_Volume : + { + switch(nbNodes) { - switch(nbNodes) - { - case 4: - NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d); - break; - case 5: - NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], id, theForce3d); - break; - case 6: - NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d); - break; - case 8: - NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], - aNds[4], aNds[5], aNds[6], aNds[7], id, theForce3d); - break; - default: - continue; - } - break; + case 4: + NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d); + break; + case 6: + NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d); + break; + case 8: + NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], + aNds[4], aNds[5], aNds[6], aNds[7], id, theForce3d); + break; + default: + continue; } + break; + } default : continue; } @@ -7717,11 +6736,11 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d) const SMDS_MeshEdge* edge = aEdgeItr->next(); if(edge && !edge->IsQuadratic()) { - int id = edge->GetID(); - const SMDS_MeshNode* n1 = edge->GetNode(0); - const SMDS_MeshNode* n2 = edge->GetNode(1); + int id = edge->GetID(); + const SMDS_MeshNode* n1 = edge->GetNode(0); + const SMDS_MeshNode* n2 = edge->GetNode(1); - meshDS->RemoveFreeElement(edge, smDS, notFromGroups); + meshDS->RemoveFreeElement(edge, smDS, notFromGroups); const SMDS_MeshEdge* NewEdge = aHelper.AddEdge(n1, n2, id, theForce3d); ReplaceElemInGroups( edge, NewEdge, GetMeshDS()); @@ -7739,7 +6758,7 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d) for(int i = 0; i < nbNodes; i++) { - aNds[i] = face->GetNode(i); + aNds[i] = face->GetNode(i); } meshDS->RemoveFreeElement(face, smDS, notFromGroups); @@ -7748,13 +6767,13 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d) switch(nbNodes) { case 3: - NewFace = aHelper.AddFace(aNds[0], aNds[1], aNds[2], id, theForce3d); - break; + NewFace = aHelper.AddFace(aNds[0], aNds[1], aNds[2], id, theForce3d); + break; case 4: - NewFace = aHelper.AddFace(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d); - break; + NewFace = aHelper.AddFace(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d); + break; default: - continue; + continue; } ReplaceElemInGroups( face, NewFace, GetMeshDS()); } @@ -7770,7 +6789,7 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d) for(int i = 0; i < nbNodes; i++) { - aNds[i] = volume->GetNode(i); + aNds[i] = volume->GetNode(i); } meshDS->RemoveFreeElement(volume, smDS, notFromGroups); @@ -7779,31 +6798,23 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d) switch(nbNodes) { case 4: - NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], + NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d ); - break; - case 5: - NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], - aNds[3], aNds[4], id, theForce3d); - break; + break; case 6: - NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], + NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d); - break; + break; case 8: - NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], + NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], aNds[6], aNds[7], id, theForce3d); - break; + break; default: - continue; + continue; } ReplaceElemInGroups(volume, NewVolume, meshDS); } } - if ( !theForce3d ) { - aHelper.SetSubShape(0); // apply to the whole mesh - aHelper.FixQuadraticElements(); - } } //======================================================================= @@ -7835,12 +6846,12 @@ int SMESH_MeshEditor::removeQuadElem(SMESHDS_SubMesh * theSm, for(int i = 0; i < nbNodes; i++) { - const SMDS_MeshNode* n = elem->GetNode(i); + const SMDS_MeshNode* n = elem->GetNode(i); - if( elem->IsMediumNode( n ) ) + if( elem->IsMediumNode( n ) ) mediumNodes.push_back( n ); - else - aNds.push_back( n ); + else + aNds.push_back( n ); } if( aNds.empty() ) continue; SMDSAbs_ElementType aType = elem->GetType(); @@ -7851,7 +6862,7 @@ int SMESH_MeshEditor::removeQuadElem(SMESHDS_SubMesh * theSm, SMDS_MeshElement * NewElem = AddElement( aNds, aType, false, id ); ReplaceElemInGroups(elem, NewElem, meshDS); if( theSm && NewElem ) - theSm->AddElement( NewElem ); + theSm->AddElement( NewElem ); // remove medium nodes vector::iterator nIt = mediumNodes.begin(); @@ -7863,7 +6874,7 @@ int SMESH_MeshEditor::removeQuadElem(SMESHDS_SubMesh * theSm, ( n->GetPosition()->GetShapeId() )); else meshDS->RemoveFreeNode( n, theSm ); - } + } } } } @@ -7889,7 +6900,7 @@ bool SMESH_MeshEditor::ConvertFromQuadratic() } } } - + int totalNbElems = GetMeshDS()->NbEdges() + GetMeshDS()->NbFaces() + GetMeshDS()->NbVolumes(); if ( nbCheckedElems < totalNbElems ) // not all elements are in submeshes @@ -7907,12 +6918,12 @@ bool SMESH_MeshEditor::ConvertFromQuadratic() //======================================================================= SMESH_MeshEditor::Sew_Error -SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1, - TIDSortedElemSet& theSide2, - const SMDS_MeshNode* theFirstNode1, - const SMDS_MeshNode* theFirstNode2, - const SMDS_MeshNode* theSecondNode1, - const SMDS_MeshNode* theSecondNode2) + SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1, + TIDSortedElemSet& theSide2, + const SMDS_MeshNode* theFirstNode1, + const SMDS_MeshNode* theFirstNode2, + const SMDS_MeshNode* theSecondNode1, + const SMDS_MeshNode* theSecondNode2) { myLastCreatedElems.Clear(); myLastCreatedNodes.Clear(); @@ -8151,40 +7162,40 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1, const SMDS_MeshElement* aFreeFace = freeFaceList.front(); faceSet->insert( aFreeFace ); // complete a node set with nodes of a found free face - // for ( iNode = 0; iNode < ; iNode++ ) - // nodeSet->insert( fNodes[ iNode ] ); +// for ( iNode = 0; iNode < ; iNode++ ) +// nodeSet->insert( fNodes[ iNode ] ); } } // loop on volumes of a side - // // complete a set of faces if new nodes in a nodeSet appeared - // // ---------------------------------------------------------- - // if ( nodeSetSize != nodeSet->size() ) { - // for ( ; nIt != nodeSet->end(); nIt++ ) { // loop on nodes of iSide - // SMDS_ElemIteratorPtr fIt = (*nIt)->GetInverseElementIterator(SMDSAbs_Face); - // while ( fIt->more() ) { // loop on faces sharing a node - // const SMDS_MeshElement* f = fIt->next(); - // if ( faceSet->find( f ) == faceSet->end() ) { - // // check if all nodes are in nodeSet and - // // complete setOfFaceNodeSet if they are - // set faceNodeSet; - // SMDS_ElemIteratorPtr nodeIt = f->nodesIterator(); - // bool allInSet = true; - // while ( nodeIt->more() && allInSet ) { // loop on nodes of a face - // const SMDS_MeshNode* n = static_cast( nodeIt->next() ); - // if ( nodeSet->find( n ) == nodeSet->end() ) - // allInSet = false; - // else - // faceNodeSet.insert( n ); - // } - // if ( allInSet ) { - // faceSet->insert( f ); - // setOfFaceNodeSet.insert( faceNodeSet ); - // } - // } - // } - // } - // } +// // complete a set of faces if new nodes in a nodeSet appeared +// // ---------------------------------------------------------- +// if ( nodeSetSize != nodeSet->size() ) { +// for ( ; nIt != nodeSet->end(); nIt++ ) { // loop on nodes of iSide +// SMDS_ElemIteratorPtr fIt = (*nIt)->GetInverseElementIterator(SMDSAbs_Face); +// while ( fIt->more() ) { // loop on faces sharing a node +// const SMDS_MeshElement* f = fIt->next(); +// if ( faceSet->find( f ) == faceSet->end() ) { +// // check if all nodes are in nodeSet and +// // complete setOfFaceNodeSet if they are +// set faceNodeSet; +// SMDS_ElemIteratorPtr nodeIt = f->nodesIterator(); +// bool allInSet = true; +// while ( nodeIt->more() && allInSet ) { // loop on nodes of a face +// const SMDS_MeshNode* n = static_cast( nodeIt->next() ); +// if ( nodeSet->find( n ) == nodeSet->end() ) +// allInSet = false; +// else +// faceNodeSet.insert( n ); +// } +// if ( allInSet ) { +// faceSet->insert( f ); +// setOfFaceNodeSet.insert( faceNodeSet ); +// } +// } +// } +// } +// } } // Create temporary faces, if there are volumes given } // loop on sides @@ -8290,10 +7301,10 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1, nbl++; if(iSide==0) notLinkNodes1[nbl] = n; - //notLinkNodes1.push_back(n); + //notLinkNodes1.push_back(n); else notLinkNodes2[nbl] = n; - //notLinkNodes2.push_back(n); + //notLinkNodes2.push_back(n); } //faceNodes[ iSide ][ iNode++ ] = n; if(iSide==0) { @@ -8374,7 +7385,7 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1, //nReplaceMap.insert( TNodeNodeMap::value_type // ( notLinkNodes[0][0], notLinkNodes[1][0] )); nReplaceMap.insert( TNodeNodeMap::value_type - ( notLinkNodes1[0], notLinkNodes2[0] )); + ( notLinkNodes1[0], notLinkNodes2[0] )); } else { for ( iSide = 0; iSide < 2; iSide++ ) { // loop on 2 sides @@ -8395,7 +7406,7 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1, // ( notLinkNodes[0][1], notLinkNodes[1][1] )); for(int nn=0; nnempty() || !faceSetPtr[1]->empty() )) { + ( linkIt[0] != linkList[0].end() || + !faceSetPtr[0]->empty() || !faceSetPtr[1]->empty() )) { MESSAGE( (linkIt[0] != linkList[0].end()) <<" "<< (faceSetPtr[0]->empty()) << - " " << (faceSetPtr[1]->empty())); + " " << (faceSetPtr[1]->empty())); aResult = SEW_TOPO_DIFF_SETS_OF_ELEMENTS; } @@ -8493,17 +7504,17 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1, } //================================================================================ -/*! - * \brief Find corresponding nodes in two sets of faces - * \param theSide1 - first face set - * \param theSide2 - second first face - * \param theFirstNode1 - a boundary node of set 1 - * \param theFirstNode2 - a node of set 2 corresponding to theFirstNode1 - * \param theSecondNode1 - a boundary node of set 1 linked with theFirstNode1 - * \param theSecondNode2 - a node of set 2 corresponding to theSecondNode1 - * \param nReplaceMap - output map of corresponding nodes - * \retval bool - is a success or not - */ + /*! + * \brief Find corresponding nodes in two sets of faces + * \param theSide1 - first face set + * \param theSide2 - second first face + * \param theFirstNode1 - a boundary node of set 1 + * \param theFirstNode2 - a node of set 2 corresponding to theFirstNode1 + * \param theSecondNode1 - a boundary node of set 1 linked with theFirstNode1 + * \param theSecondNode2 - a node of set 2 corresponding to theSecondNode1 + * \param nReplaceMap - output map of corresponding nodes + * \retval bool - is a success or not + */ //================================================================================ #ifdef _DEBUG_ @@ -8620,8 +7631,8 @@ SMESH_MeshEditor::FindMatchingNodes(set& theSide1, } #ifdef DEBUG_MATCHING_NODES MESSAGE ( " Link 1: " << link[0].first->GetID() <<" "<< link[0].second->GetID() - << " F 1: " << face[0] << "| Link 2: " << link[1].first->GetID() <<" " - << link[1].second->GetID() << " F 2: " << face[1] << " | Bind: " ) ; + << " F 1: " << face[0] << "| Link 2: " << link[1].first->GetID() <<" " + << link[1].second->GetID() << " F 2: " << face[1] << " | Bind: " ) ; #endif int nbN = nbNodes[0]; { @@ -8652,7 +7663,7 @@ SMESH_MeshEditor::FindMatchingNodes(set& theSide1, { #ifdef DEBUG_MATCHING_NODES MESSAGE ( "Add link 1: " << n1->GetID() << " " << n2->GetID() << " " - << " | link 2: " << nReplaceMap[n1]->GetID() << " " << nReplaceMap[n2]->GetID() << " " ); + << " | link 2: " << nReplaceMap[n1]->GetID() << " " << nReplaceMap[n2]->GetID() << " " ); #endif linkList[0].push_back ( NLink( n1, n2 )); linkList[1].push_back ( NLink( nReplaceMap[n1], nReplaceMap[n2] )); @@ -8665,120 +7676,6 @@ SMESH_MeshEditor::FindMatchingNodes(set& theSide1, return SEW_OK; } -/*! - \brief Creates a hole in a mesh by doubling the nodes of some particular elements - \param theElems - the list of elements (edges or faces) to be replicated - The nodes for duplication could be found from these elements - \param theNodesNot - list of nodes to NOT replicate - \param theAffectedElems - the list of elements (cells and edges) to which the - replicated nodes should be associated to. - \return TRUE if operation has been completed successfully, FALSE otherwise -*/ -bool SMESH_MeshEditor::DoubleNodes( const TIDSortedElemSet& theElems, - const TIDSortedElemSet& theNodesNot, - const TIDSortedElemSet& theAffectedElems ) -{ - myLastCreatedElems.Clear(); - myLastCreatedNodes.Clear(); - - if ( theElems.size() == 0 ) - return false; - - SMESHDS_Mesh* aMeshDS = GetMeshDS(); - if ( !aMeshDS ) - return false; - - bool res = false; - std::map< const SMDS_MeshNode*, const SMDS_MeshNode* > anOldNodeToNewNode; - // duplicate elements and nodes - res = doubleNodes( aMeshDS, theElems, theNodesNot, anOldNodeToNewNode, true ); - // replce nodes by duplications - res = doubleNodes( aMeshDS, theAffectedElems, theNodesNot, anOldNodeToNewNode, false ); - return res; -} - -/*! - \brief Creates a hole in a mesh by doubling the nodes of some particular elements - \param theMeshDS - mesh instance - \param theElems - the elements replicated or modified (nodes should be changed) - \param theNodesNot - nodes to NOT replicate - \param theNodeNodeMap - relation of old node to new created node - \param theIsDoubleElem - flag os to replicate element or modify - \return TRUE if operation has been completed successfully, FALSE otherwise -*/ -bool SMESH_MeshEditor::doubleNodes( SMESHDS_Mesh* theMeshDS, - const TIDSortedElemSet& theElems, - const TIDSortedElemSet& theNodesNot, - std::map< const SMDS_MeshNode*, - const SMDS_MeshNode* >& theNodeNodeMap, - const bool theIsDoubleElem ) -{ - // iterate on through element and duplicate them (by nodes duplication) - bool res = false; - TIDSortedElemSet::const_iterator elemItr = theElems.begin(); - for ( ; elemItr != theElems.end(); ++elemItr ) - { - const SMDS_MeshElement* anElem = *elemItr; - if (!anElem) - continue; - - bool isDuplicate = false; - // duplicate nodes to duplicate element - std::vector newNodes( anElem->NbNodes() ); - SMDS_ElemIteratorPtr anIter = anElem->nodesIterator(); - int ind = 0; - while ( anIter->more() ) - { - - SMDS_MeshNode* aCurrNode = (SMDS_MeshNode*)anIter->next(); - SMDS_MeshNode* aNewNode = aCurrNode; - if ( theNodeNodeMap.find( aCurrNode ) != theNodeNodeMap.end() ) - aNewNode = (SMDS_MeshNode*)theNodeNodeMap[ aCurrNode ]; - else if ( theIsDoubleElem && theNodesNot.find( aCurrNode ) == theNodesNot.end() ) - { - // duplicate node - aNewNode = theMeshDS->AddNode( aCurrNode->X(), aCurrNode->Y(), aCurrNode->Z() ); - theNodeNodeMap[ aCurrNode ] = aNewNode; - myLastCreatedNodes.Append( aNewNode ); - } - isDuplicate |= (aCurrNode != aNewNode); - newNodes[ ind++ ] = aNewNode; - } - if ( !isDuplicate ) - continue; - - if ( theIsDoubleElem ) - myLastCreatedElems.Append( AddElement(newNodes, anElem->GetType(), anElem->IsPoly()) ); - else - theMeshDS->ChangeElementNodes( anElem, &newNodes[ 0 ], anElem->NbNodes() ); - - res = true; - } - return res; -} - -/*! - \brief Check if element located inside shape - \return TRUE if IN or ON shape, FALSE otherwise -*/ - -static bool isInside(const SMDS_MeshElement* theElem, - BRepClass3d_SolidClassifier& theBsc3d, - const double theTol) -{ - gp_XYZ centerXYZ (0, 0, 0); - SMDS_ElemIteratorPtr aNodeItr = theElem->nodesIterator(); - while (aNodeItr->more()) - { - SMDS_MeshNode* aNode = (SMDS_MeshNode*)aNodeItr->next(); - centerXYZ += gp_XYZ(aNode->X(), aNode->Y(), aNode->Z()); - } - gp_Pnt aPnt(centerXYZ); - theBsc3d.Perform(aPnt, theTol); - TopAbs_State aState = theBsc3d.State(); - return (aState == TopAbs_IN || aState == TopAbs_ON ); -} - /*! \brief Creates a hole in a mesh by doubling the nodes of some particular elements \param theNodes - identifiers of nodes to be doubled @@ -8867,108 +7764,3 @@ bool SMESH_MeshEditor::DoubleNodes( const std::list< int >& theListOfNodes, return true; } - -/*! - \brief Creates a hole in a mesh by doubling the nodes of some particular elements - \param theElems - group of of elements (edges or faces) to be replicated - \param theNodesNot - group of nodes not to replicated - \param theShape - shape to detect affected elements (element which geometric center - located on or inside shape). - The replicated nodes should be associated to affected elements. - \return TRUE if operation has been completed successfully, FALSE otherwise -*/ - -bool SMESH_MeshEditor::DoubleNodesInRegion( const TIDSortedElemSet& theElems, - const TIDSortedElemSet& theNodesNot, - const TopoDS_Shape& theShape ) -{ - if ( theShape.IsNull() ) - return false; - - const double aTol = Precision::Confusion(); - BRepClass3d_SolidClassifier bsc3d(theShape); - bsc3d.PerformInfinitePoint(aTol); - - // iterates on indicated elements and get elements by back references from their nodes - TIDSortedElemSet anAffected; - TIDSortedElemSet::const_iterator elemItr = theElems.begin(); - for ( ; elemItr != theElems.end(); ++elemItr ) - { - SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr; - if (!anElem) - continue; - - SMDS_ElemIteratorPtr nodeItr = anElem->nodesIterator(); - while ( nodeItr->more() ) - { - const SMDS_MeshNode* aNode = static_cast(nodeItr->next()); - if ( !aNode || theNodesNot.find(aNode) != theNodesNot.end() ) - continue; - SMDS_ElemIteratorPtr backElemItr = aNode->GetInverseElementIterator(); - while ( backElemItr->more() ) - { - SMDS_MeshElement* curElem = (SMDS_MeshElement*)backElemItr->next(); - if ( curElem && theElems.find(curElem) == theElems.end() && - isInside( curElem, bsc3d, aTol ) ) - anAffected.insert( curElem ); - } - } - } - return DoubleNodes( theElems, theNodesNot, anAffected ); -} - -/*! - * \brief Generated skin mesh (containing 2D cells) from 3D mesh - * The created 2D mesh elements based on nodes of free faces of boundary volumes - * \return TRUE if operation has been completed successfully, FALSE otherwise - */ - -bool SMESH_MeshEditor::Make2DMeshFrom3D() -{ - // iterates on volume elements and detect all free faces on them - SMESHDS_Mesh* aMesh = GetMeshDS(); - if (!aMesh) - return false; - bool res = false; - SMDS_VolumeIteratorPtr vIt = aMesh->volumesIterator(); - while(vIt->more()) - { - const SMDS_MeshVolume* volume = vIt->next(); - SMDS_VolumeTool vTool( volume ); - const bool isPoly = volume->IsPoly(); - const bool isQuad = volume->IsQuadratic(); - for ( int iface = 0, n = vTool.NbFaces(); iface < n; iface++ ) - { - if (!vTool.IsFreeFace(iface)) - continue; - vector nodes; - int nbFaceNodes = vTool.NbFaceNodes(iface); - const SMDS_MeshNode** faceNodes = vTool.GetFaceNodes(iface); - if (vTool.IsFaceExternal(iface)) - { - int inode = 0; - for ( ; inode < nbFaceNodes; inode += isQuad ? 2 : 1) - nodes.push_back(faceNodes[inode]); - if (isQuad) - for ( inode = 1; inode < nbFaceNodes; inode += 2) - nodes.push_back(faceNodes[inode]); - } - else - { - int inode = nbFaceNodes-1; - for ( ; inode >=0; inode -= isQuad ? 2 : 1) - nodes.push_back(faceNodes[inode]); - if (isQuad) - for ( inode = nbFaceNodes-2; inode >=0; inode -= 2) - nodes.push_back(faceNodes[inode]); - } - - // add new face based on volume nodes - if (aMesh->FindFace( nodes ) ) - continue; // face already exsist - myLastCreatedElems.Append( AddElement(nodes, SMDSAbs_Face, isPoly && iface == 1) ); - res = true; - } - } - return res; -} diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MesherHelper.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MesherHelper.cpp index 92221826a7..dd0eabb696 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MesherHelper.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MesherHelper.cpp @@ -27,43 +27,29 @@ #include "SMDS_FacePosition.hxx" #include "SMDS_EdgePosition.hxx" -#include "SMDS_VolumeTool.hxx" -#include "SMESH_subMesh.hxx" #include #include -#include #include +#include #include -#include #include #include #include #include #include #include -#include #include #include -#include #include -#include #include #include #include -#include - #define RETURN_BAD_RESULT(msg) { MESSAGE(msg); return false; } -namespace { - - gp_XYZ XYZ(const SMDS_MeshNode* n) { return gp_XYZ(n->X(), n->Y(), n->Z()); } - -} - //================================================================================ /*! * \brief Constructor @@ -71,7 +57,7 @@ namespace { //================================================================================ SMESH_MesherHelper::SMESH_MesherHelper(SMESH_Mesh& theMesh) - : myMesh(&theMesh), myShapeID(0), myCreateQuadratic(false) + : myMesh(&theMesh), myShapeID(-1), myCreateQuadratic(false) { mySetElemOnShape = ( ! myMesh->HasShapeToMesh() ); } @@ -86,14 +72,14 @@ bool SMESH_MesherHelper::IsQuadraticSubMesh(const TopoDS_Shape& aSh) SMESHDS_Mesh* meshDS = GetMeshDS(); // we can create quadratic elements only if all elements // created on subshapes of given shape are quadratic - // also we have to fill myTLinkNodeMap + // also we have to fill myNLinkNodeMap myCreateQuadratic = true; mySeamShapeIds.clear(); myDegenShapeIds.clear(); TopAbs_ShapeEnum subType( aSh.ShapeType()==TopAbs_FACE ? TopAbs_EDGE : TopAbs_FACE ); SMDSAbs_ElementType elemType( subType==TopAbs_FACE ? SMDSAbs_Face : SMDSAbs_Edge ); - int nbOldLinks = myTLinkNodeMap.size(); + int nbOldLinks = myNLinkNodeMap.size(); TopExp_Explorer exp( aSh, subType ); for (; exp.More() && myCreateQuadratic; exp.Next()) { @@ -106,19 +92,19 @@ bool SMESH_MesherHelper::IsQuadraticSubMesh(const TopoDS_Shape& aSh) break; } else { - // fill TLinkNodeMap + // fill NLinkNodeMap switch ( e->NbNodes() ) { case 3: - AddTLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(2)); break; + AddNLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(2)); break; case 6: - AddTLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(3)); - AddTLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(4)); - AddTLinkNode(e->GetNode(2),e->GetNode(0),e->GetNode(5)); break; + AddNLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(3)); + AddNLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(4)); + AddNLinkNode(e->GetNode(2),e->GetNode(0),e->GetNode(5)); break; case 8: - AddTLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(4)); - AddTLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(5)); - AddTLinkNode(e->GetNode(2),e->GetNode(3),e->GetNode(6)); - AddTLinkNode(e->GetNode(3),e->GetNode(0),e->GetNode(7)); + AddNLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(4)); + AddNLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(5)); + AddNLinkNode(e->GetNode(2),e->GetNode(3),e->GetNode(6)); + AddNLinkNode(e->GetNode(3),e->GetNode(0),e->GetNode(7)); break; default: myCreateQuadratic = false; @@ -130,11 +116,11 @@ bool SMESH_MesherHelper::IsQuadraticSubMesh(const TopoDS_Shape& aSh) } } - if ( nbOldLinks == myTLinkNodeMap.size() ) + if ( nbOldLinks == myNLinkNodeMap.size() ) myCreateQuadratic = false; if(!myCreateQuadratic) { - myTLinkNodeMap.clear(); + myNLinkNodeMap.clear(); } SetSubShape( aSh ); @@ -175,7 +161,7 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh) myDegenShapeIds.clear(); if ( myShape.IsNull() ) { - myShapeID = 0; + myShapeID = -1; return; } SMESHDS_Mesh* meshDS = GetMeshDS(); @@ -244,8 +230,7 @@ bool SMESH_MesherHelper::GetNodeUVneedInFaceNode(const TopoDS_Face& F) const if ( !F.IsNull() && !myShape.IsNull() && myShape.IsSame( F )) return !mySeamShapeIds.empty(); - TopLoc_Location loc; - Handle(Geom_Surface) aSurface = BRep_Tool::Surface( F,loc ); + Handle(Geom_Surface) aSurface = BRep_Tool::Surface( F ); if ( !aSurface.IsNull() ) return ( aSurface->IsUPeriodic() || aSurface->IsVPeriodic() ); @@ -258,45 +243,26 @@ bool SMESH_MesherHelper::GetNodeUVneedInFaceNode(const TopoDS_Face& F) const //======================================================================= bool SMESH_MesherHelper::IsMedium(const SMDS_MeshNode* node, - const SMDSAbs_ElementType typeToCheck) + const SMDSAbs_ElementType typeToCheck) { return SMESH_MeshEditor::IsMedium( node, typeToCheck ); } //======================================================================= -/*! - * \brief Return support shape of a node - * \param node - the node - * \param meshDS - mesh DS - * \retval TopoDS_Shape - found support shape - */ -//======================================================================= - -TopoDS_Shape SMESH_MesherHelper::GetSubShapeByNode(const SMDS_MeshNode* node, - SMESHDS_Mesh* meshDS) -{ - int shapeID = node->GetPosition()->GetShapeId(); - if ( 0 < shapeID && shapeID <= meshDS->MaxShapeIndex() ) - return meshDS->IndexToShape( shapeID ); - else - return TopoDS_Shape(); -} - - -//======================================================================= -//function : AddTLinkNode +//function : AddNLinkNode //purpose : //======================================================================= /*! - * Auxilary function for filling myTLinkNodeMap + * Auxilary function for filling myNLinkNodeMap */ -void SMESH_MesherHelper::AddTLinkNode(const SMDS_MeshNode* n1, - const SMDS_MeshNode* n2, - const SMDS_MeshNode* n12) +void SMESH_MesherHelper::AddNLinkNode(const SMDS_MeshNode* n1, + const SMDS_MeshNode* n2, + const SMDS_MeshNode* n12) { + NLink link( n1, n2 ); + if ( n1 > n2 ) link = NLink( n2, n1 ); // add new record to map - SMESH_TLink link( n1, n2 ); - myTLinkNodeMap.insert( make_pair(link,n12)); + myNLinkNodeMap.insert( make_pair(link,n12)); } //======================================================================= @@ -326,94 +292,72 @@ gp_Pnt2d SMESH_MesherHelper::GetUVOnSeam( const gp_Pnt2d& uv1, const gp_Pnt2d& u * \param F - the face * \param n - the node * \param n2 - a node of element being created located inside a face - * \param check - optional flag returing false if found UV are invalid * \retval gp_XY - resulting UV + * + * Auxilary function called form GetMediumNode() */ //======================================================================= gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F, const SMDS_MeshNode* n, - const SMDS_MeshNode* n2, - bool* check) const + const SMDS_MeshNode* n2) const { gp_Pnt2d uv( 1e100, 1e100 ); const SMDS_PositionPtr Pos = n->GetPosition(); - bool uvOK = false; if(Pos->GetTypeOfPosition()==SMDS_TOP_FACE) { // node has position on face const SMDS_FacePosition* fpos = static_cast(n->GetPosition().get()); - uv.SetCoord(fpos->GetUParameter(),fpos->GetVParameter()); - uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( F )); + uv = gp_Pnt2d(fpos->GetUParameter(),fpos->GetVParameter()); } else if(Pos->GetTypeOfPosition()==SMDS_TOP_EDGE) { // node has position on edge => it is needed to find // corresponding edge from face, get pcurve for this - // edge and retrieve value from this pcurve + // edge and recieve value from this pcurve const SMDS_EdgePosition* epos = static_cast(n->GetPosition().get()); + SMESHDS_Mesh* meshDS = GetMeshDS(); int edgeID = Pos->GetShapeId(); - TopoDS_Edge E = TopoDS::Edge(GetMeshDS()->IndexToShape(edgeID)); - double f, l, u = epos->GetUParameter(); + TopoDS_Edge E = TopoDS::Edge(meshDS->IndexToShape(edgeID)); + double f, l; Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l); - if ( f < u && u < l ) - uv = C2d->Value( u ); - else - uv.SetCoord(0.,0.); - uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( E )); - + uv = C2d->Value( epos->GetUParameter() ); // for a node on a seam edge select one of UVs on 2 pcurves if ( n2 && IsSeamShape( edgeID ) ) - { uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 )); - } - else - { // adjust uv to period - TopLoc_Location loc; - Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc); - Standard_Boolean isUPeriodic = S->IsUPeriodic(); - Standard_Boolean isVPeriodic = S->IsVPeriodic(); - if ( isUPeriodic || isVPeriodic ) { - Standard_Real UF,UL,VF,VL; - S->Bounds(UF,UL,VF,VL); - if(isUPeriodic) - uv.SetX( uv.X() + ShapeAnalysis::AdjustToPeriod(uv.X(),UF,UL)); - if(isVPeriodic) - uv.SetY( uv.Y() + ShapeAnalysis::AdjustToPeriod(uv.Y(),VF,VL)); - } - } } else if(Pos->GetTypeOfPosition()==SMDS_TOP_VERTEX) { if ( int vertexID = n->GetPosition()->GetShapeId() ) { + bool ok = true; const TopoDS_Vertex& V = TopoDS::Vertex(GetMeshDS()->IndexToShape(vertexID)); try { uv = BRep_Tool::Parameters( V, F ); - uvOK = true; } catch (Standard_Failure& exc) { + ok = false; } - if ( !uvOK ) { - for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() ) - uvOK = ( V == vert.Current() ); - if ( !uvOK ) { + if ( !ok ) { + for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !ok && vert.More(); vert.Next() ) + ok = ( V == vert.Current() ); + if ( !ok ) { #ifdef _DEBUG_ MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID << " not in face " << GetMeshDS()->ShapeToIndex( F ) ); #endif // get UV of a vertex closest to the node double dist = 1e100; - gp_Pnt pn = XYZ( n ); - for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() ) { + gp_Pnt pn ( n->X(),n->Y(),n->Z() ); + for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !ok && vert.More(); vert.Next() ) { TopoDS_Vertex curV = TopoDS::Vertex( vert.Current() ); gp_Pnt p = BRep_Tool::Pnt( curV ); double curDist = p.SquareDistance( pn ); if ( curDist < dist ) { dist = curDist; uv = BRep_Tool::Parameters( curV, F ); - uvOK = ( dist < DBL_MIN ); + if ( dist < DBL_MIN ) break; } } } @@ -437,98 +381,9 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F, uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 )); } } - - if ( check ) - *check = uvOK; - return uv.XY(); } -//======================================================================= -/*! - * \brief Check and fix node UV on a face - * \retval bool - false if UV is bad and could not be fixed - */ -//======================================================================= - -bool SMESH_MesherHelper::CheckNodeUV(const TopoDS_Face& F, - const SMDS_MeshNode* n, - gp_XY& uv, - const double tol) const -{ - if ( !myOkNodePosShapes.count( n->GetPosition()->GetShapeId() )) - { - // check that uv is correct - TopLoc_Location loc; - Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc ); - gp_Pnt nodePnt = XYZ( n ); - if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() ); - if ( nodePnt.Distance( surface->Value( uv.X(), uv.Y() )) > tol ) - { - // uv incorrect, project the node to surface - GeomAPI_ProjectPointOnSurf projector( nodePnt, surface, tol ); - if ( !projector.IsDone() || projector.NbPoints() < 1 ) - { - MESSAGE( "SMESH_MesherHelper::CheckNodeUV() failed to project" ); - return false; - } - Quantity_Parameter U,V; - projector.LowerDistanceParameters(U,V); - if ( nodePnt.Distance( surface->Value( U, V )) > tol ) - { - MESSAGE( "SMESH_MesherHelper::CheckNodeUV(), invalid projection" ); - return false; - } - uv.SetCoord( U,V ); - } - else if ( uv.Modulus() > numeric_limits::min() ) - { - ((SMESH_MesherHelper*) this)->myOkNodePosShapes.insert( n->GetPosition()->GetShapeId() ); - } - } - return true; -} - -//======================================================================= -/*! - * \brief Return middle UV taking in account surface period - */ -//======================================================================= - -gp_XY SMESH_MesherHelper::GetMiddleUV(const Handle(Geom_Surface)& surface, - const gp_XY& p1, - const gp_XY& p2) -{ - if ( surface.IsNull() ) - return 0.5 * ( p1 + p2 ); - //checking if surface is periodic - Standard_Real UF,UL,VF,VL; - surface->Bounds(UF,UL,VF,VL); - - Standard_Real u,v; - Standard_Boolean isUPeriodic = surface->IsUPeriodic(); - if(isUPeriodic) { - Standard_Real UPeriod = surface->UPeriod(); - Standard_Real p2x = p2.X()+ShapeAnalysis::AdjustByPeriod(p2.X(),p1.X(),UPeriod); - Standard_Real pmid = (p1.X()+p2x)/2.; - u = pmid+ShapeAnalysis::AdjustToPeriod(pmid,UF,UL); - } - else { - u= (p1.X()+p2.X())/2.; - } - Standard_Boolean isVPeriodic = surface->IsVPeriodic(); - if(isVPeriodic) { - Standard_Real VPeriod = surface->VPeriod(); - Standard_Real p2y = p2.Y()+ShapeAnalysis::AdjustByPeriod(p2.Y(),p1.Y(),VPeriod); - Standard_Real pmid = (p1.Y()+p2y)/2.; - v = pmid+ShapeAnalysis::AdjustToPeriod(pmid,VF,VL); - } - else { - v = (p1.Y()+p2.Y())/2.; - } - return gp_XY( u,v ); -} - //======================================================================= /*! * \brief Return node U on edge @@ -541,8 +396,7 @@ gp_XY SMESH_MesherHelper::GetMiddleUV(const Handle(Geom_Surface)& surface, //======================================================================= double SMESH_MesherHelper::GetNodeU(const TopoDS_Edge& E, - const SMDS_MeshNode* n, - bool* check) + const SMDS_MeshNode* n) { double param = 0; const SMDS_PositionPtr Pos = n->GetPosition(); @@ -560,131 +414,152 @@ double SMESH_MesherHelper::GetNodeU(const TopoDS_Edge& E, return param; } -//================================================================================ +//======================================================================= +//function : GetMediumNode +//purpose : +//======================================================================= /*! - * \brief Return existing or create new medium nodes between given ones - * \param force3d - if true, new node is the middle of n1 and n2, - * else is located on geom face or geom edge + * Special function for search or creation medium node */ -//================================================================================ - const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2, bool force3d) { - SMESH_TLink link(n1,n2); - ItTLinkNode itLN = myTLinkNodeMap.find( link ); - if ( itLN != myTLinkNodeMap.end() ) { + TopAbs_ShapeEnum shapeType = myShape.IsNull() ? TopAbs_SHAPE : myShape.ShapeType(); + + NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 )); + ItNLinkNode itLN = myNLinkNodeMap.find( link ); + if ( itLN != myNLinkNodeMap.end() ) { return (*itLN).second; } - // create medium node - SMDS_MeshNode* n12; - SMESHDS_Mesh* meshDS = GetMeshDS(); - int faceID = -1, edgeID = -1; - const SMDS_PositionPtr Pos1 = n1->GetPosition(); - const SMDS_PositionPtr Pos2 = n2->GetPosition(); - - if( myShape.IsNull() ) - { - if( Pos1->GetTypeOfPosition()==SMDS_TOP_FACE ) { - faceID = Pos1->GetShapeId(); - } - else if( Pos2->GetTypeOfPosition()==SMDS_TOP_FACE ) { - faceID = Pos2->GetShapeId(); - } - - if( Pos1->GetTypeOfPosition()==SMDS_TOP_EDGE ) { - edgeID = Pos1->GetShapeId(); - } - if( Pos2->GetTypeOfPosition()==SMDS_TOP_EDGE ) { - edgeID = Pos2->GetShapeId(); - } - } - if(!force3d) - { - // we try to create medium node using UV parameters of - // nodes, else - medium between corresponding 3d points - - TopAbs_ShapeEnum shapeType = myShape.IsNull() ? TopAbs_SHAPE : myShape.ShapeType(); - if(faceID>0 || shapeType == TopAbs_FACE) { - // obtaining a face and 2d points for nodes - TopoDS_Face F; - if( myShape.IsNull() ) - F = TopoDS::Face(meshDS->IndexToShape(faceID)); - else { - F = TopoDS::Face(myShape); - faceID = myShapeID; + else { + // create medium node + SMDS_MeshNode* n12; + SMESHDS_Mesh* meshDS = GetMeshDS(); + int faceID = -1, edgeID = -1; + const SMDS_PositionPtr Pos1 = n1->GetPosition(); + const SMDS_PositionPtr Pos2 = n2->GetPosition(); + + if( myShape.IsNull() ) + { + if( Pos1->GetTypeOfPosition()==SMDS_TOP_FACE ) { + faceID = Pos1->GetShapeId(); } - bool uvOK1, uvOK2; - gp_XY p1 = GetNodeUV(F,n1,n2, &uvOK1); - gp_XY p2 = GetNodeUV(F,n2,n1, &uvOK2); - - if ( uvOK1 && uvOK2 ) - { - if ( IsDegenShape( Pos1->GetShapeId() )) - p1.SetCoord( myParIndex, p2.Coord( myParIndex )); - else if ( IsDegenShape( Pos2->GetShapeId() )) - p2.SetCoord( myParIndex, p1.Coord( myParIndex )); - - TopLoc_Location loc; - Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc); - gp_XY uv = GetMiddleUV( S, p1, p2 ); - gp_Pnt P = S->Value( uv.X(), uv.Y() ).Transformed(loc); - n12 = meshDS->AddNode(P.X(), P.Y(), P.Z()); - meshDS->SetNodeOnFace(n12, faceID, uv.X(), uv.Y()); - myTLinkNodeMap.insert(make_pair(link,n12)); - return n12; - } - } - if (edgeID>0 || shapeType == TopAbs_EDGE) { - - TopoDS_Edge E; - if( myShape.IsNull() ) - E = TopoDS::Edge(meshDS->IndexToShape(edgeID)); - else { - E = TopoDS::Edge(myShape); - edgeID = myShapeID; + else if( Pos2->GetTypeOfPosition()==SMDS_TOP_FACE ) { + faceID = Pos2->GetShapeId(); } - double p1 = GetNodeU(E,n1); - double p2 = GetNodeU(E,n2); + if( Pos1->GetTypeOfPosition()==SMDS_TOP_EDGE ) { + edgeID = Pos1->GetShapeId(); + } + if( Pos2->GetTypeOfPosition()==SMDS_TOP_EDGE ) { + edgeID = Pos2->GetShapeId(); + } + } - double f,l; - Handle(Geom_Curve) C = BRep_Tool::Curve(E, f, l); - if(!C.IsNull()) { - - Standard_Boolean isPeriodic = C->IsPeriodic(); - double u; - if(isPeriodic) { - Standard_Real Period = C->Period(); - Standard_Real p = p2+ShapeAnalysis::AdjustByPeriod(p2,p1,Period); - Standard_Real pmid = (p1+p)/2.; - u = pmid+ShapeAnalysis::AdjustToPeriod(pmid,C->FirstParameter(),C->LastParameter()); + if(!force3d) { + // we try to create medium node using UV parameters of + // nodes, else - medium between corresponding 3d points + if(faceID>-1 || shapeType == TopAbs_FACE) { + // obtaining a face and 2d points for nodes + TopoDS_Face F; + if( myShape.IsNull() ) + F = TopoDS::Face(meshDS->IndexToShape(faceID)); + else { + F = TopoDS::Face(myShape); + faceID = myShapeID; } - else - u = (p1+p2)/2.; - gp_Pnt P = C->Value( u ); + gp_XY p1 = GetNodeUV(F,n1,n2); + gp_XY p2 = GetNodeUV(F,n2,n1); + + if ( IsDegenShape( Pos1->GetShapeId() )) + p1.SetCoord( myParIndex, p2.Coord( myParIndex )); + else if ( IsDegenShape( Pos2->GetShapeId() )) + p2.SetCoord( myParIndex, p1.Coord( myParIndex )); + + //checking if surface is periodic + Handle(Geom_Surface) S = BRep_Tool::Surface(F); + Standard_Real UF,UL,VF,VL; + S->Bounds(UF,UL,VF,VL); + + Standard_Real u,v; + Standard_Boolean isUPeriodic = S->IsUPeriodic(); + if(isUPeriodic) { + Standard_Real UPeriod = S->UPeriod(); + Standard_Real p2x = p2.X()+ShapeAnalysis::AdjustByPeriod(p2.X(),p1.X(),UPeriod); + Standard_Real pmid = (p1.X()+p2x)/2.; + u = pmid+ShapeAnalysis::AdjustToPeriod(pmid,UF,UL); + } + else + u= (p1.X()+p2.X())/2.; + + Standard_Boolean isVPeriodic = S->IsVPeriodic(); + if(isVPeriodic) { + Standard_Real VPeriod = S->VPeriod(); + Standard_Real p2y = p2.Y()+ShapeAnalysis::AdjustByPeriod(p2.Y(),p1.Y(),VPeriod); + Standard_Real pmid = (p1.Y()+p2y)/2.; + v = pmid+ShapeAnalysis::AdjustToPeriod(pmid,VF,VL); + } + else + v = (p1.Y()+p2.Y())/2.; + + gp_Pnt P = S->Value(u, v); n12 = meshDS->AddNode(P.X(), P.Y(), P.Z()); - meshDS->SetNodeOnEdge(n12, edgeID, u); - myTLinkNodeMap.insert(make_pair(link,n12)); + meshDS->SetNodeOnFace(n12, faceID, u, v); + myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12)); return n12; } + if (edgeID>-1 || shapeType == TopAbs_EDGE) { + + TopoDS_Edge E; + if( myShape.IsNull() ) + E = TopoDS::Edge(meshDS->IndexToShape(edgeID)); + else { + E = TopoDS::Edge(myShape); + edgeID = myShapeID; + } + + double p1 = GetNodeU(E,n1); + double p2 = GetNodeU(E,n2); + + double f,l; + Handle(Geom_Curve) C = BRep_Tool::Curve(E, f, l); + if(!C.IsNull()) { + + Standard_Boolean isPeriodic = C->IsPeriodic(); + double u; + if(isPeriodic) { + Standard_Real Period = C->Period(); + Standard_Real p = p2+ShapeAnalysis::AdjustByPeriod(p2,p1,Period); + Standard_Real pmid = (p1+p)/2.; + u = pmid+ShapeAnalysis::AdjustToPeriod(pmid,C->FirstParameter(),C->LastParameter()); + } + else + u = (p1+p2)/2.; + + gp_Pnt P = C->Value( u ); + n12 = meshDS->AddNode(P.X(), P.Y(), P.Z()); + meshDS->SetNodeOnEdge(n12, edgeID, u); + myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12)); + return n12; + } + } } + // 3d variant + double x = ( n1->X() + n2->X() )/2.; + double y = ( n1->Y() + n2->Y() )/2.; + double z = ( n1->Z() + n2->Z() )/2.; + n12 = meshDS->AddNode(x,y,z); + if(edgeID>-1) + meshDS->SetNodeOnEdge(n12, edgeID); + else if(faceID>-1) + meshDS->SetNodeOnFace(n12, faceID); + else + meshDS->SetNodeInVolume(n12, myShapeID); + myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12)); + return n12; } - // 3d variant - double x = ( n1->X() + n2->X() )/2.; - double y = ( n1->Y() + n2->Y() )/2.; - double z = ( n1->Z() + n2->Z() )/2.; - n12 = meshDS->AddNode(x,y,z); - if(edgeID>0) - meshDS->SetNodeOnEdge(n12, edgeID); - else if(faceID>0) - meshDS->SetNodeOnFace(n12, faceID); - else - meshDS->SetNodeInVolume(n12, myShapeID); - myTLinkNodeMap.insert( make_pair( link, n12 )); - return n12; } //======================================================================= @@ -758,14 +633,10 @@ SMDS_MeshFace* SMESH_MesherHelper::AddFace(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2, const SMDS_MeshNode* n3, const int id, - const bool force3d) + const bool force3d) { SMESHDS_Mesh * meshDS = GetMeshDS(); SMDS_MeshFace* elem = 0; - - if( n1==n2 || n2==n3 || n3==n1 ) - return elem; - if(!myCreateQuadratic) { if(id) elem = meshDS->AddFaceWithID(n1, n2, n3, id); @@ -799,30 +670,10 @@ SMDS_MeshFace* SMESH_MesherHelper::AddFace(const SMDS_MeshNode* n1, const SMDS_MeshNode* n3, const SMDS_MeshNode* n4, const int id, - const bool force3d) + const bool force3d) { SMESHDS_Mesh * meshDS = GetMeshDS(); SMDS_MeshFace* elem = 0; - - if( n1==n2 ) { - return AddFace(n1,n3,n4,id,force3d); - } - if( n1==n3 ) { - return AddFace(n1,n2,n4,id,force3d); - } - if( n1==n4 ) { - return AddFace(n1,n2,n3,id,force3d); - } - if( n2==n3 ) { - return AddFace(n1,n2,n4,id,force3d); - } - if( n2==n4 ) { - return AddFace(n1,n2,n3,id,force3d); - } - if( n3==n4 ) { - return AddFace(n1,n2,n3,id,force3d); - } - if(!myCreateQuadratic) { if(id) elem = meshDS->AddFaceWithID(n1, n2, n3, n4, id); @@ -859,7 +710,7 @@ SMDS_MeshVolume* SMESH_MesherHelper::AddVolume(const SMDS_MeshNode* n1, const SMDS_MeshNode* n5, const SMDS_MeshNode* n6, const int id, - const bool force3d) + const bool force3d) { SMESHDS_Mesh * meshDS = GetMeshDS(); SMDS_MeshVolume* elem = 0; @@ -906,7 +757,7 @@ SMDS_MeshVolume* SMESH_MesherHelper::AddVolume(const SMDS_MeshNode* n1, const SMDS_MeshNode* n3, const SMDS_MeshNode* n4, const int id, - const bool force3d) + const bool force3d) { SMESHDS_Mesh * meshDS = GetMeshDS(); SMDS_MeshVolume* elem = 0; @@ -948,7 +799,7 @@ SMDS_MeshVolume* SMESH_MesherHelper::AddVolume(const SMDS_MeshNode* n1, const SMDS_MeshNode* n4, const SMDS_MeshNode* n5, const int id, - const bool force3d) + const bool force3d) { SMDS_MeshVolume* elem = 0; if(!myCreateQuadratic) { @@ -999,7 +850,7 @@ SMDS_MeshVolume* SMESH_MesherHelper::AddVolume(const SMDS_MeshNode* n1, const SMDS_MeshNode* n7, const SMDS_MeshNode* n8, const int id, - const bool force3d) + const bool force3d) { SMESHDS_Mesh * meshDS = GetMeshDS(); SMDS_MeshVolume* elem = 0; @@ -1366,1200 +1217,3 @@ double SMESH_MesherHelper::GetOtherParam(const double param) const { return fabs(param-myPar1) < fabs(param-myPar2) ? myPar2 : myPar1; } - -//======================================================================= -namespace { // Structures used by FixQuadraticElements() -//======================================================================= - -#define __DMP__(txt) \ -//cout << txt -#define MSG(txt) __DMP__(txt< _faces; - mutable gp_Vec _nodeMove; - mutable int _nbMoves; - - QLink(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2, const SMDS_MeshNode* nm): - SMESH_TLink( n1,n2 ), _mediumNode(nm), _nodeMove(0,0,0), _nbMoves(0) { - _faces.reserve(4); - //if ( MediumPos() != SMDS_TOP_3DSPACE ) - _nodeMove = MediumPnt() - MiddlePnt(); - } - void SetContinuesFaces() const; - const QFace* GetContinuesFace( const QFace* face ) const; - bool OnBoundary() const; - gp_XYZ MiddlePnt() const { return ( XYZ( node1() ) + XYZ( node2() )) / 2.; } - gp_XYZ MediumPnt() const { return XYZ( _mediumNode ); } - - SMDS_TypeOfPosition MediumPos() const - { return _mediumNode->GetPosition()->GetTypeOfPosition(); } - SMDS_TypeOfPosition EndPos(bool isSecond) const - { return (isSecond ? node2() : node1())->GetPosition()->GetTypeOfPosition(); } - const SMDS_MeshNode* EndPosNode(SMDS_TypeOfPosition pos) const - { return EndPos(0) == pos ? node1() : EndPos(1) == pos ? node2() : 0; } - - void Move(const gp_Vec& move, bool sum=false) const - { _nodeMove += move; _nbMoves += sum ? (_nbMoves==0) : 1; } - gp_XYZ Move() const { return _nodeMove.XYZ() / _nbMoves; } - bool IsMoved() const { return (_nbMoves > 0 && !IsStraight()); } - bool IsStraight() const { return _nodeMove.SquareMagnitude() <= straightTol2; } - - bool operator<(const QLink& other) const { - return (node1()->GetID() == other.node1()->GetID() ? - node2()->GetID() < other.node2()->GetID() : - node1()->GetID() < other.node1()->GetID()); - } - struct PtrComparator { - bool operator() (const QLink* l1, const QLink* l2 ) const { return *l1 < *l2; } - }; - }; - // --------------------------------------------------------- - /*! - * \brief Link in the chain of links; it connects two faces - */ - struct TChainLink - { - const QLink* _qlink; - mutable const QFace* _qfaces[2]; - - TChainLink(const QLink* qlink=0):_qlink(qlink) { - _qfaces[0] = _qfaces[1] = 0; - } - void SetFace(const QFace* face) { int iF = _qfaces[0] ? 1 : 0; _qfaces[iF]=face; } - - bool IsBoundary() const { return !_qfaces[1]; } - - void RemoveFace( const QFace* face ) const - { _qfaces[(face == _qfaces[1])] = 0; if (!_qfaces[0]) std::swap(_qfaces[0],_qfaces[1]); } - - const QFace* NextFace( const QFace* f ) const - { return _qfaces[0]==f ? _qfaces[1] : _qfaces[0]; } - - const SMDS_MeshNode* NextNode( const SMDS_MeshNode* n ) const - { return n == _qlink->node1() ? _qlink->node2() : _qlink->node1(); } - - bool operator<(const TChainLink& other) const { return *_qlink < *other._qlink; } - - operator bool() const { return (_qlink); } - - const QLink* operator->() const { return _qlink; } - - gp_Vec Normal() const; - }; - // -------------------------------------------------------------------- - typedef list< TChainLink > TChain; - typedef set < TChainLink > TLinkSet; - typedef TLinkSet::const_iterator TLinkInSet; - - const int theFirstStep = 5; - - enum { ERR_OK, ERR_TRI, ERR_PRISM, ERR_UNKNOWN }; // errors of QFace::GetLinkChain() - // -------------------------------------------------------------------- - /*! - * \brief Face shared by two volumes and bound by QLinks - */ - struct QFace: public TIDSortedElemSet - { - mutable const SMDS_MeshElement* _volumes[2]; - mutable vector< const QLink* > _sides; - mutable bool _sideIsAdded[4]; // added in chain of links - gp_Vec _normal; - - QFace( const vector< const QLink*>& links ); - - void SetVolume(const SMDS_MeshElement* v) const { _volumes[ _volumes[0] ? 1 : 0 ] = v; } - - int NbVolumes() const { return !_volumes[0] ? 0 : !_volumes[1] ? 1 : 2; } - - void AddSelfToLinks() const { - for ( int i = 0; i < _sides.size(); ++i ) - _sides[i]->_faces.push_back( this ); - } - int LinkIndex( const QLink* side ) const { - for (int i=0; i<_sides.size(); ++i ) if ( _sides[i] == side ) return i; - return -1; - } - bool GetLinkChain( int iSide, TChain& chain, SMDS_TypeOfPosition pos, int& error) const; - - bool GetLinkChain( TChainLink& link, TChain& chain, SMDS_TypeOfPosition pos, int& error) const - { - int i = LinkIndex( link._qlink ); - if ( i < 0 ) return true; - _sideIsAdded[i] = true; - link.SetFace( this ); - // continue from opposite link - return GetLinkChain( (i+2)%_sides.size(), chain, pos, error ); - } - bool IsBoundary() const { return !_volumes[1]; } - - bool Contains( const SMDS_MeshNode* node ) const { return count(node); } - - TLinkInSet GetBoundaryLink( const TLinkSet& links, - const TChainLink& avoidLink, - TLinkInSet * notBoundaryLink = 0, - const SMDS_MeshNode* nodeToContain = 0, - bool * isAdjacentUsed = 0) const; - - TLinkInSet GetLinkByNode( const TLinkSet& links, - const TChainLink& avoidLink, - const SMDS_MeshNode* nodeToContain) const; - - const SMDS_MeshNode* GetNodeInFace() const { - for ( int iL = 0; iL < _sides.size(); ++iL ) - if ( _sides[iL]->MediumPos() == SMDS_TOP_FACE ) return _sides[iL]->_mediumNode; - return 0; - } - - gp_Vec LinkNorm(const int i, SMESH_MesherHelper* theFaceHelper=0) const; - - double MoveByBoundary( const TChainLink& theLink, - const gp_Vec& theRefVec, - const TLinkSet& theLinks, - SMESH_MesherHelper* theFaceHelper=0, - const double thePrevLen=0, - const int theStep=theFirstStep, - gp_Vec* theLinkNorm=0, - double theSign=1.0) const; - }; - - //================================================================================ - /*! - * \brief Dump QLink and QFace - */ - ostream& operator << (ostream& out, const QLink& l) - { - out <<"QLink nodes: " - << l.node1()->GetID() << " - " - << l._mediumNode->GetID() << " - " - << l.node2()->GetID() << endl; - return out; - } - ostream& operator << (ostream& out, const QFace& f) - { - out <<"QFace nodes: "/*<< &f << " "*/; - for ( TIDSortedElemSet::const_iterator n = f.begin(); n != f.end(); ++n ) - out << (*n)->GetID() << " "; - out << " \tvolumes: " - << (f._volumes[0] ? f._volumes[0]->GetID() : 0) << " " - << (f._volumes[1] ? f._volumes[1]->GetID() : 0); - out << " \tNormal: "<< f._normal.X() <<", "<& links ) - { - _volumes[0] = _volumes[1] = 0; - _sides = links; - _sideIsAdded[0]=_sideIsAdded[1]=_sideIsAdded[2]=_sideIsAdded[3]=false; - _normal.SetCoord(0,0,0); - for ( int i = 1; i < _sides.size(); ++i ) { - const QLink *l1 = _sides[i-1], *l2 = _sides[i]; - insert( l1->node1() ); insert( l1->node2() ); - // compute normal - gp_Vec v1( XYZ( l1->node2()), XYZ( l1->node1())); - gp_Vec v2( XYZ( l2->node1()), XYZ( l2->node2())); - if ( l1->node1() != l2->node1() && l1->node2() != l2->node2() ) - v1.Reverse(); - _normal += v1 ^ v2; - } - double normSqSize = _normal.SquareMagnitude(); - if ( normSqSize > numeric_limits::min() ) - _normal /= sqrt( normSqSize ); - else - _normal.SetCoord(1e-33,0,0); - } - //================================================================================ - /*! - * \brief Make up chain of links - * \param iSide - link to add first - * \param chain - chain to fill in - * \param pos - postion of medium nodes the links should have - * \param error - out, specifies what is wrong - * \retval bool - false if valid chain can't be built; "valid" means that links - * of the chain belongs to rectangles bounding hexahedrons - */ - //================================================================================ - - bool QFace::GetLinkChain( int iSide, TChain& chain, SMDS_TypeOfPosition pos, int& error) const - { - if ( iSide >= _sides.size() ) // wrong argument iSide - return false; - if ( _sideIsAdded[ iSide ]) // already in chain - return true; - - if ( _sides.size() != 4 ) { // triangle - visit all my continous faces - MSGBEG( *this ); - for ( int i = 0; i < _sides.size(); ++i ) { - if ( !_sideIsAdded[i] && _sides[i] ) { - _sideIsAdded[i]=true; - TChain::iterator chLink = chain.insert( chain.begin(), TChainLink(_sides[i])); - chLink->SetFace( this ); - if ( _sides[i]->MediumPos() >= pos ) - if ( const QFace* f = _sides[i]->GetContinuesFace( this )) - f->GetLinkChain( *chLink, chain, pos, error ); - } - } - if ( error < ERR_TRI ) - error = ERR_TRI; - return false; - } - _sideIsAdded[iSide] = true; // not to add this link to chain again - const QLink* link = _sides[iSide]; - if ( !link) - return true; - - // add link into chain - TChain::iterator chLink = chain.insert( chain.begin(), TChainLink(link)); - chLink->SetFace( this ); - MSGBEG( *this ); - - // propagate from rectangle to neighbour faces - if ( link->MediumPos() >= pos ) { - int nbLinkFaces = link->_faces.size(); - if ( nbLinkFaces == 4 || nbLinkFaces < 4 && link->OnBoundary()) { - // hexahedral mesh or boundary quadrangles - goto a continous face - if ( const QFace* f = link->GetContinuesFace( this )) - return f->GetLinkChain( *chLink, chain, pos, error ); - } - else { - TChainLink chLink(link); // side face of prismatic mesh - visit all faces of iSide - for ( int i = 0; i < nbLinkFaces; ++i ) - if ( link->_faces[i] ) - link->_faces[i]->GetLinkChain( chLink, chain, pos, error ); - if ( error < ERR_PRISM ) - error = ERR_PRISM; - return false; - } - } - return true; - } - - //================================================================================ - /*! - * \brief Return a boundary link of the triangle face - * \param links - set of all links - * \param avoidLink - link not to return - * \param notBoundaryLink - out, neither the returned link nor avoidLink - * \param nodeToContain - node the returned link must contain; if provided, search - * also performed on adjacent faces - * \param isAdjacentUsed - returns true if link is found in adjacent faces - */ - //================================================================================ - - TLinkInSet QFace::GetBoundaryLink( const TLinkSet& links, - const TChainLink& avoidLink, - TLinkInSet * notBoundaryLink, - const SMDS_MeshNode* nodeToContain, - bool * isAdjacentUsed) const - { - TLinkInSet linksEnd = links.end(), boundaryLink = linksEnd; - - typedef list< pair< const QFace*, TLinkInSet > > TFaceLinkList; - TFaceLinkList adjacentFaces; - - for ( int iL = 0; iL < _sides.size(); ++iL ) - { - if ( avoidLink._qlink == _sides[iL] ) - continue; - TLinkInSet link = links.find( _sides[iL] ); - if ( link == linksEnd ) continue; - - // check link - if ( link->IsBoundary() ) { - if ( !nodeToContain || - (*link)->node1() == nodeToContain || - (*link)->node2() == nodeToContain ) - { - boundaryLink = link; - if ( !notBoundaryLink ) break; - } - } - else if ( notBoundaryLink ) { - *notBoundaryLink = link; - if ( boundaryLink != linksEnd ) break; - } - - if ( boundaryLink == linksEnd && nodeToContain ) // cellect adjacent faces - if ( const QFace* adj = link->NextFace( this )) - if ( adj->Contains( nodeToContain )) - adjacentFaces.push_back( make_pair( adj, link )); - } - - if ( isAdjacentUsed ) *isAdjacentUsed = false; - if ( boundaryLink == linksEnd && nodeToContain ) // check adjacent faces - { - TFaceLinkList::iterator adj = adjacentFaces.begin(); - for ( ; boundaryLink == linksEnd && adj != adjacentFaces.end(); ++adj ) - boundaryLink = adj->first->GetBoundaryLink( links, *(adj->second), - 0, nodeToContain, isAdjacentUsed); - if ( isAdjacentUsed ) *isAdjacentUsed = true; - } - return boundaryLink; - } - //================================================================================ - /*! - * \brief Return a link ending at the given node but not avoidLink - */ - //================================================================================ - - TLinkInSet QFace::GetLinkByNode( const TLinkSet& links, - const TChainLink& avoidLink, - const SMDS_MeshNode* nodeToContain) const - { - for ( int i = 0; i < _sides.size(); ++i ) - if ( avoidLink._qlink != _sides[i] && - (_sides[i]->node1() == nodeToContain || _sides[i]->node2() == nodeToContain )) - return links.find( _sides[ i ]); - return links.end(); - } - - //================================================================================ - /*! - * \brief Return normal to the i-th side pointing outside the face - */ - //================================================================================ - - gp_Vec QFace::LinkNorm(const int i, SMESH_MesherHelper* /*uvHelper*/) const - { - gp_Vec norm, vecOut; -// if ( uvHelper ) { -// TopoDS_Face face = TopoDS::Face( uvHelper->GetSubShape()); -// const SMDS_MeshNode* inFaceNode = uvHelper->GetNodeUVneedInFaceNode() ? GetNodeInFace() : 0; -// gp_XY uv1 = uvHelper->GetNodeUV( face, _sides[i]->node1(), inFaceNode ); -// gp_XY uv2 = uvHelper->GetNodeUV( face, _sides[i]->node2(), inFaceNode ); -// norm.SetCoord( uv1.Y() - uv2.Y(), uv2.X() - uv1.X(), 0 ); - -// const QLink* otherLink = _sides[(i + 1) % _sides.size()]; -// const SMDS_MeshNode* otherNode = -// otherLink->node1() == _sides[i]->node1() ? otherLink->node2() : otherLink->node1(); -// gp_XY pIn = uvHelper->GetNodeUV( face, otherNode, inFaceNode ); -// vecOut.SetCoord( uv1.X() - pIn.X(), uv1.Y() - pIn.Y(), 0 ); -// } -// else { - norm = _normal ^ gp_Vec( XYZ(_sides[i]->node1()), XYZ(_sides[i]->node2())); - gp_XYZ pIn = ( XYZ( _sides[0]->node1() ) + - XYZ( _sides[0]->node2() ) + - XYZ( _sides[1]->node1() )) / 3.; - vecOut.SetXYZ( _sides[i]->MiddlePnt() - pIn ); - //} - if ( norm * vecOut < 0 ) - norm.Reverse(); - double mag2 = norm.SquareMagnitude(); - if ( mag2 > numeric_limits::min() ) - norm /= sqrt( mag2 ); - return norm; - } - //================================================================================ - /*! - * \brief Move medium node of theLink according to its distance from boundary - * \param theLink - link to fix - * \param theRefVec - movement of boundary - * \param theLinks - all adjacent links of continous triangles - * \param theFaceHelper - helper is not used so far - * \param thePrevLen - distance from the boundary - * \param theStep - number of steps till movement propagation limit - * \param theLinkNorm - out normal to theLink - * \param theSign - 1 or -1 depending on movement of boundary - * \retval double - distance from boundary to propagation limit or other boundary - */ - //================================================================================ - - double QFace::MoveByBoundary( const TChainLink& theLink, - const gp_Vec& theRefVec, - const TLinkSet& theLinks, - SMESH_MesherHelper* theFaceHelper, - const double thePrevLen, - const int theStep, - gp_Vec* theLinkNorm, - double theSign) const - { - if ( !theStep ) - return thePrevLen; // propagation limit reached - - int iL; // index of theLink - for ( iL = 0; iL < _sides.size(); ++iL ) - if ( theLink._qlink == _sides[ iL ]) - break; - - MSG(string(theStep,'.')<<" Ref( "<NextFace( this ); // adjacent faces - const QFace* f2 = link2->NextFace( this ); - - // propagate to adjacent faces till limit step or boundary - double len1 = thePrevLen + (theLink->MiddlePnt() - _sides[iL1]->MiddlePnt()).Modulus(); - double len2 = thePrevLen + (theLink->MiddlePnt() - _sides[iL2]->MiddlePnt()).Modulus(); - gp_Vec linkDir1, linkDir2; - try { - OCC_CATCH_SIGNALS; - if ( f1 ) - len1 = f1->MoveByBoundary - ( *link1, theRefVec, theLinks, theFaceHelper, len1, theStep-1, &linkDir1, theSign); - else - linkDir1 = LinkNorm( iL1/*, theFaceHelper*/ ); - } catch (...) { - MSG( " --------------- EXCEPTION"); - return thePrevLen; - } - try { - OCC_CATCH_SIGNALS; - if ( f2 ) - len2 = f2->MoveByBoundary - ( *link2, theRefVec, theLinks, theFaceHelper, len2, theStep-1, &linkDir2, theSign); - else - linkDir2 = LinkNorm( iL2/*, theFaceHelper*/ ); - } catch (...) { - MSG( " --------------- EXCEPTION"); - return thePrevLen; - } - - double fullLen = 0; - if ( theStep != theFirstStep ) - { - // choose chain length by direction of propagation most codirected with theRefVec - bool choose1 = ( theRefVec * linkDir1 * theSign > theRefVec * linkDir2 * theSign ); - fullLen = choose1 ? len1 : len2; - double r = thePrevLen / fullLen; - - gp_Vec move = linkNorm * refProj * ( 1 - r ); - theLink->Move( move, true ); - - MSG(string(theStep,'.')<<" Move "<< theLink->_mediumNode->GetID()<< - " by " << refProj * ( 1 - r ) << " following " << - (choose1 ? *link1->_qlink : *link2->_qlink)); - - if ( theLinkNorm ) *theLinkNorm = linkNorm; - } - return fullLen; - } - - //================================================================================ - /*! - * \brief Find pairs of continues faces - */ - //================================================================================ - - void QLink::SetContinuesFaces() const - { - // x0 x - QLink, [-|] - QFace, v - volume - // v0 | v1 - // | Between _faces of link x2 two vertical faces are continues - // x1----x2-----x3 and two horizontal faces are continues. We set vertical faces - // | to _faces[0] and _faces[1] and horizontal faces to - // v2 | v3 _faces[2] and _faces[3] (or vise versa). - // x4 - - if ( _faces.empty() ) - return; - int iFaceCont = -1; - for ( int iF = 1; iFaceCont < 0 && iF < _faces.size(); ++iF ) - { - // look for a face bounding none of volumes bound by _faces[0] - bool sameVol = false; - int nbVol = _faces[iF]->NbVolumes(); - for ( int iV = 0; !sameVol && iV < nbVol; ++iV ) - sameVol = ( _faces[iF]->_volumes[iV] == _faces[0]->_volumes[0] || - _faces[iF]->_volumes[iV] == _faces[0]->_volumes[1]); - if ( !sameVol ) - iFaceCont = iF; - } - if ( iFaceCont > 0 ) // continues faces found, set one by the other - { - if ( iFaceCont != 1 ) - std::swap( _faces[1], _faces[iFaceCont] ); - } - else if ( _faces.size() > 1 ) // not found, set NULL by the first face - { - _faces.insert( ++_faces.begin(), 0 ); - } - } - //================================================================================ - /*! - * \brief Return a face continues to the given one - */ - //================================================================================ - - const QFace* QLink::GetContinuesFace( const QFace* face ) const - { - for ( int i = 0; i < _faces.size(); ++i ) { - if ( _faces[i] == face ) { - int iF = i < 2 ? 1-i : 5-i; - return iF < _faces.size() ? _faces[iF] : 0; - } - } - return 0; - } - //================================================================================ - /*! - * \brief True if link is on mesh boundary - */ - //================================================================================ - - bool QLink::OnBoundary() const - { - for ( int i = 0; i < _faces.size(); ++i ) - if (_faces[i] && _faces[i]->IsBoundary()) return true; - return false; - } - //================================================================================ - /*! - * \brief Return normal of link of the chain - */ - //================================================================================ - - gp_Vec TChainLink::Normal() const { - gp_Vec norm; - if (_qfaces[0]) norm = _qfaces[0]->_normal; - if (_qfaces[1]) norm += _qfaces[1]->_normal; - return norm; - } - //================================================================================ - /*! - * \brief Move medium nodes of vertical links of pentahedrons adjacent by side faces - */ - //================================================================================ - - void fixPrism( TChain& allLinks ) - { - // separate boundary links from internal ones - typedef set QLinkSet; - QLinkSet interLinks, bndLinks1, bndLink2; - - bool isCurved = false; - for ( TChain::iterator lnk = allLinks.begin(); lnk != allLinks.end(); ++lnk ) { - if ( (*lnk)->OnBoundary() ) - bndLinks1.insert( lnk->_qlink ); - else - interLinks.insert( lnk->_qlink ); - isCurved = isCurved || !(*lnk)->IsStraight(); - } - if ( !isCurved ) - return; // no need to move - - QLinkSet *curBndLinks = &bndLinks1, *newBndLinks = &bndLink2; - - while ( !interLinks.empty() && !curBndLinks->empty() ) - { - // propagate movement from boundary links to connected internal links - QLinkSet::iterator bnd = curBndLinks->begin(), bndEnd = curBndLinks->end(); - for ( ; bnd != bndEnd; ++bnd ) - { - const QLink* bndLink = *bnd; - for ( int i = 0; i < bndLink->_faces.size(); ++i ) // loop on faces of bndLink - { - const QFace* face = bndLink->_faces[i]; // quadrange lateral face of a prism - if ( !face ) continue; - // find and move internal link opposite to bndLink within the face - int interInd = ( face->LinkIndex( bndLink ) + 2 ) % face->_sides.size(); - const QLink* interLink = face->_sides[ interInd ]; - QLinkSet::iterator pInterLink = interLinks.find( interLink ); - if ( pInterLink == interLinks.end() ) continue; // not internal link - interLink->Move( bndLink->_nodeMove ); - // treated internal links become new boundary ones - interLinks. erase( pInterLink ); - newBndLinks->insert( interLink ); - } - } - curBndLinks->clear(); - std::swap( curBndLinks, newBndLinks ); - } - } - - //================================================================================ - /*! - * \brief Fix links of continues triangles near curved boundary - */ - //================================================================================ - - void fixTriaNearBoundary( TChain & allLinks, SMESH_MesherHelper& /*helper*/) - { - if ( allLinks.empty() ) return; - - TLinkSet linkSet( allLinks.begin(), allLinks.end()); - TLinkInSet linkIt = linkSet.begin(), linksEnd = linkSet.end(); - - // move in 2d if we are on geom face -// TopoDS_Face face; -// TopLoc_Location loc; -// SMESH_MesherHelper faceHelper( *helper.GetMesh()); -// while ( linkIt->IsBoundary()) ++linkIt; -// if ( linkIt == linksEnd ) return; -// if ( (*linkIt)->MediumPos() == SMDS_TOP_FACE ) { -// bool checkPos = true; -// TopoDS_Shape f = helper.GetSubShapeByNode( (*linkIt)->_mediumNode, helper.GetMeshDS() ); -// if ( !f.IsNull() && f.ShapeType() == TopAbs_FACE ) { -// face = TopoDS::Face( f ); -// helper.GetNodeUV( face, (*linkIt)->_mediumNode, 0, &checkPos); -// if (checkPos) -// face.Nullify(); -// else -// faceHelper.SetSubShape( face ); -// } -// } - for ( linkIt = linkSet.begin(); linkIt != linksEnd; ++linkIt) - { - if ( linkIt->IsBoundary() && !(*linkIt)->IsStraight() && linkIt->_qfaces[0]) - { -// if ( !face.IsNull() ) { -// const SMDS_MeshNode* inFaceNode = -// faceHelper.GetNodeUVneedInFaceNode() ? linkIt->_qfaces[0]->GetNodeInFace() : 0; -// gp_XY uvm = helper.GetNodeUV( face, (*linkIt)->_mediumNode, inFaceNode ); -// gp_XY uv1 = helper.GetNodeUV( face, (*linkIt)->node1(), inFaceNode); -// gp_XY uv2 = helper.GetNodeUV( face, (*linkIt)->node2(), inFaceNode); -// gp_XY uvMove = uvm - helper.GetMiddleUV( BRep_Tool::Surface(face,loc), uv1, uv2); -// gp_Vec move( uvMove.X(), uvMove.Y(), 0 ); -// linkIt->_qfaces[0]->MoveByBoundary( *linkIt, move, linkSet, &faceHelper ); -// } -// else { - linkIt->_qfaces[0]->MoveByBoundary( *linkIt, (*linkIt)->_nodeMove, linkSet ); - //} - } - } - } - - //================================================================================ - /*! - * \brief Detect rectangular structure of links and build chains from them - */ - //================================================================================ - - enum TSplitTriaResult { - _OK, _NO_CORNERS, _FEW_ROWS, _MANY_ROWS, _NO_SIDELINK, _BAD_MIDQUAD, _NOT_RECT, - _NO_MIDQUAD, _NO_UPTRIA, _BAD_SET_SIZE, _BAD_CORNER, _BAD_START, _NO_BOTLINK }; - - TSplitTriaResult splitTrianglesIntoChains( TChain & allLinks, - vector< TChain> & resultChains, - SMDS_TypeOfPosition pos ) - { - // put links in the set and evalute number of result chains by number of boundary links - TLinkSet linkSet; - int nbBndLinks = 0; - for ( TChain::iterator lnk = allLinks.begin(); lnk != allLinks.end(); ++lnk ) { - linkSet.insert( *lnk ); - nbBndLinks += lnk->IsBoundary(); - } - resultChains.clear(); - resultChains.reserve( nbBndLinks / 2 ); - - TLinkInSet linkIt, linksEnd = linkSet.end(); - - // find a boundary link with corner node; corner node has position pos-2 - // i.e. SMDS_TOP_VERTEX for links on faces and SMDS_TOP_EDGE for - // links in volume - SMDS_TypeOfPosition cornerPos = SMDS_TypeOfPosition(pos-2); - const SMDS_MeshNode* corner = 0; - for ( linkIt = linkSet.begin(); linkIt != linksEnd; ++linkIt ) - if ( linkIt->IsBoundary() && (corner = (*linkIt)->EndPosNode(cornerPos))) - break; - if ( !corner) - return _NO_CORNERS; - - TLinkInSet startLink = linkIt; - const SMDS_MeshNode* startCorner = corner; - vector< TChain* > rowChains; - int iCol = 0; - - while ( startLink != linksEnd) // loop on columns - { - // We suppose we have a rectangular structure like shown here. We have found a - // corner of the rectangle (startCorner) and a boundary link sharing - // |/ |/ | the startCorner (startLink). We are going to loop on rows of the - // --o---o---o structure making several chains at once. One chain (columnChain) - // |\ | /| starts at startLink and continues upward (we look at the structure - // \ | \ | / | from such point that startLink is on the bottom of the structure). - // \| \|/ | While going upward we also fill horizontal chains (rowChains) we - // --o---o---o encounter. - // /|\ |\ | - // / | \ | \ | startCorner - // | \| \|,' - // --o---o---o - // `.startLink - - if ( resultChains.size() == nbBndLinks / 2 ) - return _NOT_RECT; - resultChains.push_back( TChain() ); - TChain& columnChain = resultChains.back(); - - TLinkInSet botLink = startLink; // current horizontal link to go up from - corner = startCorner; // current corner the botLink ends at - int iRow = 0; - while ( botLink != linksEnd ) // loop on rows - { - // add botLink to the columnChain - columnChain.push_back( *botLink ); - - const QFace* botTria = botLink->_qfaces[0]; // bottom triangle bound by botLink - if ( !botTria ) - { // the column ends - - #ifdef __BORLANDC__ - linkSet.erase( *botLink ); - #else - linkSet.erase( botLink ); - #endif - - if ( iRow != rowChains.size() ) - return _FEW_ROWS; // different nb of rows in columns - break; - } - // find the link dividing the quadrangle (midQuadLink) and vertical boundary - // link ending at (sideLink); there are two cases: - // 1) midQuadLink does not end at , then we easily find it by botTria, - // since midQuadLink is not at boundary while sideLink is. - // 2) midQuadLink ends at - bool isCase2; - TLinkInSet midQuadLink = linksEnd; - TLinkInSet sideLink = botTria->GetBoundaryLink( linkSet, *botLink, &midQuadLink, - corner, &isCase2 ); - if ( isCase2 ) { // find midQuadLink among links of botTria - midQuadLink = botTria->GetLinkByNode( linkSet, *botLink, corner ); - if ( midQuadLink->IsBoundary() ) - return _BAD_MIDQUAD; - } - if ( sideLink == linksEnd || midQuadLink == linksEnd || sideLink == midQuadLink ) - return sideLink == linksEnd ? _NO_SIDELINK : _NO_MIDQUAD; - - // fill chains - columnChain.push_back( *midQuadLink ); - if ( iRow >= rowChains.size() ) { - if ( iCol > 0 ) - return _MANY_ROWS; // different nb of rows in columns - if ( resultChains.size() == nbBndLinks / 2 ) - return _NOT_RECT; - resultChains.push_back( TChain() ); - rowChains.push_back( & resultChains.back() ); - } - rowChains[iRow]->push_back( *sideLink ); - rowChains[iRow]->push_back( *midQuadLink ); - - const QFace* upTria = midQuadLink->NextFace( botTria ); // upper tria of the rectangle - if ( !upTria) - return _NO_UPTRIA; - if ( iRow == 0 ) { - // prepare startCorner and startLink for the next column - startCorner = startLink->NextNode( startCorner ); - if (isCase2) - startLink = botTria->GetBoundaryLink( linkSet, *botLink, 0, startCorner ); - else - startLink = upTria->GetBoundaryLink( linkSet, *midQuadLink, 0, startCorner ); - // check if no more columns remains - if ( startLink != linksEnd ) { - const SMDS_MeshNode* botNode = startLink->NextNode( startCorner ); - if ( (isCase2 ? botTria : upTria)->Contains( botNode )) - startLink = linksEnd; // startLink bounds upTria or botTria - else if ( startLink == botLink || startLink == midQuadLink || startLink == sideLink ) - return _BAD_START; - } - } - // find bottom link and corner for the next row - corner = sideLink->NextNode( corner ); - // next bottom link ends at the new corner - - #ifdef __BORLANDC__ - linkSet.erase( *botLink ); - #else - linkSet.erase( botLink ); - #endif - - botLink = upTria->GetLinkByNode( linkSet, (isCase2 ? *sideLink : *midQuadLink), corner ); - if ( botLink == linksEnd || botLink == (isCase2 ? midQuadLink : sideLink)) - return _NO_BOTLINK; - - #ifdef __BORLANDC__ - linkSet.erase( *midQuadLink ); - linkSet.erase( *sideLink ); - #else - linkSet.erase( midQuadLink ); - linkSet.erase( sideLink ); - #endif - - // make faces neighboring the found ones be boundary - if ( startLink != linksEnd ) { - const QFace* tria = isCase2 ? botTria : upTria; - for ( int iL = 0; iL < 3; ++iL ) { - linkIt = linkSet.find( tria->_sides[iL] ); - if ( linkIt != linksEnd ) - linkIt->RemoveFace( tria ); - } - } - if ( botLink->_qfaces[0] == upTria || botLink->_qfaces[1] == upTria ) - botLink->RemoveFace( upTria ); // make next botTria first in vector - - iRow++; - } // loop on rows - - iCol++; - } - // In the linkSet, there must remain the last links of rowChains; add them - if ( linkSet.size() != rowChains.size() ) - return _BAD_SET_SIZE; - for ( int iRow = 0; iRow < rowChains.size(); ++iRow ) { - // find the link (startLink) ending at startCorner - corner = 0; - for ( startLink = linkSet.begin(); startLink != linksEnd; ++startLink ) { - if ( (*startLink)->node1() == startCorner ) { - corner = (*startLink)->node2(); break; - } - else if ( (*startLink)->node2() == startCorner) { - corner = (*startLink)->node1(); break; - } - } - if ( startLink == linksEnd ) - return _BAD_CORNER; - rowChains[ iRow ]->push_back( *startLink ); - - #ifdef __BORLANDC__ - linkSet.erase( *startLink ); - #else - linkSet.erase( startLink ); - #endif - - startCorner = corner; - } - - return _OK; - } -} - -//======================================================================= -/*! - * \brief Move medium nodes of faces and volumes to fix distorted elements - * \param volumeOnly - to fix nodes on faces or not, if the shape is solid - * - * Issue 0020307: EDF 992 SMESH : Linea/Quadratic with Medium Node on Geometry - */ -//======================================================================= - -void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly) -{ - // apply algorithm to solids or geom faces - // ---------------------------------------------- - if ( myShape.IsNull() ) { - if ( !myMesh->HasShapeToMesh() ) return; - SetSubShape( myMesh->GetShapeToMesh() ); - - TopTools_MapOfShape faces; // faces not in solid or in not meshed solid - for ( TopExp_Explorer f(myShape,TopAbs_FACE,TopAbs_SOLID); f.More(); f.Next() ) { - faces.Add( f.Current() ); - } - for ( TopExp_Explorer v(myShape,TopAbs_SOLID); v.More(); v.Next() ) { - if ( myMesh->GetSubMesh( v.Current() )->IsEmpty() ) { // get faces of solid - for ( TopExp_Explorer f( v.Current(), TopAbs_FACE); f.More(); f.Next() ) - faces.Add( f.Current() ); - } - else { // fix nodes in the solid and its faces - SMESH_MesherHelper h(*myMesh); - h.SetSubShape( v.Current() ); - h.FixQuadraticElements(false); - } - } - // fix nodes on geom faces - for ( TopTools_MapIteratorOfMapOfShape fIt( faces ); fIt.More(); fIt.Next() ) { - SMESH_MesherHelper h(*myMesh); - h.SetSubShape( fIt.Key() ); - h.FixQuadraticElements(); - } - return; - } - - // Find out type of elements and get iterator on them - // --------------------------------------------------- - - SMDS_ElemIteratorPtr elemIt; - SMDSAbs_ElementType elemType = SMDSAbs_All; - - SMESH_subMesh* submesh = myMesh->GetSubMeshContaining( myShapeID ); - if ( !submesh ) - return; - if ( SMESHDS_SubMesh* smDS = submesh->GetSubMeshDS() ) { - elemIt = smDS->GetElements(); - if ( elemIt->more() ) { - elemType = elemIt->next()->GetType(); - elemIt = smDS->GetElements(); - } - } - if ( !elemIt || !elemIt->more() || elemType < SMDSAbs_Face ) - return; - - // Fill in auxiliary data structures - // ---------------------------------- - - set< QLink > links; - set< QFace > faces; - set< QLink >::iterator pLink; - set< QFace >::iterator pFace; - - bool isCurved = false; - bool hasRectFaces = false; - set nbElemNodeSet; - - if ( elemType == SMDSAbs_Volume ) - { - SMDS_VolumeTool volTool; - while ( elemIt->more() ) // loop on volumes - { - const SMDS_MeshElement* vol = elemIt->next(); - if ( !vol->IsQuadratic() || !volTool.Set( vol )) - return; //continue; - for ( int iF = 0; iF < volTool.NbFaces(); ++iF ) // loop on faces of volume - { - int nbN = volTool.NbFaceNodes( iF ); - nbElemNodeSet.insert( nbN ); - const SMDS_MeshNode** faceNodes = volTool.GetFaceNodes( iF ); - vector< const QLink* > faceLinks( nbN/2 ); - for ( int iN = 0; iN < nbN; iN += 2 ) // loop on links of a face - { - // store QLink - QLink link( faceNodes[iN], faceNodes[iN+2], faceNodes[iN+1] ); - pLink = links.insert( link ).first; - faceLinks[ iN/2 ] = & *pLink; - if ( !isCurved ) - isCurved = !link.IsStraight(); - if ( link.MediumPos() == SMDS_TOP_3DSPACE && !link.IsStraight() ) - return; // already fixed - } - // store QFace - pFace = faces.insert( QFace( faceLinks )).first; - if ( pFace->NbVolumes() == 0 ) - pFace->AddSelfToLinks(); - pFace->SetVolume( vol ); - hasRectFaces = hasRectFaces || - ( volTool.GetVolumeType() == SMDS_VolumeTool::QUAD_HEXA || - volTool.GetVolumeType() == SMDS_VolumeTool::QUAD_PENTA ); - } - } - set< QLink >::iterator pLink = links.begin(); - for ( ; pLink != links.end(); ++pLink ) - pLink->SetContinuesFaces(); - } - else - { - while ( elemIt->more() ) // loop on faces - { - const SMDS_MeshElement* face = elemIt->next(); - if ( !face->IsQuadratic() ) - continue; - nbElemNodeSet.insert( face->NbNodes() ); - int nbN = face->NbNodes()/2; - vector< const QLink* > faceLinks( nbN ); - for ( int iN = 0; iN < nbN; ++iN ) // loop on links of a face - { - // store QLink - QLink link( face->GetNode(iN), face->GetNode((iN+1)%nbN), face->GetNode(iN+nbN) ); - pLink = links.insert( link ).first; - faceLinks[ iN ] = & *pLink; - if ( !isCurved ) - isCurved = !link.IsStraight(); - } - // store QFace - pFace = faces.insert( QFace( faceLinks )).first; - pFace->AddSelfToLinks(); - hasRectFaces = ( hasRectFaces || nbN == 4 ); - } - } - if ( !isCurved ) - return; // no curved edges of faces - - // Compute displacement of medium nodes - // ------------------------------------- - - // two loops on faces: the first is to treat boundary links, the second is for internal ones - TopLoc_Location loc; - // not treat boundary of volumic submesh - int isInside = ( elemType == SMDSAbs_Volume && volumeOnly ) ? 1 : 0; - for ( ; isInside < 2; ++isInside ) { - MSG( "--------------- LOOP " << isInside << " ------------------"); - SMDS_TypeOfPosition pos = isInside ? SMDS_TOP_3DSPACE : SMDS_TOP_FACE; - - for ( pFace = faces.begin(); pFace != faces.end(); ++pFace ) { - if ( bool(isInside) == pFace->IsBoundary() ) - continue; - for ( int dir = 0; dir < 2; ++dir ) // 2 directions of propagation from quadrangle - { - MSG( "CHAIN"); - // make chain of links connected via continues faces - int error = ERR_OK; - TChain rawChain; - if ( !pFace->GetLinkChain( dir, rawChain, pos, error) && error ==ERR_UNKNOWN ) continue; - rawChain.reverse(); - if ( !pFace->GetLinkChain( dir+2, rawChain, pos, error ) && error ==ERR_UNKNOWN ) continue; - - vector< TChain > chains; - if ( error == ERR_OK ) { // chains contains continues rectangles - chains.resize(1); - chains[0].splice( chains[0].begin(), rawChain ); - } - else if ( error == ERR_TRI ) { // chains contains continues triangles - TSplitTriaResult res = splitTrianglesIntoChains( rawChain, chains, pos ); - if ( res != _OK ) { // not rectangles split into triangles - fixTriaNearBoundary( rawChain, *this ); - break; - } - } - else if ( error == ERR_PRISM ) { // side faces of prisms - fixPrism( rawChain ); - break; - } - else { - continue; - } - for ( int iC = 0; iC < chains.size(); ++iC ) - { - TChain& chain = chains[iC]; - if ( chain.empty() ) continue; - if ( chain.front()->IsStraight() && chain.back()->IsStraight() ) { - MSG("3D straight"); - continue; - } - // mesure chain length and compute link position along the chain - double chainLen = 0; - vector< double > linkPos; - MSGBEG( "Link medium nodes: "); - TChain::iterator link0 = chain.begin(), link1 = chain.begin(), link2; - for ( ++link1; link1 != chain.end(); ++link1, ++link0 ) { - MSGBEG( (*link0)->_mediumNode->GetID() << "-" <<(*link1)->_mediumNode->GetID()<<" "); - double len = ((*link0)->MiddlePnt() - (*link1)->MiddlePnt()).Modulus(); - while ( len < numeric_limits::min() ) { // remove degenerated link - link1 = chain.erase( link1 ); - if ( link1 == chain.end() ) - break; - len = ((*link0)->MiddlePnt() - (*link1)->MiddlePnt()).Modulus(); - } - chainLen += len; - linkPos.push_back( chainLen ); - } - MSG(""); - if ( linkPos.size() < 2 ) - continue; - - gp_Vec move0 = chain.front()->_nodeMove; - gp_Vec move1 = chain.back ()->_nodeMove; - - TopoDS_Face face; - bool checkUV = true; - if ( !isInside ) { - // compute node displacement of end links in parametric space of face - const SMDS_MeshNode* nodeOnFace = (*(++chain.begin()))->_mediumNode; - TopoDS_Shape f = GetSubShapeByNode( nodeOnFace, GetMeshDS() ); - if ( !f.IsNull() && f.ShapeType() == TopAbs_FACE ) { - face = TopoDS::Face( f ); - for ( int is1 = 0; is1 < 2; ++is1 ) { // move0 or move1 - TChainLink& link = is1 ? chain.back() : chain.front(); - gp_XY uv1 = GetNodeUV( face, link->node1(), nodeOnFace, &checkUV); - gp_XY uv2 = GetNodeUV( face, link->node2(), nodeOnFace, &checkUV); - gp_XY uvm = GetNodeUV( face, link->_mediumNode, nodeOnFace, &checkUV); - gp_XY uvMove = uvm - GetMiddleUV( BRep_Tool::Surface(face,loc), uv1, uv2); - if ( is1 ) move1.SetCoord( uvMove.X(), uvMove.Y(), 0 ); - else move0.SetCoord( uvMove.X(), uvMove.Y(), 0 ); - } - if ( move0.SquareMagnitude() < straightTol2 && - move1.SquareMagnitude() < straightTol2 ) { - MSG("2D straight"); - continue; // straight - no need to move nodes of internal links - } - } - } - gp_Trsf trsf; - if ( isInside || face.IsNull() ) - { - // compute node displacement of end links in their local coord systems - { - TChainLink& ln0 = chain.front(), ln1 = *(++chain.begin()); - trsf.SetTransformation( gp_Ax3( gp::Origin(), ln0.Normal(), - gp_Vec( ln0->MiddlePnt(), ln1->MiddlePnt() ))); - move0.Transform(trsf); - } - { - TChainLink& ln0 = *(++chain.rbegin()), ln1 = chain.back(); - trsf.SetTransformation( gp_Ax3( gp::Origin(), ln1.Normal(), - gp_Vec( ln0->MiddlePnt(), ln1->MiddlePnt() ))); - move1.Transform(trsf); - } - } - // compute displacement of medium nodes - link2 = chain.begin(); - link0 = link2++; - link1 = link2++; - for ( int i = 0; link2 != chain.end(); ++link0, ++link1, ++link2, ++i ) - { - double r = linkPos[i] / chainLen; - // displacement in local coord system - gp_Vec move = (1. - r) * move0 + r * move1; - if ( isInside || face.IsNull()) { - // transform to global - gp_Vec x01( (*link0)->MiddlePnt(), (*link1)->MiddlePnt() ); - gp_Vec x12( (*link1)->MiddlePnt(), (*link2)->MiddlePnt() ); - gp_Vec x = x01.Normalized() + x12.Normalized(); - trsf.SetTransformation( gp_Ax3( gp::Origin(), link1->Normal(), x), gp_Ax3() ); - move.Transform(trsf); - } - else { - // compute 3D displacement by 2D one - gp_XY oldUV = GetNodeUV( face, (*link1)->_mediumNode, 0, &checkUV); - gp_XY newUV = oldUV + gp_XY( move.X(), move.Y() ); - gp_Pnt newPnt = BRep_Tool::Surface(face,loc)->Value( newUV.X(), newUV.Y()); - move = gp_Vec( XYZ((*link1)->_mediumNode), newPnt.Transformed(loc) ); -#ifdef _DEBUG_ - if ( (XYZ((*link1)->node1()) - XYZ((*link1)->node2())).SquareModulus() < - move.SquareMagnitude()) - { - gp_XY uv0 = GetNodeUV( face, (*link0)->_mediumNode, 0, &checkUV); - gp_XY uv2 = GetNodeUV( face, (*link2)->_mediumNode, 0, &checkUV); - MSG( "uv0: "<Move( move ); - MSG( "Move " << (*link1)->_mediumNode->GetID() << " following " - << chain.front()->_mediumNode->GetID() <<"-" - << chain.back ()->_mediumNode->GetID() << - " by " << move.Magnitude()); - } - } // loop on chains of links - } // loop on 2 directions of propagation from quadrangle - } // loop on faces - } - - // Move nodes - // ----------- - - for ( pLink = links.begin(); pLink != links.end(); ++pLink ) { - if ( pLink->IsMoved() ) { - //gp_Pnt p = pLink->MediumPnt() + pLink->Move(); - gp_Pnt p = pLink->MiddlePnt() + pLink->Move(); - GetMeshDS()->MoveNode( pLink->_mediumNode, p.X(), p.Y(), p.Z()); - } - } -} diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Octree.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Octree.cpp index 00bdb26698..63457088e7 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Octree.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Octree.cpp @@ -20,47 +20,28 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // SMESH SMESH_Octree : global Octree implementation +// File : SMESH_Octree.cxx +// Created : Tue Jan 16 16:00:00 2007 +// Author : Nicolas Geimer & Aurélien Motteux(OCC) +// Module : SMESH // -// File : SMESH_Octree.cxx -// Created : Tue Jan 16 16:00:00 2007 -// Author : Nicolas Geimer & Aurélien Motteux(OCC) -// Module : SMESH - #include "SMESH_Octree.hxx" //=========================================================================== /*! - * Constructor. limit must be provided at tree root construction. - * limit will be deleted by SMESH_Octree. + * \brief SMESH_Octree Constructor + * \param maxLevel - The level max the octree can reach (If <0 unlimited) */ //=========================================================================== - -SMESH_Octree::SMESH_Octree (SMESH_Octree::Limit* limit): - myChildren(NULL), - myFather(NULL), - myIsLeaf( false ), - myLimit( limit ), - myLevel(0), - myBox(NULL) +SMESH_Octree::SMESH_Octree (const int maxLevel, const double minBoxSize): + myChildren(NULL), + myFather(NULL), + myLevel(0), + myMaxLevel(maxLevel), + myMinBoxSize(minBoxSize), + myIsLeaf(-1) { -} - -//================================================================================ -/*! - * \brief Compute the Octree - */ -//================================================================================ - -void SMESH_Octree::compute() -{ - if ( myLevel==0 ) - { - myBox = buildRootBox(); - if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize ) - myIsLeaf = true; - else - buildChildren(); - } + myBox = new Bnd_B3d(); } //====================================== @@ -68,25 +49,85 @@ void SMESH_Octree::compute() * \brief SMESH_Octree Destructor */ //====================================== - SMESH_Octree::~SMESH_Octree () { if(myChildren != NULL) { - if(!isLeaf()) + if(!myIsLeaf) { for(int i = 0; i<8; i++) delete myChildren[i]; - delete[] myChildren; - myChildren = 0; + delete[] myChildren ; } } - if ( myBox ) - delete myBox; - myBox = 0; - if ( level() == 0 ) - delete myLimit; - myLimit = 0; + delete myBox; +} + +//=========================================================================== +/*! + * \brief Set the bounding box of the Octree + * \param box - 3d Bounding Box of the Octree + */ +//=========================================================================== +void SMESH_Octree::setBox(const Bnd_B3d* box) +{ +// delete myBox; +// myBox=new Bnd_B3d(*box); + *myBox = *box; +} + +//=========================================================================== +/*! + * \brief Set box to the 3d Bounding Box of the Octree + * \param box - Set box to the 3d Bounding Box of the Octree + */ +//=========================================================================== +void SMESH_Octree::getBox(Bnd_B3d& box) +{ +// if(box != NULL) +// delete box; +// box = new Bnd_B3d (*myBox); + box = *myBox; +} + +//=========================================================================== +/*! + * \brief Set the max level of the Octree + * \param maxLevel - The level max the octree can reach (If <0 unlimited) + */ +//=========================================================================== +void SMESH_Octree::setMaxLevel(const int maxLevel) +{myMaxLevel = maxLevel;} + + +//=========================================================================== +/*! + * \brief Compute the bigger dimension of the box + * \param box - 3d Box + * \retval double - bigger dimension of the box + */ +//=========================================================================== +double SMESH_Octree::maxSize(const Bnd_B3d* box) +{ + if(box ==NULL) + return 0; + gp_XYZ min = box->CornerMin(); + gp_XYZ max = box->CornerMax(); + gp_XYZ Size = (max - min); + double returnVal = (Size.X()>Size.Y())?Size.X():Size.Y(); + return (returnVal>Size.Z())?returnVal:Size.Z(); +} + +//============================= +/*! + * \brief Compute the Octree + */ +//============================= +void SMESH_Octree::Compute() +{ + // As soon as the Octree is a Leaf, I stop building his children + if(!isLeaf()) + buildChildren(); } //================================================================= @@ -94,11 +135,8 @@ SMESH_Octree::~SMESH_Octree () * \brief Build the 8 children boxes and call buildChildrenData() */ //================================================================= - void SMESH_Octree::buildChildren() { - if ( isLeaf() ) return; - myChildren = new SMESH_Octree*[8]; gp_XYZ min = myBox->CornerMin(); @@ -108,11 +146,12 @@ void SMESH_Octree::buildChildren() gp_XYZ childHsize = HSize/2.; Standard_Real XminChild, YminChild, ZminChild; + Bnd_B3d* box; gp_XYZ minChild; - for (int i = 0; i < 8; i++) + for (int i =0; i<8; i++) { - // We build the eight boxes, we need 2 points to do that: - // Min and Mid + // We build the eight boxes, we need 2 points to do that. + // Min, and Mid // In binary, we can write i from 0 to 7 // For instance : // 5 is 101, it corresponds here in coordinates to ZYX @@ -121,58 +160,24 @@ void SMESH_Octree::buildChildren() // Same scheme for X and Z // I need the minChild to build the Bnd_B3d box. - XminChild = (i%2==0)?min.X():mid.X(); - YminChild = ((i%4)/2==0)?min.Y():mid.Y(); - ZminChild = (i<4)?min.Z():mid.Z(); + XminChild= (i%2==0)?min.X():mid.X(); + YminChild= ((i%4)/2==0)?min.Y():mid.Y(); + ZminChild= (i<4)?min.Z():mid.Z(); minChild.SetCoord(XminChild, YminChild, ZminChild); + box = new Bnd_B3d(minChild+childHsize,childHsize); // The child is of the same type than its father (For instance, a SMESH_OctreeNode) - // We allocate the memory we need for the child + // We allocate the memory we need fot the child myChildren[i] = allocateOctreeChild(); // and we assign to him its box. - myChildren[i]->myFather = this; - myChildren[i]->myLimit = myLimit; - myChildren[i]->myLevel = myLevel + 1; - myChildren[i]->myBox = new Bnd_B3d(minChild+childHsize,childHsize); - if ( myLimit->myMinBoxSize > 0. && myChildren[i]->maxSize() <= myLimit->myMinBoxSize ) - myChildren[i]->myIsLeaf = true; + myChildren[i]->setBox(box); + delete box; } - // After building the 8 boxes, we put the data into the children. + // After building the 8 boxes, we put the data into the children.. buildChildrenData(); //After we pass to the next level of the Octree - for (int i = 0; i<8; i++) - myChildren[i]->buildChildren(); -} - -//================================================================================ -/*! - * \brief Tell if Octree is a leaf or not - * An inheriting class can influence it via myIsLeaf protected field - */ -//================================================================================ - -bool SMESH_Octree::isLeaf() const -{ - return myIsLeaf || ((myLimit->myMaxLevel > 0) ? (level() >= myLimit->myMaxLevel) : false ); -} - -//=========================================================================== -/*! - * \brief Compute the bigger dimension of my box - */ -//=========================================================================== - -double SMESH_Octree::maxSize() const -{ - if ( myBox ) - { - gp_XYZ min = myBox->CornerMin(); - gp_XYZ max = myBox->CornerMax(); - gp_XYZ Size = (max - min); - double returnVal = (Size.X()>Size.Y())?Size.X():Size.Y(); - return (returnVal>Size.Z())?returnVal:Size.Z(); - } - return 0.; + for (int i =0; i<8; i++) + myChildren[i]->Compute(); } diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_OctreeNode.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_OctreeNode.cpp index 8a230d72e5..9a74d71bd7 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_OctreeNode.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_OctreeNode.cpp @@ -46,22 +46,18 @@ using namespace std; //================================================================ SMESH_OctreeNode::SMESH_OctreeNode (const set & theNodes, const int maxLevel, const int maxNbNodes , const double minBoxSize ) - :SMESH_Octree( new SMESH_Octree::Limit( maxLevel,minBoxSize)), + :SMESH_Octree(maxLevel,minBoxSize), myMaxNbNodes(maxNbNodes), myNodes(theNodes) { - compute(); -} - -//================================================================================ -/*! - * \brief Constructor used to allocate a child - */ -//================================================================================ - -SMESH_OctreeNode::SMESH_OctreeNode (int maxNbNodes): - SMESH_Octree(), myMaxNbNodes(maxNbNodes) -{ + // We need to compute the first bounding box via a special method + computeBoxForFather(); + myNbNodes = myNodes.size(); + myIsLeaf = ((myLevel == myMaxLevel) || + (myNbNodes <= myMaxNbNodes) || + (maxSize(myBox) <= myMinBoxSize)); + // All the children (Boxes and Data) are computed in Compute() + Compute(); } //================================================================================== @@ -69,10 +65,16 @@ SMESH_OctreeNode::SMESH_OctreeNode (int maxNbNodes): * \brief Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren() */ //================================================================================== - -SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild() const +SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild() { - return new SMESH_OctreeNode(myMaxNbNodes); + SMESH_OctreeNode * theOctree = new SMESH_OctreeNode(); + theOctree->myFather = this; + theOctree->myLevel = myLevel + 1; + theOctree->myMaxLevel = myMaxLevel; + theOctree->myMaxNbNodes = myMaxNbNodes; + theOctree->myMinBoxSize = myMinBoxSize; + theOctree->myNbNodes = 0; + return theOctree; } //====================================== @@ -82,20 +84,25 @@ SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild() const * We take the max/min coord of the nodes */ //====================================== - -Bnd_B3d* SMESH_OctreeNode::buildRootBox() +void SMESH_OctreeNode::computeBoxForFather() { - Bnd_B3d* box = new Bnd_B3d; set::iterator it = myNodes.begin(); for (; it != myNodes.end(); it++) { const SMDS_MeshNode* n1 = *it; gp_XYZ p1( n1->X(), n1->Y(), n1->Z() ); - box->Add(p1); + myBox->Add(p1); } - if ( myNodes.size() <= myMaxNbNodes ) - myIsLeaf = true; +} - return box; +//==================================================================================== +/*! + * \brief Tell if Octree is a leaf or not (has to be implemented in inherited classes) + * \retval - True if the Octree is a leaf + */ +//==================================================================================== +const bool SMESH_OctreeNode::isLeaf() +{ + return myIsLeaf; } //==================================================================================== @@ -106,15 +113,19 @@ Bnd_B3d* SMESH_OctreeNode::buildRootBox() * \retval bool - True if Node is in the box within precision */ //==================================================================================== - const bool SMESH_OctreeNode::isInside (const SMDS_MeshNode * Node, const double precision) { - gp_XYZ p (Node->X(),Node->Y(),Node->Z()); + double X = Node->X(); + double Y = Node->Y(); + double Z = Node->Z(); + bool Out = 1 ; if (precision <= 0.) - return !(getBox().IsOut(p)); - Bnd_B3d BoxWithPrecision = getBox(); + return !(myBox->IsOut(gp_XYZ(X,Y,Z))); + Bnd_B3d BoxWithPrecision; + getBox(BoxWithPrecision); BoxWithPrecision.Enlarge(precision); - return ! BoxWithPrecision.IsOut(p); + Out = BoxWithPrecision.IsOut(gp_XYZ(X,Y,Z)); + return !(Out); } //================================================ @@ -125,15 +136,16 @@ const bool SMESH_OctreeNode::isInside (const SMDS_MeshNode * Node, const double //================================================ void SMESH_OctreeNode::buildChildrenData() { - gp_XYZ min = getBox().CornerMin(); - gp_XYZ max = getBox().CornerMax(); + gp_XYZ min = myBox->CornerMin(); + gp_XYZ max = myBox->CornerMax(); gp_XYZ mid = (min + max)/2.; set::iterator it = myNodes.begin(); + int ChildBoxNum; while (it != myNodes.end()) { const SMDS_MeshNode* n1 = *it; - int ChildBoxNum = getChildIndex( n1->X(), n1->Y(), n1->Z(), mid ); + ChildBoxNum = (n1->X() > mid.X()) + (n1->Y() > mid.Y())*2 + (n1->Z() > mid.Z())*4; SMESH_OctreeNode* myChild = dynamic_cast (myChildren[ChildBoxNum]); myChild->myNodes.insert(myChild->myNodes.end(),n1); myNodes.erase( it ); @@ -142,8 +154,10 @@ void SMESH_OctreeNode::buildChildrenData() for (int i = 0; i < 8; i++) { SMESH_OctreeNode* myChild = dynamic_cast (myChildren[i]); - if ( myChild->myNodes.size() <= myMaxNbNodes ) - myChild->myIsLeaf = true; + myChild->myNbNodes = (myChild->myNodes).size(); + myChild->myIsLeaf = ((myChild->myLevel == myMaxLevel) || + (myChild->myNbNodes <= myMaxNbNodes) || + (maxSize(myChild->myBox) <= myMinBoxSize)); } } @@ -161,7 +175,7 @@ void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node, { if (isInside(Node,precision)) { - if (isLeaf()) + if (myIsLeaf) { Result->insert(Result->end(), myNodes.begin(), myNodes.end()); } @@ -176,61 +190,6 @@ void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node, } } -//================================================================================ -/*! - * \brief Return in dist2Nodes nodes mapped to their square distance from Node - * \param node - node to find nodes closest to - * \param dist2Nodes - map of found nodes and their distances - * \param precision - radius of a sphere to check nodes inside - * \retval bool - true if an exact overlapping found - */ -//================================================================================ - -bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node, - map& dist2Nodes, - double precision) -{ - if ( !dist2Nodes.empty() ) - precision = min ( precision, sqrt( dist2Nodes.begin()->first )); - else if ( precision == 0. ) - precision = maxSize() / 2; - - if (isInside(node,precision)) - { - if (!isLeaf()) - { - // first check a child containing node - gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.; - int nodeChild = getChildIndex( node->X(), node->Y(), node->Z(), mid ); - if ( ((SMESH_OctreeNode*) myChildren[nodeChild])->NodesAround(node, dist2Nodes, precision)) - return true; - - for (int i = 0; i < 8; i++) - if ( i != nodeChild ) - if (((SMESH_OctreeNode*) myChildren[i])->NodesAround(node, dist2Nodes, precision)) - return true; - } - else if ( NbNodes() > 0 ) - { - double minDist = precision * precision; - gp_Pnt p1 ( node->X(), node->Y(), node->Z() ); - set::iterator nIt = myNodes.begin(); - for ( ; nIt != myNodes.end(); ++nIt ) - { - gp_Pnt p2 ( (*nIt)->X(), (*nIt)->Y(), (*nIt)->Z() ); - double dist2 = p1.SquareDistance( p2 ); - if ( dist2 < minDist ) - dist2Nodes.insert( make_pair( minDist = dist2, *nIt )); - } -// if ( dist2Nodes.size() > 1 ) // leave only closest node in dist2Nodes -// dist2Nodes.erase( ++dist2Nodes.begin(), dist2Nodes.end()); - - return ( sqrt( minDist) <= precision * 1e-12 ); - } - } - return false; -} - //============================= /*! * \brief Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance @@ -243,14 +202,15 @@ bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node, * \param maxNbNodes - maximum Nodes in a Leaf of the SMESH_OctreeNode constructed, default value is 5 */ //============================= -void SMESH_OctreeNode::FindCoincidentNodes (set& theSetOfNodes, +void SMESH_OctreeNode::FindCoincidentNodes (set theSetOfNodes, list< list< const SMDS_MeshNode*> >* theGroupsOfNodes, const double theTolerance, const int maxLevel, const int maxNbNodes) { - SMESH_OctreeNode theOctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance); - theOctreeNode.FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes); + SMESH_OctreeNode* theOctreeNode = new SMESH_OctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance); + theOctreeNode->FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes); + delete theOctreeNode; } //============================= @@ -325,7 +285,7 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node, if (isInsideBool) { // I'm only looking in the leaves, since all the nodes are stored there. - if (isLeaf()) + if (myIsLeaf) { gp_Pnt p1 (Node->X(), Node->Y(), Node->Z()); @@ -373,43 +333,6 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node, } } -//================================================================================ -/*! - * \brief Update data according to node movement - */ -//================================================================================ - -void SMESH_OctreeNode::UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt ) -{ - if ( isLeaf() ) - { - set::iterator pNode = myNodes.find( node ); - bool nodeInMe = ( pNode != myNodes.end() ); - - SMDS_MeshNode pointNode( toPnt.X(), toPnt.Y(), toPnt.Z() ); - bool pointInMe = isInside( &pointNode, 1e-10 ); - - if ( pointInMe != nodeInMe ) - { - if ( pointInMe ) - myNodes.insert( node ); - else - myNodes.erase( node ); - } - } - else if ( myChildren ) - { - gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.; - int nodeChild = getChildIndex( node->X(), node->Y(), node->Z(), mid ); - int pointChild = getChildIndex( toPnt.X(), toPnt.Y(), toPnt.Z(), mid ); - if ( nodeChild != pointChild ) - { - ((SMESH_OctreeNode*) myChildren[ nodeChild ])->UpdateByMoveNode( node, toPnt ); - ((SMESH_OctreeNode*) myChildren[ pointChild ])->UpdateByMoveNode( node, toPnt ); - } - } -} - //================================================================================ /*! * \brief Return iterator over children @@ -419,7 +342,7 @@ SMESH_OctreeNodeIteratorPtr SMESH_OctreeNode::GetChildrenIterator() { return SMESH_OctreeNodeIteratorPtr ( new SMDS_SetIterator< SMESH_OctreeNode*, SMESH_Octree** > - ( myChildren, (( isLeaf() || !myChildren ) ? myChildren : &myChildren[ 8 ] ))); + ( myChildren, ( isLeaf() ? myChildren : &myChildren[ 8 ] ))); } //================================================================================ @@ -431,5 +354,5 @@ SMDS_NodeIteratorPtr SMESH_OctreeNode::GetNodeIterator() { return SMDS_NodeIteratorPtr ( new SMDS_SetIterator< SMDS_pNode, set< SMDS_pNode >::const_iterator > - ( myNodes.begin(), myNodes.size() ? myNodes.end() : myNodes.begin())); + ( myNodes.begin(), myNodes.end() )); } diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Pattern.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Pattern.cpp index 135e24d643..c311bb93a1 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Pattern.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Pattern.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -74,11 +73,6 @@ #include "SMESH_subMesh.hxx" #include "utilities.h" -#include - -#ifndef PI -#define PI M_PI -#endif using namespace std; @@ -442,13 +436,8 @@ static gp_XY project (const SMDS_MeshNode* theNode, } double u, v, minVal = DBL_MAX; for ( int i = theProjectorPS.NbExt(); i > 0; i-- ) -#if OCC_VERSION_HEX >= 0x060500 - if ( theProjectorPS.SquareDistance( i ) < minVal ) { + if ( theProjectorPS.SquareDistance( i ) < minVal ) { minVal = theProjectorPS.SquareDistance( i ); -#else - if ( theProjectorPS.Value( i ) < minVal ) { - minVal = theProjectorPS.Value( i ); -#endif theProjectorPS.Point( i ).Parameter( u, v ); } return gp_XY( u, v ); diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_subMesh.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_subMesh.cpp index 21d1675184..15dac99a78 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_subMesh.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_subMesh.cpp @@ -35,10 +35,9 @@ #include "SMESH_subMeshEventListener.hxx" #include "SMESH_Comment.hxx" #include "SMDS_SetIterator.hxx" -#include "SMDSAbs_ElementType.hxx" #include "utilities.h" -#include "OpUtil.hxx" +//#include "OpUtil.hxx" #include #include @@ -82,22 +81,22 @@ SMESH_subMesh::SMESH_subMesh(int Id, SMESHDS_Mesh * meshDS, const TopoDS_Shape & aSubShape) { - _subShape = aSubShape; - _subMeshDS = meshDS->MeshElements(_subShape); // may be null ... - _father = father; - _Id = Id; - _dependenceAnalysed = _alwaysComputed = false; + _subShape = aSubShape; + _subMeshDS = meshDS->MeshElements(_subShape); // may be null ... + _father = father; + _Id = Id; + _dependenceAnalysed = _alwaysComputed = false; - if (_subShape.ShapeType() == TopAbs_VERTEX) - { - _algoState = HYP_OK; - _computeState = READY_TO_COMPUTE; - } - else - { + if (_subShape.ShapeType() == TopAbs_VERTEX) + { + _algoState = HYP_OK; + _computeState = READY_TO_COMPUTE; + } + else + { _algoState = NO_ALGO; _computeState = NOT_READY; - } + } } //============================================================================= @@ -392,7 +391,7 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn() } case TopAbs_COMPSOLID: { - //MESSAGE("compsolid"); + //MESSAGE("compsolid"); for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More(); exp.Next()) { @@ -448,7 +447,7 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn() for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX); exp.More(); exp.Next()) { - InsertDependence(exp.Current()); + InsertDependence(exp.Current()); } break; } @@ -495,8 +494,8 @@ void SMESH_subMesh::InsertDependence(const TopoDS_Shape aSubShape) const TopoDS_Shape & SMESH_subMesh::GetSubShape() const { - //MESSAGE("SMESH_subMesh::GetSubShape"); - return _subShape; + //MESSAGE("SMESH_subMesh::GetSubShape"); + return _subShape; } @@ -947,12 +946,6 @@ SMESH_Hypothesis::Hypothesis_Status break; } case REMOVE_FATHER_ALGO: { - // IPAL21346. Edges not removed when Netgen 1d-2d is removed from a SOLID. - // CLEAN was not called at event REMOVE_ALGO because the algo is not applicable to SOLID. - algo = dynamic_cast (anHyp); - if (!algo->NeedDescretBoundary()) - needFullClean = true; - algo = gen->GetAlgo((*_father), _subShape); if (algo == NULL) // no more applying algo on father { @@ -1148,48 +1141,48 @@ void SMESH_subMesh::CleanDependsOn() void SMESH_subMesh::DumpAlgoState(bool isMain) { - int dim = SMESH_Gen::GetShapeDim(_subShape); + int dim = SMESH_Gen::GetShapeDim(_subShape); // if (dim < 1) return; - if (isMain) - { - const map < int, SMESH_subMesh * >&subMeshes = DependsOn(); + if (isMain) + { + const map < int, SMESH_subMesh * >&subMeshes = DependsOn(); - map < int, SMESH_subMesh * >::const_iterator itsub; - for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) - { - SMESH_subMesh *sm = (*itsub).second; - sm->DumpAlgoState(false); - } - } - int type = _subShape.ShapeType(); - MESSAGE("dim = " << dim << " type of shape " << type); - switch (_algoState) - { - case NO_ALGO: - MESSAGE(" AlgoState = NO_ALGO"); - break; - case MISSING_HYP: - MESSAGE(" AlgoState = MISSING_HYP"); - break; - case HYP_OK: - MESSAGE(" AlgoState = HYP_OK"); - break; - } - switch (_computeState) - { - case NOT_READY: - MESSAGE(" ComputeState = NOT_READY"); - break; - case READY_TO_COMPUTE: - MESSAGE(" ComputeState = READY_TO_COMPUTE"); - break; - case COMPUTE_OK: - MESSAGE(" ComputeState = COMPUTE_OK"); - break; - case FAILED_TO_COMPUTE: - MESSAGE(" ComputeState = FAILED_TO_COMPUTE"); - break; - } + map < int, SMESH_subMesh * >::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh *sm = (*itsub).second; + sm->DumpAlgoState(false); + } + } + int type = _subShape.ShapeType(); + MESSAGE("dim = " << dim << " type of shape " << type); + switch (_algoState) + { + case NO_ALGO: + MESSAGE(" AlgoState = NO_ALGO"); + break; + case MISSING_HYP: + MESSAGE(" AlgoState = MISSING_HYP"); + break; + case HYP_OK: + MESSAGE(" AlgoState = HYP_OK"); + break; + } + switch (_computeState) + { + case NOT_READY: + MESSAGE(" ComputeState = NOT_READY"); + break; + case READY_TO_COMPUTE: + MESSAGE(" ComputeState = READY_TO_COMPUTE"); + break; + case COMPUTE_OK: + MESSAGE(" ComputeState = COMPUTE_OK"); + break; + case FAILED_TO_COMPUTE: + MESSAGE(" ComputeState = FAILED_TO_COMPUTE"); + break; + } } //================================================================================ @@ -1284,13 +1277,13 @@ bool SMESH_subMesh::ComputeStateEngine(int event) if ( _algoState == HYP_OK ) _computeState = READY_TO_COMPUTE; break; - case COMPUTE: // nothing to do + case COMPUTE: // nothing to do break; case CLEAN: CleanDependants(); RemoveSubMeshElementsAndNodes(); break; - case SUBMESH_COMPUTED: // nothing to do + case SUBMESH_COMPUTED: // nothing to do break; case SUBMESH_RESTORED: ComputeSubMeshStateEngine( SUBMESH_RESTORED ); @@ -1409,7 +1402,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) _computeError->myComment += ex.GetMessageString(); } } - catch ( SALOME_Exception& S_ex ) { + catch ( SMESH_Exception& S_ex ) { if ( !_computeError ) _computeError = SMESH_ComputeError::New(); _computeError->myName = COMPERR_SLM_EXCEPTION; _computeError->myComment = S_ex.what(); @@ -1584,48 +1577,6 @@ bool SMESH_subMesh::ComputeStateEngine(int event) return ret; } - -//============================================================================= -/*! - * - */ -//============================================================================= - -bool SMESH_subMesh::Evaluate(MapShapeNbElems& aResMap) -{ - _computeError.reset(); - - bool ret = true; - - if (_subShape.ShapeType() == TopAbs_VERTEX) { - std::vector aVec(SMDSEntity_Last); - for(int i= SMDSEntity_Node; i < SMDSEntity_Last; i++) - aVec[i] = 0; - aVec[SMDSEntity_Node] = 1; - aResMap.insert(std::make_pair(this,aVec)); - return ret; - } - - SMESH_Gen *gen = _father->GetGen(); - SMESH_Algo *algo = 0; - SMESH_Hypothesis::Hypothesis_Status hyp_status; - - algo = gen->GetAlgo((*_father), _subShape); - if(algo) { - ret = algo->CheckHypothesis((*_father), _subShape, hyp_status); - if (!ret) return false; - - TopoDS_Shape shape = _subShape; - - _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo); - - ret = algo->Evaluate((*_father), shape, aResMap); - } - - return ret; -} - - //======================================================================= /*! * \brief Update compute_state by _computeError and send proper events to diff --git a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Command.cpp b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Command.cpp index ab46ee27b4..be0e5e6325 100644 --- a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Command.cpp +++ b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Command.cpp @@ -84,22 +84,6 @@ void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z) myNumber++; } -//======================================================================= -//function : -//purpose : -//======================================================================= -void SMESHDS_Command::Add0DElement(int New0DElementID, int idnode) -{ - if (!myType == SMESHDS_Add0DElement) - { - MESSAGE("SMESHDS_Command::Add0DElement : Bad Type"); - return; - } - myIntegers.push_back(New0DElementID); - myIntegers.push_back(idnode); - myNumber++; -} - //======================================================================= //function : //purpose : diff --git a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Group.cpp b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Group.cpp index fd0ba61d51..82ef5eee75 100644 --- a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Group.cpp +++ b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Group.cpp @@ -22,7 +22,7 @@ // SMESH SMESHDS : idl implementation based on 'SMESH' unit's classes // File : SMESHDS_Group.cxx // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_Group.cxx,v 1.9.2.1 2008/11/27 12:31:37 abd Exp $ // #include "SMESHDS_Group.hxx" #include "SMESHDS_Mesh.hxx" diff --git a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_GroupBase.cpp b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_GroupBase.cpp index b14afd408f..3cd114a85f 100644 --- a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_GroupBase.cpp +++ b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_GroupBase.cpp @@ -22,7 +22,7 @@ // SMESH SMESHDS : idl implementation based on 'SMESH' unit's classes // File : SMESHDS_Group.cxx // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_GroupBase.cxx,v 1.7.2.5 2008/11/27 12:31:37 abd Exp $ // #include "SMESHDS_GroupBase.hxx" #include "SMESHDS_Mesh.hxx" diff --git a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_GroupOnGeom.cpp b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_GroupOnGeom.cpp index 04e7200e20..6c936420f3 100644 --- a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_GroupOnGeom.cpp +++ b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_GroupOnGeom.cpp @@ -75,24 +75,23 @@ class MyIterator: public SMDS_ElemIterator } bool more() { - if ( myType == SMDSAbs_Node && myNodeIt != NULL ) + if ( myType == SMDSAbs_Node && (myNodeIt!=NULL) ) return myNodeIt->more(); return ( myElem != 0 ); } const SMDS_MeshElement* next() { - if ( myType == SMDSAbs_Node && myNodeIt != NULL ) + if ( myType == SMDSAbs_Node && (myNodeIt!=NULL) ) return myNodeIt->next(); const SMDS_MeshElement* res = myElem; myElem = 0; - while ( myElemIt != NULL && myElemIt->more() ) { + while ( (myElemIt!=NULL) && myElemIt->more() ) { myElem = myElemIt->next(); if ( myElem && myElem->GetType() == myType ) break; else myElem = 0; } - return res; } }; diff --git a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Hypothesis.cpp b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Hypothesis.cpp index 84b3a6c32b..22cbb1a1bd 100644 --- a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Hypothesis.cpp +++ b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Hypothesis.cpp @@ -23,7 +23,7 @@ // File : SMESHDS_Hypothesis.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_Hypothesis.cxx,v 1.10.2.1 2008/11/27 12:31:37 abd Exp $ // #include "SMESHDS_Hypothesis.hxx" diff --git a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Mesh.cpp b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Mesh.cpp index 88c1509dd0..648ad83e52 100644 --- a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Mesh.cpp +++ b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Mesh.cpp @@ -248,30 +248,6 @@ void SMESHDS_Mesh::Renumber (const bool isNodes, const int startID, const int de myScript->Renumber( isNodes, startID, deltaID ); } -//======================================================================= -//function : Add0DElement -//purpose : -//======================================================================= -SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID(int nodeID, int ID) -{ - SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElementWithID(nodeID, ID); - if (anElem) myScript->Add0DElement(ID, nodeID); - return anElem; -} - -SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID - (const SMDS_MeshNode * node, int ID) -{ - return Add0DElementWithID(node->GetID(), ID); -} - -SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElement(const SMDS_MeshNode * node) -{ - SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElement(node); - if (anElem) myScript->Add0DElement(anElem->GetID(), node->GetID()); - return anElem; -} - //======================================================================= //function :AddEdgeWithID //purpose : @@ -284,21 +260,21 @@ SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(int n1, int n2, int ID) } SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - int ID) + const SMDS_MeshNode * n2, + int ID) { return AddEdgeWithID(n1->GetID(), - n2->GetID(), - ID); + n2->GetID(), + ID); } SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2) + const SMDS_MeshNode * n2) { SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2); if(anElem) myScript->AddEdge(anElem->GetID(), - n1->GetID(), - n2->GetID()); + n1->GetID(), + n2->GetID()); return anElem; } @@ -314,25 +290,25 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int ID) } SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - int ID) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + int ID) { return AddFaceWithID(n1->GetID(), - n2->GetID(), - n3->GetID(), - ID); + n2->GetID(), + n3->GetID(), + ID); } SMDS_MeshFace* SMESHDS_Mesh::AddFace( const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3) { SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3); if(anElem) myScript->AddFace(anElem->GetID(), - n1->GetID(), - n2->GetID(), - n3->GetID()); + n1->GetID(), + n2->GetID(), + n3->GetID()); return anElem; } @@ -348,29 +324,29 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4, int I } SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - int ID) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + int ID) { return AddFaceWithID(n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID(), - ID); + n2->GetID(), + n3->GetID(), + n4->GetID(), + ID); } SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4) { SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3, n4); if(anElem) myScript->AddFace(anElem->GetID(), - n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID()); + n1->GetID(), + n2->GetID(), + n3->GetID(), + n4->GetID()); return anElem; } @@ -386,29 +362,29 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i } SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - int ID) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + int ID) { return AddVolumeWithID(n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID(), - ID); + n2->GetID(), + n3->GetID(), + n4->GetID(), + ID); } SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4) { SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4); if(anElem) myScript->AddVolume(anElem->GetID(), - n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID()); + n1->GetID(), + n2->GetID(), + n3->GetID(), + n4->GetID()); return anElem; } @@ -424,33 +400,33 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i } SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - int ID) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + int ID) { return AddVolumeWithID(n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID(), - n5->GetID(), - ID); + n2->GetID(), + n3->GetID(), + n4->GetID(), + n5->GetID(), + ID); } SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5) { SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5); if(anElem) myScript->AddVolume(anElem->GetID(), - n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID(), - n5->GetID()); + n1->GetID(), + n2->GetID(), + n3->GetID(), + n4->GetID(), + n5->GetID()); return anElem; } @@ -466,37 +442,37 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i } SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - int ID) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + int ID) { return AddVolumeWithID(n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID(), - n5->GetID(), - n6->GetID(), - ID); + n2->GetID(), + n3->GetID(), + n4->GetID(), + n5->GetID(), + n6->GetID(), + ID); } SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6) { SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6); if(anElem) myScript->AddVolume(anElem->GetID(), - n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID(), - n5->GetID(), - n6->GetID()); + n1->GetID(), + n2->GetID(), + n3->GetID(), + n4->GetID(), + n5->GetID(), + n6->GetID()); return anElem; } @@ -512,45 +488,45 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i } SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8, - int ID) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8, + int ID) { return AddVolumeWithID(n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID(), - n5->GetID(), - n6->GetID(), - n7->GetID(), - n8->GetID(), - ID); + n2->GetID(), + n3->GetID(), + n4->GetID(), + n5->GetID(), + n6->GetID(), + n7->GetID(), + n8->GetID(), + ID); } SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1, - const SMDS_MeshNode * n2, - const SMDS_MeshNode * n3, - const SMDS_MeshNode * n4, - const SMDS_MeshNode * n5, - const SMDS_MeshNode * n6, - const SMDS_MeshNode * n7, - const SMDS_MeshNode * n8) + const SMDS_MeshNode * n2, + const SMDS_MeshNode * n3, + const SMDS_MeshNode * n4, + const SMDS_MeshNode * n5, + const SMDS_MeshNode * n6, + const SMDS_MeshNode * n7, + const SMDS_MeshNode * n8) { SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8); if(anElem) myScript->AddVolume(anElem->GetID(), - n1->GetID(), - n2->GetID(), - n3->GetID(), - n4->GetID(), - n5->GetID(), - n6->GetID(), - n7->GetID(), - n8->GetID()); + n1->GetID(), + n2->GetID(), + n3->GetID(), + n4->GetID(), + n5->GetID(), + n6->GetID(), + n7->GetID(), + n8->GetID()); return anElem; } @@ -1018,7 +994,7 @@ void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode * aNode, //======================================================================= void SMESHDS_Mesh::UnSetNodeOnShape(const SMDS_MeshNode* aNode) { - if ( aNode != NULL && aNode->GetPosition() != NULL ) { + if ( (aNode!=NULL) && (aNode->GetPosition()!=NULL) ) { map::iterator it = myShapeIndexToSubMesh.find( aNode->GetPosition()->GetShapeId() ); if ( it != myShapeIndexToSubMesh.end() ) @@ -1059,7 +1035,7 @@ void SMESHDS_Mesh::UnSetMeshElementOnShape(const SMDS_MeshElement * elem, //======================================================================= TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const { - return myShape; + return myShape; } //======================================================================= @@ -1143,7 +1119,7 @@ SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape & S) const //======================================================================= SMESHDS_Script* SMESHDS_Mesh::GetScript() { - return myScript; + return myScript; } //======================================================================= @@ -1152,7 +1128,7 @@ SMESHDS_Script* SMESHDS_Mesh::GetScript() //======================================================================= void SMESHDS_Mesh::ClearScript() { - myScript->Clear(); + myScript->Clear(); } //======================================================================= @@ -1161,9 +1137,9 @@ void SMESHDS_Mesh::ClearScript() //======================================================================= bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S) { - if (myShape.IsNull()) MESSAGE("myShape is NULL"); - int Index = myIndexToShape.FindIndex(S); - return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end(); + if (myShape.IsNull()) MESSAGE("myShape is NULL"); + int Index = myIndexToShape.FindIndex(S); + return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end(); } //======================================================================= @@ -1235,7 +1211,7 @@ int SMESHDS_Mesh::AddCompoundSubmesh(const TopoDS_Shape& S, //======================================================================= const TopoDS_Shape& SMESHDS_Mesh::IndexToShape(int ShapeIndex) const { - return myIndexToShape.FindKey(ShapeIndex); + return myIndexToShape.FindKey(ShapeIndex); } //======================================================================= @@ -1351,8 +1327,8 @@ SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode* n1, { SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2,n12); if(anElem) myScript->AddEdge(anElem->GetID(), - n1->GetID(), - n2->GetID(), + n1->GetID(), + n2->GetID(), n12->GetID()); return anElem; } @@ -1367,9 +1343,9 @@ SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, int ID) { return AddEdgeWithID(n1->GetID(), - n2->GetID(), + n2->GetID(), n12->GetID(), - ID); + ID); } @@ -1386,7 +1362,7 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1, { SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n12,n23,n31); if(anElem) myScript->AddFace(anElem->GetID(), - n1->GetID(), n2->GetID(), n3->GetID(), + n1->GetID(), n2->GetID(), n3->GetID(), n12->GetID(), n23->GetID(), n31->GetID()); return anElem; } @@ -1417,7 +1393,7 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, { return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(), n12->GetID(), n23->GetID(), n31->GetID(), - ID); + ID); } @@ -1436,7 +1412,7 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1, { SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n4,n12,n23,n34,n41); if(anElem) myScript->AddFace(anElem->GetID(), - n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(), + n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(), n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID()); return anElem; } @@ -1469,7 +1445,7 @@ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, { return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(), n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(), - ID); + ID); } @@ -1490,8 +1466,8 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1, { SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n12,n23,n31,n14,n24,n34); if(anElem) myScript->AddVolume(anElem->GetID(), - n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(), - n12->GetID(), n23->GetID(), n31->GetID(), + n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(), + n12->GetID(), n23->GetID(), n31->GetID(), n14->GetID(), n24->GetID(), n34->GetID()); return anElem; } @@ -1509,7 +1485,7 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n12,n23,n31,n14,n24,n34); return anElem; } - + //======================================================================= //function : AddVolumeWithID //purpose : 2d order tetrahedron of 10 nodes @@ -1575,7 +1551,7 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, i n15,n25,n35,n45); return anElem; } - + //======================================================================= //function : AddVolumeWithID //purpose : 2d order pyramid of 13 nodes @@ -1652,7 +1628,7 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, n45,n56,n64,n14,n25,n36); return anElem; } - + //======================================================================= //function : AddVolumeWithID //purpose : 2d order Pentahedron with 15 nodes @@ -1740,7 +1716,7 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, n56,n67,n78,n85,n15,n26,n37,n48); return anElem; } - + //======================================================================= //function : AddVolumeWithID //purpose : 2d order Hexahedrons with 20 nodes diff --git a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Script.cpp b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Script.cpp index 3d379c4b0d..9b6daa8b1a 100644 --- a/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Script.cpp +++ b/src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_Script.cpp @@ -95,19 +95,6 @@ void SMESHDS_Script::AddNode(int NewNodeID, double x, double y, double z) getCommand(SMESHDS_AddNode)->AddNode(NewNodeID, x, y, z); } -//======================================================================= -//function : -//purpose : -//======================================================================= -void SMESHDS_Script::Add0DElement (int New0DElementID, int idnode) -{ - if (myIsEmbeddedMode) { - myIsModified = true; - return; - } - getCommand(SMESHDS_Add0DElement)->Add0DElement(New0DElementID, idnode); -} - //======================================================================= //function : //purpose : diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Arithmetic1D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Arithmetic1D.cpp index a24909a0cf..9dd35269e8 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Arithmetic1D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Arithmetic1D.cpp @@ -23,6 +23,7 @@ // File : StdMeshers_Arithmetic1D.cxx // Author : Damien COQUERET, OCC // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Arithmetic1D.cxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $ // #include "StdMeshers_Arithmetic1D.hxx" @@ -73,11 +74,11 @@ StdMeshers_Arithmetic1D::~StdMeshers_Arithmetic1D() //============================================================================= void StdMeshers_Arithmetic1D::SetLength(double length, bool isStartLength) - throw(SALOME_Exception) + throw(SMESH_Exception) { if ( (isStartLength ? _begLength : _endLength) != length ) { if (length <= 0) - throw SALOME_Exception(LOCALIZED("length must be positive")); + throw SMESH_Exception(LOCALIZED("length must be positive")); if ( isStartLength ) _begLength = length; else @@ -104,32 +105,9 @@ double StdMeshers_Arithmetic1D::GetLength(bool isStartLength) const */ //============================================================================= -void StdMeshers_Arithmetic1D::SetReversedEdges( std::vector& ids ) -{ - if ( ids != _edgeIDs ) { - _edgeIDs = ids; - - NotifySubMeshesHypothesisModification(); - } -} - -//============================================================================= -/*! - * - */ -//============================================================================= - ostream & StdMeshers_Arithmetic1D::SaveTo(ostream & save) { - int listSize = _edgeIDs.size(); - save << _begLength << " " << _endLength << " " << listSize; - - if ( listSize > 0 ) { - for ( int i = 0; i < listSize; i++) - save << " " << _edgeIDs[i]; - save << " " << _objEntry; - } - + save << _begLength << " " << _endLength; return save; } @@ -142,25 +120,12 @@ ostream & StdMeshers_Arithmetic1D::SaveTo(ostream & save) istream & StdMeshers_Arithmetic1D::LoadFrom(istream & load) { bool isOK = true; - int intVal; isOK = (load >> _begLength); if (!isOK) load.clear(ios::badbit | load.rdstate()); isOK = (load >> _endLength); - if (!isOK) load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> intVal); - if (isOK && intVal > 0) { - _edgeIDs.reserve( intVal ); - for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) { - isOK = (load >> intVal); - if ( isOK ) _edgeIDs.push_back( intVal ); - } - isOK = (load >> _objEntry); - } - return load; } @@ -244,4 +209,3 @@ bool StdMeshers_Arithmetic1D::SetParametersByDefaults(const TDefaults& dflts, { return ( _begLength = _endLength = dflts._elemLength ); } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_AutomaticLength.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_AutomaticLength.cpp index d77560e0ee..9622f9059d 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_AutomaticLength.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_AutomaticLength.cpp @@ -23,6 +23,7 @@ // File : StdMeshers_AutomaticLength.cxx // Author : Edward AGAPOV, OCC // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_AutomaticLength.cxx,v 1.7.2.1 2008/11/27 13:03:50 abd Exp $ // #include "StdMeshers_AutomaticLength.hxx" @@ -37,11 +38,6 @@ #include #include #include -#include - -#ifndef PI -#define PI M_PI -#endif using namespace std; @@ -88,10 +84,10 @@ const double theCoarseConst = 0.5; const double theFineConst = 4.5; void StdMeshers_AutomaticLength::SetFineness(double theFineness) - throw(SALOME_Exception) + throw(SMESH_Exception) { if ( theFineness < 0.0 || theFineness > 1.0 ) - throw SALOME_Exception(LOCALIZED("theFineness is out of range [0.0-1.0]")); + throw SMESH_Exception(LOCALIZED("theFineness is out of range [0.0-1.0]")); if ( _fineness != theFineness ) { @@ -215,9 +211,9 @@ namespace { double StdMeshers_AutomaticLength::GetLength(const SMESH_Mesh* theMesh, const double theEdgeLength) - throw(SALOME_Exception) + throw(SMESH_Exception) { - if ( !theMesh ) throw SALOME_Exception(LOCALIZED("NULL Mesh")); + if ( !theMesh ) throw SMESH_Exception(LOCALIZED("NULL Mesh")); SMESHDS_Mesh* aMeshDS = const_cast< SMESH_Mesh* > ( theMesh )->GetMeshDS(); if ( theMesh != _mesh ) @@ -237,12 +233,12 @@ double StdMeshers_AutomaticLength::GetLength(const SMESH_Mesh* theMesh, double StdMeshers_AutomaticLength::GetLength(const SMESH_Mesh* theMesh, const TopoDS_Shape& anEdge) - throw(SALOME_Exception) + throw(SMESH_Exception) { - if ( !theMesh ) throw SALOME_Exception(LOCALIZED("NULL Mesh")); + if ( !theMesh ) throw SMESH_Exception(LOCALIZED("NULL Mesh")); if ( anEdge.IsNull() || anEdge.ShapeType() != TopAbs_EDGE ) - throw SALOME_Exception(LOCALIZED("Bad edge shape")); + throw SMESH_Exception(LOCALIZED("Bad edge shape")); if ( theMesh != _mesh ) { @@ -403,5 +399,3 @@ bool StdMeshers_AutomaticLength::SetParametersByDefaults(const TDefaults& /*the // return true; } - - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp index b294f8aa57..188d8b9641 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -56,11 +55,6 @@ #include #include #include -#include - -#ifndef PI -#define PI M_PI -#endif #ifdef _DEBUG_ @@ -156,7 +150,6 @@ class _QuadFaceGrid #else typedef list< _QuadFaceGrid > TChildren; #endif - public: _QuadFaceGrid(); @@ -268,7 +261,7 @@ StdMeshers_CompositeHexa_3D::StdMeshers_CompositeHexa_3D(int hypId, int studyId, :SMESH_3D_Algo(hypId, studyId, gen) { _name = "CompositeHexa_3D"; - _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type } //================================================================================ @@ -524,213 +517,6 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, return true; } - -//======================================================================= -//function : GetNb2d -//purpose : auxilary for Evaluate -//======================================================================= -int GetNb2d(_QuadFaceGrid* QFG, SMESH_Mesh& theMesh, - MapShapeNbElems& aResMap) -{ - int nb2d = 0; - _QuadFaceGrid::TChildIterator aCI = QFG->GetChildren(); - while( aCI.more() ) { - const _QuadFaceGrid& currChild = aCI.next(); - SMESH_subMesh *sm = theMesh.GetSubMesh(currChild.GetFace()); - if( sm ) { - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - } - } - return nb2d; -} - - -//================================================================================ -/*! - * Evaluate - */ -//================================================================================ - -bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape, - MapShapeNbElems& aResMap) -{ - SMESH_MesherHelper aTool(theMesh); - bool _quadraticMesh = aTool.IsQuadraticSubMesh(theShape); - - - // ------------------------- - // Try to find 6 side faces - // ------------------------- - vector< _QuadFaceGrid > boxFaces; boxFaces.reserve( 6 ); - TopExp_Explorer exp; - int iFace, nbFaces = 0; - for ( exp.Init(theShape, TopAbs_FACE); exp.More(); exp.Next(), ++nbFaces ) - { - _QuadFaceGrid f; - if ( !f.Init( TopoDS::Face( exp.Current() ))) - //return error (COMPERR_BAD_SHAPE); - return false; - bool isContinuous = false; - for ( int i=0; i < boxFaces.size() && !isContinuous; ++i ) - isContinuous = boxFaces[ i ].AddContinuousFace( f ); - if ( !isContinuous ) - boxFaces.push_back( f ); - } - // Check what we have - if ( boxFaces.size() != 6 && nbFaces != 6) - //return error - // (COMPERR_BAD_SHAPE, - // SMESH_Comment("Can't find 6 sides of a box. Number of found sides - ")<FindAdjacentForSide( Q_BOTTOM, boxFaces ); - fLeft = fBottom->FindAdjacentForSide( Q_RIGHT, boxFaces ); - fBack = fBottom->FindAdjacentForSide( Q_TOP, boxFaces ); - fRight = fBottom->FindAdjacentForSide( Q_LEFT, boxFaces ); - // check the found - if ( !fFront || !fBack || !fLeft || !fRight ) - //return error(COMPERR_BAD_SHAPE); - return false; - // top face - fTop = 0; - int i = 1; - for(; i < boxFaces.size() && !fTop; ++i ) { - fTop = & boxFaces[ i ]; - if ( fTop==fFront || fTop==fLeft || fTop==fBack || fTop==fRight ) - fTop = 0; - } - // set bottom of the top side - if ( !fTop->SetBottomSide( fFront->GetSide( Q_TOP ) )) { - if ( !fFront->IsComplex() ) - //return error( ERR_LI("Error in StdMeshers_CompositeHexa_3D::Compute()")); - return false; - else { - _QuadFaceGrid::TChildIterator chIt = fFront->GetChildren(); - while ( chIt.more() ) { - const _QuadFaceGrid& frontChild = chIt.next(); - if ( fTop->SetBottomSide( frontChild.GetSide( Q_TOP ))) - break; - } - } - } - if ( !fTop ) - //return error(COMPERR_BAD_SHAPE); - return false; - - - TopTools_SequenceOfShape BottomFaces; - _QuadFaceGrid::TChildIterator aCI = fBottom->GetChildren(); - while( aCI.more() ) { - const _QuadFaceGrid& currChild = aCI.next(); - BottomFaces.Append(currChild.GetFace()); - } - // find boundary edges and internal nodes for bottom face - TopTools_SequenceOfShape BndEdges; - int nb0d_in = 0; - //TopTools_MapOfShape BndEdges; - for(i=1; i<=BottomFaces.Length(); i++) { - for (TopExp_Explorer exp(BottomFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) { - int nb0 = 0; - SMESH_subMesh *sm = theMesh.GetSubMesh(exp.Current()); - if( sm ) { - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb0 = aVec[SMDSEntity_Node]; - } - int j = 1; - for(; j<=BndEdges.Length(); j++) { - if( BndEdges.Value(j) == exp.Current() ) { - // internal edge => remove it - BndEdges.Remove(j); - nb0d_in += nb0; - break; - } - } - if( j > BndEdges.Length() ) { - BndEdges.Append(exp.Current()); - } - //if( BndEdges.Contains(exp.Current()) ) { - //BndEdges.Remove( exp.Current() ); - //} - //else { - //BndEdges.Add( exp.Current() ); - //} - } - } - - // find number of 1d elems for bottom face - int nb1d = 0; - for(i=1; i<=BndEdges.Length(); i++) { - SMESH_subMesh *sm = theMesh.GetSubMesh(BndEdges.Value(i)); - if( sm ) { - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); - } - } - - // find number of 2d elems on side faces - int nb2d = 0; - nb2d += GetNb2d(fFront, theMesh, aResMap); - nb2d += GetNb2d(fRight, theMesh, aResMap); - nb2d += GetNb2d(fBack, theMesh, aResMap); - nb2d += GetNb2d(fLeft, theMesh, aResMap); - - // find number of 2d elems and nodes on bottom faces - int nb0d=0, nb2d_3=0, nb2d_4=0; - for(i=1; i<=BottomFaces.Length(); i++) { - SMESH_subMesh *sm = theMesh.GetSubMesh(BottomFaces.Value(i)); - if( sm ) { - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb0d += aVec[SMDSEntity_Node]; - nb2d_3 += Max(aVec[SMDSEntity_Triangle], aVec[SMDSEntity_Quad_Triangle]); - nb2d_4 += Max(aVec[SMDSEntity_Quadrangle], aVec[SMDSEntity_Quad_Quadrangle]); - } - } - nb0d += nb0d_in; - - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i 0 && myID == Q_PARENT ) { - + #ifdef __BORLANDC__ - list< _FaceSide > aList; aList.clear(); @@ -1667,15 +1452,13 @@ void _FaceSide::SetBottomSide( int i ) list< _FaceSide >::iterator sideEnd, side = myChildren.begin(); std::advance( side, i ); myChildren.splice( myChildren.begin(), myChildren, side, myChildren.end() ); - side = myChildren.begin(), sideEnd = myChildren.end(); for ( int i = 0; side != sideEnd; ++side, ++i ) { side->SetID( EQuadSides(i) ); side->SetBottomSide(i); } - + #endif - } } @@ -1792,7 +1575,7 @@ void _FaceSide::Dump() const #else list< _FaceSide >::const_iterator side = myChildren.begin(), sideEnd = myChildren.end(); #endif - + for ( ; side != sideEnd; ++side ) { side->Dump(); cout << "\t"; diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp index eee3ef0129..4c3d5e1673 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp @@ -24,7 +24,7 @@ // Moved here from SMESH_Regular_1D.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $ // #include "StdMeshers_CompositeSegment_1D.hxx" #include "StdMeshers_FaceSide.hxx" diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Deflection1D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Deflection1D.cpp index 42ad9219a5..6854ed4192 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Deflection1D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Deflection1D.cpp @@ -22,6 +22,7 @@ // SMESH StdMeshers_Deflection1D : implementaion of SMESH idl descriptions // File : StdMeshers_Deflection1D.cxx // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Deflection1D.cxx,v 1.7.2.1 2008/11/27 13:03:49 abd Exp $ // #include "StdMeshers_Deflection1D.hxx" #include "utilities.h" @@ -75,11 +76,11 @@ StdMeshers_Deflection1D::~StdMeshers_Deflection1D() //============================================================================= void StdMeshers_Deflection1D::SetDeflection(double value) - throw(SALOME_Exception) + throw(SMESH_Exception) { if (_value != value) { if (value <= 0.) - throw SALOME_Exception(LOCALIZED("Value must be positive")); + throw SMESH_Exception(LOCALIZED("Value must be positive")); NotifySubMeshesHypothesisModification(); @@ -233,3 +234,4 @@ bool StdMeshers_Deflection1D::SetParametersByDefaults(const TDefaults& /*dflts* { return false; } + diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp index f2e591f342..d185f6b9e7 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp @@ -23,7 +23,7 @@ // File : StdMeshers_Distribution.cxx // Author : Alexandre SOLOVYOV // Module : SMESH -// $Header$ +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Distribution.cxx,v 1.6.2.2 2008/11/27 13:03:50 abd Exp $ // #include "StdMeshers_Distribution.hxx" diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_FaceSide.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_FaceSide.cpp index c677973be2..13cc6b7897 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_FaceSide.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_FaceSide.cpp @@ -52,6 +52,8 @@ #include "utilities.h" +using namespace std; + //================================================================================ /*! * \brief Constructor of a side of one edge @@ -95,7 +97,6 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, myMesh = theMesh; myMissingVertexNodes = false; myIgnoreMediumNodes = theIgnoreMediumNodes; - myDefaultPnt2d = gp_Pnt2d( 1e+100, 1e+100 ); if ( nbEdges == 0 ) return; SMESHDS_Mesh* meshDS = theMesh->GetMeshDS(); @@ -156,34 +157,6 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, //dump(); } -//================================================================================ -/*! - * \brief Constructor of a side for vertex using data from other FaceSide - * \param theVertex - the vertex - * \param theSide - the side - */ -//================================================================================ - -StdMeshers_FaceSide::StdMeshers_FaceSide(const SMDS_MeshNode* theNode, - const gp_Pnt2d thePnt2d, - const StdMeshers_FaceSide* theSide) -{ - myC2d.resize(1); - myLength = 0; - myMesh = theSide->GetMesh(); - myDefaultPnt2d = thePnt2d; - - myPoints = theSide->GetUVPtStruct(); - myNbPonits = myNbSegments = myPoints.size(); - std::vector::iterator it = myPoints.begin(); - for(; it!=myPoints.end(); it++) { - (*it).u = thePnt2d.X(); - (*it).v = thePnt2d.Y(); - (*it).y = 0.0; - (*it).node = theNode; - } -} - //================================================================================ /*! * \brief Return info on nodes on the side @@ -204,7 +177,8 @@ const vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst, map< double, const SMDS_MeshNode*> u2node; //int nbOnDegen = 0; - for ( int i = 0; i < myEdge.size(); ++i ) { + for ( int i = 0; i < myEdge.size(); ++i ) + { // put 1st vertex node TopoDS_Vertex VFirst, VLast; TopExp::Vertices( myEdge[i], VFirst, VLast, true); @@ -212,8 +186,7 @@ const vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst, double prevNormPar = ( i == 0 ? 0 : myNormPar[ i-1 ]); // normalized param if ( node ) { // internal nodes may be missing u2node.insert( make_pair( prevNormPar, node )); - } - else if ( i == 0 ) { + } else if ( i == 0 ) { MESSAGE(" NO NODE on VERTEX" ); return myPoints; } @@ -499,8 +472,7 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const double r = ( U - prevU )/ ( myNormPar[ i ] - prevU ); return myC2d[ i ]->Value( myFirst[i] * ( 1 - r ) + myLast[i] * r ); } - //return gp_Pnt2d( 1e+100, 1e+100 ); - return myDefaultPnt2d; + return gp_Pnt2d( 1e+100, 1e+100 ); } //================================================================================ @@ -541,7 +513,15 @@ TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace, return TSideVector(0); } } - const bool isForward = true; + // find out side orientation, which is important if there are several wires (PAL19080) + bool isForward = true; + if ( nbWires > 1 ) { + TopExp_Explorer e( theFace, TopAbs_EDGE ); + while ( ! e.Current().IsSame( wireEdges.back() )) + e.Next(); + isForward = ( e.Current().Orientation() == wireEdges.back().Orientation() ); + } + StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh, isForward, theIgnoreMediumNodes); wires[ iW ] = StdMeshers_FaceSidePtr( wire ); diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_FixedPoints1D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_FixedPoints1D.cpp deleted file mode 100644 index cd163c09b1..0000000000 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_FixedPoints1D.cpp +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMESH : implementaion of SMESH idl descriptions -// File : StdMeshers_FixedPoints1D.cxx -// Author : Damien COQUERET, OCC -// Module : SMESH -// -#include "StdMeshers_FixedPoints1D.hxx" - -#include "SMESH_Algo.hxx" -#include "SMESH_Mesh.hxx" - -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include - -using namespace std; - -//============================================================================= -/*! - * - */ -//============================================================================= - -StdMeshers_FixedPoints1D::StdMeshers_FixedPoints1D(int hypId, int studyId, - SMESH_Gen * gen) - :SMESH_Hypothesis(hypId, studyId, gen) -{ - _name = "FixedPoints1D"; - _param_algo_dim = 1; - _nbsegs.reserve( 1 ); - _nbsegs.push_back( 1 ); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -StdMeshers_FixedPoints1D::~StdMeshers_FixedPoints1D() -{ -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -void StdMeshers_FixedPoints1D::SetPoints(std::vector& listParams) - throw(SALOME_Exception) -{ - _params = listParams; - NotifySubMeshesHypothesisModification(); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -void StdMeshers_FixedPoints1D::SetNbSegments(std::vector& listNbSeg) - throw(SALOME_Exception) -{ - _nbsegs = listNbSeg; - NotifySubMeshesHypothesisModification(); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -void StdMeshers_FixedPoints1D::SetReversedEdges( std::vector& ids ) -{ - if ( ids != _edgeIDs ) { - _edgeIDs = ids; - - NotifySubMeshesHypothesisModification(); - } -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & StdMeshers_FixedPoints1D::SaveTo(ostream & save) -{ - int listSize = _params.size(); - save << listSize; - if ( listSize > 0 ) { - for ( int i = 0; i < listSize; i++) save << " " << _params[i]; - } - - listSize = _nbsegs.size(); - save << listSize; - if ( listSize > 0 ) { - for ( int i = 0; i < listSize; i++) save << " " << _nbsegs[i]; - } - - listSize = _edgeIDs.size(); - save << listSize; - if ( listSize > 0 ) { - for ( int i = 0; i < listSize; i++) - save << " " << _edgeIDs[i]; - } - - save << " " << _objEntry; - - return save; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load) -{ - bool isOK = true; - int intVal; - double dblVal; - - isOK = (load >> intVal); - if (isOK && intVal > 0) { - _params.reserve( intVal ); - for (int i = 0; i < _params.capacity() && isOK; i++) { - isOK = (load >> dblVal); - if ( isOK ) _params.push_back( dblVal ); - } - } - - isOK = (load >> intVal); - if (isOK && intVal > 0) { - _nbsegs.reserve( intVal ); - for (int i = 0; i < _nbsegs.capacity() && isOK; i++) { - isOK = (load >> intVal); - if ( isOK ) _nbsegs.push_back( intVal ); - } - } - - isOK = (load >> intVal); - if (isOK && intVal > 0) { - _edgeIDs.reserve( intVal ); - for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) { - isOK = (load >> intVal); - if ( isOK ) _edgeIDs.push_back( intVal ); - } - } - - isOK = (load >> _objEntry); - - return load; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & operator <<(ostream & save, StdMeshers_FixedPoints1D & hyp) -{ - return hyp.SaveTo( save ); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & operator >>(istream & load, StdMeshers_FixedPoints1D & hyp) -{ - return hyp.LoadFrom( load ); -} - -//================================================================================ -/*! - * \brief Initialize start and end length by the mesh built on the geometry - * \param theMesh - the built mesh - * \param theShape - the geometry of interest - * \retval bool - true if parameter values have been successfully defined - */ -//================================================================================ - -bool StdMeshers_FixedPoints1D::SetParametersByMesh(const SMESH_Mesh* theMesh, - const TopoDS_Shape& theShape) -{ - if ( !theMesh || theShape.IsNull() ) - return false; - - _nbsegs.reserve( 1 ); - _nbsegs.push_back( 1 ); - return true; -} - -//================================================================================ -/*! - * \brief Initialize my parameter values by default parameters. - * \retval bool - true if parameter values have been successfully defined - */ -//================================================================================ - -bool StdMeshers_FixedPoints1D::SetParametersByDefaults(const TDefaults& dflts, - const SMESH_Mesh* /*mesh*/) -{ - _nbsegs.reserve( 1 ); - _nbsegs.push_back( 1 ); - return true; -} - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Hexa_3D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Hexa_3D.cpp index 42b5488ecd..2a0c7de338 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Hexa_3D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Hexa_3D.cpp @@ -48,23 +48,17 @@ #include #include #include -#include -#include #include #include #include "utilities.h" -#include "Utils_ExceptHandlers.hxx" +#include "SMESH_ExceptHandlers.hxx" typedef SMESH_Comment TComm; using namespace std; -static SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh &, - const TopoDS_Shape &); - -static bool EvaluatePentahedralMesh(SMESH_Mesh &, const TopoDS_Shape &, - MapShapeNbElems &); +static SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh &, const TopoDS_Shape &); //============================================================================= /*! @@ -77,7 +71,7 @@ StdMeshers_Hexa_3D::StdMeshers_Hexa_3D(int hypId, int studyId, SMESH_Gen * gen) { MESSAGE("StdMeshers_Hexa_3D::StdMeshers_Hexa_3D"); _name = "Hexa_3D"; - _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type } //============================================================================= @@ -298,10 +292,10 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, try { aQuads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aFace, _quadraticMesh); if(!aQuads[i]) { - return error( quadAlgo->GetComputeError()); + return error( quadAlgo->GetComputeError()); } } - catch(SALOME_Exception & S_ex) { + catch(SMESH_Exception & S_ex) { return ClearAndReturn( aQuads, error(COMPERR_SLM_EXCEPTION,TComm(S_ex.what()) << " Raised by StdMeshers_Quadrangle_2D " " on face #" << meshDS->ShapeToIndex( aFace ))); @@ -361,7 +355,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, int _indX1 = GetFaceIndex(aMesh, aShape, meshFaces, aCube.V100, aCube.V101, aCube.V110, aCube.V111); - // IPAL21120: SIGSEGV on Meshing attached Compound with Automatic Hexadralization + // IPAL21120: SIGSEGV on Meshing attached Compound with Automatic Hexadralization if ( _indY1 < 1 || _indZ0 < 1 || _indZ1 < 1 || _indX0 < 1 || _indX1 < 1 ) return error(COMPERR_BAD_SHAPE); @@ -374,8 +368,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, // 1.7 - get convertion coefs from face 2D normalized to 3D normalized - Conv2DStruct cx0; // for face X=0 - Conv2DStruct cx1; // for face X=1 + Conv2DStruct cx0; // for face X=0 + Conv2DStruct cx1; // for face X=1 Conv2DStruct cy0; Conv2DStruct cy1; Conv2DStruct cz0; @@ -414,12 +408,12 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, const TopoDS_Face & F = TopoDS::Face(meshFaces[_indX0]->GetSubShape()); faceQuadStruct *quad = aCube.quad_X0; - int i = 0; // j = x/face , k = y/face + int i = 0; // j = x/face , k = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); - + while(itf->more()) { const SMDS_MeshNode * node = itf->next(); if(aTool.IsMedium(node)) @@ -433,8 +427,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic; // j = x/face - int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc; // k = y/face + int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic; // j = x/face + int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -448,7 +442,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_X1; - int i = nbx - 1; // j = x/face , k = y/face + int i = nbx - 1; // j = x/face , k = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -465,8 +459,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic; // j = x/face - int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc; // k = y/face + int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic; // j = x/face + int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -480,7 +474,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_Y0; - int j = 0; // i = x/face , k = y/face + int j = 0; // i = x/face , k = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -497,8 +491,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic; // i = x/face - int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc; // k = y/face + int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic; // i = x/face + int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -512,7 +506,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_Y1; - int j = nby - 1; // i = x/face , k = y/face + int j = nby - 1; // i = x/face , k = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -529,8 +523,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic; // i = x/face - int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc; // k = y/face + int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic; // i = x/face + int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -544,7 +538,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_Z0; - int k = 0; // i = x/face , j = y/face + int k = 0; // i = x/face , j = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -561,8 +555,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic; // i = x/face - int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc; // j = y/face + int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic; // i = x/face + int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc; // j = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -576,7 +570,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_Z1; - int k = nbz - 1; // i = x/face , j = y/face + int k = nbz - 1; // i = x/face , j = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -593,8 +587,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic; // i = x/face - int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc; // j = y/face + int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic; // i = x/face + int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc; // j = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -655,9 +649,9 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, GetPoint(p1yz, nbx - 1, j, k, nbx, nby, nbz, np, meshDS); int ijk = k * nbx * nby + j * nbx + i; - double x = double (i) / double (nbx - 1); // *** seulement - double y = double (j) / double (nby - 1); // *** maillage - double z = double (k) / double (nbz - 1); // *** regulier + double x = double (i) / double (nbx - 1); // *** seulement + double y = double (j) / double (nby - 1); // *** maillage + double z = double (k) / double (nbz - 1); // *** regulier Pt3 X; for (int i = 0; i < 3; i++) { @@ -742,127 +736,6 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, return ClearAndReturn( aQuads, true ); } - -//============================================================================= -/*! - * Evaluate - */ -//============================================================================= - -bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap) -{ - vector < SMESH_subMesh * >meshFaces; - TopTools_SequenceOfShape aFaces; - for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) { - aFaces.Append(exp.Current()); - SMESH_subMesh *aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); - ASSERT(aSubMesh); - meshFaces.push_back(aSubMesh); - } - if (meshFaces.size() != 6) { - //return error(COMPERR_BAD_SHAPE, TComm(meshFaces.size())<<" instead of 6 faces in a block"); - static StdMeshers_CompositeHexa_3D compositeHexa(-10, 0, aMesh.GetGen()); - return compositeHexa.Evaluate(aMesh, aShape, aResMap); - } - - int i = 0; - for(; i<6; i++) { - //TopoDS_Shape aFace = meshFaces[i]->GetSubShape(); - TopoDS_Shape aFace = aFaces.Value(i+1); - SMESH_Algo *algo = _gen->GetAlgo(aMesh, aFace); - if( !algo ) { - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); - return false; - } - string algoName = algo->GetName(); - bool isAllQuad = false; - if (algoName == "Quadrangle_2D") { - MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i]); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); - if( nbtri == 0 ) - isAllQuad = true; - } - if ( ! isAllQuad ) { - return EvaluatePentahedralMesh(aMesh, aShape, aResMap); - } - } - - // find number of 1d elems for 1 face - int nb1d = 0; - TopTools_MapOfShape Edges1; - bool IsQuadratic = false; - bool IsFirst = true; - for (TopExp_Explorer exp(aFaces.Value(1), TopAbs_EDGE); exp.More(); exp.Next()) { - Edges1.Add(exp.Current()); - SMESH_subMesh *sm = aMesh.GetSubMesh(exp.Current()); - if( sm ) { - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); - if(IsFirst) { - IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); - IsFirst = false; - } - } - } - // find face opposite to 1 face - int OppNum = 0; - for(i=2; i<=6; i++) { - bool IsOpposite = true; - for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) { - if( Edges1.Contains(exp.Current()) ) { - IsOpposite = false; - break; - } - } - if(IsOpposite) { - OppNum = i; - break; - } - } - // find number of 2d elems on side faces - int nb2d = 0; - for(i=2; i<=6; i++) { - if( i == OppNum ) continue; - MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] ); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - } - - MapShapeNbElemsItr anIt = aResMap.find( meshFaces[0] ); - std::vector aVec = (*anIt).second; - int nb2d_face0 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - int nb0d_face0 = aVec[SMDSEntity_Node]; - - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iX(); - p[1] = node->Y(); - p[2] = node->Z(); - //MESSAGE(" "<X(); + p[1] = node->Y(); + p[2] = node->Z(); + //MESSAGE(" "<&meshFaces, - const TopoDS_Vertex & V0, - const TopoDS_Vertex & V1, - const TopoDS_Vertex & V2, const TopoDS_Vertex & V3) + const TopoDS_Shape & aShape, + const vector < SMESH_subMesh * >&meshFaces, + const TopoDS_Vertex & V0, + const TopoDS_Vertex & V1, + const TopoDS_Vertex & V2, const TopoDS_Vertex & V3) { - //MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex"); - int faceIndex = -1; - for (int i = 1; i < 6; i++) - { - const TopoDS_Shape & aFace = meshFaces[i]->GetSubShape(); - //const TopoDS_Face& F = TopoDS::Face(aFace); - TopTools_IndexedMapOfShape M; - TopExp::MapShapes(aFace, TopAbs_VERTEX, M); - bool verticesInShape = false; - if (M.Contains(V0)) - if (M.Contains(V1)) - if (M.Contains(V2)) - if (M.Contains(V3)) - verticesInShape = true; - if (verticesInShape) - { - faceIndex = i; - break; - } - } - //IPAL21120 ASSERT(faceIndex > 0); - //SCRUTE(faceIndex); - return faceIndex; + //MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex"); + int faceIndex = -1; + for (int i = 1; i < 6; i++) + { + const TopoDS_Shape & aFace = meshFaces[i]->GetSubShape(); + //const TopoDS_Face& F = TopoDS::Face(aFace); + TopTools_IndexedMapOfShape M; + TopExp::MapShapes(aFace, TopAbs_VERTEX, M); + bool verticesInShape = false; + if (M.Contains(V0)) + if (M.Contains(V1)) + if (M.Contains(V2)) + if (M.Contains(V3)) + verticesInShape = true; + if (verticesInShape) + { + faceIndex = i; + break; + } + } + //IPAL21120 ASSERT(faceIndex > 0); + //SCRUTE(faceIndex); + return faceIndex; } //============================================================================= @@ -925,46 +798,46 @@ int StdMeshers_Hexa_3D::GetFaceIndex(SMESH_Mesh & aMesh, //============================================================================= TopoDS_Edge - StdMeshers_Hexa_3D::EdgeNotInFace(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - const TopoDS_Face & aFace, - const TopoDS_Vertex & aVertex, - const TopTools_IndexedDataMapOfShapeListOfShape & MS) + StdMeshers_Hexa_3D::EdgeNotInFace(SMESH_Mesh & aMesh, + const TopoDS_Shape & aShape, + const TopoDS_Face & aFace, + const TopoDS_Vertex & aVertex, + const TopTools_IndexedDataMapOfShapeListOfShape & MS) { - //MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace"); - TopTools_IndexedDataMapOfShapeListOfShape MF; - TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF); - const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex); - const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex); -// SCRUTE(ancestorsInSolid.Extent()); -// SCRUTE(ancestorsInFace.Extent()); - ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees) - ASSERT(ancestorsInFace.Extent() == 2); + //MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace"); + TopTools_IndexedDataMapOfShapeListOfShape MF; + TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF); + const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex); + const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex); +// SCRUTE(ancestorsInSolid.Extent()); +// SCRUTE(ancestorsInFace.Extent()); + ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees) + ASSERT(ancestorsInFace.Extent() == 2); - TopoDS_Edge E; - E.Nullify(); - TopTools_ListIteratorOfListOfShape its(ancestorsInSolid); - for (; its.More(); its.Next()) - { - TopoDS_Shape ancestor = its.Value(); - TopTools_ListIteratorOfListOfShape itf(ancestorsInFace); - bool isInFace = false; - for (; itf.More(); itf.Next()) - { - TopoDS_Shape ancestorInFace = itf.Value(); - if (ancestorInFace.IsSame(ancestor)) - { - isInFace = true; - break; - } - } - if (!isInFace) - { - E = TopoDS::Edge(ancestor); - break; - } - } - return E; + TopoDS_Edge E; + E.Nullify(); + TopTools_ListIteratorOfListOfShape its(ancestorsInSolid); + for (; its.More(); its.Next()) + { + TopoDS_Shape ancestor = its.Value(); + TopTools_ListIteratorOfListOfShape itf(ancestorsInFace); + bool isInFace = false; + for (; itf.More(); itf.Next()) + { + TopoDS_Shape ancestorInFace = itf.Value(); + if (ancestorInFace.IsSame(ancestor)) + { + isInFace = true; + break; + } + } + if (!isInFace) + { + E = TopoDS::Edge(ancestor); + break; + } + } + return E; } //============================================================================= @@ -974,135 +847,135 @@ TopoDS_Edge //============================================================================= void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad, - const TopoDS_Shape & aShape, - const TopoDS_Vertex & V0, - const TopoDS_Vertex & V1, - const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv) + const TopoDS_Shape & aShape, + const TopoDS_Vertex & V0, + const TopoDS_Vertex & V1, + const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv) { -// MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs"); -// const TopoDS_Face & F = TopoDS::Face(aShape); -// TopoDS_Edge E = quad.edge[0]; -// double f, l; -// Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l); -// TopoDS_Vertex VFirst, VLast; -// TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l -// bool isForward = (((l - f) * (quad.last[0] - quad.first[0])) > 0); +// MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs"); +// const TopoDS_Face & F = TopoDS::Face(aShape); +// TopoDS_Edge E = quad.edge[0]; +// double f, l; +// Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l); +// TopoDS_Vertex VFirst, VLast; +// TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l +// bool isForward = (((l - f) * (quad.last[0] - quad.first[0])) > 0); TopoDS_Vertex VA, VB; -// if (isForward) -// { -// VA = VFirst; -// VB = VLast; -// } -// else -// { -// VA = VLast; -// VB = VFirst; -// } +// if (isForward) +// { +// VA = VFirst; +// VB = VLast; +// } +// else +// { +// VA = VLast; +// VB = VFirst; +// } VA = quad.side[0]->FirstVertex(); VB = quad.side[0]->LastVertex(); - int a1, b1, c1, a2, b2, c2; - if (VA.IsSame(V0)) - if (VB.IsSame(V1)) - { - a1 = 1; - b1 = 0; - c1 = 0; // x - a2 = 0; - b2 = 1; - c2 = 0; // y - } - else - { - ASSERT(VB.IsSame(V3)); - a1 = 0; - b1 = 1; - c1 = 0; // y - a2 = 1; - b2 = 0; - c2 = 0; // x - } - if (VA.IsSame(V1)) - if (VB.IsSame(V2)) - { - a1 = 0; - b1 = -1; - c1 = 1; // 1-y - a2 = 1; - b2 = 0; - c2 = 0; // x - } - else - { - ASSERT(VB.IsSame(V0)); - a1 = -1; - b1 = 0; - c1 = 1; // 1-x - a2 = 0; - b2 = 1; - c2 = 0; // y - } - if (VA.IsSame(V2)) - if (VB.IsSame(V3)) - { - a1 = -1; - b1 = 0; - c1 = 1; // 1-x - a2 = 0; - b2 = -1; - c2 = 1; // 1-y - } - else - { - ASSERT(VB.IsSame(V1)); - a1 = 0; - b1 = -1; - c1 = 1; // 1-y - a2 = -1; - b2 = 0; - c2 = 1; // 1-x - } - if (VA.IsSame(V3)) - if (VB.IsSame(V0)) - { - a1 = 0; - b1 = 1; - c1 = 0; // y - a2 = -1; - b2 = 0; - c2 = 1; // 1-x - } - else - { - ASSERT(VB.IsSame(V2)); - a1 = 1; - b1 = 0; - c1 = 0; // x - a2 = 0; - b2 = -1; - c2 = 1; // 1-y - } -// MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y"); -// MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y"); - conv.a1 = a1; - conv.b1 = b1; - conv.c1 = c1; - conv.a2 = a2; - conv.b2 = b2; - conv.c2 = c2; + int a1, b1, c1, a2, b2, c2; + if (VA.IsSame(V0)) + if (VB.IsSame(V1)) + { + a1 = 1; + b1 = 0; + c1 = 0; // x + a2 = 0; + b2 = 1; + c2 = 0; // y + } + else + { + ASSERT(VB.IsSame(V3)); + a1 = 0; + b1 = 1; + c1 = 0; // y + a2 = 1; + b2 = 0; + c2 = 0; // x + } + if (VA.IsSame(V1)) + if (VB.IsSame(V2)) + { + a1 = 0; + b1 = -1; + c1 = 1; // 1-y + a2 = 1; + b2 = 0; + c2 = 0; // x + } + else + { + ASSERT(VB.IsSame(V0)); + a1 = -1; + b1 = 0; + c1 = 1; // 1-x + a2 = 0; + b2 = 1; + c2 = 0; // y + } + if (VA.IsSame(V2)) + if (VB.IsSame(V3)) + { + a1 = -1; + b1 = 0; + c1 = 1; // 1-x + a2 = 0; + b2 = -1; + c2 = 1; // 1-y + } + else + { + ASSERT(VB.IsSame(V1)); + a1 = 0; + b1 = -1; + c1 = 1; // 1-y + a2 = -1; + b2 = 0; + c2 = 1; // 1-x + } + if (VA.IsSame(V3)) + if (VB.IsSame(V0)) + { + a1 = 0; + b1 = 1; + c1 = 0; // y + a2 = -1; + b2 = 0; + c2 = 1; // 1-x + } + else + { + ASSERT(VB.IsSame(V2)); + a1 = 1; + b1 = 0; + c1 = 0; // x + a2 = 0; + b2 = -1; + c2 = 1; // 1-y + } +// MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y"); +// MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y"); + conv.a1 = a1; + conv.b1 = b1; + conv.c1 = c1; + conv.a2 = a2; + conv.b2 = b2; + conv.c2 = c2; - int nbdown = quad.side[0]->NbPoints(); - int nbright = quad.side[1]->NbPoints(); - conv.ia = int (a1); - conv.ib = int (b1); - conv.ic = - int (c1 * a1 * a1) * (nbdown - 1) + int (c1 * b1 * b1) * (nbright - 1); - conv.ja = int (a2); - conv.jb = int (b2); - conv.jc = - int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1); -// MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic); -// MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc); + int nbdown = quad.side[0]->NbPoints(); + int nbright = quad.side[1]->NbPoints(); + conv.ia = int (a1); + conv.ib = int (b1); + conv.ic = + int (c1 * a1 * a1) * (nbdown - 1) + int (c1 * b1 * b1) * (nbright - 1); + conv.ja = int (a2); + conv.jb = int (b2); + conv.jc = + int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1); +// MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic); +// MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc); } //================================================================================ @@ -1174,7 +1047,6 @@ SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh, } SMESH_Hypothesis::Hypothesis_Status aStatus; if ( aPrism3D->CheckHypothesis( aMesh, aShape, aStatus ) ) { - aPrism3D->InitComputeError(); bOK = aPrism3D->Compute( aMesh, aShape ); err = aPrism3D->GetComputeError(); } @@ -1183,33 +1055,3 @@ SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh, } -//======================================================================= -//function : EvaluatePentahedralMesh -//purpose : -//======================================================================= - -bool EvaluatePentahedralMesh(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap) -{ - StdMeshers_Penta_3D anAlgo; - bool bOK = anAlgo.Evaluate(aMesh, aShape, aResMap); - - //err = anAlgo.GetComputeError(); - //if ( !bOK && anAlgo.ErrorStatus() == 5 ) - if( !bOK ) { - static StdMeshers_Prism_3D * aPrism3D = 0; - if ( !aPrism3D ) { - SMESH_Gen* gen = aMesh.GetGen(); - aPrism3D = new StdMeshers_Prism_3D( gen->GetANewId(), 0, gen ); - } - SMESH_Hypothesis::Hypothesis_Status aStatus; - if ( aPrism3D->CheckHypothesis( aMesh, aShape, aStatus ) ) { - return aPrism3D->Evaluate(aMesh, aShape, aResMap); - } - } - - return bOK; -} - - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution.cpp index 8e5987e6b5..ce120f8612 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution.cpp @@ -23,6 +23,7 @@ // File : StdMeshers_LayerDistribution.cxx // Author : Edward AGAPOV // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LayerDistribution.cxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $ // #include "StdMeshers_LayerDistribution.hxx" @@ -69,11 +70,11 @@ StdMeshers_LayerDistribution::~StdMeshers_LayerDistribution() //============================================================================= void StdMeshers_LayerDistribution::SetLayerDistribution(SMESH_Hypothesis* hyp1D) - throw ( SALOME_Exception ) + throw ( SMESH_Exception ) { if ( myHyp != hyp1D ) { if ( myHyp && hyp1D->GetDim() != 1 ) - throw SALOME_Exception(LOCALIZED("1D hypothesis is expected")); + throw SMESH_Exception(LOCALIZED("1D hypothesis is expected")); myHyp = hyp1D; } std::ostringstream os; @@ -144,6 +145,7 @@ bool StdMeshers_LayerDistribution::SetParametersByMesh(const SMESH_Mesh* , { return false; } + //================================================================================ /*! * \brief Initialize my parameter values by default parameters. diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution2D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution2D.cpp deleted file mode 100644 index 23d039bee4..0000000000 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution2D.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMESH : idl implementation based on 'SMESH' unit's classes -// File : StdMeshers_LayerDistribution2D.cxx -// Author : Edward AGAPOV -// Module : SMESH -// -#include "StdMeshers_LayerDistribution2D.hxx" - -#include "utilities.h" - - -//============================================================================= -/*! - * StdMeshers_LayerDistribution2D::StdMeshers_LayerDistribution2D - * - * Constructor - */ -//============================================================================= - -StdMeshers_LayerDistribution2D::StdMeshers_LayerDistribution2D(int hypId, - int studyId, - SMESH_Gen * gen) - : StdMeshers_LayerDistribution(hypId, studyId, gen) -{ - _name = "LayerDistribution2D"; // used by RadialQuadrangle_1D2D - _param_algo_dim = 2; // 2D - myHyp = 0; -} - -//============================================================================= -/*! - * StdMeshers_LayerDistribution2D::~StdMeshers_LayerDistribution2D - * - * Destructor - */ -//============================================================================= - -StdMeshers_LayerDistribution2D::~StdMeshers_LayerDistribution2D() -{ - MESSAGE( "StdMeshers_LayerDistribution2D::~StdMeshers_LayerDistribution2D" ); -} diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LengthFromEdges.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LengthFromEdges.cpp index cad6e91869..2f6e3c7035 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LengthFromEdges.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LengthFromEdges.cpp @@ -24,6 +24,7 @@ // Moved here from SMESH_LengthFromEdges.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LengthFromEdges.cxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $ // #include "StdMeshers_LengthFromEdges.hxx" @@ -62,11 +63,11 @@ StdMeshers_LengthFromEdges::~StdMeshers_LengthFromEdges() //============================================================================= void StdMeshers_LengthFromEdges::SetMode(int mode) - throw (SALOME_Exception) + throw (SMESH_Exception) { int oldMode = _mode; if (mode <= 0) - throw SALOME_Exception(LOCALIZED("mode must be positive")); + throw SMESH_Exception(LOCALIZED("mode must be positive")); _mode = mode; if (oldMode != _mode) NotifySubMeshesHypothesisModification(); @@ -151,6 +152,7 @@ bool StdMeshers_LengthFromEdges::SetParametersByMesh(const SMESH_Mesh* /*theMesh { return false; } + //================================================================================ /*! * \brief Initialize my parameter values by default parameters. @@ -163,3 +165,4 @@ bool StdMeshers_LengthFromEdges::SetParametersByDefaults(const TDefaults& /*dfl { return true; } + diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LocalLength.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LocalLength.cpp index d52d2de541..54fc1a59f1 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LocalLength.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_LocalLength.cpp @@ -24,8 +24,8 @@ // Moved here from SMESH_LocalLength.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LocalLength.cxx,v 1.8.2.1 2008/11/27 13:03:50 abd Exp $ // - #include "StdMeshers_LocalLength.hxx" #include "SMESH_Mesh.hxx" @@ -77,11 +77,11 @@ StdMeshers_LocalLength::~StdMeshers_LocalLength() */ //============================================================================= -void StdMeshers_LocalLength::SetLength(double length) throw(SALOME_Exception) +void StdMeshers_LocalLength::SetLength(double length) throw(SMESH_Exception) { double oldLength = _length; if (length <= 0) - throw SALOME_Exception(LOCALIZED("length must be positive")); + throw SMESH_Exception(LOCALIZED("length must be positive")); _length = length; const double precision = 1e-7; if (fabs(oldLength - _length) > precision) @@ -104,11 +104,11 @@ double StdMeshers_LocalLength::GetLength() const * */ //============================================================================= -void StdMeshers_LocalLength::SetPrecision (double thePrecision) throw(SALOME_Exception) +void StdMeshers_LocalLength::SetPrecision (double thePrecision) throw(SMESH_Exception) { double oldPrecision = _precision; if (_precision < 0) - throw SALOME_Exception(LOCALIZED("precision cannot be negative")); + throw SMESH_Exception(LOCALIZED("precision cannot be negative")); _precision = thePrecision; const double precision = 1e-8; if (fabs(oldPrecision - _precision) > precision) @@ -234,6 +234,7 @@ bool StdMeshers_LocalLength::SetParametersByMesh(const SMESH_Mesh* theMesh, return nbEdges; } + //================================================================================ /*! * \brief Initialize my parameter values by default parameters. @@ -246,4 +247,3 @@ bool StdMeshers_LocalLength::SetParametersByDefaults(const TDefaults& dflts, { return ( _length = dflts._elemLength ); } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MEFISTO_2D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MEFISTO_2D.cpp index 570602eb4b..2fab2cd137 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MEFISTO_2D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MEFISTO_2D.cpp @@ -24,6 +24,7 @@ // Moved here from SMESH_MEFISTO_2D.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx,v 1.11.2.3 2008/11/27 13:03:49 abd Exp $ // #include "StdMeshers_MEFISTO_2D.hxx" @@ -50,10 +51,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -65,10 +64,6 @@ #include #include -#include -#include -#include - using namespace std; //============================================================================= @@ -197,7 +192,7 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh TError problem; TWireVector wires = StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, problem ); int nbWires = wires.size(); - if ( problem != NULL && !problem->IsOK() ) return error( problem ); + if ( (problem!=NULL) && !problem->IsOK() ) return error( problem ); if ( nbWires == 0 ) return error( "Problem in StdMeshers_FaceSide::GetFaceWires()"); if ( wires[0]->NbSegments() < 3 ) // ex: a circle with 2 segments return error(COMPERR_BAD_INPUT_MESH, @@ -288,90 +283,6 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh return isOk; } - -//============================================================================= -/*! - * - */ -//============================================================================= - -bool StdMeshers_MEFISTO_2D::Evaluate(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap) -{ - MESSAGE("StdMeshers_MEFISTO_2D::Evaluate"); - - TopoDS_Face F = TopoDS::Face(aShape.Oriented(TopAbs_FORWARD)); - - double aLen = 0.0; - int NbSeg = 0; - bool IsQuadratic = false; - bool IsFirst = true; - TopExp_Explorer exp(F,TopAbs_EDGE); - for(; exp.More(); exp.Next()) { - TopoDS_Edge E = TopoDS::Edge(exp.Current()); - MapShapeNbElemsItr anIt = aResMap.find( aMesh.GetSubMesh(E) ); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - int nbe = Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); - NbSeg += nbe; - if(IsFirst) { - IsQuadratic = ( aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge] ); - IsFirst = false; - } - double a,b; - TopLoc_Location L; - Handle(Geom_Curve) C = BRep_Tool::Curve(E,L,a,b); - gp_Pnt P1; - C->D0(a,P1); - double dp = (b-a)/nbe; - for(int i=1; i<=nbe; i++) { - gp_Pnt P2; - C->D0(a+i*dp,P2); - aLen += P1.Distance(P2); - P1 = P2; - } - } - if(NbSeg<1) { - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED, - "Submesh can not be evaluated",this)); - return false; - } - aLen = aLen/NbSeg; // middle length - - _edgeLength = Precision::Infinite(); - double tmpLength = Min( _edgeLength, aLen ); - - GProp_GProps G; - BRepGProp::SurfaceProperties(aShape,G); - double anArea = G.Mass(); - - int nbFaces = Precision::IsInfinite( tmpLength ) ? 0 : - (int)( anArea/(tmpLength*tmpLength*sqrt(3.)/4) ); - int nbNodes = (int) ( nbFaces*3 - (NbSeg-1)*2 ) / 6; - - std::vector aVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i mOnVertex; vector::const_iterator uvPt = uvPtVec.begin(); for ( ++uvPt; uvPt != uvPtVec.end(); ++uvPt ) diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxElementArea.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxElementArea.cpp index 1dce3de1f5..6b7403dddc 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxElementArea.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxElementArea.cpp @@ -24,8 +24,8 @@ // Moved here from SMESH_MaxElementArea.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MaxElementArea.cxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $ // - #include "StdMeshers_MaxElementArea.hxx" #include "SMESH_ControlsDef.hxx" @@ -71,11 +71,11 @@ StdMeshers_MaxElementArea::~StdMeshers_MaxElementArea() //============================================================================= void StdMeshers_MaxElementArea::SetMaxArea(double maxArea) - throw (SALOME_Exception) + throw (SMESH_Exception) { double oldArea = _maxArea; if (maxArea <= 0) - throw SALOME_Exception(LOCALIZED("maxArea must be positive")); + throw SMESH_Exception(LOCALIZED("maxArea must be positive")); _maxArea = maxArea; if (_maxArea != oldArea) NotifySubMeshesHypothesisModification(); @@ -185,6 +185,7 @@ bool StdMeshers_MaxElementArea::SetParametersByMesh(const SMESH_Mesh* theMesh, } return _maxArea > 0; } + //================================================================================ /*! * \brief Initialize my parameter values by default parameters. @@ -197,4 +198,3 @@ bool StdMeshers_MaxElementArea::SetParametersByDefaults(const TDefaults& dflts, { return ( _maxArea = dflts._elemLength*dflts._elemLength ); } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxElementVolume.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxElementVolume.cpp index 79be9d6bc9..9d6cbb5118 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxElementVolume.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxElementVolume.cpp @@ -24,6 +24,7 @@ // Moved here from SMESH_MaxElementVolume.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MaxElementVolume.cxx,v 1.8.2.1 2008/11/27 13:03:50 abd Exp $ // #include "StdMeshers_MaxElementVolume.hxx" @@ -72,11 +73,11 @@ StdMeshers_MaxElementVolume::~StdMeshers_MaxElementVolume() //============================================================================= void StdMeshers_MaxElementVolume::SetMaxVolume(double maxVolume) - throw (SALOME_Exception) + throw (SMESH_Exception) { double oldVolume = _maxVolume; if (maxVolume <= 0) - throw SALOME_Exception(LOCALIZED("maxVolume must be positive")); + throw SMESH_Exception(LOCALIZED("maxVolume must be positive")); _maxVolume = maxVolume; if (_maxVolume != oldVolume) NotifySubMeshesHypothesisModification(); @@ -196,6 +197,7 @@ bool StdMeshers_MaxElementVolume::SetParametersByMesh(const SMESH_Mesh* theMes } return _maxVolume > 0; } + //================================================================================ /*! * \brief Initialize my parameter values by default parameters. @@ -208,4 +210,3 @@ bool StdMeshers_MaxElementVolume::SetParametersByDefaults(const TDefaults& dflt { return ( _maxVolume = dflts._elemLength*dflts._elemLength*dflts._elemLength ); } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxLength.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxLength.cpp index 918fe6c78c..862dd26476 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxLength.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_MaxLength.cpp @@ -74,10 +74,10 @@ StdMeshers_MaxLength::~StdMeshers_MaxLength() */ //============================================================================= -void StdMeshers_MaxLength::SetLength(double length) throw(SALOME_Exception) +void StdMeshers_MaxLength::SetLength(double length) throw(SMESH_Exception) { if (length <= 0) - throw SALOME_Exception(LOCALIZED("length must be positive")); + throw SMESH_Exception(LOCALIZED("length must be positive")); if ( _length != length ) { _length = length; NotifySubMeshesHypothesisModification(); diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NotConformAllowed.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NotConformAllowed.cpp index 66c58f13cc..bba78e43ab 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NotConformAllowed.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NotConformAllowed.cpp @@ -23,6 +23,7 @@ // File : StdMeshers_NotConformAllowed.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NotConformAllowed.cxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $ // #include "StdMeshers_NotConformAllowed.hxx" #include "utilities.h" @@ -111,6 +112,7 @@ bool StdMeshers_NotConformAllowed::SetParametersByMesh(const SMESH_Mesh* /*theMe { return true; } + //================================================================================ /*! * \brief Initialize my parameter values by default parameters. @@ -123,4 +125,3 @@ bool StdMeshers_NotConformAllowed::SetParametersByDefaults(const TDefaults& /*d { return true; } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers.cpp index 8abb02c632..554650b6cf 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers.cpp @@ -23,6 +23,7 @@ // File : StdMeshers_NumberOfLayers.cxx // Author : Edward AGAPOV // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NumberOfLayers.cxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $ // #include "StdMeshers_NumberOfLayers.hxx" @@ -72,11 +73,11 @@ StdMeshers_NumberOfLayers::~StdMeshers_NumberOfLayers() //============================================================================= void StdMeshers_NumberOfLayers::SetNumberOfLayers(int numberOfLayers) - throw ( SALOME_Exception ) + throw ( SMESH_Exception ) { if ( _nbLayers != numberOfLayers ) { if ( numberOfLayers <= 0 ) - throw SALOME_Exception(LOCALIZED("numberOfLayers must be positive")); + throw SMESH_Exception(LOCALIZED("numberOfLayers must be positive")); _nbLayers = numberOfLayers; NotifySubMeshesHypothesisModification(); @@ -174,4 +175,3 @@ bool StdMeshers_NumberOfLayers::SetParametersByDefaults(const TDefaults& dflts, return theMesh ? (_nbLayers = int( theMesh->GetShapeDiagonalSize() / dflts._elemLength/ 2.)) : 0; return false; } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers2D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers2D.cpp deleted file mode 100644 index af2f04dabf..0000000000 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers2D.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMESH : idl implementation based on 'SMESH' unit's classes -// File : StdMeshers_NumberOfLayers2D.cxx -// Author : Edward AGAPOV -// Module : SMESH -// - -#include "StdMeshers_NumberOfLayers2D.hxx" - -#include "utilities.h" - - -//============================================================================= -/*! - * StdMeshers_NumberOfLayers2D::StdMeshers_NumberOfLayers2D - * - * Constructor - */ -//============================================================================= - -StdMeshers_NumberOfLayers2D::StdMeshers_NumberOfLayers2D(int hypId, - int studyId, - SMESH_Gen * gen) - : StdMeshers_NumberOfLayers(hypId, studyId, gen) -{ - _name = "NumberOfLayers2D"; // used by RadialQuadrangle_1D2D - _param_algo_dim = 2; // 2D - _nbLayers = 1; -} - -//============================================================================= -/*! - * StdMeshers_NumberOfLayers2D::~StdMeshers_NumberOfLayers2D - * - * Destructor - */ -//============================================================================= - -StdMeshers_NumberOfLayers2D::~StdMeshers_NumberOfLayers2D() -{ - MESSAGE( "StdMeshers_NumberOfLayers2D::~StdMeshers_NumberOfLayers2D" ); -} - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp index 4991d88a26..b9dd3284b7 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp @@ -24,6 +24,7 @@ // Moved here from SMESH_NumberOfSegments.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NumberOfSegments.cxx,v 1.13.2.1 2008/11/27 13:03:49 abd Exp $ // #include "StdMeshers_NumberOfSegments.hxx" @@ -49,8 +50,6 @@ #include #endif -//#include - using namespace std; const double PRECISION = 1e-7; @@ -91,7 +90,7 @@ StdMeshers_NumberOfSegments::~StdMeshers_NumberOfSegments() //============================================================================= const vector& StdMeshers_NumberOfSegments::BuildDistributionExpr( const char* expr,int nbSeg,int conv ) - throw ( SALOME_Exception ) + throw ( SMESH_Exception ) { if( !buildDistribution( TCollection_AsciiString( ( Standard_CString )expr ), conv, 0.0, 1.0, nbSeg, _distr, 1E-4 ) ) _distr.resize( 0 ); @@ -102,7 +101,7 @@ const vector& StdMeshers_NumberOfSegments::BuildDistributionTab( const vector& tab, int nbSeg, int conv ) - throw ( SALOME_Exception ) + throw ( SMESH_Exception ) { if( !buildDistribution( tab, conv, 0.0, 1.0, nbSeg, _distr, 1E-4 ) ) _distr.resize( 0 ); @@ -116,11 +115,11 @@ StdMeshers_NumberOfSegments::BuildDistributionTab( const vector& tab, //============================================================================= void StdMeshers_NumberOfSegments::SetNumberOfSegments(int segmentsNumber) -throw(SALOME_Exception) +throw(SMESH_Exception) { int oldNumberOfSegments = _numberOfSegments; if (segmentsNumber <= 0) - throw SALOME_Exception(LOCALIZED("number of segments must be positive")); + throw SMESH_Exception(LOCALIZED("number of segments must be positive")); _numberOfSegments = segmentsNumber; if (oldNumberOfSegments != _numberOfSegments) @@ -145,10 +144,10 @@ int StdMeshers_NumberOfSegments::GetNumberOfSegments() const //================================================================================ void StdMeshers_NumberOfSegments::SetDistrType(DistrType typ) - throw(SALOME_Exception) + throw(SMESH_Exception) { if (typ < DT_Regular || typ > DT_ExprFunc) - throw SALOME_Exception(LOCALIZED("distribution type is out of range")); + throw SMESH_Exception(LOCALIZED("distribution type is out of range")); if (typ != _distrType) { @@ -175,15 +174,15 @@ StdMeshers_NumberOfSegments::DistrType StdMeshers_NumberOfSegments::GetDistrType //================================================================================ void StdMeshers_NumberOfSegments::SetScaleFactor(double scaleFactor) - throw(SALOME_Exception) + throw(SMESH_Exception) { if (_distrType != DT_Scale) _distrType = DT_Scale; - //throw SALOME_Exception(LOCALIZED("not a scale distribution")); + //throw SMESH_Exception(LOCALIZED("not a scale distribution")); if (scaleFactor < PRECISION) - throw SALOME_Exception(LOCALIZED("scale factor must be positive")); + throw SMESH_Exception(LOCALIZED("scale factor must be positive")); //if (fabs(scaleFactor - 1.0) < PRECISION) - // throw SALOME_Exception(LOCALIZED("scale factor must not be equal to 1")); + // throw SMESH_Exception(LOCALIZED("scale factor must not be equal to 1")); if (fabs(_scaleFactor - scaleFactor) > PRECISION) { @@ -199,10 +198,10 @@ void StdMeshers_NumberOfSegments::SetScaleFactor(double scaleFactor) //================================================================================ double StdMeshers_NumberOfSegments::GetScaleFactor() const - throw(SALOME_Exception) + throw(SMESH_Exception) { if (_distrType != DT_Scale) - throw SALOME_Exception(LOCALIZED("not a scale distribution")); + throw SMESH_Exception(LOCALIZED("not a scale distribution")); return _scaleFactor; } @@ -213,13 +212,13 @@ double StdMeshers_NumberOfSegments::GetScaleFactor() const //================================================================================ void StdMeshers_NumberOfSegments::SetTableFunction(const vector& table) - throw(SALOME_Exception) + throw(SMESH_Exception) { if (_distrType != DT_TabFunc) _distrType = DT_TabFunc; - //throw SALOME_Exception(LOCALIZED("not a table function distribution")); + //throw SMESH_Exception(LOCALIZED("not a table function distribution")); if ( (table.size() % 2) != 0 ) - throw SALOME_Exception(LOCALIZED("odd size of vector of table function")); + throw SMESH_Exception(LOCALIZED("odd size of vector of table function")); int i; double prev = -PRECISION; @@ -235,22 +234,22 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const vector& table) #ifdef NO_CAS_CATCH OCC_CATCH_SIGNALS; #endif - val = pow( 10.0, val ); + val = pow( 10.0, val ); } catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw SALOME_Exception( LOCALIZED( "invalid value")); - return; + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + throw SMESH_Exception( LOCALIZED( "invalid value")); + return; } } else if( _convMode==1 && val<0.0 ) val = 0.0; if ( par<0 || par > 1) - throw SALOME_Exception(LOCALIZED("parameter of table function is out of range [0,1]")); + throw SMESH_Exception(LOCALIZED("parameter of table function is out of range [0,1]")); if ( fabs(par-prev)PRECISION ) pos = true; if (isSame) @@ -264,7 +263,7 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const vector& table) } if( !pos ) - throw SALOME_Exception(LOCALIZED("value of table function is not positive")); + throw SMESH_Exception(LOCALIZED("value of table function is not positive")); if( pos && !isSame ) { @@ -280,10 +279,10 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const vector& table) //================================================================================ const vector& StdMeshers_NumberOfSegments::GetTableFunction() const - throw(SALOME_Exception) + throw(SMESH_Exception) { if (_distrType != DT_TabFunc) - throw SALOME_Exception(LOCALIZED("not a table function distribution")); + throw SMESH_Exception(LOCALIZED("not a table function distribution")); return _table; } @@ -305,7 +304,7 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr ) if( !name.IsNull() ) { if( name->GetName()!="t" ) - res = false; + res = false; } else res = isCorrectArg( sub ); @@ -319,12 +318,10 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr ) */ //================================================================================ bool process( const TCollection_AsciiString& str, int convMode, - bool& syntax, bool& args, - bool& non_neg, bool& non_zero, - bool& singulars, double& sing_point ) + bool& syntax, bool& args, + bool& non_neg, bool& non_zero, + bool& singulars, double& sing_point ) { - //Kernel_Utils::Localizer loc; - bool parsed_ok = true; Handle( ExprIntrp_GenExp ) myExpr; try { @@ -363,20 +360,19 @@ bool process( const TCollection_AsciiString& str, int convMode, double t = double(i)/double(max), val; if( !f.value( t, val ) ) { - sing_point = t; - singulars = true; - break; + sing_point = t; + singulars = true; + break; } if( val<0 ) { - non_neg = false; - break; + non_neg = false; + break; } if( val>PRECISION ) - non_zero = true; + non_zero = true; } } - return res && non_neg && non_zero && ( !singulars ); } @@ -387,11 +383,11 @@ bool process( const TCollection_AsciiString& str, int convMode, //================================================================================ void StdMeshers_NumberOfSegments::SetExpressionFunction(const char* expr) - throw(SALOME_Exception) + throw(SMESH_Exception) { if (_distrType != DT_ExprFunc) _distrType = DT_ExprFunc; - //throw SALOME_Exception(LOCALIZED("not an expression function distribution")); + //throw SMESH_Exception(LOCALIZED("not an expression function distribution")); // remove white spaces TCollection_AsciiString str((Standard_CString)expr); @@ -406,19 +402,19 @@ void StdMeshers_NumberOfSegments::SetExpressionFunction(const char* expr) if( !res ) { if( !syntax ) - throw SALOME_Exception(LOCALIZED("invalid expression syntax")); + throw SMESH_Exception(LOCALIZED("invalid expression syntax")); if( !args ) - throw SALOME_Exception(LOCALIZED("only 't' may be used as function argument")); + throw SMESH_Exception(LOCALIZED("only 't' may be used as function argument")); if( !non_neg ) - throw SALOME_Exception(LOCALIZED("only non-negative function can be used as density")); + throw SMESH_Exception(LOCALIZED("only non-negative function can be used as density")); if( singulars ) { char buf[1024]; sprintf( buf, "Function has singular point in %.3f", sing_point ); - throw SALOME_Exception( buf ); + throw SMESH_Exception( buf ); } if( !non_zero ) - throw SALOME_Exception(LOCALIZED("f(t)=0 cannot be used as density")); + throw SMESH_Exception(LOCALIZED("f(t)=0 cannot be used as density")); return; } @@ -438,10 +434,10 @@ void StdMeshers_NumberOfSegments::SetExpressionFunction(const char* expr) //================================================================================ const char* StdMeshers_NumberOfSegments::GetExpressionFunction() const - throw(SALOME_Exception) + throw(SMESH_Exception) { if (_distrType != DT_ExprFunc) - throw SALOME_Exception(LOCALIZED("not an expression function distribution")); + throw SMESH_Exception(LOCALIZED("not an expression function distribution")); return _func.c_str(); } @@ -452,10 +448,10 @@ const char* StdMeshers_NumberOfSegments::GetExpressionFunction() const //================================================================================ void StdMeshers_NumberOfSegments::SetConversionMode( int conv ) - throw(SALOME_Exception) + throw(SMESH_Exception) { // if (_distrType != DT_TabFunc && _distrType != DT_ExprFunc) -// throw SALOME_Exception(LOCALIZED("not a functional distribution")); +// throw SMESH_Exception(LOCALIZED("not a functional distribution")); if( conv != _convMode ) { @@ -471,10 +467,10 @@ void StdMeshers_NumberOfSegments::SetConversionMode( int conv ) //================================================================================ int StdMeshers_NumberOfSegments::ConversionMode() const - throw(SALOME_Exception) + throw(SMESH_Exception) { // if (_distrType != DT_TabFunc && _distrType != DT_ExprFunc) -// throw SALOME_Exception(LOCALIZED("not a functional distribution")); +// throw SMESH_Exception(LOCALIZED("not a functional distribution")); return _convMode; } @@ -486,7 +482,6 @@ int StdMeshers_NumberOfSegments::ConversionMode() const ostream & StdMeshers_NumberOfSegments::SaveTo(ostream & save) { - int listSize = _edgeIDs.size(); save << _numberOfSegments << " " << (int)_distrType; switch (_distrType) { @@ -509,13 +504,6 @@ ostream & StdMeshers_NumberOfSegments::SaveTo(ostream & save) if (_distrType == DT_TabFunc || _distrType == DT_ExprFunc) save << " " << _convMode; - - if ( _distrType != DT_Regular && listSize > 0 ) { - save << " " << listSize; - for ( int i = 0; i < listSize; i++ ) - save << " " << _edgeIDs[i]; - save << " " << _objEntry; - } return save; } @@ -632,18 +620,6 @@ istream & StdMeshers_NumberOfSegments::LoadFrom(istream & load) load.clear(ios::badbit | load.rdstate()); } - // load reversed edges IDs - int intVal; - isOK = (load >> intVal); - if ( isOK && _distrType != DT_Regular && intVal > 0 ) { - _edgeIDs.reserve( intVal ); - for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) { - isOK = (load >> intVal); - if ( isOK ) _edgeIDs.push_back( intVal ); - } - isOK = (load >> _objEntry); - } - return load; } @@ -707,6 +683,7 @@ bool StdMeshers_NumberOfSegments::SetParametersByMesh(const SMESH_Mesh* theMes return nbEdges; } + //================================================================================ /*! * \brief Initialize my parameter values by default parameters. @@ -719,19 +696,3 @@ bool StdMeshers_NumberOfSegments::SetParametersByDefaults(const TDefaults& dflt { return (_numberOfSegments = dflts._nbSegments ); } - -//============================================================================= -/*! - * - */ -//============================================================================= - -void StdMeshers_NumberOfSegments::SetReversedEdges( std::vector& ids ) -{ - if ( ids != _edgeIDs ) { - _edgeIDs = ids; - - NotifySubMeshesHypothesisModification(); - } -} - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Penta_3D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Penta_3D.cpp index 7ae2e3a540..47967df375 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Penta_3D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Penta_3D.cpp @@ -26,7 +26,7 @@ #include "StdMeshers_Penta_3D.hxx" #include "utilities.h" -#include "Utils_ExceptHandlers.hxx" +#include "SMESH_ExceptHandlers.hxx" #include "SMDS_EdgePosition.hxx" #include "SMDS_MeshElement.hxx" @@ -46,8 +46,6 @@ #include #include #include -#include -#include #include #include #include @@ -69,7 +67,7 @@ enum { NB_WALL_FACES = 4 }; //purpose : //======================================================================= StdMeshers_Penta_3D::StdMeshers_Penta_3D() - : myErrorStatus(SMESH_ComputeError::New()) +: myErrorStatus(SMESH_ComputeError::New()) { myTol3D=0.1; myWallNodesMaps.resize( SMESH_Block::NbFaces() ); @@ -91,7 +89,7 @@ StdMeshers_Penta_3D::~StdMeshers_Penta_3D() //purpose : //======================================================================= bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape) + const TopoDS_Shape& aShape) { MESSAGE("StdMeshers_Penta_3D::Compute()"); // @@ -262,11 +260,11 @@ void StdMeshers_Penta_3D::MakeNodes() SMESH_Block::TShapeID wallFaceID[ NB_WALL_FACES ] = { SMESH_Block::ID_Fx0z, SMESH_Block::ID_Fx1z, SMESH_Block::ID_F0yz, SMESH_Block::ID_F1yz - }; + }; SMESH_Block::TShapeID baseEdgeID[ NB_WALL_FACES ] = { SMESH_Block::ID_Ex00, SMESH_Block::ID_Ex10, SMESH_Block::ID_E0y0, SMESH_Block::ID_E1y0 - }; + }; for ( i = 0; i < NB_WALL_FACES ; ++i ) { int fIndex = SMESH_Block::ShapeIndex( wallFaceID[ i ]); bool ok = LoadIJNodes (myWallNodesMaps[ fIndex ], @@ -424,7 +422,7 @@ void StdMeshers_Penta_3D::MakeNodes() ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID); if (!myErrorStatus->IsOK()) { MESSAGE("StdMeshers_Penta_3D::MakeNodes() "); - return; + return; } // aTN.SetShapeSupportID(aSSID); @@ -432,13 +430,13 @@ void StdMeshers_Penta_3D::MakeNodes() aTN.SetBaseNodeID(iBNID); // if (aSSID!=SMESH_Block::ID_NONE){ - // try to find the node - const TopoDS_Shape& aS=myBlock.Shape((int)aSSID); - FindNodeOnShape(aS, aCoords, i, aTN); + // try to find the node + const TopoDS_Shape& aS=myBlock.Shape((int)aSSID); + FindNodeOnShape(aS, aCoords, i, aTN); } else{ - // create node and get its id - CreateNode (bIsUpperLayer, aCoords, aTN); + // create node and get it id + CreateNode (bIsUpperLayer, aCoords, aTN); // if ( bIsUpperLayer ) { const SMDS_MeshNode* n = aTN.Node(); @@ -471,12 +469,39 @@ void StdMeshers_Penta_3D::MakeNodes() } if (!myErrorStatus->IsOK()) { MESSAGE("StdMeshers_Penta_3D::MakeNodes() "); - return; + return; } // myTNodes[ij]=aTN; } } + //DEB + /* + { + int iSSID, iBNID, aID; + // + for (i=0; iGetID(); + aX=aNode->X(); + aY=aNode->Y(); + aZ=aNode->Z(); + printf("*** j:%d BNID#%d iSSID:%d ID:%d { %lf %lf %lf }, { %lf %lf %lf }\n", + j, iBNID, iSSID, aID, aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aX, aY, aZ); + } + } + } + */ + //DEB t } @@ -486,9 +511,9 @@ void StdMeshers_Penta_3D::MakeNodes() //======================================================================= void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS, - const gp_XYZ& aParams, + const gp_XYZ& aParams, const int z, - StdMeshers_TNode& aTN) + StdMeshers_TNode& aTN) { double aX, aY, aZ, aD, aTol2, minD; gp_Pnt aP1, aP2; @@ -607,16 +632,16 @@ double StdMeshers_Penta_3D::SetHorizEdgeXYZ(const gp_XYZ& aBase } else { // this variant is better for other cases - // SMESH_MesherHelper helper( *GetMesh() ); - // const TopoDS_Edge & edge = TopoDS::Edge( myBlock.Shape( edgeVec[ TOP ])); - // double u1 = helper.GetNodeU( edge, n1 ); - // double u2 = helper.GetNodeU( edge, n2 ); - // double u = ( 1. - r ) * u1 + r * u2; - // gp_XYZ topNodeParams; - // myBlock.Block().EdgeParameters( edgeVec[ TOP ], u, topNodeParams ); - // myBlock.Block().EdgePoint( edgeVec[ TOP ], - // topNodeParams, - // myShapeXYZ[ edgeVec[ TOP ]]); +// SMESH_MesherHelper helper( *GetMesh() ); +// const TopoDS_Edge & edge = TopoDS::Edge( myBlock.Shape( edgeVec[ TOP ])); +// double u1 = helper.GetNodeU( edge, n1 ); +// double u2 = helper.GetNodeU( edge, n2 ); +// double u = ( 1. - r ) * u1 + r * u2; +// gp_XYZ topNodeParams; +// myBlock.Block().EdgeParameters( edgeVec[ TOP ], u, topNodeParams ); +// myBlock.Block().EdgePoint( edgeVec[ TOP ], +// topNodeParams, +// myShapeXYZ[ edgeVec[ TOP ]]); } // base edge @@ -648,8 +673,8 @@ void StdMeshers_Penta_3D::MakeVolumeMesh() const StdMeshers_TNode& aTN = myTNodes[ij]; aSSID=aTN.ShapeSupportID(); if (aSSID==SMESH_Block::ID_NONE) { - SMDS_MeshNode* aNode = (SMDS_MeshNode*)aTN.Node(); - meshDS->SetNodeInVolume(aNode, shapeID); + SMDS_MeshNode* aNode = (SMDS_MeshNode*)aTN.Node(); + meshDS->SetNodeInVolume(aNode, shapeID); } } } @@ -687,7 +712,7 @@ void StdMeshers_Penta_3D::MakeVolumeMesh() aJ[k] = GetIndexOnLayer(aID0); if (!myErrorStatus->IsOK()) { MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh"); - return; + return; } // ++k; @@ -698,15 +723,15 @@ void StdMeshers_Penta_3D::MakeVolumeMesh() i1=i; i2=i+1; for(j=0; jGetNodes(); aNbNodes = aSM0->NbNodes(); //printf("** aNbNodes=%d\n", aNbNodes); - myTool->SetSubShape( aFxy1 ); // to set medium nodes to aFxy1 + // // set elements on aFxy1 vector aNodes1; @@ -824,7 +849,7 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1() aJ = GetIndexOnLayer(aID0); if (!myErrorStatus->IsOK()) { MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() "); - return; + return; } // ij = aLevel*myJSize + aJ; @@ -846,7 +871,6 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1() } meshDS->SetMeshElementOnShape(face, aFxy1); } - myTool->SetSubShape( myShape ); // update compute state of top face submesh aSubMesh1->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); @@ -913,8 +937,8 @@ void StdMeshers_Penta_3D::MakeConnectingMap() //purpose : //======================================================================= void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer, - const gp_XYZ& aParams, - StdMeshers_TNode& aTN) + const gp_XYZ& aParams, + StdMeshers_TNode& aTN) { double aX, aY, aZ; // @@ -923,15 +947,15 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer, SMDS_MeshNode* pNode=NULL; aTN.SetNode(pNode); // - // if (bIsUpperLayer) { - // // point on face Fxy1 - // const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_Fxy1); - // myBlock.Point(aParams, aS, aP); - // } - // else { - // // point inside solid - // myBlock.Point(aParams, aP); - // } +// if (bIsUpperLayer) { +// // point on face Fxy1 +// const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_Fxy1); +// myBlock.Point(aParams, aS, aP); +// } +// else { +// // point inside solid +// myBlock.Point(aParams, aP); +// } if (bIsUpperLayer) { double u = aParams.X(), v = aParams.Y(); double u1 = ( 1. - u ), v1 = ( 1. - v ); @@ -949,11 +973,11 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer, SMESH_Block::ShellPoint( aParams, myShapeXYZ, aP.ChangeCoord() ); } // - // iErr=myBlock.ErrorStatus(); - // if (iErr) { - // myErrorStatus=12; // can not find the node point; - // return; - // } +// iErr=myBlock.ErrorStatus(); +// if (iErr) { +// myErrorStatus=12; // can not find the node point; +// return; +// } // aX=aP.X(); aY=aP.Y(); aZ=aP.Z(); // @@ -961,7 +985,7 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer, SMESHDS_Mesh* pMeshDS = pMesh->GetMeshDS(); // pNode = pMeshDS->AddNode(aX, aY, aZ); - + aTN.SetNode(pNode); } @@ -970,42 +994,42 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer, //purpose : //======================================================================= void StdMeshers_Penta_3D::ShapeSupportID(const bool bIsUpperLayer, - const SMESH_Block::TShapeID aBNSSID, - SMESH_Block::TShapeID& aSSID) + const SMESH_Block::TShapeID aBNSSID, + SMESH_Block::TShapeID& aSSID) { switch (aBNSSID) { - case SMESH_Block::ID_V000: - aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V001 : SMESH_Block::ID_E00z; - break; - case SMESH_Block::ID_V100: - aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V101 : SMESH_Block::ID_E10z; - break; - case SMESH_Block::ID_V110: - aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V111 : SMESH_Block::ID_E11z; - break; - case SMESH_Block::ID_V010: - aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V011 : SMESH_Block::ID_E01z; - break; - case SMESH_Block::ID_Ex00: - aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex01 : SMESH_Block::ID_Fx0z; - break; - case SMESH_Block::ID_Ex10: - aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex11 : SMESH_Block::ID_Fx1z; - break; - case SMESH_Block::ID_E0y0: - aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E0y1 : SMESH_Block::ID_F0yz; - break; - case SMESH_Block::ID_E1y0: - aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E1y1 : SMESH_Block::ID_F1yz; - break; - case SMESH_Block::ID_Fxy0: - aSSID=SMESH_Block::ID_NONE;//(bIsUpperLayer) ? Shape_ID_Fxy1 : Shape_ID_NONE; - break; - default: - aSSID=SMESH_Block::ID_NONE; - myErrorStatus->myName=10; // Can not find supporting shape ID - myErrorStatus->myComment = "Internal error of StdMeshers_Penta_3D"; - break; + case SMESH_Block::ID_V000: + aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V001 : SMESH_Block::ID_E00z; + break; + case SMESH_Block::ID_V100: + aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V101 : SMESH_Block::ID_E10z; + break; + case SMESH_Block::ID_V110: + aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V111 : SMESH_Block::ID_E11z; + break; + case SMESH_Block::ID_V010: + aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V011 : SMESH_Block::ID_E01z; + break; + case SMESH_Block::ID_Ex00: + aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex01 : SMESH_Block::ID_Fx0z; + break; + case SMESH_Block::ID_Ex10: + aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex11 : SMESH_Block::ID_Fx1z; + break; + case SMESH_Block::ID_E0y0: + aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E0y1 : SMESH_Block::ID_F0yz; + break; + case SMESH_Block::ID_E1y0: + aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E1y1 : SMESH_Block::ID_F1yz; + break; + case SMESH_Block::ID_Fxy0: + aSSID=SMESH_Block::ID_NONE;//(bIsUpperLayer) ? Shape_ID_Fxy1 : Shape_ID_NONE; + break; + default: + aSSID=SMESH_Block::ID_NONE; + myErrorStatus->myName=10; // Can not find supporting shape ID + myErrorStatus->myComment = "Internal error of StdMeshers_Penta_3D"; + break; } return; } @@ -1042,25 +1066,25 @@ void StdMeshers_Penta_3D::MakeBlock() const SMDS_MeshElement * pElement = itf->next(); aElementType = pElement->GetType(); if (aElementType==SMDSAbs_Face) { - iNbNodes = pElement->NbNodes(); - if ( iNbNodes==3 || (pElement->IsQuadratic() && iNbNodes==6) ) { - aFTr = aF; - ++iCnt; - if (iCnt>1) { - // \begin{E.A.} - // The current algorithm fails if there is more that one - // face wich contains triangles ... - // In that case, replace return by break to try another - // method (coded in "if (iCnt != 1) { ... }") - // + iNbNodes = pElement->NbNodes(); + if ( iNbNodes==3 || (pElement->IsQuadratic() && iNbNodes==6) ) { + aFTr = aF; + ++iCnt; + if (iCnt>1) { + // \begin{E.A.} + // The current algorithm fails if there is more that one + // face wich contains triangles ... + // In that case, replace return by break to try another + // method (coded in "if (iCnt != 1) { ... }") + // // MESSAGE("StdMeshers_Penta_3D::MakeBlock() "); - // myErrorStatus=5; // more than one face has triangulation - // return; - break; - // \end{E.A.} - } - break; // next face - } + // myErrorStatus=5; // more than one face has triangulation + // return; + break; + // \end{E.A.} + } + break; // next face + } } } } @@ -1129,85 +1153,85 @@ void StdMeshers_Penta_3D::MakeBlock() int has_only_quad_f6 = 1; // for (i=1; i<=iNbF; ++i) { - int ok = 1; - const TopoDS_Shape& aF = aM(i); - SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF); - SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS(); - SMDS_ElemIteratorPtr itf = aSM->GetElements(); - while(itf->more()) { - const SMDS_MeshElement * pElement = itf->next(); - aElementType = pElement->GetType(); - if (aElementType==SMDSAbs_Face) { - iNbNodes = pElement->NbNodes(); - if ( iNbNodes!=4 ) { - ok = 0; - break ; - } - } - } - if (i==1) has_only_quad_f1 = ok ; - if (i==2) has_only_quad_f2 = ok ; - if (i==3) has_only_quad_f3 = ok ; - if (i==4) has_only_quad_f4 = ok ; - if (i==5) has_only_quad_f5 = ok ; - if (i==6) has_only_quad_f6 = ok ; + int ok = 1; + const TopoDS_Shape& aF = aM(i); + SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF); + SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS(); + SMDS_ElemIteratorPtr itf = aSM->GetElements(); + while(itf->more()) { + const SMDS_MeshElement * pElement = itf->next(); + aElementType = pElement->GetType(); + if (aElementType==SMDSAbs_Face) { + iNbNodes = pElement->NbNodes(); + if ( iNbNodes!=4 ) { + ok = 0; + break ; + } + } + } + if (i==1) has_only_quad_f1 = ok ; + if (i==2) has_only_quad_f2 = ok ; + if (i==3) has_only_quad_f3 = ok ; + if (i==4) has_only_quad_f4 = ok ; + if (i==5) has_only_quad_f5 = ok ; + if (i==6) has_only_quad_f6 = ok ; } // TopTools_IndexedMapOfShape aE; TopExp::MapShapes(myShape, TopAbs_EDGE, aE); int iNbE = aE.Extent(); if (iNbE == 12) { - // - int nb_e01 = pMesh->GetSubMeshContaining(aE(1))->GetSubMeshDS()->NbElements(); - int nb_e02 = pMesh->GetSubMeshContaining(aE(2))->GetSubMeshDS()->NbElements(); - int nb_e03 = pMesh->GetSubMeshContaining(aE(3))->GetSubMeshDS()->NbElements(); - int nb_e04 = pMesh->GetSubMeshContaining(aE(4))->GetSubMeshDS()->NbElements(); - int nb_e05 = pMesh->GetSubMeshContaining(aE(5))->GetSubMeshDS()->NbElements(); - int nb_e06 = pMesh->GetSubMeshContaining(aE(6))->GetSubMeshDS()->NbElements(); - int nb_e07 = pMesh->GetSubMeshContaining(aE(7))->GetSubMeshDS()->NbElements(); - int nb_e08 = pMesh->GetSubMeshContaining(aE(8))->GetSubMeshDS()->NbElements(); - int nb_e09 = pMesh->GetSubMeshContaining(aE(9))->GetSubMeshDS()->NbElements(); - int nb_e10 = pMesh->GetSubMeshContaining(aE(10))->GetSubMeshDS()->NbElements(); - int nb_e11 = pMesh->GetSubMeshContaining(aE(11))->GetSubMeshDS()->NbElements(); - int nb_e12 = pMesh->GetSubMeshContaining(aE(12))->GetSubMeshDS()->NbElements(); - // - int nb_ok = 0 ; - // - if ( (nb_e01==nb_e03) && (nb_e03==nb_e05) && (nb_e05==nb_e07) ) { - if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f3 && has_only_quad_f4 ) { - if ( (nb_e09==nb_e10) && (nb_e08==nb_e06) && (nb_e11==nb_e12) && (nb_e04==nb_e02) ) { - if (nb_f5==nb_f6) { - nb_ok += 1; - aFTr = aM(5); - } - } - } - } - if ( (nb_e02==nb_e04) && (nb_e04==nb_e06) && (nb_e06==nb_e08) ) { - if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f5 && has_only_quad_f6 ) { - if ( (nb_e01==nb_e03) && (nb_e10==nb_e12) && (nb_e05==nb_e07) && (nb_e09==nb_e11) ) { - if (nb_f3==nb_f4) { - nb_ok += 1; - aFTr = aM(3); - } - } - } - } - if ( (nb_e09==nb_e10) && (nb_e10==nb_e11) && (nb_e11==nb_e12) ) { - if ( has_only_quad_f3 && has_only_quad_f4 && has_only_quad_f5 && has_only_quad_f6 ) { - if ( (nb_e01==nb_e05) && (nb_e02==nb_e06) && (nb_e03==nb_e07) && (nb_e04==nb_e08) ) { - if (nb_f1==nb_f2) { - nb_ok += 1; - aFTr = aM(1); - } - } - } - } - // - if ( nb_ok == 1 ) { - isOK = 1; - } - // + // + int nb_e01 = pMesh->GetSubMeshContaining(aE(1))->GetSubMeshDS()->NbElements(); + int nb_e02 = pMesh->GetSubMeshContaining(aE(2))->GetSubMeshDS()->NbElements(); + int nb_e03 = pMesh->GetSubMeshContaining(aE(3))->GetSubMeshDS()->NbElements(); + int nb_e04 = pMesh->GetSubMeshContaining(aE(4))->GetSubMeshDS()->NbElements(); + int nb_e05 = pMesh->GetSubMeshContaining(aE(5))->GetSubMeshDS()->NbElements(); + int nb_e06 = pMesh->GetSubMeshContaining(aE(6))->GetSubMeshDS()->NbElements(); + int nb_e07 = pMesh->GetSubMeshContaining(aE(7))->GetSubMeshDS()->NbElements(); + int nb_e08 = pMesh->GetSubMeshContaining(aE(8))->GetSubMeshDS()->NbElements(); + int nb_e09 = pMesh->GetSubMeshContaining(aE(9))->GetSubMeshDS()->NbElements(); + int nb_e10 = pMesh->GetSubMeshContaining(aE(10))->GetSubMeshDS()->NbElements(); + int nb_e11 = pMesh->GetSubMeshContaining(aE(11))->GetSubMeshDS()->NbElements(); + int nb_e12 = pMesh->GetSubMeshContaining(aE(12))->GetSubMeshDS()->NbElements(); + // + int nb_ok = 0 ; + // + if ( (nb_e01==nb_e03) && (nb_e03==nb_e05) && (nb_e05==nb_e07) ) { + if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f3 && has_only_quad_f4 ) { + if ( (nb_e09==nb_e10) && (nb_e08==nb_e06) && (nb_e11==nb_e12) && (nb_e04==nb_e02) ) { + if (nb_f5==nb_f6) { + nb_ok += 1; + aFTr = aM(5); + } + } + } + } + if ( (nb_e02==nb_e04) && (nb_e04==nb_e06) && (nb_e06==nb_e08) ) { + if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f5 && has_only_quad_f6 ) { + if ( (nb_e01==nb_e03) && (nb_e10==nb_e12) && (nb_e05==nb_e07) && (nb_e09==nb_e11) ) { + if (nb_f3==nb_f4) { + nb_ok += 1; + aFTr = aM(3); + } + } + } + } + if ( (nb_e09==nb_e10) && (nb_e10==nb_e11) && (nb_e11==nb_e12) ) { + if ( has_only_quad_f3 && has_only_quad_f4 && has_only_quad_f5 && has_only_quad_f6 ) { + if ( (nb_e01==nb_e05) && (nb_e02==nb_e06) && (nb_e03==nb_e07) && (nb_e04==nb_e08) ) { + if (nb_f1==nb_f2) { + nb_ok += 1; + aFTr = aM(1); + } + } + } + } + // + if ( nb_ok == 1 ) { + isOK = 1; + } + // } } if (!isOK) { @@ -1260,11 +1284,11 @@ void StdMeshers_Penta_3D::MakeBlock() const TopoDS_Edge& aE=TopoDS::Edge(aEx); TopExp::Vertices(aE, aV[0], aV[1]); for (i=0; i<2; ++i) { - if (!aV[i].IsSame(aV000)) { - aV001=aV[i]; - bFound=!bFound; - break; - } + if (!aV[i].IsSame(aV000)) { + aV001=aV[i]; + bFound=!bFound; + break; + } } } } @@ -1408,7 +1432,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes, SMESHDS_SubMesh* smVft = theMesh->MeshElements( vft ); if (!smFace || !smb || !smt || !sm1 || !sm2 || !smVfb || !smVlb || !smVft ) { MESSAGE( "NULL submesh " <NbNodes() != smt->NbNodes() || sm1->NbNodes() != sm2->NbNodes() ) { @@ -1429,13 +1453,13 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes, int nf = sm1->NbNodes()*smb->NbNodes() - n3*n4; if( nf != smFace->NbNodes() ) { MESSAGE( "Wrong nb face nodes: " << - sm1->NbNodes()<<" "<NbNodes()<<" "<NbNodes()); + sm1->NbNodes()<<" "<NbNodes()<<" "<NbNodes()); return false; } } else { MESSAGE( "Wrong nb face nodes: " << - sm1->NbNodes()<<" "<NbNodes()<<" "<NbNodes()); + sm1->NbNodes()<<" "<NbNodes()<<" "<NbNodes()); return false; } } @@ -1570,7 +1594,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes, } } else if ( (nbFaceNodes==3 || (myCreateQuadratic && nbFaceNodes==6) ) && - n3 == par_nVec_1->second[ row ] ) { + n3 == par_nVec_1->second[ row ] ) { n1 = n3; } else { @@ -1677,8 +1701,8 @@ void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell) //purpose : //======================================================================= void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell, - const TopoDS_Vertex& theV000, - const TopoDS_Vertex& theV001) + const TopoDS_Vertex& theV000, + const TopoDS_Vertex& theV001) { myErrorStatus=0; // @@ -1699,7 +1723,7 @@ void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell, //purpose : //======================================================================= void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt, - gp_XYZ& theXYZ) + gp_XYZ& theXYZ) { ComputeParameters(thePnt, myShell, theXYZ); } @@ -1709,7 +1733,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt, //purpose : //======================================================================= void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt, - const TopoDS_Shape& theShape, + const TopoDS_Shape& theShape, gp_XYZ& theXYZ) { myErrorStatus=0; @@ -1747,7 +1771,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU, return; } if ( SMESH_Block::IsEdgeID( aID )) - bOk = myTBlock.EdgeParameters( aID, theU, theXYZ ); + bOk = myTBlock.EdgeParameters( aID, theU, theXYZ ); if (!bOk) { myErrorStatus=4; // problems with computation Parameters return; @@ -1758,7 +1782,8 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU, //function : Point //purpose : //======================================================================= -void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, gp_Pnt& aP3D) + void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, + gp_Pnt& aP3D) { TopoDS_Shape aS; // @@ -1769,9 +1794,9 @@ void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, gp_Pnt& aP3D) //function : Point //purpose : //======================================================================= -void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, - const TopoDS_Shape& theShape, - gp_Pnt& aP3D) + void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, + const TopoDS_Shape& theShape, + gp_Pnt& aP3D) { myErrorStatus = 0; // @@ -1857,112 +1882,3 @@ const TopoDS_Shape& StdMeshers_SMESHBlock::Shape(const int theID) } -//======================================================================= -//function : Evaluate -//purpose : -//======================================================================= -bool StdMeshers_Penta_3D::Evaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - MapShapeNbElems& aResMap) -{ - MESSAGE("StdMeshers_Penta_3D::Evaluate()"); - - // find face contains only triangles - vector < SMESH_subMesh * >meshFaces; - TopTools_SequenceOfShape aFaces; - int NumBase = 0, i = 0; - for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) { - i++; - aFaces.Append(exp.Current()); - SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); - meshFaces.push_back(aSubMesh); - MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i]); - if( anIt == aResMap.end() ) { - NumBase = 0; - break; - } - std::vector aVec = (*anIt).second; - int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); - int nbqua = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - if( nbtri>0 && nbqua==0 ) { - NumBase = i; - } - } - - if(NumBase==0) { - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; imyName = COMPERR_ALGO_FAILED; - myErrorStatus->myComment = "Submesh can not be evaluated"; - return false; - } - - // find number of 1d elems for base face - int nb1d = 0; - TopTools_MapOfShape Edges1; - for (TopExp_Explorer exp(aFaces.Value(NumBase), TopAbs_EDGE); exp.More(); exp.Next()) { - Edges1.Add(exp.Current()); - SMESH_subMesh *sm = aMesh.GetSubMesh(exp.Current()); - if( sm ) { - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); - } - } - // find face opposite to base face - int OppNum = 0; - for(i=1; i<=6; i++) { - if(i==NumBase) continue; - bool IsOpposite = true; - for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) { - if( Edges1.Contains(exp.Current()) ) { - IsOpposite = false; - break; - } - } - if(IsOpposite) { - OppNum = i; - break; - } - } - // find number of 2d elems on side faces - int nb2d = 0; - for(i=1; i<=6; i++) { - if( i==OppNum || i==NumBase ) continue; - MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] ); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - } - - MapShapeNbElemsItr anIt = aResMap.find( meshFaces[NumBase-1] ); - std::vector aVec = (*anIt).second; - int nb2d_face0 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - int nb0d_face0 = aVec[SMDSEntity_Node]; - - anIt = aResMap.find( meshFaces[OppNum-1] ); - for(i=SMDSEntity_Node; i aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i #include #include -#include -#include #include using namespace std; @@ -368,121 +366,6 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh return true; } - -//======================================================================= -//function : Evaluate -//purpose : -//======================================================================= - -bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape, - MapShapeNbElems& aResMap) -{ - // find face contains only triangles - vector < SMESH_subMesh * >meshFaces; - TopTools_SequenceOfShape aFaces; - int NumBase = 0, i = 0, NbQFs = 0; - for (TopExp_Explorer exp(theShape, TopAbs_FACE); exp.More(); exp.Next()) { - i++; - aFaces.Append(exp.Current()); - SMESH_subMesh *aSubMesh = theMesh.GetSubMesh(exp.Current()); - meshFaces.push_back(aSubMesh); - MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i-1]); - if( anIt==aResMap.end() ) { - SMESH_ComputeErrorPtr& smError = aSubMesh->GetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); - return false; - } - std::vector aVec = (*anIt).second; - int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); - int nbqua = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - if( nbtri==0 && nbqua>0 ) { - NbQFs++; - } - if( nbtri>0 ) { - NumBase = i; - } - } - - if(NbQFs<4) { - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); - return false; - } - - if(NumBase==0) NumBase = 1; // only quads => set 1 faces as base - - // find number of 1d elems for base face - int nb1d = 0; - TopTools_MapOfShape Edges1; - for (TopExp_Explorer exp(aFaces.Value(NumBase), TopAbs_EDGE); exp.More(); exp.Next()) { - Edges1.Add(exp.Current()); - SMESH_subMesh *sm = theMesh.GetSubMesh(exp.Current()); - if( sm ) { - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); - } - } - // find face opposite to base face - int OppNum = 0; - for(i=1; i<=6; i++) { - if(i==NumBase) continue; - bool IsOpposite = true; - for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) { - if( Edges1.Contains(exp.Current()) ) { - IsOpposite = false; - break; - } - } - if(IsOpposite) { - OppNum = i; - break; - } - } - // find number of 2d elems on side faces - int nb2d = 0; - for(i=1; i<=6; i++) { - if( i==OppNum || i==NumBase ) continue; - MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] ); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - } - - MapShapeNbElemsItr anIt = aResMap.find( meshFaces[NumBase-1] ); - std::vector aVec = (*anIt).second; - bool IsQuadratic = (aVec[SMDSEntity_Quad_Triangle]>aVec[SMDSEntity_Triangle]) || - (aVec[SMDSEntity_Quad_Quadrangle]>aVec[SMDSEntity_Quadrangle]); - int nb2d_face0_3 = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); - int nb2d_face0_4 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - int nb0d_face0 = aVec[SMDSEntity_Node]; - int nb1d_face0_int = ( nb2d_face0_3*3 + nb2d_face0_4*4 - nb1d ) / 2; - - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i()<<" ( "<()<<" ( " <()<()<group projection: theShape1 is a group member, - // theShape2 is a group. We find a group theShape1 is in and recall self. - // 2) Accosiate same shapes with different location (partners). - // 3) If vertex association is given, perform accosiation according to shape type: - // switch ( ShapeType ) { - // case TopAbs_EDGE: - // case ...: - // } - // else try to accosiate in different ways: - // a) accosiate shapes by propagation and other simple cases - // switch ( ShapeType ) { - // case TopAbs_EDGE: - // case ...: - // } - // b) find association of a couple of vertices and recall self. - // - - // ================================================================================= - // Is it the case of associating a group member -> another group? (PAL16202, 16203) - // ================================================================================= if ( theShape1.ShapeType() != theShape2.ShapeType() ) { + // is it the case of a group member -> another group? (PAL16202, 16203) TopoDS_Shape group1, group2; if ( theShape1.ShapeType() == TopAbs_COMPOUND ) { group1 = theShape1; @@ -409,31 +387,6 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the } bool bidirect = ( !theShape1.IsSame( theShape2 )); - - // ============ - // Is partner? - // ============ - bool partner = theShape1.IsPartner( theShape2 ); - TopTools_DataMapIteratorOfDataMapOfShapeShape vvIt( theMap ); - for ( ; partner && vvIt.More(); vvIt.Next() ) - partner = vvIt.Key().IsPartner( vvIt.Value() ); - - if ( partner ) // Same shape with different location - { - // recursively associate all subshapes of theShape1 and theShape2 - typedef list< pair< TopoDS_Shape, TopoDS_Shape > > TShapePairsList; - TShapePairsList shapesQueue( 1, make_pair( theShape1, theShape2 )); - TShapePairsList::iterator s1_s2 = shapesQueue.begin(); - for ( ; s1_s2 != shapesQueue.end(); ++s1_s2 ) - { - InsertAssociation( s1_s2->first, s1_s2->second, theMap, bidirect); - TopoDS_Iterator s1It( s1_s2->first), s2It( s1_s2->second ); - for ( ; s1It.More(); s1It.Next(), s2It.Next() ) - shapesQueue.push_back( make_pair( s1It.Value(), s2It.Value() )); - } - return true; - } - if ( !theMap.IsEmpty() ) { //====================================================================== @@ -931,7 +884,6 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the pair step_edge = GetPropagationEdge( theMesh1, edge2, edge1 ); if ( !step_edge.second.IsNull() ) { // propagation found propag_edges.insert( step_edge ); - if ( step_edge.first == 1 ) break; // most close found } } if ( !propag_edges.empty() ) // propagation found @@ -1153,69 +1105,66 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the */ //================================================================================ -int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1, - TopoDS_Vertex VV1[2], - const TopoDS_Face& face2, - TopoDS_Vertex VV2[2], +int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1, + TopoDS_Vertex VV1[2], + const TopoDS_Face& face2, + TopoDS_Vertex VV2[2], list< TopoDS_Edge > & edges1, list< TopoDS_Edge > & edges2) { + edges1.clear(); + edges2.clear(); + list< int > nbVInW1, nbVInW2; - for ( int outer_wire_algo = 0; outer_wire_algo < 2; ++outer_wire_algo ) - { - edges1.clear(); - edges2.clear(); + if ( SMESH_Block::GetOrderedEdges( face1, VV1[0], edges1, nbVInW1) != + SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbVInW2) ) + RETURN_BAD_RESULT("Different number of wires in faces "); - if ( SMESH_Block::GetOrderedEdges( face1, VV1[0], edges1, nbVInW1, outer_wire_algo) != - SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbVInW2, outer_wire_algo) ) - CONT_BAD_RESULT("Different number of wires in faces "); - - if ( nbVInW1.front() != nbVInW2.front() ) - CONT_BAD_RESULT("Different number of edges in faces: " << + if ( nbVInW1.front() != nbVInW2.front() ) + RETURN_BAD_RESULT("Different number of edges in faces: " << nbVInW1.front() << " != " << nbVInW2.front()); - // Define if we need to reverse one of wires to make edges in lists match each other + // Define if we need to reverse one of wires to make edges in lists match each other - bool reverse = false; + bool reverse = false; - list< TopoDS_Edge >::iterator edgeIt; - if ( !VV1[1].IsSame( TopExp::LastVertex( edges1.front(), true ))) { - reverse = true; - edgeIt = --edges1.end(); - // check if the second vertex belongs to the first or last edge in the wire - if ( !VV1[1].IsSame( TopExp::FirstVertex( *edgeIt, true ))) { - bool KO = true; // belongs to none - if ( nbVInW1.size() > 1 ) { // several wires - edgeIt = edges1.begin(); - for ( int i = 1; i < nbVInW1.front(); ++i ) ++edgeIt; - KO = !VV1[1].IsSame( TopExp::FirstVertex( *edgeIt, true )); - } - if ( KO ) - CONT_BAD_RESULT("GetOrderedEdges() failed"); + list< TopoDS_Edge >::iterator eBackIt; + if ( !VV1[1].IsSame( TopExp::LastVertex( edges1.front(), true ))) { + reverse = true; + eBackIt = --edges1.end(); + // check if the second vertex belongs to the first or last edge in the wire + if ( !VV1[1].IsSame( TopExp::FirstVertex( *eBackIt, true ))) { + bool KO = true; // belongs to none + if ( nbVInW1.size() > 1 ) { // several wires + eBackIt = edges1.begin(); + for ( int i = 1; i < nbVInW1.front(); ++i ) ++eBackIt; + KO = !VV1[1].IsSame( TopExp::FirstVertex( *eBackIt, true )); } + if ( KO ) + RETURN_BAD_RESULT("GetOrderedEdges() failed"); } - edgeIt = --edges2.end(); - if ( !VV2[1].IsSame( TopExp::LastVertex( edges2.front(), true ))) { - reverse = !reverse; - // check if the second vertex belongs to the first or last edge in the wire - if ( !VV2[1].IsSame( TopExp::FirstVertex( *edgeIt, true ))) { - bool KO = true; // belongs to none - if ( nbVInW2.size() > 1 ) { // several wires - edgeIt = edges2.begin(); - for ( int i = 1; i < nbVInW2.front(); ++i ) ++edgeIt; - KO = !VV2[1].IsSame( TopExp::FirstVertex( *edgeIt, true )); - } - if ( KO ) - CONT_BAD_RESULT("GetOrderedEdges() failed"); + } + eBackIt = --edges2.end(); + if ( !VV2[1].IsSame( TopExp::LastVertex( edges2.front(), true ))) { + reverse = !reverse; + // check if the second vertex belongs to the first or last edge in the wire + if ( !VV2[1].IsSame( TopExp::FirstVertex( *eBackIt, true ))) { + bool KO = true; // belongs to none + if ( nbVInW2.size() > 1 ) { // several wires + eBackIt = edges2.begin(); + for ( int i = 1; i < nbVInW2.front(); ++i ) ++eBackIt; + KO = !VV2[1].IsSame( TopExp::FirstVertex( *eBackIt, true )); } + if ( KO ) + RETURN_BAD_RESULT("GetOrderedEdges() failed"); } - if ( reverse ) - { - Reverse( edges2 , nbVInW2.front()); - if (( VV1[1].IsSame( TopExp::LastVertex( edges1.front(), true ))) != - ( VV2[1].IsSame( TopExp::LastVertex( edges2.front(), true )))) - CONT_BAD_RESULT("GetOrderedEdges() failed"); - } + } + if ( reverse ) + { + Reverse( edges2 , nbVInW2.front()); + if (( VV1[1].IsSame( TopExp::LastVertex( edges1.front(), true ))) != + ( VV2[1].IsSame( TopExp::LastVertex( edges2.front(), true )))) + RETURN_BAD_RESULT("GetOrderedEdges() failed"); } return nbVInW2.front(); } @@ -1278,7 +1227,7 @@ bool StdMeshers_ProjectionUtils::InsertAssociation( const TopoDS_Shape& theShape return isNew; } else { - throw SALOME_Exception("StdMeshers_ProjectionUtils: attempt to associate NULL shape"); + throw SMESH_Exception("StdMeshers_ProjectionUtils: attempt to associate NULL shape"); } return false; } @@ -2036,7 +1985,7 @@ void StdMeshers_ProjectionUtils::SetEventListener(SMESH_subMesh* subMesh, SMESH_Mesh* srcMesh) { // Set listener that resets an event listener on source submesh when - // "ProjectionSource*D" hypothesis is modified since source shape can be changed + // "ProjectionSource*D" hypothesis is modified subMesh->SetEventListener( GetHypModifWaiter(),0,subMesh); // Set an event listener to submesh of the source shape @@ -2056,16 +2005,13 @@ void StdMeshers_ProjectionUtils::SetEventListener(SMESH_subMesh* subMesh, for (; it.More(); it.Next()) { SMESH_subMesh* srcSM = srcMesh->GetSubMesh( it.Current() ); - if ( srcSM != subMesh ) - { - SMESH_subMeshEventListenerData* data = - srcSM->GetEventListenerData(GetSrcSubMeshListener()); - if ( data ) - data->mySubMeshes.push_back( subMesh ); - else - data = SMESH_subMeshEventListenerData::MakeData( subMesh ); - subMesh->SetEventListener ( GetSrcSubMeshListener(), data, srcSM ); - } + SMESH_subMeshEventListenerData* data = + srcSM->GetEventListenerData(GetSrcSubMeshListener()); + if ( data ) + data->mySubMeshes.push_back( subMesh ); + else + data = SMESH_subMeshEventListenerData::MakeData( subMesh ); + subMesh->SetEventListener ( GetSrcSubMeshListener(), data, srcSM ); } } else diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_1D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_1D.cpp index df55fc2670..4fd7c5d8dc 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_1D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_1D.cpp @@ -372,97 +372,6 @@ bool StdMeshers_Projection_1D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& return true; } - -//======================================================================= -//function : Evaluate -//purpose : -//======================================================================= - -bool StdMeshers_Projection_1D::Evaluate(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape, - MapShapeNbElems& aResMap) -{ - if ( !_sourceHypo ) - return false; - - SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh(); - SMESH_Mesh * tgtMesh = & theMesh; - if ( !srcMesh ) - srcMesh = tgtMesh; - - SMESHDS_Mesh * meshDS = theMesh.GetMeshDS(); - - // --------------------------- - // Make subshapes association - // --------------------------- - - TopoDS_Edge srcEdge, tgtEdge = TopoDS::Edge( theShape.Oriented(TopAbs_FORWARD)); - TopoDS_Shape srcShape = _sourceHypo->GetSourceEdge().Oriented(TopAbs_FORWARD); - - TAssocTool::TShapeShapeMap shape2ShapeMap; - TAssocTool::InitVertexAssociation( _sourceHypo, shape2ShapeMap, tgtEdge ); - if ( !TAssocTool::FindSubShapeAssociation( tgtEdge, tgtMesh, srcShape, srcMesh, - shape2ShapeMap) || - !shape2ShapeMap.IsBound( tgtEdge )) - return error("Vertices association failed" ); - - srcEdge = TopoDS::Edge( shape2ShapeMap( tgtEdge ).Oriented(TopAbs_FORWARD)); -// cout << " srcEdge #" << srcMesh->GetMeshDS()->ShapeToIndex( srcEdge ) -// << " tgtEdge #" << tgtMesh->GetMeshDS()->ShapeToIndex( tgtEdge ) << endl; - - TopoDS_Vertex tgtV[2], srcV[2]; - TopExp::Vertices( tgtEdge, tgtV[0], tgtV[1] ); - TopExp::Vertices( srcEdge, srcV[0], srcV[1] ); - - // ---------------------------------------------- - // Assure that mesh on a source edge is computed - // ---------------------------------------------- - - SMESH_subMesh* srcSubMesh = srcMesh->GetSubMesh( srcEdge ); - //SMESH_subMesh* tgtSubMesh = tgtMesh->GetSubMesh( tgtEdge ); - - if ( tgtMesh == srcMesh ) { - if ( !TAssocTool::MakeComputed( srcSubMesh )) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); - } - else { - if ( !srcSubMesh->IsMeshComputed() ) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); - } - // ----------------------------------------------- - // Find out nodes distribution on the source edge - // ----------------------------------------------- - - double srcLength = EdgeLength( srcEdge ); - double tgtLength = EdgeLength( tgtEdge ); - - vector< double > params; // sorted parameters of nodes on the source edge - if ( !SMESH_Algo::GetNodeParamOnEdge( srcMesh->GetMeshDS(), srcEdge, params )) - return error(COMPERR_BAD_INPUT_MESH,"Bad node parameters on the source edge"); - - int nbNodes = params.size(); - - std::vector aVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetSubMeshDS()->GetElements(); - if ( elemIt->more() ) - quadratic = elemIt->next()->IsQuadratic(); - if(quadratic) - aVec[SMDSEntity_Quad_Edge] = (nbNodes-1)/2; - else - aVec[SMDSEntity_Edge] = nbNodes - 1; - - SMESH_subMesh * sm = theMesh.GetSubMesh(theShape); - aResMap.insert(std::make_pair(sm,aVec)); - - return true; -} - - //============================================================================= /*! * \brief Sets a default event listener to submesh of the source edge diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_2D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_2D.cpp index a433e2dc3a..3457197f5b 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_2D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_2D.cpp @@ -354,103 +354,8 @@ namespace { } // bool getBoundaryNodes() - //================================================================================ - /*! - * \brief Preform projection in case if tgtFace.IsPartner( srcFace ) - * \param tgtFace - target face - * \param srcFace - source face - * \param tgtMesh - target mesh - * \param srcMesh - source mesh - * \retval bool - true if succeeded - */ - //================================================================================ - - bool projectPartner(const TopoDS_Face& tgtFace, - const TopoDS_Face& srcFace, - SMESH_Mesh * tgtMesh, - SMESH_Mesh * srcMesh, - const TAssocTool::TShapeShapeMap& shape2ShapeMap) - { - if ( !tgtFace.IsPartner( srcFace )) - return false; - - // Fill map of src to tgt nodes with nodes on edges - - map src2tgtNodes; - map::iterator srcN_tgtN; - - for ( TopExp_Explorer srcEdge( srcFace, TopAbs_EDGE); srcEdge.More(); srcEdge.Next() ) - { - const TopoDS_Shape& tgtEdge = shape2ShapeMap( srcEdge.Current() ); - if ( !tgtEdge.IsPartner( srcEdge.Current() )) - return false; - - map< double, const SMDS_MeshNode* > srcNodes, tgtNodes; - if ( !SMESH_Algo::GetSortedNodesOnEdge( srcMesh->GetMeshDS(), - TopoDS::Edge( srcEdge.Current() ), - /*ignoreMediumNodes = */true, - srcNodes ) - || - !SMESH_Algo::GetSortedNodesOnEdge( tgtMesh->GetMeshDS(), - TopoDS::Edge( tgtEdge ), - /*ignoreMediumNodes = */true, - tgtNodes ) - || - srcNodes.size() != tgtNodes.size()) - return false; - - map< double, const SMDS_MeshNode* >::iterator u_tn = tgtNodes.begin(); - map< double, const SMDS_MeshNode* >::iterator u_sn = srcNodes.begin(); - for ( ; u_tn != tgtNodes.end(); ++u_tn, ++u_sn) - src2tgtNodes.insert( make_pair( u_sn->second, u_tn->second )); - } - - // Make new faces - - // transformation to get location of target nodes from source ones - gp_Trsf srcTrsf = srcFace.Location(); - gp_Trsf tgtTrsf = tgtFace.Location(); - gp_Trsf trsf = srcTrsf.Inverted() * tgtTrsf; - - // prepare the helper adding quadratic elements if necessary - SMESH_MesherHelper helper( *tgtMesh ); - helper.IsQuadraticSubMesh( tgtFace ); - helper.SetElementsOnShape( true ); - - const SMDS_MeshNode* nullNode = 0; - - SMESHDS_SubMesh* srcSubDS = srcMesh->GetMeshDS()->MeshElements( srcFace ); - SMDS_ElemIteratorPtr elemIt = srcSubDS->GetElements(); - while ( elemIt->more() ) // loop on all mesh faces on srcFace - { - const SMDS_MeshElement* elem = elemIt->next(); - vector< const SMDS_MeshNode* > tgtFaceNodes; - tgtFaceNodes.reserve( elem->NbNodes() ); - SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator(); - while ( nodeIt->more() ) // loop on nodes of the source element - { - const SMDS_MeshNode* srcNode = (const SMDS_MeshNode*) nodeIt->next(); - srcN_tgtN = src2tgtNodes.insert( make_pair( srcNode, nullNode )).first; - if ( srcN_tgtN->second == nullNode ) - { - // create a new node - gp_Pnt tgtP = gp_Pnt(srcNode->X(),srcNode->Y(),srcNode->Z()).Transformed( trsf ); - srcN_tgtN->second = helper.AddNode( tgtP.X(), tgtP.Y(), tgtP.Z() ); - } - tgtFaceNodes.push_back( srcN_tgtN->second ); - } - // create a new face (with reversed orientation) - if ( tgtFaceNodes.size() == 3 ) - helper.AddFace( tgtFaceNodes[0],tgtFaceNodes[2],tgtFaceNodes[1]); - else - helper.AddFace( tgtFaceNodes[0],tgtFaceNodes[3],tgtFaceNodes[2],tgtFaceNodes[1]); - } - return true; - } - } // namespace - //======================================================================= //function : Compute //purpose : @@ -500,10 +405,6 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); } - // try to project from same face with different location - if ( projectPartner( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap )) - return true; - // -------------------- // Prepare to mapping // -------------------- @@ -741,83 +642,6 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& return true; } - -//======================================================================= -//function : Evaluate -//purpose : -//======================================================================= - -bool StdMeshers_Projection_2D::Evaluate(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape, - MapShapeNbElems& aResMap) -{ - if ( !_sourceHypo ) - return false; - - SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh(); - SMESH_Mesh * tgtMesh = & theMesh; - if ( !srcMesh ) - srcMesh = tgtMesh; - - // --------------------------- - // Make subshapes association - // --------------------------- - - TopoDS_Face tgtFace = TopoDS::Face( theShape.Oriented(TopAbs_FORWARD)); - TopoDS_Shape srcShape = _sourceHypo->GetSourceFace().Oriented(TopAbs_FORWARD); - - TAssocTool::TShapeShapeMap shape2ShapeMap; - TAssocTool::InitVertexAssociation( _sourceHypo, shape2ShapeMap, tgtFace ); - if ( !TAssocTool::FindSubShapeAssociation( tgtFace, tgtMesh, srcShape, srcMesh, - shape2ShapeMap) || - !shape2ShapeMap.IsBound( tgtFace )) - return error(COMPERR_BAD_SHAPE,"Topology of source and target faces seems different" ); - - TopoDS_Face srcFace = TopoDS::Face( shape2ShapeMap( tgtFace ).Oriented(TopAbs_FORWARD)); - - // ---------------------------------------------- - // Assure that mesh on a source Face is computed - // ---------------------------------------------- - - SMESH_subMesh* srcSubMesh = srcMesh->GetSubMesh( srcFace ); - - if ( !srcSubMesh->IsMeshComputed() ) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); - - - std::vector aVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetSubMeshDS()->NbNodes(); - - //bool quadratic = false; - SMDS_ElemIteratorPtr elemIt = srcSubMesh->GetSubMeshDS()->GetElements(); - while ( elemIt->more() ) { - const SMDS_MeshElement* E = elemIt->next(); - if( E->NbNodes()==3 ) { - aVec[SMDSEntity_Triangle]++; - } - else if( E->NbNodes()==4 ) { - aVec[SMDSEntity_Quadrangle]++; - } - else if( E->NbNodes()==6 && E->IsQuadratic() ) { - aVec[SMDSEntity_Quad_Triangle]++; - } - else if( E->NbNodes()==8 && E->IsQuadratic() ) { - aVec[SMDSEntity_Quad_Quadrangle]++; - } - else { - aVec[SMDSEntity_Polygon]++; - } - } - - SMESH_subMesh * sm = theMesh.GetSubMesh(theShape); - aResMap.insert(std::make_pair(sm,aVec)); - - return true; -} - - //============================================================================= /*! * \brief Sets a default event listener to submesh of the source face diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_3D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_3D.cpp index d8939feadf..86d6d65d3d 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_3D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Projection_3D.cpp @@ -68,7 +68,7 @@ StdMeshers_Projection_3D::StdMeshers_Projection_3D(int hypId, int studyId, SMESH :SMESH_3D_Algo(hypId, studyId, gen) { _name = "Projection_3D"; - _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit per shape type + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit per shape type _compatibleHypothesis.push_back("ProjectionSource3D"); _sourceHypo = 0; @@ -308,9 +308,9 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS TNodeNodeMap faceMatchingNodes; if ( ! TAssocTool::FindMatchingNodesOnFaces( srcFace, srcMesh, tgtFace, tgtMesh, shape2ShapeMap, faceMatchingNodes )) - return error(COMPERR_BAD_INPUT_MESH,SMESH_Comment("Mesh on faces #") - << srcMeshDS->ShapeToIndex( srcFace ) << " and " - << tgtMeshDS->ShapeToIndex( tgtFace ) << " seems different" ); + return error(COMPERR_BAD_INPUT_MESH,SMESH_Comment("Mesh on faces #") + << srcMeshDS->ShapeToIndex( srcFace ) << " and " + << tgtMeshDS->ShapeToIndex( tgtFace ) << " seems different" ); // put found matching nodes of 2 faces to the global map src2tgtNodeMap.insert( faceMatchingNodes.begin(), faceMatchingNodes.end() ); @@ -420,104 +420,6 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS return true; } - -//======================================================================= -//function : Evaluate -//purpose : -//======================================================================= - -bool StdMeshers_Projection_3D::Evaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - MapShapeNbElems& aResMap) -{ - if ( !_sourceHypo ) - return false; - - SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh(); - SMESH_Mesh * tgtMesh = & aMesh; - if ( !srcMesh ) - srcMesh = tgtMesh; - - // get shell from shape3D - TopoDS_Shell srcShell, tgtShell; - TopExp_Explorer exp( _sourceHypo->GetSource3DShape(), TopAbs_SHELL ); - int nbShell; - for ( nbShell = 0; exp.More(); exp.Next(), ++nbShell ) - srcShell = TopoDS::Shell( exp.Current() ); - if ( nbShell != 1 ) - return error(COMPERR_BAD_SHAPE, - SMESH_Comment("Source shape must have 1 shell but not ") << nbShell); - - exp.Init( aShape, TopAbs_SHELL ); - for ( nbShell = 0; exp.More(); exp.Next(), ++nbShell ) - tgtShell = TopoDS::Shell( exp.Current() ); - if ( nbShell != 1 ) - return error(COMPERR_BAD_SHAPE, - SMESH_Comment("Target shape must have 1 shell but not ") << nbShell); - - // Check that shapes are blocks - if ( TAssocTool::Count( tgtShell, TopAbs_FACE , 1 ) != 6 || - TAssocTool::Count( tgtShell, TopAbs_EDGE , 1 ) != 12 || - TAssocTool::Count( tgtShell, TopAbs_WIRE , 1 ) != 6 ) - return error(COMPERR_BAD_SHAPE, "Target shape is not a block"); - if ( TAssocTool::Count( srcShell, TopAbs_FACE , 1 ) != 6 || - TAssocTool::Count( srcShell, TopAbs_EDGE , 1 ) != 12 || - TAssocTool::Count( srcShell, TopAbs_WIRE , 1 ) != 6 ) - return error(COMPERR_BAD_SHAPE, "Source shape is not a block"); - - // Assure that mesh on a source shape is computed - - SMESH_subMesh* srcSubMesh = srcMesh->GetSubMesh( _sourceHypo->GetSource3DShape() ); - - if ( !srcSubMesh->IsMeshComputed() ) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); - - - std::vector aVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetSubMeshDS()->NbNodes(); - - //bool quadratic = false; - SMDS_ElemIteratorPtr elemIt = srcSubMesh->GetSubMeshDS()->GetElements(); - while ( elemIt->more() ) { - const SMDS_MeshElement* E = elemIt->next(); - if( E->NbNodes()==4 ) { - aVec[SMDSEntity_Tetra]++; - } - else if( E->NbNodes()==5 ) { - aVec[SMDSEntity_Pyramid]++; - } - else if( E->NbNodes()==6 ) { - aVec[SMDSEntity_Penta]++; - } - else if( E->NbNodes()==8 ) { - aVec[SMDSEntity_Hexa]++; - } - else if( E->NbNodes()==10 && E->IsQuadratic() ) { - aVec[SMDSEntity_Quad_Tetra]++; - } - else if( E->NbNodes()==13 && E->IsQuadratic() ) { - aVec[SMDSEntity_Quad_Pyramid]++; - } - else if( E->NbNodes()==15 && E->IsQuadratic() ) { - aVec[SMDSEntity_Quad_Penta]++; - } - else if( E->NbNodes()==20 && E->IsQuadratic() ) { - aVec[SMDSEntity_Quad_Hexa]++; - } - else { - aVec[SMDSEntity_Polyhedra]++; - } - } - - SMESH_subMesh * sm = aMesh.GetSubMesh(aShape); - aResMap.insert(std::make_pair(sm,aVec)); - - return true; -} - - //============================================================================= /*! * \brief Sets a default event listener to submesh of the source shape diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp index 50eef649d1..24557ab271 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp @@ -47,11 +47,7 @@ typedef NCollection_Array1 StdMeshers_Array1OfSequenc #include typedef SMESH_Array1 StdMeshers_Array1OfSequenceOfInteger; #endif -#include -#ifndef PI -#define PI M_PI -#endif //======================================================================= //function : StdMeshers_QuadToTriaAdaptor diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadrangleParams.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadrangleParams.cpp deleted file mode 100644 index ad3fee8419..0000000000 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadrangleParams.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SMESH SMESH : implementaion of SMESH idl descriptions -// File : StdMeshers_QuadrangleParams.cxx -// Author : Sergey KUUL, OCC -// Module : SMESH -// -#include "StdMeshers_QuadrangleParams.hxx" - -#include "SMESH_Algo.hxx" -#include "SMESH_Mesh.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -//============================================================================= -/*! - * - */ -//============================================================================= - -StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId, - SMESH_Gen * gen) - :SMESH_Hypothesis(hypId, studyId, gen) -{ - _name = "QuadrangleParams"; - _param_algo_dim = 2; - _triaVertexID = -1; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -StdMeshers_QuadrangleParams::~StdMeshers_QuadrangleParams() -{ -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -void StdMeshers_QuadrangleParams::SetTriaVertex(int id) -{ - if ( id != _triaVertexID ) { - _triaVertexID = id; - NotifySubMeshesHypothesisModification(); - } -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save) -{ - save << _triaVertexID << " " << _objEntry; - return save; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load) -{ - bool isOK = true; - isOK = (load >> _triaVertexID); - if (!isOK) - load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> _objEntry); - - return load; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp) -{ - return hyp.SaveTo( save ); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp) -{ - return hyp.LoadFrom( load ); -} - -//================================================================================ -/*! - * \brief Redifined method - * \param theMesh - the built mesh - * \param theShape - the geometry of interest - * \retval bool - true if parameter values have been successfully defined - */ -//================================================================================ - -bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh, - const TopoDS_Shape& theShape) -{ - if ( !theMesh || theShape.IsNull() ) - return false; - - return true; -} - -//================================================================================ -/*! - * \brief Initialize my parameter values by default parameters. - * \retval bool - true if parameter values have been successfully defined - */ -//================================================================================ - -bool StdMeshers_QuadrangleParams::SetParametersByDefaults(const TDefaults& dflts, - const SMESH_Mesh* /*mesh*/) -{ - return true; -} - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadranglePreference.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadranglePreference.cpp index cf3986e38a..b78c95bd4a 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadranglePreference.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadranglePreference.cpp @@ -22,7 +22,8 @@ // SMESH StdMeshers_QuadranglePreference : implementaion of SMESH idl descriptions // File : StdMeshers_QuadranglePreference.cxx // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_QuadranglePreference.cxx,v 1.4.2.1 2008/11/27 13:03:50 abd Exp $ +// #include "StdMeshers_QuadranglePreference.hxx" #include "utilities.h" @@ -125,4 +126,3 @@ bool StdMeshers_QuadranglePreference::SetParametersByDefaults(const TDefaults& { return false; } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp index 4d1fd89179..79f02d85b7 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp @@ -19,18 +19,17 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// SMESH SMESH : implementaion of SMESH idl descriptions + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Quadrangle_2D.cxx // Moved here from SMESH_Quadrangle_2D.cxx // Author : Paul RASCLE, EDF // Module : SMESH +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx,v 1.14.2.5 2008/11/27 13:03:49 abd Exp $ // #include "StdMeshers_Quadrangle_2D.hxx" #include "StdMeshers_FaceSide.hxx" -#include "StdMeshers_QuadrangleParams.hxx" - #include "SMESH_Gen.hxx" #include "SMESH_Mesh.hxx" #include "SMESH_subMesh.hxx" @@ -46,13 +45,6 @@ #include #include #include - -#ifndef __BORLANDC__ -#include -#else -#include -#endif - #include #include #include @@ -60,8 +52,16 @@ #include #include +#ifndef __BORLANDC__ +#include +#else +#include +#endif + #include "utilities.h" -#include "Utils_ExceptHandlers.hxx" +#include "SMESH_ExceptHandlers.hxx" + +#include #ifndef StdMeshers_Array2OfNode_HeaderFile #define StdMeshers_Array2OfNode_HeaderFile @@ -89,14 +89,12 @@ typedef SMESH_Comment TComm; */ //============================================================================= -StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, - SMESH_Gen* gen) +StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, SMESH_Gen* gen) : SMESH_2D_Algo(hypId, studyId, gen) { MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D"); _name = "Quadrangle_2D"; _shapeType = (1 << TopAbs_FACE); - _compatibleHypothesis.push_back("QuadrangleParams"); _compatibleHypothesis.push_back("QuadranglePreference"); _compatibleHypothesis.push_back("TrianglePreference"); myTool = 0; @@ -127,69 +125,25 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis bool isOk = true; aStatus = SMESH_Hypothesis::HYP_OK; - const list &hyps = - GetUsedHypothesis(aMesh, aShape, false); + + const list &hyps = GetUsedHypothesis(aMesh, aShape, false); const SMESHDS_Hypothesis *theHyp = 0; - if( hyps.size() == 1 ) { - myTriaVertexID = -1; - theHyp = hyps.front(); - if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) { - const StdMeshers_QuadrangleParams* theHyp1 = - (const StdMeshers_QuadrangleParams*)theHyp; - myTriaVertexID = theHyp1->GetTriaVertex(); - myQuadranglePreference= false; - myTrianglePreference= false; - } + if(hyps.size() > 0){ + theHyp = *hyps.begin(); if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) { myQuadranglePreference= true; myTrianglePreference= false; - myTriaVertexID = -1; } else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){ myQuadranglePreference= false; myTrianglePreference= true; - myTriaVertexID = -1; } } - - else if( hyps.size() > 1 ) { - theHyp = hyps.front(); - if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) { - const StdMeshers_QuadrangleParams* theHyp1 = - (const StdMeshers_QuadrangleParams*)theHyp; - myTriaVertexID = theHyp1->GetTriaVertex(); - theHyp = hyps.back(); - if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) { - myQuadranglePreference= true; - myTrianglePreference= false; - } - else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){ - myQuadranglePreference= false; - myTrianglePreference= true; - } - } - else { - if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) { - myQuadranglePreference= true; - myTrianglePreference= false; - } - else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){ - myQuadranglePreference= false; - myTrianglePreference= true; - } - const StdMeshers_QuadrangleParams* theHyp2 = - (const StdMeshers_QuadrangleParams*)hyps.back(); - myTriaVertexID = theHyp2->GetTriaVertex(); - } - } - else { myQuadranglePreference = false; myTrianglePreference = false; - myTriaVertexID = -1; } - return isOk; } @@ -200,7 +154,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis //============================================================================= bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape)// throw (SALOME_Exception) + const TopoDS_Shape& aShape)// throw (SMESH_Exception) { // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside //Unexpect aCatchSalomeException); @@ -297,10 +251,15 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, b = quad->uv_grid[j * nbhoriz + i + 1].node; c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node; d = quad->uv_grid[(j + 1) * nbhoriz + i].node; - SMDS_MeshFace* face = myTool->AddFace(a, b, c, d); - if(face) { - meshDS->SetMeshElementOnShape(face, geomFaceID); - } + //SMDS_MeshFace* face = myTool->AddFace(a, b, c, d); + //meshDS->SetMeshElementOnShape(face, geomFaceID); + if(!myTrianglePreference){ + SMDS_MeshFace* face = myTool->AddFace(a, b, c, d); + meshDS->SetMeshElementOnShape(face, geomFaceID); + } + else { + SplitQuad(meshDS, geomFaceID, a, b, c, d); + } } } @@ -374,8 +333,9 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, } if (near == g) { // make triangle + //SMDS_MeshFace* face = meshDS->AddFace(a, b, c); SMDS_MeshFace* face = myTool->AddFace(a, b, c); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } else { // make quadrangle if (near - 1 < ilow) @@ -386,7 +346,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, if(!myTrianglePreference){ SMDS_MeshFace* face = myTool->AddFace(a, b, c, d); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } else { SplitQuad(meshDS, geomFaceID, a, b, c, d); @@ -400,8 +360,9 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, d = uv_e3[1].node; else d = quad->uv_grid[nbhoriz + k - 1].node; + //SMDS_MeshFace* face = meshDS->AddFace(a, c, d); SMDS_MeshFace* face = myTool->AddFace(a, c, d); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } } g = near; @@ -462,8 +423,9 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, } if (near == g) { // make triangle + //SMDS_MeshFace* face = meshDS->AddFace(a, b, c); SMDS_MeshFace* face = myTool->AddFace(a, b, c); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } else { // make quadrangle if (near + 1 > iup) @@ -473,7 +435,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, //SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); if(!myTrianglePreference){ SMDS_MeshFace* face = myTool->AddFace(a, b, c, d); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } else { SplitQuad(meshDS, geomFaceID, a, b, c, d); @@ -486,8 +448,9 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, d = uv_e1[nbright - 2].node; else d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node; + //SMDS_MeshFace* face = meshDS->AddFace(a, c, d); SMDS_MeshFace* face = myTool->AddFace(a, c, d); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } } g = near; @@ -534,8 +497,9 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, } if (near == g) { // make triangle + //SMDS_MeshFace* face = meshDS->AddFace(a, b, c); SMDS_MeshFace* face = myTool->AddFace(a, b, c); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } else { // make quadrangle if (near - 1 < jlow) @@ -546,7 +510,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, if(!myTrianglePreference){ SMDS_MeshFace* face = myTool->AddFace(a, b, c, d); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } else { SplitQuad(meshDS, geomFaceID, a, b, c, d); @@ -559,8 +523,9 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, d = uv_e0[nbdown - 2].node; else d = quad->uv_grid[nbhoriz*k - 2].node; + //SMDS_MeshFace* face = meshDS->AddFace(a, c, d); SMDS_MeshFace* face = myTool->AddFace(a, c, d); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } } g = near; @@ -604,8 +569,9 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, } if (near == g) { // make triangle + //SMDS_MeshFace* face = meshDS->AddFace(a, b, c); SMDS_MeshFace* face = myTool->AddFace(a, b, c); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } else { // make quadrangle if (near + 1 > jup) @@ -615,7 +581,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, //SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); if(!myTrianglePreference){ SMDS_MeshFace* face = myTool->AddFace(a, b, c, d); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } else { SplitQuad(meshDS, geomFaceID, a, b, c, d); @@ -628,8 +594,9 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, d = uv_e2[1].node; else d = quad->uv_grid[nbhoriz*(k + 1) + 1].node; + //SMDS_MeshFace* face = meshDS->AddFace(a, c, d); SMDS_MeshFace* face = myTool->AddFace(a, c, d); - if(face) meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } } g = near; @@ -642,101 +609,6 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, return isOk; } - -//============================================================================= -/*! - * Evaluate - */ -//============================================================================= - -bool StdMeshers_Quadrangle_2D::Evaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - MapShapeNbElems& aResMap) - -{ - aMesh.GetSubMesh(aShape); - - std::vector aNbNodes(4); - bool IsQuadratic = false; - if( !CheckNbEdgesForEvaluate( aMesh, aShape, aResMap, aNbNodes, IsQuadratic ) ) { - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); - return false; - } - - if(myQuadranglePreference) { - int n1 = aNbNodes[0]; - int n2 = aNbNodes[1]; - int n3 = aNbNodes[2]; - int n4 = aNbNodes[3]; - int nfull = n1+n2+n3+n4; - int ntmp = nfull/2; - ntmp = ntmp*2; - if( nfull==ntmp && ( (n1!=n3) || (n2!=n4) ) ) { - // special path for using only quandrangle faces - return EvaluateQuadPref(aMesh, aShape, aNbNodes, aResMap, IsQuadratic); - //return true; - } - } - - int nbdown = aNbNodes[0]; - int nbup = aNbNodes[2]; - - int nbright = aNbNodes[1]; - int nbleft = aNbNodes[3]; - - int nbhoriz = Min(nbdown, nbup); - int nbvertic = Min(nbright, nbleft); - - int dh = Max(nbdown, nbup) - nbhoriz; - int dv = Max(nbright, nbleft) - nbvertic; - - //int kdh = 0; - //if(dh>0) kdh = 1; - //int kdv = 0; - //if(dv>0) kdv = 1; - - int nbNodes = (nbhoriz-2)*(nbvertic-2); - //int nbFaces3 = dh + dv + kdh*(nbvertic-1)*2 + kdv*(nbhoriz-1)*2; - int nbFaces3 = dh + dv; - //if( kdh==1 && kdv==1 ) nbFaces3 -= 2; - //if( dh>0 && dv>0 ) nbFaces3 -= 2; - //int nbFaces4 = (nbhoriz-1-kdh)*(nbvertic-1-kdv); - int nbFaces4 = (nbhoriz-1)*(nbvertic-1); - - std::vector aVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i::iterator edgeIt = edges.begin(); - if ( nbEdgesInWire.front() == 3 ) { // exactly 3 edges - if(myTriaVertexID>0) { - SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); - TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID)); - if(!V.IsNull()) { - TopoDS_Edge E1,E2,E3; - for(; edgeIt != edges.end(); ++edgeIt) { - TopoDS_Edge E = TopoDS::Edge(*edgeIt); - TopoDS_Vertex VF, VL; - TopExp::Vertices(E, VF, VL, true); - if( VF.IsSame(V) ) - E1 = E; - else if( VL.IsSame(V) ) - E3 = E; - else - E2 = E; - } - quad->side.reserve(4); - quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes)); - quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes)); - quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false, ignoreMediumNodes)); - std::vector UVPSleft = quad->side[0]->GetUVPtStruct(true,0); - std::vector UVPStop = quad->side[1]->GetUVPtStruct(false,1); - std::vector UVPSright = quad->side[2]->GetUVPtStruct(true,1); - const SMDS_MeshNode* aNode = UVPSleft[0].node; - gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v ); - StdMeshers_FaceSide* VertFS = - new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1]); - quad->side.push_back(VertFS); - return quad; - } - } - return 0; - } - else if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges + if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges for ( ; edgeIt != edges.end(); ++edgeIt, nbSides++ ) quad->side.push_back( new StdMeshers_FaceSide(F, *edgeIt, &aMesh, nbSides& aNbNodes, - bool& IsQuadratic) - -{ - const TopoDS_Face & F = TopoDS::Face(aShape); - - // verify 1 wire only, with 4 edges - TopoDS_Vertex V; - list< TopoDS_Edge > edges; - list< int > nbEdgesInWire; - int nbWire = SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire); - if (nbWire != 1) { - return false; - } - - aNbNodes.resize(4); - - int nbSides = 0; - list< TopoDS_Edge >::iterator edgeIt = edges.begin(); - SMESH_subMesh * sm = aMesh.GetSubMesh( *edgeIt ); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if(anIt==aResMap.end()) { - return false; - } - std::vector aVec = (*anIt).second; - IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); - if ( nbEdgesInWire.front() == 3 ) { // exactly 3 edges - if(myTriaVertexID>0) { - SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); - TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID)); - if(!V.IsNull()) { - TopoDS_Edge E1,E2,E3; - for(; edgeIt != edges.end(); ++edgeIt) { - TopoDS_Edge E = TopoDS::Edge(*edgeIt); - TopoDS_Vertex VF, VL; - TopExp::Vertices(E, VF, VL, true); - if( VF.IsSame(V) ) - E1 = E; - else if( VL.IsSame(V) ) - E3 = E; - else - E2 = E; - } - SMESH_subMesh * sm = aMesh.GetSubMesh(E1); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if(anIt==aResMap.end()) return false; - std::vector aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[0] = (aVec[SMDSEntity_Node]-1)/2 + 2; - else - aNbNodes[0] = aVec[SMDSEntity_Node] + 2; - sm = aMesh.GetSubMesh(E2); - anIt = aResMap.find(sm); - if(anIt==aResMap.end()) return false; - aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[1] = (aVec[SMDSEntity_Node]-1)/2 + 2; - else - aNbNodes[1] = aVec[SMDSEntity_Node] + 2; - sm = aMesh.GetSubMesh(E3); - anIt = aResMap.find(sm); - if(anIt==aResMap.end()) return false; - aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[2] = (aVec[SMDSEntity_Node]-1)/2 + 2; - else - aNbNodes[2] = aVec[SMDSEntity_Node] + 2; - aNbNodes[3] = aNbNodes[1]; - aNbNodes.resize(5); - nbSides = 4; - } - } - } - if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges - for(; edgeIt != edges.end(); edgeIt++) { - SMESH_subMesh * sm = aMesh.GetSubMesh( *edgeIt ); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if(anIt==aResMap.end()) { - return false; - } - std::vector aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[nbSides] = (aVec[SMDSEntity_Node]-1)/2 + 2; - else - aNbNodes[nbSides] = aVec[SMDSEntity_Node] + 2; - nbSides++; - } - } - else if ( nbEdgesInWire.front() > 4 ) { // more than 4 edges - try to unite some - list< TopoDS_Edge > sideEdges; - while ( !edges.empty()) { - sideEdges.clear(); - sideEdges.splice( sideEdges.end(), edges, edges.begin()); // edges.front() -> sideEdges.end() - bool sameSide = true; - while ( !edges.empty() && sameSide ) { - sameSide = SMESH_Algo::IsContinuous( sideEdges.back(), edges.front() ); - if ( sameSide ) - sideEdges.splice( sideEdges.end(), edges, edges.begin()); - } - if ( nbSides == 0 ) { // go backward from the first edge - sameSide = true; - while ( !edges.empty() && sameSide ) { - sameSide = SMESH_Algo::IsContinuous( sideEdges.front(), edges.back() ); - if ( sameSide ) - sideEdges.splice( sideEdges.begin(), edges, --edges.end()); - } - } - list::iterator ite = sideEdges.begin(); - aNbNodes[nbSides] = 1; - for(; ite!=sideEdges.end(); ite++) { - SMESH_subMesh * sm = aMesh.GetSubMesh( *ite ); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if(anIt==aResMap.end()) { - return false; - } - std::vector aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; - else - aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; - } - ++nbSides; - } - // issue 20222. Try to unite only edges shared by two same faces - if (nbSides < 4) { - nbSides = 0; - SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire); - while ( !edges.empty()) { - sideEdges.clear(); - sideEdges.splice( sideEdges.end(), edges, edges.begin()); - bool sameSide = true; - while ( !edges.empty() && sameSide ) { - sameSide = - SMESH_Algo::IsContinuous( sideEdges.back(), edges.front() ) && - twoEdgesMeatAtVertex( sideEdges.back(), edges.front(), aMesh ); - if ( sameSide ) - sideEdges.splice( sideEdges.end(), edges, edges.begin()); - } - if ( nbSides == 0 ) { // go backward from the first edge - sameSide = true; - while ( !edges.empty() && sameSide ) { - sameSide = - SMESH_Algo::IsContinuous( sideEdges.front(), edges.back() ) && - twoEdgesMeatAtVertex( sideEdges.front(), edges.back(), aMesh ); - if ( sameSide ) - sideEdges.splice( sideEdges.begin(), edges, --edges.end()); - } - } - list::iterator ite = sideEdges.begin(); - aNbNodes[nbSides] = 1; - for(; ite!=sideEdges.end(); ite++) { - SMESH_subMesh * sm = aMesh.GetSubMesh( *ite ); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if(anIt==aResMap.end()) { - return false; - } - std::vector aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; - else - aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; - } - ++nbSides; - } - } - } - if (nbSides != 4) { - if ( !nbSides ) - nbSides = nbEdgesInWire.front(); - error(COMPERR_BAD_SHAPE, TComm("Face must have 4 sides but not ") << nbSides); - return false; - } - - return true; -} - - //============================================================================= /*! * CheckAnd2Dcompute @@ -1101,7 +752,7 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute (SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, - const bool CreateQuadratic) //throw(SALOME_Exception) + const bool CreateQuadratic) //throw(SMESH_Exception) { _quadraticMesh = CreateQuadratic; @@ -1154,7 +805,7 @@ namespace { bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh, const TopoDS_Shape& aShape, - FaceQuadStruct* & quad) //throw (SALOME_Exception) + FaceQuadStruct* & quad) //throw (SMESH_Exception) { // Algorithme décrit dans "Génération automatique de maillages" // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85 @@ -1230,15 +881,17 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh, } // normalized 2d values on grid - for (int i = 0; i < nbhoriz; i++) { - for (int j = 0; j < nbvertic; j++) { + for (int i = 0; i < nbhoriz; i++) + { + for (int j = 0; j < nbvertic; j++) + { int ij = j * nbhoriz + i; // --- droite i cste : x = x0 + y(x1-x0) - double x0 = uv_e0[i].normParam; // bas - sud - double x1 = uv_e2[i].normParam; // haut - nord + double x0 = uv_e0[i].normParam; // bas - sud + double x1 = uv_e2[i].normParam; // haut - nord // --- droite j cste : y = y0 + x(y1-y0) - double y0 = uv_e3[j].normParam; // gauche-ouest - double y1 = uv_e1[j].normParam; // droite - est + double y0 = uv_e3[j].normParam; // gauche-ouest + double y1 = uv_e1[j].normParam; // droite - est // --- intersection : x=x0+(y0+x(y1-y0))(x1-x0) double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0)); double y = y0 + x * (y1 - y0); @@ -1255,8 +908,10 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh, gp_UV a2( uv_e2.back().u, uv_e2.back().v ); gp_UV a3( uv_e2.front().u, uv_e2.front().v ); - for (int i = 0; i < nbhoriz; i++) { - for (int j = 0; j < nbvertic; j++) { + for (int i = 0; i < nbhoriz; i++) + { + for (int j = 0; j < nbvertic; j++) + { int ij = j * nbhoriz + i; double x = uv_grid[ij].x; double y = uv_grid[ij].y; @@ -1334,6 +989,7 @@ static gp_UV CalcUV(double x0, double x1, double y0, double y1, return uv; } + //======================================================================= //function : CalcUV2 //purpose : auxilary function for ComputeQuadPref @@ -1369,7 +1025,6 @@ static gp_UV CalcUV2(double x, double y, return uv; } - //======================================================================= /*! * Create only quandrangle faces @@ -1457,7 +1112,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, // 0 top 1 // 1------------1 // | |____| | - // | / \ | + // |L / \ R| // | / C \ | // left |/________\| rigth // | | @@ -1589,13 +1244,13 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, SMDS_MeshFace* F = myTool->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j), NodesL.Value(i+1,j+1), NodesL.Value(i,j+1)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } else { SMDS_MeshFace* F = myTool->AddFace(NodesL.Value(i,j), NodesL.Value(i,j+1), NodesL.Value(i+1,j+1), NodesL.Value(i+1,j)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } } } @@ -1652,13 +1307,13 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, SMDS_MeshFace* F = myTool->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j), NodesR.Value(i+1,j+1), NodesR.Value(i,j+1)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } else { SMDS_MeshFace* F = myTool->AddFace(NodesR.Value(i,j), NodesR.Value(i,j+1), NodesR.Value(i+1,j+1), NodesR.Value(i+1,j)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } } } @@ -1730,13 +1385,13 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, SMDS_MeshFace* F = myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j), NodesC.Value(i+1,j+1), NodesC.Value(i,j+1)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } else { SMDS_MeshFace* F = myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1), NodesC.Value(i+1,j+1), NodesC.Value(i+1,j)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } } } @@ -1764,24 +1419,23 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, } } - int nbf=0; for(j=1; jAddFace(NodesBRD.Value(i,j), NodesBRD.Value(i+1,j), NodesBRD.Value(i+1,j+1), NodesBRD.Value(i,j+1)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } else { SMDS_MeshFace* F = myTool->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i,j+1), NodesBRD.Value(i+1,j+1), NodesBRD.Value(i+1,j)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } } } + int drl = abs(nr-nl); // create faces for region C StdMeshers_Array2OfNode NodesC(1,nb,1,drl+1+addv); @@ -1880,18 +1534,17 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, // create faces for(j=1; j<=drl+addv; j++) { for(i=1; iAddFace(NodesC.Value(i,j), NodesC.Value(i+1,j), NodesC.Value(i+1,j+1), NodesC.Value(i,j+1)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } else { SMDS_MeshFace* F = myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1), NodesC.Value(i+1,j+1), NodesC.Value(i+1,j)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } } } // end nrAddFace(NodesLast.Value(i,1), NodesLast.Value(i+1,1), NodesLast.Value(i+1,2), NodesLast.Value(i,2)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } else { SMDS_MeshFace* F = myTool->AddFace(NodesLast.Value(i,1), NodesLast.Value(i,2), NodesLast.Value(i+1,2), NodesLast.Value(i+1,2)); - if(F) meshDS->SetMeshElementOnShape(F, geomFaceID); + meshDS->SetMeshElementOnShape(F, geomFaceID); } } } // if( (drl+addv) > 0 ) @@ -1936,140 +1588,6 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, return isOk; } - -//======================================================================= -/*! - * Evaluate only quandrangle faces - */ -//======================================================================= - -bool StdMeshers_Quadrangle_2D::EvaluateQuadPref(SMESH_Mesh & aMesh, - const TopoDS_Shape& aShape, - std::vector& aNbNodes, - MapShapeNbElems& aResMap, - bool IsQuadratic) -{ - // Auxilary key in order to keep old variant - // of meshing after implementation new variant - // for bug 0016220 from Mantis. - bool OldVersion = false; - - const TopoDS_Face& F = TopoDS::Face(aShape); - Handle(Geom_Surface) S = BRep_Tool::Surface(F); - - int nb = aNbNodes[0]; - int nr = aNbNodes[1]; - int nt = aNbNodes[2]; - int nl = aNbNodes[3]; - int dh = abs(nb-nt); - int dv = abs(nr-nl); - - if( dh>=dv ) { - if( nt>nb ) { - // it is a base case => not shift - } - else { - // we have to shift on 2 - nb = aNbNodes[2]; - nr = aNbNodes[3]; - nt = aNbNodes[0]; - nl = aNbNodes[1]; - } - } - else { - if( nr>nl ) { - // we have to shift quad on 1 - nb = aNbNodes[3]; - nr = aNbNodes[0]; - nt = aNbNodes[1]; - nl = aNbNodes[2]; - } - else { - // we have to shift quad on 3 - nb = aNbNodes[1]; - nr = aNbNodes[2]; - nt = aNbNodes[3]; - nl = aNbNodes[0]; - } - } - - dh = abs(nb-nt); - dv = abs(nr-nl); - int nbh = Max(nb,nt); - int nbv = Max(nr,nl); - int addh = 0; - int addv = 0; - - if(dh>dv) { - addv = (dh-dv)/2; - nbv = nbv + addv; - } - else { // dv>=dh - addh = (dv-dh)/2; - nbh = nbh + addh; - } - - int dl,dr; - if(OldVersion) { - // add some params to right and left after the first param - // insert to right - dr = nbv - nr; - // insert to left - dl = nbv - nl; - } - - int nnn = Min(nr,nl); - - int nbNodes = 0; - int nbFaces = 0; - if(OldVersion) { - // step1: create faces for left domain - if(dl>0) { - nbNodes += dl*(nl-1); - nbFaces += dl*(nl-1); - } - // step2: create faces for right domain - if(dr>0) { - nbNodes += dr*(nr-1); - nbFaces += dr*(nr-1); - } - // step3: create faces for central domain - nbNodes += (nb-2)*(nnn-1) + (nbv-nnn-1)*(nb-2); - nbFaces += (nb-1)*(nbv-1); - } - else { // New version (!OldVersion) - nbNodes += (nnn-2)*(nb-2); - nbFaces += (nnn-2)*(nb-1); - int drl = abs(nr-nl); - nbNodes += drl*(nb-1) + addv*nb; - nbFaces += (drl+addv)*(nb-1) + (nt-1); - } // end new version implementation - - std::vector aVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iX(),theNode3->Y(),theNode3->Z()); gp_Pnt d(theNode4->X(),theNode4->Y(),theNode4->Z()); SMDS_MeshFace* face; - if(a.Distance(c) > b.Distance(d)){ - face = myTool->AddFace(theNode2, theNode4 , theNode1); - if(face) theMeshDS->SetMeshElementOnShape(face, theFaceID ); + Standard_Real d1 = a.Distance(c); + Standard_Real d2 = b.Distance(d); + Standard_Real d3 = d2 - d1; + if(abs(d3) < gp::Resolution() || d1 > d2){ + face = myTool->AddFace(theNode2, theNode4, theNode1); + theMeshDS->SetMeshElementOnShape(face, theFaceID ); face = myTool->AddFace(theNode2, theNode3, theNode4); - if(face) theMeshDS->SetMeshElementOnShape(face, theFaceID ); - + theMeshDS->SetMeshElementOnShape(face, theFaceID ); } - else{ + else + { face = myTool->AddFace(theNode1, theNode2 ,theNode3); - if(face) theMeshDS->SetMeshElementOnShape(face, theFaceID ); + theMeshDS->SetMeshElementOnShape(face, theFaceID ); face = myTool->AddFace(theNode1, theNode3, theNode4); - if(face) theMeshDS->SetMeshElementOnShape(face, theFaceID ); + theMeshDS->SetMeshElementOnShape(face, theFaceID ); } } - - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadraticMesh.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadraticMesh.cpp index 4764356f25..4518f55f29 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadraticMesh.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadraticMesh.cpp @@ -22,7 +22,8 @@ // SMESH StdMeshers_QuadraticMesh : implementaion of SMESH idl descriptions // File : StdMeshers_QuadraticMesh.cxx // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_QuadraticMesh.cxx,v 1.4.2.1 2008/11/27 13:03:49 abd Exp $ +// #include "StdMeshers_QuadraticMesh.hxx" #include "utilities.h" @@ -120,4 +121,3 @@ bool StdMeshers_QuadraticMesh::SetParametersByDefaults(const TDefaults& /*dflts { return false; } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_RadialPrism_3D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_RadialPrism_3D.cpp index fb6cc94e1a..133b681605 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_RadialPrism_3D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_RadialPrism_3D.cpp @@ -45,12 +45,10 @@ #include #include #include -#include #include #include #include #include -#include #include #include @@ -388,171 +386,3 @@ bool StdMeshers_RadialPrism_3D::computeLayerPositions(const gp_Pnt& pIn, } RETURN_BAD_RESULT("Bad hypothesis"); } - - -//======================================================================= -//function : Evaluate -//purpose : -//======================================================================= - -bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - MapShapeNbElems& aResMap) -{ - // get 2 shells - TopoDS_Solid solid = TopoDS::Solid( aShape ); - TopoDS_Shell outerShell = BRepTools::OuterShell( solid ); - TopoDS_Shape innerShell; - int nbShells = 0; - for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells ) - if ( !outerShell.IsSame( It.Value() )) - innerShell = It.Value(); - if ( nbShells != 2 ) { - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); - return false; - } - - // Associate subshapes of the shells - TAssocTool::TShapeShapeMap shape2ShapeMap; - if ( !TAssocTool::FindSubShapeAssociation( outerShell, &aMesh, - innerShell, &aMesh, - shape2ShapeMap) ) { - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); - return false; - } - - // get info for outer shell - int nb0d_Out=0, nb2d_3_Out=0, nb2d_4_Out=0; - //TopTools_SequenceOfShape FacesOut; - for (TopExp_Explorer exp(outerShell, TopAbs_FACE); exp.More(); exp.Next()) { - //FacesOut.Append(exp.Current()); - SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); - MapShapeNbElemsItr anIt = aResMap.find(aSubMesh); - std::vector aVec = (*anIt).second; - nb0d_Out += aVec[SMDSEntity_Node]; - nb2d_3_Out += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); - nb2d_4_Out += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - } - int nb1d_Out = 0; - TopTools_MapOfShape tmpMap; - for (TopExp_Explorer exp(outerShell, TopAbs_EDGE); exp.More(); exp.Next()) { - if( tmpMap.Contains( exp.Current() ) ) - continue; - tmpMap.Add( exp.Current() ); - SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); - MapShapeNbElemsItr anIt = aResMap.find(aSubMesh); - std::vector aVec = (*anIt).second; - nb0d_Out += aVec[SMDSEntity_Node]; - nb1d_Out += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); - } - tmpMap.Clear(); - for (TopExp_Explorer exp(outerShell, TopAbs_VERTEX); exp.More(); exp.Next()) { - if( tmpMap.Contains( exp.Current() ) ) - continue; - tmpMap.Add( exp.Current() ); - nb0d_Out++; - } - - // get info for inner shell - int nb0d_In=0, nb2d_3_In=0, nb2d_4_In=0; - //TopTools_SequenceOfShape FacesIn; - for (TopExp_Explorer exp(innerShell, TopAbs_FACE); exp.More(); exp.Next()) { - //FacesIn.Append(exp.Current()); - SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); - MapShapeNbElemsItr anIt = aResMap.find(aSubMesh); - std::vector aVec = (*anIt).second; - nb0d_In += aVec[SMDSEntity_Node]; - nb2d_3_In += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); - nb2d_4_In += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); - } - int nb1d_In = 0; - tmpMap.Clear(); - bool IsQuadratic = false; - bool IsFirst = true; - for (TopExp_Explorer exp(innerShell, TopAbs_EDGE); exp.More(); exp.Next()) { - if( tmpMap.Contains( exp.Current() ) ) - continue; - tmpMap.Add( exp.Current() ); - SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); - MapShapeNbElemsItr anIt = aResMap.find(aSubMesh); - std::vector aVec = (*anIt).second; - nb0d_In += aVec[SMDSEntity_Node]; - nb1d_In += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); - if(IsFirst) { - IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); - IsFirst = false; - } - } - tmpMap.Clear(); - for (TopExp_Explorer exp(innerShell, TopAbs_VERTEX); exp.More(); exp.Next()) { - if( tmpMap.Contains( exp.Current() ) ) - continue; - tmpMap.Add( exp.Current() ); - nb0d_In++; - } - - bool IsOK = (nb0d_Out==nb0d_In) && (nb1d_Out==nb1d_In) && - (nb2d_3_Out==nb2d_3_In) && (nb2d_4_Out==nb2d_4_In); - if(!IsOK) { - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); - return false; - } - - int nbLayers = 0; - if( myNbLayerHypo ) { - nbLayers = myNbLayerHypo->GetNumberOfLayers(); - } - if ( myDistributionHypo ) { - if ( !myDistributionHypo->GetLayerDistribution() ) { - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iGetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); - return false; - } - TopExp_Explorer exp(outerShell, TopAbs_VERTEX); - TopoDS_Vertex Vout = TopoDS::Vertex(exp.Current()); - TopoDS_Vertex Vin = TopoDS::Vertex( shape2ShapeMap(Vout) ); - if ( myLayerPositions.empty() ) { - gp_Pnt pIn = BRep_Tool::Pnt(Vin); - gp_Pnt pOut = BRep_Tool::Pnt(Vout); - computeLayerPositions( pIn, pOut ); - } - nbLayers = myLayerPositions.size() + 1; - } - - std::vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef PI -#define PI M_PI -#endif - - -using namespace std; - -#define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; } -#define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z()) - -//typedef StdMeshers_ProjectionUtils TAssocTool; - - -//======================================================================= -//function : StdMeshers_RadialQuadrangle_1D2D -//purpose : -//======================================================================= - -StdMeshers_RadialQuadrangle_1D2D::StdMeshers_RadialQuadrangle_1D2D(int hypId, - int studyId, - SMESH_Gen* gen) - :SMESH_2D_Algo(hypId, studyId, gen) -{ - _name = "RadialQuadrangle_1D2D"; - _shapeType = (1 << TopAbs_FACE); // 1 bit per shape type - - _compatibleHypothesis.push_back("LayerDistribution2D"); - _compatibleHypothesis.push_back("NumberOfLayers2D"); - myNbLayerHypo = 0; - myDistributionHypo = 0; - _requireDescretBoundary = false; -} - - -//================================================================================ -/*! - * \brief Destructor - */ -//================================================================================ - -StdMeshers_RadialQuadrangle_1D2D::~StdMeshers_RadialQuadrangle_1D2D() -{} - - -//======================================================================= -//function : CheckHypothesis -//purpose : -//======================================================================= - -bool StdMeshers_RadialQuadrangle_1D2D::CheckHypothesis - (SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - SMESH_Hypothesis::Hypothesis_Status& aStatus) -{ - // check aShape - myNbLayerHypo = 0; - myDistributionHypo = 0; - - list ::const_iterator itl; - - const list &hyps = GetUsedHypothesis(aMesh, aShape); - if ( hyps.size() == 0 ) { - aStatus = SMESH_Hypothesis::HYP_MISSING; - return false; // can't work with no hypothesis - } - - if ( hyps.size() > 1 ) { - aStatus = SMESH_Hypothesis::HYP_ALREADY_EXIST; - return false; - } - - const SMESHDS_Hypothesis *theHyp = hyps.front(); - - string hypName = theHyp->GetName(); - - if (hypName == "NumberOfLayers2D") { - myNbLayerHypo = static_cast(theHyp); - aStatus = SMESH_Hypothesis::HYP_OK; - return true; - } - if (hypName == "LayerDistribution2D") { - myDistributionHypo = static_cast(theHyp); - aStatus = SMESH_Hypothesis::HYP_OK; - return true; - } - aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; - return true; -} - -namespace -{ - // ------------------------------------------------------------------------------ - /*! - * \brief Listener used to mark edges meshed by StdMeshers_RadialQuadrangle_1D2D - */ - class TLinEdgeMarker : public SMESH_subMeshEventListener - { - TLinEdgeMarker(): SMESH_subMeshEventListener(/*isDeletable=*/false) {} - public: - static SMESH_subMeshEventListener* getListener() - { - static TLinEdgeMarker theEdgeMarker; - return &theEdgeMarker; - } - }; - - // ------------------------------------------------------------------------------ - /*! - * \brief Mark an edge as computed by StdMeshers_RadialQuadrangle_1D2D - */ - void markLinEdgeAsComputedByMe(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh) - { - if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge )) - { - if ( !edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() )) - faceSubMesh->SetEventListener( TLinEdgeMarker::getListener(), - SMESH_subMeshEventListenerData::MakeData(faceSubMesh), - edgeSM); - } - } - // ------------------------------------------------------------------------------ - /*! - * \brief Return true if a radial edge was meshed with StdMeshers_RadialQuadrangle_1D2D with - * the same radial distribution - */ - bool isEdgeCompitaballyMeshed(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh) - { - if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge )) - { - if ( SMESH_subMeshEventListenerData* otherFaceData = - edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() )) - { - // compare hypothesis aplied to two disk faces sharing radial edges - SMESH_Mesh& mesh = *faceSubMesh->GetFather(); - SMESH_Algo* radialQuadAlgo = mesh.GetGen()->GetAlgo(mesh, faceSubMesh->GetSubShape() ); - SMESH_subMesh* otherFaceSubMesh = otherFaceData->mySubMeshes.front(); - const list & hyps1 = - radialQuadAlgo->GetUsedHypothesis( mesh, faceSubMesh->GetSubShape()); - const list & hyps2 = - radialQuadAlgo->GetUsedHypothesis( mesh, otherFaceSubMesh->GetSubShape()); - if( hyps1.empty() && hyps2.empty() ) - return true; // defaul hyps - if ( hyps1.size() != hyps2.size() || - strcmp( hyps1.front()->GetName(), hyps2.front()->GetName() )) - return false; - ostringstream hypDump1, hypDump2; - list ::const_iterator hyp1 = hyps1.begin(); - for ( ; hyp1 != hyps1.end(); ++hyp1 ) - const_cast(*hyp1)->SaveTo( hypDump1 ); - list ::const_iterator hyp2 = hyps2.begin(); - for ( ; hyp2 != hyps2.end(); ++hyp2 ) - const_cast(*hyp2)->SaveTo( hypDump2 ); - return hypDump1.str() == hypDump2.str(); - } - } - return false; - } - - //================================================================================ - /*! - * \brief Return base curve of the edge and extremum parameters - */ - //================================================================================ - - Handle(Geom_Curve) getCurve(const TopoDS_Edge& edge, double* f=0, double* l=0) - { - Handle(Geom_Curve) C; - if ( !edge.IsNull() ) - { - double first = 0., last = 0.; - C = BRep_Tool::Curve(edge, first, last); - if ( !C.IsNull() ) - { - Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C); - while( !tc.IsNull() ) { - C = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C); - } - if ( f ) *f = first; - if ( l ) *l = last; - } - } - return C; - } - - //================================================================================ - /*! - * \brief Return edges of the face - * \retval int - nb of edges - */ - //================================================================================ - - int analyseFace(const TopoDS_Shape& face, - TopoDS_Edge& CircEdge, - TopoDS_Edge& LinEdge1, - TopoDS_Edge& LinEdge2) - { - CircEdge.Nullify(); LinEdge1.Nullify(); LinEdge2.Nullify(); - int nbe = 0; - - for ( TopExp_Explorer exp( face, TopAbs_EDGE ); exp.More(); exp.Next(), ++nbe ) - { - const TopoDS_Edge& E = TopoDS::Edge( exp.Current() ); - double f,l; - Handle(Geom_Curve) C = getCurve(E,&f,&l); - if ( !C.IsNull() ) - { - if ( C->IsKind( STANDARD_TYPE(Geom_Circle))) - { - if ( CircEdge.IsNull() ) - CircEdge = E; - else - return 0; - } - else if ( LinEdge1.IsNull() ) - LinEdge1 = E; - else - LinEdge2 = E; - } - } - return nbe; - } -} - -//======================================================================= -/*! - * \brief Allow algo to do something after persistent restoration - * \param subMesh - restored submesh - * - * call markLinEdgeAsComputedByMe() - */ -//======================================================================= - -void StdMeshers_RadialQuadrangle_1D2D::SubmeshRestored(SMESH_subMesh* faceSubMesh) -{ - if ( !faceSubMesh->IsEmpty() ) - { - TopoDS_Edge CircEdge, LinEdge1, LinEdge2; - analyseFace( faceSubMesh->GetSubShape(), CircEdge, LinEdge1, LinEdge2 ); - if ( !LinEdge1.IsNull() ) markLinEdgeAsComputedByMe( LinEdge1, faceSubMesh ); - if ( !LinEdge2.IsNull() ) markLinEdgeAsComputedByMe( LinEdge2, faceSubMesh ); - } -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape) -{ - TopExp_Explorer exp; - SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); - - myHelper = new SMESH_MesherHelper( aMesh ); - myHelper->IsQuadraticSubMesh( aShape ); - // to delete helper at exit from Compute() - auto_ptr helperDeleter( myHelper ); - - myLayerPositions.clear(); - - TopoDS_Edge CircEdge, LinEdge1, LinEdge2; - int nbe = analyseFace( aShape, CircEdge, LinEdge1, LinEdge2 ); - if( nbe>3 || nbe < 1 || CircEdge.IsNull() ) - return error(COMPERR_BAD_SHAPE); - - gp_Pnt P0,P1; - // points for rotation - TColgp_SequenceOfPnt Points; - // angles for rotation - TColStd_SequenceOfReal Angles; - // Nodes1 and Nodes2 - nodes along radiuses - // CNodes - nodes on circle edge - vector< const SMDS_MeshNode* > Nodes1, Nodes2, CNodes; - SMDS_MeshNode * NC; - // parameters edge nodes on face - TColgp_SequenceOfPnt2d Pnts2d1; - gp_Pnt2d PC; - - int faceID = meshDS->ShapeToIndex(aShape); - TopoDS_Face F = TopoDS::Face(aShape); - Handle(Geom_Surface) S = BRep_Tool::Surface(F); - - if(nbe==1) - { - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge )); - - bool ok = _gen->Compute( aMesh, CircEdge ); - if( !ok ) return false; - map< double, const SMDS_MeshNode* > theNodes; - ok = GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); - if( !ok ) return false; - - CNodes.clear(); - map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); - const SMDS_MeshNode* NF = (*itn).second; - CNodes.push_back( (*itn).second ); - double fang = (*itn).first; - if ( itn != theNodes.end() ) { - itn++; - for(; itn != theNodes.end(); itn++ ) { - CNodes.push_back( (*itn).second ); - double ang = (*itn).first - fang; - if( ang>PI ) ang = ang - 2*PI; - if( ang<-PI ) ang = ang + 2*PI; - Angles.Append( ang ); - } - } - P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); - P0 = aCirc->Location(); - - myLayerPositions.clear(); - computeLayerPositions(P0,P1); - - exp.Init( CircEdge, TopAbs_VERTEX ); - TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() ); - gp_Pnt2d p2dV = BRep_Tool::Parameters( V1, TopoDS::Face(aShape) ); - - NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); - GeomAPI_ProjectPointOnSurf PPS(P0,S); - double U0,V0; - PPS.Parameters(1,U0,V0); - meshDS->SetNodeOnFace(NC, faceID, U0, V0); - PC = gp_Pnt2d(U0,V0); - - gp_Vec aVec(P0,P1); - gp_Vec2d aVec2d(PC,p2dV); - Nodes1.resize( myLayerPositions.size()+1 ); - Nodes2.resize( myLayerPositions.size()+1 ); - int i = 0; - for(; iAddNode(P.X(), P.Y(), P.Z()); - Nodes1[i] = node; - Nodes2[i] = node; - double U = PC.X() + aVec2d.X()*myLayerPositions[i]; - double V = PC.Y() + aVec2d.Y()*myLayerPositions[i]; - meshDS->SetNodeOnFace( node, faceID, U, V ); - Pnts2d1.Append(gp_Pnt2d(U,V)); - } - Nodes1[Nodes1.size()-1] = NF; - Nodes2[Nodes1.size()-1] = NF; - } - else if(nbe==2 && LinEdge1.Orientation() != TopAbs_INTERNAL ) - { - // one curve must be a half of circle and other curve must be - // a segment of line - double fp, lp; - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge, &fp, &lp )); - if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) { - // not half of circle - return error(COMPERR_BAD_SHAPE); - } - Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 )); - if( aLine.IsNull() ) { - // other curve not line - return error(COMPERR_BAD_SHAPE); - } - bool linEdgeComputed = false; - if( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1) ) { - if( !sm1->IsEmpty() ) - if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) )) - linEdgeComputed = true; - else - return error("Invalid set of hypotheses"); - } - - bool ok = _gen->Compute( aMesh, CircEdge ); - if( !ok ) return false; - map< double, const SMDS_MeshNode* > theNodes; - GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); - - CNodes.clear(); - map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); - double fang = (*itn).first; - itn++; - for(; itn != theNodes.end(); itn++ ) { - CNodes.push_back( (*itn).second ); - double ang = (*itn).first - fang; - if( ang>PI ) ang = ang - 2*PI; - if( ang<-PI ) ang = ang + 2*PI; - Angles.Append( ang ); - } - const SMDS_MeshNode* NF = theNodes.begin()->second; - const SMDS_MeshNode* NL = theNodes.rbegin()->second; - CNodes.push_back( NF ); - P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); - gp_Pnt P2( NL->X(), NL->Y(), NL->Z() ); - P0 = aCirc->Location(); - - myLayerPositions.clear(); - computeLayerPositions(P0,P1); - - if ( linEdgeComputed ) - { - if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge1,true,theNodes)) - return error("Invalid mesh on a straight edge"); - - vector< const SMDS_MeshNode* > *pNodes1 = &Nodes1, *pNodes2 = &Nodes2; - bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF ); - if ( !nodesFromP0ToP1 ) std::swap( pNodes1, pNodes2 ); - - map< double, const SMDS_MeshNode* >::reverse_iterator ritn = theNodes.rbegin(); - itn = theNodes.begin(); - for ( int i = Nodes1.size()-1; i > -1; ++itn, ++ritn, --i ) - { - (*pNodes1)[i] = ritn->second; - (*pNodes2)[i] = itn->second; - Points.Append( gpXYZ( Nodes1[i])); - Pnts2d1.Append( myHelper->GetNodeUV( F, Nodes1[i])); - } - NC = const_cast( itn->second ); - Points.Remove( Nodes1.size() ); - } - else - { - gp_Vec aVec(P0,P1); - int edgeID = meshDS->ShapeToIndex(LinEdge1); - // check orientation - Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp); - gp_Pnt Ptmp; - Crv->D0(fp,Ptmp); - bool ori = true; - if( P1.Distance(Ptmp) > Precision::Confusion() ) - ori = false; - // get UV points for edge - gp_Pnt2d PF,PL; - BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL ); - PC = gp_Pnt2d( (PF.X()+PL.X())/2, (PF.Y()+PL.Y())/2 ); - gp_Vec2d V2d; - if(ori) V2d = gp_Vec2d(PC,PF); - else V2d = gp_Vec2d(PC,PL); - // add nodes on edge - double cp = (fp+lp)/2; - double dp2 = (lp-fp)/2; - NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); - meshDS->SetNodeOnEdge(NC, edgeID, cp); - Nodes1.resize( myLayerPositions.size()+1 ); - Nodes2.resize( myLayerPositions.size()+1 ); - int i = 0; - for(; iAddNode(P.X(), P.Y(), P.Z()); - Nodes1[i] = node; - double param; - if(ori) - param = fp + dp2*(1-myLayerPositions[i]); - else - param = cp + dp2*myLayerPositions[i]; - meshDS->SetNodeOnEdge(node, edgeID, param); - P = gp_Pnt( P0.X() - aVec.X()*myLayerPositions[i], - P0.Y() - aVec.Y()*myLayerPositions[i], - P0.Z() - aVec.Z()*myLayerPositions[i] ); - node = meshDS->AddNode(P.X(), P.Y(), P.Z()); - Nodes2[i] = node; - if(!ori) - param = fp + dp2*(1-myLayerPositions[i]); - else - param = cp + dp2*myLayerPositions[i]; - meshDS->SetNodeOnEdge(node, edgeID, param); - // parameters on face - gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], - PC.Y() + V2d.Y()*myLayerPositions[i] ); - Pnts2d1.Append(P2d); - } - Nodes1[ myLayerPositions.size() ] = NF; - Nodes2[ myLayerPositions.size() ] = NL; - // create 1D elements on edge - vector< const SMDS_MeshNode* > tmpNodes; - tmpNodes.resize(2*Nodes1.size()+1); - for(i=0; iAddEdge( tmpNodes[i-1], tmpNodes[i] ); - if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); - } - markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F )); - } - } - else // nbe==3 or ( nbe==2 && linEdge is INTERNAL ) - { - if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL ) - LinEdge2 = LinEdge1; - - // one curve must be a part of circle and other curves must be - // segments of line - double fp, lp; - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge )); - Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 )); - Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast( getCurve( LinEdge2 )); - if( aLine1.IsNull() || aLine2.IsNull() ) { - // other curve not line - return error(COMPERR_BAD_SHAPE); - } - - bool linEdge1Computed = false; - if ( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1)) - if( !sm1->IsEmpty() ) - if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) )) - linEdge1Computed = true; - else - return error("Invalid set of hypotheses"); - - bool linEdge2Computed = false; - if ( SMESH_subMesh* sm2 = aMesh.GetSubMesh(LinEdge2)) - if( !sm2->IsEmpty() ) - if( isEdgeCompitaballyMeshed( LinEdge2, aMesh.GetSubMesh(F) )) - linEdge2Computed = true; - else - return error("Invalid set of hypotheses"); - - bool ok = _gen->Compute( aMesh, CircEdge ); - if( !ok ) return false; - map< double, const SMDS_MeshNode* > theNodes; - GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); - - const SMDS_MeshNode* NF = theNodes.begin()->second; - const SMDS_MeshNode* NL = theNodes.rbegin()->second; - CNodes.clear(); - CNodes.push_back( NF ); - map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); - double fang = (*itn).first; - itn++; - for(; itn != theNodes.end(); itn++ ) { - CNodes.push_back( (*itn).second ); - double ang = (*itn).first - fang; - if( ang>PI ) ang = ang - 2*PI; - if( ang<-PI ) ang = ang + 2*PI; - Angles.Append( ang ); - } - P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); - gp_Pnt P2( NL->X(), NL->Y(), NL->Z() ); - P0 = aCirc->Location(); - - myLayerPositions.clear(); - computeLayerPositions(P0,P1); - - Nodes1.resize( myLayerPositions.size()+1 ); - Nodes2.resize( myLayerPositions.size()+1 ); - - exp.Init( LinEdge1, TopAbs_VERTEX ); - TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() ); - exp.Next(); - TopoDS_Vertex V2 = TopoDS::Vertex( exp.Current() ); - gp_Pnt PE1 = BRep_Tool::Pnt(V1); - gp_Pnt PE2 = BRep_Tool::Pnt(V2); - if( ( P1.Distance(PE1) > Precision::Confusion() ) && - ( P1.Distance(PE2) > Precision::Confusion() ) ) - { - std::swap( LinEdge1, LinEdge2 ); - std::swap( linEdge1Computed, linEdge2Computed ); - } - TopoDS_Vertex VC = V2; - if( ( P1.Distance(PE1) > Precision::Confusion() ) && - ( P2.Distance(PE1) > Precision::Confusion() ) ) - VC = V1; - int vertID = meshDS->ShapeToIndex(VC); - - // LinEdge1 - if ( linEdge1Computed ) - { - if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge1,true,theNodes)) - return error("Invalid mesh on a straight edge"); - - bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF ); - NC = const_cast - ( nodesFromP0ToP1 ? theNodes.begin()->second : theNodes.rbegin()->second ); - int i = 0, ir = Nodes1.size()-1; - int * pi = nodesFromP0ToP1 ? &i : &ir; - itn = theNodes.begin(); - if ( nodesFromP0ToP1 ) ++itn; - for ( ; i < Nodes1.size(); ++i, --ir, ++itn ) - { - Nodes1[*pi] = itn->second; - } - for ( i = 0; i < Nodes1.size()-1; ++i ) - { - Points.Append( gpXYZ( Nodes1[i])); - Pnts2d1.Append( myHelper->GetNodeUV( F, Nodes1[i])); - } - } - else - { - int edgeID = meshDS->ShapeToIndex(LinEdge1); - gp_Vec aVec(P0,P1); - // check orientation - Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp); - gp_Pnt Ptmp = Crv->Value(fp); - bool ori = false; - if( P1.Distance(Ptmp) > Precision::Confusion() ) - ori = true; - // get UV points for edge - gp_Pnt2d PF,PL; - BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL ); - gp_Vec2d V2d; - if(ori) { - V2d = gp_Vec2d(PF,PL); - PC = PF; - } - else { - V2d = gp_Vec2d(PL,PF); - PC = PL; - } - NC = const_cast( VertexNode( VC, meshDS )); - if ( !NC ) - { - NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); - meshDS->SetNodeOnVertex(NC, vertID); - } - double dp = lp-fp; - int i = 0; - for(; iAddNode(P.X(), P.Y(), P.Z()); - Nodes1[i] = node; - double param; - if(!ori) - param = fp + dp*(1-myLayerPositions[i]); - else - param = fp + dp*myLayerPositions[i]; - meshDS->SetNodeOnEdge(node, edgeID, param); - // parameters on face - gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], - PC.Y() + V2d.Y()*myLayerPositions[i] ); - Pnts2d1.Append(P2d); - } - Nodes1[ myLayerPositions.size() ] = NF; - // create 1D elements on edge - SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] ); - if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); - for(i=1; iAddEdge( Nodes1[i-1], Nodes1[i] ); - if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); - } - if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL ) - Nodes2 = Nodes1; - } - markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F )); - - // LinEdge2 - if ( linEdge2Computed ) - { - if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge2,true,theNodes)) - return error("Invalid mesh on a straight edge"); - - bool nodesFromP0ToP2 = ( theNodes.rbegin()->second == NL ); - int i = 0, ir = Nodes1.size()-1; - int * pi = nodesFromP0ToP2 ? &i : &ir; - itn = theNodes.begin(); - if ( nodesFromP0ToP2 ) ++itn; - for ( ; i < Nodes2.size(); ++i, --ir, ++itn ) - Nodes2[*pi] = itn->second; - } - else - { - int edgeID = meshDS->ShapeToIndex(LinEdge2); - gp_Vec aVec = gp_Vec(P0,P2); - // check orientation - Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge2,fp,lp); - gp_Pnt Ptmp = Crv->Value(fp); - bool ori = false; - if( P2.Distance(Ptmp) > Precision::Confusion() ) - ori = true; - // get UV points for edge - gp_Pnt2d PF,PL; - BRep_Tool::UVPoints( LinEdge2, TopoDS::Face(aShape), PF, PL ); - gp_Vec2d V2d; - if(ori) { - V2d = gp_Vec2d(PF,PL); - PC = PF; - } - else { - V2d = gp_Vec2d(PL,PF); - PC = PL; - } - double dp = lp-fp; - for(int i=0; iAddNode(P.X(), P.Y(), P.Z()); - Nodes2[i] = node; - double param; - if(!ori) - param = fp + dp*(1-myLayerPositions[i]); - else - param = fp + dp*myLayerPositions[i]; - meshDS->SetNodeOnEdge(node, edgeID, param); - // parameters on face - gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], - PC.Y() + V2d.Y()*myLayerPositions[i] ); - } - Nodes2[ myLayerPositions.size() ] = NL; - // create 1D elements on edge - SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes2[0] ); - if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); - for(int i=1; iAddEdge( Nodes2[i-1], Nodes2[i] ); - if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); - } - } - markLinEdgeAsComputedByMe( LinEdge2, aMesh.GetSubMesh( F )); - } - - // orientation - bool IsForward = ( CircEdge.Orientation()==TopAbs_FORWARD ); - - // create nodes and mesh elements on face - // find axis of rotation - gp_Pnt P2 = gp_Pnt( CNodes[1]->X(), CNodes[1]->Y(), CNodes[1]->Z() ); - gp_Vec Vec1(P0,P1); - gp_Vec Vec2(P0,P2); - gp_Vec Axis = Vec1.Crossed(Vec2); - // create elements - int i = 1; - //cout<<"Angles.Length() = "<GetLayerDistribution() ) - return error( "Invalid LayerDistribution hypothesis"); - myUsedHyps.clear(); - myUsedHyps.push_back( hyp->GetLayerDistribution() ); - - TopoDS_Edge edge = BRepBuilderAPI_MakeEdge( pIn, pOut ); - SMESH_Hypothesis::Hypothesis_Status aStatus; - if ( !StdMeshers_Regular_1D::CheckHypothesis( aMesh, edge, aStatus )) - return error( "StdMeshers_Regular_1D::CheckHypothesis() failed " - "with LayerDistribution hypothesis"); - - BRepAdaptor_Curve C3D(edge); - double f = C3D.FirstParameter(), l = C3D.LastParameter(); - list< double > params; - if ( !StdMeshers_Regular_1D::computeInternalParameters( aMesh, C3D, len, f, l, params, false )) - return error("StdMeshers_Regular_1D failed to compute layers distribution"); - - positions.clear(); - positions.reserve( params.size() ); - for (list::iterator itU = params.begin(); itU != params.end(); itU++) - positions.push_back( *itU / len ); - return true; - } -protected: - // ----------------------------------------------------------------------------- - TNodeDistributor( int hypId, int studyId, SMESH_Gen* gen) - : StdMeshers_Regular_1D( hypId, studyId, gen) - { - } - // ----------------------------------------------------------------------------- - virtual const list & - GetUsedHypothesis(SMESH_Mesh &, const TopoDS_Shape &, const bool) - { - return myUsedHyps; - } - // ----------------------------------------------------------------------------- -}; - -//================================================================================ -/*! - * \brief Compute positions of nodes between the internal and the external surfaces - * \retval bool - is a success - */ -//================================================================================ - -bool StdMeshers_RadialQuadrangle_1D2D::computeLayerPositions(const gp_Pnt& pIn, - const gp_Pnt& pOut) -{ - if ( myNbLayerHypo ) - { - int nbSegments = myNbLayerHypo->GetNumberOfLayers(); - myLayerPositions.resize( nbSegments - 1 ); - for ( int z = 1; z < nbSegments; ++z ) - myLayerPositions[ z - 1 ] = double( z )/ double( nbSegments ); - return true; - } - if ( myDistributionHypo ) { - SMESH_Mesh * mesh = myHelper->GetMesh(); - if ( !TNodeDistributor::GetDistributor(*mesh)->Compute( myLayerPositions, pIn, pOut, - *mesh, myDistributionHypo )) - { - error( TNodeDistributor::GetDistributor(*mesh)->GetComputeError() ); - return false; - } - } - RETURN_BAD_RESULT("Bad hypothesis"); -} - - -//======================================================================= -//function : Evaluate -//purpose : -//======================================================================= - -bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - MapShapeNbElems& aResMap) -{ - if( aShape.ShapeType() != TopAbs_FACE ) { - return false; - } - SMESH_subMesh * smf = aMesh.GetSubMesh(aShape); - MapShapeNbElemsItr anIt = aResMap.find(smf); - if( anIt != aResMap.end() ) { - return false; - } - - myLayerPositions.clear(); - gp_Pnt P0(0,0,0); - gp_Pnt P1(100,0,0); - computeLayerPositions(P0,P1); - - TopoDS_Edge E1,E2,E3; - Handle(Geom_Curve) C1,C2,C3; - double f1,l1,f2,l2,f3,l3; - int nbe = 0; - TopExp_Explorer exp; - for ( exp.Init( aShape, TopAbs_EDGE ); exp.More(); exp.Next() ) { - nbe++; - TopoDS_Edge E = TopoDS::Edge( exp.Current() ); - if(nbe==1) { - E1 = E; - C1 = BRep_Tool::Curve(E,f1,l1); - } - else if(nbe==2) { - E2 = E; - C2 = BRep_Tool::Curve(E,f2,l2); - } - else if(nbe==3) { - E3 = E; - C3 = BRep_Tool::Curve(E,f3,l3); - } - } - - TopoDS_Edge CircEdge, LinEdge1, LinEdge2; - int nb0d=0, nb2d_tria=0, nb2d_quad=0; - bool isQuadratic = false; - if(nbe==1) { - // C1 must be a circle - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); - if( !aCirc.IsNull() ) { - bool ok = _gen->Evaluate( aMesh, CircEdge, aResMap ); - if(ok) { - SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); - MapShapeNbElemsItr anIt = aResMap.find(sm); - vector aVec = (*anIt).second; - isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; - if(isQuadratic) { - // main nodes - nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); - // radial medium nodes - nb0d += (aVec[SMDSEntity_Node]+1) * (myLayerPositions.size()+1); - // other medium nodes - nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); - } - else { - nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); - } - nb2d_tria = aVec[SMDSEntity_Node] + 1; - nb2d_quad = nb0d; - } - } - } - else if(nbe==2) { - // one curve must be a half of circle and other curve must be - // a segment of line - Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - while( !tc.IsNull() ) { - C1 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - } - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - while( !tc.IsNull() ) { - C2 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - } - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); - Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(C2); - CircEdge = E1; - LinEdge1 = E2; - double fp = f1; - double lp = l1; - if( aCirc.IsNull() ) { - aCirc = Handle(Geom_Circle)::DownCast(C2); - CircEdge = E2; - LinEdge1 = E1; - fp = f2; - lp = l2; - aLine = Handle(Geom_Line)::DownCast(C3); - } - bool ok = !aCirc.IsNull() && !aLine.IsNull(); - if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) { - // not half of circle - ok = false; - } - SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1); - MapShapeNbElemsItr anIt = aResMap.find(sm1); - if( anIt!=aResMap.end() ) { - ok = false; - } - if(ok) { - ok = _gen->Evaluate( aMesh, CircEdge, aResMap ); - } - if(ok) { - SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); - MapShapeNbElemsItr anIt = aResMap.find(sm); - vector aVec = (*anIt).second; - isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; - if(isQuadratic) { - // main nodes - nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size(); - // radial medium nodes - nb0d += aVec[SMDSEntity_Node] * (myLayerPositions.size()+1); - // other medium nodes - nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); - } - else { - nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size(); - } - nb2d_tria = aVec[SMDSEntity_Node] + 1; - nb2d_quad = nb2d_tria * myLayerPositions.size(); - // add evaluation for edges - vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; iBasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - } - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - while( !tc.IsNull() ) { - C2 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - } - tc = Handle(Geom_TrimmedCurve)::DownCast(C3); - while( !tc.IsNull() ) { - C3 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C3); - } - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); - Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast(C2); - Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast(C3); - CircEdge = E1; - LinEdge1 = E2; - LinEdge2 = E3; - double fp = f1; - double lp = l1; - if( aCirc.IsNull() ) { - aCirc = Handle(Geom_Circle)::DownCast(C2); - CircEdge = E2; - LinEdge1 = E3; - LinEdge2 = E1; - fp = f2; - lp = l2; - aLine1 = Handle(Geom_Line)::DownCast(C3); - aLine2 = Handle(Geom_Line)::DownCast(C1); - if( aCirc.IsNull() ) { - aCirc = Handle(Geom_Circle)::DownCast(C3); - CircEdge = E3; - LinEdge1 = E1; - LinEdge2 = E2; - fp = f3; - lp = l3; - aLine1 = Handle(Geom_Line)::DownCast(C1); - aLine2 = Handle(Geom_Line)::DownCast(C2); - } - } - bool ok = !aCirc.IsNull() && !aLine1.IsNull() && !aLine1.IsNull(); - SMESH_subMesh* sm = aMesh.GetSubMesh(LinEdge1); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt!=aResMap.end() ) { - ok = false; - } - sm = aMesh.GetSubMesh(LinEdge2); - anIt = aResMap.find(sm); - if( anIt!=aResMap.end() ) { - ok = false; - } - if(ok) { - ok = _gen->Evaluate( aMesh, CircEdge, aResMap ); - } - if(ok) { - SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); - MapShapeNbElemsItr anIt = aResMap.find(sm); - vector aVec = (*anIt).second; - isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; - if(isQuadratic) { - // main nodes - nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size(); - // radial medium nodes - nb0d += aVec[SMDSEntity_Node] * (myLayerPositions.size()+1); - // other medium nodes - nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); - } - else { - nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size(); - } - nb2d_tria = aVec[SMDSEntity_Node] + 1; - nb2d_quad = nb2d_tria * myLayerPositions.size(); - // add evaluation for edges - vector aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i aResVec(SMDSEntity_Last); - for(int i=SMDSEntity_Node; i @@ -63,7 +63,6 @@ #include #include -#include using namespace std; @@ -74,24 +73,22 @@ using namespace std; //============================================================================= StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId, - SMESH_Gen * gen):SMESH_1D_Algo(hypId, studyId, gen) + SMESH_Gen * gen):SMESH_1D_Algo(hypId, studyId, gen) { - MESSAGE("StdMeshers_Regular_1D::StdMeshers_Regular_1D"); - _name = "Regular_1D"; - _shapeType = (1 << TopAbs_EDGE); - _fpHyp = 0; + MESSAGE("StdMeshers_Regular_1D::StdMeshers_Regular_1D"); + _name = "Regular_1D"; + _shapeType = (1 << TopAbs_EDGE); - _compatibleHypothesis.push_back("LocalLength"); - _compatibleHypothesis.push_back("MaxLength"); - _compatibleHypothesis.push_back("NumberOfSegments"); - _compatibleHypothesis.push_back("StartEndLength"); - _compatibleHypothesis.push_back("Deflection1D"); - _compatibleHypothesis.push_back("Arithmetic1D"); - _compatibleHypothesis.push_back("FixedPoints1D"); - _compatibleHypothesis.push_back("AutomaticLength"); + _compatibleHypothesis.push_back("LocalLength"); + _compatibleHypothesis.push_back("MaxLength"); + _compatibleHypothesis.push_back("NumberOfSegments"); + _compatibleHypothesis.push_back("StartEndLength"); + _compatibleHypothesis.push_back("Deflection1D"); + _compatibleHypothesis.push_back("Arithmetic1D"); + _compatibleHypothesis.push_back("AutomaticLength"); - _compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!! - _compatibleHypothesis.push_back("Propagation"); // auxiliary !!! + _compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!! + _compatibleHypothesis.push_back("Propagation"); // auxiliary !!! } //============================================================================= @@ -183,15 +180,12 @@ bool StdMeshers_Regular_1D::CheckHypothesis { case StdMeshers_NumberOfSegments::DT_Scale: _value[ SCALE_FACTOR_IND ] = hyp->GetScaleFactor(); - _revEdgesIDs = hyp->GetReversedEdges(); break; case StdMeshers_NumberOfSegments::DT_TabFunc: _vvalue[ TAB_FUNC_IND ] = hyp->GetTableFunction(); - _revEdgesIDs = hyp->GetReversedEdges(); break; case StdMeshers_NumberOfSegments::DT_ExprFunc: _svalue[ EXPR_FUNC_IND ] = hyp->GetExpressionFunction(); - _revEdgesIDs = hyp->GetReversedEdges(); break; case StdMeshers_NumberOfSegments::DT_Regular: break; @@ -215,19 +209,6 @@ bool StdMeshers_Regular_1D::CheckHypothesis _value[ END_LENGTH_IND ] = hyp->GetLength( false ); ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 ); _hypType = ARITHMETIC_1D; - - _revEdgesIDs = hyp->GetReversedEdges(); - - aStatus = SMESH_Hypothesis::HYP_OK; - } - - else if (hypName == "FixedPoints1D") { - _fpHyp = dynamic_cast (theHyp); - ASSERT(_fpHyp); - _hypType = FIXED_POINTS_1D; - - _revEdgesIDs = _fpHyp->GetReversedEdges(); - aStatus = SMESH_Hypothesis::HYP_OK; } @@ -240,9 +221,6 @@ bool StdMeshers_Regular_1D::CheckHypothesis _value[ END_LENGTH_IND ] = hyp->GetLength( false ); ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 ); _hypType = BEG_END_LENGTH; - - _revEdgesIDs = hyp->GetReversedEdges(); - aStatus = SMESH_Hypothesis::HYP_OK; } @@ -758,7 +736,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, double an = _value[ END_LENGTH_IND ]; double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 ); - int n = int(fabs(q) > numeric_limits::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 )); + int n = int( 1 + ( an - a1 ) / q ); double U1 = theReverse ? l : f; double Un = theReverse ? f : l; @@ -786,62 +764,6 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, return true; } - case FIXED_POINTS_1D: { - const std::vector& aPnts = _fpHyp->GetPoints(); - const std::vector& nbsegs = _fpHyp->GetNbSegments(); - int i = 0; - TColStd_SequenceOfReal Params; - for(; i0.9999 ) continue; - int j=1; - bool IsExist = false; - for(; j<=Params.Length(); j++) { - if( fabs(aPnts[i]-Params.Value(j)) < 1e-4 ) { - IsExist = true; - break; - } - if( aPnts[i]& ids ) -{ - if ( ids != _edgeIDs ) { - _edgeIDs = ids; - - NotifySubMeshesHypothesisModification(); - } -} - -//============================================================================= -/*! - * - */ -//============================================================================= - ostream & StdMeshers_StartEndLength::SaveTo(ostream & save) { - int listSize = _edgeIDs.size(); - save << _begLength << " " << _endLength << " " << listSize; - - if ( listSize > 0 ) { - for ( int i = 0; i < listSize; i++) { - save << " " << _edgeIDs[i]; - } - save << " " << _objEntry; - } - + save << _begLength << " " <<_endLength; return save; } @@ -144,25 +121,12 @@ ostream & StdMeshers_StartEndLength::SaveTo(ostream & save) istream & StdMeshers_StartEndLength::LoadFrom(istream & load) { bool isOK = true; - int intVal; isOK = (load >> _begLength); if (!isOK) load.clear(ios::badbit | load.rdstate()); isOK = (load >> _endLength); - if (!isOK) load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> intVal); - if (isOK && intVal > 0) { - _edgeIDs.reserve( intVal ); - for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) { - isOK = (load >> intVal); - if ( isOK ) _edgeIDs.push_back( intVal ); - } - isOK = (load >> _objEntry); - } - return load; } @@ -246,4 +210,3 @@ bool StdMeshers_StartEndLength::SetParametersByDefaults(const TDefaults& dflts, { return (_begLength = _endLength = dflts._elemLength ); } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_TrianglePreference.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_TrianglePreference.cpp index 331cd0d1ce..0795b9b276 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_TrianglePreference.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_TrianglePreference.cpp @@ -22,7 +22,8 @@ // SMESH StdMeshers_TrianglePreference // File : StdMeshers_TrianglePreference.cxx // Module : SMESH - +// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/Attic/StdMeshers_TrianglePreference.cxx,v 1.1.4.2 2008/11/27 13:03:49 abd Exp $ +// #include "StdMeshers_TrianglePreference.hxx" #include "utilities.h" @@ -125,4 +126,3 @@ bool StdMeshers_TrianglePreference::SetParametersByDefaults(const TDefaults& /* { return false; } - diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_UseExisting_1D2D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_UseExisting_1D2D.cpp index 3638498e13..e44345af42 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_UseExisting_1D2D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_UseExisting_1D2D.cpp @@ -60,27 +60,10 @@ bool StdMeshers_UseExisting_1D::CheckHypothesis(SMESH_Mesh& , bool StdMeshers_UseExisting_1D::Compute(SMESH_Mesh&, const TopoDS_Shape&) { - // This algorithm exists to allow mesh generation by mesh - // edition functions in TUI mode + // This algorithm exists to allow mesh generation by mesh edition functions in TUI mode return true; } - -//======================================================================= -//function : Evaluate -//purpose : -//======================================================================= - -bool StdMeshers_UseExisting_1D::Evaluate(SMESH_Mesh&, - const TopoDS_Shape&, - MapShapeNbElems&) -{ - // This algorithm exists to allow mesh generation by mesh - // edition functions in TUI mode - return false; -} - - //======================================================================= //function : StdMeshers_UseExisting_2D //purpose : @@ -114,22 +97,6 @@ bool StdMeshers_UseExisting_2D::CheckHypothesis(SMESH_Mesh& , bool StdMeshers_UseExisting_2D::Compute(SMESH_Mesh&, const TopoDS_Shape&) { - // This algorithm exists to allow mesh generation by mesh edition - // functions in TUI mode + // This algorithm exists to allow mesh generation by mesh edition functions in TUI mode return true; } - - -//======================================================================= -//function : Evaluate -//purpose : -//======================================================================= - -bool StdMeshers_UseExisting_2D::Evaluate(SMESH_Mesh&, - const TopoDS_Shape&, - MapShapeNbElems&) -{ - // This algorithm exists to allow mesh generation by mesh edition - // functions in TUI mode - return false; -} diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index 47a42c2d6b..b0c123422b 100755 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -15,7 +15,7 @@ include_directories( ${PYTHON_INCLUDE_PATH} ${ZLIB_INCLUDE_DIR} ${XERCESC_INCLUDE_DIR} - ${SMESH_INCLUDE_DIR} + ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc ) link_directories(${OCC_LIBRARY_DIR}) @@ -24,8 +24,9 @@ set(Fem_LIBS Part Mesh FreeCADApp - ${SMESH_LIBRARIES} - ${SMESH_DEBUG_LIBRARIES} + StdMeshers + NETGENPlugin + SMESH ) generate_from_xml(FemMeshPy) diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index 4186a9b9ea..cd4e3ee052 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -15,7 +15,7 @@ include_directories( ${SOQT_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH} ${XERCESC_INCLUDE_DIR} - ${SMESH_INCLUDE_DIR} + ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc ) link_directories(${OCC_LIBRARY_DIR}) diff --git a/src/Mod/MeshPart/App/CMakeLists.txt b/src/Mod/MeshPart/App/CMakeLists.txt index 3cb408e637..bcb7745ffe 100644 --- a/src/Mod/MeshPart/App/CMakeLists.txt +++ b/src/Mod/MeshPart/App/CMakeLists.txt @@ -4,38 +4,32 @@ else(MSVC) add_definitions(-DHAVE_LIMITS_H -DHAVE_CONFIG_H) endif(MSVC) -if (SMESH_FOUND) - add_definitions(-DHAVE_SMESH) -endif(SMESH_FOUND) + +add_definitions(-DHAVE_SMESH) include_directories( ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc ${Boost_INCLUDE_DIRS} ${OCC_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH} ${XERCESC_INCLUDE_DIR} + ${SMESH_INCLUDE_DIR} ) -if(SMESH_FOUND) -include_directories( - ${SMESH_INCLUDE_DIR} -) -endif(SMESH_FOUND) + + link_directories(${OCC_LIBRARY_DIR}) -if(SMESH_FOUND) + set(MeshPart_LIBS Part Mesh - ${SMESH_LIBRARIES} - ${SMESH_DEBUG_LIBRARIES} + StdMeshers + NETGENPlugin + SMESH ) -else(SMESH_FOUND) -set(MeshPart_LIBS - Part - Mesh -) -endif(SMESH_FOUND) + SET(MeshPart_SRCS AppMeshPart.cpp