with arbitrary number of temperature intervals, to Cantera's underlying routines. Cantera can now read fortran formatted NASA9 polynomials to create cti files The cti files can then be translated into xml files. And, the xml files can now be read into constant pressure standard state objects and used normally within the guts of Cantera. Currently, the standard state just links into the GeneralSpeciesThermo object, which means that it's calculation speed is slow. However, atm this satisfies the initial use case for this new capability. In the near future, I'll push this out to the matlab and python interfaces.
101 lines
1.9 KiB
C++
101 lines
1.9 KiB
C++
/**
|
|
* @file Species.cpp
|
|
*
|
|
*/
|
|
|
|
// Copyright 2001 California Institute of Technology
|
|
|
|
|
|
#include "Species.h"
|
|
#include <iostream>
|
|
#include <stdio.h>
|
|
|
|
namespace ckr {
|
|
|
|
// Construct an empty Species object
|
|
Species::Species() :
|
|
thermoFormatType(0),
|
|
name ("<empty>"),
|
|
id ("<none>"),
|
|
phase (""),
|
|
tlow(0.0),
|
|
tmid(0.0),
|
|
thigh(0.0),
|
|
nTempRegions(2),
|
|
valid(0),
|
|
index(-1)
|
|
{
|
|
}
|
|
|
|
// Destructor
|
|
Species::~Species() {
|
|
delR();
|
|
}
|
|
|
|
void Species::delR() {
|
|
int iReg = region_coeffs.size();
|
|
for (int i = 0; i < iReg; i++) {
|
|
if (region_coeffs[i]) {
|
|
delete region_coeffs[i];
|
|
region_coeffs[i] = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
//! Copy constructor
|
|
Species::Species(const Species& s)
|
|
{
|
|
/*
|
|
* Use the assignment operator to do the brunt
|
|
* of the work for the copy construtor.
|
|
*/
|
|
*this = s;
|
|
}
|
|
|
|
// Assignment operator
|
|
Species& Species::operator=(const Species& s) {
|
|
if (&s == this) return *this;
|
|
thermoFormatType = s.thermoFormatType;
|
|
name = s.name;
|
|
id = s.id;
|
|
phase = s.phase;
|
|
tlow = s.tlow;
|
|
tmid = s.tmid;
|
|
thigh = s.thigh;
|
|
nTempRegions = s.nTempRegions;
|
|
elements = s.elements;
|
|
comp = s.comp;
|
|
lowCoeffs = s.lowCoeffs;
|
|
highCoeffs = s.highCoeffs;
|
|
delR();
|
|
int iReg = s.region_coeffs.size();
|
|
for (int i = 0; i < iReg; i++) {
|
|
region_coeffs.push_back(new vector_fp(*(s.region_coeffs[i])));
|
|
}
|
|
minTemps = s.minTemps;
|
|
maxTemps = s.maxTemps;
|
|
m_commentsRef = s.m_commentsRef;
|
|
valid = s.valid;
|
|
index = s.index;
|
|
return *this;
|
|
}
|
|
|
|
// Test for equality based on name only.
|
|
bool Species::operator==(const Species& s) const {
|
|
return (s.name == name);
|
|
}
|
|
|
|
bool Species::operator!=(const Species& s) const {
|
|
return !(*this == s);
|
|
}
|
|
|
|
// Used to sort lists of species by index number.
|
|
bool Species::operator<(const Species& s) const {
|
|
return (index < s.index);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|