gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
Gambit::Utils::type_equivalency Struct Reference

Structure providing type equivalency classes to the dep resolver. More...

#include <type_equivalency.hpp>

Collaboration diagram for Gambit::Utils::type_equivalency:

Public Member Functions

void add (str, str)
 Define a new equivalency relation {. More...
 
void add (str, str, str)
 
void add (str, str, str, str)
 
void add (str, str, str, str, str)
 
void add (str, str, str, str, str, str)
 
void add (std::vector< str >)
 
 type_equivalency ()
 Constructor. More...
 

Public Attributes

std::set< std::set< str > > equivalency_classes
 }@ The total set of equivalency classes More...
 

Private Attributes

str filename
 

Detailed Description

Structure providing type equivalency classes to the dep resolver.

Definition at line 36 of file type_equivalency.hpp.

Constructor & Destructor Documentation

◆ type_equivalency()

Gambit::Utils::type_equivalency::type_equivalency ( )

Constructor.

Constructor for type_equivalency.

Definition at line 47 of file type_equivalency.cpp.

References add(), filename, LOCAL_INFO, and Gambit::utils_error().

47  :
48  filename(GAMBIT_DIR "/config/resolution_type_equivalency_classes.yaml")
49  {
50  // Read yaml configuration file
51  std::vector<YAML::Node> yaml_entries;
52  try
53  {
54  yaml_entries = YAML::LoadAllFromFile(filename);
55  }
56  catch (YAML::Exception &e)
57  {
58  std::ostringstream msg;
59  msg << "Could not read resolution type equivalency class file \""<<filename<<"\"!" << endl;
60  msg << "Please check that file exists and contains valid YAML." << endl;
61  msg << "("<<e.what()<<")";
62  utils_error().raise(LOCAL_INFO,msg.str());
63  }
64  // Iterate over the entries in the configuration file and add them to the set of equivalency classes
65  for (auto it = yaml_entries.begin(); it != yaml_entries.end(); ++it)
66  {
67  add(it->as< std::vector<str> >());
68  }
69  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
void add(str, str)
Define a new equivalency relation {.
Here is the call graph for this function:

Member Function Documentation

◆ add() [1/6]

void Gambit::Utils::type_equivalency::add ( str  t1,
str  t2 
)

Define a new equivalency relation {.

Definition at line 73 of file type_equivalency.cpp.

References equivalency_classes, and Gambit::Utils::fix_type().

Referenced by add(), Gambit::add_equivrelation(), and type_equivalency().

74  {
75  bool already_added = false;
76  std::set<std::set<str> > equivalency_classes_copy = equivalency_classes;
77  for (std::set<std::set<str> >::const_iterator it = equivalency_classes_copy.begin(); it != equivalency_classes_copy.end(); ++it)
78  {
79  std::set<str>::const_iterator loc1 = it->find(t1);
80  std::set<str>::const_iterator loc2 = it->find(t2);
81  std::set<str>::const_iterator end = it->end();
82  if (loc1 != end and loc2 == end)
83  {
84  std::set<str> temp = *it;
85  temp.insert(fix_type(t2));
86  equivalency_classes.erase(*it);
87  equivalency_classes.insert(temp);
88  already_added = true;
89  }
90  if (loc2 != end and loc1 == end)
91  {
92  std::set<str> temp = *it;
93  temp.insert(fix_type(t1));
94  equivalency_classes.erase(*it);
95  equivalency_classes.insert(temp);
96  already_added = true;
97  }
98  if (loc1 != end and loc2 != end)
99  {
100  already_added = true;
101  }
102  if (already_added) break;
103  }
104  if (not already_added)
105  {
106  str types[] = {fix_type(t1),fix_type(t2)};
107  equivalency_classes.insert(std::set<str>(types,types+2));
108  }
109  }
std::set< std::set< str > > equivalency_classes
}@ The total set of equivalency classes
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
str fix_type(str)
Clean out whitespace and strip Gambit and default BOSSed class namespaces.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add() [2/6]

void Gambit::Utils::type_equivalency::add ( str  t1,
str  t2,
str  t3 
)

Definition at line 110 of file type_equivalency.cpp.

References add().

110 { add(t1,t2); add(t1,t3); }
void add(str, str)
Define a new equivalency relation {.
Here is the call graph for this function:

◆ add() [3/6]

void Gambit::Utils::type_equivalency::add ( str  t1,
str  t2,
str  t3,
str  t4 
)

Definition at line 111 of file type_equivalency.cpp.

References add().

111 { add(t1,t2); add(t1,t3); add(t1,t4); }
void add(str, str)
Define a new equivalency relation {.
Here is the call graph for this function:

◆ add() [4/6]

void Gambit::Utils::type_equivalency::add ( str  t1,
str  t2,
str  t3,
str  t4,
str  t5 
)

Definition at line 112 of file type_equivalency.cpp.

References add().

112 { add(t1,t2); add(t1,t3); add(t1,t4); add(t1,t5); }
void add(str, str)
Define a new equivalency relation {.
Here is the call graph for this function:

◆ add() [5/6]

void Gambit::Utils::type_equivalency::add ( str  t1,
str  t2,
str  t3,
str  t4,
str  t5,
str  t6 
)

Definition at line 113 of file type_equivalency.cpp.

References add().

113 { add(t1,t2); add(t1,t3); add(t1,t4); add(t1,t5); add(t1,t6); }
void add(str, str)
Define a new equivalency relation {.
Here is the call graph for this function:

◆ add() [6/6]

void Gambit::Utils::type_equivalency::add ( std::vector< str v)

Definition at line 114 of file type_equivalency.cpp.

References add().

114 { for (auto it = v.begin()+1; it != v.end(); ++it) { add(v[0],*it); } }
void add(str, str)
Define a new equivalency relation {.
Here is the call graph for this function:

Member Data Documentation

◆ equivalency_classes

std::set< std::set<str> > Gambit::Utils::type_equivalency::equivalency_classes

}@ The total set of equivalency classes

Definition at line 49 of file type_equivalency.hpp.

Referenced by add(), Gambit::DRes::DependencyResolver::DependencyResolver(), and Gambit::DRes::typeComp().

◆ filename

str Gambit::Utils::type_equivalency::filename
private

Definition at line 53 of file type_equivalency.hpp.

Referenced by type_equivalency().


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