From d935bfa4e5e7cad4ab929420924c228e2bf4021c Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Thu, 16 Oct 2014 16:00:15 +0200 Subject: [PATCH] Changes based on comments. --- CMakeLists.txt | 2 +- FileIO/VtkIO/VtuInterface.cpp | 6 ++-- FileIO/VtkIO/VtuInterface.h | 12 ++++---- InSituLib/VtkMappedMesh.cpp | 10 +++---- InSituLib/VtkMappedMesh.h | 10 +++---- InSituLib/VtkMappedMeshSource.cpp | 29 +++++++++---------- InSituLib/VtkMappedMeshSource.h | 5 ++-- .../VtkMeshNodalCoordinatesTemplate-impl.h | 12 ++++---- scripts/cmake/ExternalProjectCatalyst.cmake | 6 ++-- scripts/cmake/ExternalProjectVtk.cmake | 4 +-- 10 files changed, 48 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 558755bd4a1..7962eebae1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,7 +102,7 @@ INCLUDE(scripts/cmake/Pack.cmake) # External projects OPTION(Boost_USE_STATIC_LIBS "This option has to be set from the command line (before boost gets found)!" OFF) INCLUDE(scripts/cmake/ExternalProjectBoost.cmake) -OPTION(OGS_SYSTEM_VTK_ONLY "If On VTK will be searched if installed and will not be build locally." OFF) +OPTION(OGS_SYSTEM_VTK_ONLY "If On VTK / ParaView will be searched if installed and will not be build locally." OFF) INCLUDE(scripts/cmake/ExternalProjectCatalyst.cmake) INCLUDE_DIRECTORIES( SYSTEM ${Boost_INCLUDE_DIRS} ) diff --git a/FileIO/VtkIO/VtuInterface.cpp b/FileIO/VtkIO/VtuInterface.cpp index 1a64695b7be..7d5b0c51558 100644 --- a/FileIO/VtkIO/VtuInterface.cpp +++ b/FileIO/VtkIO/VtuInterface.cpp @@ -13,14 +13,14 @@ #include "VtuInterface.h" -#include "Mesh.h" -#include "MeshGenerators/VtkMeshConverter.h" - #include "logog/include/logog.hpp" #include <vtkXMLUnstructuredGridReader.h> #include <vtkSmartPointer.h> +#include "Mesh.h" +#include "MeshGenerators/VtkMeshConverter.h" + namespace FileIO { diff --git a/FileIO/VtkIO/VtuInterface.h b/FileIO/VtkIO/VtuInterface.h index a867aa90832..d5daebeef75 100644 --- a/FileIO/VtkIO/VtuInterface.h +++ b/FileIO/VtkIO/VtuInterface.h @@ -12,13 +12,13 @@ * */ -#ifndef BOOSTVTUINTERFACE_H_ -#define BOOSTVTUINTERFACE_H_ - -#include "Writer.h" +#ifndef VTUINTERFACE_H_ +#define VTUINTERFACE_H_ #include <string> +#include "Writer.h" + namespace MeshLib { class Mesh; } @@ -39,7 +39,7 @@ public: static MeshLib::Mesh* readVTUFile(const std::string &file_name); /// Decide if the mesh data should be written compressed (default is false). - void setCompressData(bool flag=true) { _use_compressor = flag; }; + void setCompressData(bool flag=true) { _use_compressor = flag; } /// Sets the mesh to write. void setMesh(const MeshLib::Mesh* mesh); @@ -53,4 +53,4 @@ private: } -#endif /* BOOSTVTUINTERFACE_H_ */ +#endif /* VTUINTERFACE_H_ */ diff --git a/InSituLib/VtkMappedMesh.cpp b/InSituLib/VtkMappedMesh.cpp index 042f577031e..b7a1cd4678e 100644 --- a/InSituLib/VtkMappedMesh.cpp +++ b/InSituLib/VtkMappedMesh.cpp @@ -14,9 +14,7 @@ #include "VtkMappedMesh.h" -#include "Element.h" -#include "MeshLib/Node.h" -#include "MeshEnums.h" +#include <algorithm> #include "logog/include/logog.hpp" @@ -27,7 +25,9 @@ #include <vtkObjectFactory.h> #include <vtkPoints.h> -#include <algorithm> +#include "Element.h" +#include "MeshLib/Node.h" +#include "MeshEnums.h" namespace InSituLib { @@ -92,7 +92,7 @@ int VtkMappedMeshImpl::GetCellType(vtkIdType cellId) void VtkMappedMeshImpl::GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) { - const MeshLib::Element* elem = (*_elements)[cellId]; + const MeshLib::Element* const elem = (*_elements)[cellId]; const unsigned numNodes(elem->getNNodes()); const MeshLib::Node* const* nodes = (*_elements)[cellId]->getNodes(); ptIds->SetNumberOfIds(numNodes); diff --git a/InSituLib/VtkMappedMesh.h b/InSituLib/VtkMappedMesh.h index 066b9c4ff67..7535891b8f0 100644 --- a/InSituLib/VtkMappedMesh.h +++ b/InSituLib/VtkMappedMesh.h @@ -17,11 +17,11 @@ #ifndef VTKMAPPEDMESH_H_ #define VTKMAPPEDMESH_H_ -#include "MeshEnums.h" - #include <vtkObject.h> #include <vtkMappedUnstructuredGrid.h> +#include "MeshEnums.h" + class vtkGenericCell; namespace MeshLib { class Element; @@ -76,9 +76,6 @@ private: MeshElemType ogs; switch (type) { - case 0: - ogs = MeshElemType::INVALID; - break; case VTK_LINE: ogs = MeshElemType::LINE; break; @@ -100,6 +97,9 @@ private: case VTK_PYRAMID: ogs = MeshElemType::PYRAMID; break; + default: + ogs = MeshElemType::INVALID; + break; } return ogs; } diff --git a/InSituLib/VtkMappedMeshSource.cpp b/InSituLib/VtkMappedMeshSource.cpp index ba23c01440e..70f97d59453 100644 --- a/InSituLib/VtkMappedMeshSource.cpp +++ b/InSituLib/VtkMappedMeshSource.cpp @@ -14,23 +14,22 @@ #include "VtkMappedMeshSource.h" -#include "VtkMappedMesh.h" -#include "VtkMeshNodalCoordinatesTemplate.h" -//#include "vtkCPExodusIIResultsArrayTemplate.h" - #include "logog/include/logog.hpp" -#include "vtkCellData.h" -#include "vtkDemandDrivenPipeline.h" -#include "vtkStreamingDemandDrivenPipeline.h" -#include "vtkDoubleArray.h" -#include "vtkInformation.h" -#include "vtkInformationVector.h" -#include "vtkObjectFactory.h" -#include "vtkPointData.h" -#include "vtkPoints.h" -#include "vtkUnstructuredGrid.h" -#include "vtkIdTypeArray.h" +#include <vtkCellData.h> +#include <vtkDemandDrivenPipeline.h> +#include <vtkStreamingDemandDrivenPipeline.h> +#include <vtkDoubleArray.h> +#include <vtkInformation.h> +#include <vtkInformationVector.h> +#include <vtkObjectFactory.h> +#include <vtkPointData.h> +#include <vtkPoints.h> +#include <vtkUnstructuredGrid.h> +#include <vtkIdTypeArray.h> + +#include "VtkMappedMesh.h" +#include "VtkMeshNodalCoordinatesTemplate.h" namespace InSituLib { diff --git a/InSituLib/VtkMappedMeshSource.h b/InSituLib/VtkMappedMeshSource.h index 6cfcb3212d4..f0b52eca23b 100644 --- a/InSituLib/VtkMappedMeshSource.h +++ b/InSituLib/VtkMappedMeshSource.h @@ -23,11 +23,12 @@ #ifndef _VTKMAPPEDMESHSOURCE #define _VTKMAPPEDMESHSOURCE -#include "vtkUnstructuredGridAlgorithm.h" -#include "vtkNew.h" #include <string> #include <vector> +#include "vtkUnstructuredGridAlgorithm.h" +#include "vtkNew.h" + class vtkDataArrayCollection; class vtkPointData; class vtkPoints; diff --git a/InSituLib/VtkMeshNodalCoordinatesTemplate-impl.h b/InSituLib/VtkMeshNodalCoordinatesTemplate-impl.h index dc17dd67593..9f6851a7f96 100644 --- a/InSituLib/VtkMeshNodalCoordinatesTemplate-impl.h +++ b/InSituLib/VtkMeshNodalCoordinatesTemplate-impl.h @@ -14,13 +14,13 @@ #include "VtkMeshNodalCoordinatesTemplate.h" -#include "MeshLib/Node.h" - #include <vtkIdList.h> #include <vtkObjectFactory.h> #include <vtkVariant.h> #include <vtkVariantCast.h> +#include "MeshLib/Node.h" + namespace InSituLib { // Can't use vtkStandardNewMacro with a template. @@ -74,7 +74,7 @@ template <class Scalar> void VtkMeshNodalCoordinatesTemplate<Scalar> return; } - vtkIdType numTuples = ptIds->GetNumberOfIds(); + const vtkIdType numTuples = ptIds->GetNumberOfIds(); outArray->SetNumberOfComponents(this->NumberOfComponents); outArray->SetNumberOfTuples(numTuples); @@ -163,9 +163,9 @@ template <class Scalar> double* VtkMeshNodalCoordinatesTemplate<Scalar> template <class Scalar> void VtkMeshNodalCoordinatesTemplate<Scalar> ::GetTuple(vtkIdType i, double *tuple) { - tuple[0] = static_cast<double>((*(*this->_nodes)[i])[0]); - tuple[1] = static_cast<double>((*(*this->_nodes)[i])[1]); - tuple[2] = static_cast<double>((*(*this->_nodes)[i])[2]); + tuple[0] = (*(*this->_nodes)[i])[0]; + tuple[1] = (*(*this->_nodes)[i])[1]; + tuple[2] = (*(*this->_nodes)[i])[2]; } template <class Scalar> vtkIdType VtkMeshNodalCoordinatesTemplate<Scalar> diff --git a/scripts/cmake/ExternalProjectCatalyst.cmake b/scripts/cmake/ExternalProjectCatalyst.cmake index 045c4048487..7f37f27cc9c 100644 --- a/scripts/cmake/ExternalProjectCatalyst.cmake +++ b/scripts/cmake/ExternalProjectCatalyst.cmake @@ -50,7 +50,7 @@ IF(ParaView_FOUND AND VTKIO_LIB_FOUND) INCLUDE_DIRECTORIES(SYSTEM ${DIR}/../cxx ${DIR}/include) ENDIF() ENDFOREACH() - MESSAGE("Using ParaView in ${ParaView_DIR}") + MESSAGE(STATUS "Using ParaView in ${ParaView_DIR}") RETURN() ELSEIF(NOT ParaView_DIR) # If ParaView was not found check for VTK @@ -65,7 +65,7 @@ ELSEIF(NOT ParaView_DIR) ENDIF() ENDFOREACH() INCLUDE_DIRECTORIES(SYSTEM ${VTK_DIR}/../ThirdParty/netcdf/vtknetcdf/cxx) - MESSAGE("Using VTK in ${VTK_DIR}") + MESSAGE(STATUS "Using VTK in ${VTK_DIR}") RETURN() ELSE() # If nothing was found build ParaView as an external project @@ -95,7 +95,7 @@ ELSE() SET(CATALYST_CONFIGURE_COMMAND cmake.sh) ENDIF() -MESSAGE("Building ParaView as an external project in the build directory") +MESSAGE(STATUS "Building ParaView as an external project in the build directory") ExternalProject_Add(Catalyst PREFIX ${CMAKE_BINARY_DIR}/External/catalyst GIT_REPOSITORY ${CATALYST_GIT_URL} diff --git a/scripts/cmake/ExternalProjectVtk.cmake b/scripts/cmake/ExternalProjectVtk.cmake index 933cb53beba..22716c157c1 100644 --- a/scripts/cmake/ExternalProjectVtk.cmake +++ b/scripts/cmake/ExternalProjectVtk.cmake @@ -54,8 +54,8 @@ IF(NOT VTK_DIR) ENDIF() ENDIF() -IF(OGS_SYSTEM_VTK_ONLY AND NOT VTK_FOUND) - MESSAGE(FATAL_ERROR "Vtk was not found but is required! Try to set VTK_DIR to its install or build directory.") +IF(OGS_SYSTEM_VTK_ONLY AND NOT VTK_FOUND AND NOT ParaView_FOUND) + MESSAGE(FATAL_ERROR "Vtk / ParaView was not found but is required! Try to set VTK_DIR or ParaView_DIR to its install or build directory.") ENDIF() IF(VTK_FOUND) -- GitLab