Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI::Map::Map Class Reference

#include <GIDI.hpp>

Inheritance diagram for GIDI::Map::Map:

Public Member Functions

 Map (std::string const &a_fileName, PoPI::Database const &a_pops, Map const *a_parent=nullptr)
 Map (HAPI::Node const &a_node, std::string const &a_fileName, PoPI::Database const &a_pops, Map const *a_parent=nullptr)
 ~Map ()
Map const * parent () const
std::string const & fileName () const
std::string const & realFileName () const
std::string const & library () const
std::string const & resolvedLibrary () const
void libraries (std::vector< std::string > &a_libraries) const
std::size_t size () const
BaseEntry const * operator[] (std::size_t a_index) const
ProtareBase const * findProtareEntry (std::string const &a_projectileID, std::string const &a_targetID, std::string const &a_library="", std::string const &a_evaluation="") const
void findProtareEntries (FindProtareEntries &a_protareEntries, std::regex const &a_projectileID, std::regex const &a_targetID, std::regex const &a_library=std::regex(".*"), std::regex const &a_evaluation=std::regex(".*")) const
std::string protareFilename (std::string const &a_projectileID, std::string const &a_targetID, std::string const &a_library="", std::string const &a_evaluation="", BaseEntry::PathForm a_form=BaseEntry::PathForm::real) const
bool isProtareAvailable (std::string const &a_projectileID, std::string const &a_targetID, std::string const &a_library="", std::string const &a_evaluation="") const
bool isTNSL_target (std::string const &a_targetID) const
std::vector< std::string > availableEvaluations (std::string const &a_projectileID, std::string const &a_targetID) const
GIDI::Protareprotare (Construction::Settings const &a_construction, PoPI::Database const &a_pops, std::string const &a_projectileID, std::string const &a_targetID, std::string const &a_library="", std::string const &a_evaluation="", bool a_targetRequiredInGlobalPoPs=true, bool a_requiredInPoPs=true) const
std::vector< ProtareBase const * > directory (std::string const &a_projectileID="", std::string const &a_targetID="", std::string const &a_library="", std::string const &a_evaluation="") const
bool walk (MapWalkCallBack a_mapWalkCallBack, void *a_userData, int a_level=0) const
GUPI::AncestryfindInAncestry3 (LUPI_maybeUnused std::string const &a_item)
GUPI::Ancestry const * findInAncestry3 (LUPI_maybeUnused std::string const &a_item) const
void saveAs (std::string const &a_fileName) const
void toXMLList (GUPI::WriteInfo &a_writeInfo, std::string const &a_indent="") const
std::string RIS_fileName ()
bool RIS_fileExist ()
RISI::Projectiles const & RIS_load (std::string const &a_energyUnit)
std::string replacementTarget (PoPI::Database const &a_pops, std::string const &a_projectile, std::string const &a_target)
Public Member Functions inherited from GUPI::Ancestry
 Ancestry (std::string const &a_moniker, std::string const &a_attribute="")
virtual ~Ancestry ()
Ancestryoperator= (Ancestry const &a_ancestry)
std::string const & moniker () const
void setMoniker (std::string const &a_moniker)
Ancestryancestor ()
Ancestry const * ancestor () const
void setAncestor (Ancestry *a_ancestor)
std::string attribute () const
Ancestryroot ()
Ancestry const * root () const
bool isChild (Ancestry *a_instance)
bool isParent (Ancestry *a_parent)
bool isRoot () const
AncestryfindInAncestry (std::string const &a_href)
Ancestry const * findInAncestry (std::string const &a_href) const
virtual AncestryfindInAncestry3 (std::string const &a_item)=0
virtual Ancestry const * findInAncestry3 (std::string const &a_item) const =0
virtual LUPI_HOST void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
virtual std::string xlinkItemKey () const
std::string toXLink () const
void printXML () const

Additional Inherited Members

Static Public Member Functions inherited from GUPI::Ancestry
static std::string buildXLinkItemKey (std::string const &a_name, std::string const &a_key)

Detailed Description

Definition at line 5336 of file GIDI.hpp.

Constructor & Destructor Documentation

◆ Map() [1/2]

GIDI::Map::Map::Map ( std::string const & a_fileName,
PoPI::Database const & a_pops,
Map const * a_parent = nullptr )
Parameters
a_fileName[in] The path to the map file to parse to construct a Map instance.
a_pops[in] A PoPI::Database instance used to get particle indices and possibly other particle information.
a_parent[in] Pointer to the Map containing this.

Definition at line 555 of file GIDI_map.cc.

555 :
556 GUPI::Ancestry( GIDI_mapChars ) {
557
558 initialize( a_fileName, a_pops, a_parent );
559}
#define GIDI_mapChars
Definition GIDI.hpp:162

Referenced by Map(), Map(), and parent().

◆ Map() [2/2]

GIDI::Map::Map::Map ( HAPI::Node const & a_node,
std::string const & a_fileName,
PoPI::Database const & a_pops,
Map const * a_parent = nullptr )
Parameters
a_node[in] HAPI::Node corresponding to the map node
a_fileName[in] std::string, the name of the file containing this map.
a_pops[in] A PoPI::Database instance used to get particle indices and possibly other particle information.
a_parent[in] Pointer to the Map containing this.

Definition at line 569 of file GIDI_map.cc.

569 :
570 GUPI::Ancestry( a_node.name( ) ) {
571
572 initialize( a_node, a_fileName, a_pops, a_parent );
573}

◆ ~Map()

GIDI::Map::Map::~Map ( )

Definition at line 636 of file GIDI_map.cc.

636 {
637
638 for( std::vector<BaseEntry *>::const_iterator iter = m_entries.begin( ); iter < m_entries.end( ); ++iter ) delete *iter;
639}

Member Function Documentation

◆ availableEvaluations()

std::vector< std::string > GIDI::Map::Map::availableEvaluations ( std::string const & a_projectileID,
std::string const & a_targetID ) const

Returns a list of all evaluations with a match to a_projectileID and a_targetID.

Parameters
a_projectileID[in] The projectile's id to match.
a_targetID[in] The target's id to match.
Returns
List of evaluations.

Definition at line 753 of file GIDI_map.cc.

753 {
754
755 std::vector<std::string> list;
756
757 for( std::vector<BaseEntry *>::const_iterator iter1 = m_entries.begin( ); iter1 != m_entries.end( ); ++iter1 ) {
758 if( (*iter1)->name( ) == GIDI_importChars ) {
759 Import *_mapEntry = static_cast<Import *> (*iter1);
760
761 std::vector<std::string> sub_list = _mapEntry->availableEvaluations( a_projectileID, a_targetID );
762 for( std::vector<std::string>::const_iterator iter2 = sub_list.begin( ); iter2 != sub_list.end( ); ++iter2 )
763 list.push_back( *iter2 ); }
764 else {
765 ProtareBase *protareEntry = static_cast<ProtareBase *> (*iter1);
766
767 if( protareEntry->isMatch( a_projectileID, a_targetID ) ) list.push_back( protareEntry->evaluation( ) );
768 }
769 }
770 return( list );
771}
#define GIDI_importChars
Definition GIDI.hpp:163

◆ directory()

std::vector< ProtareBase const * > GIDI::Map::Map::directory ( std::string const & a_projectileID = "",
std::string const & a_targetID = "",
std::string const & a_library = "",
std::string const & a_evaluation = "" ) const

Returns a list of all Protare entry's matching the input data.

Parameters
a_projectileID[in] The projectile's id to match.
a_targetID[in] The target's id to match.
a_library[in] The library to match.
a_evaluation[in] The evaluation to match.
Returns
List of all Protare entry's matching input parameters.

