Fixed MSVC warning LNK4221 by removing a few "empty" source files

This commit is contained in:
Ray Speth 2012-01-17 04:12:23 +00:00
parent e5d4b58e2a
commit e8d895ac26
7 changed files with 133 additions and 451 deletions

View file

@ -1,7 +0,0 @@
#include "kernel/ThermoPhase.h"
#include <stdio.h>
using namespace std;
namespace Cantera {
}

View file

@ -1,150 +0,0 @@
/*
* Copywrite (2005) Sandia Corporation. Under the terms of
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
* U.S. Government retains certain rights in this software.
*/
#ifdef hpux
#define dbocls_ dbocls
#endif
#ifdef DEBUG_MODE
//extern int vcs_debug_print_lvl;
#endif
#include "vcs_internal.h"
#include "vcs_solve.h"
#include <cstdio>
#include <cstdlib>
#include <cmath>
extern "C" void dbocls_(double *W, int *MDW, int *MCON, int *MROWS,
int *NCOLS,
double *BL, double *BU, int *IND, int *IOPT,
double *X, double *RNORMC, double *RNORM,
int *MODE, double *RW, int *IW);
/*****************************************************************************
* This whole program is a wrapper for the slatec routine, DBOCLS()
* DBOCLS solves a bounded and constrained least squares problem.
******************************************************************************/
namespace VCSnonideal {
#ifdef ALTLINPROG
#else
int linprogmax(double *XMOLES, double *CC, double *AX, double *BB,
size_t NE, size_t M, size_t NE0)
/*-----------------------------------------------------------------------
* Find XMOLES(I), i = 1, M such that
* Maximize CC dot W, subject to the NE constraints:
*
* [AX] [XMOLES] = [BB]
* and XMOLES(i) > 0
*
* Input
* ---------
* AX(NE, M) - matrix of constraints AX(I,J) = ax(i + j*ne0)
* BB(NE) - contraint values
* CC(M) - Vector of "Good Values" to maximize
*
* Output
* ---------
* XMOLES(M) - optimal value of XMOLES()
*----------------------------------------------------------------------*/
{
int MROWS, MCON, NCOLS, NX, NI, MDW, i, j, MODE;
double sum, F[1], RNORMC, RNORM, *W, *BL, *BU, *RW, *X;
int *IND, *IW, *IOPT;
MROWS = 1;
MCON = (int) NE;
NCOLS = (int) M;
MDW = MCON + NCOLS;
NX = 0;
NI = 0;
sum = 0.0;
for (i = 0; i < NCOLS; i++) {
sum += fabs(CC[i]);
}
F[0] = sum * 1000.;
if (F[0] <= 0.0) F[0] = 1000.;
BL = (double *) malloc(2*(NCOLS+MCON) * sizeof(double));
BU = BL + (NCOLS+MCON);
IND = (int *) malloc((NCOLS+MCON) * sizeof(int));
RW = (double *) malloc((6*NCOLS + 5*MCON) * sizeof(double));
IW = (int *) malloc((2*NCOLS + 2*MCON) * sizeof(int));
IOPT = (int *) malloc((17 + NI) * sizeof(int));
X = (double *) malloc((2*(NCOLS+MCON) + 2 + NX) * sizeof(double));
W = (double *) malloc((MDW*(NCOLS+MCON+1)) * sizeof(double));
if (W == NULL) {
plogf("linproxmax ERROR: can not malloc memory of size %d bytes\n",
(int) ((MDW*(NCOLS+MCON+1)) * sizeof(double)));
if (BL != NULL) free((void *) BL);
if (IND != NULL) free((void *) IND);
if (RW != NULL) free((void *) RW);
if (IW != NULL) free((void *) IW);
if (IOPT != NULL) free((void *) IOPT);
if (W != NULL) free((void *) W);
return -1;
}
for (j = 0; j < MCON; j++) {
for (i = 0; i < NCOLS; i++) {
W[j + i*MDW] = AX[j + i*NE0];
}
}
for (i = 0; i < NCOLS; i++) {
W[MCON + i*MDW] = CC[i];
}
W[MCON + (NCOLS)*MDW] = F[0];
IOPT[0] = 99;
for (j = 0; j < NCOLS; j++) {
IND[j] = 1;
BL[j] = 0.0;
BU[j] = 1.0e200;
}
for (j = 0; j < MCON; j++) {
IND[j + NCOLS] = 3;
BL[j + NCOLS] = BB[j];
BU[j + NCOLS] = BL[j + NCOLS];
}
dbocls_(W, &MDW, &MCON, &MROWS, &NCOLS, BL, BU, IND, IOPT,
X, &RNORMC, &RNORM, &MODE, RW, IW);
if (MODE != 0) {
plogf("Return from DBOCLS was not normal, MODE = %d\n", MODE);
plogf(" refer to subroutine DBOCLS for resolution\n");
plogf(" RNORMC = %g\n", RNORMC);
}
for (j = 0; j < NCOLS; j++) {
XMOLES[j] = X[j];
}
#ifdef DEBUG_MODE
//sum = 0.0;
//for (j = 0; j < NCOLS; j++) {
// sum += XMOLES[j] * CC[j];
//}
//if (vcs_debug_print_lvl >= 2) {
// plogf(" -- linmaxc: Final Maximized Value = %g\n", sum);
//}
#endif
free((void *)W);
free((void *)BL);
free((void *)IND);
free((void *)RW);
free((void *)IW);
free((void *)IOPT);
free((void *)X);
return 0;
}
#endif
}

