...
 
Commits (11488)

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -14,6 +14,6 @@ pre-commit crlf=input
*.txt whitespace=tab-in-indent
*.cmake whitespace=tab-in-indent
*.md whitespace=tab-in-indent conflict-marker-size=30
*.sha512 eol=lf
/ThirdParty/sqlite/vtksqlite/vtk_sqlite3.c hooks.MaxObjectKiB=4096
*.md whitespace=tab-in-indent conflict-marker-size=30
Thanks for your interest in contributing to VTK! The GitHub repository
is a mirror provided for convenience, but VTK does not use GitHub pull
requests for contribution. Please see
https://gitlab.kitware.com/vtk/vtk/tree/master/CONTRIBUTING.md
for contribution instructions. GitHub OAuth may be used to sign in.
......@@ -5,3 +5,17 @@
*.pyc
*.pyo
__pycache__/
# Exclude OS X .DS_Store files.
.DS_Store
# Exclude some Xcode stuff.
xcuserdata
project.xcworkspace
# Exclude VSCode settings and configuration folder
*.vscode*
# Exclude Visual Studio stuff
.vs*
CMakeSettings.json
[submodule "VTK-m"]
path = ThirdParty/vtkm/vtkvtkm/vtk-m
url = https://gitlab.kitware.com/vtk/vtk-m.git
##=============================================================================
##
## Copyright (c) Kitware, Inc.
## All rights reserved.
## See LICENSE.txt 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.
##
## Copyright 2012 Sandia Corporation.
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
## the U.S. Government retains certain rights in this software.
##
##=============================================================================
#ensure we link against our dependencies
include(module.cmake)
find_package(Dax REQUIRED)
DaxConfigureSerial(REQUIRED)
DaxConfigureCuda()
DaxConfigureTBB()
DaxConfigureOpenMP()
# Collect a list of available backends.
set(DAX_BACKENDS)
if(${Dax_ENABLE_CUDA})
list(APPEND DAX_BACKENDS CUDA)
endif()
if(${Dax_ENABLE_TBB})
list(APPEND DAX_BACKENDS TBB)
endif()
if(${Dax_ENABLE_OPENMP})
list(APPEND DAX_BACKENDS OPENMP)
endif()
list(APPEND DAX_BACKENDS SERIAL)
# Pick the first backed found in list as the default backend
list(GET DAX_BACKENDS 0 DEFAULT_BACKEND)
# Display available options for user selection.
set(VTK_DAX_BACKEND ${DEFAULT_BACKEND} CACHE STRING
"Choose from available backend acclerators")
set_property(CACHE VTK_DAX_BACKEND PROPERTY STRINGS ${DAX_BACKENDS})
# Turn the picked option on and turn off the others.
foreach(backend ${DAX_BACKENDS})
if(${backend} STREQUAL ${VTK_DAX_BACKEND})
set(VTK_DAX_PICKED_${backend} TRUE)
else()
set(VTK_DAX_PICKED_${backend} FALSE)
endif()
endforeach()
# Setting the configuration file to include the appropriate driver.
#we prefer cuda over everything else, than tbb and openmp
set (DAX_DISABLE_BOOST_SP_THREADS 0)
if(${VTK_DAX_PICKED_CUDA})
set (DAX_DISABLE_BOOST_SP_THREADS 1)
set (DAX_DEVICE_ADAPTER "DAX_DEVICE_ADAPTER_CUDA")
elseif(${VTK_DAX_PICKED_TBB})
set (DAX_DEVICE_ADAPTER "DAX_DEVICE_ADAPTER_TBB")
elseif(${VTK_DAX_PICKED_OPENMP})
set (DAX_DEVICE_ADAPTER "DAX_DEVICE_ADAPTER_OPENMP")
else()
set (DAX_DEVICE_ADAPTER "DAX_DEVICE_ADAPTER_SERIAL")
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/vtkDaxConfig.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/vtkDaxConfig.h" @ONLY)
#needed for our export macros
include_directories(${${vtk-module}_DEPENDS_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${Dax_INCLUDE_DIRS}
)
set(headers
vtkDaxDetailCommon.h
vtkDaxContourImpl.h
vtkDaxThresholdImpl.h
vtkDaxConfig.h
)
#implementation of the algorithms for cpu accelerators
set(cpu_accelerator_srcs
vtkDaxContourImpl.cxx
vtkDaxThresholdImpl.cxx
)
set(vtk_srcs
vtkDaxContour.cxx
vtkDaxThreshold.cxx
${CMAKE_CURRENT_BINARY_DIR}/vtkAcceleratorsDaxObjectFactory.cxx
)
set_source_files_properties(
${headers}
${cpu_accelerator_srcs}
${CMAKE_CURRENT_BINARY_DIR}/vtkAcceleratorsDaxObjectFactory.cxx
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
# Now for the object factory.
set(opengl_overrides
Contour
Threshold
)
# Now we need to generate the object factory for this module. Create a list of
# overrides, and then generate the class that overrides those classes.
set(vtk_module_overrides)
foreach(_override ${opengl_overrides})
list(APPEND vtk_module_overrides vtk${_override})
set(vtk_module_vtk${_override}_override vtkDax${_override})
endforeach()
# Now we iterate and create that class file...
foreach(_class ${vtk_module_overrides})
set(_override ${vtk_module_${_class}_override})
set(_vtk_override_includes "${_vtk_override_includes}
#include \"${_override}.h\"")
set(_vtk_override_creates "${_vtk_override_creates}
VTK_CREATE_CREATE_FUNCTION(${_override})")
set(_vtk_override_do "${_vtk_override_do}
this->RegisterOverride(\"${_class}\",
\"${_override}\",
\"rride for ${vtk-module} module\", 1,
vtkObjectFactoryCreate${_override});")
endforeach()
# Now lets create the object factory classes
string(TOUPPER ${vtk-module} VTK-MODULE)
configure_file(${VTK_CMAKE_DIR}/vtkObjectFactory.h.in
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.h)
configure_file(${VTK_CMAKE_DIR}/vtkObjectFactory.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.cxx)
list(APPEND Module_SRCS
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.cxx)
set_source_files_properties(
${vtk-module}ObjectFactory.cxx
WRAP_EXCLUDE
)
#we are building with CUDA support
if(${VTK_DAX_PICKED_CUDA})
#implementation of the algorithms for gpu accelerators
set(cuda_accelerator_srcs
vtkDaxContourImpl.cu
vtkDaxThresholdImpl.cu
)
#follow pistons example on how to build a subsection of the cuda with nvcc
if(BUILD_SHARED_LIBS)
set(GPGPU_BUILD_TYPE SHARED)
endif()
set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE OFF) #otherwise C_SOURCES is empty in VS
vtk_module_impl()
cuda_compile(cuda_compiled_srcs
${cuda_accelerator_srcs}
${headers}
${GPGPU_BUILD_TYPE})
set_source_files_properties(
${cuda_compiled_srcs}
${cuda_accelerator_srcs}
WRAP_EXCLUDE
)
vtk_module_library(vtkAcceleratorsDax ${vtk_srcs} ${cuda_compiled_srcs}
${headers})
vtk_module_link_libraries(vtkAcceleratorsDax LINK_PRIVATE ${CUDA_LIBRARIES})
elseif(${VTK_DAX_PICKED_TBB})
vtk_module_library(vtkAcceleratorsDax ${vtk_srcs}
${cpu_accelerator_srcs} ${headers})
vtk_module_link_libraries(vtkAcceleratorsDax LINK_PRIVATE ${TBB_LIBRARIES})
else()
vtk_module_library(vtkAcceleratorsDax ${vtk_srcs}
${cpu_accelerator_srcs} ${headers})
endif()
#install the required headers to make your own dax vtk filter
if(NOT VTK_INSTALL_NO_DEVELOPMENT)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/vtkToDax
DESTINATION ${VTK_INSTALL_INCLUDE_DIR}
COMPONENT Development)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/daxToVtk
DESTINATION ${VTK_INSTALL_INCLUDE_DIR}
COMPONENT Development)
endif()
Dax License Version 1.0
========================================================================
Copyright (c) 2012,
Sandia Corporation, Kitware Inc., University of California Davis
All rights reserved.
Sandia National Laboratories, New Mexico
PO Box 5800
Albuquerque, NM 87185
USA
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
University of California, Davis
One Shields Avenue
Davis, CA 95616
USA
Under the terms of Contract DE-AC04-94AL85000, there is a
non-exclusive license for use of this work by or on behalf of the
U.S. Government.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
* Neither the name of Kitware nor the names of any contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================
vtk_add_test_cxx(${vtk-module}CxxTests tests
TestDaxThreshold.cxx
TestDaxThreshold2.cxx
TestDaxMarchingCubes.cxx
)
vtk_test_cxx_executable(${vtk-module}CxxTests tests)
//=============================================================================
//
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt 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.
//
// Copyright 2012 Sandia Corporation.
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
//=============================================================================
#include "vtkActor.h"
#include "vtkCellData.h"
#include "vtkDaxContour.h"
#include "vtkElevationFilter.h"
#include "vtkImageData.h"
#include "vtkImageMandelbrotSource.h"
#include "vtkNew.h"
#include "vtkPointData.h"
#include "vtkPolyDataMapper.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
namespace
{
template<typename T>
int RunVTKPipeline(T *t, int argc, char* argv[])
{
vtkNew<vtkRenderer> ren;
vtkNew<vtkRenderWindow> renWin;
vtkNew<vtkRenderWindowInteractor> iren;
renWin->AddRenderer(ren.GetPointer());
iren->SetRenderWindow(renWin.GetPointer());
vtkNew<vtkDaxContour> cubes;
cubes->SetInputConnection(t->GetOutputPort());
cubes->SetInputArrayToProcess(
0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, "Iterations");
cubes->SetNumberOfContours(1);
cubes->SetValue(0,50.5f);
cubes->ComputeScalarsOn();
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(cubes->GetOutputPort());
mapper->ScalarVisibilityOn();
mapper->SetScalarModeToUsePointFieldData();
mapper->SelectColorArray("Elevation");
mapper->SetScalarRange(0.0, 1.0);
vtkNew<vtkActor> actor;
actor->SetMapper(mapper.GetPointer());
ren->AddActor(actor.GetPointer());
ren->ResetCamera();
renWin->Render();
int retVal = vtkRegressionTestImage(renWin.GetPointer());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
retVal = vtkRegressionTester::PASSED;
}
return (!retVal);
}
} // Anonymous namespace
int TestDaxMarchingCubes(int argc, char* argv[])
{
//create the sample grid
vtkNew<vtkImageMandelbrotSource> src;
src->SetWholeExtent(0,250,0,250,0,250);
//create a secondary field for interpolation
vtkNew<vtkElevationFilter> elevation;
elevation->SetInputConnection(src->GetOutputPort());
elevation->SetScalarRange(0.0, 1.0);
elevation->SetLowPoint(-1.75, 0.0, 1.0);
elevation->SetHighPoint(0.75, 0.0, 1.0);
//run the pipeline
return RunVTKPipeline(elevation.GetPointer(),argc,argv);
}
//=============================================================================
//
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt 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.
//
// Copyright 2012 Sandia Corporation.
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
//=============================================================================
#include "vtkActor.h"
#include "vtkDataSetSurfaceFilter.h"
#include "vtkDaxThreshold.h"
#include "vtkFloatArray.h"
#include "vtkImageData.h"
#include "vtkMath.h"
#include "vtkNew.h"
#include "vtkPointData.h"
#include "vtkPolyDataMapper.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkThreshold.h"
#include "vtkTrivialProducer.h"
namespace
{
void fillElevationArray(vtkFloatArray* elven, vtkImageData* grid)
{
elven->SetName("Elevation");
const vtkIdType size = grid->GetNumberOfPoints();
elven->SetNumberOfValues(size);
double pos[3]={0,0,0};
for(vtkIdType i=0; i < size; ++i)
{
grid->GetPoint(i,pos);
elven->SetValue(i,sqrt(vtkMath::Dot(pos,pos)));
}
}
int RunVTKPipeline(vtkImageData* grid, int argc, char* argv[])
{
vtkNew<vtkRenderer> ren;
vtkNew<vtkRenderWindow> renWin;
vtkNew<vtkRenderWindowInteractor> iren;
renWin->AddRenderer(ren.GetPointer());
iren->SetRenderWindow(renWin.GetPointer());
//compute an elevation array
vtkNew<vtkFloatArray> elevationPoints;
fillElevationArray(elevationPoints.GetPointer(), grid);
grid->GetPointData()->AddArray(elevationPoints.GetPointer());
vtkNew<vtkTrivialProducer> producer;
producer->SetOutput(grid);
vtkNew<vtkDaxThreshold> threshold;
threshold->SetInputConnection(producer->GetOutputPort());
threshold->SetPointsDataTypeToFloat();
threshold->AllScalarsOn();
threshold->ThresholdBetween(0,100);
threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS,"Elevation");