1
0
Fork 0

Removed executable flags for JSBSim source files and synced JSBSim (removed warnings about comparison between signed and unsigned / modified FGInput to issue a more explicit message about unknown input types)

This commit is contained in:
Bertrand Coconnier 2015-04-10 19:21:59 +02:00
parent 4f15e1a840
commit 475166643c
22 changed files with 46 additions and 45 deletions

0
src/FDM/JSBSim/initialization/FGSimplexTrim.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/input_output/FGPropertyManager.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGFunction.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGModelFunctions.cpp Executable file → Normal file
View file

38
src/FDM/JSBSim/math/FGNelderMead.cpp Executable file → Normal file
View file

@ -79,7 +79,7 @@ void FGNelderMead::update()
} }
// find vertex costs // find vertex costs
for (int vertex=0;vertex<m_nVert;vertex++) for (unsigned int vertex=0;vertex<m_nVert;vertex++)
{ {
try try
{ {
@ -94,7 +94,7 @@ void FGNelderMead::update()
// find max cost, next max cost, and min cost // find max cost, next max cost, and min cost
m_iMax = m_iNextMax = m_iMin = 0; m_iMax = m_iNextMax = m_iMin = 0;
for (int vertex=0;vertex<m_nVert;vertex++) for (unsigned int vertex=0;vertex<m_nVert;vertex++)
{ {
if ( m_cost[vertex] > m_cost[m_iMax] ) if ( m_cost[vertex] > m_cost[m_iMax] )
{ {
@ -128,10 +128,10 @@ void FGNelderMead::update()
} }
// compute element sum of simplex vertices // compute element sum of simplex vertices
for (int dim=0;dim<m_nDim;dim++) for (unsigned int dim=0;dim<m_nDim;dim++)
{ {
m_elemSum[dim] = 0; m_elemSum[dim] = 0;
for (int vertex=0;vertex<m_nVert;vertex++) for (unsigned int vertex=0;vertex<m_nVert;vertex++)
m_elemSum[dim] += m_simplex[vertex][dim]; m_elemSum[dim] += m_simplex[vertex][dim];
} }
@ -170,15 +170,15 @@ void FGNelderMead::update()
if (showSimplex) if (showSimplex)
{ {
std::cout << "simplex: " << std::endl;; std::cout << "simplex: " << std::endl;;
for (int j=0;j<m_nVert;j++) for (unsigned int j=0;j<m_nVert;j++)
std::cout << "\t" << std::scientific std::cout << "\t" << std::scientific
<< std::setw(10) << m_cost[j]; << std::setw(10) << m_cost[j];
std::cout << std::endl; std::cout << std::endl;
for (int j=0;j<m_nVert;j++) std::cout << "\t\t" << j; for (unsigned int j=0;j<m_nVert;j++) std::cout << "\t\t" << j;
std::cout << std::endl; std::cout << std::endl;
for (int i=0;i<m_nDim;i++) for (unsigned int i=0;i<m_nDim;i++)
{ {
for (int j=0;j<m_nVert;j++) for (unsigned int j=0;j<m_nVert;j++)
std::cout << "\t" << std::setw(10) << m_simplex[j][i]; std::cout << "\t" << std::setw(10) << m_simplex[j][i];
std::cout << std::endl; std::cout << std::endl;
} }
@ -275,7 +275,7 @@ double FGNelderMead::tryStretch(double factor)
double a= (1.0-factor)/m_nDim; double a= (1.0-factor)/m_nDim;
double b = a - factor; double b = a - factor;
std::vector<double> tryVertex(m_nDim); std::vector<double> tryVertex(m_nDim);
for (int dim=0;dim<m_nDim;dim++) for (unsigned int dim=0;dim<m_nDim;dim++)
{ {
tryVertex[dim] = m_elemSum[dim]*a - m_simplex[m_iMax][dim]*b; tryVertex[dim] = m_elemSum[dim]*a - m_simplex[m_iMax][dim]*b;
boundVertex(tryVertex,m_lowerBound,m_upperBound); boundVertex(tryVertex,m_lowerBound,m_upperBound);
@ -288,10 +288,10 @@ double FGNelderMead::tryStretch(double factor)
if (costTry < m_cost[m_iMax]) if (costTry < m_cost[m_iMax])
{ {
// update the element sum of the simplex // update the element sum of the simplex
for (int dim=0;dim<m_nDim;dim++) m_elemSum[dim] += for (unsigned int dim=0;dim<m_nDim;dim++) m_elemSum[dim] +=
tryVertex[dim] - m_simplex[m_iMax][dim]; tryVertex[dim] - m_simplex[m_iMax][dim];
// replace the max vertex with the trial vertex // replace the max vertex with the trial vertex
for (int dim=0;dim<m_nDim;dim++) m_simplex[m_iMax][dim] = tryVertex[dim]; for (unsigned int dim=0;dim<m_nDim;dim++) m_simplex[m_iMax][dim] = tryVertex[dim];
// update the cost // update the cost
m_cost[m_iMax] = costTry; m_cost[m_iMax] = costTry;
if (showSimplex) std::cout << "stretched\t" << m_iMax << "\tby : " << factor << std::endl; if (showSimplex) std::cout << "stretched\t" << m_iMax << "\tby : " << factor << std::endl;
@ -301,9 +301,9 @@ double FGNelderMead::tryStretch(double factor)
void FGNelderMead::contract() void FGNelderMead::contract()
{ {
for (int dim=0;dim<m_nDim;dim++) for (unsigned int dim=0;dim<m_nDim;dim++)
{ {
for (int vertex=0;vertex<m_nVert;vertex++) for (unsigned int vertex=0;vertex<m_nVert;vertex++)
{ {
m_simplex[vertex][dim] = m_simplex[vertex][dim] =
getRandomFactor()*0.5*(m_simplex[vertex][dim] + getRandomFactor()*0.5*(m_simplex[vertex][dim] +
@ -315,12 +315,12 @@ void FGNelderMead::contract()
void FGNelderMead::constructSimplex(const std::vector<double> & guess, void FGNelderMead::constructSimplex(const std::vector<double> & guess,
const std::vector<double> & stepSize) const std::vector<double> & stepSize)
{ {
for (int vertex=0;vertex<m_nVert;vertex++) for (unsigned int vertex=0;vertex<m_nVert;vertex++)
{ {
m_simplex[vertex] = guess; m_simplex[vertex] = guess;
} }
for (int dim=0;dim<m_nDim;dim++) for (unsigned int dim=0;dim<m_nDim;dim++)
{ {
int vertex = dim + 1; int vertex = dim + 1;
m_simplex[vertex][dim] += stepSize[dim]*getRandomFactor(); m_simplex[vertex][dim] += stepSize[dim]*getRandomFactor();
@ -329,11 +329,11 @@ void FGNelderMead::constructSimplex(const std::vector<double> & guess,
if (showSimplex) if (showSimplex)
{ {
std::cout << "simplex: " << std::endl;; std::cout << "simplex: " << std::endl;;
for (int j=0;j<m_nVert;j++) std::cout << "\t\t" << j; for (unsigned int j=0;j<m_nVert;j++) std::cout << "\t\t" << j;
std::cout << std::endl; std::cout << std::endl;
for (int i=0;i<m_nDim;i++) for (unsigned int i=0;i<m_nDim;i++)
{ {
for (int j=0;j<m_nVert;j++) for (unsigned int j=0;j<m_nVert;j++)
std::cout << "\t" << std::setw(10) << m_simplex[j][i]; std::cout << "\t" << std::setw(10) << m_simplex[j][i];
std::cout << std::endl; std::cout << std::endl;
} }
@ -344,7 +344,7 @@ void FGNelderMead::boundVertex(std::vector<double> & vertex,
const std::vector<double> & lowerBound, const std::vector<double> & lowerBound,
const std::vector<double> & upperBound) const std::vector<double> & upperBound)
{ {
for (int dim=0;dim<m_nDim;dim++) for (unsigned int dim=0;dim<m_nDim;dim++)
{ {
if (vertex[dim] > upperBound[dim]) vertex[dim] = upperBound[dim]; if (vertex[dim] > upperBound[dim]) vertex[dim] = upperBound[dim];
else if (vertex[dim] < lowerBound[dim]) vertex[dim] = lowerBound[dim]; else if (vertex[dim] < lowerBound[dim]) vertex[dim] = lowerBound[dim];

0
src/FDM/JSBSim/math/FGNelderMead.h Executable file → Normal file
View file

12
src/FDM/JSBSim/math/FGStateSpace.cpp Executable file → Normal file
View file

@ -54,10 +54,10 @@ void FGStateSpace::numericalJacobian(std::vector< std::vector<double> > & J, Co
size_t nY = y.getSize(); size_t nY = y.getSize();
double f1 = 0, f2 = 0, fn1 = 0, fn2 = 0; double f1 = 0, f2 = 0, fn1 = 0, fn2 = 0;
J.resize(nY); J.resize(nY);
for (int iY=0;iY<nY;iY++) for (unsigned int iY=0;iY<nY;iY++)
{ {
J[iY].resize(nX); J[iY].resize(nX);
for (int iX=0;iX<nX;iX++) for (unsigned int iX=0;iX<nX;iX++)
{ {
x.set(x0); x.set(x0);
x.set(iX,x.get(iX)+h); x.set(iX,x.get(iX)+h);
@ -123,7 +123,7 @@ std::ostream &operator<<( std::ostream &out, const FGStateSpace::Component &c )
std::ostream &operator<<( std::ostream &out, const FGStateSpace::ComponentVector &v ) std::ostream &operator<<( std::ostream &out, const FGStateSpace::ComponentVector &v )
{ {
for (int i=0; i< v.getSize(); i++) for (unsigned int i=0; i< v.getSize(); i++)
{ {
out << *(v.getComp(i)) << "\n"; out << *(v.getComp(i)) << "\n";
} }
@ -144,11 +144,11 @@ std::ostream &operator<<( std::ostream &out, const std::vector< std::vector<doub
std::streamsize width = out.width(); std::streamsize width = out.width();
size_t nI = vec2d.size(); size_t nI = vec2d.size();
out << std::left << std::setw(1) << "[" << std::right; out << std::left << std::setw(1) << "[" << std::right;
for (int i=0;i<nI;i++) for (unsigned int i=0;i<nI;i++)
{ {
//std::cout << "i: " << i << std::endl; //std::cout << "i: " << i << std::endl;
size_t nJ = vec2d[i].size(); size_t nJ = vec2d[i].size();
for (int j=0;j<nJ;j++) for (unsigned int j=0;j<nJ;j++)
{ {
//std::cout << "j: " << j << std::endl; //std::cout << "j: " << j << std::endl;
if (i==0 && j==0) out << std::setw(width-1) << vec2d[i][j]; if (i==0 && j==0) out << std::setw(width-1) << vec2d[i][j];
@ -171,7 +171,7 @@ std::ostream &operator<<( std::ostream &out, const std::vector<double> &vec )
std::streamsize width = out.width(); std::streamsize width = out.width();
size_t nI = vec.size(); size_t nI = vec.size();
out << std::left << std::setw(1) << "[" << std::right; out << std::left << std::setw(1) << "[" << std::right;
for (int i=0;i<nI;i++) for (unsigned int i=0;i<nI;i++)
{ {
if (i==0) out << std::setw(width-1) << vec[i]; if (i==0) out << std::setw(width-1) << vec[i];
else out << std::setw(width) << vec[i]; else out << std::setw(width) << vec[i];

18
src/FDM/JSBSim/math/FGStateSpace.h Executable file → Normal file
View file

@ -151,12 +151,12 @@ public:
std::vector<double> get() const std::vector<double> get() const
{ {
std::vector<double> val; std::vector<double> val;
for (int i=0;i<getSize();i++) val.push_back(m_components[i]->get()); for (unsigned int i=0;i<getSize();i++) val.push_back(m_components[i]->get());
return val; return val;
} }
void get(double * array) const void get(double * array) const
{ {
for (int i=0;i<getSize();i++) array[i] = m_components[i]->get(); for (unsigned int i=0;i<getSize();i++) array[i] = m_components[i]->get();
} }
double getDeriv(int i) double getDeriv(int i)
{ {
@ -165,21 +165,21 @@ public:
std::vector<double> getDeriv() const std::vector<double> getDeriv() const
{ {
std::vector<double> val; std::vector<double> val;
for (int i=0;i<getSize();i++) val.push_back(m_components[i]->getDeriv()); for (unsigned int i=0;i<getSize();i++) val.push_back(m_components[i]->getDeriv());
return val; return val;
} }
void getDeriv(double * array) const void getDeriv(double * array) const
{ {
for (int i=0;i<getSize();i++) array[i] = m_components[i]->getDeriv(); for (unsigned int i=0;i<getSize();i++) array[i] = m_components[i]->getDeriv();
} }
void set(std::vector<double> vals) void set(std::vector<double> vals)
{ {
for (int i=0;i<getSize();i++) m_components[i]->set(vals[i]); for (unsigned int i=0;i<getSize();i++) m_components[i]->set(vals[i]);
m_stateSpace->run(); m_stateSpace->run();
} }
void set(double * array) void set(double * array)
{ {
for (int i=0;i<getSize();i++) m_components[i]->set(array[i]); for (unsigned int i=0;i<getSize();i++) m_components[i]->set(array[i]);
m_stateSpace->run(); m_stateSpace->run();
} }
std::string getName(int i) const std::string getName(int i) const
@ -189,7 +189,7 @@ public:
std::vector<std::string> getName() const std::vector<std::string> getName() const
{ {
std::vector<std::string> name; std::vector<std::string> name;
for (int i=0;i<getSize();i++) name.push_back(m_components[i]->getName()); for (unsigned int i=0;i<getSize();i++) name.push_back(m_components[i]->getName());
return name; return name;
} }
std::string getUnit(int i) const std::string getUnit(int i) const
@ -199,7 +199,7 @@ public:
std::vector<std::string> getUnit() const std::vector<std::string> getUnit() const
{ {
std::vector<std::string> unit; std::vector<std::string> unit;
for (int i=0;i<getSize();i++) unit.push_back(m_components[i]->getUnit()); for (unsigned int i=0;i<getSize();i++) unit.push_back(m_components[i]->getUnit());
return unit; return unit;
} }
void clear() { void clear() {
@ -260,7 +260,7 @@ public:
double stateSum() { double stateSum() {
double sum = 0; double sum = 0;
for (int i=0;i<x.getSize();i++) sum += x.get(i); for (unsigned int i=0;i<x.getSize();i++) sum += x.get(i);
return sum; return sum;
} }

View file

@ -60,7 +60,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
IDENT(IdSrc,"$Id: FGAccelerations.cpp,v 1.22 2015/03/28 14:49:02 bcoconni Exp $"); IDENT(IdSrc,"$Id: FGAccelerations.cpp,v 1.24 2015/04/02 18:30:06 ehofman Exp $");
IDENT(IdHdr,ID_ACCELERATIONS); IDENT(IdHdr,ID_ACCELERATIONS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -294,12 +294,12 @@ void FGAccelerations::ResolveFrictionForces(double dt)
// 1. Compute the right hand side member 'rhs' // 1. Compute the right hand side member 'rhs'
// 2. Divide every line of 'a' and 'rhs' by a[i,i]. This is in order to save // 2. Divide every line of 'a' and 'rhs' by a[i,i]. This is in order to save
// a division computation at each iteration of Gauss-Seidel. // a division computation at each iteration of Gauss-Seidel.
for (int i=0; i < n; i++) { for (unsigned int i=0; i < n; i++) {
double d = 1.0 / a[i*n+i]; double d = 1.0 / a[i*n+i];
rhs[i] = -(DotProduct(multipliers[i]->ForceJacobian, vdot) rhs[i] = -(DotProduct(multipliers[i]->ForceJacobian, vdot)
+DotProduct(multipliers[i]->MomentJacobian, wdot))*d; +DotProduct(multipliers[i]->MomentJacobian, wdot))*d;
for (int j=0; j < n; j++) for (unsigned int j=0; j < n; j++)
a[i*n+j] *= d; a[i*n+j] *= d;
} }
@ -307,11 +307,11 @@ void FGAccelerations::ResolveFrictionForces(double dt)
for (int iter=0; iter < 50; iter++) { for (int iter=0; iter < 50; iter++) {
double norm = 0.; double norm = 0.;
for (int i=0; i < n; i++) { for (unsigned int i=0; i < n; i++) {
double lambda0 = multipliers[i]->value; double lambda0 = multipliers[i]->value;
double dlambda = rhs[i]; double dlambda = rhs[i];
for (int j=0; j < n; j++) for (unsigned int j=0; j < n; j++)
dlambda -= a[i*n+j]*multipliers[j]->value; dlambda -= a[i*n+j]*multipliers[j]->value;
multipliers[i]->value = Constrain(multipliers[i]->Min, lambda0+dlambda, multipliers[i]->Max); multipliers[i]->value = Constrain(multipliers[i]->Min, lambda0+dlambda, multipliers[i]->Max);
@ -325,7 +325,7 @@ void FGAccelerations::ResolveFrictionForces(double dt)
// Calculate the total friction forces and moments // Calculate the total friction forces and moments
for (int i=0; i< n; i++) { for (unsigned int i=0; i< n; i++) {
double lambda = multipliers[i]->value; double lambda = multipliers[i]->value;
vFrictionForces += lambda * multipliers[i]->ForceJacobian; vFrictionForces += lambda * multipliers[i]->ForceJacobian;
vFrictionMoments += lambda * multipliers[i]->MomentJacobian; vFrictionMoments += lambda * multipliers[i]->MomentJacobian;

0
src/FDM/JSBSim/models/FGAuxiliary.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGExternalForce.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGExternalForce.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGExternalReactions.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGExternalReactions.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGFCSChannel.h Executable file → Normal file
View file

5
src/FDM/JSBSim/models/FGInput.cpp Executable file → Normal file
View file

@ -50,7 +50,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
IDENT(IdSrc,"$Id: FGInput.cpp,v 1.32 2015/04/02 02:20:50 dpculp Exp $"); IDENT(IdSrc,"$Id: FGInput.cpp,v 1.33 2015/04/08 19:35:00 bcoconni Exp $");
IDENT(IdHdr,ID_INPUT); IDENT(IdHdr,ID_INPUT);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -104,7 +104,8 @@ bool FGInput::Load(Element* el)
} else if (type == "QTJSBSIM") { } else if (type == "QTJSBSIM") {
Input = new FGUDPInputSocket(FDMExec); Input = new FGUDPInputSocket(FDMExec);
} else if (type != string("NONE")) { } else if (type != string("NONE")) {
cerr << "Unknown type of input specified in config file" << endl; cerr << element->ReadFrom()
<< "Unknown type of input specified in config file" << endl;
} }
if (!Input) return false; if (!Input) return false;

0
src/FDM/JSBSim/models/FGInput.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGAccelerometer.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGDistributor.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGDistributor.h Executable file → Normal file
View file

View file

@ -46,7 +46,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
IDENT(IdSrc,"$Id: FGKinemat.cpp,v 1.14 2014/01/13 10:46:09 ehofman Exp $"); IDENT(IdSrc,"$Id: FGKinemat.cpp,v 1.15 2015/04/02 17:39:28 bcoconni Exp $");
IDENT(IdHdr,ID_FLAPS); IDENT(IdHdr,ID_FLAPS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -119,7 +119,7 @@ bool FGKinemat::Run(void )
while ( dt0 > 0.0 && !EqualToRoundoff(Input, Output) ) { while ( dt0 > 0.0 && !EqualToRoundoff(Input, Output) ) {
// Find the area where Output is in // Find the area where Output is in
int ind; unsigned int ind;
for (ind = 1; (Input < Output) ? Detents[ind] < Output : Detents[ind] <= Output ; ++ind) for (ind = 1; (Input < Output) ? Detents[ind] < Output : Detents[ind] <= Output ; ++ind)
if (NumDetents <= ind) if (NumDetents <= ind)
break; break;
@ -190,7 +190,7 @@ void FGKinemat::Debug(int from)
if (from == 0) { // Constructor if (from == 0) { // Constructor
cout << " INPUT: " << InputNodes[0]->GetName() << endl; cout << " INPUT: " << InputNodes[0]->GetName() << endl;
cout << " DETENTS: " << NumDetents << endl; cout << " DETENTS: " << NumDetents << endl;
for (int i=0;i<NumDetents;i++) { for (unsigned int i=0;i<NumDetents;i++) {
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl; cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
} }
if (IsOutput) { if (IsOutput) {

0
src/FDM/JSBSim/models/propulsion/FGTurboProp.h Executable file → Normal file
View file