Cantera
2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
transport
LiquidTransportData.cpp
Go to the documentation of this file.
1
/**
2
* @file LiquidTransportData.cpp
3
* Source code for liquid transport property evaluations.
4
*/
5
6
#include "
cantera/transport/LiquidTransportData.h
"
7
using namespace
std;
8
9
#ifndef SAFE_DELETE
10
#define SAFE_DELETE(x) if (x) { delete (x); x = 0; }
11
#endif
12
namespace
Cantera
13
{
14
15
//====================================================================================================================
16
LiquidTransportData::LiquidTransportData() :
17
speciesName(
"-"
),
18
hydroRadius(0),
19
viscosity(0),
20
ionConductivity(0),
21
mobilityRatio(0),
22
selfDiffusion(0),
23
thermalCond(0),
24
electCond(0),
25
speciesDiffusivity(0)
26
{
27
28
}
29
//====================================================================================================================
30
// Copy constructor
31
LiquidTransportData::LiquidTransportData
(
const
LiquidTransportData
& right) :
32
speciesName(
"-"
),
33
hydroRadius(0),
34
viscosity(0),
35
ionConductivity(0),
36
mobilityRatio(0),
37
selfDiffusion(0),
38
thermalCond(0),
39
electCond(0),
40
speciesDiffusivity(0)
41
{
42
*
this
= right;
//use assignment operator to do other work
43
}
44
//====================================================================================================================
45
// Assignment operator
46
LiquidTransportData
&
LiquidTransportData::operator=
(
const
LiquidTransportData
& right)
47
{
48
if
(&right !=
this
) {
49
// These are all shallow pointer copies - yes, yes, yes horrible crime.
50
speciesName
= right.
speciesName
;
51
if
(right.
hydroRadius
) {
52
hydroRadius
= (right.
hydroRadius
)->duplMyselfAsLTPspecies();
53
}
54
if
(right.
viscosity
) {
55
viscosity
= (right.
viscosity
)->duplMyselfAsLTPspecies();
56
}
57
if
(right.
ionConductivity
) {
58
ionConductivity
= (right.
ionConductivity
)->duplMyselfAsLTPspecies();
59
}
60
61
mobilityRatio
= right.
mobilityRatio
;
62
for
(
size_t
k = 0; k <
mobilityRatio
.size(); k++) {
63
if
(right.
mobilityRatio
[k]) {
64
mobilityRatio
[k] = (right.
mobilityRatio
[k])->duplMyselfAsLTPspecies();
65
}
66
}
67
68
selfDiffusion
= right.
selfDiffusion
;
69
for
(
size_t
k = 0; k <
selfDiffusion
.size(); k++) {
70
if
(right.
selfDiffusion
[k]) {
71
selfDiffusion
[k] = (right.
selfDiffusion
[k])->duplMyselfAsLTPspecies();
72
}
73
}
74
75
if
(right.
thermalCond
) {
76
thermalCond
= (right.
thermalCond
)->duplMyselfAsLTPspecies();
77
}
78
if
(right.
electCond
) {
79
electCond
= (right.
electCond
)->duplMyselfAsLTPspecies();
80
}
81
if
(right.
speciesDiffusivity
) {
82
speciesDiffusivity
= (right.
speciesDiffusivity
)->duplMyselfAsLTPspecies();
83
}
84
}
85
return
*
this
;
86
}
87
//====================================================================================================================
88
LiquidTransportData::~LiquidTransportData
()
89
{
90
91
SAFE_DELETE(
hydroRadius
);
92
SAFE_DELETE(
viscosity
);
93
SAFE_DELETE(
ionConductivity
);
94
95
for
(
size_t
k = 0; k <
mobilityRatio
.size(); k++) {
96
if
(
mobilityRatio
[k]) {
97
SAFE_DELETE(
mobilityRatio
[k]);
98
}
99
}
100
for
(
size_t
k = 0; k <
selfDiffusion
.size(); k++) {
101
if
(
selfDiffusion
[k]) {
102
SAFE_DELETE(
selfDiffusion
[k]);
103
}
104
}
105
106
SAFE_DELETE(
thermalCond
);
107
SAFE_DELETE(
electCond
);
108
SAFE_DELETE(
speciesDiffusivity
);
109
110
}
111
//====================================================================================================================
112
}
Generated by
1.8.2