Salome HOME
Porting to Mandrake 10.1 and new products:
[plugins/netgenplugin.git] / src / NETGEN / netgen43ForSalome.patch
1 diff -N -r -u netgen43/libsrc/general/array.hpp netgen-4.3/libsrc/general/array.hpp
2 --- netgen43/libsrc/general/array.hpp   2003-05-07 18:01:43.000000000 +0400
3 +++ netgen-4.3/libsrc/general/array.hpp 2005-05-31 16:43:28.000000000 +0400
4 @@ -130,9 +130,9 @@
5    explicit ARRAY (const ARRAY<T> & a2)
6      : FlatArray<T> (a2.Size(), a2.Size() ? new T[a2.Size()] : 0)
7    {
8 -    allocsize = size;
9 +    allocsize = this->size;
10      ownmem = 1;
11 -    for (int i = 0; i < size; i++)
12 +    for (int i = 0; i < this->size; i++)
13        (*this)[i] = a2[i];
14    }
15  
16 @@ -142,7 +142,7 @@
17    ~ARRAY()
18    {
19      if (ownmem)
20 -      delete [] data;
21 +      delete [] this->data;
22    }
23  
24    /// Change logical size. If necessary, do reallocation. Keeps contents.
25 @@ -150,7 +150,7 @@
26    {
27      if (nsize > allocsize) 
28        ReSize (nsize);
29 -    size = nsize; 
30 +    this->size = nsize; 
31    }
32  
33    /// Change physical size. Keeps logical size. Keeps contents.
34 @@ -164,11 +164,11 @@
35    /// Add element at end of array. reallocation if necessary.
36    int Append (const T & el)
37    {
38 -    if (size == allocsize) 
39 -      ReSize (size+1);
40 -    data[size] = el;
41 -    size++;
42 -    return size;
43 +    if (this->size == allocsize) 
44 +      ReSize (this->size+1);
45 +    this->data[this->size] = el;
46 +    this->size++;
47 +    return this->size;
48    }
49  
50  
51 @@ -186,23 +186,23 @@
52      RangeCheck (i);
53  #endif
54  
55 -    data[i-1] = data[size-1];
56 -    size--;
57 +    this->data[i-1] = this->data[this->size-1];
58 +    this->size--;
59    }
60  
61    /// Delete last element. 
62    void DeleteLast ()
63    {
64 -    size--;
65 +    this->size--;
66    }
67  
68    /// Deallocate memory
69    void DeleteAll ()
70    {
71      if (ownmem)
72 -      delete [] data;
73 -    data = 0;
74 -    size = allocsize = 0;
75 +      delete [] this->data;
76 +    this->data = 0;
77 +    this->size = allocsize = 0;
78    }
79  
80    /// Fill array with val
81 @@ -216,7 +216,7 @@
82    ARRAY & operator= (const ARRAY & a2)
83    {
84      SetSize (a2.Size());
85 -    for (int i = 0; i < size; i++)
86 +    for (int i = 0; i < this->size; i++)
87        (*this)[i] = a2[i];
88      return *this;
89    }
90 @@ -229,21 +229,21 @@
91      int nsize = 2 * allocsize;
92      if (nsize < minsize) nsize = minsize;
93  
94 -    if (data)
95 +    if (this->data)
96        {
97         T * p = new T[nsize];
98         
99 -       int mins = (nsize < size) ? nsize : size; 
100 -       memcpy (p, data, mins * sizeof(T));
101 +       int mins = (nsize < this->size) ? nsize : this->size; 
102 +       memcpy (p, this->data, mins * sizeof(T));
103  
104         if (ownmem)
105 -         delete [] data;
106 +         delete [] this->data;
107         ownmem = 1;
108 -       data = p;
109 +       this->data = p;
110        }
111      else
112        {
113 -       data = new T[nsize];
114 +       this->data = new T[nsize];
115         ownmem = 1;
116        }
117      
118 @@ -262,7 +262,7 @@
119    explicit ArrayMem(int asize = 0)
120      : ARRAY<T> (S, mem)
121    {
122 -    SetSize (asize);
123 +    this->SetSize (asize);
124    }
125  
126    ArrayMem & operator= (const T & val)  
127 diff -N -r -u netgen43/libsrc/gprim/geomobjects.hpp netgen-4.3/libsrc/gprim/geomobjects.hpp
128 --- netgen43/libsrc/gprim/geomobjects.hpp       2003-05-07 18:01:43.000000000 +0400
129 +++ netgen-4.3/libsrc/gprim/geomobjects.hpp     2005-05-31 16:45:53.000000000 +0400
130 @@ -296,11 +296,11 @@
131         if (nr & 1)
132           {
133             sbox.pmin(i) = c(i);
134 -           sbox.pmax(i) = pmax(i);
135 +           sbox.pmax(i) = this->pmax(i);
136           }
137         else
138           {
139 -           sbox.pmin(i) = pmin(i);
140 +           sbox.pmin(i) = this->pmin(i);
141             sbox.pmax(i) = c(i);
142           }
143         sbox.c(i) = 0.5 * (sbox.pmin(i) + sbox.pmax(i));
144 @@ -315,12 +315,12 @@
145    void CalcDiamCenter ()
146    {
147      c = Box<D>::Center ();
148 -    diam = Dist (pmin, pmax);
149 +    diam = Dist (this->pmin, this->pmax);
150  
151 -    inner = pmax(0) - pmin(0);
152 +    inner = this->pmax(0) - this->pmin(0);
153      for (int i = 1; i < D; i++)
154 -      if (pmax(i) - pmin(i) < inner)
155 -       inner = pmax(i) - pmin(i);
156 +      if (this->pmax(i) - this->pmin(i) < inner)
157 +       inner = this->pmax(i) - this->pmin(i);
158    }
159  
160  };
161 diff -N -r -u netgen43/libsrc/include/spline2d.hpp netgen-4.3/libsrc/include/spline2d.hpp
162 --- netgen43/libsrc/include/spline2d.hpp        1970-01-01 03:00:00.000000000 +0300
163 +++ netgen-4.3/libsrc/include/spline2d.hpp      2004-03-30 16:02:24.000000000 +0400
164 @@ -0,0 +1 @@
165 +#include "../geom2d/spline2d.hpp"
166 diff -N -r -u netgen43/libsrc/include/splinegeometry2.hpp netgen-4.3/libsrc/include/splinegeometry2.hpp
167 --- netgen43/libsrc/include/splinegeometry2.hpp 1970-01-01 03:00:00.000000000 +0300
168 +++ netgen-4.3/libsrc/include/splinegeometry2.hpp       2004-03-30 16:02:24.000000000 +0400
169 @@ -0,0 +1 @@
170 +#include "../geom2d/splinegeometry2.hpp"
171 diff -N -r -u netgen43/libsrc/interface/Makefile netgen-4.3/libsrc/interface/Makefile
172 --- netgen43/libsrc/interface/Makefile  2003-05-07 18:01:43.000000000 +0400
173 +++ netgen-4.3/libsrc/interface/Makefile        2004-03-30 16:02:24.000000000 +0400
174 @@ -1,4 +1,4 @@
175 -src = nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp readuser.cpp importsolution.cpp
176 +src = writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp readuser.cpp importsolution.cpp nglib.cpp ngnewdelete.cpp
177  #
178  lib = nginterface
179  libpath = libsrc/interface
180 diff -N -r -u netgen43/libsrc/interface/nglib.cpp netgen-4.3/libsrc/interface/nglib.cpp
181 --- netgen43/libsrc/interface/nglib.cpp 2003-05-07 18:01:43.000000000 +0400
182 +++ netgen-4.3/libsrc/interface/nglib.cpp       2004-03-30 16:02:24.000000000 +0400
183 @@ -23,6 +23,20 @@
184  
185  #include "nglib.h"
186  
187 +namespace netgen
188 +{
189 +  char geomfilename [100];
190 +
191 +  //Destination for messages, errors, ...
192 +  void Ng_PrintDest(const char * s)
193 +  {
194 +    (*mycout) << s << flush;
195 +  }
196 +
197 +#include <spline2d.hpp>
198 +#include <splinegeometry2.hpp>
199 +}
200 +
201  using namespace netgen;
202  
203  // constants and types:
204 @@ -171,8 +185,6 @@
205  // CSG Geometry
206  
207  // FlexLexer * lexer;
208 -char geomfilename [100];
209 -
210  
211  // 2D Meshing Functions:
212  
213 @@ -362,7 +374,18 @@
214           cout << "e(" << readedges.Get(i) << "," << readedges.Get(i+1) << ")" << endl;
215         }
216        */
217 -      geo->AddEdges(readedges);
218 +
219 +      ARRAY< Point<3> > readedges1;
220 +
221 +      for (i = 1; i <= readedges.Size(); i++)
222 +       {
223 +         Point3d readedgesData = readedges.Get(i);
224 +         Point <3> readedges1Data = Point<3>(readedgesData.X(),readedgesData.Y(),readedgesData.Z());
225 +
226 +         readedges1.Append(readedges1Data);
227 +       }
228 +
229 +      geo->AddEdges(readedges1);
230      }
231  
232    if (geo->GetStatus() == STLTopology::STL_GOOD || geo->GetStatus() == STLTopology::STL_WARNING) return NG_OK;
233 @@ -472,7 +495,14 @@
234      n = Vec3d(nv[0],nv[1],nv[2]);
235    }
236  
237 -  readtrias.Append(STLReadTriangle(apts,n));
238 +  Point<3> apts1[3];
239 +  apts1[0] = Point<3>(p1[0],p1[1],p1[2]);
240 +  apts1[1] = Point<3>(p2[0],p2[1],p2[2]);
241 +  apts1[2] = Point<3>(p3[0],p3[1],p3[2]);
242 +
243 +  Vec<3> n1 = Vec<3>(n.X(),n.Y(),n.Z());
244 +
245 +  readtrias.Append(STLReadTriangle(apts1,n1));
246  }
247  
248    // add (optional) edges:
249 @@ -487,30 +517,29 @@
250  
251  // compatibility functions:
252  
253 -void MyError (const char * ch)
254 +void netgen::MyError (const char * ch)
255  {
256    cerr << ch;
257  }
258  
259 -//Destination for messages, errors, ...
260 -void Ng_PrintDest(const char * s)
261 -{
262 -  (*mycout) << s << flush;
263 -}
264 -
265 -
266 -double GetTime ()
267 +double netgen::GetTime ()
268  {
269    return 0;
270  }
271  
272 -void ResetTime ()
273 +void netgen::ResetTime ()
274  {
275    ;
276  }
277  
278 -void MyBeep (int i)
279 +void netgen::MyBeep (int i)
280  {
281    ;
282  }
283  
284 +void MeshFromSpline2D (SplineGeometry2d & geometry,
285 +                      Mesh *& mesh, 
286 +                      MeshingParameters & mp)
287 +{
288 +  MeshFromSpline2D (geometry, mesh,  mp);
289 +}
290 diff -N -r -u netgen43/libsrc/makefile.mach.LINUX netgen-4.3/libsrc/makefile.mach.LINUX
291 --- netgen43/libsrc/makefile.mach.LINUX 2003-05-07 18:01:43.000000000 +0400
292 +++ netgen-4.3/libsrc/makefile.mach.LINUX       2004-03-30 16:02:24.000000000 +0400
293 @@ -14,7 +14,8 @@
294  #
295  CFLAGS2 =
296  # pg stands for profiling - also in linkflags2
297 -CPLUSPLUSFLAGS2 =  -O2 -I/usr/X11R6/include -DLINUX -DOPENGL
298 +#CPLUSPLUSFLAGS2 =  -O2 -I/usr/X11R6/include -DLINUX -DOPENGL
299 +CPLUSPLUSFLAGS2 =  -O2 -I/usr/X11R6/include -DLINUX
300  # -fomit-frame-pointer
301  # -ffast-math
302  #
303 diff -N -r -u netgen43/libsrc/meshing/improve2.cpp netgen-4.3/libsrc/meshing/improve2.cpp
304 --- netgen43/libsrc/meshing/improve2.cpp        2003-05-07 18:01:43.000000000 +0400
305 +++ netgen-4.3/libsrc/meshing/improve2.cpp      2004-03-30 16:02:24.000000000 +0400
306 @@ -3,7 +3,7 @@
307  #include "meshing.hpp"
308  #include <opti.hpp>
309  
310 -#include <visual.hpp>
311 +/*#include <visual.hpp>*/
312  
313  
314  namespace netgen
315 diff -N -r -u netgen43/libsrc/meshing/meshing2.cpp netgen-4.3/libsrc/meshing/meshing2.cpp
316 --- netgen43/libsrc/meshing/meshing2.cpp        2003-05-07 18:01:43.000000000 +0400
317 +++ netgen-4.3/libsrc/meshing/meshing2.cpp      2004-03-30 16:02:24.000000000 +0400
318 @@ -1785,7 +1785,7 @@
319  
320  
321  #else
322 -void glrender (int wait)
323 +void netgen::glrender (int wait)
324  {
325    ;
326  } 
327 diff -N -r -u netgen43/libsrc/visualization/stlmeshing.cpp netgen-4.3/libsrc/visualization/stlmeshing.cpp
328 --- netgen43/libsrc/visualization/stlmeshing.cpp        2003-05-07 18:01:43.000000000 +0400
329 +++ netgen-4.3/libsrc/visualization/stlmeshing.cpp      2004-03-30 16:02:24.000000000 +0400
330 @@ -5,7 +5,7 @@
331  #include <stlgeom.hpp>
332  
333  #include <meshing.hpp>
334 -#include <visual.hpp>
335 +/*#include <visual.hpp>*/
336  
337  namespace netgen
338  {
339 diff -N -r -u netgen43/Makefile netgen-4.3/Makefile
340 --- netgen43/Makefile   2003-05-07 18:01:43.000000000 +0400
341 +++ netgen-4.3/Makefile 2004-03-30 16:02:24.000000000 +0400
342 @@ -35,7 +35,8 @@
343  .SUFFIXES: .cpp .o
344  #
345  #
346 -CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include  -DOPENGL
347 +#CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include  -DOPENGL
348 +CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include
349  LINKFLAGS1 =   -lGL -lGLU -lX11 -lXext -lXmu
350  #
351  CPLUSPLUSFLAGS = $(CPLUSPLUSFLAGS1) $(CPLUSPLUSFLAGS2) $(CPLUSPLUSFLAGS3)
352 diff -N -r -u netgen43/makeForSalome.sh netgen-4.3/makeForSalome.sh
353 --- netgen43/makeForSalome.sh   1970-01-01 03:00:00.000000000 +0300
354 +++ netgen-4.3/makeForSalome.sh 2004-03-11 16:52:17.000000000 +0300
355 @@ -0,0 +1,26 @@
356 +#! /bin/sh
357 +cp ngtcltk/ngnewdelete.* libsrc/interface/
358 +
359 +MACHINE=LINUX
360 +export MACHINE
361 +make -C libsrc/csg
362 +make -C libsrc/general
363 +make -C libsrc/geom2d
364 +make -C libsrc/gprim
365 +make -C libsrc/interface
366 +make -C libsrc/linalg
367 +make -C libsrc/meshing
368 +make -C libsrc/opti
369 +make -C libsrc/stlgeom
370 +
371 +if [ ! -d install ] ; then
372 +       mkdir install
373 +fi
374 +
375 +cp -r lib install/
376 +
377 +if [ ! -d install/include ] ; then
378 +       mkdir install/include
379 +fi
380 +
381 +cp libsrc/interface/nglib.h install/include