diff --git a/src/ElossTable.cpp b/src/ElossTable.cpp index 85141e8..a8e0657 100644 --- a/src/ElossTable.cpp +++ b/src/ElossTable.cpp @@ -34,10 +34,16 @@ namespace PunchTable { double value; std::vector energyLoss, energyFinal; - std::getline(input, junk); - while(junk != "---------------------------------") + input>>junk>>junk>>m_projectileString; + input>>junk>>junk; + + while(input>>junk) { - std::getline(input, junk); + if(junk == "---------------------------------") + break; + input>>junk; + m_materialString += junk; + input>>junk; } input>>junk>>m_thetaMin>>junk>>m_thetaMax>>junk>>m_thetaStep; std::getline(input, junk); diff --git a/src/ElossTable.h b/src/ElossTable.h index 322b83c..7dbebd9 100644 --- a/src/ElossTable.h +++ b/src/ElossTable.h @@ -21,11 +21,16 @@ namespace PunchTable { ~ElossTable(); void ReadFile(const std::string& filename); - double GetEnergyLoss(double thetaIncident, double finalEnergy); + std::string GetProjectile() { return m_projectileString; } + std::string GetMaterial() { return m_materialString; } + double GetEnergyLoss(double thetaIncident, double finalEnergy); + inline const bool IsValid() const { return m_isValid; } private: + std::string m_projectileString; + std::string m_materialString; std::vector m_splines; double m_thetaStep, m_thetaMin, m_thetaMax; diff --git a/src/GenerateTable.cpp b/src/GenerateTable.cpp index 7a1fc32..de39f49 100644 --- a/src/GenerateTable.cpp +++ b/src/GenerateTable.cpp @@ -106,18 +106,21 @@ namespace PunchTable { } output< energyIn, energyDep; - std::getline(input, junk); - while(junk != "---------------------------------") + input>>junk>>junk>>m_projectileString; + input>>junk>>junk; + + while(input>>junk) { - std::getline(input, junk); + if(junk == "---------------------------------") + break; + input>>junk; + m_materialString += junk; + input>>junk; } + input>>junk>>m_thetaMin>>junk>>m_thetaMax>>junk>>m_thetaStep; std::getline(input, junk); std::getline(input, junk); diff --git a/src/PunchTable.h b/src/PunchTable.h index be873d4..033e2d0 100644 --- a/src/PunchTable.h +++ b/src/PunchTable.h @@ -13,11 +13,17 @@ namespace PunchTable { PunchTable(); PunchTable(const std::string& filename); ~PunchTable(); + void ReadFile(const std::string& filename); + std::string GetProjectile() { return m_projectileString; } + std::string GetMaterial() { return m_materialString; } + double GetInitialKineticEnergy(double theta_incident, double e_deposited); //radians, MeV inline bool IsValid() const { return m_validFlag; } private: + std::string m_projectileString; + std::string m_materialString; std::vector m_splines; double m_thetaStep, m_thetaMin, m_thetaMax; diff --git a/src/main.cpp b/src/main.cpp index 7d9459f..b9b239d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,6 +43,8 @@ int main(int argc, char** argv) std::cout<<"-------------Testing---------"<