Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  thermalCond(0),
17  electCond(0),
18  speciesDiffusivity(0)
19 {
20 
21 }
22 
23 LiquidTransportData::LiquidTransportData(const LiquidTransportData& right) :
24  speciesName("-"),
25  hydroRadius(0),
26  viscosity(0),
27  ionConductivity(0),
28  thermalCond(0),
29  electCond(0),
30  speciesDiffusivity(0)
31 {
32  *this = right; //use assignment operator to do other work
33 }
34 
35 LiquidTransportData& LiquidTransportData::operator=(const LiquidTransportData& right)
36 {
37  if (&right != this) {
38  // These are all shallow pointer copies - yes, yes, yes horrible crime.
39  speciesName = right.speciesName;
40  if (right.hydroRadius) {
41  hydroRadius = (right.hydroRadius)->duplMyselfAsLTPspecies();
42  }
43  if (right.viscosity) {
44  viscosity = (right.viscosity)->duplMyselfAsLTPspecies();
45  }
46  if (right.ionConductivity) {
47  ionConductivity = (right.ionConductivity)->duplMyselfAsLTPspecies();
48  }
49 
50  mobilityRatio = right.mobilityRatio;
51  for (size_t k = 0; k < mobilityRatio.size(); k++) {
52  if (right.mobilityRatio[k]) {
53  mobilityRatio[k] = (right.mobilityRatio[k])->duplMyselfAsLTPspecies();
54  }
55  }
56 
57  selfDiffusion = right.selfDiffusion;
58  for (size_t k = 0; k < selfDiffusion.size(); k++) {
59  if (right.selfDiffusion[k]) {
60  selfDiffusion[k] = (right.selfDiffusion[k])->duplMyselfAsLTPspecies();
61  }
62  }
63 
64  if (right.thermalCond) {
65  thermalCond = (right.thermalCond)->duplMyselfAsLTPspecies();
66  }
67  if (right.electCond) {
68  electCond = (right.electCond)->duplMyselfAsLTPspecies();
69  }
70  if (right.speciesDiffusivity) {
71  speciesDiffusivity = (right.speciesDiffusivity)->duplMyselfAsLTPspecies();
72  }
73  }
74  return *this;
75 }
76 
77 LiquidTransportData::~LiquidTransportData()
78 {
79  delete hydroRadius;
80  delete viscosity;
81  delete ionConductivity;
82 
83  for (size_t k = 0; k < mobilityRatio.size(); k++) {
84  if (mobilityRatio[k]) {
85  delete mobilityRatio[k];
86  }
87  }
88  for (size_t k = 0; k < selfDiffusion.size(); k++) {
89  if (selfDiffusion[k]) {
90  delete selfDiffusion[k];
91  }
92  }
93 
94  delete thermalCond;
95  delete electCond;
96  delete speciesDiffusivity;
97 }
98 
99 }
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.