Definition at line 856 of file GIDI_map.cc.

857 {
858
859 MapWalkDirectoryCallbackData mapWalkDirectoryCallbackData( a_projectileID, a_targetID, a_library, a_evaluation );
860
861 walk( MapWalkDirectoryCallback, &mapWalkDirectoryCallbackData, 0 );
862 return( mapWalkDirectoryCallbackData.m_protareEntries );
863}
bool walk(MapWalkCallBack a_mapWalkCallBack, void *a_userData, int a_level=0) const
Definition GIDI_map.cc:876
bool MapWalkDirectoryCallback(ProtareBase const *a_protareEntry, std::string const &a_library, void *a_data, LUPI_maybeUnused int a_level)
Definition GIDI_map.cc:82

◆ fileName()

std::string const & GIDI::Map::Map::fileName ( ) const
inline

Returns the value of the m_fileName member.

Definition at line 5356 of file GIDI.hpp.

◆ findInAncestry3() [1/2]

GUPI::Ancestry * GIDI::Map::Map::findInAncestry3 ( LUPI_maybeUnused std::string const & a_item)
inline

Always returns nullptr.

Definition at line 5389 of file GIDI.hpp.

◆ findInAncestry3() [2/2]

GUPI::Ancestry const * GIDI::Map::Map::findInAncestry3 ( LUPI_maybeUnused std::string const & a_item) const
inline

Always returns nullptr.

Definition at line 5390 of file GIDI.hpp.

◆ findProtareEntries()

void GIDI::Map::Map::findProtareEntries ( FindProtareEntries & a_protareEntries,
std::regex const & a_projectileID,
std::regex const & a_targetID,
std::regex const & a_library = std::regex( ".*" ),
std::regex const & a_evaluation = std::regex( ".*" ) ) const

Returns the list of all Protare entries that match a_projectileID, a_targetID, a_library and a_evaluation. The arguments a_projectileID, a_targetID, a_library and a_evaluation can be an C++ regex string. An empty string for any of the arguments will match all.

Parameters
a_protareEntries[out] The list of ProtareBase found.
a_projectileID[in] The projectile's id to match.
a_targetID[in] The target's id to match.
a_library[in] The library to match.
a_evaluation[in] The evaluation to match.

Definition at line 699 of file GIDI_map.cc.

700 {
701
702 for( std::vector<BaseEntry *>::const_iterator iter = m_entries.begin( ); iter != m_entries.end( ); ++iter ) {
703 (*iter)->findProtareEntries( a_protareEntries, a_projectileID, a_targetID, a_library, a_evaluation );
704 }
705}

Referenced by replacementTarget().

◆ findProtareEntry()

ProtareBase const * GIDI::Map::Map::findProtareEntry ( std::string const & a_projectileID,
std::string const & a_targetID,
std::string const & a_library = "",
std::string const & a_evaluation = "" ) const

Returns the Protare to the first protare to match a_projectileID, a_targetID and a_evaluation. If a_evaluation is an empty string, only a_projectileID and a_targetID are matched.

Parameters
a_projectileID[in] The projectile's id to match.
a_targetID[in] The target's id to match.
a_library[in] The library to match.
a_evaluation[in] The evaluation to match.
Returns
The const pointer ProtareBase for the matched protare.

Definition at line 675 of file GIDI_map.cc.

676 {
677
678 ProtareBase const *protareEntry = nullptr;
679
680 for( std::vector<BaseEntry *>::const_iterator iter = m_entries.begin( ); iter != m_entries.end( ); ++iter ) {
681 protareEntry = (*iter)->findProtareEntry( a_projectileID, a_targetID, a_library, a_evaluation );
682 if( protareEntry != nullptr ) break;
683 }
684 return( protareEntry );
685}

Referenced by isTNSL_target(), protare(), protareFilename(), and replacementTarget().

◆ isProtareAvailable()

