Remove accidently added .orig files
This commit is contained in:
parent
15b14783d1
commit
b7d2943217
409
src/3rdParty/salomesmesh/CMakeLists.txt.orig
vendored
409
src/3rdParty/salomesmesh/CMakeLists.txt.orig
vendored
|
@ -1,409 +0,0 @@
|
|||
# SGEOM cmake build file
|
||||
#PROJECT(SMESH Fortran CXX)
|
||||
|
||||
SET(SMESH_VERSION_MAJOR 5)
|
||||
SET(SMESH_VERSION_MINOR 1)
|
||||
SET(SMESH_VERSION_PATCH 2)
|
||||
SET(SMESH_VERSION_TWEAK 2)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-sign-compare -Wno-reorder -Wno-switch -Wno-unused-variable -Wno-unused-but-set-variable -Wno-comment")
|
||||
elseif(CMAKE_COMPILER_IS_CLANGXX)
|
||||
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-sign-compare -Wno-reorder -Wno-switch -Wno-unused-variable -Wno-unused-private-field -Wno-unused-function -Wno-sometimes-uninitialized -Wno-overloaded-virtual -Wno-dynamic-class-memaccess -Wno-comment")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_CLANGXX)
|
||||
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-self-assign -Wno-reorder -Wno-switch-enum -Wno-unknown-pragmas -Wno-logical-op-parentheses -Wno-unused-variable -Wno-unused-function -Wno-overloaded-virtual")
|
||||
endif()
|
||||
|
||||
<<<<<<< HEAD
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
|
||||
=======
|
||||
include(${VTK_USE_FILE})
|
||||
>>>>>>> 901e260... FEM: Make SMESH7 compile with occ6
|
||||
include_directories(
|
||||
src/SMDS
|
||||
src/Driver
|
||||
src/DriverUNV
|
||||
src/DriverDAT
|
||||
src/DriverSTL
|
||||
src/StdMeshers
|
||||
inc
|
||||
${CMAKE_BINARY_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${OCC_INCLUDE_DIR}
|
||||
${NGLIB_INCLUDE_DIR}
|
||||
${NETGEN_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
)
|
||||
link_directories(${OCC_LIBRARY_DIR})
|
||||
|
||||
if(MSVC)
|
||||
if(BUILD_FEM_NETGEN)
|
||||
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}
|
||||
)
|
||||
ADD_DEFINITIONS(${NETGEN_DEFINITIONS})
|
||||
else(BUILD_FEM_NETGEN)
|
||||
set(SMESH_LIBS
|
||||
debug MSVCRTD.LIB
|
||||
debug MSVCPRTD.LIB
|
||||
optimized MSVCRT.LIB
|
||||
optimized MSVCPRT.LIB
|
||||
Rpcrt4.lib
|
||||
${OCC_LIBRARIES}
|
||||
${OCC_DEBUG_LIBRARIES}
|
||||
${OCC_OCAF_DEBUG_LIBRARIES}
|
||||
${OCC_OCAF_LIBRARIES}
|
||||
)
|
||||
endif(BUILD_FEM_NETGEN)
|
||||
else(MSVC)
|
||||
if(BUILD_FEM_NETGEN)
|
||||
set(SMESH_LIBS
|
||||
${NGLIB_LIBRARIES}
|
||||
${OCC_LIBRARIES}
|
||||
${OCC_OCAF_LIBRARIES}
|
||||
)
|
||||
ADD_DEFINITIONS(${NETGEN_DEFINITIONS})
|
||||
else(BUILD_FEM_NETGEN)
|
||||
set(SMESH_LIBS
|
||||
${OCC_LIBRARIES}
|
||||
${OCC_OCAF_LIBRARIES}
|
||||
)
|
||||
endif(BUILD_FEM_NETGEN)
|
||||
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)
|
||||
|
||||
#############
|
||||
# FindBoost #
|
||||
#############
|
||||
#FIND_PACKAGE(Boost REQUIRED)
|
||||
#MESSAGE("-- Boost found: ${Boost_FOUND}")
|
||||
#INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
|
||||
#MESSAGE("Popo: ${Boost_INCLUDE_DIR}")
|
||||
|
||||
|
||||
########################################
|
||||
# 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})
|
||||
|
||||
# Tells CMake where are the required headers
|
||||
#INCLUDE_DIRECTORIES(${OCC_INCLUDE_PATH})
|
||||
#LINK_DIRECTORIES(${OCC_LIB_PATH})
|
||||
|
||||
|
||||
############################
|
||||
# Check 32/64 bit platform #
|
||||
############################
|
||||
IF (${CMAKE_SIZEOF_VOID_P} MATCHES "8") # It is 64bit, 32 bit systems returns 4
|
||||
ADD_DEFINITIONS(-D_OCC64)
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# 0001715: Mefisto Mesh Fails since translated by f2c
|
||||
# ADD_DEFINITIONS(-DPCLINUX64)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
#MESSAGE("-- Build 64bit")
|
||||
ELSE (${CMAKE_SIZEOF_VOID_P} MATCHES "8")
|
||||
#MESSAGE("-- Build 32bit")
|
||||
ENDIF(${CMAKE_SIZEOF_VOID_P} MATCHES "8")
|
||||
|
||||
######################################################
|
||||
# Configure Build settings according to the platform #
|
||||
######################################################
|
||||
IF(UNIX)
|
||||
# Same settings are used for both MacOSX and Unix/Linux
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H -DHAVE_LIMITS_H -DCSFDB -DLIN -DOCC_CONVERT_SIGNALS)
|
||||
ELSE(UNIX)
|
||||
IF(WIN32)
|
||||
######### Windows ###########
|
||||
#MESSAGE("-- Windows system detected")
|
||||
IF(MSVC)
|
||||
ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -DNO_My_ctype -DNO_ISATTY -DNO_FPINIT /wd4290 /wd4251 /wd4018 /wd4800 /wd4996 /wd4244 /wd4806 /wd4275 /wd4005 /wd4099 /wd4101 /wd4267 /wd4390)
|
||||
ELSE(MSVC)
|
||||
ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB)
|
||||
ENDIF(MSVC)
|
||||
ELSE(WIN32)
|
||||
MESSAGE("Unknown platform")
|
||||
ENDIF(WIN32)
|
||||
ENDIF(UNIX)
|
||||
|
||||
#########
|
||||
# SMDS #
|
||||
#########
|
||||
FILE(GLOB SMDS_source_files src/SMDS/*.cpp inc/SMDS*.hxx)
|
||||
ADD_LIBRARY(SMDS SHARED ${SMDS_source_files})
|
||||
TARGET_LINK_LIBRARIES(SMDS ${SMESH_LIBS})
|
||||
|
||||
SET_BIN_DIR(SMDS SMDS)
|
||||
if(WIN32)
|
||||
set_target_properties(SMDS PROPERTIES COMPILE_FLAGS "-DSMDS_EXPORTS")
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
##########
|
||||
# Driver #
|
||||
##########
|
||||
FILE(GLOB Driver_source_files src/Driver/*.cpp inc/Driver_*.hxx)
|
||||
ADD_LIBRARY(Driver SHARED ${Driver_source_files})
|
||||
TARGET_LINK_LIBRARIES(Driver ${SMESH_LIBS})
|
||||
|
||||
SET_BIN_DIR(Driver Driver)
|
||||
if(WIN32)
|
||||
set_target_properties(Driver PROPERTIES COMPILE_FLAGS "-DMESHDRIVER_EXPORTS")
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
#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 inc/DriverSTL*.h*)
|
||||
ADD_LIBRARY(DriverSTL SHARED ${DriverSTL_source_files})
|
||||
TARGET_LINK_LIBRARIES(DriverSTL ${SMESH_LIBS} Driver SMDS)
|
||||
|
||||
SET_BIN_DIR(DriverSTL DriverSTL)
|
||||
if(WIN32)
|
||||
set_target_properties(DriverSTL PROPERTIES COMPILE_FLAGS "-DMESHDRIVERSTL_EXPORTS")
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
#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 inc/DriverDAT*.h*)
|
||||
ADD_LIBRARY(DriverDAT SHARED ${DriverDAT_source_files})
|
||||
TARGET_LINK_LIBRARIES(DriverDAT ${SMESH_LIBS} SMDS Driver)
|
||||
|
||||
SET_BIN_DIR(DriverDAT DriverDAT)
|
||||
if(WIN32)
|
||||
set_target_properties(DriverDAT PROPERTIES COMPILE_FLAGS "-DMESHDRIVERDAT_EXPORTS")
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
#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 inc/DriverUNV*.h*)
|
||||
ADD_LIBRARY(DriverUNV SHARED ${DriverUNV_source_files})
|
||||
TARGET_LINK_LIBRARIES(DriverUNV ${SMESH_LIBS} SMESHDS SMDS Driver)
|
||||
|
||||
SET_BIN_DIR(DriverUNV DriverUNV)
|
||||
if(WIN32)
|
||||
set_target_properties(DriverUNV PROPERTIES COMPILE_FLAGS "-DMESHDRIVERUNV_EXPORTS")
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
#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 inc/SMESHDS_*.h*)
|
||||
ADD_LIBRARY(SMESHDS SHARED ${SMESHDS_source_files})
|
||||
TARGET_LINK_LIBRARIES(SMESHDS ${SMESH_LIBS} SMDS )
|
||||
|
||||
SET_BIN_DIR(SMESHDS SMESHDS)
|
||||
|
||||
|
||||
#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 inc/SMESH_*.h*)
|
||||
ADD_LIBRARY(SMESH SHARED ${SMESH_source_files})
|
||||
TARGET_LINK_LIBRARIES(SMESH SMDS SMESHDS Driver DriverSTL DriverDAT DriverUNV ${SMESH_LIBS})
|
||||
|
||||
SET_BIN_DIR(SMESH SMESH)
|
||||
if(WIN32)
|
||||
set_target_properties(SMESH PROPERTIES COMPILE_FLAGS "-DSMESH_EXPORTS -DSMESHCONTROLS_EXPORTS -DSMESHimpl_EXPORTS")
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
#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 #
|
||||
##############
|
||||
#if (MSVC)
|
||||
#IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# # Mefisto2f.lib was built using f2c which created
|
||||
# # all function names with an '_' at the end.
|
||||
# FILE(GLOB MEFISTO2_source_files
|
||||
# src/MEFISTO2/*.cpp
|
||||
# inc/Rn.h
|
||||
# inc/aptrte.h
|
||||
# )
|
||||
#ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# FILE(GLOB MEFISTO2_source_files
|
||||
# src/MEFISTO2/*.cpp
|
||||
# src/MEFISTO2/MEFISTO2F.def
|
||||
# inc/Rn.h
|
||||
# inc/aptrte.h
|
||||
# )
|
||||
#ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
|
||||
set(MEFISTO2_source_files
|
||||
src/MEFISTO2/aptrte.cpp
|
||||
src/MEFISTO2/trte.c
|
||||
inc/Rn.h
|
||||
inc/aptrte.h
|
||||
)
|
||||
|
||||
#else(MSVC)
|
||||
# FILE(GLOB MEFISTO2_source_files
|
||||
# src/MEFISTO2/*.cpp
|
||||
# src/MEFISTO2/trte.f
|
||||
# inc/Rn.h
|
||||
# inc/aptrte.h
|
||||
# )
|
||||
#endif(MSVC)
|
||||
|
||||
ADD_LIBRARY(MEFISTO2 SHARED ${MEFISTO2_source_files})
|
||||
|
||||
SET_BIN_DIR(MEFISTO2 MEFISTO2)
|
||||
#if(MSVC)
|
||||
TARGET_LINK_LIBRARIES(MEFISTO2 ${SMESH_LIBS}) # in case of Windows link the prebuild Fortran lib
|
||||
set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "-DMEFISTO2D_EXPORTS")
|
||||
# if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "-DMEFISTO2D_EXPORTS")
|
||||
# else(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "-DMEFISTO2D_EXPORTS -D__WATCOM__")
|
||||
# endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
#elseif(MINGW)
|
||||
# TARGET_LINK_LIBRARIES(MEFISTO2 ${SMESH_LIBS} gfortran)
|
||||
# set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "-DMEFISTO2D_EXPORTS")
|
||||
#else(MSVC)
|
||||
# TARGET_LINK_LIBRARIES(MEFISTO2 ${SMESH_LIBS} gfortran)
|
||||
# set_target_properties(MEFISTO2 PROPERTIES COMPILE_FLAGS "${MEFISTO2_CFLAGS}")
|
||||
#endif(MSVC)
|
||||
|
||||
|
||||
##############
|
||||
# StdMeshers #
|
||||
##############
|
||||
FILE(GLOB StdMeshers_source_files src/StdMeshers/*.cpp inc/StdMeshers_*.h*)
|
||||
ADD_LIBRARY(StdMeshers SHARED ${StdMeshers_source_files})
|
||||
TARGET_LINK_LIBRARIES(StdMeshers SMESH ${SMESH_LIBS} MEFISTO2)
|
||||
|
||||
SET_BIN_DIR(StdMeshers StdMeshers)
|
||||
if(WIN32)
|
||||
set_target_properties(StdMeshers PROPERTIES COMPILE_FLAGS "-DSTDMESHERS_EXPORTS")
|
||||
else(WIN32)
|
||||
set_target_properties(StdMeshers PROPERTIES COMPILE_FLAGS "${StdMeshers_CFLAGS}")
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
#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)
|
||||
|
||||
# Disable for all other compilers but MSVC
|
||||
if (BUILD_FEM_NETGEN)
|
||||
|
||||
################
|
||||
# NETGENPlugin #
|
||||
################
|
||||
FILE(GLOB NETGENPlugin_source_files src/NETGENPlugin/*.cpp inc/NETGENPlugin_*.h* )
|
||||
ADD_LIBRARY(NETGENPlugin SHARED ${NETGENPlugin_source_files})
|
||||
TARGET_LINK_LIBRARIES(NETGENPlugin SMDS SMESHDS SMESH StdMeshers ${SMESH_LIBS} )
|
||||
|
||||
SET_BIN_DIR(NETGENPlugin NETGENPlugin)
|
||||
if(WIN32)
|
||||
set_target_properties(NETGENPlugin PROPERTIES COMPILE_FLAGS "-DNETGENPLUGIN_EXPORTS -DNO_PARALLEL_THREADS -DOCCGEOMETRY -DNETGEN_V5")
|
||||
endif(WIN32)
|
||||
|
||||
endif (BUILD_FEM_NETGEN)
|
||||
|
||||
#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)
|
||||
|
||||
|
||||
if(WIN32)
|
||||
INSTALL(TARGETS SMDS Driver DriverSTL DriverDAT DriverUNV SMESHDS SMESH MEFISTO2 StdMeshers
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
else(WIN32)
|
||||
INSTALL(TARGETS SMDS Driver DriverSTL DriverDAT DriverUNV SMESHDS SMESH MEFISTO2 StdMeshers
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
if (BUILD_FEM_NETGEN)
|
||||
if(WIN32)
|
||||
INSTALL(TARGETS NETGENPlugin
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
else(WIN32)
|
||||
INSTALL(TARGETS NETGENPlugin
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endif(WIN32)
|
||||
endif (BUILD_FEM_NETGEN)
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
<<<<<<< bca7a1866e596ad2e318809f35b6d08776226a69
|
||||
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
|
||||
//
|
||||
// Copyright (C) 2003 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
|
||||
//
|
||||
// File : SMESH_MeshVSLink.cxx
|
||||
// Created : Mon Dec 1 09:00:00 2008
|
||||
// Author : Sioutis Fotios
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _Handle_SMESH_MeshVSLink_HeaderFile
|
||||
#define _Handle_SMESH_MeshVSLink_HeaderFile
|
||||
|
||||
#ifndef _Standard_Macro_HeaderFile
|
||||
#include <Standard_Macro.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Version_HeaderFile
|
||||
#include <Standard_Version.hxx>
|
||||
#endif
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
#ifndef _Handle_MeshVS_DataSource3D_HeaderFile
|
||||
#include <Handle_MeshVS_DataSource3D.hxx>
|
||||
#endif
|
||||
|
||||
class Standard_Transient;
|
||||
class Handle_Standard_Type;
|
||||
class Handle(MeshVS_DataSource3D);
|
||||
class SMESH_MeshVSLink;
|
||||
|
||||
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESH_MeshVSLink);
|
||||
|
||||
class Handle(SMESH_MeshVSLink) : public Handle(MeshVS_DataSource3D) {
|
||||
public:
|
||||
Handle(SMESH_MeshVSLink)():Handle(MeshVS_DataSource3D)() {}
|
||||
Handle(SMESH_MeshVSLink)(const Handle(SMESH_MeshVSLink)& aHandle) : Handle(MeshVS_DataSource3D)(aHandle)
|
||||
{
|
||||
}
|
||||
|
||||
Handle(SMESH_MeshVSLink)(const SMESH_MeshVSLink* anItem) : Handle(MeshVS_DataSource3D)((MeshVS_DataSource3D *)anItem)
|
||||
{
|
||||
}
|
||||
|
||||
Handle(SMESH_MeshVSLink)& operator=(const Handle(SMESH_MeshVSLink)& aHandle)
|
||||
{
|
||||
Assign(aHandle.Access());
|
||||
return *this;
|
||||
}
|
||||
|
||||
Handle(SMESH_MeshVSLink)& operator=(const SMESH_MeshVSLink* anItem)
|
||||
{
|
||||
Assign((Standard_Transient *)anItem);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SMESH_MeshVSLink* operator->() const
|
||||
{
|
||||
return (SMESH_MeshVSLink *)ControlAccess();
|
||||
}
|
||||
|
||||
Standard_EXPORT static const Handle(SMESH_MeshVSLink) DownCast(const Handle(Standard_Transient)& AnObject);
|
||||
};
|
||||
#endif // OCC_VERSION_HEX < 0x070000
|
||||
#endif
|
||||
=======
|
||||
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
|
||||
//
|
||||
// Copyright (C) 2003 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
|
||||
//
|
||||
// File : SMESH_MeshVSLink.cxx
|
||||
// Created : Mon Dec 1 09:00:00 2008
|
||||
// Author : Sioutis Fotios
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _Handle_SMESH_MeshVSLink_HeaderFile
|
||||
#define _Handle_SMESH_MeshVSLink_HeaderFile
|
||||
|
||||
#ifndef _Standard_Macro_HeaderFile
|
||||
#include <Standard_Macro.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_MeshVS_DataSource3D_HeaderFile
|
||||
//#include <Handle_MeshVS_DataSource3D.hxx>
|
||||
#include <MeshVS_DataSource3D.hxx>
|
||||
#endif
|
||||
|
||||
class Standard_Transient;
|
||||
class Handle_Standard_Type;
|
||||
class Handle(MeshVS_DataSource3D);
|
||||
class SMESH_MeshVSLink;
|
||||
|
||||
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESH_MeshVSLink);
|
||||
|
||||
class Handle(SMESH_MeshVSLink) : public Handle(MeshVS_DataSource3D) {
|
||||
public:
|
||||
Handle(SMESH_MeshVSLink)():Handle(MeshVS_DataSource3D)() {}
|
||||
Handle(SMESH_MeshVSLink)(const Handle(SMESH_MeshVSLink)& aHandle) : Handle(MeshVS_DataSource3D)(aHandle)
|
||||
{
|
||||
}
|
||||
|
||||
Handle(SMESH_MeshVSLink)(const SMESH_MeshVSLink* anItem) : Handle(MeshVS_DataSource3D)((MeshVS_DataSource3D *)anItem)
|
||||
{
|
||||
}
|
||||
|
||||
Handle(SMESH_MeshVSLink)& operator=(const Handle(SMESH_MeshVSLink)& aHandle)
|
||||
{
|
||||
Assign(aHandle.Access());
|
||||
return *this;
|
||||
}
|
||||
|
||||
Handle(SMESH_MeshVSLink)& operator=(const SMESH_MeshVSLink* anItem)
|
||||
{
|
||||
Assign((Standard_Transient *)anItem);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SMESH_MeshVSLink* operator->() const
|
||||
{
|
||||
return (SMESH_MeshVSLink *)ControlAccess();
|
||||
}
|
||||
|
||||
Standard_EXPORT static const Handle(SMESH_MeshVSLink) DownCast(const Handle(Standard_Transient)& AnObject);
|
||||
};
|
||||
#endif
|
||||
>>>>>>> upgrade to SMESH7.7.1
|
|
@ -1,105 +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 : SMDSAbs_ElementType.hxx
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifndef _SMDSAbs_ElementType_HeaderFile
|
||||
#define _SMDSAbs_ElementType_HeaderFile
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Type (node, edge, face or volume) of elements
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
enum SMDSAbs_ElementType
|
||||
{
|
||||
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,
|
||||
};
|
||||
|
||||
|
||||
enum SMDSAbs_ElementOrder {
|
||||
ORDER_ANY, /*! entities of any order */
|
||||
ORDER_LINEAR, /*! entities of 1st order */
|
||||
ORDER_QUADRATIC /*! entities of 2nd order */
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
/*!
|
||||
* Enumeration of entity type used in mesh info array
|
||||
*/
|
||||
enum SMDSAbs_EntityType {
|
||||
SMDSEntity_Node,
|
||||
SMDSEntity_0D,
|
||||
SMDSEntity_Edge,
|
||||
SMDSEntity_Quad_Edge,
|
||||
SMDSEntity_Triangle,
|
||||
SMDSEntity_Quad_Triangle,
|
||||
SMDSEntity_BiQuad_Triangle,
|
||||
SMDSEntity_Quadrangle,
|
||||
SMDSEntity_Quad_Quadrangle,
|
||||
SMDSEntity_BiQuad_Quadrangle,
|
||||
SMDSEntity_Polygon,
|
||||
#ifndef VTK_NO_QUAD_POLY
|
||||
SMDSEntity_Quad_Polygon,
|
||||
#endif
|
||||
SMDSEntity_Tetra,
|
||||
SMDSEntity_Quad_Tetra,
|
||||
SMDSEntity_Pyramid,
|
||||
SMDSEntity_Quad_Pyramid,
|
||||
SMDSEntity_Hexa,
|
||||
SMDSEntity_Quad_Hexa,
|
||||
SMDSEntity_TriQuad_Hexa,
|
||||
SMDSEntity_Penta,
|
||||
SMDSEntity_Quad_Penta,
|
||||
SMDSEntity_Hexagonal_Prism,
|
||||
SMDSEntity_Polyhedra,
|
||||
SMDSEntity_Quad_Polyhedra,
|
||||
SMDSEntity_Ball,
|
||||
SMDSEntity_Last
|
||||
};
|
||||
|
||||
>>>>>>> c5d257d... SMESH: Make it compatibel to VTK 6.0
|
||||
#endif
|
393
src/3rdParty/salomesmesh/inc/SMDS_MeshInfo.hxx.orig
vendored
393
src/3rdParty/salomesmesh/inc/SMDS_MeshInfo.hxx.orig
vendored
|
@ -1,393 +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
|
||||
//
|
||||
// File : SMDS_MeshInfo.hxx
|
||||
// Created : Mon Sep 24 18:32:41 2007
|
||||
// Author : Edward AGAPOV (eap)
|
||||
//
|
||||
#ifndef SMDS_MeshInfo_HeaderFile
|
||||
#define SMDS_MeshInfo_HeaderFile
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "SMESH_SMDS.hxx"
|
||||
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
|
||||
class SMDS_EXPORT SMDS_MeshInfo
|
||||
{
|
||||
public:
|
||||
|
||||
inline SMDS_MeshInfo();
|
||||
inline void Clear();
|
||||
|
||||
int NbNodes() const { return myNbNodes; }
|
||||
|
||||
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;
|
||||
inline int NbQuadrangles(SMDSAbs_ElementOrder order = ORDER_ANY) const;
|
||||
int NbPolygons() const { return myNbPolygons; }
|
||||
|
||||
inline int NbVolumes (SMDSAbs_ElementOrder order = ORDER_ANY) const;
|
||||
inline int NbTetras (SMDSAbs_ElementOrder order = ORDER_ANY) const;
|
||||
inline int NbHexas (SMDSAbs_ElementOrder order = ORDER_ANY) const;
|
||||
inline int NbPyramids(SMDSAbs_ElementOrder order = ORDER_ANY) const;
|
||||
inline int NbPrisms (SMDSAbs_ElementOrder order = ORDER_ANY) const;
|
||||
int NbPolyhedrons() const { return myNbPolyhedrons; }
|
||||
|
||||
private:
|
||||
friend class SMDS_Mesh;
|
||||
|
||||
// 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);
|
||||
// methods to remove elements of ANY kind
|
||||
inline void RemoveEdge(const SMDS_MeshElement* el);
|
||||
inline void RemoveFace(const SMDS_MeshElement* el);
|
||||
inline void RemoveVolume(const SMDS_MeshElement* el);
|
||||
|
||||
int myNbNodes;
|
||||
|
||||
int myNbEdges , myNbQuadEdges ;
|
||||
int myNbTriangles , myNbQuadTriangles ;
|
||||
int myNbQuadrangles, myNbQuadQuadrangles;
|
||||
int myNbPolygons;
|
||||
|
||||
int myNbTetras , myNbQuadTetras ;
|
||||
int myNbHexas , myNbQuadHexas ;
|
||||
int myNbPyramids, myNbQuadPyramids;
|
||||
int myNbPrisms , myNbQuadPrisms ;
|
||||
int myNbPolyhedrons;
|
||||
|
||||
std::vector<int*> myNb; // pointers to myNb... fields
|
||||
std::vector<int> myShift; // shift to get an index in myNb by elem->NbNodes()
|
||||
};
|
||||
|
||||
inline SMDS_MeshInfo::SMDS_MeshInfo():
|
||||
myNbNodes(0),
|
||||
myNbEdges (0), myNbQuadEdges (0),
|
||||
myNbTriangles (0), myNbQuadTriangles (0),
|
||||
myNbQuadrangles(0), myNbQuadQuadrangles(0),
|
||||
myNbPolygons(0),
|
||||
myNbTetras (0), myNbQuadTetras (0),
|
||||
myNbHexas (0), myNbQuadHexas (0),
|
||||
myNbPyramids(0), myNbQuadPyramids(0),
|
||||
myNbPrisms (0), myNbQuadPrisms (0),
|
||||
myNbPolyhedrons(0)
|
||||
{
|
||||
// Number of nodes in standard element types
|
||||
// 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
|
||||
// 20 *
|
||||
//
|
||||
// So to have a unique index for each type basing on nb of nodes, we use a shift:
|
||||
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_Edge,2 )] = & myNbEdges;
|
||||
myNb[ index( SMDSAbs_Edge,4 )] = & myNbQuadEdges;
|
||||
|
||||
myNb[ index( SMDSAbs_Face,3 )] = & myNbTriangles;
|
||||
myNb[ index( SMDSAbs_Face,4 )] = & myNbQuadrangles;
|
||||
myNb[ index( SMDSAbs_Face,6 )] = & myNbQuadTriangles;
|
||||
myNb[ index( SMDSAbs_Face,8 )] = & myNbQuadQuadrangles;
|
||||
|
||||
myNb[ index( SMDSAbs_Volume, 4)] = & myNbTetras;
|
||||
myNb[ index( SMDSAbs_Volume, 5)] = & myNbPyramids;
|
||||
myNb[ index( SMDSAbs_Volume, 6)] = & myNbPrisms;
|
||||
myNb[ index( SMDSAbs_Volume, 8)] = & myNbHexas;
|
||||
myNb[ index( SMDSAbs_Volume, 10)] = & myNbQuadTetras;
|
||||
myNb[ index( SMDSAbs_Volume, 13)] = & myNbQuadPyramids;
|
||||
myNb[ index( SMDSAbs_Volume, 15)] = & myNbQuadPrisms;
|
||||
myNb[ index( SMDSAbs_Volume, 20)] = & myNbQuadHexas;
|
||||
}
|
||||
inline void // Clear
|
||||
SMDS_MeshInfo::Clear()
|
||||
{ for ( std::size_t i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0;
|
||||
myNbPolygons=myNbPolyhedrons=0;
|
||||
}
|
||||
inline int // index
|
||||
SMDS_MeshInfo::index(SMDSAbs_ElementType type, int nbNodes)
|
||||
{ return nbNodes + myShift[ type ]; }
|
||||
|
||||
inline void // remove
|
||||
SMDS_MeshInfo::remove(const SMDS_MeshElement* el)
|
||||
{ --(*myNb[ index(el->GetType(), el->NbNodes()) ]); }
|
||||
|
||||
inline void // add
|
||||
SMDS_MeshInfo::add(const SMDS_MeshElement* el)
|
||||
{ ++(*myNb[ index(el->GetType(), el->NbNodes()) ]); }
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
inline void // addWithPoly
|
||||
SMDS_MeshInfo::addWithPoly(const SMDS_MeshElement* el) {
|
||||
switch ( el->GetEntityType() ) {
|
||||
case SMDSEntity_Polygon: ++myNbPolygons; break;
|
||||
#ifndef VTK_NO_QUAD_POLY
|
||||
case SMDSEntity_Quad_Polygon: ++myNbQuadPolygons; break;
|
||||
#endif
|
||||
case SMDSEntity_Polyhedra: ++myNbPolyhedrons; break;
|
||||
default: add(el);
|
||||
}
|
||||
}
|
||||
>>>>>>> c5d257d... SMESH: Make it compatibel to VTK 6.0
|
||||
inline void // RemoveEdge
|
||||
SMDS_MeshInfo::RemoveEdge(const SMDS_MeshElement* el)
|
||||
{ if ( el->IsQuadratic() ) --myNbQuadEdges; else --myNbEdges; }
|
||||
|
||||
inline void // RemoveFace
|
||||
<<<<<<< HEAD
|
||||
SMDS_MeshInfo::RemoveFace(const SMDS_MeshElement* el)
|
||||
{ if ( el->IsPoly() ) --myNbPolygons; else remove( el ); }
|
||||
=======
|
||||
SMDS_MeshInfo::RemoveFace(const SMDS_MeshElement* el) {
|
||||
switch ( el->GetEntityType() ) {
|
||||
case SMDSEntity_Polygon: --myNbPolygons; break;
|
||||
#ifndef VTK_NO_QUAD_POLY
|
||||
case SMDSEntity_Quad_Polygon: --myNbQuadPolygons; break;
|
||||
#endif
|
||||
default: remove(el);
|
||||
}
|
||||
}
|
||||
>>>>>>> c5d257d... SMESH: Make it compatibel to VTK 6.0
|
||||
|
||||
inline void // RemoveVolume
|
||||
SMDS_MeshInfo::RemoveVolume(const SMDS_MeshElement* el)
|
||||
{ if ( el->IsPoly() ) --myNbPolyhedrons; else remove( el ); }
|
||||
|
||||
inline int // NbEdges
|
||||
SMDS_MeshInfo::NbEdges (SMDSAbs_ElementOrder order) const
|
||||
{ return order == ORDER_ANY ? myNbEdges+myNbQuadEdges : order == ORDER_LINEAR ? myNbEdges : myNbQuadEdges; }
|
||||
|
||||
inline int // NbFaces
|
||||
SMDS_MeshInfo::NbFaces (SMDSAbs_ElementOrder order) const
|
||||
{ return NbTriangles(order)+NbQuadrangles(order)+(order == ORDER_QUADRATIC ? 0 : myNbPolygons); }
|
||||
|
||||
inline int // NbTriangles
|
||||
SMDS_MeshInfo::NbTriangles (SMDSAbs_ElementOrder order) const
|
||||
{ return order == ORDER_ANY ? myNbTriangles+myNbQuadTriangles : order == ORDER_LINEAR ? myNbTriangles : myNbQuadTriangles; }
|
||||
|
||||
inline int // NbQuadrangles
|
||||
SMDS_MeshInfo::NbQuadrangles(SMDSAbs_ElementOrder order) const
|
||||
{ return order == ORDER_ANY ? myNbQuadrangles+myNbQuadQuadrangles : order == ORDER_LINEAR ? myNbQuadrangles : myNbQuadQuadrangles; }
|
||||
|
||||
inline int // NbVolumes
|
||||
SMDS_MeshInfo::NbVolumes (SMDSAbs_ElementOrder order) const
|
||||
{ return NbTetras(order) + NbHexas(order) + NbPyramids(order) + NbPrisms(order) + (order == ORDER_QUADRATIC ? 0 : myNbPolyhedrons); }
|
||||
|
||||
inline int // NbTetras
|
||||
SMDS_MeshInfo::NbTetras (SMDSAbs_ElementOrder order) const
|
||||
{ return order == ORDER_ANY ? myNbTetras+myNbQuadTetras : order == ORDER_LINEAR ? myNbTetras : myNbQuadTetras; }
|
||||
|
||||
inline int // NbHexas
|
||||
SMDS_MeshInfo::NbHexas (SMDSAbs_ElementOrder order) const
|
||||
{ return order == ORDER_ANY ? myNbHexas+myNbQuadHexas : order == ORDER_LINEAR ? myNbHexas : myNbQuadHexas; }
|
||||
|
||||
inline int // NbPyramids
|
||||
SMDS_MeshInfo::NbPyramids(SMDSAbs_ElementOrder order) const
|
||||
{ return order == ORDER_ANY ? myNbPyramids+myNbQuadPyramids : order == ORDER_LINEAR ? myNbPyramids : myNbQuadPyramids; }
|
||||
|
||||
inline int // NbPrisms
|
||||
SMDS_MeshInfo::NbPrisms (SMDSAbs_ElementOrder order) const
|
||||
{ return order == ORDER_ANY ? myNbPrisms+myNbQuadPrisms : order == ORDER_LINEAR ? myNbPrisms : myNbQuadPrisms; }
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
inline int // NbHexPrisms
|
||||
SMDS_MeshInfo::NbHexPrisms (SMDSAbs_ElementOrder order) const
|
||||
{ return order == ORDER_ANY ? myNbHexPrism : order == ORDER_LINEAR ? myNbHexPrism : 0; }
|
||||
|
||||
inline int // NbElements
|
||||
SMDS_MeshInfo::NbElements(SMDSAbs_ElementType type) const
|
||||
{
|
||||
int nb = 0;
|
||||
switch (type) {
|
||||
case SMDSAbs_All:
|
||||
for ( int i=1+index( SMDSAbs_Node,1 ); i<myNb.size(); ++i ) if ( myNb[i] ) nb += *myNb[i];
|
||||
nb += myNbPolygons + myNbQuadPolygons + myNbPolyhedrons;
|
||||
break;
|
||||
case SMDSAbs_Volume:
|
||||
nb = ( myNbTetras+ myNbPyramids+ myNbPrisms+ myNbHexas+ myNbHexPrism+
|
||||
myNbQuadTetras+ myNbQuadPyramids+ myNbQuadPrisms+ myNbQuadHexas+ myNbTriQuadHexas+
|
||||
myNbPolyhedrons );
|
||||
break;
|
||||
case SMDSAbs_Face:
|
||||
nb = ( myNbTriangles+ myNbQuadrangles+
|
||||
myNbQuadTriangles+ myNbBiQuadTriangles+
|
||||
myNbQuadQuadrangles+ myNbBiQuadQuadrangles+ myNbPolygons+ myNbQuadPolygons );
|
||||
break;
|
||||
case SMDSAbs_Edge:
|
||||
nb = myNbEdges + myNbQuadEdges;
|
||||
break;
|
||||
case SMDSAbs_Node:
|
||||
nb = myNbNodes;
|
||||
break;
|
||||
case SMDSAbs_0DElement:
|
||||
nb = myNb0DElements;
|
||||
break;
|
||||
case SMDSAbs_Ball:
|
||||
nb = myNbBalls;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
return nb;
|
||||
}
|
||||
|
||||
inline int // NbEntities
|
||||
SMDS_MeshInfo::NbEntities(SMDSAbs_EntityType type) const
|
||||
{
|
||||
switch (type) {
|
||||
case SMDSEntity_Node: return myNbNodes;
|
||||
case SMDSEntity_Edge: return myNbEdges;
|
||||
case SMDSEntity_Quad_Edge: return myNbQuadEdges;
|
||||
case SMDSEntity_Triangle: return myNbTriangles;
|
||||
case SMDSEntity_Quad_Triangle: return myNbQuadTriangles;
|
||||
case SMDSEntity_BiQuad_Triangle: return myNbBiQuadTriangles;
|
||||
case SMDSEntity_Quadrangle: return myNbQuadrangles;
|
||||
case SMDSEntity_Quad_Quadrangle: return myNbQuadQuadrangles;
|
||||
case SMDSEntity_BiQuad_Quadrangle:return myNbBiQuadQuadrangles;
|
||||
case SMDSEntity_Polygon: return myNbPolygons;
|
||||
case SMDSEntity_Tetra: return myNbTetras;
|
||||
case SMDSEntity_Quad_Tetra: return myNbQuadTetras;
|
||||
case SMDSEntity_Pyramid: return myNbPyramids;
|
||||
case SMDSEntity_Quad_Pyramid: return myNbQuadPyramids;
|
||||
case SMDSEntity_Hexa: return myNbHexas;
|
||||
case SMDSEntity_Quad_Hexa: return myNbQuadHexas;
|
||||
case SMDSEntity_TriQuad_Hexa: return myNbTriQuadHexas;
|
||||
case SMDSEntity_Penta: return myNbPrisms;
|
||||
case SMDSEntity_Quad_Penta: return myNbQuadPrisms;
|
||||
case SMDSEntity_Hexagonal_Prism: return myNbHexPrism;
|
||||
case SMDSEntity_Polyhedra: return myNbPolyhedrons;
|
||||
case SMDSEntity_0D: return myNb0DElements;
|
||||
case SMDSEntity_Ball: return myNbBalls;
|
||||
#ifndef VTK_NO_QUAD_POLY
|
||||
case SMDSEntity_Quad_Polygon: return myNbQuadPolygons;
|
||||
#endif
|
||||
case SMDSEntity_Quad_Polyhedra:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int // NbElementsOfGeom
|
||||
SMDS_MeshInfo::NbElementsOfGeom(SMDSAbs_GeometryType geom) const
|
||||
{
|
||||
switch ( geom ) {
|
||||
// 0D:
|
||||
case SMDSGeom_POINT: return myNb0DElements;
|
||||
// 1D:
|
||||
case SMDSGeom_EDGE: return (myNbEdges +
|
||||
myNbQuadEdges);
|
||||
// 2D:
|
||||
case SMDSGeom_TRIANGLE: return (myNbTriangles +
|
||||
myNbQuadTriangles +
|
||||
myNbBiQuadTriangles );
|
||||
case SMDSGeom_QUADRANGLE: return (myNbQuadrangles +
|
||||
myNbQuadQuadrangles +
|
||||
myNbBiQuadQuadrangles );
|
||||
case SMDSGeom_POLYGON: return (myNbPolygons + myNbQuadPolygons );
|
||||
// 3D:
|
||||
case SMDSGeom_TETRA: return (myNbTetras +
|
||||
myNbQuadTetras);
|
||||
case SMDSGeom_PYRAMID: return (myNbPyramids +
|
||||
myNbQuadPyramids);
|
||||
case SMDSGeom_HEXA: return (myNbHexas +
|
||||
myNbQuadHexas +
|
||||
myNbTriQuadHexas);
|
||||
case SMDSGeom_PENTA: return (myNbPrisms +
|
||||
myNbQuadPrisms);
|
||||
case SMDSGeom_HEXAGONAL_PRISM: return myNbHexPrism;
|
||||
case SMDSGeom_POLYHEDRA: return myNbPolyhedrons;
|
||||
// Discrete:
|
||||
case SMDSGeom_BALL: return myNbBalls;
|
||||
//
|
||||
case SMDSGeom_NONE:
|
||||
default:;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void // setNb
|
||||
SMDS_MeshInfo::setNb(const SMDSAbs_EntityType geomType, const int nb)
|
||||
{
|
||||
switch (geomType) {
|
||||
case SMDSEntity_Node: myNbNodes = nb; break;
|
||||
case SMDSEntity_0D: myNb0DElements = nb; break;
|
||||
case SMDSEntity_Ball: myNbBalls = nb; break;
|
||||
case SMDSEntity_BiQuad_Quadrangle:myNbBiQuadQuadrangles = nb; break;
|
||||
case SMDSEntity_BiQuad_Triangle: myNbBiQuadTriangles = nb; break;
|
||||
case SMDSEntity_Edge: myNbEdges = nb; break;
|
||||
case SMDSEntity_Hexa: myNbHexas = nb; break;
|
||||
case SMDSEntity_Hexagonal_Prism: myNbHexPrism = nb; break;
|
||||
case SMDSEntity_Penta: myNbPrisms = nb; break;
|
||||
case SMDSEntity_Polygon: myNbPolygons = nb; break;
|
||||
case SMDSEntity_Polyhedra: myNbPolyhedrons = nb; break;
|
||||
case SMDSEntity_Pyramid: myNbPyramids = nb; break;
|
||||
case SMDSEntity_Quad_Edge: myNbQuadEdges = nb; break;
|
||||
case SMDSEntity_Quad_Hexa: myNbQuadHexas = nb; break;
|
||||
case SMDSEntity_Quad_Penta: myNbQuadPrisms = nb; break;
|
||||
case SMDSEntity_Quad_Pyramid: myNbQuadPyramids = nb; break;
|
||||
case SMDSEntity_Quad_Quadrangle: myNbQuadQuadrangles = nb; break;
|
||||
case SMDSEntity_Quad_Tetra: myNbQuadTetras = nb; break;
|
||||
case SMDSEntity_Quad_Triangle: myNbQuadTriangles = nb; break;
|
||||
case SMDSEntity_Quadrangle: myNbQuadrangles = nb; break;
|
||||
case SMDSEntity_Tetra: myNbTetras = nb; break;
|
||||
case SMDSEntity_TriQuad_Hexa: myNbTriQuadHexas = nb; break;
|
||||
case SMDSEntity_Triangle: myNbTriangles = nb; break;
|
||||
#ifndef VTK_NO_QUAD_POLY
|
||||
case SMDSEntity_Quad_Polygon: myNbQuadPolygons = nb; break;
|
||||
#endif
|
||||
case SMDSEntity_Quad_Polyhedra:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
>>>>>>> c5d257d... SMESH: Make it compatibel to VTK 6.0
|
||||
#endif
|
175
src/3rdParty/salomesmesh/inc/SMESH_Gen.hxx.orig
vendored
175
src/3rdParty/salomesmesh/inc/SMESH_Gen.hxx.orig
vendored
|
@ -1,175 +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 : SMESH_Gen.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
//
|
||||
|
||||
#ifndef _SMESH_GEN_HXX_
|
||||
#define _SMESH_GEN_HXX_
|
||||
|
||||
#include "SMESH_SMESH.hxx"
|
||||
|
||||
#include "SMESH_Exception.hxx"
|
||||
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
#include "SMESH_ComputeError.hxx"
|
||||
#include "SMESH_Algo.hxx"
|
||||
#include "SMESH_0D_Algo.hxx"
|
||||
#include "SMESH_1D_Algo.hxx"
|
||||
#include "SMESH_2D_Algo.hxx"
|
||||
#include "SMESH_3D_Algo.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
class SMESHDS_Document;
|
||||
|
||||
typedef SMESH_Hypothesis::Hypothesis_Status TAlgoStateErrorName;
|
||||
|
||||
typedef struct studyContextStruct
|
||||
{
|
||||
std::map < int, SMESH_Hypothesis * >mapHypothesis;
|
||||
std::map < int, SMESH_Mesh * >mapMesh;
|
||||
SMESHDS_Document * myDocument;
|
||||
} StudyContextStruct;
|
||||
|
||||
typedef std::set<int> TSetOfInt;
|
||||
|
||||
class SMESH_EXPORT SMESH_Gen
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
public:
|
||||
SMESH_Gen();
|
||||
=======
|
||||
public:
|
||||
>>>>>>> 9778eb1... FEM: Use single smesh mesh generator throughout FreeCAD
|
||||
~SMESH_Gen();
|
||||
|
||||
static SMESH_Gen* get();
|
||||
|
||||
SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode)
|
||||
throw(SMESH_Exception);
|
||||
|
||||
/*!
|
||||
* \brief Computes aMesh on aShape
|
||||
* \param anUpward - compute from vertices up to more complex shape (internal usage)
|
||||
* \param aDim - upper level dimension of the mesh computation
|
||||
* \param aShapesId - list of shapes with computed mesh entities (elements or nodes)
|
||||
* \retval bool - true if none submesh failed to compute
|
||||
*/
|
||||
bool Compute(::SMESH_Mesh & aMesh,
|
||||
const TopoDS_Shape & aShape,
|
||||
const bool anUpward=false,
|
||||
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
|
||||
// if Compute() would fail because of some algo bad state
|
||||
|
||||
/*!
|
||||
* \brief Sets number of segments per diagonal of boundary box of geometry by which
|
||||
* default segment length of appropriate 1D hypotheses is defined
|
||||
*/
|
||||
void SetBoundaryBoxSegmentation( int theNbSegments ) { _segmentation = theNbSegments; }
|
||||
int GetBoundaryBoxSegmentation() const { return _segmentation; }
|
||||
/*!
|
||||
* \brief Sets default number of segments per edge
|
||||
*/
|
||||
void SetDefaultNbSegments(int nb) { _nbSegments = nb; }
|
||||
int GetDefaultNbSegments() const { return _nbSegments; }
|
||||
|
||||
struct TAlgoStateError
|
||||
{
|
||||
TAlgoStateErrorName _name;
|
||||
const SMESH_Algo* _algo;
|
||||
int _algoDim;
|
||||
bool _isGlobalAlgo;
|
||||
|
||||
TAlgoStateError(): _name(SMESH_Hypothesis::HYP_OK),_algo(0),_algoDim(0) {}
|
||||
void Set(TAlgoStateErrorName name, const SMESH_Algo* algo, bool isGlobal)
|
||||
{ _name = name; _algo = algo; _algoDim = algo->GetDim(); _isGlobalAlgo = isGlobal; }
|
||||
void Set(TAlgoStateErrorName name, const int algoDim, bool isGlobal)
|
||||
{ _name = name; _algo = 0; _algoDim = algoDim; _isGlobalAlgo = isGlobal; }
|
||||
};
|
||||
|
||||
bool GetAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
|
||||
std::list< SMESH_Gen::TAlgoStateError > & theErrors);
|
||||
// notify on bad state of attached algos, return false
|
||||
// if Compute() would fail because of some algo bad state
|
||||
// theErrors list contains problems description
|
||||
|
||||
StudyContextStruct *GetStudyContext(int studyId);
|
||||
|
||||
static int GetShapeDim(const TopAbs_ShapeEnum & aShapeType);
|
||||
static int GetShapeDim(const TopoDS_Shape & aShape)
|
||||
{ return GetShapeDim( aShape.ShapeType() ); }
|
||||
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;
|
||||
std::map < int, SMESH_0D_Algo * >_map0D_Algo;
|
||||
std::map < int, SMESH_1D_Algo * >_map1D_Algo;
|
||||
std::map < int, SMESH_2D_Algo * >_map2D_Algo;
|
||||
std::map < int, SMESH_3D_Algo * >_map3D_Algo;
|
||||
|
||||
<<<<<<< HEAD
|
||||
private:
|
||||
=======
|
||||
protected:
|
||||
SMESH_Gen();
|
||||
static SMESH_Gen* generator;
|
||||
|
||||
private:
|
||||
>>>>>>> 9778eb1... FEM: Use single smesh mesh generator throughout FreeCAD
|
||||
|
||||
int _localId; // unique Id of created objects, within SMESH_Gen entity
|
||||
std::map < int, StudyContextStruct * >_mapStudyContext;
|
||||
|
||||
// hypotheses managing
|
||||
int _hypId;
|
||||
|
||||
// number of segments per diagonal of boundary box of geometry by which
|
||||
// default segment length of appropriate 1D hypotheses is defined
|
||||
int _segmentation;
|
||||
// default of segments
|
||||
int _nbSegments;
|
||||
};
|
||||
|
||||
#endif
|
400
src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx.orig
vendored
400
src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx.orig
vendored
|
@ -1,400 +0,0 @@
|
|||
// Copyright (C) 2007-2015 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, or (at your option) any later version.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// File : SMESH_Mesh.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifndef _SMESH_MESH_HXX_
|
||||
#define _SMESH_MESH_HXX_
|
||||
|
||||
#include "SMESH_SMESH.hxx"
|
||||
|
||||
#include "SMDSAbs_ElementType.hxx"
|
||||
#include "SMESHDS_Command.hxx"
|
||||
#include "SMESHDS_Mesh.hxx"
|
||||
#include "SMESH_ComputeError.hxx"
|
||||
#include "SMESH_Controls.hxx"
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
|
||||
#include "Utils_SALOME_Exception.hxx"
|
||||
|
||||
#include <Standard_Version.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable:4251) // Warning DLL Interface ...
|
||||
#pragma warning(disable:4290) // Warning Exception ...
|
||||
#endif
|
||||
|
||||
class SMESH_Gen;
|
||||
class SMESHDS_Document;
|
||||
class SMESH_Group;
|
||||
<<<<<<< bca7a1866e596ad2e318809f35b6d08776226a69
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
class TopTools_ListOfShape;
|
||||
#endif
|
||||
=======
|
||||
// class TopTools_ListOfShape;
|
||||
>>>>>>> upgrade to SMESH7.7.1
|
||||
class SMESH_subMesh;
|
||||
class SMESH_HypoFilter;
|
||||
class TopoDS_Solid;
|
||||
|
||||
typedef std::list<int> TListOfInt;
|
||||
typedef std::list<TListOfInt> TListOfListOfInt;
|
||||
|
||||
class SMESH_EXPORT SMESH_Mesh
|
||||
{
|
||||
public:
|
||||
SMESH_Mesh(int theLocalId,
|
||||
int theStudyId,
|
||||
SMESH_Gen* theGen,
|
||||
bool theIsEmbeddedMode,
|
||||
SMESHDS_Document* theDocument);
|
||||
|
||||
virtual ~SMESH_Mesh();
|
||||
|
||||
/*!
|
||||
* \brief Set geometry to be meshed
|
||||
*/
|
||||
void ShapeToMesh(const TopoDS_Shape & aShape);
|
||||
/*!
|
||||
* \brief Return geometry to be meshed. (It may be a PseudoShape()!)
|
||||
*/
|
||||
TopoDS_Shape GetShapeToMesh() const;
|
||||
/*!
|
||||
* \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;
|
||||
/*!
|
||||
* \brief Return diagonal size of bounding box of a shape.
|
||||
*/
|
||||
static double GetShapeDiagonalSize(const TopoDS_Shape & aShape);
|
||||
/*!
|
||||
* \brief Return a solid which is returned by GetShapeToMesh() if
|
||||
* a real geometry to be meshed was not set
|
||||
*/
|
||||
static const TopoDS_Solid& PseudoShape();
|
||||
|
||||
/*!
|
||||
* \brief Load mesh from study file
|
||||
*/
|
||||
void Load();
|
||||
/*!
|
||||
* \brief Remove all nodes and elements
|
||||
*/
|
||||
void Clear();
|
||||
/*!
|
||||
* \brief Remove all nodes and elements of indicated shape
|
||||
*/
|
||||
void ClearSubMesh(const int theShapeId);
|
||||
|
||||
/*!
|
||||
* consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
|
||||
*/
|
||||
int UNVToMesh(const char* theFileName);
|
||||
|
||||
int MEDToMesh(const char* theFileName, const char* theMeshName);
|
||||
|
||||
int STLToMesh(const char* theFileName);
|
||||
|
||||
int DATToMesh(const char* theFileName);
|
||||
|
||||
int CGNSToMesh(const char* theFileName, const int theMeshIndex, std::string& theMeshName);
|
||||
|
||||
SMESH_ComputeErrorPtr GMFToMesh(const char* theFileName,
|
||||
bool theMakeRequiredGroups = true );
|
||||
|
||||
SMESH_Hypothesis::Hypothesis_Status
|
||||
AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId, std::string* error=0)
|
||||
throw(SALOME_Exception);
|
||||
|
||||
SMESH_Hypothesis::Hypothesis_Status
|
||||
RemoveHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
|
||||
throw(SALOME_Exception);
|
||||
|
||||
const std::list <const SMESHDS_Hypothesis * >&
|
||||
GetHypothesisList(const TopoDS_Shape & aSubShape) const
|
||||
throw(SALOME_Exception);
|
||||
|
||||
const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape & aSubShape,
|
||||
const SMESH_HypoFilter& aFilter,
|
||||
const bool andAncestors,
|
||||
TopoDS_Shape* assignedTo=0) const;
|
||||
|
||||
int GetHypotheses(const TopoDS_Shape & aSubShape,
|
||||
const SMESH_HypoFilter& aFilter,
|
||||
std::list< const SMESHDS_Hypothesis * >& aHypList,
|
||||
const bool andAncestors,
|
||||
std::list< TopoDS_Shape > * assignedTo=0) const;
|
||||
|
||||
const SMESH_Hypothesis * GetHypothesis(const SMESH_subMesh * aSubMesh,
|
||||
const SMESH_HypoFilter& aFilter,
|
||||
const bool andAncestors,
|
||||
TopoDS_Shape* assignedTo=0) const;
|
||||
|
||||
int GetHypotheses(const SMESH_subMesh * aSubMesh,
|
||||
const SMESH_HypoFilter& aFilter,
|
||||
std::list< const SMESHDS_Hypothesis * >& aHypList,
|
||||
const bool andAncestors,
|
||||
std::list< TopoDS_Shape > * assignedTo=0) const;
|
||||
|
||||
SMESH_Hypothesis * GetHypothesis(const int aHypID) const;
|
||||
|
||||
const std::list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
|
||||
|
||||
void ClearLog() throw(SALOME_Exception);
|
||||
|
||||
int GetId() const { return _id; }
|
||||
|
||||
bool MeshExists( int meshId ) const;
|
||||
|
||||
SMESH_Mesh* FindMesh( int meshId ) const;
|
||||
|
||||
SMESHDS_Mesh * GetMeshDS() { return _myMeshDS; }
|
||||
|
||||
const SMESHDS_Mesh * GetMeshDS() const { return _myMeshDS; }
|
||||
|
||||
SMESH_Gen *GetGen() { return _gen; }
|
||||
|
||||
SMESH_subMesh *GetSubMesh(const TopoDS_Shape & aSubShape)
|
||||
throw(SALOME_Exception);
|
||||
|
||||
SMESH_subMesh *GetSubMeshContaining(const TopoDS_Shape & aSubShape) const
|
||||
throw(SALOME_Exception);
|
||||
|
||||
SMESH_subMesh *GetSubMeshContaining(const int aShapeID) const
|
||||
throw(SALOME_Exception);
|
||||
/*!
|
||||
* \brief Return submeshes of groups containing the given subshape
|
||||
*/
|
||||
std::list<SMESH_subMesh*> GetGroupSubMeshesContaining(const TopoDS_Shape & shape) const
|
||||
throw(SALOME_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);
|
||||
/*!
|
||||
* \brief Return True if anHyp is used to mesh aSubShape
|
||||
*/
|
||||
bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
|
||||
const SMESH_subMesh * aSubMesh);
|
||||
/*!
|
||||
* \brief check if a hypothesis alowing notconform mesh is present
|
||||
*/
|
||||
bool IsNotConformAllowed() const;
|
||||
|
||||
bool IsMainShape(const TopoDS_Shape& theShape) const;
|
||||
/*!
|
||||
* \brief Return list of ancestors of theSubShape in the order
|
||||
* that lower dimention shapes come first
|
||||
*/
|
||||
const TopTools_ListOfShape& GetAncestors(const TopoDS_Shape& theSubShape) const;
|
||||
|
||||
void SetAutoColor(bool theAutoColor) throw(SALOME_Exception);
|
||||
|
||||
bool GetAutoColor() throw(SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* \brief Set the flag meaning that the mesh has been edited "manually".
|
||||
* It is to set to false after Clear() and to set to true by MeshEditor
|
||||
*/
|
||||
void SetIsModified(bool isModified);
|
||||
|
||||
bool GetIsModified() const { return _isModified; }
|
||||
|
||||
/*!
|
||||
* \brief Return true if the mesh has been edited since a total re-compute
|
||||
* and those modifications may prevent successful partial re-compute.
|
||||
* As a side effect reset _isModified flag if mesh is empty
|
||||
*/
|
||||
bool HasModificationsToDiscard() const;
|
||||
|
||||
/*!
|
||||
* \brief Return data map of descendant to ancestor shapes
|
||||
*/
|
||||
typedef TopTools_IndexedDataMapOfShapeListOfShape TAncestorMap;
|
||||
const TAncestorMap& GetAncestorMap() const { return _mapAncestors; }
|
||||
/*!
|
||||
* \brief Check group names for duplications.
|
||||
* Consider maximum group name length stored in MED file
|
||||
*/
|
||||
bool HasDuplicatedGroupNamesMED();
|
||||
|
||||
void ExportMED(const char * theFile,
|
||||
const char* theMeshName = NULL,
|
||||
bool theAutoGroups = true,
|
||||
int theVersion = 0,
|
||||
const SMESHDS_Mesh* theMeshPart = 0,
|
||||
bool theAutoDimension = false,
|
||||
bool theAddODOnVertices = false)
|
||||
throw(SALOME_Exception);
|
||||
|
||||
void ExportDAT(const char * file,
|
||||
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
|
||||
void ExportUNV(const char * file,
|
||||
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
|
||||
void ExportSTL(const char * file,
|
||||
const bool isascii,
|
||||
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
|
||||
void ExportCGNS(const char * file,
|
||||
const SMESHDS_Mesh* mesh,
|
||||
const char * meshName = 0);
|
||||
void ExportGMF(const char * file,
|
||||
const SMESHDS_Mesh* mesh,
|
||||
bool withRequiredGroups = true );
|
||||
void ExportSAUV(const char *file,
|
||||
const char* theMeshName = NULL,
|
||||
bool theAutoGroups = true) throw(SALOME_Exception);
|
||||
|
||||
double GetComputeProgress() const;
|
||||
|
||||
int NbNodes() const throw(SALOME_Exception);
|
||||
int Nb0DElements() const throw(SALOME_Exception);
|
||||
int NbBalls() const throw(SALOME_Exception);
|
||||
|
||||
int NbEdges(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
|
||||
int NbFaces(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
int NbTriangles(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
int NbQuadrangles(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
int NbBiQuadQuadrangles() const throw(SALOME_Exception);
|
||||
int NbBiQuadTriangles() const throw(SALOME_Exception);
|
||||
int NbPolygons(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
|
||||
int NbVolumes(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
int NbTetras(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
int NbHexas(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
int NbTriQuadraticHexas() const throw(SALOME_Exception);
|
||||
int NbPyramids(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
int NbPrisms(SMDSAbs_ElementOrder order = ORDER_ANY) const throw(SALOME_Exception);
|
||||
int NbHexagonalPrisms() const throw(SALOME_Exception);
|
||||
int NbPolyhedrons() const throw(SALOME_Exception);
|
||||
|
||||
int NbSubMesh() const throw(SALOME_Exception);
|
||||
|
||||
int NbGroup() const { return _mapGroup.size(); }
|
||||
|
||||
int NbMeshes() const; // nb meshes in the Study
|
||||
|
||||
SMESH_Group* AddGroup (const SMDSAbs_ElementType theType,
|
||||
const char* theName,
|
||||
int& theId,
|
||||
const TopoDS_Shape& theShape=TopoDS_Shape(),
|
||||
const SMESH_PredicatePtr& thePredicate=SMESH_PredicatePtr());
|
||||
|
||||
SMESH_Group* AddGroup (SMESHDS_GroupBase* groupDS) throw(SALOME_Exception);
|
||||
|
||||
typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr;
|
||||
GroupIteratorPtr GetGroups() const;
|
||||
|
||||
std::list<int> GetGroupIds() const;
|
||||
|
||||
SMESH_Group* GetGroup (const int theGroupID);
|
||||
|
||||
bool RemoveGroup (const int theGroupID);
|
||||
|
||||
SMESH_Group* ConvertToStandalone ( int theGroupID );
|
||||
|
||||
struct TCallUp // callback from SMESH to SMESH_I level
|
||||
{
|
||||
virtual void RemoveGroup (const int theGroupID)=0;
|
||||
virtual void HypothesisModified ()=0;
|
||||
virtual void Load ()=0;
|
||||
virtual ~TCallUp() {}
|
||||
};
|
||||
void SetCallUp( TCallUp * upCaller );
|
||||
|
||||
bool SynchronizeGroups();
|
||||
|
||||
|
||||
SMDSAbs_ElementType GetElementType( const int id, const bool iselem );
|
||||
|
||||
void ClearMeshOrder();
|
||||
void SetMeshOrder(const TListOfListOfInt& theOrder );
|
||||
const TListOfListOfInt& GetMeshOrder() const;
|
||||
|
||||
// sort submeshes according to stored mesh order
|
||||
bool SortByMeshOrder(std::vector<SMESH_subMesh*>& theListToSort) const;
|
||||
|
||||
// return true if given order of sub-meshes is OK
|
||||
bool IsOrderOK( const SMESH_subMesh* smBefore,
|
||||
const SMESH_subMesh* smAfter ) const;
|
||||
|
||||
ostream& Dump(ostream & save);
|
||||
|
||||
private:
|
||||
|
||||
void fillAncestorsMap(const TopoDS_Shape& theShape);
|
||||
void getAncestorsSubMeshes(const TopoDS_Shape& theSubShape,
|
||||
std::vector< SMESH_subMesh* >& theSubMeshes) const;
|
||||
|
||||
protected:
|
||||
int _id; // id given by creator (unique within the creator instance)
|
||||
int _studyId;
|
||||
int _groupId; // id generator for group objects
|
||||
int _nbSubShapes; // initial nb of subshapes in the shape to mesh
|
||||
bool _isShapeToMesh;// set to true when a shape is given (only once)
|
||||
SMESHDS_Document * _myDocument;
|
||||
SMESHDS_Mesh * _myMeshDS;
|
||||
SMESH_Gen * _gen;
|
||||
std::map <int, SMESH_Group*> _mapGroup;
|
||||
|
||||
class SubMeshHolder;
|
||||
SubMeshHolder* _subMeshHolder;
|
||||
|
||||
bool _isAutoColor;
|
||||
bool _isModified; //!< modified since last total re-compute, issue 0020693
|
||||
|
||||
double _shapeDiagonal; //!< diagonal size of bounding box of shape to mesh
|
||||
|
||||
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
|
||||
|
||||
mutable std::vector<SMESH_subMesh*> _ancestorSubMeshes; // to speed up GetHypothes[ei]s()
|
||||
|
||||
TListOfListOfInt _mySubMeshOrder;
|
||||
|
||||
// Struct calling methods at CORBA API implementation level, used to
|
||||
// 1) make an upper level (SMESH_I) be consistent with a lower one (SMESH)
|
||||
// when group removal is invoked by hyp modification (issue 0020918)
|
||||
// 2) to forget not loaded mesh data at hyp modification
|
||||
TCallUp* _callUp;
|
||||
|
||||
protected:
|
||||
SMESH_Mesh();
|
||||
SMESH_Mesh(const SMESH_Mesh&) {};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,329 +0,0 @@
|
|||
<<<<<<< HEAD
|
||||
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
|
||||
//
|
||||
// Copyright (C) 2003 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
|
||||
//
|
||||
// File : SMESH_MeshVSLink.cxx
|
||||
// Created : Mon Dec 1 09:00:00 2008
|
||||
// Author : Sioutis Fotios
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMESH_MeshVSLink_HeaderFile
|
||||
#define _SMESH_MeshVSLink_HeaderFile
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_SMESH_MeshVSLink_HeaderFile
|
||||
#include <Handle_SMESH_MeshVSLink.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_PackedMapOfInteger_HeaderFile
|
||||
#include <TColStd_PackedMapOfInteger.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_HArray2OfInteger_HeaderFile
|
||||
#include <TColStd_HArray2OfInteger.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_HArray2OfReal_HeaderFile
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
#endif
|
||||
#ifndef _MeshVS_DataSource3D_HeaderFile
|
||||
#include <MeshVS_DataSource3D.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Boolean_HeaderFile
|
||||
#include <Standard_Boolean.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _MeshVS_EntityType_HeaderFile
|
||||
#include <MeshVS_EntityType.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Address_HeaderFile
|
||||
#include <Standard_Address.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_HArray1OfInteger_HeaderFile
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Real_HeaderFile
|
||||
#include <Standard_Real.hxx>
|
||||
#endif
|
||||
#ifndef _SMESH_Mesh_HeaderFile
|
||||
#include <SMESH_Mesh.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Version_HeaderFile
|
||||
#include <Standard_Version.hxx>
|
||||
#endif
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
DEFINE_STANDARD_HANDLE(SMESH_MeshVSLink, MeshVS_DataSource3D)
|
||||
#endif
|
||||
class SMESH_MeshVSLink : public MeshVS_DataSource3D {
|
||||
|
||||
public:
|
||||
// Methods PUBLIC
|
||||
//
|
||||
|
||||
//! Constructor <br>
|
||||
Standard_EXPORT SMESH_MeshVSLink(const SMESH_Mesh *aMesh);
|
||||
|
||||
//Not implemented yet
|
||||
/*
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetNodeNormal(const Standard_Integer ranknode,const Standard_Integer ElementId,Standard_Real& nx,Standard_Real& ny,Standard_Real& nz) const;
|
||||
Standard_EXPORT Standard_Boolean GetNormalsByElement(const Standard_Integer Id,const Standard_Boolean IsNodal,const Standard_Integer MaxNodes,Handle(TColStd_HArray1OfReal)& Normals) const;
|
||||
Standard_EXPORT void GetAllGroups(TColStd_PackedMapOfInteger& Ids) const;
|
||||
Standard_EXPORT Standard_Boolean GetGroup(const Standard_Integer Id,MeshVS_EntityType& Type,TColStd_PackedMapOfInteger& Ids) const;
|
||||
Standard_EXPORT Standard_Address GetGroupAddr(const Standard_Integer ID) const;
|
||||
Standard_EXPORT Standard_Boolean IsAdvancedSelectionEnabled() const;
|
||||
Standard_EXPORT Bnd_Box GetBoundingBox() const;
|
||||
Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,const Standard_Real X,const Standard_Real Y,const Standard_Real aTol,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ;
|
||||
Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,const Standard_Real XMin,const Standard_Real YMin,const Standard_Real XMax,const Standard_Real YMax,const Standard_Real aTol,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ;
|
||||
Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,const TColgp_Array1OfPnt2d& Polyline,const Bnd_Box2d& aBox,const Standard_Real aTol,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ;
|
||||
Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ;
|
||||
*/
|
||||
|
||||
//! Returns geometry information about node ( if IsElement is False ) or element ( IsElement is True ) <br>
|
||||
//! by co-ordinates. For element this method must return all its nodes co-ordinates in the strict order: X, Y, Z and <br>
|
||||
//! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element. <br>
|
||||
//! It is recommended to return 1 for node. Type is an element type. <br>
|
||||
Standard_EXPORT Standard_Boolean GetGeom(const Standard_Integer ID,const Standard_Boolean IsElement,TColStd_Array1OfReal& Coords,Standard_Integer& NbNodes,MeshVS_EntityType& Type) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Get3DGeom(const Standard_Integer ID,Standard_Integer& NbNodes,Handle(MeshVS_HArray1OfSequenceOfInteger)& Data) const;
|
||||
|
||||
//! This method is similar to GetGeom, but returns only element or node type. This method is provided for <br>
|
||||
//! a fine performance. <br>
|
||||
Standard_EXPORT Standard_Boolean GetGeomType(const Standard_Integer ID,const Standard_Boolean IsElement,MeshVS_EntityType& Type) const;
|
||||
|
||||
//! This method returns by number an address of any entity which represents element or node data structure. <br>
|
||||
Standard_EXPORT Standard_Address GetAddr(const Standard_Integer ID,const Standard_Boolean IsElement) const;
|
||||
|
||||
//! This method returns information about what node this element consist of. <br>
|
||||
Standard_EXPORT /*virtual*/ Standard_Boolean GetNodesByElement(const Standard_Integer ID,TColStd_Array1OfInteger& NodeIDs,Standard_Integer& NbNodes) const;
|
||||
|
||||
//! This method returns map of all nodes the object consist of. <br>
|
||||
Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const;
|
||||
|
||||
//! This method returns map of all elements the object consist of. <br>
|
||||
Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const;
|
||||
|
||||
//! This method calculates normal of face, which is using for correct reflection presentation. <br>
|
||||
//! There is default method, for advance reflection this method can be redefined. <br>
|
||||
Standard_EXPORT Standard_Boolean GetNormal(const Standard_Integer Id,const Standard_Integer Max,Standard_Real& nx,Standard_Real& ny,Standard_Real& nz) const;
|
||||
|
||||
//! This method returns map of all groups the object contains. <br>
|
||||
Standard_EXPORT void GetAllGroups(TColStd_PackedMapOfInteger& Ids) const;
|
||||
|
||||
// Type management
|
||||
//
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
DEFINE_STANDARD_RTTIEXT(SMESH_MeshVSLink,MeshVS_DataSource3D)
|
||||
#else
|
||||
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Methods PROTECTED
|
||||
//
|
||||
|
||||
// Fields PROTECTED
|
||||
//
|
||||
|
||||
private:
|
||||
// Methods PRIVATE
|
||||
//
|
||||
|
||||
// Fields PRIVATE
|
||||
//
|
||||
SMESH_Mesh *myMesh;
|
||||
TColStd_PackedMapOfInteger myNodes;
|
||||
TColStd_PackedMapOfInteger myElements;
|
||||
TColStd_PackedMapOfInteger myGroups;
|
||||
};
|
||||
|
||||
// other Inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
#endif
|
||||
=======
|
||||
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
|
||||
//
|
||||
// Copyright (C) 2003 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
|
||||
//
|
||||
// File : SMESH_MeshVSLink.cxx
|
||||
// Created : Mon Dec 1 09:00:00 2008
|
||||
// Author : Sioutis Fotios
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMESH_MeshVSLink_HeaderFile
|
||||
#define _SMESH_MeshVSLink_HeaderFile
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
#ifndef _Handle_SMESH_MeshVSLink_HeaderFile
|
||||
#include <Handle_SMESH_MeshVSLink.hxx>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_PackedMapOfInteger_HeaderFile
|
||||
#include <TColStd_PackedMapOfInteger.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_HArray2OfInteger_HeaderFile
|
||||
#include <TColStd_HArray2OfInteger.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_HArray2OfReal_HeaderFile
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
#endif
|
||||
#ifndef _MeshVS_DataSource3D_HeaderFile
|
||||
#include <MeshVS_DataSource3D.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Boolean_HeaderFile
|
||||
#include <Standard_Boolean.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _MeshVS_EntityType_HeaderFile
|
||||
#include <MeshVS_EntityType.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Address_HeaderFile
|
||||
#include <Standard_Address.hxx>
|
||||
#endif
|
||||
#ifndef _TColStd_HArray1OfInteger_HeaderFile
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Real_HeaderFile
|
||||
#include <Standard_Real.hxx>
|
||||
#endif
|
||||
#ifndef _SMESH_Mesh_HeaderFile
|
||||
#include <SMESH_Mesh.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Version_HeaderFile
|
||||
#include <Standard_Version.hxx>
|
||||
#endif
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
DEFINE_STANDARD_HANDLE(SMESH_MeshVSLink, MeshVS_DataSource3D)
|
||||
#endif
|
||||
class SMESH_MeshVSLink : public MeshVS_DataSource3D {
|
||||
|
||||
public:
|
||||
// Methods PUBLIC
|
||||
//
|
||||
|
||||
//! Constructor <br>
|
||||
Standard_EXPORT SMESH_MeshVSLink(const SMESH_Mesh *aMesh);
|
||||
|
||||
//Not implemented yet
|
||||
/*
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetNodeNormal(const Standard_Integer ranknode,const Standard_Integer ElementId,Standard_Real& nx,Standard_Real& ny,Standard_Real& nz) const;
|
||||
Standard_EXPORT Standard_Boolean GetNormalsByElement(const Standard_Integer Id,const Standard_Boolean IsNodal,const Standard_Integer MaxNodes,Handle(TColStd_HArray1OfReal)& Normals) const;
|
||||
Standard_EXPORT void GetAllGroups(TColStd_PackedMapOfInteger& Ids) const;
|
||||
Standard_EXPORT Standard_Boolean GetGroup(const Standard_Integer Id,MeshVS_EntityType& Type,TColStd_PackedMapOfInteger& Ids) const;
|
||||
Standard_EXPORT Standard_Address GetGroupAddr(const Standard_Integer ID) const;
|
||||
Standard_EXPORT Standard_Boolean IsAdvancedSelectionEnabled() const;
|
||||
Standard_EXPORT Bnd_Box GetBoundingBox() const;
|
||||
Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,const Standard_Real X,const Standard_Real Y,const Standard_Real aTol,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ;
|
||||
Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,const Standard_Real XMin,const Standard_Real YMin,const Standard_Real XMax,const Standard_Real YMax,const Standard_Real aTol,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ;
|
||||
Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,const TColgp_Array1OfPnt2d& Polyline,const Bnd_Box2d& aBox,const Standard_Real aTol,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ;
|
||||
Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ;
|
||||
*/
|
||||
|
||||
//! Returns geometry information about node ( if IsElement is False ) or element ( IsElement is True ) <br>
|
||||
//! by co-ordinates. For element this method must return all its nodes co-ordinates in the strict order: X, Y, Z and <br>
|
||||
//! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element. <br>
|
||||
//! It is recommended to return 1 for node. Type is an element type. <br>
|
||||
Standard_EXPORT Standard_Boolean GetGeom(const Standard_Integer ID,const Standard_Boolean IsElement,TColStd_Array1OfReal& Coords,Standard_Integer& NbNodes,MeshVS_EntityType& Type) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Get3DGeom(const Standard_Integer ID,Standard_Integer& NbNodes,Handle(MeshVS_HArray1OfSequenceOfInteger)& Data) const;
|
||||
|
||||
//! This method is similar to GetGeom, but returns only element or node type. This method is provided for <br>
|
||||
//! a fine performance. <br>
|
||||
Standard_EXPORT Standard_Boolean GetGeomType(const Standard_Integer ID,const Standard_Boolean IsElement,MeshVS_EntityType& Type) const;
|
||||
|
||||
//! This method returns by number an address of any entity which represents element or node data structure. <br>
|
||||
Standard_EXPORT Standard_Address GetAddr(const Standard_Integer ID,const Standard_Boolean IsElement) const;
|
||||
|
||||
//! This method returns information about what node this element consist of. <br>
|
||||
Standard_EXPORT /*virtual*/ Standard_Boolean GetNodesByElement(const Standard_Integer ID,TColStd_Array1OfInteger& NodeIDs,Standard_Integer& NbNodes) const;
|
||||
|
||||
//! This method returns map of all nodes the object consist of. <br>
|
||||
Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const;
|
||||
|
||||
//! This method returns map of all elements the object consist of. <br>
|
||||
Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const;
|
||||
|
||||
//! This method calculates normal of face, which is using for correct reflection presentation. <br>
|
||||
//! There is default method, for advance reflection this method can be redefined. <br>
|
||||
Standard_EXPORT Standard_Boolean GetNormal(const Standard_Integer Id,const Standard_Integer Max,Standard_Real& nx,Standard_Real& ny,Standard_Real& nz) const;
|
||||
|
||||
//! This method returns map of all groups the object contains. <br>
|
||||
Standard_EXPORT void GetAllGroups(TColStd_PackedMapOfInteger& Ids) const;
|
||||
|
||||
// Type management
|
||||
//
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
DEFINE_STANDARD_RTTIEXT(SMESH_MeshVSLink,MeshVS_DataSource3D)
|
||||
#else
|
||||
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Methods PROTECTED
|
||||
//
|
||||
|
||||
// Fields PROTECTED
|
||||
//
|
||||
|
||||
private:
|
||||
// Methods PRIVATE
|
||||
//
|
||||
|
||||
// Fields PRIVATE
|
||||
//
|
||||
SMESH_Mesh *myMesh;
|
||||
TColStd_PackedMapOfInteger myNodes;
|
||||
TColStd_PackedMapOfInteger myElements;
|
||||
TColStd_PackedMapOfInteger myGroups;
|
||||
};
|
||||
#include <SMESH_MeshVSLink.ixx>
|
||||
// other Inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
#endif
|
||||
>>>>>>> 901e260... FEM: Make SMESH7 compile with occ6
|
|
@ -1,154 +0,0 @@
|
|||
<<<<<<< HEAD
|
||||
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
|
||||
//
|
||||
// Copyright (C) 2003 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
|
||||
//
|
||||
// File : SMESH_MeshVSLink.cxx
|
||||
// Created : Mon Dec 1 09:00:00 2008
|
||||
// Author : Sioutis Fotios
|
||||
// Module : SMESH
|
||||
|
||||
#include <SMESH_MeshVSLink.jxx>
|
||||
|
||||
#ifndef _Standard_TypeMismatch_HeaderFile
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _Standard_Version_HeaderFile
|
||||
#include <Standard_Version.hxx>
|
||||
#endif
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
Standard_EXPORT Handle_Standard_Type& SMESH_MeshVSLink_Type_()
|
||||
{
|
||||
static Handle_Standard_Type aType1 = STANDARD_TYPE(MeshVS_DataSource3D);
|
||||
static Handle_Standard_Type aType2 = STANDARD_TYPE(MeshVS_DataSource);
|
||||
static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
|
||||
static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
|
||||
|
||||
|
||||
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
|
||||
static Handle_Standard_Type _aType = new Standard_Type("SMESH_MeshVSLink",
|
||||
sizeof(SMESH_MeshVSLink),
|
||||
1,
|
||||
(Standard_Address)_Ancestors,
|
||||
(Standard_Address)NULL);
|
||||
|
||||
return _aType;
|
||||
}
|
||||
|
||||
|
||||
// DownCast method
|
||||
// allow safe downcasting
|
||||
//
|
||||
const Handle(SMESH_MeshVSLink) Handle(SMESH_MeshVSLink)::DownCast(const Handle(Standard_Transient)& AnObject)
|
||||
{
|
||||
Handle(SMESH_MeshVSLink) _anOtherObject;
|
||||
|
||||
if (!AnObject.IsNull()) {
|
||||
if (AnObject->IsKind(STANDARD_TYPE(SMESH_MeshVSLink))) {
|
||||
_anOtherObject = Handle(SMESH_MeshVSLink)((Handle(SMESH_MeshVSLink)&)AnObject);
|
||||
}
|
||||
}
|
||||
|
||||
return _anOtherObject ;
|
||||
}
|
||||
|
||||
const Handle(Standard_Type)& SMESH_MeshVSLink::DynamicType() const
|
||||
{
|
||||
return STANDARD_TYPE(SMESH_MeshVSLink) ;
|
||||
}
|
||||
#endif
|
||||
=======
|
||||
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
|
||||
//
|
||||
// Copyright (C) 2003 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
|
||||
//
|
||||
// File : SMESH_MeshVSLink.cxx
|
||||
// Created : Mon Dec 1 09:00:00 2008
|
||||
// Author : Sioutis Fotios
|
||||
// Module : SMESH
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
|
||||
#include <SMESH_MeshVSLink.jxx>
|
||||
|
||||
#ifndef _Standard_TypeMismatch_HeaderFile
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#endif
|
||||
|
||||
Standard_EXPORT Handle_Standard_Type& SMESH_MeshVSLink_Type_()
|
||||
{
|
||||
static Handle_Standard_Type aType1 = STANDARD_TYPE(MeshVS_DataSource3D);
|
||||
static Handle_Standard_Type aType2 = STANDARD_TYPE(MeshVS_DataSource);
|
||||
static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
|
||||
static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
|
||||
|
||||
|
||||
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
|
||||
static Handle_Standard_Type _aType = new Standard_Type("SMESH_MeshVSLink",
|
||||
sizeof(SMESH_MeshVSLink),
|
||||
1,
|
||||
(Standard_Address)_Ancestors,
|
||||
(Standard_Address)NULL);
|
||||
|
||||
return _aType;
|
||||
}
|
||||
|
||||
|
||||
// DownCast method
|
||||
// allow safe downcasting
|
||||
//
|
||||
const Handle(SMESH_MeshVSLink) Handle(SMESH_MeshVSLink)::DownCast(const Handle(Standard_Transient)& AnObject)
|
||||
{
|
||||
Handle(SMESH_MeshVSLink) _anOtherObject;
|
||||
|
||||
if (!AnObject.IsNull()) {
|
||||
if (AnObject->IsKind(STANDARD_TYPE(SMESH_MeshVSLink))) {
|
||||
_anOtherObject = Handle(SMESH_MeshVSLink)((Handle(SMESH_MeshVSLink)&)AnObject);
|
||||
}
|
||||
}
|
||||
|
||||
return _anOtherObject ;
|
||||
}
|
||||
|
||||
const Handle(Standard_Type)& SMESH_MeshVSLink::DynamicType() const
|
||||
{
|
||||
return STANDARD_TYPE(SMESH_MeshVSLink) ;
|
||||
}
|
||||
#endif
|
||||
>>>>>>> 901e260... FEM: Make SMESH7 compile with occ6
|
|
@ -1,75 +0,0 @@
|
|||
// Copyright (C) 2007-2015 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, or (at your option) any later version.
|
||||
//
|
||||
// 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_Hexa_3D.hxx
|
||||
// Moved here from SMESH_Hexa_3D.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifndef _SMESH_HEXA_3D_HXX_
|
||||
#define _SMESH_HEXA_3D_HXX_
|
||||
|
||||
#include "SMESH_StdMeshers.hxx"
|
||||
|
||||
#include "SMESH_Algo.hxx"
|
||||
|
||||
<<<<<<< bca7a1866e596ad2e318809f35b6d08776226a69
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
class TopTools_IndexedMapOfShape;
|
||||
#endif
|
||||
|
||||
typedef struct point3Dstruct
|
||||
{
|
||||
const SMDS_MeshNode * node;
|
||||
} Point3DStruct;
|
||||
=======
|
||||
>>>>>>> upgrade to SMESH7.7.1
|
||||
|
||||
class StdMeshers_ViscousLayers;
|
||||
class SMESH_MesherHelper;
|
||||
|
||||
class STDMESHERS_EXPORT StdMeshers_Hexa_3D : public SMESH_3D_Algo
|
||||
{
|
||||
public:
|
||||
StdMeshers_Hexa_3D(int hypId, int studyId, SMESH_Gen* gen);
|
||||
virtual ~StdMeshers_Hexa_3D();
|
||||
|
||||
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 Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper);
|
||||
|
||||
virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
|
||||
MapShapeNbElems& aResMap);
|
||||
|
||||
static bool IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll);
|
||||
|
||||
protected:
|
||||
|
||||
const StdMeshers_ViscousLayers* _viscousLayersHyp;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,227 +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_ProjectionUtils.hxx
|
||||
// Created : Thu Oct 26 15:37:24 2006
|
||||
// Author : Edward AGAPOV (eap)
|
||||
//
|
||||
#ifndef StdMeshers_ProjectionUtils_HeaderFile
|
||||
#define StdMeshers_ProjectionUtils_HeaderFile
|
||||
|
||||
#include "SMESH_StdMeshers.hxx"
|
||||
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
<<<<<<< HEAD
|
||||
#include <TopoDS_Face.hxx>
|
||||
=======
|
||||
#include <gp_GTrsf.hxx>
|
||||
#include <gp_GTrsf2d.hxx>
|
||||
>>>>>>> 901e260... FEM: Make SMESH7 compile with occ6
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
class TopoDS_Shape;
|
||||
class SMDS_MeshNode;
|
||||
class SMESH_Mesh;
|
||||
class SMESH_Hypothesis;
|
||||
class SMESH_subMesh;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
class TopoDS_Shape;
|
||||
>>>>>>> 901e260... FEM: Make SMESH7 compile with occ6
|
||||
|
||||
/*!
|
||||
* \brief Class encapsulating methods common to Projection algorithms
|
||||
*/
|
||||
class StdMeshers_ProjectionUtils
|
||||
{
|
||||
public:
|
||||
|
||||
typedef TopTools_DataMapOfShapeShape TShapeShapeMap;
|
||||
typedef TopTools_IndexedDataMapOfShapeListOfShape TAncestorMap;
|
||||
typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
|
||||
|
||||
/*!
|
||||
* \brief Looks for association of all subshapes of two shapes
|
||||
* \param theShape1 - shape 1
|
||||
* \param theMesh1 - mesh built on shape 1
|
||||
* \param theShape2 - shape 2
|
||||
* \param theMesh2 - mesh built on shape 2
|
||||
* \param theAssociation - association map to be filled that may
|
||||
* contain association of one or two pairs of vertices
|
||||
* \retval bool - true if association found
|
||||
*/
|
||||
static bool FindSubShapeAssociation(const TopoDS_Shape& theShape1,
|
||||
SMESH_Mesh* theMesh1,
|
||||
const TopoDS_Shape& theShape2,
|
||||
SMESH_Mesh* theMesh2,
|
||||
TShapeShapeMap & theAssociationMap);
|
||||
|
||||
/*!
|
||||
* \brief Find association of edges of faces
|
||||
* \param face1 - face 1
|
||||
* \param VV1 - vertices of face 1
|
||||
* \param face2 - face 2
|
||||
* \param VV2 - vertices of face 2 associated with oned of face 1
|
||||
* \param edges1 - out list of edges of face 1
|
||||
* \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],
|
||||
std::list< TopoDS_Edge > & edges1,
|
||||
std::list< TopoDS_Edge > & edges2);
|
||||
|
||||
/*!
|
||||
* \brief Insert vertex association defined by a hypothesis into a map
|
||||
* \param theHyp - hypothesis
|
||||
* \param theAssociationMap - association map
|
||||
* \param theTargetShape - the shape theHyp assigned to
|
||||
*/
|
||||
static void InitVertexAssociation( const SMESH_Hypothesis* theHyp,
|
||||
TShapeShapeMap & theAssociationMap,
|
||||
const TopoDS_Shape& theTargetShape);
|
||||
|
||||
/*!
|
||||
* \brief Inserts association theShape1 <-> theShape2 to TShapeShapeMap
|
||||
* \param theShape1 - shape 1
|
||||
* \param theShape2 - shape 2
|
||||
* \param theAssociationMap - association map
|
||||
* \param theBidirectional - if false, inserts theShape1 -> theShape2 association
|
||||
* \retval bool - true if there was no association for these shapes before
|
||||
*/
|
||||
static bool InsertAssociation( const TopoDS_Shape& theShape1,
|
||||
const TopoDS_Shape& theShape2,
|
||||
TShapeShapeMap & theAssociationMap,
|
||||
const bool theBidirectional=true);
|
||||
|
||||
static bool IsSubShape( const TopoDS_Shape& shape, SMESH_Mesh* aMesh );
|
||||
|
||||
static bool IsSubShape( const TopoDS_Shape& shape, const TopoDS_Shape& mainShape );
|
||||
|
||||
/*!
|
||||
* \brief Finds an edge by its vertices in a main shape of the mesh
|
||||
*/
|
||||
static TopoDS_Edge GetEdgeByVertices( SMESH_Mesh* aMesh,
|
||||
const TopoDS_Vertex& V1,
|
||||
const TopoDS_Vertex& V2);
|
||||
|
||||
/*!
|
||||
* \brief Return another face sharing an edge
|
||||
* \param edgeToFaces - data map of descendants to ancestors
|
||||
*/
|
||||
static TopoDS_Face GetNextFace( const TAncestorMap& edgeToFaces,
|
||||
const TopoDS_Edge& edge,
|
||||
const TopoDS_Face& face);
|
||||
/*!
|
||||
* \brief Return other vertex of an edge
|
||||
*/
|
||||
static TopoDS_Vertex GetNextVertex(const TopoDS_Edge& edge,
|
||||
const TopoDS_Vertex& vertex);
|
||||
|
||||
/*!
|
||||
* \brief Return an oriented propagation edge
|
||||
* \param aMesh - mesh
|
||||
* \param fromEdge - start edge for propagation
|
||||
* \retval pair<int,TopoDS_Edge> - propagation step and found edge
|
||||
*/
|
||||
static std::pair<int,TopoDS_Edge> GetPropagationEdge( SMESH_Mesh* aMesh,
|
||||
const TopoDS_Edge& anEdge,
|
||||
const TopoDS_Edge& fromEdge);
|
||||
|
||||
/*!
|
||||
* \brief Find corresponding nodes on two faces
|
||||
* \param face1 - the first face
|
||||
* \param mesh1 - mesh containing elements on the first face
|
||||
* \param face2 - the second face
|
||||
* \param mesh2 - mesh containing elements on the second face
|
||||
* \param assocMap - map associating subshapes of the faces
|
||||
* \param nodeIn2OutMap - map containing found matching nodes
|
||||
* \retval bool - is a success
|
||||
*/
|
||||
static bool FindMatchingNodesOnFaces( const TopoDS_Face& face1,
|
||||
SMESH_Mesh* mesh1,
|
||||
const TopoDS_Face& face2,
|
||||
SMESH_Mesh* mesh2,
|
||||
const TShapeShapeMap & assocMap,
|
||||
TNodeNodeMap & nodeIn2OutMap);
|
||||
/*!
|
||||
* \brief Check if the first and last vertices of an edge are the same
|
||||
* \param anEdge - the edge to check
|
||||
* \retval bool - true if same
|
||||
*/
|
||||
static bool IsClosedEdge( const TopoDS_Edge& anEdge );
|
||||
|
||||
/*!
|
||||
* \brief Return any subshape of a face belonging to the outer wire
|
||||
* \param face - the face
|
||||
* \param type - type of subshape to return
|
||||
* \retval TopoDS_Shape - the found subshape
|
||||
*/
|
||||
static TopoDS_Shape OuterShape( const TopoDS_Face& face,
|
||||
TopAbs_ShapeEnum type);
|
||||
|
||||
/*!
|
||||
* \brief Check that submeshis is computed and try to compute it if is not
|
||||
* \param sm - submesh to compute
|
||||
* \param iterationNb - int used to stop infinite recursive call
|
||||
* \retval bool - true if computed
|
||||
*/
|
||||
static bool MakeComputed(SMESH_subMesh * sm, const int iterationNb = 0);
|
||||
|
||||
/*!
|
||||
* \brief Count nb of subshapes
|
||||
* \param shape - the shape
|
||||
* \param type - the type of subshapes to count
|
||||
* \param ignoreSame - if true, use map not to count same shapes, esle use explorer
|
||||
* \retval int - the calculated number
|
||||
*/
|
||||
static int Count(const TopoDS_Shape& shape,
|
||||
const TopAbs_ShapeEnum type,
|
||||
const bool ignoreSame);
|
||||
|
||||
/*!
|
||||
* \brief Set event listeners to submesh with projection algo
|
||||
* \param subMesh - submesh with projection algo
|
||||
* \param srcShape - source shape
|
||||
* \param srcMesh - source mesh
|
||||
*/
|
||||
static void SetEventListener(SMESH_subMesh* subMesh,
|
||||
TopoDS_Shape srcShape,
|
||||
SMESH_Mesh* srcMesh);
|
||||
|
||||
/*!
|
||||
* \brief Return true if edge is a boundary of edgeContainer
|
||||
*/
|
||||
static bool IsBoundaryEdge(const TopoDS_Edge& edge,
|
||||
const TopoDS_Shape& edgeContainer,
|
||||
SMESH_Mesh& mesh);
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,785 +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 : SMESH_Gen.cxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_subMesh.hxx"
|
||||
#include "SMESH_HypoFilter.hxx"
|
||||
#include "SMESHDS_Document.hxx"
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
//#include "OpUtil.hxx"
|
||||
#include "SMESH_ExceptHandlers.hxx"
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
using namespace std;
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
//#include <vtkDebugLeaks.h>
|
||||
|
||||
SMESH_Gen* SMESH_Gen::generator = nullptr;
|
||||
|
||||
>>>>>>> 9778eb1... FEM: Use single smesh mesh generator throughout FreeCAD
|
||||
//=============================================================================
|
||||
/*!
|
||||
* default constructor:
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_Gen::SMESH_Gen()
|
||||
{
|
||||
//MESSAGE("SMESH_Gen::SMESH_Gen");
|
||||
_localId = 0;
|
||||
_hypId = 0;
|
||||
_segmentation = 10;
|
||||
}
|
||||
|
||||
SMESH_Gen* SMESH_Gen::get() {
|
||||
|
||||
if(!generator)
|
||||
generator = new SMESH_Gen();
|
||||
|
||||
return generator;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_Gen::~SMESH_Gen()
|
||||
{
|
||||
//MESSAGE("SMESH_Gen::~SMESH_Gen");
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
/*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId)
|
||||
throw(SALOME_Exception)
|
||||
{
|
||||
|
||||
MESSAGE("CreateHypothesis("<<anHyp<<","<<studyId<<")");
|
||||
// Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
|
||||
|
||||
StudyContextStruct *myStudyContext = GetStudyContext(studyId);
|
||||
|
||||
// create a new hypothesis object, store its ref. in studyContext
|
||||
|
||||
SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId);
|
||||
int hypId = myHypothesis->GetID();
|
||||
myStudyContext->mapHypothesis[hypId] = myHypothesis;
|
||||
SCRUTE(studyId);
|
||||
SCRUTE(hypId);
|
||||
|
||||
// store hypothesis in SMESHDS document
|
||||
|
||||
myStudyContext->myDocument->AddHypothesis(myHypothesis);
|
||||
return myHypothesis;
|
||||
}*/
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
|
||||
throw(SMESH_Exception)
|
||||
{
|
||||
Unexpect aCatch(SmeshException);
|
||||
MESSAGE("SMESH_Gen::CreateMesh");
|
||||
|
||||
// Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
|
||||
StudyContextStruct *aStudyContext = GetStudyContext(theStudyId);
|
||||
|
||||
// create a new SMESH_mesh object
|
||||
SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++,
|
||||
theStudyId,
|
||||
this,
|
||||
theIsEmbeddedMode,
|
||||
aStudyContext->myDocument);
|
||||
aStudyContext->mapMesh[_localId] = aMesh;
|
||||
|
||||
return aMesh;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Compute a mesh
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
||||
const TopoDS_Shape & aShape,
|
||||
const bool anUpward,
|
||||
const ::MeshDimension aDim,
|
||||
TSetOfInt* aShapesId)
|
||||
{
|
||||
MESSAGE("SMESH_Gen::Compute");
|
||||
|
||||
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;
|
||||
|
||||
// check for preview dimension limitations
|
||||
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
|
||||
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
|
||||
|
||||
// we check all the submeshes here and detect if any of them failed to compute
|
||||
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
|
||||
ret = false;
|
||||
else 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();
|
||||
if ( smToCompute->GetComputeState() != SMESH_subMesh::READY_TO_COMPUTE )
|
||||
continue;
|
||||
|
||||
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
|
||||
const int aShapeDim = GetShapeDim( aSubShape );
|
||||
if ( aShapeDim < 1 ) break;
|
||||
|
||||
// check for preview dimension limitations
|
||||
if ( aShapesId && aShapeDim > (int)aDim )
|
||||
continue;
|
||||
|
||||
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
|
||||
if ( algo && !algo->NeedDescretBoundary() )
|
||||
{
|
||||
if ( algo->SupportSubmeshes() )
|
||||
smWithAlgoSupportingSubmeshes.push_back( smToCompute );
|
||||
else
|
||||
{
|
||||
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
|
||||
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 ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
|
||||
if ( aShapeDim < 1 ) 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 ))
|
||||
.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
|
||||
Compute( aMesh, aSubShape, /*anUpward=*/true, aDim, aShapesId );
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----------------------------------------------------------
|
||||
// apply the algos that do not require descretized boundaries
|
||||
// ----------------------------------------------------------
|
||||
for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++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;
|
||||
|
||||
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
|
||||
if ( aShapesId )
|
||||
aShapesId->insert( sm->GetId() );
|
||||
}
|
||||
|
||||
// -----------------------------------------------
|
||||
// mesh the rest subshapes starting from vertices
|
||||
// -----------------------------------------------
|
||||
ret = Compute( aMesh, aShape, /*anUpward=*/true, aDim, aShapesId );
|
||||
}
|
||||
|
||||
MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : checkConformIgnoredAlgos
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
|
||||
SMESH_subMesh* aSubMesh,
|
||||
const SMESH_Algo* aGlobIgnoAlgo,
|
||||
const SMESH_Algo* aLocIgnoAlgo,
|
||||
bool & checkConform,
|
||||
map<int, SMESH_subMesh*>& aCheckedMap,
|
||||
list< SMESH_Gen::TAlgoStateError > & theErrors)
|
||||
{
|
||||
ASSERT( aSubMesh );
|
||||
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
||||
return true;
|
||||
|
||||
|
||||
bool ret = true;
|
||||
|
||||
const list<const SMESHDS_Hypothesis*>& listHyp =
|
||||
aMesh.GetMeshDS()->GetHypothesis( aSubMesh->GetSubShape() );
|
||||
list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
|
||||
for ( ; it != listHyp.end(); it++)
|
||||
{
|
||||
const SMESHDS_Hypothesis * aHyp = *it;
|
||||
if (aHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
|
||||
continue;
|
||||
|
||||
const SMESH_Algo* algo = dynamic_cast<const SMESH_Algo*> (aHyp);
|
||||
ASSERT ( algo );
|
||||
|
||||
if ( aLocIgnoAlgo ) // algo is hidden by a local algo of upper dim
|
||||
{
|
||||
INFOS( "Local <" << algo->GetName() << "> is hidden by local <"
|
||||
<< aLocIgnoAlgo->GetName() << ">");
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isGlobal = (aMesh.IsMainShape( aSubMesh->GetSubShape() ));
|
||||
int dim = algo->GetDim();
|
||||
int aMaxGlobIgnoDim = ( aGlobIgnoAlgo ? aGlobIgnoAlgo->GetDim() : -1 );
|
||||
|
||||
if ( dim < aMaxGlobIgnoDim )
|
||||
{
|
||||
// algo is hidden by a global algo
|
||||
INFOS( ( isGlobal ? "Global" : "Local" )
|
||||
<< " <" << algo->GetName() << "> is hidden by global <"
|
||||
<< aGlobIgnoAlgo->GetName() << ">");
|
||||
}
|
||||
else if ( !algo->NeedDescretBoundary() && !isGlobal)
|
||||
{
|
||||
// local algo is not hidden and hides algos on sub-shapes
|
||||
if (checkConform && !aSubMesh->IsConform( algo ))
|
||||
{
|
||||
ret = false;
|
||||
checkConform = false; // no more check conformity
|
||||
INFOS( "ERROR: Local <" << algo->GetName() <<
|
||||
"> would produce not conform mesh: "
|
||||
"<Not Conform Mesh Allowed> hypotesis is missing");
|
||||
theErrors.push_back( SMESH_Gen::TAlgoStateError() );
|
||||
theErrors.back().Set( SMESH_Hypothesis::HYP_NOTCONFORM, algo, false );
|
||||
}
|
||||
|
||||
// sub-algos will be hidden by a local <algo>
|
||||
const map<int, SMESH_subMesh*>& smMap = aSubMesh->DependsOn();
|
||||
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub;
|
||||
bool checkConform2 = false;
|
||||
for ( revItSub = smMap.rbegin(); revItSub != smMap.rend(); revItSub++)
|
||||
{
|
||||
checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo,
|
||||
algo, checkConform2, aCheckedMap, theErrors);
|
||||
int key = (*revItSub).first;
|
||||
SMESH_subMesh* sm = (*revItSub).second;
|
||||
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
|
||||
{
|
||||
aCheckedMap[ key ] = sm;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : checkMissing
|
||||
//purpose : notify on missing hypothesis
|
||||
// Return false if algo or hipothesis is missing
|
||||
//=======================================================================
|
||||
|
||||
static bool checkMissing(SMESH_Gen* aGen,
|
||||
SMESH_Mesh& aMesh,
|
||||
SMESH_subMesh* aSubMesh,
|
||||
const int aTopAlgoDim,
|
||||
bool* globalChecked,
|
||||
const bool checkNoAlgo,
|
||||
map<int, SMESH_subMesh*>& aCheckedMap,
|
||||
list< SMESH_Gen::TAlgoStateError > & theErrors)
|
||||
{
|
||||
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
||||
return true;
|
||||
|
||||
//MESSAGE("=====checkMissing");
|
||||
|
||||
int ret = true;
|
||||
SMESH_Algo* algo = 0;
|
||||
|
||||
switch (aSubMesh->GetAlgoState())
|
||||
{
|
||||
case SMESH_subMesh::NO_ALGO: {
|
||||
if (checkNoAlgo)
|
||||
{
|
||||
// should there be any algo?
|
||||
int shapeDim = SMESH_Gen::GetShapeDim( aSubMesh->GetSubShape() );
|
||||
if (aTopAlgoDim > shapeDim)
|
||||
{
|
||||
MESSAGE( "ERROR: " << shapeDim << "D algorithm is missing" );
|
||||
ret = false;
|
||||
theErrors.push_back( SMESH_Gen::TAlgoStateError() );
|
||||
theErrors.back().Set( SMESH_Hypothesis::HYP_MISSING, shapeDim, true );
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
case SMESH_subMesh::MISSING_HYP: {
|
||||
// notify if an algo missing hyp is attached to aSubMesh
|
||||
algo = aGen->GetAlgo( aMesh, aSubMesh->GetSubShape() );
|
||||
ASSERT( algo );
|
||||
bool IsGlobalHypothesis = aGen->IsGlobalHypothesis( algo, aMesh );
|
||||
if (!IsGlobalHypothesis || !globalChecked[ algo->GetDim() ])
|
||||
{
|
||||
TAlgoStateErrorName errName = SMESH_Hypothesis::HYP_MISSING;
|
||||
SMESH_Hypothesis::Hypothesis_Status status;
|
||||
algo->CheckHypothesis( aMesh, aSubMesh->GetSubShape(), status );
|
||||
if ( status == SMESH_Hypothesis::HYP_BAD_PARAMETER ) {
|
||||
MESSAGE( "ERROR: hypothesis of " << (IsGlobalHypothesis ? "Global " : "Local ")
|
||||
<< "<" << algo->GetName() << "> has a bad parameter value");
|
||||
errName = status;
|
||||
} else if ( status == SMESH_Hypothesis::HYP_BAD_GEOMETRY ) {
|
||||
MESSAGE( "ERROR: " << (IsGlobalHypothesis ? "Global " : "Local ")
|
||||
<< "<" << algo->GetName() << "> assigned to mismatching geometry");
|
||||
errName = status;
|
||||
} else {
|
||||
MESSAGE( "ERROR: " << (IsGlobalHypothesis ? "Global " : "Local ")
|
||||
<< "<" << algo->GetName() << "> misses some hypothesis");
|
||||
}
|
||||
if (IsGlobalHypothesis)
|
||||
globalChecked[ algo->GetDim() ] = true;
|
||||
theErrors.push_back( SMESH_Gen::TAlgoStateError() );
|
||||
theErrors.back().Set( errName, algo, IsGlobalHypothesis );
|
||||
}
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
case SMESH_subMesh::HYP_OK:
|
||||
algo = aGen->GetAlgo( aMesh, aSubMesh->GetSubShape() );
|
||||
ret = true;
|
||||
break;
|
||||
default: ASSERT(0);
|
||||
}
|
||||
|
||||
// do not check under algo that hides sub-algos or
|
||||
// re-start checking NO_ALGO state
|
||||
ASSERT (algo);
|
||||
bool isTopLocalAlgo =
|
||||
( aTopAlgoDim <= algo->GetDim() && !aGen->IsGlobalHypothesis( algo, aMesh ));
|
||||
if (!algo->NeedDescretBoundary() || isTopLocalAlgo)
|
||||
{
|
||||
bool checkNoAlgo2 = ( algo->NeedDescretBoundary() );
|
||||
const map<int, SMESH_subMesh*>& subMeshes = aSubMesh->DependsOn();
|
||||
map<int, SMESH_subMesh*>::const_iterator itsub;
|
||||
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
|
||||
{
|
||||
// sub-meshes should not be checked further more
|
||||
int key = (*itsub).first;
|
||||
SMESH_subMesh* sm = (*itsub).second;
|
||||
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
|
||||
aCheckedMap[ key ] = sm;
|
||||
|
||||
if (isTopLocalAlgo)
|
||||
{
|
||||
//check algo on sub-meshes
|
||||
int aTopAlgoDim2 = algo->GetDim();
|
||||
if (!checkMissing (aGen, aMesh, sm, aTopAlgoDim2,
|
||||
globalChecked, checkNoAlgo2, aCheckedMap, theErrors))
|
||||
{
|
||||
ret = false;
|
||||
if (sm->GetAlgoState() == SMESH_subMesh::NO_ALGO )
|
||||
checkNoAlgo2 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckAlgoState
|
||||
//purpose : notify on bad state of attached algos, return false
|
||||
// if Compute() would fail because of some algo bad state
|
||||
//=======================================================================
|
||||
|
||||
bool SMESH_Gen::CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
|
||||
{
|
||||
list< TAlgoStateError > errors;
|
||||
return GetAlgoState( aMesh, aShape, errors );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetAlgoState
|
||||
//purpose : notify on bad state of attached algos, return false
|
||||
// if Compute() would fail because of some algo bad state
|
||||
// theErrors list contains problems description
|
||||
//=======================================================================
|
||||
|
||||
bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
|
||||
const TopoDS_Shape& theShape,
|
||||
list< TAlgoStateError > & theErrors)
|
||||
{
|
||||
//MESSAGE("SMESH_Gen::CheckAlgoState");
|
||||
|
||||
bool ret = true;
|
||||
bool hasAlgo = false;
|
||||
|
||||
SMESH_subMesh* sm = theMesh.GetSubMesh(theShape);
|
||||
const SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
|
||||
TopoDS_Shape mainShape = meshDS->ShapeToMesh();
|
||||
|
||||
// -----------------
|
||||
// get global algos
|
||||
// -----------------
|
||||
|
||||
const SMESH_Algo* aGlobAlgoArr[] = {0,0,0,0};
|
||||
|
||||
const list<const SMESHDS_Hypothesis*>& listHyp = meshDS->GetHypothesis( mainShape );
|
||||
list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
|
||||
for ( ; it != listHyp.end(); it++)
|
||||
{
|
||||
const SMESHDS_Hypothesis * aHyp = *it;
|
||||
if (aHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
|
||||
continue;
|
||||
|
||||
const SMESH_Algo* algo = dynamic_cast<const SMESH_Algo*> (aHyp);
|
||||
ASSERT ( algo );
|
||||
|
||||
int dim = algo->GetDim();
|
||||
aGlobAlgoArr[ dim ] = algo;
|
||||
|
||||
hasAlgo = true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// info on algos that will be ignored because of ones that
|
||||
// don't NeedDescretBoundary() attached to super-shapes,
|
||||
// check that a conform mesh will be produced
|
||||
// --------------------------------------------------------
|
||||
|
||||
|
||||
// find a global algo possibly hiding sub-algos
|
||||
int dim;
|
||||
const SMESH_Algo* aGlobIgnoAlgo = 0;
|
||||
for (dim = 3; dim > 0; dim--)
|
||||
{
|
||||
if (aGlobAlgoArr[ dim ] &&
|
||||
!aGlobAlgoArr[ dim ]->NeedDescretBoundary())
|
||||
{
|
||||
aGlobIgnoAlgo = aGlobAlgoArr[ dim ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const map<int, SMESH_subMesh*>& smMap = sm->DependsOn();
|
||||
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
|
||||
map<int, SMESH_subMesh*> aCheckedMap;
|
||||
bool checkConform = ( !theMesh.IsNotConformAllowed() );
|
||||
int aKey = 1;
|
||||
SMESH_subMesh* smToCheck = sm;
|
||||
|
||||
// loop on theShape and its sub-shapes
|
||||
while ( smToCheck )
|
||||
{
|
||||
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
||||
break;
|
||||
|
||||
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
|
||||
if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo,
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// info on missing hypothesis and find out if all needed algos are
|
||||
// well defined
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
//MESSAGE( "---info on missing hypothesis and find out if all needed algos are");
|
||||
|
||||
// find max dim of global algo
|
||||
int aTopAlgoDim = 0;
|
||||
for (dim = 3; dim > 0; dim--)
|
||||
{
|
||||
if (aGlobAlgoArr[ dim ])
|
||||
{
|
||||
aTopAlgoDim = dim;
|
||||
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
|
||||
while ( smToCheck )
|
||||
{
|
||||
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
||||
break;
|
||||
|
||||
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
|
||||
if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
|
||||
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 ) {
|
||||
ret = false;
|
||||
INFOS( "None algorithm attached" );
|
||||
theErrors.push_back( TAlgoStateError() );
|
||||
theErrors.back().Set( SMESH_Hypothesis::HYP_MISSING, 1, true );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsGlobalHypothesis
|
||||
//purpose : check if theAlgo is attached to the main shape
|
||||
//=======================================================================
|
||||
|
||||
bool SMESH_Gen::IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh)
|
||||
{
|
||||
SMESH_HypoFilter filter( SMESH_HypoFilter::Is( theHyp ));
|
||||
return aMesh.GetHypothesis( aMesh.GetMeshDS()->ShapeToMesh(), filter, false );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh,
|
||||
const TopoDS_Shape & aShape,
|
||||
TopoDS_Shape* assignedTo)
|
||||
{
|
||||
|
||||
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
|
||||
filter.And( filter.IsApplicableTo( aShape ));
|
||||
|
||||
return (SMESH_Algo*) aMesh.GetHypothesis( aShape, filter, true, assignedTo );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId)
|
||||
{
|
||||
// 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];
|
||||
// ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end());
|
||||
return myStudyContext;
|
||||
}
|
||||
|
||||
// //=============================================================================
|
||||
// /*!
|
||||
// *
|
||||
// */
|
||||
// //=============================================================================
|
||||
|
||||
// void SMESH_Gen::Save(int studyId, const char *aUrlOfFile)
|
||||
// {
|
||||
// }
|
||||
|
||||
// //=============================================================================
|
||||
// /*!
|
||||
// *
|
||||
// */
|
||||
// //=============================================================================
|
||||
|
||||
// void SMESH_Gen::Load(int studyId, const char *aUrlOfFile)
|
||||
// {
|
||||
// }
|
||||
|
||||
// //=============================================================================
|
||||
// /*!
|
||||
// *
|
||||
// */
|
||||
// //=============================================================================
|
||||
|
||||
// void SMESH_Gen::Close(int studyId)
|
||||
// {
|
||||
// }
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
|
||||
{
|
||||
static vector<int> dim;
|
||||
if ( dim.empty() )
|
||||
{
|
||||
dim.resize( TopAbs_SHAPE, -1 );
|
||||
dim[ TopAbs_COMPOUND ] = MeshDim_3D;
|
||||
dim[ TopAbs_COMPSOLID ] = MeshDim_3D;
|
||||
dim[ TopAbs_SOLID ] = MeshDim_3D;
|
||||
dim[ TopAbs_SHELL ] = MeshDim_3D;
|
||||
dim[ TopAbs_FACE ] = MeshDim_2D;
|
||||
dim[ TopAbs_WIRE ] = MeshDim_1D;
|
||||
dim[ TopAbs_EDGE ] = MeshDim_1D;
|
||||
dim[ TopAbs_VERTEX ] = MeshDim_0D;
|
||||
}
|
||||
return dim[ aShapeType ];
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
int SMESH_Gen::GetANewId()
|
||||
{
|
||||
//MESSAGE("SMESH_Gen::GetANewId");
|
||||
return _hypId++;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,683 +0,0 @@
|
|||
<<<<<<< bca7a1866e596ad2e318809f35b6d08776226a69
|
||||
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
|
||||
//
|
||||
// Copyright (C) 2003 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
|
||||
//
|
||||
// File : SMESH_MeshVSLink.cxx
|
||||
// Created : Mon Dec 1 09:00:00 2008
|
||||
// Author : Sioutis Fotios
|
||||
// Module : SMESH
|
||||
|
||||
//local headers
|
||||
#include <SMESH_MeshVSLink.ixx>
|
||||
#include <SMESHDS_Group.hxx>
|
||||
|
||||
//occ headers
|
||||
#include <TColgp_Array1OfXYZ.hxx>
|
||||
#include <MeshVS_HArray1OfSequenceOfInteger.hxx>
|
||||
#include <SMDS_VolumeTool.hxx>
|
||||
|
||||
//BEGIN sortNodes CHANGE /*
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
#include <TColgp_Array1OfXYZ.hxx>
|
||||
#include <TColgp_Array1OfVec.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
IMPLEMENT_STANDARD_RTTIEXT(SMESH_MeshVSLink,MeshVS_DataSource3D)
|
||||
#endif
|
||||
|
||||
#define MAX_SORT_NODE_COUNT 12
|
||||
|
||||
typedef std::map<double, int> T_Double_NodeID_Map;
|
||||
|
||||
//=======================================================================
|
||||
//function : sortNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool sortNodes (const SMDS_MeshElement* theTool, const int* idNodes, int theNodeCount, int *myResult)
|
||||
{
|
||||
if (theNodeCount < 3) return false;
|
||||
//INITIAL VARS
|
||||
TColgp_Array1OfXYZ myNodeList(1, theNodeCount);
|
||||
TColgp_Array1OfVec myVectList(1, theNodeCount);
|
||||
TColStd_Array1OfReal myAngleList(1, theNodeCount);
|
||||
gp_XYZ BaryCenter(0.,0.,0.);
|
||||
//int myResult[MAX_SORT_NODE_COUNT];
|
||||
//INITIALIZE THE POINTS
|
||||
for (int i = 1; i <= theNodeCount; i++ ) {
|
||||
const SMDS_MeshNode *n = theTool->GetNode( idNodes[i-1] );
|
||||
gp_XYZ aPoint(n->X(), n->Y(), n->Z());
|
||||
myNodeList.SetValue(i, aPoint);
|
||||
}
|
||||
//CALCULATE THE BARYCENTER
|
||||
for (int i = 1; i <= theNodeCount; i++ )
|
||||
BaryCenter += myNodeList.Value(i);
|
||||
BaryCenter /= theNodeCount;
|
||||
//CREATE THE VECTORS
|
||||
for (int i = 1; i <= theNodeCount; i++ ) {
|
||||
gp_Vec aVector(BaryCenter, myNodeList.Value(i));
|
||||
myVectList.SetValue(i, aVector);
|
||||
}
|
||||
//CALCULATE THE NORMAL USING FIRST THREE POINTS
|
||||
gp_XYZ q1 = myNodeList.Value(2)-myNodeList.Value(1);
|
||||
gp_XYZ q2 = myNodeList.Value(3)-myNodeList.Value(1);
|
||||
gp_XYZ normal = q1 ^ q2;
|
||||
double modul = normal.Modulus();
|
||||
if ( modul > 0 )
|
||||
normal /= modul;
|
||||
//COUNT THE ANGLE OF THE FIRST WITH EACH
|
||||
for (int i = 1; i <= theNodeCount; i++ )
|
||||
myAngleList.SetValue(i, myVectList.Value(1).AngleWithRef(myVectList.Value(i), normal));
|
||||
//CREATE THE RESULT MAP (WILL SORT THE VERTICES)
|
||||
T_Double_NodeID_Map myMap;
|
||||
for (int i = 1; i <= theNodeCount; i++ )
|
||||
myMap.insert( make_pair(myAngleList.Value(i), idNodes[i-1]));
|
||||
int resID = 0;
|
||||
T_Double_NodeID_Map::iterator it;
|
||||
for(it = myMap.begin(); it!= myMap.end(); ++it)
|
||||
myResult[resID++] = it->second;
|
||||
|
||||
return true;
|
||||
}
|
||||
//END sortNodes CHANGE */
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
//================================================================
|
||||
SMESH_MeshVSLink::SMESH_MeshVSLink(const SMESH_Mesh *aMesh)
|
||||
{
|
||||
myMesh = (SMESH_Mesh*) aMesh;
|
||||
//add the nodes
|
||||
SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator();
|
||||
for(;aNodeIter->more();) {
|
||||
const SMDS_MeshNode* aNode = aNodeIter->next();
|
||||
myNodes.Add( aNode->GetID() );
|
||||
}
|
||||
//add the edges
|
||||
SMDS_EdgeIteratorPtr anEdgeIter = myMesh->GetMeshDS()->edgesIterator();
|
||||
for(;anEdgeIter->more();) {
|
||||
const SMDS_MeshEdge* anElem = anEdgeIter->next();
|
||||
myElements.Add( anElem->GetID() );
|
||||
}
|
||||
//add the faces
|
||||
SMDS_FaceIteratorPtr aFaceIter = myMesh->GetMeshDS()->facesIterator();
|
||||
for(;aFaceIter->more();) {
|
||||
const SMDS_MeshFace* anElem = aFaceIter->next();
|
||||
myElements.Add( anElem->GetID() );
|
||||
}
|
||||
//add the volumes
|
||||
SMDS_VolumeIteratorPtr aVolumeIter = myMesh->GetMeshDS()->volumesIterator();
|
||||
for(;aVolumeIter->more();) {
|
||||
const SMDS_MeshVolume* anElem = aVolumeIter->next();
|
||||
myElements.Add( anElem->GetID() );
|
||||
}
|
||||
//add the groups
|
||||
const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetMeshDS()->GetGroups();
|
||||
if (!groups.empty()) {
|
||||
std::set<SMESHDS_GroupBase*>::const_iterator GrIt = groups.begin();
|
||||
for (; GrIt != groups.end(); GrIt++) {
|
||||
SMESHDS_Group* grp = dynamic_cast<SMESHDS_Group*>(*GrIt);
|
||||
if (!grp || grp->IsEmpty()) continue;
|
||||
myGroups.Add(grp->GetID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetGeom
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::GetGeom
|
||||
( const Standard_Integer ID, const Standard_Boolean IsElement,
|
||||
TColStd_Array1OfReal& Coords, Standard_Integer& NbNodes,
|
||||
MeshVS_EntityType& Type ) const
|
||||
{
|
||||
if( IsElement ) {
|
||||
const SMDS_MeshElement* myElem = myMesh->GetMeshDS()->FindElement(ID);
|
||||
if (!myElem) return Standard_False;
|
||||
if (myElem->GetType() == SMDSAbs_Edge)
|
||||
Type = MeshVS_ET_Link;
|
||||
else if (myElem->GetType() == SMDSAbs_Face)
|
||||
Type = MeshVS_ET_Face;
|
||||
else if (myElem->GetType() == SMDSAbs_Volume)
|
||||
Type = MeshVS_ET_Volume;
|
||||
else
|
||||
Type = MeshVS_ET_Element;
|
||||
NbNodes = myElem->NbNodes();
|
||||
int nbCoord = 1;
|
||||
for(Standard_Integer i = 0; i < NbNodes; i++ ) {
|
||||
Coords(nbCoord++) = myElem->GetNode(i)->X();
|
||||
Coords(nbCoord++) = myElem->GetNode(i)->Y();
|
||||
Coords(nbCoord++) = myElem->GetNode(i)->Z();
|
||||
}
|
||||
}
|
||||
else {
|
||||
const SMDS_MeshNode* myNode = myMesh->GetMeshDS()->FindNode(ID);
|
||||
if (!myNode) return Standard_False;
|
||||
if (myNode->GetType() == SMDSAbs_Node)
|
||||
Type = MeshVS_ET_Node;
|
||||
else
|
||||
Type = MeshVS_ET_0D;
|
||||
NbNodes = 1;
|
||||
Coords(1) = myNode->X();
|
||||
Coords(2) = myNode->Y();
|
||||
Coords(3) = myNode->Z();
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : Get3DGeom
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::Get3DGeom
|
||||
( const Standard_Integer ID, Standard_Integer& NbNodes,
|
||||
Handle(MeshVS_HArray1OfSequenceOfInteger)& Data) const
|
||||
{
|
||||
//check validity of element
|
||||
const SMDS_MeshElement* myVolume = myMesh->GetMeshDS()->FindElement(ID);
|
||||
if (!myVolume) return Standard_False;
|
||||
if (myVolume->GetType() != SMDSAbs_Volume) return Standard_False;
|
||||
|
||||
//initialize VolumeTool
|
||||
SMDS_VolumeTool aTool;
|
||||
aTool.Set(myVolume);
|
||||
//set the nodes number
|
||||
NbNodes = aTool.NbNodes();// myVolume->NbNodes();
|
||||
//check validity or create Data
|
||||
int NbFaces = aTool.NbFaces();
|
||||
if (Data.IsNull())
|
||||
Data = new MeshVS_HArray1OfSequenceOfInteger(1, NbFaces);
|
||||
else if (Data->Length() != NbFaces) {
|
||||
Data.Nullify();
|
||||
Data = new MeshVS_HArray1OfSequenceOfInteger(1, NbFaces);
|
||||
}
|
||||
//iterate the faces and their nodes and add them to Data
|
||||
for (int itr=0;itr < NbFaces;itr++) {
|
||||
int NbThisFaceNodeCount = aTool.NbFaceNodes(itr);
|
||||
const int *FaceIndices = aTool.GetFaceNodesIndices(itr);
|
||||
int sortedFaceIndices[MAX_SORT_NODE_COUNT];
|
||||
TColStd_SequenceOfInteger aSeq;
|
||||
if (sortNodes(myVolume, FaceIndices, NbThisFaceNodeCount, sortedFaceIndices)) {
|
||||
for (int itrX=0;itrX < NbThisFaceNodeCount;itrX++)
|
||||
aSeq.Append(sortedFaceIndices[itrX]);
|
||||
} else {
|
||||
for (int itrX=0;itrX < NbThisFaceNodeCount;itrX++)
|
||||
aSeq.Append(FaceIndices[itrX]);
|
||||
}
|
||||
Data->SetValue(itr+1, aSeq);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetGeomType
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::GetGeomType
|
||||
( const Standard_Integer ID,
|
||||
const Standard_Boolean IsElement,
|
||||
MeshVS_EntityType& Type ) const
|
||||
{
|
||||
if( IsElement ) {
|
||||
const SMDS_MeshElement* myElem = myMesh->GetMeshDS()->FindElement(ID);
|
||||
if (!myElem) return Standard_False;
|
||||
if (myElem->GetType() == SMDSAbs_Edge)
|
||||
Type = MeshVS_ET_Link;
|
||||
else if (myElem->GetType() == SMDSAbs_Face)
|
||||
Type = MeshVS_ET_Face;
|
||||
else if (myElem->GetType() == SMDSAbs_Volume)
|
||||
Type = MeshVS_ET_Volume;
|
||||
else
|
||||
Type = MeshVS_ET_Element;
|
||||
}
|
||||
else {
|
||||
const SMDS_MeshNode* myNode = myMesh->GetMeshDS()->FindNode(ID);
|
||||
if (!myNode) return Standard_False;
|
||||
if (myNode->GetType() == SMDSAbs_Node)
|
||||
Type = MeshVS_ET_Node;
|
||||
else
|
||||
Type = MeshVS_ET_0D;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetAddr
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Address SMESH_MeshVSLink::GetAddr
|
||||
( const Standard_Integer, const Standard_Boolean ) const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetNodesByElement
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::GetNodesByElement
|
||||
( const Standard_Integer ID,TColStd_Array1OfInteger& NodeIDs,Standard_Integer& NbNodes ) const
|
||||
{
|
||||
const SMDS_MeshElement* myElem = myMesh->GetMeshDS()->FindElement(ID);
|
||||
if (!myElem) return Standard_False;
|
||||
NbNodes = myElem->NbNodes();
|
||||
for(Standard_Integer i = 0; i < NbNodes; i++ ) {
|
||||
const SMDS_MeshNode* aNode = myElem->GetNode(i);
|
||||
if (!aNode) return Standard_False;
|
||||
NodeIDs.SetValue(i+1, aNode->GetID());
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetAllNodes
|
||||
// Purpose :
|
||||
//================================================================
|
||||
const TColStd_PackedMapOfInteger& SMESH_MeshVSLink::GetAllNodes() const
|
||||
{
|
||||
return myNodes;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetAllElements
|
||||
// Purpose :
|
||||
//================================================================
|
||||
const TColStd_PackedMapOfInteger& SMESH_MeshVSLink::GetAllElements() const
|
||||
{
|
||||
return myElements;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetAllElements
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void SMESH_MeshVSLink::GetAllGroups(TColStd_PackedMapOfInteger& Ids) const
|
||||
{
|
||||
Ids = myGroups;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetNormal
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::GetNormal
|
||||
( const Standard_Integer Id, const Standard_Integer Max,
|
||||
Standard_Real& nx, Standard_Real& ny,Standard_Real& nz ) const
|
||||
{
|
||||
if(Max<3) return Standard_False;
|
||||
const SMDS_MeshElement* myElem = myMesh->GetMeshDS()->FindElement(Id);
|
||||
if(!myElem) return Standard_False;
|
||||
if(myElem->NbNodes() < 3) return Standard_False;
|
||||
gp_XYZ normal;
|
||||
gp_XYZ nodes[3];
|
||||
for (int itr = 0;itr < 3;itr++)
|
||||
nodes[itr] = gp_XYZ(myElem->GetNode(itr)->X(), myElem->GetNode(itr)->Y(), myElem->GetNode(itr)->Z());
|
||||
normal = (nodes[1]-nodes[0]) ^ (nodes[2]-nodes[0]);
|
||||
if ( normal.Modulus() > 0 )
|
||||
normal /= normal.Modulus();
|
||||
nx = normal.X();
|
||||
ny = normal.Y();
|
||||
nz = normal.Z();
|
||||
return Standard_True;
|
||||
}
|
||||
=======
|
||||
// SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC
|
||||
//
|
||||
// Copyright (C) 2003 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
|
||||
//
|
||||
// File : SMESH_MeshVSLink.cxx
|
||||
// Created : Mon Dec 1 09:00:00 2008
|
||||
// Author : Sioutis Fotios
|
||||
// Module : SMESH
|
||||
|
||||
//local headers
|
||||
#include <SMESH_MeshVSLink.hxx>
|
||||
#include <SMESHDS_Group.hxx>
|
||||
|
||||
//occ headers
|
||||
#include <TColgp_Array1OfXYZ.hxx>
|
||||
#include <MeshVS_HArray1OfSequenceOfInteger.hxx>
|
||||
#include <SMDS_VolumeTool.hxx>
|
||||
|
||||
//BEGIN sortNodes CHANGE /*
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
#include <TColgp_Array1OfXYZ.hxx>
|
||||
#include <TColgp_Array1OfVec.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
#define MAX_SORT_NODE_COUNT 12
|
||||
|
||||
typedef std::map<double, int> T_Double_NodeID_Map;
|
||||
|
||||
//=======================================================================
|
||||
//function : sortNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool sortNodes (const SMDS_MeshElement* theTool, const int* idNodes, int theNodeCount, int *myResult)
|
||||
{
|
||||
if (theNodeCount < 3) return false;
|
||||
//INITIAL VARS
|
||||
TColgp_Array1OfXYZ myNodeList(1, theNodeCount);
|
||||
TColgp_Array1OfVec myVectList(1, theNodeCount);
|
||||
TColStd_Array1OfReal myAngleList(1, theNodeCount);
|
||||
gp_XYZ BaryCenter(0.,0.,0.);
|
||||
//int myResult[MAX_SORT_NODE_COUNT];
|
||||
//INITIALIZE THE POINTS
|
||||
for (int i = 1; i <= theNodeCount; i++ ) {
|
||||
const SMDS_MeshNode *n = theTool->GetNode( idNodes[i-1] );
|
||||
gp_XYZ aPoint(n->X(), n->Y(), n->Z());
|
||||
myNodeList.SetValue(i, aPoint);
|
||||
}
|
||||
//CALCULATE THE BARYCENTER
|
||||
for (int i = 1; i <= theNodeCount; i++ )
|
||||
BaryCenter += myNodeList.Value(i);
|
||||
BaryCenter /= theNodeCount;
|
||||
//CREATE THE VECTORS
|
||||
for (int i = 1; i <= theNodeCount; i++ ) {
|
||||
gp_Vec aVector(BaryCenter, myNodeList.Value(i));
|
||||
myVectList.SetValue(i, aVector);
|
||||
}
|
||||
//CALCULATE THE NORMAL USING FIRST THREE POINTS
|
||||
gp_XYZ q1 = myNodeList.Value(2)-myNodeList.Value(1);
|
||||
gp_XYZ q2 = myNodeList.Value(3)-myNodeList.Value(1);
|
||||
gp_XYZ normal = q1 ^ q2;
|
||||
double modul = normal.Modulus();
|
||||
if ( modul > 0 )
|
||||
normal /= modul;
|
||||
//COUNT THE ANGLE OF THE FIRST WITH EACH
|
||||
for (int i = 1; i <= theNodeCount; i++ )
|
||||
myAngleList.SetValue(i, myVectList.Value(1).AngleWithRef(myVectList.Value(i), normal));
|
||||
//CREATE THE RESULT MAP (WILL SORT THE VERTICES)
|
||||
T_Double_NodeID_Map myMap;
|
||||
for (int i = 1; i <= theNodeCount; i++ )
|
||||
myMap.insert( make_pair(myAngleList.Value(i), idNodes[i-1]));
|
||||
int resID = 0;
|
||||
T_Double_NodeID_Map::iterator it;
|
||||
for(it = myMap.begin(); it!= myMap.end(); ++it)
|
||||
myResult[resID++] = it->second;
|
||||
|
||||
return true;
|
||||
}
|
||||
//END sortNodes CHANGE */
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
//================================================================
|
||||
SMESH_MeshVSLink::SMESH_MeshVSLink(const SMESH_Mesh *aMesh)
|
||||
{
|
||||
myMesh = (SMESH_Mesh*) aMesh;
|
||||
//add the nodes
|
||||
SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator();
|
||||
for(;aNodeIter->more();) {
|
||||
const SMDS_MeshNode* aNode = aNodeIter->next();
|
||||
myNodes.Add( aNode->GetID() );
|
||||
}
|
||||
//add the edges
|
||||
SMDS_EdgeIteratorPtr anEdgeIter = myMesh->GetMeshDS()->edgesIterator();
|
||||
for(;anEdgeIter->more();) {
|
||||
const SMDS_MeshEdge* anElem = anEdgeIter->next();
|
||||
myElements.Add( anElem->GetID() );
|
||||
}
|
||||
//add the faces
|
||||
SMDS_FaceIteratorPtr aFaceIter = myMesh->GetMeshDS()->facesIterator();
|
||||
for(;aFaceIter->more();) {
|
||||
const SMDS_MeshFace* anElem = aFaceIter->next();
|
||||
myElements.Add( anElem->GetID() );
|
||||
}
|
||||
//add the volumes
|
||||
SMDS_VolumeIteratorPtr aVolumeIter = myMesh->GetMeshDS()->volumesIterator();
|
||||
for(;aVolumeIter->more();) {
|
||||
const SMDS_MeshVolume* anElem = aVolumeIter->next();
|
||||
myElements.Add( anElem->GetID() );
|
||||
}
|
||||
//add the groups
|
||||
const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetMeshDS()->GetGroups();
|
||||
if (!groups.empty()) {
|
||||
std::set<SMESHDS_GroupBase*>::const_iterator GrIt = groups.begin();
|
||||
for (; GrIt != groups.end(); GrIt++) {
|
||||
SMESHDS_Group* grp = dynamic_cast<SMESHDS_Group*>(*GrIt);
|
||||
if (!grp || grp->IsEmpty()) continue;
|
||||
myGroups.Add(grp->GetID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetGeom
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::GetGeom
|
||||
( const Standard_Integer ID, const Standard_Boolean IsElement,
|
||||
TColStd_Array1OfReal& Coords, Standard_Integer& NbNodes,
|
||||
MeshVS_EntityType& Type ) const
|
||||
{
|
||||
if( IsElement ) {
|
||||
const SMDS_MeshElement* myElem = myMesh->GetMeshDS()->FindElement(ID);
|
||||
if (!myElem) return Standard_False;
|
||||
if (myElem->GetType() == SMDSAbs_Edge)
|
||||
Type = MeshVS_ET_Link;
|
||||
else if (myElem->GetType() == SMDSAbs_Face)
|
||||
Type = MeshVS_ET_Face;
|
||||
else if (myElem->GetType() == SMDSAbs_Volume)
|
||||
Type = MeshVS_ET_Volume;
|
||||
else
|
||||
Type = MeshVS_ET_Element;
|
||||
NbNodes = myElem->NbNodes();
|
||||
int nbCoord = 1;
|
||||
for(Standard_Integer i = 0; i < NbNodes; i++ ) {
|
||||
Coords(nbCoord++) = myElem->GetNode(i)->X();
|
||||
Coords(nbCoord++) = myElem->GetNode(i)->Y();
|
||||
Coords(nbCoord++) = myElem->GetNode(i)->Z();
|
||||
}
|
||||
}
|
||||
else {
|
||||
const SMDS_MeshNode* myNode = myMesh->GetMeshDS()->FindNode(ID);
|
||||
if (!myNode) return Standard_False;
|
||||
if (myNode->GetType() == SMDSAbs_Node)
|
||||
Type = MeshVS_ET_Node;
|
||||
else
|
||||
Type = MeshVS_ET_0D;
|
||||
NbNodes = 1;
|
||||
Coords(1) = myNode->X();
|
||||
Coords(2) = myNode->Y();
|
||||
Coords(3) = myNode->Z();
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : Get3DGeom
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::Get3DGeom
|
||||
( const Standard_Integer ID, Standard_Integer& NbNodes,
|
||||
Handle(MeshVS_HArray1OfSequenceOfInteger)& Data) const
|
||||
{
|
||||
//check validity of element
|
||||
const SMDS_MeshElement* myVolume = myMesh->GetMeshDS()->FindElement(ID);
|
||||
if (!myVolume) return Standard_False;
|
||||
if (myVolume->GetType() != SMDSAbs_Volume) return Standard_False;
|
||||
|
||||
//initialize VolumeTool
|
||||
SMDS_VolumeTool aTool;
|
||||
aTool.Set(myVolume);
|
||||
//set the nodes number
|
||||
NbNodes = aTool.NbNodes();// myVolume->NbNodes();
|
||||
//check validity or create Data
|
||||
int NbFaces = aTool.NbFaces();
|
||||
if (Data.IsNull())
|
||||
Data = new MeshVS_HArray1OfSequenceOfInteger(1, NbFaces);
|
||||
else if (Data->Length() != NbFaces) {
|
||||
Data.Nullify();
|
||||
Data = new MeshVS_HArray1OfSequenceOfInteger(1, NbFaces);
|
||||
}
|
||||
//iterate the faces and their nodes and add them to Data
|
||||
for (int itr=0;itr < NbFaces;itr++) {
|
||||
int NbThisFaceNodeCount = aTool.NbFaceNodes(itr);
|
||||
const int *FaceIndices = aTool.GetFaceNodesIndices(itr);
|
||||
int sortedFaceIndices[MAX_SORT_NODE_COUNT];
|
||||
TColStd_SequenceOfInteger aSeq;
|
||||
if (sortNodes(myVolume, FaceIndices, NbThisFaceNodeCount, sortedFaceIndices)) {
|
||||
for (int itrX=0;itrX < NbThisFaceNodeCount;itrX++)
|
||||
aSeq.Append(sortedFaceIndices[itrX]);
|
||||
} else {
|
||||
for (int itrX=0;itrX < NbThisFaceNodeCount;itrX++)
|
||||
aSeq.Append(FaceIndices[itrX]);
|
||||
}
|
||||
Data->SetValue(itr+1, aSeq);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetGeomType
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::GetGeomType
|
||||
( const Standard_Integer ID,
|
||||
const Standard_Boolean IsElement,
|
||||
MeshVS_EntityType& Type ) const
|
||||
{
|
||||
if( IsElement ) {
|
||||
const SMDS_MeshElement* myElem = myMesh->GetMeshDS()->FindElement(ID);
|
||||
if (!myElem) return Standard_False;
|
||||
if (myElem->GetType() == SMDSAbs_Edge)
|
||||
Type = MeshVS_ET_Link;
|
||||
else if (myElem->GetType() == SMDSAbs_Face)
|
||||
Type = MeshVS_ET_Face;
|
||||
else if (myElem->GetType() == SMDSAbs_Volume)
|
||||
Type = MeshVS_ET_Volume;
|
||||
else
|
||||
Type = MeshVS_ET_Element;
|
||||
}
|
||||
else {
|
||||
const SMDS_MeshNode* myNode = myMesh->GetMeshDS()->FindNode(ID);
|
||||
if (!myNode) return Standard_False;
|
||||
if (myNode->GetType() == SMDSAbs_Node)
|
||||
Type = MeshVS_ET_Node;
|
||||
else
|
||||
Type = MeshVS_ET_0D;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetAddr
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Address SMESH_MeshVSLink::GetAddr
|
||||
( const Standard_Integer, const Standard_Boolean ) const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetNodesByElement
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::GetNodesByElement
|
||||
( const Standard_Integer ID,TColStd_Array1OfInteger& NodeIDs,Standard_Integer& NbNodes ) const
|
||||
{
|
||||
const SMDS_MeshElement* myElem = myMesh->GetMeshDS()->FindElement(ID);
|
||||
if (!myElem) return Standard_False;
|
||||
NbNodes = myElem->NbNodes();
|
||||
for(Standard_Integer i = 0; i < NbNodes; i++ ) {
|
||||
const SMDS_MeshNode* aNode = myElem->GetNode(i);
|
||||
if (!aNode) return Standard_False;
|
||||
NodeIDs.SetValue(i+1, aNode->GetID());
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetAllNodes
|
||||
// Purpose :
|
||||
//================================================================
|
||||
const TColStd_PackedMapOfInteger& SMESH_MeshVSLink::GetAllNodes() const
|
||||
{
|
||||
return myNodes;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetAllElements
|
||||
// Purpose :
|
||||
//================================================================
|
||||
const TColStd_PackedMapOfInteger& SMESH_MeshVSLink::GetAllElements() const
|
||||
{
|
||||
return myElements;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetAllElements
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void SMESH_MeshVSLink::GetAllGroups(TColStd_PackedMapOfInteger& Ids) const
|
||||
{
|
||||
Ids = myGroups;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetNormal
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean SMESH_MeshVSLink::GetNormal
|
||||
( const Standard_Integer Id, const Standard_Integer Max,
|
||||
Standard_Real& nx, Standard_Real& ny,Standard_Real& nz ) const
|
||||
{
|
||||
if(Max<3) return Standard_False;
|
||||
const SMDS_MeshElement* myElem = myMesh->GetMeshDS()->FindElement(Id);
|
||||
if(!myElem) return Standard_False;
|
||||
if(myElem->NbNodes() < 3) return Standard_False;
|
||||
gp_XYZ normal;
|
||||
gp_XYZ nodes[3];
|
||||
for (int itr = 0;itr < 3;itr++)
|
||||
nodes[itr] = gp_XYZ(myElem->GetNode(itr)->X(), myElem->GetNode(itr)->Y(), myElem->GetNode(itr)->Z());
|
||||
normal = (nodes[1]-nodes[0]) ^ (nodes[2]-nodes[0]);
|
||||
if ( normal.Modulus() > 0 )
|
||||
normal /= normal.Modulus();
|
||||
nx = normal.X();
|
||||
ny = normal.Y();
|
||||
nz = normal.Z();
|
||||
return Standard_True;
|
||||
}
|
||||
>>>>>>> upgrade to SMESH7.7.1
|
|
@ -1,416 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* 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 Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include <Base/Writer.h>
|
||||
|
||||
#include "Document.h"
|
||||
#include "DocumentObject.h"
|
||||
#include "DocumentObjectGroup.h"
|
||||
#include "PropertyLinks.h"
|
||||
#include "PropertyExpressionEngine.h"
|
||||
<<<<<<< d634f3384aa4e6436c7df203435de3895700be84
|
||||
#include <App/DocumentObjectPy.h>
|
||||
=======
|
||||
#include "DocumentObjectExtension.h"
|
||||
>>>>>>> Special calls for document object extensions
|
||||
#include <boost/signals/connection.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
using namespace App;
|
||||
|
||||
|
||||
PROPERTY_SOURCE(App::DocumentObject, App::TransactionalObject)
|
||||
|
||||
DocumentObjectExecReturn *DocumentObject::StdReturn = 0;
|
||||
|
||||
//===========================================================================
|
||||
// DocumentObject
|
||||
//===========================================================================
|
||||
|
||||
DocumentObject::DocumentObject(void)
|
||||
: ExpressionEngine(),_pDoc(0),pcNameInDocument(0)
|
||||
{
|
||||
// define Label of type 'Output' to avoid being marked as touched after relabeling
|
||||
ADD_PROPERTY_TYPE(Label,("Unnamed"),"Base",Prop_Output,"User name of the object (UTF8)");
|
||||
ADD_PROPERTY_TYPE(ExpressionEngine,(),"Base",Prop_Hidden,"Property expressions");
|
||||
}
|
||||
|
||||
DocumentObject::~DocumentObject(void)
|
||||
{
|
||||
if (!PythonObject.is(Py::_None())){
|
||||
// Remark: The API of Py::Object has been changed to set whether the wrapper owns the passed
|
||||
// Python object or not. In the constructor we forced the wrapper to own the object so we need
|
||||
// not to dec'ref the Python object any more.
|
||||
// But we must still invalidate the Python object because it need not to be
|
||||
// destructed right now because the interpreter can own several references to it.
|
||||
Base::PyObjectBase* obj = (Base::PyObjectBase*)PythonObject.ptr();
|
||||
// Call before decrementing the reference counter, otherwise a heap error can occur
|
||||
obj->setInvalid();
|
||||
}
|
||||
}
|
||||
|
||||
namespace App {
|
||||
class ObjectExecution
|
||||
{
|
||||
public:
|
||||
ObjectExecution(DocumentObject* o) : obj(o)
|
||||
{ obj->StatusBits.set(3); }
|
||||
~ObjectExecution()
|
||||
{ obj->StatusBits.reset(3); }
|
||||
private:
|
||||
DocumentObject* obj;
|
||||
};
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *DocumentObject::recompute(void)
|
||||
{
|
||||
// set/unset the execution bit
|
||||
ObjectExecution exe(this);
|
||||
return this->execute();
|
||||
}
|
||||
|
||||
DocumentObjectExecReturn *DocumentObject::execute(void)
|
||||
{
|
||||
//call all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
if(ext->extensionMustExecute())
|
||||
ext->extensionExecute();
|
||||
|
||||
return StdReturn;
|
||||
}
|
||||
|
||||
short DocumentObject::mustExecute(void) const
|
||||
{
|
||||
if(isTouched())
|
||||
return 1;
|
||||
|
||||
//ask all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
if(ext->extensionMustExecute())
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
const char* DocumentObject::getStatusString(void) const
|
||||
{
|
||||
if (isError()) {
|
||||
const char* text = getDocument()->getErrorDescription(this);
|
||||
return text ? text : "Error";
|
||||
}
|
||||
else if (isTouched())
|
||||
return "Touched";
|
||||
else
|
||||
return "Valid";
|
||||
}
|
||||
|
||||
const char *DocumentObject::getNameInDocument(void) const
|
||||
{
|
||||
// Note: It can happen that we query the internal name of an object even if it is not
|
||||
// part of a document (anymore). This is the case e.g. if we have a reference in Python
|
||||
// to an object that has been removed from the document. In this case we should rather
|
||||
// return 0.
|
||||
//assert(pcNameInDocument);
|
||||
if (!pcNameInDocument) return 0;
|
||||
return pcNameInDocument->c_str();
|
||||
}
|
||||
|
||||
bool DocumentObject::isAttachedToDocument() const
|
||||
{
|
||||
return (pcNameInDocument != 0);
|
||||
}
|
||||
|
||||
const char* DocumentObject::detachFromDocument()
|
||||
{
|
||||
const std::string* name = pcNameInDocument;
|
||||
pcNameInDocument = 0;
|
||||
return name ? name->c_str() : 0;
|
||||
}
|
||||
|
||||
std::vector<DocumentObject*> DocumentObject::getOutList(void) const
|
||||
{
|
||||
std::vector<Property*> List;
|
||||
std::vector<DocumentObject*> ret;
|
||||
getPropertyList(List);
|
||||
for (std::vector<Property*>::const_iterator It = List.begin();It != List.end(); ++It) {
|
||||
if ((*It)->isDerivedFrom(PropertyLinkList::getClassTypeId())) {
|
||||
const std::vector<DocumentObject*> &OutList = static_cast<PropertyLinkList*>(*It)->getValues();
|
||||
for (std::vector<DocumentObject*>::const_iterator It2 = OutList.begin();It2 != OutList.end(); ++It2) {
|
||||
if (*It2)
|
||||
ret.push_back(*It2);
|
||||
}
|
||||
}
|
||||
else if ((*It)->isDerivedFrom(PropertyLinkSubList::getClassTypeId())) {
|
||||
const std::vector<DocumentObject*> &OutList = static_cast<PropertyLinkSubList*>(*It)->getValues();
|
||||
for (std::vector<DocumentObject*>::const_iterator It2 = OutList.begin();It2 != OutList.end(); ++It2) {
|
||||
if (*It2)
|
||||
ret.push_back(*It2);
|
||||
}
|
||||
}
|
||||
else if ((*It)->isDerivedFrom(PropertyLink::getClassTypeId())) {
|
||||
if (static_cast<PropertyLink*>(*It)->getValue())
|
||||
ret.push_back(static_cast<PropertyLink*>(*It)->getValue());
|
||||
}
|
||||
else if ((*It)->isDerivedFrom(PropertyLinkSub::getClassTypeId())) {
|
||||
if (static_cast<PropertyLinkSub*>(*It)->getValue())
|
||||
ret.push_back(static_cast<PropertyLinkSub*>(*It)->getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// Get document objects that this document object relies on
|
||||
ExpressionEngine.getDocumentObjectDeps(ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> DocumentObject::getInList(void) const
|
||||
{
|
||||
if (_pDoc)
|
||||
return _pDoc->getInList(this);
|
||||
else
|
||||
return std::vector<App::DocumentObject*>();
|
||||
}
|
||||
|
||||
DocumentObjectGroup* DocumentObject::getGroup() const
|
||||
{
|
||||
return dynamic_cast<DocumentObjectGroup*>(GroupExtension::getGroupOfObject(this));
|
||||
}
|
||||
|
||||
bool DocumentObject::testIfLinkDAGCompatible(DocumentObject *linkTo) const
|
||||
{
|
||||
std::vector<App::DocumentObject*> linkTo_in_vector;
|
||||
linkTo_in_vector.push_back(linkTo);
|
||||
return this->testIfLinkDAGCompatible(linkTo_in_vector);
|
||||
}
|
||||
|
||||
bool DocumentObject::testIfLinkDAGCompatible(const std::vector<DocumentObject *> &linksTo) const
|
||||
{
|
||||
Document* doc = this->getDocument();
|
||||
if (!doc)
|
||||
throw Base::Exception("DocumentObject::testIfLinkIsDAG: object is not in any document.");
|
||||
std::vector<App::DocumentObject*> deplist = doc->getDependencyList(linksTo);
|
||||
if( std::find(deplist.begin(),deplist.end(),this) != deplist.end() )
|
||||
//found this in dependency list
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DocumentObject::testIfLinkDAGCompatible(PropertyLinkSubList &linksTo) const
|
||||
{
|
||||
const std::vector<App::DocumentObject*> &linksTo_in_vector = linksTo.getValues();
|
||||
return this->testIfLinkDAGCompatible(linksTo_in_vector);
|
||||
}
|
||||
|
||||
bool DocumentObject::testIfLinkDAGCompatible(PropertyLinkSub &linkTo) const
|
||||
{
|
||||
std::vector<App::DocumentObject*> linkTo_in_vector;
|
||||
linkTo_in_vector.reserve(1);
|
||||
linkTo_in_vector.push_back(linkTo.getValue());
|
||||
return this->testIfLinkDAGCompatible(linkTo_in_vector);
|
||||
}
|
||||
|
||||
void DocumentObject::onLostLinkToObject(DocumentObject*)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
App::Document *DocumentObject::getDocument(void) const
|
||||
{
|
||||
return _pDoc;
|
||||
}
|
||||
|
||||
void DocumentObject::setDocument(App::Document* doc)
|
||||
{
|
||||
_pDoc=doc;
|
||||
onSettingDocument();
|
||||
}
|
||||
|
||||
void DocumentObject::onBeforeChange(const Property* prop)
|
||||
{
|
||||
|
||||
// Store current name in oldLabel, to be able to easily retrieve old name of document object later
|
||||
// when renaming expressions.
|
||||
if (prop == &Label)
|
||||
oldLabel = Label.getStrValue();
|
||||
|
||||
if (_pDoc)
|
||||
onBeforeChangeProperty(_pDoc, prop);
|
||||
}
|
||||
|
||||
/// get called by the container when a Property was changed
|
||||
void DocumentObject::onChanged(const Property* prop)
|
||||
{
|
||||
if (_pDoc)
|
||||
_pDoc->onChangedProperty(this,prop);
|
||||
|
||||
if (prop == &Label && _pDoc && oldLabel != Label.getStrValue())
|
||||
_pDoc->signalRelabelObject(*this);
|
||||
|
||||
if (prop->getType() & Prop_Output)
|
||||
return;
|
||||
// set object touched
|
||||
StatusBits.set(0);
|
||||
}
|
||||
|
||||
PyObject *DocumentObject::getPyObject(void)
|
||||
{
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
// ref counter is set to 1
|
||||
PythonObject = Py::Object(new DocumentObjectPy(this),true);
|
||||
}
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
|
||||
std::vector<PyObject *> DocumentObject::getPySubObjects(const std::vector<std::string>&) const
|
||||
{
|
||||
// default implementation returns nothing
|
||||
return std::vector<PyObject *>();
|
||||
}
|
||||
|
||||
void DocumentObject::touch(void)
|
||||
{
|
||||
StatusBits.set(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether the document object is touched or not.
|
||||
* @return true if document object is touched, false if not.
|
||||
*/
|
||||
|
||||
bool DocumentObject::isTouched() const
|
||||
{
|
||||
return ExpressionEngine.isTouched() || StatusBits.test(0);
|
||||
}
|
||||
|
||||
void DocumentObject::Save (Base::Writer &writer) const
|
||||
{
|
||||
writer.ObjectName = this->getNameInDocument();
|
||||
App::PropertyContainer::Save(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Associate the expression \expr with the object identifier \a path in this document object.
|
||||
* @param path Target object identifier for the result of the expression
|
||||
* @param expr Expression tree
|
||||
* @param comment Optional comment describing the expression
|
||||
*/
|
||||
|
||||
void DocumentObject::setExpression(const ObjectIdentifier &path, boost::shared_ptr<Expression> expr, const char * comment)
|
||||
{
|
||||
ExpressionEngine.setValue(path, expr, comment);
|
||||
connectRelabelSignals();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get expression information associated with \a path.
|
||||
* @param path Object identifier
|
||||
* @return Expression info, containing expression and optional comment.
|
||||
*/
|
||||
|
||||
const PropertyExpressionEngine::ExpressionInfo DocumentObject::getExpression(const ObjectIdentifier &path) const
|
||||
{
|
||||
boost::any value = ExpressionEngine.getPathValue(path);
|
||||
|
||||
if (value.type() == typeid(PropertyExpressionEngine::ExpressionInfo))
|
||||
return boost::any_cast<PropertyExpressionEngine::ExpressionInfo>(value);
|
||||
else
|
||||
return PropertyExpressionEngine::ExpressionInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Invoke ExpressionEngine's renameObjectIdentifier, to possibly rewrite expressions using
|
||||
* the \a paths map with current and new identifiers.
|
||||
*
|
||||
* @param paths
|
||||
*/
|
||||
|
||||
void DocumentObject::renameObjectIdentifiers(const std::map<ObjectIdentifier, ObjectIdentifier> &paths)
|
||||
{
|
||||
ExpressionEngine.renameObjectIdentifiers(paths);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper function that sets up a signal to track document object renames.
|
||||
*/
|
||||
|
||||
void DocumentObject::connectRelabelSignals()
|
||||
{
|
||||
// Only keep signal if the ExpressionEngine has at least one expression
|
||||
if (ExpressionEngine.numExpressions() > 0) {
|
||||
|
||||
// Not already connected?
|
||||
if (!onRelabledObjectConnection.connected())
|
||||
onRelabledObjectConnection = getDocument()->signalRelabelObject.connect(boost::bind(&PropertyExpressionEngine::slotObjectRenamed, &ExpressionEngine, _1));
|
||||
|
||||
// Connect to signalDeletedObject, to properly track deletion of other objects that might be referenced in an expression
|
||||
if (!onDeletedObjectConnection.connected())
|
||||
onDeletedObjectConnection = getDocument()->signalDeletedObject.connect(boost::bind(&PropertyExpressionEngine::slotObjectDeleted, &ExpressionEngine, _1));
|
||||
|
||||
try {
|
||||
// Crude method to resolve all expression dependencies
|
||||
ExpressionEngine.execute();
|
||||
}
|
||||
catch (...) {
|
||||
// Ignore any error
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Disconnect signals; nothing to track now
|
||||
onRelabledObjectConnection.disconnect();
|
||||
onRelabledDocumentConnection.disconnect();
|
||||
onDeletedObjectConnection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentObject::onSettingDocument() {
|
||||
|
||||
//call all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
ext->onExtendedSettingDocument();
|
||||
}
|
||||
|
||||
void DocumentObject::setupObject() {
|
||||
|
||||
//call all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
ext->onExtendedSetupObject();
|
||||
}
|
||||
|
||||
void DocumentObject::unsetupObject() {
|
||||
|
||||
//call all extensions
|
||||
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
|
||||
for(auto ext : vector)
|
||||
ext->onExtendedUnsetupObject();
|
||||
}
|
|
@ -1,267 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* 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 Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef APP_DOCUMENTOBJECT_H
|
||||
#define APP_DOCUMENTOBJECT_H
|
||||
|
||||
<<<<<<< 75964436541d26c663d0ad51ae81c5ab359a539c
|
||||
#include <App/TransactionalObject.h>
|
||||
=======
|
||||
#include <App/ExtensionContainer.h>
|
||||
>>>>>>> Extensions: Make Python Integration work
|
||||
#include <App/PropertyStandard.h>
|
||||
#include <App/PropertyLinks.h>
|
||||
#include <App/PropertyExpressionEngine.h>
|
||||
|
||||
#include <Base/TimeInfo.h>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
#include <bitset>
|
||||
#include <boost/signals.hpp>
|
||||
|
||||
namespace App
|
||||
{
|
||||
class Document;
|
||||
class DocumentObjectGroup;
|
||||
class DocumentObjectPy;
|
||||
class Expression;
|
||||
|
||||
enum ObjectStatus {
|
||||
Touch = 0,
|
||||
Error = 1,
|
||||
New = 2,
|
||||
Recompute = 3,
|
||||
Restore = 4,
|
||||
Delete = 5,
|
||||
Expand = 16
|
||||
};
|
||||
|
||||
/** Return object for feature execution
|
||||
*/
|
||||
class AppExport DocumentObjectExecReturn
|
||||
{
|
||||
public:
|
||||
DocumentObjectExecReturn(const std::string& sWhy, DocumentObject* WhichObject=0)
|
||||
: Why(sWhy), Which(WhichObject)
|
||||
{
|
||||
}
|
||||
DocumentObjectExecReturn(const char* sWhy, DocumentObject* WhichObject=0)
|
||||
: Which(WhichObject)
|
||||
{
|
||||
if(sWhy)
|
||||
Why = sWhy;
|
||||
}
|
||||
|
||||
std::string Why;
|
||||
DocumentObject* Which;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** Base class of all Classes handled in the Document
|
||||
*/
|
||||
class AppExport DocumentObject: public App::TransactionalObject
|
||||
{
|
||||
PROPERTY_HEADER(App::DocumentObject);
|
||||
|
||||
public:
|
||||
|
||||
PropertyString Label;
|
||||
PropertyExpressionEngine ExpressionEngine;
|
||||
|
||||
/// returns the type name of the ViewProvider
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "";
|
||||
}
|
||||
/// Constructor
|
||||
DocumentObject(void);
|
||||
virtual ~DocumentObject();
|
||||
|
||||
/// returns the name which is set in the document for this object (not the name property!)
|
||||
const char *getNameInDocument(void) const;
|
||||
virtual bool isAttachedToDocument() const;
|
||||
virtual const char* detachFromDocument();
|
||||
/// gets the document in which this Object is handled
|
||||
App::Document *getDocument(void) const;
|
||||
|
||||
/** Set the property touched -> changed, cause recomputation in Update()
|
||||
*/
|
||||
//@{
|
||||
/// set this feature touched (cause recomputation on depndend features)
|
||||
void touch(void);
|
||||
/// test if this feature is touched
|
||||
bool isTouched(void) const;
|
||||
/// reset this feature touched
|
||||
void purgeTouched(void){StatusBits.reset(0);setPropertyStatus(0,false);}
|
||||
/// set this feature to error
|
||||
bool isError(void) const {return StatusBits.test(1);}
|
||||
bool isValid(void) const {return !StatusBits.test(1);}
|
||||
/// remove the error from the object
|
||||
void purgeError(void){StatusBits.reset(1);}
|
||||
/// returns true if this objects is currently recomputing
|
||||
bool isRecomputing() const {return StatusBits.test(3);}
|
||||
/// returns true if this objects is currently restoring from file
|
||||
bool isRestoring() const {return StatusBits.test(4);}
|
||||
/// returns true if this objects is currently restoring from file
|
||||
bool isDeleting() const {return StatusBits.test(5);}
|
||||
/// recompute only this object
|
||||
virtual App::DocumentObjectExecReturn *recompute(void);
|
||||
/// return the status bits
|
||||
unsigned long getStatus() const {return StatusBits.to_ulong();}
|
||||
bool testStatus(ObjectStatus pos) const {return StatusBits.test((size_t)pos);}
|
||||
void setStatus(ObjectStatus pos, bool on) {StatusBits.set((size_t)pos, on);}
|
||||
//@}
|
||||
|
||||
/// returns a list of objects this object is pointing to by Links
|
||||
std::vector<App::DocumentObject*> getOutList(void) const;
|
||||
/// get all objects link to this object
|
||||
std::vector<App::DocumentObject*> getInList(void) const;
|
||||
/// get group if object is part of a group, otherwise 0 is returned
|
||||
DocumentObjectGroup* getGroup() const;
|
||||
|
||||
/**
|
||||
* @brief testIfLinkIsDAG tests a link that is about to be created for
|
||||
* circular references.
|
||||
* @param objToLinkIn (input). The object this object is to depend on after
|
||||
* the link is going to be created.
|
||||
* @return true if link can be created (no cycles will be made). False if
|
||||
* the link will cause a circular dependency and break recomputes. Throws an
|
||||
* error if the document already has a circular dependency.
|
||||
* That is, if the return is true, the link is allowed.
|
||||
*/
|
||||
bool testIfLinkDAGCompatible(DocumentObject* linkTo) const;
|
||||
bool testIfLinkDAGCompatible(const std::vector<DocumentObject *> &linksTo) const;
|
||||
bool testIfLinkDAGCompatible(App::PropertyLinkSubList &linksTo) const;
|
||||
bool testIfLinkDAGCompatible(App::PropertyLinkSub &linkTo) const;
|
||||
|
||||
|
||||
public:
|
||||
/** mustExecute
|
||||
* We call this method to check if the object was modified to
|
||||
* be invoked. If the object label or an argument is modified.
|
||||
* If we must recompute the object - to call the method execute().
|
||||
* 0: no recompution is needed
|
||||
* 1: recompution needed
|
||||
* -1: the document examine all links of this object and if one is touched -> recompute
|
||||
*/
|
||||
virtual short mustExecute(void) const;
|
||||
|
||||
/// get the status Message
|
||||
const char *getStatusString(void) const;
|
||||
|
||||
/** Called in case of loosing a link
|
||||
* Get called by the document when a object got deleted a link property of this
|
||||
* object ist pointing to. The standard behaviour of the DocumentObject implementation
|
||||
* is to reset the links to nothing. You may overide this method to implement
|
||||
*additional or different behavior.
|
||||
*/
|
||||
virtual void onLostLinkToObject(DocumentObject*);
|
||||
virtual PyObject *getPyObject(void);
|
||||
/// its used to get the python sub objects by name (e.g. by the selection)
|
||||
virtual std::vector<PyObject *> getPySubObjects(const std::vector<std::string>&) const;
|
||||
|
||||
friend class Document;
|
||||
friend class Transaction;
|
||||
friend class ObjectExecution;
|
||||
|
||||
static DocumentObjectExecReturn *StdReturn;
|
||||
|
||||
virtual void Save (Base::Writer &writer) const;
|
||||
|
||||
/* Expression support */
|
||||
|
||||
virtual void setExpression(const ObjectIdentifier & path, boost::shared_ptr<App::Expression> expr, const char *comment = 0);
|
||||
|
||||
virtual const PropertyExpressionEngine::ExpressionInfo getExpression(const ObjectIdentifier &path) const;
|
||||
|
||||
virtual void renameObjectIdentifiers(const std::map<App::ObjectIdentifier, App::ObjectIdentifier> & paths);
|
||||
|
||||
virtual void connectRelabelSignals();
|
||||
|
||||
const std::string & getOldLabel() const { return oldLabel; }
|
||||
|
||||
protected:
|
||||
/** get called by the document to recompute this feature
|
||||
* Normaly this method get called in the processing of
|
||||
* Document::recompute().
|
||||
* In execute() the outpupt properties get recomputed
|
||||
* with the data from linked objects and objects own
|
||||
* properties.
|
||||
*/
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
|
||||
/** Status bits of the document object
|
||||
* The first 8 bits are used for the base system the rest can be used in
|
||||
* descendent classes to to mark special stati on the objects.
|
||||
* The bits and their meaning are listed below:
|
||||
* 0 - object is marked as 'touched'
|
||||
* 1 - object is marked as 'erroneous'
|
||||
* 2 - object is marked as 'new'
|
||||
* 3 - object is marked as 'recompute', i.e. the object gets recomputed now
|
||||
* 4 - object is marked as 'restoring', i.e. the object gets loaded at the moment
|
||||
* 5 - object is marked as 'deleting', i.e. the object gets deleted at the moment
|
||||
* 6 - reserved
|
||||
* 7 - reserved
|
||||
* 16 - object is marked as 'expanded' in the tree view
|
||||
*/
|
||||
std::bitset<32> StatusBits;
|
||||
|
||||
void setError(void){StatusBits.set(1);}
|
||||
void resetError(void){StatusBits.reset(1);}
|
||||
void setDocument(App::Document* doc);
|
||||
|
||||
/// get called before the value is changed
|
||||
virtual void onBeforeChange(const Property* prop);
|
||||
/// get called by the container when a property was changed
|
||||
virtual void onChanged(const Property* prop);
|
||||
/// get called after a document has been fully restored
|
||||
virtual void onDocumentRestored() {}
|
||||
/// get called after setting the document
|
||||
virtual void onSettingDocument();
|
||||
/// get called after a brand new object was created
|
||||
virtual void setupObject();
|
||||
/// get called when object is going to be removed from the document
|
||||
virtual void unsetupObject();
|
||||
|
||||
/// python object of this class and all descendend
|
||||
protected: // attributes
|
||||
Py::Object PythonObject;
|
||||
/// pointer to the document this object belongs to
|
||||
App::Document* _pDoc;
|
||||
|
||||
// Connections to track relabeling of document and document objects
|
||||
boost::BOOST_SIGNALS_NAMESPACE::scoped_connection onRelabledDocumentConnection;
|
||||
boost::BOOST_SIGNALS_NAMESPACE::scoped_connection onRelabledObjectConnection;
|
||||
boost::BOOST_SIGNALS_NAMESPACE::scoped_connection onDeletedObjectConnection;
|
||||
|
||||
/// Old label; used for renaming expressions
|
||||
std::string oldLabel;
|
||||
|
||||
// pointer to the document name string (for performance)
|
||||
const std::string *pcNameInDocument;
|
||||
};
|
||||
|
||||
} //namespace App
|
||||
|
||||
|
||||
#endif // APP_DOCUMENTOBJECT_H
|
|
@ -1,376 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2015 Stefan Tröger <stefantroeger@gmx.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* 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 Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include "PropertyPostDataObject.h"
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Writer.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <vtkPolyData.h>
|
||||
#include <vtkStructuredGrid.h>
|
||||
#include <vtkRectilinearGrid.h>
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
#include <vtkUniformGrid.h>
|
||||
#include <vtkCompositeDataSet.h>
|
||||
#include <vtkMultiBlockDataSet.h>
|
||||
#include <vtkMultiPieceDataSet.h>
|
||||
#include <vtkXMLDataSetWriter.h>
|
||||
#include <vtkXMLPolyDataReader.h>
|
||||
#include <vtkXMLStructuredGridReader.h>
|
||||
#include <vtkXMLUnstructuredGridReader.h>
|
||||
#include <vtkXMLRectilinearGridReader.h>
|
||||
#include <vtkXMLImageDataReader.h>
|
||||
|
||||
#include <strstream>
|
||||
|
||||
#ifndef _PreComp_
|
||||
|
||||
#endif
|
||||
|
||||
using namespace Fem;
|
||||
|
||||
TYPESYSTEM_SOURCE(Fem::PropertyPostDataObject , App::Property);
|
||||
|
||||
PropertyPostDataObject::PropertyPostDataObject()
|
||||
{
|
||||
}
|
||||
|
||||
PropertyPostDataObject::~PropertyPostDataObject()
|
||||
{
|
||||
}
|
||||
|
||||
void PropertyPostDataObject::setValue(const vtkSmartPointer<vtkDataObject>& ds)
|
||||
{
|
||||
aboutToSetValue();
|
||||
|
||||
if(ds) {
|
||||
createDataObjectByExternalType(ds);
|
||||
m_dataObject->DeepCopy(ds);
|
||||
}
|
||||
else
|
||||
m_dataObject = NULL;
|
||||
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
const vtkSmartPointer<vtkDataObject>& PropertyPostDataObject::getValue(void)const
|
||||
{
|
||||
return m_dataObject;
|
||||
}
|
||||
|
||||
bool PropertyPostDataObject::isComposite() {
|
||||
|
||||
return m_dataObject && !m_dataObject->IsA("vtkDataSet");
|
||||
}
|
||||
|
||||
bool PropertyPostDataObject::isDataSet() {
|
||||
|
||||
return m_dataObject && m_dataObject->IsA("vtkDataSet");
|
||||
}
|
||||
|
||||
int PropertyPostDataObject::getDataType() {
|
||||
|
||||
if(!m_dataObject)
|
||||
return -1;
|
||||
|
||||
return m_dataObject->GetDataObjectType();
|
||||
}
|
||||
|
||||
|
||||
|
||||
PyObject *PropertyPostDataObject::getPyObject(void)
|
||||
{
|
||||
//TODO: fetch the vtk python object from the data set and return it
|
||||
return new PyObject();
|
||||
}
|
||||
|
||||
void PropertyPostDataObject::setPyObject(PyObject *value)
|
||||
{
|
||||
}
|
||||
|
||||
App::Property *PropertyPostDataObject::Copy(void) const
|
||||
{
|
||||
PropertyPostDataObject *prop = new PropertyPostDataObject();
|
||||
if (m_dataObject) {
|
||||
|
||||
prop->createDataObjectByExternalType(m_dataObject);
|
||||
prop->m_dataObject->DeepCopy(m_dataObject);
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
void PropertyPostDataObject::createDataObjectByExternalType(vtkSmartPointer< vtkDataObject > ex) {
|
||||
|
||||
switch( ex->GetDataObjectType() ) {
|
||||
|
||||
case VTK_POLY_DATA:
|
||||
m_dataObject = vtkSmartPointer<vtkPolyData>::New();
|
||||
break;
|
||||
case VTK_STRUCTURED_GRID:
|
||||
m_dataObject = vtkSmartPointer<vtkStructuredGrid>::New();
|
||||
break;
|
||||
case VTK_RECTILINEAR_GRID:
|
||||
m_dataObject = vtkSmartPointer<vtkRectilinearGrid>::New();
|
||||
break;
|
||||
case VTK_UNSTRUCTURED_GRID:
|
||||
m_dataObject = vtkSmartPointer<vtkUnstructuredGrid>::New();
|
||||
break;
|
||||
case VTK_UNIFORM_GRID:
|
||||
m_dataObject = vtkSmartPointer<vtkUniformGrid>::New();
|
||||
break;
|
||||
case VTK_COMPOSITE_DATA_SET:
|
||||
m_dataObject = vtkCompositeDataSet::New();
|
||||
break;
|
||||
case VTK_MULTIBLOCK_DATA_SET:
|
||||
m_dataObject = vtkSmartPointer<vtkMultiBlockDataSet>::New();
|
||||
break;
|
||||
case VTK_MULTIPIECE_DATA_SET:
|
||||
m_dataObject = vtkSmartPointer<vtkMultiPieceDataSet>::New();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void PropertyPostDataObject::Paste(const App::Property &from)
|
||||
{
|
||||
aboutToSetValue();
|
||||
m_dataObject = dynamic_cast<const PropertyPostDataObject&>(from).m_dataObject;
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
unsigned int PropertyPostDataObject::getMemSize (void) const
|
||||
{
|
||||
return m_dataObject->GetActualMemorySize();
|
||||
}
|
||||
|
||||
void PropertyPostDataObject::getPaths(std::vector<App::ObjectIdentifier> &paths) const
|
||||
{
|
||||
// paths.push_back(App::ObjectIdentifier(getContainer()) << App::ObjectIdentifier::Component::SimpleComponent(getName())
|
||||
// << App::ObjectIdentifier::Component::SimpleComponent(App::ObjectIdentifier::String("ShapeType")));
|
||||
// paths.push_back(App::ObjectIdentifier(getContainer()) << App::ObjectIdentifier::Component::SimpleComponent(getName())
|
||||
// << App::ObjectIdentifier::Component::SimpleComponent(App::ObjectIdentifier::String("Orientation")));
|
||||
// paths.push_back(App::ObjectIdentifier(getContainer()) << App::ObjectIdentifier::Component::SimpleComponent(getName())
|
||||
// << App::ObjectIdentifier::Component::SimpleComponent(App::ObjectIdentifier::String("Length")));
|
||||
// paths.push_back(App::ObjectIdentifier(getContainer()) << App::ObjectIdentifier::Component::SimpleComponent(getName())
|
||||
// << App::ObjectIdentifier::Component::SimpleComponent(App::ObjectIdentifier::String("Area")));
|
||||
// paths.push_back(App::ObjectIdentifier(getContainer()) << App::ObjectIdentifier::Component::SimpleComponent(getName())
|
||||
// << App::ObjectIdentifier::Component::SimpleComponent(App::ObjectIdentifier::String("Volume")));
|
||||
}
|
||||
|
||||
void PropertyPostDataObject::Save (Base::Writer &writer) const
|
||||
{
|
||||
std::string extension;
|
||||
if(!m_dataObject)
|
||||
return;
|
||||
|
||||
switch( m_dataObject->GetDataObjectType() ) {
|
||||
|
||||
case VTK_POLY_DATA:
|
||||
extension = "vtp";
|
||||
break;
|
||||
case VTK_STRUCTURED_GRID:
|
||||
extension = "vts";
|
||||
break;
|
||||
case VTK_RECTILINEAR_GRID:
|
||||
extension = "vtr";
|
||||
break;
|
||||
case VTK_UNSTRUCTURED_GRID:
|
||||
extension = "vtu";
|
||||
break;
|
||||
case VTK_UNIFORM_GRID:
|
||||
extension = "vti"; //image data
|
||||
break;
|
||||
//TODO:multi-datasets use multiple files, this needs to be implemented specially
|
||||
// case VTK_COMPOSITE_DATA_SET:
|
||||
// prop->m_dataObject = vtkCompositeDataSet::New();
|
||||
// break;
|
||||
// case VTK_MULTIBLOCK_DATA_SET:
|
||||
// prop->m_dataObject = vtkMultiBlockDataSet::New();
|
||||
// break;
|
||||
// case VTK_MULTIPIECE_DATA_SET:
|
||||
// prop->m_dataObject = vtkMultiPieceDataSet::New();
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
if(!writer.isForceXML()) {
|
||||
std::string file = "Data." + extension;
|
||||
writer.Stream() << writer.ind() << "<Data file=\""
|
||||
<< writer.addFile(file.c_str(), this)
|
||||
<< "\"/>" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyPostDataObject::Restore(Base::XMLReader &reader)
|
||||
{
|
||||
reader.readElement("Data");
|
||||
if(!reader.hasAttribute("file"))
|
||||
return;
|
||||
|
||||
std::string file (reader.getAttribute("file") );
|
||||
|
||||
if (!file.empty()) {
|
||||
// initate a file read
|
||||
reader.addFile(file.c_str(),this);
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyPostDataObject::SaveDocFile (Base::Writer &writer) const
|
||||
{
|
||||
// If the shape is empty we simply store nothing. The file size will be 0 which
|
||||
// can be checked when reading in the data.
|
||||
if (!m_dataObject)
|
||||
return;
|
||||
|
||||
// create a temporary file and copy the content to the zip stream
|
||||
// once the tmp. filename is known use always the same because otherwise
|
||||
// we may run into some problems on the Linux platform
|
||||
static Base::FileInfo fi(App::Application::getTempFileName());
|
||||
|
||||
vtkSmartPointer<vtkXMLDataSetWriter> xmlWriter = vtkSmartPointer<vtkXMLDataSetWriter>::New();
|
||||
xmlWriter->SetInputDataObject(m_dataObject);
|
||||
xmlWriter->SetFileName(fi.filePath().c_str());
|
||||
xmlWriter->SetDataModeToBinary();
|
||||
|
||||
if ( xmlWriter->Write() != 1 ) {
|
||||
// Note: Do NOT throw an exception here because if the tmp. file could
|
||||
// not be created we should not abort.
|
||||
// We only print an error message but continue writing the next files to the
|
||||
// stream...
|
||||
App::PropertyContainer* father = this->getContainer();
|
||||
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
<<<<<<< 51e23d854e59ab0a23a9ea9b19e74e5f02753d82
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("Dataset of '%s' cannot be written to vtk file '%s'\n",
|
||||
=======
|
||||
App::DocumentObject* obj = dynamic_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("Dataset of '%s' cannot be written to vtk file '%s'\n",
|
||||
>>>>>>> Introduce extensions and port App groups
|
||||
obj->Label.getValue(),fi.filePath().c_str());
|
||||
}
|
||||
else {
|
||||
Base::Console().Error("Cannot save vtk file '%s'\n", fi.filePath().c_str());
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "Cannot save vtk file '" << fi.filePath() << "'";
|
||||
writer.addError(ss.str());
|
||||
}
|
||||
|
||||
Base::ifstream file(fi, std::ios::in | std::ios::binary);
|
||||
if (file){
|
||||
unsigned long ulSize = 0;
|
||||
std::streambuf* buf = file.rdbuf();
|
||||
if (buf) {
|
||||
unsigned long ulCurr;
|
||||
ulCurr = buf->pubseekoff(0, std::ios::cur, std::ios::in);
|
||||
ulSize = buf->pubseekoff(0, std::ios::end, std::ios::in);
|
||||
buf->pubseekoff(ulCurr, std::ios::beg, std::ios::in);
|
||||
}
|
||||
|
||||
// read in the ASCII file and write back to the stream
|
||||
std::strstreambuf sbuf(ulSize);
|
||||
file >> &sbuf;
|
||||
writer.Stream() << &sbuf;
|
||||
}
|
||||
|
||||
file.close();
|
||||
// remove temp file
|
||||
fi.deleteFile();
|
||||
}
|
||||
|
||||
void PropertyPostDataObject::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
Base::FileInfo xml(reader.getFileName());
|
||||
// create a temporary file and copy the content from the zip stream
|
||||
Base::FileInfo fi(App::Application::getTempFileName());
|
||||
|
||||
// read in the ASCII file and write back to the file stream
|
||||
Base::ofstream file(fi, std::ios::out | std::ios::binary);
|
||||
unsigned long ulSize = 0;
|
||||
if (reader) {
|
||||
std::streambuf* buf = file.rdbuf();
|
||||
reader >> buf;
|
||||
file.flush();
|
||||
ulSize = buf->pubseekoff(0, std::ios::cur, std::ios::in);
|
||||
}
|
||||
file.close();
|
||||
|
||||
// Read the data from the temp file
|
||||
if (ulSize > 0) {
|
||||
std::string extension = xml.extension();
|
||||
|
||||
//TODO: read in of composite data structures need to be coded, including replace of "GetOutputAsDataSet()"
|
||||
vtkSmartPointer<vtkXMLReader> xmlReader;
|
||||
if(extension == "vtp")
|
||||
xmlReader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
|
||||
else if (extension == "vts")
|
||||
xmlReader = vtkSmartPointer<vtkXMLStructuredGridReader>::New();
|
||||
else if (extension == "vtr")
|
||||
xmlReader = vtkSmartPointer<vtkXMLRectilinearGridReader>::New();
|
||||
else if (extension == "vtu")
|
||||
xmlReader = vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
|
||||
else if (extension == "vti")
|
||||
xmlReader = vtkSmartPointer<vtkXMLImageDataReader>::New();
|
||||
|
||||
xmlReader->SetFileName(fi.filePath().c_str());
|
||||
xmlReader->Update();
|
||||
|
||||
if (!xmlReader->GetOutputAsDataSet()) {
|
||||
// Note: Do NOT throw an exception here because if the tmp. created file could
|
||||
// not be read it's NOT an indication for an invalid input stream 'reader'.
|
||||
// We only print an error message but continue reading the next files from the
|
||||
// stream...
|
||||
App::PropertyContainer* father = this->getContainer();
|
||||
if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
<<<<<<< 51e23d854e59ab0a23a9ea9b19e74e5f02753d82
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("Dataset file '%s' with data of '%s' seems to be empty\n",
|
||||
=======
|
||||
App::DocumentObject* obj = dynamic_cast<App::DocumentObject*>(father);
|
||||
Base::Console().Error("Dataset file '%s' with data of '%s' seems to be empty\n",
|
||||
>>>>>>> Introduce extensions and port App groups
|
||||
fi.filePath().c_str(),obj->Label.getValue());
|
||||
}
|
||||
else {
|
||||
Base::Console().Warning("Loaded Dataset file '%s' seems to be empty\n", fi.filePath().c_str());
|
||||
}
|
||||
}
|
||||
else {
|
||||
aboutToSetValue();
|
||||
createDataObjectByExternalType(xmlReader->GetOutputAsDataSet());
|
||||
m_dataObject->DeepCopy(xmlReader->GetOutputAsDataSet());
|
||||
hasSetValue();
|
||||
}
|
||||
}
|
||||
|
||||
// delete the temp file
|
||||
fi.deleteFile();
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
<<<<<<< ba52dbfac69983692e8edbeca2eff74154a312b6
|
||||
# FreeCAD init script of the Fem module
|
||||
# (c) 2001 Juergen Riegel
|
||||
|
||||
#***************************************************************************
|
||||
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
|
||||
#* *
|
||||
#* This file is part of the FreeCAD CAx development system. *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* the License, or (at your option) any later version. *
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* FreeCAD 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 Library General Public *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#* Juergen Riegel 2002 *
|
||||
#***************************************************************************/
|
||||
|
||||
|
||||
import FreeCAD
|
||||
|
||||
|
||||
FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
|
||||
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
|
||||
FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
|
||||
FreeCAD.addImportType("CalculiX result (*.frd)", "ccxFrdReader")
|
||||
FreeCAD.addImportType("Abaqus file (*.inp)", "FemGui")
|
||||
FreeCAD.addImportType("Z88 mesh file (*.txt)", "importZ88Mesh")
|
||||
FreeCAD.addExportType("Z88 mesh file (*.txt)", "importZ88Mesh")
|
||||
FreeCAD.addImportType("Z88 displacement result file (*.txt)", "z88DispReader")
|
||||
=======
|
||||
# FreeCAD init script of the Fem module
|
||||
# (c) 2001 Juergen Riegel
|
||||
|
||||
#***************************************************************************
|
||||
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
|
||||
#* *
|
||||
#* This file is part of the FreeCAD CAx development system. *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* the License, or (at your option) any later version. *
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* FreeCAD 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 Library General Public *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#* Juergen Riegel 2002 *
|
||||
#***************************************************************************/
|
||||
|
||||
|
||||
import FreeCAD
|
||||
|
||||
|
||||
FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
|
||||
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
|
||||
FreeCAD.addImportType("FEM results (*.vtk)","Fem")
|
||||
FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
|
||||
FreeCAD.addImportType("CalculiX result (*.frd)", "ccxFrdReader")
|
||||
FreeCAD.addImportType("Abaqus file (*.inp)", "FemGui")
|
||||
>>>>>>> Move post processing to fem objects
|
|
@ -1,208 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Copyright (c)2012 Jan Rheinlaender <jrheinlaender@users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* 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 Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <BRep_Builder.hxx>
|
||||
# include <BRepBndLib.hxx>
|
||||
# include <BRepPrimAPI_MakeRevol.hxx>
|
||||
# include <BRepBuilderAPI_MakeFace.hxx>
|
||||
# include <TopoDS.hxx>
|
||||
# include <TopoDS_Face.hxx>
|
||||
# include <TopoDS_Wire.hxx>
|
||||
# include <TopExp_Explorer.hxx>
|
||||
# include <BRepAlgoAPI_Cut.hxx>
|
||||
# include <Precision.hxx>
|
||||
# include <gp_Lin.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Axis.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Placement.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "FeatureGroove.h"
|
||||
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
namespace PartDesign {
|
||||
|
||||
|
||||
PROPERTY_SOURCE(PartDesign::Groove, PartDesign::ProfileBased)
|
||||
|
||||
Groove::Groove()
|
||||
{
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
|
||||
ADD_PROPERTY_TYPE(Base,(Base::Vector3d(0.0f,0.0f,0.0f)),"Groove", App::Prop_ReadOnly, "Base");
|
||||
ADD_PROPERTY_TYPE(Axis,(Base::Vector3d(0.0f,1.0f,0.0f)),"Groove", App::Prop_ReadOnly, "Axis");
|
||||
ADD_PROPERTY_TYPE(Angle,(360.0),"Groove", App::Prop_None, "Angle");
|
||||
ADD_PROPERTY_TYPE(ReferenceAxis,(0),"Groove",(App::PropertyType)(App::Prop_None),"Reference axis of Groove");
|
||||
}
|
||||
|
||||
short Groove::mustExecute() const
|
||||
{
|
||||
if (Placement.isTouched() ||
|
||||
ReferenceAxis.isTouched() ||
|
||||
Axis.isTouched() ||
|
||||
Base.isTouched() ||
|
||||
Angle.isTouched())
|
||||
return 1;
|
||||
return ProfileBased::mustExecute();
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *Groove::execute(void)
|
||||
{
|
||||
// Validate parameters
|
||||
double angle = Angle.getValue();
|
||||
if (angle < Precision::Confusion())
|
||||
return new App::DocumentObjectExecReturn("Angle of groove too small");
|
||||
if (angle > 360.0)
|
||||
return new App::DocumentObjectExecReturn("Angle of groove too large");
|
||||
|
||||
angle = Base::toRadians<double>(angle);
|
||||
// Reverse angle if selected
|
||||
if (Reversed.getValue() && !Midplane.getValue())
|
||||
angle *= (-1.0);
|
||||
|
||||
TopoDS_Shape sketchshape;
|
||||
try {
|
||||
sketchshape = getVerifiedFace();
|
||||
} catch (const Base::Exception& e) {
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
}
|
||||
|
||||
// if the Base property has a valid shape, fuse the prism into it
|
||||
TopoDS_Shape base;
|
||||
try {
|
||||
base = getBaseShape();
|
||||
} catch (const Base::Exception&) {
|
||||
return new App::DocumentObjectExecReturn("No sketch support and no base shape: Please tell me where to remove the material of the groove!");
|
||||
}
|
||||
|
||||
updateAxis();
|
||||
|
||||
// get revolve axis
|
||||
Base::Vector3d b = Base.getValue();
|
||||
gp_Pnt pnt(b.x,b.y,b.z);
|
||||
Base::Vector3d v = Axis.getValue();
|
||||
gp_Dir dir(v.x,v.y,v.z);
|
||||
|
||||
try {
|
||||
if (sketchshape.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Creating a face from sketch failed");
|
||||
|
||||
// Rotate the face by half the angle to get Groove symmetric to sketch plane
|
||||
if (Midplane.getValue()) {
|
||||
gp_Trsf mov;
|
||||
mov.SetRotation(gp_Ax1(pnt, dir), Base::toRadians<double>(Angle.getValue()) * (-1.0) / 2.0);
|
||||
TopLoc_Location loc(mov);
|
||||
sketchshape.Move(loc);
|
||||
}
|
||||
|
||||
this->positionByPrevious();
|
||||
TopLoc_Location invObjLoc = this->getLocation().Inverted();
|
||||
pnt.Transform(invObjLoc.Transformation());
|
||||
dir.Transform(invObjLoc.Transformation());
|
||||
base.Move(invObjLoc);
|
||||
sketchshape.Move(invObjLoc);
|
||||
|
||||
// Check distance between sketchshape and axis - to avoid failures and crashes
|
||||
TopExp_Explorer xp;
|
||||
xp.Init(sketchshape, TopAbs_FACE);
|
||||
for (;xp.More(); xp.Next()) {
|
||||
<<<<<<< 94c547439cc0d5e6dca5e724c97f861f5b1f530e
|
||||
|
||||
if (checkLineCrossesFace(gp_Lin(pnt, dir), TopoDS::Face(xp.Current())))
|
||||
return new App::DocumentObjectExecReturn("Revolve axis intersects the sketch");
|
||||
}
|
||||
|
||||
=======
|
||||
if (checkLineCrossesFace(gp_Lin(pnt, dir), TopoDS::Face(xp.Current())))
|
||||
return new App::DocumentObjectExecReturn("Revolve axis intersects the sketch");
|
||||
}
|
||||
|
||||
>>>>>>> Travis: Add SMESH7 dependencies for OSX
|
||||
// revolve the face to a solid
|
||||
BRepPrimAPI_MakeRevol RevolMaker(sketchshape, gp_Ax1(pnt, dir), angle);
|
||||
|
||||
if (RevolMaker.IsDone()) {
|
||||
TopoDS_Shape result = RevolMaker.Shape();
|
||||
// set the subtractive shape property for later usage in e.g. pattern
|
||||
result = refineShapeIfActive(result);
|
||||
this->AddSubShape.setValue(result);
|
||||
|
||||
// cut out groove to get one result object
|
||||
BRepAlgoAPI_Cut mkCut(base, result);
|
||||
// Let's check if the fusion has been successful
|
||||
if (!mkCut.IsDone())
|
||||
throw Base::Exception("Cut out of base feature failed");
|
||||
|
||||
// we have to get the solids (fuse sometimes creates compounds)
|
||||
TopoDS_Shape solRes = this->getSolid(mkCut.Shape());
|
||||
if (solRes.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Resulting shape is not a solid");
|
||||
|
||||
solRes = refineShapeIfActive(solRes);
|
||||
this->Shape.setValue(getSolid(solRes));
|
||||
}
|
||||
else
|
||||
return new App::DocumentObjectExecReturn("Could not revolve the sketch!");
|
||||
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
if (std::string(e->GetMessageString()) == "TopoDS::Face")
|
||||
return new App::DocumentObjectExecReturn("Could not create face from sketch.\n"
|
||||
"Intersecting sketch entities in a sketch are not allowed.");
|
||||
else
|
||||
return new App::DocumentObjectExecReturn(e->GetMessageString());
|
||||
}
|
||||
catch (Base::Exception& e) {
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
}
|
||||
}
|
||||
|
||||
bool Groove::suggestReversed(void)
|
||||
{
|
||||
updateAxis();
|
||||
return ProfileBased::getReversedAngle(Base.getValue(), Axis.getValue()) > 0.0;
|
||||
}
|
||||
|
||||
void Groove::updateAxis(void)
|
||||
{
|
||||
App::DocumentObject *pcReferenceAxis = ReferenceAxis.getValue();
|
||||
const std::vector<std::string> &subReferenceAxis = ReferenceAxis.getSubValues();
|
||||
Base::Vector3d base;
|
||||
Base::Vector3d dir;
|
||||
getAxis(pcReferenceAxis, subReferenceAxis, base, dir);
|
||||
|
||||
if (dir.Length() > Precision::Confusion()) {
|
||||
Base.setValue(base.x,base.y,base.z);
|
||||
Axis.setValue(dir.x,dir.y,dir.z);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,202 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2010 Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* 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 Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <BRep_Builder.hxx>
|
||||
# include <BRepBndLib.hxx>
|
||||
# include <BRepPrimAPI_MakeRevol.hxx>
|
||||
# include <BRepBuilderAPI_MakeFace.hxx>
|
||||
# include <TopoDS.hxx>
|
||||
# include <TopoDS_Face.hxx>
|
||||
# include <TopoDS_Wire.hxx>
|
||||
# include <TopExp_Explorer.hxx>
|
||||
# include <BRepAlgoAPI_Fuse.hxx>
|
||||
# include <Precision.hxx>
|
||||
# include <gp_Lin.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Axis.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Placement.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "FeatureRevolution.h"
|
||||
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
namespace PartDesign {
|
||||
|
||||
|
||||
PROPERTY_SOURCE(PartDesign::Revolution, PartDesign::ProfileBased)
|
||||
|
||||
Revolution::Revolution()
|
||||
{
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
|
||||
ADD_PROPERTY_TYPE(Base,(Base::Vector3d(0.0,0.0,0.0)),"Revolution", App::Prop_ReadOnly, "Base");
|
||||
ADD_PROPERTY_TYPE(Axis,(Base::Vector3d(0.0,1.0,0.0)),"Revolution", App::Prop_ReadOnly, "Axis");
|
||||
ADD_PROPERTY_TYPE(Angle,(360.0),"Revolution", App::Prop_None, "Angle");
|
||||
ADD_PROPERTY_TYPE(ReferenceAxis,(0),"Revolution",(App::Prop_None),"Reference axis of revolution");
|
||||
}
|
||||
|
||||
short Revolution::mustExecute() const
|
||||
{
|
||||
if (Placement.isTouched() ||
|
||||
ReferenceAxis.isTouched() ||
|
||||
Axis.isTouched() ||
|
||||
Base.isTouched() ||
|
||||
Angle.isTouched())
|
||||
return 1;
|
||||
return ProfileBased::mustExecute();
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *Revolution::execute(void)
|
||||
{
|
||||
// Validate parameters
|
||||
double angle = Angle.getValue();
|
||||
if (angle < Precision::Confusion())
|
||||
return new App::DocumentObjectExecReturn("Angle of revolution too small");
|
||||
if (angle > 360.0)
|
||||
return new App::DocumentObjectExecReturn("Angle of revolution too large");
|
||||
|
||||
angle = Base::toRadians<double>(angle);
|
||||
// Reverse angle if selected
|
||||
if (Reversed.getValue() && !Midplane.getValue())
|
||||
angle *= (-1.0);
|
||||
|
||||
TopoDS_Shape sketchshape;
|
||||
try {
|
||||
sketchshape = getVerifiedFace();
|
||||
} catch (const Base::Exception& e) {
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
}
|
||||
|
||||
// if the Base property has a valid shape, fuse the AddShape into it
|
||||
TopoDS_Shape base;
|
||||
try {
|
||||
base = getBaseShape();
|
||||
} catch (const Base::Exception&) {
|
||||
// fall back to support (for legacy features)
|
||||
base = TopoDS_Shape();
|
||||
}
|
||||
|
||||
// update Axis from ReferenceAxis
|
||||
updateAxis();
|
||||
|
||||
// get revolve axis
|
||||
Base::Vector3d b = Base.getValue();
|
||||
gp_Pnt pnt(b.x,b.y,b.z);
|
||||
Base::Vector3d v = Axis.getValue();
|
||||
gp_Dir dir(v.x,v.y,v.z);
|
||||
|
||||
try {
|
||||
if (sketchshape.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Creating a face from sketch failed");
|
||||
|
||||
// Rotate the face by half the angle to get Revolution symmetric to sketch plane
|
||||
if (Midplane.getValue()) {
|
||||
gp_Trsf mov;
|
||||
mov.SetRotation(gp_Ax1(pnt, dir), Base::toRadians<double>(Angle.getValue()) * (-1.0) / 2.0);
|
||||
TopLoc_Location loc(mov);
|
||||
sketchshape.Move(loc);
|
||||
}
|
||||
|
||||
this->positionByPrevious();
|
||||
TopLoc_Location invObjLoc = this->getLocation().Inverted();
|
||||
pnt.Transform(invObjLoc.Transformation());
|
||||
dir.Transform(invObjLoc.Transformation());
|
||||
base.Move(invObjLoc);
|
||||
sketchshape.Move(invObjLoc);
|
||||
|
||||
// Check distance between sketchshape and axis - to avoid failures and crashes
|
||||
TopExp_Explorer xp;
|
||||
xp.Init(sketchshape, TopAbs_FACE);
|
||||
for (;xp.More(); xp.Next()) {
|
||||
if (checkLineCrossesFace(gp_Lin(pnt, dir), TopoDS::Face(xp.Current())))
|
||||
<<<<<<< 94c547439cc0d5e6dca5e724c97f861f5b1f530e
|
||||
return new App::DocumentObjectExecReturn("Revolve axis intersects the sketch");
|
||||
=======
|
||||
return new App::DocumentObjectExecReturn("Revolve axis intersects the sketch");
|
||||
>>>>>>> Travis: Add SMESH7 dependencies for OSX
|
||||
}
|
||||
|
||||
// revolve the face to a solid
|
||||
BRepPrimAPI_MakeRevol RevolMaker(sketchshape, gp_Ax1(pnt, dir), angle);
|
||||
|
||||
if (RevolMaker.IsDone()) {
|
||||
TopoDS_Shape result = RevolMaker.Shape();
|
||||
result = refineShapeIfActive(result);
|
||||
// set the additive shape property for later usage in e.g. pattern
|
||||
this->AddSubShape.setValue(result);
|
||||
|
||||
if (!base.IsNull()) {
|
||||
// Let's call algorithm computing a fuse operation:
|
||||
BRepAlgoAPI_Fuse mkFuse(base, result);
|
||||
// Let's check if the fusion has been successful
|
||||
if (!mkFuse.IsDone())
|
||||
throw Base::Exception("Fusion with base feature failed");
|
||||
result = mkFuse.Shape();
|
||||
result = refineShapeIfActive(result);
|
||||
}
|
||||
|
||||
this->Shape.setValue(getSolid(result));
|
||||
}
|
||||
else
|
||||
return new App::DocumentObjectExecReturn("Could not revolve the sketch!");
|
||||
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
if (std::string(e->GetMessageString()) == "TopoDS::Face")
|
||||
return new App::DocumentObjectExecReturn("Could not create face from sketch.\n"
|
||||
"Intersecting sketch entities in a sketch are not allowed.");
|
||||
else
|
||||
return new App::DocumentObjectExecReturn(e->GetMessageString());
|
||||
}
|
||||
catch (Base::Exception& e) {
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
}
|
||||
}
|
||||
|
||||
bool Revolution::suggestReversed(void)
|
||||
{
|
||||
updateAxis();
|
||||
return ProfileBased::getReversedAngle(Base.getValue(), Axis.getValue()) < 0.0;
|
||||
}
|
||||
|
||||
void Revolution::updateAxis(void)
|
||||
{
|
||||
App::DocumentObject *pcReferenceAxis = ReferenceAxis.getValue();
|
||||
const std::vector<std::string> &subReferenceAxis = ReferenceAxis.getSubValues();
|
||||
Base::Vector3d base;
|
||||
Base::Vector3d dir;
|
||||
getAxis(pcReferenceAxis, subReferenceAxis, base, dir);
|
||||
|
||||
Base.setValue(base.x,base.y,base.z);
|
||||
Axis.setValue(dir.x,dir.y,dir.z);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user