Verified Commit fbd6bdf2 authored by Lars Bilke's avatar Lars Bilke
Browse files

Refactored insitu functionality for current ParaView.

parent 55f9f314
......@@ -3,5 +3,15 @@ get_source_files(SOURCES)
# Library
ogs_add_library(InSituLib ${SOURCES})
if(BUILD_SHARED_LIBS)
install(TARGETS InSituLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
target_link_libraries(PUBLIC BaseLib PRIVATE MeshLib)
target_link_libraries(InSituLib
INTERFACE
VTK::PythonUsed
PRIVATE
ParaView::PythonCatalyst
VTK::CommonDataModel)
target_link_libraries(InSituLib PUBLIC BaseLib PRIVATE MeshLib)
......@@ -79,9 +79,10 @@ int VtkMappedMeshSource::RequestData(vtkInformation* /*request*/,
// Points
this->Points->Reset();
vtkNew<VtkMeshNodalCoordinatesTemplate<double>> nodeCoords;
VtkMeshNodalCoordinatesTemplate<double>* nodeCoords =
VtkMeshNodalCoordinatesTemplate<double>::New();
nodeCoords->SetNodes(_mesh->getNodes());
this->Points->SetData(nodeCoords.GetPointer());
this->Points->SetData(nodeCoords);
output->SetPoints(this->Points.GetPointer());
// Cells
......
......@@ -16,11 +16,6 @@
#include <vtkMappedDataArray.h>
#include <vtkObjectFactory.h> // for vtkStandardNewMacro
#include <vtkVersion.h>
#if VTK_MAJOR_VERSION < 7 || VTK_MAJOR_VERSION == 7 && VTK_MINOR_VERSION < 1
#include <vtkTypeTemplate.h> // For templated vtkObject API
#endif
namespace MeshLib
{
......@@ -30,24 +25,16 @@ namespace MeshLib
namespace MeshLib
{
template <class Scalar>
class VtkMeshNodalCoordinatesTemplate :
#if !(VTK_MAJOR_VERSION < 7 || VTK_MAJOR_VERSION == 7 && VTK_MINOR_VERSION < 1)
public vtkMappedDataArray<Scalar>
#else
public vtkTypeTemplate<VtkMeshNodalCoordinatesTemplate<Scalar>,
vtkMappedDataArray<Scalar>>
#endif // vtk version
class VtkMeshNodalCoordinatesTemplate : public vtkMappedDataArray<Scalar>
{
public:
#if !(VTK_MAJOR_VERSION < 7 || VTK_MAJOR_VERSION == 7 && VTK_MINOR_VERSION < 1)
vtkTemplateTypeMacro(VtkMeshNodalCoordinatesTemplate<Scalar>,
vtkMappedDataArray<Scalar>);
#else
vtkMappedDataArrayNewInstanceMacro(VtkMeshNodalCoordinatesTemplate<Scalar>);
#endif // vtk version
static VtkMeshNodalCoordinatesTemplate *New();
vtkAbstractTemplateTypeMacro(VtkMeshNodalCoordinatesTemplate<Scalar>, vtkMappedDataArray<Scalar>)
vtkMappedDataArrayNewInstanceMacro(
VtkMeshNodalCoordinatesTemplate<Scalar>) static VtkMeshNodalCoordinatesTemplate* New();
void PrintSelf(std::ostream& os, vtkIndent indent) override;
typedef typename Superclass::ValueType ValueType;
/// Pass the nodes from OGS mesh
void SetNodes(std::vector<MeshLib::Node*> const & nodes);
......@@ -101,20 +88,12 @@ public:
vtkIdType InsertNextValue(Scalar v) override;
void InsertValue(vtkIdType idx, Scalar v) override;
#if !(VTK_MAJOR_VERSION < 7 || VTK_MAJOR_VERSION == 7 && VTK_MINOR_VERSION < 1)
Scalar& GetValueReference(vtkIdType idx) const;
Scalar GetValue(vtkIdType idx) const override;
void GetTypedTuple(vtkIdType tupleId, Scalar* t) const override;
void SetTypedTuple(vtkIdType i, const Scalar* t) override;
void InsertTypedTuple(vtkIdType i, const Scalar* t) override;
vtkIdType InsertNextTypedTuple(const Scalar* t) override;
#else
Scalar GetValue(vtkIdType idx) override;
void GetTupleValue(vtkIdType idx, Scalar* t) override;
void SetTupleValue(vtkIdType i, const Scalar* t) override;
void InsertTupleValue(vtkIdType i, const Scalar* t) override;
vtkIdType InsertNextTupleValue(const Scalar* t) override;
#endif // vtk version
VtkMeshNodalCoordinatesTemplate(const VtkMeshNodalCoordinatesTemplate&) =
delete;
......@@ -127,6 +106,9 @@ protected:
const std::vector<MeshLib::Node*>* _nodes{nullptr};
private:
// VtkMeshNodalCoordinatesTemplate(const VtkMeshNodalCoordinatesTemplate&) = delete;
// void operator=(const VtkMeshNodalCoordinatesTemplate&) = delete;
vtkIdType Lookup(const Scalar &val, vtkIdType startIndex);
double* TempDoubleArray{nullptr};
};
......
......@@ -38,5 +38,5 @@ if(OGS_USE_PYTHON)
endif()
if(OGS_INSITU)
target_link_libraries(ProcessLib InSituLib)
target_link_libraries(ProcessLib PRIVATE InSituLib)
endif()
......@@ -71,8 +71,12 @@ endif()
if(OGS_USE_MPI)
set(VTK_COMPONENTS ${VTK_COMPONENTS} vtkIOParallelXML vtkParallelMPI)
endif()
find_package(VTK ${ogs.minimum_version.vtk} REQUIRED COMPONENTS ${VTK_COMPONENTS})
include(${VTK_USE_FILE})
if(OGS_INSITU)
find_package(ParaView REQUIRED)
else()
find_package(VTK ${ogs.minimum_version.vtk} REQUIRED COMPONENTS ${VTK_COMPONENTS})
include(${VTK_USE_FILE})
endif()
find_package(Eigen3 ${ogs.minimum_version.eigen} REQUIRED)
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment