sospin is hosted by Hepforge, IPPP Durham
SOSpin  1.0.0
form.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // SOSpin Library
3 // Copyright (C) 2015 SOSpin Project
4 //
5 // Authors:
6 //
7 // Nuno Cardoso (nuno.cardoso@tecnico.ulisboa.pt)
8 // David Emmanuel-Costa (david.costa@tecnico.ulisboa.pt)
9 // Nuno Gonçalves (nunogon@deec.uc.pt)
10 // Catarina Simoes (csimoes@ulg.ac.be)
11 //
12 // ----------------------------------------------------------------------------
13 // This file is part of SOSpin Library.
14 //
15 // SOSpin Library is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or any
18 // later version.
19 //
20 // SOSpin Library is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU General Public License for more details.
24 //
25 // You should have received a copy of the GNU General Public License
26 // along with SOSpin Library. If not, see <http://www.gnu.org/licenses/>.
27 // ----------------------------------------------------------------------------
28 
29 // form.h created on 27/02/2015
30 //
31 // This file contains the functions necessary to do things
32 // in the SOSpin Library.
33 //
34 // Revision 1.1 28/02/2015 23:19:29 david
35 // License updated
36 //
37 
43 #ifndef FORM_H
44 #define FORM_H
45 
46 #include <iostream>
47 #include <fstream>
48 #include <cstring>
49 #include <sstream>
50 #include <cstdlib>
51 #include <string>
52 #include <vector>
53 #include <list>
54 
55 #include "braket.h"
56 #include "index.h"
57 
58 
59 
60 
61 namespace sospin {
62 
63 #define addFunction(a) form.function(#a)
64 #define addFC(a) form.contractions(a)
65 
66 using namespace std;
67 
68 
69 
70 
71 
80 void setFormRenumber();
85 void unsetFormRenumber();
86 
92 void setFormIndexSum();
95 void unsetFormIndexSum();
96 
97 
98 
108 string FormField(const string fieldname, const unsigned int numUpperIds, const unsigned int numLowerIds, \
109  const FuncProp funcp);
110 
117 void CallForm(Braket &exp, bool print=true, bool all=true, string newidlabel="j");
118 
123 class ToForm {
127  vector<string> Functions;
131  vector<string> FormContraction;
135  string filename;
144 
148  bool indexSum;
149  public:
151  ToForm(void);
153  ~ToForm();
155  void clear();
157  bool function(string f);
159  void contractions(string f);
163  string getFC();
167  string getFunction();
168 
172  void setFilename(string name);
176  string file(){return filename;}
180  string& rpath(){return resource_path;}
189  void run(Braket &exp, bool print, bool all, string newidlabel);
191  bool getIndexSum();
193  void setIndexSum(bool flag);
194 
203  void setRenumber(bool flag=true);
205  bool getRenumberOption();
206 
207 
208  ToForm& operator<<(const string &func);
209  ToForm& operator+(const string &func);
210 };
211 
212 extern ToForm form;
213 
214 
215 
216 }
217 
218 
219 
220 #endif
string file()
Returns the beginning of a input/output FORM file.
Definition: form.h:176
enum FuncProp_s FuncProp
vector< string > Functions
Function declaration storage.
Definition: form.h:127
Functions and cointainer for indices.
bool indexSum
Set(true) or unset(false) indice sum in FORM, useful when using expressions without fields...
Definition: form.h:148
string resource_path
Path to Form file.
Definition: form.h:139
string FormField(const string fieldname, const unsigned int numUpperIds, const unsigned int numLowerIds, const FuncProp funcp)
Function to add field name and create field proprieties to FORM input file.
Definition: form.cpp:156
Store expression...
Definition: braket.h:198
void CallForm(Braket &exp, bool print, bool all, string newidlabel)
Creat the file input for FORM and run the FORM program and return the result to file and/or screen...
Definition: form.cpp:617
Defintions for all general (initialisation etc.) routines of class Braket.
ToForm form
Definition: form.cpp:56
void setFormIndexSum()
Set the index sum in input FORM file, ie, adds "sum i,j,...;" and "id e_(1,...,N) = 1"...
Definition: form.cpp:129
OPMode operator+(const OPMode a, const OPMode b)
calculate the mode for the sum
Definition: braket.cpp:304
void unsetFormIndexSum()
Unset the index sum in input FORM file.
Definition: form.cpp:134
void setFormRenumber()
Set "renumber 1;" in FORM input file. This option is used to renumber indices in order to allow furth...
Definition: form.cpp:113
ostream & operator<<(ostream &out, const OPMode &a)
Get the mode of the expression.
Definition: braket.cpp:266
bool formRenumber
Set(true) or unset(false) "renumber 1;" in FORM.
Definition: form.h:143
vector< string > FormContraction
Function contractions storage.
Definition: form.h:131
void unsetFormRenumber()
Unset "renumber 1;" in FORM input file.
Definition: form.cpp:120
Container for form specifications.
Definition: form.h:123
string & rpath()
Returns the full path name and form binary file.
Definition: form.h:180
string filename
Form input/output filename, input(output) filename is given by filename_in(_out).frm.
Definition: form.h:135