Skip to content

Commit

Permalink
Remove dead code from FGSurface (JSBSim-Team#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoconni committed Aug 26, 2023
1 parent 3620c1f commit a1f4eec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 91 deletions.
3 changes: 1 addition & 2 deletions src/models/FGGroundReactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ string FGGroundReactions::GetGroundReactionValues(string delimeter) const

void FGGroundReactions::bind(void)
{
eSurfaceType = ctGROUND;
FGSurface::bind();
FGSurface::bind(PropertyManager);

PropertyManager->Tie("gear/num-units", this, &FGGroundReactions::GetNumGearUnits);
PropertyManager->Tie("gear/wow", this, &FGGroundReactions::GetWOW);
Expand Down
80 changes: 8 additions & 72 deletions src/models/FGSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,13 @@ namespace JSBSim {
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

FGSurface::FGSurface(FGFDMExec* fdmex, int number) :
contactNumber(number)
FGSurface::FGSurface(FGFDMExec* fdmex)
{
eSurfaceType = ctBOGEY;
_PropertyManager = fdmex->GetPropertyManager();
resetValues();
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

FGSurface::~FGSurface()
{
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void FGSurface::resetValues(void)
{
staticFFactor = 1.0;
Expand All @@ -79,37 +70,21 @@ void FGSurface::resetValues(void)

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void FGSurface::bind(void)
void FGSurface::bind(FGPropertyManager* PropertyManager)
{
if (!_PropertyManager) return;

string base_property_name;
string base_property_name = "ground";
string property_name;

switch(eSurfaceType) {
case ctBOGEY:
base_property_name = _CreateIndexedPropertyName("gear/unit", contactNumber);
break;
case ctSTRUCTURE:
base_property_name = _CreateIndexedPropertyName("contact/unit", contactNumber);
break;
case ctGROUND:
base_property_name = "ground";
break;
default:
return;
}

property_name = base_property_name + "/solid";
_PropertyManager->Tie( property_name.c_str(), &isSolid);
PropertyManager->Tie( property_name.c_str(), &isSolid);
property_name = base_property_name + "/bumpiness";
_PropertyManager->Tie( property_name.c_str(), &bumpiness);
PropertyManager->Tie( property_name.c_str(), &bumpiness);
property_name = base_property_name + "/maximum-force-lbs";
_PropertyManager->Tie( property_name.c_str(), &maximumForce);
PropertyManager->Tie( property_name.c_str(), &maximumForce);
property_name = base_property_name + "/rolling_friction-factor";
_PropertyManager->Tie( property_name.c_str(), &rollingFFactor);
PropertyManager->Tie( property_name.c_str(), &rollingFFactor);
property_name = base_property_name + "/static-friction-factor";
_PropertyManager->Tie( property_name.c_str(), &staticFFactor);
PropertyManager->Tie( property_name.c_str(), &staticFFactor);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand All @@ -136,43 +111,4 @@ float FGSurface::GetBumpHeight()
return h*(1/8.)*bumpiness*maxGroundBumpAmplitude;
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

string FGSurface::_CreateIndexedPropertyName(const string& Property, int index)
{
std::ostringstream buf;
buf << Property << '[' << index << ']';
return buf.str();
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

string FGSurface::GetSurfaceStrings(string delimeter) const
{
std::ostringstream buf;

buf << "staticFFactor" << delimeter
<< "rollingFFactor" << delimeter
<< "maximumForce" << delimeter
<< "bumpiness" << delimeter
<< "isSolid";

return buf.str();
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

string FGSurface::GetSurfaceValues(string delimeter) const
{
std::ostringstream buf;

buf << staticFFactor << delimeter
<< rollingFFactor << delimeter
<< maximumForce << delimeter
<< bumpiness << delimeter
<< (isSolid ? "1" : "0");

return buf.str();
}

} // namespace JSBSim
19 changes: 2 additions & 17 deletions src/models/FGSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,10 @@ CLASS DECLARATION
class FGSurface
{
public:

enum ContactType {ctBOGEY, ctSTRUCTURE, ctGROUND};

/// Constructor
FGSurface(FGFDMExec* fdmex, int number = -1);

/// Destructor
~FGSurface();
FGSurface(FGFDMExec* fdmex);

void bind(void);
void bind(FGPropertyManager* pm);

/// Reset all surface values to a default
void resetValues(void);
Expand Down Expand Up @@ -114,23 +108,14 @@ class FGSurface
/// Returns the height of the bump at the provided offset
float GetBumpHeight();

std::string GetSurfaceStrings(std::string delimeter) const;
std::string GetSurfaceValues(std::string delimeter) const;

protected:
ContactType eSurfaceType;
double staticFFactor, rollingFFactor;
double maximumForce;
double bumpiness;
bool isSolid;

private:
int contactNumber;
double pos[3];

FGPropertyManager* _PropertyManager;

static std::string _CreateIndexedPropertyName(const std::string& Property, int index);
};

}
Expand Down

0 comments on commit a1f4eec

Please sign in to comment.