1 // Copyright (C) 2021 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #ifndef vtkRateOfFlowThroughSection_h__
22 #define vtkRateOfFlowThroughSection_h__
24 #include <vtkDataObjectAlgorithm.h>
25 #include "vtkExplodePolyLine.h"
26 #include <vtkAdjacentVertexIterator.h>
27 #include <vtkAlgorithmOutput.h>
29 #include <vtkCellData.h>
30 #include <vtkCellType.h>
31 #include <vtkCharArray.h>
32 #include <vtkDataArraySelection.h>
33 #include <vtkDataObjectTreeIterator.h>
35 #include <vtkDataSet.h>
36 #include <vtkDataSetAttributes.h>
37 #include <vtkDemandDrivenPipeline.h>
38 #include <vtkDoubleArray.h>
39 #include <vtkExecutive.h>
40 #include <vtkDoubleArray.h>
41 #include <vtkInEdgeIterator.h>
42 #include <vtkInformation.h>
43 #include <vtkInformationDataObjectKey.h>
44 #include <vtkInformationStringKey.h>
45 #include <vtkInformationVector.h>
46 #include <vtkIntArray.h>
47 #include <vtkMultiBlockDataSet.h>
48 #include <vtkMutableDirectedGraph.h>
50 #include <vtkObjectFactory.h>
51 #include <vtkPointData.h>
52 #include <vtkPolyData.h>
53 #include <vtkResampleWithDataSet.h>
54 #include <vtkStreamingDemandDrivenPipeline.h>
55 #include <vtkStringArray.h>
57 #include <vtkTimeStamp.h>
58 #include <vtkUnsignedCharArray.h>
59 #include <vtkUnstructuredGrid.h>
60 #include <vtkVariantArray.h>
61 #include <vtkWarpScalar.h>
62 #include <vtkSetGet.h>
64 #include "VTKToMEDMem.h"
70 class vtkMutableDirectedGraph;
72 class VTK_EXPORT vtkRateOfFlowThroughSection : public vtkDataObjectAlgorithm
75 static vtkRateOfFlowThroughSection *New();
76 vtkTypeMacro(vtkRateOfFlowThroughSection, vtkDataObjectAlgorithm);
77 void PrintSelf(ostream &os, vtkIndent indent) override;
79 void SetSourceData(vtkDataObject *input);
81 void SetSourceConnection(vtkAlgorithmOutput *algOutput);
83 int FillOutputPortInformation(int, vtkInformation *) override;
86 vtkRateOfFlowThroughSection();
87 ~vtkRateOfFlowThroughSection() override;
89 int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
90 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
91 int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
93 int NumberOfTimeSteps;
96 class VTK_EXPORT vtkInternal {
99 void pushData(double timeStep, double value) { _data.emplace_back(timeStep, value); }
100 void fillTable(vtkTable *table) const;
101 void analyzeInputDataSets(vtkUnstructuredGrid *ds1, vtkDataSet *ds2);
102 bool computationNeeded() const
104 if (_recomputationOfMatrixNeeded)
108 return _recomputationOfMatrixNeeded;
110 std::vector<std::map<int, double>> &getMatrix() { return _matrix; }
111 void setOrtho(const MEDCoupling::DataArrayDouble *ortho) { _ortho.takeRef(ortho); }
112 const MEDCoupling::DataArrayDouble *getOrtho() const { return (const MEDCoupling::DataArrayDouble *)_ortho; }
113 void setMeasure(const MEDCoupling::DataArrayDouble *measure) { _measure.takeRef(measure); }
114 const MEDCoupling::DataArrayDouble *getMeasure() { return (const MEDCoupling::DataArrayDouble *)_measure; }
117 std::vector<std::pair<double, double>> _data;
118 vtkMTimeType _mt1 = 0;
119 vtkMTimeType _mt2 = 0;
120 mutable std::vector<std::map<int, double>> _matrix;
121 bool _recomputationOfMatrixNeeded = true;
122 MEDCoupling::MCConstAuto<MEDCoupling::DataArrayDouble> _ortho;
123 MEDCoupling::MCConstAuto<MEDCoupling::DataArrayDouble> _measure;
126 vtkInternal *Internal;
129 vtkRateOfFlowThroughSection(const vtkRateOfFlowThroughSection &) = delete;
130 void operator=(const vtkRateOfFlowThroughSection &) = delete;