changes to make type integer compatible with f2c
This commit is contained in:
parent
6ade908e92
commit
3de1be8c1d
12 changed files with 148 additions and 134 deletions
|
|
@ -135,7 +135,7 @@ namespace Cantera {
|
|||
*/
|
||||
int invert(DenseMatrix& A, int nn) {
|
||||
integer n = (nn > 0 ? nn : static_cast<int>(A.nRows()));
|
||||
integer info=0;
|
||||
int info=0;
|
||||
ct_dgetrf(n, n, A.begin(), static_cast<int>(A.nRows()),
|
||||
A.ipiv().begin(), info);
|
||||
if (info != 0)
|
||||
|
|
|
|||
|
|
@ -612,11 +612,11 @@ namespace Cantera {
|
|||
if (!m_finalized) {
|
||||
int i, j, nr, np;
|
||||
m_kdata->falloff_work.resize(
|
||||
static_cast<ctvector_fp::size_t>(m_falloffn.workSize()));
|
||||
static_cast<size_t>(m_falloffn.workSize()));
|
||||
m_kdata->concm_3b_values.resize(
|
||||
static_cast<ctvector_fp::size_t>(m_3b_concm.workSize()));
|
||||
static_cast<size_t>(m_3b_concm.workSize()));
|
||||
m_kdata->concm_falloff_values.resize(
|
||||
static_cast<ctvector_fp::size_t>(m_falloff_concm.workSize()));
|
||||
static_cast<size_t>(m_falloff_concm.workSize()));
|
||||
|
||||
for (i = 0; i < m_ii; i++) {
|
||||
nr = m_reactants[i].size();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
// Copyright 2001 California Institute of Technology
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.14 2004-09-13 11:22:21 dggoodwin
|
||||
// Revision 1.15 2004-10-10 20:46:36 dggoodwin
|
||||
// changes to make type integer compatible with f2c
|
||||
//
|
||||
// Revision 1.14 2004/09/13 11:22:21 dggoodwin
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.13 2004/08/28 16:12:41 dggoodwin
|
||||
|
|
@ -1382,7 +1385,7 @@ next:
|
|||
string::const_iterator begin = s.begin();
|
||||
string::const_iterator end = s.end();
|
||||
vector<string>::iterator e;
|
||||
result.resize(static_cast<ct::ctvector_int::size_t>(esyms.size()),0);
|
||||
result.resize(static_cast<size_t>(esyms.size()),0);
|
||||
for (; begin != end; ++begin) {
|
||||
|
||||
// new element
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace ckr {
|
|||
<< ", " << c[2] << ", " << c[3] << ")" << endl;
|
||||
}
|
||||
else {
|
||||
for (ct::ctvector_fp::size_t n = 0; n < c.size(); n++) {
|
||||
for (size_t n = 0; n < c.size(); n++) {
|
||||
log << c[n] << ", "; log << endl;
|
||||
}
|
||||
log << "###### ERROR ##### incorrect number of parameters" << endl;
|
||||
|
|
@ -70,7 +70,7 @@ namespace ckr {
|
|||
<< ")" << endl;
|
||||
}
|
||||
else {
|
||||
for (ct::ctvector_fp::size_t n = 0; n < c.size(); n++) {
|
||||
for (size_t n = 0; n < c.size(); n++) {
|
||||
log << c[n] << ", "; log << endl;
|
||||
}
|
||||
log << "##### ERROR ##### incorrect number of parameters" << endl;
|
||||
|
|
|
|||
|
|
@ -119,89 +119,89 @@ namespace ct {
|
|||
void ctvector_fp::clear() { fill(_data, _data + _size, 0.0); resize(0); }
|
||||
|
||||
|
||||
//-------------------------------------//
|
||||
// ctvector_float //
|
||||
//-------------------------------------//
|
||||
// //-------------------------------------//
|
||||
// // ctvector_float //
|
||||
// //-------------------------------------//
|
||||
|
||||
|
||||
ctvector_float::ctvector_float(size_t n) : _size(0), _alloc(0), _data(0) {
|
||||
resize(n);
|
||||
}
|
||||
// ctvector_float::ctvector_float(size_t n) : _size(0), _alloc(0), _data(0) {
|
||||
// resize(n);
|
||||
// }
|
||||
|
||||
ctvector_float::ctvector_float(size_t n, value_type v0)
|
||||
: _size(0), _alloc(0), _data(0) {
|
||||
resize(n, v0);
|
||||
}
|
||||
// ctvector_float::ctvector_float(size_t n, value_type v0)
|
||||
// : _size(0), _alloc(0), _data(0) {
|
||||
// resize(n, v0);
|
||||
// }
|
||||
|
||||
ctvector_float::ctvector_float(const ctvector_float& x) {
|
||||
if (x._alloc > 0) {
|
||||
_data = new value_type[x._alloc];
|
||||
copy(x._data, x._data + x._alloc, _data);
|
||||
}
|
||||
else {
|
||||
_data = 0;
|
||||
}
|
||||
_size = x._size;
|
||||
_alloc = x._alloc;
|
||||
}
|
||||
// ctvector_float::ctvector_float(const ctvector_float& x) {
|
||||
// if (x._alloc > 0) {
|
||||
// _data = new value_type[x._alloc];
|
||||
// copy(x._data, x._data + x._alloc, _data);
|
||||
// }
|
||||
// else {
|
||||
// _data = 0;
|
||||
// }
|
||||
// _size = x._size;
|
||||
// _alloc = x._alloc;
|
||||
// }
|
||||
|
||||
ctvector_float ctvector_float::operator=(const ctvector_float& x) {
|
||||
if (this == &x) return *this;
|
||||
if (_data) delete[] _data;
|
||||
if (x._alloc > 0) {
|
||||
_data = new value_type[x._alloc];
|
||||
copy(x._data, x._data + x._alloc, _data);
|
||||
}
|
||||
else {
|
||||
_data = 0;
|
||||
}
|
||||
_size = x._size;
|
||||
_alloc = x._alloc;
|
||||
return *this;
|
||||
}
|
||||
// ctvector_float ctvector_float::operator=(const ctvector_float& x) {
|
||||
// if (this == &x) return *this;
|
||||
// if (_data) delete[] _data;
|
||||
// if (x._alloc > 0) {
|
||||
// _data = new value_type[x._alloc];
|
||||
// copy(x._data, x._data + x._alloc, _data);
|
||||
// }
|
||||
// else {
|
||||
// _data = 0;
|
||||
// }
|
||||
// _size = x._size;
|
||||
// _alloc = x._alloc;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
ctvector_float::~ctvector_float() {
|
||||
if (_data) delete[] _data;
|
||||
_data = 0;
|
||||
}
|
||||
// ctvector_float::~ctvector_float() {
|
||||
// if (_data) delete[] _data;
|
||||
// _data = 0;
|
||||
// }
|
||||
|
||||
void ctvector_float::resize(size_t n) {
|
||||
size_t new_alloc = n+1;
|
||||
value_type* newdata = new value_type[new_alloc];
|
||||
size_t datalen = (n > _size ? _size : n);
|
||||
if (_data) {
|
||||
copy(_data, _data + datalen, newdata);
|
||||
}
|
||||
if (_data) delete[] _data;
|
||||
_data = newdata;
|
||||
_alloc = new_alloc;
|
||||
_size = n;
|
||||
}
|
||||
// void ctvector_float::resize(size_t n) {
|
||||
// size_t new_alloc = n+1;
|
||||
// value_type* newdata = new value_type[new_alloc];
|
||||
// size_t datalen = (n > _size ? _size : n);
|
||||
// if (_data) {
|
||||
// copy(_data, _data + datalen, newdata);
|
||||
// }
|
||||
// if (_data) delete[] _data;
|
||||
// _data = newdata;
|
||||
// _alloc = new_alloc;
|
||||
// _size = n;
|
||||
// }
|
||||
|
||||
void ctvector_float::resize(size_t n, value_type v0) {
|
||||
size_t new_alloc = n+1;
|
||||
value_type* newdata = new value_type[new_alloc];
|
||||
fill(newdata, newdata + new_alloc, v0);
|
||||
size_t datalen = (n > _size ? _size : n);
|
||||
if (_data) {
|
||||
copy(_data, _data + datalen, newdata);
|
||||
}
|
||||
if (_data) delete[] _data;
|
||||
_data = newdata;
|
||||
_alloc = new_alloc;
|
||||
_size = n;
|
||||
}
|
||||
// void ctvector_float::resize(size_t n, value_type v0) {
|
||||
// size_t new_alloc = n+1;
|
||||
// value_type* newdata = new value_type[new_alloc];
|
||||
// fill(newdata, newdata + new_alloc, v0);
|
||||
// size_t datalen = (n > _size ? _size : n);
|
||||
// if (_data) {
|
||||
// copy(_data, _data + datalen, newdata);
|
||||
// }
|
||||
// if (_data) delete[] _data;
|
||||
// _data = newdata;
|
||||
// _alloc = new_alloc;
|
||||
// _size = n;
|
||||
// }
|
||||
|
||||
void ctvector_float::push_back(value_type x) {
|
||||
size_t loc = _size;
|
||||
if (_size == _alloc) {
|
||||
resize(2*_alloc);
|
||||
}
|
||||
_data[loc] = x;
|
||||
_size = loc + 1;
|
||||
}
|
||||
// void ctvector_float::push_back(value_type x) {
|
||||
// size_t loc = _size;
|
||||
// if (_size == _alloc) {
|
||||
// resize(2*_alloc);
|
||||
// }
|
||||
// _data[loc] = x;
|
||||
// _size = loc + 1;
|
||||
// }
|
||||
|
||||
void ctvector_float::clear() { fill(_data, _data + _size, 0.0); resize(0); }
|
||||
// void ctvector_float::clear() { fill(_data, _data + _size, 0.0); resize(0); }
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#define CT_CTVECTOR_H
|
||||
|
||||
#include <iostream>
|
||||
#include "config.h"
|
||||
|
||||
namespace ct {
|
||||
|
||||
|
|
@ -29,8 +30,8 @@ namespace ct {
|
|||
class ctvector_fp {
|
||||
public:
|
||||
|
||||
typedef unsigned int size_t;
|
||||
typedef double doublereal;
|
||||
//typedef unsigned int size_t;
|
||||
//typedef double doublereal;
|
||||
typedef doublereal* iterator;
|
||||
typedef const doublereal* const_iterator;
|
||||
typedef doublereal* pointer;
|
||||
|
|
@ -66,55 +67,55 @@ namespace ct {
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* A class for single-precision floating-point arrays
|
||||
*/
|
||||
class ctvector_float {
|
||||
public:
|
||||
// /**
|
||||
// * A class for single-precision floating-point arrays
|
||||
// */
|
||||
// class ctvector_float {
|
||||
// public:
|
||||
|
||||
typedef unsigned int size_t;
|
||||
typedef float doublereal;
|
||||
typedef doublereal* iterator;
|
||||
typedef const doublereal* const_iterator;
|
||||
typedef doublereal* pointer;
|
||||
typedef size_t difference_type;
|
||||
typedef doublereal value_type;
|
||||
// //typedef unsigned int size_t;
|
||||
// //typedef float doublereal;
|
||||
// typedef real* iterator;
|
||||
// typedef const real* const_iterator;
|
||||
// typedef real* pointer;
|
||||
// typedef size_t difference_type;
|
||||
// typedef real value_type;
|
||||
|
||||
ctvector_float(size_t n=0);
|
||||
ctvector_float(size_t n, value_type v0);
|
||||
ctvector_float(const ctvector_float& x);
|
||||
ctvector_float operator=(const ctvector_float& x);
|
||||
virtual ~ctvector_float();
|
||||
// ctvector_float(size_t n=0);
|
||||
// ctvector_float(size_t n, value_type v0);
|
||||
// ctvector_float(const ctvector_float& x);
|
||||
// ctvector_float operator=(const ctvector_float& x);
|
||||
// virtual ~ctvector_float();
|
||||
|
||||
value_type operator[](size_t n) const { return _data[n]; }
|
||||
value_type& operator[](size_t n) { return _data[n]; }
|
||||
// value_type operator[](size_t n) const { return _data[n]; }
|
||||
// value_type& operator[](size_t n) { return _data[n]; }
|
||||
|
||||
void resize(size_t n);
|
||||
void resize(size_t n, value_type v0);
|
||||
// void resize(size_t n);
|
||||
// void resize(size_t n, value_type v0);
|
||||
|
||||
value_type back() const { return _data[_size-1]; }
|
||||
const_iterator begin() const { return _data; }
|
||||
iterator begin() { return _data; }
|
||||
const_iterator end() const { return _data + _size; }
|
||||
iterator end() { return _data + _size; }
|
||||
void push_back(value_type x);
|
||||
size_t size() const { return _size; }
|
||||
void clear();
|
||||
bool empty() const { return (_size == 0); }
|
||||
// value_type back() const { return _data[_size-1]; }
|
||||
// const_iterator begin() const { return _data; }
|
||||
// iterator begin() { return _data; }
|
||||
// const_iterator end() const { return _data + _size; }
|
||||
// iterator end() { return _data + _size; }
|
||||
// void push_back(value_type x);
|
||||
// size_t size() const { return _size; }
|
||||
// void clear();
|
||||
// bool empty() const { return (_size == 0); }
|
||||
|
||||
protected:
|
||||
size_t _size, _alloc;
|
||||
iterator _data;
|
||||
private:
|
||||
};
|
||||
// protected:
|
||||
// size_t _size, _alloc;
|
||||
// iterator _data;
|
||||
// private:
|
||||
// };
|
||||
|
||||
|
||||
// integer arrays
|
||||
class ctvector_int {
|
||||
public:
|
||||
|
||||
typedef unsigned int size_t;
|
||||
typedef int integer;
|
||||
//typedef unsigned int size_t;
|
||||
//typedef long int integer;
|
||||
typedef integer* iterator;
|
||||
typedef const integer* const_iterator;
|
||||
typedef integer* pointer;
|
||||
|
|
@ -156,8 +157,8 @@ namespace ct {
|
|||
|
||||
std::ostream& operator<<(std::ostream& s, const ct::ctvector_fp& v);
|
||||
std::ostream& operator<<(std::ostream& s, ct::ctvector_fp& v);
|
||||
std::ostream& operator<<(std::ostream& s, const ct::ctvector_float& v);
|
||||
std::ostream& operator<<(std::ostream& s, ct::ctvector_float& v);
|
||||
//std::ostream& operator<<(std::ostream& s, const ct::ctvector_float& v);
|
||||
//std::ostream& operator<<(std::ostream& s, ct::ctvector_float& v);
|
||||
std::ostream& operator<<(std::ostream& s, const ct::ctvector_int& v);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -905,7 +905,7 @@ namespace Cantera {
|
|||
addFloat(flow, "pressure", m_press, "Pa", "pressure");
|
||||
addFloatArray(gv,"z",m_z.size(),m_z.begin(),
|
||||
"m","length");
|
||||
vector_fp x(static_cast<ctvector_fp::size_t>(soln.nColumns()));
|
||||
vector_fp x(static_cast<size_t>(soln.nColumns()));
|
||||
|
||||
soln.getRow(0,x.begin());
|
||||
addFloatArray(gv,"u",x.size(),x.begin(),"m/s","velocity");
|
||||
|
|
|
|||
|
|
@ -77,6 +77,10 @@ namespace Cantera {
|
|||
const doublereal FiveThirds = 5.0/3.0;
|
||||
|
||||
|
||||
TransportParams::~TransportParams(){
|
||||
delete xml;
|
||||
};
|
||||
|
||||
//////////////////// class Transport methods /////////////////////
|
||||
|
||||
void Transport::setThermo(thermo_t& thermo) {
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ namespace Cantera {
|
|||
public:
|
||||
|
||||
TransportParams() : thermo(0), xml(0) {}
|
||||
virtual ~TransportParams(){
|
||||
delete xml;
|
||||
}
|
||||
virtual ~TransportParams();
|
||||
int nsp;
|
||||
|
||||
// phase_t* mix;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@
|
|||
// are OK for most systems
|
||||
|
||||
typedef double doublereal; // Fortran double precision
|
||||
typedef int integer; // Fortran integer
|
||||
typedef int ftnlen; // Fortran hidden string length type
|
||||
typedef int integer; // Fortran integer
|
||||
typedef int ftnlen; // Fortran hidden string length type
|
||||
|
||||
|
||||
|
||||
// Fortran compilers pass character strings in argument lists by
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@ typedef __int64 ulongint; /* HACK ALERT */
|
|||
#pragma warning(disable:4101)
|
||||
#endif
|
||||
|
||||
typedef long int integer;
|
||||
typedef unsigned long int uinteger;
|
||||
//typedef long int integer;
|
||||
typedef int integer;
|
||||
//typedef unsigned long int uinteger;
|
||||
typedef unsigned int uinteger;
|
||||
typedef char *address;
|
||||
typedef short int shortint;
|
||||
typedef float real;
|
||||
|
|
@ -58,9 +60,12 @@ typedef short flag;
|
|||
typedef short ftnlen;
|
||||
typedef short ftnint;
|
||||
#else
|
||||
typedef long int flag;
|
||||
typedef long int ftnlen;
|
||||
typedef long int ftnint;
|
||||
//typedef long int flag;
|
||||
//typedef long int ftnlen;
|
||||
//typedef long int ftnint;
|
||||
typedef int flag;
|
||||
typedef int ftnlen;
|
||||
typedef int ftnint;
|
||||
#endif
|
||||
|
||||
/*external read, write*/
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
#include "f2c.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Table of constant values */
|
||||
|
||||
static integer c__0 = 0;
|
||||
|
|
@ -51,6 +52,7 @@ static integer c__1 = 1;
|
|||
|
||||
/* Function Body */
|
||||
if (*m != *m1 + *m2 + *m3) {
|
||||
printf(" %d %d %d %d ", *m, *m1, *m2, *m3);
|
||||
s_paus("Bad input constraint counts.", (ftnlen)28);
|
||||
}
|
||||
nl1 = *n;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue