solaris port:

std:: applied to copy()
This commit is contained in:
Harry Moffat 2006-12-14 18:03:37 +00:00
parent 7c3d9c8320
commit 46d984cf63
2 changed files with 51 additions and 53 deletions

View file

@ -45,16 +45,16 @@ namespace Cantera {
* @param nv Number of variables at each grid point. * @param nv Number of variables at each grid point.
* @param points Number of grid points. * @param points Number of grid points.
*/ */
Domain1D(int nv=1, int points=1, Domain1D(int nv=1, int points=1,
doublereal time = 0.0) : doublereal time = 0.0) :
m_rdt(0.0), m_rdt(0.0),
m_time(time), m_time(time),
m_container(0), m_container(0),
m_index(-1), m_index(-1),
m_type(0), m_type(0),
m_iloc(0), m_iloc(0),
m_jstart(0), m_jstart(0),
m_left(0), m_left(0),
m_right(0), m_right(0),
m_id("-"), m_desc("-"), m_id("-"), m_desc("-"),
m_refiner(0) { m_refiner(0) {
@ -91,7 +91,7 @@ namespace Cantera {
m_index = index; m_index = index;
} }
/** /**
* Initialize. This method is called by OneDim::init() for * Initialize. This method is called by OneDim::init() for
* each domain once at the beginning of a simulation. Base * each domain once at the beginning of a simulation. Base
* class method does nothing, but may be overloaded. * class method does nothing, but may be overloaded.
@ -139,9 +139,9 @@ namespace Cantera {
int nPoints() const { return m_points; } int nPoints() const { return m_points; }
/// Name of the nth component. May be overloaded. /// Name of the nth component. May be overloaded.
virtual std::string componentName(int n) const { virtual std::string componentName(int n) const {
if (m_name[n] != "") return m_name[n]; if (m_name[n] != "") return m_name[n];
else return "component " + int2str(n); else return "component " + int2str(n);
} }
void setComponentName(int n, std::string name) { void setComponentName(int n, std::string name) {
@ -165,14 +165,14 @@ namespace Cantera {
/** /**
* Set the lower and upper bounds for each solution component. * Set the lower and upper bounds for each solution component.
*/ */
void setBounds(int nl, const doublereal* lower, void setBounds(int nl, const doublereal* lower,
int nu, const doublereal* upper) { int nu, const doublereal* upper) {
if (nl < m_nv || nu < m_nv) if (nl < m_nv || nu < m_nv)
throw CanteraError("Domain1D::setBounds", throw CanteraError("Domain1D::setBounds",
"wrong array size for solution bounds. " "wrong array size for solution bounds. "
"Size should be at least "+int2str(m_nv)); "Size should be at least "+int2str(m_nv));
copy(upper, upper + m_nv, m_max.begin()); std::copy(upper, upper + m_nv, m_max.begin());
copy(lower, lower + m_nv, m_min.begin()); std::copy(lower, lower + m_nv, m_min.begin());
} }
void setBounds(int n, doublereal lower, doublereal upper) { void setBounds(int n, doublereal lower, doublereal upper) {
@ -180,8 +180,8 @@ namespace Cantera {
m_max[n] = upper; m_max[n] = upper;
} }
/// set the error tolerances for all solution components. /// set the error tolerances for all solution components.
void setTolerances(int nr, const doublereal* rtol, void setTolerances(int nr, const doublereal* rtol,
int na, const doublereal* atol, int ts = 0); int na, const doublereal* atol, int ts = 0);
/// set the error tolerances for solution component \a n. /// set the error tolerances for solution component \a n.
@ -197,7 +197,7 @@ namespace Cantera {
//added by Karl Meredith //added by Karl Meredith
void setTolerancesSS(doublereal rtol, doublereal atol); void setTolerancesSS(doublereal rtol, doublereal atol);
/// Relative tolerance of the nth component. /// Relative tolerance of the nth component.
doublereal rtol(int n) { return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]); } doublereal rtol(int n) { return (m_rdt == 0.0 ? m_rtol_ss[n] : m_rtol_ts[n]); }
@ -217,10 +217,10 @@ namespace Cantera {
* x0. * x0.
*/ */
void initTimeInteg(doublereal dt, const doublereal* x0) { void initTimeInteg(doublereal dt, const doublereal* x0) {
copy(x0 + loc(), x0 + loc() + size(), m_slast.begin()); std::copy(x0 + loc(), x0 + loc() + size(), m_slast.begin());
m_rdt = 1.0/dt; m_rdt = 1.0/dt;
} }
/** /**
* Prepare to solve the steady-state problem. * Prepare to solve the steady-state problem.
* Set the internally-stored reciprocal of the time step to 0,0 * Set the internally-stored reciprocal of the time step to 0,0
@ -242,7 +242,7 @@ namespace Cantera {
void needJacUpdate(); void needJacUpdate();
/** /**
* Evaluate the steady-state residual at all points, even if in * Evaluate the steady-state residual at all points, even if in
* transient mode. Used only to print diagnostic output. * transient mode. Used only to print diagnostic output.
*/ */
void evalss(doublereal* x, doublereal* r, integer* mask) { void evalss(doublereal* x, doublereal* r, integer* mask) {
@ -252,8 +252,8 @@ namespace Cantera {
/** /**
* Evaluate the residual function at point j. If j < 0, * Evaluate the residual function at point j. If j < 0,
* evaluate the residual function at all points. * evaluate the residual function at all points.
*/ */
virtual void eval(int j, doublereal* x, doublereal* r, virtual void eval(int j, doublereal* x, doublereal* r,
integer* mask, doublereal rdt=0.0); integer* mask, doublereal rdt=0.0);
virtual doublereal residual(doublereal* x, int n, int j) { virtual doublereal residual(doublereal* x, int n, int j) {
@ -301,7 +301,7 @@ namespace Cantera {
m_jstart = 0; m_jstart = 0;
m_iloc = 0; m_iloc = 0;
} }
// if there is a domain to the right of this one, then // if there is a domain to the right of this one, then
// repeat this for it // repeat this for it
if (m_right) m_right->locate(); if (m_right) m_right->locate();
} }
@ -329,13 +329,13 @@ namespace Cantera {
* called to update the global positions of this domain and * called to update the global positions of this domain and
* all those to its right. * all those to its right.
*/ */
void linkLeft(Domain1D* left) { void linkLeft(Domain1D* left) {
m_left = left; m_left = left;
locate(); locate();
} }
/** /**
* Set the right neighbor to domain 'right.' * Set the right neighbor to domain 'right.'
*/ */
void linkRight(Domain1D* right) { m_right = right; } void linkRight(Domain1D* right) { m_right = right; }
@ -363,13 +363,13 @@ namespace Cantera {
double prevSoln(int n, int j) const { double prevSoln(int n, int j) const {
return m_slast[m_nv*j + n]; return m_slast[m_nv*j + n];
} }
/** /**
* Specify an identifying tag for this domain. * Specify an identifying tag for this domain.
*/ */
void setID(const std::string& s) {m_id = s;} void setID(const std::string& s) {m_id = s;}
std::string id() { std::string id() {
if (m_id != "") return m_id; if (m_id != "") return m_id;
else return std::string("domain ") + int2str(m_index); else return std::string("domain ") + int2str(m_index);
} }
@ -440,13 +440,13 @@ namespace Cantera {
* this domain that will be used as the initial guess. If no * this domain that will be used as the initial guess. If no
* such parameters need to be set, then method _finalize does * such parameters need to be set, then method _finalize does
* not need to be overloaded. * not need to be overloaded.
*/ */
virtual void _finalize(const doublereal* x) {} virtual void _finalize(const doublereal* x) {}
//added by Karl Meredith //added by Karl Meredith
doublereal m_zfixed; doublereal m_zfixed;
doublereal m_tfixed; doublereal m_tfixed;
bool m_adiabatic; bool m_adiabatic;
protected: protected:
@ -478,5 +478,3 @@ namespace Cantera {
} }
#endif #endif

View file

@ -35,7 +35,7 @@ namespace Cantera {
* as surface species coverages. * as surface species coverages.
* *
* The boundary types are an inlet, an outlet, a symmetry plane, * The boundary types are an inlet, an outlet, a symmetry plane,
* and a surface. * and a surface.
* *
* The public methods are all virtual, and the base class * The public methods are all virtual, and the base class
* implementations throw exceptions. * implementations throw exceptions.
@ -44,7 +44,7 @@ namespace Cantera {
public: public:
Bdry1D(); Bdry1D();
virtual ~Bdry1D() {} virtual ~Bdry1D() {}
/// Initialize. /// Initialize.
@ -93,7 +93,7 @@ namespace Cantera {
private: private:
void err(std::string method) { void err(std::string method) {
throw CanteraError("Bdry1D::"+method, throw CanteraError("Bdry1D::"+method,
"attempt to call base class method "+method); "attempt to call base class method "+method);
} }
}; };
@ -160,10 +160,10 @@ namespace Cantera {
virtual doublereal massFraction(int k) {return m_yin[k];} virtual doublereal massFraction(int k) {return m_yin[k];}
virtual std::string componentName(int n) const; virtual std::string componentName(int n) const;
virtual void init(); virtual void init();
virtual void eval(int jg, doublereal* xg, doublereal* rg, virtual void eval(int jg, doublereal* xg, doublereal* rg,
integer* diagg, doublereal rdt); integer* diagg, doublereal rdt);
virtual void save(XML_Node& o, doublereal* soln); virtual void save(XML_Node& o, doublereal* soln);
virtual void restore(const XML_Node& dom, doublereal* soln); virtual void restore(const XML_Node& dom, doublereal* soln);
protected: protected:
@ -184,7 +184,7 @@ namespace Cantera {
public: public:
Empty1D() : Domain1D() { Empty1D() : Domain1D() {
m_type = cEmptyType; m_type = cEmptyType;
} }
virtual ~Empty1D(){} virtual ~Empty1D(){}
@ -193,11 +193,11 @@ namespace Cantera {
virtual void init(); virtual void init();
virtual void eval(int jg, doublereal* xg, doublereal* rg, virtual void eval(int jg, doublereal* xg, doublereal* rg,
integer* diagg, doublereal rdt); integer* diagg, doublereal rdt);
virtual void save(XML_Node& o, doublereal* soln); virtual void save(XML_Node& o, doublereal* soln);
virtual void restore(const XML_Node& dom, doublereal* soln); virtual void restore(const XML_Node& dom, doublereal* soln);
virtual void _finalize(const doublereal* x) {} virtual void _finalize(const doublereal* x) {}
virtual void _getInitialSoln(doublereal* x) { virtual void _getInitialSoln(doublereal* x) {
x[0] = 0.0; x[0] = 0.0;
@ -216,7 +216,7 @@ namespace Cantera {
public: public:
Symm1D() : Bdry1D() { Symm1D() : Bdry1D() {
m_type = cSymmType; m_type = cSymmType;
} }
virtual ~Symm1D(){} virtual ~Symm1D(){}
@ -224,11 +224,11 @@ namespace Cantera {
virtual void init(); virtual void init();
virtual void eval(int jg, doublereal* xg, doublereal* rg, virtual void eval(int jg, doublereal* xg, doublereal* rg,
integer* diagg, doublereal rdt); integer* diagg, doublereal rdt);
virtual void save(XML_Node& o, doublereal* soln); virtual void save(XML_Node& o, doublereal* soln);
virtual void restore(const XML_Node& dom, doublereal* soln); virtual void restore(const XML_Node& dom, doublereal* soln);
virtual void _finalize(const doublereal* x) { virtual void _finalize(const doublereal* x) {
; //m_temp = x[0]; ; //m_temp = x[0];
} }
@ -248,7 +248,7 @@ namespace Cantera {
public: public:
Outlet1D() : Bdry1D() { Outlet1D() : Bdry1D() {
m_type = cOutletType; m_type = cOutletType;
} }
virtual ~Outlet1D(){} virtual ~Outlet1D(){}
@ -256,11 +256,11 @@ namespace Cantera {
virtual void init(); virtual void init();
virtual void eval(int jg, doublereal* xg, doublereal* rg, virtual void eval(int jg, doublereal* xg, doublereal* rg,
integer* diagg, doublereal rdt); integer* diagg, doublereal rdt);
virtual void save(XML_Node& o, doublereal* soln); virtual void save(XML_Node& o, doublereal* soln);
virtual void restore(const XML_Node& dom, doublereal* soln); virtual void restore(const XML_Node& dom, doublereal* soln);
virtual void _finalize(const doublereal* x) { virtual void _finalize(const doublereal* x) {
; //m_temp = x[0]; ; //m_temp = x[0];
} }
@ -281,7 +281,7 @@ namespace Cantera {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
OutletRes1D() : Bdry1D(), m_nsp(0), m_flow(0) { OutletRes1D() : Bdry1D(), m_nsp(0), m_flow(0) {
m_type = cOutletResType; m_type = cOutletResType;
@ -304,10 +304,10 @@ namespace Cantera {
virtual doublereal massFraction(int k) {return m_yres[k];} virtual doublereal massFraction(int k) {return m_yres[k];}
virtual std::string componentName(int n) const; virtual std::string componentName(int n) const;
virtual void init(); virtual void init();
virtual void eval(int jg, doublereal* xg, doublereal* rg, virtual void eval(int jg, doublereal* xg, doublereal* rg,
integer* diagg, doublereal rdt); integer* diagg, doublereal rdt);
virtual void save(XML_Node& o, doublereal* soln); virtual void save(XML_Node& o, doublereal* soln);
virtual void restore(const XML_Node& dom, doublereal* soln); virtual void restore(const XML_Node& dom, doublereal* soln);
protected: protected:
@ -329,7 +329,7 @@ namespace Cantera {
public: public:
Surf1D() : Bdry1D() { Surf1D() : Bdry1D() {
m_type = cSurfType; m_type = cSurfType;
} }
virtual ~Surf1D(){} virtual ~Surf1D(){}
@ -337,11 +337,11 @@ namespace Cantera {
virtual void init(); virtual void init();
virtual void eval(int jg, doublereal* xg, doublereal* rg, virtual void eval(int jg, doublereal* xg, doublereal* rg,
integer* diagg, doublereal rdt); integer* diagg, doublereal rdt);
virtual void save(XML_Node& o, doublereal* soln); virtual void save(XML_Node& o, doublereal* soln);
virtual void restore(const XML_Node& dom, doublereal* soln); virtual void restore(const XML_Node& dom, doublereal* soln);
virtual void _getInitialSoln(doublereal* x) { virtual void _getInitialSoln(doublereal* x) {
x[0] = m_temp; x[0] = m_temp;
@ -376,7 +376,7 @@ namespace Cantera {
public: public:
ReactingSurf1D() : Bdry1D(), ReactingSurf1D() : Bdry1D(),
m_kin(0), m_surfindex(0), m_nsp(0) { m_kin(0), m_surfindex(0), m_nsp(0) {
m_type = cSurfType; m_type = cSurfType;
} }
@ -390,18 +390,18 @@ namespace Cantera {
} }
void enableCoverageEquations(bool docov) { m_enabled = docov; } void enableCoverageEquations(bool docov) { m_enabled = docov; }
virtual ~ReactingSurf1D(){} virtual ~ReactingSurf1D(){}
virtual std::string componentName(int n) const; virtual std::string componentName(int n) const;
virtual void init(); virtual void init();
virtual void eval(int jg, doublereal* xg, doublereal* rg, virtual void eval(int jg, doublereal* xg, doublereal* rg,
integer* diagg, doublereal rdt); integer* diagg, doublereal rdt);
virtual void save(XML_Node& o, doublereal* soln); virtual void save(XML_Node& o, doublereal* soln);
virtual void restore(const XML_Node& dom, doublereal* soln); virtual void restore(const XML_Node& dom, doublereal* soln);
virtual void _getInitialSoln(doublereal* x) { virtual void _getInitialSoln(doublereal* x) {
x[0] = m_temp; x[0] = m_temp;
@ -410,7 +410,7 @@ namespace Cantera {
} }
virtual void _finalize(const doublereal* x) { virtual void _finalize(const doublereal* x) {
copy(x+1,x+1+m_nsp,m_fixed_cov.begin()); std::copy(x+1,x+1+m_nsp,m_fixed_cov.begin());
} }
virtual void showSolution(const doublereal* x) { virtual void showSolution(const doublereal* x) {