Cantera  2.3.0
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 // This file is part of Cantera. See License.txt in the top-level directory or
7 // at http://www.cantera.org/license.txt for license and copyright information.
8 
10 using namespace std;
11 
12 namespace Cantera
13 {
14 LiquidTransportData::LiquidTransportData() :
15  speciesName("-"),
16  hydroRadius(0),
17  viscosity(0),
18  ionConductivity(0),
19  thermalCond(0),
20  electCond(0),
21  speciesDiffusivity(0)
22 {
23 }
24 
25 LiquidTransportData::LiquidTransportData(const LiquidTransportData& right) :
26  speciesName("-"),
27  hydroRadius(0),
28  viscosity(0),
29  ionConductivity(0),
30  thermalCond(0),
31  electCond(0),
32  speciesDiffusivity(0)
33 {
34  *this = right; //use assignment operator to do other work
35 }
36 
37 LiquidTransportData& LiquidTransportData::operator=(const LiquidTransportData& right)
38 {
39  if (&right != this) {
40  // These are all shallow pointer copies - yes, yes, yes horrible crime.
41  speciesName = right.speciesName;
42  if (right.hydroRadius) {
43  hydroRadius = (right.hydroRadius)->duplMyselfAsLTPspecies();
44  }
45  if (right.viscosity) {
46  viscosity = (right.viscosity)->duplMyselfAsLTPspecies();
47  }
48  if (right.ionConductivity) {
49  ionConductivity = (right.ionConductivity)->duplMyselfAsLTPspecies();
50  }
51 
52  mobilityRatio = right.mobilityRatio;
53  for (size_t k = 0; k < mobilityRatio.size(); k++) {
54  if (right.mobilityRatio[k]) {
55  mobilityRatio[k] = (right.mobilityRatio[k])->duplMyselfAsLTPspecies();
56  }
57  }
58 
59  selfDiffusion = right.selfDiffusion;
60  for (size_t k = 0; k < selfDiffusion.size(); k++) {
61  if (right.selfDiffusion[k]) {
62  selfDiffusion[k] = (right.selfDiffusion[k])->duplMyselfAsLTPspecies();
63  }
64  }
65 
66  if (right.thermalCond) {
67  thermalCond = (right.thermalCond)->duplMyselfAsLTPspecies();
68  }
69  if (right.electCond) {
70  electCond = (right.electCond)->duplMyselfAsLTPspecies();
71  }
72  if (right.speciesDiffusivity) {
73  speciesDiffusivity = (right.speciesDiffusivity)->duplMyselfAsLTPspecies();
74  }
75  }
76  return *this;
77 }
78 
79 LiquidTransportData::~LiquidTransportData()
80 {
81  delete hydroRadius;
82  delete viscosity;
83  delete ionConductivity;
84 
85  for (size_t k = 0; k < mobilityRatio.size(); k++) {
86  delete mobilityRatio[k];
87  }
88  for (size_t k = 0; k < selfDiffusion.size(); k++) {
89  delete selfDiffusion[k];
90  }
91 
92  delete thermalCond;
93  delete electCond;
94  delete speciesDiffusivity;
95 }
96 
97 }
LTPspecies * thermalCond
Model type for the thermal conductivity.
STL namespace.
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.
Namespace for the Cantera kernel.
Definition: application.cpp:29
LTPspecies * ionConductivity
Model type for the ionic conductivity.