Cantera
2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
converters
Species.cpp
Go to the documentation of this file.
1
/**
2
* @file Species.cpp
3
*
4
*/
5
6
// Copyright 2001 California Institute of Technology
7
8
9
#include "
Species.h
"
10
#include <iostream>
11
#include <stdio.h>
12
13
namespace
ckr
14
{
15
16
// Construct an empty Species object
17
Species::Species
() :
18
thermoFormatType(0),
19
name(
"<empty>"
),
20
id(
"<none>"
),
21
phase(
""
),
22
tlow(0.0),
23
tmid(0.0),
24
thigh(0.0),
25
nTempRegions(2),
26
valid
(0),
27
index(-1)
28
{
29
}
30
31
// Destructor
32
Species::~Species
()
33
{
34
delR
();
35
}
36
37
void
Species::delR
()
38
{
39
for
(
size_t
i = 0; i < region_coeffs.size(); i++) {
40
if
(region_coeffs[i]) {
41
delete
region_coeffs[i];
42
region_coeffs[i] = 0;
43
}
44
}
45
}
46
47
//! Copy constructor
48
Species::Species
(
const
Species
& s)
49
{
50
/*
51
* Use the assignment operator to do the brunt
52
* of the work for the copy constructor.
53
*/
54
*
this
= s;
55
}
56
57
// Assignment operator
58
Species
&
Species::operator=
(
const
Species
& s)
59
{
60
if
(&s ==
this
) {
61
return
*
this
;
62
}
63
thermoFormatType
= s.
thermoFormatType
;
64
name
= s.
name
;
65
id
= s.
id
;
66
phase
= s.
phase
;
67
tlow
= s.
tlow
;
68
tmid
= s.
tmid
;
69
thigh
= s.
thigh
;
70
nTempRegions
= s.
nTempRegions
;
71
elements
= s.
elements
;
72
comp
= s.
comp
;
73
lowCoeffs
= s.
lowCoeffs
;
74
highCoeffs
= s.
highCoeffs
;
75
delR
();
76
for
(
size_t
i = 0; i < s.region_coeffs.size(); i++) {
77
region_coeffs.push_back(
new
vector_fp(*(s.region_coeffs[i])));
78
}
79
minTemps = s.minTemps;
80
maxTemps = s.maxTemps;
81
m_commentsRef = s.m_commentsRef;
82
valid
= s.
valid
;
83
index
= s.
index
;
84
return
*
this
;
85
}
86
87
// Test for equality based on name only.
88
bool
Species::operator==
(
const
Species
& s)
const
89
{
90
return
(s.
name
==
name
);
91
}
92
93
bool
Species::operator!=(
const
Species
& s)
const
94
{
95
return
!(*
this
== s);
96
}
97
98
// Used to sort lists of species by index number.
99
bool
Species::operator<
(
const
Species
& s)
const
100
{
101
return
(
index
< s.
index
);
102
}
103
104
105
106
107
108
}
Generated by
1.8.2