forked from hundlab/LongQt-model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeasure.h
84 lines (70 loc) · 2.73 KB
/
measure.h
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
//################################################
// This header file
// declares Measure class used to track properties
// (e.g. peak, min, duration) of specified state variable.
//
// Copyright (C) 2015 Thomas J. Hund.
// Updated 07/2015
// Email thomas.hund@osumc.edu
//#################################################
#ifndef MEASURE_H
#define MEASURE_H
#include <string>
#include <map>
#include <set>
#include <limits>
#include <cmath>
using namespace std;
class Measure
{
public:
Measure(set<string> selected = {});
Measure(const Measure& toCopy);
Measure(Measure&& toCopy);
virtual ~Measure() = default;
Measure& operator=(const Measure& toCopy) = delete;
virtual bool measure(double time,double var); //measures props related to var; returns 1 when ready for output.
virtual void reset(); //resets params to init vals
// string varname;
set<string> variables();
map<string,double> variablesMap();
set<string> selection();
void selection(set<string> new_selection);
// void restoreLast();
virtual string getNameString(string name) const;
virtual string getValueString() const;
protected:
virtual void calcMeasure(double time, double var);
virtual void updateOld(double time, double var);
map<string, double* const> varmap = // map for refing properties that can be measured.
{{"peak",&peak},{"min",&min},{"maxderiv",&maxderiv},
{"mint",&mint},{"derivt",&derivt}};
// map<string, double> lastMap;
double varold = NAN;
// double vartakeoff=-100; //var value at point of max deflection.
double told = NAN;
// double durtime1;
double derivold = 0; //dv/dt from prev. time step
double derivt = 0; // time of max deriv.
double peak = std::numeric_limits<double>::min(); // max var value
double maxt = NAN; //time of max value.
double min = std::numeric_limits<double>::max(); // min var value
double mint = NAN; //time of min value.
double maxderiv = 0;
double deriv = 0;
// double maxderiv1;
// double maxderiv2;
// double maxderiv2nd = 0;
// double cl = 0;
// double dur; //duration
// double __percrepol = 50; //specify percent repolarization
// double repol = -25; // repol var val for duration measure.
// bool durflag = false; //1 while measuring duration.
// bool ampflag = false;
// bool ddrflag = false;
bool returnflag = false;
set<string> __selection; // map for refing properties that will be output.
private:
void copy(const Measure& toCopy);
};
#endif