Commit f9dfb319 authored by Grégoire Uhlrich's avatar Grégoire Uhlrich
Browse files

MARTY-pre1.3 -- sgl, calculation architecture refactor, MSSM & SM corrections,...

MARTY-pre1.3 -- sgl, calculation architecture refactor, MSSM & SM corrections, more tests and many things !
parent c4f00408
......@@ -242,6 +242,8 @@ grafed_release=grafed/build-grafed-gui-Desktop_Qt_5_12_1_GCC_64bit-Release
unameOut="$(uname -s)"
case "${unameOut}" in
Darwin*)
mkdir -p $grafed_debug
mkdir -p $grafed_release
cd $grafed_debug && qmake -makefile -o Makefile "CONFIG+=debug" ../grafed-gui/grafed-gui.pro; cd $MARTY_LOC
cd $grafed_release && qmake -makefile -o Makefile ../grafed-gui/grafed-gui.pro; cd $MARTY_LOC
conf_release=`ls $grafed_release/.qmake*`
......
......@@ -13,6 +13,7 @@ all:
$(MAKE) csl
$(MAKE) jsonparser
$(MAKE) grafed
$(MAKE) sgl
$(MAKE) marty
@echo "$(GREEN)$(BOLD)Compilation finished, you may now type $(BLUE)\n $$ make install$(NC)$(NORMAL)"
dep:
......@@ -23,12 +24,14 @@ jsonparser:
cd jsonparser&& $(MAKE) all
grafed:
cd grafed&& $(MAKE) all
sgl:
cd marty/sgl&& $(MAKE) all
marty:
cd marty/models&& $(MAKE) all
cd marty&& $(MAKE) all
install:
cd marty&& $(MAKE) install
cd marty&& $(MAKE) install
cd csl&& $(MAKE) install
cd grafed&& $(MAKE) install
cd jsonparser&& $(MAKE) install
......@@ -38,8 +41,8 @@ install:
@echo "(or start using the code, as you want)$(NC)$(NORMAL)"
clean:
cd marty&& $(MAKE) clean&
cd csl&& $(MAKE) clean&
cd grafed&& $(MAKE) clean&
cd jsonparser&& $(MAKE) clean&
cd dependencies&& $(MAKE) clean
cd marty&& $(MAKE) clean;
cd csl&& $(MAKE) clean;
cd grafed&& $(MAKE) clean;
cd jsonparser&& $(MAKE) clean;
cd dependencies&& $(MAKE) clean;
INSTALLDIR=/home/uhlrich/.local
CC = gcc-7
CC = gcc-7
CXX = g++-7
FC = gfortran-7
FC = gfortran-7
VERSION = 1.0
STATICLIBRARY = libcsl.a
DYNAMICLIBRARY = libcsl.so
......@@ -49,5 +49,5 @@ $(OBJDIR)/%_debug.o: $(SRCDIR)/%.cpp
$(CXXDEBUG) $(CFLAGS) $(INCLUDE) -o $@ -c $<
clean:
rm $(OBJDIR)/*.o;
rm $(LIBDIR)/*.a $(LIBDIR)/*.so
-rm -f $(OBJDIR)/*.o;
-rm -f $(LIBDIR)/*.a $(LIBDIR)/*.so
......@@ -44,5 +44,5 @@ $(OBJDIR)/%_debug.o: $(SRCDIR)/%.cpp
$(CXXDEBUG) $(CFLAGS) $(INCLUDE) -o $@ -c $<
clean:
rm $(OBJDIR)/*.o;
rm $(LIBDIR)/*.a $(LIBDIR)/*.so
-rm -f $(OBJDIR)/*.o;
-rm -f $(LIBDIR)/*.a $(LIBDIR)/*.so
......@@ -28,6 +28,7 @@
#include "interface.h"
#include "index.h"
#include "utils.h"
#include "replace.h"
#include "algo.h"
namespace csl {
......@@ -212,6 +213,10 @@ class Abbreviation: public BaseParent {
<< "\", " << regName << "_encaps);\n";
}
std::string const &getBaseName() const override {
return baseName;
}
void enableEvaluation() override {
evaluation = true;
};
......@@ -269,18 +274,7 @@ class Abbreviation: public BaseParent {
}
}
});
res = ReplaceIndices(res, initialStructure, structure, false, true);
// for (size_t i = 0; i != initialStructure.size(); ++i) {
// res = Replaced(res,
// intermediate[i],
// structure[i],
// false);
// if (structure[i].getSpace()->getSignedIndex())
// res = Replaced(res,
// intermediate[i].getFlipped(),
// structure[i].getFlipped(),
// false);
// }
Replace(res, initialStructure, structure);
return Evaluated(res, user_mode);
}
return std::nullopt;
......
......@@ -318,6 +318,13 @@ namespace csl {
std::function<bool(Expr_info)> const& f,
int depth = -1);
bool isUnique(csl::Expr const &expr);
size_t Count(csl::Expr const &expr, csl::Expr const &search);
size_t CountIf(
csl::Expr const &expr,
std::function<bool(csl::Expr const&)> const &f
);
size_t CountNodes(Expr const &init);
size_t CountLeafs(Expr const &init);
......
......@@ -36,8 +36,6 @@ class AbstractBuildingBlock: public Abstract {
AbstractBuildingBlock();
~AbstractBuildingBlock(){}
bool isBuildingBlock() const override { return true;}
virtual bool commutesWith(Expr_info expr, int sign=-1) const override;
......@@ -74,8 +72,6 @@ class Complexified: public AbstractBuildingBlock {
Complexified();
~Complexified(){};
bool isReal() const override;
bool isPurelyImaginary() const override;
......
......@@ -45,6 +45,7 @@
#include "sort.h"
#include "lock.h"
#include "replace.h"
#include "utils.h"
#include "conditional.h"
#include "algo.h"
......
......@@ -89,9 +89,6 @@ class SelfContraction{
std::optional<std::function<bool(Expr_info, Expr_info)>>
t_condition = std::nullopt);
/*! \brief Destructor.
*/
~SelfContraction(){};
/*! \return \b True if the SelfContraction is empty (no pair of integers).
* \return \b False else.
......@@ -167,8 +164,6 @@ class ContractionChain {
ContractionChain& operator=(const ContractionChain& other) = default;
~ContractionChain(){};
std::optional<ContractionChain> splitAndEvaluate() const;
bool contains(const Expr& tensor) const;
......@@ -371,9 +366,6 @@ class TensorParent: public AbstractParent{
std::vector<const Space*> const& indices,
Args&& ...args);
/*! \brief Destructor.
*/
~TensorParent();
cslParent::PrimaryType getPrimaryType() const override;
......@@ -579,8 +571,6 @@ class EpsilonParent: public TensorParent{
explicit EpsilonParent(const Space* t_space);
~EpsilonParent(){};
cslParent::Type getType() const override;
bool hasContractionProperty(const Abstract* self,
......@@ -612,8 +602,6 @@ class DeltaParent: public TensorParent{
explicit DeltaParent(const Space* t_space);
~DeltaParent(){};
cslParent::Type getType() const override;
bool hasContractionProperty(const Abstract* self,
......@@ -667,9 +655,6 @@ class MetricParent: public TensorParent{
MetricParent(const Space* t_space,
const std::string& t_name="g");
/*! \brief Destructor
*/
~MetricParent(){};
cslParent::Type getType() const override;
......@@ -841,9 +826,6 @@ class TensorElement: public AbstractElement{
#ifdef DEBUG
~TensorElement(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~TensorElement(){};
#endif
csl::PrimaryType getPrimaryType() const override {
......@@ -1113,9 +1095,6 @@ class ISum: public Sum{
#ifdef DEBUG
~ISum(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~ISum(){};
#endif
bool isIndexed() const override;
......@@ -1218,9 +1197,6 @@ class IProd: public Prod{
#ifdef DEBUG
~IProd(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~IProd(){};
#endif
bool isIndexed() const override;
......
This diff is collapsed.
......@@ -164,12 +164,14 @@ namespace csl {
);
void print() const;
void setupDirectory() const;
void printHeader() const;
void printGlobal() const;
void printSource() const;
void printCallable() const;
void printTest() const;
void printMakefile() const;
void printPythonDir() const;
// void printCMakeLists() const;
......
......@@ -42,7 +42,6 @@ class AbstractLiteral: public Complexified{
public:
AbstractLiteral();
~AbstractLiteral();
csl::PrimaryType getPrimaryType() const override {
return csl::PrimaryType::Literal;
......@@ -83,9 +82,6 @@ class Constant: public AbstractLiteral{
#ifdef DEBUG
~Constant(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Constant(){};
#endif
std::string const &getName() const override;
......@@ -202,9 +198,6 @@ class Variable: public AbstractLiteral{
#ifdef DEBUG
~Variable(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Variable(){};
#endif
/*! \brief Gives the \b primary \b type of a Variable.
......@@ -344,9 +337,6 @@ class IntFactorial: public AbstractLiteral{
#ifdef DEBUG
~IntFactorial(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~IntFactorial(){};
#endif
/*! \brief Returns the \b value in the factorial.
......@@ -435,9 +425,6 @@ class Imaginary: public AbstractLiteral{
#ifdef DEBUG
~Imaginary(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Imaginary(){};
#endif
/*! Gives the **primary type** of the Imaginary.
......
......@@ -43,9 +43,6 @@ class Abs: public AbstractFunc{
#ifdef DEBUG
~Abs(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Abs(){};
#endif
/*! \brief Gives the **type** of the abs funtion function.
......@@ -126,9 +123,6 @@ class Exp: public AbstractFunc{
#ifdef DEBUG
~Exp(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Exp(){};
#endif
/*! \brief Gives the **type** of the exponential function.
......@@ -221,9 +215,6 @@ class Log: public AbstractFunc{
#ifdef DEBUG
~Log(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Log(){};
#endif
/*! \brief Gives the **type** of the logarithm function.
......@@ -308,9 +299,6 @@ class Cos: public AbstractFunc{
#ifdef DEBUG
~Cos(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Cos(){};
#endif
/*! \brief Gives the **type** of the cos function.
......@@ -397,9 +385,6 @@ class Sin: public AbstractFunc{
#ifdef DEBUG
~Sin(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Sin(){};
#endif
/*! \brief Gives the **type** of the sin function.
......@@ -486,9 +471,6 @@ class Tan: public AbstractFunc{
#ifdef DEBUG
~Tan(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Tan(){};
#endif
/*! \brief Gives the **type** of the tan function.
......@@ -575,9 +557,6 @@ class ACos: public AbstractFunc{
#ifdef DEBUG
~ACos(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~ACos(){};
#endif
/*! \brief Gives the **type** of the acos function.
......@@ -662,9 +641,6 @@ class ASin: public AbstractFunc{
#ifdef DEBUG
~ASin(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~ASin(){};
#endif
/*! \brief Gives the **type** of the asin function.
......@@ -750,9 +726,6 @@ class ATan: public AbstractFunc{
#ifdef DEBUG
~ATan(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~ATan(){};
#endif
/*! \brief Gives the **type** of the atan function.
......@@ -832,9 +805,6 @@ class Angle: public AbstractDuoFunc{
#ifdef DEBUG
~Angle(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Angle(){};
#endif
/*! \brief Gives the **type** of an Angle object.
......@@ -909,9 +879,6 @@ class Cosh: public AbstractFunc{
#ifdef DEBUG
~Cosh(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Cosh(){};
#endif
/*! \brief Gives the **type** of the cosh function.
......@@ -998,9 +965,6 @@ class Sinh: public AbstractFunc{
#ifdef DEBUG
~Sinh(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Sinh(){};
#endif
/*! \brief Gives the **type** of the sinh function.
......@@ -1087,9 +1051,6 @@ class Tanh: public AbstractFunc{
#ifdef DEBUG
~Tanh(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Tanh(){};
#endif
/*! \brief Gives the **type** of the tanh function.
......@@ -1176,9 +1137,6 @@ class ACosh: public AbstractFunc{
#ifdef DEBUG
~ACosh(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~ACosh(){};
#endif
/*! \brief Gives the **type** of the acosh function.
......@@ -1255,9 +1213,6 @@ class ASinh: public AbstractFunc{
#ifdef DEBUG
~ASinh(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~ASinh(){};
#endif
/*! \brief Gives the **type** of the asinh function.
......@@ -1334,9 +1289,6 @@ class ATanh: public AbstractFunc{
#ifdef DEBUG
~ATanh(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~ATanh(){};
#endif
/*! \brief Gives the **type** of the atanh function.
......@@ -1414,9 +1366,6 @@ class Factorial: public AbstractFunc{
#ifdef DEBUG
~Factorial(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Factorial(){};
#endif
/*! \brief Gives the **type** of the factorial function.
......@@ -1487,9 +1436,6 @@ class DiracDelta: public AbstractFunc {
#ifdef DEBUG
~DiracDelta(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~DiracDelta(){};
#endif
/*! \brief Gives the **type** of the atanh function.
......
......@@ -35,7 +35,6 @@ class AbstractNumerical: public AbstractBuildingBlock{
public:
AbstractNumerical();
~AbstractNumerical(){}
csl::PrimaryType getPrimaryType() const override {
return csl::PrimaryType::Numerical;
......@@ -50,6 +49,19 @@ class AbstractNumerical: public AbstractBuildingBlock{
Expr getNumericalFactor() const override;
std::optional<Expr> getTerm() const override;
bool dependsOn(Expr_info) const override {
return false;
}
bool dependsOn(Parent_info) const override {
return false;
}
bool dependsExplicitlyOn(Expr_info) const override {
return false;
}
bool dependsExplicitlyOn(Parent_info) const override {
return false;
}
};
inline AbstractNumerical::AbstractNumerical(): AbstractBuildingBlock(){}
......@@ -83,9 +95,6 @@ class Integer: public AbstractNumerical{
#ifdef DEBUG
~Integer(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Integer(){};
#endif
/*! \brief Returns the \b type corresponding to an object Integer.
......@@ -177,9 +186,6 @@ class Float: public AbstractNumerical{
#ifdef DEBUG
~Float(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Float(){};
#endif
......@@ -287,9 +293,6 @@ class IntFraction: public AbstractNumerical{
#ifdef DEBUG
~IntFraction(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~IntFraction(){};
#endif
/*! \brief Gives the \b type of a IntFraction.
......@@ -419,9 +422,6 @@ class Complex : public AbstractNumerical {
#ifdef DEBUG
~Complex(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Complex(){};
#endif
/*! \brief Gives the \b type of a Complex.
......
......@@ -54,9 +54,6 @@ class Sum: public AbstractMultiFunc{
#ifdef DEBUG
~Sum(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Sum(){};
#endif
/*! \brief Gives the **type** of a Sum object.
......@@ -210,9 +207,6 @@ class Polynomial: public AbstractMultiFunc{
#ifdef DEBUG
~Polynomial(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Polynomial(){};
#endif
bool mergeTerms();
......@@ -318,9 +312,6 @@ class Prod: public AbstractMultiFunc{
#ifdef DEBUG
~Prod(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Prod(){};
#endif
/*! \brief Gives the **type** of a Prod object.
......@@ -511,9 +502,6 @@ class Pow: public AbstractDuoFunc{
#ifdef DEBUG
~Pow(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Pow(){};
#endif
/*! \brief Gives the **type** of a Pow object.
......@@ -688,9 +676,6 @@ class Derivative: public Operator<AbstractDuoFunc>{
#ifdef DEBUG
~Derivative(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Derivative(){};
#endif
/*! \brief Gives the **type** of a Derivative object.
......@@ -779,9 +764,6 @@ class Integral: public Operator<AbstractDuoFunc>{
#ifdef DEBUG
~Integral(){ __record_data_alloc(static_cast<int>(getType())); }
#else
/*! \brief Destructor. */
~Integral(){};
#endif
/*! \brief Gives the **type** of a Integral object.
......
......@@ -130,6 +130,8 @@ class AbstractParent: public std::enable_shared_from_this<AbstractParent>{
std::string const &getLatexName() const;
virtual std::string const &getBaseName() const;
/*! \return commutable
*/
bool getCommutable() const;
......
#pragma once
#include "abstract.h"
#include "index.h"
namespace csl {
///////////////////////////////////////////////////
// Expression replacements
///////////////////////////////////////////////////
void Replace(
csl::Expr &expr,
csl::Expr const &from,
csl::Expr const &to
);
void Replace(
csl::Expr &expr,
csl::Parent const &from,
csl::Parent const &to
);
void Replace(
csl::Expr &expr,
csl::Parent const &from,
csl::Expr const &to
);
void Replace(
csl::Expr &expr,