View file

@ -8,7 +8,6 @@
* U.S. Government retains certain rights in this software.
*/
#include "vcs_internal.h"
#include "vcs_VolPhase.h"
#include "vcs_species_thermo.h"
@ -17,8 +16,21 @@
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#ifdef hpux
#define dbocls_ dbocls
#endif
#ifdef DEBUG_MODE
//extern int vcs_debug_print_lvl;
#endif
extern "C" void dbocls_(double *W, int *MDW, int *MCON, int *MROWS,
int *NCOLS,
double *BL, double *BU, int *IND, int *IOPT,
double *X, double *RNORMC, double *RNORM,
int *MODE, double *RW, int *IW);
using namespace std;
namespace VCSnonideal {
@ -54,7 +66,7 @@ static void printProgress(const vector<string> &spName,
* non-negativity constraints.
*/
int VCS_SOLVE::vcs_setMolesLinProg() {
int ik, irxn;
size_t ik, irxn;
double test = -1.0E-10;
#ifdef DEBUG_MODE
@ -79,7 +91,7 @@ int VCS_SOLVE::vcs_setMolesLinProg() {
int retn;
int iter = 0;
bool abundancesOK = true;
int usedZeroedSpecies;
size_t usedZeroedSpecies;
std::vector<double> sm(m_numElemConstraints*m_numElemConstraints, 0.0);
std::vector<double> ss(m_numElemConstraints, 0.0);
@ -224,5 +236,120 @@ int VCS_SOLVE::vcs_setMolesLinProg() {
}
return retn;
}
#else // ALTLINPROG
int linprogmax(double *XMOLES, double *CC, double *AX, double *BB,
size_t NE, size_t M, size_t NE0)
/*-----------------------------------------------------------------------
* Find XMOLES(I), i = 1, M such that
* Maximize CC dot W, subject to the NE constraints:
*
* [AX] [XMOLES] = [BB]
* and XMOLES(i) > 0
*
* Input
* ---------
* AX(NE, M) - matrix of constraints AX(I,J) = ax(i + j*ne0)
* BB(NE) - contraint values
* CC(M) - Vector of "Good Values" to maximize
*
* Output
* ---------
* XMOLES(M) - optimal value of XMOLES()
*----------------------------------------------------------------------*/
{
int MROWS, MCON, NCOLS, NX, NI, MDW, i, j, MODE;
double sum, F[1], RNORMC, RNORM, *W, *BL, *BU, *RW, *X;
int *IND, *IW, *IOPT;
MROWS = 1;
MCON = (int) NE;
NCOLS = (int) M;
MDW = MCON + NCOLS;
NX = 0;
NI = 0;
sum = 0.0;
for (i = 0; i < NCOLS; i++) {
sum += fabs(CC[i]);
}
F[0] = sum * 1000.;
if (F[0] <= 0.0) F[0] = 1000.;
BL = (double *) malloc(2*(NCOLS+MCON) * sizeof(double));
BU = BL + (NCOLS+MCON);
IND = (int *) malloc((NCOLS+MCON) * sizeof(int));
RW = (double *) malloc((6*NCOLS + 5*MCON) * sizeof(double));
IW = (int *) malloc((2*NCOLS + 2*MCON) * sizeof(int));
IOPT = (int *) malloc((17 + NI) * sizeof(int));
X = (double *) malloc((2*(NCOLS+MCON) + 2 + NX) * sizeof(double));
W = (double *) malloc((MDW*(NCOLS+MCON+1)) * sizeof(double));
if (W == NULL) {
plogf("linproxmax ERROR: can not malloc memory of size %d bytes\n",
(int) ((MDW*(NCOLS+MCON+1)) * sizeof(double)));
if (BL != NULL) free((void *) BL);
if (IND != NULL) free((void *) IND);
if (RW != NULL) free((void *) RW);
if (IW != NULL) free((void *) IW);
if (IOPT != NULL) free((void *) IOPT);
if (W != NULL) free((void *) W);
return -1;
}
for (j = 0; j < MCON; j++) {
for (i = 0; i < NCOLS; i++) {
W[j + i*MDW] = AX[j + i*NE0];
}
}
for (i = 0; i < NCOLS; i++) {
W[MCON + i*MDW] = CC[i];
}
W[MCON + (NCOLS)*MDW] = F[0];
IOPT[0] = 99;
for (j = 0; j < NCOLS; j++) {
IND[j] = 1;
BL[j] = 0.0;
BU[j] = 1.0e200;
}
for (j = 0; j < MCON; j++) {
IND[j + NCOLS] = 3;
BL[j + NCOLS] = BB[j];
BU[j + NCOLS] = BL[j + NCOLS];
}
dbocls_(W, &MDW, &MCON, &MROWS, &NCOLS, BL, BU, IND, IOPT,
X, &RNORMC, &RNORM, &MODE, RW, IW);
if (MODE != 0) {
plogf("Return from DBOCLS was not normal, MODE = %d\n", MODE);
plogf(" refer to subroutine DBOCLS for resolution\n");
plogf(" RNORMC = %g\n", RNORMC);
}
for (j = 0; j < NCOLS; j++) {
XMOLES[j] = X[j];
}
#ifdef DEBUG_MODE
//sum = 0.0;
//for (j = 0; j < NCOLS; j++) {
// sum += XMOLES[j] * CC[j];
//}
//if (vcs_debug_print_lvl >= 2) {
// plogf(" -- linmaxc: Final Maximized Value = %g\n", sum);
//}
#endif
free((void *)W);
free((void *)BL);
free((void *)IND);
free((void *)RW);
free((void *)IW);
free((void *)IOPT);
free((void *)X);
return 0;
}
#endif // ALTLINPROG
}

View file

@ -30,6 +30,8 @@
#include "vcs_DoubleStarStar.h"
#include "vcs_IntStarStar.h"
#define ALTLINPROG
namespace VCSnonideal {
/*
* Forward references

View file

@ -1,221 +0,0 @@
/**
* @file DAE_Solver.h
*
* Header file for class DAE_Solver
*/
/*
* Copyright 2006 California Institute of Technology
*/
#undef DAE_DEVEL
#ifndef CT_DAE_Solver_H
#define CT_DAE_Solver_H
#include <vector>
#include "ct_defs.h"
#include "ResidEval.h"
#include "global.h"
namespace Cantera {
#ifdef DAE_DEVEL
/**
* @defgroup numerics Numerical Utilities within Cantera
*
*
*/
class Jacobian {
public:
Jacobian(){}
virtual ~Jacobian(){}
virtual bool supplied() { return false; }
virtual bool isBanded() { return false; }
virtual int lowerBandWidth() { return 0; }
virtual int upperBandWidth() { return 0; }
};
class BandedJacobian : public Jacobian {
public:
BandedJacobian(int ml, int mu) {
m_ml = ml; m_mu = mu;
}
virtual bool supplied() { return false; }
virtual bool isBanded() { return true; }
virtual int lowerBandWidth() { return m_ml; }
virtual int upperBandWidth() { return m_mu; }
protected:
int m_ml, m_mu;
};
const int cDirect = 0;
const int cKrylov = 1;
/**
* Wrapper for DAE solvers
*/
class DAE_Solver {
public:
DAE_Solver(ResidEval& f) : m_resid(f),
m_neq(f.nEquations()),
m_time(0.0) {}
virtual ~DAE_Solver(){}
/**
* Set error tolerances. This version specifies a scalar
* relative tolerance, and a vector absolute tolerance.
*/
virtual void setTolerances(doublereal reltol,
doublereal* abstol) {
warn("setTolerances");
}
/**
* Set error tolerances. This version specifies a scalar
* relative tolerance, and a scalar absolute tolerance.
*/
virtual void setTolerances(doublereal reltol, doublereal abstol) {
warn("setTolerances");
}
/**
* Specify a Jacobian evaluator. If this method is not called,
* the Jacobian will be computed by finite difference.
*/
void setJacobian(Jacobian& jac) {
warn("setJacobian");
}
virtual void setLinearSolverType(int solverType) {
warn("setLinearSolverType");
}
virtual void setDenseLinearSolver() {
warn("setDenseLinearSolver");
}
virtual void setBandedLinearSolver(int m_upper, int m_lower) {
warn("setBandedLinearSolver");
}
virtual void setMaxTime(doublereal tmax) {
warn("setMaxTime");
}
virtual void setMaxStepSize(doublereal dtmax) {
warn("setMaxStepSize");
}
virtual void setMaxOrder(int n) {
warn("setMaxOrder");
}
virtual void setMaxNumSteps(int n) {
warn("setMaxNumSteps");
}
virtual void setInitialStepSize(doublereal h0) {
warn("setInitialStepSize");
}
virtual void setStopTime(doublereal tstop) {
warn("setStopTime");
}
virtual void setMaxErrTestFailures(int n) {
warn("setMaxErrTestFailures");
}
virtual void setMaxNonlinIterations(int n) {
warn("setMaxNonlinIterations");
}
virtual void setMaxNonlinConvFailures(int n) {
warn("setMaxNonlinConvFailures");
}
virtual void inclAlgebraicInErrorTest(bool yesno) {
warn("inclAlgebraicInErrorTest");
}
virtual void correctInitial_Y_given_Yp() {
warn("correctInitial_Y_given_Yp");
}
virtual void correctInitial_YaYp_given_Yd() {
warn("correctInitial_YaYp_given_Yd");
}
/**
* Solve the system of equations up to time tout.
*/
virtual int solve(doublereal tout) {
warn("solve"); return 0;
}
/**
* Take one internal step.
*/
virtual doublereal step(doublereal tout) {
warn("step"); return 0;
}
/// Number of equations.
int nEquations() const { return m_resid.nEquations(); }
/**
* initialize. Base class method does nothing.
*/
virtual void init(doublereal t0) {}
/**
* Set a solver-specific input parameter.
*/
virtual void setInputParameter(int flag, doublereal value) {
warn("setInputParameter");
}
/**
* Get the value of a solver-specific output parameter.
*/
virtual doublereal getOutputParameter(int flag) const {
warn("getOutputParameter"); return 0.0;
}
/// the current value of solution component k.
virtual doublereal solution(int k) const {
warn("solution"); return 0.0;
}
virtual const doublereal* solutionVector() const {
warn("solutionVector"); return &m_dummy;
}
/// the current value of the derivative of solution component k.
virtual doublereal derivative(int k) const {
warn("derivative"); return 0.0;
}
virtual const doublereal* derivativeVector() const {
warn("derivativeVector"); return &m_dummy;
}
protected:
doublereal m_dummy;
ResidEval& m_resid;
integer m_neq;
doublereal m_time;
private:
void warn(std::string msg) const {
writelog(">>>> Warning: method "+msg+" of base class "
+"DAE_Solver called. Nothing done.\n");
}
};
#endif
}
#endif

View file

@ -1,31 +0,0 @@
#include "ct_defs.h"
#include "DAE_Solver.h"
// DAE_DEVEL is turned off at the current time
#ifdef DAE_DEVEL
#ifdef HAS_SUNDIALS
#include "IDA_Solver.cpp"
#endif
namespace Cantera {
DAE_Solver* newDAE_Solver(string itype) {
if (itype == "IDA") {
#ifdef HAS_SUNDIALS
return new IDA_Solver();
#else
raise CanteraError("newDAE_Solver","IDA solver requires sundials"
" package, but Cantera was not built with sundials.");
#endif
}
else {
throw CanteraError("newDAE_Solver",
"unknown DAE solver: "+itype);
}
}
}
#
#endif

View file

@ -1,38 +0,0 @@
/**
* @file SpeciesThermoFactory.cpp
* Definitions for factory to build instances of classes that manage the
* standard-state thermodynamic properties of a set of species
* (see \ref pdssthermo and class \link Cantera::SpeciesThermoFactory SpeciesThermoFactory\endlink);
*/
// Copyright 2001 California Institute of Technology
#include "SpeciesThermoFactory.h"
using namespace std;
#include "SpeciesThermo.h"
#include "NasaThermo.h"
#include "ShomateThermo.h"
#include "SimpleThermo.h"
#include "GeneralSpeciesThermo.h"
#include "Mu0Poly.h"
#include "Nasa9PolyMultiTempRegion.h"
#include "Nasa9Poly1.h"
#ifdef WITH_ADSORBATE
#include "AdsorbateThermo.h"
#endif
#include "SpeciesThermoMgr.h"
#include "speciesThermoTypes.h"
#include "VPSSMgr.h"
#include "xml.h"
#include "ctml.h"
using namespace ctml;
namespace Cantera {
}