changed from using ctvector to using std::vector. Required replacing v.begin() in many places by &v[0]. Macro DATA_PTR(v) defined for readability.

This commit is contained in:
Dave Goodwin 2006-04-28 17:22:23 +00:00
parent 1e44c119f7
commit f5ffa16a48
64 changed files with 455 additions and 432 deletions

View file

@ -50,7 +50,7 @@ int flamespeed(int np, void* p) {
else{ x[k]=0.0; }
}
gas.setState_TPX(temp,pressure,x.begin());
gas.setState_TPX(temp,pressure,DATA_PTR(x));
doublereal rho_in=gas.density();
double *yin=new double[nsp];
@ -107,7 +107,7 @@ int flamespeed(int np, void* p) {
Inlet1D inlet;
inlet.setMoleFractions(x.begin());
inlet.setMoleFractions(DATA_PTR(x));
doublereal mdot=uin*rho_in;
inlet.setMdot(mdot);
inlet.setTemperature(temp);
@ -155,7 +155,7 @@ int flamespeed(int np, void* p) {
flame.setInitialGuess(gas.speciesName(i),locs,value);
}
inlet.setMoleFractions(x.begin());
inlet.setMoleFractions(DATA_PTR(x));
inlet.setMdot(mdot);
inlet.setTemperature(temp);

View file

@ -57,8 +57,8 @@ namespace Cantera {
int kk = th.nSpecies();
array_fp x(kk);
array_fp y(kk);
th.getMoleFractions(x.begin());
th.getMassFractions(y.begin());
th.getMoleFractions(DATA_PTR(x));
th.getMassFractions(DATA_PTR(y));
int k;
@ -90,9 +90,9 @@ namespace Cantera {
int kk = mix.nSpecies();
array_fp zz(kk);
switch (xyc) {
case 0: mix.getMoleFractions(zz.begin()); break;
case 1: mix.getMassFractions(zz.begin()); break;
case 2: mix.getConcentrations(zz.begin()); break;
case 0: mix.getMoleFractions(DATA_PTR(zz)); break;
case 1: mix.getMassFractions(DATA_PTR(zz)); break;
case 2: mix.getConcentrations(DATA_PTR(zz)); break;
default: return "error: xyc must be 0, 1, or 2";
}

View file

@ -180,6 +180,7 @@ namespace Cantera {
/// Return a pointer to the top of column j, columns are contiguous
/// in memory
doublereal * ptrColumn(int j) { return &(m_data[m_nrows*j]); }
const doublereal * ptrColumn(int j) const { return &(m_data[m_nrows*j]); }
protected:

View file

@ -129,7 +129,7 @@ namespace Cantera {
int info=0;
copy(data.begin(), data.end(), ludata.begin());
ct_dgbtrf(rows(), columns(), nSubDiagonals(), nSuperDiagonals(),
ludata.begin(), ldim(), ipiv().begin(), info);
DATA_PTR(ludata), ldim(), DATA_PTR(ipiv()), info);
// if info = 0, LU decomp succeeded.
if (info == 0) {
@ -187,8 +187,8 @@ namespace Cantera {
if (!m_factored) info = factor();
if (info == 0)
ct_dgbtrs(ctlapack::NoTranspose, columns(), nSubDiagonals(),
nSuperDiagonals(), 1, ludata.begin(), ldim(),
ipiv().begin(), b, columns(), info);
nSuperDiagonals(), 1, DATA_PTR(ludata), ldim(),
DATA_PTR(ipiv()), b, columns(), info);
// error handling
if (info != 0) {

View file

@ -205,13 +205,13 @@ namespace Cantera {
m_cvode_mem = CVodeMalloc(m_neq, cvode_rhs, m_t0, nv(m_y), m_method,
m_iter, m_itol, &m_reltol,
nv(m_abstol), m_data, NULL, TRUE, m_iopt,
m_ropt.begin(), NULL);
DATA_PTR(m_ropt), NULL);
}
else {
m_cvode_mem = CVodeMalloc(m_neq, cvode_rhs, m_t0, nv(m_y), m_method,
m_iter, m_itol, &m_reltol,
&m_abstols, m_data, NULL, TRUE, m_iopt,
m_ropt.begin(), NULL);
DATA_PTR(m_ropt), NULL);
}
if (!m_cvode_mem) throw CVodeErr("CVodeMalloc failed.");
@ -254,13 +254,13 @@ namespace Cantera {
result = CVReInit(m_cvode_mem, cvode_rhs, m_t0, nv(m_y), m_method,
m_iter, m_itol, &m_reltol,
nv(m_abstol), m_data, NULL, TRUE, m_iopt,
m_ropt.begin(), NULL);
DATA_PTR(m_ropt), NULL);
}
else {
result = CVReInit(m_cvode_mem, cvode_rhs, m_t0, nv(m_y), m_method,
m_iter, m_itol, &m_reltol,
&m_abstols, m_data, NULL, TRUE, m_iopt,
m_ropt.begin(), NULL);
DATA_PTR(m_ropt), NULL);
}
if (result != 0) throw CVodeErr("CVReInit failed.");

View file

@ -62,7 +62,7 @@ extern "C" {
if (d->m_pars.size() == 0)
f->eval(t, ydata, ydotdata, NULL);
else
f->eval(t, ydata, ydotdata, d->m_pars.begin());
f->eval(t, ydata, ydotdata, DATA_PTR(d->m_pars));
//}
//catch (...) {
//Cantera::showErrors();
@ -208,7 +208,7 @@ namespace Cantera {
throw CVodesErr("Error in CVodeSensMalloc");
vector_fp atol(m_np, m_abstolsens);
double rtol = m_reltolsens;
flag = CVodeSetSensTolerances(m_cvode_mem, CV_SS, rtol, atol.begin());
flag = CVodeSetSensTolerances(m_cvode_mem, CV_SS, rtol, DATA_PTR(atol));
}
void CVodesIntegrator::initialize(double t0, FuncEval& func)
@ -281,7 +281,7 @@ namespace Cantera {
if (func.nparams() > 0) {
sensInit(t0, func);
flag = CVodeSetSensParams(m_cvode_mem, m_fdata->m_pars.begin(),
flag = CVodeSetSensParams(m_cvode_mem, DATA_PTR(m_fdata->m_pars),
NULL, NULL);
}

View file

@ -160,7 +160,7 @@ namespace Cantera {
// call the phase-specific method to set the phase to the
// equilibrium state with the specified species chemical
// potentials.
s.setToEquilState(m_mu_RT.begin());
s.setToEquilState(DATA_PTR(m_mu_RT));
update(s);
}
@ -172,7 +172,7 @@ namespace Cantera {
void ChemEquil::update(const thermo_t& s) {
// get the mole fractions, temperature, and density
m_phase->getMoleFractions(m_molefractions.begin());
m_phase->getMoleFractions(DATA_PTR(m_molefractions));
m_temp = m_phase->temperature();
m_dens = m_phase->density();
@ -256,7 +256,7 @@ namespace Cantera {
vector_fp mu_RT(m_kk, 0.0);
s.getChemPotentials(mu_RT.begin());
s.getChemPotentials(DATA_PTR(mu_RT));
doublereal rrt = 1.0/(GasConstant*m_phase->temperature());
scale(mu_RT.begin(), mu_RT.end(), mu_RT.begin(), rrt);
@ -269,7 +269,7 @@ namespace Cantera {
int info;
try {
info = solve(aa, b.begin());
info = solve(aa, DATA_PTR(b));
}
catch (CanteraError) {
addLogEntry("failed to estimate initial element potentials.");
@ -396,7 +396,7 @@ namespace Cantera {
for (int k = 0; k < m_kk; k++) {
xmm[k] = m_phase->moleFraction(k) + Cutoff;
}
m_phase->setMoleFractions(xmm.begin());
m_phase->setMoleFractions(DATA_PTR(xmm));
update(s);
@ -529,13 +529,13 @@ namespace Cantera {
equilJacobian(s, x, elMoles, jac, xval, yval);
// compute grad f = F*J
jac.leftMult(res_trial.begin(), grad.begin());
jac.leftMult(DATA_PTR(res_trial), DATA_PTR(grad));
copy(x.begin(), x.end(), oldx.begin());
oldf = f;
scale(res_trial.begin(), res_trial.end(), res_trial.begin(), -1.0);
try {
info = solve(jac, res_trial.begin());
info = solve(jac, DATA_PTR(res_trial));
}
catch (CanteraError) {
addLogEntry("Jacobian is singular.");

View file

@ -22,19 +22,19 @@ namespace Cantera {
doublereal ConstDensityThermo::enthalpy_mole() const {
doublereal p0 = m_spthermo->refPressure();
return GasConstant * temperature() *
mean_X(enthalpy_RT().begin())
mean_X(&enthalpy_RT()[0])
+ (pressure() - p0)/molarDensity();
}
doublereal ConstDensityThermo::intEnergy_mole() const {
doublereal p0 = m_spthermo->refPressure();
return GasConstant * temperature() *
mean_X(enthalpy_RT().begin())
mean_X(&enthalpy_RT()[0])
- p0/molarDensity();
}
doublereal ConstDensityThermo::entropy_mole() const {
return GasConstant * (mean_X(entropy_R().begin()) -
return GasConstant * (mean_X(&entropy_R()[0]) -
sum_xlogx());
}
@ -43,7 +43,7 @@ namespace Cantera {
}
doublereal ConstDensityThermo::cp_mole() const {
return GasConstant * mean_X(cp_R().begin());
return GasConstant * mean_X(&cp_R()[0]);
}
doublereal ConstDensityThermo::cv_mole() const {
@ -120,8 +120,8 @@ namespace Cantera {
void ConstDensityThermo::_updateThermo() const {
doublereal tnow = temperature();
if (m_tlast != tnow) {
m_spthermo->update(tnow, m_cp0_R.begin(), m_h0_RT.begin(),
m_s0_R.begin());
m_spthermo->update(tnow, &m_cp0_R[0], &m_h0_RT[0],
&m_s0_R[0]);
m_tlast = tnow;
int k;
for (k = 0; k < m_kk; k++) {

View file

@ -31,9 +31,9 @@ namespace Cantera {
void DenseMatrix::mult(const double* b, double* prod) const {
ct_dgemv(ctlapack::ColMajor, ctlapack::NoTranspose,
static_cast<int>(nRows()),
static_cast<int>(nRows()), 1.0, begin(),
static_cast<int>(nRows()), b, 1, 0.0, prod, 1);
static_cast<int>(nRows()),
static_cast<int>(nRows()), 1.0, ptrColumn(0), //begin(),
static_cast<int>(nRows()), b, 1, 0.0, prod, 1);
}
void DenseMatrix::leftMult(const double* b, double* prod) const {
@ -53,16 +53,16 @@ namespace Cantera {
int solve(DenseMatrix& A, double* b) {
int info=0;
ct_dgetrf(static_cast<int>(A.nRows()),
static_cast<int>(A.nColumns()), A.begin(),
static_cast<int>(A.nRows()), A.ipiv().begin(), info);
static_cast<int>(A.nColumns()), A.ptrColumn(0), //begin(),
static_cast<int>(A.nRows()), &A.ipiv()[0], info);
if (info != 0)
throw CanteraError("DenseMatrix::solve",
"DGETRF returned INFO = "+int2str(info));
ct_dgetrs(ctlapack::NoTranspose,
static_cast<int>(A.nRows()), 1, A.begin(),
static_cast<int>(A.nRows()),
A.ipiv().begin(), b,
static_cast<int>(A.nColumns()), info);
static_cast<int>(A.nRows()), 1, A.ptrColumn(0), //begin(),
static_cast<int>(A.nRows()),
&A.ipiv()[0], b,
static_cast<int>(A.nColumns()), info);
if (info != 0)
throw CanteraError("DenseMatrix::solve",
"DGETRS returned INFO = "+int2str(info));
@ -72,16 +72,16 @@ namespace Cantera {
int solve(DenseMatrix& A, DenseMatrix& b) {
int info=0;
ct_dgetrf(static_cast<int>(A.nRows()),
static_cast<int>(A.nColumns()), A.begin(),
static_cast<int>(A.nRows()), A.ipiv().begin(), info);
static_cast<int>(A.nColumns()), A.ptrColumn(0),
static_cast<int>(A.nRows()), &A.ipiv()[0], info);
if (info != 0)
throw CanteraError("DenseMatrix::solve",
"DGETRF returned INFO = "+int2str(info));
ct_dgetrs(ctlapack::NoTranspose, static_cast<int>(A.nRows()),
static_cast<int>(b.nColumns()),
A.begin(), static_cast<int>(A.nRows()),
A.ipiv().begin(), b.begin(),
static_cast<int>(b.nRows()), info);
static_cast<int>(b.nColumns()),
A.ptrColumn(0), static_cast<int>(A.nRows()),
&A.ipiv()[0], b.ptrColumn(0),
static_cast<int>(b.nRows()), info);
if (info != 0)
throw CanteraError("DenseMatrix::solve",
"DGETRS returned INFO = "+int2str(info));
@ -101,10 +101,10 @@ namespace Cantera {
vector_fp s(min(static_cast<int>(A.nRows()),
static_cast<int>(A.nColumns())));
ct_dgelss(static_cast<int>(A.nRows()),
static_cast<int>(A.nColumns()), 1, A.begin(),
static_cast<int>(A.nColumns()), 1, A.ptrColumn(0),
static_cast<int>(A.nRows()), b,
static_cast<int>(A.nColumns()), s.begin(),
rcond, rank, work.begin(), work.size(), info);
static_cast<int>(A.nColumns()), &s[0], //.begin(),
rcond, rank, &work[0], work.size(), info);
if (info != 0)
throw CanteraError("DenseMatrix::leaseSquares",
"DGELSS returned INFO = "+int2str(info));
@ -115,30 +115,30 @@ namespace Cantera {
void multiply(const DenseMatrix& A, const double* b, double* prod) {
ct_dgemv(ctlapack::ColMajor, ctlapack::NoTranspose,
static_cast<int>(A.nRows()), static_cast<int>(A.nColumns()), 1.0,
A.begin(), static_cast<int>(A.nRows()), b, 1, 0.0, prod, 1);
A.ptrColumn(0), static_cast<int>(A.nRows()), b, 1, 0.0, prod, 1);
}
void increment(const DenseMatrix& A,
const double* b, double* prod) {
ct_dgemv(ctlapack::ColMajor, ctlapack::NoTranspose,
static_cast<int>(A.nRows()), static_cast<int>(A.nRows()), 1.0,
A.begin(), static_cast<int>(A.nRows()), b, 1, 1.0, prod, 1);
A.ptrColumn(0), static_cast<int>(A.nRows()), b, 1, 1.0, prod, 1);
}
int invert(DenseMatrix& A, int nn) {
integer n = (nn > 0 ? nn : static_cast<int>(A.nRows()));
int info=0;
ct_dgetrf(n, n, A.begin(), static_cast<int>(A.nRows()),
A.ipiv().begin(), info);
ct_dgetrf(n, n, A.ptrColumn(0), static_cast<int>(A.nRows()),
&A.ipiv()[0], info);
if (info != 0)
throw CanteraError("invert",
"DGETRF returned INFO="+int2str(info));
vector_fp work(n);
integer lwork = static_cast<int>(work.size());
ct_dgetri(n, A.begin(), static_cast<int>(A.nRows()),
A.ipiv().begin(),
work.begin(), lwork, info);
ct_dgetri(n, A.ptrColumn(0), static_cast<int>(A.nRows()),
&A.ipiv()[0],
&work[0], lwork, info);
if (info != 0)
throw CanteraError("invert",
"DGETRI returned INFO="+int2str(info));

View file

@ -63,9 +63,9 @@ namespace Cantera {
doublereal T = thermo(surfacePhaseIndex()).temperature();
if (T != m_kdata->m_temp || m_redo_rates) {
m_kdata->m_logtemp = log(T);
m_rates.update(T, m_kdata->m_logtemp, m_kdata->m_rfn.begin());
m_rates.update(T, m_kdata->m_logtemp, DATA_PTR(m_kdata->m_rfn));
if (m_has_electrochem_rxns)
applyButlerVolmerCorrection(m_kdata->m_rfn.begin());
applyButlerVolmerCorrection(DATA_PTR(m_kdata->m_rfn));
m_kdata->m_temp = T;
updateKc();
m_kdata->m_ROP_ok = false;
@ -101,7 +101,7 @@ namespace Cantera {
int np = nPhases();
for (n = 0; n < np; n++) {
thermo(n).getActivityConcentrations(m_conc.begin() + m_start[n]);
thermo(n).getActivityConcentrations(DATA_PTR(m_conc) + m_start[n]);
}
m_kdata->m_ROP_ok = false;
}
@ -124,7 +124,7 @@ namespace Cantera {
doublereal rrt = 1.0/rt;
int np = nPhases();
for (n = 0; n < np; n++) {
thermo(n).getStandardChemPotentials(m_mu0.begin() + m_start[n]);
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) {
m_mu0[ik] -= rt*thermo(n).logStandardConc(k);
@ -134,8 +134,10 @@ namespace Cantera {
}
// compute Delta mu^0 for all reversible reactions
m_reactantStoich.decrementReactions(m_mu0.begin(), m_rkc.begin());
m_revProductStoich.incrementReactions(m_mu0.begin(), m_rkc.begin());
m_reactantStoich.decrementReactions(DATA_PTR(m_mu0),
DATA_PTR(m_rkc));
m_revProductStoich.incrementReactions(DATA_PTR(m_mu0),
DATA_PTR(m_rkc));
for (i = 0; i < m_nrev; i++) {
irxn = m_revindex[i];
@ -160,7 +162,7 @@ namespace Cantera {
doublereal rrt = 1.0/rt;
int np = nPhases();
for (n = 0; n < np; n++) {
thermo(n).getChemPotentials(dmu.begin() + m_start[n]);
thermo(n).getChemPotentials(DATA_PTR(dmu) + m_start[n]);
nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) {
dmu[ik] += Faraday * m_phi[n] * thermo(n).charge(k);
@ -170,8 +172,8 @@ namespace Cantera {
}
// compute Delta mu^ for all reversible reactions
m_reactantStoich.decrementReactions(dmu.begin(), rmu.begin());
m_revProductStoich.incrementReactions(dmu.begin(), rmu.begin());
m_reactantStoich.decrementReactions(DATA_PTR(dmu), DATA_PTR(rmu));
m_revProductStoich.incrementReactions(DATA_PTR(dmu), DATA_PTR(rmu));
for (i = 0; i < m_nrev; i++) {
irxn = m_revindex[i];
@ -193,7 +195,7 @@ namespace Cantera {
doublereal rrt = 1.0/rt;
int np = nPhases();
for (n = 0; n < np; n++) {
thermo(n).getStandardChemPotentials(m_mu0.begin() + m_start[n]);
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) {
m_mu0[ik] -= rt*thermo(n).logStandardConc(k);
@ -204,9 +206,9 @@ namespace Cantera {
fill(kc, kc + m_ii, 0.0);
m_reactantStoich.decrementReactions(m_mu0.begin(), kc);
m_revProductStoich.incrementReactions(m_mu0.begin(), kc);
m_irrevProductStoich.incrementReactions(m_mu0.begin(), kc);
m_reactantStoich.decrementReactions(DATA_PTR(m_mu0), kc);
m_revProductStoich.incrementReactions(DATA_PTR(m_mu0), kc);
m_irrevProductStoich.incrementReactions(DATA_PTR(m_mu0), kc);
for (i = 0; i < m_ii; i++) {
kc[i] = exp(-kc[i]*rrt);
@ -240,10 +242,10 @@ namespace Cantera {
// compute the change in electrical potential energy for each
// reaction. This will only be non-zero if a potential
// difference is present.
fill(m_rwork.begin(), m_rwork.begin() + m_ii, 0.0);
m_reactantStoich.decrementReactions(m_pot.begin(), m_rwork.begin());
m_revProductStoich.incrementReactions(m_pot.begin(), m_rwork.begin());
m_irrevProductStoich.incrementReactions(m_pot.begin(), m_rwork.begin());
fill(DATA_PTR(m_rwork), DATA_PTR(m_rwork) + m_ii, 0.0);
m_reactantStoich.decrementReactions(DATA_PTR(m_pot), DATA_PTR(m_rwork));
m_revProductStoich.incrementReactions(DATA_PTR(m_pot), DATA_PTR(m_rwork));
m_irrevProductStoich.incrementReactions(DATA_PTR(m_pot), DATA_PTR(m_rwork));
// modify the reaction rates. Only modify those with a
// non-zero activation energy, and do not decrease the
@ -300,14 +302,14 @@ namespace Cantera {
multiply_each(ropr.begin(), ropr.end(), m_rkc.begin());
// multiply ropf by concentration products
m_reactantStoich.multiply(m_conc.begin(), ropf.begin());
m_reactantStoich.multiply(DATA_PTR(m_conc), DATA_PTR(ropf));
// for reversible reactions, multiply ropr by concentration
// products
m_revProductStoich.multiply(m_conc.begin(), ropr.begin());
m_revProductStoich.multiply(DATA_PTR(m_conc), DATA_PTR(ropr));
// do global reactions
//m_globalReactantStoich.power(m_conc.begin(), ropf.begin());
//m_globalReactantStoich.power(DATA_PTR(m_conc), ropf.begin());
for (int j = 0; j != m_ii; ++j) {
ropnet[j] = ropf[j] - ropr[j];
@ -368,7 +370,7 @@ namespace Cantera {
for (int m = 0; m < ncov; m++) rp.push_back(r.cov[m]);
iloc = m_rates.install( reactionNumber(), r.rateCoeffType, rp.size(),
rp.begin() );
DATA_PTR(rp) );
// store activation energy
if (r.beta > 0.0) {
@ -395,7 +397,7 @@ namespace Cantera {
for (int m = 0; m < ncov; m++) rp.push_back(r.cov[m]);
iloc = m_rates.install( reactionNumber(),
r.rateCoeffType, rp.size(),
rp.begin() );
DATA_PTR(rp) );
// add constant term to rate coeff value vector
m_kdata->m_rfn.push_back(r.rateCoeffParameters[0]);

View file

@ -160,11 +160,11 @@ namespace Cantera {
updateROP();
fill(cdot, cdot + m_kk, 0.0);
m_revProductStoich.incrementSpecies(
m_kdata->m_ropf.begin(), cdot);
&m_kdata->m_ropf[0], cdot);
m_irrevProductStoich.incrementSpecies(
m_kdata->m_ropf.begin(), cdot);
&m_kdata->m_ropf[0], cdot);
m_reactantStoich.incrementSpecies(
m_kdata->m_ropr.begin(), cdot);
&m_kdata->m_ropr[0], cdot);
}
/**
@ -179,9 +179,9 @@ namespace Cantera {
updateROP();
fill(ddot, ddot + m_kk, 0.0);
m_revProductStoich.incrementSpecies(
m_kdata->m_ropr.begin(), ddot);
&m_kdata->m_ropr[0], ddot);
m_reactantStoich.incrementSpecies(
m_kdata->m_ropf.begin(), ddot);
&m_kdata->m_ropf[0], ddot);
}
/**
@ -195,11 +195,11 @@ namespace Cantera {
updateROP();
fill(net, net + m_kk, 0.0);
m_revProductStoich.incrementSpecies(
m_kdata->m_ropnet.begin(), net);
&m_kdata->m_ropnet[0], net);
m_irrevProductStoich.incrementSpecies(
m_kdata->m_ropnet.begin(), net);
&m_kdata->m_ropnet[0], net);
m_reactantStoich.decrementSpecies(
m_kdata->m_ropnet.begin(), net);
&m_kdata->m_ropnet[0], net);
}
//@}

View file

@ -39,10 +39,10 @@ namespace Cantera {
if (fabs(T - m_kdata->m_temp) > m_dt_threshold) {
doublereal logT = log(T);
m_kdata->m_logc_ref = m_kdata->m_logp_ref - logT;
update_rates(T, logT, m_kdata->m_rfn.begin());
m_falloff_low_rates.update(T, logT, m_kdata->m_rfn_low.begin());
m_falloff_high_rates.update(T, logT, m_kdata->m_rfn_high.begin());
m_falloffn.updateTemp(T, m_kdata->falloff_work.begin());
update_rates(T, logT, &m_kdata->m_rfn[0]);
m_falloff_low_rates.update(T, logT, &m_kdata->m_rfn_low[0]);
m_falloff_high_rates.update(T, logT, &m_kdata->m_rfn_high[0]);
m_falloffn.updateTemp(T, &m_kdata->falloff_work[0]);
m_kdata->m_temp = T;
gri30_updateKc();
m_kdata->m_ROP_ok = false;
@ -55,9 +55,9 @@ namespace Cantera {
* @todo This formulation assumes an ideal gas.
*/
void GRI_30_Kinetics::gri30_updateKc() {
doublereal* rkc = m_kdata->m_rkcn.begin();
doublereal* rkc = &m_kdata->m_rkcn[0];
const doublereal* a =
((IdealGasPhase*)m_thermo[0])->expGibbs_RT_ref().begin();
&((IdealGasPhase*)m_thermo[0])->expGibbs_RT_ref()[0];
doublereal exp_c_ref = exp(m_kdata->m_logc_ref);
update_kc(a, exp_c_ref, rkc);
}
@ -76,10 +76,10 @@ namespace Cantera {
array_fp& ropnet = m_kdata->m_ropnet;
copy(rf.begin(), rf.end(), ropf.begin());
m_3b_concm.multiply( ropf.begin(), m_kdata->concm_3b_values.begin() );
m_3b_concm.multiply( &ropf[0], &m_kdata->concm_3b_values[0] );
processFalloffReactions();
multiply_each(ropf.begin(), ropf.end(), m_perturb.begin());
eval_ropnet(m_conc.begin(), ropf.begin(), rkc.begin(), ropnet.begin());
eval_ropnet(&m_conc[0], &ropf[0], &rkc[0], &ropnet[0]);
m_kdata->m_ROP_ok = true;
}

View file

@ -33,7 +33,7 @@ namespace Cantera {
virtual void getNetProductionRates(doublereal* net) {
gri30_updateROP();
get_wdot(m_kdata->m_ropnet.begin(), net);
get_wdot(&m_kdata->m_ropnet[0], net);
}
private:

View file

@ -69,10 +69,10 @@ namespace Cantera {
if (fabs(T - m_kdata->m_temp) > 0.0) { // m_dt_threshold) {
doublereal logT = log(T);
//m_kdata->m_logp0 - logT;
m_rates.update(T, logT, m_kdata->m_rfn.begin());
m_falloff_low_rates.update(T, logT, m_kdata->m_rfn_low.begin());
m_falloff_high_rates.update(T, logT, m_kdata->m_rfn_high.begin());
m_falloffn.updateTemp(T, m_kdata->falloff_work.begin());
m_rates.update(T, logT, &m_kdata->m_rfn[0]);
m_falloff_low_rates.update(T, logT, &m_kdata->m_rfn_low[0]);
m_falloff_high_rates.update(T, logT, &m_kdata->m_rfn_high[0]);
m_falloffn.updateTemp(T, &m_kdata->falloff_work[0]);
m_kdata->m_temp = T;
updateKc();
m_kdata->m_ROP_ok = false;
@ -86,11 +86,11 @@ namespace Cantera {
*/
void GasKinetics::
_update_rates_C() {
thermo().getActivityConcentrations(m_conc.begin());
thermo().getActivityConcentrations(&m_conc[0]);
doublereal ctot = thermo().molarDensity();
m_3b_concm.update(m_conc, ctot, m_kdata->concm_3b_values.begin());
m_3b_concm.update(m_conc, ctot, &m_kdata->concm_3b_values[0]);
m_falloff_concm.update(m_conc, ctot,
m_kdata->concm_falloff_values.begin());
&m_kdata->concm_falloff_values[0]);
m_kdata->m_ROP_ok = false;
}
@ -101,11 +101,11 @@ namespace Cantera {
int i, irxn;
vector_fp& m_rkc = m_kdata->m_rkcn;
thermo().getStandardChemPotentials(m_grt.begin());
thermo().getStandardChemPotentials(&m_grt[0]);
fill(m_rkc.begin(), m_rkc.end(), 0.0);
// compute Delta G^0 for all reversible reactions
m_rxnstoich->getRevReactionDelta(m_ii, m_grt.begin(), m_rkc.begin());
m_rxnstoich->getRevReactionDelta(m_ii, &m_grt[0], &m_rkc[0]);
doublereal logStandConc = m_kdata->m_logStandConc;
doublereal rrt = 1.0/(GasConstant * thermo().temperature());
@ -128,11 +128,11 @@ namespace Cantera {
_update_rates_T();
vector_fp& rkc = m_kdata->m_rkcn;
//thermo().getGibbs_RT(m_grt.begin());
thermo().getStandardChemPotentials(m_grt.begin());
thermo().getStandardChemPotentials(&m_grt[0]);
fill(rkc.begin(), rkc.end(), 0.0);
// compute Delta G^0 for all reactions
m_rxnstoich->getReactionDelta(m_ii, m_grt.begin(), rkc.begin());
m_rxnstoich->getReactionDelta(m_ii, &m_grt[0], &rkc[0]);
doublereal logStandConc = m_kdata->m_logStandConc;
doublereal rrt = 1.0/(GasConstant * thermo().temperature());
@ -161,12 +161,12 @@ namespace Cantera {
* Get the chemical potentials of the species in the
* ideal gas solution.
*/
thermo().getChemPotentials(m_grt.begin());
thermo().getChemPotentials(&m_grt[0]);
/*
* Use the stoichiometric manager to find deltaG for each
* reaction.
*/
m_rxnstoich->getReactionDelta(m_ii, m_grt.begin(), deltaG);
m_rxnstoich->getReactionDelta(m_ii, &m_grt[0], deltaG);
}
/**
@ -185,12 +185,12 @@ namespace Cantera {
* Get the partial molar enthalpy of all species in the
* ideal gas.
*/
thermo().getPartialMolarEnthalpies(m_grt.begin());
thermo().getPartialMolarEnthalpies(&m_grt[0]);
/*
* Use the stoichiometric manager to find deltaG for each
* reaction.
*/
m_rxnstoich->getReactionDelta(m_ii, m_grt.begin(), deltaH);
m_rxnstoich->getReactionDelta(m_ii, &m_grt[0], deltaH);
}
/************************************************************************
@ -209,12 +209,12 @@ namespace Cantera {
* Get the partial molar entropy of all species in the
* solid solution.
*/
thermo().getPartialMolarEntropies(m_grt.begin());
thermo().getPartialMolarEntropies(&m_grt[0]);
/*
* Use the stoichiometric manager to find deltaS for each
* reaction.
*/
m_rxnstoich->getReactionDelta(m_ii, m_grt.begin(), deltaS);
m_rxnstoich->getReactionDelta(m_ii, &m_grt[0], deltaS);
}
/**
@ -235,12 +235,12 @@ namespace Cantera {
* We define these here as the chemical potentials of the pure
* species at the temperature and pressure of the solution.
*/
thermo().getStandardChemPotentials(m_grt.begin());
thermo().getStandardChemPotentials(&m_grt[0]);
/*
* Use the stoichiometric manager to find deltaG for each
* reaction.
*/
m_rxnstoich->getReactionDelta(m_ii, m_grt.begin(), deltaG);
m_rxnstoich->getReactionDelta(m_ii, &m_grt[0], deltaG);
}
/**
@ -261,7 +261,7 @@ namespace Cantera {
* We define these here as the enthalpies of the pure
* species at the temperature and pressure of the solution.
*/
thermo().getEnthalpy_RT(m_grt.begin());
thermo().getEnthalpy_RT(&m_grt[0]);
doublereal RT = thermo().temperature() * GasConstant;
for (int k = 0; k < m_kk; k++) {
m_grt[k] *= RT;
@ -270,7 +270,7 @@ namespace Cantera {
* Use the stoichiometric manager to find deltaG for each
* reaction.
*/
m_rxnstoich->getReactionDelta(m_ii, m_grt.begin(), deltaH);
m_rxnstoich->getReactionDelta(m_ii, &m_grt[0], deltaH);
}
/*********************************************************************
@ -290,7 +290,7 @@ namespace Cantera {
* We define these here as the entropies of the pure
* species at the temperature and pressure of the solution.
*/
thermo().getEntropy_R(m_grt.begin());
thermo().getEntropy_R(&m_grt[0]);
doublereal R = GasConstant;
for (int k = 0; k < m_kk; k++) {
m_grt[k] *= R;
@ -299,7 +299,7 @@ namespace Cantera {
* Use the stoichiometric manager to find deltaS for each
* reaction.
*/
m_rxnstoich->getReactionDelta(m_ii, m_grt.begin(), deltaS);
m_rxnstoich->getReactionDelta(m_ii, &m_grt[0], deltaS);
}
void GasKinetics::processFalloffReactions() {
@ -318,7 +318,7 @@ namespace Cantera {
pr[i] = fc[i] * m_rf_low[i] / m_rf_high[i];
}
m_falloffn.pr_to_falloff( pr.begin(), m_kdata->falloff_work.begin() );
m_falloffn.pr_to_falloff( &pr[0], &m_kdata->falloff_work[0] );
for (i = 0; i < m_nfall; i++) {
pr[i] *= m_rf_high[i];
@ -346,7 +346,7 @@ namespace Cantera {
copy(rf.begin(), rf.end(), ropf.begin());
// multiply ropf by enhanced 3b conc for all 3b rxns
m_3b_concm.multiply( ropf.begin(), m_kdata->concm_3b_values.begin() );
m_3b_concm.multiply( &ropf[0], &m_kdata->concm_3b_values[0] );
processFalloffReactions();
@ -362,12 +362,12 @@ namespace Cantera {
multiply_each(ropr.begin(), ropr.end(), m_rkc.begin());
// multiply ropf by concentration products
m_rxnstoich->multiplyReactants(m_conc.begin(), ropf.begin());
m_rxnstoich->multiplyReactants(&m_conc[0], &ropf[0]);
//m_reactantStoich.multiply(m_conc.begin(), ropf.begin());
// for reversible reactions, multiply ropr by concentration
// products
m_rxnstoich->multiplyRevProducts(m_conc.begin(), ropr.begin());
m_rxnstoich->multiplyRevProducts(&m_conc[0], &ropr[0]);
//m_revProductStoich.multiply(m_conc.begin(), ropr.begin());
for (int j = 0; j != m_ii; ++j) {
@ -396,7 +396,7 @@ namespace Cantera {
copy(rf.begin(), rf.end(), ropf.begin());
// multiply ropf by enhanced 3b conc for all 3b rxns
m_3b_concm.multiply(ropf.begin(), m_kdata->concm_3b_values.begin() );
m_3b_concm.multiply(&ropf[0], &m_kdata->concm_3b_values[0] );
/*
* This routine is hardcoded to replace some of the values
@ -433,7 +433,7 @@ namespace Cantera {
getFwdRateConstants(krev);
if (doIrreversible) {
doublereal *tmpKc = m_kdata->m_ropnet.begin();
doublereal *tmpKc = &m_kdata->m_ropnet[0];
getEquilibriumConstants(tmpKc);
for (int i = 0; i < m_ii; i++) {
krev[i] /= tmpKc[i];
@ -472,11 +472,11 @@ namespace Cantera {
int iloc = m_falloff_high_rates.install(m_nfall,
r.rateCoeffType,
r.rateCoeffParameters.size(),
r.rateCoeffParameters.begin() );
&r.rateCoeffParameters[0] );
m_falloff_low_rates.install( m_nfall,
r.rateCoeffType, r.auxRateCoeffParameters.size(),
r.auxRateCoeffParameters.begin() );
DATA_PTR(r.auxRateCoeffParameters) );
// add constant terms to high and low rate
// coeff value vectors
@ -517,7 +517,7 @@ namespace Cantera {
// install rate coeff calculator
iloc = m_rates.install( reactionNumber(),
r.rateCoeffType, r.rateCoeffParameters.size(),
r.rateCoeffParameters.begin() );
DATA_PTR(r.rateCoeffParameters) );
// add constant term to rate coeff value vector
m_kdata->m_rfn.push_back(r.rateCoeffParameters[0]);
@ -535,7 +535,7 @@ namespace Cantera {
// install rate coeff calculator
iloc = m_rates.install( reactionNumber(),
r.rateCoeffType, r.rateCoeffParameters.size(),
r.rateCoeffParameters.begin() );
DATA_PTR(r.rateCoeffParameters) );
// add constant term to rate coeff value vector
m_kdata->m_rfn.push_back(r.rateCoeffParameters[0]);

View file

@ -216,9 +216,9 @@ namespace Cantera {
virtual void getNetProductionRates(doublereal* net) {
updateROP();
#ifdef HWMECH
get_wdot(m_kdata->m_ropnet.begin(), net);
get_wdot(&m_kdata->m_ropnet[0], net);
#else
m_rxnstoich->getNetProductionRates(m_kk, m_kdata->m_ropnet.begin(), net);
m_rxnstoich->getNetProductionRates(m_kk, &m_kdata->m_ropnet[0], net);
//fill(net, net + m_kk, 0.0);
//m_revProductStoich.incrementSpecies(
// m_kdata->m_ropnet.begin(), net);
@ -238,8 +238,8 @@ namespace Cantera {
*/
virtual void getCreationRates(doublereal* cdot) {
updateROP();
m_rxnstoich->getCreationRates(m_kk, m_kdata->m_ropf.begin(),
m_kdata->m_ropr.begin(), cdot);
m_rxnstoich->getCreationRates(m_kk, &m_kdata->m_ropf[0],
&m_kdata->m_ropr[0], cdot);
//fill(cdot, cdot + m_kk, 0.0);
//m_revProductStoich.incrementSpecies(
// m_kdata->m_ropf.begin(), cdot);
@ -258,8 +258,8 @@ namespace Cantera {
*/
virtual void getDestructionRates(doublereal* ddot) {
updateROP();
m_rxnstoich->getDestructionRates(m_kk, m_kdata->m_ropf.begin(),
m_kdata->m_ropr.begin(), ddot);
m_rxnstoich->getDestructionRates(m_kk, &m_kdata->m_ropf[0],
&m_kdata->m_ropr[0], ddot);
// fill(ddot, ddot + m_kk, 0.0);
//m_revProductStoich.incrementSpecies(
// m_kdata->m_ropr.begin(), ddot);

View file

@ -13,7 +13,6 @@
#define CT_RXNPATH_GROUP
#include "ct_defs.h"
#include "ctvector.h"
using namespace std;
namespace Cantera {
@ -123,7 +122,7 @@ namespace Cantera {
const Group& g);
private:
ctvector_int m_comp;
vector_int m_comp;
int m_sign;
};

View file

@ -275,7 +275,7 @@ namespace Cantera {
pres += m_pp[k];
}
// set state
setState_PX(pres, m_pp.begin());
setState_PX(pres, &m_pp[0]);
}
@ -288,8 +288,8 @@ namespace Cantera {
// If the temperature has changed since the last time these
// properties were computed, recompute them.
if (m_tlast != tnow) {
m_spthermo->update(tnow, m_cp0_R.begin(), m_h0_RT.begin(),
m_s0_R.begin());
m_spthermo->update(tnow, &m_cp0_R[0], &m_h0_RT[0],
&m_s0_R[0]);
m_tlast = tnow;
// update the species Gibbs functions

View file

@ -68,7 +68,7 @@ namespace Cantera {
*/
virtual doublereal enthalpy_mole() const {
return GasConstant * temperature() *
mean_X(enthalpy_RT_ref().begin());
mean_X(&enthalpy_RT_ref()[0]);
}
/**
@ -84,7 +84,7 @@ namespace Cantera {
*/
virtual doublereal intEnergy_mole() const {
return GasConstant * temperature()
* ( mean_X(enthalpy_RT_ref().begin()) - 1.0);
* ( mean_X(&enthalpy_RT_ref()[0]) - 1.0);
}
/**
@ -99,7 +99,7 @@ namespace Cantera {
* @see SpeciesThermo
*/
virtual doublereal entropy_mole() const {
return GasConstant * (mean_X(entropy_R_ref().begin()) -
return GasConstant * (mean_X(&entropy_R_ref()[0]) -
sum_xlogx() - log(pressure()/m_spthermo->refPressure()));
}
@ -124,7 +124,7 @@ namespace Cantera {
* @see SpeciesThermo
*/
virtual doublereal cp_mole() const {
return GasConstant * mean_X(cp_R_ref().begin());
return GasConstant * mean_X(&cp_R_ref()[0]);
}
/**

View file

@ -97,7 +97,7 @@ namespace Cantera {
int loc, k, kstart;
for (n = 0; n < m_nsurf; n++) {
rs0 = 1.0/m_surf[n]->siteDensity();
m_kin[n]->getNetProductionRates(m_work.begin());
m_kin[n]->getNetProductionRates(DATA_PTR(m_work));
kstart = m_kin[n]->kineticsSpeciesIndex(0,m_surfindex[n]);
sum = 0.0;
loc = 0;

View file

@ -67,15 +67,15 @@ namespace Cantera {
_update_rates_T() {
_update_rates_phi();
if (m_has_coverage_dependence) {
m_surf->getCoverages(m_conc.begin());
m_rates.update_C(m_conc.begin());
m_surf->getCoverages(DATA_PTR(m_conc));
m_rates.update_C(DATA_PTR(m_conc));
m_redo_rates = true;
}
doublereal T = thermo(surfacePhaseIndex()).temperature();
if (T != m_kdata->m_temp || m_redo_rates) {
m_kdata->m_logtemp = log(T);
m_rates.update(T, m_kdata->m_logtemp, m_kdata->m_rfn.begin());
applyButlerVolmerCorrection(m_kdata->m_rfn.begin());
m_rates.update(T, m_kdata->m_logtemp, DATA_PTR(m_kdata->m_rfn));
applyButlerVolmerCorrection(DATA_PTR(m_kdata->m_rfn));
m_kdata->m_temp = T;
updateKc();
m_kdata->m_ROP_ok = false;
@ -116,7 +116,7 @@ namespace Cantera {
* are integer indecises for that vector denoting the start of the
* species for each phase.
*/
thermo(n).getActivityConcentrations(m_conc.begin() + m_start[n]);
thermo(n).getActivityConcentrations(DATA_PTR(m_conc) + m_start[n]);
}
m_kdata->m_ROP_ok = false;
}
@ -141,7 +141,7 @@ namespace Cantera {
doublereal rrt = 1.0/rt;
int np = nPhases();
for (n = 0; n < np; n++) {
thermo(n).getStandardChemPotentials(m_mu0.begin() + m_start[n]);
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) {
m_mu0[ik] -= rt*thermo(n).logStandardConc(k);
@ -153,7 +153,8 @@ namespace Cantera {
// compute Delta mu^0 for all reversible reactions
//m_reactantStoich.decrementReactions(m_mu0.begin(), m_rkc.begin());
//m_revProductStoich.incrementReactions(m_mu0.begin(), m_rkc.begin());
m_rxnstoich.getRevReactionDelta(m_ii, m_mu0.begin(), m_rkc.begin());
m_rxnstoich.getRevReactionDelta(m_ii, DATA_PTR(m_mu0),
DATA_PTR(m_rkc));
for (i = 0; i < m_nrev; i++) {
irxn = m_revindex[i];
@ -185,7 +186,7 @@ namespace Cantera {
int np = nPhases();
doublereal delta;
for (n = 0; n < np; n++) {
thermo(n).getChemPotentials(dmu.begin() + m_start[n]);
thermo(n).getChemPotentials(DATA_PTR(dmu) + m_start[n]);
nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) {
delta = Faraday * m_phi[n] * thermo(n).charge(k);
@ -196,10 +197,10 @@ namespace Cantera {
}
// compute Delta mu^ for all reversible reactions
m_rxnstoich.getRevReactionDelta(m_ii, dmu.begin(), rmu.begin());
getFwdRatesOfProgress(frop.begin());
getRevRatesOfProgress(rrop.begin());
getNetRatesOfProgress(netrop.begin());
m_rxnstoich.getRevReactionDelta(m_ii, DATA_PTR(dmu), DATA_PTR(rmu));
getFwdRatesOfProgress(DATA_PTR(frop));
getRevRatesOfProgress(DATA_PTR(rrop));
getNetRatesOfProgress(DATA_PTR(netrop));
for (i = 0; i < m_nrev; i++) {
irxn = m_revindex[i];
cout << "Reaction " << reactionString(irxn)
@ -224,7 +225,7 @@ namespace Cantera {
doublereal rrt = 1.0/rt;
int np = nPhases();
for (n = 0; n < np; n++) {
thermo(n).getStandardChemPotentials(m_mu0.begin() + m_start[n]);
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
nsp = thermo(n).nSpecies();
for (k = 0; k < nsp; k++) {
m_mu0[ik] -= rt*thermo(n).logStandardConc(k);
@ -238,7 +239,7 @@ namespace Cantera {
//m_reactantStoich.decrementReactions(m_mu0.begin(), kc);
//m_revProductStoich.incrementReactions(m_mu0.begin(), kc);
//m_irrevProductStoich.incrementReactions(m_mu0.begin(), kc);
m_rxnstoich.getReactionDelta(m_ii, m_mu0.begin(), kc);
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_mu0), kc);
for (i = 0; i < m_ii; i++) {
kc[i] = exp(-kc[i]*rrt);
@ -275,7 +276,8 @@ namespace Cantera {
//m_reactantStoich.decrementReactions(m_pot.begin(), m_rwork.begin());
//m_revProductStoich.incrementReactions(m_pot.begin(), m_rwork.begin());
//m_irrevProductStoich.incrementReactions(m_pot.begin(), m_rwork.begin());
m_rxnstoich.getReactionDelta(m_ii, m_pot.begin(), m_rwork.begin());
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_pot),
DATA_PTR(m_rwork));
// modify the reaction rates. Only modify those with a
// non-zero activation energy, and do not decrease the
@ -333,7 +335,7 @@ namespace Cantera {
void InterfaceKinetics::getRevRateConstants(doublereal* krev, bool doIrreversible) {
getFwdRateConstants(krev);
if (doIrreversible) {
doublereal *tmpKc = m_kdata->m_ropnet.begin();
doublereal *tmpKc = DATA_PTR(m_kdata->m_ropnet);
getEquilibriumConstants(tmpKc);
for (int i = 0; i < m_ii; i++) {
krev[i] /= tmpKc[i];
@ -382,12 +384,13 @@ namespace Cantera {
multiply_each(ropr.begin(), ropr.end(), m_rkc.begin());
// multiply ropf by concentration products
m_rxnstoich.multiplyReactants(m_conc.begin(), ropf.begin());
m_rxnstoich.multiplyReactants(DATA_PTR(m_conc), DATA_PTR(ropf));
//m_reactantStoich.multiply(m_conc.begin(), ropf.begin());
// for reversible reactions, multiply ropr by concentration
// products
m_rxnstoich.multiplyRevProducts(m_conc.begin(), ropr.begin());
m_rxnstoich.multiplyRevProducts(DATA_PTR(m_conc),
DATA_PTR(ropr));
//m_revProductStoich.multiply(m_conc.begin(), ropr.begin());
// do global reactions
@ -420,13 +423,13 @@ namespace Cantera {
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
thermo(n).getChemPotentials(m_grt.begin() + m_start[n]);
thermo(n).getChemPotentials(DATA_PTR(m_grt) + m_start[n]);
}
/*
* Use the stoichiometric manager to find deltaG for each
* reaction.
*/
m_rxnstoich.getReactionDelta(m_ii, m_grt.begin(), deltaG);
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_grt), deltaG);
}
/**
@ -448,13 +451,13 @@ namespace Cantera {
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
thermo(n).getPartialMolarEnthalpies(m_grt.begin() + m_start[n]);
thermo(n).getPartialMolarEnthalpies(DATA_PTR(m_grt) + m_start[n]);
}
/*
* Use the stoichiometric manager to find deltaG for each
* reaction.
*/
m_rxnstoich.getReactionDelta(m_ii, m_grt.begin(), deltaH);
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_grt), deltaH);
}
/************************************************************************
@ -476,13 +479,13 @@ namespace Cantera {
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
thermo(n).getPartialMolarEntropies(m_grt.begin() + m_start[n]);
thermo(n).getPartialMolarEntropies(DATA_PTR(m_grt) + m_start[n]);
}
/*
* Use the stoichiometric manager to find deltaS for each
* reaction.
*/
m_rxnstoich.getReactionDelta(m_ii, m_grt.begin(), deltaS);
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_grt), deltaS);
}
/**
@ -506,13 +509,13 @@ namespace Cantera {
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
thermo(n).getStandardChemPotentials(m_grt.begin() + m_start[n]);
thermo(n).getStandardChemPotentials(DATA_PTR(m_grt) + m_start[n]);
}
/*
* Use the stoichiometric manager to find deltaG for each
* reaction.
*/
m_rxnstoich.getReactionDelta(m_ii, m_grt.begin(), deltaG);
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_grt), deltaG);
}
/**
@ -536,7 +539,7 @@ namespace Cantera {
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
thermo(n).getEnthalpy_RT(m_grt.begin() + m_start[n]);
thermo(n).getEnthalpy_RT(DATA_PTR(m_grt) + m_start[n]);
}
doublereal RT = thermo().temperature() * GasConstant;
for (int k = 0; k < m_kk; k++) {
@ -546,7 +549,7 @@ namespace Cantera {
* Use the stoichiometric manager to find deltaG for each
* reaction.
*/
m_rxnstoich.getReactionDelta(m_ii, m_grt.begin(), deltaH);
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_grt), deltaH);
}
/*********************************************************************
@ -569,7 +572,7 @@ namespace Cantera {
int np = nPhases();
int n;
for (n = 0; n < np; n++) {
thermo(n).getEntropy_R(m_grt.begin() + m_start[n]);
thermo(n).getEntropy_R(DATA_PTR(m_grt) + m_start[n]);
}
doublereal R = GasConstant;
for (int k = 0; k < m_kk; k++) {
@ -579,7 +582,7 @@ namespace Cantera {
* Use the stoichiometric manager to find deltaS for each
* reaction.
*/
m_rxnstoich.getReactionDelta(m_ii, m_grt.begin(), deltaS);
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_grt), deltaS);
}
@ -621,7 +624,7 @@ namespace Cantera {
for (int m = 0; m < ncov; m++) rp.push_back(r.cov[m]);
iloc = m_rates.install( reactionNumber(),
r.rateCoeffType, rp.size(),
rp.begin() );
DATA_PTR(rp) );
// store activation energy
m_E.push_back(r.rateCoeffParameters[2]);
// add constant term to rate coeff value vector

View file

@ -191,8 +191,8 @@ namespace Cantera {
*/
virtual void getCreationRates(doublereal* cdot) {
updateROP();
m_rxnstoich.getCreationRates(m_kk, m_kdata->m_ropf.begin(),
m_kdata->m_ropr.begin(), cdot);
m_rxnstoich.getCreationRates(m_kk, &m_kdata->m_ropf[0],
&m_kdata->m_ropr[0], cdot);
}
/**
@ -205,8 +205,8 @@ namespace Cantera {
*/
virtual void getDestructionRates(doublereal* ddot) {
updateROP();
m_rxnstoich.getDestructionRates(m_kk, m_kdata->m_ropf.begin(),
m_kdata->m_ropr.begin(), ddot);
m_rxnstoich.getDestructionRates(m_kk, &m_kdata->m_ropf[0],
&m_kdata->m_ropr[0], ddot);
}
/**
@ -219,7 +219,7 @@ namespace Cantera {
virtual void getNetProductionRates(doublereal* net) {
updateROP();
m_rxnstoich.getNetProductionRates(m_kk,
m_kdata->m_ropnet.begin(),
&m_kdata->m_ropnet[0],
net);
}

View file

@ -21,19 +21,19 @@ namespace Cantera {
enthalpy_mole() const {
doublereal p0 = m_spthermo->refPressure();
return GasConstant * temperature() *
mean_X(enthalpy_RT().begin())
mean_X(&enthalpy_RT()[0])
+ (pressure() - p0)/molarDensity();
}
doublereal LatticeSolidPhase::intEnergy_mole() const {
doublereal p0 = m_spthermo->refPressure();
return GasConstant * temperature() *
mean_X(enthalpy_RT().begin())
mean_X(&enthalpy_RT()[0])
- p0/molarDensity();
}
doublereal LatticeSolidPhase::entropy_mole() const {
return GasConstant * (mean_X(entropy_R().begin()) -
return GasConstant * (mean_X(&entropy_R()[0]) -
sum_xlogx());
}
@ -42,7 +42,7 @@ namespace Cantera {
}
doublereal LatticeSolidPhase::cp_mole() const {
return GasConstant * mean_X(cp_R().begin());
return GasConstant * mean_X(&cp_R()[0]);
}
void LatticeSolidPhase::getActivityConcentrations(doublereal* c) const {
@ -104,8 +104,8 @@ namespace Cantera {
+fp2str(m_molar_density)+" to "+fp2str(molarDensity()));
}
if (m_tlast != tnow) {
m_spthermo->update(tnow, m_cp0_R.begin(), m_h0_RT.begin(),
m_s0_R.begin());
m_spthermo->update(tnow, &m_cp0_R[0], &m_h0_RT[0],
&m_s0_R[0]);
m_tlast = tnow;
int k;
for (k = 0; k < m_kk; k++) {

View file

@ -28,12 +28,12 @@ SUNDIALS_INC = @sundials_include@
# basic components always needed
BASE_OBJ = State.o Elements.o Constituents.o stringUtils.o misc.o \
importCTML.o plots.o \
xml.o Phase.o DenseMatrix.o ctml.o funcs.o ctvector.o \
xml.o Phase.o DenseMatrix.o ctml.o funcs.o \
phasereport.o ct2ctml.o
BASE_H = State.h Elements.h Constituents.h stringUtils.h global.h \
importCTML.h plots.h xml.h Phase.h DenseMatrix.h ctml.h \
funcs.h ctvector.h ct_defs.h Array.h PropertyCalculator.h \
funcs.h ct_defs.h Array.h PropertyCalculator.h \
ctexceptions.h ctlapack.h units.h mix_defs.h\
utilities.h vec_functions.h XML_Writer.h diagnostics.h \
config.h

View file

@ -399,7 +399,7 @@ namespace Cantera {
c[2+i*2+1] = cValues[i];
}
sp.install(speciesName, k, MU0_INTERP, c.begin(), tmin, tmax, pref);
sp.install(speciesName, k, MU0_INTERP, &c[0], tmin, tmax, pref);
}
}

View file

@ -157,7 +157,7 @@ namespace Cantera {
MultiPhase::phase_t& MultiPhase::phase(index_t n) {
if (!m_init) init();
m_phase[n]->setState_TPX(m_temp, m_press,
m_moleFractions.begin() + m_spstart[n]);
DATA_PTR(m_moleFractions) + m_spstart[n]);
return *m_phase[n];
}
@ -335,7 +335,7 @@ namespace Cantera {
x = xMap[speciesName(k)];
if (x > 0.0) moles[k] = x;
}
setMoles(moles.begin());
setMoles(DATA_PTR(moles));
}
@ -377,7 +377,7 @@ namespace Cantera {
m_moles[ip] = phasemoles;
if (nsp > 1) {
p->setState_TPX(m_temp, m_press, n + loc);
p->getMoleFractions(m_moleFractions.begin() + loc);
p->getMoleFractions(DATA_PTR(m_moleFractions) + loc);
}
else {
m_moleFractions[loc] = 1.0;
@ -403,12 +403,12 @@ namespace Cantera {
doublereal dt;
doublereal h0;
int n;
bool start, once;
bool start;
doublereal ferr, hnow, herr = 1.0;
doublereal snow, serr = 1.0, s0;
doublereal Tlow = -1.0, Thigh = -1.0;
doublereal Hlow = Undef, Hhigh = Undef, tnew;
doublereal dta, dtmax, cpb;
doublereal dta=0.0, dtmax, cpb;
MultiPhaseEquil* e = 0;
if (!m_init) init();
@ -670,12 +670,12 @@ namespace Cantera {
// }
else if (XY == TV) {
addLogEntry("problem type","fixed T, V");
doublereal dt = 1.0e3;
// doublereal dt = 1.0e3;
doublereal v0 = volume();
doublereal dVdP;
int n;
bool start = true;
doublereal error, ferr, vnow, pnow, verr, tnew;
doublereal error, vnow, pnow, verr;
for (n = 0; n < maxiter; n++) {
pnow = pressure();
MultiPhaseEquil e(this, start);
@ -728,7 +728,7 @@ done:
index_t ip, loc = 0;
for (ip = 0; ip < m_np; ip++) {
phase_t* p = m_phase[ip];
p->getMoleFractions(m_moleFractions.begin() + loc);
p->getMoleFractions(DATA_PTR(m_moleFractions) + loc);
loc += p->nSpecies();
}
}
@ -742,7 +742,7 @@ done:
index_t p, nsp, loc = 0;
for (p = 0; p < m_np; p++) {
nsp = m_phase[p]->nSpecies();
const doublereal* x = m_moleFractions.begin() + loc;
const doublereal* x = DATA_PTR(m_moleFractions) + loc;
loc += nsp;
m_phase[p]->setState_TPX(m_temp, m_press, x);
m_temp_OK[p] = true;

View file

@ -181,7 +181,7 @@ namespace Cantera {
// Take a very small step in composition space, so that no
// species has precisely zero moles.
vector_fp dxi(m_nsp - m_nel, 1.0e-20);
multiply(m_N, dxi.begin(), m_work.begin());
multiply(m_N, DATA_PTR(dxi), DATA_PTR(m_work));
unsort(m_work);
for (k = 0; k < m_nsp; k++) {
@ -239,7 +239,7 @@ namespace Cantera {
for (k = 0; k < m_nsp; k++) {
m_work3[m_species[k]] = m_moles[k];
}
m_mix->setMoles(m_work3.begin());
m_mix->setMoles(DATA_PTR(m_work3));
}
/// Clean up the composition. The solution algorithm can leave
@ -252,7 +252,7 @@ namespace Cantera {
for (k = 0; k < m_nsp; k++) {
m_work3[m_species[k]] = (m_moles[k] > 0.0 ? m_moles[k] : 0.0);
}
m_mix->setMoles(m_work3.begin());
m_mix->setMoles(DATA_PTR(m_work3));
}
@ -266,12 +266,12 @@ namespace Cantera {
/// linear Gibbs function subject to the element and
/// non-negativity constraints.
int MultiPhaseEquil::setInitialMoles() {
index_t m, n, ik, j;
index_t ik, j;
double not_mu = 1.0e12;
beginLogGroup("MultiPhaseEquil::setInitialMoles");
m_mix->getValidChemPotentials(not_mu, m_mu.begin(), true);
m_mix->getValidChemPotentials(not_mu, DATA_PTR(m_mu), true);
doublereal dg_rt;
int idir;
@ -568,11 +568,11 @@ namespace Cantera {
beginLogGroup("MultiPhaseEquil::stepComposition");
m_iter++;
index_t ik, j, k = 0;
index_t ik, k = 0;
doublereal grad0 = computeReactionSteps(m_dxi);
// compute the mole fraction changes.
multiply(m_N, m_dxi.begin(), m_work.begin());
multiply(m_N, DATA_PTR(m_dxi), DATA_PTR(m_work));
// change to sequential form
unsort(m_work);
@ -635,7 +635,7 @@ namespace Cantera {
// current direction. If it is positive, then we have overshot
// the minimum. In this case, interpolate back.
doublereal not_mu = 1.0e12;
m_mix->getValidChemPotentials(not_mu, m_mu.begin());
m_mix->getValidChemPotentials(not_mu, DATA_PTR(m_mu));
doublereal grad1 = 0.0;
for (k = 0; k < m_nsp; k++) {
grad1 += m_work[k] * m_mu[m_species[k]];
@ -667,7 +667,7 @@ namespace Cantera {
dxi.resize(m_nsp - m_nel);
computeN();
doublereal not_mu = 1.0e12;
m_mix->getValidChemPotentials(not_mu, m_mu.begin());
m_mix->getValidChemPotentials(not_mu, DATA_PTR(m_mu));
for (j = 0; j < m_nsp - m_nel; j++) {

View file

@ -74,9 +74,9 @@ namespace Cantera {
copy(coeffs, coeffs + 15, m_coeff.begin());
m_midT = coeffs[0];
mnp_low = new NasaPoly1(m_index, m_lowT, m_midT,
m_Pref, m_coeff.begin()+1);
m_Pref, &m_coeff[1]);
mnp_high = new NasaPoly1(m_index, m_midT, m_highT,
m_Pref, m_coeff.begin()+8);
m_Pref, &m_coeff[8]);
}
NasaPoly2(const NasaPoly2& b) :
@ -93,9 +93,9 @@ namespace Cantera {
b.m_coeff.begin() + 15,
m_coeff.begin());
mnp_low = new NasaPoly1(m_index, m_lowT, m_midT,
m_Pref, m_coeff.begin()+1);
m_Pref, &m_coeff[1]);
mnp_high = new NasaPoly1(m_index, m_midT, m_highT,
m_Pref, m_coeff.begin()+8);
m_Pref, &m_coeff[8]);
}
NasaPoly2& operator=(const NasaPoly2& b) {
@ -111,9 +111,9 @@ namespace Cantera {
if (mnp_low) delete mnp_low;
if (mnp_high) delete mnp_high;
mnp_low = new NasaPoly1(m_index, m_lowT, m_midT,
m_Pref, m_coeff.begin()+1);
m_Pref, &m_coeff[1]);
mnp_high = new NasaPoly1(m_index, m_midT, m_highT,
m_Pref, m_coeff.begin()+8);
m_Pref, &m_coeff[8]);
}
return *this;
}

View file

@ -96,10 +96,10 @@ namespace Cantera {
vector_fp chigh(7);
copy(c + 8, c + 15, chigh.begin());
checkContinuity(name, tmid, clow, chigh.begin());
checkContinuity(name, tmid, clow, &chigh[0]);
m_high[igrp-1].push_back(NasaPoly1(index, tmid, thigh,
pref, chigh.begin()));
pref, &chigh[0]));
m_low[igrp-1].push_back(NasaPoly1(index, tlow, tmid,
pref, clow));
@ -130,11 +130,11 @@ namespace Cantera {
doublereal tmid = nlow->maxTemp();
if (t < tmid) {
nlow->updateProperties(m_t.begin(), cp_R, h_RT, s_R);
nlow->updateProperties(&m_t[0], cp_R, h_RT, s_R);
} else {
const vector<NasaPoly1> &mhg = m_high[grp-1];
const NasaPoly1 *nhigh = &(mhg[pos]);
nhigh->updateProperties(m_t.begin(), cp_R, h_RT, s_R);
nhigh->updateProperties(&m_t[0], cp_R, h_RT, s_R);
}
}
@ -163,7 +163,7 @@ namespace Cantera {
_end = m_low[i].end();
}
for (; _begin != _end; ++_begin)
_begin->updateProperties(m_t.begin(), cp_R, h_RT, s_R);
_begin->updateProperties(&m_t[0], cp_R, h_RT, s_R);
}
}

View file

@ -79,7 +79,7 @@ namespace Cantera {
void Phase::saveState(vector_fp& state) const {
state.resize(nSpecies() + 2);
saveState(state.size(),state.begin());
saveState(state.size(),&state[0]);
}
void Phase::saveState(int lenstate, doublereal* state) const {
state[0] = temperature();
@ -88,7 +88,7 @@ namespace Cantera {
}
void Phase::restoreState(const vector_fp& state) {
restoreState(state.size(),state.begin());
restoreState(state.size(),&state[0]);
}
void Phase::restoreState(int lenstate, const doublereal* state) {
@ -111,7 +111,7 @@ namespace Cantera {
x = xMap[speciesName(k)];
if (x > 0.0) mf[k] = x;
}
setMoleFractions(mf.begin());
setMoleFractions(&mf[0]);
}
void Phase::setMoleFractionsByName(const string& x) {
@ -138,7 +138,7 @@ namespace Cantera {
y = yMap[speciesName(k)];
if (y > 0.0) mf[k] = y;
}
setMassFractions(mf.begin());
setMassFractions(&mf[0]);
}
void Phase::setMassFractionsByName(const string& y) {
@ -304,7 +304,7 @@ namespace Cantera {
m_data[1] = 0.001;
m_data[2] = 1.0;
setState_TRY(300.0, density(), m_data.begin() + 2);
setState_TRY(300.0, density(), &m_data[2]);
m_kk = nSpecies();
}

View file

@ -873,8 +873,8 @@ namespace Cantera {
//int k;
int kk = s.nTotalSpecies();
s.getFwdRatesOfProgress(m_ropf.begin());
s.getRevRatesOfProgress(m_ropr.begin());
s.getFwdRatesOfProgress(DATA_PTR(m_ropf));
s.getRevRatesOfProgress(DATA_PTR(m_ropr));
//ph.getMoleFractions(m_x.begin());

View file

@ -223,9 +223,9 @@ namespace Cantera {
b.m_coeff.begin() + 15,
m_coeff.begin());
msp_low = new ShomatePoly(m_index, m_lowT, m_midT,
m_Pref, m_coeff.begin()+1);
m_Pref, &m_coeff[1]);
msp_high = new ShomatePoly(m_index, m_midT, m_highT,
m_Pref, m_coeff.begin()+8);
m_Pref, &m_coeff[8]);
}
ShomatePoly2& operator=(const ShomatePoly2& b) {
@ -241,9 +241,9 @@ namespace Cantera {
if (msp_low) delete msp_low;
if (msp_high) delete msp_high;
msp_low = new ShomatePoly(m_index, m_lowT, m_midT,
m_Pref, m_coeff.begin()+1);
m_Pref, &m_coeff[1]);
msp_high = new ShomatePoly(m_index, m_midT, m_highT,
m_Pref, m_coeff.begin()+8);
m_Pref, &m_coeff[8]);
}
return *this;
}

View file

@ -117,11 +117,11 @@ namespace Cantera {
doublereal tmid = nlow->maxTemp();
if (t < tmid) {
nlow->updateProperties(m_t.begin(), cp_R, h_RT, s_R);
nlow->updateProperties(&m_t[0], cp_R, h_RT, s_R);
} else {
const vector<ShomatePoly> &mhg = m_high[grp-1];
const ShomatePoly *nhigh = &(mhg[pos]);
nhigh->updateProperties(m_t.begin(), cp_R, h_RT, s_R);
nhigh->updateProperties(&m_t[0], cp_R, h_RT, s_R);
}
}
@ -149,7 +149,7 @@ namespace Cantera {
_end = m_low[i].end();
}
for (; _begin != _end; ++_begin) {
_begin->updateProperties(m_t.begin(), cp_R, h_RT, s_R);
_begin->updateProperties(&m_t[0], cp_R, h_RT, s_R);
}
}
}

View file

@ -238,7 +238,7 @@ namespace Cantera {
c[8] = c1[5];
c[9] = c1[6];
copy(c1.begin(), c1.begin()+5, c.begin() + 10);
sp.install(speciesName, k, NASA, c.begin(), tmin, tmax, p0);
sp.install(speciesName, k, NASA, &c[0], tmin, tmax, p0);
}
#ifdef INCL_NASA96
@ -297,7 +297,7 @@ namespace Cantera {
c[8] = c1[5];
c[9] = c1[6];
copy(c1.begin(), c1.begin()+5, c.begin() + 10);
sp.install(speciesName, k, NASA, c.begin(), tmin, tmax, p0);
sp.install(speciesName, k, NASA, &c[0], tmin, tmax, p0);
}
#endif
@ -353,7 +353,7 @@ namespace Cantera {
doublereal p0 = OneAtm;
copy(c0.begin(), c0.begin()+7, c.begin() + 1);
copy(c1.begin(), c1.begin()+7, c.begin() + 8);
sp.install(speciesName, k, SHOMATE, c.begin(), tmin, tmax, p0);
sp.install(speciesName, k, SHOMATE, &c[0], tmin, tmax, p0);
}
@ -376,7 +376,7 @@ namespace Cantera {
c[2] = getFloat(f, "s0", "-");
c[3] = getFloat(f, "cp0", "-");
doublereal p0 = OneAtm;
sp.install(speciesName, k, SIMPLE, c.begin(), tmin, tmax, p0);
sp.install(speciesName, k, SIMPLE, &c[0], tmin, tmax, p0);
}
/**

View file

@ -169,7 +169,7 @@ namespace Cantera {
}
doublereal State::mean_Y(const doublereal* Q) const {
return dot(m_ym.begin(), m_ym.end(), Q);
return dot(m_y.begin(), m_y.end(), Q);
}
void State::getMoleFractions(doublereal* x) const {

View file

@ -173,14 +173,14 @@ namespace Cantera {
* Returns a read-only pointer to the start of the
* massFraction array
*/
const doublereal* massFractions() const { return m_y.begin(); }
const doublereal* massFractions() const { return &m_y[0]; }
/**
* Returns a read-only pointer to the start of the
* moleFraction/MW array. This array is the array of mole
* fractions, each divided by the mean molecular weight.
*/
const doublereal* moleFractdivMMW() const { return m_ym.begin();}
const doublereal* moleFractdivMMW() const { return &m_ym[0];}
//@}

View file

@ -38,8 +38,8 @@ namespace Cantera {
void StoichSubstance::_updateThermo() const {
doublereal tnow = temperature();
if (m_tlast != tnow) {
m_spthermo->update(tnow, m_cp0_R.begin(), m_h0_RT.begin(),
m_s0_R.begin());
m_spthermo->update(tnow, &m_cp0_R[0], &m_h0_RT[0],
&m_s0_R[0]);
m_tlast = tnow;
}
}

View file

@ -46,7 +46,7 @@ namespace Cantera {
enthalpy_mole() const {
if (m_n0 <= 0.0) return 0.0;
_updateThermo();
return mean_X(m_h0.begin());
return mean_X(DATA_PTR(m_h0));
}
SurfPhase::
@ -71,7 +71,7 @@ namespace Cantera {
_updateThermo();
copy(m_mu0.begin(), m_mu0.end(), mu);
int k;
getActivityConcentrations(m_work.begin());
getActivityConcentrations(DATA_PTR(m_work));
for (k = 0; k < m_kk; k++) {
mu[k] += GasConstant * temperature() * (log(m_work[k]) - logStandardConc(k));
}
@ -128,7 +128,7 @@ namespace Cantera {
m_pe.resize(m_kk, 0.0);
vector_fp cov(m_kk, 0.0);
cov[0] = 1.0;
setCoverages(cov.begin());
setCoverages(DATA_PTR(cov));
m_logsize.resize(m_kk);
for (int k = 0; k < m_kk; k++)
m_logsize[k] = log(size(k));
@ -178,7 +178,7 @@ namespace Cantera {
* Call the State:: class function
* setConcentrations.
*/
setConcentrations(m_work.begin());
setConcentrations(DATA_PTR(m_work));
}
void SurfPhase::
@ -190,7 +190,7 @@ namespace Cantera {
* Call the State:: class function
* setConcentrations.
*/
setConcentrations(m_work.begin());
setConcentrations(DATA_PTR(m_work));
}
void SurfPhase::
@ -216,7 +216,7 @@ namespace Cantera {
c = cc[speciesName(k)];
if (c > 0.0) cv[k] = c;
}
setCoverages(cv.begin());
setCoverages(DATA_PTR(cv));
}
@ -224,8 +224,8 @@ namespace Cantera {
_updateThermo(bool force) const {
doublereal tnow = temperature();
if (m_tlast != tnow || force) {
m_spthermo->update(tnow, m_cp0.begin(), m_h0.begin(),
m_s0.begin());
m_spthermo->update(tnow, DATA_PTR(m_cp0), DATA_PTR(m_h0),
DATA_PTR(m_s0));
m_tlast = tnow;
doublereal rt = GasConstant * tnow;
int k;

View file

@ -18,8 +18,9 @@ do_ranlib = @DO_RANLIB@
CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT)
OBJS = atomicWeightDB.o CKParser.o CKReader.o Reaction.o ckr_utils.o \
thermoFunctions.o writelog.o ck2ct.o ck2ctml.o
CONV_H = ck2ctml.h CKReader.h thermoFunctions.h \
thermoFunctions.o writelog.o ck2ct.o
# ck2ctml.o
CONV_H = CKReader.h thermoFunctions.h \
Element.h Reaction.h CKParser.h \
ckr_utils.h RxnSpecies.h writelog.h \
ck2ct.h ckr_defs.h Constituent.h \

View file

@ -16,13 +16,13 @@
#include <vector>
using namespace std;
#include "../ctvector.h"
//#include "../ctvector.h"
/// the namespace for the CKReader packaage
namespace ckr {
typedef ct::ctvector_fp vector_fp;
typedef ct::ctvector_int vector_int;
typedef vector<double> vector_fp;
typedef vector<double> vector_int;
//typedef vector<double> vector_fp;
// exceptions

View file

@ -30,8 +30,10 @@
using namespace std;
#include "ctvector.h"
using namespace ct;
//#include "ctvector.h"
//using namespace ct;
#define DATA_PTR(vec) &vec[0]
#ifdef WIN32
#define TYPENAME_KEYWORD
@ -152,15 +154,23 @@ namespace Cantera {
// typedefs
typedef std::map<string, doublereal> compositionMap;
#define USE_STL_VECTOR
#ifdef USE_STL_VECTOR
typedef std::vector<double> array_fp;
typedef std::vector<double> vector_fp;
typedef std::vector<int> array_int;
typedef std::vector<int> vector_int;
#else
typedef ct::ctvector_fp array_fp;
typedef ct::ctvector_fp vector_fp;
typedef ct::ctvector_int array_int;
typedef ct::ctvector_int vector_int;
#endif
typedef vector_int group_t;
typedef std::vector<group_t> grouplist_t;
typedef vector_fp::iterator workPtr;
typedef vector_fp::const_iterator const_workPtr;
typedef doublereal* workPtr;
typedef const doublereal* const_workPtr;
// template<class A, class B>

View file

@ -41,7 +41,8 @@ namespace Cantera {
return fpts[0];
if (x >= xpts.back())
return fpts.back();
const doublereal* loc = lower_bound(xpts.begin(), xpts.end(), x);
vector_fp::const_iterator loc =
lower_bound(xpts.begin(), xpts.end(), x);
int iloc = int(loc - xpts.begin()) - 1;
doublereal ff = fpts[iloc] +
(x - xpts[iloc])*(fpts[iloc + 1]
@ -63,14 +64,14 @@ namespace Cantera {
vector_fp coeffs(n+1, 0.0);
doublereal zer = 0.0;
dpolft_(&nn, x, y, w, &mdeg, &ndg, &epss, coeffs.begin(),
&ierr, awork.begin());
dpolft_(&nn, x, y, w, &mdeg, &ndg, &epss, &coeffs[0],
&ierr, &awork[0]);
if (ierr != 1) throw CanteraError("polyfit",
"DPOLFT returned error code IERR = " + int2str(ierr) +
"while attempting to fit " + int2str(n) + " data points "
+ "to a polynomial of degree " + int2str(maxdeg));
ndeg = ndg;
dpcoef_(&ndg, &zer, r, awork.begin());
dpcoef_(&ndg, &zer, r, &awork[0]);
return epss;
}

View file

@ -238,7 +238,7 @@ namespace Cantera {
if (s.hasChild("size")) sz = getFloat(s, "size");
// add the species to phase p.
p.addUniqueSpecies(s["name"], ecomp.begin(), chrg, sz);
p.addUniqueSpecies(s["name"], &ecomp[0], chrg, sz);
// install the thermo parameterization for this species into
// the species thermo manager for phase p.

View file

@ -46,7 +46,8 @@ namespace Cantera {
* @param points Number of grid points.
*/
Domain1D(int nv=1, int points=1,
doublereal time = 0.0) :
doublereal time = 0.0) :
m_rdt(0.0),
m_time(time),
m_container(0),
m_index(-1),
@ -55,7 +56,8 @@ namespace Cantera {
m_jstart(0),
m_left(0),
m_right(0),
m_refiner(0), m_id("-"), m_desc("-"), m_rdt(0.0) {
m_id("-"), m_desc("-"),
m_refiner(0) {
resize(nv, points);
}

View file

@ -84,7 +84,7 @@ namespace Cantera {
rdx = 1.0/dx;
// calculate perturbed residual
m_resid->eval(j, x0, m_r1.begin(), rdt, 0);
m_resid->eval(j, x0, DATA_PTR(m_r1), rdt, 0);
// compute nth column of Jacobian
for (i = j - 1; i <= j+1; i++) {

View file

@ -324,7 +324,7 @@ namespace Cantera {
if (forceNewJac) {
r.eval(-1, x, stp, 0.0, 0);
jac.eval(x, stp, 0.0);
jac.updateTransient(rdt, r.transientMask().begin());
jac.updateTransient(rdt, DATA_PTR(r.transientMask()));
forceNewJac = false;
}

View file

@ -202,7 +202,7 @@ namespace Cantera {
if (!m_jac_ok) {
eval(-1, x, xnew, 0.0, 0);
m_jac->eval(x, xnew, 0.0);
m_jac->updateTransient(m_rdt, m_mask.begin());
m_jac->updateTransient(m_rdt, DATA_PTR(m_mask));
m_jac_ok = true;
}
int m = m_newt->solve(x, xnew, *this, *m_jac, loglevel);
@ -237,17 +237,17 @@ namespace Cantera {
fill(r, r + m_size, 0.0);
fill(m_mask.begin(), m_mask.end(), 0);
if (rdt < 0.0) rdt = m_rdt;
int nn;
// int nn;
vector<Domain1D*>::iterator d;
// iterate over the bulk domains first
for (d = m_bulk.begin(); d != m_bulk.end(); ++d) {
(*d)->eval(j, x, r, m_mask.begin(), rdt);
(*d)->eval(j, x, r, DATA_PTR(m_mask), rdt);
}
// then over the connector domains
for (d = m_connect.begin(); d != m_connect.end(); ++d) {
(*d)->eval(j, x, r, m_mask.begin(), rdt);
(*d)->eval(j, x, r, DATA_PTR(m_mask), rdt);
}
// increment counter and time
@ -283,7 +283,7 @@ namespace Cantera {
// if the stepsize has changed, then update the transient
// part of the Jacobian
if (fabs(rdt_old - m_rdt) > Tiny) {
m_jac->updateTransient(m_rdt, m_mask.begin());
m_jac->updateTransient(m_rdt, DATA_PTR(m_mask));
}
// iterate over all domains, preparing each one to begin
@ -303,7 +303,7 @@ namespace Cantera {
*/
void OneDim::setSteadyMode() {
m_rdt = 0.0;
m_jac->updateTransient(m_rdt, m_mask.begin());
m_jac->updateTransient(m_rdt, DATA_PTR(m_mask));
}
/**

View file

@ -32,7 +32,7 @@ namespace Cantera {
m_x.resize(size(), 0.0);
m_xnew.resize(size(), 0.0);
for (int n = 0; n < m_nd; n++) {
domain(n)._getInitialSoln(m_x.begin() + start(n));
domain(n)._getInitialSoln(DATA_PTR(m_x) + start(n));
domain(n).m_adiabatic=false;
}
@ -126,7 +126,7 @@ namespace Cantera {
void Sim1D::save(string fname, string id, string desc) {
OneDim::save(fname, id, desc, m_x.begin());
OneDim::save(fname, id, desc, DATA_PTR(m_x));
}
/**
@ -169,7 +169,7 @@ namespace Cantera {
m_xnew.resize(sz);
for (m = 0; m < m_nd; m++) {
if (xd[m]) {
domain(m).restore(*xd[m], m_x.begin() + domain(m).loc());
domain(m).restore(*xd[m], DATA_PTR(m_x) + domain(m).loc());
}
}
resize();
@ -187,7 +187,7 @@ namespace Cantera {
void Sim1D::showSolution(ostream& s) {
for (int n = 0; n < m_nd; n++) {
if (domain(n).domainType() != cEmptyType)
domain(n).showSolution_s(s, m_x.begin() + start(n));
domain(n).showSolution_s(s, DATA_PTR(m_x) + start(n));
}
}
@ -196,20 +196,20 @@ namespace Cantera {
if (domain(n).domainType() != cEmptyType) {
writelog("\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+domain(n).id()
+" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
domain(n).showSolution(m_x.begin() + start(n));
domain(n).showSolution(DATA_PTR(m_x) + start(n));
}
}
}
void Sim1D::getInitialSoln() {
for (int n = 0; n < m_nd; n++) {
domain(n)._getInitialSoln(m_x.begin() + start(n));
domain(n)._getInitialSoln(DATA_PTR(m_x) + start(n));
}
}
void Sim1D::finalize() {
for (int n = 0; n < m_nd; n++) {
domain(n)._finalize(m_x.begin() + start(n));
domain(n)._finalize(DATA_PTR(m_x) + start(n));
}
}
@ -222,7 +222,7 @@ namespace Cantera {
void Sim1D::newtonSolve(int loglevel) {
int m = OneDim::solve(m_x.begin(), m_xnew.begin(), loglevel);
int m = OneDim::solve(DATA_PTR(m_x), DATA_PTR(m_xnew), loglevel);
if (m >= 0)
copy(m_xnew.begin(), m_xnew.end(), m_x.begin());
else if (m > -10)
@ -285,11 +285,11 @@ namespace Cantera {
writelog("Take "+int2str(nsteps)+
" timesteps ");
}
dt = timeStep(nsteps, dt, m_x.begin(), m_xnew.begin(),
dt = timeStep(nsteps, dt, DATA_PTR(m_x), DATA_PTR(m_xnew),
loglevel-1);
if (loglevel == 1) {
sprintf(buf, " %10.4g %10.4g \n", dt,
log10(ssnorm(m_x.begin(), m_xnew.begin())));
log10(ssnorm(DATA_PTR(m_x), DATA_PTR(m_xnew))));
writelog(buf);
}
istep++;
@ -336,7 +336,7 @@ namespace Cantera {
// determine where new points are needed
ianalyze = r.analyze(d.grid().size(),
d.grid().begin(), m_x.begin() + start(n));
DATA_PTR(d.grid()), DATA_PTR(m_x) + start(n));
if (ianalyze < 0) return ianalyze;
if (loglevel > 0) { r.show(); }
@ -396,7 +396,7 @@ namespace Cantera {
Domain1D& d = domain(n);
// Refiner& r = d.refiner();
gridsize = dsize[n]; // d.nPoints() + r.nNewPoints();
d.setupGrid(gridsize, znew.begin() + gridstart);
d.setupGrid(gridsize, DATA_PTR(znew) + gridstart);
gridstart += gridsize;
}
@ -424,7 +424,7 @@ namespace Cantera {
vector_fp znew, xnew;
doublereal xmid;
doublereal zfixed,interp_factor;
doublereal z1,z2,t1,t2;
doublereal z1 = 0.0, z2 = 0.0, t1,t2;
int strt, n, m, i;
int m1,m2;
vector_int dsize;
@ -508,7 +508,7 @@ namespace Cantera {
Domain1D& d = domain(n);
// Refiner& r = d.refiner();
gridsize = dsize[n]; // d.nPoints() + r.nNewPoints();
d.setupGrid(gridsize, znew.begin() + gridstart);
d.setupGrid(gridsize, DATA_PTR(znew) + gridstart);
gridstart += gridsize;
}

View file

@ -75,7 +75,7 @@ namespace Cantera {
void showSolution(ostream& s);
void showSolution();
const doublereal* solution() { return m_x.begin(); }
const doublereal* solution() { return DATA_PTR(m_x); }
void setTimeStep(doublereal stepsize, int n, integer* tsteps);
@ -84,7 +84,7 @@ namespace Cantera {
void solve(int loglevel = 0, bool refine_grid = true);
void eval(doublereal rdt=-1.0, int count = 1) {
OneDim::eval(-1, m_x.begin(), m_xnew.begin(), rdt, count);
OneDim::eval(-1, DATA_PTR(m_x), DATA_PTR(m_xnew), rdt, count);
}
/// Refine the grid in all domains.
@ -104,10 +104,10 @@ namespace Cantera {
void getInitialSoln();
void setSolution(const doublereal* soln) {
copy(soln, soln + m_x.size(), m_x.begin());
copy(soln, soln + m_x.size(), DATA_PTR(m_x));
}
const doublereal* solution() const { return m_x.begin(); }
const doublereal* solution() const { return DATA_PTR(m_x); }
protected:

View file

@ -176,14 +176,14 @@ namespace Cantera {
vmin[4+k] = -1.0e-5;
vmax[4+k] = 1.0e5;
}
setBounds(vmin.size(), vmin.begin(), vmax.size(), vmax.begin());
setBounds(vmin.size(), DATA_PTR(vmin), vmax.size(), DATA_PTR(vmax));
//-------------------- default error tolerances ----------------
vector_fp rtol(m_nv, 1.0e-8);
vector_fp atol(m_nv, 1.0e-15);
setTolerances(rtol.size(), rtol.begin(), atol.size(), atol.begin(),false);
setTolerances(rtol.size(), rtol.begin(), atol.size(), atol.begin(),true);
setTolerances(rtol.size(), DATA_PTR(rtol), atol.size(), DATA_PTR(atol),false);
setTolerances(rtol.size(), DATA_PTR(rtol), atol.size(), DATA_PTR(atol),true);
//-------------------- grid refinement -------------------------
m_refiner->setActive(0, false);
@ -193,7 +193,7 @@ namespace Cantera {
vector_fp gr;
for (int ng = 0; ng < m_points; ng++) gr.push_back(1.0*ng/m_points);
setupGrid(m_points, gr.begin());
setupGrid(m_points, DATA_PTR(gr));
setID("stagnation flow");
}
@ -289,7 +289,7 @@ namespace Cantera {
const doublereal* yyjp = x + m_nv*(j+1) + c_offset_Y;
for (int k = 0; k < m_nsp; k++)
m_ybar[k] = 0.5*(yyj[k] + yyjp[k]);
m_thermo->setMassFractions_NoNorm(m_ybar.begin());
m_thermo->setMassFractions_NoNorm(DATA_PTR(m_ybar));
m_thermo->setPressure(m_press);
}
@ -582,7 +582,7 @@ namespace Cantera {
for (j = j0; j < j1; j++) {
setGasAtMidpoint(x,j);
m_visc[j] = (m_dovisc ? m_trans->viscosity() : 0.0);
m_trans->getMixDiffCoeffs(m_diff.begin() + j*m_nsp);
m_trans->getMixDiffCoeffs(DATA_PTR(m_diff) + j*m_nsp);
m_tcon[j] = m_trans->thermalConductivity();
}
}
@ -597,7 +597,7 @@ namespace Cantera {
m_visc[m] = (m_dovisc ? m_trans->viscosity() : 0.0);
m_trans->getMultiDiffCoeffs(m_nsp,
m_multidiff.begin() + mindex(0,0,m));
DATA_PTR(m_multidiff) + mindex(0,0,m));
for (k = 0; k < m_nsp; k++) {
sum = 0.0;
@ -614,7 +614,7 @@ namespace Cantera {
m_tcon[m] = m_trans->thermalConductivity();
if (m_do_soret) {
m_trans->getThermalDiffCoeffs(m_dthermal.begin() + m*m_nsp);
m_trans->getThermalDiffCoeffs(m_dthermal.ptrColumn(0) + m*m_nsp);
}
}
}
@ -1043,7 +1043,7 @@ namespace Cantera {
writelog("Grid contains "+int2str(np)+
" points.\n");
readgrid = true;
setupGrid(np, x.begin());
setupGrid(np, DATA_PTR(x));
}
}
if (!readgrid) {
@ -1157,27 +1157,27 @@ namespace Cantera {
if (m_desc != "") addString(flow,"description",m_desc);
XML_Node& gv = flow.addChild("grid_data");
addFloat(flow, "pressure", m_press, "Pa", "pressure");
addFloatArray(gv,"z",m_z.size(),m_z.begin(),
addFloatArray(gv,"z",m_z.size(),DATA_PTR(m_z),
"m","length");
vector_fp x(static_cast<size_t>(soln.nColumns()));
soln.getRow(0,x.begin());
addFloatArray(gv,"u",x.size(),x.begin(),"m/s","velocity");
soln.getRow(0,DATA_PTR(x));
addFloatArray(gv,"u",x.size(),DATA_PTR(x),"m/s","velocity");
soln.getRow(1,x.begin());
soln.getRow(1,DATA_PTR(x));
addFloatArray(gv,"V",
x.size(),x.begin(),"1/s","rate");
x.size(),DATA_PTR(x),"1/s","rate");
soln.getRow(2,x.begin());
addFloatArray(gv,"T",x.size(),x.begin(),"K","temperature",0.0);
soln.getRow(2,DATA_PTR(x));
addFloatArray(gv,"T",x.size(),DATA_PTR(x),"K","temperature",0.0);
soln.getRow(3,x.begin());
addFloatArray(gv,"L",x.size(),x.begin(),"N/m^4");
soln.getRow(3,DATA_PTR(x));
addFloatArray(gv,"L",x.size(),DATA_PTR(x),"N/m^4");
for (k = 0; k < m_nsp; k++) {
soln.getRow(4+k,x.begin());
soln.getRow(4+k,DATA_PTR(x));
addFloatArray(gv,m_thermo->speciesName(k),
x.size(),x.begin(),"","massFraction",0.0,1.0);
x.size(),DATA_PTR(x),"","massFraction",0.0,1.0);
}
}

View file

@ -98,7 +98,7 @@ namespace Cantera {
m_xstr = xin;
if (m_flow) {
m_flow->phase().setMoleFractionsByName(xin);
m_flow->phase().getMassFractions(m_yin.begin());
m_flow->phase().getMassFractions(DATA_PTR(m_yin));
needJacUpdate();
}
}
@ -107,7 +107,7 @@ namespace Cantera {
setMoleFractions(doublereal* xin) {
if (m_flow) {
m_flow->phase().setMoleFractions(xin);
m_flow->phase().getMassFractions(m_yin.begin());
m_flow->phase().getMassFractions(DATA_PTR(m_yin));
needJacUpdate();
}
}
@ -134,7 +134,7 @@ namespace Cantera {
// set tolerances
vector_fp rtol(2, 1e-4);
vector_fp atol(2, 1.e-5);
setTolerances(2, rtol.begin(), 2, atol.begin());
setTolerances(2, DATA_PTR(rtol), 2, DATA_PTR(atol));
// if a flow domain is present on the left, then this must be
// a right inlet. Note that an inlet object can only be a
@ -504,7 +504,7 @@ namespace Cantera {
m_xstr = xres;
if (m_flow) {
m_flow->phase().setMoleFractionsByName(xres);
m_flow->phase().getMassFractions(m_yres.begin());
m_flow->phase().getMassFractions(DATA_PTR(m_yres));
needJacUpdate();
}
}
@ -513,7 +513,7 @@ namespace Cantera {
setMoleFractions(doublereal* xres) {
if (m_flow) {
m_flow->phase().setMoleFractions(xres);
m_flow->phase().getMassFractions(m_yres.begin());
m_flow->phase().getMassFractions(DATA_PTR(m_yres));
needJacUpdate();
}
}
@ -747,14 +747,14 @@ namespace Cantera {
lower[n+1] = -1.0e-5;
upper[n+1] = 2.0;
}
setBounds(m_nv, lower.begin(), m_nv, upper.begin());
setBounds(m_nv, DATA_PTR(lower), m_nv, DATA_PTR(upper));
vector_fp rtol(m_nv), atol(m_nv);
for (n = 0; n < m_nv; n++) {
rtol[n] = 1.0e-5;
atol[n] = 1.0e-9;
}
atol[0] = 1.0e-4;
setTolerances(m_nv, rtol.begin(), m_nv, atol.begin());
setTolerances(m_nv, DATA_PTR(rtol), m_nv, DATA_PTR(atol));
}
@ -780,7 +780,7 @@ namespace Cantera {
sum += x[k+1];
}
m_sphase->setTemperature(x[0]);
m_sphase->setCoverages(m_work.begin());
m_sphase->setCoverages(DATA_PTR(m_work));
//m_kin->advanceCoverages(1.0);
//m_sphase->getCoverages(m_fixed_cov.begin());
@ -800,7 +800,7 @@ namespace Cantera {
m_flow_right->setGas(xg + rightloc, 0);
}
m_kin->getNetProductionRates(m_work.begin());
m_kin->getNetProductionRates(DATA_PTR(m_work));
doublereal rs0 = 1.0/m_sphase->siteDensity();
//scale(m_work.begin(), m_work.end(), m_work.begin(), m_mult[0]);
@ -838,7 +838,7 @@ namespace Cantera {
int nc;
if (m_flow_left) {
nc = m_flow_left->nComponents();
const doublereal* mwleft = m_phase_left->molecularWeights().begin();
const doublereal* mwleft = DATA_PTR(m_phase_left->molecularWeights());
rb =r - nc;
xb = x - nc;
rb[2] = xb[2] - x[0]; // specified T

View file

@ -78,9 +78,9 @@ namespace Cantera {
array_fp x(kk);
array_fp y(kk);
array_fp mu(kk);
th.getMoleFractions(x.begin());
th.getMassFractions(y.begin());
th.getChemPotentials(mu.begin());
th.getMoleFractions(&x[0]);
th.getMassFractions(&y[0]);
th.getChemPotentials(&mu[0]);
doublereal rt = GasConstant * th.temperature();
int k;
if (th.nSpecies() > 1) {
@ -142,9 +142,9 @@ namespace Cantera {
int kk = mix.nSpecies();
array_fp zz(kk);
switch (xyc) {
case 0: mix.getMoleFractions(zz.begin()); break;
case 1: mix.getMassFractions(zz.begin()); break;
case 2: mix.getConcentrations(zz.begin()); break;
case 0: mix.getMoleFractions(&zz[0]); break;
case 1: mix.getMassFractions(&zz[0]); break;
case 2: mix.getConcentrations(&zz[0]); break;
default: return "error: xyc must be 0, 1, or 2";
}

View file

@ -109,7 +109,7 @@ namespace Cantera {
int n,m;
// get the gaseous binary diffusion coefficients
m_gastran->getBinaryDiffCoeffs(m_nsp, m_d.begin());
m_gastran->getBinaryDiffCoeffs(m_nsp, m_d.ptrColumn(0));
doublereal por2tort = m_porosity / m_tortuosity;
for (n = 0; n < m_nsp; n++)
for (m = 0; m < m_nsp; m++)
@ -177,8 +177,8 @@ namespace Cantera {
const doublereal* state2, double delta, double* fluxes) {
int k;
doublereal conc1, conc2;
doublereal* cbar = m_spwork.begin();
doublereal* gradc = m_spwork2.begin();
doublereal* cbar = DATA_PTR(m_spwork);
doublereal* gradc = DATA_PTR(m_spwork2);
doublereal t1 = state1[0];
doublereal t2 = state2[0];
doublereal rho1 = state1[1];
@ -268,7 +268,7 @@ namespace Cantera {
void DustyGasTransport::updateTransport_C()
{
m_thermo->getMoleFractions(m_x.begin());
m_thermo->getMoleFractions(DATA_PTR(m_x));
// add an offset to avoid a pure species condition
// (check - this may be unnecessary)

View file

@ -262,36 +262,36 @@ namespace Cantera {
m_logTemp[i] = log(tstar[i+1]);
vector_fp c(DeltaDegree+1);
rmserr = fitDelta(0, i, DeltaDegree, c.begin());
rmserr = fitDelta(0, i, DeltaDegree, DATA_PTR(c));
if (log_level > 3) {
sprintf(p, " Tstar=\"%12.6g\"", tstar[i+1]);
m_xml->XML_open(logfile, "dstar_fit", p);
m_xml->XML_item(logfile, "Tstar", tstar[i+1]);
m_xml->XML_writeVector(logfile, indent, "omega22",
c.size(), c.begin());
c.size(), DATA_PTR(c));
}
m_o22poly.push_back(c);
if (rmserr > e22) e22 = rmserr;
rmserr = fitDelta(1, i, DeltaDegree, c.begin());
rmserr = fitDelta(1, i, DeltaDegree, DATA_PTR(c));
m_apoly.push_back(c);
if (log_level > 3)
m_xml->XML_writeVector(logfile, indent, "astar",
c.size(), c.begin());
c.size(), DATA_PTR(c));
if (rmserr > ea) ea = rmserr;
rmserr = fitDelta(2, i, DeltaDegree, c.begin());
rmserr = fitDelta(2, i, DeltaDegree, DATA_PTR(c));
m_bpoly.push_back(c);
if (log_level > 3)
m_xml->XML_writeVector(logfile, indent, "bstar",
c.size(), c.begin());
c.size(), DATA_PTR(c));
if (rmserr > eb) eb = rmserr;
rmserr = fitDelta(3, i, DeltaDegree, c.begin());
rmserr = fitDelta(3, i, DeltaDegree, DATA_PTR(c));
m_cpoly.push_back(c);
if (log_level > 3)
m_xml->XML_writeVector(logfile, indent, "cstar",
c.size(), c.begin());
c.size(), DATA_PTR(c));
if (rmserr > ec) ec = rmserr;
if (log_level > 3)
@ -329,7 +329,7 @@ namespace Cantera {
return 0.0;
}
w[0] = -1.0;
return polyfit(8, delta, begin, w.begin(), degree, ndeg, 0.0, c);
return polyfit(8, delta, begin, DATA_PTR(w), degree, ndeg, 0.0, c);
}
doublereal MMCollisionInt::omega22(double ts, double deltastar) {
@ -346,9 +346,10 @@ namespace Cantera {
vector_fp values(3);
for (i = i1; i < i2; i++) {
if (deltastar == 0.0) values[i-i1] = omega22_table[8*i];
else values[i-i1] = poly5(deltastar, m_o22poly[i].begin());
else values[i-i1] = poly5(deltastar, DATA_PTR(m_o22poly[i]));
}
return quadInterp(log(ts), m_logTemp.begin() + i1, values.begin());
return quadInterp(log(ts), DATA_PTR(m_logTemp)
+ i1, DATA_PTR(values));
}
doublereal MMCollisionInt::astar(double ts, double deltastar) {
@ -365,9 +366,10 @@ namespace Cantera {
vector_fp values(3);
for (i = i1; i < i2; i++) {
if (deltastar == 0.0) values[i-i1] = astar_table[8*(i + 1)];
else values[i-i1] = poly5(deltastar, m_apoly[i].begin());
else values[i-i1] = poly5(deltastar, DATA_PTR(m_apoly[i]));
}
return quadInterp(log(ts), m_logTemp.begin() + i1, values.begin());
return quadInterp(log(ts), DATA_PTR(m_logTemp)
+ i1, DATA_PTR(values));
}
@ -385,9 +387,10 @@ namespace Cantera {
vector_fp values(3);
for (i = i1; i < i2; i++) {
if (deltastar == 0.0) values[i-i1] = bstar_table[8*(i + 1)];
else values[i-i1] = poly5(deltastar, m_bpoly[i].begin());
else values[i-i1] = poly5(deltastar, DATA_PTR(m_bpoly[i]));
}
return quadInterp(log(ts), m_logTemp.begin() + i1, values.begin());
return quadInterp(log(ts), DATA_PTR(m_logTemp) + i1,
DATA_PTR(values));
}
@ -405,10 +408,10 @@ namespace Cantera {
vector_fp values(3);
for (i = i1; i < i2; i++) {
if (deltastar == 0.0) values[i-i1] = cstar_table[8*(i + 1)];
else values[i-i1] = poly5(deltastar, m_cpoly[i].begin());
else values[i-i1] = poly5(deltastar, DATA_PTR(m_cpoly[i]));
}
return quadInterp(log(ts), m_logTemp.begin() + i1,
values.begin()); }
return quadInterp(log(ts), DATA_PTR(m_logTemp) + i1,
DATA_PTR(values)); }
void MMCollisionInt::fit_omega22(ostream& logfile, int degree,
@ -421,14 +424,14 @@ namespace Cantera {
vector_fp values(n);
doublereal rmserr;
vector_fp w(n);
doublereal* logT = m_logTemp.begin() + m_nmin;
doublereal* logT = DATA_PTR(m_logTemp) + m_nmin;
for (i = 0; i < n; i++) {
if (deltastar == 0.0) values[i] = omega22_table[8*(i + m_nmin)];
else values[i] = poly5(deltastar, m_o22poly[i+m_nmin].begin());
else values[i] = poly5(deltastar, DATA_PTR(m_o22poly[i+m_nmin]));
}
w[0]= -1.0;
rmserr = polyfit(n, logT, values.begin(),
w.begin(), degree, ndeg, 0.0, o22);
rmserr = polyfit(n, logT, DATA_PTR(values),
DATA_PTR(w), degree, ndeg, 0.0, o22);
if (rmserr > 0.01) {
char p[100];
sprintf(p, "Warning: RMS error = %12.6g in omega_22 fit with delta* = %12.6g\n", rmserr, deltastar);
@ -446,30 +449,30 @@ namespace Cantera {
vector_fp values(n);
doublereal rmserr;
vector_fp w(n);
doublereal* logT = m_logTemp.begin() + m_nmin;
doublereal* logT = DATA_PTR(m_logTemp) + m_nmin;
for (i = 0; i < n; i++) {
if (deltastar == 0.0) values[i] = astar_table[8*(i + m_nmin + 1)];
else values[i] = poly5(deltastar, m_apoly[i+m_nmin].begin());
else values[i] = poly5(deltastar, DATA_PTR(m_apoly[i+m_nmin]));
}
w[0]= -1.0;
rmserr = polyfit(n, logT, values.begin(),
w.begin(), degree, ndeg, 0.0, a);
rmserr = polyfit(n, logT, DATA_PTR(values),
DATA_PTR(w), degree, ndeg, 0.0, a);
for (i = 0; i < n; i++) {
if (deltastar == 0.0) values[i] = bstar_table[8*(i + m_nmin + 1)];
else values[i] = poly5(deltastar, m_bpoly[i+m_nmin].begin());
else values[i] = poly5(deltastar, DATA_PTR(m_bpoly[i+m_nmin]));
}
w[0]= -1.0;
rmserr = polyfit(n, logT, values.begin(),
w.begin(), degree, ndeg, 0.0, b);
rmserr = polyfit(n, logT, DATA_PTR(values),
DATA_PTR(w), degree, ndeg, 0.0, b);
for (i = 0; i < n; i++) {
if (deltastar == 0.0) values[i] = cstar_table[8*(i + m_nmin + 1)];
else values[i] = poly5(deltastar, m_cpoly[i+m_nmin].begin());
else values[i] = poly5(deltastar, DATA_PTR(m_cpoly[i+m_nmin]));
}
w[0]= -1.0;
rmserr = polyfit(n, logT, values.begin(),
w.begin(), degree, ndeg, 0.0, c);
rmserr = polyfit(n, logT, DATA_PTR(values),
DATA_PTR(w), degree, ndeg, 0.0, c);
if (m_loglevel > 2) {
char p[100];

View file

@ -22,7 +22,7 @@ OBJS = TransportFactory.o MultiTransport.o MixTransport.o MMCollisionInt.o \
SolidTransport.o DustyGasTransport.o
TRAN_H = TransportFactory.h MultiTransport.h MixTransport.h \
MMCollisionInt.h SolidTransport.h DustyGasTransport.h \
TransportBase.h L_matrix.h FtnTransport.h TransportParams.h
TransportBase.h L_matrix.h TransportParams.h
CXX_INCLUDES = -I.. @CXX_INCLUDES@
LIB = @buildlib@/libtransport.a

View file

@ -150,7 +150,7 @@ namespace Cantera {
// update m_visc and m_phi if necessary
if (!m_viscwt_ok) updateViscosity_T();
multiply(m_phi, m_molefracs.begin(), m_spwork.begin());
multiply(m_phi, DATA_PTR(m_molefracs), DATA_PTR(m_spwork));
for (k = 0; k < m_nsp; k++) {
vismix += m_molefracs[k] * m_visc[k]/m_spwork[k]; //denom;
@ -182,7 +182,7 @@ namespace Cantera {
void MixTransport::getMobilities(doublereal* mobil) {
int k;
getMixDiffCoeffs(m_spwork.begin());
getMixDiffCoeffs(DATA_PTR(m_spwork));
doublereal c1 = ElectronCharge / (Boltzmann * m_temp);
for (k = 0; k < m_nsp; k++) {
mobil[k] = c1 * m_spwork[k] * m_thermo->charge(k);
@ -250,7 +250,7 @@ namespace Cantera {
update_T();
update_C();
getMixDiffCoeffs(m_spwork.begin());
getMixDiffCoeffs(DATA_PTR(m_spwork));
const array_fp& mw = m_thermo->molecularWeights();
const doublereal* y = m_thermo->massFractions();
@ -367,7 +367,7 @@ namespace Cantera {
m_diffmix_ok = false;
m_condmix_ok = false;
m_thermo->getMoleFractions(m_molefracs.begin());
m_thermo->getMoleFractions(DATA_PTR(m_molefracs));
// add an offset to avoid a pure species condition
int k;

View file

@ -117,12 +117,12 @@ namespace Cantera {
integer n2 = 2*n;
integer n3 = 3*n;
ct_dgemv(ctlapack::ColMajor, ctlapack::NoTranspose, n, n2, 1.0,
data().begin(), static_cast<int>(nRows()), b, 1, 0.0, prod, 1);
DATA_PTR(data()), static_cast<int>(nRows()), b, 1, 0.0, prod, 1);
ct_dgemv(ctlapack::ColMajor, ctlapack::NoTranspose, n, n3, 1.0,
data().begin() + n, static_cast<int>(nRows()),
DATA_PTR(data()) + n, static_cast<int>(nRows()),
b, 1, 0.0, prod+n, 1);
ct_dgemv(ctlapack::ColMajor, ctlapack::NoTranspose, n, n, 1.0,
data().begin() + n*n3 + n2, static_cast<int>(nRows()),
DATA_PTR(data()) + n*n3 + n2, static_cast<int>(nRows()),
b + n, 1, 0.0, prod+n2, 1);
for (int i = 0; i < n; i++)
prod[i + n2] += b[i + n2] * value(i + n2, i + n2);
@ -397,15 +397,15 @@ namespace Cantera {
m_Lmatrix.resize(3*m_nsp, 3*m_nsp, 0.0);
eval_L0000(m_molefracs.begin());
eval_L0010(m_molefracs.begin());
eval_L0000(DATA_PTR(m_molefracs));
eval_L0010(DATA_PTR(m_molefracs));
eval_L0001();
eval_L1000();
eval_L1010(m_molefracs.begin());
eval_L1001(m_molefracs.begin());
eval_L1010(DATA_PTR(m_molefracs));
eval_L1001(DATA_PTR(m_molefracs));
eval_L0100();
eval_L0110();
eval_L0101(m_molefracs.begin());
eval_L0101(DATA_PTR(m_molefracs));
// Solve it using GMRES or LU decomposition. The last solution
@ -421,7 +421,7 @@ namespace Cantera {
//else {
copy(m_b.begin(), m_b.end(), m_a.begin());
try {
int info = solve(m_Lmatrix, m_a.begin());
solve(m_Lmatrix, DATA_PTR(m_a));
}
catch (CanteraError) {
//if (info != 0) {
@ -456,7 +456,7 @@ namespace Cantera {
for (i = 0; i < ndim; i++) {
if (grad_T[i] != 0.0) addThermalDiffusion = true;
}
if (addThermalDiffusion) getThermalDiffCoeffs(m_spwork.begin());
if (addThermalDiffusion) getThermalDiffCoeffs(DATA_PTR(m_spwork));
const doublereal* y = m_thermo->massFractions();
doublereal rho = m_thermo->density();
@ -510,14 +510,14 @@ namespace Cantera {
// use LAPACK to solve the equations
int info=0;
ct_dgetrf(static_cast<int>(m_aa.nRows()),
static_cast<int>(m_aa.nColumns()), m_aa.begin(),
static_cast<int>(m_aa.nColumns()), m_aa.ptrColumn(0),
static_cast<int>(m_aa.nRows()),
m_aa.ipiv().begin(), info);
&m_aa.ipiv()[0], info);
if (info == 0) {
ct_dgetrs(ctlapack::NoTranspose,
static_cast<int>(m_aa.nRows()), ndim,
m_aa.begin(), static_cast<int>(m_aa.nRows()),
m_aa.ipiv().begin(), fluxes, ldf, info);
m_aa.ptrColumn(0), static_cast<int>(m_aa.nRows()),
&m_aa.ipiv()[0], fluxes, ldf, info);
if (info != 0) info += 100;
}
else
@ -558,9 +558,9 @@ namespace Cantera {
const doublereal* state2, doublereal delta,
doublereal* fluxes) {
double* x1 = m_spwork1.begin();
double* x2 = m_spwork2.begin();
double* x3 = m_spwork3.begin();
double* x1 = DATA_PTR(m_spwork1);
double* x2 = DATA_PTR(m_spwork2);
double* x3 = DATA_PTR(m_spwork3);
int n, nsp = m_thermo->nSpecies();
m_thermo->restoreState(nsp+2, state1);
double p1 = m_thermo->pressure();
@ -580,7 +580,7 @@ namespace Cantera {
x3[n] = 0.5*(x1[n] + x2[n]);
}
m_thermo->setState_TPX(t, p, x3);
m_thermo->getMoleFractions(m_molefracs.begin());
m_thermo->getMoleFractions(DATA_PTR(m_molefracs));
// update the binary diffusion coefficients if necessary
@ -595,7 +595,7 @@ namespace Cantera {
bool addThermalDiffusion = false;
if (state1[0] != state2[0]) {
addThermalDiffusion = true;
getThermalDiffCoeffs(m_spwork.begin());
getThermalDiffCoeffs(DATA_PTR(m_spwork));
}
const doublereal* y = m_thermo->massFractions();
@ -636,11 +636,11 @@ namespace Cantera {
int nr = m_aa.nRows();
int nc = m_aa.nColumns();
ct_dgetrf(nr, nc, m_aa.begin(), nr, m_aa.ipiv().begin(), info);
ct_dgetrf(nr, nc, m_aa.ptrColumn(0), nr, &m_aa.ipiv()[0], info);
if (info == 0) {
int ndim = 1;
ct_dgetrs(ctlapack::NoTranspose, nr, ndim,
m_aa.begin(), nr, m_aa.ipiv().begin(), fluxes, nr, info);
m_aa.ptrColumn(0), nr, &m_aa.ipiv()[0], fluxes, nr, info);
if (info != 0)
throw CanteraError("MultiTransport::getMassFluxes",
"Error in DGETRS. Info = "+int2str(info));
@ -690,7 +690,7 @@ namespace Cantera {
// evaluate L0000 if the temperature or concentrations have
// changed since it was last evaluated.
if (!m_l0000_ok) eval_L0000(m_molefracs.begin());
if (!m_l0000_ok) eval_L0000(DATA_PTR(m_molefracs));
// invert L00,00
int ierr = invert(m_Lmatrix, m_nsp);
@ -804,7 +804,7 @@ namespace Cantera {
// fraction array.
m_l0000_ok = false;
m_lmatrix_soln_ok = false;
m_thermo->getMoleFractions(m_molefracs.begin());
m_thermo->getMoleFractions(DATA_PTR(m_molefracs));
// add an offset to avoid a pure species condition
@ -967,16 +967,16 @@ namespace Cantera {
z = m_logt - m_log_eps_k(i,j);
ipoly = m_poly[i][j];
if (m_mode == CK_Mode) {
m_om22(i,j) = poly6(z, m_om22_poly[ipoly].begin());
m_astar(i,j) = poly6(z, m_astar_poly[ipoly].begin());
m_bstar(i,j) = poly6(z, m_bstar_poly[ipoly].begin());
m_cstar(i,j) = poly6(z, m_cstar_poly[ipoly].begin());
m_om22(i,j) = poly6(z, DATA_PTR(m_om22_poly[ipoly]));
m_astar(i,j) = poly6(z, DATA_PTR(m_astar_poly[ipoly]));
m_bstar(i,j) = poly6(z, DATA_PTR(m_bstar_poly[ipoly]));
m_cstar(i,j) = poly6(z, DATA_PTR(m_cstar_poly[ipoly]));
}
else {
m_om22(i,j) = poly8(z, m_om22_poly[ipoly].begin());
m_astar(i,j) = poly8(z, m_astar_poly[ipoly].begin());
m_bstar(i,j) = poly8(z, m_bstar_poly[ipoly].begin());
m_cstar(i,j) = poly8(z, m_cstar_poly[ipoly].begin());
m_om22(i,j) = poly8(z, DATA_PTR(m_om22_poly[ipoly]));
m_astar(i,j) = poly8(z, DATA_PTR(m_astar_poly[ipoly]));
m_bstar(i,j) = poly8(z, DATA_PTR(m_bstar_poly[ipoly]));
m_cstar(i,j) = poly8(z, DATA_PTR(m_cstar_poly[ipoly]));
}
m_om22(j,i) = m_om22(i,j);
m_astar(j,i) = m_astar(i,j);

View file

@ -20,7 +20,7 @@
#include "MixTransport.h"
#include "SolidTransport.h"
#include "DustyGasTransport.h"
#include "FtnTransport.h"
//#include "FtnTransport.h"
#include "TransportFactory.h"
@ -482,7 +482,7 @@ namespace Cantera {
void TransportFactory::fitCollisionIntegrals(ostream& logfile,
TransportParams& tr) {
doublereal* dptr;
vector_fp::iterator dptr;
doublereal dstar;
int nsp = tr.nsp;
int mode = tr.mode;
@ -519,9 +519,9 @@ namespace Cantera {
vector_fp ca(degree+1), cb(degree+1), cc(degree+1);
vector_fp co22(degree+1);
m_integrals->fit(logfile, degree, dstar,
ca.begin(), cb.begin(), cc.begin());
DATA_PTR(ca), DATA_PTR(cb), DATA_PTR(cc));
m_integrals->fit_omega22(logfile, degree, dstar,
co22.begin());
DATA_PTR(co22));
tr.omega22_poly.push_back(co22);
tr.astar_poly.push_back(ca);
tr.bstar_poly.push_back(cb);
@ -828,21 +828,21 @@ namespace Cantera {
w2[n] = 1.0/(spcond[n]*spcond[n]);
}
}
polyfit(np, tlog.begin(), spvisc.begin(),
w.begin(), degree, ndeg, 0.0, c.begin());
polyfit(np, tlog.begin(), spcond.begin(),
w.begin(), degree, ndeg, 0.0, c2.begin());
polyfit(np, DATA_PTR(tlog), DATA_PTR(spvisc),
DATA_PTR(w), degree, ndeg, 0.0, DATA_PTR(c));
polyfit(np, DATA_PTR(tlog), DATA_PTR(spcond),
DATA_PTR(w), degree, ndeg, 0.0, DATA_PTR(c2));
// evaluate max fit errors for viscosity
for (n = 0; n < np; n++) {
if (mode == CK_Mode) {
val = exp(spvisc[n]);
fit = exp(poly3(tlog[n], c.begin()));
fit = exp(poly3(tlog[n], DATA_PTR(c)));
}
else {
sqrt_T = exp(0.5*tlog[n]);
val = sqrt_T * pow(spvisc[n],2);
fit = sqrt_T * pow(poly4(tlog[n], c.begin()),2);
fit = sqrt_T * pow(poly4(tlog[n], DATA_PTR(c)),2);
}
err = fit - val;
relerr = err/val;
@ -854,12 +854,12 @@ namespace Cantera {
for (n = 0; n < np; n++) {
if (mode == CK_Mode) {
val = exp(spcond[n]);
fit = exp(poly3(tlog[n], c2.begin()));
fit = exp(poly3(tlog[n], DATA_PTR(c2)));
}
else {
sqrt_T = exp(0.5*tlog[n]);
val = sqrt_T * spcond[n];
fit = sqrt_T * poly4(tlog[n], c2.begin());
fit = sqrt_T * poly4(tlog[n], DATA_PTR(c2));
}
err = fit - val;
relerr = err/val;
@ -871,7 +871,7 @@ namespace Cantera {
if (tr.log_level >= 2) {
tr.xml->XML_writeVector(logfile, " ", tr.thermo->speciesName(k),
c.size(), c.begin());
c.size(), DATA_PTR(c));
}
}
@ -895,7 +895,7 @@ namespace Cantera {
if (tr.log_level >= 2)
for (k = 0; k < tr.nsp; k++) {
tr.xml->XML_writeVector(logfile, " ", tr.thermo->speciesName(k),
degree+1, tr.condcoeffs[k].begin());
degree+1, DATA_PTR(tr.condcoeffs[k]));
}
sprintf(s, "Maximum conductivity absolute error: %12.6g", mxerr_cond);
tr.xml->XML_comment(logfile,s);
@ -954,20 +954,20 @@ namespace Cantera {
w[n] = 1.0/(diff[n]*diff[n]);
}
}
polyfit(np, tlog.begin(), diff.begin(),
w.begin(), degree, ndeg, 0.0, c.begin());
polyfit(np, DATA_PTR(tlog), DATA_PTR(diff),
DATA_PTR(w), degree, ndeg, 0.0, DATA_PTR(c));
doublereal pre;
for (n = 0; n < np; n++) {
if (mode == CK_Mode) {
val = exp(diff[n]);
fit = exp(poly3(tlog[n], c.begin()));
fit = exp(poly3(tlog[n], DATA_PTR(c)));
}
else {
t = exp(tlog[n]);
pre = pow(t, 1.5);
val = pre * diff[n];
fit = pre * poly4(tlog[n], c.begin());
fit = pre * poly4(tlog[n], DATA_PTR(c));
}
err = fit - val;
relerr = err/val;
@ -977,7 +977,7 @@ namespace Cantera {
tr.diffcoeffs.push_back(c);
if (tr.log_level >= 2)
tr.xml->XML_writeVector(logfile, " ", tr.thermo->speciesName(k)
+ "__"+tr.thermo->speciesName(j), c.size(), c.begin());
+ "__"+tr.thermo->speciesName(j), c.size(), DATA_PTR(c));
}
}
sprintf(s,"Maximum binary diffusion coefficient absolute error:"

View file

@ -252,7 +252,8 @@ namespace Cantera {
return sum;
}
inline void scale(int N, double alpha, double* x) {
template<class OutputIter>
inline void scale(int N, double alpha, OutputIter x) {
//#ifdef DARWINNNN
//cblas_dscal(N, alpha, x, 1);
//#else

View file

@ -108,7 +108,7 @@ namespace CanteraZeroD {
ydot[1] = m_fctr*(m_speed0 - m_mix->density()*m_speed/m_rho0);
/* species equations */
const doublereal* mw = m_mix->molecularWeights().begin();
const doublereal* mw = DATA_PTR(m_mix->molecularWeights());
if (m_chem) {
m_kin->getNetProductionRates(ydot+2); // "omega dot"

View file

@ -103,7 +103,7 @@ namespace CanteraZeroD {
#ifdef INCL_REACTOR_INTEG
m_atol.resize(neq());
fill(m_atol.begin(), m_atol.end(), 1.e-15);
m_integ->setTolerances(m_rtol, neq(), m_atol.begin());
m_integ->setTolerances(m_rtol, neq(), DATA_PTR(m_atol));
m_integ->setMaxStepSize(m_maxstep);
m_integ->initialize(t0, *this);
#endif
@ -254,7 +254,7 @@ namespace CanteraZeroD {
sum = 0.0;
surf->setTemperature(m_state[0]);
m_wall[i]->syncCoverages(m_lr[i]);
kin->getNetProductionRates(m_work.begin());
kin->getNetProductionRates(DATA_PTR(m_work));
ns = kin->surfacePhaseIndex();
surfloc = kin->kineticsSpeciesIndex(0,ns);
for (k = 1; k < nk; k++) {
@ -279,7 +279,7 @@ namespace CanteraZeroD {
* \dot M_k = \hat W_k \dot\omega_k + \dot m_{in} Y_{k,in}
* - \dot m_{out} Y_{k} + A \dot s_k.
*/
const doublereal* mw = m_mix->molecularWeights().begin();
const doublereal* mw = DATA_PTR(m_mix->molecularWeights());
if (m_chem) {
m_kin->getNetProductionRates(ydot+2); // "omega dot"
}

View file

@ -136,7 +136,7 @@ namespace CanteraZeroD {
doublereal intEnergy_mass() const { return m_intEnergy; }
doublereal pressure() const { return m_pressure; }
doublereal mass() const { return m_vol * density(); }
const doublereal* massFractions() const { return m_state.begin() + 2; }
const doublereal* massFractions() const { return DATA_PTR(m_state) + 2; }
doublereal massFraction(int k) const { return m_state[k+2]; }
//@}

View file

@ -62,7 +62,7 @@ namespace CanteraZeroD {
m_atol.resize(neq());
fill(m_atol.begin(), m_atol.end(), m_atols);
m_integ->setTolerances(m_rtol, neq(), m_atol.begin());
m_integ->setTolerances(m_rtol, neq(), DATA_PTR(m_atol));
m_integ->setSensitivityTolerances(m_rtolsens, m_atolsens);
m_integ->setMaxStepSize(m_maxstep);
if (m_verbose) {

View file

@ -42,7 +42,7 @@ namespace CanteraZeroD {
m_surf[0] = (SurfPhase*)&left->thermo(ileft);
m_nsp[0] = m_surf[0]->nSpecies();
m_leftcov.resize(m_nsp[0]);
m_surf[0]->getCoverages(m_leftcov.begin());
m_surf[0]->getCoverages(DATA_PTR(m_leftcov));
}
}
if (right) {
@ -51,7 +51,7 @@ namespace CanteraZeroD {
m_surf[1] = (SurfPhase*)&right->thermo(iright);
m_nsp[1] = m_surf[1]->nSpecies();
m_rightcov.resize(m_nsp[1]);
m_surf[1]->getCoverages(m_rightcov.begin());
m_surf[1]->getCoverages(DATA_PTR(m_rightcov));
}
}
if (ileft < 0 || iright < 0) {
@ -110,9 +110,9 @@ namespace CanteraZeroD {
void Wall::syncCoverages(int leftright) {
if (leftright == 0)
m_surf[0]->setCoverages(m_leftcov.begin());
m_surf[0]->setCoverages(DATA_PTR(m_leftcov));
else
m_surf[1]->setCoverages(m_rightcov.begin());
m_surf[1]->setCoverages(DATA_PTR(m_rightcov));
}
void Wall::addSensitivityReaction(int leftright, int rxn) {

View file

@ -28,9 +28,9 @@ int main() {
vector_fp cov;
cov.push_back(0.8);
cov.push_back(0.2);
surf.setCoverages(cov.begin());
surf.setCoverages(DATA_PTR(cov));
vector_fp wdot(gas.nSpecies() + surf.nSpecies());
surf.getNetProductionRates(wdot.begin());
surf.getNetProductionRates(DATA_PTR(wdot));
int k;
for (k = 0; k < gas.nSpecies(); k++)
cout << gas.speciesName(k) << " " << wdot[k] << endl;