Skip to content

Commit

Permalink
[Samples] Fix compilation errors and warnings in the C++ examples
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Jul 16, 2015
1 parent e21a7ce commit 571eaed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
12 changes: 7 additions & 5 deletions samples/cxx/bvp/BoundaryValueProblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define BVP_H

#include "cantera/onedim.h"
#include <fstream>

/// Namespace for the boundary value problem package.
namespace BVP
Expand Down Expand Up @@ -113,18 +114,19 @@ class BoundaryValueProblem : public Cantera::Domain1D
* @param n Component number.
* @param c Component parameter values
*/
void setComponent(int n, Component& c) {
void setComponent(size_t n, Component& c) {
if (m_sim == 0) {
start();
}
if (n < 0 || n >= m_nv) {
if (n >= m_nv) {
throw Cantera::CanteraError("BoundaryValueProblem::setComponent",
"Illegal solution component number");
}
// set the upper and lower bounds for this component
setBounds(n, c.lower, c.upper);
// set the error tolerances
setTolerances(n, c.rtol, c.atol);
setSteadyTolerances(c.rtol, c.atol, n);
setTransientTolerances(c.rtol, c.atol, n);
// specify whether this component should be considered in
// refining the grid
m_refiner->setActive(n, c.refine);
Expand Down Expand Up @@ -209,15 +211,15 @@ class BoundaryValueProblem : public Cantera::Domain1D
* True if n is the index of the left-most grid point (zero),
* false otherwise.
*/
bool isLeft(int n) const {
bool isLeft(size_t n) const {
return (n == 0);
}

/**
* True if \a n is the index of the right-most grid point, false
* otherwise.
*/
bool isRight(int n) const {
bool isRight(size_t n) const {
return (n == nPoints() - 1);
}

Expand Down
2 changes: 0 additions & 2 deletions samples/cxx/combustor/combustor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ void runexample()

// use reaction mechanism GRI-Mech 3.0
IdealGasMix gas("gri30.cti", "gri30");
int nsp = gas.nSpecies();

// create a reservoir for the fuel inlet, and set to pure methane.
Reservoir fuel_in;
Expand Down Expand Up @@ -105,7 +104,6 @@ void runexample()
double tfinal = 1.0;
double tnow = 0.0;
double tres;
int k;

std::ofstream f("combustor_cxx.csv");
std::vector<size_t> k_out;
Expand Down
1 change: 1 addition & 0 deletions samples/cxx/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "cantera/IdealGasMix.h" // defines class IdealGasMix
#include "cantera/transport.h" // transport properties
#include <cstdio>

// All Cantera kernel names are in namespace Cantera. You can either
// reference everything as Cantera::<name>, or include the following
Expand Down
2 changes: 1 addition & 1 deletion samples/cxx/kinetics1/kinetics1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int kinetics1(int np, void* p)
// create a container object to run the simulation
// and add the reactor to it
ReactorNet sim;
sim.addReactor(&r);
sim.addReactor(r);

// main loop
clock_t t0 = clock(); // save start time
Expand Down

0 comments on commit 571eaed

Please sign in to comment.