Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
feynruleMomentum.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 #ifndef FEYNRULEMOMENTUM_H_INCLUDED
24 #define FEYNRULEMOMENTUM_H_INCLUDED
25 
26 #include <csl.h>
27 #include "quantumField.h"
28 
29 namespace mty {
30 
31 class FeynmanRule;
32 
33 struct FeynruleKey {
34  mty::QuantumField field;
35  csl::Tensor point;
36 
37  bool operator==(FeynruleKey const& other) const {
38  return field.getParent_info() == other.field.getParent_info()
39  and field.isComplexConjugate() == other.field.isComplexConjugate()
40  and point.get() == other.point.get();
41  }
42 
43  bool operator<(FeynruleKey const& other) const {
44  int comp = csl::compare(point->getName(), other.point->getName());
45  if (comp == -1)
46  return true;
47  else if (comp == 0)
48  return field.TensorFieldElement::operator<(&other.field);
49  return false;
50  }
51 };
52 
54  csl::Expr factor = CSL_1;
55  csl::Tensor momentum;
56 
57  FeynruleTarget(): momentum(nullptr) {}
58  FeynruleTarget(csl::Tensor const& m) :momentum(m) {}
59  FeynruleTarget(csl::Expr const& f, csl::Tensor const& m)
60  :factor(f), momentum(m) {}
61 
62  bool operator==(FeynruleTarget const &other) const {
63  return momentum.get() == other.momentum.get()
64  and factor == other.factor;
65  }
66 };
67 
69 
70  public:
71 
72  FeynruleMomentum(std::vector<mty::FeynmanRule> const& rules,
73  std::vector<csl::Tensor> const& vertices);
74 
75  FeynruleMomentum() = default;
76  FeynruleMomentum(FeynruleMomentum const& other) = default;
77  FeynruleMomentum(FeynruleMomentum&& other) = default;
78  FeynruleMomentum& operator=(FeynruleMomentum const& other) = default;
79  FeynruleMomentum& operator=(FeynruleMomentum&& other) = default;
80  ~FeynruleMomentum() = default;
81 
82  bool isEmpty() const;
83  size_t getSize() const;
84  void clear();
85 
86  std::vector<FeynruleKey>& getKeys();
87  std::vector<FeynruleKey> const& getKeys() const;
88 
89  std::vector<FeynruleTarget>& getTargets();
90  std::vector<FeynruleTarget> const& getTargets() const;
91 
92  std::vector<int>& getMomentumMapping();
93  std::vector<int> const& getMomentumMapping() const;
94 
95  std::vector<FeynruleKey>::iterator find(
96  mty::QuantumField const& field);
97 
98  std::vector<FeynruleKey>::const_iterator find(
99  mty::QuantumField const& field) const;
100 
101  std::vector<FeynruleTarget>::const_iterator find(
102  FeynruleKey const& key) const;
103 
104  std::vector<FeynruleTarget>::iterator find(
105  FeynruleKey const& key);
106 
107  std::vector<FeynruleTarget>::const_iterator find(
108  csl::Tensor const& momentum) const;
109 
110  std::vector<FeynruleTarget>::iterator find(
111  csl::Tensor const& momentum);
112 
113  void push(mty::QuantumField const& field,
114  FeynruleTarget const& target);
115 
116  std::optional<FeynruleTarget> pop(csl::Tensor momentum);
117 
118  friend
119  std::ostream& operator<<(std::ostream& out,
120  FeynruleMomentum const& mom);
121 
122  private:
123 
124  std::vector<FeynruleKey> keys;
125 
126  std::vector<FeynruleTarget> targets;
127 
128  std::vector<int> mapping;
129 };
130 
131 }
132 
133 #endif
Definition: feynruleMomentum.h:68
Definition: feynruleMomentum.h:53
std::ostream & operator<<(std::ostream &fout, csl::Type type)
Namespace of MARTY.
Definition: 2HDM.h:31
Definition: feynruleMomentum.h:33
Class deriving from csl::TensorFieldElement, may enter expressions. In contrary to QuantumFieldParent...
Definition: quantumField.h:1614
bool operator==(const Expr &a, const Expr &b)
Contains QuantumField and QuantumFieldParent, basic objects handling quantum fields as csl expression...