bool GIDI::Map::Map::isProtareAvailable ( std::string const & a_projectileID,
std::string const & a_targetID,
std::string const & a_library = "",
std::string const & a_evaluation = "" ) const
inline

Returns true if the map contains a Protare matching a_projectileID, a_targetID, a_library and a_evaluation, and false otherwise.

Definition at line 5374 of file GIDI.hpp.

◆ isTNSL_target()

bool GIDI::Map::Map::isTNSL_target ( std::string const & a_targetID) const

Returns true if a_targetID is a thermal neutron scattering law (TNSL) target id contained this map, including recursion, and false otherwise.

Parameters
a_targetID[in] The target's id.
Returns
true if target a_targetID is present and is a TNSL target, and false otherwise.

Definition at line 736 of file GIDI_map.cc.

736 {
737
738 ProtareBase const *protareEntry = findProtareEntry( PoPI::IDs::neutron, a_targetID );
739
740 if( protareEntry == nullptr ) return( false );
741 if( protareEntry->entryType( ) == EntryType::TNSL ) return( true );
742 return( false );
743}
ProtareBase const * findProtareEntry(std::string const &a_projectileID, std::string const &a_targetID, std::string const &a_library="", std::string const &a_evaluation="") const
Definition GIDI_map.cc:675
static std::string const neutron
Definition PoPI.hpp:164

◆ libraries()

void GIDI::Map::Map::libraries ( std::vector< std::string > & a_libraries) const

Fills a_libraries with the name of all the libraries this is contained in. The first library in the list is the library this is defined in and the last is the starting library.

Parameters
a_libraries[out] The instances that is filled with the library names.

Definition at line 657 of file GIDI_map.cc.

657 {
658
659 a_libraries.push_back( m_library );
660 if( m_parent != nullptr ) m_parent->libraries( a_libraries );
661}

Referenced by GIDI::Map::BaseEntry::libraries().

◆ library()

std::string const & GIDI::Map::Map::library ( ) const
inline

Returns the value of the m_library member.

Definition at line 5359 of file GIDI.hpp.

◆ operator[]()

BaseEntry const * GIDI::Map::Map::operator[] ( std::size_t a_index) const
inline

Returns the map entry at index a_index.

Definition at line 5364 of file GIDI.hpp.

◆ parent()

Map const * GIDI::Map::Map::parent ( ) const
inline

Returns the value of the m_parent member.

Definition at line 5355 of file GIDI.hpp.

◆ protare()

GIDI::Protare * GIDI::Map::Map::protare ( Construction::Settings const & a_construction,
PoPI::Database const & a_pops,
std::string const & a_projectileID,
std::string const & a_targetID,
std::string const & a_library = "",
std::string const & a_evaluation = "",
bool a_targetRequiredInGlobalPoPs = true,
bool a_requiredInPoPs = true ) const

If a protare matching a_projectileID, a_targetID and a_evaluation is found, the Protare constructor is called with its fileName.

Parameters
a_construction[in] Pass to the Protare constructor.
a_pops[in] A PoPI::Database instance used to get particle indices and possibly other particle information.
a_projectileID[in] The projectile's id to match.
a_targetID[in] The target's id to match.
a_library[in] The library to match.
a_evaluation[in] The evaluation to match.
a_targetRequiredInGlobalPoPs[in] If true, the target is required to be in a_pops.
a_ignorePoPs[in] If true, no particle is required to be in a_pops.

Definition at line 787 of file GIDI_map.cc.

