From e1b3e0e2e4def9e0693ff98be0c47de7ca77cacf Mon Sep 17 00:00:00 2001 From: Brown <2mx@ornl.gov> Date: Wed, 2 Jun 2021 17:01:54 -0400 Subject: [PATCH] add function to grab names of particle pairs --- sammy/src/endf/ResonanceParameterIO.cpp | 19 +++++++++++++++++++ sammy/src/endf/ResonanceParameterIO.h | 10 ++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/sammy/src/endf/ResonanceParameterIO.cpp b/sammy/src/endf/ResonanceParameterIO.cpp index 9a823aee8..6e32459bb 100644 --- a/sammy/src/endf/ResonanceParameterIO.cpp +++ b/sammy/src/endf/ResonanceParameterIO.cpp @@ -1479,5 +1479,24 @@ namespace sammy{ } } } + + std::vector<std::string> ResonanceParameterIO::getParticlePairNames(SammyRMatrixParameters & params){ + std::vector<std::string> name_list; + + for ( int ig = 0; ig < params.getNumSpinGroups(); ig++){ + SammySpinGroupInfo * spinInfo = params.getSpinGroupInfo(ig); + for ( int ic = 0; ic < spinInfo->getNumChannels(); ic++){ + SammyChannelInfo *channelInfo = spinInfo->getChannelInfo(ic); + SammyParticlePairInfo *pairInfo = params.getParticlePairInfo(channelInfo->getParticlePairIndex()); + std::string name; + if (pairInfo->getName().empty()) name = "undefined"; + else name = pairInfo->getName(); + + name_list.push_back(name); + } + } + + return name_list; + } } diff --git a/sammy/src/endf/ResonanceParameterIO.h b/sammy/src/endf/ResonanceParameterIO.h index 0a5738fd6..525ec24cb 100644 --- a/sammy/src/endf/ResonanceParameterIO.h +++ b/sammy/src/endf/ResonanceParameterIO.h @@ -116,7 +116,9 @@ namespace sammy{ * @param incidentSpin if old spin group format the spin of the incident particle * @return 0 if no error occurred, 1 for a warning and -1 for an error */ - int readSpinGroupData(SammyRMatrixParameters & isotopes, SammyRMatrixParameters & params, bool oldFormat, double mass, double incidentSpin); + int readSpinGroupData(SammyRMatrixParameters & isotopes, SammyRMatrixParameters & params, bool oldFormat, double mass, double incidentSpin); + std::vector<std::string> getParticlePairNames(SammyRMatrixParameters & params); + void setParticlePairNames(SammyRMatrixParameters & params); protected: class IsotopeData{ public: @@ -128,9 +130,9 @@ namespace sammy{ void setSpecialParticlePairInfo( SammyParticlePairInfo & info, int index, const std::string & type) const; - void readParameterCard1Line(size_t & lineNum, std::vector<double> & values,std::vector<int> & fitOptions, int & group, double & x) const; + void readParameterCard1Line(size_t & lineNum, std::vector<double> & values,std::vector<int> & fitOptions, int & group, double & x) const; - void readParameterCard10Line(size_t & lineNum, IsotopeData & isoData, bool large) const; + void readParameterCard10Line(size_t & lineNum, IsotopeData & isoData, bool large) const; int readNewChannelData(const std::string & line, int channelId, SammyRMatrixParameters & params); @@ -142,7 +144,7 @@ namespace sammy{ */ void setParticleNames(SammyParticlePairInfo & info); - void setParticlePairNames(SammyRMatrixParameters & params); + bool manySpinGroups; -- GitLab