Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
topology.h
Go to the documentation of this file.
1 // This file is part of MARTY.
2 //
3 // MARTY is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // MARTY is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15 
23 #pragma once
24 
25 #include <iostream>
26 
31 namespace mty::Topology {
32 
50  enum Type {
51  Tadpole = (1 << 0),
52  Mass = (1 << 1),
53  Triangle = (1 << 2),
54  Box = (1 << 3),
55  Pentagon = (1 << 4),
60  };
61 
65  inline constexpr auto topologyList = {
67  };
68 
72  inline constexpr auto names = {
73  "Tadpole", "Mass", "Triangle", "Box", "Pentagon"
74  };
75 
84  inline Type legsToTopology(int nLegs) {
85  return static_cast<Type>(
86  ((nLegs == 1) * Tadpole)
87  | ((nLegs == 2) * Mass)
88  | ((nLegs == 3) * Triangle)
89  | ((nLegs == 4) * Box)
90  | ((nLegs == 5) * Pentagon)
91  );
92  }
93 
102  inline std::ostream &operator<<(std::ostream &out, Type t) {
103  if (t == Any) out << "Any";
104  else out << *(names.begin() + static_cast<int>(t)/2);
105  return out;
106  }
107 }
Definition: topology.h:53
Definition: topology.h:52
Definition: topology.h:55
Definition: topology.h:51
std::ostream & operator<<(std::ostream &out, Type t)
Overload of output stream operator for a topology.
Definition: topology.h:102
constexpr auto names
Names for topologies.
Definition: topology.h:72
Type
Enumeration of the different possible topologies.
Definition: topology.h:50
Namespace containing topology utilities for Feynman diagram calculations.
Definition: topology.h:31
constexpr auto topologyList
List of the different possible topologies.
Definition: topology.h:65
Type legsToTopology(int nLegs)
Converts an integer corresponding to a number of legs to a topology.
Definition: topology.h:84
Any topologies i.e. combination of all 5 possible topologies.
Definition: topology.h:59
Definition: topology.h:54