commit
79f04fdc92
4466 changed files with 1252254 additions and 0 deletions
@ -0,0 +1,62 @@ |
||||
PROJECT(VTK_LOADED_COMMANDS) |
||||
|
||||
IF(NOT VTK_BUILD_FROM_TRY_COMPILE) |
||||
STRING(REGEX REPLACE "[\\/][cC][mM][Aa][Kk][Ee]$" "" REAL_SOURCE "${VTK_LOADED_COMMANDS_SOURCE_DIR}") |
||||
MESSAGE(SEND_ERROR "\nThis directory:\n${VTK_LOADED_COMMANDS_SOURCE_DIR}\nshould not be used as a source directory for building VTK. \nYou should exit cmake and remove the file:\n${VTK_LOADED_COMMANDS_BINARY_DIR}/CMakeCache.txt\nThen re-run cmake with the source directory set to:\n${REAL_SOURCE}") |
||||
ENDIF(NOT VTK_BUILD_FROM_TRY_COMPILE) |
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") |
||||
INCLUDE_DIRECTORIES(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source) |
||||
ADD_LIBRARY(cmVTK_WRAP_TCL2 MODULE cmVTKWrapTcl2Command.c) |
||||
ADD_LIBRARY(cmVTK_WRAP_PYTHON2 MODULE cmVTKWrapPython2Command.c) |
||||
ADD_LIBRARY(cmVTK_WRAP_JAVA2 MODULE cmVTKWrapJava2Command.c) |
||||
ADD_LIBRARY(cmVTK_GENERATE_JAVA_DEPENDENCIES MODULE cmVTKGenerateJavaDependencies.c) |
||||
|
||||
# Make sure we build with flags matching the CMake executable. |
||||
IF(CMAKE_SYSTEM MATCHES "IRIX64") |
||||
# A table of ABI flags. |
||||
IF(CMAKE_COMPILER_IS_GNUCXX) |
||||
SET(CMAKE_ABI_32 "-mabi=32") |
||||
SET(CMAKE_ABI_n32 "-mabi=n32") |
||||
SET(CMAKE_ABI_64 "-mabi=64") |
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX) |
||||
SET(CMAKE_ABI_32 "-o32") |
||||
SET(CMAKE_ABI_n32 "-n32") |
||||
SET(CMAKE_ABI_64 "-64") |
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX) |
||||
|
||||
# Check how cmake was built. |
||||
IF(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") |
||||
EXEC_PROGRAM(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF) |
||||
SET(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL |
||||
"Output of file command on ${CMAKE_COMMAND}.") |
||||
ENDIF(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") |
||||
|
||||
# Remove any existing flag. |
||||
SET(CMAKE_ABI_VARS |
||||
CMAKE_C_FLAGS |
||||
CMAKE_CXX_FLAGS |
||||
CMAKE_EXE_LINKER_FLAGS |
||||
CMAKE_SHARED_LINKER_FLAGS |
||||
CMAKE_MODULE_LINKER_FLAGS |
||||
) |
||||
FOREACH(var ${CMAKE_ABI_VARS}) |
||||
FOREACH(regex "-([on]32|64)" "-mabi=[a-z0-9]*") |
||||
STRING(REGEX REPLACE "${regex}" "" ${var} "${${var}}") |
||||
ENDFOREACH(regex) |
||||
ENDFOREACH(var) |
||||
|
||||
# Add the proper flag. |
||||
IF(CMAKE_FILE_SELF MATCHES " 32-bit ") |
||||
SET(CMAKE_ABI_FLAG "${CMAKE_ABI_32}") |
||||
ENDIF(CMAKE_FILE_SELF MATCHES " 32-bit ") |
||||
IF(CMAKE_FILE_SELF MATCHES " N32 ") |
||||
SET(CMAKE_ABI_FLAG "${CMAKE_ABI_n32}") |
||||
ENDIF(CMAKE_FILE_SELF MATCHES " N32 ") |
||||
IF(CMAKE_FILE_SELF MATCHES " 64-bit ") |
||||
SET(CMAKE_ABI_FLAG "${CMAKE_ABI_64}") |
||||
ENDIF(CMAKE_FILE_SELF MATCHES " 64-bit ") |
||||
|
||||
FOREACH(var ${CMAKE_ABI_VARS}) |
||||
SET(${var} "${CMAKE_ABI_FLAG} ${${var}}") |
||||
ENDFOREACH(var) |
||||
ENDIF(CMAKE_SYSTEM MATCHES "IRIX64") |
@ -0,0 +1,41 @@ |
||||
SET(CTEST_CUSTOM_WARNING_MATCH |
||||
${CTEST_CUSTOM_WARNING_MATCH} |
||||
"{standard input}:[0-9][0-9]*: Warning: " |
||||
) |
||||
|
||||
# Removing this because it somehow matches normal build output lines |
||||
# on several platforms. Perhaps there is a bug in the custom match |
||||
# support. |
||||
# |
||||
# SET(CTEST_CUSTOM_ERROR_MATCH |
||||
# ${CTEST_CUSTOM_ERROR_MATCH} |
||||
# "\\", line [0-9]+, in " |
||||
# ) |
||||
|
||||
IF("@CMAKE_SYSTEM@" MATCHES "OSF") |
||||
SET(CTEST_CUSTOM_WARNING_EXCEPTION |
||||
${CTEST_CUSTOM_WARNING_EXCEPTION} |
||||
"vtkKWApplication" |
||||
"vtkKWObject" |
||||
) |
||||
ENDIF("@CMAKE_SYSTEM@" MATCHES "OSF") |
||||
|
||||
SET(CTEST_CUSTOM_WARNING_EXCEPTION |
||||
${CTEST_CUSTOM_WARNING_EXCEPTION} |
||||
"Utilities/vtktiff/" |
||||
"xtree.[0-9]+. : warning C4702: unreachable code" |
||||
"warning LNK4221" |
||||
"variable .var_args[2]*. is used before its value is set" |
||||
"jobserver unavailable" |
||||
"warning: \\(Long double usage is reported only once for each file" |
||||
"warning: To disable this warning use" |
||||
"ranlib: file: .+ has no symbols" |
||||
"could not be inlined" |
||||
"ld: warning prebinding disabled because \\((__TEXT|__DATA|__LINKEDIT) segment \\(address = 0x[a-f0-9]+ size = 0x[a-f0-9]+\\) of (.*) overlaps with (__LINKEDIT|__TEXT|__DATA) segment \\(address = 0x[a-f0-9]+ size = 0x[a-f0-9]+\\) of (.*)" |
||||
"ld: warning prebinding disabled because dependent library: (.*).dylib is not prebound" |
||||
) |
||||
|
||||
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE |
||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE} |
||||
"vtk.*TCLInit.cxx" |
||||
"vtk[^\\.]+Tcl.cxx") |
@ -0,0 +1,27 @@ |
||||
# |
||||
# Find the native EXPAT includes and library |
||||
# |
||||
# This module defines |
||||
# EXPAT_INCLUDE_DIR, where to find expat.h, etc. |
||||
# EXPAT_LIBRARIES, the libraries to link against to use EXPAT. |
||||
# EXPAT_FOUND, If false, do not try to use EXPAT. |
||||
|
||||
# also defined, but not for general use are |
||||
# EXPAT_LIBRARY, where to find the EXPAT library. |
||||
|
||||
FIND_PATH(EXPAT_INCLUDE_DIR expat.h |
||||
/usr/local/include |
||||
/usr/include |
||||
) |
||||
|
||||
FIND_LIBRARY(EXPAT_LIBRARY expat |
||||
/usr/lib |
||||
/usr/local/lib |
||||
) |
||||
|
||||
IF(EXPAT_INCLUDE_DIR) |
||||
IF(EXPAT_LIBRARY) |
||||
SET( EXPAT_FOUND "YES" ) |
||||
SET( EXPAT_LIBRARIES ${EXPAT_LIBRARY} ) |
||||
ENDIF(EXPAT_LIBRARY) |
||||
ENDIF(EXPAT_INCLUDE_DIR) |
@ -0,0 +1,37 @@ |
||||
# |
||||
# Find the native FREETYPE includes and library |
||||
# |
||||
|
||||
# This module defines |
||||
# FREETYPE_INCLUDE_DIR, where to find ft2build.h, ftheader.h, ... |
||||
# FREETYPE_LIBRARIES, the libraries to link against to use FREETYPE. |
||||
# FREETYPE_FOUND, If false, do not try to use FREETYPE. |
||||
|
||||
# also defined, but not for general use are |
||||
# FREETYPE_LIBRARY, where to find the FREETYPE library. |
||||
|
||||
FIND_PATH(FREETYPE_INCLUDE_DIR_FT2BUILD ft2build.h |
||||
/usr/include/ |
||||
/usr/local/include/ |
||||
) |
||||
|
||||
FIND_PATH(FREETYPE_INCLUDE_DIR_FTHEADER freetype/config/ftheader.h |
||||
/usr/include/freetype2 |
||||
/usr/local/include/freetype2 |
||||
) |
||||
|
||||
FIND_LIBRARY(FREETYPE_LIBRARY freetype |
||||
/usr/lib |
||||
/usr/local/lib |
||||
) |
||||
|
||||
IF (FREETYPE_LIBRARY) |
||||
IF (FREETYPE_INCLUDE_DIR_FTHEADER AND FREETYPE_INCLUDE_DIR_FT2BUILD) |
||||
SET( FREETYPE_FOUND "YES" ) |
||||
SET( FREETYPE_INCLUDE_DIR |
||||
${FREETYPE_INCLUDE_DIR_FT2BUILD} |
||||
${FREETYPE_INCLUDE_DIR_FTHEADER} ) |
||||
SET( FREETYPE_LIBRARIES ${FREETYPE_LIBRARY} ) |
||||
ENDIF (FREETYPE_INCLUDE_DIR_FTHEADER AND FREETYPE_INCLUDE_DIR_FT2BUILD) |
||||
ENDIF (FREETYPE_LIBRARY) |
||||
|
@ -0,0 +1,38 @@ |
||||
# |
||||
# Find the MPEG2 includes and library |
||||
# |
||||
# This module (forces the user to) provide: |
||||
# vtkMPEG2Encode_INCLUDE_PATH, for use with INCLUDE_DIRECTORIES commands |
||||
# vtkMPEG2Encode_LIBRARIES, for use with TARGET_LINK_LIBRARIES commands |
||||
# |
||||
# If VTK_USE_MPEG2_ENCODER is ON, it is an error to end up with empty values |
||||
# for vtkMPEG2Encode_INCLUDE_PATH or vtkMPEG2Encode_LIBRARIES. |
||||
# The only way to fix this error, if it occurs, is to provide non-empty |
||||
# values or to turn OFF VTK_USE_MPEG2_ENCODER. |
||||
# |
||||
# Cache NOTFOUND initial values. The user will have to provide them unless |
||||
# they were provided in the initial cache. |
||||
|
||||
|
||||
# vtkMPEG2Encode_INCLUDE_PATH should be "/path/to/source;/path/to/binary" |
||||
# where source contains "mpeg2enc.h" and binary contains "mpeg2encDllConfig.h" |
||||
# |
||||
SET(vtkMPEG2Encode_INCLUDE_PATH "vtkMPEG2Encode_INCLUDE_PATH-NOTFOUND" CACHE STRING "Semi-colon delimited list of paths to vtkmpeg2encode header files") |
||||
|
||||
|
||||
# vtkMPEG2Encode_LIBRARIES should be "/path/to/binary/vtkMPEG2Encode.lib" |
||||
# |
||||
SET(vtkMPEG2Encode_LIBRARIES "vtkMPEG2Encode_LIBRARIES-NOTFOUND" CACHE STRING "Semi-colon delimited list of vtkMPEG2Encode library full path names") |
||||
|
||||
|
||||
# Error if values are empty: |
||||
# |
||||
IF(VTK_USE_MPEG2_ENCODER) |
||||
IF(NOT vtkMPEG2Encode_INCLUDE_PATH) |
||||
MESSAGE(SEND_ERROR "Could not determine value for vtkMPEG2Encode_INCLUDE_PATH. Provide value or turn off VTK_USE_MPEG2_ENCODER. Value should be a semi-colon delimited list of paths to vtkmpeg2encode header files.") |
||||
ENDIF(NOT vtkMPEG2Encode_INCLUDE_PATH) |
||||
|
||||
IF(NOT vtkMPEG2Encode_LIBRARIES) |
||||
MESSAGE(SEND_ERROR "Could not determine value for vtkMPEG2Encode_LIBRARIES. Provide value or turn off VTK_USE_MPEG2_ENCODER. Value should be a semi-colon delimited list of vtkMPEG2Encode library full path names.") |
||||
ENDIF(NOT vtkMPEG2Encode_LIBRARIES) |
||||
ENDIF(VTK_USE_MPEG2_ENCODER) |
@ -0,0 +1,23 @@ |
||||
# Try to find mangled Mesa libraries and include dir. |
||||
# Once done this will define |
||||
# |
||||
# MANGLED_MESA_INCLUDE_DIR |
||||
# MANGLED_MESA_LIBRARY |
||||
# MANGLED_OSMESA_INCLUDE_DIR |
||||
# MANGLED_OSMESA_LIBRARY |
||||
|
||||
IF (NOT MANGLED_MESA_INCLUDE_DIR) |
||||
FIND_PATH(MANGLED_MESA_INCLUDE_DIR GL/gl_mangle.h ) |
||||
ENDIF (NOT MANGLED_MESA_INCLUDE_DIR) |
||||
|
||||
IF (NOT MANGLED_MESA_LIBRARY) |
||||
FIND_LIBRARY(MANGLED_MESA_LIBRARY MesaGL) |
||||
ENDIF (NOT MANGLED_MESA_LIBRARY) |
||||
|
||||
IF (NOT MANGLED_OSMESA_INCLUDE_DIR) |
||||
FIND_PATH(MANGLED_OSMESA_INCLUDE_DIR GL/osmesa.h) |
||||
ENDIF (NOT MANGLED_OSMESA_INCLUDE_DIR) |
||||
|
||||
IF (NOT MANGLED_OSMESA_LIBRARY) |
||||
FIND_LIBRARY(MANGLED_OSMESA_LIBRARY OSMesa) |
||||
ENDIF (NOT MANGLED_OSMESA_LIBRARY) |
@ -0,0 +1,29 @@ |
||||
# Try to find Mesa off-screen library and include dir. |
||||
# Once done this will define |
||||
# |
||||
# OSMESA_INCLUDE_DIR - where the GL/osmesa.h can be found |
||||
# OSMESA_LIBRARY - Link this to use OSMesa |
||||
|
||||
|
||||
IF (NOT OSMESA_INCLUDE_DIR) |
||||
FIND_PATH(OSMESA_INCLUDE_DIR GL/osmesa.h |
||||
/usr/include |
||||
/usr/local/include |
||||
/usr/openwin/share/include |
||||
/opt/graphics/OpenGL/include |
||||
/usr/X11R6/include |
||||
) |
||||
ENDIF (NOT OSMESA_INCLUDE_DIR) |
||||
|
||||
# This may be left blank if OSMesa symbols are included |
||||
# in the main Mesa library |
||||
IF (NOT OSMESA_LIBRARY) |
||||
FIND_LIBRARY(OSMESA_LIBRARY OSMesa |
||||
/usr/lib |
||||
/usr/local/lib |
||||
/opt/graphics/OpenGL/lib |
||||
/usr/openwin/lib |
||||
/usr/X11R6/lib |
||||
) |
||||
ENDIF (NOT OSMESA_LIBRARY) |
||||
|
@ -0,0 +1,53 @@ |
||||
# Try to find VLI libraries for VolumePro. |
||||
# Once done this will define |
||||
# |
||||
# VLI_LIBRARY_FOR_VG500 |
||||
# VLI_LIBRARY_FOR_VP1000 |
||||
# VLI_INCLUDE_PATH_FOR_VG500 |
||||
# VLI_INCLUDE_PATH_FOR_VP1000 |
||||
|
||||
FIND_LIBRARY(VLI_LIBRARY_FOR_VG500 |
||||
NAMES vli |
||||
PATHS |
||||
/usr/lib |
||||
/usr/local/lib |
||||
/opt/vli/lib |
||||
"C:/Program Files/VolumePro/lib" |
||||
) |
||||
|
||||
FIND_LIBRARY(VLI_LIBRARY_FOR_VP1000 |
||||
NAMES vli3 |
||||
PATHS |
||||
/usr/lib |
||||
/usr/local/lib |
||||
/opt/vli/lib |
||||
"C:/Program Files/VolumePro1000/lib" |
||||
) |
||||
|
||||
IF (VLI_LIBRARY_FOR_VG500) |
||||
IF (WIN32) |
||||
FIND_PATH(VLI_INCLUDE_PATH_FOR_VG500 VolumePro/inc/vli.h |
||||
"C:/Program Files" |
||||
) |
||||
ELSE (WIN32) |
||||
FIND_PATH(VLI_INCLUDE_PATH_FOR_VG500 vli/include/vli.h |
||||
/usr |
||||
/usr/local |
||||
/opt |
||||
) |
||||
ENDIF (WIN32) |
||||
ENDIF (VLI_LIBRARY_FOR_VG500) |
||||
|
||||
IF (VLI_LIBRARY_FOR_VP1000) |
||||
IF (WIN32) |
||||
FIND_PATH(VLI_INCLUDE_PATH_FOR_VP1000 VolumePro1000/inc/vli.h |
||||
"C:/Program Files" |
||||
) |
||||
ELSE (WIN32) |
||||
FIND_PATH(VLI_INCLUDE_PATH_FOR_VP1000 vli3/include/vli.h |
||||
/usr |
||||
/usr/local |
||||
/opt/vli/include |
||||
) |
||||
ENDIF (WIN32) |
||||
ENDIF (VLI_LIBRARY_FOR_VP1000) |
@ -0,0 +1,3 @@ |
||||
MESSAGE(FATAL_ERROR |
||||
"ERROR: VTK installation is disabled because VTK_USE_RPATH is ON. It is not safe to install binaries that have a runtime path pointing to the build tree. In order to install safely you need to delete the libraries from your build tree, set VTK_USE_RPATH to OFF, and rebuild. See comments in VTK/CMake/vtkSelectSharedLibraries.cmake for more information." |
||||
) |
@ -0,0 +1,116 @@ |
||||
# Setup vtkInstantiator registration for this library's classes. |
||||
VTK_MAKE_INSTANTIATOR3(vtk${KIT}Instantiator KitInstantiator_SRCS |
||||
"${Kit_SRCS}" |
||||
VTK_${UKIT}_EXPORT |
||||
${VTK_BINARY_DIR} "") |
||||
|
||||
ADD_LIBRARY(vtk${KIT} ${Kit_SRCS} ${Kit_EXTRA_SRCS} ${KitInstantiator_SRCS}) |
||||
SET(KIT_LIBRARY_TARGETS ${KIT_LIBRARY_TARGETS} vtk${KIT}) |
||||
|
||||
# Allow the user to customize their build with some local options |
||||
# |
||||
SET(LOCALUSERMACRODEFINED 0) |
||||
INCLUDE (${VTK_BINARY_DIR}/${KIT}/LocalUserOptions.cmake OPTIONAL) |
||||
INCLUDE (${VTK_SOURCE_DIR}/${KIT}/LocalUserOptions.cmake OPTIONAL) |
||||
|
||||
# if we are wrapping into Tcl then add the library and extra |
||||
# source files |
||||
# |
||||
IF (VTK_WRAP_TCL) |
||||
VTK_WRAP_TCL3(vtk${KIT}TCL KitTCL_SRCS |
||||
"${Kit_SRCS}" |
||||
"${Kit_TCL_EXTRA_CMDS}") |
||||
ADD_LIBRARY(vtk${KIT}TCL ${KitTCL_SRCS} ${Kit_TCL_EXTRA_SRCS}) |
||||
SET(KIT_LIBRARY_TARGETS ${KIT_LIBRARY_TARGETS} vtk${KIT}TCL) |
||||
TARGET_LINK_LIBRARIES (vtk${KIT}TCL vtk${KIT} ${KIT_TCL_LIBS}) |
||||
IF(NOT VTK_INSTALL_NO_LIBRARIES) |
||||
INSTALL_TARGETS(${VTK_INSTALL_LIB_DIR} vtk${KIT}TCL) |
||||
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES) |
||||
IF(KIT_TCL_DEPS) |
||||
ADD_DEPENDENCIES(vtk${KIT}TCL ${KIT_TCL_DEPS}) |
||||
ENDIF(KIT_TCL_DEPS) |
||||
ENDIF (VTK_WRAP_TCL) |
||||
|
||||
# if we are wrapping into Python then add the library and extra |
||||
# source files |
||||
# |
||||
IF (VTK_WRAP_PYTHON) |
||||
# Create custom commands to generate the python wrappers for this kit. |
||||
VTK_WRAP_PYTHON3(vtk${KIT}Python KitPython_SRCS "${Kit_SRCS}") |
||||
|
||||
# Create a shared library containing the python wrappers. Executables |
||||
# can link to this but it is not directly loaded dynamically as a |
||||
# module. |
||||
ADD_LIBRARY(vtk${KIT}PythonD ${KitPython_SRCS} ${Kit_PYTHON_EXTRA_SRCS}) |
||||
TARGET_LINK_LIBRARIES(vtk${KIT}PythonD vtk${KIT} ${KIT_PYTHON_LIBS}) |
||||
IF(NOT VTK_INSTALL_NO_LIBRARIES) |
||||
INSTALL_TARGETS(${VTK_INSTALL_LIB_DIR} vtk${KIT}PythonD) |
||||
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES) |
||||
SET(KIT_LIBRARY_TARGETS ${KIT_LIBRARY_TARGETS} vtk${KIT}PythonD) |
||||
|
||||
# On some UNIX platforms the python library is static and therefore |
||||
# should not be linked into the shared library. Instead the symbols |
||||
# are exported from the python executable so that they can be used by |
||||
# shared libraries that are linked or loaded. On Windows and OSX we |
||||
# want to link to the python libray to resolve its symbols |
||||
# immediately. |
||||
IF(WIN32 OR APPLE) |
||||
TARGET_LINK_LIBRARIES (vtk${KIT}PythonD ${VTK_PYTHON_LIBRARIES}) |
||||
ENDIF(WIN32 OR APPLE) |
||||
|
||||
# Add dependencies that may have been generated by VTK_WRAP_PYTHON3 to |
||||
# the python wrapper library. This is needed for the |
||||
# pre-custom-command hack in Visual Studio 6. |
||||
IF(KIT_PYTHON_DEPS) |
||||
ADD_DEPENDENCIES(vtk${KIT}PythonD ${KIT_PYTHON_DEPS}) |
||||
ENDIF(KIT_PYTHON_DEPS) |
||||
|
||||
# Create a python module that can be loaded dynamically. It links to |
||||
# the shared library containing the wrappers for this kit. |
||||
ADD_LIBRARY(vtk${KIT}Python MODULE vtk${KIT}PythonInit.cxx) |
||||
TARGET_LINK_LIBRARIES(vtk${KIT}Python vtk${KIT}PythonD) |
||||
ENDIF (VTK_WRAP_PYTHON) |
||||
|
||||
# if we are wrapping into Java then add the library and extra |
||||
# source files |
||||
# |
||||
IF (VTK_WRAP_JAVA) |
||||
VTK_WRAP_JAVA3(vtk${KIT}Java KitJava_SRCS "${Kit_SRCS}") |
||||
ADD_LIBRARY(vtk${KIT}Java SHARED ${KitJava_SRCS} ${Kit_JAVA_EXTRA_SRCS}) |
||||
SET(KIT_LIBRARY_TARGETS ${KIT_LIBRARY_TARGETS} vtk${KIT}Java) |
||||
TARGET_LINK_LIBRARIES(vtk${KIT}Java vtk${KIT} ${KIT_JAVA_LIBS}) |
||||
IF(NOT VTK_INSTALL_NO_LIBRARIES) |
||||
INSTALL_TARGETS(${VTK_INSTALL_LIB_DIR} vtk${KIT}Java) |
||||
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES) |
||||
IF(KIT_JAVA_DEPS) |
||||
ADD_DEPENDENCIES(vtk${KIT}Java ${KIT_JAVA_DEPS}) |
||||
ENDIF(KIT_JAVA_DEPS) |
||||
ENDIF (VTK_WRAP_JAVA) |
||||
|
||||
TARGET_LINK_LIBRARIES(vtk${KIT} ${KIT_LIBS}) |
||||
|
||||
IF(NOT VTK_INSTALL_NO_LIBRARIES) |
||||
INSTALL_TARGETS(${VTK_INSTALL_LIB_DIR} vtk${KIT}) |
||||
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES) |
||||
IF(NOT VTK_INSTALL_NO_DEVELOPMENT) |
||||
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h ${Kit_SRCS}) |
||||
ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT) |
||||
|
||||
VTK_EXPORT_KIT("${KIT}" "${UKIT}" "${Kit_SRCS}") |
||||
|
||||
# If the user defined a custom macro, execute it now and pass in all the srcs |
||||
# |
||||
IF(LOCALUSERMACRODEFINED) |
||||
LocalUserOptionsMacro( "${Kit_SRCS}" "${Kit_EXTRA_SRCS}" |
||||
"${KitTCL_SRCS}" "${Kit_TCL_EXTRA_SRCS}" |
||||
"${KitJava_SRCS}" "${Kit_JAVA_EXTRA_SRCS}" |
||||
"${KitPython_SRCS}" "${Kit_PYTHON_EXTRA_SRCS}") |
||||
ENDIF(LOCALUSERMACRODEFINED) |
||||
|
||||
|
||||
# Apply user-defined properties to the library targets. |
||||
IF(VTK_LIBRARY_PROPERTIES) |
||||
SET_TARGET_PROPERTIES(${KIT_LIBRARY_TARGETS} PROPERTIES |
||||
${VTK_LIBRARY_PROPERTIES} |
||||
) |
||||
ENDIF(VTK_LIBRARY_PROPERTIES) |
@ -0,0 +1,31 @@ |
||||
# |
||||
# Check if the system is big endian or little endian |
||||
# |
||||
# VARIABLE - variable to store the result to |
||||
# |
||||
|
||||
MACRO(TESTNO_ICC_IDYNAMIC_NEEDED VARIABLE LOCAL_TEST_DIR) |
||||
IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") |
||||
TRY_RUN(${VARIABLE} HAVE_${VARIABLE} |
||||
${CMAKE_BINARY_DIR} |
||||
${LOCAL_TEST_DIR}/TestNO_ICC_IDYNAMIC_NEEDED.cxx |
||||
OUTPUT_VARIABLE OUTPUT) |
||||
MESSAGE(STATUS "Check if using the Intel icc compiler, and if -i_dynamic is needed... COMPILE_RESULT...${HAVE_${VARIABLE}} RUN_RESULT...${VARIABLE}\n") |
||||
IF(HAVE_${VARIABLE}) #Test compiled, either working intel w/o -i_dynamic, or another compiler |
||||
IF(${VARIABLE}) #Intel icc compiler, -i_dynamic not needed |
||||
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log |
||||
"-i_dynamic not needed, (Not Intel icc, or this version of Intel icc does not conflict with OS glibc.") |
||||
MESSAGE(STATUS "-i_dynamic not needed, (Not Intel icc, or this version of Intel icc does not conflict with OS glibc.") |
||||
ELSE(${VARIABLE}) #The compiler is not Intel icc |
||||
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log |
||||
"The compiler ERROR--This should never happen") |
||||
MESSAGE(STATUS "The compiler ERROR--This should never happen") |
||||
ENDIF(${VARIABLE}) |
||||
ELSE(HAVE_${VARIABLE}) #Test did not compile, either badly broken compiler, or intel -i_dynamic needed |
||||
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log |
||||
"\tThe -i_dynamic compiler flag is needed for the Intel icc compiler on this platform.\n") |
||||
MESSAGE("The -i_dynamic compiler flag is needed for the Intel icc compiler on this platform.") |
||||
ENDIF(HAVE_${VARIABLE}) |
||||
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "TestNO_ICC_IDYNAMIC_NEEDED produced following output:\n${OUTPUT}\n\n") |
||||
ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") |
||||
ENDMACRO(TESTNO_ICC_IDYNAMIC_NEEDED) |
@ -0,0 +1,9 @@ |
||||
#ifdef __INTEL_COMPILER |
||||
//If -i_dynamic is required (i.e. icc v7.1 on Redhat 9 or similar glibc version),
|
||||
//this simple program will fail to compile.
|
||||
#include <iostream> |
||||
int main(int argc, char * argv[]) { return 1; } |
||||
#else //__INTEL_COMPILER
|
||||
// If not the INTEL compiler, just fall though to simplest program
|
||||
int main(int argc, char * argv[]) { return 1; } |
||||
#endif //__INTEL_COMPILER
|
@ -0,0 +1,949 @@ |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Addr1 |
||||
fun:strcmp |
||||
fun:_dl_map_object_internal |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:_dl_relocate_object_internal |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:_dl_relocate_object_internal |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:__stpcpy |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:__sysconf |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
core:PThread |
||||
fun:pthread_error |
||||
fun:pthread_attr_setscope |
||||
fun:_ZN16vtkMultiThreader19SingleMethodExecuteEv |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:__stpcpy |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:setlocale |
||||
fun:TclpSetInitialEncodings |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:__stpcpy |
||||
fun:setlocale |
||||
fun:TclpSetInitialEncodings |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:__stpcpy |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:__pthread_once |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:__stpcpy |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:__nss_hosts_lookup |
||||
fun:gethostbyname_r |
||||
fun:gethostbyname |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_X11TransConnect |
||||
fun:_X11TransConnectDisplay |
||||
fun:XOpenDisplay |
||||
fun:TkpOpenDisplay |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_XlcDefaultMapModifiers |
||||
fun:XSetLocaleModifiers |
||||
obj:/usr/lib/libtk8.4.so |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_XrmDefaultInitParseInfo |
||||
fun:_XrmInitParseInfo |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:XrmGetFileDatabase |
||||
fun:_XInitKeysymDB |
||||
fun:XStringToKeysym |
||||
fun:TkStringToKeysym |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2 |
||||
fun:_XimOpenIM |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:XOpenIM |
||||
obj:/usr/lib/libtk8.4.so |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_XlcResolveLocaleName |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:realloc |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_XlcCreateLocaleDataBase |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:XauFileName |
||||
fun:XauGetBestAuthByAddr |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_X11TransConnectDisplay |
||||
fun:XOpenDisplay |
||||
fun:TkpOpenDisplay |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XrmInternalStringToQuark |
||||
fun:XrmStringToQuark |
||||
fun:_XlcGetCharSet |
||||
fun:_XlcAddCT |
||||
fun:_XlcInitCTInfo |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_XlcAddCT |
||||
fun:_XlcInitCTInfo |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
obj:/usr/lib/libtk8.4.so |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:__strdup |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Addr4 |
||||
obj:/lib/libc-2.3.3.so |
||||
obj:/lib/libc-2.3.3.so |
||||
obj:/lib/libc-2.3.3.so |
||||
obj:/lib/libc-2.3.3.so |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:__libc_freeres |
||||
fun:vgPlain___libc_freeres_wrapper |
||||
fun:exit |
||||
fun:Tcl_Exit |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_dl_map_object_deps_internal |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcCreateLC |
||||
fun:_XlcDefaultLoader |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_dl_new_object |
||||
fun:_dl_map_object_from_fd |
||||
fun:_dl_map_object_internal |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_dl_map_object_internal |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_dl_check_map_versions_internal |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_dl_new_object |
||||
fun:_dl_map_object_from_fd |
||||
fun:_dl_map_object_internal |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Overlap |
||||
fun:memcpy |
||||
obj:/usr/X11R6/lib/libXt.so.6.0 |
||||
fun:_XtGetResources |
||||
obj:/usr/X11R6/lib/libXt.so.6.0 |
||||
fun:_XtAppCreateShell |
||||
fun:XtVaAppCreateShell |
||||
} |
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:strlen |
||||
obj:/lib/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XrmInitParseInfo |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:XrmGetStringDatabase |
||||
obj:/usr/X11R6/lib/libXt.so.6.0 |
||||
obj:/usr/X11R6/lib/libXt.so.6.0 |
||||
fun:_XtDisplayInitialize |
||||
fun:XtDisplayInitialize |
||||
fun:_ZN29vtkXRenderWindowTclInteractor10InitializeEv |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:XShmCreateImage |
||||
fun:alloc_shm_back_buffer |
||||
fun:xmesa_alloc_back_buffer |
||||
fun:xmesa_resize_buffers |
||||
fun:_mesa_ResizeBuffersMESA |
||||
fun:_mesa_set_viewport |
||||
fun:_mesa_Viewport |
||||
fun:glViewport |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:XCreateImage |
||||
fun:initialize_visual_and_buffer |
||||
fun:XMesaCreateWindowBuffer2 |
||||
fun:Fake_glXMakeContextCurrent |
||||
fun:Fake_glXMakeCurrent |
||||
fun:glXMakeCurrent |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_dl_map_object_internal |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
fun:OpenIM |
||||
fun:TkpOpenDisplay |
||||
fun:GetScreen |
||||
fun:CreateTopLevelWindow |
||||
fun:TkCreateMainWindow |
||||
fun:CreateFrame |
||||
fun:TkCreateFrame |
||||
fun:Initialize |
||||
fun:Tk_Init |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_dl_map_object_deps_internal |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XNoticeCreateBitmap |
||||
fun:XCreatePixmap |
||||
fun:XCreateBitmapFromData |
||||
fun:GetBitmap |
||||
fun:Tk_GetBitmap |
||||
fun:TkButtonWorldChanged |
||||
fun:ConfigureButton |
||||
fun:ButtonCreate |
||||
fun:Tk_ButtonObjCmd |
||||
fun:TclEvalObjvInternal |
||||
fun:TclExecuteByteCode |
||||
fun:TclCompEvalObj |
||||
fun:TclObjInterpProc |
||||
fun:TclEvalObjvInternal |
||||
fun:TclExecuteByteCode |
||||
fun:TclCompEvalObj |
||||
fun:Tcl_EvalObjEx |
||||
fun:NamespaceEvalCmd |
||||
fun:Tcl_NamespaceObjCmd |
||||
fun:TclEvalObjvInternal |
||||
fun:Tcl_EvalEx |
||||
fun:Tcl_Eval |
||||
fun:Tcl_GlobalEval |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_dl_map_object_deps_internal |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
fun:OpenIM |
||||
fun:TkpOpenDisplay |
||||
fun:GetScreen |
||||
fun:CreateTopLevelWindow |
||||
fun:TkCreateMainWindow |
||||
fun:CreateFrame |
||||
fun:TkCreateFrame |
||||
fun:Initialize |
||||
fun:Tk_Init |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_dl_new_object |
||||
fun:_dl_map_object_from_fd |
||||
fun:_dl_map_object_internal |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
fun:OpenIM |
||||
fun:TkpOpenDisplay |
||||
fun:GetScreen |
||||
fun:CreateTopLevelWindow |
||||
fun:TkCreateMainWindow |
||||
fun:CreateFrame |
||||
fun:TkCreateFrame |
||||
fun:Initialize |
||||
fun:Tk_Init |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:strdup |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
fun:OpenIM |
||||
fun:TkpOpenDisplay |
||||
fun:GetScreen |
||||
fun:CreateTopLevelWindow |
||||
fun:TkCreateMainWindow |
||||
fun:CreateFrame |
||||
fun:TkCreateFrame |
||||
fun:Initialize |
||||
fun:Tk_Init |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_dl_check_map_versions_internal |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
fun:OpenIM |
||||
fun:TkpOpenDisplay |
||||
fun:GetScreen |
||||
fun:CreateTopLevelWindow |
||||
fun:TkCreateMainWindow |
||||
fun:CreateFrame |
||||
fun:TkCreateFrame |
||||
fun:Initialize |
||||
fun:Tk_Init |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:XCreateGC |
||||
fun:initialize_visual_and_buffer |
||||
fun:XMesaCreateWindowBuffer2 |
||||
fun:Fake_glXMakeContextCurrent |
||||
fun:Fake_glXMakeCurrent |
||||
fun:glXMakeCurrent |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:XGetVisualInfo |
||||
fun:get_visual |
||||
fun:choose_x_visual |
||||
fun:choose_visual |
||||
fun:Fake_glXChooseVisual |
||||
fun:glXChooseVisual |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_mesa_malloc |
||||
fun:_mesa_new_buffer_object |
||||
fun:_mesa_init_buffer_objects |
||||
fun:init_attrib_groups |
||||
fun:_mesa_initialize_context |
||||
fun:XMesaCreateContext |
||||
fun:Fake_glXCreateContext |
||||
fun:glXCreateContext |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:strchr |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_dl_new_object |
||||
fun:_dl_map_object_from_fd |
||||
fun:_dl_map_object_internal |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XlcDynamicLoad |
||||
fun:_XOpenLC |
||||
fun:_XlcCurrentLC |
||||
fun:XSetLocaleModifiers |
||||
fun:OpenIM |
||||
fun:TkpOpenDisplay |
||||
fun:GetScreen |
||||
fun:CreateTopLevelWindow |
||||
fun:TkCreateMainWindow |
||||
fun:CreateFrame |
||||
fun:TkCreateFrame |
||||
fun:Initialize |
||||
fun:Tk_Init |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_mesa_calloc |
||||
fun:_mesa_alloc_program |
||||
fun:alloc_shared_state |
||||
fun:_mesa_initialize_context |
||||
fun:XMesaCreateContext |
||||
fun:Fake_glXCreateContext |
||||
fun:glXCreateContext |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_mesa_malloc |
||||
fun:alloc_vertex_store |
||||
fun:_tnl_NewList |
||||
fun:_mesa_NewList |
||||
fun:glNewList |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_mesa_malloc |
||||
fun:XMesaCreateVisual |
||||
fun:save_glx_visual |
||||
fun:choose_visual |
||||
fun:Fake_glXChooseVisual |
||||
fun:glXChooseVisual |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_mesa_calloc |
||||
fun:XMesaCreateVisual |
||||
fun:save_glx_visual |
||||
fun:choose_visual |
||||
fun:Fake_glXChooseVisual |
||||
fun:glXChooseVisual |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_mesa_calloc |
||||
fun:_mesa_NewHashTable |
||||
fun:_mesa_init_occlude |
||||
fun:init_attrib_groups |
||||
fun:_mesa_initialize_context |
||||
fun:XMesaCreateContext |
||||
fun:Fake_glXCreateContext |
||||
fun:glXCreateContext |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_mesa_calloc |
||||
fun:Fake_glXCreateContext |
||||
fun:glXCreateContext |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_mesa_malloc |
||||
fun:_mesa_strdup |
||||
fun:_mesa_init_program |
||||
fun:init_attrib_groups |
||||
fun:_mesa_initialize_context |
||||
fun:XMesaCreateContext |
||||
fun:Fake_glXCreateContext |
||||
fun:glXCreateContext |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_mesa_calloc |
||||
fun:_mesa_NewHashTable |
||||
fun:_mesa_init_depth |
||||
fun:init_attrib_groups |
||||
fun:_mesa_initialize_context |
||||
fun:XMesaCreateContext |
||||
fun:Fake_glXCreateContext |
||||
fun:glXCreateContext |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
fun:_mesa_calloc |
||||
fun:_mesa_new_texture_object |
||||
fun:alloc_shared_state |
||||
fun:_mesa_initialize_context |
||||
fun:XMesaCreateContext |
||||
fun:Fake_glXCreateContext |
||||
fun:glXCreateContext |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Param |
||||
write(buf) |
||||
fun:write |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_X11TransWrite |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XReply |
||||
fun:XSync |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Cond |
||||
fun:_playback_copy_to_current |
||||
fun:_tnl_playback_vertex_list |
||||
fun:execute_list |
||||
fun:_mesa_CallList |
||||
fun:glCallList |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Addr4 |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
fun:__libc_freeres |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:get_dispatch |
||||
fun:glXChooseVisual |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/libXcursor.so.1.0 |
||||
fun:XcursorTryShapeCursor |
||||
fun:_XTryShapeCursor |
||||
fun:XCreateGlyphCursor |
||||
fun:TkGetCursorByName |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:calloc |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlsym |
||||
fun:fcntl |
||||
fun:TclpOpenFileChannel |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:open_path |
||||
fun:_dl_map_object_internal |
||||
obj:/lib/tls/libc-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
fun:_dl_open |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:_dl_catch_error_internal |
||||
obj:/lib/libdl-2.3.3.so |
||||
fun:dlopen |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:_XNoticeCreateBitmap |
||||
fun:XCreatePixmap |
||||
fun:XCreateBitmapFromData |
||||
obj:/usr/lib/libtk8.4.so |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:XQueryFont |
||||
obj:/usr/X11R6/lib/libXcursor.so.1.0 |
||||
fun:XcursorTryShapeCursor |
||||
fun:_XTryShapeCursor |
||||
fun:XCreateGlyphCursor |
||||
fun:TkGetCursorByName |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:XQueryFont |
||||
obj:/usr/X11R6/lib/libXcursor.so.1.0 |
||||
fun:XcursorTryShapeCursor |
||||
fun:_XTryShapeCursor |
||||
fun:XCreateGlyphCursor |
||||
fun:TkGetCursorByName |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
obj:/usr/X11R6/lib/libX11.so.6.2 |
||||
fun:XQueryFont |
||||
obj:/usr/X11R6/lib/libXcursor.so.1.0 |
||||
fun:XcursorTryShapeCursor |
||||
fun:_XTryShapeCursor |
||||
fun:XCreateGlyphCursor |
||||
fun:TkGetCursorByName |
||||
} |
||||
|
||||
{ |
||||
<insert a suppression name here> |
||||
Memcheck:Leak |
||||
fun:malloc |
||||
fun:_mesa_malloc |
||||
fun:alloc_vertex_store |
||||
fun:_save_compile_vertex_list |
||||
fun:_save_wrap_buffers |
||||
fun:_save_wrap_filled_vertex |
||||
fun:save_attrib_0_3 |
||||
fun:_save_Vertex3fv |
||||
fun:glVertex3fv |
||||
} |
@ -0,0 +1,195 @@ |
||||
/* this is a CMake loadable command to wrap vtk objects into Java */ |
||||
|
||||
#include "cmCPluginAPI.h" |
||||
#include <string.h> |
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
|
||||
#define SINGLE_FILE_BUILD |
||||
|
||||
/* do almost everything in the initial pass */ |
||||
static int InitialPass(void *inf, void *mf, int argc, char *argv[]) |
||||
{ |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
int i; |
||||
int newArgc; |
||||
int msize; |
||||
int estimated; |
||||
char **newArgv; |
||||
int numClasses = 0; |
||||
char **classes = 0; |
||||
char **dependencies = 0; |
||||
int numDep = 0; |
||||
int numWrapped = 0; |
||||
const char *cdir = info->CAPI->GetCurrentDirectory(mf); |
||||
const char *def = 0; |
||||
char *newName; |
||||
char *target = 0; |
||||
const char *javac = info->CAPI->GetDefinition(mf,"JAVA_COMPILE"); |
||||
const char *jar = info->CAPI->GetDefinition(mf,"JAVA_ARCHIVE"); |
||||
void *cfile = 0; |
||||
char *args[5]; |
||||
char *jargs[5]; |
||||
int depends = 0; |
||||
char **sargs = 0; |
||||
int sargsCnt = 0; |
||||
char **srcList = 0; |
||||
int srcCnt = 0; |
||||
char* javaPath = 0; |
||||
const char *libpath = info->CAPI->GetDefinition(mf,"LIBRARY_OUTPUT_PATH"); |
||||
const char *vtkpath = info->CAPI->GetDefinition(mf,"VTK_BINARY_DIR"); |
||||
const char *userjavapath = info->CAPI->GetDefinition(mf,"USER_JAVA_CLASSPATH"); |
||||
const char *startTempFile; |
||||
const char *endTempFile; |
||||
|
||||
FILE* outfile = 0; |
||||
const char* filename = 0; |
||||
|
||||
if(argc < 2 ) |
||||
{ |
||||
info->CAPI->SetError(info, "called with incorrect number of arguments"); |
||||
return 0; |
||||
} |
||||
|
||||
/* Now check and see if the value has been stored in the cache */ |
||||
/* already, if so use that value and don't look for the program */ |
||||
if(!info->CAPI->IsOn(mf,"VTK_WRAP_JAVA")) |
||||
{ |
||||
info->CAPI->FreeArguments(newArgc, newArgv); |
||||
return 1; |
||||
} |
||||
|
||||
info->CAPI->ExpandSourceListArguments(mf, argc, (const char**)argv,
|
||||
&newArgc, &newArgv, 2); |
||||
|
||||
/* keep the library name */ |
||||
target = strdup(newArgv[0]); |
||||
|
||||
if (userjavapath) |
||||
{ |
||||
javaPath = (char *)malloc(strlen(vtkpath) + 20 + strlen(userjavapath)); |
||||
sprintf(javaPath, "%s;%s/java", userjavapath, vtkpath); |
||||
} |
||||
else |
||||
{ |
||||
javaPath = (char *)malloc(strlen(vtkpath) + 20); |
||||
sprintf(javaPath, "%s/java", vtkpath); |
||||
} |
||||
|
||||
args[0] = strdup("-classpath"); |
||||
args[1] = strdup(javaPath); |
||||
|
||||
classes = (char**) malloc( newArgc * sizeof(char*)); |
||||
numClasses = 0; |
||||
|
||||
filename = (char*) malloc( strlen(vtkpath) + strlen("/java/vtk/") + strlen(target) + 100 ); |
||||
sprintf(filename, "%s/java/vtk/vtk%sDriver.java", vtkpath, target); |
||||
outfile = fopen(filename, "w"); |
||||
if ( !outfile ) |
||||
{ |
||||
char buffer[1024]; |
||||
sprintf(buffer, "cannot generate output file: %s", filename); |
||||
info->CAPI->SetError(info, buffer); |
||||
return 0; |
||||
} |
||||
|
||||
fprintf(outfile,
|
||||
"// Do not edit\n" |
||||
"// This file is generated by cmVTKGenerateJavaDependencies.c in VTK\n" |
||||
"package vtk;\n" |
||||
"import vtk.*;\n" |
||||
"\n" |
||||
"public class vtk%sDriver\n" |
||||
"{\n" |
||||
" public static void Initialize(String[] args)\n" |
||||
" {\n" |
||||
" Object dummy;\n", target); |
||||
|
||||
/* get the classes for this lib */ |
||||
for(i = 1; i < newArgc; ++i) |
||||
{
|
||||
const char *srcName = newArgv[i]; |
||||
char *className = 0; |
||||
char *srcNameWe; |
||||
char *srcPath; |
||||
|
||||
srcNameWe = info->CAPI->GetFilenameWithoutExtension(srcName); |
||||
srcPath = info->CAPI->GetFilenamePath(srcName); |
||||
|
||||
className = (char *)malloc(strlen(srcPath) + strlen(srcNameWe) + 20); |
||||
sprintf(className,"%s/%s.class",srcPath,srcNameWe); |
||||
fprintf(outfile,
|
||||
" dummy = new %s();\n", srcNameWe); |
||||
|
||||
|
||||
args[2] = (char*) malloc(strlen(srcName) + strlen(target) + 20); |
||||
/* On Unix we can just call javac ... *.java */ |
||||
sprintf(args[2], "%s/vtk%sDriver.java", srcPath, target); |
||||
info->CAPI->AddCustomCommand(mf, srcName, javac, 3, (const char**)args,
|
||||
0, 0, 1, (const char**)&className, target); |
||||
|
||||
free(args[2]); |
||||
info->CAPI->Free(srcNameWe); |
||||
info->CAPI->Free(srcPath); |
||||
classes[numClasses++] = strdup(className); |
||||
free(className); |
||||
} |
||||
free(args[0]); |
||||
free(args[1]); |
||||
|
||||
info->CAPI->AddCustomCommand(mf, target, "", 0, 0, |
||||
numClasses, (const char**)classes, 0, 0, target); |
||||
|
||||
for (i = 0; i < numClasses; i ++ ) |
||||
{ |
||||
free(classes[i]); |
||||
} |
||||
free(classes); |
||||
|
||||
free(javaPath); |
||||
|
||||
free(target); |
||||
|
||||
fprintf(outfile, |
||||
" }\n" |
||||
" }\n"); |
||||
fclose(outfile); |
||||
|
||||
info->CAPI->FreeArguments(newArgc, newArgv); |
||||
return 1; |
||||
} |
||||
|
||||
|
||||
static void FinalPass(void *inf, void *mf)
|
||||
{ |
||||
} |
||||
|
||||
static void Destructor(void *inf)
|
||||
{ |
||||
} |
||||
|
||||
static const char* GetTerseDocumentation()
|
||||
{ |
||||
return "Create Java Archive."; |
||||
} |
||||
|
||||
static const char* GetFullDocumentation() |
||||
{ |
||||
return |
||||
"VTK_WRAP_JAVA(target SourceLists ...)"; |
||||
} |
||||
|
||||
void CM_PLUGIN_EXPORT VTK_GENERATE_JAVA_DEPENDENCIESInit(cmLoadedCommandInfo *info) |
||||
{ |
||||
info->InitialPass = InitialPass; |
||||
info->FinalPass = FinalPass; |
||||
info->Destructor = Destructor; |
||||
info->GetTerseDocumentation = GetTerseDocumentation; |
||||
info->GetFullDocumentation = GetFullDocumentation;
|
||||
info->m_Inherited = 0; |
||||
info->Name = "VTK_GENERATE_JAVA_DEPENDENCIES"; |
||||
} |
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,355 @@ |
||||
/* this is a CMake loadable command to wrap vtk objects into Java */ |
||||
|
||||
#include "cmCPluginAPI.h" |
||||
#include <string.h> |
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
|
||||
static void GenerateHeaderFile(cmLoadedCommandInfo *info,
|
||||
const char *fullPath, const char *hdrName, |
||||
const char *macroName, |
||||
int numIncludes, const char **includes) |
||||
{ |
||||
char *tempOutputFile;
|
||||
FILE *fout; |
||||
int i; |
||||
|
||||
tempOutputFile = (char *)malloc(strlen(fullPath) + 5); |
||||
sprintf(tempOutputFile,"%s.tmp",fullPath); |
||||
fout = fopen(tempOutputFile,"w"); |
||||
if (!fout) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
fprintf(fout, |
||||
"#ifndef __%s_h\n" |
||||
"#define __%s_h\n" |
||||
"\n" |
||||
"#include \"vtkInstantiator.h\"\n", hdrName, hdrName); |
||||
|
||||
for(i=0; i < numIncludes;++i) |
||||
{ |
||||
fprintf(fout,"#include \"%s\"\n", includes[i]); |
||||
} |
||||
|
||||
/* Write the instantiator class definition. */ |
||||
fprintf(fout, |
||||
"\n" |
||||
"class %s %s\n" |
||||
"{\n" |
||||
"public:\n" |
||||
" %s();\n" |
||||
" ~%s();\n" |
||||
"private:\n" |
||||
" static void ClassInitialize();\n" |
||||
" static void ClassFinalize();\n" |
||||
" static unsigned int Count;\n" |
||||
"};\n" |
||||
"\n", macroName, hdrName, hdrName, hdrName); |
||||
|
||||
/* Write the initialization instance to make sure the creation */ |
||||
/* functions get registered when this generated header is included. */ |
||||
fprintf(fout, |
||||
"static %s %sInitializer;\n" |
||||
"\n" |
||||
"#endif\n",hdrName, hdrName);
|
||||
|
||||
fclose(fout); |
||||
|
||||
/* copy the file if different */ |
||||
info->CAPI->CopyFileIfDifferent(tempOutputFile, fullPath); |
||||
info->CAPI->RemoveFile(tempOutputFile); |
||||
free(tempOutputFile); |
||||
} |
||||
|
||||
static void GenerateImplementationFile(cmLoadedCommandInfo *info,
|
||||
const char *fullPath,
|
||||
const char *hdrName, |
||||
int numClasses, const char **classes) |
||||
{ |
||||
char *tempOutputFile;
|
||||
FILE *fout; |
||||
int i; |
||||
|
||||
tempOutputFile = (char *)malloc(strlen(fullPath) + 5); |
||||
sprintf(tempOutputFile,"%s.tmp",fullPath); |
||||
fout = fopen(tempOutputFile,"w"); |
||||
if (!fout) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
/* Include the instantiator class header. */ |
||||
fprintf(fout, |
||||
"#include \"%s.h\"\n" |
||||
"\n", hdrName); |
||||
|
||||
/* Write the extern declarations for all the creation functions. */ |
||||
for(i=0; i < numClasses; ++i) |
||||
{ |
||||
if (classes[i]) |
||||
{ |
||||
fprintf(fout, |
||||
"extern vtkObject* vtkInstantiator%sNew();\n",
|
||||
classes[i]); |
||||
} |
||||
} |
||||
|
||||
/* Write the ClassInitialize method to register all the creation functions.*/ |
||||
fprintf(fout, |
||||
"\n" |
||||
"void %s::ClassInitialize()\n" |
||||
"{\n", hdrName); |
||||
|
||||
for(i=0; i < numClasses; ++i) |
||||
{ |
||||
if (classes[i]) |
||||
{ |
||||
fprintf(fout, |
||||
" vtkInstantiator::RegisterInstantiator(\"%s\", vtkInstantiator%sNew);\n", classes[i], classes[i]); |
||||
} |
||||
} |
||||
|
||||
/* Write the ClassFinalize method to unregister all the creation functions.*/ |
||||
fprintf(fout, |
||||
"}\n" |
||||
"\n" |
||||
"void %s::ClassFinalize()\n" |
||||
"{\n", hdrName); |
||||
|
||||
for(i=0; i < numClasses; ++i) |
||||
{ |
||||
if (classes[i]) |
||||
{ |
||||
fprintf(fout, |
||||
" vtkInstantiator::UnRegisterInstantiator(\"%s\", vtkInstantiator%sNew);\n",classes[i],classes[i]); |
||||
} |
||||
} |
||||
|
||||
/* Write the constructor and destructor of the initializer class to */ |
||||
/* call the ClassInitialize and ClassFinalize methods at the right */ |
||||
/* time. */ |
||||
fprintf(fout, |
||||
"}\n" |
||||
"\n"
|
||||
"%s::%s()\n" |
||||
"{\n" |
||||
" if(++%s::Count == 1)\n" |
||||
" { %s::ClassInitialize(); }\n" |
||||
"}\n", hdrName, hdrName, hdrName, hdrName); |
||||
fprintf(fout, |
||||
"\n"
|
||||
"%s::~%s()\n" |
||||
"{\n" |
||||
" if(--%s::Count == 0)\n" |
||||
" { %s::ClassFinalize(); }\n" |
||||
"}\n" |
||||
"\n" |
||||
"// Number of translation units that include this class's header.\n" |
||||
"// Purposely not initialized. Default is static initialization to 0.\n" |
||||
"unsigned int %s::Count;\n", |
||||
hdrName, hdrName, hdrName, hdrName, hdrName); |
||||
fclose(fout); |
||||
|
||||
/* copy the file if different */ |
||||
info->CAPI->CopyFileIfDifferent(tempOutputFile, fullPath); |
||||
info->CAPI->RemoveFile(tempOutputFile); |
||||
free(tempOutputFile); |
||||
} |
||||
|
||||
/* do almost everything in the initial pass */ |
||||
static int InitialPass(void *inf, void *mf, int argc, char *argv[]) |
||||
{ |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
int i; |
||||
int newArgc; |
||||
char **newArgv; |
||||
const char *filePath = info->CAPI->GetCurrentOutputDirectory(mf); |
||||
const char *headerPath = filePath; |
||||
int includesMode = 0; |
||||
const char *ExportMacro = 0; |
||||
int numClasses = 0; |
||||
char **classes = 0; |
||||
int numIncludes = 0; |
||||
char **includes = 0; |
||||
char *fullName; |
||||
void *cfile; |
||||
|
||||
/* make sure we have the correct number of arguments */ |
||||
if(argc < 3 ) |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
/* expand any source lists */ |
||||
info->CAPI->ExpandSourceListArguments(mf, argc, argv,
|
||||
&newArgc, &newArgv, 2); |
||||
|
||||
/* make sure we allocate enough memory */ |
||||
classes = (char **)malloc(sizeof(char *)*newArgc); |
||||
includes = (char **)malloc(sizeof(char *)*newArgc); |
||||
|
||||
/* Find the path of the files to be generated. */ |
||||
for(i=2; i < newArgc; ++i) |
||||
{ |
||||
if(strcmp(newArgv[i],"HEADER_LOCATION") == 0) |
||||
{ |
||||
includesMode = 0; |
||||
if(++i < newArgc) |
||||
{ |
||||
headerPath = newArgv[i]; |
||||
} |
||||
else |
||||
{ |
||||
info->CAPI->SetError(info,"HEADER_LOCATION option used without value."); |
||||
return 0; |
||||
} |
||||
} |
||||
else if (strcmp(newArgv[i],"EXPORT_MACRO") == 0) |
||||
{ |
||||
includesMode = 0; |
||||
if (++i < newArgc) |
||||
{ |
||||
ExportMacro = newArgv[i]; |
||||
} |
||||
else |
||||
{ |
||||
info->CAPI->SetError(info, "EXPORT_MACRO option used without value."); |
||||
return 0; |
||||
} |
||||
} |
||||
else if (strcmp(newArgv[i],"INCLUDES") == 0) |
||||
{ |
||||
includesMode = 1; |
||||
} |
||||
/* If not an option, it must be another input source list name or */ |
||||
/* an include file. */ |
||||
else |
||||
{ |
||||
if(!includesMode) |
||||
{ |
||||
classes[numClasses] = newArgv[i]; |
||||
numClasses++; |
||||
} |
||||
else |
||||
{ |
||||
includes[numIncludes] = newArgv[i]; |
||||
numIncludes++; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if(!ExportMacro) |
||||
{ |
||||
info->CAPI->SetError(info, "No EXPORT_MACRO option given."); |
||||
return 0; |
||||
} |
||||
|
||||
for (i = 0; i < numClasses; ++i) |
||||
{ |
||||
const char *srcName = info->CAPI->GetFilenameWithoutExtension(classes[i]); |
||||
void *sf = info->CAPI->GetSource(mf,classes[i]); |
||||
|
||||
/* Wrap-excluded and abstract classes do not have a New() method. */ |
||||
/* vtkIndent and vtkTimeStamp are special cases and are not */ |
||||
/* vtkObject subclasses. */ |
||||
if( |
||||
(sf &&
|
||||
(info->CAPI->SourceFileGetPropertyAsBool(sf,"WRAP_EXCLUDE") || |
||||
info->CAPI->SourceFileGetPropertyAsBool(sf,"ABSTRACT"))) || |
||||
!strcmp(srcName,"vtkIndent") ||
|
||||
!strcmp(srcName,"vtkTimeStamp")) |
||||
{ |
||||
/* remove this class from the list */ |
||||
classes[i] = 0; |
||||
} |
||||
else |
||||
{ |
||||
classes[i] = info->CAPI->GetFilenameWithoutExtension(classes[i]); |
||||
} |
||||
info->CAPI->Free((char*)srcName); |
||||
}
|
||||
|
||||
/* Generate the header */ |
||||
fullName = malloc(strlen(newArgv[0]) + strlen(headerPath) + 10); |
||||
sprintf(fullName,"%s/%s.h",headerPath,newArgv[0]); |
||||
GenerateHeaderFile(info, fullName, newArgv[0], ExportMacro,
|
||||
numIncludes, includes); |
||||
free(fullName); |
||||
|
||||
/* Generate the implementation */ |
||||
fullName = malloc(strlen(newArgv[0]) + strlen(filePath) + 10); |
||||
sprintf(fullName,"%s.cxx",newArgv[0]); |
||||
info->CAPI->AddDefinition(mf, newArgv[1], fullName);
|
||||
sprintf(fullName,"%s/%s.cxx",filePath,newArgv[0]); |
||||
GenerateImplementationFile(info, fullName, newArgv[0], numClasses, classes); |
||||
free(fullName); |
||||
|
||||
/* free the classes */ |
||||
for (i = 0; i < numClasses; ++i) |
||||
{ |
||||
if (classes[i]) |
||||
{ |
||||
info->CAPI->Free(classes[i]); |
||||
} |
||||
} |
||||
|
||||
/* Add the generated source file into the source list. */ |
||||
cfile = info->CAPI->CreateSourceFile(); |
||||
info->CAPI->SourceFileSetProperty(cfile,"WRAP_EXCLUDE","1"); |
||||
info->CAPI->SourceFileSetProperty(cfile,"ABSTRACT","0"); |
||||
info->CAPI->SourceFileSetName2(cfile, newArgv[0],
|
||||
info->CAPI->GetCurrentOutputDirectory(mf), |
||||
"cxx",0); |
||||
info->CAPI->AddSource(mf,cfile); |
||||
info->CAPI->DestroySourceFile(cfile); |
||||
info->CAPI->FreeArguments(newArgc, newArgv); |
||||
free(classes); |
||||
free(includes); |
||||
return 1; |
||||
} |
||||
|
||||
static const char* GetTerseDocumentation()
|
||||
{ |
||||
return "Register classes for creation by vtkInstantiator"; |
||||
} |
||||
|
||||
static const char* GetFullDocumentation() |
||||
{ |
||||
return |
||||
"VTK_MAKE_INSTANTIATOR(className outSourceList\n" |
||||
" src-list1 [src-list2 ..]\n" |
||||
" EXPORT_MACRO exportMacro\n" |
||||
" [HEADER_LOCATION dir]\n" |
||||
" [INCLUDES [file1 file2 ..]])\n" |
||||
"Generates a new class with the given name and adds its files to the\n" |
||||
"given outSourceList. It registers the classes from the other given\n" |
||||
"source lists with vtkInstantiator when it is loaded. The output\n" |
||||
"source list should be added to the library with the classes it\n" |
||||
"registers.\n" |
||||
"The EXPORT_MACRO argument must be given and followed by the export\n" |
||||
"macro to use when generating the class (ex. VTK_COMMON_EXPORT).\n" |
||||
"The HEADER_LOCATION option must be followed by a path. It specifies\n" |
||||
"the directory in which to place the generated class's header file.\n" |
||||
"The generated class implementation files always go in the build\n" |
||||
"directory corresponding to the CMakeLists.txt file containing\n" |
||||
"the command. This is the default location for the header.\n" |
||||
"The INCLUDES option can be followed by a list of zero or more files.\n" |
||||
"These files will be #included by the generated instantiator header,\n" |
||||
"and can be used to gain access to the specified exportMacro in the\n" |
||||
" C++ code."; |
||||
} |
||||
|
||||
void CM_PLUGIN_EXPORT VTK_MAKE_INSTANTIATOR2Init(cmLoadedCommandInfo *info) |
||||
{ |
||||
info->InitialPass = InitialPass; |
||||
info->m_Inherited = 0; |
||||
info->GetTerseDocumentation = GetTerseDocumentation; |
||||
info->GetFullDocumentation = GetFullDocumentation;
|
||||
info->Name = "VTK_MAKE_INSTANTIATOR2"; |
||||
} |
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,272 @@ |
||||
/* this is a CMake loadable command to wrap vtk objects into Java */ |
||||
|
||||
#include "cmCPluginAPI.h" |
||||
#include <string.h> |
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
|
||||
typedef struct
|
||||
{ |
||||
char *LibraryName; |
||||
int NumberWrapped; |
||||
void **SourceFiles; |
||||
} cmVTKWrapJavaData; |
||||
|
||||
/* do almost everything in the initial pass */ |
||||
static int InitialPass(void *inf, void *mf, int argc, char *argv[]) |
||||
{ |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
int i; |
||||
int newArgc; |
||||
char **newArgv; |
||||
int numWrapped = 0; |
||||
cmVTKWrapJavaData *cdata =
|
||||
(cmVTKWrapJavaData *)malloc(sizeof(cmVTKWrapJavaData)); |
||||
const char *cdir = info->CAPI->GetCurrentDirectory(mf); |
||||
const char *def = 0; |
||||
int sourceListSize = 0; |
||||
char *sourceListValue = 0; |
||||
char *newName; |
||||
void *cfile = 0; |
||||
|
||||
const char* resultDirectory = "${VTK_JAVA_HOME}"; |
||||
const char* res = info->CAPI->GetCurrentOutputDirectory(mf); |
||||
char* depFileName; |
||||
FILE* fp; |
||||
|
||||
if(argc < 3 ) |
||||
{ |
||||
info->CAPI->SetError(info, "called with incorrect number of arguments"); |
||||
return 0; |
||||
} |
||||
|
||||
info->CAPI->ExpandSourceListArguments(mf, argc, (const char**)argv,
|
||||
&newArgc, (char***)&newArgv, 2); |
||||
|
||||
/* Now check and see if the value has been stored in the cache */ |
||||
/* already, if so use that value and don't look for the program */ |
||||
if(!info->CAPI->IsOn(mf,"VTK_WRAP_JAVA")) |
||||
{ |
||||
info->CAPI->FreeArguments(newArgc, newArgv); |
||||
return 1; |
||||
} |
||||
|
||||
/* keep the library name */ |
||||
cdata->LibraryName = strdup(newArgv[0]); |
||||
cdata->SourceFiles = (void **)malloc(sizeof(void *)*newArgc); |
||||
|
||||
/* was the list already populated */ |
||||
def = info->CAPI->GetDefinition(mf, newArgv[1]); |
||||
|
||||
/* Calculate size of source list. */ |
||||
/* Start with list of source files. */ |
||||
sourceListSize = info->CAPI->GetTotalArgumentSize(newArgc,newArgv); |
||||
/* Add enough to extend the name of each class. */ |
||||
sourceListSize += newArgc*strlen("Java.cxx"); |
||||
/* Add enough to include the def. */ |
||||
sourceListSize += def?strlen(def):0; |
||||
|
||||
/* Allocate and initialize the source list. */ |
||||
sourceListValue = (char *)malloc(sourceListSize); |
||||
sourceListValue[0] = 0; |
||||
if (def) |
||||
{ |
||||
sprintf(sourceListValue,"%s",def); |
||||
} |
||||
|
||||
/* Prepare java dependency file */ |
||||
depFileName = (char*)malloc(strlen(res) + 40); |
||||
sprintf(depFileName, "%s/JavaDependencies.cmake", res); |
||||
fp = fopen(depFileName, "w"); |
||||
fprintf(fp, "# This file is automatically generated by CMake VTK_WRAP_JAVA\n\n" |
||||
"SET(VTK_JAVA_DEPENDENCIES ${VTK_JAVA_DEPENDENCIES}\n"); |
||||
|
||||
/* get the classes for this lib */ |
||||
for(i = 2; i < newArgc; ++i) |
||||
{
|
||||
void *curr = info->CAPI->GetSource(mf,newArgv[i]); |
||||
|
||||
/* if we should wrap the class */ |
||||
if (!curr ||
|
||||
!info->CAPI->SourceFileGetPropertyAsBool(curr,"WRAP_EXCLUDE")) |
||||
{ |
||||
void *file = info->CAPI->CreateSourceFile(); |
||||
char *srcName; |
||||
char *hname=0; |
||||
srcName = info->CAPI->GetFilenameWithoutExtension(newArgv[i]); |
||||
if (curr) |
||||
{ |
||||
int abst = info->CAPI->SourceFileGetPropertyAsBool(curr,"ABSTRACT"); |
||||
info->CAPI->SourceFileSetProperty(file,"ABSTRACT", |
||||
(abst ? "1" : "0")); |
||||
} |
||||
newName = (char *)malloc(strlen(srcName)+5); |
||||
sprintf(newName,"%sJava",srcName); |
||||
info->CAPI->SourceFileSetName2(file, newName,
|
||||
info->CAPI->GetCurrentOutputDirectory(mf), |
||||
"cxx",0); |
||||
hname = (char *)malloc(strlen(cdir) + strlen(srcName) + 4); |
||||
sprintf(hname,"%s/%s.h",cdir,srcName); |
||||
/* add starting depends */ |
||||
info->CAPI->SourceFileAddDepend(file,hname); |
||||
info->CAPI->AddSource(mf,file); |
||||
free(hname); |
||||
cdata->SourceFiles[numWrapped] = file; |
||||
numWrapped++; |
||||
strcat(sourceListValue,";"); |
||||
strcat(sourceListValue,newName); |
||||
strcat(sourceListValue,".cxx");
|
||||
|
||||
/* Write file to java dependency file */ |
||||
fprintf(fp, " %s/%s.java\n", resultDirectory, srcName); |
||||
free(newName); |
||||
info->CAPI->Free(srcName); |
||||
} |
||||
} |
||||
|
||||
/* Finalize java dependency file */ |
||||
fprintf(fp, ")\n"); |
||||
fclose(fp); |
||||
|
||||
cdata->NumberWrapped = numWrapped; |
||||
info->CAPI->SetClientData(info,cdata); |
||||
|
||||
info->CAPI->AddDefinition(mf, newArgv[1], sourceListValue); |
||||
info->CAPI->FreeArguments(newArgc, newArgv); |
||||
free(sourceListValue); |
||||
return 1; |
||||
} |
||||
|
||||
|
||||
static void FinalPass(void *inf, void *mf)
|
||||
{ |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
/* get our client data from initial pass */ |
||||
cmVTKWrapJavaData *cdata =
|
||||
(cmVTKWrapJavaData *)info->CAPI->GetClientData(info); |
||||
|
||||
/* first we add the rules for all the .h to Java.cxx files */ |
||||
const char *wjava = "${VTK_WRAP_JAVA_EXE}"; |
||||
const char *pjava = "${VTK_PARSE_JAVA_EXE}"; |
||||
const char *hints = info->CAPI->GetDefinition(mf,"VTK_WRAP_HINTS"); |
||||
const char *args[4]; |
||||
const char *depends[2]; |
||||
const char *depends2[2]; |
||||
char **alldeps = 0; |
||||
char* util=0; |
||||
int i; |
||||
int numDepends, numArgs; |
||||
const char *cdir = info->CAPI->GetCurrentDirectory(mf); |
||||
const char *resultDirectory = "${VTK_JAVA_HOME}"; |
||||
|
||||
/* If the first pass terminated early, we have nothing to do. */ |
||||
if(!cdata) |
||||
{ |
||||
return; |
||||
}
|
||||
|
||||
/* wrap all the .h files */ |
||||
depends[0] = wjava; |
||||
depends2[0] = pjava; |
||||
numDepends = 1; |
||||
if (hints) |
||||
{ |
||||
depends[1] = hints; |
||||
depends2[1] = hints; |
||||
numDepends++; |
||||
} |
||||
alldeps = (char**)malloc(sizeof(const char*)*cdata->NumberWrapped); |
||||
for(i = 0; i < cdata->NumberWrapped; i++) |
||||
{ |
||||
char *res; |
||||
const char *srcName = info->CAPI->SourceFileGetSourceName(cdata->SourceFiles[i]); |
||||
char *hname = (char *)malloc(strlen(cdir) + strlen(srcName) + 4); |
||||
sprintf(hname,"%s/%s",cdir,srcName); |
||||
hname[strlen(hname)-4]= '\0'; |
||||
strcat(hname,".h"); |
||||
args[0] = hname; |
||||
numArgs = 1; |
||||
if (hints) |
||||
{ |
||||
args[1] = hints; |
||||
numArgs++; |
||||
} |
||||
args[numArgs] =
|
||||
(info->CAPI->SourceFileGetPropertyAsBool(cdata->SourceFiles[i],"ABSTRACT") ?"0" :"1"); |
||||
numArgs++; |
||||
res = (char *)malloc(strlen(info->CAPI->GetCurrentOutputDirectory(mf)) +
|
||||
strlen(srcName) + 6); |
||||
sprintf(res,"%s/%s.cxx",info->CAPI->GetCurrentOutputDirectory(mf),srcName); |
||||
args[numArgs] = res; |
||||
numArgs++; |
||||
info->CAPI->AddCustomCommand(mf, args[0], |
||||
wjava, numArgs, (const char**)args, numDepends, (const char**)depends,
|
||||
1, (const char**)&res, cdata->LibraryName); |
||||
free(res); |
||||
|
||||
res = (char *)malloc(strlen(resultDirectory) +
|
||||
strlen(srcName) + 3); |
||||
sprintf(res,"%s/%s",resultDirectory,srcName); |
||||
sprintf(res+strlen(res)-4, ".java"); |
||||
args[numArgs-1] = res; |
||||
info->CAPI->AddCustomCommand(mf, args[0], |
||||
pjava, numArgs, args, numDepends, depends2,
|
||||
1, (const char**)&res, cdata->LibraryName); |
||||
alldeps[i] = res; |
||||
free(hname); |
||||
} |
||||
|
||||
util = malloc(strlen(cdata->LibraryName) + 12); |
||||
sprintf(util, "%sJavaClasses", cdata->LibraryName); |
||||
info->CAPI->AddUtilityCommand(mf, util, "", "", 1, |
||||
cdata->NumberWrapped, |
||||
(const char**)alldeps, |
||||
0, 0);
|
||||
for(i = 0; i < cdata->NumberWrapped; i++) |
||||
{ |
||||
free(alldeps[i]); |
||||
} |
||||
free(alldeps); |
||||
free(util); |
||||
} |
||||
|
||||
static void Destructor(void *inf)
|
||||
{ |
||||
int i; |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
/* get our client data from initial pass */ |
||||
cmVTKWrapJavaData *cdata =
|
||||
(cmVTKWrapJavaData *)info->CAPI->GetClientData(info); |
||||
if (cdata) |
||||
{ |
||||
for (i = 0; i < cdata->NumberWrapped; ++i) |
||||
{
|
||||
info->CAPI->DestroySourceFile(cdata->SourceFiles[i]); |
||||
} |
||||
free(cdata->SourceFiles); |
||||
free(cdata->LibraryName); |
||||
free(cdata); |
||||
} |
||||
} |
||||
|
||||
static const char* GetTerseDocumentation()
|
||||
{ |
||||
return "Create Java Wrappers."; |
||||
} |
||||
|
||||
static const char* GetFullDocumentation() |
||||
{ |
||||
return |
||||
"VTK_WRAP_JAVA(resultingLibraryName SourceListName SourceLists ...)"; |
||||
} |
||||
|
||||
void CM_PLUGIN_EXPORT VTK_WRAP_JAVA2Init(cmLoadedCommandInfo *info) |
||||
{ |
||||
info->InitialPass = InitialPass; |
||||
info->FinalPass = FinalPass; |
||||
info->Destructor = Destructor; |
||||
info->GetTerseDocumentation = GetTerseDocumentation; |
||||
info->GetFullDocumentation = GetFullDocumentation;
|
||||
info->m_Inherited = 0; |
||||
info->Name = "VTK_WRAP_JAVA2"; |
||||
} |
@ -0,0 +1,350 @@ |
||||
/* this is a CMake loadable command to wrap vtk objects into Python */ |
||||
|
||||
#include "cmCPluginAPI.h" |
||||
#include <string.h> |
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
|
||||
typedef struct
|
||||
{ |
||||
char *LibraryName; |
||||
int NumberWrapped; |
||||
void **SourceFiles; |
||||
char **HeaderFiles; |
||||
} cmVTKWrapPythonData; |
||||
|
||||
/* this roputine creates the init file */ |
||||
static void CreateInitFile(cmLoadedCommandInfo *info, |
||||
void *mf, const char *kitName,
|
||||
int numClasses, const char **classes)
|
||||
{ |
||||
/* we have to make sure that the name is the correct case */ |
||||
int i; |
||||
char *tempOutputFile;
|
||||
char *outFileName =
|
||||
(char *)malloc(strlen(info->CAPI->GetCurrentOutputDirectory(mf)) +
|
||||
strlen(kitName) + 10); |
||||
FILE *fout; |
||||
|
||||
sprintf(outFileName,"%s/%sInit.cxx", |
||||
info->CAPI->GetCurrentOutputDirectory(mf), kitName); |
||||
|
||||
tempOutputFile = (char *)malloc(strlen(outFileName) + 5); |
||||
sprintf(tempOutputFile,"%s.tmp",outFileName); |
||||
fout = fopen(tempOutputFile,"w"); |
||||
if (!fout) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
fprintf(fout,"// Generated by cmVTKWrapPythonCommand2 in VTK/CMake\n\n"); |
||||
fprintf(fout,"#include \"vtkPython.h\"\n\n"); |
||||
fprintf(fout,"#include \"vtkSystemIncludes.h\"\n"); |
||||
fprintf(fout,"#include <string.h>\n"); |
||||
fprintf(fout,"// Handle compiler warning messages, etc.\n" |
||||
"#if defined( _MSC_VER ) && !defined(VTK_DISPLAY_WIN32_WARNINGS)\n" |
||||
"#pragma warning ( disable : 4706 )\n" |
||||
"#endif // Windows Warnings \n\n"); |
||||
|
||||
for (i = 0; i < numClasses; i++) |
||||
{ |
||||
#ifdef _WIN32 |
||||
fprintf(fout,"extern \"C\" {__declspec( dllexport) PyObject *PyVTKClass_%sNew(char *); }\n",classes[i]); |
||||
#else |
||||
fprintf(fout,"extern \"C\" {PyObject *PyVTKClass_%sNew(char *); }\n",classes[i]); |
||||
#endif |
||||
} |
||||
|
||||
fprintf(fout,"\nstatic PyMethodDef Py%s_ClassMethods[] = {\n", |
||||
kitName); |
||||
fprintf(fout,"{NULL, NULL, 0, NULL}};\n\n"); |
||||
|
||||
#ifdef _WIN32 |
||||
fprintf(fout,"extern \"C\" {__declspec( dllexport) void init%s();}\n\n",kitName); |
||||
fprintf(fout,"void init%s()\n{\n",kitName); |
||||
#else |
||||
fprintf(fout,"extern \"C\" {void initlib%s();}\n\n",kitName); |
||||
fprintf(fout,"void initlib%s()\n{\n",kitName); |
||||
#endif |
||||
|
||||
|
||||
/* module init function */ |
||||
fprintf(fout," PyObject *m, *d, *c;\n\n"); |
||||
#ifdef _WIN32 |
||||
fprintf(fout," static const char modulename[] = \"%s\";\n",kitName); |
||||
#else |
||||
fprintf(fout," static const char modulename[] = \"lib%s\";\n",kitName); |
||||
#endif |
||||
fprintf(fout," m = Py_InitModule((char*)modulename, Py%s_ClassMethods);\n", |
||||
kitName); |
||||
|
||||
fprintf(fout," d = PyModule_GetDict(m);\n"); |
||||
fprintf(fout," if (!d) Py_FatalError((char*)\"can't get dictionary for module %s!\");\n\n", |
||||
kitName); |
||||
|
||||
for (i = 0; i < numClasses; i++) |
||||
{ |
||||
fprintf(fout," if ((c = PyVTKClass_%sNew((char*)modulename)))\n", |
||||
classes[i]); |
||||
fprintf(fout," if (-1 == PyDict_SetItemString(d, (char*)\"%s\", c))\n", |
||||
classes[i]); |
||||
fprintf(fout," Py_FatalError((char*)\"can't add class %s to dictionary!\");\n\n", |
||||
classes[i]); |
||||
} |
||||
fprintf(fout,"}\n\n"); |
||||
fclose(fout); |
||||
|
||||
/* copy the file if different */ |
||||
info->CAPI->CopyFileIfDifferent(tempOutputFile, outFileName); |
||||
info->CAPI->RemoveFile(tempOutputFile); |
||||
} |
||||
|
||||
/* do almost everything in the initial pass */ |
||||
static int InitialPass(void *inf, void *mf, int argc, char *argv[]) |
||||
{ |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
int i; |
||||
int newArgc; |
||||
char **newArgv; |
||||
int numClasses = 0; |
||||
char **classes = 0; |
||||
int numWrapped = 0; |
||||
cmVTKWrapPythonData *cdata =
|
||||
(cmVTKWrapPythonData *)malloc(sizeof(cmVTKWrapPythonData)); |
||||
const char *cdir = info->CAPI->GetCurrentDirectory(mf); |
||||
const char *def = 0; |
||||
int sourceListSize = 0; |
||||
char *sourceListValue = 0; |
||||
char *newName; |
||||
void *cfile = 0; |
||||
|
||||
if(argc < 3 ) |
||||
{ |
||||
info->CAPI->SetError(info, "called with incorrect number of arguments"); |
||||
return 0; |
||||
} |
||||
|
||||
info->CAPI->ExpandSourceListArguments(mf, argc, argv,
|
||||
&newArgc, &newArgv, 2); |
||||
|
||||
/* Now check and see if the value has been stored in the cache */ |
||||
/* already, if so use that value and don't look for the program */ |
||||
if(!info->CAPI->IsOn(mf,"VTK_WRAP_PYTHON")) |
||||
{ |
||||
info->CAPI->FreeArguments(newArgc, newArgv); |
||||
return 1; |
||||
} |
||||
|
||||
/* keep the library name */ |
||||
classes = (char **)malloc(sizeof(char *)*newArgc); |
||||
cdata->LibraryName = strdup(newArgv[0]); |
||||
cdata->SourceFiles = (void **)malloc(sizeof(void *)*newArgc); |
||||
cdata->HeaderFiles = (char **)malloc(sizeof(char *)*newArgc); |
||||
|
||||
/* was the list already populated */ |
||||
def = info->CAPI->GetDefinition(mf, newArgv[1]); |
||||
|
||||
/* Calculate size of source list. */ |
||||
/* Start with list of source files. */ |
||||
sourceListSize = info->CAPI->GetTotalArgumentSize(newArgc,newArgv); |
||||
/* Add enough to extend the name of each class. */ |
||||
sourceListSize += newArgc*strlen("Python.cxx"); |
||||
/* Add enough to include the def and init file. */ |
||||
sourceListSize += def?strlen(def):0; |
||||
sourceListSize += strlen(";Init.cxx"); |
||||
|
||||
/* Allocate and initialize the source list. */ |
||||
sourceListValue = (char *)malloc(sourceListSize); |
||||
if (def) |
||||
{ |
||||
sprintf(sourceListValue,"%s;%sInit.cxx",def,newArgv[0]); |
||||
} |
||||
else |
||||
{ |
||||
/* Don't include the Init.cxx file in the library on OSX */ |
||||
/* It is linked into a MODULE separate from the rest of the dylib */ |
||||
#if defined(__APPLE__) |
||||
sprintf(sourceListValue,""); |
||||
#else |
||||
sprintf(sourceListValue,"%sInit.cxx",newArgv[0]); |
||||
#endif |
||||
} |
||||
|
||||
/* get the classes for this lib */ |
||||
for(i = 2; i < newArgc; ++i) |
||||
{
|
||||
void *curr = info->CAPI->GetSource(mf,newArgv[i]); |
||||
|
||||
/* if we should wrap the class */ |
||||
if (!curr ||
|
||||
!info->CAPI->SourceFileGetPropertyAsBool(curr,"WRAP_EXCLUDE")) |
||||
{ |
||||
void *file = info->CAPI->CreateSourceFile(); |
||||
char *srcName; |
||||
char *hname; |
||||
char *pathName; |
||||
srcName = info->CAPI->GetFilenameWithoutExtension(newArgv[i]); |
||||
pathName = info->CAPI->GetFilenamePath(newArgv[i]); |
||||
if (curr) |
||||
{ |
||||
int abst = info->CAPI->SourceFileGetPropertyAsBool(curr,"ABSTRACT"); |
||||
info->CAPI->SourceFileSetProperty(file,"ABSTRACT", |
||||
(abst ? "1" : "0")); |
||||
} |
||||
classes[numClasses] = strdup(srcName); |
||||
numClasses++; |
||||
newName = (char *)malloc(strlen(srcName)+7); |
||||
sprintf(newName,"%sPython",srcName); |
||||
info->CAPI->SourceFileSetName2(file, newName,
|
||||
info->CAPI->GetCurrentOutputDirectory(mf), |
||||
"cxx",0); |
||||
|
||||
if (strlen(pathName) > 1) |
||||
{ |
||||
hname = (char *)malloc(strlen(pathName) + strlen(srcName) + 4); |
||||
sprintf(hname,"%s/%s.h",pathName,srcName); |
||||
} |
||||
else |
||||
{ |
||||
hname = (char *)malloc(strlen(cdir) + strlen(srcName) + 4); |
||||
sprintf(hname,"%s/%s.h",cdir,srcName); |
||||
} |
||||
/* add starting depends */ |
||||
info->CAPI->SourceFileAddDepend(file,hname); |
||||
info->CAPI->AddSource(mf,file); |
||||
cdata->SourceFiles[numWrapped] = file; |
||||
cdata->HeaderFiles[numWrapped] = hname; |
||||
numWrapped++; |
||||
if(sourceListValue[0]) |
||||
{ |
||||
/* This is not the first value, add a separator. */ |
||||
strcat(sourceListValue,";"); |
||||
} |
||||
strcat(sourceListValue,newName); |
||||
strcat(sourceListValue,".cxx");
|
||||
free(newName); |
||||
info->CAPI->Free(srcName); |
||||
info->CAPI->Free(pathName); |
||||
} |
||||
} |
||||
|
||||
/* add the init file */ |
||||
cfile = info->CAPI->CreateSourceFile(); |
||||
info->CAPI->SourceFileSetProperty(cfile,"ABSTRACT","0"); |
||||
newName = (char *)malloc(strlen(newArgv[0]) + 5); |
||||
sprintf(newName,"%sInit",newArgv[0]); |
||||
CreateInitFile(info,mf,newArgv[0],numClasses,classes); |
||||
info->CAPI->SourceFileSetName2(cfile, newName,
|
||||
info->CAPI->GetCurrentOutputDirectory(mf), |
||||
"cxx",0); |
||||
free(newName); |
||||
info->CAPI->AddSource(mf,cfile); |
||||
|
||||
cdata->NumberWrapped = numWrapped; |
||||
info->CAPI->SetClientData(info,cdata); |
||||
|
||||
info->CAPI->AddDefinition(mf, newArgv[1], sourceListValue); |
||||
info->CAPI->FreeArguments(newArgc, newArgv); |
||||
free(sourceListValue); |
||||
return 1; |
||||
} |
||||
|
||||
|
||||
static void FinalPass(void *inf, void *mf)
|
||||
{ |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
/* get our client data from initial pass */ |
||||
cmVTKWrapPythonData *cdata =
|
||||
(cmVTKWrapPythonData *)info->CAPI->GetClientData(info); |
||||
|
||||
/* first we add the rules for all the .h to Python.cxx files */ |
||||
const char *wpython = "${VTK_WRAP_PYTHON_EXE}"; |
||||
const char *hints = info->CAPI->GetDefinition(mf,"VTK_WRAP_HINTS"); |
||||
const char *args[4]; |
||||
const char *depends[2]; |
||||
int i; |
||||
int numDepends, numArgs; |
||||
const char *cdir = info->CAPI->GetCurrentDirectory(mf); |
||||
|
||||
/* If the first pass terminated early, we have nothing to do. */ |
||||
if(!cdata) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
/* wrap all the .h files */ |
||||
depends[0] = wpython; |
||||
numDepends = 1; |
||||
if (hints) |
||||
{ |
||||
depends[1] = hints; |
||||
numDepends++; |
||||
} |
||||
for(i = 0; i < cdata->NumberWrapped; i++) |
||||
{ |
||||
char *res; |
||||
const char *srcName = info->CAPI->SourceFileGetSourceName(cdata->SourceFiles[i]); |
||||
args[0] = cdata->HeaderFiles[i]; |
||||
numArgs = 1; |
||||
if (hints) |
||||
{ |
||||
args[1] = hints; |
||||
numArgs++; |
||||
} |
||||
args[numArgs] =
|
||||
(info->CAPI->SourceFileGetPropertyAsBool(cdata->SourceFiles[i],"ABSTRACT") ?"0" :"1"); |
||||
numArgs++; |
||||
res = (char *)malloc(strlen(info->CAPI->GetCurrentOutputDirectory(mf)) +
|
||||
strlen(srcName) + 6); |
||||
sprintf(res,"%s/%s.cxx",info->CAPI->GetCurrentOutputDirectory(mf),srcName); |
||||
args[numArgs] = res; |
||||
numArgs++; |
||||
info->CAPI->AddCustomCommand(mf, args[0], |
||||
wpython, numArgs, args, numDepends, depends,
|
||||
1, &res, cdata->LibraryName); |
||||
free(res); |
||||
} |
||||
} |
||||
|
||||
static void Destructor(void *inf)
|
||||
{ |
||||
int i; |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
/* get our client data from initial pass */ |
||||
cmVTKWrapPythonData *cdata =
|
||||
(cmVTKWrapPythonData *)info->CAPI->GetClientData(info); |
||||
if (cdata) |
||||
{ |
||||
for (i = 0; i < cdata->NumberWrapped; ++i) |
||||
{
|
||||
info->CAPI->DestroySourceFile(cdata->SourceFiles[i]); |
||||
free(cdata->HeaderFiles[i]); |
||||
} |
||||
free(cdata->SourceFiles); |
||||
free(cdata->HeaderFiles); |
||||
free(cdata->LibraryName); |
||||
free(cdata); |
||||
} |
||||
} |
||||
|
||||
static const char* GetTerseDocumentation()
|
||||
{ |
||||
return "Create Python Wrappers."; |
||||
} |
||||
|
||||
static const char* GetFullDocumentation() |
||||
{ |
||||
return |
||||
"VTK_WRAP_PYTHON(resultingLibraryName SourceListName SourceLists ...)"; |
||||
} |
||||
|
||||
void CM_PLUGIN_EXPORT VTK_WRAP_PYTHON2Init(cmLoadedCommandInfo *info) |
||||
{ |
||||
info->InitialPass = InitialPass; |
||||
info->FinalPass = FinalPass; |
||||
info->Destructor = Destructor; |
||||
info->m_Inherited = 0; |
||||
info->GetTerseDocumentation = GetTerseDocumentation; |
||||
info->GetFullDocumentation = GetFullDocumentation;
|
||||
info->Name = "VTK_WRAP_PYTHON2"; |
||||
} |
@ -0,0 +1,478 @@ |
||||
/* this is a CMake loadable command to wrap vtk objects into Tcl */ |
||||
|
||||
#include "cmCPluginAPI.h" |
||||
#include <string.h> |
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
|
||||
typedef struct
|
||||
{ |
||||
char *LibraryName; |
||||
int NumberWrapped; |
||||
void **SourceFiles; |
||||
char **HeaderFiles; |
||||
} cmVTKWrapTclData; |
||||
|
||||
/* this roputine creates the init file */ |
||||
static void CreateInitFile(cmLoadedCommandInfo *info, |
||||
void *mf, const char *libName,
|
||||
int numConcrete, const char **concrete,
|
||||
int numCommands, const char **commands)
|
||||
{ |
||||
/* we have to make sure that the name is the correct case */ |
||||
char *kitName = info->CAPI->Capitalized(libName); |
||||
int i; |
||||
char *tempOutputFile;
|
||||
char *outFileName =
|
||||
(char *)malloc(strlen(info->CAPI->GetCurrentOutputDirectory(mf)) +
|
||||
strlen(libName) + 10); |
||||
char **capcommands = (char **)malloc(numCommands*sizeof(char *)); |
||||
FILE *fout; |
||||
|
||||
sprintf(outFileName,"%s/%sInit.cxx", |
||||
info->CAPI->GetCurrentOutputDirectory(mf), libName); |
||||
|
||||
tempOutputFile = (char *)malloc(strlen(outFileName) + 5); |
||||
sprintf(tempOutputFile,"%s.tmp",outFileName); |
||||
fout = fopen(tempOutputFile,"w"); |
||||
if (!fout) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
/* capitalized commands just once */ |
||||
for (i = 0; i < numCommands; i++) |
||||
{ |
||||
capcommands[i] = info->CAPI->Capitalized(commands[i]); |
||||
} |
||||
|
||||
fprintf(fout,"#include \"vtkTclUtil.h\"\n"); |
||||
fprintf(fout,"#include \"vtkVersion.h\"\n"); |
||||
fprintf(fout,"#define VTK_TCL_TO_STRING(x) VTK_TCL_TO_STRING0(x)\n"); |
||||
fprintf(fout,"#define VTK_TCL_TO_STRING0(x) #x\n"); |
||||
|
||||
fprintf(fout, |
||||
"extern \"C\"\n" |
||||
"{\n" |
||||
"#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4) && (TCL_RELEASE_LEVEL >= TCL_FINAL_RELEASE)\n" |
||||
" typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp *,int, CONST84 char *[]);\n" |
||||
"#else\n" |
||||
" typedef int (*vtkTclCommandType)(ClientData, Tcl_Interp *,int, char *[]);\n" |
||||
"#endif\n" |
||||
"}\n" |
||||
"\n"); |
||||
|
||||
for (i = 0; i < numConcrete; i++) |
||||
{ |
||||
fprintf(fout,"int %sCommand(ClientData cd, Tcl_Interp *interp,\n int argc, char *argv[]);\n",concrete[i]); |
||||
fprintf(fout,"ClientData %sNewCommand();\n",concrete[i]); |
||||
} |
||||
|
||||
if (!strcmp(kitName,"Vtkcommontcl")) |
||||
{ |
||||
fprintf(fout,"int vtkCreateCommand(ClientData cd, Tcl_Interp *interp,\n" |
||||
" int argc, char *argv[]);\n"); |
||||
fprintf(fout,"\nTcl_HashTable vtkInstanceLookup;\n"); |
||||
fprintf(fout,"Tcl_HashTable vtkPointerLookup;\n"); |
||||
fprintf(fout,"Tcl_HashTable vtkCommandLookup;\n"); |
||||
} |
||||
else |
||||
{ |
||||
fprintf(fout,"\nextern Tcl_HashTable vtkInstanceLookup;\n"); |
||||
fprintf(fout,"extern Tcl_HashTable vtkPointerLookup;\n"); |
||||
fprintf(fout,"extern Tcl_HashTable vtkCommandLookup;\n"); |
||||
} |
||||
fprintf(fout,"extern void vtkTclDeleteObjectFromHash(void *);\n");
|
||||
fprintf(fout,"extern void vtkTclListInstances(Tcl_Interp *interp, ClientData arg);\n"); |
||||
|
||||
for (i = 0; i < numCommands; i++) |
||||
{ |
||||
fprintf(fout, |
||||
"\nextern \"C\" {int VTK_EXPORT %s_Init(Tcl_Interp *interp);}\n", |
||||
capcommands[i]); |
||||
} |
||||
|
||||
fprintf(fout, |
||||
"\n\nextern \"C\" {int VTK_EXPORT %s_SafeInit(Tcl_Interp *interp);}\n", |
||||
kitName); |
||||
fprintf(fout, |
||||
"\nextern \"C\" {int VTK_EXPORT %s_Init(Tcl_Interp *interp);}\n", |
||||
kitName); |
||||
|
||||
/* create an extern ref to the generic delete function */ |
||||
fprintf(fout,"\nextern void vtkTclGenericDeleteObject(ClientData cd);\n"); |
||||
|
||||
if (!strcmp(kitName,"Vtkcommontcl")) |
||||
{ |
||||
fprintf(fout, |
||||
"extern \"C\"\n{\nvoid vtkCommonDeleteAssocData(ClientData cd)\n"); |
||||
fprintf(fout," {\n"); |
||||
fprintf(fout," vtkTclInterpStruct *tis = static_cast<vtkTclInterpStruct*>(cd);\n"); |
||||
fprintf(fout," delete tis;\n }\n}\n"); |
||||
} |
||||
|
||||
/* the main declaration */ |
||||
fprintf(fout, |
||||
"\n\nint VTK_EXPORT %s_SafeInit(Tcl_Interp *interp)\n{\n",kitName); |
||||
fprintf(fout," return %s_Init(interp);\n}\n",kitName); |
||||
|
||||
fprintf(fout,"\n\nint VTK_EXPORT %s_Init(Tcl_Interp *interp)\n{\n", |
||||
kitName); |
||||
if (!strcmp(kitName,"Vtkcommontcl")) |
||||
{ |
||||
fprintf(fout, |
||||
" vtkTclInterpStruct *info = new vtkTclInterpStruct;\n"); |
||||
fprintf(fout, |
||||
" info->Number = 0; info->InDelete = 0; info->DebugOn = 0; info->DeleteExistingObjectOnNew = 0;\n"); |
||||
fprintf(fout,"\n"); |
||||
fprintf(fout,"\n"); |
||||
fprintf(fout, |
||||
" Tcl_InitHashTable(&info->InstanceLookup, TCL_STRING_KEYS);\n"); |
||||
fprintf(fout, |
||||
" Tcl_InitHashTable(&info->PointerLookup, TCL_STRING_KEYS);\n"); |
||||
fprintf(fout, |
||||
" Tcl_InitHashTable(&info->CommandLookup, TCL_STRING_KEYS);\n"); |
||||
fprintf(fout, |
||||
" Tcl_SetAssocData(interp,(char *) \"vtk\",NULL,(ClientData *)info);\n"); |
||||
fprintf(fout, |
||||
" Tcl_CreateExitHandler(vtkCommonDeleteAssocData,(ClientData *)info);\n"); |
||||
|
||||
/* create special vtkCommand command */ |
||||
fprintf(fout," Tcl_CreateCommand(interp,(char *) \"vtkCommand\",\n" |
||||
" reinterpret_cast<vtkTclCommandType>(vtkCreateCommand),\n" |
||||
" (ClientData *)NULL, NULL);\n\n"); |
||||
} |
||||
|
||||
for (i = 0; i < numCommands; i++) |
||||
{ |
||||
fprintf(fout," %s_Init(interp);\n", capcommands[i]); |
||||
} |
||||
fprintf(fout,"\n"); |
||||
|
||||
for (i = 0; i < numConcrete; i++) |
||||
{ |
||||
fprintf(fout," vtkTclCreateNew(interp,(char *) \"%s\", %sNewCommand,\n", |
||||
concrete[i], concrete[i]); |
||||
fprintf(fout," %sCommand);\n",concrete[i]); |
||||
} |
||||
|
||||
fprintf(fout," char pkgName[]=\"%s\";\n", libName); |
||||
fprintf(fout," char pkgVers[]=VTK_TCL_TO_STRING(VTK_MAJOR_VERSION)" |
||||
" \".\" " |
||||
"VTK_TCL_TO_STRING(VTK_MINOR_VERSION);\n"); |
||||
fprintf(fout," Tcl_PkgProvide(interp, pkgName, pkgVers);\n"); |
||||
fprintf(fout," return TCL_OK;\n}\n"); |
||||
fclose(fout); |
||||
|
||||
/* copy the file if different */ |
||||
info->CAPI->CopyFileIfDifferent(tempOutputFile, outFileName); |
||||
info->CAPI->RemoveFile(tempOutputFile); |
||||
for ( i = 0; i < numCommands; i++ ) |
||||
{ |
||||
info->CAPI->Free(capcommands[i]); |
||||
} |
||||
free(capcommands); |
||||
free(tempOutputFile); |
||||
info->CAPI->Free(kitName); |
||||
free(outFileName); |
||||
} |
||||
|
||||
/* do almost everything in the initial pass */ |
||||
static int InitialPass(void *inf, void *mf, int argc, char *argv[]) |
||||
{ |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
int i; |
||||
int newArgc; |
||||
char **newArgv; |
||||
int doing_sources = 1; |
||||
char **sources = 0; |
||||
char **commands = 0; |
||||
int numSources = 0; |
||||
int numCommands = 0; |
||||
int numConcrete = 0; |
||||
char **concrete = 0; |
||||
int numWrapped = 0; |
||||
cmVTKWrapTclData *cdata =
|
||||
(cmVTKWrapTclData *)malloc(sizeof(cmVTKWrapTclData)); |
||||
|
||||
if(argc < 3 ) |
||||
{ |
||||
info->CAPI->SetError(info, "called with incorrect number of arguments"); |
||||
return 0; |
||||
} |
||||
|
||||
if (!strcmp(argv[1],"SOURCES")) |
||||
{ |
||||
info->CAPI->ExpandSourceListArguments(mf, argc, argv, &newArgc,
|
||||
&newArgv, 3); |
||||
} |
||||
else |
||||
{ |
||||
info->CAPI->ExpandSourceListArguments(mf, argc, argv,
|
||||
&newArgc, &newArgv, 2); |
||||
} |
||||
|
||||
/* Now check and see if the value has been stored in the cache */ |
||||
/* already, if so use that value and don't look for the program */ |
||||
if(!info->CAPI->IsOn(mf,"VTK_WRAP_TCL")) |
||||
{ |
||||
info->CAPI->FreeArguments(newArgc, newArgv); |
||||
return 1; |
||||
} |
||||
|
||||
/* extract the sources and commands parameters */ |
||||
sources = (char **)malloc(sizeof(char *)*newArgc); |
||||
commands = (char **)malloc(sizeof(char *)*newArgc); |
||||
concrete = (char **)malloc(sizeof(char *)*newArgc); |
||||
cdata->SourceFiles = (void **)malloc(sizeof(void *)*newArgc); |
||||
cdata->HeaderFiles = (char **)malloc(sizeof(char *)*newArgc); |
||||
|
||||
for(i = 1; i < newArgc; ++i) |
||||
{
|
||||
if(!strcmp(newArgv[i],"SOURCES")) |
||||
{ |
||||
doing_sources = 1; |
||||
} |
||||
else if (!strcmp(newArgv[i],"COMMANDS")) |
||||
{ |
||||
doing_sources = 0; |
||||
} |
||||
else |
||||
{
|
||||
if(doing_sources) |
||||
{ |
||||
sources[numSources] = newArgv[i]; |
||||
numSources++; |
||||
} |
||||
else |
||||
{ |
||||
commands[numCommands] = newArgv[i]; |
||||
numCommands++; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/* get the list of classes for this library */ |
||||
if (numSources) |
||||
{ |
||||
/* what is the current source dir */ |
||||
const char *cdir = info->CAPI->GetCurrentDirectory(mf); |
||||
int sourceListSize = 0; |
||||
char *sourceListValue = 0; |
||||
void *cfile = 0; |
||||
char *newName; |
||||
|
||||
/* was the list already populated */ |
||||
const char *def = info->CAPI->GetDefinition(mf, sources[0]); |
||||
|
||||
/* Calculate size of source list. */ |
||||
/* Start with list of source files. */ |
||||
sourceListSize = info->CAPI->GetTotalArgumentSize(newArgc,newArgv); |
||||
/* Add enough to extend the name of each class. */ |
||||
sourceListSize += numSources*strlen("Tcl.cxx"); |
||||
/* Add enough to include the def and init file. */ |
||||
sourceListSize += def?strlen(def):0; |
||||
sourceListSize += strlen(";Init.cxx"); |
||||
|
||||
/* Allocate and initialize the source list. */ |
||||
sourceListValue = (char *)malloc(sourceListSize); |
||||
if (def) |
||||
{ |
||||
sprintf(sourceListValue,"%s;%sInit.cxx",def,argv[0]); |
||||
} |
||||
else |
||||
{ |
||||
sprintf(sourceListValue,"%sInit.cxx",argv[0]); |
||||
} |
||||
|
||||
for(i = 1; i < numSources; ++i) |
||||
{
|
||||
void *curr = info->CAPI->GetSource(mf,sources[i]); |
||||
|
||||
/* if we should wrap the class */ |
||||
if (!curr ||
|
||||
!info->CAPI->SourceFileGetPropertyAsBool(curr,"WRAP_EXCLUDE")) |
||||
{ |
||||
void *file = info->CAPI->CreateSourceFile(); |
||||
char *srcName; |
||||
char *hname; |
||||
char *pathName; |
||||
srcName = info->CAPI->GetFilenameWithoutExtension(sources[i]); |
||||
pathName = info->CAPI->GetFilenamePath(sources[i]); |
||||
if (curr) |
||||
{ |
||||
int abst = info->CAPI->SourceFileGetPropertyAsBool(curr,"ABSTRACT"); |
||||
info->CAPI->SourceFileSetProperty(file,"ABSTRACT", |
||||
(abst ? "1" : "0")); |
||||
if (!abst) |
||||
{ |
||||
concrete[numConcrete] = strdup(srcName); |
||||
numConcrete++; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
concrete[numConcrete] = strdup(srcName); |
||||
numConcrete++; |
||||
} |
||||
newName = (char *)malloc(strlen(srcName)+4); |
||||
sprintf(newName,"%sTcl",srcName); |
||||
info->CAPI->SourceFileSetName2(file, newName,
|
||||
info->CAPI->GetCurrentOutputDirectory(mf), |
||||
"cxx",0); |
||||
|
||||
if (strlen(pathName) > 1) |
||||
{ |
||||
hname = (char *)malloc(strlen(pathName) + strlen(srcName) + 4); |
||||
sprintf(hname,"%s/%s.h",pathName,srcName); |
||||
} |
||||
else |
||||
{ |
||||
hname = (char *)malloc(strlen(cdir) + strlen(srcName) + 4); |
||||
sprintf(hname,"%s/%s.h",cdir,srcName); |
||||
} |
||||
/* add starting depends */ |
||||
info->CAPI->SourceFileAddDepend(file,hname); |
||||
info->CAPI->AddSource(mf,file); |
||||
cdata->SourceFiles[numWrapped] = file; |
||||
cdata->HeaderFiles[numWrapped] = hname; |
||||
numWrapped++; |
||||
strcat(sourceListValue,";"); |
||||
strcat(sourceListValue,newName); |
||||
strcat(sourceListValue,".cxx");
|
||||
free(newName); |
||||
info->CAPI->Free(srcName); |
||||
info->CAPI->Free(pathName); |
||||
} |
||||
} |
||||
/* add the init file */ |
||||
cfile = info->CAPI->CreateSourceFile(); |
||||
info->CAPI->SourceFileSetProperty(cfile,"ABSTRACT","0"); |
||||
newName = (char *)malloc(strlen(argv[0]) + 5); |
||||
sprintf(newName,"%sInit",argv[0]); |
||||
CreateInitFile(info,mf,argv[0],numConcrete,concrete,numCommands,commands); |
||||
info->CAPI->SourceFileSetName2(cfile, newName,
|
||||
info->CAPI->GetCurrentOutputDirectory(mf), |
||||
"cxx",0); |
||||
free(newName); |
||||
info->CAPI->AddSource(mf,cfile); |
||||
info->CAPI->DestroySourceFile(cfile); |
||||
info->CAPI->AddDefinition(mf, sources[0], sourceListValue); |
||||
free(sourceListValue); |
||||
} |
||||
|
||||
/* store key data in the CLientData for the final pass */ |
||||
cdata->NumberWrapped = numWrapped; |
||||
cdata->LibraryName = strdup(argv[0]); |
||||
info->CAPI->SetClientData(info,cdata); |
||||
|
||||
free(sources); |
||||
free(commands); |
||||
info->CAPI->FreeArguments(newArgc, newArgv); |
||||
for (i = 0; i < numConcrete; ++i) |
||||
{ |
||||
free(concrete[i]); |
||||
} |
||||
free(concrete); |
||||
return 1; |
||||
} |
||||
|
||||
|
||||
static void FinalPass(void *inf, void *mf)
|
||||
{ |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
/* get our client data from initial pass */ |
||||
cmVTKWrapTclData *cdata =
|
||||
(cmVTKWrapTclData *)info->CAPI->GetClientData(info); |
||||
|
||||
/* first we add the rules for all the .h to Tcl.cxx files */ |
||||
const char *wtcl = "${VTK_WRAP_TCL_EXE}"; |
||||
const char *hints = info->CAPI->GetDefinition(mf,"VTK_WRAP_HINTS"); |
||||
const char *args[4]; |
||||
const char *depends[2]; |
||||
int i; |
||||
int numDepends, numArgs; |
||||
const char *cdir = info->CAPI->GetCurrentDirectory(mf); |
||||
|
||||
/* If the first pass terminated early, we have nothing to do. */ |
||||
if(!cdata) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
/* wrap all the .h files */ |
||||
depends[0] = wtcl; |
||||
numDepends = 1; |
||||
if (hints) |
||||
{ |
||||
depends[1] = hints; |
||||
numDepends++; |
||||
} |
||||
for(i = 0; i < cdata->NumberWrapped; i++) |
||||
{ |
||||
char *res; |
||||
const char *srcName = info->CAPI->SourceFileGetSourceName(cdata->SourceFiles[i]); |
||||
args[0] = cdata->HeaderFiles[i]; |
||||
numArgs = 1; |
||||
if (hints) |
||||
{ |
||||
args[1] = hints; |
||||
numArgs++; |
||||
} |
||||
args[numArgs] =
|
||||
(info->CAPI->SourceFileGetPropertyAsBool(cdata->SourceFiles[i],"ABSTRACT") ?"0" :"1"); |
||||
numArgs++; |
||||
res = (char *)malloc(strlen(info->CAPI->GetCurrentOutputDirectory(mf)) +
|
||||
strlen(srcName) + 6); |
||||
sprintf(res,"%s/%s.cxx",info->CAPI->GetCurrentOutputDirectory(mf),srcName); |
||||
args[numArgs] = res; |
||||
numArgs++; |
||||
info->CAPI->AddCustomCommand(mf, args[0], |
||||
wtcl, numArgs, args, numDepends, depends,
|
||||
1, &res, cdata->LibraryName); |
||||
free(res); |
||||
} |
||||
} |
||||
|
||||
static void Destructor(void *inf)
|
||||
{ |
||||
int i; |
||||
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; |
||||
/* get our client data from initial pass */ |
||||
cmVTKWrapTclData *cdata =
|
||||
(cmVTKWrapTclData *)info->CAPI->GetClientData(info); |
||||
if (cdata) |
||||
{ |
||||
for (i = 0; i < cdata->NumberWrapped; ++i) |
||||
{
|
||||
info->CAPI->DestroySourceFile(cdata->SourceFiles[i]); |
||||
free(cdata->HeaderFiles[i]); |
||||
} |
||||
free(cdata->SourceFiles); |
||||
free(cdata->HeaderFiles); |
||||
free(cdata->LibraryName); |
||||
free(cdata); |
||||
} |
||||
} |
||||
|
||||
static const char* GetTerseDocumentation()
|
||||
{ |
||||
return "Create Tcl Wrappers for VTK classes."; |
||||
} |
||||
|
||||
static const char* GetFullDocumentation() |
||||
{ |
||||
return |
||||
"VTK_WRAP_TCL(resultingLibraryName [SOURCES] SourceListName SourceLists ... [COMMANDS CommandName1 CommandName2 ...])"; |
||||
} |
||||
|
||||
void CM_PLUGIN_EXPORT VTK_WRAP_TCL2Init(cmLoadedCommandInfo *info) |
||||
{ |
||||
info->InitialPass = InitialPass; |
||||
info->FinalPass = FinalPass; |
||||
info->Destructor = Destructor; |
||||
info->m_Inherited = 0; |
||||
info->GetTerseDocumentation = GetTerseDocumentation; |
||||
info->GetFullDocumentation = GetFullDocumentation;
|
||||
info->Name = "VTK_WRAP_TCL2"; |
||||
} |
@ -0,0 +1,36 @@ |
||||
#----------------------------------------------------------------------------- |
||||
# Macro to compile VTK's CMake extension commands. |
||||
# The arguments are the source and build tree locations for the loaded |
||||
# commands project, and the variable in which success/failure should |
||||
# be stored. |
||||
MACRO(VTK_COMPILE_CMAKE_EXTENSIONS source_dir build_dir result_var) |
||||
# do we need the extensions |
||||
SET (VTK_NEED_LOADED_COMMANDS 0) |
||||
IF (VTK_WRAP_TCL OR VTK_WRAP_PYTHON) |
||||
SET (VTK_NEED_LOADED_COMMANDS 1) |
||||
ENDIF (VTK_WRAP_TCL OR VTK_WRAP_PYTHON) |
||||
IF (VTK_WRAP_JAVA) |
||||
SET (VTK_NEED_LOADED_COMMANDS 1) |
||||
ENDIF (VTK_WRAP_JAVA) |
||||
|
||||
# if we need them |
||||
IF (VTK_NEED_LOADED_COMMANDS) |
||||
# if they are not already loaded |
||||
IF(COMMAND VTK_WRAP_TCL2) |
||||
ELSE(COMMAND VTK_WRAP_TCL2) |
||||
MESSAGE(STATUS "Compiling VTK CMake commands") |
||||
TRY_COMPILE("${result_var}" "${build_dir}" "${source_dir}" |
||||
VTK_LOADED_COMMANDS |
||||
CMAKE_FLAGS -DVTK_BUILD_FROM_TRY_COMPILE:BOOL=TRUE |
||||
OUTPUT_VARIABLE VTK_COMPILE_CMAKE_EXTENSIONS_OUTPUT) |
||||
IF("${result_var}") |
||||
MESSAGE(STATUS "Compiling VTK CMake commands - done") |
||||
ELSE("${result_var}") |
||||
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log |
||||
"Building of VTK extensions failed with the following output:\n" |
||||
"${VTK_COMPILE_CMAKE_EXTENSIONS_OUTPUT}\n" APPEND) |
||||
MESSAGE(FATAL_ERROR "Compiling VTK CMake commands - failed") |
||||
ENDIF("${result_var}") |
||||
ENDIF(COMMAND VTK_WRAP_TCL2) |
||||
ENDIF (VTK_NEED_LOADED_COMMANDS) |
||||
ENDMACRO(VTK_COMPILE_CMAKE_EXTENSIONS) |
@ -0,0 +1,33 @@ |
||||
# Macro to provide an option only if a set of other variables are ON. |
||||
# Example invocation: |
||||
# |
||||
# VTK_DEPENDENT_OPTION(USE_FOO "Use Foo" ON "USE_BAR;USE_ZOT" OFF) |
||||
# |
||||
# If both USE_BAR and USE_ZOT are true, this provides an option called |
||||
# USE_FOO that defaults to ON. Otherwise, it sets USE_FOO to OFF. If |
||||
# the status of USE_BAR or USE_ZOT ever changes, any value for the |
||||
# USE_FOO option is saved so that when the option is re-enabled it |
||||
# retains its old value. |
||||
# |
||||
MACRO(VTK_DEPENDENT_OPTION option doc default depends force) |
||||
IF(${option}_ISSET MATCHES "^${option}_ISSET$") |
||||
SET(${option}_AVAILABLE 1) |
||||
FOREACH(d ${depends}) |
||||
IF(NOT ${d}) |
||||
SET(${option}_AVAILABLE 0) |
||||
ENDIF(NOT ${d}) |
||||
ENDFOREACH(d) |
||||
IF(${option}_AVAILABLE) |
||||
OPTION(${option} "${doc}" "${default}") |
||||
SET(${option} "${${option}}" CACHE BOOL "${doc}" FORCE) |
||||
ELSE(${option}_AVAILABLE) |
||||
IF(${option} MATCHES "^${option}$") |
||||
ELSE(${option} MATCHES "^${option}$") |
||||
SET(${option} "${${option}}" CACHE INTERNAL "${doc}") |
||||
ENDIF(${option} MATCHES "^${option}$") |
||||
SET(${option} ${force}) |
||||
ENDIF(${option}_AVAILABLE) |
||||
ELSE(${option}_ISSET MATCHES "^${option}_ISSET$") |
||||
SET(${option} "${${option}_ISSET}") |
||||
ENDIF(${option}_ISSET MATCHES "^${option}_ISSET$") |
||||
ENDMACRO(VTK_DEPENDENT_OPTION) |
@ -0,0 +1,34 @@ |
||||
#----------------------------------------------------------------------------- |
||||
MACRO(VTK_EXPORT_KIT kit ukit sources) |
||||
SET(KIT_CLASS_LIST) |
||||
SET(KIT_ABSTRACT_LIST) |
||||
SET(KIT_EXCLUDE_LIST) |
||||
FOREACH(src ${sources}) |
||||
STRING(REGEX REPLACE "\\.cxx$" "" CLASS "${src}") |
||||
SET(KIT_CLASS_LIST "${KIT_CLASS_LIST}\n \"${CLASS}\"") |
||||
GET_SOURCE_FILE_PROPERTY(IS_ABSTRACT ${src} ABSTRACT) |
||||
IF(IS_ABSTRACT MATCHES "^1$") |
||||
SET(KIT_ABSTRACT_LIST "${KIT_ABSTRACT_LIST}\n \"${CLASS}\"") |
||||
ENDIF(IS_ABSTRACT MATCHES "^1$") |
||||
GET_SOURCE_FILE_PROPERTY(IS_EXCLUDE ${src} WRAP_EXCLUDE) |
||||
IF(IS_EXCLUDE MATCHES "^1$") |
||||
SET(KIT_EXCLUDE_LIST "${KIT_EXCLUDE_LIST}\n \"${CLASS}\"") |
||||
ENDIF(IS_EXCLUDE MATCHES "^1$") |
||||
ENDFOREACH(src) |
||||
SET(VTK_EXPORT_KIT ${kit}) |
||||
SET(VTK_EXPORT_UKIT ${ukit}) |
||||
SET(VTK_EXPORT_KIT_DOLLAR "$") |
||||
SET(VTK_EXPORT_HEADER_DIR ${VTK_EXPORT_KIT_DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_INCLUDE_DIR}) |
||||
CONFIGURE_FILE(${VTK_SOURCE_DIR}/CMake/vtkKit.cmake.in |
||||
${VTK_BINARY_DIR}/Utilities/InstallOnly/vtk${kit}Kit.cmake |
||||
@ONLY IMMEDIATE) |
||||
SET(VTK_EXPORT_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
||||
CONFIGURE_FILE(${VTK_SOURCE_DIR}/CMake/vtkKit.cmake.in |
||||
${VTK_BINARY_DIR}/Utilities/vtk${kit}Kit.cmake |
||||
@ONLY IMMEDIATE) |
||||
IF(NOT VTK_INSTALL_NO_DEVELOPMENT) |
||||
INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR} FILES |
||||
${VTK_BINARY_DIR}/Utilities/InstallOnly/vtk${kit}Kit.cmake |
||||
) |
||||
ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT) |
||||
ENDMACRO(VTK_EXPORT_KIT) |
@ -0,0 +1,22 @@ |
||||
# Directory containing class headers. |
||||
SET(VTK_@VTK_EXPORT_UKIT@_HEADER_DIR "@VTK_EXPORT_HEADER_DIR@") |
||||
|
||||
# Classes in vtk@VTK_EXPORT_KIT@. |
||||
SET(VTK_@VTK_EXPORT_UKIT@_CLASSES@KIT_CLASS_LIST@) |
||||
|
||||
# Abstract classes in vtk@VTK_EXPORT_KIT@. |
||||
SET(VTK_@VTK_EXPORT_UKIT@_CLASSES_ABSTRACT@KIT_ABSTRACT_LIST@) |
||||
|
||||
# Wrap-exclude classes in vtk@VTK_EXPORT_KIT@. |
||||
SET(VTK_@VTK_EXPORT_UKIT@_CLASSES_WRAP_EXCLUDE@KIT_EXCLUDE_LIST@) |
||||
|
||||
# Set convenient variables to test each class. |
||||
FOREACH(class ${VTK_@VTK_EXPORT_UKIT@_CLASSES}) |
||||
SET(VTK_CLASS_EXISTS_${class} 1) |
||||
ENDFOREACH(class) |
||||
FOREACH(class ${VTK_@VTK_EXPORT_UKIT@_CLASSES_ABSTRACT}) |
||||
SET(VTK_CLASS_ABSTRACT_${class} 1) |
||||
ENDFOREACH(class) |
||||
FOREACH(class ${VTK_@VTK_EXPORT_UKIT@_CLASSES_WRAP_EXCLUDE}) |
||||
SET(VTK_CLASS_WRAP_EXCLUDE_${class} 1) |
||||
ENDFOREACH(class) |
@ -0,0 +1,33 @@ |
||||
#----------------------------------------------------------------------------- |
||||
# Macro to load VTK's CMake extension commands. The argument should |
||||
# be the directory containing the command modules. |
||||
MACRO(VTK_LOAD_SINGLE_CMAKE_EXTENSION name dir) |
||||
IF(COMMAND ${name}) |
||||
ELSE(COMMAND ${name}) |
||||
LOAD_COMMAND(${name} ${dir} ${dir}/Debug) |
||||
ENDIF(COMMAND ${name}) |
||||
IF(COMMAND ${name}) |
||||
ELSE(COMMAND ${name}) |
||||
MESSAGE(FATAL_ERROR "Loading VTK command ${name} - failed") |
||||
ENDIF(COMMAND ${name}) |
||||
ENDMACRO(VTK_LOAD_SINGLE_CMAKE_EXTENSION) |
||||
|
||||
MACRO(VTK_LOAD_CMAKE_EXTENSIONS ext_dir) |
||||
# do we need the extensions |
||||
SET (VTK_NEED_LOADED_COMMANDS 0) |
||||
IF (VTK_WRAP_TCL OR VTK_WRAP_PYTHON) |
||||
SET (VTK_NEED_LOADED_COMMANDS 1) |
||||
ENDIF (VTK_WRAP_TCL OR VTK_WRAP_PYTHON) |
||||
IF (VTK_WRAP_JAVA) |
||||
SET (VTK_NEED_LOADED_COMMANDS 1) |
||||
ENDIF (VTK_WRAP_JAVA) |
||||
|
||||
IF (VTK_NEED_LOADED_COMMANDS) |
||||
MESSAGE(STATUS "Loading VTK CMake commands") |
||||
VTK_LOAD_SINGLE_CMAKE_EXTENSION(VTK_WRAP_TCL2 ${ext_dir}) |
||||
VTK_LOAD_SINGLE_CMAKE_EXTENSION(VTK_WRAP_PYTHON2 ${ext_dir}) |
||||
VTK_LOAD_SINGLE_CMAKE_EXTENSION(VTK_WRAP_JAVA2 ${ext_dir}) |
||||
VTK_LOAD_SINGLE_CMAKE_EXTENSION(VTK_GENERATE_JAVA_DEPENDENCIES ${ext_dir}) |
||||
MESSAGE(STATUS "Loading VTK CMake commands - done") |
||||
ENDIF (VTK_NEED_LOADED_COMMANDS) |
||||
ENDMACRO(VTK_LOAD_CMAKE_EXTENSIONS) |
@ -0,0 +1,115 @@ |
||||
# |
||||
# a cmake implementation of the Wrap Tcl command |
||||
# |
||||
|
||||
# VTK_MAKE_INSTANTIATOR(className |
||||
# outSourceList |
||||
# src-list1 |
||||
# EXPORT_MACRO |
||||
# HEADER_LOCATION |
||||
# INCLUDES) |
||||
# |
||||
# Generates a new class with the given name and adds its files to the |
||||
# given outSourceList. It registers the classes from the other given |
||||
# source lists with vtkInstantiator when it is loaded. The output |
||||
# source list should be added to the library with the classes it |
||||
# registers. |
||||
# The EXPORT_MACRO argument must be given and followed by the export |
||||
# macro to use when generating the class (ex. VTK_COMMON_EXPORT). |
||||
# The HEADER_LOCATION option must be followed by a path. It specifies |
||||
# the directory in which to place the generated class's header file. |
||||
# The generated class implementation files always go in the build |
||||
# directory corresponding to the CMakeLists.txt file containing |
||||
# the command. This is the default location for the header. |
||||
# The INCLUDES option can be followed by a list of zero or more files. |
||||
# These files will be #included by the generated instantiator header, |
||||
# and can be used to gain access to the specified exportMacro in the |
||||
# C++ code. |
||||
|
||||
MACRO(VTK_MAKE_INSTANTIATOR3 className outSourceList SOURCES EXPORT_MACRO HEADER_LOCATION INCLUDES) |
||||
|
||||
# Initialize local variables |
||||
SET(HEADER_CONTENTS) |
||||
SET(CXX_CONTENTS) |
||||
SET(CXX_CONTENTS2) |
||||
SET(CXX_CONTENTS3) |
||||
|
||||
# make the arguments available to the configured files |
||||
SET (VTK_MAKE_INSTANTIATOR_CLASS_NAME ${className}) |
||||
SET (VTK_MAKE_INSTANTIATOR_EXPORT_MACRO ${EXPORT_MACRO}) |
||||
|
||||
# For each include |
||||
FOREACH(FILE ${INCLUDES}) |
||||
# generate the header |
||||
SET (HEADER_CONTENTS |
||||
"${HEADER_CONTENTS}#include \"${FILE}\"\n") |
||||
ENDFOREACH(FILE) |
||||
|
||||
# For each class |
||||
FOREACH(FILE ${SOURCES}) |
||||
|
||||
# should we wrap the file? |
||||
SET (WRAP_THIS_CLASS 1) |
||||
GET_SOURCE_FILE_PROPERTY(TMP_WRAP_EXCLUDE ${FILE} WRAP_EXCLUDE) |
||||
GET_SOURCE_FILE_PROPERTY(TMP_ABSTRACT ${FILE} ABSTRACT) |
||||
|
||||
# if it is abstract or wrap exclude then don't wrap it |
||||
IF (TMP_WRAP_EXCLUDE OR TMP_ABSTRACT) |
||||
SET (WRAP_THIS_CLASS 0) |
||||
ENDIF (TMP_WRAP_EXCLUDE OR TMP_ABSTRACT) |
||||
|
||||
# don't wrap vtkIndent or vtkTimeStamp |
||||
IF (${FILE} MATCHES "vtkIndent") |
||||
SET (WRAP_THIS_CLASS 0) |
||||
ENDIF (${FILE} MATCHES "vtkIndent") |
||||
IF (${FILE} MATCHES "vtkTimeStamp") |
||||
SET (WRAP_THIS_CLASS 0) |
||||
ENDIF (${FILE} MATCHES "vtkTimeStamp") |
||||
|
||||
# finally if we should wrap it, then ... |
||||
IF (WRAP_THIS_CLASS) |
||||
|
||||
# what is the filename without the extension |
||||
GET_FILENAME_COMPONENT(TMP_FILENAME ${FILE} NAME_WE) |
||||
|
||||
# generate the implementation |
||||
SET (CXX_CONTENTS |
||||
"${CXX_CONTENTS}extern vtkObject* vtkInstantiator${TMP_FILENAME}New();\n") |
||||
|
||||
SET (CXX_CONTENTS2 |
||||
"${CXX_CONTENTS2} vtkInstantiator::RegisterInstantiator(\"${TMP_FILENAME}\", vtkInstantiator${TMP_FILENAME}New);\n") |
||||
|
||||
SET (CXX_CONTENTS3 |
||||
"${CXX_CONTENTS3} vtkInstantiator::UnRegisterInstantiator(\"${TMP_FILENAME}\", vtkInstantiator${TMP_FILENAME}New);\n") |
||||
|
||||
ENDIF (WRAP_THIS_CLASS) |
||||
ENDFOREACH(FILE) |
||||
|
||||
# add the source file to the source list |
||||
SET(${outSourceList} ${${outSourceList}} |
||||
${CMAKE_CURRENT_BINARY_DIR}/${className}.cxx) |
||||
|
||||
SET_SOURCE_FILES_PROPERTIES( |
||||
${CMAKE_CURRENT_BINARY_DIR}/${className}.cxx |
||||
PROPERTIES GENERATED 1 WRAP_EXCLUDE 1 ABSTRACT 0 |
||||
) |
||||
|
||||
|
||||
IF (NOT VTK_CMAKE_DIR) |
||||
SET(VTK_CMAKE_DIR ${VTK_SOURCE_DIR}/CMake) |
||||
ENDIF (NOT VTK_CMAKE_DIR) |
||||
|
||||
CONFIGURE_FILE( |
||||
${VTK_CMAKE_DIR}/vtkMakeInstantiator.h.in |
||||
${HEADER_LOCATION}/${className}.h |
||||
COPY_ONLY |
||||
IMMEDIATE |
||||
) |
||||
CONFIGURE_FILE( |
||||
${VTK_CMAKE_DIR}/vtkMakeInstantiator.cxx.in |
||||
${CMAKE_CURRENT_BINARY_DIR}/${className}.cxx |
||||
COPY_ONLY |
||||
IMMEDIATE |
||||
) |
||||
|
||||
ENDMACRO(VTK_MAKE_INSTANTIATOR3) |
@ -0,0 +1,38 @@ |
||||
#include "@VTK_MAKE_INSTANTIATOR_CLASS_NAME@.h" |
||||
|
||||
@CXX_CONTENTS@ |
||||
|
||||
|
||||
void @VTK_MAKE_INSTANTIATOR_CLASS_NAME@::ClassInitialize() |
||||
{ |
||||
|
||||
@CXX_CONTENTS2@ |
||||
|
||||
} |
||||
|
||||
void @VTK_MAKE_INSTANTIATOR_CLASS_NAME@::ClassFinalize() |
||||
{
|
||||
|
||||
@CXX_CONTENTS3@ |
||||
|
||||
} |
||||
|
||||
@VTK_MAKE_INSTANTIATOR_CLASS_NAME@::@VTK_MAKE_INSTANTIATOR_CLASS_NAME@() |
||||
{ |
||||
if(++@VTK_MAKE_INSTANTIATOR_CLASS_NAME@::Count == 1) |
||||
{
|
||||
@VTK_MAKE_INSTANTIATOR_CLASS_NAME@::ClassInitialize();
|
||||
} |
||||
} |
||||
|
||||
@VTK_MAKE_INSTANTIATOR_CLASS_NAME@::~@VTK_MAKE_INSTANTIATOR_CLASS_NAME@() |
||||
{ |
||||
if(--@VTK_MAKE_INSTANTIATOR_CLASS_NAME@::Count == 0) |
||||
{
|
||||
@VTK_MAKE_INSTANTIATOR_CLASS_NAME@::ClassFinalize();
|
||||
} |
||||
} |
||||
|
||||
// Number of translation units that include this class's header.
|
||||
// Purposely not initialized. Default is static initialization to 0.
|
||||
unsigned int @VTK_MAKE_INSTANTIATOR_CLASS_NAME@::Count; |
@ -0,0 +1,21 @@ |
||||
#ifndef __@VTK_MAKE_INSTANTIATOR_CLASS_NAME@_h |
||||
#define __@VTK_MAKE_INSTANTIATOR_CLASS_NAME@_h |
||||
|
||||
#include "vtkInstantiator.h" |
||||
|
||||
@HEADER_CONTENTS@ |
||||
|
||||
class @VTK_MAKE_INSTANTIATOR_EXPORT_MACRO@ @VTK_MAKE_INSTANTIATOR_CLASS_NAME@ |
||||
{ |
||||
public: |
||||
@VTK_MAKE_INSTANTIATOR_CLASS_NAME@(); |
||||
~@VTK_MAKE_INSTANTIATOR_CLASS_NAME@(); |
||||
private: |
||||
static void ClassInitialize(); |
||||
static void ClassFinalize(); |
||||
static unsigned int Count; |
||||
};
|
||||
|
||||
static @VTK_MAKE_INSTANTIATOR_CLASS_NAME@ @VTK_MAKE_INSTANTIATOR_CLASS_NAME@Initializer; |
||||
|
||||
#endif |
@ -0,0 +1,67 @@ |
||||
IF(NOT VTK_SHARED_LIBRARIES_SELECTED) |
||||
SET(VTK_SHARED_LIBRARIES_SELECTED 1) |
||||
|
||||
# We need the VTK_DEPENDENT_OPTION macro. |
||||
INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkDependentOption.cmake) |
||||
|
||||
# Choose static or shared libraries. |
||||
OPTION(BUILD_SHARED_LIBS "Build VTK with shared libraries." OFF) |
||||
SET(VTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) |
||||
|
||||
# On platforms that support rpath users may want to use them to make |
||||
# running VTK from the build tree easy. It is not safe to install |
||||
# programs built with an rpath pointing at the build tree, so we must |
||||
# disable install support when using the rpath feature. |
||||
IF(NOT WIN32) |
||||
# Choose whether to use the rpath feature. Parent projects may |
||||
# set VTK_FORCE_RPATH to force the value on or off without providing |
||||
# the option. |
||||
IF(VTK_FORCE_RPATH) |
||||
SET(VTK_USE_RPATH ${VTK_FORCE_RPATH}) |
||||
ELSE(VTK_FORCE_RPATH) |
||||
IF("VTK_USE_RPATH_DEFAULT" MATCHES "^VTK_USE_RPATH_DEFAULT$") |
||||
# Choosing a default value for this option is tricky. Dashboard |
||||
# scripts need to have this ON or set the LD_LIBRARY_PATH, which at |
||||
# the time of this writing none does. Therefore the default must be |
||||
# ON. However, users that download a VTK release to build and install |
||||
# it will not know to turn this OFF and will be confused when they get |
||||
# an empty installation. One solution to this dilema is to note that |
||||
# users that do not know what they are doing will generally use a |
||||
# release. Dashboards use the latest development version. Users that |
||||
# checkout from the CVS head will usually run from the build tree or |
||||
# at least understand this option. Therefore a simple decision |
||||
# criterion is whether VTK_MINOR_VERSION is odd or even. |
||||
IF(VTK_MINOR_VERSION MATCHES "[02468]$") |
||||
# This is a release version. Default to not use rpath. |
||||
SET(VTK_USE_RPATH_DEFAULT OFF) |
||||
ELSE(VTK_MINOR_VERSION MATCHES "[02468]$") |
||||
# This is a development version. Default to use rpath. |
||||
SET(VTK_USE_RPATH_DEFAULT ON) |
||||
ENDIF(VTK_MINOR_VERSION MATCHES "[02468]$") |
||||
ENDIF("VTK_USE_RPATH_DEFAULT" MATCHES "^VTK_USE_RPATH_DEFAULT$") |
||||
VTK_DEPENDENT_OPTION(VTK_USE_RPATH "Build shared libraries with rpath. This makes it easy to run executables from the build tree when using shared libraries, but removes install support." |
||||
${VTK_USE_RPATH_DEFAULT} |
||||
"BUILD_SHARED_LIBS" OFF) |
||||
ENDIF(VTK_FORCE_RPATH) |
||||
|
||||
# Configure VTK according to the rpath setting. |
||||
IF(VTK_USE_RPATH) |
||||
# We will use rpath support. Tell CMake not to skip it. |
||||
SET(CMAKE_SKIP_RPATH 0 CACHE INTERNAL "Whether to build with rpath." FORCE) |
||||
|
||||
# If someone is trying to install do not do an entire build with |
||||
# the wrong rpath feature setting just to report failed |
||||
# installation. |
||||
SET(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) |
||||
|
||||
# Add a dummy target and attach an install rule that will always fail |
||||
# and produce a message explaining why installation is disabled. |
||||
ADD_CUSTOM_TARGET(vtk_install_disabled) |
||||
SET_TARGET_PROPERTIES(vtk_install_disabled PROPERTIES |
||||
PRE_INSTALL_SCRIPT ${VTK_SOURCE_DIR}/CMake/InstallDisabled.cmake) |
||||
ELSE(VTK_USE_RPATH) |
||||
# We will not use rpath support. Tell CMake to skip it. |
||||
SET(CMAKE_SKIP_RPATH 1 CACHE INTERNAL "Whether to build with rpath." FORCE) |
||||
ENDIF(VTK_USE_RPATH) |
||||
ENDIF(NOT WIN32) |
||||
ENDIF(NOT VTK_SHARED_LIBRARIES_SELECTED) |
@ -0,0 +1,62 @@ |
||||
# Include CHECK_INCLUDE_FILE_CXX macro used by this macro. |
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake) |
||||
|
||||
#----------------------------------------------------------------------------- |
||||
# Macro to select whether to use old streams or ANSI streams. |
||||
# Argument is the variable to set with the result (VTK_USE_ANSI_STDLIB). |
||||
MACRO(VTK_SELECT_STREAMS_LIBRARY var VTK_SOURCE_DIR) |
||||
IF("${var}" MATCHES "^${var}$") |
||||
CHECK_INCLUDE_FILE_CXX("iosfwd" VTK_HAVE_ANSI_STREAMS) |
||||
CHECK_INCLUDE_FILE_CXX("iostream.h" VTK_HAVE_OLD_STREAMS) |
||||
IF(VTK_HAVE_OLD_STREAMS) |
||||
# Some compilers have iostream.h but not strstream.h |
||||
# or strstrea.h. Treat these as not having old streams. |
||||
CHECK_INCLUDE_FILE_CXX("strstrea.h" VTK_HAVE_OLD_STRSTREA_H) |
||||
CHECK_INCLUDE_FILE_CXX("strstream.h" VTK_HAVE_OLD_STRSTREAM_H) |
||||
IF(NOT VTK_HAVE_OLD_STRSTREAM_H) |
||||
IF(NOT VTK_HAVE_OLD_STRSTREA_H) |
||||
SET(VTK_HAVE_OLD_STREAMS 0) |
||||
ENDIF(NOT VTK_HAVE_OLD_STRSTREA_H) |
||||
ENDIF(NOT VTK_HAVE_OLD_STRSTREAM_H) |
||||
ENDIF(VTK_HAVE_OLD_STREAMS) |
||||
|
||||
IF(VTK_HAVE_ANSI_STREAMS AND VTK_HAVE_OLD_STREAMS) |
||||
# Have both old and new streams. Provide the option. |
||||
# Default to OFF for MSVC 6 and ON for all others. |
||||
SET(${var}_DEFAULT ON) |
||||
IF(NOT CMAKE_COMPILER_IS_GNUCXX) |
||||
IF("VTK_COMPILER_IS_VC6" MATCHES "^VTK_COMPILER_IS_VC6$") |
||||
MESSAGE(STATUS "Checking if compiler is VC6") |
||||
TRY_COMPILE(VTK_COMPILER_IS_VC6 |
||||
${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp |
||||
${VTK_SOURCE_DIR}/CMake/vtkTestCompilerIsVC6.cxx |
||||
OUTPUT_VARIABLE OUTPUT) |
||||
IF(VTK_COMPILER_IS_VC6) |
||||
MESSAGE(STATUS "Checking if compiler is VC6 -- yes") |
||||
SET(VTK_COMPILER_IS_VC6 1 CACHE INTERNAL "Compiler is MSVC 6") |
||||
ELSE(VTK_COMPILER_IS_VC6) |
||||
MESSAGE(STATUS "Checking if compiler is VC6 -- no") |
||||
SET(VTK_COMPILER_IS_VC6 0 CACHE INTERNAL "Compiler is MSVC 6") |
||||
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log |
||||
"Determining if the compiler is MSVC 6 " |
||||
"failed with the following output:\n" |
||||
"${OUTPUT}\n" APPEND) |
||||
ENDIF(VTK_COMPILER_IS_VC6) |
||||
ENDIF("VTK_COMPILER_IS_VC6" MATCHES "^VTK_COMPILER_IS_VC6$") |
||||
IF(VTK_COMPILER_IS_VC6) |
||||
SET(${var}_DEFAULT OFF) |
||||
ENDIF(VTK_COMPILER_IS_VC6) |
||||
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) |
||||
OPTION(${var} "Use the ANSI standard iostream library." ${${var}_DEFAULT}) |
||||
MARK_AS_ADVANCED(${var}) |
||||
ELSE(VTK_HAVE_ANSI_STREAMS AND VTK_HAVE_OLD_STREAMS) |
||||
IF(VTK_HAVE_ANSI_STREAMS) |
||||
# Have only new streams. Use them. |
||||
SET(${var} ON) |
||||
ELSE(VTK_HAVE_ANSI_STREAMS) |
||||
# Have only old streams. Use them. |
||||
SET(${var} OFF) |
||||
ENDIF(VTK_HAVE_ANSI_STREAMS) |
||||
ENDIF(VTK_HAVE_ANSI_STREAMS AND VTK_HAVE_OLD_STREAMS) |
||||
ENDIF("${var}" MATCHES "^${var}$") |
||||
ENDMACRO(VTK_SELECT_STREAMS_LIBRARY var) |
@ -0,0 +1,259 @@ |
||||
# ---------------------------------------------------------------------------- |
||||
# VTK_GET_TCL_TK_VERSION |
||||
# Return the major/minor version of the Tcl/Tk library used by VTK. |
||||
# |
||||
# in: tcl_tk_major_version: name of the var the major version is written to |
||||
# tcl_tk_minor_version: name of the var the minor version is written to |
||||
# |
||||
# ex: VTK_GET_TCL_TK_VERSION ("TCL_TK_MAJOR_VERSION" "TCL_TK_MINOR_VERSION") |
||||
# SET (TCL_TK_VERSION "${TCL_TK_MAJOR_VERSION}.${TCL_TK_MINOR_VERSION}") |
||||
|
||||
MACRO (VTK_GET_TCL_TK_VERSION tcl_tk_major_version tcl_tk_minor_version) |
||||
|
||||
# Try to find the current Tcl/Tk version by matching TK_INTERNAL_PATH |
||||
# or TCL_LIBRARY against some version numbers |
||||
|
||||
SET (${tcl_tk_major_version} "") |
||||
SET (${tcl_tk_minor_version} "") |
||||
IF (TK_INTERNAL_PATH) |
||||
SET (try_tk_internal_path ${TK_INTERNAL_PATH}) |
||||
ELSE (TK_INTERNAL_PATH) |
||||
SET (try_tk_internal_path ${VTK_TK_INTERNAL_DIR}) |
||||
ENDIF (TK_INTERNAL_PATH) |
||||
FOREACH (tcl_tk_minor_version_try "2" "3" "4") |
||||
IF ("${try_tk_internal_path}" MATCHES "tk8\\.?${tcl_tk_minor_version_try}") |
||||
SET (${tcl_tk_major_version} "8") |
||||
SET (${tcl_tk_minor_version} ${tcl_tk_minor_version_try}) |
||||
ENDIF ("${try_tk_internal_path}" MATCHES "tk8\\.?${tcl_tk_minor_version_try}") |
||||
IF ("${TCL_LIBRARY}" MATCHES "tcl8\\.?${tcl_tk_minor_version_try}") |
||||
SET (${tcl_tk_major_version} "8") |
||||
SET (${tcl_tk_minor_version} ${tcl_tk_minor_version_try}) |
||||
ENDIF ("${TCL_LIBRARY}" MATCHES "tcl8\\.?${tcl_tk_minor_version_try}") |
||||
IF ("${TCL_INCLUDE_PATH}" MATCHES "tcl8\\.?${tcl_tk_minor_version_try}") |
||||
SET (${tcl_tk_major_version} "8") |
||||
SET (${tcl_tk_minor_version} ${tcl_tk_minor_version_try}) |
||||
ENDIF ("${TCL_INCLUDE_PATH}" MATCHES "tcl8\\.?${tcl_tk_minor_version_try}") |
||||
# Mac |
||||
IF ("${TCL_INCLUDE_PATH}" MATCHES "Tcl.*8\\.${tcl_tk_minor_version_try}") |
||||
SET (${tcl_tk_major_version} "8") |
||||
SET (${tcl_tk_minor_version} ${tcl_tk_minor_version_try}) |
||||
ENDIF ("${TCL_INCLUDE_PATH}" MATCHES "Tcl.*8\\.${tcl_tk_minor_version_try}") |
||||
ENDFOREACH (tcl_tk_minor_version_try) |
||||
|
||||
FOREACH(dir ${TCL_INCLUDE_PATH}) |
||||
IF(EXISTS "${dir}/tcl.h") |
||||
FILE(READ "${TCL_INCLUDE_PATH}/tcl.h" tcl_include_file) |
||||
STRING(REGEX REPLACE |
||||
".*#define TCL_VERSION[ \t]*\"([0-9][0-9]*\\.[0-9][0-9]*)\".*" "\\1" |
||||
tcl_include_file "${tcl_include_file}") |
||||
IF(${tcl_include_file} MATCHES "^[0-9]*\\.[0-9]*$") |
||||
STRING(REGEX REPLACE "^([0-9]*)\\.([0-9]*)$" "\\1" "${tcl_tk_major_version}" |
||||
"${tcl_include_file}") |
||||
STRING(REGEX REPLACE "^([0-9]*)\\.([0-9]*)$" "\\2" "${tcl_tk_minor_version}" |
||||
"${tcl_include_file}") |
||||
ENDIF(${tcl_include_file} MATCHES "^[0-9]*\\.[0-9]*$") |
||||
ENDIF(EXISTS "${dir}/tcl.h") |
||||
ENDFOREACH(dir) |
||||
|
||||
ENDMACRO (VTK_GET_TCL_TK_VERSION) |
||||
|
||||
# ---------------------------------------------------------------------------- |
||||
# VTK_GET_TCL_SUPPORT_FILES, VTK_GET_TK_SUPPORT_FILES |
||||
# Get a list of Tcl/Tk support files for a given Tcl/Tk repository. |
||||
# Tcl/Tk support files are additional files that are mandatory for Tcl/Tk |
||||
# to work properly. Linking against Tcl/Tk shared/static library is just |
||||
# not enough, Tcl/Tk needs to access those files at run-time. |
||||
# A typical Tcl/Tk installation will store support files in sub-directories |
||||
# inside the Tcl/Tk lib directory, organized by version number. |
||||
# Example: |
||||
# c:/tcl/lib/tcl8.4 |
||||
# c:/tcl/lib/tcl8.3 |
||||
# c:/tcl/lib/tk8.4 |
||||
# c:/tcl/lib/tk8.3 |
||||
# A typical source repository is organized differently: |
||||
# c:/tcl8.4.5/library |
||||
# c:/tk8.4.5/library |
||||
# Given the path to the Tcl support lib dir, VTK_GET_TCL_SUPPORT_FILES will |
||||
# return the corresponding list of support files. |
||||
# Given the path to the Tk support lib dir, VTK_GET_TK_SUPPORT_FILES will |
||||
# return the corresponding list of support files. |
||||
# |
||||
# in: support_lib_dir: path to the Tcl (or Tk) support lib dir |
||||
# list: name of the var the list is written to |
||||
|
||||
MACRO (VTK_GET_TCL_SUPPORT_FILES tcl_support_lib_dir list) |
||||
|
||||
# Tcl support files (*.tcl + encoding + tclIndex, etc.) |
||||
|
||||
FILE (GLOB TCL_SUPPORT_FILES_TCL "${tcl_support_lib_dir}/*.tcl") |
||||
FILE (GLOB TCL_SUPPORT_FILES_ENC "${tcl_support_lib_dir}/encoding/*.enc") |
||||
SET (${list} |
||||
"${tcl_support_lib_dir}/tclIndex" |
||||
${TCL_SUPPORT_FILES_TCL} |
||||
${TCL_SUPPORT_FILES_ENC}) |
||||
|
||||
ENDMACRO (VTK_GET_TCL_SUPPORT_FILES) |
||||
|
||||
MACRO (VTK_GET_TK_SUPPORT_FILES tk_support_lib_dir list) |
||||
|
||||
# Tk support files (*.tcl + tclIndex, etc.) |
||||
|
||||
FILE (GLOB TK_SUPPORT_FILES_TCL "${tk_support_lib_dir}/*.tcl") |
||||
SET (${list} |
||||
"${tk_support_lib_dir}/tclIndex" |
||||
${TK_SUPPORT_FILES_TCL}) |
||||
|
||||
ENDMACRO (VTK_GET_TK_SUPPORT_FILES) |
||||
|
||||
# ---------------------------------------------------------------------------- |
||||
# VTK_COPY_TCL_TK_SUPPORT_FILES |
||||
# Copy (or install) Tcl/Tk support files to a specific location. |
||||
# See VTK_GET_TCL_SUPPORT_FILES for more info about support files. |
||||
# Given the paths to the Tcl and Tk support lib dirs, this macro will |
||||
# copy (or install) the appropriate support files to destination dirs, |
||||
# recreating the subdirs. |
||||
# This macro takes an optional last parameter, if set to INSTALL the |
||||
# files will be scheduled for installation (using CMake's INSTALL_FILES) |
||||
# instead of copied. |
||||
# |
||||
# in: tcl_support_lib_dir: path to the Tcl support lib dir |
||||
# tcl_support_lib_dest: destination dir for the Tcl support lib files |
||||
# tk_support_lib_dir: path to the Tk support lib dir |
||||
# tk_support_lib_dest: destination dir for the Tk support lib files |
||||
# INSTALL: optional parameter (install files instead of copy) |
||||
# |
||||
# ex: VTK_COPY_TCL_TK_SUPPORT_FILES ( |
||||
# "c:/tcl/lib/tcl8.4" "d:/vtk-bin/TclTk/lib/tcl8.4" |
||||
# "c:/tcl/lib/tk8.4" "d:/vtk-bin/TclTk/lib/tk8.4") |
||||
# this will copy support files from: |
||||
# c:/tcl/lib/tcl8.4 |
||||
# c:/tcl/lib/tk8.4 |
||||
# to: |
||||
# d:/vtk-bin/TclTk/lib/tcl8.4 |
||||
# d:/vtk-bin/TclTk/lib/tk8.4 |
||||
|
||||
MACRO (VTK_COPY_TCL_TK_SUPPORT_FILES tcl_support_lib_dir tcl_support_lib_dest tk_support_lib_dir tk_support_lib_dest) |
||||
|
||||
# Get the support files and copy them to dest dir |
||||
# Check if EXISTS to work around CONFIGURE_FILE bug (if file does not |
||||
# exist, it would create the subdirs anyway) |
||||
|
||||
VTK_GET_TCL_SUPPORT_FILES(${tcl_support_lib_dir} "TCL_SUPPORT_FILES") |
||||
FOREACH (file ${TCL_SUPPORT_FILES}) |
||||
IF (EXISTS ${file}) |
||||
STRING (REGEX REPLACE "${tcl_support_lib_dir}/" "" filebase ${file}) |
||||
IF ("${ARGV4}" STREQUAL "INSTALL") |
||||
GET_FILENAME_COMPONENT(dir ${filebase} PATH) |
||||
INSTALL_FILES ("${tcl_support_lib_dest}/${dir}" FILES ${file}) |
||||
ELSE ("${ARGV4}" STREQUAL "INSTALL") |
||||
CONFIGURE_FILE (${file} "${tcl_support_lib_dest}/${filebase}" COPYONLY) |
||||
ENDIF ("${ARGV4}" STREQUAL "INSTALL") |
||||
ENDIF (EXISTS ${file}) |
||||
ENDFOREACH (file) |
||||
|
||||
VTK_GET_TK_SUPPORT_FILES(${tk_support_lib_dir} "TK_SUPPORT_FILES") |
||||
FOREACH (file ${TK_SUPPORT_FILES}) |
||||
IF (EXISTS ${file}) |
||||
STRING (REGEX REPLACE "${tk_support_lib_dir}/" "" filebase ${file}) |
||||
IF ("${ARGV4}" STREQUAL "INSTALL") |
||||
GET_FILENAME_COMPONENT(dir ${filebase} PATH) |
||||
INSTALL_FILES ("${tk_support_lib_dest}/${dir}" FILES ${file}) |
||||
ELSE ("${ARGV4}" STREQUAL "INSTALL") |
||||
CONFIGURE_FILE (${file} "${tk_support_lib_dest}/${filebase}" COPYONLY) |
||||
ENDIF ("${ARGV4}" STREQUAL "INSTALL") |
||||
ENDIF (EXISTS ${file}) |
||||
ENDFOREACH (file) |
||||
|
||||
ENDMACRO (VTK_COPY_TCL_TK_SUPPORT_FILES) |
||||
|
||||
# ---------------------------------------------------------------------------- |
||||
# VTK_COPY_TCL_TK_SUPPORT_FILES_TO_DIR |
||||
# Front-end to VTK_COPY_TCL_TK_SUPPORT_FILES, this macro will |
||||
# copy (or install) the appropriate Tcl/Tk support files to a directory. |
||||
# The Tcl/Tk version is retrieved automatically and used to create |
||||
# the subdirectories (see example below) |
||||
# This macro takes an optional last parameter, if set to INSTALL the |
||||
# files will be scheduled for installation (using CMake's INSTALL_FILES) |
||||
# instead of copied. |
||||
# |
||||
# in: tcl_support_lib_dir: path to the Tcl support lib dir |
||||
# tk_support_lib_dir: path to the Tk support lib dir |
||||
# target_dir: target directory |
||||
# INSTALL: optional parameter (install files instead of copy) |
||||
# |
||||
# ex: VTK_COPY_TCL_TK_SUPPORT_FILES_TO_DIR ( |
||||
# "c:/tcl/lib/tcl8.4" "c:/tcl/lib/tk8.4" "d:/vtk-bin/lib") |
||||
# if this project is configured to use TclTk 8.4, this will copy support |
||||
# files from: |
||||
# c:/tcl/lib/tcl8.4 |
||||
# c:/tcl/lib/tk8.4 |
||||
# to: |
||||
# d:/vtk-bin/lib/tcl8.4 |
||||
# d:/vtk-bin/lib/tk8.4 |
||||
|
||||
MACRO (VTK_COPY_TCL_TK_SUPPORT_FILES_TO_DIR tcl_support_lib_dir tk_support_lib_dir target_dir) |
||||
VTK_GET_TCL_TK_VERSION ("TCL_TK_MAJOR_VERSION" "TCL_TK_MINOR_VERSION") |
||||
IF (TCL_TK_MAJOR_VERSION AND TCL_TK_MINOR_VERSION) |
||||
SET (TCL_TK_VERSION "${TCL_TK_MAJOR_VERSION}.${TCL_TK_MINOR_VERSION}") |
||||
VTK_COPY_TCL_TK_SUPPORT_FILES ( |
||||
"${tcl_support_lib_dir}" |
||||
"${target_dir}/tcl${TCL_TK_VERSION}" |
||||
"${tk_support_lib_dir}" |
||||
"${target_dir}/tk${TCL_TK_VERSION}" |
||||
"${ARGV3}" |
||||
) |
||||
ENDIF (TCL_TK_MAJOR_VERSION AND TCL_TK_MINOR_VERSION) |
||||
|
||||
ENDMACRO (VTK_COPY_TCL_TK_SUPPORT_FILES_TO_DIR) |
||||
|
||||
# ---------------------------------------------------------------------------- |
||||
# VTK_COPY_TCL_TK_SUPPORT_FILES_TO_BUILD_DIR |
||||
# Front-end to VTK_COPY_TCL_TK_SUPPORT_FILES_TO_DIR, this macro will copy the |
||||
# appropriate Tcl/Tk support files to a project build directory. |
||||
# The support files will be copied simultaneously to all configuration |
||||
# sub-directories (Release, RelInfo, Debug, etc.) if needed. |
||||
# The Tcl/Tk version is retrieved automatically and used to create |
||||
# the subdirectories (see example below) |
||||
# |
||||
# in: tcl_support_lib_dir: path to the Tcl support lib dir |
||||
# tk_support_lib_dir: path to the Tk support lib dir |
||||
# build_dir: project build dir |
||||
# dir: relative subdir inside the build dir, into which the |
||||
# support files will be copied. |
||||
# |
||||
# ex: VTK_COPY_TCL_TK_SUPPORT_FILES_TO_BUILD_DIR ( |
||||
# "c:/tcl/lib/tcl8.4" "c:/tcl/lib/tk8.4" "d:/vtk-bin" "TclTk/lib") |
||||
# if this project is configured to use TclTk 8.4, this will copy support |
||||
# files from: |
||||
# c:/tcl/lib/tcl8.4 |
||||
# c:/tcl/lib/tk8.4 |
||||
# to: |
||||
# d:/vtk-bin/TclTk/lib/tcl8.4 |
||||
# d:/vtk-bin/TclTk/lib/tk8.4 |
||||
# or (if configuration types are supported by the generator): |
||||
# d:/vtk-bin/Release/TclTk/lib/tcl8.4 |
||||
# d:/vtk-bin/Release/TclTk/lib/tk8.4 |
||||
# d:/vtk-bin/Debug/TclTk/lib/tcl8.4 |
||||
# d:/vtk-bin/Debug/TclTk/lib/tk8.4 |
||||
# etc. |
||||
|
||||
MACRO (VTK_COPY_TCL_TK_SUPPORT_FILES_TO_BUILD_DIR tcl_support_lib_dir tk_support_lib_dir build_dir dir) |
||||
|
||||
# For each configuration type (Debug, RelInfo, Release, etc.) |
||||
# Copy the TclTk support files to the corresponding sub-directory inside |
||||
# the build dir |
||||
|
||||
IF (CMAKE_CONFIGURATION_TYPES) |
||||
SET (CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) |
||||
ELSE (CMAKE_CONFIGURATION_TYPES) |
||||
SET (CONFIG_TYPES .) |
||||
ENDIF (CMAKE_CONFIGURATION_TYPES) |
||||
FOREACH (config ${CONFIG_TYPES}) |
||||
VTK_COPY_TCL_TK_SUPPORT_FILES_TO_DIR ( |
||||
"${tcl_support_lib_dir}" |
||||
"${tk_support_lib_dir}" |
||||
"${build_dir}/${config}/${dir}" |
||||
) |
||||
ENDFOREACH (config) |
||||
|
||||
ENDMACRO (VTK_COPY_TCL_TK_SUPPORT_FILES_TO_BUILD_DIR) |
@ -0,0 +1,9 @@ |
||||
// Minimal test for existence of "bool" type.
|
||||
void TestBool(bool) {} |
||||
|
||||
int main() |
||||
{ |
||||
TestBool(false); |
||||
TestBool(true); |
||||
return 0; |
||||
} |
@ -0,0 +1,6 @@ |
||||
/* Return 1 for char signed and 0 for char unsigned. */ |
||||
int main() |
||||
{ |
||||
unsigned char uc = 255; |
||||
return (*reinterpret_cast<char*>(&uc) < 0)?1:0; |
||||
} |
@ -0,0 +1,28 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: vtkTestCompareTypes.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
#define TYPE_LONG_LONG long long |
||||
|
||||
typedef VTK_TEST_COMPARE_TYPE_1 Type1; |
||||
typedef VTK_TEST_COMPARE_TYPE_2 Type2; |
||||
|
||||
void function(Type1**) {} |
||||
|
||||
int main() |
||||
{ |
||||
Type2** p = 0; |
||||
function(p); |
||||
return 0; |
||||
} |
@ -0,0 +1,7 @@ |
||||
/* Compile if this is MSVC 6. */ |
||||
#if defined(_MSC_VER) && (_MSC_VER == 1200) |
||||
int main() |
||||
{ |
||||
return 0; |
||||
} |
||||
#endif |
@ -0,0 +1,32 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: vtkTestConvertTypes.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
#define TYPE_UNSIGNED___INT64 unsigned __int64 |
||||
|
||||
typedef VTK_TEST_CONVERT_TYPE_TO TypeTo; |
||||
typedef VTK_TEST_CONVERT_TYPE_FROM TypeFrom; |
||||
|
||||
void function(TypeTo& l, TypeFrom const& r) |
||||
{ |
||||
l = static_cast<TypeTo>(r); |
||||
} |
||||
|
||||
int main() |
||||
{ |
||||
TypeTo tTo = TypeTo(); |
||||
TypeFrom tFrom = TypeFrom(); |
||||
function(tTo, tFrom); |
||||
return 0; |
||||
} |
@ -0,0 +1,56 @@ |
||||
# Test whether the compiler supports explicit template instantiation. |
||||
# This actually creates a class template instantiation in one source |
||||
# file and tries to use it from another. This approach checks that |
||||
# both the instantiation syntax and symbol linkage is handled |
||||
# properly. |
||||
IF("VTK_EXPLICIT_TEMPLATES" MATCHES "^VTK_EXPLICIT_TEMPLATES") |
||||
MESSAGE(STATUS "Checking support for C++ explicit template instantiation") |
||||
|
||||
MAKE_DIRECTORY(${VTK_BINARY_DIR}/CMakeTmp/TestExplicitInstantiation) |
||||
STRING(ASCII 35 POUND) |
||||
WRITE_FILE( |
||||
${VTK_BINARY_DIR}/CMakeTmp/TestExplicitInstantiation/CMakeLists.txt |
||||
"PROJECT(EXPLICIT)\n" |
||||
"ADD_LIBRARY(A A.cxx)\n" |
||||
"ADD_EXECUTABLE(B B.cxx)\n" |
||||
"TARGET_LINK_LIBRARIES(B A)\n" |
||||
) |
||||
WRITE_FILE( |
||||
${VTK_BINARY_DIR}/CMakeTmp/TestExplicitInstantiation/A.h |
||||
"${POUND}ifndef A_h\n" |
||||
"${POUND}define A_h\n" |
||||
"template <class T> class A { public: static T Method(); };\n" |
||||
"${POUND}endif\n" |
||||
) |
||||
WRITE_FILE( |
||||
${VTK_BINARY_DIR}/CMakeTmp/TestExplicitInstantiation/A.cxx |
||||
"${POUND}include \"A.h\"\n" |
||||
"template <class T> T A<T>::Method() { return 0; }\n" |
||||
"template class A<int>;" |
||||
) |
||||
WRITE_FILE( |
||||
${VTK_BINARY_DIR}/CMakeTmp/TestExplicitInstantiation/B.cxx |
||||
"${POUND}include \"A.h\"\n" |
||||
"int main() { return A<int>::Method(); }\n" |
||||
) |
||||
TRY_COMPILE(VTK_EXPLICIT_TEMPLATES |
||||
${VTK_BINARY_DIR}/CMakeTmp/TestExplicitInstantiation/Build |
||||
${VTK_BINARY_DIR}/CMakeTmp/TestExplicitInstantiation |
||||
EXPLICIT OUTPUT_VARIABLE OUTPUT |
||||
) |
||||
IF(VTK_EXPLICIT_TEMPLATES) |
||||
MESSAGE(STATUS "Checking support for C++ explicit template instantiation -- yes") |
||||
SET(VTK_EXPLICIT_TEMPLATES 1 CACHE INTERNAL "Support for C++ explict templates") |
||||
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log |
||||
"Determining if the C++ compiler supports explict template instantiation " |
||||
"passed with the following output:\n" |
||||
"${OUTPUT}\n" APPEND) |
||||
ELSE(VTK_EXPLICIT_TEMPLATES) |
||||
MESSAGE(STATUS "Checking support for C++ explicit template instantiation -- no") |
||||
SET(VTK_EXPLICIT_TEMPLATES 0 CACHE INTERNAL "Support for C++ explict templates") |
||||
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log |
||||
"Determining if the C++ compiler supports explict template instantiation " |
||||
"failed with the following output:\n" |
||||
"${OUTPUT}\n" APPEND) |
||||
ENDIF(VTK_EXPLICIT_TEMPLATES) |
||||
ENDIF("VTK_EXPLICIT_TEMPLATES" MATCHES "^VTK_EXPLICIT_TEMPLATES") |
@ -0,0 +1,6 @@ |
||||
template <class T> struct A {}; |
||||
template <> struct A<int*> |
||||
{ |
||||
static int f() { return 0; } |
||||
}; |
||||
int main() { return A<int*>::f(); } |
@ -0,0 +1,13 @@ |
||||
// Minimal test for existence of MPI_LONG_LONG
|
||||
|
||||
#include "mpi.h" |
||||
MPI_Datatype vtkMPICommunicatorGetMPIType() |
||||
{ |
||||
return MPI_LONG_LONG; |
||||
} |
||||
|
||||
int main() |
||||
{ |
||||
vtkMPICommunicatorGetMPIType(); |
||||
return 0; |
||||
} |
@ -0,0 +1,6 @@ |
||||
#if defined(_COMPILER_VERSION) && _COMPILER_VERSION == 742 |
||||
# include <cstdarg> |
||||
#endif |
||||
#include <stdarg.h> |
||||
void f(const char*, va_list); |
||||
int main() { return 0; } |
@ -0,0 +1,14 @@ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#if !defined(_WIN32) || defined(__CYGWIN__) |
||||
# include <sys/types.h> |
||||
# include <sys/socket.h> |
||||
#endif |
||||
|
||||
int main() |
||||
{ |
||||
/* Test whether getsockname takes socklen_t. */ |
||||
if(getsockname(0, 0, (socklen_t*)0)) return 0; |
||||
if(sizeof (socklen_t)) return 0; |
||||
return 0; |
||||
} |
@ -0,0 +1,139 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: vtkTestStreamEOF.cxx.in,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// Many C++ streams libraries have buggy conditions when reading
|
||||
// reaches the end of a file. When an ifstream attempts to read past
|
||||
// the end of the file, the "eof" and "fail" bits are set. Clearing
|
||||
// the fail bit should be enough to allow seekg() to work and tellg()
|
||||
// to report the file position. Some stream libraries have bugs in
|
||||
// this case. This source file tests the severity of the eof
|
||||
// conditions for a compiler.
|
||||
//
|
||||
// Severity levels are reported in terms of the extent of the
|
||||
// work-around required:
|
||||
//
|
||||
// 0 - No bug exists.
|
||||
// 1 - User must clear eof bit.
|
||||
// 2 - User must clear eof bit and re-seek to end.
|
||||
// 3 - User must clear eof bit and call _M_seek_return on the filebuf.
|
||||
// 126 - Could not open sample input file.
|
||||
// 127 - Unknown severity level.
|
||||
//
|
||||
// Severity level 3 is only known to exist for -LANG:std streams on
|
||||
// the SGI MIPSpro 7.30 - 7.3.1.1 compiler versions. The cause of the
|
||||
// bug is a code pattern like this:
|
||||
//
|
||||
// _M_in_error_mode = true;
|
||||
// while(!_M_in_error_mode) { _M_in_error_mode = false; }
|
||||
//
|
||||
// It requires directly calling a non-public member function in the
|
||||
// filebuf instance on the stream to escape the bad state.
|
||||
// Unfortunately there is no way to detect the patch level of the
|
||||
// compiler from the preprocessor, so we need to actually try the
|
||||
// call.
|
||||
|
||||
#if defined(__sgi) && !defined(__GNUC__) && defined(_COMPILER_VERSION) |
||||
# if _COMPILER_VERSION == 730 |
||||
# define VTK_SGI_730 |
||||
# endif |
||||
#endif |
||||
|
||||
#if defined(_MSC_VER) |
||||
# pragma warning (push, 1) |
||||
#endif |
||||
|
||||
// Include the streams library. Hack access to SGI stream
|
||||
// implementation for MIPSpro 7.3 compiler.
|
||||
#cmakedefine VTK_USE_ANSI_STDLIB |
||||
#if defined(VTK_USE_ANSI_STDLIB) |
||||
# if defined(VTK_SGI_730) |
||||
# define protected public |
||||
# define private public |
||||
# endif |
||||
# include <fstream> |
||||
using std::ifstream; |
||||
using std::ios; |
||||
# if defined(VTK_SGI_730) |
||||
# undef protected |
||||
# undef private |
||||
# endif |
||||
#else |
||||
# include <fstream.h> |
||||
#endif |
||||
|
||||
#if defined(_MSC_VER) |
||||
# pragma warning (pop) |
||||
#endif |
||||
|
||||
int main() |
||||
{ |
||||
const char* fname = "@VTK_TEST_STREAM_EOF_CXX@"; |
||||
|
||||
// Open the file.
|
||||
#if defined(_WIN32) |
||||
ifstream fin(fname, ios::binary | ios::in); |
||||
#else |
||||
ifstream fin(fname, ios::in); |
||||
#endif |
||||
|
||||
// Make sure we opened the file.
|
||||
if(!fin) |
||||
{ |
||||
return 126; |
||||
} |
||||
|
||||
// Go to eof in a way that exposes the bug everywhere.
|
||||
char c = 0; |
||||
fin.seekg(-1, ios::end); |
||||
while(fin.get(c)); |
||||
|
||||
// Clear the fail bit so tellg() is supposed to return something
|
||||
// other than -1.
|
||||
fin.clear(fin.rdstate() & ~ios::failbit); |
||||
if(fin.tellg() >= 0) |
||||
{ |
||||
// Nothing is wrong with eof for this streams library.
|
||||
return 0; |
||||
} |
||||
|
||||
// Some streams return -1 from tellg() if eof is set.
|
||||
fin.clear(fin.rdstate() & ~ios::failbit & ~ios::eofbit); |
||||
if(fin.tellg() >= 0) |
||||
{ |
||||
return 1; |
||||
} |
||||
|
||||
// Some streams still return -1 from tellg. Try seeking to get it
|
||||
// out of this strange state.
|
||||
fin.clear(fin.rdstate() & ~ios::failbit & ~ios::eofbit); |
||||
fin.seekg(0, ios::end); |
||||
if(fin.tellg() >= 0) |
||||
{ |
||||
return 2; |
||||
} |
||||
|
||||
// Only SGI 7.30 to 7.3.1.1 is known to get this far. Try to escape
|
||||
// the bad state.
|
||||
#if defined(VTK_USE_ANSI_STDLIB) && defined(VTK_SGI_730) |
||||
fin.clear(fin.rdstate() & ~ios::failbit & ~ios::eofbit); |
||||
fin.rdbuf()->_M_seek_return(0, 0); |
||||
if(fin.tellg() >= 0) |
||||
{ |
||||
return 3; |
||||
} |
||||
#endif |
||||
|
||||
return 127; |
||||
} |
@ -0,0 +1,60 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: vtkTestStreamLongLong.cxx.in,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
#if defined(_MSC_VER) |
||||
# pragma warning (push, 1) |
||||
#endif |
||||
|
||||
// Include the streams library.
|
||||
#cmakedefine VTK_USE_ANSI_STDLIB |
||||
#if defined(VTK_USE_ANSI_STDLIB) |
||||
# include <iostream> |
||||
using std::ostream; |
||||
using std::istream; |
||||
using std::cout; |
||||
using std::cin; |
||||
#else |
||||
# include <iostream.h> |
||||
#endif |
||||
|
||||
#if defined(_MSC_VER) |
||||
# pragma warning (pop) |
||||
#endif |
||||
|
||||
#if defined(VTK_TEST_OSTREAM_LONG_LONG) |
||||
int test_ostream(ostream& os, long long x) |
||||
{ |
||||
return (os << x)? 1:0; |
||||
} |
||||
#endif |
||||
|
||||
#if defined(VTK_TEST_ISTREAM_LONG_LONG) |
||||
int test_istream(istream& is, long long& x) |
||||
{ |
||||
return (is >> x)? 1:0; |
||||
} |
||||
#endif |
||||
|
||||
int main() |
||||
{ |
||||
#if defined(VTK_TEST_OSTREAM_LONG_LONG) |
||||
long long x = 0; |
||||
return test_ostream(cout, x); |
||||
#endif |
||||
#if defined(VTK_TEST_ISTREAM_LONG_LONG) |
||||
long long x; |
||||
return test_istream(cin, x); |
||||
#endif |
||||
} |
||||
|
@ -0,0 +1,9 @@ |
||||
#include "windows.h" |
||||
#include "vfw.h" |
||||
|
||||
int main() |
||||
{ |
||||
AVIFileInit(); |
||||
AVIFileExit(); |
||||
return 0; |
||||
} |
@ -0,0 +1,46 @@ |
||||
#include "windows.h" |
||||
#include "vfw.h" |
||||
|
||||
// Can vtkWin32VideoSource.cxx be compiled?
|
||||
// Test by using some of the structs in a class and
|
||||
// calling some of the functions Win32VideoSource
|
||||
// uses...
|
||||
|
||||
class vtkWin32VideoSourceInternal |
||||
{ |
||||
public: |
||||
vtkWin32VideoSourceInternal() {} |
||||
HWND CapWnd; |
||||
HWND ParentWnd; |
||||
CAPSTATUS CapStatus; |
||||
CAPDRIVERCAPS CapDriverCaps; |
||||
CAPTUREPARMS CaptureParms; |
||||
LPBITMAPINFO BitMapPtr; |
||||
}; |
||||
|
||||
int main() |
||||
{ |
||||
vtkWin32VideoSourceInternal internal; |
||||
|
||||
internal.CapWnd = capCreateCaptureWindow( |
||||
"Capture", WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, NULL, 1); |
||||
|
||||
// capDriverConnect
|
||||
// capDriverGetCaps
|
||||
// capCaptureGetSetup
|
||||
// capCaptureSetSetup
|
||||
|
||||
capSetUserData(internal.CapWnd, &internal); |
||||
|
||||
// capSetCallbackOnCapControl
|
||||
// capSetCallbackOnFrame
|
||||
// capSetCallbackOnVideoStream
|
||||
// capSetCallbackOnStatus
|
||||
// capSetCallbackOnError
|
||||
|
||||
(void) capOverlay(internal.CapWnd, TRUE); |
||||
|
||||
(void) capGetUserData(internal.CapWnd); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,53 @@ |
||||
#----------------------------------------------------------------------------- |
||||
MACRO(VTK_THIRD_PARTY_OPTION upper lower) |
||||
OPTION(VTK_USE_SYSTEM_${upper} "Use the system's ${lower} library." OFF) |
||||
MARK_AS_ADVANCED(VTK_USE_SYSTEM_${upper}) |
||||
IF(VTK_USE_SYSTEM_${upper}) |
||||
IF(EXISTS ${CMAKE_ROOT}/Modules/Find${upper}.cmake) |
||||
INCLUDE(${CMAKE_ROOT}/Modules/Find${upper}.cmake) |
||||
ELSE(EXISTS ${CMAKE_ROOT}/Modules/Find${upper}.cmake) |
||||
INCLUDE(${VTK_SOURCE_DIR}/CMake/Find${upper}.cmake) |
||||
ENDIF(EXISTS ${CMAKE_ROOT}/Modules/Find${upper}.cmake) |
||||
MARK_AS_ADVANCED(${upper}_INCLUDE_DIR ${upper}_LIBRARY) |
||||
IF(${upper}_FOUND) |
||||
SET(VTK_${upper}_LIBRARIES ${${upper}_LIBRARIES}) |
||||
IF("${upper}" MATCHES "^PNG$") |
||||
SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR}) |
||||
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR) |
||||
ENDIF("${upper}" MATCHES "^PNG$") |
||||
ELSE(${upper}_FOUND) |
||||
MESSAGE(SEND_ERROR "VTK_USE_SYSTEM_${upper} is ON, but ${upper}_LIBRARY is NOTFOUND.") |
||||
ENDIF(${upper}_FOUND) |
||||
ELSE(VTK_USE_SYSTEM_${upper}) |
||||
SET(VTK_${upper}_LIBRARIES vtk${lower}) |
||||
ENDIF(VTK_USE_SYSTEM_${upper}) |
||||
ENDMACRO(VTK_THIRD_PARTY_OPTION) |
||||
|
||||
#----------------------------------------------------------------------------- |
||||
MACRO(VTK_THIRD_PARTY_INCLUDE upper lower) |
||||
IF(VTK_USE_SYSTEM_${upper}) |
||||
IF(${upper}_INCLUDE_DIR) |
||||
SET(VTK_INCLUDE_DIRS_SYSTEM ${VTK_INCLUDE_DIRS_SYSTEM} ${${upper}_INCLUDE_DIR}) |
||||
ENDIF(${upper}_INCLUDE_DIR) |
||||
ELSE(VTK_USE_SYSTEM_${upper}) |
||||
SET(VTK_INCLUDE_DIRS_SOURCE_TREE ${VTK_INCLUDE_DIRS_SOURCE_TREE} |
||||
${VTK_BINARY_DIR}/Utilities/${lower} |
||||
${VTK_SOURCE_DIR}/Utilities/${lower} |
||||
) |
||||
ENDIF(VTK_USE_SYSTEM_${upper}) |
||||
ENDMACRO(VTK_THIRD_PARTY_INCLUDE) |
||||
|
||||
MACRO(VTK_THIRD_PARTY_INCLUDE2 upper) |
||||
IF(VTK_USE_SYSTEM_${upper}) |
||||
IF(${upper}_INCLUDE_DIR) |
||||
SET(VTK_INCLUDE_DIRS_SYSTEM ${VTK_INCLUDE_DIRS_SYSTEM} ${${upper}_INCLUDE_DIR}) |
||||
ENDIF(${upper}_INCLUDE_DIR) |
||||
ENDIF(VTK_USE_SYSTEM_${upper}) |
||||
ENDMACRO(VTK_THIRD_PARTY_INCLUDE2) |
||||
|
||||
#----------------------------------------------------------------------------- |
||||
MACRO(VTK_THIRD_PARTY_SUBDIR upper lower) |
||||
IF(NOT VTK_USE_SYSTEM_${upper}) |
||||
SUBDIRS(${lower}) |
||||
ENDIF(NOT VTK_USE_SYSTEM_${upper}) |
||||
ENDMACRO(VTK_THIRD_PARTY_SUBDIR) |
@ -0,0 +1,129 @@ |
||||
# |
||||
# a cmake implementation of the Wrap Java command |
||||
# |
||||
|
||||
MACRO(VTK_WRAP_JAVA3 TARGET SRC_LIST_NAME SOURCES) |
||||
IF(NOT VTK_PARSE_JAVA_EXE) |
||||
MESSAGE(SEND_ERROR "VTK_PARSE_JAVA_EXE not specified when calling VTK_WRAP_JAVA3") |
||||
ENDIF(NOT VTK_PARSE_JAVA_EXE) |
||||
IF(NOT VTK_WRAP_JAVA_EXE) |
||||
MESSAGE(SEND_ERROR "VTK_WRAP_JAVA_EXE not specified when calling VTK_WRAP_JAVA3") |
||||
ENDIF(NOT VTK_WRAP_JAVA_EXE) |
||||
# for new cmake use the new custom commands |
||||
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6) |
||||
|
||||
# Initialize the custom target counter. |
||||
IF(VTK_WRAP_JAVA_NEED_CUSTOM_TARGETS) |
||||
SET(VTK_WRAP_JAVA_CUSTOM_COUNT "") |
||||
SET(VTK_WRAP_JAVA_CUSTOM_NAME ${TARGET}) |
||||
SET(VTK_WRAP_JAVA_CUSTOM_LIST) |
||||
ENDIF(VTK_WRAP_JAVA_NEED_CUSTOM_TARGETS) |
||||
|
||||
SET(VTK_JAVA_DEPENDENCIES) |
||||
SET(VTK_JAVA_DEPENDENCIES_FILE) |
||||
# For each class |
||||
FOREACH(FILE ${SOURCES}) |
||||
# should we wrap the file? |
||||
GET_SOURCE_FILE_PROPERTY(TMP_WRAP_EXCLUDE ${FILE} WRAP_EXCLUDE) |
||||
|
||||
# if we should wrap it |
||||
IF (NOT TMP_WRAP_EXCLUDE) |
||||
|
||||
# what is the filename without the extension |
||||
GET_FILENAME_COMPONENT(TMP_FILENAME ${FILE} NAME_WE) |
||||
|
||||
# the input file might be full path so handle that |
||||
GET_FILENAME_COMPONENT(TMP_FILEPATH ${FILE} PATH) |
||||
|
||||
# compute the input filename |
||||
IF (TMP_FILEPATH) |
||||
SET(TMP_INPUT ${TMP_FILEPATH}/${TMP_FILENAME}.h) |
||||
ELSE (TMP_FILEPATH) |
||||
SET(TMP_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${TMP_FILENAME}.h) |
||||
ENDIF (TMP_FILEPATH) |
||||
|
||||
# is it abstract? |
||||
GET_SOURCE_FILE_PROPERTY(TMP_ABSTRACT ${FILE} ABSTRACT) |
||||
IF (TMP_ABSTRACT) |
||||
SET(TMP_CONCRETE 0) |
||||
ELSE (TMP_ABSTRACT) |
||||
SET(TMP_CONCRETE 1) |
||||
ENDIF (TMP_ABSTRACT) |
||||
|
||||
# new source file is nameJava.cxx, add to resulting list |
||||
SET(${SRC_LIST_NAME} ${${SRC_LIST_NAME}} |
||||
${TMP_FILENAME}Java.cxx) |
||||
|
||||
# add custom command to output |
||||
ADD_CUSTOM_COMMAND( |
||||
OUTPUT ${VTK_JAVA_HOME}/${TMP_FILENAME}.java |
||||
DEPENDS ${VTK_PARSE_JAVA_EXE} ${VTK_WRAP_HINTS} ${TMP_INPUT} |
||||
COMMAND ${VTK_PARSE_JAVA_EXE} |
||||
ARGS ${TMP_INPUT} ${VTK_WRAP_HINTS} ${TMP_CONCRETE} |
||||
${VTK_JAVA_HOME}/${TMP_FILENAME}.java |
||||
COMMENT "Java Wrappings" |
||||
) |
||||
|
||||
# add custom command to output |
||||
ADD_CUSTOM_COMMAND( |
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Java.cxx |
||||
DEPENDS ${VTK_WRAP_JAVA_EXE} ${VTK_WRAP_HINTS} ${TMP_INPUT} |
||||
COMMAND ${VTK_WRAP_JAVA_EXE} |
||||
ARGS ${TMP_INPUT} ${VTK_WRAP_HINTS} ${TMP_CONCRETE} |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Java.cxx |
||||
COMMENT "Java Wrappings" |
||||
) |
||||
|
||||
SET(VTK_JAVA_DEPENDENCIES ${VTK_JAVA_DEPENDENCIES} "${VTK_JAVA_HOME}/${TMP_FILENAME}.java") |
||||
SET(VTK_JAVA_DEPENDENCIES_FILE |
||||
"${VTK_JAVA_DEPENDENCIES_FILE}\n \"${VTK_JAVA_HOME}/${TMP_FILENAME}.java\"") |
||||
|
||||
# Add this output to a custom target if needed. |
||||
IF(VTK_WRAP_JAVA_NEED_CUSTOM_TARGETS) |
||||
SET(VTK_WRAP_JAVA_CUSTOM_LIST ${VTK_WRAP_JAVA_CUSTOM_LIST} |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Java.cxx |
||||
) |
||||
SET(VTK_WRAP_JAVA_CUSTOM_COUNT ${VTK_WRAP_JAVA_CUSTOM_COUNT}x) |
||||
IF(VTK_WRAP_JAVA_CUSTOM_COUNT MATCHES "^${VTK_WRAP_JAVA_CUSTOM_LIMIT}$") |
||||
SET(VTK_WRAP_JAVA_CUSTOM_NAME ${VTK_WRAP_JAVA_CUSTOM_NAME}Hack) |
||||
ADD_CUSTOM_TARGET(${VTK_WRAP_JAVA_CUSTOM_NAME} DEPENDS ${VTK_WRAP_JAVA_CUSTOM_LIST}) |
||||
SET(KIT_JAVA_DEPS ${VTK_WRAP_JAVA_CUSTOM_NAME}) |
||||
SET(VTK_WRAP_JAVA_CUSTOM_LIST) |
||||
SET(VTK_WRAP_JAVA_CUSTOM_COUNT) |
||||
ENDIF(VTK_WRAP_JAVA_CUSTOM_COUNT MATCHES "^${VTK_WRAP_JAVA_CUSTOM_LIMIT}$") |
||||
ENDIF(VTK_WRAP_JAVA_NEED_CUSTOM_TARGETS) |
||||
ENDIF (NOT TMP_WRAP_EXCLUDE) |
||||
ENDFOREACH(FILE) |
||||
|
||||
ADD_CUSTOM_TARGET("${TARGET}JavaClasses" ALL DEPENDS ${VTK_JAVA_DEPENDENCIES}) |
||||
SET(dir ${CMAKE_CURRENT_SOURCE_DIR}) |
||||
IF(VTK_WRAP_JAVA3_INIT_DIR) |
||||
SET(dir ${VTK_WRAP_JAVA3_INIT_DIR}) |
||||
ENDIF(VTK_WRAP_JAVA3_INIT_DIR) |
||||
CONFIGURE_FILE("${dir}/JavaDependencies.cmake.in" |
||||
"${CMAKE_CURRENT_BINARY_DIR}/JavaDependencies.cmake" IMMEDIATE @ONLY) |
||||
|
||||
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6) |
||||
#otherwise use old loaded command |
||||
VTK_WRAP_JAVA2(${TARGET} |
||||
SOURCES ${SRC_LIST} ${SOURCES} |
||||
) |
||||
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6) |
||||
ENDMACRO(VTK_WRAP_JAVA3) |
||||
|
||||
# VS 6 does not like needing to run a huge number of custom commands |
||||
# when building a single target. Generate some extra custom targets |
||||
# that run the custom commands before the main target is built. This |
||||
# is a hack to work-around the limitation. The test to enable it is |
||||
# done here since it does not need to be done for every macro |
||||
# invocation. |
||||
IF(CMAKE_GENERATOR MATCHES "^Visual Studio 6$") |
||||
SET(VTK_WRAP_JAVA_NEED_CUSTOM_TARGETS 1) |
||||
SET(VTK_WRAP_JAVA_CUSTOM_LIMIT x) |
||||
# Limit the number of custom commands in each target |
||||
# to 2^7. |
||||
FOREACH(t 1 2 3 4 5 6 7) |
||||
SET(VTK_WRAP_JAVA_CUSTOM_LIMIT |
||||
${VTK_WRAP_JAVA_CUSTOM_LIMIT}${VTK_WRAP_JAVA_CUSTOM_LIMIT}) |
||||
ENDFOREACH(t) |
||||
ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 6$") |
@ -0,0 +1,142 @@ |
||||
# |
||||
# a cmake implementation of the Wrap Python command |
||||
# |
||||
|
||||
MACRO(VTK_WRAP_PYTHON3 TARGET SRC_LIST_NAME SOURCES) |
||||
IF(NOT VTK_WRAP_PYTHON_INIT_EXE) |
||||
MESSAGE(SEND_ERROR "VTK_WRAP_PYTHON_INIT_EXE not specified when calling VTK_WRAP_PYTHON3") |
||||
ENDIF(NOT VTK_WRAP_PYTHON_INIT_EXE) |
||||
IF(NOT VTK_WRAP_PYTHON_EXE) |
||||
MESSAGE(SEND_ERROR "VTK_WRAP_PYTHON_EXE not specified when calling VTK_WRAP_PYTHON3") |
||||
ENDIF(NOT VTK_WRAP_PYTHON_EXE) |
||||
# for new cmake use the new custom commands |
||||
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6) |
||||
|
||||
# Initialize the custom target counter. |
||||
IF(VTK_WRAP_PYTHON_NEED_CUSTOM_TARGETS) |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_COUNT "") |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_NAME ${TARGET}) |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_LIST) |
||||
ENDIF(VTK_WRAP_PYTHON_NEED_CUSTOM_TARGETS) |
||||
|
||||
# start writing the input file for the init file |
||||
SET(VTK_WRAPPER_INIT_DATA "${TARGET}") |
||||
|
||||
# For each class |
||||
FOREACH(FILE ${SOURCES}) |
||||
# should we wrap the file? |
||||
GET_SOURCE_FILE_PROPERTY(TMP_WRAP_EXCLUDE ${FILE} WRAP_EXCLUDE) |
||||
|
||||
# if we should wrap it |
||||
IF (NOT TMP_WRAP_EXCLUDE) |
||||
|
||||
# what is the filename without the extension |
||||
GET_FILENAME_COMPONENT(TMP_FILENAME ${FILE} NAME_WE) |
||||
|
||||
# the input file might be full path so handle that |
||||
GET_FILENAME_COMPONENT(TMP_FILEPATH ${FILE} PATH) |
||||
|
||||
# compute the input filename |
||||
IF (TMP_FILEPATH) |
||||
SET(TMP_INPUT ${TMP_FILEPATH}/${TMP_FILENAME}.h) |
||||
ELSE (TMP_FILEPATH) |
||||
SET(TMP_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${TMP_FILENAME}.h) |
||||
ENDIF (TMP_FILEPATH) |
||||
|
||||
# is it abstract? |
||||
GET_SOURCE_FILE_PROPERTY(TMP_ABSTRACT ${FILE} ABSTRACT) |
||||
IF (TMP_ABSTRACT) |
||||
SET(TMP_CONCRETE 0) |
||||
ELSE (TMP_ABSTRACT) |
||||
SET(TMP_CONCRETE 1) |
||||
ENDIF (TMP_ABSTRACT) |
||||
|
||||
# add the info to the init file |
||||
SET(VTK_WRAPPER_INIT_DATA |
||||
"${VTK_WRAPPER_INIT_DATA}\n${TMP_FILENAME}") |
||||
|
||||
# new source file is namePython.cxx, add to resulting list |
||||
SET(${SRC_LIST_NAME} ${${SRC_LIST_NAME}} |
||||
${TMP_FILENAME}Python.cxx) |
||||
|
||||
# add custom command to output |
||||
ADD_CUSTOM_COMMAND( |
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Python.cxx |
||||
DEPENDS ${VTK_WRAP_PYTHON_EXE} ${VTK_WRAP_HINTS} ${TMP_INPUT} |
||||
COMMAND ${VTK_WRAP_PYTHON_EXE} |
||||
ARGS ${TMP_INPUT} ${VTK_WRAP_HINTS} ${TMP_CONCRETE} |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Python.cxx |
||||
COMMENT "Python Wrappings" |
||||
) |
||||
|
||||
# Add this output to a custom target if needed. |
||||
IF(VTK_WRAP_PYTHON_NEED_CUSTOM_TARGETS) |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_LIST ${VTK_WRAP_PYTHON_CUSTOM_LIST} |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Python.cxx) |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_COUNT ${VTK_WRAP_PYTHON_CUSTOM_COUNT}x) |
||||
IF(VTK_WRAP_PYTHON_CUSTOM_COUNT MATCHES "^${VTK_WRAP_PYTHON_CUSTOM_LIMIT}$") |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_NAME ${VTK_WRAP_PYTHON_CUSTOM_NAME}Hack) |
||||
ADD_CUSTOM_TARGET(${VTK_WRAP_PYTHON_CUSTOM_NAME} DEPENDS ${VTK_WRAP_PYTHON_CUSTOM_LIST}) |
||||
SET(KIT_PYTHON_DEPS ${VTK_WRAP_PYTHON_CUSTOM_NAME}) |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_LIST) |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_COUNT) |
||||
ENDIF(VTK_WRAP_PYTHON_CUSTOM_COUNT MATCHES "^${VTK_WRAP_PYTHON_CUSTOM_LIMIT}$") |
||||
ENDIF(VTK_WRAP_PYTHON_NEED_CUSTOM_TARGETS) |
||||
ENDIF (NOT TMP_WRAP_EXCLUDE) |
||||
ENDFOREACH(FILE) |
||||
|
||||
# finish the data file for the init file |
||||
SET(dir ${CMAKE_CURRENT_SOURCE_DIR}) |
||||
IF(VTK_WRAP_PYTHON3_INIT_DIR) |
||||
SET(dir ${VTK_WRAP_PYTHON3_INIT_DIR}) |
||||
ELSE(VTK_WRAP_PYTHON3_INIT_DIR) |
||||
IF(VTK_INSTALL_PREFIX) |
||||
SET(dir "${VTK_CMAKE_DIR}") |
||||
ELSE(VTK_INSTALL_PREFIX) |
||||
SET(dir "${VTK_SOURCE_DIR}/Wrapping") |
||||
ENDIF(VTK_INSTALL_PREFIX) |
||||
ENDIF(VTK_WRAP_PYTHON3_INIT_DIR) |
||||
CONFIGURE_FILE( |
||||
${dir}/vtkWrapperInit.data.in |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data |
||||
COPY_ONLY |
||||
IMMEDIATE |
||||
) |
||||
|
||||
ADD_CUSTOM_COMMAND( |
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.cxx |
||||
DEPENDS ${VTK_WRAP_PYTHON_INIT_EXE} |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data |
||||
COMMAND ${VTK_WRAP_PYTHON_INIT_EXE} |
||||
ARGS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.cxx |
||||
COMMENT "Python Wrapping Init" |
||||
) |
||||
|
||||
# Create the Init File |
||||
SET(${SRC_LIST_NAME} ${${SRC_LIST_NAME}} ${TARGET}Init.cxx) |
||||
|
||||
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6) |
||||
#otherwise use old loaded command |
||||
VTK_WRAP_PYTHON2(${TARGET} |
||||
SOURCES ${SRC_LIST} ${SOURCES} |
||||
) |
||||
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6) |
||||
ENDMACRO(VTK_WRAP_PYTHON3) |
||||
|
||||
# VS 6 does not like needing to run a huge number of custom commands |
||||
# when building a single target. Generate some extra custom targets |
||||
# that run the custom commands before the main target is built. This |
||||
# is a hack to work-around the limitation. The test to enable it is |
||||
# done here since it does not need to be done for every macro |
||||
# invocation. |
||||
IF(CMAKE_GENERATOR MATCHES "^Visual Studio 6$") |
||||
SET(VTK_WRAP_PYTHON_NEED_CUSTOM_TARGETS 1) |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_LIMIT x) |
||||
# Limit the number of custom commands in each target |
||||
# to 2^7. |
||||
FOREACH(t 1 2 3 4 5 6 7) |
||||
SET(VTK_WRAP_PYTHON_CUSTOM_LIMIT |
||||
${VTK_WRAP_PYTHON_CUSTOM_LIMIT}${VTK_WRAP_PYTHON_CUSTOM_LIMIT}) |
||||
ENDFOREACH(t) |
||||
ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 6$") |
@ -0,0 +1,157 @@ |
||||
# |
||||
# a cmake implementation of the Wrap Tcl command |
||||
# it takes an optional VERSION parameter that will be output |
||||
# to the .data file as VERSION ${VERSION}. |
||||
# vtkWrapTclInit will then recognize the VERSION keyword, extract the version |
||||
# and make sure the corresponding Tcl package is 'provided' with that version. |
||||
# |
||||
|
||||
MACRO(VTK_WRAP_TCL3 TARGET SRC_LIST_NAME SOURCES COMMANDS) |
||||
IF(NOT VTK_WRAP_TCL_INIT_EXE) |
||||
MESSAGE(SEND_ERROR "VTK_WRAP_TCL_INIT_EXE not specified when calling VTK_WRAP_TCL3") |
||||
ENDIF(NOT VTK_WRAP_TCL_INIT_EXE) |
||||
IF(NOT VTK_WRAP_TCL_EXE) |
||||
MESSAGE(SEND_ERROR "VTK_WRAP_TCL_EXE not specified when calling VTK_WRAP_TCL3") |
||||
ENDIF(NOT VTK_WRAP_TCL_EXE) |
||||
# for new cmake use the new custom commands |
||||
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6) |
||||
|
||||
# Initialize the custom target counter. |
||||
IF(VTK_WRAP_TCL_NEED_CUSTOM_TARGETS) |
||||
SET(VTK_WRAP_TCL_CUSTOM_COUNT "") |
||||
SET(VTK_WRAP_TCL_CUSTOM_NAME ${TARGET}) |
||||
SET(VTK_WRAP_TCL_CUSTOM_LIST) |
||||
ENDIF(VTK_WRAP_TCL_NEED_CUSTOM_TARGETS) |
||||
|
||||
# start writing the input file for the init file |
||||
SET(VTK_WRAPPER_INIT_DATA "${TARGET}") |
||||
IF (${ARGC} GREATER 4) |
||||
SET(VTK_WRAPPER_INIT_DATA |
||||
"${VTK_WRAPPER_INIT_DATA}\nVERSION ${ARGV4}") |
||||
ENDIF (${ARGC} GREATER 4) |
||||
|
||||
# For each class |
||||
FOREACH(FILE ${SOURCES}) |
||||
# should we wrap the file? |
||||
GET_SOURCE_FILE_PROPERTY(TMP_WRAP_EXCLUDE ${FILE} WRAP_EXCLUDE) |
||||
|
||||
# if we should wrap it |
||||
IF (NOT TMP_WRAP_EXCLUDE) |
||||
|
||||
# what is the filename without the extension |
||||
GET_FILENAME_COMPONENT(TMP_FILENAME ${FILE} NAME_WE) |
||||
|
||||
# the input file might be full path so handle that |
||||
GET_FILENAME_COMPONENT(TMP_FILEPATH ${FILE} PATH) |
||||
|
||||
# compute the input filename |
||||
IF (TMP_FILEPATH) |
||||
SET(TMP_INPUT ${TMP_FILEPATH}/${TMP_FILENAME}.h) |
||||
ELSE (TMP_FILEPATH) |
||||
SET(TMP_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${TMP_FILENAME}.h) |
||||
ENDIF (TMP_FILEPATH) |
||||
|
||||
# is it abstract? |
||||
GET_SOURCE_FILE_PROPERTY(TMP_ABSTRACT ${FILE} ABSTRACT) |
||||
IF (TMP_ABSTRACT) |
||||
SET(TMP_CONCRETE 0) |
||||
ELSE (TMP_ABSTRACT) |
||||
SET(TMP_CONCRETE 1) |
||||
# add the info to the init file |
||||
SET(VTK_WRAPPER_INIT_DATA |
||||
"${VTK_WRAPPER_INIT_DATA}\n${TMP_FILENAME}") |
||||
ENDIF (TMP_ABSTRACT) |
||||
|
||||
# new source file is nameTcl.cxx, add to resulting list |
||||
SET(${SRC_LIST_NAME} ${${SRC_LIST_NAME}} |
||||
${TMP_FILENAME}Tcl.cxx) |
||||
|
||||
# add custom command to output |
||||
ADD_CUSTOM_COMMAND( |
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Tcl.cxx |
||||
DEPENDS ${VTK_WRAP_TCL_EXE} ${VTK_WRAP_HINTS} |
||||
MAIN_DEPENDENCY "${TMP_INPUT}" |
||||
COMMAND ${VTK_WRAP_TCL_EXE} |
||||
ARGS ${TMP_INPUT} ${VTK_WRAP_HINTS} ${TMP_CONCRETE} |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Tcl.cxx |
||||
COMMENT |
||||
"Tcl Wrappings" |
||||
) |
||||
|
||||
# Add this output to a custom target if needed. |
||||
IF(VTK_WRAP_TCL_NEED_CUSTOM_TARGETS) |
||||
SET(VTK_WRAP_TCL_CUSTOM_LIST ${VTK_WRAP_TCL_CUSTOM_LIST} |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Tcl.cxx) |
||||
SET(VTK_WRAP_TCL_CUSTOM_COUNT ${VTK_WRAP_TCL_CUSTOM_COUNT}x) |
||||
IF(VTK_WRAP_TCL_CUSTOM_COUNT MATCHES "^${VTK_WRAP_TCL_CUSTOM_LIMIT}$") |
||||
SET(VTK_WRAP_TCL_CUSTOM_NAME ${VTK_WRAP_TCL_CUSTOM_NAME}Hack) |
||||
ADD_CUSTOM_TARGET(${VTK_WRAP_TCL_CUSTOM_NAME} DEPENDS ${VTK_WRAP_TCL_CUSTOM_LIST}) |
||||
SET(KIT_TCL_DEPS ${VTK_WRAP_TCL_CUSTOM_NAME}) |
||||
SET(VTK_WRAP_TCL_CUSTOM_LIST) |
||||
SET(VTK_WRAP_TCL_CUSTOM_COUNT) |
||||
ENDIF(VTK_WRAP_TCL_CUSTOM_COUNT MATCHES "^${VTK_WRAP_TCL_CUSTOM_LIMIT}$") |
||||
ENDIF(VTK_WRAP_TCL_NEED_CUSTOM_TARGETS) |
||||
ENDIF (NOT TMP_WRAP_EXCLUDE) |
||||
ENDFOREACH(FILE) |
||||
|
||||
# finish the data file for the init file |
||||
FOREACH(CMD ${COMMANDS}) |
||||
SET(VTK_WRAPPER_INIT_DATA |
||||
"${VTK_WRAPPER_INIT_DATA}\nCOMMAND ${CMD}") |
||||
ENDFOREACH(CMD ${COMMANDS}) |
||||
|
||||
SET(dir ${CMAKE_CURRENT_SOURCE_DIR}) |
||||
IF(VTK_WRAP_TCL3_INIT_DIR) |
||||
SET(dir ${VTK_WRAP_TCL3_INIT_DIR}) |
||||
ELSE(VTK_WRAP_TCL3_INIT_DIR) |
||||
IF(VTK_INSTALL_PREFIX) |
||||
SET(dir "${VTK_CMAKE_DIR}") |
||||
ELSE(VTK_INSTALL_PREFIX) |
||||
SET(dir "${VTK_SOURCE_DIR}/Wrapping") |
||||
ENDIF(VTK_INSTALL_PREFIX) |
||||
ENDIF(VTK_WRAP_TCL3_INIT_DIR) |
||||
CONFIGURE_FILE( |
||||
${dir}/vtkWrapperInit.data.in |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data |
||||
COPY_ONLY |
||||
IMMEDIATE |
||||
) |
||||
|
||||
ADD_CUSTOM_COMMAND( |
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.cxx |
||||
DEPENDS ${VTK_WRAP_TCL_INIT_EXE} |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data |
||||
COMMAND ${VTK_WRAP_TCL_INIT_EXE} |
||||
ARGS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data |
||||
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.cxx |
||||
COMMENT "Tcl Wrapping Init" |
||||
) |
||||
|
||||
# Create the Init File |
||||
SET(${SRC_LIST_NAME} ${${SRC_LIST_NAME}} ${TARGET}Init.cxx) |
||||
|
||||
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6) |
||||
#otherwise use old loaded command |
||||
VTK_WRAP_TCL2(${TARGET} |
||||
SOURCES ${SRC_LIST} ${SOURCES} |
||||
COMMANDS ${COMMANDS} |
||||
) |
||||
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.6) |
||||
ENDMACRO(VTK_WRAP_TCL3) |
||||
|
||||
# VS 6 does not like needing to run a huge number of custom commands |
||||
# when building a single target. Generate some extra custom targets |
||||
# that run the custom commands before the main target is built. This |
||||
# is a hack to work-around the limitation. The test to enable it is |
||||
# done here since it does not need to be done for every macro |
||||
# invocation. |
||||
IF(CMAKE_GENERATOR MATCHES "^Visual Studio 6$") |
||||
SET(VTK_WRAP_TCL_NEED_CUSTOM_TARGETS 1) |
||||
SET(VTK_WRAP_TCL_CUSTOM_LIMIT x) |
||||
# Limit the number of custom commands in each target |
||||
# to 2^7. |
||||
FOREACH(t 1 2 3 4 5 6 7) |
||||
SET(VTK_WRAP_TCL_CUSTOM_LIMIT |
||||
${VTK_WRAP_TCL_CUSTOM_LIMIT}${VTK_WRAP_TCL_CUSTOM_LIMIT}) |
||||
ENDFOREACH(t) |
||||
ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 6$") |
@ -0,0 +1 @@ |
||||
# This file is generated by cmake for dependency checking of the CMakeCache.txt file |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,346 @@ |
||||
SET(KIT Common) |
||||
SET(UKIT COMMON) |
||||
SET(KIT_TCL_LIBS ${VTK_TCL_LIBRARIES}) |
||||
SET(KIT_PYTHON_LIBS) |
||||
SET(KIT_JAVA_LIBS) |
||||
SET(KIT_LIBS vtksys) |
||||
|
||||
IF(WIN32) |
||||
IF (NOT VTK_USE_X) |
||||
SET(VTK_OWP_ENCODED_C vtkWin32OutputWindowProcessEncoded.c) |
||||
SET_SOURCE_FILES_PROPERTIES(${VTK_OWP_ENCODED_C} PROPERTIES WRAP_EXCLUDE 1) |
||||
ENDIF (NOT VTK_USE_X) |
||||
ENDIF(WIN32) |
||||
|
||||
IF (APPLE) |
||||
SET(KIT_LIBS ${KIT_LIBS} "-framework AppKit") |
||||
ENDIF (APPLE) |
||||
IF (UNIX) |
||||
SET(KIT_LIBS ${KIT_LIBS} ${CMAKE_THREAD_LIBS} ${CMAKE_DL_LIBS} -lm) |
||||
ENDIF (UNIX) |
||||
|
||||
SET( Kit_SRCS |
||||
vtkAbstractArray.cxx |
||||
vtkAbstractTransform.cxx |
||||
vtkAmoebaMinimizer.cxx |
||||
vtkAnimationCue.cxx |
||||
vtkAnimationScene.cxx |
||||
vtkAssemblyNode.cxx |
||||
vtkAssemblyPath.cxx |
||||
vtkAssemblyPaths.cxx |
||||
vtkBitArray.cxx |
||||
vtkBox.cxx |
||||
vtkByteSwap.cxx |
||||
vtkCallbackCommand.cxx |
||||
vtkCharArray.cxx |
||||
vtkCollection.cxx |
||||
vtkCollectionIterator.cxx |
||||
vtkCommand.cxx |
||||
vtkContourValues.cxx |
||||
vtkCriticalSection.cxx |
||||
vtkCylindricalTransform.cxx |
||||
vtkDataArray.cxx |
||||
vtkDataArrayCollection.cxx |
||||
vtkDataArrayCollectionIterator.cxx |
||||
vtkDataArraySelection.cxx |
||||
vtkDebugLeaks.cxx |
||||
vtkDebugLeaksManager.cxx |
||||
vtkDirectory.cxx |
||||
vtkDoubleArray.cxx |
||||
vtkDynamicLoader.cxx |
||||
vtkEdgeTable.cxx |
||||
vtkErrorCode.cxx |
||||
vtkEventForwarderCommand.cxx |
||||
vtkExtentSplitter.cxx |
||||
vtkExtentTranslator.cxx |
||||
vtkFastNumericConversion.cxx |
||||
vtkFileOutputWindow.cxx |
||||
vtkFloatArray.cxx |
||||
vtkFunctionParser.cxx |
||||
vtkFunctionSet.cxx |
||||
vtkGarbageCollector.cxx |
||||
vtkGarbageCollectorManager.cxx |
||||
vtkGeneralTransform.cxx |
||||
vtkHeap.cxx |
||||
vtkHomogeneousTransform.cxx |
||||
vtkIOStream.cxx |
||||
vtkIdList.cxx |
||||
vtkIdListCollection.cxx |
||||
vtkIdTypeArray.cxx |
||||
vtkIdentityTransform.cxx |
||||
vtkImplicitFunction.cxx |
||||
vtkImplicitFunctionCollection.cxx |
||||
vtkIndent.cxx |
||||
vtkInitialValueProblemSolver.cxx |
||||
vtkInstantiator.cxx |
||||
vtkIntArray.cxx |
||||
vtkLargeInteger.cxx |
||||
vtkLinearTransform.cxx |
||||
vtkLogLookupTable.cxx |
||||
vtkLongArray.cxx |
||||
vtkLookupTable.cxx |
||||
vtkMath.cxx |
||||
vtkMatrix4x4.cxx |
||||
vtkMatrixToHomogeneousTransform.cxx |
||||
vtkMatrixToLinearTransform.cxx |
||||
vtkMultiPartExtentTranslator.cxx |
||||
vtkMultiThreader.cxx |
||||
vtkMutexLock.cxx |
||||
vtkOStrStreamWrapper.cxx |
||||
vtkOStreamWrapper.cxx |
||||
vtkObject.cxx |
||||
vtkObjectBase.cxx |
||||
vtkObjectFactory.cxx |
||||
vtkObjectFactoryCollection.cxx |
||||
vtkOldStyleCallbackCommand.cxx |
||||
vtkOutputWindow.cxx |
||||
vtkOverrideInformation.cxx |
||||
vtkOverrideInformationCollection.cxx |
||||
vtkParametricBoy.cxx |
||||
vtkParametricConicSpiral.cxx |
||||
vtkParametricCrossCap.cxx |
||||
vtkParametricDini.cxx |
||||
vtkParametricEllipsoid.cxx |
||||
vtkParametricEnneper.cxx |
||||
vtkParametricFigure8Klein.cxx |
||||
vtkParametricFunction.cxx |
||||
vtkParametricKlein.cxx |
||||
vtkParametricMobius.cxx |
||||
vtkParametricRandomHills.cxx |
||||
vtkParametricRoman.cxx |
||||
vtkParametricSuperEllipsoid.cxx |
||||
vtkParametricSuperToroid.cxx |
||||
vtkParametricTorus.cxx |
||||
vtkPerspectiveTransform.cxx |
||||
vtkPlane.cxx |
||||
vtkPlaneCollection.cxx |
||||
vtkPlanes.cxx |
||||
vtkPoints.cxx |
||||
vtkPriorityQueue.cxx |
||||
vtkProp.cxx |
||||
vtkPropCollection.cxx |
||||
vtkProperty2D.cxx |
||||
vtkQuadric.cxx |
||||
vtkReferenceCount.cxx |
||||
vtkRungeKutta2.cxx |
||||
vtkRungeKutta4.cxx |
||||
vtkRungeKutta45.cxx |
||||
vtkScalarsToColors.cxx |
||||
vtkShortArray.cxx |
||||
vtkSignedCharArray.cxx |
||||
vtkSmartPointerBase.cxx |
||||
vtkSphericalTransform.cxx |
||||
vtkStdString.cxx |
||||
vtkStringArray.cxx |
||||
vtkStructuredData.cxx |
||||
vtkStructuredVisibilityConstraint.cxx |
||||
vtkTableExtentTranslator.cxx |
||||
vtkTensor.cxx |
||||
vtkThreadMessager.cxx |
||||
vtkTimeStamp.cxx |
||||
vtkTimerLog.cxx |
||||
vtkTransform.cxx |
||||
vtkTransformCollection.cxx |
||||
vtkUnsignedCharArray.cxx |
||||
vtkUnsignedIntArray.cxx |
||||
vtkUnsignedLongArray.cxx |
||||
vtkUnsignedShortArray.cxx |
||||
vtkVersion.cxx |
||||
vtkVoidArray.cxx |
||||
vtkWarpTransform.cxx |
||||
vtkWindow.cxx |
||||
vtkWindowLevelLookupTable.cxx |
||||
vtkXMLFileOutputWindow.cxx |
||||
) |
||||
|
||||
IF(VTK_TYPE_USE_LONG_LONG) |
||||
SET(Kit_SRCS ${Kit_SRCS} |
||||
vtkLongLongArray.cxx |
||||
vtkUnsignedLongLongArray.cxx |
||||
) |
||||
ENDIF(VTK_TYPE_USE_LONG_LONG) |
||||
IF(VTK_TYPE_USE___INT64) |
||||
SET(Kit_SRCS ${Kit_SRCS} vtk__Int64Array.cxx) |
||||
IF(VTK_TYPE_CONVERT_UI64_TO_DOUBLE) |
||||
SET(Kit_SRCS ${Kit_SRCS} vtkUnsigned__Int64Array.cxx) |
||||
ENDIF(VTK_TYPE_CONVERT_UI64_TO_DOUBLE) |
||||
ENDIF(VTK_TYPE_USE___INT64) |
||||
|
||||
# Configure data arrays for platform-independent fixed-size types. |
||||
# Match the type selection here to that in vtkType.h. |
||||
IF(VTK_TYPE_CHAR_IS_SIGNED) |
||||
SET(VTK_TYPE_NATIVE_Int8 Char) |
||||
ELSE(VTK_TYPE_CHAR_IS_SIGNED) |
||||
SET(VTK_TYPE_NATIVE_Int8 SignedChar) |
||||
ENDIF(VTK_TYPE_CHAR_IS_SIGNED) |
||||
SET(VTK_TYPE_NATIVE_Int16 UnsignedShort) |
||||
SET(VTK_TYPE_NATIVE_Int32 UnsignedInt) |
||||
SET(VTK_TYPE_NATIVE_UInt8 UnsignedChar) |
||||
SET(VTK_TYPE_NATIVE_UInt16 UnsignedShort) |
||||
SET(VTK_TYPE_NATIVE_UInt32 UnsignedInt) |
||||
IF(VTK_SIZEOF_LONG MATCHES "^8$") |
||||
SET(VTK_TYPE_NATIVE_Int64 Long) |
||||
SET(VTK_TYPE_NATIVE_UInt64 UnsignedLong) |
||||
ELSE(VTK_SIZEOF_LONG MATCHES "^8$") |
||||
IF(VTK_SIZEOF_LONG_LONG MATCHES "^8$") |
||||
SET(VTK_TYPE_NATIVE_Int64 LongLong) |
||||
SET(VTK_TYPE_NATIVE_UInt64 UnsignedLongLong) |
||||
ELSE(VTK_SIZEOF_LONG_LONG MATCHES "^8$") |
||||
IF(VTK_SIZEOF___INT64 MATCHES "^8$") |
||||
SET(VTK_TYPE_NATIVE_Int64 __Int64) |
||||
IF(VTK_TYPE_CONVERT_UI64_TO_DOUBLE) |
||||
SET(VTK_TYPE_NATIVE_UInt64 Unsigned__Int64) |
||||
ENDIF(VTK_TYPE_CONVERT_UI64_TO_DOUBLE) |
||||
ENDIF(VTK_SIZEOF___INT64 MATCHES "^8$") |
||||
ENDIF(VTK_SIZEOF_LONG_LONG MATCHES "^8$") |
||||
ENDIF(VTK_SIZEOF_LONG MATCHES "^8$") |
||||
SET(VTK_TYPE_NATIVE_Float32 Float) |
||||
SET(VTK_TYPE_NATIVE_Float64 Double) |
||||
FOREACH(t Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64) |
||||
SET(VTK_TYPE_NAME ${t}) |
||||
SET(VTK_TYPE_NATIVE ${VTK_TYPE_NATIVE_${t}}) |
||||
IF(VTK_TYPE_NATIVE) |
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/vtkTypedArray.h.in |
||||
${CMAKE_CURRENT_BINARY_DIR}/vtkType${t}Array.h |
||||
@ONLY IMMEDIATE) |
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/vtkTypedArray.cxx.in |
||||
${CMAKE_CURRENT_BINARY_DIR}/vtkType${t}Array.cxx |
||||
@ONLY IMMEDIATE) |
||||
SET(Kit_SRCS ${Kit_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/vtkType${t}Array.cxx) |
||||
ENDIF(VTK_TYPE_NATIVE) |
||||
ENDFOREACH(t) |
||||
|
||||
SET_SOURCE_FILES_PROPERTIES( |
||||
# vtkObjectBase is marked ABSTRACT so that instantiators are happy. |
||||
vtkAbstractArray |
||||
vtkAbstractTransform |
||||
vtkCallbackCommand |
||||
vtkCommand |
||||
vtkDataArray |
||||
vtkEventForwarderCommand |
||||
vtkFunctionSet |
||||
vtkHomogeneousTransform |
||||
vtkImplicitFunction |
||||
vtkInitialValueProblemSolver |
||||
vtkLinearTransform |
||||
vtkObjectBase |
||||
vtkObjectFactory |
||||
vtkOldStyleCallbackCommand |
||||
vtkOverrideInformation |
||||
vtkOverrideInformationCollection |
||||
vtkParametricFunction |
||||
vtkProp |
||||
vtkScalarsToColors |
||||
vtkStructuredData |
||||
vtkWarpTransform |
||||
vtkWindow |
||||
ABSTRACT |
||||
) |
||||
|
||||
SET_SOURCE_FILES_PROPERTIES( |
||||
vtkCallbackCommand.cxx |
||||
vtkCommand.cxx |
||||
vtkDebugLeaksManager.cxx |
||||
vtkErrorCode.cxx |
||||
vtkEventForwarderCommand.cxx |
||||
vtkGarbageCollectorManager.cxx |
||||
vtkIOStream.cxx |
||||
vtkIndent.cxx |
||||
vtkLargeInteger.cxx |
||||
vtkOStrStreamWrapper.cxx |
||||
vtkOStreamWrapper.cxx |
||||
vtkOldStyleCallbackCommand.cxx |
||||
vtkSmartPointerBase.cxx |
||||
vtkStdString.cxx |
||||
vtkTimeStamp.cxx |
||||
|
||||
WRAP_EXCLUDE |
||||
) |
||||
|
||||
SET(Kit_EXTRA_SRCS) |
||||
SET(Kit_EXTRA_CMDS) |
||||
SET(Kit_TCL_EXTRA_SRCS vtkTclUtil.cxx) |
||||
SET(Kit_PYTHON_EXTRA_SRCS vtkPythonUtil.cxx) |
||||
SET(Kit_JAVA_EXTRA_SRCS vtkJavaUtil.cxx) |
||||
SET(KIT_TCL_DEPS) |
||||
SET(KIT_PYTHON_DEPS) |
||||
SET(KIT_JAVA_DEPS) |
||||
|
||||
IF (WIN32) |
||||
IF (NOT VTK_USE_X) |
||||
SET(Kit_SRCS ${Kit_SRCS} vtkWin32OutputWindow.cxx |
||||
vtkWin32ProcessOutputWindow.cxx) |
||||
SET(Kit_EXTRA_SRCS ${Kit_EXTRA_SRCS} vtkWin32OutputWindowProcessEncoded.c) |
||||
SET_SOURCE_FILES_PROPERTIES(vtkWin32OutputWindowProcessEncoded.c |
||||
PROPERTIES WRAP_EXCLUDE 1) |
||||
ENDIF (NOT VTK_USE_X) |
||||
ENDIF (WIN32) |
||||
|
||||
#----------------------------------------------------------------------------- |
||||
# Include CMake code common to all kits. |
||||
INCLUDE(${VTK_SOURCE_DIR}/CMake/KitCommonBlock.cmake) |
||||
#----------------------------------------------------------------------------- |
||||
|
||||
IF(NOT VTK_INSTALL_NO_DEVELOPMENT) |
||||
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h |
||||
vtkDataArrayTemplate |
||||
vtkIOStream |
||||
vtkIOStreamFwd |
||||
vtkSetGet |
||||
vtkSmartPointer |
||||
vtkSystemIncludes |
||||
vtkType |
||||
vtkTypeTraits |
||||
vtkWin32Header |
||||
vtkWindows |
||||
) |
||||
|
||||
IF(VTK_WRAP_TCL) |
||||
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h |
||||
vtkTcl |
||||
vtkTclUtil |
||||
vtkTk |
||||
) |
||||
ENDIF(VTK_WRAP_TCL) |
||||
IF(VTK_WRAP_PYTHON) |
||||
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h |
||||
vtkPythonUtil |
||||
) |
||||
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} FILES |
||||
vtkPython.h |
||||
) |
||||
IF (TK_LIBRARY) |
||||
IF(NOT VTK_USE_COCOA) |
||||
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h |
||||
vtkTcl |
||||
vtkTk |
||||
) |
||||
ENDIF(NOT VTK_USE_COCOA) |
||||
ENDIF (TK_LIBRARY) |
||||
ENDIF(VTK_WRAP_PYTHON) |
||||
IF(VTK_WRAP_JAVA) |
||||
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h |
||||
vtkJavaUtil |
||||
) |
||||
ENDIF(VTK_WRAP_JAVA) |
||||
|
||||
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .txx |
||||
vtkDataArrayTemplate |
||||
vtkDataArrayTemplateImplicit |
||||
) |
||||
|
||||
INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR}/testing FILES |
||||
${VTK_SOURCE_DIR}/${KIT}/Testing/HeaderTesting.py |
||||
${VTK_SOURCE_DIR}/${KIT}/Testing/WindowsMangleList.py |
||||
${VTK_SOURCE_DIR}/${KIT}/Testing/Tcl/FindString.tcl |
||||
${VTK_SOURCE_DIR}/${KIT}/Testing/Tcl/PrintSelfCheck.tcl |
||||
${VTK_SOURCE_DIR}/${KIT}/Testing/Tcl/rtImageTest.tcl |
||||
${VTK_SOURCE_DIR}/${KIT}/Testing/Tcl/TestSetGet.tcl |
||||
) |
||||
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} FILES |
||||
${VTK_SOURCE_DIR}/${KIT}/Testing/Cxx/vtkTestUtilities.h) |
||||
IF(VTK_USE_PARALLEL) |
||||
INSTALL_FILES(${VTK_INSTALL_PACKAGE_DIR}/testing FILES |
||||
${VTK_SOURCE_DIR}/${KIT}/Testing/Tcl/prtImageTest.tcl) |
||||
ENDIF(VTK_USE_PARALLEL) |
||||
ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT) |
@ -0,0 +1,143 @@ |
||||
SUBDIRS(Cxx) |
||||
|
||||
IF (VTK_WRAP_TCL) |
||||
SUBDIRS(Tcl) |
||||
ENDIF (VTK_WRAP_TCL) |
||||
|
||||
IF (VTK_WRAP_PYTHON) |
||||
SUBDIRS(Python) |
||||
ENDIF (VTK_WRAP_PYTHON) |
||||
|
||||
IF(PYTHON_EXECUTABLE) |
||||
ADD_TEST(HeaderTesting-Common ${PYTHON_EXECUTABLE} |
||||
${VTK_SOURCE_DIR}/Common/Testing/HeaderTesting.py |
||||
"${VTK_SOURCE_DIR}/Common" |
||||
VTK_COMMON_EXPORT |
||||
vtkAbstractIterator.h |
||||
vtkAbstractList.h |
||||
vtkAbstractMap.h |
||||
vtkArrayMap.h |
||||
vtkArrayMapIterator.h |
||||
vtkAssemblyPaths.h |
||||
vtkByteSwap.h |
||||
vtkCallbackCommand.h |
||||
vtkCommand.h |
||||
vtkContainer.h |
||||
vtkDataArrayCollection.h |
||||
vtkDataArrayTemplate.h |
||||
vtkDebugLeaks.h |
||||
vtkDebugLeaksManager.h |
||||
vtkDynamicLoader.h |
||||
vtkEventForwarderCommand.h |
||||
vtkErrorCode.h |
||||
vtkGarbageCollector.h |
||||
vtkGarbageCollectorManager.h |
||||
vtkHashMap.h |
||||
vtkHashMapIterator.h |
||||
vtkIdListCollection.h |
||||
vtkImplicitFunctionCollection.h |
||||
vtkIOStream.h |
||||
vtkIOStreamFwd.h |
||||
vtkIndent.h |
||||
vtkJavaAwt.h |
||||
vtkJavaUtil.h |
||||
vtkLargeInteger.h |
||||
vtkLinkedList.h |
||||
vtkLinkedListIterator.h |
||||
vtkMultiPartExtentTranslator.h |
||||
vtkOStrStreamWrapper.h |
||||
vtkOStreamWrapper.h |
||||
vtkObject.h |
||||
vtkObjectBase.h |
||||
vtkObjectFactoryCollection.h |
||||
vtkOldStyleCallbackCommand.h |
||||
vtkOverrideInformationCollection.h |
||||
vtkPlaneCollection.h |
||||
vtkProcessStatistics.h |
||||
vtkPropCollection.h |
||||
vtkPython.h |
||||
vtkPythonUtil.h |
||||
vtkRayCastStructures.h |
||||
vtkRungeKutta2.h |
||||
vtkSetGet.h |
||||
vtkSmartPointer.h |
||||
vtkSmartPointerBase.h |
||||
vtkStdString.h |
||||
vtkStructuredData.h |
||||
vtkSystemIncludes.h |
||||
vtkTclUtil.h |
||||
vtkTemplateAliasMacro.h |
||||
vtkTimeStamp.h |
||||
vtkTransformCollection.h |
||||
vtkType.h |
||||
vtkTypeTraits.h |
||||
vtkVector.h |
||||
vtkVectorIterator.h |
||||
vtkWin32Header.h |
||||
vtkWinCE.h |
||||
vtkWindows.h |
||||
vtkTcl.h |
||||
vtkTk.h |
||||
vtkVersion.h |
||||
vtkXMLFileOutputWindow.h |
||||
) |
||||
ENDIF(PYTHON_EXECUTABLE) |
||||
|
||||
#----------------------------------------------------------------------------- |
||||
# Configure the VTK install test. It is enabled only if the install |
||||
# prefix is set to an InstallTest/Root directory under the top of the build |
||||
# tree. Note that the install prefix used for the install test must |
||||
# not be a 1-level deep subdirectory under the top of the build tree. |
||||
# If it were such then a few executables may be confused into thinking |
||||
# they are running from the build tree instead of the install tree. |
||||
IF(WIN32 OR APPLE) |
||||
STRING(TOLOWER "${CMAKE_INSTALL_PREFIX}" VTK_TEST_INSTALL_LEFT) |
||||
STRING(TOLOWER "${VTK_BINARY_DIR}/InstallTest/Root" VTK_TEST_INSTALL_RIGHT) |
||||
ELSE(WIN32 OR APPLE) |
||||
SET(VTK_TEST_INSTALL_LEFT "${CMAKE_INSTALL_PREFIX}") |
||||
SET(VTK_TEST_INSTALL_RIGHT "${VTK_BINARY_DIR}/InstallTest/Root") |
||||
ENDIF(WIN32 OR APPLE) |
||||
STRING(COMPARE EQUAL "${VTK_TEST_INSTALL_LEFT}" "${VTK_TEST_INSTALL_RIGHT}" |
||||
VTK_TEST_INSTALL) |
||||
|
||||
# No install when using rpaths. |
||||
IF(VTK_USE_RPATH) |
||||
SET(VTK_TEST_INSTALL 0) |
||||
ENDIF(VTK_USE_RPATH) |
||||
|
||||
# We cannot safely implement the install test when there are multiple |
||||
# configuration types unless tests are run by CTest 2.2 or higher. |
||||
# See VTK/Examples/CMakeLists.txt where it adds the Example-vtkLocal |
||||
# test for an explanation. |
||||
IF(CMAKE_CONFIGURATION_TYPES) |
||||
IF(NOT VTK_TEST_WITH_CTEST) |
||||
SET(VTK_TEST_INSTALL 0) |
||||
ENDIF(NOT VTK_TEST_WITH_CTEST) |
||||
ENDIF(CMAKE_CONFIGURATION_TYPES) |
||||
|
||||
IF(VTK_TEST_INSTALL) |
||||
IF(CMAKE_CONFIGURATION_TYPES) |
||||
# There are multiple configurations. Make sure the tested |
||||
# configuration is the one that is installed. |
||||
SET(DOLLAR "$") |
||||
SET(VTK_INSTALL_TEST_CONFIG_TYPE -C "${DOLLAR}{CTEST_CONFIGURATION_TYPE}") |
||||
ELSE(CMAKE_CONFIGURATION_TYPES) |
||||
# There is only one configuration. It will be installed. |
||||
SET(VTK_INSTALL_TEST_CONFIG_TYPE) |
||||
ENDIF(CMAKE_CONFIGURATION_TYPES) |
||||
|
||||
# Add a test to install VTK through the build system install target. |
||||
ADD_TEST(Install |
||||
${CMAKE_CTEST_COMMAND} |
||||
${VTK_INSTALL_TEST_CONFIG_TYPE} |
||||
--build-and-test ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} |
||||
--build-generator ${CMAKE_GENERATOR} |
||||
--build-project VTK |
||||
--build-makeprogram ${CMAKE_MAKE_PROGRAM} |
||||
--build-noclean |
||||
--build-target install) |
||||
ENDIF(VTK_TEST_INSTALL) |
||||
|
||||
# Suppress memory checking of some tests |
||||
CONFIGURE_FILE(${VTK_SOURCE_DIR}/Common/Testing/CTestCustom.ctest.in |
||||
${VTK_BINARY_DIR}/Common/Testing/CTestCustom.ctest @ONLY) |
@ -0,0 +1,41 @@ |
||||
SET(CTEST_CUSTOM_MEMCHECK_IGNORE |
||||
${CTEST_CUSTOM_MEMCHECK_IGNORE} |
||||
HeaderTesting-Common |
||||
HeaderTesting-GenericFiltering |
||||
HeaderTesting-Filtering |
||||
HeaderTesting-Graphics |
||||
HeaderTesting-Hybrid |
||||
HeaderTesting-IO |
||||
HeaderTesting-Imaging |
||||
HeaderTesting-Parallel |
||||
HeaderTesting-Rendering |
||||
PrintSelf-Common |
||||
PrintSelf-GenericFiltering |
||||
PrintSelf-Filtering |
||||
PrintSelf-Graphics |
||||
PrintSelf-Hybrid |
||||
PrintSelf-IO |
||||
PrintSelf-Imaging |
||||
PrintSelf-Parallel |
||||
PrintSelf-Rendering |
||||
SystemInformation |
||||
TestSetObjectMacro-Common |
||||
TestSetObjectMacro-GenericFiltering |
||||
TestSetObjectMacro-Filtering |
||||
TestSetObjectMacro-Graphics |
||||
TestSetObjectMacro-Hybrid |
||||
TestSetObjectMacro-IO |
||||
TestSetObjectMacro-Imaging |
||||
TestSetObjectMacro-Parallel |
||||
TestSetObjectMacro-Rendering |
||||
Install |
||||
Example-vtkMy |
||||
) |
||||
|
||||
SET(CTEST_CUSTOM_MEMCHECK_IGNORE |
||||
${CTEST_CUSTOM_MEMCHECK_IGNORE} |
||||
largeImageOffset-image |
||||
largeImageParallel-image |
||||
Sockets-image |
||||
) |
||||
|
@ -0,0 +1,60 @@ |
||||
SET(KIT Common) |
||||
CREATE_TEST_SOURCELIST(Tests ${KIT}CxxTests.cxx |
||||
ObjectFactory.cxx |
||||
otherArrays.cxx |
||||
otherEmptyCell.cxx |
||||
otherRectilinearGrid.cxx |
||||
otherCellBoundaries.cxx |
||||
otherCellPosition.cxx |
||||
otherStructuredGrid.cxx |
||||
otherTimerLog.cxx |
||||
otherLookupTable.cxx |
||||
otherByteSwap.cxx |
||||
otherCellArray.cxx |
||||
otherStringArray.cxx |
||||
otherCellTypes.cxx |
||||
otherFieldData.cxx |
||||
quadraticEvaluation.cxx |
||||
TestAmoebaMinimizer.cxx |
||||
TestGarbageCollector.cxx |
||||
TestImageIterator.cxx |
||||
TestDirectory.cxx |
||||
TestSmartPointer.cxx |
||||
SystemInformation.cxx |
||||
EXTRA_INCLUDE vtkTestDriver.h |
||||
) |
||||
|
||||
ADD_EXECUTABLE(${KIT}CxxTests ${Tests}) |
||||
TARGET_LINK_LIBRARIES(${KIT}CxxTests vtkCommon vtkFiltering) |
||||
|
||||
SET (TestsToRun ${Tests}) |
||||
REMOVE (TestsToRun ${KIT}CxxTests.cxx) |
||||
|
||||
# Configure a header needed by SystemInformation. |
||||
CONFIGURE_FILE("${VTK_SOURCE_DIR}/Common/Testing/Cxx/SystemInformation.h.in" |
||||
"${VTK_BINARY_DIR}/Common/Testing/Cxx/SystemInformation.h" |
||||
@ONLY IMMEDIATE) |
||||
|
||||
# |
||||
# Add all the executables |
||||
FOREACH (test ${TestsToRun}) |
||||
GET_FILENAME_COMPONENT(TName ${test} NAME_WE) |
||||
ADD_TEST(${TName} ${CXX_TEST_PATH}/${KIT}CxxTests ${TName}) |
||||
ENDFOREACH (test) |
||||
|
||||
# |
||||
# Add the TestCxxFeatures test by itself so that if it doesn't compile |
||||
# we don't loose all the tests for common |
||||
# |
||||
ADD_EXECUTABLE(TestCxxFeatures TestCxxFeatures.cxx) |
||||
TARGET_LINK_LIBRARIES(TestCxxFeatures vtkCommon) |
||||
ADD_TEST(TestCxxFeatures ${CXX_TEST_PATH}/TestCxxFeatures) |
||||
|
||||
# |
||||
# Add the TestInstantiator test by itself because it is designed to |
||||
# test pulling in all class's symbols. We don't want the other tests |
||||
# to draw in symbols. |
||||
# |
||||
ADD_EXECUTABLE(TestInstantiator TestInstantiator.cxx) |
||||
TARGET_LINK_LIBRARIES(TestInstantiator vtkCommon) |
||||
ADD_TEST(TestInstantiator ${CXX_TEST_PATH}/TestInstantiator) |
@ -0,0 +1,194 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: ObjectFactory.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkObjectFactory.h" |
||||
#include "vtkObjectFactoryCollection.h" |
||||
#include "vtkOutputWindow.h" |
||||
#include "vtkOverrideInformation.h" |
||||
#include "vtkOverrideInformationCollection.h" |
||||
#include "vtkVersion.h" |
||||
#include "vtkVertex.h" |
||||
|
||||
int failed = 0; |
||||
|
||||
class vtkTestVertex : public vtkVertex |
||||
{ |
||||
public: |
||||
// Methods from vtkObject
|
||||
~vtkTestVertex()
|
||||
{ |
||||
} |
||||
|
||||
vtkTypeRevisionMacro(vtkTestVertex,vtkVertex); |
||||
static vtkTestVertex* New() { return new vtkTestVertex; } |
||||
vtkTestVertex() { } |
||||
private: |
||||
vtkTestVertex(const vtkTestVertex&); |
||||
void operator=(const vtkTestVertex&); |
||||
}; |
||||
|
||||
vtkCxxRevisionMacro(vtkTestVertex, "$Revision: 1.23 $"); |
||||
|
||||
class vtkTestVertex2 : public vtkVertex |
||||
{ |
||||
public: |
||||
~vtkTestVertex2()
|
||||
{ |
||||
} |
||||
|
||||
// Methods from vtkObject
|
||||
vtkTypeRevisionMacro(vtkTestVertex2,vtkVertex); |
||||
static vtkTestVertex2* New() { return new vtkTestVertex2; } |
||||
vtkTestVertex2() { } |
||||
private: |
||||
vtkTestVertex2(const vtkTestVertex2&); |
||||
void operator=(const vtkTestVertex2&); |
||||
}; |
||||
|
||||
vtkCxxRevisionMacro(vtkTestVertex2, "$Revision: 1.23 $"); |
||||
|
||||
VTK_CREATE_CREATE_FUNCTION(vtkTestVertex); |
||||
VTK_CREATE_CREATE_FUNCTION(vtkTestVertex2); |
||||
|
||||
class VTK_EXPORT TestFactory : public vtkObjectFactory |
||||
{ |
||||
public: |
||||
TestFactory(); |
||||
static TestFactory* New() { return new TestFactory;} |
||||
virtual const char* GetVTKSourceVersion() { return VTK_SOURCE_VERSION; } |
||||
const char* GetDescription() { return "A fine Test Factory"; } |
||||
|
||||
protected: |
||||
TestFactory(const TestFactory&); |
||||
void operator=(const TestFactory&); |
||||
}; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TestFactory::TestFactory() |
||||
{ |
||||
this->RegisterOverride("vtkVertex", |
||||
"vtkTestVertex", |
||||
"test vertex factory override", |
||||
1, |
||||
vtkObjectFactoryCreatevtkTestVertex); |
||||
this->RegisterOverride("vtkVertex", "vtkTestVertex2", |
||||
"test vertex factory override 2", |
||||
0, |
||||
vtkObjectFactoryCreatevtkTestVertex2); |
||||
} |
||||
|
||||
void TestNewVertex(vtkVertex* v, const char* expectedClassName) |
||||
{ |
||||
if(strcmp(v->GetClassName(), expectedClassName) != 0) |
||||
{ |
||||
failed = 1; |
||||
cout << "Test Failed" << endl; |
||||
} |
||||
} |
||||
|
||||
|
||||
int ObjectFactory(int, char *[]) |
||||
{ |
||||
vtkOutputWindow::GetInstance()->PromptUserOff(); |
||||
vtkGenericWarningMacro("Test Generic Warning"); |
||||
TestFactory* factory = TestFactory::New(); |
||||
vtkObjectFactory::RegisterFactory(factory); |
||||
factory->Delete(); |
||||
vtkVertex* v = vtkVertex::New(); |
||||
TestNewVertex(v, "vtkTestVertex"); |
||||
v->Delete(); |
||||
|
||||
// disable all vtkVertex creation with the
|
||||
factory->Disable("vtkVertex"); |
||||
v = vtkVertex::New(); |
||||
TestNewVertex(v, "vtkVertex"); |
||||
|
||||
factory->SetEnableFlag(1, "vtkVertex", "vtkTestVertex2"); |
||||
v->Delete(); |
||||
v = vtkVertex::New(); |
||||
TestNewVertex(v, "vtkTestVertex2"); |
||||
|
||||
factory->SetEnableFlag(0, "vtkVertex", "vtkTestVertex2"); |
||||
factory->SetEnableFlag(1, "vtkVertex", "vtkTestVertex"); |
||||
v->Delete(); |
||||
v = vtkVertex::New(); |
||||
TestNewVertex(v, "vtkTestVertex"); |
||||
v->Delete(); |
||||
vtkOverrideInformationCollection* oic =
|
||||
vtkOverrideInformationCollection::New(); |
||||
vtkObjectFactory::GetOverrideInformation("vtkVertex", oic); |
||||
vtkOverrideInformation* oi; |
||||
if(oic->GetNumberOfItems() != 2) |
||||
{ |
||||
cout << "Incorrect number of overrides for vtkVertex, expected 2, got: " |
||||
<< oic->GetNumberOfItems() << "\n"; |
||||
failed = 1; |
||||
if(oic->GetNumberOfItems() < 2) |
||||
{ |
||||
return 1; |
||||
} |
||||
} |
||||
vtkCollectionSimpleIterator oicit; |
||||
oic->InitTraversal(oicit); |
||||
oi = oic->GetNextOverrideInformation(oicit); |
||||
oi->GetObjectFactory(); |
||||
|
||||
if(strcmp(oi->GetClassOverrideName(), "vtkVertex")) |
||||
{ |
||||
cout << "failed: GetClassOverrideName should be vtkVertex, is: " |
||||
<< oi->GetClassOverrideName() << "\n"; |
||||
failed = 1; |
||||
} |
||||
if(strcmp(oi->GetClassOverrideWithName(), "vtkTestVertex")) |
||||
{ |
||||
cout << "failed: GetClassOverrideWithName should be vtkTestVertex, is: " |
||||
<< oi->GetClassOverrideWithName() << "\n"; |
||||
failed = 1; |
||||
} |
||||
if(strcmp(oi->GetDescription(), "test vertex factory override")) |
||||
{ |
||||
cout << "failed: GetClassOverrideWithName should be test vertex factory override, is: " |
||||
<< oi->GetDescription() << "\n"; |
||||
failed = 1; |
||||
} |
||||
|
||||
oi = oic->GetNextOverrideInformation(oicit); |
||||
if(strcmp(oi->GetClassOverrideName(), "vtkVertex")) |
||||
{ |
||||
cout << "failed: GetClassOverrideName should be vtkVertex, is: " |
||||
<< oi->GetClassOverrideName() << "\n"; |
||||
failed = 1; |
||||
} |
||||
if(strcmp(oi->GetClassOverrideWithName(), "vtkTestVertex2")) |
||||
{ |
||||
cout << "failed: GetClassOverrideWithName should be vtkTestVertex2, is: " |
||||
<< oi->GetClassOverrideWithName() << "\n"; |
||||
failed = 1; |
||||
} |
||||
if(strcmp(oi->GetDescription(), "test vertex factory override 2")) |
||||
{ |
||||
cout << "failed: GetClassOverrideWithName should be test vertex factory override 2, is: " |
||||
<< oi->GetDescription() << "\n"; |
||||
failed = 1; |
||||
} |
||||
oic->Delete(); |
||||
vtkObjectFactory::UnRegisterAllFactories(); |
||||
return failed; |
||||
} |
@ -0,0 +1,93 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: SystemInformation.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
// .NAME Test to print system information useful for remote debugging.
|
||||
// .SECTION Description
|
||||
// Remote dashboard debugging often requires access to the
|
||||
// CMakeCache.txt file. This test will display the file.
|
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
#include <Common/Testing/Cxx/SystemInformation.h> |
||||
#include <sys/stat.h> |
||||
|
||||
void vtkSystemInformationPrintFile(const char* name, ostream& os) |
||||
{ |
||||
os << "================================================================\n"; |
||||
struct stat fs; |
||||
if(stat(name, &fs) != 0) |
||||
{ |
||||
os << "The file \"" << name << "\" does not exist.\n"; |
||||
return; |
||||
} |
||||
|
||||
#ifdef _WIN32 |
||||
ifstream fin(name, ios::in | ios::binary); |
||||
#else |
||||
ifstream fin(name, ios::in); |
||||
#endif |
||||
|
||||
if(fin) |
||||
{ |
||||
os << "Contents of \"" << name << "\":\n"; |
||||
os << "----------------------------------------------------------------\n"; |
||||
const int bufferSize = 4096; |
||||
char buffer[bufferSize]; |
||||
// This copy loop is very sensitive on certain platforms with
|
||||
// slightly broken stream libraries (like HPUX). Normally, it is
|
||||
// incorrect to not check the error condition on the fin.read()
|
||||
// before using the data, but the fin.gcount() will be zero if an
|
||||
// error occurred. Therefore, the loop should be safe everywhere.
|
||||
while(fin) |
||||
{ |
||||
fin.read(buffer, bufferSize); |
||||
if(fin.gcount()) |
||||
{ |
||||
os.write(buffer, fin.gcount()); |
||||
} |
||||
} |
||||
os.flush(); |
||||
} |
||||
else |
||||
{ |
||||
os << "Error opening \"" << name << "\" for reading.\n"; |
||||
} |
||||
} |
||||
|
||||
int SystemInformation(int,char *[]) |
||||
{ |
||||
const char* files[] = |
||||
{ |
||||
CMAKE_BINARY_DIR "/CMakeCache.txt",
|
||||
VTK_BINARY_DIR "/vtkConfigure.h", |
||||
VTK_BINARY_DIR "/vtkToolkits.h", |
||||
CMAKE_BINARY_DIR "/CMakeFiles/CMakeError.log", |
||||
VTK_BINARY_DIR "/CMake/CMakeCache.txt",
|
||||
VTK_BINARY_DIR "/VTKBuildSettings.cmake", |
||||
VTK_BINARY_DIR "/VTKLibraryDepends.cmake", |
||||
VTK_BINARY_DIR "/VTKConfig.cmake", |
||||
0 |
||||
}; |
||||
|
||||
const char** f; |
||||
for(f = files; *f; ++f) |
||||
{ |
||||
vtkSystemInformationPrintFile(*f, cout); |
||||
} |
||||
|
||||
#if defined(__sgi) && !defined(__GNUC__) && defined(_COMPILER_VERSION) |
||||
cout << "SGI compiler version: " << int(_COMPILER_VERSION) << endl; |
||||
#endif |
||||
|
||||
return 0; |
||||
}
|
@ -0,0 +1,7 @@ |
||||
#ifndef __vtk_SystemInformation_h |
||||
#define __vtk_SystemInformation_h |
||||
|
||||
#define VTK_BINARY_DIR "@VTK_BINARY_DIR@" |
||||
#define CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@" |
||||
|
||||
#endif |
@ -0,0 +1,75 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: TestAmoebaMinimizer.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
#include "vtkAmoebaMinimizer.h" |
||||
#include <math.h> |
||||
|
||||
// the function to be minimized
|
||||
static void vtkFunctionToMinimize(void *arg) |
||||
{ |
||||
vtkAmoebaMinimizer *minimizer = (vtkAmoebaMinimizer *)arg; |
||||
|
||||
double x = minimizer->GetParameterValue("x"); |
||||
double y = minimizer->GetParameterValue("y"); |
||||
double z = minimizer->GetParameterValue("z"); |
||||
|
||||
double r = (x-5)*(x-5) + (y+2)*(y+2) + (z)*(z); |
||||
|
||||
minimizer->SetFunctionValue(r); |
||||
} |
||||
|
||||
int TestAmoebaMinimizer(int argc, char*[]) |
||||
{ |
||||
vtkAmoebaMinimizer *minimizer = vtkAmoebaMinimizer::New(); |
||||
|
||||
minimizer->SetFunction(&vtkFunctionToMinimize, minimizer); |
||||
minimizer->SetParameterValue("x",0.0); |
||||
minimizer->SetParameterScale("x",2.0); |
||||
minimizer->SetParameterValue("y",0.0); |
||||
minimizer->SetParameterScale("y",2.0); |
||||
minimizer->SetParameterValue("z",0.0); |
||||
minimizer->SetParameterScale("z",2.0); |
||||
|
||||
minimizer->Minimize(); |
||||
|
||||
double x = minimizer->GetParameterValue("x"); |
||||
double y = minimizer->GetParameterValue("y"); |
||||
double z = minimizer->GetParameterValue("z"); |
||||
|
||||
double r = minimizer->GetFunctionValue(); |
||||
|
||||
int iterations = minimizer->GetIterations(); |
||||
|
||||
int maxiterations = minimizer->GetMaxIterations(); |
||||
|
||||
int noconvergence = minimizer->Iterate(); |
||||
|
||||
minimizer->Delete(); |
||||
|
||||
// check parameters to make sure that they converged to the
|
||||
// correct values
|
||||
if (argc > 10 || |
||||
fabs(x - 5.0) > 1e-4 || |
||||
fabs(y + 2.0) > 1e-4 || |
||||
fabs(z - 0.0) > 1e-4 || |
||||
r > 1e-4 || |
||||
iterations >= maxiterations || |
||||
noconvergence) |
||||
{ |
||||
return 1; |
||||
} |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,664 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: TestCxxFeatures.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME TestCxxFeatures
|
||||
// .SECTION Description
|
||||
// Provides a reference for the set of C++ features that can be used
|
||||
// by VTK.
|
||||
|
||||
#include "vtkConfigure.h" |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Check for known compilers. */ |
||||
|
||||
#if defined(_MSC_VER) |
||||
# define VTK_CXX_MSVC |
||||
#endif |
||||
|
||||
#if defined(__sgi) && !defined(__GNUC__) |
||||
# define VTK_CXX_SGI |
||||
# if !defined(_COMPILER_VERSION) |
||||
# define VTK_CXX_SGI_6 |
||||
# endif |
||||
#endif |
||||
|
||||
#if defined(__HP_aCC) |
||||
# define VTK_CXX_ACC |
||||
#endif |
||||
|
||||
#if defined(__SUNPRO_CC) |
||||
# define VTK_CXX_SUNPRO |
||||
#endif |
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3) |
||||
# if (__GNUC__ < 3) |
||||
# define VTK_CXX_GCC_2 |
||||
# elif (__GNUC__ == 3) |
||||
# define VTK_CXX_GCC_3 |
||||
# endif |
||||
#endif |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Check for known compiler limitations. */ |
||||
|
||||
// Check for IRIX64-6.5-CC-o32 (old SGI compiler).
|
||||
#if defined(VTK_CXX_SGI_6) |
||||
# define VTK_TYPENAME /* empty */ |
||||
# define VTK_CLASS_TEMPLATE_SPECIALIZATION /* empty */ |
||||
#endif |
||||
|
||||
// Check for MSVC.
|
||||
#if defined(VTK_CXX_MSVC) && (_MSC_VER < 1310) |
||||
# define VTK_TYPENAME /* empty */ |
||||
#endif |
||||
|
||||
// Assume standard behavior if symbol is not already defined.
|
||||
#if !defined(VTK_TYPENAME) |
||||
# define VTK_TYPENAME typename |
||||
#endif |
||||
|
||||
// Assume standard behavior if symbol is not already defined.
|
||||
#if !defined(VTK_CLASS_TEMPLATE_SPECIALIZATION) |
||||
# define VTK_CLASS_TEMPLATE_SPECIALIZATION template <> |
||||
#endif |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "vtkSystemIncludes.h" |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test inclusion of sstream header. */ |
||||
//#if !(defined(VTK_CXX_GCC_2) || defined(VTK_CXX_ACC) || defined(VTK_CXX_SGI_6))
|
||||
#if defined(VTK_CXX_GCC_3) |
||||
# include <sstream> |
||||
#endif |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test inclusion of typeinfo header. */ |
||||
|
||||
#include <typeinfo> |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test use of namespaces. */ |
||||
|
||||
#if !defined(VTK_CXX_SGI_6) |
||||
// Fails on kulu.crd IRIX64-6.5-CC-o32 (old SGI compiler).
|
||||
namespace NamespaceTest {} |
||||
namespace {} |
||||
void NamespaceTestFunc() {} |
||||
namespace NamespaceTest |
||||
{ |
||||
using ::NamespaceTestFunc; |
||||
} |
||||
using namespace NamespaceTest; |
||||
#endif |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test nested classes defined outside. */ |
||||
|
||||
class NestedTestOuter |
||||
{ |
||||
public: |
||||
NestedTestOuter(); |
||||
~NestedTestOuter(); |
||||
private: |
||||
class NestedTestInner; |
||||
NestedTestInner* Inner; |
||||
}; |
||||
|
||||
class NestedTestOuter::NestedTestInner |
||||
{ |
||||
public: |
||||
NestedTestInner() {} |
||||
~NestedTestInner() {} |
||||
}; |
||||
|
||||
NestedTestOuter::NestedTestOuter() |
||||
{ |
||||
this->Inner = new NestedTestInner; |
||||
} |
||||
|
||||
NestedTestOuter::~NestedTestOuter() |
||||
{ |
||||
delete this->Inner; |
||||
} |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test inclusion of some stl headers. */ |
||||
#ifdef _MSC_VER |
||||
#pragma warning (push, 2) |
||||
#endif |
||||
|
||||
#include <vector> |
||||
|
||||
#ifdef _MSC_VER |
||||
#pragma warning(pop) |
||||
#endif |
||||
|
||||
#if !defined(VTK_CXX_SGI_6) |
||||
// Fails on kulu.crd IRIX64-6.5-CC-o32 (old SGI compiler).
|
||||
void UsingStdVector() |
||||
{ |
||||
using vtkstd::vector; |
||||
vector<int>(); |
||||
} |
||||
#endif |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test full template specialization of functions. */ |
||||
template <class T> |
||||
int FullySpecializedFunction(T*) |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
#if !defined(VTK_CXX_SGI) |
||||
// Fails on kulu.crd IRIX64-6.5-CC-o32 (old SGI compiler).
|
||||
// Fails on manifold.crd IRIX64-6.5-CC-n32 (new SGI compiler).
|
||||
template <> |
||||
int FullySpecializedFunction<int>(int*) |
||||
{ |
||||
return 1; |
||||
} |
||||
#else |
||||
// Let overload resolution pick this one instead.
|
||||
int FullySpecializedFunction(int*) |
||||
{ |
||||
return 1; |
||||
} |
||||
#endif |
||||
|
||||
int TestFullySpecializedFunction() |
||||
{ |
||||
int result = 1; |
||||
int should_be_0 = FullySpecializedFunction(static_cast<float*>(0)); |
||||
if(should_be_0 != 0) |
||||
{ |
||||
cerr << "FullySpecializedFunction<float*>() returned " |
||||
<< should_be_0 << ", not 0.\n"; |
||||
result = 0; |
||||
} |
||||
int should_be_1 = FullySpecializedFunction(static_cast<int*>(0)); |
||||
if(should_be_1 != 1) |
||||
{
|
||||
cerr << "FullySpecializedFunction(int*) returned " |
||||
<< should_be_1 << ", not 1.\n"; |
||||
result = 0; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test member template of non-template. */ |
||||
|
||||
class NonTemplate |
||||
{ |
||||
void* Pointer; |
||||
public: |
||||
template <class T> void Set(T* t) { this->Pointer = t; } |
||||
template <class T> void Get(T*& t) { t = static_cast<T*>(this->Pointer); } |
||||
}; |
||||
|
||||
int TestNonTemplateMemberTemplate() |
||||
{ |
||||
int x = 123; |
||||
int* px = 0; |
||||
NonTemplate nt; |
||||
nt.Set(&x); |
||||
nt.Get(px); |
||||
return (*px == 123); |
||||
} |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test member template of template. */ |
||||
|
||||
template <class T> |
||||
class OuterTemplate |
||||
{ |
||||
T* Pointer; |
||||
public: |
||||
template <class U> void Set(U* u) { this->Pointer = u; } |
||||
template <class U> void Get(U*& u) { u = static_cast<U*>(this->Pointer); } |
||||
}; |
||||
|
||||
int TestTemplateMemberTemplate() |
||||
{ |
||||
int x = 123; |
||||
int* px = 0; |
||||
OuterTemplate<void> nt; |
||||
nt.Set(&x); |
||||
nt.Get(px); |
||||
return (*px == 123); |
||||
} |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test use of standard "bool" type and values. */ |
||||
|
||||
#if !defined(VTK_CXX_SGI_6) |
||||
bool GetFalse() |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool GetTrue() |
||||
{ |
||||
return true; |
||||
} |
||||
|
||||
int TestBool() |
||||
{ |
||||
int result = 1; |
||||
bool should_be_false = GetFalse(); |
||||
bool should_be_true = GetTrue(); |
||||
if(should_be_false) |
||||
{ |
||||
cerr << "GetFalse() returned " << should_be_false << ", not false.\n"; |
||||
result = 0; |
||||
} |
||||
if(!should_be_true) |
||||
{ |
||||
cerr << "GetTrue() returned " << should_be_true << ", not true.\n"; |
||||
result = 0; |
||||
} |
||||
return result; |
||||
} |
||||
#endif |
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test full template specialization of classes. */ |
||||
|
||||
template <class T> |
||||
struct FullySpecializedClass |
||||
{ |
||||
static int Method() { return 0; } |
||||
typedef T Type; |
||||
}; |
||||
|
||||
VTK_CLASS_TEMPLATE_SPECIALIZATION |
||||
struct FullySpecializedClass<float> |
||||
{ |
||||
static int Method() { return 1; } |
||||
typedef int Type; |
||||
}; |
||||
|
||||
template <class T> |
||||
int TestFullySpecializedClassTrait(T*) |
||||
{ |
||||
typedef VTK_TYPENAME FullySpecializedClass<T>::Type Type; |
||||
if(static_cast<Type>(3.1) == 3.1) |
||||
{ |
||||
return 0; |
||||
} |
||||
return 1; |
||||
} |
||||
|
||||
int TestFullySpecializedClass() |
||||
{ |
||||
int result = 1; |
||||
int should_be_0 = FullySpecializedClass<int>::Method(); |
||||
if(should_be_0 != 0) |
||||
{ |
||||
cerr << "FullySpecializedClass<int>::Method() returned " |
||||
<< should_be_0 << ", not 0.\n"; |
||||
result = 0; |
||||
} |
||||
int should_be_1 = FullySpecializedClass<float>::Method(); |
||||
if(should_be_1 != 1) |
||||
{
|
||||
cerr << "FullySpecializedClass<float>::Method() returned " |
||||
<< should_be_1 << ", not 1.\n"; |
||||
result = 0; |
||||
} |
||||
if(!TestFullySpecializedClassTrait(static_cast<float*>(0))) |
||||
{ |
||||
cerr << "Trait lookup of float didn't produce int."; |
||||
result = 0; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test if(int x = f()) style scoping. */ |
||||
|
||||
int TestIfScopeHelper(int i) |
||||
{ |
||||
int result = 1; |
||||
if(int x = i) |
||||
{ |
||||
if(x != i) |
||||
{ |
||||
cerr << "TestIfScope: x != " << i << "\n"; |
||||
result = 0; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
if(x != i) |
||||
{ |
||||
cerr << "TestIfScope: x != " << i << "\n"; |
||||
result = 0; |
||||
} |
||||
} |
||||
int x = result; |
||||
return x; |
||||
} |
||||
|
||||
int TestIfScope() |
||||
{ |
||||
int result = 1; |
||||
if(!TestIfScopeHelper(1)) |
||||
{ |
||||
result = 0; |
||||
} |
||||
if(!TestIfScopeHelper(0)) |
||||
{ |
||||
result = 0; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test non-type template parameter. */ |
||||
|
||||
template <int I> |
||||
struct NonTypeTemplate |
||||
{ |
||||
static int GetValue() { return I; } |
||||
}; |
||||
|
||||
int TestNonTypeTemplate() |
||||
{ |
||||
int result = 1; |
||||
if(NonTypeTemplate<0>::GetValue() != 0) |
||||
{ |
||||
cerr << "NonTypeTemplate<0>::GetValue() != 0\n"; |
||||
result = 0; |
||||
} |
||||
if(NonTypeTemplate<1>::GetValue() != 1) |
||||
{ |
||||
cerr << "NonTypeTemplate<1>::GetValue() != 1\n"; |
||||
result = 0; |
||||
} |
||||
if(NonTypeTemplate<2>::GetValue() != 2) |
||||
{ |
||||
cerr << "NonTypeTemplate<2>::GetValue() != 2\n"; |
||||
result = 0; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test mixed type and non-type template arguments in a non-trival way. */ |
||||
|
||||
#if !(defined(VTK_CXX_MSVC) && (_MSC_VER < 1300)) && !defined(__BORLANDC__) |
||||
// Visual Studio 6 and Borland do not support this fancy array template.
|
||||
template <class T, int N> |
||||
int TestMixedTypeTemplateFunction(T (*)[N]) |
||||
{ |
||||
return N; |
||||
} |
||||
int TestMixedTypeTemplate() |
||||
{ |
||||
int x2[2]; |
||||
float x3[3]; |
||||
int result = 1; |
||||
if(TestMixedTypeTemplateFunction(&x2) != 2) |
||||
{ |
||||
cerr << "TestMixedTypeTemplateFunction(&x2) != 2\n"; |
||||
result = 0; |
||||
} |
||||
if(TestMixedTypeTemplateFunction(&x3) != 3) |
||||
{ |
||||
cerr << "TestMixedTypeTemplateFunction(&x3) != 3\n"; |
||||
result = 0; |
||||
} |
||||
return result; |
||||
} |
||||
#endif |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
int TestBinaryWriting() |
||||
{ |
||||
int result = 1; |
||||
// ios::binary does not exist on SGI and OSF cxx (DEC)
|
||||
// it failed to compile on these machines:
|
||||
// ct02_oc.crd IRIX64-6.5-CC-64
|
||||
// manifold IRIX64-6.5-CC-n32
|
||||
// kulu.crd IRIX64-6.5-CC-o32
|
||||
// a62.iue.tuwien.ac.at OSF1-V5.1-cxx
|
||||
#if defined(VTK_CXX_SGI) || defined( __DECCXX_VER) |
||||
ofstream fout_with_warning_C4701("TestCxxFeatures_TestBinaryWriting", ios::out ); |
||||
#else |
||||
ofstream fout_with_warning_C4701("TestCxxFeatures_TestBinaryWriting", ios::out | ios::binary); |
||||
#endif |
||||
if(!fout_with_warning_C4701) |
||||
{ |
||||
cerr << "Error opening TestCxxFeatures_TestBinaryWriting for binary writing.\n"; |
||||
result = 0; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class SafeBoolIdiomClass |
||||
{ |
||||
private: |
||||
struct SafeBoolDummy { void Dummy() {} }; |
||||
typedef void (SafeBoolDummy::* SafeBool)(); |
||||
public: |
||||
SafeBoolIdiomClass(int x): Value(x) {} |
||||
operator SafeBool() |
||||
{ |
||||
return this->Value? &SafeBoolDummy::Dummy : 0; |
||||
} |
||||
SafeBool operator !() |
||||
{ |
||||
return this->Value? 0 : &SafeBoolDummy::Dummy; |
||||
} |
||||
protected: |
||||
int Value; |
||||
}; |
||||
|
||||
int TestSafeBoolIdiom() |
||||
{ |
||||
int result = 1; |
||||
SafeBoolIdiomClass cTrue(1); |
||||
SafeBoolIdiomClass cFalse(0); |
||||
if(cTrue) {} |
||||
else |
||||
{ |
||||
cerr << "if(cTrue) evaluates to false.\n"; |
||||
result = 0; |
||||
} |
||||
if(!cTrue) |
||||
{ |
||||
cerr << "if(!cTrue) evaluates to true.\n"; |
||||
result = 0; |
||||
} |
||||
if(cFalse) |
||||
{ |
||||
cerr << "if(cFalse) evaluates to true.\n"; |
||||
result = 0; |
||||
} |
||||
if(!cFalse) {} |
||||
else |
||||
{ |
||||
cerr << "if(!cFalse) evaluates to false.\n"; |
||||
result = 0; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test use of exceptions. */ |
||||
|
||||
#if defined(_MSC_VER) |
||||
# pragma warning (push) |
||||
# pragma warning (disable: 4702) /* Unreachable code. */ |
||||
#endif |
||||
|
||||
class TestExceptionUnwind |
||||
{ |
||||
int* pvalue; |
||||
public: |
||||
TestExceptionUnwind(int* p): pvalue(p) {} |
||||
~TestExceptionUnwind() { *pvalue = 1; } |
||||
void Use() {} |
||||
}; |
||||
|
||||
class ExceptionClass {}; |
||||
|
||||
void TestThrowException(int* p) |
||||
{ |
||||
TestExceptionUnwind unwind(p); |
||||
unwind.Use(); |
||||
throw ExceptionClass(); |
||||
} |
||||
|
||||
int TestException() |
||||
{ |
||||
int value = 0; |
||||
try |
||||
{ |
||||
TestThrowException(&value); |
||||
} |
||||
catch(ExceptionClass&) |
||||
{ |
||||
if(value) |
||||
{ |
||||
return 1; |
||||
} |
||||
else |
||||
{ |
||||
cerr << "TestExceptionUnwind object not destroyed!" << endl; |
||||
return 0; |
||||
} |
||||
} |
||||
catch(...) |
||||
{ |
||||
cerr << "ExceptionClass not caught!" << endl; |
||||
return 0; |
||||
} |
||||
cerr << "No exception caught!" << endl; |
||||
return 0; |
||||
} |
||||
|
||||
#if defined(_MSC_VER) |
||||
# pragma warning (pop) |
||||
#endif |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* Test void return type syntax. */ |
||||
|
||||
void TestVoidReturnInner() {} |
||||
void TestVoidReturnOuter() |
||||
{ |
||||
// Visual Studio 6 and MIPSpro 7.3 do not support void returns.
|
||||
#if !(defined(_MSC_VER) && (_MSC_VER < 1300) || defined(_COMPILER_VERSION) && (_COMPILER_VERSION < 740)) |
||||
return TestVoidReturnInner(); |
||||
#endif |
||||
} |
||||
|
||||
// MIPSpro warns about type qualifiers on return types.
|
||||
#if defined(_COMPILER_VERSION) |
||||
# pragma set woff 3303 // type qualifier on return is meaningless
|
||||
#endif |
||||
// Intel C++ warns about type qualifiers on return types.
|
||||
#if defined(__INTEL_COMPILER) |
||||
# pragma warning (push) |
||||
# pragma warning (disable:858) // type qualifier on return is meaningless
|
||||
#endif |
||||
|
||||
void const TestVoidConstReturn() {} |
||||
|
||||
#if defined(__INTEL_COMPILER) |
||||
# pragma warning (pop) |
||||
#endif |
||||
|
||||
#if defined(_COMPILER_VERSION) |
||||
# pragma reset woff 3303 // type qualifier on return is meaningless
|
||||
#endif |
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// See if the following code works on all platforms
|
||||
#if defined(_MSC_VER) && defined(_DEBUG) |
||||
/* MSVC debug hook to prevent dialogs when running from DART. */ |
||||
# include <crtdbg.h> |
||||
static int TestDriverDebugReport(int type, char* message, int* retVal) |
||||
{ |
||||
(void)type; (void)retVal; |
||||
fprintf(stderr, message); |
||||
exit(1); |
||||
} |
||||
#endif |
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#define DO_TEST(x) \ |
||||
if(x()) { cout << "Passed: " #x "\n"; } \
|
||||
else { cout << "Failed: " #x "\n"; result = 1; } |
||||
|
||||
int main() |
||||
{ |
||||
int result = 0; |
||||
DO_TEST(TestFullySpecializedFunction); |
||||
DO_TEST(TestNonTemplateMemberTemplate); |
||||
DO_TEST(TestTemplateMemberTemplate); |
||||
#if !defined(VTK_CXX_SGI_6) |
||||
DO_TEST(TestBool); |
||||
#endif |
||||
DO_TEST(TestFullySpecializedClass); |
||||
DO_TEST(TestIfScope); |
||||
DO_TEST(TestNonTypeTemplate); |
||||
#if !(defined(VTK_CXX_MSVC) && (_MSC_VER < 1300)) && !defined(__BORLANDC__) |
||||
DO_TEST(TestMixedTypeTemplate); |
||||
#endif |
||||
DO_TEST(TestBinaryWriting); |
||||
DO_TEST(TestSafeBoolIdiom); |
||||
#ifndef VTK_CXX_GCC_2 // avoid strange exception problem on debian gcc 2.95
|
||||
DO_TEST(TestException); |
||||
#endif |
||||
#if defined(_MSC_VER) && defined(_DEBUG) |
||||
// just call the code to shut up a linker warning
|
||||
int retVal = 0; |
||||
if (result) |
||||
{ |
||||
// really shouldn't be calle dunless somehting else failed
|
||||
// just want to make the compiler think it might get called
|
||||
// all this will be yanked once I see the results of this test
|
||||
TestDriverDebugReport(0, "a temp test", &retVal); |
||||
} |
||||
#endif |
||||
return result; |
||||
} |
@ -0,0 +1,40 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: TestDirectory.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests the Directory class
|
||||
|
||||
#include "vtkDirectory.h" |
||||
#include "vtkDebugLeaks.h" |
||||
|
||||
int TestDirectory(int,char *[]) |
||||
{ |
||||
vtkDirectory *myDir = vtkDirectory::New(); |
||||
vtkDirectory *testDir = vtkDirectory::New(); |
||||
myDir->Open ("."); |
||||
char buf[1024]; |
||||
myDir->GetCurrentWorkingDirectory(buf, 1024); |
||||
cout << "Working Directory: " << buf << endl; |
||||
// Get each file name in the directory
|
||||
for (int i = 0; i < myDir->GetNumberOfFiles(); i++) |
||||
{ |
||||
cout << (testDir->Open(myDir->GetFile(i)) == 0 ? "file: " : "dir: ") << myDir->GetFile(i) << endl; |
||||
} |
||||
|
||||
myDir->Delete(); |
||||
testDir->Delete(); |
||||
return 0; |
||||
}
|
@ -0,0 +1,119 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: TestGarbageCollector.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
#include "vtkCallbackCommand.h" |
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkGarbageCollector.h" |
||||
#include "vtkObject.h" |
||||
#include "vtkSmartPointer.h" |
||||
|
||||
// A class that simulates a reference loop and participates in garbage
|
||||
// collection.
|
||||
class vtkTestReferenceLoop: public vtkObject |
||||
{ |
||||
public: |
||||
static vtkTestReferenceLoop* New() { return new vtkTestReferenceLoop; } |
||||
vtkTypeMacro(vtkTestReferenceLoop, vtkObject); |
||||
|
||||
void Register(vtkObjectBase* o) { this->RegisterInternal(o, 1); } |
||||
void UnRegister(vtkObjectBase* o) { this->UnRegisterInternal(o, 1); } |
||||
|
||||
protected: |
||||
vtkTestReferenceLoop() |
||||
{ |
||||
this->Other = new vtkTestReferenceLoop(this); |
||||
#ifdef VTK_DEBUG_LEAKS |
||||
vtkDebugLeaks::ConstructClass("vtkTestReferenceLoop"); |
||||
#endif |
||||
} |
||||
vtkTestReferenceLoop(vtkTestReferenceLoop* other) |
||||
{ |
||||
this->Other = other; |
||||
this->Other->Register(this); |
||||
#ifdef VTK_DEBUG_LEAKS |
||||
vtkDebugLeaks::ConstructClass("vtkTestReferenceLoop"); |
||||
#endif |
||||
} |
||||
~vtkTestReferenceLoop() |
||||
{ |
||||
if(this->Other) |
||||
{ |
||||
this->Other->UnRegister(this); |
||||
this->Other = 0; |
||||
} |
||||
} |
||||
|
||||
void ReportReferences(vtkGarbageCollector* collector) |
||||
{ |
||||
vtkGarbageCollectorReport(collector, this->Other, "Other"); |
||||
} |
||||
|
||||
vtkTestReferenceLoop* Other; |
||||
|
||||
private: |
||||
vtkTestReferenceLoop(const vtkTestReferenceLoop&); // Not implemented.
|
||||
void operator=(const vtkTestReferenceLoop&); // Not implemented.
|
||||
}; |
||||
|
||||
// A callback that reports when it is called.
|
||||
static int called = 0; |
||||
void MyDeleteCallback(vtkObject*, unsigned long, void*, void*) |
||||
{ |
||||
called = 1; |
||||
} |
||||
|
||||
// Main test function.
|
||||
int TestGarbageCollector(int,char *[]) |
||||
{ |
||||
// Create a callback that reports when it is called.
|
||||
vtkSmartPointer<vtkCallbackCommand> cc = |
||||
vtkSmartPointer<vtkCallbackCommand>::New(); |
||||
cc->SetCallback(MyDeleteCallback); |
||||
|
||||
// Create an object and delete it immediately. It should be
|
||||
// immediately collected.
|
||||
vtkTestReferenceLoop* obj = vtkTestReferenceLoop::New(); |
||||
obj->AddObserver(vtkCommand::DeleteEvent, cc); |
||||
called = 0; |
||||
obj->Delete(); |
||||
if(!called) |
||||
{ |
||||
cerr << "Object not immediately collected." << endl; |
||||
return 1; |
||||
} |
||||
|
||||
// Create an object, enable deferred collection, and delete it. It
|
||||
// should not be collected yet.
|
||||
obj = vtkTestReferenceLoop::New(); |
||||
obj->AddObserver(vtkCommand::DeleteEvent, cc); |
||||
vtkGarbageCollector::DeferredCollectionPush(); |
||||
called = 0; |
||||
obj->Delete(); |
||||
if(called) |
||||
{ |
||||
cerr << "Object collection not deferred." << endl; |
||||
return 1; |
||||
} |
||||
|
||||
// Disable deferred collection. The object should be deleted now.
|
||||
vtkGarbageCollector::DeferredCollectionPop(); |
||||
if(!called) |
||||
{ |
||||
cerr << "Deferred collection did not collect object." << endl; |
||||
return 1; |
||||
} |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,56 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: TestImageIterator.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME Test of image iterators
|
||||
// .SECTION Description
|
||||
// this program tests the image iterators
|
||||
// At this point it only creates an object of every supported type.
|
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkImageIterator.h" |
||||
#include "vtkImageProgressIterator.h" |
||||
#include "vtkImageData.h" |
||||
|
||||
template<class T> |
||||
inline int DoTest(T*) |
||||
{ |
||||
int ext[6] = { 0, 0, 0, 0, 0, 0 }; |
||||
vtkImageData *id = vtkImageData::New(); |
||||
id->SetExtent(ext); |
||||
vtkImageIterator<T> *it = new vtkImageIterator<T>(id,ext); |
||||
vtkImageProgressIterator<T> *ipt
|
||||
= new vtkImageProgressIterator<T>(id,ext,0,0); |
||||
delete it; |
||||
delete ipt; |
||||
id->Delete(); |
||||
return 0; |
||||
} |
||||
|
||||
|
||||
int TestImageIterator(int,char *[]) |
||||
{ |
||||
DoTest( static_cast<char*>( 0 ) ); |
||||
DoTest( static_cast<int*>( 0 ) ); |
||||
DoTest( static_cast<long*>( 0 ) ); |
||||
DoTest( static_cast<short*>( 0 ) ); |
||||
DoTest( static_cast<float*>( 0 ) ); |
||||
DoTest( static_cast<double*>( 0 ) ); |
||||
DoTest( static_cast<unsigned long*>( 0 ) ); |
||||
DoTest( static_cast<unsigned short*>( 0 ) ); |
||||
DoTest( static_cast<unsigned char*>( 0 ) ); |
||||
DoTest( static_cast<unsigned int*>( 0 ) );
|
||||
|
||||
return 0; |
||||
}
|
@ -0,0 +1,45 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: TestInstantiator.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
// .NAME Test of vtkCommonInstantiator
|
||||
// .SECTION Description
|
||||
// Make sure common registers its classes with vtkInstantiator.
|
||||
|
||||
#include "vtkCommonInstantiator.h" |
||||
|
||||
int main() |
||||
{ |
||||
int result = 0; |
||||
vtkObject* object = vtkInstantiator::CreateInstance("vtkDoubleArray"); |
||||
if(object) |
||||
{ |
||||
if(object->IsA("vtkDoubleArray")) |
||||
{ |
||||
cout << "Successfully created an instance of vtkDoubleArray." << endl; |
||||
} |
||||
else |
||||
{ |
||||
cerr << "Created an instance of " << object->GetClassName() |
||||
<< "instead of vtkDoubleArray." << endl; |
||||
result = 1; |
||||
} |
||||
object->Delete(); |
||||
} |
||||
else |
||||
{ |
||||
cerr << "Failed to create an instance of vtkDoubleArray." << endl; |
||||
result = 1; |
||||
} |
||||
return result; |
||||
} |
@ -0,0 +1,76 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: TestSmartPointer.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
// .NAME Test of vtkSmartPointer.
|
||||
// .SECTION Description
|
||||
// Tests instantiations of the vtkSmartPointer class template.
|
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkFloatArray.h" |
||||
#include "vtkIntArray.h" |
||||
#include "vtkSmartPointer.h" |
||||
|
||||
int TestSmartPointer(int,char *[]) |
||||
{ |
||||
vtkIntArray* ia = vtkIntArray::New(); |
||||
|
||||
// Coverage:
|
||||
vtkSmartPointer<vtkDataArray> da1; |
||||
vtkSmartPointer<vtkIntArray> da2(ia); |
||||
vtkSmartPointer<vtkFloatArray> da3(da1); |
||||
da1 = ia; |
||||
da2 = da1; |
||||
da2 == da3; |
||||
da2 != da3; |
||||
da2 < da3; |
||||
da2 <= da3; |
||||
da2 > da3; |
||||
da2 >= da3; |
||||
ia == da3; |
||||
ia != da3; |
||||
ia < da3; |
||||
ia <= da3; |
||||
ia > da3; |
||||
ia >= da3; |
||||
da2 == ia; |
||||
da2 != ia; |
||||
da2 < ia; |
||||
da2 <= ia; |
||||
da2 > ia; |
||||
da2 >= ia; |
||||
da1 == 0; |
||||
da1 != 0; |
||||
da1 < 0; |
||||
da1 <= 0; |
||||
da1 > 0; |
||||
da1 >= 0; |
||||
(*da1).SetNumberOfComponents(1); |
||||
if(da2) |
||||
{ |
||||
da2->SetNumberOfComponents(1); |
||||
} |
||||
if(!da2) |
||||
{ |
||||
cerr << "da2 is NULL!" << "\n"; |
||||
return 1; |
||||
} |
||||
cout << "IntArray: " << da2 << "\n"; |
||||
da1 = vtkSmartPointer<vtkDataArray>::NewInstance(ia); |
||||
da1.TakeReference(vtkIntArray::New()); |
||||
vtkSmartPointer<vtkIntArray> da4 = |
||||
vtkSmartPointer<vtkIntArray>::Take(vtkIntArray::New()); |
||||
ia->Delete(); |
||||
|
||||
return 0; |
||||
}
|
@ -0,0 +1,673 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherArrays.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkCharArray.h" |
||||
#include "vtkUnsignedCharArray.h" |
||||
#include "vtkIntArray.h" |
||||
#include "vtkUnsignedIntArray.h" |
||||
#include "vtkLongArray.h" |
||||
#include "vtkUnsignedLongArray.h" |
||||
#include "vtkShortArray.h" |
||||
#include "vtkUnsignedShortArray.h" |
||||
#include "vtkFloatArray.h" |
||||
#include "vtkDoubleArray.h" |
||||
#include "vtkIdTypeArray.h" |
||||
|
||||
#define SIZE 1000 |
||||
|
||||
template <class T, class A, class V> |
||||
int doArrayTest (ostream& strm, T *ptr, A *array, V value, int size) |
||||
{ |
||||
float tuple1[SIZE/100]; |
||||
double tuple3[SIZE/100]; |
||||
double *tuple2; |
||||
int i; |
||||
int errors = 0; |
||||
|
||||
strm << "\tResize(0)..."; |
||||
ptr->Resize(0);
|
||||
strm << "OK" << endl; |
||||
|
||||
strm << "\tResize(10)..."; |
||||
ptr->Resize(10);
|
||||
strm << "OK" << endl; |
||||
|
||||
strm << "\tResize(5)..."; |
||||
ptr->Resize(5);
|
||||
strm << "OK" << endl; |
||||
|
||||
strm << "\tResize(size)..."; |
||||
ptr->Resize(size);
|
||||
strm << "OK" << endl; |
||||
|
||||
strm << "\tSetNumberOfTuples..."; |
||||
ptr->SetNumberOfTuples (100); |
||||
if (ptr->GetNumberOfTuples() == 100) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
strm << "\tSetNumberOfComponents..."; |
||||
ptr->SetNumberOfComponents (10); |
||||
if (ptr->GetNumberOfComponents() == 10) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tSetVoidArray..."; |
||||
ptr->SetVoidArray(array, size, 1);
|
||||
strm << "OK" << endl; |
||||
|
||||
strm << "CreateDefaultLookupTable" << endl; |
||||
ptr->CreateDefaultLookupTable(); |
||||
strm << *ptr; |
||||
|
||||
strm << "\tGetTuple(i)..."; |
||||
tuple2 = ptr->GetTuple (2); |
||||
int passed = 1; |
||||
if (tuple2) |
||||
{ |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
strm << *(tuple2 + i) << " "; |
||||
if (*(tuple2 + i) != (20 + i)) |
||||
{ |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tGetTuple(i, double *tuple)..."; |
||||
ptr->GetTuple (4, tuple3); |
||||
passed = 1; |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
tuple1[i] = static_cast<float>(tuple3[i]); |
||||
strm << tuple3[i] << " "; |
||||
if (tuple3[i] != (40 + i)) |
||||
{ |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tvtkDataArray::GetTuple(i, double *tuple)..."; |
||||
((vtkDataArray*)ptr)->GetTuple (4, tuple3); |
||||
passed = 1; |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
strm << tuple3[i] << " "; |
||||
if (tuple3[i] != (40 + i)) |
||||
{ |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tSetValue(i, value)..."; |
||||
ptr->SetValue (99, value); |
||||
if (ptr->GetValue (99) == value) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertValue(i, value)..."; |
||||
ptr->InsertValue (500, value); |
||||
if (ptr->GetValue (500) == value) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertNextValue(value)..."; |
||||
if (ptr->GetValue (ptr->InsertNextValue (static_cast<char>(22.0))) == 22.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertComponent(i, j, 5.0)..."; |
||||
ptr->InsertComponent (500, 9, 5.0); |
||||
if (ptr->GetComponent (500, 9) == 5.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tSetTuple(i, float *tuple)..."; |
||||
ptr->SetTuple (99, tuple1); |
||||
for (i=0; i < 10; i++) tuple3[i] = 0; |
||||
ptr->GetTuple (99, tuple3); |
||||
passed = 1; |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
strm << tuple3[i] << " "; |
||||
if (tuple3[i] != (40 + i)) |
||||
{ |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tSetTuple(i, double *tuple)..."; |
||||
ptr->SetTuple (99, tuple3); |
||||
for (i=0; i < 10; i++) tuple3[i] = 0; |
||||
ptr->GetTuple (99, tuple3); |
||||
passed = 1; |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
strm << tuple3[i] << " "; |
||||
if (tuple3[i] != (40 + i)) |
||||
{ |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertTuple(i, float *tuple)..."; |
||||
ptr->InsertTuple (100, tuple1); |
||||
for (i=0; i < 10; i++) tuple3[i] = 0; |
||||
ptr->GetTuple (100, tuple3); |
||||
passed = 1; |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
strm << tuple3[i] << " "; |
||||
if (tuple3[i] != (40 + i)) |
||||
{ |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertTuple(i, double *tuple)..."; |
||||
ptr->InsertTuple (100, tuple3); |
||||
for (i=0; i < 10; i++) tuple3[i] = 0; |
||||
ptr->GetTuple (100, tuple3); |
||||
passed = 1; |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
strm << tuple3[i] << " "; |
||||
if (tuple3[i] != (40 + i)) |
||||
{ |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertNextTuple(float *tuple)..."; |
||||
for (i=0; i < 10; i++) tuple1[i] = 30 + i; |
||||
ptr->GetTuple (ptr->InsertNextTuple (tuple1), tuple3); |
||||
passed = 1; |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
strm << tuple3[i] << " "; |
||||
if (tuple3[i] != (30 + i)) |
||||
{ |
||||
strm << "Expected " << 30 + 1 << " "; |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertNextTuple(double *tuple)..."; |
||||
for (i=0; i < 10; i++) tuple3[i] = 40 + i; |
||||
ptr->GetTuple (ptr->InsertNextTuple (tuple3), tuple3); |
||||
passed = 1; |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
strm << tuple3[i] << " "; |
||||
if (tuple3[i] != (40 + i)) |
||||
{ |
||||
strm << "Expected " << 40 + 1; |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tvtkDataArray::GetData..."; |
||||
vtkDoubleArray *farray = vtkDoubleArray::New(); |
||||
farray->SetNumberOfComponents(1); |
||||
ptr->vtkDataArray::GetData (0, 59, 1, 1, farray); |
||||
passed = 1; |
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
strm << farray->GetTuple(i)[0] << " "; |
||||
if (farray->GetTuple(i)[0] != (1 + i*10)) |
||||
{ |
||||
passed = 0; |
||||
break; |
||||
} |
||||
} |
||||
if (passed) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
|
||||
strm << "\tSetTuple1..."; |
||||
ptr->SetNumberOfComponents(1); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->SetTuple1(50,10.0); |
||||
if (ptr->GetTuple1(50) == 10.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tSetTuple2..."; |
||||
ptr->SetNumberOfComponents(2); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->SetTuple2(50,10.0,20.0); |
||||
if (ptr->GetTuple2(50)[0] == 10.0 && |
||||
ptr->GetTuple2(50)[1] == 20.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tSetTuple3..."; |
||||
ptr->SetNumberOfComponents(3); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->SetTuple3(50,10.0,20.0,30.0); |
||||
if (ptr->GetTuple3(50)[0] == 10.0 && |
||||
ptr->GetTuple3(50)[1] == 20.0 && |
||||
ptr->GetTuple3(50)[2] == 30.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tSetTuple4..."; |
||||
ptr->SetNumberOfComponents(4); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->SetTuple4(50,10.0,20.0,30.0,40.0); |
||||
if (ptr->GetTuple4(50)[0] == 10.0 && |
||||
ptr->GetTuple4(50)[1] == 20.0 && |
||||
ptr->GetTuple4(50)[2] == 30.0 && |
||||
ptr->GetTuple4(50)[3] == 40.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tSetTuple9..."; |
||||
ptr->SetNumberOfComponents(9); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->SetTuple9(50,10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,90.0); |
||||
if (ptr->GetTuple9(50)[0] == 10.0 && |
||||
ptr->GetTuple9(50)[1] == 20.0 && |
||||
ptr->GetTuple9(50)[2] == 30.0 && |
||||
ptr->GetTuple9(50)[3] == 40.0 && |
||||
ptr->GetTuple9(50)[4] == 50.0 && |
||||
ptr->GetTuple9(50)[5] == 60.0 && |
||||
ptr->GetTuple9(50)[6] == 70.0 && |
||||
ptr->GetTuple9(50)[7] == 80.0 && |
||||
ptr->GetTuple9(50)[8] == 90.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertTuple1..."; |
||||
ptr->SetNumberOfComponents(1); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertTuple1(502,10.0); |
||||
if (ptr->GetTuple1(502) == 10.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertTuple2..."; |
||||
ptr->SetNumberOfComponents(2); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertTuple2(502,10.0,20.0); |
||||
if (ptr->GetTuple2(502)[0] == 10.0 && |
||||
ptr->GetTuple2(502)[1] == 20.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertTuple3..."; |
||||
ptr->SetNumberOfComponents(3); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertTuple3(502,10.0,20.0,30.0); |
||||
if (ptr->GetTuple3(502)[0] == 10.0 && |
||||
ptr->GetTuple3(502)[1] == 20.0 && |
||||
ptr->GetTuple3(502)[2] == 30.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertTuple4..."; |
||||
ptr->SetNumberOfComponents(4); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertTuple4(502,10.0,20.0,30.0,40.0); |
||||
if (ptr->GetTuple4(502)[0] == 10.0 && |
||||
ptr->GetTuple4(502)[1] == 20.0 && |
||||
ptr->GetTuple4(502)[2] == 30.0 && |
||||
ptr->GetTuple4(502)[3] == 40.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertTuple9..."; |
||||
ptr->SetNumberOfComponents(9); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertTuple9(502,10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,90.0); |
||||
if (ptr->GetTuple9(502)[0] == 10.0 && |
||||
ptr->GetTuple9(502)[1] == 20.0 && |
||||
ptr->GetTuple9(502)[2] == 30.0 && |
||||
ptr->GetTuple9(502)[3] == 40.0 && |
||||
ptr->GetTuple9(502)[4] == 50.0 && |
||||
ptr->GetTuple9(502)[5] == 60.0 && |
||||
ptr->GetTuple9(502)[6] == 70.0 && |
||||
ptr->GetTuple9(502)[7] == 80.0 && |
||||
ptr->GetTuple9(502)[8] == 90.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertNextTuple1..."; |
||||
ptr->SetNumberOfComponents(1); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertNextTuple1(10.0); |
||||
if (ptr->GetTuple1(100) == 10.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << " FAILED" << endl; |
||||
} |
||||
strm << "\tInsertNextTuple2..."; |
||||
ptr->SetNumberOfComponents(2); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertNextTuple2(10.0,20.0); |
||||
if (ptr->GetTuple2(100)[0] == 10.0 && |
||||
ptr->GetTuple2(100)[1] == 20.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertNextTuple3..."; |
||||
ptr->SetNumberOfComponents(3); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertNextTuple3(10.0,20.0,30.0); |
||||
if (ptr->GetTuple3(100)[0] == 10.0 && |
||||
ptr->GetTuple3(100)[1] == 20.0 && |
||||
ptr->GetTuple3(100)[2] == 30.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertNextTuple4..."; |
||||
ptr->SetNumberOfComponents(4); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertNextTuple4(10.0,20.0,30.0,40.0); |
||||
if (ptr->GetTuple4(100)[0] == 10.0 && |
||||
ptr->GetTuple4(100)[1] == 20.0 && |
||||
ptr->GetTuple4(100)[2] == 30.0 && |
||||
ptr->GetTuple4(100)[3] == 40.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertNextTuple9..."; |
||||
ptr->SetNumberOfComponents(9); |
||||
ptr->SetNumberOfTuples(100); |
||||
ptr->InsertNextTuple9(10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,90.0); |
||||
if (ptr->GetTuple9(100)[0] == 10.0 && |
||||
ptr->GetTuple9(100)[1] == 20.0 && |
||||
ptr->GetTuple9(100)[2] == 30.0 && |
||||
ptr->GetTuple9(100)[3] == 40.0 && |
||||
ptr->GetTuple9(100)[4] == 50.0 && |
||||
ptr->GetTuple9(100)[5] == 60.0 && |
||||
ptr->GetTuple9(100)[6] == 70.0 && |
||||
ptr->GetTuple9(100)[7] == 80.0 && |
||||
ptr->GetTuple9(100)[8] == 90.0) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
errors++; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
|
||||
farray->Delete(); |
||||
|
||||
|
||||
strm << "PrintSelf..." << endl; |
||||
strm << *ptr; |
||||
|
||||
return errors; |
||||
} |
||||
|
||||
int otherArraysTest(ostream& strm) |
||||
{ |
||||
int errors = 0; |
||||
{ |
||||
strm << "Test CharArray" << endl; |
||||
vtkCharArray *ptr = vtkCharArray::New(); |
||||
char *array = new char[SIZE]; |
||||
char value = static_cast<char>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test UnsignedCharArray" << endl; |
||||
vtkUnsignedCharArray *ptr = vtkUnsignedCharArray::New(); |
||||
unsigned char *array = new unsigned char[SIZE]; |
||||
unsigned char value = static_cast<unsigned char>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test IntArray" << endl; |
||||
vtkIntArray *ptr = vtkIntArray::New(); |
||||
int *array = new int[SIZE]; |
||||
int value = static_cast<int>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test UnsignedIntArray" << endl; |
||||
vtkUnsignedIntArray *ptr = vtkUnsignedIntArray::New(); |
||||
unsigned int *array = new unsigned int[SIZE]; |
||||
unsigned int value = static_cast<unsigned int>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test LongArray" << endl; |
||||
vtkLongArray *ptr = vtkLongArray::New(); |
||||
long *array = new long[SIZE]; |
||||
long value = static_cast<long>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test UnsignedLongArray" << endl; |
||||
vtkUnsignedLongArray *ptr = vtkUnsignedLongArray::New(); |
||||
unsigned long *array = new unsigned long[SIZE]; |
||||
unsigned long value = static_cast<unsigned long>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test ShortArray" << endl; |
||||
vtkShortArray *ptr = vtkShortArray::New(); |
||||
short *array = new short[SIZE]; |
||||
short value = static_cast<short>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test UnsignedShortArray" << endl; |
||||
vtkUnsignedShortArray *ptr = vtkUnsignedShortArray::New(); |
||||
unsigned short *array = new unsigned short[SIZE]; |
||||
unsigned short value = static_cast<unsigned short>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test FloatArray" << endl; |
||||
vtkFloatArray *ptr = vtkFloatArray::New(); |
||||
float *array = new float[SIZE]; |
||||
float value = static_cast<float>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test DoubleArray" << endl; |
||||
vtkDoubleArray *ptr = vtkDoubleArray::New(); |
||||
double *array = new double[SIZE]; |
||||
double value = static_cast<double>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
|
||||
{ |
||||
strm << "Test IdTypeArray" << endl; |
||||
vtkIdTypeArray *ptr = vtkIdTypeArray::New(); |
||||
vtkIdType *array = new vtkIdType[SIZE]; |
||||
vtkIdType value = static_cast<vtkIdType>(1); |
||||
for (int i = 0; i < SIZE; i++) *(array + i ) = i; |
||||
errors += doArrayTest (strm, ptr, array, value, SIZE); |
||||
ptr->Delete(); |
||||
delete []array; |
||||
} |
||||
return errors; |
||||
} |
||||
|
||||
int otherArrays(int, char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
// return otherArraysTest(vtkmsg_with_warning_C4701);
|
||||
return otherArraysTest(cerr); |
||||
|
||||
}
|
@ -0,0 +1,159 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherByteSwap.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests the byte swapper
|
||||
|
||||
#include "vtkByteSwap.h" |
||||
#include "vtkDebugLeaks.h" |
||||
|
||||
int TestByteSwap(ostream& strm) |
||||
{ |
||||
// actual test
|
||||
strm << "Test vtkByteSwap Start" << endl; |
||||
|
||||
char check[1024]; |
||||
short sword[2]; |
||||
char cword[1024]; |
||||
unsigned short usword[2]; |
||||
|
||||
memcpy ((char *) sword, "abcd", 2); |
||||
vtkByteSwap::Swap2BE(sword); |
||||
memcpy ((char *) check, sword, 2); |
||||
strm << "Swap2BE(short \"ab\") -> " << (char) check[0] << (char) check[1] << endl; |
||||
|
||||
memcpy ((char *) usword, "abcd", 2); |
||||
vtkByteSwap::Swap2BE(usword); |
||||
memcpy ((char *) check, usword, 2); |
||||
strm << "Swap2BE(unsigned short \"ab\") -> " << (char) check[0] << (char) check[1] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcd", 4); |
||||
vtkByteSwap::Swap4BE(cword); |
||||
memcpy ((char *) check, cword, 4); |
||||
strm << "Swap4BE(char *\"abcd\") -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::Swap8BE(cword); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "Swap8BE(char *\"abcdefgh\") -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::Swap2BERange(cword,8); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "Swap2BERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::Swap4BERange(cword,8); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "Swap4BERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::Swap8BERange(cword,8); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "Swap8BERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefghijklmnop", 16); |
||||
strm << "SwapWrite2BERange(char *\"abcdefghijklmnop\",8,stdout) -> "; |
||||
vtkByteSwap::SwapWrite2BERange(cword,8,stdout); |
||||
strm << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefghijklmnop", 16); |
||||
strm << "SwapWrite4BERange(char *\"abcdefghijklmnop\",4,stdout) -> "; |
||||
vtkByteSwap::SwapWrite4BERange(cword,4,stdout); |
||||
strm << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefghijklmnop", 16); |
||||
strm << "SwapWrite8BERange(char *\"abcdefghijklmnop\",2,stdout) -> "; |
||||
vtkByteSwap::SwapWrite8BERange(cword,2,stdout); |
||||
strm << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefghijklmnop", 16); |
||||
strm << "SwapWrite2BERange(char *\"abcdefghijklmnop\",8,&strm) -> "; |
||||
vtkByteSwap::SwapWrite2BERange(cword,8,&strm); |
||||
strm << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefghijklmnop", 16); |
||||
strm << "SwapWrite4BERange(char *\"abcdefghijklmnop\",4,&strm) -> "; |
||||
vtkByteSwap::SwapWrite4BERange(cword,4,&strm); |
||||
strm << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefghijklmnop", 16); |
||||
strm << "SwapWrite8BERange(char *\"abcdefghijklmnop\",2,&strm) -> "; |
||||
vtkByteSwap::SwapWrite8BERange(cword,2,&strm); |
||||
strm << endl; |
||||
|
||||
memcpy ((char *) sword, "abcd", 2); |
||||
vtkByteSwap::Swap2LE(sword); |
||||
memcpy ((char *) check, sword, 2); |
||||
strm << "Swap2LE(short \"ab\") -> " << (char) check[0] << (char) check[1] << endl; |
||||
|
||||
memcpy ((char *) usword, "abcd", 2); |
||||
vtkByteSwap::Swap2LE(usword); |
||||
memcpy ((char *) check, usword, 2); |
||||
strm << "Swap2LE(unsigned short \"ab\") -> " << (char) check[0] << (char) check[1] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcd", 4); |
||||
vtkByteSwap::Swap4LE(cword); |
||||
memcpy ((char *) check, cword, 4); |
||||
strm << "Swap4LE(char *\"abcd\") -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::Swap8LE(cword); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "Swap8LE(char *\"abcdefgh\") -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::Swap2LERange(cword,8); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "Swap2LERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::Swap4LERange(cword,8); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "Swap4LERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::Swap8LERange(cword,8); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "Swap8LERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::SwapVoidRange(cword,4,2); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "SwapVoidRange(char *\"abcdefgh\",4,2) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::SwapVoidRange(cword,2,4); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "SwapVoidRange(char *\"abcdefgh\",2,4) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
memcpy ((char *) cword, "abcdefgh", 8); |
||||
vtkByteSwap::SwapVoidRange(cword,1,8); |
||||
memcpy ((char *) check, cword, 8); |
||||
strm << "SwapVoidRange(char *\"abcdefgh\",1,8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl; |
||||
|
||||
strm << "Test vtkByteSwap End" << endl; |
||||
return 0; |
||||
} |
||||
|
||||
|
||||
int otherByteSwap(int,char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
return TestByteSwap(vtkmsg_with_warning_C4701); |
||||
}
|
@ -0,0 +1,86 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherCellArray.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests the CellArray
|
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
|
||||
#include "vtkCellArray.h" |
||||
#include "vtkIdList.h" |
||||
#include "vtkIdTypeArray.h" |
||||
#include "vtkQuad.h" |
||||
|
||||
int TestCellArray(ostream& strm) |
||||
{ |
||||
// actual test
|
||||
strm << "Test CellArray Start" << endl; |
||||
vtkCellArray *ca = vtkCellArray::New(); |
||||
|
||||
ca->Initialize(); |
||||
strm << "ca->GetNumberOfCells() = " << ca->GetNumberOfCells() << endl; |
||||
strm << "ca->GetSize() = " << ca->GetSize() << endl; |
||||
strm << "ca->GetNumberOfConnectivityEntries() = " << ca->GetNumberOfConnectivityEntries() << endl; |
||||
strm << "ca->EstimateSize (1000, 3) = " << ca->EstimateSize(1000,3) << endl; |
||||
|
||||
vtkIdType npts = 3; |
||||
vtkIdType pts[3] = {0, 1, 2}; |
||||
vtkQuad *cell = vtkQuad::New(); |
||||
vtkIdList *ids = vtkIdList::New(); |
||||
vtkIdType *ptrIds = ids->WritePointer(0,3); |
||||
memcpy (ptrIds, pts, 3 * sizeof (vtkIdType)); |
||||
|
||||
strm << "ca->InsertNextCell (npts, pts) = " << ca->InsertNextCell (npts, pts) << endl; |
||||
strm << "ca->InsertNextCell (cell) = " << ca->InsertNextCell (cell) << endl; |
||||
strm << "ca->InsertNextCell (ids) = " << ca->InsertNextCell (ids) << endl; |
||||
strm << "ca->InsertNextCell (4) = " << ca->InsertNextCell (4) << endl; |
||||
ca->InsertCellPoint (3); |
||||
ca->InsertCellPoint (4); |
||||
ca->InsertCellPoint (5); |
||||
|
||||
ca->InsertCellPoint (6); |
||||
ca->InsertCellPoint (7); |
||||
ca->InsertCellPoint (8); |
||||
ca->UpdateCellCount (3); |
||||
|
||||
strm << "ca->GetNumberOfCells() = " << ca->GetNumberOfCells() << endl; |
||||
strm << "ca->GetSize() = " << ca->GetSize() << endl; |
||||
strm << "ca->GetNumberOfConnectivityEntries() = " << ca->GetNumberOfConnectivityEntries() << endl; |
||||
|
||||
vtkIdTypeArray *cells = vtkIdTypeArray::New(); |
||||
cells->SetNumberOfTuples(12); |
||||
vtkIdType idT[12] = {3, 0, 1, 2, 3, 1, 2, 3, 3, 3, 4, 5}; |
||||
cells->SetVoidArray(idT,12,1); |
||||
ca->Allocate(10000); |
||||
ca->SetCells (3, cells); |
||||
strm << "ca->GetNumberOfCells() = " << ca->GetNumberOfCells() << endl; |
||||
strm << "ca->GetSize() = " << ca->GetSize() << endl; |
||||
strm << "ca->GetNumberOfConnectivityEntries() = " << ca->GetNumberOfConnectivityEntries() << endl; |
||||
|
||||
ca->Delete(); |
||||
cell->Delete(); |
||||
ids->Delete(); |
||||
cells->Delete(); |
||||
strm << "Test CellArray Complete" << endl; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int otherCellArray(int,char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
return TestCellArray(vtkmsg_with_warning_C4701); |
||||
}
|
@ -0,0 +1,499 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherCellBoundaries.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests the CellBoundary method for each cell type
|
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkHexahedron.h" |
||||
#include "vtkIdList.h" |
||||
#include "vtkLine.h" |
||||
#include "vtkPixel.h" |
||||
#include "vtkPoints.h" |
||||
#include "vtkPolyLine.h" |
||||
#include "vtkPolyVertex.h" |
||||
#include "vtkPolygon.h" |
||||
#include "vtkQuad.h" |
||||
#include "vtkTetra.h" |
||||
#include "vtkTriangle.h" |
||||
#include "vtkTriangleStrip.h" |
||||
#include "vtkVertex.h" |
||||
#include "vtkVoxel.h" |
||||
#include "vtkWedge.h" |
||||
#include "vtkPentagonalPrism.h" |
||||
#include "vtkHexagonalPrism.h" |
||||
|
||||
|
||||
int TestOCB(ostream& strm) |
||||
{ |
||||
// actual test
|
||||
vtkIdList *ids = vtkIdList::New(); |
||||
int i, j, k; |
||||
strm << "Test vtkCell::CellBoundary Start" << endl; |
||||
|
||||
//Vertex
|
||||
vtkVertex *vertex = vtkVertex::New(); |
||||
double vertexCoords[1][1]; |
||||
|
||||
vertex->GetPointIds()->SetId(0,0); |
||||
|
||||
vertexCoords[0][0] = 0.0; |
||||
|
||||
for (j = 0; j < 1; j++) |
||||
{ |
||||
vertex->CellBoundary (0, vertexCoords[j], ids); |
||||
strm << "vtkVertex \t(" << vertexCoords[j][0] << ") \t= "; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Poly Vertex
|
||||
vtkPolyVertex *polyVertex = vtkPolyVertex::New(); |
||||
double polyVertexCoords[1][1]; |
||||
|
||||
polyVertex->GetPointIds()->SetNumberOfIds(2); |
||||
polyVertex->GetPointIds()->SetId(0,0); |
||||
polyVertex->GetPointIds()->SetId(1,1); |
||||
|
||||
polyVertexCoords[0][0] = 0.0; |
||||
|
||||
for (k = 0; k < polyVertex->GetPointIds()->GetNumberOfIds(); k++) |
||||
{ |
||||
for (j = 0; j < 1; j++) |
||||
{ |
||||
polyVertex->CellBoundary (k, polyVertexCoords[j], ids); |
||||
strm << "vtkPolyVertex \t(" << polyVertexCoords[j][0] << ") \t= "; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
} |
||||
|
||||
//Line
|
||||
vtkLine *line = vtkLine::New(); |
||||
double lineCoords[2][1]; |
||||
|
||||
line->GetPointIds()->SetId(0,0); |
||||
line->GetPointIds()->SetId(1,1); |
||||
|
||||
lineCoords[0][0] = .25; |
||||
lineCoords[1][0] = .75; |
||||
|
||||
for (j = 0; j < 2; j++) |
||||
{ |
||||
line->CellBoundary (0, lineCoords[j], ids); |
||||
strm << "vtkLine \t(" << lineCoords[j][0] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Poly Line
|
||||
vtkPolyLine *polyLine = vtkPolyLine::New(); |
||||
double polyLineCoords[3][1]; |
||||
|
||||
polyLine->GetPointIds()->SetNumberOfIds(3); |
||||
polyLine->GetPointIds()->SetId(0,0); |
||||
polyLine->GetPointIds()->SetId(1,1); |
||||
polyLine->GetPointIds()->SetId(2,2); |
||||
|
||||
polyLineCoords[0][0] = .25; |
||||
polyLineCoords[1][0] = .75; |
||||
|
||||
for (k = 0; k < polyLine->GetPointIds()->GetNumberOfIds() - 1; k++) |
||||
{ |
||||
for (j = 0; j < 2; j++) |
||||
{ |
||||
polyLine->CellBoundary (k, polyLineCoords[j], ids); |
||||
strm << "vtkPolyLine \t(" << polyLineCoords[j][0] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
} |
||||
|
||||
//Triangle
|
||||
vtkTriangle *triangle = vtkTriangle::New(); |
||||
double triangleCoords[3][2]; |
||||
|
||||
triangle->GetPointIds()->SetId(0,0); |
||||
triangle->GetPointIds()->SetId(1,1); |
||||
triangle->GetPointIds()->SetId(2,2); |
||||
|
||||
triangleCoords[0][0] = .5; triangleCoords[0][1] = 0.1; |
||||
triangleCoords[1][0] = .9; triangleCoords[1][1] = 0.9; |
||||
triangleCoords[2][0] = .1; triangleCoords[2][1] = 0.5; |
||||
|
||||
for (j = 0; j < 3; j++) |
||||
{ |
||||
triangle->CellBoundary (0, triangleCoords[j], ids); |
||||
strm << "vtkTriangle \t(" << triangleCoords[j][0] << ", " << triangleCoords[j][1] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Triangle Strip
|
||||
vtkTriangleStrip *triangleStrip = vtkTriangleStrip::New(); |
||||
double triangleStripCoords[3][2]; |
||||
|
||||
triangleStrip->GetPointIds()->SetNumberOfIds(4); |
||||
triangleStrip->GetPointIds()->SetId(0,0); |
||||
triangleStrip->GetPointIds()->SetId(1,1); |
||||
triangleStrip->GetPointIds()->SetId(2,2); |
||||
triangleStrip->GetPointIds()->SetId(3,3); |
||||
|
||||
triangleStripCoords[0][0] = .5; triangleStripCoords[0][1] = 0.1; |
||||
triangleStripCoords[1][0] = .9; triangleStripCoords[1][1] = 0.9; |
||||
triangleStripCoords[2][0] = .1; triangleStripCoords[2][1] = 0.5; |
||||
|
||||
for (k = 0; k < triangleStrip->GetPointIds()->GetNumberOfIds() - 2; k++) |
||||
{ |
||||
for (j = 0; j < 3; j++) |
||||
{ |
||||
triangleStrip->CellBoundary (k, triangleStripCoords[j], ids); |
||||
strm << "vtkTriangleStrip \t(" << triangleStripCoords[j][0] << ", " << triangleStripCoords[j][1] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
} |
||||
|
||||
//Quad
|
||||
vtkQuad *quad = vtkQuad::New(); |
||||
double quadCoords[4][2]; |
||||
|
||||
quad->GetPointIds()->SetId(0,0); |
||||
quad->GetPointIds()->SetId(1,1); |
||||
quad->GetPointIds()->SetId(2,2); |
||||
quad->GetPointIds()->SetId(3,3); |
||||
|
||||
quadCoords[0][0] = .5; quadCoords[0][1] = 0.1; |
||||
quadCoords[1][0] = .9; quadCoords[1][1] = 0.5; |
||||
quadCoords[2][0] = .5; quadCoords[2][1] = 0.9; |
||||
quadCoords[3][0] = .1; quadCoords[3][1] = 0.5; |
||||
|
||||
for (j = 0; j < 4; j++) |
||||
{ |
||||
quad->CellBoundary (0, quadCoords[j], ids); |
||||
strm << "vtkQuad \t(" << quadCoords[j][0] << ", " << quadCoords[j][1] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Pixel
|
||||
vtkPixel *pixel = vtkPixel::New(); |
||||
double pixelCoords[4][2]; |
||||
|
||||
pixel->GetPointIds()->SetId(0,0); |
||||
pixel->GetPointIds()->SetId(1,1); |
||||
pixel->GetPointIds()->SetId(2,2); |
||||
pixel->GetPointIds()->SetId(3,3); |
||||
|
||||
pixelCoords[0][0] = .5; pixelCoords[0][1] = 0.1; |
||||
pixelCoords[1][0] = .9; pixelCoords[1][1] = 0.5; |
||||
pixelCoords[2][0] = .5; pixelCoords[2][1] = 0.9; |
||||
pixelCoords[3][0] = .1; pixelCoords[3][1] = 0.5; |
||||
|
||||
for (j = 0; j < 4; j++) |
||||
{ |
||||
pixel->CellBoundary (0, pixelCoords[j], ids); |
||||
strm << "vtkPixel \t(" << pixelCoords[j][0] << ", " << pixelCoords[j][1] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Polygon
|
||||
vtkPolygon *polygon = vtkPolygon::New(); |
||||
double polygonCoords[4][2]; |
||||
|
||||
polygon->GetPointIds()->SetNumberOfIds(4); |
||||
polygon->GetPointIds()->SetId(0,0); |
||||
polygon->GetPointIds()->SetId(1,1); |
||||
polygon->GetPointIds()->SetId(2,2); |
||||
polygon->GetPointIds()->SetId(3,3); |
||||
|
||||
polygon->GetPoints()->SetNumberOfPoints(4); |
||||
polygon->GetPoints()->SetPoint(0, 0.0, 0.0, 0.0); |
||||
polygon->GetPoints()->SetPoint(1, 1.0, 0.0, 0.0); |
||||
polygon->GetPoints()->SetPoint(2, 1.0, 1.0, 0.0); |
||||
polygon->GetPoints()->SetPoint(3, 0.0, 1.0, 0.0); |
||||
|
||||
polygonCoords[0][0] = .5; polygonCoords[0][1] = 0.1; |
||||
polygonCoords[1][0] = .9; polygonCoords[1][1] = 0.5; |
||||
polygonCoords[2][0] = .5; polygonCoords[2][1] = 0.9; |
||||
polygonCoords[3][0] = .1; polygonCoords[3][1] = 0.5; |
||||
|
||||
for (j = 0; j < 4; j++) |
||||
{ |
||||
polygon->CellBoundary (0, polygonCoords[j], ids); |
||||
strm << "vtkPolygon \t(" << polygonCoords[j][0] << ", " << polygonCoords[j][1] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Tetra
|
||||
vtkTetra *tetra = vtkTetra::New(); |
||||
double tetraCoords[4][3]; |
||||
|
||||
tetra->GetPointIds()->SetNumberOfIds(4); |
||||
tetra->GetPointIds()->SetId(0,0); |
||||
tetra->GetPointIds()->SetId(1,1); |
||||
tetra->GetPointIds()->SetId(2,2); |
||||
tetra->GetPointIds()->SetId(3,3); |
||||
|
||||
tetraCoords[0][0] = .1; tetraCoords[0][1] = 0.2; tetraCoords[0][2] = 0.2; |
||||
tetraCoords[1][0] = .2; tetraCoords[1][1] = 0.1; tetraCoords[1][2] = 0.2; |
||||
tetraCoords[2][0] = .2; tetraCoords[2][1] = 0.2; tetraCoords[2][2] = 0.1; |
||||
tetraCoords[3][0] = .3; tetraCoords[3][1] = 0.3; tetraCoords[3][2] = 0.3; |
||||
|
||||
for (j = 0; j < 4; j++) |
||||
{ |
||||
tetra->CellBoundary (0, tetraCoords[j], ids); |
||||
strm << "vtkTetra \t(" << tetraCoords[j][0] << ", " << tetraCoords[j][1] << ", " << tetraCoords[j][2] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Voxel
|
||||
vtkVoxel *voxel = vtkVoxel::New(); |
||||
double voxelCoords[6][3]; |
||||
|
||||
voxel->GetPointIds()->SetNumberOfIds(8); |
||||
voxel->GetPointIds()->SetId(0,0); |
||||
voxel->GetPointIds()->SetId(1,1); |
||||
voxel->GetPointIds()->SetId(2,2); |
||||
voxel->GetPointIds()->SetId(3,3); |
||||
voxel->GetPointIds()->SetId(4,4); |
||||
voxel->GetPointIds()->SetId(5,5); |
||||
voxel->GetPointIds()->SetId(6,6); |
||||
voxel->GetPointIds()->SetId(7,7); |
||||
|
||||
voxelCoords[0][0] = .5; voxelCoords[0][1] = 0.5; voxelCoords[0][2] = 0.1; |
||||
voxelCoords[1][0] = .9; voxelCoords[1][1] = 0.9; voxelCoords[1][2] = 0.5; |
||||
voxelCoords[2][0] = .5; voxelCoords[2][1] = 0.1; voxelCoords[2][2] = 0.5; |
||||
voxelCoords[3][0] = .5; voxelCoords[3][1] = 0.5; voxelCoords[3][2] = 0.9; |
||||
voxelCoords[4][0] = .1; voxelCoords[4][1] = 0.5; voxelCoords[4][2] = 0.5; |
||||
voxelCoords[5][0] = .5; voxelCoords[5][1] = 0.9; voxelCoords[5][2] = 0.5; |
||||
|
||||
for (j = 0; j < 6; j++) |
||||
{ |
||||
voxel->CellBoundary (0, voxelCoords[j], ids); |
||||
strm << "vtkVoxel \t(" << voxelCoords[j][0] << ", " << voxelCoords[j][1] << ", " << voxelCoords[j][2] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Wedge
|
||||
vtkWedge *wedge = vtkWedge::New(); |
||||
double wedgeCoords[6][3]; |
||||
|
||||
wedge->GetPointIds()->SetNumberOfIds(6); |
||||
wedge->GetPointIds()->SetId(0,0); |
||||
wedge->GetPointIds()->SetId(1,1); |
||||
wedge->GetPointIds()->SetId(2,2); |
||||
wedge->GetPointIds()->SetId(3,3); |
||||
wedge->GetPointIds()->SetId(4,4); |
||||
wedge->GetPointIds()->SetId(5,5); |
||||
|
||||
wedgeCoords[0][0] = .5; wedgeCoords[0][1] = 0.5; wedgeCoords[0][2] = 0.1; |
||||
wedgeCoords[1][0] = .9; wedgeCoords[1][1] = 0.9; wedgeCoords[1][2] = 0.5; |
||||
wedgeCoords[2][0] = .5; wedgeCoords[2][1] = 0.1; wedgeCoords[2][2] = 0.5; |
||||
wedgeCoords[3][0] = .5; wedgeCoords[3][1] = 0.5; wedgeCoords[3][2] = 0.9; |
||||
wedgeCoords[4][0] = .1; wedgeCoords[4][1] = 0.5; wedgeCoords[4][2] = 0.5; |
||||
wedgeCoords[5][0] = .5; wedgeCoords[5][1] = 0.9; wedgeCoords[5][2] = 0.5; |
||||
|
||||
for (j = 0; j < 6; j++) |
||||
{ |
||||
wedge->CellBoundary (0, wedgeCoords[j], ids); |
||||
strm << "vtkWedge \t(" << wedgeCoords[j][0] << ", " << wedgeCoords[j][1] << ", " << wedgeCoords[j][2] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Hexahedron
|
||||
vtkHexahedron *hexahedron = vtkHexahedron::New(); |
||||
double hexahedronCoords[8][3]; |
||||
|
||||
hexahedron->GetPointIds()->SetNumberOfIds(8); |
||||
hexahedron->GetPointIds()->SetId(0,0); |
||||
hexahedron->GetPointIds()->SetId(1,1); |
||||
hexahedron->GetPointIds()->SetId(2,2); |
||||
hexahedron->GetPointIds()->SetId(3,3); |
||||
hexahedron->GetPointIds()->SetId(4,4); |
||||
hexahedron->GetPointIds()->SetId(5,5); |
||||
hexahedron->GetPointIds()->SetId(6,6); |
||||
hexahedron->GetPointIds()->SetId(7,7); |
||||
|
||||
hexahedronCoords[0][0] = .5; hexahedronCoords[0][1] = 0.5; hexahedronCoords[0][2] = 0.1; |
||||
hexahedronCoords[1][0] = .9; hexahedronCoords[1][1] = 0.9; hexahedronCoords[1][2] = 0.5; |
||||
hexahedronCoords[2][0] = .5; hexahedronCoords[2][1] = 0.1; hexahedronCoords[2][2] = 0.5; |
||||
hexahedronCoords[3][0] = .5; hexahedronCoords[3][1] = 0.5; hexahedronCoords[3][2] = 0.1; |
||||
hexahedronCoords[4][0] = .5; hexahedronCoords[4][1] = 0.5; hexahedronCoords[4][2] = 0.9; |
||||
hexahedronCoords[5][0] = .9; hexahedronCoords[5][1] = 0.9; hexahedronCoords[5][2] = 0.7; |
||||
hexahedronCoords[6][0] = .5; hexahedronCoords[6][1] = 0.1; hexahedronCoords[6][2] = 0.7; |
||||
hexahedronCoords[7][0] = .5; hexahedronCoords[7][1] = 0.5; hexahedronCoords[7][2] = 0.9; |
||||
|
||||
for (j = 0; j < 8; j++) |
||||
{ |
||||
hexahedron->CellBoundary (0, hexahedronCoords[j], ids); |
||||
strm << "vtkHexahedron \t(" << hexahedronCoords[j][0] << ", " << hexahedronCoords[j][1] << ", " << hexahedronCoords[j][2] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Pentagonal Prism
|
||||
vtkPentagonalPrism *penta = vtkPentagonalPrism::New(); |
||||
double pentaCoords[10][3]; |
||||
|
||||
penta->GetPointIds()->SetNumberOfIds(10); |
||||
penta->GetPointIds()->SetId(0,0); |
||||
penta->GetPointIds()->SetId(1,1); |
||||
penta->GetPointIds()->SetId(2,2); |
||||
penta->GetPointIds()->SetId(3,3); |
||||
penta->GetPointIds()->SetId(4,4); |
||||
penta->GetPointIds()->SetId(5,5); |
||||
penta->GetPointIds()->SetId(6,6); |
||||
penta->GetPointIds()->SetId(7,7); |
||||
penta->GetPointIds()->SetId(8,8); |
||||
penta->GetPointIds()->SetId(9,9); |
||||
|
||||
pentaCoords[0][0] = 0.25; pentaCoords[0][1] = 0.0; pentaCoords[0][2] = 0.0; |
||||
pentaCoords[1][0] = 0.75; pentaCoords[1][1] = 0.0; pentaCoords[1][2] = 0.0; |
||||
pentaCoords[2][0] = 1.0 ; pentaCoords[2][1] = 0.5; pentaCoords[2][2] = 0.0; |
||||
pentaCoords[3][0] = 0.5 ; pentaCoords[3][1] = 1.0; pentaCoords[3][2] = 0.0; |
||||
pentaCoords[4][0] = 0.0 ; pentaCoords[4][1] = 0.5; pentaCoords[4][2] = 0.0; |
||||
pentaCoords[5][0] = 0.25; pentaCoords[5][1] = 0.0; pentaCoords[5][2] = 1.0; |
||||
pentaCoords[6][0] = 0.75; pentaCoords[6][1] = 0.0; pentaCoords[6][2] = 1.0; |
||||
pentaCoords[7][0] = 1.0 ; pentaCoords[7][1] = 0.5; pentaCoords[7][2] = 1.0; |
||||
pentaCoords[8][0] = 0.5 ; pentaCoords[8][1] = 1.0; pentaCoords[8][2] = 1.0; |
||||
pentaCoords[9][0] = 0.0 ; pentaCoords[9][1] = 0.5; pentaCoords[9][2] = 1.0; |
||||
|
||||
for (j = 0; j < 10; j++) |
||||
{ |
||||
penta->CellBoundary (0, pentaCoords[j], ids); |
||||
strm << "vtkPentagonalPrism \t(" << pentaCoords[j][0] << ", " << pentaCoords[j][1] << ", " << pentaCoords[j][2] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
//Hexagonal Prism
|
||||
vtkHexagonalPrism *hexa = vtkHexagonalPrism::New(); |
||||
double hexaCoords[12][3]; |
||||
|
||||
hexa->GetPointIds()->SetNumberOfIds(12); |
||||
hexa->GetPointIds()->SetId(0,0); |
||||
hexa->GetPointIds()->SetId(1,1); |
||||
hexa->GetPointIds()->SetId(2,2); |
||||
hexa->GetPointIds()->SetId(3,3); |
||||
hexa->GetPointIds()->SetId(4,4); |
||||
hexa->GetPointIds()->SetId(5,5); |
||||
hexa->GetPointIds()->SetId(6,6); |
||||
hexa->GetPointIds()->SetId(7,7); |
||||
hexa->GetPointIds()->SetId(8,8); |
||||
hexa->GetPointIds()->SetId(9,9); |
||||
hexa->GetPointIds()->SetId(10,12); |
||||
hexa->GetPointIds()->SetId(11,11); |
||||
|
||||
hexaCoords[0][0] = 0.5 ; hexaCoords[0][1] = 0.0; hexaCoords[0][2] = 0.3; |
||||
hexaCoords[1][0] = 0.93 ; hexaCoords[1][1] = 0.25; hexaCoords[1][2] = 0.3; |
||||
hexaCoords[2][0] = 0.93 ; hexaCoords[2][1] = 0.75; hexaCoords[2][2] = 0.3; |
||||
hexaCoords[3][0] = 0.716 ; hexaCoords[3][1] = 0.875; hexaCoords[3][2] = 0.4; |
||||
hexaCoords[4][0] = 0.55 ; hexaCoords[4][1] = 0.95; hexaCoords[4][2] = 0.3; |
||||
hexaCoords[5][0] = 0.067 ; hexaCoords[5][1] = 0.6; hexaCoords[5][2] = 0.1; |
||||
hexaCoords[6][0] = 0.05 ; hexaCoords[6][1] = 0.4; hexaCoords[6][2] = 0.7; |
||||
hexaCoords[7][0] = 0.5 ; hexaCoords[7][1] = 0.6; hexaCoords[7][2] = 0.7; |
||||
hexaCoords[8][0] = 0.93 ; hexaCoords[8][1] = 0.4; hexaCoords[8][2] = 0.7; |
||||
hexaCoords[9][0] = 0.93 ; hexaCoords[9][1] = 0.9; hexaCoords[9][2] = 0.7; |
||||
hexaCoords[10][0] = 0.06 ; hexaCoords[10][1] = 0.7; hexaCoords[10][2] = 0.7; |
||||
hexaCoords[11][0] = 0.07 ; hexaCoords[11][1] = 0.3; hexaCoords[11][2] = 0.7; |
||||
|
||||
for (j = 0; j < 12; j++) |
||||
{ |
||||
hexa->CellBoundary (0, hexaCoords[j], ids); |
||||
strm << "vtkHexagonalPrism \t(" << hexaCoords[j][0] << ", " << hexaCoords[j][1] << ", " << hexaCoords[j][2] << ") = \t"; |
||||
for (i = 0; i < ids->GetNumberOfIds(); i++) |
||||
{ |
||||
strm << ids->GetId(i) << ", "; |
||||
} |
||||
strm << endl; |
||||
} |
||||
|
||||
ids->Delete(); |
||||
vertex->Delete(); |
||||
polyVertex->Delete(); |
||||
line->Delete(); |
||||
polyLine->Delete(); |
||||
triangle->Delete(); |
||||
triangleStrip->Delete(); |
||||
quad->Delete(); |
||||
pixel->Delete(); |
||||
polygon->Delete(); |
||||
tetra->Delete(); |
||||
voxel->Delete(); |
||||
wedge->Delete(); |
||||
hexahedron->Delete(); |
||||
penta->Delete(); |
||||
hexa->Delete(); |
||||
|
||||
strm << "Test vtkCell::CellBoundary Complete" << endl; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
|
||||
int otherCellBoundaries(int, char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
return TestOCB(vtkmsg_with_warning_C4701); |
||||
}
|
@ -0,0 +1,583 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherCellPosition.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests the Cell Position and Location Boundary methods for each cell type
|
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkHexahedron.h" |
||||
#include "vtkIdList.h" |
||||
#include "vtkLine.h" |
||||
#include "vtkPixel.h" |
||||
#include "vtkPoints.h" |
||||
#include "vtkPolyLine.h" |
||||
#include "vtkPolyVertex.h" |
||||
#include "vtkPolygon.h" |
||||
#include "vtkQuad.h" |
||||
#include "vtkTetra.h" |
||||
#include "vtkTriangle.h" |
||||
#include "vtkTriangleStrip.h" |
||||
#include "vtkVertex.h" |
||||
#include "vtkVoxel.h" |
||||
#include "vtkWedge.h" |
||||
#include "vtkPentagonalPrism.h" |
||||
#include "vtkHexagonalPrism.h" |
||||
|
||||
int TestOCP(ostream& strm) |
||||
{ |
||||
// actual test
|
||||
vtkIdList *ids = vtkIdList::New(); |
||||
int j; |
||||
int n; |
||||
double dist2; |
||||
int subId; |
||||
|
||||
strm << "Test vtkCell::EvaluatePosition Start" << endl; |
||||
|
||||
//Vertex
|
||||
vtkVertex *vertex = vtkVertex::New(); |
||||
double vertexCoords[3], vertexWeights[2]; |
||||
double vertexPoint[2][3] = {{10.0, 20.0, 30.0}, {0, 0, 0}}; |
||||
double vertexClosest[3]; |
||||
|
||||
vertex->GetPointIds()->SetId(0,0); |
||||
vertex->GetPoints()->SetPoint (0, 10.0, 20.0, 30.0); |
||||
|
||||
n = sizeof(vertexPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
vertex->EvaluatePosition (&vertexPoint[j][0], &vertexClosest[0], subId, &vertexCoords[0], dist2, &vertexWeights[0]); |
||||
strm << "vtkVertex (" << vertexPoint[j][0] << ", " << vertexPoint[j][1] << ", " << vertexPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << vertexClosest[0] << ", " << vertexClosest[1] << ", " << vertexClosest[2] << endl; |
||||
strm << "\tcoords: " << vertexCoords[0] << endl; |
||||
strm << "\tweights: " << vertexWeights[0] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Poly Vertex
|
||||
vtkPolyVertex *polyVertex = vtkPolyVertex::New(); |
||||
double polyVertexCoords[1], polyVertexWeights[2]; |
||||
double polyVertexPoint[3][3] = {{10.0, 20.0, 30.0}, {30.0, 20.0, 10.0}, {0, 0, 0}}; |
||||
double polyVertexClosest[3]; |
||||
|
||||
polyVertex->GetPointIds()->SetNumberOfIds(2); |
||||
polyVertex->GetPointIds()->SetId(0,0); |
||||
polyVertex->GetPointIds()->SetId(1,1); |
||||
|
||||
polyVertex->GetPoints()->SetNumberOfPoints(2); |
||||
polyVertex->GetPoints()->SetPoint (0, 10.0, 20.0, 30.0); |
||||
polyVertex->GetPoints()->SetPoint (1, 30.0, 20.0, 10.0); |
||||
|
||||
n = sizeof(polyVertexPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
polyVertex->EvaluatePosition (&polyVertexPoint[j][0], &polyVertexClosest[0], subId, &polyVertexCoords[0], dist2, &polyVertexWeights[0]); |
||||
strm << "vtkPolyVertex (" << polyVertexPoint[j][0] << ", " << polyVertexPoint[j][1] << ", " << polyVertexPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << polyVertexClosest[0] << ", " << polyVertexClosest[1] << ", " << polyVertexClosest[2] << endl; |
||||
strm << "\tcoords: " << polyVertexCoords[0] << endl; |
||||
strm << "\tweights: " << polyVertexWeights[0] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Line
|
||||
vtkLine *line = vtkLine::New(); |
||||
double lineCoords[3], lineWeights[2]; |
||||
double linePoint[3][3] = {{10.0, 20.0, 30.0}, {30.0, 20.0, 10.0}, {0, 0, 0}}; |
||||
double lineClosest[3]; |
||||
|
||||
line->GetPointIds()->SetId(0,0); |
||||
line->GetPointIds()->SetId(1,1); |
||||
line->GetPoints()->SetPoint (0, 10.0, 20.0, 30.0); |
||||
line->GetPoints()->SetPoint (1, 30.0, 20.0, 10.0); |
||||
|
||||
n = sizeof(linePoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
line->EvaluatePosition (&linePoint[j][0], &lineClosest[0], subId, &lineCoords[0], dist2, &lineWeights[0]); |
||||
strm << "vtkLine (" << linePoint[j][0] << ", " << linePoint[j][1] << ", " << linePoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << lineClosest[0] << ", " << lineClosest[1] << ", " << lineClosest[2] << endl; |
||||
strm << "\tcoords: " << lineCoords[0] << endl; |
||||
strm << "\tweights: " << lineWeights[0] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Poly Line
|
||||
vtkPolyLine *polyLine = vtkPolyLine::New(); |
||||
double polyLineCoords[3], polyLineWeights[3]; |
||||
double polyLinePoint[4][3] = {{10.0, 20.0, 30.0}, {10.0, 30.0, 30.0}, {10.0, 30.0, 40.0}, {0, 0, 0}}; |
||||
double polyLineClosest[3]; |
||||
|
||||
polyLine->GetPointIds()->SetNumberOfIds(3); |
||||
polyLine->GetPointIds()->SetId(0,0); |
||||
polyLine->GetPointIds()->SetId(1,1); |
||||
polyLine->GetPointIds()->SetId(2,2); |
||||
|
||||
polyLine->GetPoints()->SetNumberOfPoints(3); |
||||
polyLine->GetPoints()->SetPoint (0, 10.0, 20.0, 30.0); |
||||
polyLine->GetPoints()->SetPoint (1, 10.0, 30.0, 30.0); |
||||
polyLine->GetPoints()->SetPoint (2, 10.0, 30.0, 40.0); |
||||
|
||||
n = sizeof(polyLinePoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
polyLine->EvaluatePosition (&polyLinePoint[j][0], &polyLineClosest[0], subId, &polyLineCoords[0], dist2, &polyLineWeights[0]); |
||||
strm << "vtkPolyLine (" << polyLinePoint[j][0] << ", " << polyLinePoint[j][1] << ", " << polyLinePoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << polyLineClosest[0] << ", " << polyLineClosest[1] << ", " << polyLineClosest[2] << endl; |
||||
strm << "\tcoords: " << polyLineCoords[0] << endl; |
||||
strm << "\tweights: " << polyLineWeights[0] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Triangle
|
||||
vtkTriangle *triangle = vtkTriangle::New(); |
||||
double triangleCoords[3], triangleWeights[3], trianglePosition[3]; |
||||
double trianglePoint[4][3] = {{10.0, 10.0, 10.0}, {12.0, 10.0, 10.0}, {11.0, 12.0, 12.0}, {11, 11, 11}}; |
||||
double triangleClosest[3]; |
||||
|
||||
triangle->GetPointIds()->SetId(0,0); |
||||
triangle->GetPointIds()->SetId(1,1); |
||||
triangle->GetPointIds()->SetId(2,2); |
||||
|
||||
triangle->GetPoints()->SetPoint (0, 10.0, 10.0, 10.0); |
||||
triangle->GetPoints()->SetPoint (1, 12.0, 10.0, 10.0); |
||||
triangle->GetPoints()->SetPoint (2, 11.0, 12.0, 12.0); |
||||
|
||||
n = sizeof(trianglePoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
triangle->EvaluatePosition (&trianglePoint[j][0], &triangleClosest[0], subId, &triangleCoords[0], dist2, &triangleWeights[0]); |
||||
strm << "vtkTriangle (" << trianglePoint[j][0] << ", " << trianglePoint[j][1] << ", " << trianglePoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << triangleClosest[0] << ", " << triangleClosest[1] << ", " << triangleClosest[2] << endl; |
||||
strm << "\tcoords: " << triangleCoords[0] << ", " << triangleCoords[1] << ", " << triangleCoords[2] << endl; |
||||
strm << "\tweights: " << triangleWeights[0] << ", " << triangleWeights[1] << ", " << triangleWeights[2] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
triangle->EvaluateLocation (subId, triangleCoords, trianglePosition, triangleWeights); |
||||
strm << "\tposition: " << trianglePosition[0] << ", " << trianglePosition[1] << ", " << trianglePosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Triangle Strip
|
||||
vtkTriangleStrip *triangleStrip = vtkTriangleStrip::New(); |
||||
double triangleStripCoords[3], triangleStripWeights[4], triangleStripPosition[3]; |
||||
double triangleStripPoint[5][3] = {{10.0, 10.0, 10.0}, {12.0, 10.0, 10.0}, {11.0, 12.0, 10.0}, {13, 10, 10}, {11, 11, 10}}; |
||||
double triangleStripClosest[3]; |
||||
|
||||
triangleStrip->GetPointIds()->SetNumberOfIds(4); |
||||
triangleStrip->GetPointIds()->SetId(0,0); |
||||
triangleStrip->GetPointIds()->SetId(1,1); |
||||
triangleStrip->GetPointIds()->SetId(2,2); |
||||
triangleStrip->GetPointIds()->SetId(3,3); |
||||
|
||||
triangleStrip->GetPoints()->SetNumberOfPoints(4); |
||||
triangleStrip->GetPoints()->SetPoint (0, 10.0, 10.0, 10.0); |
||||
triangleStrip->GetPoints()->SetPoint (1, 12.0, 10.0, 10.0); |
||||
triangleStrip->GetPoints()->SetPoint (2, 11.0, 12.0, 10.0); |
||||
triangleStrip->GetPoints()->SetPoint (3, 13.0, 10.0, 10.0); |
||||
|
||||
n = sizeof(triangleStripPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
triangleStrip->EvaluatePosition (&triangleStripPoint[j][0], &triangleStripClosest[0], subId, &triangleStripCoords[0], dist2, &triangleStripWeights[0]); |
||||
strm << "vtkTriangleStrip (" << triangleStripPoint[j][0] << ", " << triangleStripPoint[j][1] << ", " << triangleStripPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << triangleStripClosest[0] << ", " << triangleStripClosest[1] << ", " << triangleStripClosest[2] << endl; |
||||
strm << "\tcoords: " << triangleStripCoords[0] << ", " << triangleStripCoords[1] << ", " << triangleStripCoords[2] << endl; |
||||
strm << "\tweights: " << triangleStripWeights[0] << ", " << triangleStripWeights[1] << ", " << triangleStripWeights[2] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
triangleStrip->EvaluateLocation (subId, triangleStripCoords, triangleStripPosition, triangleStripWeights); |
||||
strm << "\tposition: " << triangleStripPosition[0] << ", " << triangleStripPosition[1] << ", " << triangleStripPosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Quad
|
||||
vtkQuad *quad = vtkQuad::New(); |
||||
double quadCoords[2], quadWeights[4], quadPosition[3]; |
||||
double quadPoint[5][3] = {{10.0, 10.0, 10.0}, {12.0, 10.0, 10.0}, {12.0, 12.0, 10.0}, {10, 12, 10}, {11, 11, 10.1}}; |
||||
double quadClosest[3]; |
||||
|
||||
quad->GetPointIds()->SetId(0,0); |
||||
quad->GetPointIds()->SetId(1,1); |
||||
quad->GetPointIds()->SetId(2,2); |
||||
quad->GetPointIds()->SetId(3,3); |
||||
|
||||
quad->GetPoints()->SetPoint (0, 10.0, 10.0, 10.0); |
||||
quad->GetPoints()->SetPoint (1, 12.0, 10.0, 10.0); |
||||
quad->GetPoints()->SetPoint (2, 12.0, 12.0, 10.0); |
||||
quad->GetPoints()->SetPoint (3, 10.0, 12.0, 10.0); |
||||
|
||||
n = sizeof(quadPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
quad->EvaluatePosition (&quadPoint[j][0], &quadClosest[0], subId, &quadCoords[0], dist2, &quadWeights[0]); |
||||
strm << "vtkQuad (" << quadPoint[j][0] << ", " << quadPoint[j][1] << ", " << quadPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << quadClosest[0] << ", " << quadClosest[1] << ", " << quadClosest[2] << endl; |
||||
strm << "\tcoords: " << quadCoords[0] << ", " << quadCoords[1] << endl; |
||||
strm << "\tweights: " << quadWeights[0] << ", " << quadWeights[1] << ", " << quadWeights[2] << ", " << quadWeights[3] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
quad->EvaluateLocation (subId, quadCoords, quadPosition, quadWeights); |
||||
strm << "\tposition: " << quadPosition[0] << ", " << quadPosition[1] << ", " << quadPosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Pixel
|
||||
vtkPixel *pixel = vtkPixel::New(); |
||||
double pixelCoords[3], pixelWeights[4], pixelPosition[3]; |
||||
double pixelPoint[5][3] = {{10.0, 10.0, 10.0}, {12.0, 10.0, 10.0}, {12.0, 12.0, 10.0}, {10, 12, 10}, {11, 11, 10.1}}; |
||||
double pixelClosest[3]; |
||||
|
||||
pixel->GetPointIds()->SetId(0,0); |
||||
pixel->GetPointIds()->SetId(1,1); |
||||
pixel->GetPointIds()->SetId(2,3); |
||||
pixel->GetPointIds()->SetId(3,2); |
||||
|
||||
pixel->GetPoints()->SetPoint (0, 10.0, 10.0, 10.0); |
||||
pixel->GetPoints()->SetPoint (1, 12.0, 10.0, 10.0); |
||||
pixel->GetPoints()->SetPoint (3, 12.0, 12.0, 10.0); |
||||
pixel->GetPoints()->SetPoint (2, 10.0, 12.0, 10.0); |
||||
|
||||
n = sizeof(pixelPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
pixel->EvaluatePosition (&pixelPoint[j][0], &pixelClosest[0], subId, &pixelCoords[0], dist2, &pixelWeights[0]); |
||||
strm << "vtkPixel (" << pixelPoint[j][0] << ", " << pixelPoint[j][1] << ", " << pixelPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << pixelClosest[0] << ", " << pixelClosest[1] << ", " << pixelClosest[2] << endl; |
||||
strm << "\tcoords: " << pixelCoords[0] << ", " << pixelCoords[1] << endl; |
||||
strm << "\tweights: " << pixelWeights[0] << ", " << pixelWeights[1] << ", " << pixelWeights[2] << ", " << pixelWeights[3] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
pixel->EvaluateLocation (subId, pixelCoords, pixelPosition, pixelWeights); |
||||
strm << "\tposition: " << pixelPosition[0] << ", " << pixelPosition[1] << ", " << pixelPosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Polygon
|
||||
vtkPolygon *polygon = vtkPolygon::New(); |
||||
double polygonCoords[2], polygonWeights[4], polygonPosition[3]; |
||||
double polygonPoint[5][3] = {{0.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, {1.0, 1.0, 0.0}, {0, 1, 0}, {.5, .5, 0}}; |
||||
double polygonClosest[3]; |
||||
|
||||
polygon->GetPointIds()->SetNumberOfIds(4); |
||||
polygon->GetPointIds()->SetId(0,0); |
||||
polygon->GetPointIds()->SetId(1,1); |
||||
polygon->GetPointIds()->SetId(2,2); |
||||
polygon->GetPointIds()->SetId(3,3); |
||||
|
||||
polygon->GetPoints()->SetNumberOfPoints(4); |
||||
polygon->GetPoints()->SetPoint(0, 0.0, 0.0, 0.0); |
||||
polygon->GetPoints()->SetPoint(1, 1.0, 0.0, 0.0); |
||||
polygon->GetPoints()->SetPoint(2, 1.0, 1.0, 0.0); |
||||
polygon->GetPoints()->SetPoint(3, 0.0, 1.0, 0.0); |
||||
|
||||
n = sizeof(polygonPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
polygon->EvaluatePosition (&polygonPoint[j][0], &polygonClosest[0], subId, &polygonCoords[0], dist2, &polygonWeights[0]); |
||||
strm << "vtkPolygon (" << polygonPoint[j][0] << ", " << polygonPoint[j][1] << ", " << polygonPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << polygonClosest[0] << ", " << polygonClosest[1] << ", " << polygonClosest[2] << endl; |
||||
strm << "\tcoords: " << polygonCoords[0] << ", " << polygonCoords[1] << endl; |
||||
strm << "\tweights: " << polygonWeights[0] << ", " << polygonWeights[1] << ", " << polygonWeights[2] << ", " << polygonWeights[3] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
polygon->EvaluateLocation (subId, polygonCoords, polygonPosition, polygonWeights); |
||||
strm << "\tposition: " << polygonPosition[0] << ", " << polygonPosition[1] << ", " << polygonPosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Tetra
|
||||
vtkTetra *tetra = vtkTetra::New(); |
||||
double tetraCoords[3], tetraWeights[4], tetraPosition[3]; |
||||
double tetraPoint[5][3] = {{10, 10, 10}, {12, 10, 10}, {11, 12, 10}, {11, 11, 12}, {11, 11, 11}}; |
||||
double tetraClosest[3]; |
||||
|
||||
tetra->GetPointIds()->SetNumberOfIds(4); |
||||
tetra->GetPointIds()->SetId(0,0); |
||||
tetra->GetPointIds()->SetId(1,1); |
||||
tetra->GetPointIds()->SetId(2,2); |
||||
tetra->GetPointIds()->SetId(3,3); |
||||
tetra->GetPoints()->SetPoint(0, 10.0, 10.0, 10.0); |
||||
tetra->GetPoints()->SetPoint(1, 12.0, 10.0, 10.0); |
||||
tetra->GetPoints()->SetPoint(2, 11.0, 12.0, 10.0); |
||||
tetra->GetPoints()->SetPoint(3, 11.0, 11.0, 12.0); |
||||
|
||||
n = sizeof(tetraPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
tetra->EvaluatePosition (&tetraPoint[j][0], &tetraClosest[0], subId, &tetraCoords[0], dist2, &tetraWeights[0]); |
||||
strm << "vtkTetra (" << tetraPoint[j][0] << ", " << tetraPoint[j][1] << ", " << tetraPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << tetraClosest[0] << ", " << tetraClosest[1] << ", " << tetraClosest[2] << endl; |
||||
strm << "\tcoords: " << tetraCoords[0] << ", " << tetraCoords[1] << ", " << tetraCoords[2] << endl; |
||||
strm << "\tweights: " << tetraWeights[0] << ", " << tetraWeights[1] << ", " << tetraWeights[2] << ", " << tetraWeights[3] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
tetra->EvaluateLocation (subId, tetraCoords, tetraPosition, tetraWeights); |
||||
strm << "\tposition: " << tetraPosition[0] << ", " << tetraPosition[1] << ", " << tetraPosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Voxel
|
||||
vtkVoxel *voxel = vtkVoxel::New(); |
||||
double voxelCoords[3], voxelWeights[8], voxelPosition[3]; |
||||
double voxelPoint[9][3] = {{10, 10, 10}, {12, 10, 10}, {12, 12, 10}, {10, 12, 10}, |
||||
{10, 10, 12}, {12, 10, 12}, {12, 12, 12}, {10, 12, 12}, |
||||
{11, 11, 11}}; |
||||
double voxelClosest[3]; |
||||
|
||||
voxel->GetPointIds()->SetNumberOfIds(8); |
||||
voxel->GetPointIds()->SetId(0,0); |
||||
voxel->GetPointIds()->SetId(1,1); |
||||
voxel->GetPointIds()->SetId(2,3); |
||||
voxel->GetPointIds()->SetId(3,2); |
||||
voxel->GetPointIds()->SetId(4,4); |
||||
voxel->GetPointIds()->SetId(5,5); |
||||
voxel->GetPointIds()->SetId(6,7); |
||||
voxel->GetPointIds()->SetId(7,6); |
||||
|
||||
voxel->GetPoints()->SetPoint(0, 10, 10, 10); |
||||
voxel->GetPoints()->SetPoint(1, 12, 10, 10); |
||||
voxel->GetPoints()->SetPoint(3, 12, 12, 10); |
||||
voxel->GetPoints()->SetPoint(2, 10, 12, 10); |
||||
voxel->GetPoints()->SetPoint(4, 10, 10, 12); |
||||
voxel->GetPoints()->SetPoint(5, 12, 10, 12); |
||||
voxel->GetPoints()->SetPoint(7, 12, 12, 12); |
||||
voxel->GetPoints()->SetPoint(6, 10, 12, 12); |
||||
|
||||
n = sizeof(voxelPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
voxel->EvaluatePosition (&voxelPoint[j][0], &voxelClosest[0], subId, &voxelCoords[0], dist2, &voxelWeights[0]); |
||||
strm << "vtkVoxel (" << voxelPoint[j][0] << ", " << voxelPoint[j][1] << ", " << voxelPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << voxelClosest[0] << ", " << voxelClosest[1] << ", " << voxelClosest[2] << endl; |
||||
strm << "\tcoords: " << voxelCoords[0] << ", " << voxelCoords[1] << ", " << voxelCoords[2] << endl; |
||||
strm << "\tweights: " << voxelWeights[0] << ", " << voxelWeights[1] << ", " << voxelWeights[2] << ", " << voxelWeights[3] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
voxel->EvaluateLocation (subId, voxelCoords, voxelPosition, voxelWeights); |
||||
strm << "\tposition: " << voxelPosition[0] << ", " << voxelPosition[1] << ", " << voxelPosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Wedge
|
||||
vtkWedge *wedge = vtkWedge::New(); |
||||
double wedgeCoords[3], wedgeWeights[8], wedgePosition[3]; |
||||
double wedgePoint[9][3] = {{10, 10, 10}, {12, 10, 10}, {11, 12, 10}, {10, 10, 12}, |
||||
{12, 10, 12}, {11, 12, 12}, {11, 11, 11}}; |
||||
double wedgeClosest[3]; |
||||
|
||||
wedge->GetPointIds()->SetNumberOfIds(6); |
||||
wedge->GetPointIds()->SetId(0,0); |
||||
wedge->GetPointIds()->SetId(1,1); |
||||
wedge->GetPointIds()->SetId(2,2); |
||||
wedge->GetPointIds()->SetId(3,3); |
||||
wedge->GetPointIds()->SetId(4,4); |
||||
wedge->GetPointIds()->SetId(5,5); |
||||
|
||||
wedge->GetPoints()->SetPoint(0, 10, 10, 10); |
||||
wedge->GetPoints()->SetPoint(1, 12, 10, 10); |
||||
wedge->GetPoints()->SetPoint(2, 11, 12, 10); |
||||
wedge->GetPoints()->SetPoint(3, 10, 10, 12); |
||||
wedge->GetPoints()->SetPoint(4, 12, 10, 12); |
||||
wedge->GetPoints()->SetPoint(5, 11, 12, 12); |
||||
|
||||
n = sizeof(wedgePoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
wedge->EvaluatePosition (&wedgePoint[j][0], &wedgeClosest[0], subId, &wedgeCoords[0], dist2, &wedgeWeights[0]); |
||||
strm << "vtkWedge (" << wedgePoint[j][0] << ", " << wedgePoint[j][1] << ", " << wedgePoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << wedgeClosest[0] << ", " << wedgeClosest[1] << ", " << wedgeClosest[2] << endl; |
||||
strm << "\tcoords: " << wedgeCoords[0] << ", " << wedgeCoords[1] << ", " << wedgeCoords[2] << endl; |
||||
strm << "\tweights: " << wedgeWeights[0] << ", " << wedgeWeights[1] << ", " << wedgeWeights[2] << ", " << wedgeWeights[3] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
wedge->EvaluateLocation (subId, wedgeCoords, wedgePosition, wedgeWeights); |
||||
strm << "\tposition: " << wedgePosition[0] << ", " << wedgePosition[1] << ", " << wedgePosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Hexahedron
|
||||
vtkHexahedron *hexahedron = vtkHexahedron::New(); |
||||
double hexahedronCoords[3], hexahedronWeights[8], hexahedronPosition[3]; |
||||
double hexahedronPoint[9][3] = {{10, 10, 10}, {12, 10, 10}, {12, 12, 10}, {10, 12, 10}, |
||||
{10, 10, 12}, {12, 10, 12}, {12, 12, 12}, {10, 12, 12}, |
||||
{11, 11, 11}}; |
||||
double hexahedronClosest[3]; |
||||
|
||||
hexahedron->GetPointIds()->SetNumberOfIds(8); |
||||
hexahedron->GetPointIds()->SetId(0,0); |
||||
hexahedron->GetPointIds()->SetId(1,1); |
||||
hexahedron->GetPointIds()->SetId(2,2); |
||||
hexahedron->GetPointIds()->SetId(3,3); |
||||
hexahedron->GetPointIds()->SetId(4,4); |
||||
hexahedron->GetPointIds()->SetId(5,5); |
||||
hexahedron->GetPointIds()->SetId(6,6); |
||||
hexahedron->GetPointIds()->SetId(7,7); |
||||
|
||||
hexahedron->GetPoints()->SetPoint(0, 10, 10, 10); |
||||
hexahedron->GetPoints()->SetPoint(1, 12, 10, 10); |
||||
hexahedron->GetPoints()->SetPoint(2, 12, 12, 10); |
||||
hexahedron->GetPoints()->SetPoint(3, 10, 12, 10); |
||||
hexahedron->GetPoints()->SetPoint(4, 10, 10, 12); |
||||
hexahedron->GetPoints()->SetPoint(5, 12, 10, 12); |
||||
hexahedron->GetPoints()->SetPoint(6, 12, 12, 12); |
||||
hexahedron->GetPoints()->SetPoint(7, 10, 12, 12); |
||||
|
||||
n = sizeof(hexahedronPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
hexahedron->EvaluatePosition (&hexahedronPoint[j][0], &hexahedronClosest[0], subId, &hexahedronCoords[0], dist2, &hexahedronWeights[0]); |
||||
strm << "vtkHexahedron (" << hexahedronPoint[j][0] << ", " << hexahedronPoint[j][1] << ", " << hexahedronPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << hexahedronClosest[0] << ", " << hexahedronClosest[1] << ", " << hexahedronClosest[2] << endl; |
||||
strm << "\tcoords: " << hexahedronCoords[0] << ", " << hexahedronCoords[1] << ", " << hexahedronCoords[2] << endl; |
||||
strm << "\tweights: " << hexahedronWeights[0] << ", " << hexahedronWeights[1] << ", " << hexahedronWeights[2] << ", " << hexahedronWeights[3] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
hexahedron->EvaluateLocation (subId, hexahedronCoords, hexahedronPosition, hexahedronWeights); |
||||
strm << "\tposition: " << hexahedronPosition[0] << ", " << hexahedronPosition[1] << ", " << hexahedronPosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Pentagonal Prism
|
||||
vtkPentagonalPrism *penta = vtkPentagonalPrism::New(); |
||||
double pentaCoords[3], pentaWeights[10], pentaPosition[3]; |
||||
double pentaPoint[11][3] = {{11, 10, 10}, {13, 10, 10}, {14, 12, 10}, {12, 14, 10}, |
||||
{10, 12, 10}, {11, 10, 14}, {13, 10, 14}, {14, 12, 14}, |
||||
{12, 14, 14}, {10, 12, 14}, {12, 12, 12}}; |
||||
double pentaClosest[3]; |
||||
|
||||
penta->GetPointIds()->SetNumberOfIds(10); |
||||
penta->GetPointIds()->SetId(0,0); |
||||
penta->GetPointIds()->SetId(1,1); |
||||
penta->GetPointIds()->SetId(2,2); |
||||
penta->GetPointIds()->SetId(3,3); |
||||
penta->GetPointIds()->SetId(4,4); |
||||
penta->GetPointIds()->SetId(5,5); |
||||
penta->GetPointIds()->SetId(6,6); |
||||
penta->GetPointIds()->SetId(7,7); |
||||
penta->GetPointIds()->SetId(8,8); |
||||
penta->GetPointIds()->SetId(9,9); |
||||
|
||||
penta->GetPoints()->SetPoint(0, 11, 10, 10); |
||||
penta->GetPoints()->SetPoint(1, 13, 10, 10); |
||||
penta->GetPoints()->SetPoint(2, 14, 12, 10); |
||||
penta->GetPoints()->SetPoint(3, 12, 14, 10); |
||||
penta->GetPoints()->SetPoint(4, 10, 12, 10); |
||||
penta->GetPoints()->SetPoint(5, 11, 10, 14); |
||||
penta->GetPoints()->SetPoint(6, 13, 10, 14); |
||||
penta->GetPoints()->SetPoint(7, 14, 12, 14); |
||||
penta->GetPoints()->SetPoint(8, 12, 14, 14); |
||||
penta->GetPoints()->SetPoint(9, 10, 12, 14); |
||||
|
||||
n = sizeof(pentaPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
penta->EvaluatePosition (&pentaPoint[j][0], &pentaClosest[0], subId, &pentaCoords[0], dist2, &pentaWeights[0]); |
||||
strm << "vtkPentagonalPrism (" << pentaPoint[j][0] << ", " << pentaPoint[j][1] << ", " << pentaPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << pentaClosest[0] << ", " << pentaClosest[1] << ", " << pentaClosest[2] << endl; |
||||
strm << "\tcoords: " << pentaCoords[0] << ", " << pentaCoords[1] << ", " << pentaCoords[2] << endl; |
||||
strm << "\tweights: " << pentaWeights[0] << ", " << pentaWeights[1] << ", " << pentaWeights[2] << ", " << pentaWeights[3] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
penta->EvaluateLocation (subId, pentaCoords, pentaPosition, pentaWeights); |
||||
strm << "\tposition: " << pentaPosition[0] << ", " << pentaPosition[1] << ", " << pentaPosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
//Hexagonal Prism
|
||||
vtkHexagonalPrism *hexa = vtkHexagonalPrism::New(); |
||||
double hexaCoords[3], hexaWeights[12], hexaPosition[3]; |
||||
double hexaPoint[13][3] = {{11, 10, 10}, {13, 10, 10}, {14, 12, 10}, {13, 14, 10}, |
||||
{11, 14, 10}, {10, 12, 10}, {11, 10, 14}, {13, 10, 14},
|
||||
{14, 12, 14}, {13, 14, 14}, {11, 14, 14}, {10, 12, 14}, |
||||
{12, 12, 12}}; |
||||
double hexaClosest[3]; |
||||
|
||||
hexa->GetPointIds()->SetNumberOfIds(12); |
||||
hexa->GetPointIds()->SetId(0,0); |
||||
hexa->GetPointIds()->SetId(1,1); |
||||
hexa->GetPointIds()->SetId(2,2); |
||||
hexa->GetPointIds()->SetId(3,3); |
||||
hexa->GetPointIds()->SetId(4,4); |
||||
hexa->GetPointIds()->SetId(5,5); |
||||
hexa->GetPointIds()->SetId(6,6); |
||||
hexa->GetPointIds()->SetId(7,7); |
||||
hexa->GetPointIds()->SetId(8,8); |
||||
hexa->GetPointIds()->SetId(9,9); |
||||
hexa->GetPointIds()->SetId(10,10); |
||||
hexa->GetPointIds()->SetId(11,11); |
||||
|
||||
hexa->GetPoints()->SetPoint(0, 11, 10, 10); |
||||
hexa->GetPoints()->SetPoint(1, 13, 10, 10); |
||||
hexa->GetPoints()->SetPoint(2, 14, 12, 10); |
||||
hexa->GetPoints()->SetPoint(3, 13, 14, 10); |
||||
hexa->GetPoints()->SetPoint(4, 11, 14, 10); |
||||
hexa->GetPoints()->SetPoint(5, 10, 12, 10); |
||||
hexa->GetPoints()->SetPoint(6, 11, 10, 14); |
||||
hexa->GetPoints()->SetPoint(7, 13, 10, 14); |
||||
hexa->GetPoints()->SetPoint(8, 14, 12, 14); |
||||
hexa->GetPoints()->SetPoint(9, 13, 14, 14); |
||||
hexa->GetPoints()->SetPoint(10, 11, 14, 14); |
||||
hexa->GetPoints()->SetPoint(11, 10, 12, 14); |
||||
|
||||
n = sizeof(hexaPoint) / (3 * sizeof(double)); |
||||
for (j = 0; j < n; j++) |
||||
{ |
||||
hexa->EvaluatePosition (&hexaPoint[j][0], &hexaClosest[0], subId, &hexaCoords[0], dist2, &hexaWeights[0]); |
||||
strm << "vtkHexagonalPrism (" << hexaPoint[j][0] << ", " << hexaPoint[j][1] << ", " << hexaPoint[j][2] << ")" << endl; |
||||
strm << "\tclosest: " << hexaClosest[0] << ", " << hexaClosest[1] << ", " << hexaClosest[2] << endl; |
||||
strm << "\tcoords: " << hexaCoords[0] << ", " << hexaCoords[1] << ", " << hexaCoords[2] << endl; |
||||
strm << "\tweights: " << hexaWeights[0] << ", " << hexaWeights[1] << ", " << hexaWeights[2] << ", " << hexaWeights[3] << endl; |
||||
strm << "\tsubid: " << subId << endl; |
||||
strm << "\tdist2: " << dist2 << endl; |
||||
hexa->EvaluateLocation (subId, hexaCoords, hexaPosition, hexaWeights); |
||||
strm << "\tposition: " << hexaPosition[0] << ", " << hexaPosition[1] << ", " << hexaPosition[2] << endl; |
||||
strm << endl; |
||||
} |
||||
|
||||
ids->Delete(); |
||||
vertex->Delete(); |
||||
polyVertex->Delete(); |
||||
line->Delete(); |
||||
polyLine->Delete(); |
||||
triangle->Delete(); |
||||
triangleStrip->Delete(); |
||||
quad->Delete(); |
||||
pixel->Delete(); |
||||
polygon->Delete(); |
||||
tetra->Delete(); |
||||
voxel->Delete(); |
||||
wedge->Delete(); |
||||
hexahedron->Delete(); |
||||
penta->Delete(); |
||||
hexa->Delete(); |
||||
|
||||
strm << "Test vtkCell::CellPosition Complete" << endl; |
||||
return 0; |
||||
} |
||||
|
||||
int otherCellPosition(int, char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
return TestOCP(vtkmsg_with_warning_C4701); |
||||
}
|
@ -0,0 +1,80 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherCellTypes.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests the CellTypes
|
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
|
||||
#include "vtkCellTypes.h" |
||||
#include "vtkCellType.h" |
||||
|
||||
void TestOCT() |
||||
{ |
||||
// actual test
|
||||
vtkCellTypes *ct = vtkCellTypes::New(); |
||||
ct->Allocate(); |
||||
|
||||
ct->InsertCell(0, VTK_QUAD, 0); |
||||
ct->InsertNextCell(VTK_PIXEL, 1); |
||||
|
||||
vtkUnsignedCharArray *cellTypes = vtkUnsignedCharArray::New(); |
||||
vtkIntArray *cellLocations = vtkIntArray::New(); |
||||
|
||||
cellLocations->InsertNextValue (0); |
||||
cellTypes->InsertNextValue(VTK_QUAD); |
||||
|
||||
cellLocations->InsertNextValue (1); |
||||
cellTypes->InsertNextValue(VTK_PIXEL); |
||||
|
||||
cellLocations->InsertNextValue (2); |
||||
cellTypes->InsertNextValue(VTK_TETRA); |
||||
|
||||
ct->SetCellTypes (3, cellTypes, cellLocations); |
||||
|
||||
ct->GetCellLocation (1); |
||||
ct->DeleteCell(1); |
||||
|
||||
ct->GetNumberOfTypes(); |
||||
|
||||
ct->IsType(VTK_QUAD); |
||||
ct->IsType(VTK_WEDGE); |
||||
|
||||
ct->InsertNextType(VTK_WEDGE); |
||||
ct->IsType(VTK_WEDGE); |
||||
|
||||
ct->GetCellType(2); |
||||
|
||||
ct->GetActualMemorySize(); |
||||
|
||||
vtkCellTypes *ct1 = vtkCellTypes::New(); |
||||
ct1->DeepCopy(ct); |
||||
|
||||
ct->Reset(); |
||||
ct->Squeeze(); |
||||
|
||||
ct1->Delete(); |
||||
ct->Delete(); |
||||
cellLocations->Delete(); |
||||
cellTypes->Delete(); |
||||
} |
||||
|
||||
int otherCellTypes(int, char *[]) |
||||
{ |
||||
TestOCT(); |
||||
|
||||
return 0; |
||||
}
|
@ -0,0 +1,100 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherEmptyCell.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
#include "vtkEmptyCell.h" |
||||
#include "vtkIdList.h" |
||||
#include "vtkPoints.h" |
||||
#include "vtkFloatArray.h" |
||||
#include "vtkPointLocator.h" |
||||
#include "vtkCellArray.h" |
||||
#include "vtkPointData.h" |
||||
#include "vtkCellData.h" |
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
|
||||
void TestOEC(ostream& strm) |
||||
{ |
||||
vtkEmptyCell *cell = vtkEmptyCell::New(); |
||||
vtkCell *cell2 = cell->NewInstance(); |
||||
cell2->DeepCopy(cell); |
||||
vtkIdList *ids = vtkIdList::New(); |
||||
vtkPoints *pts = vtkPoints::New(); |
||||
double v = 0.0; |
||||
vtkFloatArray *cellScalars = vtkFloatArray::New(); |
||||
vtkPointLocator *locator = vtkPointLocator::New(); |
||||
vtkCellArray *verts = vtkCellArray::New(); |
||||
vtkCellArray *lines = vtkCellArray::New(); |
||||
vtkCellArray *polys = vtkCellArray::New(); |
||||
vtkPointData *inPd = vtkPointData::New(); |
||||
vtkPointData *outPd = vtkPointData::New(); |
||||
vtkCellData *inCd = vtkCellData::New(); |
||||
vtkCellData *outCd = vtkCellData::New(); |
||||
int cellId = 0; |
||||
int inOut = 0; |
||||
double t, tol = 0.0; |
||||
double x[3]; |
||||
double c[3]; |
||||
double p[3]; |
||||
double d; |
||||
double w[3]; |
||||
int s; |
||||
|
||||
strm << "Testing EmptyCell" << endl; |
||||
strm << "Cell Type is: " << cell2->GetCellType() << endl; |
||||
strm << "Cell Dimension is: " << cell2->GetCellDimension() << endl; |
||||
strm << "Cell NumberOfEdges is: " << cell2->GetNumberOfEdges() << endl; |
||||
strm << "Cell NumberOfFaces is: " << cell2->GetNumberOfFaces() << endl; |
||||
strm << "Cell GetEdge(0) is: " << cell2->GetEdge(0) << endl; |
||||
strm << "Cell GetFace(0) is: " << cell2->GetFace(0) << endl; |
||||
strm << "Cell CellBoundary(0,p,ids) is: " << cell2->CellBoundary(0,p,ids) << endl; |
||||
strm << "Cell EvaluatePosition(x, c, s, p, d, w)" << endl; |
||||
cell2->EvaluatePosition(x,c,s,p,d,w); |
||||
strm << "Cell EvaluateLocation(s, p, x, w)" << endl; |
||||
cell2->EvaluateLocation(s,p,x,w); |
||||
strm << "Cell Contour" << endl; |
||||
cell2->Contour(v,cellScalars,locator,verts,lines,polys,inPd,outPd,inCd,cellId,outCd); |
||||
strm << "Cell Clip" << endl; |
||||
cell2->Clip(v,cellScalars,locator,verts,inPd,outPd,inCd,cellId,outCd,inOut); |
||||
strm << "Cell IntersectWithLine" << endl; |
||||
cell2->IntersectWithLine(x,x,tol,t,x,p,s); |
||||
strm << "Cell Triangulate" << endl; |
||||
cell2->Triangulate(s,ids,pts); |
||||
strm << "Cell Derivatives" << endl; |
||||
cell2->Derivatives(s,p,x,inOut,w); |
||||
|
||||
// clean up
|
||||
cell->Delete(); |
||||
cell2->Delete(); |
||||
ids->Delete(); |
||||
pts->Delete(); |
||||
cellScalars->Delete(); |
||||
locator->Delete(); |
||||
verts->Delete(); |
||||
lines->Delete(); |
||||
polys->Delete(); |
||||
inPd->Delete(); |
||||
outPd->Delete(); |
||||
inCd->Delete(); |
||||
outCd->Delete(); |
||||
strm << "Testing EmptyCell Complete" << endl; |
||||
} |
||||
|
||||
int otherEmptyCell(int , char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
TestOEC(vtkmsg_with_warning_C4701); |
||||
|
||||
return 0; |
||||
}
|
@ -0,0 +1,93 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherFieldData.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkFieldData.h" |
||||
#include "vtkFloatArray.h" |
||||
#include "vtkIdList.h" |
||||
|
||||
int otherFieldData(int,char *[]) |
||||
{ |
||||
int i; |
||||
vtkFieldData* fd = vtkFieldData::New(); |
||||
|
||||
vtkFloatArray* fa; |
||||
|
||||
char name[128]; |
||||
for(i=0; i<5; i++) |
||||
{ |
||||
sprintf(name, "Array%d", i); |
||||
fa = vtkFloatArray::New(); |
||||
fa->SetName(name); |
||||
// the tuples must be set before being read to avoid a UMR
|
||||
// this must have been a UMR in the past that was suppressed
|
||||
fa->Allocate(20); |
||||
fa->SetTuple1(0,0.0); |
||||
fa->SetTuple1(2,0.0); |
||||
fd->AddArray(fa); |
||||
fa->Delete(); |
||||
} |
||||
|
||||
// Coverage
|
||||
vtkFieldData::Iterator it(fd); |
||||
vtkFieldData::Iterator it2(it); |
||||
|
||||
it = it; |
||||
it2 = it; |
||||
|
||||
fd->Allocate(20); |
||||
fd->CopyFieldOff("Array0"); |
||||
fd->CopyFieldOff("Array1"); |
||||
|
||||
vtkFieldData* fd2 = fd->NewInstance(); |
||||
fd2->CopyStructure(fd); |
||||
fd2->ShallowCopy(fd); |
||||
fd2->DeepCopy(fd); |
||||
|
||||
vtkIdList* ptIds = vtkIdList::New(); |
||||
ptIds->InsertNextId(0); |
||||
ptIds->InsertNextId(2); |
||||
|
||||
fd->GetField(ptIds, fd2); |
||||
ptIds->Delete(); |
||||
|
||||
int arrayComp; |
||||
int a = fd->GetArrayContainingComponent(1, arrayComp); |
||||
if (a != 1) |
||||
{ |
||||
return 1; |
||||
} |
||||
|
||||
double tuple[10]; |
||||
// initialize tuple before using it to set something
|
||||
for (i = 0; i < 10; i++) |
||||
{ |
||||
tuple[i] = i; |
||||
} |
||||
fd->GetTuple(2); |
||||
fd->SetTuple(2, tuple); |
||||
fd->InsertTuple(2, tuple); |
||||
fd->InsertNextTuple(tuple); |
||||
fd->SetComponent(0,0, 1.0); |
||||
fd->InsertComponent(0,0, 1.0); |
||||
|
||||
fd2->Reset(); |
||||
|
||||
fd->Delete(); |
||||
fd2->Delete(); |
||||
|
||||
return 0; |
||||
|
||||
}
|
@ -0,0 +1,177 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherLookupTable.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests the LookupTable
|
||||
|
||||
#include "vtkLookupTable.h" |
||||
#include "vtkLogLookupTable.h" |
||||
#include "vtkDebugLeaks.h" |
||||
|
||||
void TestOLT(vtkLookupTable *lut1) |
||||
{ |
||||
// actual test
|
||||
|
||||
lut1->SetRange(1,1024); |
||||
|
||||
lut1->Allocate (1024); |
||||
lut1->SetRampToLinear(); |
||||
lut1->Build(); |
||||
|
||||
double rgb[4]; |
||||
lut1->GetColor(0, rgb); |
||||
|
||||
lut1->GetOpacity(0); |
||||
|
||||
lut1->GetTableValue(10,rgb); |
||||
lut1->GetTableValue(10); |
||||
|
||||
unsigned char output[4*1024]; |
||||
|
||||
int bitA = 1; |
||||
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_BIT,
|
||||
2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR,
|
||||
2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR,
|
||||
2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR,
|
||||
2, 1, VTK_LUMINANCE); |
||||
|
||||
|
||||
char charA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
|
||||
2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
|
||||
2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
|
||||
2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
|
||||
2, 1, VTK_LUMINANCE); |
||||
|
||||
unsigned char ucharA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
|
||||
2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
|
||||
2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
|
||||
2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
|
||||
2, 1, VTK_LUMINANCE); |
||||
|
||||
int intA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
|
||||
2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
|
||||
2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
|
||||
2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
|
||||
2, 1, VTK_LUMINANCE); |
||||
|
||||
unsigned int uintA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
|
||||
2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
|
||||
2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
|
||||
2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
|
||||
2, 1, VTK_LUMINANCE); |
||||
|
||||
long longA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
|
||||
2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
|
||||
2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
|
||||
2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
|
||||
2, 1, VTK_LUMINANCE); |
||||
|
||||
unsigned long ulongA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG,
|
||||
2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG,
|
||||
2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG,
|
||||
2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG, 2, 1, VTK_LUMINANCE); |
||||
|
||||
short shortA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
|
||||
2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
|
||||
2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
|
||||
2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
|
||||
2, 1, VTK_LUMINANCE); |
||||
|
||||
unsigned short ushortA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) ushortA, output,
|
||||
VTK_UNSIGNED_SHORT, 2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) ushortA, output,
|
||||
VTK_UNSIGNED_SHORT, 2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) ushortA, output,
|
||||
VTK_UNSIGNED_SHORT, 2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) ushortA, output,
|
||||
VTK_UNSIGNED_SHORT, 2, 1, VTK_LUMINANCE); |
||||
|
||||
float floatA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) floatA, output,
|
||||
VTK_FLOAT, 2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) floatA, output,
|
||||
VTK_FLOAT, 2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) floatA, output,
|
||||
VTK_FLOAT, 2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) floatA, output,
|
||||
VTK_FLOAT, 2, 1, VTK_LUMINANCE); |
||||
|
||||
double doubleA[2] = {1, 10}; |
||||
lut1->MapScalarsThroughTable2((void *) doubleA, output,
|
||||
VTK_DOUBLE, 2, 1, VTK_RGBA); |
||||
lut1->MapScalarsThroughTable2((void *) doubleA, output,
|
||||
VTK_DOUBLE, 2, 1, VTK_RGB); |
||||
lut1->MapScalarsThroughTable2((void *) doubleA, output,
|
||||
VTK_DOUBLE, 2, 1, VTK_LUMINANCE_ALPHA); |
||||
lut1->MapScalarsThroughTable2((void *) doubleA, output,
|
||||
VTK_DOUBLE, 2, 1, VTK_LUMINANCE); |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
int otherLookupTable(int,char *[]) |
||||
{ |
||||
vtkLookupTable *lut1 = vtkLookupTable::New(); |
||||
lut1->SetAlpha(1.0); |
||||
lut1->SetScaleToLinear(); |
||||
TestOLT(lut1); |
||||
lut1->SetAlpha(.5); |
||||
TestOLT(lut1); |
||||
lut1->Delete(); |
||||
|
||||
vtkLogLookupTable *lut2 = vtkLogLookupTable::New(); |
||||
lut2->SetAlpha(1.0); |
||||
lut2->SetScaleToLog10(); |
||||
TestOLT(lut2); |
||||
lut2->SetAlpha(.5); |
||||
TestOLT(lut2); |
||||
lut2->Delete(); |
||||
|
||||
return 0; |
||||
}
|
@ -0,0 +1,602 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherRectilinearGrid.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests vtkRectilinearGrid
|
||||
|
||||
#include "vtkCell.h" |
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkDoubleArray.h" |
||||
#include "vtkDoubleArray.h" |
||||
#include "vtkGenericCell.h" |
||||
#include "vtkIdList.h" |
||||
#include "vtkLongArray.h" |
||||
#include "vtkPointData.h" |
||||
#include "vtkRectilinearGrid.h" |
||||
#include "vtkShortArray.h" |
||||
|
||||
int TestORG(ostream& strm) |
||||
{ |
||||
int i, j, k; |
||||
// actual test
|
||||
strm << "Testing vtkRectilinearGrid" << endl; |
||||
vtkRectilinearGrid *rg0D = vtkRectilinearGrid::New(); |
||||
vtkRectilinearGrid *rg1Dx = vtkRectilinearGrid::New(); |
||||
vtkRectilinearGrid *rg1Dy = vtkRectilinearGrid::New(); |
||||
vtkRectilinearGrid *rg1Dz = vtkRectilinearGrid::New(); |
||||
vtkRectilinearGrid *rg2Dxy = vtkRectilinearGrid::New(); |
||||
vtkRectilinearGrid *rg2Dxz = vtkRectilinearGrid::New(); |
||||
vtkRectilinearGrid *rg2Dyz = vtkRectilinearGrid::New(); |
||||
vtkRectilinearGrid *rg3D = vtkRectilinearGrid::New(); |
||||
|
||||
vtkDoubleArray *xdata = vtkDoubleArray::New(); |
||||
vtkDoubleArray *ydata = vtkDoubleArray::New(); |
||||
vtkDoubleArray *zdata = vtkDoubleArray::New(); |
||||
|
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
xdata->InsertNextValue((double) i); |
||||
ydata->InsertNextValue((double) i); |
||||
zdata->InsertNextValue((double) i); |
||||
} |
||||
|
||||
rg3D->SetDimensions(20,20,20); |
||||
rg3D->SetXCoordinates(xdata); |
||||
rg3D->SetYCoordinates(ydata); |
||||
rg3D->SetZCoordinates(zdata); |
||||
|
||||
rg2Dxy->SetDimensions(20,20,1); |
||||
rg2Dxy->SetXCoordinates(xdata); |
||||
rg2Dxy->SetYCoordinates(ydata); |
||||
|
||||
rg2Dxz->SetDimensions(20,1,20); |
||||
rg2Dxz->SetXCoordinates(xdata); |
||||
rg2Dxz->SetZCoordinates(zdata); |
||||
|
||||
rg2Dyz->SetDimensions(1,20,20); |
||||
rg2Dyz->SetYCoordinates(ydata); |
||||
rg2Dyz->SetZCoordinates(zdata); |
||||
|
||||
rg1Dx->SetDimensions(20,1,1); |
||||
rg1Dx->SetXCoordinates(xdata); |
||||
|
||||
rg1Dy->SetDimensions(1,20,1); |
||||
rg1Dy->SetYCoordinates(ydata); |
||||
strm << *rg1Dy; |
||||
|
||||
rg1Dz->SetDimensions(1,1,20); |
||||
rg1Dz->SetZCoordinates(zdata); |
||||
|
||||
rg0D->SetDimensions(1,1,1); |
||||
|
||||
vtkShortArray *shortScalars3D = vtkShortArray::New(); |
||||
shortScalars3D->SetNumberOfComponents(3); |
||||
shortScalars3D->SetNumberOfTuples(20*20*20); |
||||
|
||||
int l = 0; |
||||
for (k = 0; k < 20; k++) |
||||
{ |
||||
for (j = 0; j < 20; j++) |
||||
{ |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
shortScalars3D->InsertComponent(l,0,i); |
||||
shortScalars3D->InsertComponent(l,0,j); |
||||
shortScalars3D->InsertComponent(l,0,k); |
||||
l++; |
||||
} |
||||
} |
||||
} |
||||
|
||||
vtkShortArray *shortScalars2D = vtkShortArray::New(); |
||||
shortScalars2D->SetNumberOfComponents(2); |
||||
shortScalars2D->SetNumberOfTuples(20*20); |
||||
|
||||
l = 0; |
||||
for (j = 0; j < 20; j++) |
||||
{ |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
shortScalars2D->InsertComponent(l,0,i); |
||||
shortScalars2D->InsertComponent(l,0,j); |
||||
l++; |
||||
} |
||||
} |
||||
|
||||
vtkShortArray *shortScalars1D = vtkShortArray::New(); |
||||
shortScalars1D->SetNumberOfComponents(1); |
||||
shortScalars1D->SetNumberOfTuples(20); |
||||
|
||||
l = 0; |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
shortScalars1D->InsertComponent(l,0,i); |
||||
l++; |
||||
} |
||||
|
||||
vtkShortArray *shortScalars0D = vtkShortArray::New(); |
||||
shortScalars0D->SetNumberOfComponents(1); |
||||
shortScalars0D->SetNumberOfTuples(1); |
||||
|
||||
l = 0; |
||||
shortScalars0D->InsertComponent(l,0,0); |
||||
|
||||
rg3D->GetPointData()->SetScalars(shortScalars3D); |
||||
rg2Dxy->GetPointData()->SetScalars(shortScalars2D); |
||||
rg2Dxz->GetPointData()->SetScalars(shortScalars2D); |
||||
rg2Dyz->GetPointData()->SetScalars(shortScalars2D); |
||||
rg1Dx->GetPointData()->SetScalars(shortScalars1D); |
||||
rg1Dy->GetPointData()->SetScalars(shortScalars1D); |
||||
rg1Dz->GetPointData()->SetScalars(shortScalars1D); |
||||
rg0D->GetPointData()->SetScalars(shortScalars0D); |
||||
|
||||
strm << "rg3D:" << *rg3D; |
||||
|
||||
// Test shallow copy
|
||||
vtkRectilinearGrid *scrg3D = vtkRectilinearGrid::New(); |
||||
scrg3D->ShallowCopy(rg3D); |
||||
strm << "ShallowCopy(rg3D):" << *scrg3D; |
||||
|
||||
// Test deep copy
|
||||
vtkRectilinearGrid *dcrg3D = vtkRectilinearGrid::New(); |
||||
dcrg3D->DeepCopy(rg3D); |
||||
strm << "DeepCopy(rg3D):" << *dcrg3D; |
||||
|
||||
// Test GetCell
|
||||
vtkIdList *ids = vtkIdList::New(); |
||||
int cellId; |
||||
int ii; |
||||
|
||||
i = 10; j = 15; k = 7; |
||||
cellId = k * (19 * 19) + j * 19 + i; |
||||
vtkCell *cell3D = rg3D->GetCell(cellId); |
||||
strm << "cell3D: " << *cell3D ; |
||||
rg3D->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; j = 15; |
||||
cellId = j * 19 + i; |
||||
vtkCell *cell2D = rg2Dxy->GetCell(cellId); |
||||
strm << "cell2D: " << *cell2D ; |
||||
rg2Dxy->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
|
||||
i = 10; j = 15; |
||||
cellId = j * 19 + i; |
||||
cell2D = rg2Dxz->GetCell(j * 19 + i); |
||||
strm << "cell2D: " << *cell2D ; |
||||
rg2Dxz->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; j = 15; |
||||
cellId = j * 19 + i; |
||||
cell2D = rg2Dyz->GetCell(j * 19 + i); |
||||
strm << "cell2D: " << *cell2D ; |
||||
rg2Dyz->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; |
||||
cellId = i; |
||||
vtkCell *cell1D = rg1Dx->GetCell(i); |
||||
strm << "cell1D: " << *cell1D; |
||||
rg1Dx->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; |
||||
cellId = i; |
||||
cell1D = rg1Dy->GetCell(i); |
||||
strm << "cell1D: " << *cell1D; |
||||
rg1Dy->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; |
||||
cellId = i; |
||||
cell1D = rg1Dz->GetCell(i); |
||||
strm << "cell1D: " << *cell1D; |
||||
rg1Dz->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
cellId = 0; |
||||
vtkCell *cell0D = rg0D->GetCell(0); |
||||
strm << "cell0D: " << *cell0D; |
||||
rg0D->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
// Test Thread Safe GetCell
|
||||
vtkGenericCell *gcell3D = vtkGenericCell::New(); |
||||
vtkGenericCell *gcell2D = vtkGenericCell::New(); |
||||
vtkGenericCell *gcell1D = vtkGenericCell::New(); |
||||
vtkGenericCell *gcell0D = vtkGenericCell::New(); |
||||
i = 10; j = 15; k = 7; |
||||
rg3D->GetCell(k * (19 * 19) + j * 19 + i, gcell3D); |
||||
strm << "gcell3D: " << *gcell3D ; |
||||
|
||||
i = 10; j = 15; |
||||
rg2Dxy->GetCell(j * 19 + i,gcell2D); |
||||
strm << "gcell2D: " << *gcell2D ; |
||||
|
||||
i = 10; j = 15; |
||||
rg2Dxz->GetCell(j * 19 + i,gcell2D); |
||||
strm << "gcell2D: " << *gcell2D ; |
||||
|
||||
i = 10; j = 15; |
||||
rg2Dxz->GetCell(j * 19 + i,gcell2D); |
||||
strm << "gcell2D: " << *gcell2D ; |
||||
|
||||
i = 10; j = 15; |
||||
rg2Dyz->GetCell(j * 19 + i,gcell2D); |
||||
strm << "gcell2D: " << *gcell2D ; |
||||
|
||||
i = 10; |
||||
rg1Dx->GetCell(i,gcell1D); |
||||
strm << "gcell1D: " << *gcell1D; |
||||
|
||||
i = 10; |
||||
rg1Dy->GetCell(i,gcell1D); |
||||
strm << "gcell1D: " << *gcell1D; |
||||
|
||||
i = 10; |
||||
rg1Dz->GetCell(i,gcell1D); |
||||
strm << "gcell1D: " << *gcell1D; |
||||
|
||||
i = 10; |
||||
rg0D->GetCell(0,gcell0D); |
||||
strm << "gcell0D: " << *gcell0D; |
||||
|
||||
// Test GetCellBounds
|
||||
|
||||
double bounds[6]; |
||||
rg3D->GetCellBounds(k * (19 * 19) + j * 19 + i, bounds); |
||||
strm << "GetCellBounds(rg3D): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
rg2Dxy->GetCellBounds(j * 19 + i, bounds); |
||||
strm << "GetCellBounds(rg2Dxy): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
rg2Dxz->GetCellBounds(j * 19 + i, bounds); |
||||
strm << "GetCellBounds(rg2Dxz): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
rg2Dyz->GetCellBounds(j * 19 + i, bounds); |
||||
strm << "GetCellBounds(rg2Dyz): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
rg1Dx->GetCellBounds(i, bounds); |
||||
strm << "GetCellBounds(rg1x): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
rg1Dy->GetCellBounds(i, bounds); |
||||
strm << "GetCellBounds(rg1Dy): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
rg1Dz->GetCellBounds(i, bounds); |
||||
strm << "GetCellBounds(rg1Dz): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
rg0D->GetCellBounds(i, bounds); |
||||
strm << "GetCellBounds(rg0D): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
// Test GetPoint
|
||||
|
||||
double point[6]; |
||||
rg3D->GetPoint(k * (20 * 20) + j * 20 + i, point); |
||||
strm << "GetPoint(rg3D): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
rg2Dxy->GetPoint(j * 20 + i, point); |
||||
strm << "GetPoint(rg2Dxy): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
rg2Dxz->GetPoint(j * 20 + i, point); |
||||
strm << "GetPoint(rg2Dxz): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
rg2Dyz->GetPoint(j * 20 + i, point); |
||||
strm << "GetPoint(rg2Dyz): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
rg1Dx->GetPoint(i, point); |
||||
strm << "GetPoint(rg1x): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
rg1Dy->GetPoint(i, point); |
||||
strm << "GetPoint(rg1Dy): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
rg1Dz->GetPoint(i, point); |
||||
strm << "GetPoint(rg1Dz): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
rg0D->GetPoint(0, point); |
||||
strm << "GetPoint(rg0D): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
// Test FindPoint
|
||||
|
||||
double point3D[3] = {10, 12, 14}; |
||||
|
||||
rg3D->GetPoint(rg3D->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 10; point3D[1] = 12; point3D[2] = 0; |
||||
rg2Dxy->GetPoint(rg2Dxy->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 10; point3D[1] = 0; point3D[2] = 14; |
||||
rg2Dxz->GetPoint(rg2Dxz->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 0; point3D[1] = 12; point3D[2] = 14; |
||||
rg2Dyz->GetPoint(rg2Dyz->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 10; point3D[1] = 0; point3D[2] = 0; |
||||
rg1Dx->GetPoint(rg1Dx->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 0; point3D[1] = 12; point3D[2] = 0; |
||||
rg1Dy->GetPoint(rg1Dy->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 0; point3D[1] = 0; point3D[2] = 14; |
||||
rg1Dz->GetPoint(rg1Dz->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
// Test FindAndGetCell
|
||||
|
||||
double pcoords[3], weights[8]; |
||||
int subId; |
||||
vtkCell *dummyCell = NULL; |
||||
|
||||
point3D[0] = 10.5; |
||||
point3D[1] = 12.1; |
||||
point3D[2] = 14.7; |
||||
|
||||
strm << "FindAndGetCell(rg3D): " << *rg3D->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << ", " << pcoords[1] << ", " << pcoords[2] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << ", " |
||||
<< weights[2] << ", " << weights[3] << ", " |
||||
<< weights[4] << ", " << weights[5] << ", " |
||||
<< weights[6] << ", " << weights[7] << endl; |
||||
|
||||
point3D[0] = 10.5; point3D[1] = 12.1; point3D[2] = 0; |
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0.0; |
||||
dummyCell = 0; |
||||
vtkCell *found = rg2Dxy->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(rg2Dxy) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(rg2Dxy): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << ", " << pcoords[1] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << endl; |
||||
|
||||
point3D[0] = 10.5; point3D[1] = 0.0; point3D[2] = 14.7; |
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0.0; |
||||
weights[0] = weights[1] = weights[2] = weights[3] = 0.0; |
||||
dummyCell = 0; |
||||
found = rg2Dxz->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(rg2Dxz) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(rg2Dxz): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << ", " << pcoords[1] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << endl; |
||||
|
||||
point3D[0] = 0.0; point3D[1] = 12.1; point3D[2] = 14.7; |
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0.0; |
||||
weights[0] = weights[1] = weights[2] = weights[3] = 0.0; |
||||
dummyCell = 0; |
||||
found = rg2Dyz->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(rg2Dyz) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(rg2Dyz): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << ", " << pcoords[1] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << endl; |
||||
|
||||
point3D[0] = 10.5; point3D[1] = 0.0; point3D[2] = 0.0; |
||||
dummyCell = 0; |
||||
found = rg1Dx->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(rg1Dx) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(rg1Dx): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << endl; |
||||
|
||||
|
||||
point3D[0] = 0.0; point3D[1] = 12.1; point3D[2] = 0.0; |
||||
dummyCell = 0; |
||||
found = rg1Dy->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(rg1Dy) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(rg1Dy): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << endl; |
||||
|
||||
|
||||
point3D[0] = 0.0; point3D[1] = 0.0; point3D[2] = 14.7; |
||||
dummyCell = 0; |
||||
found = rg1Dz->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(rg1Dz) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(rg1Dz): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << endl; |
||||
|
||||
|
||||
// Test GetCellType
|
||||
|
||||
strm << "GetCellType(rg3D): " << rg3D->GetCellType(0) << endl; |
||||
strm << "GetCellType(rg2Dxy): " << rg2Dxy->GetCellType(0) << endl; |
||||
strm << "GetCellType(rg2Dxz): " << rg2Dxz->GetCellType(0) << endl; |
||||
strm << "GetCellType(rg2Dyz): " << rg2Dyz->GetCellType(0) << endl; |
||||
strm << "GetCellType(rg1Dx): " << rg1Dx->GetCellType(0) << endl; |
||||
strm << "GetCellType(rg1Dy): " << rg1Dy->GetCellType(0) << endl; |
||||
strm << "GetCellType(rg1Dz): " << rg1Dz->GetCellType(0) << endl; |
||||
strm << "GetCellType(rg0D): " << rg0D->GetCellType(0) << endl; |
||||
|
||||
// Test GetActualMemorySize
|
||||
|
||||
strm << "GetActualMemorySize(rg3D): " << rg3D->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(rg2Dxy): " << rg2Dxy->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(rg2Dxz): " << rg2Dxz->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(rg2Dyz): " << rg2Dyz->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(rg1Dx): " << rg1Dx->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(rg1Dy): " << rg1Dy->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(rg1Dz): " << rg1Dz->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(rg0D): " << rg0D->GetActualMemorySize() << endl; |
||||
|
||||
// Cleanup
|
||||
rg0D->Delete(); |
||||
rg1Dx->Delete(); |
||||
rg1Dy->Delete(); |
||||
rg1Dz->Delete(); |
||||
rg2Dxy->Delete(); |
||||
rg2Dxz->Delete(); |
||||
rg2Dyz->Delete(); |
||||
rg3D->Delete(); |
||||
xdata->Delete(); |
||||
ydata->Delete(); |
||||
zdata->Delete(); |
||||
shortScalars3D->Delete(); |
||||
shortScalars2D->Delete(); |
||||
shortScalars1D->Delete(); |
||||
shortScalars0D->Delete(); |
||||
scrg3D->Delete(); |
||||
dcrg3D->Delete(); |
||||
ids->Delete(); |
||||
gcell3D->Delete(); |
||||
gcell2D->Delete(); |
||||
gcell1D->Delete(); |
||||
gcell0D->Delete(); |
||||
|
||||
strm << "Testing completed" << endl; |
||||
return 0; |
||||
} |
||||
|
||||
int otherRectilinearGrid(int,char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
return TestORG(vtkmsg_with_warning_C4701); |
||||
}
|
@ -0,0 +1,266 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherStringArray.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkCharArray.h" |
||||
#include "vtkIdTypeArray.h" |
||||
#include "vtkStringArray.h" |
||||
#include "vtkIdList.h" |
||||
|
||||
#define SIZE 1000 |
||||
|
||||
int doStringArrayTest(ostream& strm, int size) |
||||
{ |
||||
int errors = 0; |
||||
|
||||
vtkStringArray *ptr = vtkStringArray::New(); |
||||
vtkStdString *strings = new vtkStdString[SIZE]; |
||||
for (int i = 0; i < SIZE; ++i) |
||||
{ |
||||
char buf[1024]; |
||||
sprintf(buf, "string entry %d", i); |
||||
strings[i] = vtkStdString(buf);
|
||||
} |
||||
|
||||
strm << "\tResize(0)..."; |
||||
ptr->Resize(0);
|
||||
strm << "OK" << endl; |
||||
|
||||
strm << "\tResize(10)..."; |
||||
ptr->Resize(10);
|
||||
strm << "OK" << endl; |
||||
|
||||
strm << "\tResize(5)..."; |
||||
ptr->Resize(5);
|
||||
strm << "OK" << endl; |
||||
|
||||
strm << "\tResize(size)..."; |
||||
ptr->Resize(size);
|
||||
strm << "OK" << endl; |
||||
|
||||
strm << "\tSetNumberOfValues..."; |
||||
ptr->SetNumberOfValues(100); |
||||
if (ptr->GetNumberOfValues() == 100) strm << "OK" << endl; |
||||
else |
||||
{ |
||||
++errors; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tSetVoidArray..."; |
||||
ptr->SetVoidArray(strings, size, 1); |
||||
strm << "OK" << endl; |
||||
|
||||
strm << "\tGetValue..."; |
||||
vtkStdString value = ptr->GetValue(123); |
||||
if (value == "string entry 123")
|
||||
{ |
||||
strm << "OK" << endl; |
||||
} |
||||
else |
||||
{ |
||||
++errors; |
||||
strm << "FAILED. Expected 'string entry 123', got '"
|
||||
<< value << "'" << endl; |
||||
#ifdef DUMP_VALUES |
||||
for (int i = 0; i < ptr->GetNumberOfValues(); ++i) |
||||
{ |
||||
strm << "\t\tValue " << i << ": " << ptr->GetValue(i) << endl; |
||||
} |
||||
#endif |
||||
} |
||||
|
||||
strm << "\tSetValue..."; |
||||
ptr->SetValue(124, "jabberwocky"); |
||||
if (ptr->GetValue(124) == "jabberwocky") |
||||
{ |
||||
strm << "OK" << endl; |
||||
} |
||||
else |
||||
{ |
||||
++errors; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertValue..."; |
||||
ptr->InsertValue(500, "There and Back Again"); |
||||
if (ptr->GetValue(500) == "There and Back Again") |
||||
{ |
||||
strm << "OK" << endl; |
||||
} |
||||
else |
||||
{ |
||||
++errors; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tInsertNextValue..."; |
||||
if (ptr->GetValue(ptr->InsertNextValue("3.141592653589")) == |
||||
"3.141592653589") |
||||
{ |
||||
strm << "OK" << endl; |
||||
} |
||||
else |
||||
{ |
||||
++errors; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tvtkAbstractArray::GetValues(vtkIdList)..."; |
||||
vtkIdList *indices = vtkIdList::New(); |
||||
indices->InsertNextId(10); |
||||
indices->InsertNextId(20); |
||||
indices->InsertNextId(314); |
||||
|
||||
vtkStringArray *newValues = vtkStringArray::New(); |
||||
newValues->SetNumberOfValues(3); |
||||
ptr->GetValues(indices, newValues); |
||||
|
||||
if (newValues->GetValue(0) == "string entry 10" && |
||||
newValues->GetValue(1) == "string entry 20" && |
||||
newValues->GetValue(2) == "string entry 314") |
||||
{ |
||||
strm << "OK" << endl; |
||||
} |
||||
else |
||||
{ |
||||
++errors; |
||||
strm << "FAILED. Results:" << endl; |
||||
strm << "\tExpected: 'string entry 10'\tActual: '"
|
||||
<< newValues->GetValue(0) << "'" << endl; |
||||
strm << "\tExpected: 'string entry 20'\tActual: '"
|
||||
<< newValues->GetValue(1) << "'" << endl; |
||||
strm << "\tExpected: 'string entry 314'\tActual: '"
|
||||
<< newValues->GetValue(2) << "'" << endl; |
||||
} |
||||
|
||||
newValues->Reset(); |
||||
|
||||
strm << "\tvtkAbstractArray::GetValues(vtkIdType, vtkIdType)..."; |
||||
newValues->SetNumberOfValues(3); |
||||
ptr->GetValues(30, 32, newValues); |
||||
if (newValues->GetValue(0) == "string entry 30" && |
||||
newValues->GetValue(1) == "string entry 31" && |
||||
newValues->GetValue(2) == "string entry 32") |
||||
{ |
||||
strm << "OK" << endl; |
||||
} |
||||
else |
||||
{ |
||||
++errors; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
strm << "\tvtkAbstractArray::CopyValue..."; |
||||
ptr->CopyValue(150, 2, newValues); |
||||
if (ptr->GetValue(150) == "string entry 32") |
||||
{ |
||||
strm << "OK" << endl; |
||||
} |
||||
else |
||||
{ |
||||
++errors; |
||||
strm << "FAILED" << endl; |
||||
} |
||||
|
||||
newValues->Delete(); |
||||
indices->Delete(); |
||||
|
||||
strm << "PrintSelf..." << endl; |
||||
strm << *ptr; |
||||
|
||||
ptr->Delete(); |
||||
delete [] strings; |
||||
|
||||
strm << "\tvtkAbstractArray::ConvertToContiguous..."; |
||||
vtkStringArray *srcArray = vtkStringArray::New(); |
||||
vtkStringArray *destArray = vtkStringArray::New(); |
||||
|
||||
srcArray->InsertNextValue("First"); |
||||
srcArray->InsertNextValue("Second"); |
||||
srcArray->InsertNextValue("Third"); |
||||
|
||||
vtkDataArray *data; |
||||
vtkIdTypeArray *offsets; |
||||
srcArray->ConvertToContiguous(&data, &offsets); |
||||
|
||||
char combinedString[] = "FirstSecondThird"; |
||||
vtkCharArray *charData = vtkCharArray::SafeDownCast(data); |
||||
if (charData == NULL) |
||||
{ |
||||
++errors; |
||||
strm << "FAILED: couldn't downcast data array" << endl; |
||||
} |
||||
else |
||||
{ |
||||
for (int i = 0; i < static_cast<int>(strlen(combinedString)); ++i) |
||||
{ |
||||
if (charData->GetValue(i) != combinedString[i]) |
||||
{ |
||||
strm << "FAILED: array element " << i << " is wrong. Expected " |
||||
<< combinedString[i] << ", got " |
||||
<< charData->GetValue(i) << endl; |
||||
++errors; |
||||
} |
||||
} |
||||
|
||||
|
||||
destArray->ConvertFromContiguous(data, offsets); |
||||
|
||||
if (destArray->GetNumberOfValues() != srcArray->GetNumberOfValues()) |
||||
{ |
||||
++errors; |
||||
strm << "FAILED: reconstructed lengths don't match" << endl; |
||||
} |
||||
else |
||||
{ |
||||
for (int i = 0; i < srcArray->GetNumberOfValues(); ++i) |
||||
{ |
||||
if (destArray->GetValue(i) != srcArray->GetValue(i)) |
||||
{ |
||||
strm << "FAILED: element " << i << " doesn't match" << endl; |
||||
++errors; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
srcArray->Delete(); |
||||
destArray->Delete(); |
||||
data->Delete(); |
||||
offsets->Delete(); |
||||
|
||||
return errors; |
||||
} |
||||
|
||||
int otherStringArrayTest(ostream& strm) |
||||
{ |
||||
int errors = 0; |
||||
{ |
||||
strm << "Test StringArray" << endl; |
||||
errors += doStringArrayTest(strm, SIZE); |
||||
} |
||||
|
||||
return errors; |
||||
} |
||||
|
||||
int otherStringArray(int, char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
// return otherArraysTest(vtkmsg_with_warning_C4701);
|
||||
return otherStringArrayTest(cerr); |
||||
|
||||
}
|
@ -0,0 +1,634 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherStructuredGrid.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests vtkStructuredGrid
|
||||
|
||||
#include "vtkCell.h" |
||||
#include "vtkDebugLeaks.h" |
||||
#include "vtkDoubleArray.h" |
||||
#include "vtkFloatArray.h" |
||||
#include "vtkGenericCell.h" |
||||
#include "vtkIdList.h" |
||||
#include "vtkLongArray.h" |
||||
#include "vtkPointData.h" |
||||
#include "vtkShortArray.h" |
||||
#include "vtkStructuredGrid.h" |
||||
|
||||
int TestOSG(ostream& strm) |
||||
{ |
||||
int i, j, k; |
||||
// actual test
|
||||
strm << "Testing vtkStructuredGrid" << endl; |
||||
vtkStructuredGrid *sg0D = vtkStructuredGrid::New(); |
||||
vtkStructuredGrid *sg1Dx = vtkStructuredGrid::New(); |
||||
vtkStructuredGrid *sg1Dy = vtkStructuredGrid::New(); |
||||
vtkStructuredGrid *sg1Dz = vtkStructuredGrid::New(); |
||||
vtkStructuredGrid *sg2Dxy = vtkStructuredGrid::New(); |
||||
vtkStructuredGrid *sg2Dxz = vtkStructuredGrid::New(); |
||||
vtkStructuredGrid *sg2Dyz = vtkStructuredGrid::New(); |
||||
vtkStructuredGrid *sg3D = vtkStructuredGrid::New(); |
||||
|
||||
vtkPoints *xyzpoints = vtkPoints::New(); |
||||
for (k = 0; k < 20; k++) |
||||
{ |
||||
for (j = 0; j < 20; j++) |
||||
{ |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
xyzpoints->InsertNextPoint((double) i, (double) j, (double) k); |
||||
} |
||||
} |
||||
} |
||||
sg3D->SetDimensions(20,20,20); |
||||
sg3D->SetPoints(xyzpoints); xyzpoints->Delete(); |
||||
|
||||
vtkPoints *xypoints = vtkPoints::New(); |
||||
for (j = 0; j < 20; j++) |
||||
{ |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
xypoints->InsertNextPoint((double) i, (double) j, 0.0); |
||||
} |
||||
} |
||||
sg2Dxy->SetDimensions(20,20,1); |
||||
sg2Dxy->SetPoints(xypoints); xypoints->Delete(); |
||||
|
||||
vtkPoints *xzpoints = vtkPoints::New(); |
||||
for (k = 0; k < 20; k++) |
||||
{ |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
xzpoints->InsertNextPoint((double) i, 0.0, (double) k); |
||||
} |
||||
} |
||||
sg2Dxz->SetDimensions(20,1,20); |
||||
sg2Dxz->SetPoints(xzpoints); xzpoints->Delete(); |
||||
|
||||
vtkPoints *yzpoints = vtkPoints::New(); |
||||
for (k = 0; k < 20; k++) |
||||
{ |
||||
for (j = 0; j < 20; j++) |
||||
{ |
||||
yzpoints->InsertNextPoint(0.0, (double) j, (double) k); |
||||
} |
||||
} |
||||
sg2Dyz->SetDimensions(1,20,20); |
||||
sg2Dyz->SetPoints(yzpoints); yzpoints->Delete(); |
||||
|
||||
vtkPoints *xpoints = vtkPoints::New(); |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
xpoints->InsertNextPoint((double) i, 0.0, 0.0); |
||||
} |
||||
sg1Dx->SetDimensions(20,1,1); |
||||
sg1Dx->SetPoints(xpoints); xpoints->Delete(); |
||||
|
||||
vtkPoints *ypoints = vtkPoints::New(); |
||||
for (j = 0; j < 20; j++) |
||||
{ |
||||
ypoints->InsertNextPoint(0.0, (double) j, 0.0); |
||||
} |
||||
sg1Dy->SetDimensions(1,20,1); |
||||
sg1Dy->SetPoints(ypoints); ypoints->Delete(); |
||||
strm << *sg1Dy; |
||||
|
||||
vtkPoints *zpoints = vtkPoints::New(); |
||||
for (k = 0; k < 20; k++) |
||||
{ |
||||
zpoints->InsertNextPoint(0.0, 0.0, (double) k); |
||||
} |
||||
sg1Dz->SetDimensions(1,1,20); |
||||
sg1Dz->SetPoints(zpoints); zpoints->Delete(); |
||||
|
||||
vtkPoints *onepoints = vtkPoints::New(); |
||||
for (k = 0; k < 1; k++) |
||||
{ |
||||
onepoints->InsertNextPoint(0.0, 0.0, 0.0); |
||||
} |
||||
sg0D->SetDimensions(1,1,1); |
||||
sg0D->SetPoints(onepoints); onepoints->Delete(); |
||||
|
||||
vtkShortArray *shortScalars3D = vtkShortArray::New(); |
||||
shortScalars3D->SetNumberOfComponents(3); |
||||
shortScalars3D->SetNumberOfTuples(20*20*20); |
||||
|
||||
int l = 0; |
||||
for (k = 0; k < 20; k++) |
||||
{ |
||||
for (j = 0; j < 20; j++) |
||||
{ |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
shortScalars3D->InsertComponent(l,0,i); |
||||
shortScalars3D->InsertComponent(l,0,j); |
||||
shortScalars3D->InsertComponent(l,0,k); |
||||
l++; |
||||
} |
||||
} |
||||
} |
||||
|
||||
vtkShortArray *shortScalars2D = vtkShortArray::New(); |
||||
shortScalars2D->SetNumberOfComponents(2); |
||||
shortScalars2D->SetNumberOfTuples(20*20); |
||||
|
||||
l = 0; |
||||
for (j = 0; j < 20; j++) |
||||
{ |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
shortScalars2D->InsertComponent(l,0,i); |
||||
shortScalars2D->InsertComponent(l,0,j); |
||||
l++; |
||||
} |
||||
} |
||||
|
||||
vtkShortArray *shortScalars1D = vtkShortArray::New(); |
||||
shortScalars1D->SetNumberOfComponents(1); |
||||
shortScalars1D->SetNumberOfTuples(20); |
||||
|
||||
l = 0; |
||||
for (i = 0; i < 20; i++) |
||||
{ |
||||
shortScalars1D->InsertComponent(l,0,i); |
||||
l++; |
||||
} |
||||
|
||||
vtkShortArray *shortScalars0D = vtkShortArray::New(); |
||||
shortScalars0D->SetNumberOfComponents(1); |
||||
shortScalars0D->SetNumberOfTuples(1); |
||||
|
||||
l = 0; |
||||
shortScalars0D->InsertComponent(l,0,0); |
||||
|
||||
sg3D->GetPointData()->SetScalars(shortScalars3D); |
||||
sg2Dxy->GetPointData()->SetScalars(shortScalars2D); |
||||
sg2Dxz->GetPointData()->SetScalars(shortScalars2D); |
||||
sg2Dyz->GetPointData()->SetScalars(shortScalars2D); |
||||
sg1Dx->GetPointData()->SetScalars(shortScalars1D); |
||||
sg1Dy->GetPointData()->SetScalars(shortScalars1D); |
||||
sg1Dz->GetPointData()->SetScalars(shortScalars1D); |
||||
sg0D->GetPointData()->SetScalars(shortScalars3D); |
||||
|
||||
strm << "sg3D:" << *sg3D; |
||||
|
||||
// Test shallow copy
|
||||
vtkStructuredGrid *scsg3D = vtkStructuredGrid::New(); |
||||
scsg3D->ShallowCopy(sg3D); |
||||
strm << "ShallowCopy(sg3D):" << *scsg3D; |
||||
|
||||
// Test deep copy
|
||||
vtkStructuredGrid *dcsg3D = vtkStructuredGrid::New(); |
||||
dcsg3D->DeepCopy(sg3D); |
||||
strm << "DeepCopy(sg3D):" << *dcsg3D; |
||||
|
||||
// Test GetCell
|
||||
vtkIdList *ids = vtkIdList::New(); |
||||
int cellId; |
||||
int ii; |
||||
|
||||
i = 10; j = 15; k = 7; |
||||
cellId = k * (19 * 19) + j * 19 + i; |
||||
vtkCell *cell3D = sg3D->GetCell(cellId); |
||||
strm << "cell3D: " << *cell3D ; |
||||
sg3D->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; j = 15; |
||||
cellId = j * 19 + i; |
||||
vtkCell *cell2D = sg2Dxy->GetCell(cellId); |
||||
strm << "cell2D: " << *cell2D ; |
||||
sg2Dxy->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
|
||||
i = 10; j = 15; |
||||
cellId = j * 19 + i; |
||||
cell2D = sg2Dxz->GetCell(j * 19 + i); |
||||
strm << "cell2D: " << *cell2D ; |
||||
sg2Dxz->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; j = 15; |
||||
cellId = j * 19 + i; |
||||
cell2D = sg2Dyz->GetCell(j * 19 + i); |
||||
strm << "cell2D: " << *cell2D ; |
||||
sg2Dyz->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; |
||||
cellId = i; |
||||
vtkCell *cell1D = sg1Dx->GetCell(i); |
||||
strm << "cell1D: " << *cell1D; |
||||
sg1Dx->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; |
||||
cellId = i; |
||||
cell1D = sg1Dy->GetCell(i); |
||||
strm << "cell1D: " << *cell1D; |
||||
sg1Dy->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
i = 10; |
||||
cellId = i; |
||||
cell1D = sg1Dz->GetCell(i); |
||||
strm << "cell1D: " << *cell1D; |
||||
sg1Dz->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
cellId = 0; |
||||
vtkCell *cell0D = sg0D->GetCell(0); |
||||
strm << "cell0D: " << *cell0D; |
||||
sg0D->GetCellPoints (cellId, ids); |
||||
strm << "Ids for cell " << cellId << " are "; |
||||
for (ii = 0; ii < ids->GetNumberOfIds(); ii++) |
||||
{ |
||||
strm << ids->GetId(ii) << " "; |
||||
} |
||||
strm << endl << endl; |
||||
|
||||
// Test Thread Safe GetCell
|
||||
vtkGenericCell *gcell3D = vtkGenericCell::New(); |
||||
vtkGenericCell *gcell2D = vtkGenericCell::New(); |
||||
vtkGenericCell *gcell1D = vtkGenericCell::New(); |
||||
vtkGenericCell *gcell0D = vtkGenericCell::New(); |
||||
i = 10; j = 15; k = 7; |
||||
sg3D->GetCell(k * (19 * 19) + j * 19 + i, gcell3D); |
||||
strm << "gcell3D: " << *gcell3D ; |
||||
|
||||
i = 10; j = 15; |
||||
sg2Dxy->GetCell(j * 19 + i,gcell2D); |
||||
strm << "gcell2D: " << *gcell2D ; |
||||
|
||||
i = 10; j = 15; |
||||
sg2Dxz->GetCell(j * 19 + i,gcell2D); |
||||
strm << "gcell2D: " << *gcell2D ; |
||||
|
||||
i = 10; j = 15; |
||||
sg2Dyz->GetCell(j * 19 + i,gcell2D); |
||||
strm << "gcell2D: " << *gcell2D ; |
||||
|
||||
i = 10; |
||||
sg1Dx->GetCell(i,gcell1D); |
||||
strm << "gcell1D: " << *gcell1D; |
||||
|
||||
i = 10; |
||||
sg1Dy->GetCell(i,gcell1D); |
||||
strm << "gcell1D: " << *gcell1D; |
||||
|
||||
i = 10; |
||||
sg1Dz->GetCell(i,gcell1D); |
||||
strm << "gcell1D: " << *gcell1D; |
||||
|
||||
i = 10; |
||||
sg0D->GetCell(0,gcell0D); |
||||
strm << "gcell0D: " << *gcell0D; |
||||
|
||||
// Test GetCellBounds
|
||||
|
||||
double bounds[6]; |
||||
sg3D->GetCellBounds(k * (19 * 19) + j * 19 + i, bounds); |
||||
strm << "GetCellBounds(sg3D): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
sg2Dxy->GetCellBounds(j * 19 + i, bounds); |
||||
strm << "GetCellBounds(sg2Dxy): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
sg2Dxz->GetCellBounds(j * 19 + i, bounds); |
||||
strm << "GetCellBounds(sg2Dxz): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
sg2Dyz->GetCellBounds(j * 19 + i, bounds); |
||||
strm << "GetCellBounds(sg2Dyz): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
sg1Dx->GetCellBounds(i, bounds); |
||||
strm << "GetCellBounds(sg1x): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
sg1Dy->GetCellBounds(i, bounds); |
||||
strm << "GetCellBounds(sg1Dy): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
sg1Dz->GetCellBounds(i, bounds); |
||||
strm << "GetCellBounds(sg1Dz): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
sg0D->GetCellBounds(i, bounds); |
||||
strm << "GetCellBounds(sg0D): " |
||||
<< bounds[0] << ", " << bounds[1] << ", " |
||||
<< bounds[2] << ", " << bounds[3] << ", " |
||||
<< bounds[4] << ", " << bounds[5] << endl; |
||||
|
||||
// Test GetPoint
|
||||
|
||||
double point[6]; |
||||
sg3D->GetPoint(k * (20 * 20) + j * 20 + i, point); |
||||
strm << "GetPoint(sg3D): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
sg2Dxy->GetPoint(j * 20 + i, point); |
||||
strm << "GetPoint(sg2Dxy): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
sg2Dxz->GetPoint(j * 20 + i, point); |
||||
strm << "GetPoint(sg2Dxz): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
sg2Dyz->GetPoint(j * 20 + i, point); |
||||
strm << "GetPoint(sg2Dyz): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
sg1Dx->GetPoint(i, point); |
||||
strm << "GetPoint(sg1x): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
sg1Dy->GetPoint(i, point); |
||||
strm << "GetPoint(sg1Dy): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
sg1Dz->GetPoint(i, point); |
||||
strm << "GetPoint(sg1Dz): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
sg0D->GetPoint(0, point); |
||||
strm << "GetPoint(sg0D): " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
// Test FindPoint
|
||||
|
||||
double point3D[3] = {10, 12, 14}; |
||||
|
||||
sg3D->GetPoint(sg3D->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 10; point3D[1] = 12; point3D[2] = 0; |
||||
sg2Dxy->GetPoint(sg2Dxy->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 10; point3D[1] = 0; point3D[2] = 14; |
||||
sg2Dxz->GetPoint(sg2Dxz->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 0; point3D[1] = 12; point3D[2] = 14; |
||||
sg2Dyz->GetPoint(sg2Dyz->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 10; point3D[1] = 0; point3D[2] = 0; |
||||
sg1Dx->GetPoint(sg1Dx->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 0; point3D[1] = 12; point3D[2] = 0; |
||||
sg1Dy->GetPoint(sg1Dy->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
point3D[0] = 0; point3D[1] = 0; point3D[2] = 14; |
||||
sg1Dz->GetPoint(sg1Dz->FindPoint(point3D), point); |
||||
strm << "FindPoint(" |
||||
<< point3D[0] << ", " << point3D[1] << ", " << point3D[2] << ") = " |
||||
<< point[0] << ", " << point[1] << ", " << point[2] << endl; |
||||
|
||||
// Test FindAndGetCell
|
||||
|
||||
double pcoords[3], weights[8]; |
||||
int subId; |
||||
vtkCell *dummyCell = 0; |
||||
|
||||
point3D[0] = 10.5; |
||||
point3D[1] = 12.1; |
||||
point3D[2] = 14.7; |
||||
|
||||
strm << "FindAndGetCell(sg3D): " << *sg3D->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << ", " << pcoords[1] << ", " << pcoords[2] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << ", " |
||||
<< weights[2] << ", " << weights[3] << ", " |
||||
<< weights[4] << ", " << weights[5] << ", " |
||||
<< weights[6] << ", " << weights[7] << endl; |
||||
|
||||
point3D[0] = 10.5; point3D[1] = 12.1; point3D[2] = 0; |
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0.0; |
||||
dummyCell = 0; |
||||
vtkCell *found = sg2Dxy->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(sg2Dxy) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(sg2Dxy): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << ", " << pcoords[1] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << endl; |
||||
|
||||
point3D[0] = 10.5; point3D[1] = 0.0; point3D[2] = 14.7; |
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0.0; |
||||
weights[0] = weights[1] = weights[2] = weights[3] = 0.0; |
||||
dummyCell = 0; |
||||
found = sg2Dxz->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(sg2Dxz) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(sg2Dxz): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << ", " << pcoords[1] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << endl; |
||||
|
||||
point3D[0] = 0.0; point3D[1] = 12.1; point3D[2] = 14.7; |
||||
pcoords[0] = pcoords[1] = pcoords[2] = 0.0; |
||||
weights[0] = weights[1] = weights[2] = weights[3] = 0.0; |
||||
dummyCell = 0; |
||||
found = sg2Dyz->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(sg2Dyz) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(sg2Dyz): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << ", " << pcoords[1] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << endl; |
||||
|
||||
point3D[0] = 10.5; point3D[1] = 0.0; point3D[2] = 0.0; |
||||
dummyCell = 0; |
||||
found = sg1Dx->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(sg1Dx) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(sg1Dx): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << endl; |
||||
|
||||
|
||||
point3D[0] = 0.0; point3D[1] = 12.1; point3D[2] = 0.0; |
||||
dummyCell = 0; |
||||
found = sg1Dy->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(sg1Dy) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(sg1Dy): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << endl; |
||||
|
||||
|
||||
point3D[0] = 0.0; point3D[1] = 0.0; point3D[2] = 14.7; |
||||
dummyCell = 0; |
||||
found = sg1Dz->FindAndGetCell(point3D, dummyCell, 0, 0, subId, pcoords, weights); |
||||
if (found == NULL) |
||||
{ |
||||
strm << "FindAndGetCell(sg1Dz) not found!" << endl; |
||||
return 1; |
||||
} |
||||
|
||||
strm << "FindAndGetCell(sg1Dz): " << *found; |
||||
strm << "pcoords: " |
||||
<< pcoords[0] << endl; |
||||
strm << "weights: " |
||||
<< weights[0] << ", " << weights[1] << endl; |
||||
|
||||
|
||||
// Test GetCellType
|
||||
|
||||
strm << "GetCellType(sg3D): " << sg3D->GetCellType(0) << endl; |
||||
strm << "GetCellType(sg2Dxy): " << sg2Dxy->GetCellType(0) << endl; |
||||
strm << "GetCellType(sg2Dxz): " << sg2Dxz->GetCellType(0) << endl; |
||||
strm << "GetCellType(sg2Dyz): " << sg2Dyz->GetCellType(0) << endl; |
||||
strm << "GetCellType(sg1Dx): " << sg1Dx->GetCellType(0) << endl; |
||||
strm << "GetCellType(sg1Dy): " << sg1Dy->GetCellType(0) << endl; |
||||
strm << "GetCellType(sg1Dz): " << sg1Dz->GetCellType(0) << endl; |
||||
strm << "GetCellType(sg0D): " << sg0D->GetCellType(0) << endl; |
||||
|
||||
// Test GetActualMemorySize
|
||||
|
||||
strm << "GetActualMemorySize(sg3D): " << sg3D->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(sg2Dxy): " << sg2Dxy->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(sg2Dxz): " << sg2Dxz->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(sg2Dyz): " << sg2Dyz->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(sg1Dx): " << sg1Dx->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(sg1Dy): " << sg1Dy->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(sg1Dz): " << sg1Dz->GetActualMemorySize() << endl; |
||||
strm << "GetActualMemorySize(sg0D): " << sg0D->GetActualMemorySize() << endl; |
||||
|
||||
sg0D->Delete(); |
||||
sg1Dx->Delete(); |
||||
sg1Dy->Delete(); |
||||
sg1Dz->Delete(); |
||||
sg2Dxy->Delete(); |
||||
sg2Dxz->Delete(); |
||||
sg2Dyz->Delete(); |
||||
sg3D->Delete(); |
||||
shortScalars3D->Delete(); |
||||
shortScalars2D->Delete(); |
||||
shortScalars1D->Delete(); |
||||
shortScalars0D->Delete(); |
||||
scsg3D->Delete(); |
||||
dcsg3D->Delete(); |
||||
ids->Delete(); |
||||
gcell3D->Delete(); |
||||
gcell2D->Delete(); |
||||
gcell1D->Delete(); |
||||
gcell0D->Delete(); |
||||
|
||||
strm << "Testing completed" << endl; |
||||
return 0; |
||||
} |
||||
|
||||
int otherStructuredGrid(int,char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
return TestOSG(vtkmsg_with_warning_C4701); |
||||
}
|
@ -0,0 +1,75 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: otherTimerLog.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
|
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// this program tests the TimerLog
|
||||
|
||||
#include "vtkTimerLog.h" |
||||
#include "vtkDebugLeaks.h" |
||||
|
||||
// this is needed for the unlink call
|
||||
#if defined(__CYGWIN__) |
||||
#include <sys/unistd.h> |
||||
#elif defined(_WIN32) |
||||
# include <io.h> |
||||
#endif |
||||
|
||||
#include "vtkWindows.h" // for Sleep |
||||
|
||||
void otherTimerLogTest(ostream& strm) |
||||
{ |
||||
// actual test
|
||||
float a = 1.0; |
||||
int i, j; |
||||
strm << "Test vtkTimerLog Start" << endl; |
||||
vtkTimerLog *timer1 = vtkTimerLog::New(); |
||||
|
||||
timer1->SetMaxEntries (3); |
||||
timer1->StartTimer(); |
||||
for (j = 0; j < 4; j++) |
||||
{ |
||||
timer1->FormatAndMarkEvent("%s%d", "start", j); |
||||
for (i = 0; i < 10000000; i++) |
||||
{ |
||||
a *= a; |
||||
} |
||||
#ifndef WIN32 |
||||
sleep (1); |
||||
#else |
||||
Sleep(1000); |
||||
#endif |
||||
timer1->FormatAndMarkEvent("%s%d", "end", j); |
||||
} |
||||
timer1->StopTimer(); |
||||
strm << *timer1; |
||||
strm << "GetElapsedTime: " << timer1->GetElapsedTime() << endl; |
||||
strm << "GetCPUTime: " << timer1->GetCPUTime() << endl; |
||||
timer1->DumpLog( "timing" ); |
||||
timer1->ResetLog (); |
||||
timer1->CleanupLog(); |
||||
unlink("timing"); |
||||
timer1->Delete(); |
||||
strm << "Test vtkTimerLog End" << endl; |
||||
} |
||||
|
||||
|
||||
int otherTimerLog(int,char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
otherTimerLogTest(vtkmsg_with_warning_C4701); |
||||
|
||||
return 0; |
||||
}
|
@ -0,0 +1,400 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: quadraticEvaluation.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
// .NAME
|
||||
// .SECTION Description
|
||||
// This program tests quadratic cell EvaluatePosition() and EvaluateLocation()
|
||||
// methods.
|
||||
|
||||
#include "vtkDebugLeaks.h" |
||||
|
||||
#include "vtkIdList.h" |
||||
#include "vtkQuadraticEdge.h" |
||||
#include "vtkQuadraticTriangle.h" |
||||
#include "vtkQuadraticQuad.h" |
||||
#include "vtkQuadraticHexahedron.h" |
||||
#include "vtkQuadraticTetra.h" |
||||
#include "vtkQuadraticWedge.h" |
||||
#include "vtkQuadraticPyramid.h" |
||||
|
||||
void ComputeDataValues(vtkPoints *pts, double *edgeValues) |
||||
{ |
||||
double x[3]; |
||||
int numPts = pts->GetNumberOfPoints(); |
||||
for (int i=0; i<numPts; i++) |
||||
{ |
||||
pts->GetPoint(i,x); |
||||
double dem = (1.0 + x[0]); |
||||
if(fabs(dem) < 1.e-08) |
||||
{ |
||||
edgeValues[i] = 0; |
||||
} |
||||
else |
||||
{ |
||||
edgeValues[i] = 1.0 / dem; //simple linear function for now
|
||||
} |
||||
} |
||||
} |
||||
|
||||
int TestQE(ostream& strm) |
||||
{ |
||||
// actual test
|
||||
double dist2; |
||||
int subId; |
||||
|
||||
//-----------------------------------------------------------
|
||||
strm << "Test instantiation New() and NewInstance() Start" << endl; |
||||
vtkQuadraticEdge *edge = vtkQuadraticEdge::New(); |
||||
vtkQuadraticEdge *edge2 = edge->NewInstance(); |
||||
|
||||
vtkQuadraticTriangle *tri = vtkQuadraticTriangle::New(); |
||||
vtkQuadraticTriangle *tri2 = tri->NewInstance(); |
||||
|
||||
vtkQuadraticQuad *quad = vtkQuadraticQuad::New(); |
||||
vtkQuadraticQuad *quad2 = quad->NewInstance(); |
||||
|
||||
vtkQuadraticTetra *tetra = vtkQuadraticTetra::New(); |
||||
vtkQuadraticTetra *tetra2 = tetra->NewInstance(); |
||||
|
||||
vtkQuadraticHexahedron *hex = vtkQuadraticHexahedron::New(); |
||||
vtkQuadraticHexahedron *hex2 = hex->NewInstance(); |
||||
|
||||
vtkQuadraticWedge *wedge = vtkQuadraticWedge::New(); |
||||
vtkQuadraticWedge *wedge2 = wedge->NewInstance(); |
||||
|
||||
vtkQuadraticPyramid *pyra = vtkQuadraticPyramid::New(); |
||||
vtkQuadraticHexahedron *pyra2 = hex->NewInstance(); |
||||
|
||||
edge2->Delete(); |
||||
tri2->Delete(); |
||||
quad2->Delete(); |
||||
tetra2->Delete(); |
||||
hex2->Delete(); |
||||
wedge2->Delete(); |
||||
pyra2->Delete(); |
||||
|
||||
strm << "Test instantiation New() and NewInstance() End" << endl; |
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
strm << "Test vtkCell::EvaluatePosition Start" << endl; |
||||
|
||||
// vtkQuadraticEdge
|
||||
double edgePCoords[3], edgeWeights[3], edgePosition[3]; |
||||
double edgePoint[1][3] = {{0.25, 0.125, 0.0}}; |
||||
double edgeClosest[3]; |
||||
|
||||
edge->GetPointIds()->SetId(0,0); |
||||
edge->GetPointIds()->SetId(1,1); |
||||
edge->GetPointIds()->SetId(2,2); |
||||
|
||||
edge->GetPoints()->SetPoint(0, 0, 0, 0); |
||||
edge->GetPoints()->SetPoint(1, 1, 0, .5); |
||||
edge->GetPoints()->SetPoint(2, 0.5, 0.25, .2); |
||||
|
||||
edge->EvaluatePosition(edgePoint[0], edgeClosest, subId, edgePCoords,
|
||||
dist2, edgeWeights); |
||||
|
||||
// vtkQuadraticTriangle
|
||||
double triPCoords[3], triWeights[6], triPosition[3]; |
||||
double triPoint[1][3] = {{0.5, 0.266667, 0.0}}; |
||||
double triClosest[3]; |
||||
|
||||
tri->GetPointIds()->SetId(0,0); |
||||
tri->GetPointIds()->SetId(1,1); |
||||
tri->GetPointIds()->SetId(2,2); |
||||
tri->GetPointIds()->SetId(3,3); |
||||
tri->GetPointIds()->SetId(4,4); |
||||
tri->GetPointIds()->SetId(5,5); |
||||
|
||||
tri->GetPoints()->SetPoint(0, 0, 0, 0); |
||||
tri->GetPoints()->SetPoint(1, 1, 0, 0); |
||||
tri->GetPoints()->SetPoint(2, 0.5, 0.8, 0); |
||||
tri->GetPoints()->SetPoint(3, 0.5, 0.0, 0); |
||||
tri->GetPoints()->SetPoint(4, 0.75, 0.4, 0); |
||||
tri->GetPoints()->SetPoint(5, 0.25, 0.4, 0); |
||||
|
||||
tri->EvaluatePosition(triPoint[0], triClosest, subId, triPCoords,
|
||||
dist2, triWeights); |
||||
|
||||
|
||||
// vtkQuadraticQuad
|
||||
double quadPCoords[3], quadWeights[8], quadPosition[3]; |
||||
double quadPoint[1][3] = {{0.25, 0.33, 0.0}}; |
||||
double quadClosest[3]; |
||||
|
||||
quad->GetPointIds()->SetId(0,0); |
||||
quad->GetPointIds()->SetId(1,1); |
||||
quad->GetPointIds()->SetId(2,2); |
||||
quad->GetPointIds()->SetId(3,3); |
||||
quad->GetPointIds()->SetId(4,4); |
||||
quad->GetPointIds()->SetId(5,5); |
||||
quad->GetPointIds()->SetId(6,6); |
||||
quad->GetPointIds()->SetId(7,7); |
||||
|
||||
quad->GetPoints()->SetPoint(0, 0.0, 0.0, 0.0); |
||||
quad->GetPoints()->SetPoint(1, 1.0, 0.0, 0.0); |
||||
quad->GetPoints()->SetPoint(2, 1.0, 1.0, 0.0); |
||||
quad->GetPoints()->SetPoint(3, 0.0, 1.0, 0.0); |
||||
quad->GetPoints()->SetPoint(4, 0.5, 0.0, 0.0); |
||||
quad->GetPoints()->SetPoint(5, 1.0, 0.5, 0.0); |
||||
quad->GetPoints()->SetPoint(6, 0.5, 1.0, 0.0); |
||||
quad->GetPoints()->SetPoint(7, 0.0, 0.5, 0.0); |
||||
|
||||
quad->EvaluatePosition(quadPoint[0], quadClosest, subId, quadPCoords,
|
||||
dist2, quadWeights); |
||||
|
||||
// vtkQuadraticTetra
|
||||
double tetraPCoords[3], tetraWeights[10], tetraPosition[3]; |
||||
double tetraPoint[1][3] = {{0.5, 0.266667, 0.333333}}; |
||||
double tetraClosest[3]; |
||||
|
||||
tetra->GetPointIds()->SetId(0,0); |
||||
tetra->GetPointIds()->SetId(1,1); |
||||
tetra->GetPointIds()->SetId(2,2); |
||||
tetra->GetPointIds()->SetId(3,3); |
||||
tetra->GetPointIds()->SetId(4,4); |
||||
tetra->GetPointIds()->SetId(5,5); |
||||
tetra->GetPointIds()->SetId(6,6); |
||||
tetra->GetPointIds()->SetId(7,7); |
||||
tetra->GetPointIds()->SetId(8,8); |
||||
tetra->GetPointIds()->SetId(9,9); |
||||
|
||||
tetra->GetPoints()->SetPoint(0, 0.0, 0.0, 0.0); |
||||
tetra->GetPoints()->SetPoint(1, 1.0, 0.0, 0.0); |
||||
tetra->GetPoints()->SetPoint(2, 0.5, 0.8, 0.0); |
||||
tetra->GetPoints()->SetPoint(3, 0.5, 0.4, 1.0); |
||||
tetra->GetPoints()->SetPoint(4, 0.5, 0.0, 0.0); |
||||
tetra->GetPoints()->SetPoint(5, 0.75, 0.4, 0.0); |
||||
tetra->GetPoints()->SetPoint(6, 0.25, 0.4, 0.0); |
||||
tetra->GetPoints()->SetPoint(7, 0.25, 0.2, 0.5); |
||||
tetra->GetPoints()->SetPoint(8, 0.75, 0.2, 0.5); |
||||
tetra->GetPoints()->SetPoint(9, 0.50, 0.6, 0.5); |
||||
|
||||
tetra->EvaluatePosition(tetraPoint[0], tetraClosest, subId, tetraPCoords,
|
||||
dist2, tetraWeights); |
||||
|
||||
|
||||
// vtkQuadraticHexahedron
|
||||
double hexPCoords[3], hexWeights[20], hexPosition[3]; |
||||
double hexPoint[1][3] = {{0.25, 0.33333, 0.666667}}; |
||||
double hexClosest[3]; |
||||
|
||||
hex->GetPointIds()->SetId(0,0); |
||||
hex->GetPointIds()->SetId(1,1); |
||||
hex->GetPointIds()->SetId(2,2); |
||||
hex->GetPointIds()->SetId(3,3); |
||||
hex->GetPointIds()->SetId(4,4); |
||||
hex->GetPointIds()->SetId(5,5); |
||||
hex->GetPointIds()->SetId(6,6); |
||||
hex->GetPointIds()->SetId(7,7); |
||||
hex->GetPointIds()->SetId(8,8); |
||||
hex->GetPointIds()->SetId(9,9); |
||||
hex->GetPointIds()->SetId(10,10); |
||||
hex->GetPointIds()->SetId(11,11); |
||||
hex->GetPointIds()->SetId(12,12); |
||||
hex->GetPointIds()->SetId(13,13); |
||||
hex->GetPointIds()->SetId(14,14); |
||||
hex->GetPointIds()->SetId(15,15); |
||||
hex->GetPointIds()->SetId(16,16); |
||||
hex->GetPointIds()->SetId(17,17); |
||||
hex->GetPointIds()->SetId(18,18); |
||||
hex->GetPointIds()->SetId(19,19); |
||||
|
||||
hex->GetPoints()->SetPoint( 0, 0, 0, 0 ); |
||||
hex->GetPoints()->SetPoint( 1, 1, 0, 0 ); |
||||
hex->GetPoints()->SetPoint( 2, 1, 1, 0 ); |
||||
hex->GetPoints()->SetPoint( 3, 0, 1, 0 ); |
||||
hex->GetPoints()->SetPoint( 4, 0, 0, 1 ); |
||||
hex->GetPoints()->SetPoint( 5, 1, 0, 1 ); |
||||
hex->GetPoints()->SetPoint( 6, 1, 1, 1 ); |
||||
hex->GetPoints()->SetPoint( 7, 0, 1, 1 ); |
||||
hex->GetPoints()->SetPoint( 8, 0.5, 0, 0); |
||||
hex->GetPoints()->SetPoint( 9, 1, 0.5, 0); |
||||
hex->GetPoints()->SetPoint(10, 0.5, 1, 0); |
||||
hex->GetPoints()->SetPoint(11, 0, 0.5, 0); |
||||
hex->GetPoints()->SetPoint(12, 0.5, 0, 1); |
||||
hex->GetPoints()->SetPoint(13, 1, 0.5, 1); |
||||
hex->GetPoints()->SetPoint(14, 0.5, 1, 1); |
||||
hex->GetPoints()->SetPoint(15, 0, 0.5, 1); |
||||
hex->GetPoints()->SetPoint(16, 0, 0, 0.5); |
||||
hex->GetPoints()->SetPoint(17, 1, 0, 0.5); |
||||
hex->GetPoints()->SetPoint(18, 1, 1, 0.5); |
||||
hex->GetPoints()->SetPoint(19, 0, 1, 0.5); |
||||
|
||||
hex->EvaluatePosition(hexPoint[0], hexClosest, subId, hexPCoords,
|
||||
dist2, hexWeights); |
||||
|
||||
// vtkQuadraticWedge
|
||||
double wedgePCoords[3], wedgeWeights[20], wedgePosition[3]; |
||||
double wedgePoint[1][3] = {{0.25, 0.33333, 0.666667}}; |
||||
double wedgeClosest[3]; |
||||
|
||||
wedge->GetPointIds()->SetId(0,0); |
||||
wedge->GetPointIds()->SetId(1,1); |
||||
wedge->GetPointIds()->SetId(2,2); |
||||
wedge->GetPointIds()->SetId(3,3); |
||||
wedge->GetPointIds()->SetId(4,4); |
||||
wedge->GetPointIds()->SetId(5,5); |
||||
wedge->GetPointIds()->SetId(6,6); |
||||
wedge->GetPointIds()->SetId(7,7); |
||||
wedge->GetPointIds()->SetId(8,8); |
||||
wedge->GetPointIds()->SetId(9,9); |
||||
wedge->GetPointIds()->SetId(10,10); |
||||
wedge->GetPointIds()->SetId(11,11); |
||||
wedge->GetPointIds()->SetId(12,12); |
||||
wedge->GetPointIds()->SetId(13,13); |
||||
wedge->GetPointIds()->SetId(14,14); |
||||
|
||||
wedge->GetPoints()->SetPoint( 0, 0, 0, 0 ); |
||||
wedge->GetPoints()->SetPoint( 1, 1, 0, 0 ); |
||||
wedge->GetPoints()->SetPoint( 2, 0, 1, 0 ); |
||||
wedge->GetPoints()->SetPoint( 3, 0, 0, 1 ); |
||||
wedge->GetPoints()->SetPoint( 4, 1, 0, 1 ); |
||||
wedge->GetPoints()->SetPoint( 5, 0, 1, 1 ); |
||||
wedge->GetPoints()->SetPoint( 6, 0.5, 0, 0 ); |
||||
wedge->GetPoints()->SetPoint( 7, 0.5, 0.5, 0 ); |
||||
wedge->GetPoints()->SetPoint( 8, 0, 0.5, 0); |
||||
wedge->GetPoints()->SetPoint( 9, 0.5, 0, 1); |
||||
wedge->GetPoints()->SetPoint(10, 0.5, 0.5, 1); |
||||
wedge->GetPoints()->SetPoint(11, 0, 0.5, 1); |
||||
wedge->GetPoints()->SetPoint(12, 0, 0, 0.5); |
||||
wedge->GetPoints()->SetPoint(13, 1, 0, 0.5); |
||||
wedge->GetPoints()->SetPoint(14, 0, 1, 0.5); |
||||
|
||||
wedge->EvaluatePosition(wedgePoint[0], wedgeClosest, subId, wedgePCoords,
|
||||
dist2, wedgeWeights); |
||||
|
||||
// vtkQuadraticPyramid
|
||||
double pyraPCoords[3], pyraWeights[20], pyraPosition[3]; |
||||
double pyraPoint[1][3] = {{0.25, 0.33333, 0.666667}}; |
||||
double pyraClosest[3]; |
||||
|
||||
pyra->GetPointIds()->SetId(0,0); |
||||
pyra->GetPointIds()->SetId(1,1); |
||||
pyra->GetPointIds()->SetId(2,2); |
||||
pyra->GetPointIds()->SetId(3,3); |
||||
pyra->GetPointIds()->SetId(4,4); |
||||
pyra->GetPointIds()->SetId(5,5); |
||||
pyra->GetPointIds()->SetId(6,6); |
||||
pyra->GetPointIds()->SetId(7,7); |
||||
pyra->GetPointIds()->SetId(8,8); |
||||
pyra->GetPointIds()->SetId(9,9); |
||||
pyra->GetPointIds()->SetId(10,10); |
||||
pyra->GetPointIds()->SetId(11,11); |
||||
pyra->GetPointIds()->SetId(12,12); |
||||
|
||||
pyra->GetPoints()->SetPoint( 0, 0, 0, 0 ); |
||||
pyra->GetPoints()->SetPoint( 1, 1, 0, 0 ); |
||||
pyra->GetPoints()->SetPoint( 2, 1, 1, 0 ); |
||||
pyra->GetPoints()->SetPoint( 3, 0, 1, 0 ); |
||||
pyra->GetPoints()->SetPoint( 4, 0, 0, 1 ); |
||||
pyra->GetPoints()->SetPoint( 5, 0.5, 0, 0 ); |
||||
pyra->GetPoints()->SetPoint( 6, 1, 0.5, 0 ); |
||||
pyra->GetPoints()->SetPoint( 7, 0.5, 1, 0 ); |
||||
pyra->GetPoints()->SetPoint( 8, 0, 0.5, 0 ); |
||||
pyra->GetPoints()->SetPoint( 9, 0, 0, 0.5 ); |
||||
pyra->GetPoints()->SetPoint(10, 0.5, 0, 0.5 ); |
||||
pyra->GetPoints()->SetPoint(11, 0.5, 0.5, 0.5 ); |
||||
pyra->GetPoints()->SetPoint(12, 0, 0.5, 0.5 ); |
||||
|
||||
pyra->EvaluatePosition(pyraPoint[0], pyraClosest, subId, pyraPCoords,
|
||||
dist2, pyraWeights); |
||||
|
||||
strm << "Test vtkCell::EvaluatePosition End" << endl; |
||||
|
||||
//-------------------------------------------------------------
|
||||
strm << "Test vtkCell::EvaluateLocation Start" << endl; |
||||
// vtkQuadraticEdge
|
||||
edge->EvaluateLocation(subId, edgePCoords, edgePosition, edgeWeights); |
||||
|
||||
// vtkQuadraticTriangle
|
||||
tri->EvaluateLocation(subId, triPCoords, triPosition, triWeights); |
||||
|
||||
// vtkQuadraticQuad
|
||||
quad->EvaluateLocation(subId, quadPCoords, quadPosition, quadWeights); |
||||
|
||||
// vtkQuadraticTetra
|
||||
tetra->EvaluateLocation(subId, tetraPCoords, tetraPosition, tetraWeights); |
||||
|
||||
// vtkQuadraticHexahedron
|
||||
hexPCoords[0] = 0.25; |
||||
hexPCoords[1] = 0.33; |
||||
hexPCoords[2] = 0.75; |
||||
hex->EvaluateLocation(subId, hexPCoords, hexPosition, hexWeights); |
||||
|
||||
// vtkQuadraticWedge
|
||||
wedge->EvaluateLocation(subId, wedgePCoords, wedgePosition, wedgeWeights); |
||||
|
||||
// vtkQuadraticPyramid
|
||||
pyra->EvaluateLocation(subId, pyraPCoords, pyraPosition, pyraWeights); |
||||
|
||||
strm << "Test vtkCell::EvaluateLocation End" << endl; |
||||
|
||||
//-------------------------------------------------------------
|
||||
strm << "Test vtkCell::CellDerivs Start" << endl; |
||||
|
||||
// vtkQuadraticEdge - temporarily commented out
|
||||
// double edgeValues[3], edgeDerivs[3];
|
||||
// ComputeDataValues(edge->Points,edgeValues);
|
||||
// edge->Derivatives(subId, edgePCoords, edgeValues, 1, edgeDerivs);
|
||||
|
||||
// vtkQuadraticTriangle
|
||||
double triValues[6], triDerivs[3]; |
||||
ComputeDataValues(tri->Points,triValues); |
||||
tri->Derivatives(subId, triPCoords, triValues, 1, triDerivs); |
||||
|
||||
// vtkQuadraticQuad
|
||||
double quadValues[8], quadDerivs[3]; |
||||
ComputeDataValues(quad->Points,quadValues); |
||||
quad->Derivatives(subId, quadPCoords, quadValues, 1, quadDerivs); |
||||
|
||||
// vtkQuadraticTetra
|
||||
double tetraValues[10], tetraDerivs[3]; |
||||
ComputeDataValues(tetra->Points,tetraValues); |
||||
tetra->Derivatives(subId, tetraPCoords, tetraValues, 1, tetraDerivs); |
||||
|
||||
// vtkQuadraticHexahedron
|
||||
double hexValues[20], hexDerivs[3]; |
||||
ComputeDataValues(hex->Points,hexValues); |
||||
hex->Derivatives(subId, hexPCoords, hexValues, 1, hexDerivs); |
||||
|
||||
// vtkQuadraticWedge
|
||||
double wedgeValues[15], wedgeDerivs[3]; |
||||
ComputeDataValues(wedge->Points,wedgeValues); |
||||
wedge->Derivatives(subId, wedgePCoords, wedgeValues, 1, wedgeDerivs); |
||||
|
||||
// vtkQuadraticPyramid
|
||||
double pyraValues[13], pyraDerivs[3]; |
||||
ComputeDataValues(pyra->Points,pyraValues); |
||||
pyra->Derivatives(subId, pyraPCoords, pyraValues, 1, pyraDerivs); |
||||
|
||||
strm << "Test vtkCell::CellDerivs End" << endl; |
||||
|
||||
edge->Delete(); |
||||
tri->Delete(); |
||||
quad->Delete(); |
||||
tetra->Delete(); |
||||
hex->Delete(); |
||||
wedge->Delete(); |
||||
pyra->Delete(); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int quadraticEvaluation(int,char *[]) |
||||
{ |
||||
ostrstream vtkmsg_with_warning_C4701;
|
||||
return TestQE(vtkmsg_with_warning_C4701); |
||||
}
|
@ -0,0 +1,35 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: vtkTestDriver.h,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
// This header is included by all the C++ test drivers in VTK.
|
||||
#ifndef _vtkTestDriver_h |
||||
#define _vtkTestDriver_h |
||||
|
||||
// MSVC 6.0 warns about unused inline functions from <exception> and
|
||||
// <crtdbg.h>. Unfortunately this pragma has to be in effect at the
|
||||
// end of the translation unit so we cannot push/pop it around the
|
||||
// include.
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1300) |
||||
# pragma warning (disable: 4514) /* unreferenced inline function */ |
||||
|
||||
// Temporary suppression of this warning from CMake generated TestDriver
|
||||
// code until it can be fixed in the generator...
|
||||
# pragma warning (disable: 4701) /* local variable 'x' may be used |
||||
without having been initialized */ |
||||
|
||||
#endif |
||||
|
||||
#include <vtkstd/exception> // for vtkstd::exception |
||||
|
||||
#endif |
@ -0,0 +1,170 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: vtkTestUtilities.h,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
// .NAME vtkTestUtilities - Utility functions used for regression testing.
|
||||
// .SECTION Description
|
||||
// vtkTestUtilities provides methods to perform common testing operations.
|
||||
// These include getting a command line argument or an environment variable,
|
||||
// or a default value. Particularly, there are specialized methods to get the
|
||||
// root directory for VTK Data, expanding a filename with this root directory.
|
||||
|
||||
#ifndef __vtkTestUtilities_h |
||||
#define __vtkTestUtilities_h |
||||
|
||||
#include "vtkSystemIncludes.h" |
||||
|
||||
struct vtkTestUtilities |
||||
{ |
||||
// Description:
|
||||
// Function necessary for accessing the root directory for VTK data. Try the
|
||||
// -D command line argument or VTK_DATA_ROOT or a default value. The returned
|
||||
// string has to be deleted (with delete[]) by the user.
|
||||
static inline char* GetDataRoot(int argc, char* argv[]); |
||||
|
||||
// Description:
|
||||
// Given a file name, this function returns a new string which is (in theory)
|
||||
// the full path. This path is constructed by prepending the file name with a
|
||||
// command line argument (-D path) or VTK_DATA_ROOT env. variable. If slash
|
||||
// is true, appends a slash to the resulting string. The returned string has
|
||||
// to be deleted (with delete[]) by the user.
|
||||
static inline char* ExpandDataFileName(int argc, char* argv[],
|
||||
const char* fname, |
||||
int slash = 0); |
||||
// Description:
|
||||
// Function returning either a command line argument, an environment variable
|
||||
// or a default value. The returned string has to be deleted (with delete[])
|
||||
// by the user.
|
||||
static inline char* GetArgOrEnvOrDefault(const char* arg,
|
||||
int argc, char* argv[],
|
||||
const char* env,
|
||||
const char* def); |
||||
|
||||
// Description:
|
||||
// Given a file name, this function returns a new string which is (in theory)
|
||||
// the full path. This path is constructed by prepending the file name with a
|
||||
// command line argument, an environment variable or a default value. If
|
||||
// slash is true, appends a slash to the resulting string. The returned
|
||||
// string has to be deleted (with delete[]) by the user.
|
||||
static inline char* ExpandFileNameWithArgOrEnvOrDefault(const char* arg,
|
||||
int argc, char* argv[],
|
||||
const char* env,
|
||||
const char* def,
|
||||
const char* fname, |
||||
int slash = 0); |
||||
}; |
||||
|
||||
inline |
||||
char* vtkTestUtilities::GetDataRoot(int argc, char* argv[]) |
||||
{ |
||||
return vtkTestUtilities::GetArgOrEnvOrDefault( |
||||
"-D", argc, argv,
|
||||
"VTK_DATA_ROOT",
|
||||
"../../../../VTKData"); |
||||
} |
||||
|
||||
inline |
||||
char* vtkTestUtilities::ExpandDataFileName(int argc, char* argv[],
|
||||
const char* fname, |
||||
int slash) |
||||
{ |
||||
return vtkTestUtilities::ExpandFileNameWithArgOrEnvOrDefault( |
||||
"-D", argc, argv,
|
||||
"VTK_DATA_ROOT",
|
||||
"../../../../VTKData", |
||||
fname, |
||||
slash); |
||||
} |
||||
|
||||
inline |
||||
char* vtkTestUtilities::GetArgOrEnvOrDefault(const char* arg,
|
||||
int argc, char* argv[],
|
||||
const char* env,
|
||||
const char *def) |
||||
{ |
||||
int index = -1; |
||||
|
||||
for (int i = 0; i < argc; i++) |
||||
{ |
||||
if (strcmp(arg, argv[i]) == 0 && i < argc - 1) |
||||
{ |
||||
index = i + 1; |
||||
} |
||||
} |
||||
|
||||
char* value; |
||||
|
||||
if (index != -1)
|
||||
{ |
||||
value = new char[strlen(argv[index]) + 1]; |
||||
strcpy(value, argv[index]); |
||||
} |
||||
else
|
||||
{ |
||||
char *foundenv = getenv(env); |
||||
if (foundenv) |
||||
{ |
||||
value = new char[strlen(foundenv) + 1]; |
||||
strcpy(value, foundenv); |
||||
} |
||||
else |
||||
{ |
||||
value = new char[strlen(def) + 1]; |
||||
strcpy(value, def); |
||||
} |
||||
} |
||||
|
||||
return value; |
||||
}
|
||||
|
||||
inline |
||||
char* vtkTestUtilities::ExpandFileNameWithArgOrEnvOrDefault(const char* arg,
|
||||
int argc,
|
||||
char* argv[],
|
||||
const char* env,
|
||||
const char *def,
|
||||
const char* fname, |
||||
int slash) |
||||
{ |
||||
char* fullName; |
||||
|
||||
char* value = vtkTestUtilities::GetArgOrEnvOrDefault(arg, argc, argv,
|
||||
env, |
||||
def); |
||||
if (value) |
||||
{ |
||||
fullName = new char[strlen(value) + strlen(fname) + 2 + (slash ? 1 : 0)]; |
||||
fullName[0] = 0; |
||||
strcat(fullName, value); |
||||
int len = static_cast<int>(strlen(fullName)); |
||||
fullName[len] = '/'; |
||||
fullName[len+1] = 0; |
||||
strcat(fullName, fname); |
||||
} |
||||
else |
||||
{ |
||||
fullName = new char[strlen(fname) + 1 + (slash ? 1 : 0)]; |
||||
strcpy(fullName, fname); |
||||
} |
||||
|
||||
if (slash) |
||||
{ |
||||
strcat(fullName, "/"); |
||||
} |
||||
|
||||
delete[] value; |
||||
|
||||
return fullName; |
||||
} |
||||
|
||||
#endif // __vtkTestUtilities_h
|
@ -0,0 +1,218 @@ |
||||
#ifndef __vtkTestingColors_h |
||||
#define __vtkTestingColors_h |
||||
|
||||
// Standard colors used by many vtk scripts
|
||||
|
||||
static float vtk_antique_white[3] = { 0.9804, 0.9216, 0.8431 }; |
||||
static float vtk_azure[3] = { 0.9412, 1.0000, 1.0000 }; |
||||
static float vtk_bisque[3] = { 1.0000, 0.8941, 0.7686 }; |
||||
static float vtk_blanched_almond[3] = { 1.0000, 0.9216, 0.8039 }; |
||||
static float vtk_cornsilk[3] = { 1.0000, 0.9725, 0.8627 }; |
||||
static float vtk_eggshell[3] = { 0.9900, 0.9000, 0.7900 }; |
||||
static float vtk_floral_white[3] = { 1.0000, 0.9804, 0.9412 }; |
||||
static float vtk_gainsboro[3] = { 0.8627, 0.8627, 0.8627 }; |
||||
static float vtk_ghost_white[3] = { 0.9725, 0.9725, 1.0000 }; |
||||
static float vtk_honeydew[3] = { 0.9412, 1.0000, 0.9412 }; |
||||
static float vtk_ivory[3] = { 1.0000, 1.0000, 0.9412 }; |
||||
static float vtk_lavender[3] = { 0.9020, 0.9020, 0.9804 }; |
||||
static float vtk_lavender_blush[3] = { 1.0000, 0.9412, 0.9608 }; |
||||
static float vtk_lemon_chiffon[3] = { 1.0000, 0.9804, 0.8039 }; |
||||
static float vtk_linen[3] = { 0.9804, 0.9412, 0.9020 }; |
||||
static float vtk_mint_cream[3] = { 0.9608, 1.0000, 0.9804 }; |
||||
static float vtk_misty_rose[3] = { 1.0000, 0.8941, 0.8824 }; |
||||
static float vtk_moccasin[3] = { 1.0000, 0.8941, 0.7098 }; |
||||
static float vtk_navajo_white[3] = { 1.0000, 0.8706, 0.6784 }; |
||||
static float vtk_old_lace[3] = { 0.9922, 0.9608, 0.9020 }; |
||||
static float vtk_papaya_whip[3] = { 1.0000, 0.9373, 0.8353 }; |
||||
static float vtk_peach_puff[3] = { 1.0000, 0.8549, 0.7255 }; |
||||
static float vtk_seashell[3] = { 1.0000, 0.9608, 0.9333 }; |
||||
static float vtk_snow[3] = { 1.0000, 0.9804, 0.9804 }; |
||||
static float vtk_thistle[3] = { 0.8471, 0.7490, 0.8471 }; |
||||
static float vtk_titanium_white[3] = { 0.9900, 1.0000, 0.9400 }; |
||||
static float vtk_wheat[3] = { 0.9608, 0.8706, 0.7020 }; |
||||
static float vtk_white[3] = { 1.0000, 1.0000, 1.0000 }; |
||||
static float vtk_white_smoke[3] = { 0.9608, 0.9608, 0.9608 }; |
||||
static float vtk_zinc_white[3] = { 0.9900, 0.9700, 1.0000 }; |
||||
|
||||
// Greys
|
||||
static float vtk_cold_grey[3] = { 0.5000, 0.5400, 0.5300 }; |
||||
static float vtk_dim_grey[3] = { 0.4118, 0.4118, 0.4118 }; |
||||
static float vtk_grey[3] = { 0.7529, 0.7529, 0.7529 }; |
||||
static float vtk_light_grey[3] = { 0.8275, 0.8275, 0.8275 }; |
||||
static float vtk_slate_grey[3] = { 0.4392, 0.5020, 0.5647 }; |
||||
static float vtk_slate_grey_dark[3] = { 0.1843, 0.3098, 0.3098 }; |
||||
static float vtk_slate_grey_light[3] = { 0.4667, 0.5333, 0.6000 }; |
||||
static float vtk_warm_grey[3] = { 0.5000, 0.5000, 0.4100 }; |
||||
|
||||
// Blacks
|
||||
static float vtk_black[3] = { 0.0000, 0.0000, 0.0000 }; |
||||
static float vtk_ivory_black[3] = { 0.1600, 0.1400, 0.1300 }; |
||||
static float vtk_lamp_black[3] = { 0.1800, 0.2800, 0.2300 }; |
||||
|
||||
// Reds
|
||||
static float vtk_alizarin_crimson[3] = { 0.8900, 0.1500, 0.2100 }; |
||||
static float vtk_brick[3] = { 0.6100, 0.4000, 0.1200 }; |
||||
static float vtk_cadmium_red_deep[3] = { 0.8900, 0.0900, 0.0500 }; |
||||
static float vtk_coral[3] = { 1.0000, 0.4980, 0.3137 }; |
||||
static float vtk_coral_light[3] = { 0.9412, 0.5020, 0.5020 }; |
||||
static float vtk_deep_pink[3] = { 1.0000, 0.0784, 0.5765 }; |
||||
static float vtk_english_red[3] = { 0.8300, 0.2400, 0.1000 }; |
||||
static float vtk_firebrick[3] = { 0.6980, 0.1333, 0.1333 }; |
||||
static float vtk_geranium_lake[3] = { 0.8900, 0.0700, 0.1900 }; |
||||
static float vtk_hot_pink[3] = { 1.0000, 0.4118, 0.7059 }; |
||||
static float vtk_indian_red[3] = { 0.6900, 0.0900, 0.1200 }; |
||||
static float vtk_light_salmon[3] = { 1.0000, 0.6275, 0.4784 }; |
||||
static float vtk_madder_lake_deep[3] = { 0.8900, 0.1800, 0.1900 }; |
||||
static float vtk_maroon[3] = { 0.6902, 0.1882, 0.3765 }; |
||||
static float vtk_pink[3] = { 1.0000, 0.7529, 0.7961 }; |
||||
static float vtk_pink_light[3] = { 1.0000, 0.7137, 0.7569 }; |
||||
static float vtk_raspberry[3] = { 0.5300, 0.1500, 0.3400 }; |
||||
static float vtk_red[3] = { 1.0000, 0.0000, 0.0000 }; |
||||
static float vtk_rose_madder[3] = { 0.8900, 0.2100, 0.2200 }; |
||||
static float vtk_salmon[3] = { 0.9804, 0.5020, 0.4471 }; |
||||
static float vtk_tomato[3] = { 1.0000, 0.3882, 0.2784 }; |
||||
static float vtk_venetian_red[3] = { 0.8300, 0.1000, 0.1200 }; |
||||
|
||||
// Browns
|
||||
static float vtk_beige[3] = { 0.6400, 0.5800, 0.5000 }; |
||||
static float vtk_brown[3] = { 0.5000, 0.1647, 0.1647 }; |
||||
static float vtk_brown_madder[3] = { 0.8600, 0.1600, 0.1600 }; |
||||
static float vtk_brown_ochre[3] = { 0.5300, 0.2600, 0.1200 }; |
||||
static float vtk_burlywood[3] = { 0.8706, 0.7216, 0.5294 }; |
||||
static float vtk_burnt_sienna[3] = { 0.5400, 0.2100, 0.0600 }; |
||||
static float vtk_burnt_umber[3] = { 0.5400, 0.2000, 0.1400 }; |
||||
static float vtk_chocolate[3] = { 0.8235, 0.4118, 0.1176 }; |
||||
static float vtk_deep_ochre[3] = { 0.4500, 0.2400, 0.1000 }; |
||||
static float vtk_flesh[3] = { 1.0000, 0.4900, 0.2500 }; |
||||
static float vtk_flesh_ochre[3] = { 1.0000, 0.3400, 0.1300 }; |
||||
static float vtk_gold_ochre[3] = { 0.7800, 0.4700, 0.1500 }; |
||||
static float vtk_greenish_umber[3] = { 1.0000, 0.2400, 0.0500 }; |
||||
static float vtk_khaki[3] = { 0.9412, 0.9020, 0.5490 }; |
||||
static float vtk_khaki_dark[3] = { 0.7412, 0.7176, 0.4196 }; |
||||
static float vtk_light_beige[3] = { 0.9608, 0.9608, 0.8627 }; |
||||
static float vtk_peru[3] = { 0.8039, 0.5216, 0.2471 }; |
||||
static float vtk_rosy_brown[3] = { 0.7373, 0.5608, 0.5608 }; |
||||
static float vtk_raw_sienna[3] = { 0.7800, 0.3800, 0.0800 }; |
||||
static float vtk_raw_umber[3] = { 0.4500, 0.2900, 0.0700 }; |
||||
static float vtk_sepia[3] = { 0.3700, 0.1500, 0.0700 }; |
||||
static float vtk_sienna[3] = { 0.6275, 0.3216, 0.1765 }; |
||||
static float vtk_saddle_brown[3] = { 0.5451, 0.2706, 0.0745 }; |
||||
static float vtk_sandy_brown[3] = { 0.9569, 0.6431, 0.3765 }; |
||||
static float vtk_tan[3] = { 0.8235, 0.7059, 0.5490 }; |
||||
static float vtk_van_dyke_brown[3] = { 0.3700, 0.1500, 0.0200 }; |
||||
|
||||
// Oranges
|
||||
static float vtk_cadmium_orange[3] = { 1.0000, 0.3800, 0.0100 }; |
||||
static float vtk_cadmium_red_light[3] = { 1.0000, 0.0100, 0.0500 }; |
||||
static float vtk_carrot[3] = { 0.9300, 0.5700, 0.1300 }; |
||||
static float vtk_dark_orange[3] = { 1.0000, 0.5490, 0.0000 }; |
||||
static float vtk_mars_orange[3] = { 0.5900, 0.2700, 0.0800 }; |
||||
static float vtk_mars_yellow[3] = { 0.8900, 0.4400, 0.1000 }; |
||||
static float vtk_orange[3] = { 1.0000, 0.5000, 0.0000 }; |
||||
static float vtk_orange_red[3] = { 1.0000, 0.2706, 0.0000 }; |
||||
static float vtk_yellow_ochre[3] = { 0.8900, 0.5100, 0.0900 }; |
||||
|
||||
// Yellows
|
||||
static float vtk_aureoline_yellow[3] = { 1.0000, 0.6600, 0.1400 }; |
||||
static float vtk_banana[3] = { 0.8900, 0.8100, 0.3400 }; |
||||
static float vtk_cadmium_lemon[3] = { 1.0000, 0.8900, 0.0100 }; |
||||
static float vtk_cadmium_yellow[3] = { 1.0000, 0.6000, 0.0700 }; |
||||
static float vtk_cadmium_yellow_light[3] = { 1.0000, 0.6900, 0.0600 }; |
||||
static float vtk_gold[3] = { 1.0000, 0.8431, 0.0000 }; |
||||
static float vtk_goldenrod[3] = { 0.8549, 0.6471, 0.1255 }; |
||||
static float vtk_goldenrod_dark[3] = { 0.7216, 0.5255, 0.0431 }; |
||||
static float vtk_goldenrod_light[3] = { 0.9804, 0.9804, 0.8235 }; |
||||
static float vtk_goldenrod_pale[3] = { 0.9333, 0.9098, 0.6667 }; |
||||
static float vtk_light_goldenrod[3] = { 0.9333, 0.8667, 0.5098 }; |
||||
static float vtk_melon[3] = { 0.8900, 0.6600, 0.4100 }; |
||||
static float vtk_naples_yellow_deep[3] = { 1.0000, 0.6600, 0.0700 }; |
||||
static float vtk_yellow[3] = { 1.0000, 1.0000, 0.0000 }; |
||||
static float vtk_yellow_light[3] = { 1.0000, 1.0000, 0.8784 }; |
||||
|
||||
// Greens
|
||||
static float vtk_chartreuse[3] = { 0.4980, 1.0000, 0.0000 }; |
||||
static float vtk_chrome_oxide_green[3] = { 0.4000, 0.5000, 0.0800 }; |
||||
static float vtk_cinnabar_green[3] = { 0.3800, 0.7000, 0.1600 }; |
||||
static float vtk_cobalt_green[3] = { 0.2400, 0.5700, 0.2500 }; |
||||
static float vtk_emerald_green[3] = { 0.0000, 0.7900, 0.3400 }; |
||||
static float vtk_forest_green[3] = { 0.1333, 0.5451, 0.1333 }; |
||||
static float vtk_green[3] = { 0.0000, 1.0000, 0.0000 }; |
||||
static float vtk_green_dark[3] = { 0.0000, 0.3922, 0.0000 }; |
||||
static float vtk_green_pale[3] = { 0.5961, 0.9843, 0.5961 }; |
||||
static float vtk_green_yellow[3] = { 0.6784, 1.0000, 0.1843 }; |
||||
static float vtk_lawn_green[3] = { 0.4863, 0.9882, 0.0000 }; |
||||
static float vtk_lime_green[3] = { 0.1961, 0.8039, 0.1961 }; |
||||
static float vtk_mint[3] = { 0.7400, 0.9900, 0.7900 }; |
||||
static float vtk_olive[3] = { 0.2300, 0.3700, 0.1700 }; |
||||
static float vtk_olive_drab[3] = { 0.4196, 0.5569, 0.1373 }; |
||||
static float vtk_olive_green_dark[3] = { 0.3333, 0.4196, 0.1843 }; |
||||
static float vtk_permanent_green[3] = { 0.0400, 0.7900, 0.1700 }; |
||||
static float vtk_sap_green[3] = { 0.1900, 0.5000, 0.0800 }; |
||||
static float vtk_sea_green[3] = { 0.1804, 0.5451, 0.3412 }; |
||||
static float vtk_sea_green_dark[3] = { 0.5608, 0.7373, 0.5608 }; |
||||
static float vtk_sea_green_medium[3] = { 0.2353, 0.7020, 0.4431 }; |
||||
static float vtk_sea_green_light[3] = { 0.1255, 0.6980, 0.6667 }; |
||||
static float vtk_spring_green[3] = { 0.0000, 1.0000, 0.4980 }; |
||||
static float vtk_spring_green_medium[3] = { 0.0000, 0.9804, 0.6039 }; |
||||
static float vtk_terre_verte[3] = { 0.2200, 0.3700, 0.0600 }; |
||||
static float vtk_viridian_light[3] = { 0.4300, 1.0000, 0.4400 }; |
||||
static float vtk_yellow_green[3] = { 0.6039, 0.8039, 0.1961 }; |
||||
|
||||
// Cyans
|
||||
static float vtk_aquamarine[3] = { 0.4980, 1.0000, 0.8314 }; |
||||
static float vtk_aquamarine_medium[3] = { 0.4000, 0.8039, 0.6667 }; |
||||
static float vtk_cyan[3] = { 0.0000, 1.0000, 1.0000 }; |
||||
static float vtk_cyan_white[3] = { 0.8784, 1.0000, 1.0000 }; |
||||
static float vtk_turquoise[3] = { 0.2510, 0.8784, 0.8157 }; |
||||
static float vtk_turquoise_dark[3] = { 0.0000, 0.8078, 0.8196 }; |
||||
static float vtk_turquoise_medium[3] = { 0.2824, 0.8196, 0.8000 }; |
||||
static float vtk_turquoise_pale[3] = { 0.6863, 0.9333, 0.9333 }; |
||||
|
||||
// Blues
|
||||
static float vtk_alice_blue[3] = { 0.9412, 0.9725, 1.0000 }; |
||||
static float vtk_blue[3] = { 0.0000, 0.0000, 1.0000 }; |
||||
static float vtk_blue_light[3] = { 0.6784, 0.8471, 0.9020 }; |
||||
static float vtk_blue_medium[3] = { 0.0000, 0.0000, 0.8039 }; |
||||
static float vtk_cadet[3] = { 0.3725, 0.6196, 0.6275 }; |
||||
static float vtk_cobalt[3] = { 0.2400, 0.3500, 0.6700 }; |
||||
static float vtk_cornflower[3] = { 0.3922, 0.5843, 0.9294 }; |
||||
static float vtk_cerulean[3] = { 0.0200, 0.7200, 0.8000 }; |
||||
static float vtk_dodger_blue[3] = { 0.1176, 0.5647, 1.0000 }; |
||||
static float vtk_indigo[3] = { 0.0300, 0.1800, 0.3300 }; |
||||
static float vtk_manganese_blue[3] = { 0.0100, 0.6600, 0.6200 }; |
||||
static float vtk_midnight_blue[3] = { 0.0980, 0.0980, 0.4392 }; |
||||
static float vtk_navy[3] = { 0.0000, 0.0000, 0.5020 }; |
||||
static float vtk_peacock[3] = { 0.2000, 0.6300, 0.7900 }; |
||||
static float vtk_powder_blue[3] = { 0.6902, 0.8784, 0.9020 }; |
||||
static float vtk_royal_blue[3] = { 0.2549, 0.4118, 0.8824 }; |
||||
static float vtk_slate_blue[3] = { 0.4157, 0.3529, 0.8039 }; |
||||
static float vtk_slate_blue_dark[3] = { 0.2824, 0.2392, 0.5451 }; |
||||
static float vtk_slate_blue_light[3] = { 0.5176, 0.4392, 1.0000 }; |
||||
static float vtk_slate_blue_medium[3] = { 0.4824, 0.4078, 0.9333 }; |
||||
static float vtk_sky_blue[3] = { 0.5294, 0.8078, 0.9216 }; |
||||
static float vtk_sky_blue_deep[3] = { 0.0000, 0.7490, 1.0000 }; |
||||
static float vtk_sky_blue_light[3] = { 0.5294, 0.8078, 0.9804 }; |
||||
static float vtk_steel_blue[3] = { 0.2745, 0.5098, 0.7059 }; |
||||
static float vtk_steel_blue_light[3] = { 0.6902, 0.7686, 0.8706 }; |
||||
static float vtk_turquoise_blue[3] = { 0.0000, 0.7800, 0.5500 }; |
||||
static float vtk_ultramarine[3] = { 0.0700, 0.0400, 0.5600 }; |
||||
|
||||
// Magentas
|
||||
static float vtk_blue_violet[3] = { 0.5412, 0.1686, 0.8863 }; |
||||
static float vtk_cobalt_violet_deep[3] = { 0.5700, 0.1300, 0.6200 }; |
||||
static float vtk_magenta[3] = { 1.0000, 0.0000, 1.0000 }; |
||||
static float vtk_orchid[3] = { 0.8549, 0.4392, 0.8392 }; |
||||
static float vtk_orchid_dark[3] = { 0.6000, 0.1961, 0.8000 }; |
||||
static float vtk_orchid_medium[3] = { 0.7294, 0.3333, 0.8275 }; |
||||
static float vtk_permanent_red_violet[3] = { 0.8600, 0.1500, 0.2700 }; |
||||
static float vtk_plum[3] = { 0.8667, 0.6275, 0.8667 }; |
||||
static float vtk_purple[3] = { 0.6275, 0.1255, 0.9412 }; |
||||
static float vtk_purple_medium[3] = { 0.5765, 0.4392, 0.8588 }; |
||||
static float vtk_ultramarine_violet[3] = { 0.3600, 0.1400, 0.4300 }; |
||||
static float vtk_violet[3] = { 0.5600, 0.3700, 0.6000 }; |
||||
static float vtk_violet_dark[3] = { 0.5804, 0.0000, 0.8275 }; |
||||
static float vtk_violet_red[3] = { 0.8157, 0.1255, 0.5647 }; |
||||
static float vtk_violet_red_medium[3] = { 0.7804, 0.0824, 0.5216 }; |
||||
static float vtk_violet_red_pale[3] = { 0.8588, 0.4392, 0.5765 }; |
||||
|
||||
#endif // __vtkTestingColors_h
|
@ -0,0 +1,453 @@ |
||||
#!/usr/bin/env python |
||||
|
||||
## /*========================================================================= |
||||
|
||||
## Program: Visualization Toolkit |
||||
## Module: $RCSfile: HeaderTesting.py,v $ |
||||
|
||||
## Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
## All rights reserved. |
||||
## See Copyright.txt or http://www.kitware.com/Copyright.htm for details. |
||||
|
||||
## This software is distributed WITHOUT ANY WARRANTY; without even |
||||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
## PURPOSE. See the above copyright notice for more information. |
||||
|
||||
## =========================================================================*/ |
||||
## .NAME HeaderTesting - a VTK style and validity checking utility |
||||
## .SECTION Description |
||||
## HeaderTesting is a script which checks the list of header files for |
||||
## validity based on VTK coding standard. It checks for proper super |
||||
## classes, number and style of include files, type macro, private |
||||
## copy constructor and assignment operator, broken constructors, and |
||||
## exsistence of PrintSelf method. This script should be run as a part |
||||
## of the dashboard checking of the Visualization Toolkit and related |
||||
## projects. |
||||
|
||||
## .SECTION See Also |
||||
## http://www.vtk.org http://public.kitware.com/Dart/HTML/Index.shtml |
||||
## http://www.vtk.org/contribute.php#coding-standards |
||||
|
||||
import sys |
||||
import re |
||||
import os |
||||
import stat |
||||
import string |
||||
|
||||
# Get the path to the directory containing this script. |
||||
if __name__ == '__main__': |
||||
selfpath = os.path.abspath(sys.path[0] or os.curdir) |
||||
else: |
||||
selfpath = os.path.abspath(os.path.dirname(__file__)) |
||||
|
||||
# Load the list of names mangled by windows.h. |
||||
execfile(os.path.join(selfpath, 'WindowsMangleList.py')) |
||||
|
||||
## If tested from dart, make sure to fix all the output strings |
||||
test_from_dart = 0 |
||||
if os.environ.has_key("DART_TEST_FROM_DART"): |
||||
test_from_dart = 1 |
||||
|
||||
## For backward compatibility |
||||
def StringEndsWith(str1, str2): |
||||
l1 = len(str1) |
||||
l2 = len(str2) |
||||
if l1 < l2: |
||||
return 0 |
||||
return (str1[(l1-l2):] == str2) |
||||
|
||||
## |
||||
class TestVTKFiles: |
||||
def __init__(self): |
||||
self.FileName = "" |
||||
self.ErrorValue = 0; |
||||
self.Errors = {} |
||||
self.WarningValue = 0; |
||||
self.Warnings = {} |
||||
self.FileLines = [] |
||||
self.Export = "" |
||||
self.UnnecessaryIncludes = [ |
||||
"stdio.h", |
||||
"stdlib.h", |
||||
"string.h", |
||||
"iostream", |
||||
"iostream.h", |
||||
"strstream", |
||||
"strstream.h", |
||||
"fstream", |
||||
"fstream.h", |
||||
"windows.h" |
||||
] |
||||
pass |
||||
def SetExport(self, export): |
||||
self.Export = export |
||||
def Print(self, text=""): |
||||
rtext = text |
||||
if test_from_dart: |
||||
rtext = string.replace(rtext, "<", "<") |
||||
rtext = string.replace(rtext, ">", ">") |
||||
print rtext |
||||
def Error(self, error): |
||||
self.ErrorValue = 1 |
||||
self.Errors[error] = 1 |
||||
pass |
||||
def Warning(self, warning): |
||||
self.WarningValue = 1 |
||||
self.Warnings[warning] = 1 |
||||
pass |
||||
def PrintErrors(self): |
||||
if self.ErrorValue: |
||||
self.Print( ) |
||||
self.Print( "There were errors:" ) |
||||
for a in self.Errors.keys(): |
||||
self.Print( "* %s" % a ) |
||||
def PrintWarnings(self): |
||||
if self.WarningValue: |
||||
self.Print( ) |
||||
self.Print( "There were warnings:" ) |
||||
for a in self.Warnings.keys(): |
||||
self.Print( "* %s" % a ) |
||||
|
||||
def TestFile(self, filename): |
||||
self.FileName = filename |
||||
self.FileLines = [] |
||||
self.ClassName = "" |
||||
self.ParentName = "" |
||||
try: |
||||
file = open(filename) |
||||
self.FileLines = file.readlines() |
||||
file.close() |
||||
except: |
||||
self.Print( "Problem reading file: %s" % filename ) |
||||
sys.exit(1) |
||||
pass |
||||
|
||||
def CheckIncludes(self): |
||||
count = 0 |
||||
lines = [] |
||||
nplines = [] |
||||
unlines = [] |
||||
includere = "^\s*#\s*include\s*[\"<]([^>\"]+)" |
||||
ignincludere = ".*\/\/.*" |
||||
regx = re.compile(includere) |
||||
regx1 = re.compile(ignincludere) |
||||
cc = 0 |
||||
includeparent = 0 |
||||
for a in self.FileLines: |
||||
line = string.strip(a) |
||||
rm = regx.match(line) |
||||
if rm and not regx1.match(line): |
||||
lines.append(" %4d: %s" % (cc, line)) |
||||
file = rm.group(1) |
||||
if file == (self.ParentName + ".h"): |
||||
includeparent = 1 |
||||
if not StringEndsWith(file, ".h"): |
||||
nplines.append(" %4d: %s" % (cc, line)) |
||||
if file in self.UnnecessaryIncludes: |
||||
unlines.append(" %4d: %s" % (cc, line)) |
||||
cc = cc + 1 |
||||
if len(lines) > 1: |
||||
self.Print() |
||||
self.Print( "File: %s has %d includes: " % |
||||
( self.FileName, len(lines)) ) |
||||
for a in lines: |
||||
self.Print( a ) |
||||
self.Error("Multiple includes") |
||||
if len(nplines) > 0: |
||||
self.Print( ) |
||||
self.Print( "File: %s has non-portable include(s): " % self.FileName ) |
||||
for a in nplines: |
||||
self.Print( a ) |
||||
self.Error("Non-portable includes") |
||||
if len(unlines) > 0: |
||||
self.Print( ) |
||||
self.Print( "File: %s has unnecessary include(s): " % self.FileName ) |
||||
for a in unlines: |
||||
self.Print( a ) |
||||
self.Error("Unnecessary includes") |
||||
if not includeparent and self.ParentName: |
||||
self.Print() |
||||
self.Print( "File: %s does not include parent \"%s.h\"" % |
||||
( self.FileName, self.ParentName ) ) |
||||
self.Error("Does not include parent") |
||||
pass |
||||
|
||||
def CheckParent(self): |
||||
classre = "^class\s*(.*_EXPORT|\s*) (vtk[A-Z0-9_][^ :\n]*)\s*:\s*public\s*(vtk[^ \n\{]*)" |
||||
cname = "" |
||||
pname = "" |
||||
classlines = [] |
||||
regx = re.compile(classre) |
||||
cc = 0 |
||||
lastline = "" |
||||
for a in self.FileLines: |
||||
line = string.strip(a) |
||||
rm = regx.match(line) |
||||
if not rm and not cname: |
||||
rm = regx.match(lastline + line) |
||||
if rm: |
||||
export = rm.group(1) |
||||
export = string.strip(export) |
||||
cname = rm.group(2) |
||||
pname = rm.group(3) |
||||
classlines.append(" %4d: %s" % (cc, line)) |
||||
if not export: |
||||
self.Print("File: %s defines 1 class with no export macro:" % self.FileName) |
||||
self.Print(" %4d: %s" % (cc, line)) |
||||
self.Error("No export macro") |
||||
elif self.Export and self.Export != export: |
||||
self.Print("File: %s defines 1 class with wrong export macro:" % self.FileName) |
||||
self.Print(" %4d: %s" % (cc, line)) |
||||
self.Print(" The export macro should be: %s" % (self.Export)) |
||||
self.Error("Wrong export macro") |
||||
cc = cc + 1 |
||||
lastline = a |
||||
if len(classlines) > 1: |
||||
self.Print() |
||||
self.Print( "File: %s defines %d classes: " % |
||||
(self.FileName, len(classlines)) ) |
||||
for a in classlines: |
||||
self.Print( a ) |
||||
self.Error("Multiple classes defined") |
||||
if len(classlines) < 1: |
||||
self.Print() |
||||
self.Print( "File: %s does not define any classes" % self.FileName ) |
||||
self.Error("No class defined") |
||||
return |
||||
#self.Print( "Classname: %s ParentName: %s" % (cname, pname) |
||||
self.ClassName = cname |
||||
self.ParentName = pname |
||||
pass |
||||
def CheckTypeMacro(self): |
||||
count = 0 |
||||
lines = [] |
||||
oldlines = [] |
||||
typere = "^\s*vtkType(Revision)*Macro\s*\(\s*(vtk[^ ,]+)\s*,\s*(vtk[^ \)]+)\s*\)\s*;" |
||||
typesplitre = "^\s*vtkType(Revision)*Macro\s*\(" |
||||
|
||||
regx = re.compile(typere) |
||||
regxs = re.compile(typesplitre) |
||||
cc = 0 |
||||
found = 0 |
||||
for a in range(len(self.FileLines)): |
||||
line = string.strip(self.FileLines[a]) |
||||
rm = regx.match(line) |
||||
if rm: |
||||
found = 1 |
||||
if rm.group(1) != "Revision": |
||||
oldlines.append(" %4d: %s" % (cc, line)) |
||||
cname = rm.group(2) |
||||
pname = rm.group(3) |
||||
if cname != self.ClassName or pname != self.ParentName: |
||||
lines.append(" %4d: %s" % (cc, line)) |
||||
else: |
||||
# Maybe it is in two lines |
||||
rm = regxs.match(line) |
||||
if rm: |
||||
nline = line + " " + string.strip(self.FileLines[a+1]) |
||||
line = string.strip(nline) |
||||
rm = regx.match(line) |
||||
if rm: |
||||
found = 1 |
||||
if rm.group(1) != "Revision": |
||||
oldlines.append(" %4d: %s" % (cc, line)) |
||||
cname = rm.group(2) |
||||
pname = rm.group(3) |
||||
if cname != self.ClassName or pname != self.ParentName: |
||||
lines.append(" %4d: %s" % (cc, line)) |
||||
cc = cc + 1 |
||||
if len(lines) > 0: |
||||
self.Print( "File: %s has broken type macro(s):" % self.FileName ) |
||||
for a in lines: |
||||
self.Print( a ) |
||||
self.Print( "Should be:\n vtkTypeRevisionMacro(%s, %s)" % |
||||
(self.ClassName, self.ParentName) ) |
||||
self.Error("Broken type macro") |
||||
if len(oldlines) > 0: |
||||
self.Print( "File: %s has old type macro(s):" % self.FileName ) |
||||
for a in oldlines: |
||||
self.Print( a ) |
||||
self.Print( "Should be:\n vtkTypeRevisionMacro(%s, %s);" % |
||||
(self.ClassName, self.ParentName)) |
||||
self.Error("Old style type macro") |
||||
if not found: |
||||
self.Print( "File: %s does not have type macro" % self.FileName ) |
||||
self.Print( "Should be:\n vtkTypeRevisionMacro(%s, %s);" % |
||||
(self.ClassName, self.ParentName)) |
||||
self.Error("No type macro") |
||||
pass |
||||
def CheckForCopyAndAssignment(self): |
||||
if not self.ClassName: |
||||
return |
||||
count = 0 |
||||
lines = [] |
||||
oldlines = [] |
||||
copyoperator = "^\s*%s\s*\(\s*const\s*%s\s*&\s*\)\s*;\s*\/\/\s*Not\s*[iI]mplemented(\.)*" % ( self.ClassName, self.ClassName) |
||||
asgnoperator = "^\s*void\s*operator\s*=\s*\(\s*const\s*%s\s*&\s*\)\s*;\s*\/\/\s*Not\s*[iI]mplemented(\.)*" % self.ClassName |
||||
#self.Print( copyoperator |
||||
regx1 = re.compile(copyoperator) |
||||
regx2 = re.compile(asgnoperator) |
||||
foundcopy = 0 |
||||
foundasgn = 0 |
||||
for a in self.FileLines: |
||||
line = string.strip(a) |
||||
if regx1.match(line): |
||||
foundcopy = foundcopy + 1 |
||||
if regx2.match(line): |
||||
foundasgn = foundasgn + 1 |
||||
lastline = "" |
||||
if foundcopy < 1: |
||||
for a in self.FileLines: |
||||
line = string.strip(a) |
||||
if regx1.match(lastline + line): |
||||
foundcopy = foundcopy + 1 |
||||
lastline = a |
||||
lastline = "" |
||||
if foundasgn < 1: |
||||
for a in self.FileLines: |
||||
line = string.strip(a) |
||||
if regx2.match(lastline + line): |
||||
foundasgn = foundasgn + 1 |
||||
lastline = a |
||||
|
||||
if foundcopy < 1: |
||||
self.Print( "File: %s does not define copy constructor" % |
||||
self.FileName ) |
||||
self.Print( "Should be:\n%s(const %s&); // Not implemented" % |
||||
(self.ClassName, self.ClassName) ) |
||||
self.Error("No private copy constructor") |
||||
if foundcopy > 1: |
||||
self.Print( "File: %s defines multiple copy constructors" % |
||||
self.FileName ) |
||||
self.Error("Multiple copy constructor") |
||||
if foundasgn < 1: |
||||
self.Print( "File: %s does not define assignment operator" % |
||||
self.FileName ) |
||||
self.Print( "Should be:\nvoid operator=(const %s&); // Not implemented" |
||||
% self.ClassName ) |
||||
self.Error("No private assignment operator") |
||||
if foundcopy > 1: |
||||
self.Print( "File: %s defines multiple assignment operators" % |
||||
self.FileName ) |
||||
self.Error("Multiple assignment operators") |
||||
pass |
||||
def CheckWeirdConstructors(self): |
||||
count = 0 |
||||
lines = [] |
||||
oldlines = [] |
||||
constructor = "^\s*%s\s*\(([^ )]*)\)" % self.ClassName |
||||
copyoperator = "^\s*%s\s*\(\s*const\s*%s\s*&\s*\)\s*;\s*\/\/\s*Not\s*implemented(\.)*" % ( self.ClassName, self.ClassName) |
||||
regx1 = re.compile(constructor) |
||||
regx2 = re.compile(copyoperator) |
||||
cc = 0 |
||||
for a in self.FileLines: |
||||
line = string.strip(a) |
||||
rm = regx1.match(line) |
||||
if rm: |
||||
arg = string.strip(rm.group(1)) |
||||
if arg and not regx2.match(line): |
||||
lines.append(" %4d: %s" % (cc, line)) |
||||
cc = cc + 1 |
||||
if len(lines) > 0: |
||||
self.Print( "File: %s has weird constructor(s):" % self.FileName ) |
||||
for a in lines: |
||||
self.Print( a ) |
||||
self.Print( "There should be only:\n %s();" % self.ClassName ) |
||||
self.Error("Weird constructor") |
||||
pass |
||||
|
||||
def CheckPrintSelf(self): |
||||
if not self.ClassName: |
||||
return |
||||
typere = "^\s*void\s*PrintSelf\s*\(\s*ostream\s*&\s*os*\s*,\s*vtkIndent\s*indent\s*\)" |
||||
newtypere = "^\s*virtual\s*void\s*PrintSelf\s*\(\s*ostream\s*&\s*os*\s*,\s*vtkIndent\s*indent\s*\)" |
||||
regx1 = re.compile(typere) |
||||
regx2 = re.compile(newtypere) |
||||
found = 0 |
||||
oldstyle = 0 |
||||
for a in self.FileLines: |
||||
line = string.strip(a) |
||||
rm1 = regx1.match(line) |
||||
rm2 = regx2.match(line) |
||||
if rm1 or rm2: |
||||
found = 1 |
||||
if rm1: |
||||
oldstyle = 1 |
||||
if not found: |
||||
self.Print( "File: %s does not define PrintSelf method:" % |
||||
self.FileName ) |
||||
self.Warning("No PrintSelf method") |
||||
pass |
||||
|
||||
def CheckWindowsMangling(self): |
||||
lines = [] |
||||
regx1 = WindowsMangleRegEx |
||||
regx2 = re.compile("^.*VTK_LEGACY.*$") |
||||
# This version will leave out comment lines but we probably do |
||||
# not want to refer to mangled (hopefully deprecated) methods |
||||
# in comments. |
||||
# regx2 = re.compile("^(\s*//|\s*\*|.*VTK_LEGACY).*$") |
||||
cc = 1 |
||||
for a in self.FileLines: |
||||
line = string.strip(a) |
||||
rm = regx1.match(line) |
||||
if rm: |
||||
arg = string.strip(rm.group(1)) |
||||
if arg and not regx2.match(line): |
||||
lines.append(" %4d: %s" % (cc, line)) |
||||
cc = cc + 1 |
||||
if len(lines) > 0: |
||||
self.Print( "File: %s has windows.h mangling violations:" % self.FileName ) |
||||
for a in lines: |
||||
self.Print(a) |
||||
self.Error("Windows Mangling Violation") |
||||
pass |
||||
|
||||
## |
||||
test = TestVTKFiles() |
||||
|
||||
## Check command line arguments |
||||
if len(sys.argv) < 2: |
||||
print "Testing directory not specified..." |
||||
print "Usage: %s <directory> [ exception(s) ]" % sys.argv[0] |
||||
sys.exit(1) |
||||
|
||||
dirname = sys.argv[1] |
||||
exceptions = sys.argv[2:] |
||||
if len(sys.argv) > 2: |
||||
export = sys.argv[2] |
||||
if export[:3] == "VTK" and export[len(export)-len("EXPORT"):] == "EXPORT": |
||||
print "Use export macro: %s" % export |
||||
exceptions = sys.argv[3:] |
||||
test.SetExport(export) |
||||
|
||||
## Traverse through the list of files |
||||
for a in os.listdir(dirname): |
||||
## Skip non-header files |
||||
if not StringEndsWith(a, ".h"): |
||||
continue |
||||
## Skip exceptions |
||||
if a in exceptions: |
||||
continue |
||||
pathname = '%s/%s' % (dirname, a) |
||||
if pathname in exceptions: |
||||
continue |
||||
mode = os.stat(pathname)[stat.ST_MODE] |
||||
## Skip directories |
||||
if stat.S_ISDIR(mode): |
||||
continue |
||||
elif stat.S_ISREG(mode): |
||||
## Do all the tests |
||||
test.TestFile(pathname) |
||||
test.CheckParent() |
||||
test.CheckIncludes() |
||||
test.CheckTypeMacro() |
||||
test.CheckForCopyAndAssignment() |
||||
test.CheckWeirdConstructors() |
||||
test.CheckPrintSelf() |
||||
test.CheckWindowsMangling() |
||||
|
||||
## Summarize errors |
||||
test.PrintWarnings() |
||||
test.PrintErrors() |
||||
sys.exit(test.ErrorValue) |
@ -0,0 +1,10 @@ |
||||
PROJECT(VIT) |
||||
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/FindVTK.cmake) |
||||
IF(VTK_FOUND) |
||||
INCLUDE("${VTK_USE_FILE}") |
||||
ADD_EXECUTABLE(vit vit.cxx) |
||||
TARGET_LINK_LIBRARIES(vit vtkGraphics) |
||||
ELSE(VTK_FOUND) |
||||
MESSAGE(SEND_ERROR "VTK not found!") |
||||
ENDIF(VTK_FOUND) |
@ -0,0 +1,88 @@ |
||||
#!/bin/sh |
||||
|
||||
CMAKE_COMMAND="@CMAKE_COMMAND@" |
||||
VTK_SOURCE_DIR="@VTK_SOURCE_DIR@" |
||||
VTK_BINARY_DIR="@VTK_BINARY_DIR@" |
||||
CMAKE_INSTALL_PREFIX="@CMAKE_INSTALL_PREFIX@" |
||||
CMAKE_MAKE_PROGRAM="@CMAKE_MAKE_PROGRAM@" |
||||
VTK_INSTALL_LIB_DIR="@VTK_INSTALL_LIB_DIR@" |
||||
|
||||
SOURCE_DIR="${VTK_SOURCE_DIR}/Common/Testing/Install" |
||||
BINARY_DIR="${VTK_BINARY_DIR}/Common/Testing/Install" |
||||
|
||||
trap cleanup 1 2 3 6 |
||||
|
||||
cleanup() |
||||
{ |
||||
( |
||||
cd "${VTK_BINARY_DIR}" |
||||
if [ -d "bin-InstallTestTemp" ]; then |
||||
mv "bin-InstallTestTemp" "bin" |
||||
fi |
||||
) |
||||
exit 1 |
||||
} |
||||
|
||||
install() |
||||
{ |
||||
echo "Erasing ${CMAKE_INSTALL_PREFIX}" && |
||||
([ ! -d "${CMAKE_INSTALL_PREFIX}" ] || rm -rf "${CMAKE_INSTALL_PREFIX}") && |
||||
mkdir -p "${CMAKE_INSTALL_PREFIX}" && |
||||
echo "Running make install" && |
||||
( |
||||
cd "${VTK_BINARY_DIR}" && |
||||
"${CMAKE_MAKE_PROGRAM}" install |
||||
) |
||||
} |
||||
|
||||
setup() |
||||
{ |
||||
echo "Entering ${BINARY_DIR}" && |
||||
cd "${BINARY_DIR}" |
||||
} |
||||
|
||||
write_cache() |
||||
{ |
||||
install || return 1 |
||||
setup || return 1 |
||||
echo "Writing CMakeCache.txt" |
||||
( |
||||
cat > CMakeCache.txt <<EOF |
||||
VTK_DIR:FILEPATH=${CMAKE_INSTALL_PREFIX}${VTK_INSTALL_LIB_DIR} |
||||
EOF |
||||
) |
||||
} |
||||
|
||||
run_cmake() |
||||
{ |
||||
write_cache || return 1 |
||||
echo "Running CMake" |
||||
"${CMAKE_COMMAND}" "${SOURCE_DIR}" |
||||
} |
||||
|
||||
run_make() |
||||
{ |
||||
run_cmake || return 1 |
||||
echo "Running ${CMAKE_MAKE_PROGRAM}" |
||||
"${CMAKE_MAKE_PROGRAM}" |
||||
} |
||||
|
||||
run_test() |
||||
{ |
||||
( |
||||
cd "${VTK_BINARY_DIR}" |
||||
mv "bin" "bin-InstallTestTemp" |
||||
) |
||||
echo "Running ${BINARY_DIR}/vit" |
||||
( |
||||
"${BINARY_DIR}/vit" |
||||
) |
||||
result="$?" |
||||
( |
||||
cd "${VTK_BINARY_DIR}" |
||||
mv "bin-InstallTestTemp" "bin" |
||||
) |
||||
return $result |
||||
} |
||||
|
||||
run_make && run_test |
@ -0,0 +1,9 @@ |
||||
#include "vtkArrowSource.h" |
||||
#include "vtkDoubleArray.h" |
||||
|
||||
int main() |
||||
{ |
||||
vtkArrowSource::New()->Delete(); |
||||
vtkDoubleArray::New()->Delete(); |
||||
return 0; |
||||
} |
@ -0,0 +1,12 @@ |
||||
# |
||||
# Add tests, with the data |
||||
# |
||||
IF (VTK_PYTHON_EXE) |
||||
FOREACH ( tfile |
||||
PythonSmoke |
||||
TestWeakref |
||||
) |
||||
ADD_TEST(${tfile}Python-image ${VTK_PYTHON_EXE} |
||||
${VTK_SOURCE_DIR}/Common/Testing/Python/${tfile}.py) |
||||
ENDFOREACH( tfile ) |
||||
ENDIF (VTK_PYTHON_EXE) |
@ -0,0 +1,47 @@ |
||||
import sys |
||||
|
||||
try: |
||||
import vtk |
||||
|
||||
except: |
||||
print "Cannot import vtk" |
||||
sys.exit(1) |
||||
try: |
||||
print dir(vtk) |
||||
except: |
||||
print "Cannot print dir(vtk)" |
||||
sys.exit(1) |
||||
|
||||
try: |
||||
try: |
||||
try: |
||||
o = vtk.vtkLineWidget() |
||||
print "Using Hybrid" |
||||
except: |
||||
o = vtk.vtkActor() |
||||
print "Using Rendering" |
||||
except: |
||||
o = vtk.vtkObject() |
||||
print "Using Common" |
||||
except: |
||||
print "Cannot create vtkObject" |
||||
sys.exit(1) |
||||
|
||||
try: |
||||
print o |
||||
print "Reference count: %d" % o.GetReferenceCount() |
||||
print "Class name: %s" % o.GetClassName() |
||||
except: |
||||
print "Cannot print object" |
||||
sys.exit(1) |
||||
|
||||
try: |
||||
b = vtk.vtkObject() |
||||
d = b.SafeDownCast(o) |
||||
print b, d |
||||
except: |
||||
print "Cannot downcast" |
||||
sys.exit(1) |
||||
|
||||
sys.exit(0) |
||||
|
@ -0,0 +1,42 @@ |
||||
"""Test if VTK-Python objects support weak referencing. |
||||
|
||||
Run this test like so: |
||||
$ vtkpython TestWeakref.py |
||||
or |
||||
$ python TestWeakref.py |
||||
|
||||
Created on July, 8 2005 |
||||
Prabhu Ramachandran <prabhu_r at users dot sf dot net> |
||||
|
||||
""" |
||||
|
||||
import sys |
||||
import vtk |
||||
from vtk.test import Testing |
||||
try: |
||||
import weakref |
||||
except ImportError: |
||||
print "No weakref in this version of Python. Time to upgrade?" |
||||
print "Python version:", sys.version |
||||
sys.exit(0) |
||||
|
||||
|
||||
class TestWeakref(Testing.vtkTest): |
||||
def testWeakref(self): |
||||
o = vtk.vtkObject() |
||||
ref = weakref.ref(o) |
||||
self.assertEqual(ref().GetClassName(), 'vtkObject') |
||||
del o |
||||
self.assertEqual(ref(), None) |
||||
|
||||
def testProxy(self): |
||||
o = vtk.vtkObject() |
||||
proxy = weakref.proxy(o) |
||||
self.assertEqual(proxy.GetClassName(), 'vtkObject') |
||||
del o |
||||
self.assertRaises(weakref.ReferenceError, getattr, |
||||
proxy, 'GetClassName') |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
Testing.main([(TestWeakref, 'test')]) |
@ -0,0 +1,26 @@ |
||||
ADD_TEST(otherInterp ${VTK_EXECUTABLE} |
||||
${VTK_SOURCE_DIR}/Common/Testing/Tcl/otherInterp.tcl |
||||
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl) |
||||
ADD_TEST(otherPrint ${VTK_EXECUTABLE} |
||||
${VTK_SOURCE_DIR}/Common/Testing/Tcl/otherPrint.tcl |
||||
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl) |
||||
ADD_TEST(TestEmptyInput ${VTK_EXECUTABLE} |
||||
${VTK_SOURCE_DIR}/Common/Testing/Tcl/TestEmptyInput.tcl |
||||
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl) |
||||
ADD_TEST(TestSetGet ${VTK_EXECUTABLE} |
||||
${VTK_SOURCE_DIR}/Common/Testing/Tcl/TestSetGet.tcl |
||||
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl) |
||||
ADD_TEST(TestArrays ${VTK_EXECUTABLE} |
||||
${VTK_SOURCE_DIR}/Common/Testing/Tcl/TestArrays.tcl |
||||
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl) |
||||
ADD_TEST(TestAmoebaMinimizer ${VTK_EXECUTABLE} |
||||
${VTK_SOURCE_DIR}/Common/Testing/Tcl/TestAmoebaMinimizer.tcl) |
||||
ADD_TEST(PrintSelf-Common ${TCL_TCLSH} |
||||
${VTK_SOURCE_DIR}/Common/Testing/Tcl/PrintSelfCheck.tcl |
||||
${VTK_SOURCE_DIR}/Common) |
||||
ADD_TEST(TestSetObjectMacro-Common ${TCL_TCLSH} |
||||
${VTK_SOURCE_DIR}/Common/Testing/Tcl/FindString.tcl |
||||
"${VTK_SOURCE_DIR}/Common/vtk\\\\*.h" |
||||
"vtkSetObjectMacro" |
||||
${VTK_SOURCE_DIR}/Common/vtkSetGet.h |
||||
) |
@ -0,0 +1,87 @@ |
||||
#!/usr/bin/tclsh |
||||
|
||||
# This script will find all files that include certain regular expression. |
||||
# If the files are not in the list provided, the script will return error. |
||||
|
||||
set ProgName [ lindex [ split $argv0 "/" ] end ] |
||||
|
||||
if { $argc < 2 } { |
||||
puts "Usage: $ProgName <expr1> <expr2> \[ <file> ... \]" |
||||
puts "\texpr1 - file list expression (vtk*.h)" |
||||
puts "\texpr2 - search string expression (vtkSet.*Macro)" |
||||
puts "\tfile - files that should be ignore" |
||||
|
||||
puts "" |
||||
puts "You provided:" |
||||
foreach { a } $argv { |
||||
puts "$a" |
||||
} |
||||
|
||||
exit 1 |
||||
} |
||||
|
||||
# Parse command line arguments |
||||
set FileExpression [ lindex $argv 0 ] |
||||
set SearchMessage [ lindex $argv 1 ] |
||||
set IgnoreFileListIn [ lrange $argv 2 end ] |
||||
set IgnoreFileList {} |
||||
foreach { file } $IgnoreFileListIn { |
||||
set IgnoreFileList "$IgnoreFileList [ glob $file ]" |
||||
} |
||||
#puts "Searching for $SearchMessage in $FileExpression" |
||||
#puts "Ignore list: $IgnoreFileList" |
||||
|
||||
# Find regular expression in the string |
||||
proc FindString { InFile SearchString } { |
||||
if [ catch { open $InFile r } inchan ] { |
||||
puts stderr "Cannot open $InFile" |
||||
return 0 |
||||
} |
||||
set res 0 |
||||
set lcount 1 |
||||
while { ! [eof $inchan] } { |
||||
gets $inchan line |
||||
if [ regexp $SearchString $line matches ] { |
||||
puts "$InFile: Found $SearchString on line $lcount" |
||||
puts "$line" |
||||
set res 1 |
||||
} |
||||
set lcount [ expr $lcount + 1 ] |
||||
} |
||||
close $inchan |
||||
return $res |
||||
} |
||||
|
||||
# Get all files that match expression |
||||
set files "" |
||||
if [ catch { [ set files [ glob $FileExpression ] ] } result ] { |
||||
regsub {\\\*} $FileExpression "*" FileExpression |
||||
if [ catch { [ set files [ glob $FileExpression ] ] } nresult ] { |
||||
#puts "Cannot expand the expression: \"$FileExpression\"" |
||||
#puts "Error: $nresult" |
||||
#exit 1 |
||||
} |
||||
} |
||||
|
||||
if { [ llength $files ] < 1 } { |
||||
puts "Cannot find any files that match your file expression" |
||||
exit 0 |
||||
} |
||||
|
||||
set count 0 |
||||
foreach { a } $files { |
||||
regsub -all {\\} $a {/} b |
||||
if { [ lsearch $IgnoreFileList $b ] >= 0 } { |
||||
puts "Ignoring: $b" |
||||
} else { |
||||
set count [ expr $count + [ FindString $a $SearchMessage ] ] |
||||
} |
||||
} |
||||
|
||||
if { $count > 0 } { |
||||
puts "" |
||||
puts "Found \"$SearchMessage\" $count times" |
||||
exit 1 |
||||
} |
||||
|
||||
exit 0 |
@ -0,0 +1,720 @@ |
||||
# |
||||
# Verify that each class's PrintSelf prints all ivars that have |
||||
# a set/get. |
||||
# |
||||
# |
||||
# Verbose Levels: |
||||
# |
||||
# 0: No extra printing |
||||
# 1: Print basic extra information |
||||
# 2: Print lots of details |
||||
# |
||||
set verbose 0 |
||||
|
||||
set class_name "" |
||||
|
||||
set class_count 0 |
||||
set class_print_count 0 |
||||
set printself_miss_count 0 |
||||
set super_miss_count 0 |
||||
set ivar_count 0 |
||||
set ivar_miss_count 0 |
||||
|
||||
set total_class_count 0 |
||||
set total_class_print_count 0 |
||||
set total_ivar_count 0 |
||||
set total_printself_miss_count 0 |
||||
set total_super_miss_count 0 |
||||
set total_ivar_miss_count 0 |
||||
|
||||
# Fileid for the PrintSelfDetails.html file |
||||
set pd_id 0 |
||||
|
||||
# |
||||
# class_list contains the following for each class evaluated: |
||||
# |
||||
# <class>.p <true|false> True if printself declared |
||||
# <class>.s.<super_class> <true|false> True if superclass used in printself |
||||
# <class>.i.<ivar> <true|false> True if ivar used in printself |
||||
|
||||
set class_list(null) 1 |
||||
|
||||
proc list_contains { string } { |
||||
|
||||
global class_list |
||||
|
||||
set ivar_found 0 |
||||
|
||||
set searchid [array startsearch class_list] |
||||
|
||||
while { [array anymore class_list $searchid] } { |
||||
|
||||
set element [array nextelement class_list $searchid] |
||||
|
||||
if { $element == $string } { |
||||
|
||||
set ivar_found 1 |
||||
} |
||||
} |
||||
|
||||
array donesearch class_list $searchid |
||||
|
||||
return $ivar_found |
||||
} |
||||
|
||||
proc get_ivar { string } { |
||||
|
||||
global verbose |
||||
|
||||
set ivar_string "-1" |
||||
|
||||
#puts "Getting ivar from macro: $string" |
||||
|
||||
# Search for the first occurrence of an open parenthesis |
||||
set first [string first "(" $string]; |
||||
|
||||
if { $first > -1 } { |
||||
|
||||
set begintrim [string range $string [expr $first + 1] end]; |
||||
set begintrim [string trim $begintrim]; |
||||
|
||||
# Find the end of the ivar |
||||
set last [string wordend $begintrim 0] |
||||
|
||||
if { $last > -1 } { |
||||
|
||||
set ivar_string [string range $begintrim 0 [expr $last - 1] ]; |
||||
|
||||
set ivar_string [string trim $ivar_string]; |
||||
|
||||
if { $verbose >= 2 } { |
||||
puts " Macro: $ivar_string" |
||||
} |
||||
} |
||||
} |
||||
|
||||
return [string trim $ivar_string] |
||||
} |
||||
|
||||
proc check_header_file { filename } { |
||||
|
||||
global class_name |
||||
global class_count |
||||
global ivar_count |
||||
global class_list |
||||
global verbose |
||||
|
||||
if { $verbose >= 2 } { |
||||
puts "Processing file: $filename" |
||||
} |
||||
|
||||
set data "" |
||||
set class_name "" |
||||
|
||||
set printself_found 0 |
||||
set class_found 0 |
||||
|
||||
if { [file readable $filename] } { |
||||
set fileid [open $filename "r"] |
||||
|
||||
set protected_not_found 1 |
||||
|
||||
# |
||||
# Read each line in the file |
||||
# |
||||
while { [gets $fileid data] >= 0 && $protected_not_found } { |
||||
# Search for the printSelf string |
||||
if { [string match "*PrintSelf*(*" $data] == 1 } { |
||||
|
||||
set printself_found 1 |
||||
|
||||
set class_list($class_name.p) 1 |
||||
} |
||||
|
||||
if { [string match "*protected:*" $data] == 1 } { |
||||
set protected_not_found 0 |
||||
} |
||||
|
||||
# Search for the class string |
||||
# Extract the class name from the string |
||||
if { [string match "*class VTK_*EXPORT*" $data] == 1 } { |
||||
set class_found 1 |
||||
|
||||
set class_ivar_count 0 |
||||
|
||||
set first [string first "vtk" $data]; |
||||
|
||||
if { $first > -1 } { |
||||
|
||||
set end [expr [string first ":" $data] - 1]; |
||||
|
||||
set newstring [string range $data $first $end ] |
||||
|
||||
set last [string wordend $newstring 0]; |
||||
|
||||
if { $last > -1 } { |
||||
set class_name [string trim [string range $newstring 0 $last] ]; |
||||
} |
||||
|
||||
} |
||||
set class_list($class_name.p) 0 |
||||
|
||||
if { $verbose >= 2 } { |
||||
puts " Class Name: $class_name" |
||||
} |
||||
|
||||
if { [string compare $class_name ""] == 0 } { |
||||
puts "Problem with class definition in file $filename" |
||||
} |
||||
|
||||
set first [string first "public" $data] |
||||
|
||||
if { $first > -1 } { |
||||
set first [expr $first + 7]; |
||||
set end [ string length $data] |
||||
|
||||
set string [string range $data $first $end ] |
||||
|
||||
set first [string first "vtk" $string] |
||||
set end [string wordend $string $first] |
||||
|
||||
set super_class [string range $string $first $end ] |
||||
set super_class [string trim $super_class] |
||||
|
||||
set class_list($class_name.s.$super_class) 0 |
||||
set class_list($class_name.s.Superclass) 0 |
||||
} |
||||
} |
||||
|
||||
if { $class_found == 1 } { |
||||
|
||||
# Search for Set and Get macros |
||||
set set_macro_found [string match "*vtkSet*Macro*(*" $data] |
||||
set get_macro_found [string match "*vtkGet*Macro*(*" $data] |
||||
|
||||
if { $set_macro_found || $get_macro_found } { |
||||
|
||||
# Get the ivar from the Macro declaration |
||||
set ivar [get_ivar $data]; |
||||
|
||||
if { [string compare $ivar "-1"] != 0 } { |
||||
|
||||
if { [list_contains "$class_name.i.$ivar"] == 0 } { |
||||
|
||||
incr ivar_count |
||||
incr class_ivar_count |
||||
|
||||
set class_list($class_name.i.$ivar) 0 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
# If a class was found within the file then increment the class count |
||||
if { $class_found } { |
||||
incr class_count |
||||
} |
||||
|
||||
close $fileid |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
proc check_printself { filename } { |
||||
|
||||
global verbose |
||||
|
||||
global class_list |
||||
global class_name |
||||
|
||||
if { $verbose >= 2 } { |
||||
puts " Checking PrintSelf in file: $filename" |
||||
} |
||||
|
||||
if { [file readable $filename] } { |
||||
|
||||
set fileid [open $filename "r"] |
||||
|
||||
set search_state 0 |
||||
|
||||
set curly_open 0 |
||||
set curly_close 0 |
||||
|
||||
set line_count 0 |
||||
|
||||
# |
||||
# Read each line in the file |
||||
# |
||||
while { [gets $fileid data] >= 0 && $search_state != 3 } { |
||||
|
||||
incr line_count |
||||
|
||||
# Search for the PrintSelf string |
||||
if { $search_state == 0 && [string match "*PrintSelf*(*" $data] == 1 } { |
||||
|
||||
set search_state 1 |
||||
|
||||
set first [string first ")" $data] |
||||
|
||||
set data [string range $data [expr $first + 1] end] |
||||
|
||||
} |
||||
|
||||
# Find the first open curly bracket |
||||
if { $search_state == 1 } { |
||||
|
||||
while { [string length $data] > 0 && $curly_open == 0 } { |
||||
|
||||
# Check for an open curly bracket |
||||
set curly_found [string first "\{" $data] |
||||
|
||||
if { $curly_found > -1 } { |
||||
|
||||
set data [string range $data [expr $curly_found + 1] end ] |
||||
set curly_open 1 |
||||
set search_state 2 |
||||
|
||||
} else { |
||||
set data "" |
||||
} |
||||
} |
||||
} |
||||
|
||||
# Count curly brackets in PrintSelf() method and find ivars |
||||
if { $search_state == 2 } { |
||||
|
||||
set start 0 |
||||
set end [string length $data] |
||||
|
||||
#puts "Line: $data" |
||||
|
||||
if { [string match "*this->Superclass::PrintSelf(*)*" $data] == 1 } { |
||||
if { [list_contains "$class_name.s.Superclass"] == 1 } { |
||||
set class_list($class_name.s.Superclass) 1 |
||||
} |
||||
} elseif { [string match "*::PrintSelf(*)*" $data] == 1 } { |
||||
set start [string first "vtk" $data] |
||||
set end [string wordend $data $start] |
||||
|
||||
set super_class [string range $data $start [expr $end -1]] |
||||
set super_class [string trim $super_class] |
||||
|
||||
if { [list_contains "$class_name.s.$super_class"] == 1 } { |
||||
set class_list($class_name.s.$super_class) 1 |
||||
} elseif { $verbose >= 2 } { |
||||
puts "\tSuperclass Issue:\tCan't find $class_name.s.$super_class" |
||||
} |
||||
} |
||||
|
||||
while { $start < $end && $curly_open > $curly_close } { |
||||
|
||||
set word_end [string wordend $data $start] |
||||
|
||||
set token [string range $data $start [expr $word_end -1] ] |
||||
|
||||
set token [string trim $token] |
||||
|
||||
set start $word_end |
||||
|
||||
if { $verbose >= 2 } { |
||||
puts "\tNew Token: $token" |
||||
} |
||||
|
||||
# Check for open and close curly braces |
||||
if { [string compare "\{" $token] == 0 } { |
||||
incr curly_open |
||||
} elseif { [string compare "\}" $token] == 0 } { |
||||
incr curly_close |
||||
} elseif { [string compare "this" $token] == 0 } { |
||||
set start [expr $start + 2] |
||||
set token_end [expr [string wordend $data $start ] - 1] |
||||
|
||||
# Check if this is an array. If so, remove bracket |
||||
#if { [string first "\[" $data] > -1 } { |
||||
# set token_end [expr $token_end - 1]; |
||||
#} |
||||
|
||||
set ivar [string range $data $start $token_end] |
||||
|
||||
# Check if this is a Get procedure. If so, remove open parenthesis |
||||
#if { [string first "(" $ivar] > -1 } { |
||||
# set token_end [expr $token_end - 1]; |
||||
# set ivar [string range $data $start $token_end] |
||||
#} |
||||
|
||||
if { [string first "Get" $ivar] > -1 } { |
||||
set start [expr $start + 3]; |
||||
|
||||
# Check if this is a Get*AsString() method |
||||
if { [string first "AsString" $ivar] > -1 } { |
||||
set token_end [expr $token_end - 8]; |
||||
} |
||||
|
||||
set ivar [string range $data $start $token_end] |
||||
} |
||||
|
||||
set ivar [string trim $ivar] |
||||
|
||||
if { [list_contains "$class_name.i.$ivar"] == 1 } { |
||||
set class_list($class_name.i.$ivar) 1 |
||||
} elseif { $verbose } { |
||||
puts "\tIvar Issue:\t\tCan't find $class_name.i.$ivar" |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
if { $curly_open == $curly_close } { |
||||
set search_state 3 |
||||
} |
||||
} |
||||
} |
||||
|
||||
close $fileid |
||||
} |
||||
} |
||||
|
||||
proc read_directory { dirname } { |
||||
|
||||
global class_name |
||||
global argv |
||||
|
||||
set total_defects 0 |
||||
|
||||
set files [glob -nocomplain "$dirname/vtk*.h"] |
||||
if { $files != "" } { |
||||
foreach headername $files { |
||||
|
||||
set class_name "" |
||||
|
||||
# Check that a PrintSelf() is defined |
||||
check_header_file $headername |
||||
|
||||
# Check that the PrintSelf() method accesses the appropriate ivars |
||||
if { $class_name != "" && [list_contains "$class_name.p"] == 1 } { |
||||
set length [string length $headername] |
||||
set filename [string range $headername 0 [expr $length - 3] ] |
||||
if {[file exists "$filename.mm"] == 1} { |
||||
check_printself "$filename.mm" |
||||
} else { |
||||
check_printself "$filename.cxx" |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
||||
|
||||
proc class_has_ivars { class } { |
||||
|
||||
global verbose |
||||
global class_list |
||||
|
||||
set searchid [array startsearch class_list] |
||||
|
||||
while { [array anymore class_list $searchid] } { |
||||
|
||||
set element [array nextelement class_list $searchid] |
||||
|
||||
if { [string match "$class.i.*" $element] == 1 } { |
||||
array donesearch class_list $searchid |
||||
return 1 |
||||
} |
||||
} |
||||
|
||||
array donesearch class_list $searchid |
||||
|
||||
return 0 |
||||
} |
||||
|
||||
proc check_for_defects { print } { |
||||
|
||||
global pd_id |
||||
|
||||
global verbose |
||||
global class_list |
||||
global class_print_count |
||||
global ivar_miss_count |
||||
global printself_miss_count |
||||
global super_miss_count |
||||
|
||||
# |
||||
# PRINTSELF CHECK |
||||
# |
||||
|
||||
# Loop through list and count printself defects, if any |
||||
set searchid [array startsearch class_list] |
||||
|
||||
while { [array anymore class_list $searchid] } { |
||||
set element [array nextelement class_list $searchid] |
||||
# Extract strings that represent PrintSelfs |
||||
if { [string match "*.p" $element] == 1 } { |
||||
set end [expr [string wordend $element 0] - 1] |
||||
set curr_class [string range $element 0 $end] |
||||
|
||||
if { [class_has_ivars $curr_class] == 1 } { |
||||
|
||||
incr class_print_count |
||||
|
||||
if { $class_list($element) != 1 } { |
||||
|
||||
incr printself_miss_count |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
array donesearch class_list $searchid |
||||
|
||||
# Loop through list and print printself defects |
||||
if { $printself_miss_count > 0 && $print } { |
||||
puts $pd_id " PrintSelf DEFECTS: " |
||||
set searchid [array startsearch class_list] |
||||
|
||||
while { [array anymore class_list $searchid] } { |
||||
|
||||
set element [array nextelement class_list $searchid] |
||||
# Extract strings that represent PrintSelfs |
||||
if { [string match "*.p" $element] == 1 } { |
||||
set end [expr [string wordend $element 0] - 1] |
||||
set curr_class [string range $element 0 $end] |
||||
|
||||
if { [class_has_ivars $curr_class] == 1 } { |
||||
if { $class_list($element) != 1 } { |
||||
puts $pd_id " $curr_class does not have a PrintSelf method" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
array donesearch class_list $searchid |
||||
} |
||||
|
||||
# |
||||
# SUPERCLASS CHECK |
||||
# |
||||
|
||||
# Loop through list and count superclass defects, if any |
||||
set searchid [array startsearch class_list] |
||||
|
||||
while { [array anymore class_list $searchid] } { |
||||
|
||||
set element [array nextelement class_list $searchid] |
||||
# Extract strings that represent superclasses |
||||
if { [string match "*.s.*" $element] == 1 } { |
||||
set end [expr [string wordend $element 0] - 1] |
||||
set curr_class [string range $element 0 $end] |
||||
|
||||
if { $class_list($curr_class.s.Superclass) != 1 && |
||||
[class_has_ivars $curr_class] == 1 && |
||||
$class_list($element) != 1 } { |
||||
set start [expr $end + 4] |
||||
set end [expr [string wordend $element $start] - 1] |
||||
set parent [string range $element $start $end] |
||||
if { $parent == "Superclass" } continue; |
||||
|
||||
incr super_miss_count |
||||
} |
||||
} |
||||
} |
||||
|
||||
array donesearch class_list $searchid |
||||
|
||||
# Loop through list and print superclass defects |
||||
if { $super_miss_count > 0 && $print } { |
||||
puts $pd_id " Superclass DEFECTS: " |
||||
set searchid [array startsearch class_list] |
||||
|
||||
while { [array anymore class_list $searchid] } { |
||||
|
||||
set element [array nextelement class_list $searchid] |
||||
# Extract strings that represent superclasses |
||||
if { [string match "*.s.*" $element] == 1 } { |
||||
set end [expr [string wordend $element 0] - 1] |
||||
set curr_class [string range $element 0 $end] |
||||
|
||||
if { $class_list($curr_class.s.Superclass) != 1 && |
||||
[class_has_ivars $curr_class] == 1 && |
||||
$class_list($element) != 1 } { |
||||
|
||||
set start [expr $end + 4] |
||||
set end [expr [string wordend $element $start] - 1] |
||||
set parent [string range $element $start $end] |
||||
if { $parent == "Superclass" } continue; |
||||
puts $pd_id " $curr_class did not print superclass $parent" |
||||
} |
||||
} |
||||
} |
||||
|
||||
array donesearch class_list $searchid |
||||
} |
||||
|
||||
# |
||||
# IVAR CHECK |
||||
# |
||||
|
||||
# Loop through list and count ivar defects, if any |
||||
set searchid [array startsearch class_list] |
||||
|
||||
while { [array anymore class_list $searchid] } { |
||||
|
||||
set element [array nextelement class_list $searchid] |
||||
|
||||
# Extract strings that represent ivars |
||||
if { [string match "*.i.*" $element] == 1 } { |
||||
if { $class_list($element) != 1 } { |
||||
incr ivar_miss_count |
||||
|
||||
} |
||||
} |
||||
} |
||||
|
||||
array donesearch class_list $searchid |
||||
|
||||
# Loop through list and print ivar defects |
||||
if { $ivar_miss_count > 0 && $print } { |
||||
puts $pd_id " Ivar DEFECTS: " |
||||
set searchid [array startsearch class_list] |
||||
|
||||
while { [array anymore class_list $searchid] } { |
||||
|
||||
set element [array nextelement class_list $searchid] |
||||
|
||||
# Extract strings that represent ivars |
||||
if { [string match "*.i.*" $element] == 1 } { |
||||
if { $class_list($element) != 1 } { |
||||
set end [expr [string wordend $element 0] - 1] |
||||
set curr_class [string range $element 0 $end] |
||||
|
||||
set start [expr $end + 4] |
||||
set end [expr [string wordend $element $start] - 1] |
||||
set ivar [string range $element $start $end] |
||||
|
||||
puts $pd_id " $curr_class does not print ivar: $ivar" |
||||
} |
||||
} |
||||
} |
||||
|
||||
array donesearch class_list $searchid |
||||
} |
||||
|
||||
} |
||||
|
||||
proc print_toolkit_results { toolkit } { |
||||
|
||||
global pd_id |
||||
|
||||
global class_count |
||||
global class_print_count |
||||
global printself_miss_count |
||||
global ivar_count |
||||
global ivar_miss_count |
||||
global super_miss_count |
||||
|
||||
check_for_defects 1 |
||||
|
||||
set tk [string range $toolkit 0 14 ] |
||||
|
||||
} |
||||
|
||||
proc print_totals {} { |
||||
global total_defects |
||||
global total_class_count |
||||
global total_class_print_count |
||||
global total_printself_miss_count |
||||
global total_ivar_count |
||||
global total_ivar_miss_count |
||||
global total_super_miss_count |
||||
|
||||
set total_defects [expr $total_printself_miss_count + $total_super_miss_count + $total_ivar_miss_count] |
||||
|
||||
} |
||||
|
||||
proc open_files { } { |
||||
|
||||
global pd_id |
||||
|
||||
set pd_id stdout |
||||
|
||||
} |
||||
|
||||
proc close_files { } { |
||||
|
||||
global pd_id |
||||
|
||||
close $pd_id |
||||
|
||||
set pd_id 0 |
||||
} |
||||
|
||||
proc clear_results { } { |
||||
|
||||
global class_count |
||||
global class_print_count |
||||
global printself_miss_count |
||||
global ivar_count |
||||
global ivar_miss_count |
||||
global super_miss_count |
||||
global class_list |
||||
|
||||
unset class_list |
||||
set class_list(null) 1 |
||||
|
||||
set class_count 0 |
||||
set class_print_count 0 |
||||
set ivar_count 0 |
||||
set printself_miss_count 0 |
||||
set ivar_miss_count 0 |
||||
set super_miss_count 0 |
||||
} |
||||
|
||||
proc measure_vtk {kit} { |
||||
|
||||
global pd_id |
||||
|
||||
global verbose |
||||
|
||||
global class_list |
||||
global class_count |
||||
global class_print_count |
||||
global printself_miss_count |
||||
global ivar_count |
||||
global ivar_miss_count |
||||
global super_miss_count |
||||
|
||||
global total_class_count |
||||
global total_class_print_count |
||||
global total_printself_miss_count |
||||
global total_ivar_count |
||||
global total_ivar_miss_count |
||||
global total_super_miss_count |
||||
|
||||
open_files |
||||
|
||||
clear_results |
||||
|
||||
read_directory "$kit" |
||||
|
||||
print_toolkit_results $kit |
||||
|
||||
set total_class_count [expr $total_class_count + $class_count] |
||||
set total_class_print_count [expr $total_class_print_count + $class_print_count] |
||||
set total_printself_miss_count [expr $total_printself_miss_count + $printself_miss_count]; |
||||
set total_ivar_count [expr $total_ivar_count + $ivar_count]; |
||||
set total_ivar_miss_count [expr $total_ivar_miss_count + $ivar_miss_count]; |
||||
set total_super_miss_count [expr $total_super_miss_count + $super_miss_count]; |
||||
|
||||
print_totals |
||||
close_files |
||||
|
||||
if { $verbose } { |
||||
parray class_list |
||||
} |
||||
|
||||
} |
||||
measure_vtk [lindex $argv 0] |
||||
|
||||
exit $total_defects |
||||
|
@ -0,0 +1,57 @@ |
||||
for {set i 0} {$i < [expr $argc - 1]} {incr i} { |
||||
if {[lindex $argv $i] == "-A"} { |
||||
set auto_path "$auto_path [lindex $argv [expr $i +1]]" |
||||
} |
||||
} |
||||
|
||||
package require vtk |
||||
|
||||
vtkAmoebaMinimizer m |
||||
|
||||
proc func {} { |
||||
set x [m GetParameterValue "x"] |
||||
set y [m GetParameterValue "y"] |
||||
set z [m GetParameterValue "z"] |
||||
|
||||
set r [expr ($x-5.0)*($x-5.0) + ($y+2.0)*($y+2.0) + ($z)*($z)] |
||||
|
||||
m SetFunctionValue $r |
||||
} |
||||
|
||||
m SetFunction func |
||||
m SetParameterValue "x" 0.0 |
||||
m SetParameterScale "x" 2.0 |
||||
m SetParameterValue "y" 0.0 |
||||
m SetParameterScale "y" 2.0 |
||||
m SetParameterValue "z" 0.0 |
||||
m SetParameterScale "z" 2.0 |
||||
m Minimize |
||||
|
||||
puts "should find x=5, y=-2, z=0" |
||||
|
||||
puts -nonewline "should be 0 if the simplex converged -> " |
||||
puts [m Iterate] |
||||
|
||||
puts -nonewline "x = " |
||||
puts [m GetParameterValue "x"] |
||||
puts -nonewline "y = " |
||||
puts [m GetParameterValue "y"] |
||||
puts -nonewline "z = " |
||||
puts [m GetParameterValue "z"] |
||||
|
||||
puts -nonewline "function value = " |
||||
puts [m GetFunctionValue] |
||||
|
||||
puts -nonewline "evaluations = " |
||||
puts [m GetFunctionEvaluations] |
||||
|
||||
puts -nonewline "iterations = " |
||||
puts [m GetIterations] |
||||
|
||||
puts "To improve coverage and catch errors, do a PrintSelf with parameters set:" |
||||
|
||||
puts [m Print] |
||||
|
||||
m Delete |
||||
|
||||
exit |
@ -0,0 +1,62 @@ |
||||
for {set i 0} {$i < [expr $argc - 1]} {incr i} { |
||||
if {[lindex $argv $i] == "-A"} { |
||||
set auto_path "$auto_path [lindex $argv [expr $i +1]]" |
||||
} |
||||
} |
||||
|
||||
package require vtk |
||||
|
||||
foreach array "Bit Char Double Float Int Long Short UnsignedChar UnsignedInt UnsignedLong UnsignedShort" { |
||||
puts "$array array" |
||||
vtk${array}Array a${array}Array |
||||
a${array}Array Allocate 1 1 |
||||
a${array}Array SetNumberOfComponents 3 |
||||
a${array}Array SetNumberOfTuples 4 |
||||
|
||||
# InsertComponent |
||||
set k 0 |
||||
for {set i 0} {$i < [a${array}Array GetNumberOfTuples]} {incr i} { |
||||
for {set j 0} {$j < [a${array}Array GetNumberOfComponents]} {incr j} { |
||||
a${array}Array InsertComponent $i $j 1 |
||||
incr k |
||||
} |
||||
} |
||||
# SetComponent |
||||
set k 0 |
||||
for {set i 0} {$i < [a${array}Array GetNumberOfTuples]} {incr i} { |
||||
for {set j 0} {$j < [a${array}Array GetNumberOfComponents]} {incr j} { |
||||
a${array}Array SetComponent $i $j 1 |
||||
incr k |
||||
} |
||||
} |
||||
|
||||
# DeepCopy |
||||
vtk${array}Array b${array}Array |
||||
b${array}Array Allocate 1000 100 |
||||
# force a resize |
||||
b${array}Array InsertComponent 2001 0 1 |
||||
b${array}Array DeepCopy a${array}Array |
||||
|
||||
# NewInstance |
||||
set m${array} [b${array}Array NewInstance] |
||||
eval [set m${array}] UnRegister b${array}Array |
||||
|
||||
# confirm the deep copy |
||||
for {set i 0} {$i < [a${array}Array GetNumberOfTuples]} {incr i} { |
||||
for {set j 0} {$j < [a${array}Array GetNumberOfComponents]} {incr j} { |
||||
if { [a${array}Array GetComponent $i $j] != [b${array}Array GetComponent $i $j] } { |
||||
puts "${array}: bad component $i $j" |
||||
} |
||||
incr k |
||||
} |
||||
} |
||||
b${array}Array InsertComponent 2001 0 1 |
||||
b${array}Array Resize 3000 |
||||
|
||||
a${array}Array Squeeze |
||||
a${array}Array Initialize |
||||
|
||||
a${array}Array Delete |
||||
b${array}Array Delete |
||||
} |
||||
exit |
@ -0,0 +1,88 @@ |
||||
for {set i 0} {$i < [expr $argc - 1]} {incr i} { |
||||
if {[lindex $argv $i] == "-A"} { |
||||
set auto_path "$auto_path [lindex $argv [expr $i +1]]" |
||||
} |
||||
} |
||||
|
||||
package require vtk |
||||
vtkObject a |
||||
a GlobalWarningDisplayOff |
||||
a Delete |
||||
|
||||
|
||||
vtkPolyData emptyPD |
||||
vtkImageData emptyID |
||||
vtkStructuredGrid emptySG |
||||
vtkUnstructuredGrid emptyUG |
||||
vtkRectilinearGrid emptyRG |
||||
|
||||
proc TestOne {cname} { |
||||
|
||||
$cname b |
||||
|
||||
if {[b IsA "vtkAlgorithm"]} { |
||||
catch {b Update} |
||||
if {[catch {b SetInput emptyPD}] == 0} { |
||||
catch {b Update} |
||||
} |
||||
if {[catch {b SetInput emptyID}] == 0} { |
||||
catch {b Update} |
||||
} |
||||
if {[catch {b SetInput emptySG}] == 0} { |
||||
catch {b Update} |
||||
} |
||||
if {[catch {b SetInput emptyUG}] == 0} { |
||||
catch {b Update} |
||||
} |
||||
if {[catch {b SetInput emptyRG}] == 0} { |
||||
catch {b Update} |
||||
} |
||||
} |
||||
|
||||
b Delete |
||||
} |
||||
|
||||
set classExceptions { |
||||
vtkCommand |
||||
vtkIndent |
||||
vtkTimeStamp |
||||
vtkTkImageViewerWidget |
||||
vtkTkImageWindowWidget |
||||
vtkTkRenderWidget |
||||
vtkImageDataToTkPhoto |
||||
vtkJPEGReader |
||||
vtkWin32VideoSource |
||||
vtkDistributedDataFilter |
||||
} |
||||
|
||||
proc rtTestEmptyInputTest { fileid } { |
||||
global classExceptions |
||||
# for every class |
||||
set all [lsort [info command vtk*]] |
||||
foreach a $all { |
||||
if {[lsearch $classExceptions $a] == -1} { |
||||
# test some set get methods |
||||
puts -nonewline "Testing -- $a - " |
||||
flush stdout |
||||
TestOne $a |
||||
puts "done" |
||||
} |
||||
} |
||||
puts "All Passed" |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
rtTestEmptyInputTest stdout |
||||
|
||||
emptyPD Delete |
||||
emptyID Delete |
||||
emptySG Delete |
||||
emptyUG Delete |
||||
emptyRG Delete |
||||
|
||||
exit |
||||
|
||||
|
@ -0,0 +1,95 @@ |
||||
for {set i 0} {$i < [expr $argc - 1]} {incr i} { |
||||
if {[lindex $argv $i] == "-A"} { |
||||
set auto_path "$auto_path [lindex $argv [expr $i +1]]" |
||||
} |
||||
} |
||||
|
||||
package require vtk |
||||
vtkObject a |
||||
a GlobalWarningDisplayOff |
||||
a Delete |
||||
|
||||
set exceptions { |
||||
vtkLODProp3D-GetPickLODID |
||||
vtkObject-GetSuperClassName |
||||
vtkPropAssembly-GetBounds |
||||
vtkRenderWindow-GetEventPending |
||||
vtkXOpenGLRenderWindow-GetEventPending |
||||
vtkXMesaRenderWindow-GetEventPending |
||||
vtkMPICommunicator-GetWorldCommunicator |
||||
} |
||||
|
||||
proc TestOne {cname} { |
||||
global exceptions |
||||
$cname b |
||||
puts "Testing Class $cname" |
||||
set methods [b ListMethods] |
||||
# look for a Get Set pair |
||||
set len [llength $methods] |
||||
for {set i 0} {$i < $len} {incr i} { |
||||
if {[regsub {^Get([A-za-z0-9]*)} [lindex $methods $i] {\1} name]} { |
||||
if {($i == $len - 1) || ($i < $len - 1 && [lindex $methods [expr $i + 1]] != "with")} { |
||||
if {[lsearch $exceptions "$cname-[lindex $methods $i]"] == -1} { |
||||
# invoke the GetMethod |
||||
puts " Invoking Get$name" |
||||
set tmp [b Get$name] |
||||
# find matching set method |
||||
for {set j 0} {$j < $len} {incr j} { |
||||
if {[regexp "^Set$name" [lindex $methods $j]]} { |
||||
if {$j < $len - 3 && [lindex $methods [expr $j + 2]] == "1"} { |
||||
puts " Invoking Set$name" |
||||
catch {b Set$name $tmp} |
||||
} |
||||
if {$j < $len - 3 && [lindex $methods [expr $j + 2]] > 1} { |
||||
puts " Invoking Set$name" |
||||
catch {eval b Set$name $tmp} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
# Test the PrintRevisions method. |
||||
b PrintRevisions |
||||
b Delete |
||||
} |
||||
|
||||
set classExceptions { |
||||
vtkCommand |
||||
vtkFileOutputWindow |
||||
vtkIndent |
||||
vtkOutputWindow |
||||
vtkParallelFactory |
||||
vtkPlanes |
||||
vtkProjectedPolyDataRayBounder |
||||
vtkRayCaster |
||||
vtkTimeStamp |
||||
vtkTkImageViewerWidget |
||||
vtkTkImageWindowWidget |
||||
vtkTkRenderWidget |
||||
vtkImageDataToTkPhoto |
||||
vtkViewRays |
||||
vtkWin32OutputWindow |
||||
vtkWin32ProcessOutputWindow |
||||
vtkXMLFileOutputWindow |
||||
} |
||||
|
||||
proc rtSetGetTest { fileid } { |
||||
global classExceptions |
||||
# for every class |
||||
set all [lsort [info command vtk*]] |
||||
foreach a $all { |
||||
if {[lsearch $classExceptions $a] == -1} { |
||||
# test some set get methods |
||||
#puts "Testing -- $a" |
||||
TestOne $a |
||||
} |
||||
} |
||||
} |
||||
|
||||
# All tests should end with the following... |
||||
|
||||
rtSetGetTest stdout |
||||
|
||||
exit |
@ -0,0 +1,51 @@ |
||||
for {set i 0} {$i < [expr $argc - 1]} {incr i} { |
||||
if {[lindex $argv $i] == "-A"} { |
||||
set auto_path "$auto_path [lindex $argv [expr $i +1]]" |
||||
} |
||||
} |
||||
package require vtk |
||||
|
||||
proc rtOtherTest { fileid } { |
||||
#actual test |
||||
puts $fileid "vtkTclUtil test started" |
||||
|
||||
vtkCommand DebugOn |
||||
vtkTriangle a |
||||
vtkQuad b |
||||
puts $fileid "a ListInstances: [a ListInstances]" |
||||
puts $fileid "vtkTriangle ListInstances: [vtkTriangle ListInstances]" |
||||
puts $fileid "vtkCommand ListMethods" |
||||
puts $fileid "[vtkCommand ListMethods]" |
||||
puts $fileid "vtkCommand ListAllInstances" |
||||
puts $fileid "[vtkCommand ListAllInstances]" |
||||
puts $fileid "Some error handling..." |
||||
|
||||
puts $fileid "vtkWedge" |
||||
set rc [catch {puts $fileid "[vtkWedge]"} status] |
||||
puts $fileid "tcl return code: $rc : $status" |
||||
|
||||
puts $fileid "vtkWedge 1a" |
||||
set rc [catch {puts $fileid "[vtkWedge 1a]"} status] |
||||
puts $fileid "tcl return code: $rc : $status" |
||||
|
||||
puts $fileid "vtkTransform t; vtkTransform t" |
||||
set rc [catch {puts $fileid "[vtkTransform t; vtkTransform t]"} status] |
||||
puts $fileid "tcl return code: $rc : $status" |
||||
|
||||
puts $fileid "vtkTransform image;" |
||||
set rc [catch {puts $fileid "[vtkTransform image]"} status] |
||||
puts $fileid "tcl return code: $rc : $status" |
||||
|
||||
puts $fileid "vtkTclUtil test ended" |
||||
} |
||||
|
||||
# All tests should end with the following... |
||||
|
||||
if {![info exists rtOutId]} { |
||||
rtOtherTest stdout |
||||
vtkCommand DebugOff |
||||
vtkCommand DeleteAllObjects |
||||
exit |
||||
} |
||||
|
||||
wm withdraw . |
@ -0,0 +1,56 @@ |
||||
for {set i 0} {$i < [expr $argc - 1]} {incr i} { |
||||
if {[lindex $argv $i] == "-A"} { |
||||
set auto_path "$auto_path [lindex $argv [expr $i +1]]" |
||||
} |
||||
} |
||||
|
||||
package require vtk |
||||
|
||||
vtkObject a |
||||
a GlobalWarningDisplayOff |
||||
a Delete |
||||
|
||||
proc rtOtherTest { fileid } { |
||||
#actual test |
||||
set all [lsort [info command vtk*]] |
||||
foreach a $all { |
||||
if {$a == "vtkIndent"} { |
||||
continue |
||||
} |
||||
if {$a == "vtkOutputPort"} { |
||||
continue |
||||
} |
||||
if {$a == "vtkTimeStamp"} { |
||||
continue |
||||
} |
||||
if {$a == "vtkOutputWindow"} { |
||||
continue |
||||
} |
||||
catch { |
||||
$a b |
||||
b Print |
||||
if {[b IsA $a] == 0} {puts stderr "$a failed IsA test!!!"} |
||||
if {[b IsA "vtkObject"] == 0} {puts stdout "$a is not a sub-class of vtkObject"} |
||||
b GetClassName |
||||
b Delete |
||||
} |
||||
catch { |
||||
$a b |
||||
$a c |
||||
set d [b SafeDownCast c] |
||||
b Delete |
||||
c Delete |
||||
} |
||||
catch { |
||||
b Delete |
||||
c Delete |
||||
} |
||||
} |
||||
} |
||||
|
||||
# All tests should end with the following... |
||||
|
||||
rtOtherTest stdout |
||||
|
||||
exit |
||||
|
@ -0,0 +1,130 @@ |
||||
|
||||
# setup some common things for testing |
||||
vtkObject rtTempObject; |
||||
rtTempObject GlobalWarningDisplayOff; |
||||
vtkMath rtExMath |
||||
rtExMath RandomSeed 6 |
||||
|
||||
# create the testing class to do the work |
||||
vtkTesting rtTester |
||||
for {set i 1} {$i < [expr $argc - 1]} {incr i} { |
||||
rtTester AddArgument "[lindex $argv $i]" |
||||
} |
||||
set VTK_DATA_ROOT [rtTester GetDataRoot] |
||||
|
||||
for {set i 1} {$i < [expr $argc - 1]} {incr i} { |
||||
if {[lindex $argv $i] == "-A"} { |
||||
foreach dir [split [lindex $argv [expr $i +1]] ":"] { |
||||
lappend auto_path $dir |
||||
} |
||||
} |
||||
} |
||||
|
||||
vtkMPIController mpc |
||||
set gc [mpc GetGlobalController] |
||||
mpc Delete |
||||
|
||||
vtkCompositeRenderManager compManager |
||||
|
||||
if { $gc != "" } { |
||||
set myProcId [$gc GetLocalProcessId] |
||||
set numProcs [$gc GetNumberOfProcesses] |
||||
|
||||
compManager SetController $gc |
||||
} else { |
||||
set myProcId 0 |
||||
set numProcs 1 |
||||
} |
||||
|
||||
|
||||
proc ExitMaster { code } { |
||||
global numProcs |
||||
for { set i 1 } { $i < $numProcs } { incr i } { |
||||
# Send break to all the nodes |
||||
#puts "Send break to: $i" |
||||
catch [ [ compManager GetController ] TriggerRMI $i 239954 ] |
||||
} |
||||
|
||||
vtkCommand DeleteAllObjects |
||||
catch {destroy .top} |
||||
catch {destroy .geo} |
||||
|
||||
exit $code |
||||
} |
||||
|
||||
# load in the script |
||||
set file [lindex $argv 0] |
||||
|
||||
if { $myProcId != 0 } { |
||||
#puts "Start reading script on satellite node" |
||||
source $file |
||||
|
||||
compManager InitializeRMIs |
||||
#puts "Process RMIs" |
||||
[ compManager GetController ] ProcessRMIs |
||||
|
||||
#puts "**********************************" |
||||
#puts "Done on the slave node" |
||||
#puts "**********************************" |
||||
|
||||
|
||||
vtkCommand DeleteAllObjects |
||||
catch {destroy .top} |
||||
catch {destroy .geo} |
||||
exit 0 |
||||
} |
||||
|
||||
# set the default threshold, the Tcl script may change this |
||||
set threshold -1 |
||||
|
||||
if {[info commands wm] != ""} { |
||||
wm withdraw . |
||||
} else { |
||||
# There is no Tk. Help the tests run without it. |
||||
proc wm args { |
||||
puts "wm not implemented" |
||||
} |
||||
# The vtkinteraction package requires Tk but since Tk is not |
||||
# available it will never be used anyway. Just pretend it is |
||||
# already loaded so that tests that load it will not try to load Tk. |
||||
package provide vtkinteraction 5.0 |
||||
} |
||||
|
||||
# Run the test. |
||||
source $file |
||||
if {[info commands iren] == "iren"} {renWin Render} |
||||
# run the event loop quickly to map any tkwidget windows |
||||
update |
||||
|
||||
# current directory |
||||
if {[rtTester IsValidImageSpecified] != 0} { |
||||
# look for a renderWindow ImageWindow or ImageViewer |
||||
# first check for some common names |
||||
if {[info commands renWin] == "renWin"} { |
||||
rtTester SetRenderWindow renWin |
||||
if {$threshold == -1} { |
||||
set threshold 10 |
||||
} |
||||
} else { |
||||
if {$threshold == -1} { |
||||
set threshold 5 |
||||
} |
||||
if {[info commands viewer] == "viewer"} { |
||||
rtTester SetRenderWindow [viewer GetRenderWindow] |
||||
viewer Render |
||||
} else { |
||||
if {[info commands imgWin] == "imgWin"} { |
||||
rtTester SetRenderWindow imgWin |
||||
imgWin Render |
||||
} else { |
||||
if {[info exists viewer]} { |
||||
rtTester SetRenderWindow [$viewer GetRenderWindow] |
||||
} |
||||
} |
||||
} |
||||
} |
||||
set rtResult [rtTester RegressionTest $threshold] |
||||
} |
||||
|
||||
if {$rtResult == 0} {ExitMaster 1} |
||||
ExitMaster 0 |
@ -0,0 +1,87 @@ |
||||
|
||||
# setup some common things for testing |
||||
vtkObject rtTempObject; |
||||
|
||||
# This really should be removed but used to hang dashboards. |
||||
# I'm commenting it out for now to see what happens. |
||||
#rtTempObject GlobalWarningDisplayOff; |
||||
|
||||
vtkMath rtExMath |
||||
rtExMath RandomSeed 6 |
||||
|
||||
# create the testing class to do the work |
||||
vtkTesting rtTester |
||||
for {set i 1} {$i < [expr $argc - 1]} {incr i} { |
||||
rtTester AddArgument "[lindex $argv $i]" |
||||
} |
||||
set VTK_DATA_ROOT [rtTester GetDataRoot] |
||||
|
||||
for {set i 1} {$i < [expr $argc - 1]} {incr i} { |
||||
if {[lindex $argv $i] == "-A"} { |
||||
foreach dir [split [lindex $argv [expr $i +1]] ":"] { |
||||
lappend auto_path $dir |
||||
} |
||||
} |
||||
} |
||||
|
||||
# load in the script |
||||
set file [lindex $argv 0] |
||||
|
||||
# set the default threshold, the Tcl script may change this |
||||
set threshold -1 |
||||
|
||||
if {[info commands wm] != ""} { |
||||
wm withdraw . |
||||
} else { |
||||
# There is no Tk. Help the tests run without it. |
||||
proc wm args { |
||||
puts "wm not implemented" |
||||
} |
||||
# The vtkinteraction package requires Tk but since Tk is not |
||||
# available it will never be used anyway. Just pretend it is |
||||
# already loaded so that tests that load it will not try to load Tk. |
||||
package provide vtkinteraction 5.0 |
||||
} |
||||
|
||||
# Run the test. |
||||
source $file |
||||
if {[info commands iren] == "iren"} {renWin Render} |
||||
# run the event loop quickly to map any tkwidget windows |
||||
update |
||||
|
||||
# current directory |
||||
if {[rtTester IsValidImageSpecified] != 0} { |
||||
# look for a renderWindow ImageWindow or ImageViewer |
||||
# first check for some common names |
||||
if {[info commands renWin] == "renWin"} { |
||||
rtTester SetRenderWindow renWin |
||||
if {$threshold == -1} { |
||||
set threshold 10 |
||||
} |
||||
} else { |
||||
if {$threshold == -1} { |
||||
set threshold 5 |
||||
} |
||||
if {[info commands viewer] == "viewer"} { |
||||
rtTester SetRenderWindow [viewer GetRenderWindow] |
||||
viewer Render |
||||
} else { |
||||
if {[info commands imgWin] == "imgWin"} { |
||||
rtTester SetRenderWindow imgWin |
||||
imgWin Render |
||||
} else { |
||||
if {[info exists viewer]} { |
||||
rtTester SetRenderWindow [$viewer GetRenderWindow] |
||||
} |
||||
} |
||||
} |
||||
} |
||||
set rtResult [rtTester RegressionTest $threshold] |
||||
} |
||||
|
||||
vtkCommand DeleteAllObjects |
||||
catch {destroy .top} |
||||
catch {destroy .geo} |
||||
|
||||
if {$rtResult == 0} {exit 1} |
||||
exit 0 |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,206 @@ |
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit |
||||
Module: $RCSfile: vtkAbstractArray.cxx,v $ |
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen |
||||
All rights reserved. |
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even |
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||||
PURPOSE. See the above copyright notice for more information. |
||||
|
||||
=========================================================================*/ |
||||
#include "vtkAbstractArray.h" |
||||
#include "vtkIdList.h" |
||||
#include "vtkMath.h" |
||||
|
||||
#include "vtkDataArray.h" |
||||
#include "vtkBitArray.h" |
||||
#include "vtkCharArray.h" |
||||
#include "vtkDoubleArray.h" |
||||
#include "vtkFloatArray.h" |
||||
#include "vtkIntArray.h" |
||||
#include "vtkIdTypeArray.h" |
||||
#include "vtkLongArray.h" |
||||
#include "vtkShortArray.h" |
||||
#include "vtkUnsignedCharArray.h" |
||||
#include "vtkUnsignedIntArray.h" |
||||
#include "vtkUnsignedLongArray.h" |
||||
#include "vtkUnsignedShortArray.h" |
||||
|
||||
vtkCxxRevisionMacro(vtkAbstractArray, "$Revision: 1.5 $"); |
||||
|
||||
// Construct object with sane defaults.
|
||||
|
||||
vtkAbstractArray::vtkAbstractArray(vtkIdType vtkNotUsed(numComp)) |
||||
{ |
||||
this->Size = 0; |
||||
this->MaxId = -1; |
||||
|
||||
this->Name = NULL; |
||||
this->DataType = -1; |
||||
} |
||||
|
||||
vtkAbstractArray::~vtkAbstractArray() |
||||
{ |
||||
if (this->Name != NULL) |
||||
{ |
||||
delete [] this->Name; |
||||
} |
||||
this->Name = NULL; |
||||
} |
||||
|
||||
void vtkAbstractArray::SetName(const char* name) |
||||
{ |
||||
if (this->Name != NULL) |
||||
{ |
||||
delete[] this->Name; |
||||
} |
||||
|
||||
this->Name = NULL; |
||||
if (name) |
||||
{ |
||||
int size = static_cast<int>(strlen(name)); |
||||
this->Name = new char[size+1]; |
||||
strcpy(this->Name, name); |
||||
} |
||||
} |
||||
|
||||
const char* vtkAbstractArray::GetName() |
||||
{ |
||||
return this->Name; |
||||
} |
||||
|
||||
|
||||
void vtkAbstractArray::PrintSelf(ostream& os, vtkIndent indent) |
||||
{ |
||||
this->Superclass::PrintSelf(os,indent); |
||||
|
||||
const char* name = this->GetName(); |
||||
if (name) |
||||
{ |
||||
os << indent << "Name: " << name << "\n"; |
||||
} |
||||
else |
||||
{ |
||||
os << indent << "Name: (none)\n"; |
||||
} |
||||
os << indent << "Data type: " << this->GetDataTypeAsString(); |
||||
os << indent << "Size: " << this->Size << "\n"; |
||||
os << indent << "MaxId: " << this->MaxId << "\n"; |
||||
} |
||||
|
||||
unsigned long vtkAbstractArray::GetDataTypeSize(int type) |
||||
{ |
||||
switch (type) |
||||
{ |
||||
case VTK_BIT: |
||||
return 1; |
||||
break; |
||||
|
||||
case VTK_CHAR: |
||||
return sizeof(char); |
||||
break; |
||||
|
||||
case VTK_UNSIGNED_CHAR: |
||||
return sizeof(unsigned char); |
||||
break; |
||||
|
||||
case VTK_SHORT: |
||||
return sizeof(short); |
||||
break; |
||||
|
||||
case VTK_UNSIGNED_SHORT: |
||||
return sizeof(unsigned short); |
||||
break; |
||||
|
||||
case VTK_INT: |
||||
return sizeof(int); |
||||
break; |
||||
|
||||
case VTK_UNSIGNED_INT: |
||||
return sizeof(unsigned int); |
||||
break; |
||||
|
||||
case VTK_LONG: |
||||
return sizeof(long); |
||||
break; |
||||
|
||||
case VTK_UNSIGNED_LONG: |
||||
return sizeof(unsigned long); |
||||
break; |
||||
|
||||
case VTK_FLOAT: |
||||
return sizeof(float); |
||||
break; |
||||
|
||||
case VTK_DOUBLE: |
||||
return sizeof(double); |
||||
break; |
||||
|
||||
case VTK_ID_TYPE: |
||||
return sizeof(vtkIdType); |
||||
break; |
||||
|
||||
case VTK_STRING: |
||||
return 0; |
||||
break; |
||||
|
||||
default: |
||||
vtkGenericWarningMacro(<<"Unsupported data type!"); |
||||
} |
||||
|
||||
return 1; |
||||
} |
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#if 0 |
||||
vtkAbstractArray* vtkAbstractArray::CreateArray(int dataType) |
||||
{ |
||||
switch (dataType) |
||||
{ |
||||
case VTK_BIT: |
||||
return vtkBitArray::New(); |
||||
|
||||
case VTK_CHAR: |
||||
return vtkCharArray::New(); |
||||
|
||||
case VTK_UNSIGNED_CHAR: |
||||
return vtkUnsignedCharArray::New(); |
||||
|
||||
case VTK_SHORT: |
||||
return vtkShortArray::New(); |
||||
|
||||
case VTK_UNSIGNED_SHORT: |
||||
return vtkUnsignedShortArray::New(); |
||||
|
||||
case VTK_INT: |
||||
return vtkIntArray::New(); |
||||
|
||||
case VTK_UNSIGNED_INT: |
||||
return vtkUnsignedIntArray::New(); |
||||
|
||||
case VTK_LONG: |
||||
return vtkLongArray::New(); |
||||
|
||||
case VTK_UNSIGNED_LONG: |
||||
return vtkUnsignedLongArray::New(); |
||||
|
||||
case VTK_FLOAT: |
||||
return vtkFloatArray::New(); |
||||
|
||||
case VTK_DOUBLE: |
||||
return vtkDoubleArray::New(); |
||||
|
||||
case VTK_ID_TYPE: |
||||
return vtkIdTypeArray::New(); |
||||
|
||||
default: |
||||
vtkGenericWarningMacro(<<"Unsupported data type! Setting to VTK_DOUBLE"); |
||||
return vtkDoubleArray::New(); |
||||
} |
||||
} |
||||
#endif |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue