diff --git a/Code/Mantid/Build/CMake/ParaViewSetup.cmake b/Code/Mantid/Build/CMake/ParaViewSetup.cmake index 06421815464c194899c27e74855d5813f4781ee8..91fb527a5559d67e7d7dbe247555c281099e8c6b 100644 --- a/Code/Mantid/Build/CMake/ParaViewSetup.cmake +++ b/Code/Mantid/Build/CMake/ParaViewSetup.cmake @@ -1,7 +1,7 @@ # This file will setup some common items that later setups depend on # Set the version of ParaView that is compatible with the Mantid code base -set ( COMPATIBLE_PARAVIEW_VERSION "4.3.1" ) +set ( COMPATIBLE_PARAVIEW_VERSION "4.3.b40280" ) # Set the name of the OSX application as this tends to be different set ( OSX_PARAVIEW_APP "paraview.app" ) diff --git a/Code/Mantid/Build/Jenkins/buildscript b/Code/Mantid/Build/Jenkins/buildscript index b3938615a1016d07fc45b99da23708cc1b09b3e9..56a4a9e709c6b439ce98552c490b11763f25549c 100755 --- a/Code/Mantid/Build/Jenkins/buildscript +++ b/Code/Mantid/Build/Jenkins/buildscript @@ -14,9 +14,9 @@ SCRIPT_DIR=$(dirname "$0") BUILDPKG=true ############################################################################### -# All node currently have PARAVIEW_DIR=3.98.1 and PARAVIEW_NEXT_DIR=4.3.1 +# All node currently have PARAVIEW_DIR=4.3.b40280 and PARAVIEW_NEXT_DIR=4.3.1 ############################################################################### -export PARAVIEW_DIR=${PARAVIEW_NEXT_DIR} +#export PARAVIEW_DIR=${PARAVIEW_DIR} ############################################################################### # Print out the versions of things we are using diff --git a/Code/Mantid/Build/Jenkins/buildscript.bat b/Code/Mantid/Build/Jenkins/buildscript.bat index 26bcc7cec9286b90adc377520295be9982df8b9a..a0e9bbd0a8d276964c488e086d045ca5c4e480cf 100755 --- a/Code/Mantid/Build/Jenkins/buildscript.bat +++ b/Code/Mantid/Build/Jenkins/buildscript.bat @@ -9,9 +9,8 @@ setlocal enableextensions enabledelayedexpansion ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: All node currently have PARAVIEW_DIR=3.98.1 and PARAVIEW_NEXT_DIR=4.3.1 +:: All nodes currently have PARAVIEW_DIR=4.3.b40280 and PARAVIEW_NEXT_DIR=4.3.1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -set PARAVIEW_DIR=%PARAVIEW_NEXT_DIR% set CMAKE_BIN_DIR=C:\Program Files (x86)\CMake 2.8\bin "%CMAKE_BIN_DIR%\cmake.exe" --version diff --git a/Code/Mantid/MantidPlot/make_package.rb.in b/Code/Mantid/MantidPlot/make_package.rb.in index 1d52b0a5615bd1f87251fc793d272b563a853cc4..08b7538811a1e875076fff0cdc7ce9e44556828b 100755 --- a/Code/Mantid/MantidPlot/make_package.rb.in +++ b/Code/Mantid/MantidPlot/make_package.rb.in @@ -4,19 +4,19 @@ require 'pathname' def copyFile(file) - p "copying file #{file}" - output = system("cp #{file} Contents/MacOS/") - if output != true - exit 1 - end + p "copying file #{file}" + output = system("cp #{file} Contents/MacOS/") + if output != true + exit 1 + end end def addPythonLibrary(directory) - p "copying directory #{directory}" - output = system("rsync -a --exclude=.pyc #{directory} Contents/MacOS/") - if output != true - exit 1 - end + p "copying directory #{directory}" + output = system("rsync -a --exclude=.pyc #{directory} Contents/MacOS/") + if output != true + exit 1 + end end lib_dir = Pathname.new("/usr/local/lib") @@ -67,38 +67,17 @@ library_filenames = ["libboost_regex-mt.dylib", #This copies the libraries over, then changes permissions and the id from /usr/local/lib to @rpath library_filenames.each do |filename| - if filename.include? "libssl.dylib" - copyFile(openssl_dir+filename) - elsif filename.include? "libcrypto.dylib" - copyFile(openssl_dir+filename) - else - copyFile(lib_dir+filename) - end - `chmod +w Contents/MacOS/#{filename}` - `install_name_tool -id @rpath/#{filename} Contents/MacOS/#{filename}` -end - -#use install_name_tool to change dependencies form /usr/local to libraries in the package. -search_patterns = ["**/*.dylib","**/*.so","**/MantidPlot","**/VatesSimpleGui"] -search_patterns.each do |pattern| - Dir[pattern].each do |library| - dependencies = `otool -L #{library}` - dependencies.split("\n").each do |dependency| - currentname = dependency.strip.split(" ") - name_split_on_slash = currentname[0].strip.split("/") - name_split_on_period = name_split_on_slash[-1].split(".") - prefix = name_split_on_period[0]+"." - library_filenames.each do |filename| - basename = File.basename(filename,"dylib") - if prefix == basename - `install_name_tool -change #{currentname[0]} @rpath/#{basename+"dylib"} #{library}` - end - end - end - end + if filename.include? "libssl.dylib" + copyFile(openssl_dir+filename) + elsif filename.include? "libcrypto.dylib" + copyFile(openssl_dir+filename) + else + copyFile(lib_dir+filename) + end + `chmod +w Contents/MacOS/#{filename}` + `install_name_tool -id @rpath/#{filename} Contents/MacOS/#{filename}` end - if( "@MAKE_VATES@" == "ON" ) def add_ParaView_Libraries(file) @@ -141,6 +120,7 @@ if( "@MAKE_VATES@" == "ON" ) `install_name_tool -id @rpath/#{filename_no_dir} Contents/Libraries/#{filename_no_dir}` end `install_name_tool -add_rpath @loader_path/../Libraries #{library} > /dev/null 2>&1` + `install_name_tool -add_rpath @loader_path/../MacOS #{library} > /dev/null 2>&1` `install_name_tool -change #{filename} @rpath/#{filename_no_dir} #{library}` end end @@ -148,6 +128,28 @@ if( "@MAKE_VATES@" == "ON" ) p "fixed #{issues_found} issues this iteration!" break if issues_found == 0 end + #fix libNonOrthogonalSource.dylib + `install_name_tool -id @rpath/libNonOrthogonalSource.dylib pvplugins/pvplugins/libNonOrthogonalSource.dylib` +end + +#use install_name_tool to change dependencies form /usr/local to libraries in the package. +search_patterns = ["**/*.dylib","**/*.so","**/MantidPlot","**/VatesSimpleGui"] +search_patterns.each do |pattern| + Dir[pattern].each do |library| + dependencies = `otool -L #{library}` + dependencies.split("\n").each do |dependency| + currentname = dependency.strip.split(" ") + name_split_on_slash = currentname[0].strip.split("/") + name_split_on_period = name_split_on_slash[-1].split(".") + prefix = name_split_on_period[0]+"." + library_filenames.each do |filename| + basename = File.basename(filename,"dylib") + if prefix == basename + `install_name_tool -change #{currentname[0]} @rpath/#{basename+"dylib"} #{library}` + end + end + end + end end #We'll use macdeployqt to fix qt dependencies. diff --git a/Code/Mantid/Vates/ParaviewPlugins/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/CMakeLists.txt index 0bbe7ce454abfee7198b8afc2122826000ba6665..51d5be27eb7f3aa09a3374d9624607c5ef7436e4 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/CMakeLists.txt @@ -1,6 +1,41 @@ # bring in Mantid/VATES API dependencies set_mantid_subprojects( Vates/VatesAPI ) +# NonOrthogonalSourcePlugin is necessary for viewing materials with nonorthogonal basis vectors. +# Copy it over to the pvplugins dir +if("${CMAKE_CFG_INTDIR}" STREQUAL ".") + # This is NOT a multi-configuration builder + find_library(NonOrthogonalSourcePlugin_LOCATION name NonOrthogonalSource HINTS ${ParaView_DIR}/lib) + file (COPY ${NonOrthogonalSourcePlugin_LOCATION} DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${PVPLUGINS_DIR}/${PVPLUGINS_SUBDIR}) +elseif(MSVC) + # find_library won't find dlls only import libraries so just hardcode them + # Release + set( _pvplugins_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Release/${PVPLUGINS_DIR}/${PVPLUGINS_SUBDIR} ) + set( RUNTIME_LIB ${ParaView_DIR}/bin/Release/NonOrthogonalSource.dll ) + if (NOT ${_pvplugins_dir} ) + file( MAKE_DIRECTORY ${_pvplugins_dir} ) + file( COPY ${RUNTIME_LIB} DESTINATION ${_pvplugins_dir} ) + endif () + set( NonOrthogonalSourcePlugin_LOCATION ${RUNTIME_LIB} ) + # Debug + set( RUNTIME_LIB_DEBUG ${ParaView_DIR}/bin/Debug/NonOrthogonalSource.dll ) + if (EXISTS ${RUNTIME_LIB_DEBUG}) + set( _pvplugins_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Debug/${PVPLUGINS_DIR}/${PVPLUGINS_SUBDIR} ) + if (NOT ${_pvplugins_dir} ) + file( MAKE_DIRECTORY ${_pvplugins_dir} ) + file( COPY ${RUNTIME_LIB_DEBUG} DESTINATION ${_pvplugins_dir} ) + endif () + # Don't install the debug as the packaging is broken under debug + endif() +else () + message ( WARNING "Unknown multi-configuration generator. Cannot copy NonOrthogonalSource plugin to our plugin directory." ) +endif() + +if ( (NOT APPLE) AND NonOrthogonalSourcePlugin_LOCATION) + # make_package.rb handles this for OSX + install( FILES ${NonOrthogonalSourcePlugin_LOCATION} DESTINATION ${PVPLUGINS_DIR}/${PVPLUGINS_SUBDIR} ) +endif() + add_subdirectory( ParaViewFilters ) add_subdirectory( ParaViewReaders ) add_subdirectory( ParaViewSources ) diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewWidgets/QtWidgets/CMakeLists.txt b/Code/Mantid/Vates/ParaviewPlugins/ParaViewWidgets/QtWidgets/CMakeLists.txt index 4484de7e620d6fad5964f34f3976bcbceed125e8..70f61b908f0220e2b066b150a36b41c63ef5ebf0 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewWidgets/QtWidgets/CMakeLists.txt +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewWidgets/QtWidgets/CMakeLists.txt @@ -39,7 +39,6 @@ add_library( MantidParaViewQtWidgets ${SRC_FILES} ${MOCCED_FILES} ${INC_FILES} ) set_property( TARGET MantidParaViewQtWidgets PROPERTY FOLDER "MantidVates" ) target_link_libraries( MantidParaViewQtWidgets LINK_PRIVATE vtkRenderingFreeType -vtkRenderingFreeTypeOpenGL ${QT_LIBRARIES} ${MANTID_SUBPROJECT_LIBS} ) diff --git a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h index 831df55d738a0ffa2ca7ccc7c7efe5c94dc99574..9ab6e54e648b69d98addda08a20d7145d7671868 100644 --- a/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h +++ b/Code/Mantid/Vates/VatesAPI/inc/MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h @@ -9,7 +9,7 @@ #include "MantidGeometry/MDGeometry/MDTypes.h" #include <string> -#include <vector> +#include <array> class vtkDataSet; class vtkUnstructuredGrid; @@ -83,6 +83,7 @@ namespace VATES Kernel::V3D m_basisY; ///< The Y direction basis vector Kernel::V3D m_basisZ; ///< The Z direction basis vector Kernel::SpecialCoordinateSystem m_coordType; ///< The coordinate system for the workspace + std::array<double, 6> m_boundingBox; }; diff --git a/Code/Mantid/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp b/Code/Mantid/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp index 5d06c8d01ff4d9aaef9e014735f75316eb000c94..319edd9f331cb6744b9b0288182b0d5613ed4703 100644 --- a/Code/Mantid/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp @@ -17,9 +17,15 @@ #include <boost/scoped_ptr.hpp> +#include <vtkPVChangeOfBasisHelper.h> #include <vtkFieldData.h> #include <vtkDataSet.h> +namespace { + +Mantid::Kernel::Logger g_log("MDHWLoadingPresenter"); +} + namespace Mantid { namespace VATES @@ -185,10 +191,12 @@ namespace Mantid */ void MDHWLoadingPresenter::setAxisLabels(vtkDataSet *visualDataSet) { - vtkFieldData* fieldData = visualDataSet->GetFieldData(); - setAxisLabel("AxisTitleForX", axisLabels[0], fieldData); - setAxisLabel("AxisTitleForY", axisLabels[1], fieldData); - setAxisLabel("AxisTitleForZ", axisLabels[2], fieldData); + if (!vtkPVChangeOfBasisHelper::AddBasisNames( + visualDataSet, axisLabels[0].c_str(), axisLabels[1].c_str(), + axisLabels[2].c_str())) { + g_log.warning("The basis names could not be added to the field data of " + "the data set.\n"); + } } /** diff --git a/Code/Mantid/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp b/Code/Mantid/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp index 22040df08d65b0cf245139904e4bef490e9ad193..64e8d97fc1c2f9123f9e9bdfc1ea0221a29b59da 100644 --- a/Code/Mantid/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp @@ -13,12 +13,14 @@ #include <vtkFloatArray.h> #include <vtkDoubleArray.h> #include <vtkMatrix3x3.h> +#include "vtkVector.h" #include <vtkNew.h> #include <vtkPoints.h> #include <vtkUnstructuredGrid.h> #include <vtkDataObject.h> #include <vtkMatrix4x4.h> #include <vtkSmartPointer.h> +#include <vtkPVChangeOfBasisHelper.h> #include <boost/algorithm/string/find.hpp> #include <stdexcept> @@ -26,9 +28,11 @@ using namespace Mantid; namespace { -void addChangeOfBasisMatrixToFieldData(vtkDataObject *dataObject, - const MantidVec &u, const MantidVec &v, - const MantidVec &w) { +Mantid::Kernel::Logger g_log("vtkDataSetToNonOrthogonalDataSet"); + +void addChangeOfBasisMatrixToFieldData( + vtkDataObject *dataObject, const MantidVec &u, const MantidVec &v, + const MantidVec &w, const std::array<double, 6> &boundingBox) { if (!dataObject) { throw std::invalid_argument("Change of basis needs a vtkDataObject"); @@ -44,21 +48,20 @@ void addChangeOfBasisMatrixToFieldData(vtkDataObject *dataObject, } vtkSmartPointer<vtkMatrix4x4> cobMatrix = - vtkSmartPointer<vtkMatrix4x4>::New(); - cobMatrix->Identity(); - std::copy(u.begin(), u.end(), cobMatrix->Element[0]); - std::copy(v.begin(), v.end(), cobMatrix->Element[1]); - std::copy(w.begin(), w.end(), cobMatrix->Element[2]); - - cobMatrix->Transpose(); - - vtkNew<vtkDoubleArray> cobArray; - cobArray->SetName("ChangeOfBasisMatrix"); - cobArray->SetNumberOfComponents(16); - cobArray->SetNumberOfTuples(1); - std::copy(&cobMatrix->Element[0][0], (&cobMatrix->Element[0][0]) + 16, - cobArray->GetPointer(0)); - dataObject->GetFieldData()->AddArray(cobArray.GetPointer()); + vtkPVChangeOfBasisHelper::GetChangeOfBasisMatrix( + vtkVector3d(&u[0]), vtkVector3d(&v[0]), vtkVector3d(&w[0])); + + if (!vtkPVChangeOfBasisHelper::AddChangeOfBasisMatrixToFieldData(dataObject, + cobMatrix)) { + g_log.warning("The Change-of-Basis-Matrix could not be added to the field " + "data of the data set.\n"); + } + + if (!vtkPVChangeOfBasisHelper::AddBoundingBoxInBasis(dataObject, + &boundingBox[0])) { + g_log.warning("The bounding box could not be added to the field data of " + "the data set.\n"); + } } } @@ -127,6 +130,14 @@ void vtkDataSetToNonOrthogonalDataSet::execute() { if (boost::algorithm::find_first(wsType, "MDHistoWorkspace")) { API::IMDHistoWorkspace_const_sptr infoWs = boost::dynamic_pointer_cast<const API::IMDHistoWorkspace>(ws); + + m_boundingBox[0] = infoWs->getDimension(0)->getMinimum(); + m_boundingBox[1] = infoWs->getDimension(0)->getMaximum(); + m_boundingBox[2] = infoWs->getDimension(1)->getMinimum(); + m_boundingBox[3] = infoWs->getDimension(1)->getMaximum(); + m_boundingBox[4] = infoWs->getDimension(2)->getMinimum(); + m_boundingBox[5] = infoWs->getDimension(2)->getMaximum(); + m_numDims = infoWs->getNumDims(); m_coordType = infoWs->getSpecialCoordinateSystem(); if (Kernel::HKL != m_coordType) { @@ -331,7 +342,8 @@ void vtkDataSetToNonOrthogonalDataSet::stripMatrix(Kernel::DblMatrix &mat) { void vtkDataSetToNonOrthogonalDataSet::updateMetaData(vtkUnstructuredGrid *ugrid) { // Create and add the change of basis matrix - addChangeOfBasisMatrixToFieldData(ugrid, m_basisX, m_basisY, m_basisZ); + addChangeOfBasisMatrixToFieldData(ugrid, m_basisX, m_basisY, m_basisZ, + m_boundingBox); } } // namespace VATES diff --git a/Code/Mantid/Vates/VatesSimpleGui/StandAloneExec/CMakeLists.txt b/Code/Mantid/Vates/VatesSimpleGui/StandAloneExec/CMakeLists.txt index 78aacd83ba3a130099d7d0ac72ea40aa7704655b..411e660230bd5bc704fc9115718974090f9b2c87 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/StandAloneExec/CMakeLists.txt +++ b/Code/Mantid/Vates/VatesSimpleGui/StandAloneExec/CMakeLists.txt @@ -48,7 +48,6 @@ VatesSimpleGuiQtWidgets VatesSimpleGuiViewWidgets MantidQtAPI vtkRenderingFreeType -vtkRenderingFreeTypeOpenGL ${POCO_LIBRARIES} ${Boost_LIBRARIES} ) diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt index 4d436b6790207699e844d05211b897d6ce7fbbe2..939d3b12451870f97ddcc9a985b429431bffa447 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt @@ -139,7 +139,6 @@ pqApplicationComponents pqComponents vtkPVServerManagerRendering vtkRenderingFreeType -vtkRenderingFreeTypeOpenGL vtksys ${QT_LIBRARIES} VatesSimpleGuiQtWidgets diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp index 77f992c50f0c451a32dc1e7598e589f6dc89fe22..e7deaefe48cf9c6078220fcc1c9bccb18535b7d1 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp @@ -83,7 +83,7 @@ pqRenderView* ViewBase::createRenderView(QWidget* widget, QString viewName) pqActiveObjects::instance().setActiveView(view); // Place the widget for the render view in the frame provided. - hbox->addWidget(view->getWidget()); + hbox->addWidget(view->widget()); /// Make a connection to the view's endRender signal for later checking. QObject::connect(view, SIGNAL(endRender()),