All tests using TemperatureTable.h now use a shared copy

This commit is contained in:
Ray Speth 2012-02-22 00:16:48 +00:00
parent 437294ae00
commit 01e63f004e
8 changed files with 6 additions and 751 deletions

View file

@ -2,7 +2,7 @@ from buildutils import *
Import('env','buildTargets','installTargets')
localenv = env.Clone()
localenv.Append(CPPPATH=['#include', '#src'])
localenv.Append(CPPPATH=['#include', '#src', 'shared'])
os.environ['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'Cantera', 'python')
os.environ['CANTERA_DATA'] = pjoin(os.getcwd(), '..', 'data', 'inputs')

View file

@ -1,123 +0,0 @@
/*
* Copyright 2004 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000, there is a non-exclusive license for use of this
* work by or on behalf of the U.S. Government. Export of this program
* may require a license from the United States Government.
*/
#ifndef TEMPERATURE_TABLE_H
#define TEMPERATURE_TABLE_H
//#include "cantera/base/mdp_allo.h"
#include <vector>
using std::vector;
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/**
* This Class constructs a vector of temperature from which to make
* a table.
*/
class TemperatureTable
{
public:
int NPoints;
bool Include298;
double Tlow; //!< Min temperature for thermo data fit
double Thigh; //!< Max temperature for thermo table
double DeltaT;
vector<double> T;
int numAddedTs;
vector<double> AddedTempVector;
public:
/*
* Default constructor for TemperatureTable()
*/
TemperatureTable(const int nPts = 14,
const bool inc298 = true,
const double tlow = 300.,
const double deltaT = 100.,
const int numAdded = 0,
const double* addedTempVector = 0) :
NPoints(nPts),
Include298(inc298),
Tlow(tlow),
DeltaT(deltaT),
T(0),
numAddedTs(numAdded) {
/****************************/
int i;
// AddedTempVector = mdp_alloc_dbl_1(numAdded, 0.0);
AddedTempVector.resize(numAdded, 0.0);
for (int i = 0; i < numAdded; i++) {
AddedTempVector[i] = addedTempVector[i];
}
//mdp_copy_dbl_1(AddedTempVector, addedTempVector, numAdded);
// T = mdp_alloc_dbl_1(NPoints, 0.0);
T.resize(NPoints, 0.0);
double TCurrent = Tlow;
for (i = 0; i < NPoints; i++) {
T[i] = TCurrent;
TCurrent += DeltaT;
}
if (Include298) {
T.push_back(298.15);
//mdp_realloc_dbl_1(&T, NPoints+1, NPoints, 298.15);
NPoints++;
}
if (numAdded > 0) {
//mdp_realloc_dbl_1(&T, NPoints+numAdded, NPoints, 0.0);
T.resize(NPoints+numAdded, 0.0);
for (i = 0; i < numAdded; i++) {
T[i+NPoints] = addedTempVector[i];
}
NPoints += numAdded;
}
std::sort(T.begin(), T.end());
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Destructor
*/
~TemperatureTable() {
//mdp_safe_free((void **) &AddedTempVector);
// mdp_safe_free((void **) &T);
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Overloaded operator[]
*
* return the array value in the vector
*/
double operator[](const int i) {
return T[i];
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* size()
*/
int size() {
return NPoints;
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Block assignment and copy constructors: not needed.
*/
private:
TemperatureTable(const TemperatureTable&);
TemperatureTable& operator=(const TemperatureTable&);
};
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
#endif

View file

@ -1,123 +0,0 @@
/*
* Copyright 2004 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000, there is a non-exclusive license for use of this
* work by or on behalf of the U.S. Government. Export of this program
* may require a license from the United States Government.
*/
#ifndef TEMPERATURE_TABLE_H
#define TEMPERATURE_TABLE_H
//#include "cantera/base/mdp_allo.h"
#include <vector>
using std::vector;
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/**
* This Class constructs a vector of temperature from which to make
* a table.
*/
class TemperatureTable
{
public:
int NPoints;
bool Include298;
double Tlow; //!< Min temperature for thermo data fit
double Thigh; //!< Max temperature for thermo table
double DeltaT;
vector<double> T;
int numAddedTs;
vector<double> AddedTempVector;
public:
/*
* Default constructor for TemperatureTable()
*/
TemperatureTable(const int nPts = 14,
const bool inc298 = true,
const double tlow = 300.,
const double deltaT = 100.,
const int numAdded = 0,
const double* addedTempVector = 0) :
NPoints(nPts),
Include298(inc298),
Tlow(tlow),
DeltaT(deltaT),
T(0),
numAddedTs(numAdded) {
/****************************/
int i;
// AddedTempVector = mdp_alloc_dbl_1(numAdded, 0.0);
AddedTempVector.resize(numAdded, 0.0);
for (int i = 0; i < numAdded; i++) {
AddedTempVector[i] = addedTempVector[i];
}
//mdp_copy_dbl_1(AddedTempVector, addedTempVector, numAdded);
// T = mdp_alloc_dbl_1(NPoints, 0.0);
T.resize(NPoints, 0.0);
double TCurrent = Tlow;
for (i = 0; i < NPoints; i++) {
T[i] = TCurrent;
TCurrent += DeltaT;
}
if (Include298) {
T.push_back(298.15);
//mdp_realloc_dbl_1(&T, NPoints+1, NPoints, 298.15);
NPoints++;
}
if (numAdded > 0) {
//mdp_realloc_dbl_1(&T, NPoints+numAdded, NPoints, 0.0);
T.resize(NPoints+numAdded, 0.0);
for (i = 0; i < numAdded; i++) {
T[i+NPoints] = addedTempVector[i];
}
NPoints += numAdded;
}
std::sort(T.begin(), T.end());
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Destructor
*/
~TemperatureTable() {
//mdp_safe_free((void **) &AddedTempVector);
// mdp_safe_free((void **) &T);
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Overloaded operator[]
*
* return the array value in the vector
*/
double operator[](const int i) {
return T[i];
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* size()
*/
int size() {
return NPoints;
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Block assignment and copy constructors: not needed.
*/
private:
TemperatureTable(const TemperatureTable&);
TemperatureTable& operator=(const TemperatureTable&);
};
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
#endif

View file

@ -1,123 +0,0 @@
/*
* Copyright 2004 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000, there is a non-exclusive license for use of this
* work by or on behalf of the U.S. Government. Export of this program
* may require a license from the United States Government.
*/
#ifndef TEMPERATURE_TABLE_H
#define TEMPERATURE_TABLE_H
//#include "cantera/base/mdp_allo.h"
#include <vector>
using std::vector;
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/**
* This Class constructs a vector of temperature from which to make
* a table.
*/
class TemperatureTable
{
public:
int NPoints;
bool Include298;
double Tlow; //!< Min temperature for thermo data fit
double Thigh; //!< Max temperature for thermo table
double DeltaT;
vector<double> T;
int numAddedTs;
vector<double> AddedTempVector;
public:
/*
* Default constructor for TemperatureTable()
*/
TemperatureTable(const int nPts = 14,
const bool inc298 = true,
const double tlow = 300.,
const double deltaT = 100.,
const int numAdded = 0,
const double* addedTempVector = 0) :
NPoints(nPts),
Include298(inc298),
Tlow(tlow),
DeltaT(deltaT),
T(0),
numAddedTs(numAdded) {
/****************************/
int i;
// AddedTempVector = mdp_alloc_dbl_1(numAdded, 0.0);
AddedTempVector.resize(numAdded, 0.0);
for (int i = 0; i < numAdded; i++) {
AddedTempVector[i] = addedTempVector[i];
}
//mdp_copy_dbl_1(AddedTempVector, addedTempVector, numAdded);
// T = mdp_alloc_dbl_1(NPoints, 0.0);
T.resize(NPoints, 0.0);
double TCurrent = Tlow;
for (i = 0; i < NPoints; i++) {
T[i] = TCurrent;
TCurrent += DeltaT;
}
if (Include298) {
T.push_back(298.15);
//mdp_realloc_dbl_1(&T, NPoints+1, NPoints, 298.15);
NPoints++;
}
if (numAdded > 0) {
//mdp_realloc_dbl_1(&T, NPoints+numAdded, NPoints, 0.0);
T.resize(NPoints+numAdded, 0.0);
for (i = 0; i < numAdded; i++) {
T[i+NPoints] = addedTempVector[i];
}
NPoints += numAdded;
}
std::sort(T.begin(), T.end());
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Destructor
*/
~TemperatureTable() {
//mdp_safe_free((void **) &AddedTempVector);
// mdp_safe_free((void **) &T);
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Overloaded operator[]
*
* return the array value in the vector
*/
double operator[](const int i) {
return T[i];
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* size()
*/
int size() {
return NPoints;
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Block assignment and copy constructors: not needed.
*/
private:
TemperatureTable(const TemperatureTable&);
TemperatureTable& operator=(const TemperatureTable&);
};
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
#endif

View file

@ -1,123 +0,0 @@
/*
* Copyright 2004 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000, there is a non-exclusive license for use of this
* work by or on behalf of the U.S. Government. Export of this program
* may require a license from the United States Government.
*/
#ifndef TEMPERATURE_TABLE_H
#define TEMPERATURE_TABLE_H
//#include "cantera/base/mdp_allo.h"
#include <vector>
using std::vector;
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/**
* This Class constructs a vector of temperature from which to make
* a table.
*/
class TemperatureTable
{
public:
int NPoints;
bool Include298;
double Tlow; //!< Min temperature for thermo data fit
double Thigh; //!< Max temperature for thermo table
double DeltaT;
vector<double> T;
int numAddedTs;
vector<double> AddedTempVector;
public:
/*
* Default constructor for TemperatureTable()
*/
TemperatureTable(const int nPts = 14,
const bool inc298 = true,
const double tlow = 300.,
const double deltaT = 100.,
const int numAdded = 0,
const double* addedTempVector = 0) :
NPoints(nPts),
Include298(inc298),
Tlow(tlow),
DeltaT(deltaT),
T(0),
numAddedTs(numAdded) {
/****************************/
int i;
// AddedTempVector = mdp_alloc_dbl_1(numAdded, 0.0);
AddedTempVector.resize(numAdded, 0.0);
for (int i = 0; i < numAdded; i++) {
AddedTempVector[i] = addedTempVector[i];
}
//mdp_copy_dbl_1(AddedTempVector, addedTempVector, numAdded);
// T = mdp_alloc_dbl_1(NPoints, 0.0);
T.resize(NPoints, 0.0);
double TCurrent = Tlow;
for (i = 0; i < NPoints; i++) {
T[i] = TCurrent;
TCurrent += DeltaT;
}
if (Include298) {
T.push_back(298.15);
//mdp_realloc_dbl_1(&T, NPoints+1, NPoints, 298.15);
NPoints++;
}
if (numAdded > 0) {
//mdp_realloc_dbl_1(&T, NPoints+numAdded, NPoints, 0.0);
T.resize(NPoints+numAdded, 0.0);
for (i = 0; i < numAdded; i++) {
T[i+NPoints] = addedTempVector[i];
}
NPoints += numAdded;
}
std::sort(T.begin(), T.end());
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Destructor
*/
~TemperatureTable() {
//mdp_safe_free((void **) &AddedTempVector);
// mdp_safe_free((void **) &T);
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Overloaded operator[]
*
* return the array value in the vector
*/
double operator[](const int i) {
return T[i];
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* size()
*/
int size() {
return NPoints;
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Block assignment and copy constructors: not needed.
*/
private:
TemperatureTable(const TemperatureTable&);
TemperatureTable& operator=(const TemperatureTable&);
};
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
#endif

View file

@ -1,123 +0,0 @@
/*
* Copyright 2004 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000, there is a non-exclusive license for use of this
* work by or on behalf of the U.S. Government. Export of this program
* may require a license from the United States Government.
*/
#ifndef TEMPERATURE_TABLE_H
#define TEMPERATURE_TABLE_H
//#include "cantera/base/mdp_allo.h"
#include <vector>
using std::vector;
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/**
* This Class constructs a vector of temperature from which to make
* a table.
*/
class TemperatureTable
{
public:
int NPoints;
bool Include298;
double Tlow; //!< Min temperature for thermo data fit
double Thigh; //!< Max temperature for thermo table
double DeltaT;
vector<double> T;
int numAddedTs;
vector<double> AddedTempVector;
public:
/*
* Default constructor for TemperatureTable()
*/
TemperatureTable(const int nPts = 14,
const bool inc298 = true,
const double tlow = 300.,
const double deltaT = 100.,
const int numAdded = 0,
const double* addedTempVector = 0) :
NPoints(nPts),
Include298(inc298),
Tlow(tlow),
DeltaT(deltaT),
T(0),
numAddedTs(numAdded) {
/****************************/
int i;
// AddedTempVector = mdp_alloc_dbl_1(numAdded, 0.0);
AddedTempVector.resize(numAdded, 0.0);
for (int i = 0; i < numAdded; i++) {
AddedTempVector[i] = addedTempVector[i];
}
//mdp_copy_dbl_1(AddedTempVector, addedTempVector, numAdded);
// T = mdp_alloc_dbl_1(NPoints, 0.0);
T.resize(NPoints, 0.0);
double TCurrent = Tlow;
for (i = 0; i < NPoints; i++) {
T[i] = TCurrent;
TCurrent += DeltaT;
}
if (Include298) {
T.push_back(298.15);
//mdp_realloc_dbl_1(&T, NPoints+1, NPoints, 298.15);
NPoints++;
}
if (numAdded > 0) {
//mdp_realloc_dbl_1(&T, NPoints+numAdded, NPoints, 0.0);
T.resize(NPoints+numAdded, 0.0);
for (i = 0; i < numAdded; i++) {
T[i+NPoints] = addedTempVector[i];
}
NPoints += numAdded;
}
std::sort(T.begin(), T.end());
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Destructor
*/
~TemperatureTable() {
//mdp_safe_free((void **) &AddedTempVector);
// mdp_safe_free((void **) &T);
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Overloaded operator[]
*
* return the array value in the vector
*/
double operator[](const int i) {
return T[i];
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* size()
*/
int size() {
return NPoints;
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Block assignment and copy constructors: not needed.
*/
private:
TemperatureTable(const TemperatureTable&);
TemperatureTable& operator=(const TemperatureTable&);
};
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
#endif

View file

@ -1,123 +0,0 @@
/*
* Copyright 2004 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000, there is a non-exclusive license for use of this
* work by or on behalf of the U.S. Government. Export of this program
* may require a license from the United States Government.
*/
#ifndef TEMPERATURE_TABLE_H
#define TEMPERATURE_TABLE_H
//#include "cantera/base/mdp_allo.h"
#include <vector>
using std::vector;
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/**
* This Class constructs a vector of temperature from which to make
* a table.
*/
class TemperatureTable
{
public:
int NPoints;
bool Include298;
double Tlow; //!< Min temperature for thermo data fit
double Thigh; //!< Max temperature for thermo table
double DeltaT;
vector<double> T;
int numAddedTs;
vector<double> AddedTempVector;
public:
/*
* Default constructor for TemperatureTable()
*/
TemperatureTable(const int nPts = 14,
const bool inc298 = true,
const double tlow = 300.,
const double deltaT = 100.,
const int numAdded = 0,
const double* addedTempVector = 0) :
NPoints(nPts),
Include298(inc298),
Tlow(tlow),
DeltaT(deltaT),
T(0),
numAddedTs(numAdded) {
/****************************/
int i;
// AddedTempVector = mdp_alloc_dbl_1(numAdded, 0.0);
AddedTempVector.resize(numAdded, 0.0);
for (int i = 0; i < numAdded; i++) {
AddedTempVector[i] = addedTempVector[i];
}
//mdp_copy_dbl_1(AddedTempVector, addedTempVector, numAdded);
// T = mdp_alloc_dbl_1(NPoints, 0.0);
T.resize(NPoints, 0.0);
double TCurrent = Tlow;
for (i = 0; i < NPoints; i++) {
T[i] = TCurrent;
TCurrent += DeltaT;
}
if (Include298) {
T.push_back(298.15);
//mdp_realloc_dbl_1(&T, NPoints+1, NPoints, 298.15);
NPoints++;
}
if (numAdded > 0) {
//mdp_realloc_dbl_1(&T, NPoints+numAdded, NPoints, 0.0);
T.resize(NPoints+numAdded, 0.0);
for (i = 0; i < numAdded; i++) {
T[i+NPoints] = addedTempVector[i];
}
NPoints += numAdded;
}
std::sort(T.begin(), T.end());
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Destructor
*/
~TemperatureTable() {
//mdp_safe_free((void **) &AddedTempVector);
// mdp_safe_free((void **) &T);
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Overloaded operator[]
*
* return the array value in the vector
*/
double operator[](const int i) {
return T[i];
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* size()
*/
int size() {
return NPoints;
}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*
* Block assignment and copy constructors: not needed.
*/
private:
TemperatureTable(const TemperatureTable&);
TemperatureTable& operator=(const TemperatureTable&);
};
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
#endif

View file

@ -1,14 +1,15 @@
/*
* Copyright 2004 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000, there is a non-exclusive license for use of this
* work by or on behalf of the U.S. Government. Export of this program
* may require a license from the United States Government.
* work by or on behalf of the U.S. Government.
*/
#ifndef TEMPERATURE_TABLE_H
#define TEMPERATURE_TABLE_H
//#include "cantera/base/mdp_allo.h"
#include <vector>
#include <algorithm>
using std::vector;
/***********************************************************************/
@ -48,13 +49,10 @@ public:
numAddedTs(numAdded) {
/****************************/
int i;
// AddedTempVector = mdp_alloc_dbl_1(numAdded, 0.0);
AddedTempVector.resize(numAdded, 0.0);
for (int i = 0; i < numAdded; i++) {
AddedTempVector[i] = addedTempVector[i];
}
//mdp_copy_dbl_1(AddedTempVector, addedTempVector, numAdded);
// T = mdp_alloc_dbl_1(NPoints, 0.0);
T.resize(NPoints, 0.0);
double TCurrent = Tlow;
for (i = 0; i < NPoints; i++) {
@ -63,11 +61,9 @@ public:
}
if (Include298) {
T.push_back(298.15);
//mdp_realloc_dbl_1(&T, NPoints+1, NPoints, 298.15);
NPoints++;
}
if (numAdded > 0) {
//mdp_realloc_dbl_1(&T, NPoints+numAdded, NPoints, 0.0);
T.resize(NPoints+numAdded, 0.0);
for (i = 0; i < numAdded; i++) {
T[i+NPoints] = addedTempVector[i];
@ -82,10 +78,7 @@ public:
/*
* Destructor
*/
~TemperatureTable() {
//mdp_safe_free((void **) &AddedTempVector);
// mdp_safe_free((void **) &T);
}
~TemperatureTable() {}
/***********************************************************************/
/***********************************************************************/