source: git/Singular/comm.h @ e9ad8a6

spielwiese
Last change on this file since e9ad8a6 was e9ad8a6, checked in by Hans Schönemann <hannes@…>, 26 years ago
* hannes:introduced /* */ comments, some code cleanups git-svn-id: file:///usr/local/Singular/svn/trunk@2016 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.4 KB
Line 
1#include "mod2.h"
2#ifndef COMM_H
3#define COMM_H
4
5#include <sys/types.h>
6#include "silink.h"
7#include "intvec.h"
8#include "structs.h"
9//#include "febase.h"
10#include "structs.h"
11#include "kutil.h"
12
13#include <stdio.h>
14
15extern int pVariables;
16
17enum stdModus
18{
19  ModEnde,          // Berechnung sofort verlassen
20  ModRead,          // Nur zur besseren Lesbarkeit
21  ModWrite,         //  "   "     "         "
22  ModRun,           // Normales rechnen, Tupel versenden
23  ModStep,          // Tupel Empfangen, Rechenweg richtet sich nach Nachricht
24  ModCalc,          // Normale Rechnen Tupel nicht versenden
25  ModCheck,         // Nachrechnen
26  ModPosition       // Aktuelles Tupel wird beim Reduzieren
27                    // neu in der Liste strat->L positioniert.
28};
29
30enum linkModus
31{
32  lnRead,
33  lnWrite
34};
35
36
37enum stdMsg
38{
39                         // Wird gesendet wenn :
40  MsgEnd           = 2,  // schreibender Prozess die Berechnung beendet hat.
41  MsgTupelisZero   = 3,  // wenn aktuelles Tupel zu NULL geht
42  MsgTupel         = 4,  // wenn aktuelles Tupel nicht zu NULL geht
43  MsgTupelPosition = 5,  // wenn aktuelles Tupel in strat->Ll neu positioniert wird
44  MsgTupelHilb     = 6   // wenn ein Tupel mit Hilberfunktion elimiert wurde.
45};
46
47
48class sklinkvec;
49typedef class sklinkvec * linkvec;
50class sklinkvec
51{
52private:
53  si_link * link;
54public:
55  int nr;
56  sklinkvec(int l=1) {
57    nr=l;
58    link = (si_link *)Alloc0(sizeof(sip_link)*l);
59  }
60
61  si_link& operator[](int i) {
62    return link[i];
63  }
64};
65
66class skintarray;
67typedef class skintarray * intarray;
68class skintarray
69{
70private:
71   intvec * * vec;
72public:
73  int nr;
74  skintarray(int l=1) {
75    nr=l;
76     vec = (intvec **)Alloc0(sizeof(intvec*)*l);
77    for(int i=0; i<l ; i++)
78      vec[i] = NULL;
79  }
80
81  intvec*& operator[](int i) {
82    return vec[i];
83  }
84
85   ~skintarray() {
86     if(vec!=NULL)
87       {
88        for(int i=0; i<nr; i++)
89          {
90            if((vec[i])!=NULL)
91              delete (vec[i]);
92            vec[i]=NULL;
93          }
94       }
95     Free((ADDRESS)vec,sizeof(intvec*)*nr);
96     vec=NULL;
97   }
98};
99
100
101
102class skstdLink;
103typedef class skstdLink * stdLink;
104
105class skstdLink
106{
107public:
108  stdModus Modus;
109  BOOLEAN Verwaltung,
110          Receive,
111          TupelL,
112          TupelWarte,
113          SPoly,
114          Reduzieren,
115          TupelStore,
116          TupelMelden,
117          TupelTesten,
118          TupelPosition,
119          ResultSend;
120
121  void Init(leftv ,int);
122  void Start(kStrategy);
123
124  void Store(LObject);           // Speichert ein Polynom in der Liste l zur späteren Verarbeitung
125  BOOLEAN Restore(kStrategy);    // Holt das ein in l gespeicherten Polynom zur Verarbeitung heran.
126
127  BOOLEAN ReceiveMsg();
128  void SendTupel(kStrategy);
129  void ParseMessage(kStrategy);
130  void TupelDifferent(kStrategy);
131  void CheckPosition(kStrategy, int);
132  void CheckHilb(kStrategy, int);
133
134  void Kill();
135
136  BOOLEAN CheckEnd(kStrategy);
137  void End(kStrategy);
138  lists RestTupel();
139
140  void DispMsg(stdMsg);
141  void DispMod(int i=-1);
142private:
143  //  stdModus Modus;
144  linkModus lnModus;
145
146  LSet Warteliste;
147  int Wartelistemax, Wartelistel;
148  int aktuell;         // Index des Polynoms in l, das als nächstes verarbeitet wird.
149
150  int      procnum;
151  intarray res;
152  linkvec  links;
153  intvec * msg;
154
155  void ParseMessageFinal(kStrategy, int=0);
156  void SendMsg(kStrategy, stdMsg msg,int i =0);
157  BOOLEAN QueryRestore();
158  void SetModus(stdModus,kStrategy);
159  void KillChild(kStrategy,int=-1,BOOLEAN=TRUE);
160};
161
162
163#endif
Note: See TracBrowser for help on using the repository browser.