#include "FITKCFDPostProbe.h" #include "FITKCFDPost3DManager.h" #include "FITKCFDPostData.h" #include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h" #include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h" #include #include #include #include #include #include #include #include #include namespace Interface { Interface::FITKCFDPostProbe::FITKCFDPostProbe(int parentID) { _CFDPostParentID = parentID; Interface::FITKCFDPost3DManager* dataManger = FITKAPP->getGlobalData()->getPostData()->getPostDataManager(); if (dataManger == nullptr)return; Interface::FITKAbstractCFDPostData* parentData = dataManger->getDataByID(_CFDPostParentID); if (parentData == nullptr)return; _polyData = vtkPolyData::New(); vtkSmartPointer points = vtkSmartPointer::New(); _polyData->SetPoints(points); vtkSmartPointer cellArray = vtkSmartPointer::New(); _polyData->SetPolys(cellArray); _probeFilter = vtkProbeFilter::New(); _probeFilter->SetInputData(0, _polyData); _probeFilter->SetInputData(1, parentData->getOutput()); vtkDataSetMapper* mapper = vtkDataSetMapper::New(); mapper->SetInputConnection(_probeFilter->GetOutputPort()); _mappers.append(mapper); } FITKCFDPostProbe::~FITKCFDPostProbe() { if (_polyData) { _polyData->Delete(); _polyData = nullptr; } if (_probeFilter) { _probeFilter->Delete(); _probeFilter = nullptr; } } FITKPostDataType FITKCFDPostProbe::getPostDataType() { return FITKPostDataType::Post_Probe; } vtkDataSet* FITKCFDPostProbe::getOutput() { if (_probeFilter == nullptr)return nullptr; return _probeFilter->GetOutput(); } vtkAlgorithmOutput* FITKCFDPostProbe::getOutputPort() { if (_probeFilter == nullptr)return nullptr; return _probeFilter->GetOutputPort(); } int FITKCFDPostProbe::insertPoint(double* point) { if (_polyData == nullptr)return -1; vtkPoints* points = _polyData->GetPoints(); if (points == nullptr)return -1; int pointID = points->InsertNextPoint(point); return pointID; } int FITKCFDPostProbe::getPointCount() { if (_polyData == nullptr)return 0; vtkPoints* vtkpoints = _polyData->GetPoints(); if (vtkpoints == nullptr)return 0; int pointNum = vtkpoints->GetNumberOfPoints(); return pointNum; } void FITKCFDPostProbe::getPointAtInter(double* point, int index) { if (index < 0 || index >= getPointCount())return; if (_polyData == nullptr)return; vtkPoints* vtkpoints = _polyData->GetPoints(); if (vtkpoints == nullptr)return; double* p = vtkpoints->GetPoint(index); point[0] = p[0]; point[1] = p[1]; point[2] = p[2]; } vtkPolyData* FITKCFDPostProbe::getPolyData() { return _polyData; } void FITKCFDPostProbe::reset() { if (_polyData == nullptr)return; if (_polyData->GetPoints()) { _polyData->GetPoints()->Reset(); } if (_polyData->GetPolys()) { _polyData->GetPolys()->Reset(); } } }