Cantera  2.1.2
LiquidTransportData.cpp
Go to the documentation of this file.
1 /**
2  * @file LiquidTransportData.cpp
3  * Source code for liquid transport property evaluations.
4  */
5 
7 using namespace std;
8 
9 namespace Cantera
10 {
11 LiquidTransportData::LiquidTransportData() :
12  speciesName("-"),
13  hydroRadius(0),
14  viscosity(0),
15  ionConductivity(0),
16  mobilityRatio(0),
17  selfDiffusion(0),
18  thermalCond(0),
19  electCond(0),
20  speciesDiffusivity(0)
21 {
22 
23 }
24 
25 LiquidTransportData::LiquidTransportData(const LiquidTransportData& right) :
26  speciesName("-"),
27  hydroRadius(0),
28  viscosity(0),
29  ionConductivity(0),
30  mobilityRatio(0),
31  selfDiffusion(0),
32  thermalCond(0),
33  electCond(0),
34  speciesDiffusivity(0)
35 {
36  *this = right; //use assignment operator to do other work
37 }
38 
39 LiquidTransportData& LiquidTransportData::operator=(const LiquidTransportData& right)
40 {
41  if (&right != this) {
42  // These are all shallow pointer copies - yes, yes, yes horrible crime.
43  speciesName = right.speciesName;
44  if (right.hydroRadius) {
45  hydroRadius = (right.hydroRadius)->duplMyselfAsLTPspecies();
46  }
47  if (right.viscosity) {
48  viscosity = (right.viscosity)->duplMyselfAsLTPspecies();
49  }
50  if (right.ionConductivity) {
51  ionConductivity = (right.ionConductivity)->duplMyselfAsLTPspecies();
52  }
53 
54  mobilityRatio = right.mobilityRatio;
55  for (size_t k = 0; k < mobilityRatio.size(); k++) {
56  if (right.mobilityRatio[k]) {
57  mobilityRatio[k] = (right.mobilityRatio[k])->duplMyselfAsLTPspecies();
58  }
59  }
60 
61  selfDiffusion = right.selfDiffusion;
62  for (size_t k = 0; k < selfDiffusion.size(); k++) {
63  if (right.selfDiffusion[k]) {
64  selfDiffusion[k] = (right.selfDiffusion[k])->duplMyselfAsLTPspecies();
65  }
66  }
67 
68  if (right.thermalCond) {
69  thermalCond = (right.thermalCond)->duplMyselfAsLTPspecies();
70  }
71  if (right.electCond) {
72  electCond = (right.electCond)->duplMyselfAsLTPspecies();
73  }
74  if (right.speciesDiffusivity) {
75  speciesDiffusivity = (right.speciesDiffusivity)->duplMyselfAsLTPspecies();
76  }
77  }
78  return *this;
79 }
80 
81 LiquidTransportData::~LiquidTransportData()
82 {
83  delete hydroRadius;
84  delete viscosity;
85  delete ionConductivity;
86 
87  for (size_t k = 0; k < mobilityRatio.size(); k++) {
88  if (mobilityRatio[k]) {
89  delete mobilityRatio[k];
90  }
91  }
92  for (size_t k = 0; k < selfDiffusion.size(); k++) {
93  if (selfDiffusion[k]) {
94  delete selfDiffusion[k];
95  }
96  }
97 
98  delete thermalCond;
99  delete electCond;
100  delete speciesDiffusivity;
101 }
102 
103 }
LTPspecies * thermalCond
Model type for the thermal conductivity.
LTPspecies * speciesDiffusivity
Model type for the speciesDiffusivity.
Header file defining class LiquidTransportData.
LTPspecies * electCond
Model type for the electrical conductivity.
std::string speciesName
A LiquidTransportData object is instantiated for each species.
std::vector< LTPspecies * > mobilityRatio
Model type for the mobility ratio.
LTPspecies * hydroRadius
Model type for the hydroradius.
std::vector< LTPspecies * > selfDiffusion
Model type for the self diffusion coefficients.
LTPspecies * viscosity
Model type for the viscosity.
LTPspecies * ionConductivity
Model type for the ionic conductivity.