788 {
789
790 std::string targetID( a_targetID );
791 std::string atomicTargetID;
792
793 ParticleSubstitution particleSubstitution;
794 GIDI::Protare *nuclear = nullptr, *atomic = nullptr, *protare;
795
796 if( a_projectileID != PoPI::IDs::neutron ) { // Check if targetID is for TNSL target. If so, and projectile is not a neutron, need to use standardTarget name.
797 ProtareBase const *protareEntry = findProtareEntry( PoPI::IDs::neutron, targetID );
798
799 if( protareEntry != nullptr ) {
800 if( protareEntry->entryType( ) == EntryType::TNSL ) targetID = static_cast<TNSL const *>( protareEntry )->standardTarget( );
801 }
802 }
803
804 if( a_projectileID == PoPI::IDs::photon ) {
805 PoPI::ParseIdInfo parseIdInfo( targetID );
806
807 if( a_construction.photoMode( ) != Construction::PhotoMode::nuclearOnly ) {
808 atomicTargetID = targetID; // Kludge for 99120 and similar targets.
809
810 if( parseIdInfo.isNuclear( ) ) atomicTargetID = parseIdInfo.symbol( );
811 ProtareBase const *protareEntry = findProtareEntry( a_projectileID, atomicTargetID, a_library, a_evaluation );
812 if( protareEntry != nullptr ) {
813 particleSubstitution.insert( { atomicTargetID, ParticleInfo( targetID, a_pops, a_pops, true ) } );
814 atomic = protareEntry->protare( a_construction, a_pops, particleSubstitution );
815 particleSubstitution.clear( );
816 }
817 }
818 if( ( a_construction.photoMode( ) != Construction::PhotoMode::atomicOnly ) && ( targetID != atomicTargetID ) ) {
819 if( parseIdInfo.isSupported( ) ) { // Kludge to ignore 99120 and similar targers.
820 ProtareBase const *protareEntry = findProtareEntry( a_projectileID, targetID, a_library, a_evaluation );
821 if( protareEntry != nullptr ) nuclear = protareEntry->protare( a_construction, a_pops, particleSubstitution );
822 }
823 } }
824 else {
825 ProtareBase const *protareEntry = findProtareEntry( a_projectileID, targetID, a_library, a_evaluation );
826 if( protareEntry != nullptr ) nuclear = protareEntry->protare( a_construction, a_pops, particleSubstitution );
827 }
828
829 if( nuclear == nullptr ) {
830 protare = atomic; }
831 else if( atomic == nullptr ) {
832 protare = nuclear; }
833 else {
834 ProtareComposite *protareComposite = new ProtareComposite( a_construction );
835
836 protareComposite->setProjectile( nuclear->projectile( ) );
837 protareComposite->setTarget( nuclear->target( ) );
838 protareComposite->append( nuclear );
839 protareComposite->append( atomic );
840 protare = protareComposite;
841 }
842
843 return( protare );
844}
GIDI::Protare * protare(Construction::Settings const &a_construction, PoPI::Database const &a_pops, std::string const &a_projectileID, std::string const &a_targetID, std::string const &a_library="", std::string const &a_evaluation="", bool a_targetRequiredInGlobalPoPs=true, bool a_requiredInPoPs=true) const
Definition GIDI_map.cc:787
ParticleInfo const & target() const
Definition GIDI.hpp:4543
ParticleInfo const & projectile() const
Definition GIDI.hpp:4541
virtual ProtareSingle * protare(std::size_t a_index)=0
std::map< std::string, ParticleInfo > ParticleSubstitution
Definition GIDI.hpp:487
static std::string const photon
Definition PoPI.hpp:162

Referenced by protare().

◆ protareFilename()

std::string GIDI::Map::Map::protareFilename ( std::string const & a_projectileID,
std::string const & a_targetID,
std::string const & a_library = "",
std::string const & a_evaluation = "",
BaseEntry::PathForm a_form = BaseEntry::PathForm::real ) const

Returns the path to the first protare to match a_projectileID, a_targetID and a_evaluation. If a_evaluation is an empty string, only a_projectileID and a_targetID are matched.

Parameters
a_projectileID[in] The projectile's id to match.
a_targetID[in] The target's id to match.
a_library[in] The library to match.
a_evaluation[in] The evaluation to match.
a_form[in] Determines the form of the path returned.
Returns
The path to the matched protare.

