forked from FreeFem/FreeFem-sources
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.cpp
202 lines (137 loc) · 5.54 KB
/
global.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/// \file
// -*- Mode : c++ -*-
//
// SUMMARY :
// USAGE :
// ORG :
// AUTHOR : Frederic Hecht
// E-MAIL : [email protected]
//
/*
This file is part of Freefem++
Freefem++ is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Freefem++ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Freefem++; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <iostream>
#include <cstdio>
namespace ffapi {
// void init) ();
// need #include <iostream>
// need #include <sstream>
// need using namespace std;
std::istream * (*cin)();
std::ostream *(*cout)();
std::ostream *(*cerr)();
// <<mingw32_stdout>> Cannot name these functions identically to the original file pointers under MingW32 (compile
// error). Impacts [[file:InitFunct.hpp::LOADINITIO]]. Changed from stdxxx_ptr() to ffstdxxx() according to the way FF
// itself was changed.
FILE *(*ffstdout)();
FILE *(*ffstderr)();
FILE *(*ffstdin)();
/// Initiate graphical pipe output. I need a separate function for this to warn ffcs to check the corresponding ffglut
/// magic number
size_t (*fwriteinit)(const void *ptr, size_t size, size_t nmemb,FILE *stream);
/// Indicates the begining of a new plot to avoid sending socket control data with each plot item.
void (*newplot)();
/// Redefinition of standard system calls
FILE *(*ff_popen)(const char *command, const char *type);
int (*ff_pclose)(FILE *stream); // [[file:ffapi.cpp::ff_pclose]]
size_t (*ff_fwrite)(const void *ptr, size_t size, size_t nmemb,FILE *stream);
int (*ff_fflush)(FILE *stream);
int (*ff_ferror)(FILE *stream);
int (*ff_feof)(FILE *stream);
// Windows file mode
// -----------------
/// Changing file mode needs to be disabled when the file is a TCP socket to FFCS. Since the treatment is different in
/// FF and in FFLANG executables, they have to be stored in a DLL that changes between these two programs.
void (*wintextmode)(FILE *f);
void (*winbinmode)(FILE *f);
// Transfer basic MPI control
// --------------------------
void (*mpi_init)(int &argc, char **& argv);
void (*mpi_finalize)();
// Permanent server control
// ------------------------
/// if true, FF is considered to be accessible from remote anonymous connections and some commands (like shell
/// commands) are not allowed.
bool (*protectedservermode)();
}
#include "config-wrapper.h"
#include <complex>
#include "AFunction.hpp"
#include "error.hpp"
#include "lex.hpp"
#include "RNM.hpp"
#include <queue>
#include "environment.hpp"
#include "ufunction.hpp"
using namespace std;
#define FF_GRAPH_PTR_DCL
#include "rgraph.hpp"
#include "fem.hpp"
#include "Mesh3dn.hpp"
#include "MatriceCreuse_tpl.hpp"
#include "MeshPoint.hpp"
bool NoGraphicWindow=false;
/// <<verbosity>>
long verbosity = 1;
long searchMethod = 0; //pichon
long npichon2d=0, npichon3d=0;
long npichon2d1=0, npichon3d1=0;
FILE *ThePlotStream=0; // Add for new plot. FH oct 2008
KN<String> *pkarg;// for the list of argument mars 2010
Map_type_of_map map_type_of_map ; // to store te type
Map_type_of_map map_pair_of_type ; // to store te type
basicForEachType * typevarreal, * typevarcomplex; // type of real and complex variable
/// <<zzzfff>> see [[file:lex.hpp::mylex]]
mylex *zzzfff;
bool lexdebug;
/// <<plglval>> see [[file:../lglib/lg.ypp::YYSTYPE]] and [[file:../lglib/lg.ypp::yylval]]
#include "lg.tab.hpp"
YYSTYPE *plglval;
int TheCurrentLine=-1; // unset: by default
//int NbNewVarWithDel =0; // add FH sep 2016 (bof bof global variable not got but hard to set in E_F0 or C_F0
long mpisize=0,mpirank=0;
C_F0 *pOne=0,*pZero=0,*pminusOne=0;
// const C_F0 & One(*pOne), &Zero(*pZero);
Polymorphic * TheOperators=0, //=new Polymorphic(),
* TheRightOperators=0;//=new Polymorphic();
/// <<Global>> Contains all FreeFem++ language keywords. Declaration in [[file:AFunction.hpp::Global]]
TableOfIdentifier Global;
long E_Border::Count =0;
/// <<tables_of_identifier>> declared at [[file:AFunction.hpp::tables_of_identifier]]
typedef list<TableOfIdentifier *> ListOfTOfId;
ListOfTOfId tables_of_identifier;
const int AC_F0::MaxSize=1024; // maximal number of parameters
map<const string,basicForEachType *> map_type;
bool showCPU= false;
size_t CodeAlloc::nb=0, CodeAlloc::lg=0,CodeAlloc::nbpx=0,CodeAlloc::chunk=2048;
size_t CodeAlloc::nbt,CodeAlloc::nbdl=0;
CodeAlloc ** CodeAlloc::mem=0;
size_t CodeAlloc::memoryusage=0;
bool CodeAlloc::sort=true;
bool CodeAlloc::cleanning=false;
bool echo_edp=true; // add F.H of remove script dump
// add F. Hecht
EnvironmentData ffenvironment;
basicForEachType *basicForEachType::tnull=0;
E_F0 *E_F0::tnull=0;
long newconvect3=0;// old convect 3d
CodeAlloc *CodeAlloc::tnull=0;
#include <RefCounter.hpp>
RefCounter *RefCounter::tnull=0;
double ff_tgv=1e30;
void InitMeshPoint(void * p)
{
EF23::MeshPoint*mps=static_cast<EF23::MeshPoint*>(p);
mps->unset();
}