18 #ifndef QGSMESHCALCUTILS_H
19 #define QGSMESHCALCUTILS_H
25 #include <QStringList>
37 #include "qgis_analysis.h"
39 struct QgsMeshMemoryDatasetGroup;
40 struct QgsMeshMemoryDataset;
51 class ANALYSIS_EXPORT QgsMeshCalcUtils
66 const QStringList &usedGroupNames,
77 std::shared_ptr<const QgsMeshMemoryDatasetGroup> group(
const QString &groupName )
const;
80 void ones( QgsMeshMemoryDatasetGroup &group1 )
const;
83 void nodata( QgsMeshMemoryDatasetGroup &group1 )
const;
86 std::shared_ptr<QgsMeshMemoryDataset> number(
double val,
double time )
const;
89 void copy( QgsMeshMemoryDatasetGroup &group1,
const QString &groupName )
const;
92 std::shared_ptr<QgsMeshMemoryDataset> copy( std::shared_ptr<const QgsMeshMemoryDataset> dataset0 )
const;
95 void transferDatasets( QgsMeshMemoryDatasetGroup &group1, QgsMeshMemoryDatasetGroup &group2 )
const;
98 void expand( QgsMeshMemoryDatasetGroup &group1,
99 const QgsMeshMemoryDatasetGroup &group2 )
const;
102 void number( QgsMeshMemoryDatasetGroup &group1,
double val )
const;
105 void addIf( QgsMeshMemoryDatasetGroup &trueGroup,
106 const QgsMeshMemoryDatasetGroup &falseGroup,
107 const QgsMeshMemoryDatasetGroup &condition )
const;
110 void filter( QgsMeshMemoryDatasetGroup &group1,
const QgsRectangle &extent )
const;
113 void filter( QgsMeshMemoryDatasetGroup &group1,
const QgsGeometry &mask )
const;
116 void logicalNot( QgsMeshMemoryDatasetGroup &group1 )
const;
119 void changeSign( QgsMeshMemoryDatasetGroup &group1 )
const;
122 void abs( QgsMeshMemoryDatasetGroup &group1 )
const;
125 void sumAggregated( QgsMeshMemoryDatasetGroup &group1 )
const;
128 void minimumAggregated( QgsMeshMemoryDatasetGroup &group1 )
const;
131 void maximumAggregated( QgsMeshMemoryDatasetGroup &group1 )
const;
134 void averageAggregated( QgsMeshMemoryDatasetGroup &group1 )
const;
137 void add( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
140 void subtract( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
143 void multiply( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
146 void divide( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
149 void power( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
152 void equal( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
155 void notEqual( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
158 void greaterThan( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
161 void lesserThan( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
164 void lesserEqual( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
167 void greaterEqual( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
170 void logicalAnd( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
173 void logicalOr( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
176 void minimum( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
179 void maximum( QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
188 double ffilter(
double val1,
double filter )
const;
189 double fadd(
double val1,
double val2 )
const;
190 double fsubtract(
double val1,
double val2 )
const;
191 double fmultiply(
double val1,
double val2 )
const;
192 double fdivide(
double val1,
double val2 )
const;
193 double fpower(
double val1,
double val2 )
const;
194 double fequal(
double val1,
double val2 )
const;
195 double fnotEqual(
double val1,
double val2 )
const;
196 double fgreaterThan(
double val1,
double val2 )
const;
197 double flesserThan(
double val1,
double val2 )
const;
198 double flesserEqual(
double val1,
double val2 )
const;
199 double fgreaterEqual(
double val1,
double val2 )
const;
200 double flogicalAnd(
double val1,
double val2 )
const;
201 double flogicalOr(
double val1,
double val2 )
const;
202 double flogicalNot(
double val1 )
const;
203 double fchangeSign(
double val1 )
const;
204 double fmin(
double val1,
double val2 )
const;
205 double fmax(
double val1,
double val2 )
const;
206 double fabs(
double val1 )
const;
207 double fsumAggregated( QVector<double> &vals )
const;
208 double fminimumAggregated( QVector<double> &vals )
const;
209 double fmaximumAggregated( QVector<double> &vals )
const;
210 double faverageAggregated( QVector<double> &vals )
const;
219 std::shared_ptr<QgsMeshMemoryDatasetGroup> create(
const QString &datasetGroupName )
const;
224 std::shared_ptr<QgsMeshMemoryDataset> create(
const QgsMeshMemoryDatasetGroup &grp )
const;
234 std::shared_ptr<QgsMeshMemoryDataset> canditateDataset( QgsMeshMemoryDatasetGroup &group,
235 int datasetIndex )
const;
240 std::shared_ptr<const QgsMeshMemoryDataset> constCandidateDataset(
const QgsMeshMemoryDatasetGroup &group,
241 int datasetIndex )
const;
246 int datasetCount(
const QgsMeshMemoryDatasetGroup &group1,
const QgsMeshMemoryDatasetGroup &group2 )
const;
253 void activate( std::shared_ptr<QgsMeshMemoryDataset> dataset,
254 std::shared_ptr<const QgsMeshMemoryDataset> refDataset =
nullptr )
const;
257 void activate( QgsMeshMemoryDatasetGroup &group )
const;
260 void populateSpatialFilter( QgsMeshMemoryDatasetGroup &filter,
const QgsRectangle &extent )
const;
263 void populateMaskFilter( QgsMeshMemoryDatasetGroup &filter,
const QgsGeometry &mask )
const;
266 void func1( QgsMeshMemoryDatasetGroup &group,
267 std::function<
double(
double )> func )
const;
270 void func2( QgsMeshMemoryDatasetGroup &group1,
271 const QgsMeshMemoryDatasetGroup &group2,
272 std::function<
double(
double,
double )> func )
const;
275 void funcAggr( QgsMeshMemoryDatasetGroup &group1,
276 std::function<
double( QVector<double>& )> func )
const;
279 const QgsMesh *nativeMesh()
const;
280 void updateMesh()
const;
285 QVector<double> mTimes;
287 QMap < QString, std::shared_ptr<QgsMeshMemoryDatasetGroup> > mDatasetGroupMap;
292 #endif // QGSMESHCALCUTILS_H