From 998af3dc84ae5143864f8d70978d86bab2f7d143 Mon Sep 17 00:00:00 2001 From: Bertrand Coconnier Date: Sat, 18 Dec 2021 21:25:47 +0100 Subject: [PATCH] Remove useless members and methods. --- src/math/FGTable.cpp | 46 ++++++++++---------------------------------- src/math/FGTable.h | 7 +++---- 2 files changed, 13 insertions(+), 40 deletions(-) diff --git a/src/math/FGTable.cpp b/src/math/FGTable.cpp index dc9220cd7..c02a70472 100644 --- a/src/math/FGTable.cpp +++ b/src/math/FGTable.cpp @@ -55,8 +55,6 @@ FGTable::FGTable(int NRows) Type = tt1D; colCounter = 0; rowCounter = 1; - nTables = 0; - Data = Allocate(); Debug(0); lastRowIndex=lastColumnIndex=2; @@ -70,8 +68,6 @@ FGTable::FGTable(int NRows, int NCols) Type = tt2D; colCounter = 1; rowCounter = 0; - nTables = 0; - Data = Allocate(); Debug(0); lastRowIndex=lastColumnIndex=2; @@ -80,15 +76,13 @@ FGTable::FGTable(int NRows, int NCols) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FGTable::FGTable(const FGTable& t) + : PropertyManager(t.PropertyManager) { Type = t.Type; colCounter = t.colCounter; rowCounter = t.rowCounter; - tableCounter = t.tableCounter; nRows = t.nRows; nCols = t.nCols; - nTables = t.nTables; - dimension = t.dimension; internal = t.internal; Name = t.Name; lookupProperty[0] = t.lookupProperty[0]; @@ -104,7 +98,6 @@ FGTable::FGTable(const FGTable& t) } lastRowIndex = t.lastRowIndex; lastColumnIndex = t.lastColumnIndex; - lastTableIndex = t.lastTableIndex; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -135,8 +128,6 @@ FGTable::FGTable(std::shared_ptr pm, Element* el, string operation_types = "function, product, sum, difference, quotient," "pow, abs, sin, cos, asin, acos, tan, atan, table"; - nTables = 0; - // Is this an internal lookup table? internal = false; @@ -165,7 +156,7 @@ FGTable::FGTable(std::shared_ptr pm, Element* el, // is part of a 3D table, in which case its independentVar property indexes // will be set by a call from the owning table during creation - dimension = 0; + unsigned int dimension = 0; Element* axisElement = el->FindElement("independentVar"); if (axisElement) { @@ -284,8 +275,7 @@ FGTable::FGTable(std::shared_ptr pm, Element* el, *this << buf; break; case 3: - nTables = el->GetNumElements("tableData"); - nRows = nTables; + nRows = el->GetNumElements("tableData"); nCols = 1; Type = tt3D; colCounter = 1; @@ -293,9 +283,8 @@ FGTable::FGTable(std::shared_ptr pm, Element* el, lastRowIndex = lastColumnIndex = 2; Data = Allocate(); // this data array will contain the keys for the associated tables - Tables.reserve(nTables); // necessary? tableData = el->FindElement("tableData"); - for (i=0; iGetAttributeValueAsNumber("breakPoint"); Tables[i]->lookupProperty[eRow] = lookupProperty[eRow]; @@ -321,10 +310,10 @@ FGTable::FGTable(std::shared_ptr pm, Element* el, // check breakpoints, if applicable if (dimension > 2) { - for (b=2; b<=nTables; ++b) { + for (b=2; b<=Tables.size(); ++b) { if (Data[b][1] <= Data[b-1][1]) { std::cerr << el->ReadFrom() - << fgred << highint + << fgred << highint << " FGTable: breakpoint lookup is not monotonically increasing" << endl << " in breakpoint " << b; if (nameel != 0) std::cerr << " of table in " << nameel->GetAttributeValue("name"); @@ -340,7 +329,7 @@ FGTable::FGTable(std::shared_ptr pm, Element* el, for (c=2; c<=nCols; ++c) { if (Data[0][c] <= Data[0][c-1]) { std::cerr << el->ReadFrom() - << fgred << highint + << fgred << highint << " FGTable: column lookup is not monotonically increasing" << endl << " in column " << c; if (nameel != 0) std::cerr << " of table in " << nameel->GetAttributeValue("name"); @@ -356,7 +345,7 @@ FGTable::FGTable(std::shared_ptr pm, Element* el, for (r=2; r<=nRows; ++r) { if (Data[r][0]<=Data[r-1][0]) { std::cerr << el->ReadFrom() - << fgred << highint + << fgred << highint << " FGTable: row lookup is not monotonically increasing" << endl << " in row " << r; if (nameel != 0) std::cerr << " of table in " << nameel->GetAttributeValue("name"); @@ -399,10 +388,7 @@ FGTable::~FGTable() PropertyManager->Untie(node); } - if (nTables > 0) { - for (unsigned int i=0; i Tables; - unsigned int nRows, nCols, nTables, dimension; - int colCounter, rowCounter, tableCounter; - mutable int lastRowIndex, lastColumnIndex, lastTableIndex; + unsigned int nRows, nCols; + int colCounter, rowCounter; + mutable int lastRowIndex, lastColumnIndex; double** Allocate(void); std::string Name; void bind(Element* el, const std::string& Prefix);