diff --git a/Plugins/LagrangianParticleTracker/Filters/LagrangianParticleTracker.xml b/Plugins/LagrangianParticleTracker/Filters/LagrangianParticleTracker.xml index a65470d869f15c6d5861529c842b801b0c73d059..3250a7390e77e9f1e3d1290fbecc7812f050a0fc 100644 --- a/Plugins/LagrangianParticleTracker/Filters/LagrangianParticleTracker.xml +++ b/Plugins/LagrangianParticleTracker/Filters/LagrangianParticleTracker.xml @@ -200,6 +200,7 @@ number_of_elements="5"> This property contains the name of the vector array from the seeds to use as initial particle velocity. - - - Set whether to use an initial integration time array from input - instead of zero values. - - - - @@ -237,11 +228,6 @@ name="DummySource" /> - - - - - This property contains the name of the scalar array from the seeds to use as initial particle integration time. @@ -307,6 +293,31 @@ + + + + + + + + This property contains the name of + the array to use as flow velocity. + + - - This property specifies the input used to obtain the seed points to generate particles. @@ -626,6 +631,14 @@ This property specifies the integration model to use to generate data. + + + + + Specify the locator used to locate cells in the flow input + IntegrationModel = vtkLagrangianMatidaIntegrationModel::New(); -} - -//--------------------------------------------------------------------------- -vtkLagrangianHelperBase::~vtkLagrangianHelperBase() -{ - this->SetIntegrationModel(nullptr); -} - //---------------------------------------------------------------------------- void vtkLagrangianHelperBase::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); - os << indent << "IntegrationModel: " << this->IntegrationModel << endl; } //---------------------------------------------------------------------------- diff --git a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianHelperBase.h b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianHelperBase.h index 801d19766bc4f4cc26b2c2011085d7e5c08bf85c..ca403b4ee128267a9f6d36cfeadf89b0ed2e4374 100644 --- a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianHelperBase.h +++ b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianHelperBase.h @@ -18,8 +18,6 @@ * * * This is an abstract class for Lagrangian helper - * It defines the integration model - * as well as the SetArrayToGenerate method signature */ #ifndef vtkLagrangianHelperBase_h @@ -28,21 +26,12 @@ #include "vtkDataObjectAlgorithm.h" #include "vtkLagrangianParticleTrackerModule.h" // for export macro -class vtkLagrangianBasicIntegrationModel; class VTKLAGRANGIANPARTICLETRACKER_EXPORT vtkLagrangianHelperBase : public vtkDataObjectAlgorithm { public: vtkTypeMacro(vtkLagrangianHelperBase, vtkDataObjectAlgorithm); void PrintSelf(ostream& os, vtkIndent indent) override; - //@{ - /** - * Set/Get the integration model. - */ - void SetIntegrationModel(vtkLagrangianBasicIntegrationModel* integrationModel); - vtkGetObjectMacro(IntegrationModel, vtkLagrangianBasicIntegrationModel); - //@} - /** * Remove all arrays to generate, no more array will be generated */ @@ -60,16 +49,14 @@ public: int secondInt, const char* arrayValues) = 0; protected: - vtkLagrangianHelperBase(); - ~vtkLagrangianHelperBase() override; + vtkLagrangianHelperBase() = default; + ~vtkLagrangianHelperBase() override = default; /** * Parse string array and extract double components from it. */ bool ParseDoubleValues(const char*& arrayString, int numberOfComponents, double* array); - vtkLagrangianBasicIntegrationModel* IntegrationModel; - class vtkInternals; vtkInternals* Internals; diff --git a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSeedHelper.cxx b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSeedHelper.cxx index 0d97e36c40e725a1dd7764937ae399a68cf0f257..2d0238d0c742e3fc8213ac927c981664a4ec4839 100644 --- a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSeedHelper.cxx +++ b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSeedHelper.cxx @@ -15,6 +15,7 @@ #include "vtkLagrangianSeedHelper.h" +#include "vtkAbstractCellLocator.h" #include "vtkCell.h" #include "vtkCellData.h" #include "vtkCompositeDataIterator.h" @@ -25,7 +26,7 @@ #include "vtkExecutive.h" #include "vtkInformation.h" #include "vtkInformationVector.h" -#include "vtkLagrangianBasicIntegrationModel.h" +#include "vtkLagrangianMatidaIntegrationModel.h" #include "vtkLagrangianParticle.h" #include "vtkNew.h" #include "vtkObjectFactory.h" @@ -35,6 +36,8 @@ #include vtkStandardNewMacro(vtkLagrangianSeedHelper); +vtkCxxSetSmartPointerMacro(vtkLagrangianSeedHelper, IntegrationModel, vtkLagrangianBasicIntegrationModel); +vtkCxxSetSmartPointerMacro(vtkLagrangianSeedHelper, Locator, vtkAbstractCellLocator); class vtkLagrangianSeedHelper::vtkInternals { @@ -66,16 +69,14 @@ public: //--------------------------------------------------------------------------- vtkLagrangianSeedHelper::vtkLagrangianSeedHelper() + : Internals(new vtkLagrangianSeedHelper::vtkInternals()) { - this->Internals = new vtkInternals(); + this->IntegrationModel = vtkSmartPointer::New(); this->SetNumberOfInputPorts(2); } //--------------------------------------------------------------------------- -vtkLagrangianSeedHelper::~vtkLagrangianSeedHelper() -{ - delete this->Internals; -} +vtkLagrangianSeedHelper::~vtkLagrangianSeedHelper() = default; //--------------------------------------------------------------------------- void vtkLagrangianSeedHelper::SetSourceConnection(vtkAlgorithmOutput* algInput) @@ -109,6 +110,7 @@ int vtkLagrangianSeedHelper::RequestData( // Clear previously setup flow this->IntegrationModel->ClearDataSets(); + this->IntegrationModel->SetLocator(this->Locator); // Check flow dataset type vtkCompositeDataSet* hdFlow = vtkCompositeDataSet::SafeDownCast(flow); diff --git a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSeedHelper.h b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSeedHelper.h index ce9fbe8bbd9338316e66f982e766fad03d9b8d53..dd340fe65b8530a0b16ec713542ec7841f11e685 100644 --- a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSeedHelper.h +++ b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSeedHelper.h @@ -27,7 +27,12 @@ #include "vtkLagrangianHelperBase.h" #include "vtkLagrangianParticleTrackerModule.h" // for export macro +#include "vtkSmartPointer.h" // for SmartPointer +#include + +class vtkLagrangianBasicIntegrationModel; +class vtkAbstractCellLocator; class VTKLAGRANGIANPARTICLETRACKER_EXPORT vtkLagrangianSeedHelper : public vtkLagrangianHelperBase { public: @@ -41,6 +46,16 @@ public: CONSTANT = 1 }; + /** + * Set the integration model. + */ + void SetIntegrationModel(vtkLagrangianBasicIntegrationModel* integrationModel); + + /** + * Set the locator. + */ + void SetLocator(vtkAbstractCellLocator* locator); + /** * Set/Get the seed source input */ @@ -81,8 +96,11 @@ protected: int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; + vtkSmartPointer IntegrationModel; + vtkSmartPointer Locator; + class vtkInternals; - vtkInternals* Internals; + std::unique_ptr Internals; private: vtkLagrangianSeedHelper(const vtkLagrangianSeedHelper&) = delete; diff --git a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSurfaceHelper.cxx b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSurfaceHelper.cxx index b9bf0baca3ff36c37687ea8ef31c24ff91c41e6d..58f9459d09121478c4c90d58fb19c3157d2c5c3d 100644 --- a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSurfaceHelper.cxx +++ b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSurfaceHelper.cxx @@ -24,7 +24,6 @@ #include "vtkFieldData.h" #include "vtkInformation.h" #include "vtkInformationVector.h" -#include "vtkLagrangianBasicIntegrationModel.h" #include "vtkNew.h" #include "vtkObjectFactory.h" #include "vtkSmartPointer.h" @@ -60,35 +59,6 @@ vtkLagrangianSurfaceHelper::~vtkLagrangianSurfaceHelper() delete this->Internals; } -//--------------------------------------------------------------------------- -int vtkLagrangianSurfaceHelper::RequestInformation(vtkInformation* vtkNotUsed(request), - vtkInformationVector** inputVector, vtkInformationVector* vtkNotUsed(outputVector)) -{ - // Add input to the model so it will be able to use it to compute default values - this->IntegrationModel->ClearDataSets(true); - vtkDataObject* input = vtkDataObject::GetData(inputVector[0]); - vtkCompositeDataSet* hdInput = vtkCompositeDataSet::SafeDownCast(input); - vtkDataSet* dsInput = vtkDataSet::SafeDownCast(input); - if (hdInput) - { - vtkSmartPointer iter; - iter.TakeReference(hdInput->NewIterator()); - for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem()) - { - vtkDataSet* inDataset = vtkDataSet::SafeDownCast(hdInput->GetDataSet(iter)); - if (inDataset) - { - this->IntegrationModel->AddDataSet(inDataset, true, iter->GetCurrentFlatIndex()); - } - } - } - else if (dsInput) - { - this->IntegrationModel->AddDataSet(dsInput, true); - } - return 1; -} - //--------------------------------------------------------------------------- int vtkLagrangianSurfaceHelper::RequestData( vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector) diff --git a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSurfaceHelper.h b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSurfaceHelper.h index e35553055af0a39b17d1ebfb8acced6efba2deb7..ba855e7df36bd15a74dae027fd9b987cce7f0b67 100644 --- a/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSurfaceHelper.h +++ b/Plugins/LagrangianParticleTracker/Filters/vtkLagrangianSurfaceHelper.h @@ -57,12 +57,6 @@ protected: vtkLagrangianSurfaceHelper(); ~vtkLagrangianSurfaceHelper() override; - /** - * Fill the model with inputs if any. - */ - int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector, - vtkInformationVector* outputVector) override; - /** * Creates the same output type as the input type. */ diff --git a/Plugins/LagrangianParticleTracker/Testing/LagrangianParticleTrackerReseeding.xml b/Plugins/LagrangianParticleTracker/Testing/LagrangianParticleTrackerReseeding.xml index 62511d3c67228d4f1c1b59458c496ec16466327d..51d3fa96d00f8b174083144e62f774df784a3ec4 100644 --- a/Plugins/LagrangianParticleTracker/Testing/LagrangianParticleTrackerReseeding.xml +++ b/Plugins/LagrangianParticleTracker/Testing/LagrangianParticleTrackerReseeding.xml @@ -71,7 +71,6 @@ - diff --git a/Plugins/LagrangianParticleTracker/pqIntegrationModelSurfaceHelperWidget.cxx b/Plugins/LagrangianParticleTracker/pqIntegrationModelSurfaceHelperWidget.cxx index 2ea97aa8fece4dd7c630a8aac1e2bc40031e452c..fa1e176cd75aa7cbdc843bb3c17b97c20b395b16 100644 --- a/Plugins/LagrangianParticleTracker/pqIntegrationModelSurfaceHelperWidget.cxx +++ b/Plugins/LagrangianParticleTracker/pqIntegrationModelSurfaceHelperWidget.cxx @@ -179,6 +179,7 @@ void pqIntegrationModelSurfaceHelperWidget::resetSurfaceWidget(bool force) enumIndex++; // Add a row for each leaf + double defaultValue = 0; for (unsigned int j = 0; j < nLeafs; j++) { QStandardItem* item; @@ -191,9 +192,10 @@ void pqIntegrationModelSurfaceHelperWidget::resetSurfaceWidget(bool force) { item = new QStandardItem(); model->setItem(j, k, item); - double defaultValue = 0; if (defaultValuesIndex < defaultValuesProp->GetNumberOfElements()) { + // defaultValue can be set only once and will be used all the time + // or can be set multiple times if provided defaultValue = defaultValuesProp->GetElement(defaultValuesIndex); defaultValuesIndex++; } diff --git a/VTK b/VTK index 3b249310b0ebec3a9aabfd65bfeabb0e46dfd266..bcfaf22150a1646c4b6f313861d6aa06407180f9 160000 --- a/VTK +++ b/VTK @@ -1 +1 @@ -Subproject commit 3b249310b0ebec3a9aabfd65bfeabb0e46dfd266 +Subproject commit bcfaf22150a1646c4b6f313861d6aa06407180f9