Definition at line 719 of file GIDI_map.cc.

720 {
721
722 ProtareBase const *protareEntry = findProtareEntry( a_projectileID, a_targetID, a_library, a_evaluation );
723
724 if( protareEntry != nullptr ) return( protareEntry->path( a_form ) );
725 return( GIDI_emptyFileNameChars );
726}
#define GIDI_emptyFileNameChars
Definition GIDI.hpp:150

Referenced by isProtareAvailable().

◆ realFileName()

std::string const & GIDI::Map::Map::realFileName ( ) const
inline

Returns the value of the m_realFileName member.

Definition at line 5357 of file GIDI.hpp.

◆ replacementTarget()

std::string GIDI::Map::Map::replacementTarget ( PoPI::Database const & a_pops,
std::string const & a_projectile,
std::string const & a_target )

If this has target a_target for projectile a_projectile, then a_target is returned. If it does not have target a_target, for projectile a_projectile, then a reasonable substitute is returned if one can be found in this. If no reasonable substitute is found, an empty string is returned.

Parameters
a_pops[in] A PoPI::Database instance used to get information about a_target..
a_projectile[in] The PoPs id of the projectile.
a_target[in] The PoPs id of the target.
Returns
The PoPs id of the replacement target.

Definition at line 995 of file GIDI_map.cc.

995 {
996
997 if( findProtareEntry( a_projectile, a_target ) != nullptr ) return( a_target );
998
999 if( a_pops.exists( a_target ) ) {
1000 std::string particleID = a_pops.final( a_target );
1001 if( a_pops.isParticle( particleID ) ) {
1002 PoPI::Particle const &particle = a_pops.particle( particleID );
1003 if( particle.hasNucleus( ) ) {
1004 PoPI::Nuclide const *nuclide = static_cast<PoPI::Nuclide const *>( &particle );
1005 if( particle.isNucleus( ) ) {
1006 PoPI::Nucleus const *nucleus = static_cast<PoPI::Nucleus const *>( &particle );
1007 nuclide = nucleus->nuclide( );
1008 }
1009 PoPI::Isotope const *isotope = nuclide->isotope( );
1010 std::string targetRegexString( isotope->chemicalElement( )->symbol( ) + "[0-9]+" );
1011
1012 std::vector<ProtareBase const *> protareEntries;
1013 findProtareEntries( protareEntries, std::regex( a_projectile ), std::regex( targetRegexString ) );
1014 if( protareEntries.size( ) > 0 ) {
1015 int offset = 0;
1016 std::map<int, std::string> choices;
1017 for( auto entryIter = protareEntries.begin( ); entryIter != protareEntries.end( ); ++entryIter ) {
1018 PoPI::Nuclide const &nuclide2 = a_pops.get<PoPI::Nuclide const>( (*entryIter)->targetID( ) );
1019 int diffA = nuclide->A( ) - nuclide2.A( );
1020 offset += diffA;
1021 choices[diffA] = nuclide2.ID( );
1022 }
1023 offset = offset < 0 ? -1 : 1;
1024 int diff = 2 * offset;
1025 int step = 2;
1026 for( int doTwo = 0; doTwo < 2; ++doTwo ) {
1027 for( std::size_t index = 0; index < choices.size( ); ++index ) {
1028 auto iter = choices.find( diff );
1029 if( iter != choices.end( ) ) return( (*iter).second );
1030
1031 diff *= -1;
1032 iter = choices.find( diff );
1033 if( iter != choices.end( ) ) return( (*iter).second );
1034
1035 diff = -diff + step * offset;
1036 }
1037 step = 1;
1038 }
1039 }
1040 }
1041 }
1042 }
1043
1044 return( "" );
1045}
G4ThreadLocal T * G4GeomSplitter< T >::offset
void findProtareEntries(FindProtareEntries &a_protareEntries, std::regex const &a_projectileID, std::regex const &a_targetID, std::regex const &a_library=std::regex(".*"), std::regex const &a_evaluation=std::regex(".*")) const
Definition GIDI_map.cc:699
bool isNucleus() const
Definition PoPI.hpp:667
std::string const & ID(void) const
Definition PoPI.hpp:652
int A(void) const
int hasNucleus(void) const
Definition PoPI.hpp:876

