Commit 9a7dcd0f authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot

Merge topic 'python-calc-15125' into pv-master

7c7c3ca4 Add missing numpy functions previously available in ParaView 4.1.
f54b5b9f Merge topic 'enh_xdmf3_writer' into master
9f0d0bae Merge topic 'fix_xdmf2_writer' into master
fa2aef48 Merge topic 'update-hdf5' into master
acb40959 Enhance Xdmf3 writer to save block names.
2cc28ea5 Fix Xdmf2 writer: array type was not respected. Also save block name.
96db5108 Merge topic 'plotbar_improvement' into master
f7bf6158 Merge topic 'qt-warning-take3' into master
bed938eb Merge topic 'enum-comma-warning' into master
18f678ac Fix warning about comma at end of enum list.
91dcdaa6 Another attempt to silence warning from Qt header
4bcf0dc2 Prefix BUILD_STATIC_EXECS with HDF5 and make it advanced.
1dc7f42b Merge topic 'sample_distance_issue' into master
aab57b1d Merge topic 'fix_xdmf3_dll_export' into master
cac3a404 Merge topic 'type-punned-pointer' into master
1dcc3d96 Add functions to get data bounds and number of plotted bars.
...
parents 83046737 7c7c3ca4
......@@ -119,44 +119,6 @@ void CopyToPointsSwitch(vtkPoints2D *points, vtkPoints2D *previousPoints, A *a,
}
}
// Indexed vector for sorting
struct vtkIndexedVector2f
{
size_t index;
vtkVector2f pos;
};
// Compare two vtkIndexedVector2f, in X component only
bool compVector3fX(const vtkIndexedVector2f& v1,
const vtkIndexedVector2f& v2)
{
if (v1.pos.GetX() < v2.pos.GetX())
{
return true;
}
else
{
return false;
}
}
class VectorPIMPL : public std::vector<vtkIndexedVector2f>
{
public:
VectorPIMPL(vtkVector2f* array, size_t n)
: std::vector<vtkIndexedVector2f>()
{
this->reserve(n);
for (size_t i = 0; i < n; ++i)
{
vtkIndexedVector2f tmp;
tmp.index = i;
tmp.pos = array[i];
this->push_back(tmp);
}
}
};
} // namespace
//-----------------------------------------------------------------------------
......@@ -338,7 +300,7 @@ class vtkPlotBarSegment : public vtkObject {
// Set up our search array, use the STL lower_bound algorithm
VectorPIMPL::iterator low;
VectorPIMPL &v = *this->Sorted;
low = std::lower_bound(v.begin(), v.end(), lowPoint, compVector3fX);
low = std::lower_bound(v.begin(), v.end(), lowPoint);
while (low != v.end())
{
......@@ -373,7 +335,7 @@ class vtkPlotBarSegment : public vtkObject {
vtkVector2f* data =
static_cast<vtkVector2f*>(this->Points->GetVoidPointer(0));
this->Sorted = new VectorPIMPL(data, n);
std::sort(this->Sorted->begin(), this->Sorted->end(), compVector3fX);
std::sort(this->Sorted->begin(), this->Sorted->end());
}
}
......@@ -409,7 +371,7 @@ class vtkPlotBarSegment : public vtkObject {
// Set up our search array, use the STL lower_bound algorithm
VectorPIMPL::iterator low;
VectorPIMPL &v = *this->Sorted;
low = std::lower_bound(v.begin(), v.end(), lowPoint, compVector3fX);
low = std::lower_bound(v.begin(), v.end(), lowPoint);
std::vector<vtkIdType> selected;
......@@ -453,6 +415,36 @@ class vtkPlotBarSegment : public vtkObject {
}
}
// Indexed vector for sorting
struct vtkIndexedVector2f
{
size_t index;
vtkVector2f pos;
// Compare two vtkIndexedVector2f, in X component only
bool operator<(const vtkIndexedVector2f& v2) const
{
return (this->pos.GetX() < v2.pos.GetX());
}
};
class VectorPIMPL : public std::vector<vtkIndexedVector2f>
{
public:
VectorPIMPL(vtkVector2f* array, size_t n)
: std::vector<vtkIndexedVector2f>()
{
this->reserve(n);
for (size_t i = 0; i < n; ++i)
{
vtkIndexedVector2f tmp;
tmp.index = i;
tmp.pos = array[i];
this->push_back(tmp);
}
}
};
vtkSmartPointer<vtkPlotBarSegment> Previous;
vtkSmartPointer<vtkPoints2D> Points;
vtkPlotBar *Bar;
......@@ -1113,3 +1105,36 @@ vtkStdString vtkPlotBar::GetTooltipLabel(const vtkVector2d &plotPos,
}
return tooltipLabel;
}
//-----------------------------------------------------------------------------
int vtkPlotBar::GetBarsCount()
{
vtkTable *table = this->Data->GetInput();
if (!table)
{
vtkWarningMacro(<< "GetBarsCount called with no input table set.");
return 0;
}
vtkDataArray* x = this->Data->GetInputArrayToProcess(0, table);
return x ? x->GetNumberOfTuples() : 0;
}
//-----------------------------------------------------------------------------
void vtkPlotBar::GetDataBounds(double bounds[2])
{
assert(bounds);
// Get the x and y arrays (index 0 and 1 respectively)
vtkTable *table = this->Data->GetInput();
if (!table)
{
vtkWarningMacro(<< "GetDataBounds called with no input table set.");
bounds[0] = VTK_DOUBLE_MAX;
bounds[1] = VTK_DOUBLE_MIN;
return;
}
vtkDataArray* x = this->Data->GetInputArrayToProcess(0, table);
if (x)
{
x->GetRange(bounds);
}
}
......@@ -192,6 +192,14 @@ public:
vtkVector2f* location,
vtkIdType* segmentIndex);
// Description:
// Get amount of plotted bars.
int GetBarsCount();
// Description:
// Get the data bounds for this mapper as (Xmin,Xmax).
void GetDataBounds(double bounds[2]);
protected:
vtkPlotBar();
~vtkPlotBar();
......
......@@ -148,9 +148,7 @@ int vtkMultiThreader::GetGlobalDefaultNumberOfThreads()
// and will not change.
vtkMultiThreader::vtkMultiThreader()
{
int i;
for ( i = 0; i < VTK_MAX_THREADS; i++ )
for ( int i = 0; i < VTK_MAX_THREADS; i++ )
{
this->ThreadInfoArray[i].ThreadID = i;
this->ThreadInfoArray[i].ActiveFlag = NULL;
......@@ -170,9 +168,7 @@ vtkMultiThreader::vtkMultiThreader()
// Destructor. Nothing allocated so nothing needs to be done here.
vtkMultiThreader::~vtkMultiThreader()
{
int i;
for ( i = 0; i < VTK_MAX_THREADS; i++ )
for ( int i = 0; i < VTK_MAX_THREADS; i++ )
{
if ( this->ThreadInfoArray[i].ActiveFlagLock )
{
......@@ -234,16 +230,16 @@ void vtkMultiThreader::SingleMethodExecute()
#ifdef VTK_USE_WIN32_THREADS
DWORD threadId;
HANDLE process_id[VTK_MAX_THREADS];
HANDLE process_id[VTK_MAX_THREADS] = {};
#endif
#ifdef VTK_USE_SPROC
siginfo_t info_ptr;
int process_id[VTK_MAX_THREADS];
int process_id[VTK_MAX_THREADS] = {};
#endif
#ifdef VTK_USE_PTHREADS
pthread_t process_id[VTK_MAX_THREADS];
pthread_t process_id[VTK_MAX_THREADS] = {};
#endif
if ( !this->SingleMethod )
......@@ -419,16 +415,16 @@ void vtkMultiThreader::MultipleMethodExecute()
#ifdef VTK_USE_WIN32_THREADS
DWORD threadId;
HANDLE process_id[VTK_MAX_THREADS];
HANDLE process_id[VTK_MAX_THREADS] = {};
#endif
#ifdef VTK_USE_SPROC
siginfo_t info_ptr;
int process_id[VTK_MAX_THREADS];
int process_id[VTK_MAX_THREADS] = {};
#endif
#ifdef VTK_USE_PTHREADS
pthread_t process_id[VTK_MAX_THREADS];
pthread_t process_id[VTK_MAX_THREADS] = {};
#endif
......
......@@ -160,7 +160,7 @@ vtkIdType vtkUnicodeStringArray::InsertNextTuple(vtkIdType j, vtkAbstractArray*
this->Internal->Storage.push_back(array->Internal->Storage[j]);
this->DataChanged();
return this->Internal->Storage.size() - 1;
return static_cast<vtkIdType>(this->Internal->Storage.size()) - 1;
}
void* vtkUnicodeStringArray::GetVoidPointer(vtkIdType id)
......@@ -324,7 +324,7 @@ void vtkUnicodeStringArray::SetVariantValue(vtkIdType id, vtkVariant value)
void vtkUnicodeStringArray::DataChanged()
{
this->MaxId = this->Internal->Storage.size() - 1;
this->MaxId = static_cast<vtkIdType>(this->Internal->Storage.size()) - 1;
}
void vtkUnicodeStringArray::ClearLookup()
......@@ -335,7 +335,7 @@ vtkIdType vtkUnicodeStringArray::InsertNextValue(const vtkUnicodeString& value)
{
this->Internal->Storage.push_back(value);
this->DataChanged();
return this->Internal->Storage.size() - 1;
return static_cast<vtkIdType>(this->Internal->Storage.size()) - 1;
}
void vtkUnicodeStringArray::InsertValue(vtkIdType i, const vtkUnicodeString& value)
......
......@@ -2425,9 +2425,14 @@ void vtkHyperOctree::GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
cellIds->Reset();
//Find the point used by the fewest number of cells
//
numPts = ptIds->GetNumberOfIds();
if (numPts <= 0)
{
vtkErrorMacro("input point ids empty.");
return;
}
//Find the point used by the fewest number of cells
pts = ptIds->GetPointer(0);
for (minNumCells=VTK_INT_MAX,i=0; i<numPts; i++)
{
......@@ -2442,10 +2447,6 @@ void vtkHyperOctree::GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
}
}
if (minNumCells == VTK_INT_MAX || numPts == 0) {
vtkErrorMacro("input point ids empty.");
return;
}
//Now for each cell, see if it contains all the points
//in the ptIds list.
for (i=0; i<minNumCells; i++)
......
......@@ -732,6 +732,12 @@ void vtkHyperTreeGrid::GetCellNeighbors( vtkIdType cellId,
cellIds->Reset();
int numPts = ptIds->GetNumberOfIds();
if ( numPts <= 0 )
{
vtkErrorMacro( "input point ids empty." );
return;
}
int minNumCells = VTK_INT_MAX;
vtkIdType* pts = ptIds->GetPointer( 0 );
vtkIdType* minCells = 0;
......@@ -749,12 +755,6 @@ void vtkHyperTreeGrid::GetCellNeighbors( vtkIdType cellId,
}
}
if ( minNumCells == VTK_INT_MAX || numPts == 0 )
{
vtkErrorMacro( "input point ids empty." );
return;
}
cellIds->Allocate( minNumCells );
// For all cells that contNow for each cell, see if it contains all the points
......
......@@ -56,10 +56,10 @@ int vtkPolyLine::GenerateSlidingNormals(vtkPoints *pts, vtkCellArray *lines,
{
vtkIdType npts=0;
vtkIdType *linePts=0;
double sPrev[3], sNext[3], q[3], w[3], normal[3], theta;
double sPrev[3], sNext[3], q[3], w[3], normal[3];
double p[3], pNext[3];
double c[3], f1, f2;
int i, j, largeRotation;
int i, j;
sNext[0]=0.0;
sNext[1]=0.0;
sNext[2]=0.0;
......@@ -206,35 +206,13 @@ int vtkPolyLine::GenerateSlidingNormals(vtkPoints *pts, vtkCellArray *lines,
return 0;
}
//see whether we rotate greater than 90 degrees.
if ( vtkMath::Dot(sPrev,sNext) < 0.0 )
{
largeRotation = 1;
}
else
{
largeRotation = 0;
}
//compute rotation of line segment
vtkMath::Cross (sNext, sPrev, q);
theta=asin(static_cast<double>(vtkMath::Normalize(q)));
if (theta==0.0)
if (vtkMath::Normalize(q) == 0.0)
{ //no rotation, use previous normal
normals->InsertTuple(linePts[j],normal);
continue;
}
if ( largeRotation )
{
if ( theta > 0.0 )
{
theta = vtkMath::Pi() - theta;
}
else
{
theta = -vtkMath::Pi() - theta;
}
}
// new method
for (i=0; i<3; i++)
......
......@@ -1790,9 +1790,14 @@ void vtkUnstructuredGrid::GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
cellIds->Reset();
//Find the point used by the fewest number of cells
//
numPts = ptIds->GetNumberOfIds();
if (numPts <= 0)
{
vtkErrorMacro("input point ids empty.");
return;
}
//Find the point used by the fewest number of cells
pts = ptIds->GetPointer(0);
for (minNumCells=VTK_INT_MAX,i=0; i<numPts; i++)
{
......@@ -1807,10 +1812,6 @@ void vtkUnstructuredGrid::GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
}
}
if (minNumCells == VTK_INT_MAX && numPts == 0) {
vtkErrorMacro("input point ids empty.");
minNumCells = 0;
}
//Now for each cell, see if it contains all the points
//in the ptIds list.
for (i=0; i<minNumCells; i++)
......
......@@ -787,6 +787,7 @@ static int vtkHabichtOrSturmBisectionSolve(
int deg = polynomialEucliDiv(
SSS, d, SSS + offsets[nSSS - 1], degrees[nSSS - 1], Q, R,
vtkPolynomialSolversUnivariate::GetDivisionTolerance() );
(void)deg; // above result not really needed, but useful in debugging
deg = d - degrees[nSSS - 1];
......
vtk_add_test_cxx(${vtk-module}CxxTests tests
NO_DATA NO_VALID NO_OUTPUT
TestPolygonBuilder.cxx
UnitTestFunctionParser.cxx
)
vtk_test_cxx_executable(${vtk-module}CxxTests tests)
This diff is collapsed.
This diff is collapsed.
......@@ -72,10 +72,10 @@
#define VTK_PARSER_HYPERBOLIC_TANGENT 24
#define VTK_PARSER_MIN 25
#define VTK_PARSER_MAX 26
#define VTK_PARSER_CROSS 27
#define VTK_PARSER_SIGN 28
// functions involving vectors
#define VTK_PARSER_CROSS 27
#define VTK_PARSER_VECTOR_UNARY_MINUS 29
#define VTK_PARSER_DOT_PRODUCT 30
#define VTK_PARSER_VECTOR_ADD 31
......@@ -127,6 +127,10 @@ public:
vtkTypeMacro(vtkFunctionParser, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Return parser's MTime
unsigned long int GetMTime();
// Description:
// Set/Get input string to evaluate.
void SetFunction(const char *function);
......
......@@ -21,7 +21,7 @@ find_package(VTK COMPONENTS
vtkIOLegacy
vtkIOXML
vtkInteractionStyle
vtkRenderingOpenGL
vtkRendering${VTK_RENDERING_BACKEND}
vtkTestingCore
)
include(${VTK_USE_FILE})
......
......@@ -14,7 +14,7 @@ find_package(VTK COMPONENTS
vtkFiltersSources
vtkInteractionStyle
vtkRenderingLabel
vtkRenderingOpenGL
vtkRendering${VTK_RENDERING_BACKEND}
)
include(${VTK_USE_FILE})
......
cmake_minimum_required(VERSION 2.6.3 FATAL_ERROR)
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW) # CMake 3.1
endif()
#
# Set the project name.
......
cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
......@@ -29,7 +32,6 @@ else()
add_subdirectory(DataManipulation/Cxx)
add_subdirectory(ImageProcessing/Cxx)
add_subdirectory(IO/Cxx)
add_subdirectory(LIC/Cxx)
add_subdirectory(Medical/Cxx)
add_subdirectory(Modelling/Cxx)
add_subdirectory(MultiBlock/Cxx)
......@@ -44,6 +46,10 @@ else()
add_subdirectory(VolumeRendering/Cxx)
add_subdirectory(Widgets/Cxx)
add_subdirectory(ParallelProcessing/SMP)
if(VTK_RENDERING_BACKEND STREQUAL "OpenGL")
add_subdirectory(LIC/Cxx)
endif()
# if(vtkParallelCore_LOADED)
# add_subdirectory(ParallelProcessing/Generic)
# endif()
......@@ -61,20 +67,18 @@ else()
add_subdirectory(Build/vtkMy)
add_subdirectory(Infovis/Cxx)
# add_subdirectory(GUI/Motif)
#
# IF(VTK_USE_INFOVIS)
# IF(VTK_USE_CHARTS)
# add_subdirectory(Charts/Cxx)
# ENDIF()
# add_subdirectory(Infovis/Cxx)
# IF(VTK_USE_N_WAY_ARRAYS)
# add_subdirectory(Array/Cxx)
# ENDIF()
# ENDIF()
# IF(VTK_USE_QVTK)
# add_subdirectory(GUI/Qt)
# ENDIF()
# IF(WIN32)
# add_subdirectory(GUI/Win32/SimpleCxx)
# IF(VTK_USE_MFC)
......
......@@ -13,7 +13,7 @@ find_package(VTK COMPONENTS
vtkCommonDataModel
vtkFiltersGeometry
vtkInteractionStyle
vtkRenderingOpenGL
vtkRendering${VTK_RENDERING_BACKEND}
)
include(${VTK_USE_FILE})
......
......@@ -5,6 +5,9 @@ endif()
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW) # CMake 3.0
endif()
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW) # CMake 3.1
endif()
......
......@@ -5,6 +5,9 @@ endif()
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW) # CMake 3.0
endif()
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW) # CMake 3.1
endif()
......
......@@ -5,6 +5,9 @@ endif()
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW) # CMake 3.0
endif()
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW) # CMake 3.1
endif()
......@@ -14,7 +17,7 @@ find_package(VTK COMPONENTS
vtkGUISupportQt
vtkIOImage
vtkInteractionImage
vtkRenderingOpenGL
vtkRendering${VTK_RENDERING_BACKEND}
vtkTestingCore
)
include(${VTK_USE_FILE})
......
......@@ -5,6 +5,9 @@ endif()
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW) # CMake 3.0
endif()
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW) # CMake 3.1
endif()
......@@ -15,7 +18,7 @@ find_package(VTK COMPONENTS
vtkFiltersCore
vtkInfovisCore
vtkInteractionStyle
vtkRenderingFreeTypeOpenGL
vtkRenderingFreeType${VTK_RENDERING_BACKEND}
vtkViewsQt
)
include(${VTK_USE_FILE})
......
......@@ -12,7 +12,7 @@ find_package(VTK COMPONENTS
vtkIOImage
vtkImagingCore
vtkInteractionStyle
vtkRenderingOpenGL
vtkRendering${VTK_RENDERING_BACKEND}
vtkTestingRendering
)
include(${VTK_USE_FILE})
......
PROJECT(Infovis)
IF(NOT VTK_BINARY_DIR)
FIND_PACKAGE(VTK REQUIRED)
IF(NOT VTK_USE_RENDERING)
MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires VTK_USE_RENDERING.")
ENDIF()
IF(NOT VTK_USE_INFOVIS)
MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires VTK_USE_INFOVIS.")
ENDIF()
INCLUDE(${VTK_USE_FILE})
ENDIF()
ADD_EXECUTABLE(TreeLayout TreeLayout.cxx)
TARGET_LINK_LIBRARIES(TreeLayout vtkInfovis vtkRendering vtkImaging vtkIO)
IF(VTK_USE_VIEWS)
ADD_EXECUTABLE(HelloWorld HelloWorld.cxx)
TARGET_LINK_LIBRARIES(HelloWorld vtkViews vtkInfovis vtkRendering vtkImaging vtkIO)
ADD_EXECUTABLE(Theme Theme.cxx)
TARGET_LINK_LIBRARIES(Theme vtkViews vtkInfovis vtkRendering vtkImaging vtkIO)
ADD_EXECUTABLE(CreateTree CreateTree.cxx)
TARGET_LINK_LIBRARIES(CreateTree vtkViews vtkInfovis vtkRendering vtkImaging vtkIO)
ADD_EXECUTABLE(MultiView MultiView.cxx)
TARGET_LINK_LIBRARIES(MultiView vtkViews vtkInfovis vtkRendering vtkImaging vtkIO)
ENDIF()
# If Qt is enabled include the EasyView example
IF(VTK_USE_QVTK)
ADD_SUBDIRECTORY(EasyView)
ADD_SUBDIRECTORY(CustomLinkView)
ADD_SUBDIRECTORY(StatsView)
ENDIF()
IF(VTK_USE_PARALLEL_BGL)
ADD_EXECUTABLE(ParallelBFS ParallelBFS.cxx)
cmake_minimum_required(VERSION 2.8.8)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
project(Infovis)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
add_executable(TreeLayout TreeLayout.cxx)
target_link_libraries(TreeLayout ${VTK_LIBRARIES})
if(vtkViewsInfovis_LOADED)
add_executable(HelloWorld HelloWorld.cxx)
target_link_libraries(HelloWorld ${VTK_LIBRARIES})
add_executable(Theme Theme.cxx)
target_link_libraries(Theme ${VTK_LIBRARIES})
add_executable(CreateTree CreateTree.cxx)
target_link_libraries(CreateTree ${VTK_LIBRARIES})
add_executable(MultiView MultiView.cxx)
target_link_LIBRARIES(MultiView ${VTK_LIBRARIES})
endif()
# If Qt is enabled include the QT based examples
if(vtkGUISupportQt_LOADED)
add_subdirectory(EasyView)
add_subdirectory(CustomLinkView)
add_subdirectory(StatsView)
endif()
if(vtkInfovisParallel_LOADED)
add_executable(ParallelBFS ParallelBFS.cxx)
find_package(MPI REQUIRED)