-
Notifications
You must be signed in to change notification settings - Fork 0
/
KonstNyomas.cpp
97 lines (84 loc) · 2.39 KB
/
KonstNyomas.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
using namespace std;
#include <cmath>
#include <vector>
#include <iostream>
#include <sstream>
#include "Agelem.h"
#include "KonstNyomas.h"
KonstNyomas::KonstNyomas(
const string a_nev,
const double a_Aref,
const string a_csp_nev,
const double a_ro,
const double a_p,
const double a_mp,
const double a_tt) :
Agelem(a_nev, a_Aref, a_mp, a_ro, a_tt) {
//Kotelezo adatok minden Agelemnel:
tipus = "Konstans nyomas";
csp_db = 1;
/*cspe_nev="<nincs>";
cspv_nev=a_csp_nev;
*/
cspv_nev = "<nincs>";
cspe_nev = a_csp_nev;
// nyomas
p = a_p;
}
//--------------------------------------------------------------
KonstNyomas::~KonstNyomas() {
}
//--------------------------------------------------------------
string KonstNyomas::Info() {
ostringstream strstrm;
strstrm << Agelem::Info();
strstrm << endl << " kapcsolodas : " << cspe_nev << "(index:" << cspe_index << ")\n";
return strstrm.str();
}
//--------------------------------------------------------------
double KonstNyomas::f(vector<double> x) {
double ere = x[0] - p / ro / g;
return ere;
}
//--------------------------------------------------------------
vector<double> KonstNyomas::df(vector<double> x) {
vector<double> ere;
ere.push_back(1);
ere.push_back(0);
ere.push_back(0);
ere.push_back(-p / ro / g);
return ere;
}
//--------------------------------------------------------------
void KonstNyomas::Ini(int mode, double value) {
if (mode == 0)
mp = 0.01;
else
mp = value;
}
//--------------------------------------------------------------
void KonstNyomas::Set_dprop(string mit, double mire) {
if ((mit == "concentration") || (mit == "konc_atlag")) {
konc_atlag = mire;
} else {
cout << endl << "HIBA! KonstNyomas::Set_dprop(mit), ismeretlen bemenet: mit="
<< mit << endl << endl;
}
}
double KonstNyomas::Get_dprop(string mit) {
double out = 0.0;
if (mit == "headloss")
out = 0.;
else if (mit == "headloss_per_unit_length")
out = 0.;
else if ((mit == "concentration") || (mit == "konc_atlag"))
out = konc_atlag;
else {
cout << endl
<< "HIBA! Cso::Get_dprop(mit), ismeretlen bemenet: mit=" << mit << endl
<< endl;
cout << endl << "Name of KonstNyomas: " << nev << endl;
cin.get();
}
return out;
}