25 #include "qgsmeshmemorydataprovider.h"
29 const QString &outputFile,
34 : mFormulaString( formulaString )
35 , mOutputDriver( QStringLiteral(
"DAT" ) )
36 , mOutputFile( outputFile )
37 , mOutputExtent( outputExtent )
39 , mStartTime( startTime )
43 if ( !mOutputFile.isEmpty() )
44 mOutputGroupName = QFileInfo( mOutputFile ).baseName();
48 const QString &outputFile,
53 : mFormulaString( formulaString )
54 , mOutputDriver( QStringLiteral(
"DAT" ) )
55 , mOutputFile( outputFile )
56 , mOutputMask( outputMask )
58 , mStartTime( startTime )
62 if ( !mOutputFile.isEmpty() )
63 mOutputGroupName = QFileInfo( mOutputFile ).baseName();
68 const QString &outputDriver,
69 const QString &outputGroupName,
70 const QString &outputFile,
75 : mFormulaString( formulaString )
76 , mOutputDriver( outputDriver )
77 , mOutputGroupName( outputGroupName )
78 , mOutputFile( outputFile )
79 , mOutputExtent( outputExtent )
81 , mStartTime( startTime )
88 const QString &outputDriver,
89 const QString &outputGroupName,
90 const QString &outputFile,
95 : mFormulaString( formulaString )
96 , mOutputDriver( outputDriver )
97 , mOutputGroupName( outputGroupName )
98 , mOutputFile( outputFile )
99 , mOutputMask( outputMask )
101 , mStartTime( startTime )
102 , mEndTime( endTime )
103 , mMeshLayer( layer )
108 const QString &formulaString,
116 const QString &formulaString,
121 std::unique_ptr< QgsMeshCalcNode > calcNode( QgsMeshCalcNode::parseMeshCalcString( formulaString, errorString ) );
131 QgsMeshDriverMetadata::MeshDriverCapability::CanWriteVertexDatasets;
139 if ( mOutputFile.isEmpty() )
154 std::unique_ptr< QgsMeshCalcNode > calcNode( QgsMeshCalcNode::parseMeshCalcString( mFormulaString, errorString ) );
160 QgsMeshCalcUtils dsu( mMeshLayer, calcNode->usedDatasetGroupNames(), mStartTime, mEndTime );
161 if ( !dsu.isValid() )
167 std::unique_ptr<QgsMeshMemoryDatasetGroup> outputGroup = qgis::make_unique<QgsMeshMemoryDatasetGroup> ( mOutputFile, dsu.outputType() );
170 bool ok = calcNode->calculate( dsu, *outputGroup );
188 dsu.filter( *outputGroup, mOutputMask );
192 dsu.filter( *outputGroup, mOutputExtent );
194 outputGroup->isScalar =
true;
195 outputGroup->name = mOutputGroupName;
208 QVector<QgsMeshDataBlock> datasetValues;
209 QVector<QgsMeshDataBlock> datasetActive;
210 QVector<double> times;
212 const auto datasize = outputGroup->datasets.size();
213 datasetValues.reserve( datasize );
214 times.reserve( datasize );
216 for (
int i = 0; i < datasize; ++i )
218 const std::shared_ptr<QgsMeshMemoryDataset> dataset = outputGroup->datasets.at( i );
220 times.push_back( dataset->time );
221 datasetValues.push_back(
222 dataset->datasetValues( outputGroup->isScalar,
224 dataset->values.size() )
226 if ( !dataset->active.isEmpty() )
228 datasetActive.push_back(
229 dataset->areFacesActive(
231 dataset->active.size() )