◆ resolvedLibrary()

std::string const & GIDI::Map::Map::resolvedLibrary ( ) const

Definition at line 644 of file GIDI_map.cc.

644 {
645
646 if( ( m_library == "" ) && ( m_parent != nullptr ) ) return( m_parent->resolvedLibrary( ) );
647 return( m_library );
648}

◆ RIS_fileExist()

bool GIDI::Map::Map::RIS_fileExist ( )

Returns true if the RIS file for this map file exists and false otherwise.

Returns
A boolean indicating if the RIS file exists or not.

Definition at line 958 of file GIDI_map.cc.

958 {
959
960 return( LUPI::FileInfo::exists( RIS_fileName( ) ) );
961}
std::string RIS_fileName()
Definition GIDI_map.cc:944
bool exists(std::string const &a_path)
Definition LUPI_file.cc:129

Referenced by RIS_load().

◆ RIS_fileName()

std::string GIDI::Map::Map::RIS_fileName ( )

Returns the name of the RIS file for this map file. All RIS files must have a standard name which is the name of the map file with its extension replaced with ".ris".

Returns
The std::string representing the RIS file.

Definition at line 944 of file GIDI_map.cc.

944 {
945
946 std::size_t found = m_fileName.rfind( '.' );
947 std::string RIS_fileName( m_fileName.substr( 0, found ) );
948
949 return( RIS_fileName + ".ris" );
950}

Referenced by RIS_fileExist(), RIS_fileName(), and RIS_load().

◆ RIS_load()

RISI::Projectiles const & GIDI::Map::Map::RIS_load ( std::string const & a_energyUnit)

Load the data from the RIS file if it exists. If it does not exists, no error is reported and the returned RISI::Projectiles will be empty.

Parameters
a_energyUnit[in/out] The unit desired for threshold energies.
Returns
A const reference to the RISI::Projectiles data.

Definition at line 972 of file GIDI_map.cc.

972 {
973
974 if( !m_projectilesLoaded ) {
975 if( RIS_fileExist( ) ) GIDI::RISI::readRIS( RIS_fileName( ), a_energyUnit, m_projectiles );
976 }
977 m_projectilesLoaded = true;
978
979 return( m_projectiles );
980}
bool RIS_fileExist()
Definition GIDI_map.cc:958
void readRIS(std::string const &a_fileName, std::string const &a_energyUnit, Projectiles &a_projectiles)
Definition RISI_read.cc:667

◆ saveAs()

void GIDI::Map::Map::saveAs ( std::string const & a_fileName) const

Write this to a file in GNDS/XML format.

Parameters
a_fileName[in] Name of file to save XML lines to.

Definition at line 902 of file GIDI_map.cc.

902 {
903
904 GUPI::WriteInfo writeInfo;
905
906 toXMLList( writeInfo, "" );
907
908 std::ofstream fileio;
909 fileio.open( a_fileName.c_str( ) );
910 for( std::list<std::string>::iterator iter = writeInfo.m_lines.begin( ); iter != writeInfo.m_lines.end( ); ++iter ) fileio << *iter << std::endl;
911 fileio.close( );
912}
void toXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent="") const
Definition GIDI_map.cc:921
std::list< std::string > m_lines
Definition GUPI.hpp:45

◆ size()

std::size_t GIDI::Map::Map::size ( ) const
inline

Returns the number of entries in this. Does not descend map entries.

