-
Notifications
You must be signed in to change notification settings - Fork 26
/
simulation.cpp
1153 lines (801 loc) · 31.4 KB
/
simulation.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
//==============================================================================
// Simulation
//==============================================================================
#include "cellmlfilemanager.h"
#include "combinefilemanager.h"
#include "interfaces.h"
#include "sedmlfilemanager.h"
#include "simulation.h"
#include "simulationworker.h"
//==============================================================================
#include <QtMath>
//==============================================================================
namespace OpenCOR {
namespace SimulationSupport {
//==============================================================================
SimulationData::SimulationData(Simulation *pSimulation) :
mSimulation(pSimulation),
mDelay(0),
mStartingPoint(0.0),
mEndingPoint(1000.0),
mPointInterval(1.0),
mOdeSolverName(QString()),
mOdeSolverProperties(Solver::Solver::Properties()),
mDaeSolverName(QString()),
mDaeSolverProperties(Solver::Solver::Properties()),
mNlaSolverName(QString()),
mNlaSolverProperties(Solver::Solver::Properties())
{
// Create our various arrays
createArrays();
}
//==============================================================================
SimulationData::~SimulationData()
{
// Delete some internal objects
deleteArrays();
}
//==============================================================================
void SimulationData::reload()
{
// Reload ourselves by deleting and recreating our arrays
deleteArrays();
createArrays();
}
//==============================================================================
Simulation * SimulationData::simulation() const
{
// Return our simulation
return mSimulation;
}
//==============================================================================
double * SimulationData::constants() const
{
// Return our constants array
return mConstants;
}
//==============================================================================
double * SimulationData::rates() const
{
// Return our rates array
return mRates;
}
//==============================================================================
double * SimulationData::states() const
{
// Return our states array
return mStates;
}
//==============================================================================
double * SimulationData::algebraic() const
{
// Return our algebraic array
return mAlgebraic;
}
//==============================================================================
int SimulationData::delay() const
{
// Return our delay
return mDelay;
}
//==============================================================================
void SimulationData::setDelay(int pDelay)
{
// Set our delay
mDelay = pDelay;
}
//==============================================================================
double SimulationData::startingPoint() const
{
// Return our starting point
return mStartingPoint;
}
//==============================================================================
void SimulationData::setStartingPoint(double pStartingPoint, bool pRecompute)
{
// Set our starting point
mStartingPoint = pStartingPoint;
// Recompute our 'computed constants' and 'variables', i.e. reset ourselves
// witout initialisation (hence passing false to reset())
if (pRecompute)
reset(false);
}
//==============================================================================
double SimulationData::endingPoint() const
{
// Return our ending point
return mEndingPoint;
}
//==============================================================================
void SimulationData::setEndingPoint(double pEndingPoint)
{
// Set our ending point
mEndingPoint = pEndingPoint;
}
//==============================================================================
double SimulationData::pointInterval() const
{
// Return our point interval
return mPointInterval;
}
//==============================================================================
void SimulationData::setPointInterval(double pPointInterval)
{
// Set our point interval
mPointInterval = pPointInterval;
}
//==============================================================================
SolverInterface * SimulationData::solverInterface(const QString &pSolverName) const
{
// Return the named solver interface, if any
foreach (SolverInterface *solverInterface, Core::solverInterfaces()) {
if (!solverInterface->solverName().compare(pSolverName))
return solverInterface;
}
return 0;
}
//==============================================================================
SolverInterface * SimulationData::odeSolverInterface() const
{
// Return our ODE solver interface, if any
return solverInterface(odeSolverName());
}
//==============================================================================
QString SimulationData::odeSolverName() const
{
// Return our ODE solver name
return mSimulation->runtime()?mOdeSolverName:QString();
}
//==============================================================================
void SimulationData::setOdeSolverName(const QString &pOdeSolverName)
{
// Set our ODE solver name and reset its properties
if (pOdeSolverName.compare(mOdeSolverName) && mSimulation->runtime()) {
mOdeSolverName = pOdeSolverName;
mOdeSolverProperties.clear();
}
}
//==============================================================================
Solver::Solver::Properties SimulationData::odeSolverProperties() const
{
// Return our ODE solver's properties
return mSimulation->runtime()?mOdeSolverProperties:Solver::Solver::Properties();
}
//==============================================================================
void SimulationData::addOdeSolverProperty(const QString &pName,
const QVariant &pValue)
{
// Add an ODE solver property
if (mSimulation->runtime())
mOdeSolverProperties.insert(pName, pValue);
}
//==============================================================================
SolverInterface * SimulationData::nlaSolverInterface() const
{
// Return our NLA solver interface, if any
return solverInterface(nlaSolverName());
}
//==============================================================================
QString SimulationData::nlaSolverName() const
{
// Return our NLA solver name
return ( mSimulation->runtime()
&& mSimulation->runtime()->needNlaSolver())?mNlaSolverName:QString();
}
//==============================================================================
void SimulationData::setNlaSolverName(const QString &pNlaSolverName,
bool pReset)
{
// Set our NLA solver name and reset its properties
if ( pNlaSolverName.compare(mNlaSolverName)
&& mSimulation->runtime() && mSimulation->runtime()->needNlaSolver()) {
mNlaSolverName = pNlaSolverName;
mNlaSolverProperties.clear();
// Reset our parameter values, if required
// Note: to only recompute our 'computed constants' and 'variables' is
// not sufficient since some constants may also need to be
// reinitialised...
if (pReset)
reset();
}
}
//==============================================================================
Solver::Solver::Properties SimulationData::nlaSolverProperties() const
{
// Return our NLA solver's properties
return ( mSimulation->runtime()
&& mSimulation->runtime()->needNlaSolver())?mNlaSolverProperties:Solver::Solver::Properties();
}
//==============================================================================
void SimulationData::addNlaSolverProperty(const QString &pName,
const QVariant &pValue, bool pReset)
{
// Add an NLA solver property
if (mSimulation->runtime() && mSimulation->runtime()->needNlaSolver()) {
mNlaSolverProperties.insert(pName, pValue);
// Reset our parameter values, if required
// Note: to only recompute our 'computed constants' and 'variables' is
// not sufficient since some constants may also need to be
// reinitialised...
if (pReset)
reset();
}
}
//==============================================================================
void SimulationData::reset(bool pInitialize)
{
// Reset our parameter values which means both initialising our 'constants'
// and computing our 'computed constants' and 'variables'
// Note #1: we must check whether our runtime needs NLA solver and, if so,
// then retrieve an instance of our NLA solver since some of the
// resetting may require solving one or several NLA systems...
// Note #2: recomputeComputedConstantsAndVariables() will let people know
// that our data has changed...
CellMLSupport::CellmlFileRuntime *runtime = mSimulation->runtime();
Solver::NlaSolver *nlaSolver = 0;
if (runtime->needNlaSolver()) {
// Set our NLA solver
// Note: we unset it at the end of this method...
nlaSolver = static_cast<Solver::NlaSolver *>(nlaSolverInterface()->solverInstance());
Solver::setNlaSolver(runtime->address(), nlaSolver);
// Keep track of any error that might be reported by our NLA solver
connect(nlaSolver, &Solver::NlaSolver::error,
this, &SimulationData::error);
// Initialise our NLA solver
nlaSolver->setProperties(mNlaSolverProperties);
}
// Reset our parameter values
if (pInitialize) {
memset(mConstants, 0, runtime->constantsCount()*Solver::SizeOfDouble);
memset(mRates, 0, runtime->ratesCount()*Solver::SizeOfDouble);
memset(mStates, 0, runtime->statesCount()*Solver::SizeOfDouble);
memset(mAlgebraic, 0, runtime->algebraicCount()*Solver::SizeOfDouble);
runtime->initializeConstants()(mConstants, mRates, mStates);
}
recomputeComputedConstantsAndVariables(mStartingPoint, pInitialize);
// Delete our NLA solver, if any
if (nlaSolver) {
delete nlaSolver;
Solver::unsetNlaSolver(runtime->address());
}
// Keep track of our various initial values
if (pInitialize) {
memcpy(mInitialConstants, mConstants, runtime->constantsCount()*Solver::SizeOfDouble);
memcpy(mInitialStates, mStates, runtime->statesCount()*Solver::SizeOfDouble);
}
// Let people know whether our data is 'cleaned', i.e. not modified, and ask
// our simulation worker to reset itself
// Note: no point in checking if we are initialising...
if (!pInitialize) {
emit modified(isModified());
if (mSimulation->worker())
mSimulation->worker()->reset();
}
}
//==============================================================================
void SimulationData::recomputeComputedConstantsAndVariables(double pCurrentPoint,
bool pInitialize)
{
// Recompute our 'computed constants', some 'constant' algebraic variables
// and our 'variables'
CellMLSupport::CellmlFileRuntime *runtime = mSimulation->runtime();
runtime->computeComputedConstants()(pCurrentPoint, mConstants, mRates, pInitialize?mStates:mDummyStates, mAlgebraic);
runtime->computeRates()(pCurrentPoint, mConstants, mRates, mStates, mAlgebraic);
runtime->computeVariables()(pCurrentPoint, mConstants, mRates, mStates, mAlgebraic);
// Let people know that our data has been updated
emit updated(pCurrentPoint);
}
//==============================================================================
void SimulationData::recomputeVariables(double pCurrentPoint)
{
// Recompute our 'variables'
mSimulation->runtime()->computeVariables()(pCurrentPoint, mConstants, mRates, mStates, mAlgebraic);
}
//==============================================================================
bool SimulationData::isModified() const
{
// Check whether any of our constants or states has been modified, if
// possible
// Note: we start with our states since they are more likely to be modified
// than our constants...
CellMLSupport::CellmlFileRuntime *runtime = mSimulation->runtime();
if (runtime) {
for (int i = 0, iMax = runtime->statesCount(); i < iMax; ++i) {
if (mStates[i] != mInitialStates[i])
return true;
}
for (int i = 0, iMax = runtime->constantsCount(); i < iMax; ++i) {
if (mConstants[i] != mInitialConstants[i])
return true;
}
}
return false;
}
//==============================================================================
void SimulationData::checkForModifications()
{
// Let people know whether any of our constants or states has been modified
emit modified(isModified());
}
//==============================================================================
void SimulationData::createArrays()
{
// Create our various arrays, if possible
CellMLSupport::CellmlFileRuntime *runtime = mSimulation->runtime();
if (runtime) {
// Create our various arrays to compute our model
mConstants = new double[runtime->constantsCount()] {};
mRates = new double[runtime->ratesCount()] {};
mStates = new double[runtime->statesCount()] {};
mDummyStates = new double[runtime->statesCount()] {};
mAlgebraic = new double[runtime->algebraicCount()] {};
// Create our various arrays to keep track of our various initial values
mInitialConstants = new double[runtime->constantsCount()] {};
mInitialStates = new double[runtime->statesCount()] {};
} else {
mConstants = mRates = mStates = mDummyStates = mAlgebraic = 0;
mInitialConstants = mInitialStates = 0;
}
}
//==============================================================================
void SimulationData::deleteArrays()
{
// Delete our various arrays
delete[] mConstants;
delete[] mRates;
delete[] mStates;
delete[] mDummyStates;
delete[] mAlgebraic;
delete[] mInitialConstants;
delete[] mInitialStates;
// Reset our various arrays
// Note: this shouldn't be needed, but better be safe than sorry...
mConstants = mRates = mStates = mDummyStates = mAlgebraic = 0;
mInitialConstants = mInitialStates = 0;
}
//==============================================================================
SimulationResults::SimulationResults(Simulation *pSimulation) :
mSimulation(pSimulation),
mDataStore(0),
mPoints(0),
mConstants(DataStore::DataStoreVariables()),
mRates(DataStore::DataStoreVariables()),
mStates(DataStore::DataStoreVariables()),
mAlgebraic(DataStore::DataStoreVariables())
{
// Create our data store
createDataStore();
}
//==============================================================================
SimulationResults::~SimulationResults()
{
// Delete some internal objects
deleteDataStore();
}
//==============================================================================
QString SimulationResults::uri(const QStringList &pComponentHierarchy,
const QString &pName)
{
// Generate an URI using the given component hierarchy and name
QString res = pComponentHierarchy.join('/')+"/"+pName;
return res.replace('\'', "/prime");
}
//==============================================================================
void SimulationResults::createDataStore()
{
// Make sure that we have a runtime and a VOI
CellMLSupport::CellmlFileRuntime *runtime = mSimulation->runtime();
if (!runtime || !runtime->voi())
return;
// Create our data store
SimulationData *data = mSimulation->data();
mDataStore = new DataStore::DataStore(runtime->cellmlFile()->xmlBase());
mPoints = mDataStore->voi();
mConstants = mDataStore->addVariables(data->constants(), runtime->constantsCount());
mRates = mDataStore->addVariables(data->rates(), runtime->ratesCount());
mStates = mDataStore->addVariables(data->states(), runtime->statesCount());
mAlgebraic = mDataStore->addVariables(data->algebraic(), runtime->algebraicCount());
// Customise our VOI, as well as our constant, rate, state and algebraic
// variables
for (int i = 0, iMax = runtime->parameters().count(); i < iMax; ++i) {
CellMLSupport::CellmlFileRuntimeParameter *parameter = runtime->parameters()[i];
DataStore::DataStoreVariable *variable = 0;
switch (parameter->type()) {
case CellMLSupport::CellmlFileRuntimeParameter::Voi:
mPoints->setIcon(parameter->icon());
mPoints->setUri(uri(runtime->voi()->componentHierarchy(),
runtime->voi()->name()));
mPoints->setLabel(runtime->voi()->name());
mPoints->setUnit(runtime->voi()->unit());
break;
case CellMLSupport::CellmlFileRuntimeParameter::Constant:
case CellMLSupport::CellmlFileRuntimeParameter::ComputedConstant:
variable = mConstants[parameter->index()];
break;
case CellMLSupport::CellmlFileRuntimeParameter::Rate:
variable = mRates[parameter->index()];
break;
case CellMLSupport::CellmlFileRuntimeParameter::State:
variable = mStates[parameter->index()];
break;
case CellMLSupport::CellmlFileRuntimeParameter::Algebraic:
variable = mAlgebraic[parameter->index()];
break;
default:
// Not a relevant type, so do nothing
;
}
if (variable) {
variable->setIcon(parameter->icon());
variable->setUri(uri(parameter->componentHierarchy(), parameter->formattedName()));
variable->setLabel(parameter->formattedName());
variable->setUnit(parameter->formattedUnit(runtime->voi()->unit()));
}
}
}
//==============================================================================
void SimulationResults::deleteDataStore()
{
// Delete our data store
delete mDataStore;
// Reset our data store and our different data store variable/s
// Note: this is in case we are not able to recreate a data store...
mDataStore = 0;
mPoints = 0;
mConstants = DataStore::DataStoreVariables();
mRates = DataStore::DataStoreVariables();
mStates = DataStore::DataStoreVariables();
mAlgebraic = DataStore::DataStoreVariables();
}
//==============================================================================
void SimulationResults::reload()
{
// Reload ourselves by resetting ourselves
reset();
}
//==============================================================================
void SimulationResults::reset()
{
// Reset our data store by deleting it and then recreating it
deleteDataStore();
createDataStore();
}
//==============================================================================
int SimulationResults::runsCount() const
{
// Return the number of runs held by our data store
return mDataStore?mDataStore->runsCount():0;
}
//==============================================================================
bool SimulationResults::addRun()
{
// Ask our data store to add a run to itself
// Note: we consider things to be fine if our data store have had no problem
// adding a run to itself or if the simulation size is zero...
quint64 simulationSize = mSimulation->size();
if (simulationSize)
return mDataStore->addRun(simulationSize);
else
return true;
}
//==============================================================================
void SimulationResults::addPoint(double pPoint)
{
// Add the data to our data store
mDataStore->addValues(pPoint);
}
//==============================================================================
quint64 SimulationResults::size(int pRun) const
{
// Return the size of our data store for the given run
return mDataStore?mDataStore->size(pRun):0;
}
//==============================================================================
DataStore::DataStore * SimulationResults::dataStore() const
{
// Return our data store
return mDataStore;
}
//==============================================================================
double * SimulationResults::points(int pRun) const
{
// Return our points for the given run
return mPoints?mPoints->values(pRun):0;
}
//==============================================================================
double * SimulationResults::constants(int pIndex, int pRun) const
{
// Return our constants data at the given index and for the given run
return mConstants.isEmpty()?0:mConstants[pIndex]->values(pRun);
}
//==============================================================================
double * SimulationResults::rates(int pIndex, int pRun) const
{
// Return our rates data at the given index and for the given run
return mRates.isEmpty()?0:mRates[pIndex]->values(pRun);
}
//==============================================================================
double * SimulationResults::states(int pIndex, int pRun) const
{
// Return our states data at the given index and for the given run
return mStates.isEmpty()?0:mStates[pIndex]->values(pRun);
}
//==============================================================================
double * SimulationResults::algebraic(int pIndex, int pRun) const
{
// Return our algebraic data at the given index and for the given run
return mAlgebraic.isEmpty()?0:mAlgebraic[pIndex]->values(pRun);
}
//==============================================================================
Simulation::Simulation(const QString &pFileName) :
mFileName(pFileName),
mWorker(0)
{
// Retrieve our file details
retrieveFileDetails();
// Create our data and results objects, now that we are all set
mData = new SimulationData(this);
mResults = new SimulationResults(this);
// Keep track of any error occurring in our data
connect(mData, &SimulationData::error,
this, &Simulation::error);
}
//==============================================================================
Simulation::~Simulation()
{
// Stop our worker
stop();
// Delete some internal objects
delete mResults;
delete mData;
}
//==============================================================================
void Simulation::retrieveFileDetails()
{
// Retrieve our CellML and SED-ML files, as well as COMBINE archive
mCellmlFile = CellMLSupport::CellmlFileManager::instance()->cellmlFile(mFileName);
mSedmlFile = mCellmlFile?0:SEDMLSupport::SedmlFileManager::instance()->sedmlFile(mFileName);
mCombineArchive = mSedmlFile?0:COMBINESupport::CombineFileManager::instance()->combineArchive(mFileName);
// Determine the type of our file
mFileType = mCellmlFile?CellmlFile:mSedmlFile?SedmlFile:CombineArchive;
// We have a COMBINE archive, so we need to retrieve its corresponding
// SED-ML file
if (mCombineArchive)
mSedmlFile = mCombineArchive->sedmlFile();
// We have a SED-ML file (either a direct one or through a COMBINE archive),
// so we need to retrieve its corresponding CellML file
if (mSedmlFile)
mCellmlFile = mSedmlFile->cellmlFile();
// Keep track of our runtime, if any
mRuntime = mCellmlFile?mCellmlFile->runtime(true):0;
}
//==============================================================================
QString Simulation::fileName() const
{
// Return our file name
return mFileName;
}
//==============================================================================
void Simulation::save()
{
// Retrieve our file details
bool needReloading = !mRuntime;
retrieveFileDetails();
// Ask our data and results to update themselves, if needed
// Note: this is, for example, needed when we open an invalid file (in which
// case mRuntime is null), fix it (resulting in a valid mRuntime
// value) and then save it...
if (needReloading) {
mData->reload();
mResults->reload();
}
}
//==============================================================================
void Simulation::reload()
{
// Retrieve our file details
retrieveFileDetails();
// Ask our data and results to update themselves
mData->reload();
mResults->reload();
}
//==============================================================================
void Simulation::rename(const QString &pFileName)
{
// Rename ourselves by simply updating our file name
mFileName = pFileName;
}
//==============================================================================
CellMLSupport::CellmlFileRuntime * Simulation::runtime() const
{
// Return our runtime
return mRuntime;
}
//==============================================================================
SimulationWorker * Simulation::worker() const
{
// Return our worker
return mWorker;
}
//==============================================================================
Simulation::FileType Simulation::fileType() const
{
// Return our file type
return mFileType;
}
//==============================================================================
CellMLSupport::CellmlFile * Simulation::cellmlFile() const
{
// Return our CellML file object
return mCellmlFile;
}
//==============================================================================
SEDMLSupport::SedmlFile * Simulation::sedmlFile() const
{
// Return our SED-ML file object
return mSedmlFile;
}
//==============================================================================
COMBINESupport::CombineArchive * Simulation::combineArchive() const
{
// Return our COBMINE archive object
return mCombineArchive;
}
//==============================================================================
SimulationData * Simulation::data() const
{
// Return our data
return mData;
}
//==============================================================================
SimulationResults * Simulation::results() const
{
// Return our results
return mResults;
}
//==============================================================================
int Simulation::runsCount() const
{
// Return the number of runs held by our results
return mResults?mResults->runsCount():0;
}
//==============================================================================
bool Simulation::addRun()
{
// Ask our results to add a run
return mResults?mResults->addRun():false;
}
//==============================================================================
bool Simulation::isRunning() const
{
// Return whether we are running
return mWorker?mWorker->isRunning():false;
}
//==============================================================================
bool Simulation::isPaused() const
{
// Return whether we are paused
return mWorker?mWorker->isPaused():false;
}
//==============================================================================
double Simulation::currentPoint() const
{