Eliminated some redundant code in cxx_ex transport tests

This commit is contained in:
Ray Speth 2012-10-24 15:44:42 +00:00
parent fcb46460cc
commit 94f85db5c5
3 changed files with 22 additions and 46 deletions

View file

@ -55,4 +55,26 @@ void plotSoln(const std::string& fname, const std::string& fmt,
writePlotFile(fname, fmt, title, names, soln);
}
template<class G, class V>
void makeTransportDataLabels(const G& gas, V& names)
{
size_t nsp = gas.nSpecies();
names.resize(nsp + 3);
names[0] = "Temperature (K)";
names[1] = "Viscosity ()";
names[2] = "Thermal Conductivity (W/m-K)";
for (size_t k = 0; k < nsp; k++) {
names[3+k] = gas.speciesName(k);
}
}
template<class G, class A>
void plotTransportSoln(const std::string& fname, const std::string& fmt,
const std::string& title, const G& gas, const A& soln)
{
std::vector<std::string> names;
makeTransportDataLabels(gas, names);
writePlotFile(fname, fmt, title, names, soln);
}
#endif

View file

@ -14,29 +14,6 @@ using namespace Cantera;
using std::cout;
using std::endl;
template<class G, class V>
void makeTransportDataLabels(const G& gas, V& names)
{
size_t nsp = gas.nSpecies();
names.resize(nsp + 3);
names[0] = "Temperature (K)";
names[1] = "Viscosity ()";
names[2] = "Thermal Conductivity (W/m-K)";
for (size_t k = 0; k < nsp; k++) {
names[3+k] = gas.speciesName(k);
}
}
template<class G, class A>
void plotTransportSoln(const std::string& fname, const std::string& fmt,
const std::string& title, const G& gas, const A& soln)
{
std::vector<std::string> names;
makeTransportDataLabels(gas, names);
writePlotFile(fname, fmt, title, names, soln);
}
int transport_example1(int job)
{
try {

View file

@ -15,29 +15,6 @@ using namespace Cantera;
using std::cout;
using std::endl;
template<class G, class V>
void makeTransportDataLabels(const G& gas, V& names)
{
size_t nsp = gas.nSpecies();
names.resize(nsp + 3);
names[0] = "Temperature (K)";
names[1] = "Viscosity ()";
names[2] = "Thermal Conductivity (W/m-K)";
for (size_t k = 0; k < nsp; k++) {
names[3+k] = gas.speciesName(k);
}
}
template<class G, class A>
void plotTransportSoln(const std::string& fname, const std::string& fmt,
const std::string& title, const G& gas, const A& soln)
{
std::vector<std::string> names;
makeTransportDataLabels(gas, names);
writePlotFile(fname, fmt, title, names, soln);
}
int transport_example2(int job)
{
try {