Definition at line 5363 of file GIDI.hpp.

Referenced by walk().

◆ toXMLList()

void GIDI::Map::Map::toXMLList ( GUPI::WriteInfo & a_writeInfo,
std::string const & a_indent = "" ) const
virtual

Fills the argument a_writeInfo with the XML lines that represent this. Recursively enters each sub-node.

Parameters
a_writeInfo[in/out] Instance containing incremental indentation and other information and stores the appended lines.
a_indent[in] The amount to indent this node.

Reimplemented from GUPI::Ancestry.

Definition at line 921 of file GIDI_map.cc.

921 {
922
923 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
924 std::string header = LUPI_XML_verionEncoding;
925 std::string attributes;
926
927 a_writeInfo.push_back( header );
928
929 attributes = a_writeInfo.addAttribute( GIDI_libraryChars, m_library );
930 attributes += a_writeInfo.addAttribute( GIDI_formatChars, GNDS_formatVersion_2_0Chars );
931
932 a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
933 for( auto iter = m_entries.begin( ); iter != m_entries.end( ); ++iter ) (*iter)->toXMLList( a_writeInfo, indent2 );
934 a_writeInfo.addNodeEnder( moniker( ) );
935}
#define GIDI_libraryChars
Definition GIDI.hpp:411
#define GIDI_formatChars
Definition GIDI.hpp:167
#define LUPI_XML_verionEncoding
Definition LUPI.hpp:28
#define GNDS_formatVersion_2_0Chars
Definition LUPI.hpp:49
std::string const & moniker() const
Definition GUPI.hpp:102
void push_back(std::string const &a_line)
Definition GUPI.hpp:53
void addNodeEnder(std::string const &a_moniker)
Definition GUPI.hpp:59
std::string incrementalIndent(std::string const &indent)
Definition GUPI.hpp:52
void addNodeStarter(std::string const &indent, std::string const &a_moniker, std::string const &a_attributes="")
Definition GUPI.hpp:55
std::string addAttribute(std::string const &a_name, std::string const &a_value) const
Definition GUPI.hpp:60

Referenced by saveAs().

◆ walk()

bool GIDI::Map::Map::walk ( MapWalkCallBack a_mapWalkCallBack,
void * a_userData,
int a_level = 0 ) const

A method to walk a map file. For each Protare entry found, the a_mapWalkCallBack function is called with a pointer to the Protare entry and a_userData has its arguments.

Parameters
a_mapWalkCallBack[in] The callback function.
a_userData[in] Pointer to user data.
a_level[in] Nested level of this map file. For internal use.
Returns
true if no issue is found and false if an issue is found.

Definition at line 876 of file GIDI_map.cc.

876 {
877
878 for( std::size_t i1 = 0; i1 < size( ); ++i1 ) {
879 BaseEntry const *entry = (*this)[i1];
880
881 std::string path = entry->path( BaseEntry::PathForm::cumulative );
882
883 if( entry->name( ) == GIDI_importChars ) {
884 Import const *mapEntry = static_cast<Import const *>( entry );
885 if( !mapEntry->map( )->walk( a_mapWalkCallBack, a_userData, a_level + 1 ) ) return( true ); }
886 else if( ( entry->name( ) == GIDI_protareChars ) || ( entry->name( ) == GIDI_TNSLChars ) ) {
887 if( !a_mapWalkCallBack( static_cast<ProtareBase const *>( entry ), m_library, a_userData, a_level ) ) return( true ); }
888 else {
889 std::cerr << " ERROR: unknown map entry name: " << entry->name( ) << std::endl;
890 }
891 }
892
893 return( true );
894}
#define GIDI_TNSLChars
Definition GIDI.hpp:165
#define GIDI_protareChars
Definition GIDI.hpp:164
std::size_t size() const
Definition GIDI.hpp:5363

Referenced by directory(), and walk().


The documentation for this class was generated from the following files: