Salome HOME
merge from master
[tools/sat_salome.git] / products / patches / ParaView-4.2.0.patch
1 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/CMakeLists.txt ParaView-4.2.0_SRC.new/CMakeLists.txt
2 --- ParaView-4.2.0_SRC/CMakeLists.txt   2014-09-23 18:46:43.000000000 +0400
3 +++ ParaView-4.2.0_SRC.new/CMakeLists.txt       2014-12-19 15:39:41.000000000 +0300
4 @@ -543,8 +543,8 @@
5  
6    #----------------------------------------------------------------------------------
7    # Set some flags that affect VTK's modules.
8 -  set (VTK_NO_PYTHON_THREADS 1 CACHE INTERNAL
9 -                               "Disable Python Threads support" FORCE)
10 +  set (VTK_NO_PYTHON_THREADS ON CACHE BOOL 
11 +                               "Disable Python Threads support")
12    set(VTK_WRAP_PYTHON ${PARAVIEW_ENABLE_PYTHON}
13      CACHE INTERNAL "Should VTK Python wrapping be built?" FORCE)
14  
15 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Core/vtkPVPythonInformation.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Core/vtkPVPythonInformation.cxx
16 --- ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Core/vtkPVPythonInformation.cxx    2014-09-23 18:46:44.000000000 +0400
17 +++ ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Core/vtkPVPythonInformation.cxx        2014-12-19 15:39:41.000000000 +0300
18 @@ -100,7 +100,9 @@
19  namespace {
20  bool hasModule(const char *module)
21  {
22 +  VTK_PY_GIL_ENSURE
23    vtkSmartPyObject mod(PyImport_ImportModule(module));
24 +  VTK_PY_GIL_RELEASE
25    bool result = mod;
26    return result;
27  }
28 @@ -108,11 +110,13 @@
29  // Returns empty string on error.
30  std::string getModuleAttrAsString(const char *module, const char *attribute)
31  {
32 +  VTK_PY_GIL_ENSURE
33    vtkSmartPyObject mod(PyImport_ImportModule(module));
34    if (!mod)
35      {
36      std::ostringstream result;
37      result << "(module '" << module << "' not found)";
38 +    VTK_PY_GIL_RELEASE
39      return result.str();
40      }
41  
42 @@ -122,11 +126,13 @@
43      std::ostringstream result;
44      result << "('" << module << "' module found, missing '" << attribute
45             << "' attribute)";
46 +    VTK_PY_GIL_RELEASE
47      return result.str();
48      }
49  
50    std::string result = PyBytes_AsString(attr);
51  
52 +  VTK_PY_GIL_RELEASE
53    return result;
54  }
55  
56 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Core/vtkSession.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Core/vtkSession.cxx
57 --- ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Core/vtkSession.cxx        2014-09-23 18:46:44.000000000 +0400
58 +++ ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Core/vtkSession.cxx    2014-12-19 15:39:41.000000000 +0300
59 @@ -30,13 +30,15 @@
60  //----------------------------------------------------------------------------
61  void vtkSession::Activate()
62  {
63 -  vtkProcessModule::GetProcessModule()->PushActiveSession(this);
64 +  if(vtkProcessModule::GetProcessModule())
65 +    vtkProcessModule::GetProcessModule()->PushActiveSession(this);
66  }
67  
68  //----------------------------------------------------------------------------
69  void vtkSession::DeActivate()
70  {
71 -  vtkProcessModule::GetProcessModule()->PopActiveSession(this);
72 +  if(vtkProcessModule::GetProcessModule())
73 +    vtkProcessModule::GetProcessModule()->PopActiveSession(this);
74  }
75  
76  //----------------------------------------------------------------------------
77 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.cxx
78 --- ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.cxx    2014-09-23 18:46:44.000000000 +0400
79 +++ ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.cxx        2014-12-19 15:39:41.000000000 +0300
80 @@ -172,6 +172,7 @@
81    if (geomFilter)
82      {
83      geomFilter->SetUseOutline(0);
84 +    geomFilter->SetTriangulate(0);
85      geomFilter->SetNonlinearSubdivisionLevel(1);
86      geomFilter->SetPassThroughCellIds(1);
87      geomFilter->SetPassThroughPointIds(1);
88 @@ -236,7 +237,7 @@
89      vtkPVRenderView::MarkAsRedistributable(inInfo, this);
90  
91      // Tell the view if this representation needs ordered compositing. We need
92 -    // ordered compositing when rendering translucent geometry. 
93 +    // ordered compositing when rendering translucent geometry.
94      if (this->Actor->HasTranslucentPolygonalGeometry())
95        {
96        // We need to extend this condition to consider translucent LUTs once we
97 @@ -270,7 +271,7 @@
98          this->LODOutlineFilter->Update();
99          // Pass along the LOD geometry to the view so that it can deliver it to
100          // the rendering node as and when needed.
101 -        vtkPVRenderView::SetPieceLOD(inInfo, this, 
102 +        vtkPVRenderView::SetPieceLOD(inInfo, this,
103            this->LODOutlineFilter->GetOutputDataObject(0));
104          }
105        else
106 @@ -290,7 +291,7 @@
107  
108          // Pass along the LOD geometry to the view so that it can deliver it to
109          // the rendering node as and when needed.
110 -        vtkPVRenderView::SetPieceLOD(inInfo, this, 
111 +        vtkPVRenderView::SetPieceLOD(inInfo, this,
112            this->Decimator->GetOutputDataObject(0));
113          }
114        }
115 @@ -780,6 +781,19 @@
116  }
117  
118  //----------------------------------------------------------------------------
119 +void vtkGeometryRepresentation::SetTriangulate(int val)
120 +{
121 +  if (vtkPVGeometryFilter::SafeDownCast(this->GeometryFilter))
122 +    {
123 +    vtkPVGeometryFilter::SafeDownCast(this->GeometryFilter)->SetTriangulate(val);
124 +    }
125 +
126 +  // since geometry filter needs to execute, we need to mark the representation
127 +  // modified.
128 +  this->MarkModified();
129 +}
130 +
131 +//----------------------------------------------------------------------------
132  void vtkGeometryRepresentation::SetNonlinearSubdivisionLevel(int val)
133  {
134    if (vtkPVGeometryFilter::SafeDownCast(this->GeometryFilter))
135 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.h ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.h
136 --- ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.h      2014-09-23 18:46:44.000000000 +0400
137 +++ ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.h  2014-12-19 15:39:41.000000000 +0300
138 @@ -19,7 +19,7 @@
139  // It handles non-polygonal datasets by extracting external surfaces. One can
140  // use this representation to show surface/wireframe/points/surface-with-edges.
141  // .SECTION Thanks
142 -// The addition of a transformation matrix was supported by CEA/DIF 
143 +// The addition of a transformation matrix was supported by CEA/DIF
144  // Commissariat a l'Energie Atomique, Centre DAM Ile-De-France, Arpajon, France.
145  
146  #ifndef __vtkGeometryRepresentation_h
147 @@ -109,7 +109,7 @@
148    // Description:
149    // Returns true if this class would like to get ghost-cells if available for
150    // the connection whose information object is passed as the argument.
151 -  static bool DoRequestGhostCells(vtkInformation* information); 
152 +  static bool DoRequestGhostCells(vtkInformation* information);
153  
154    // Description:
155    // Representations that use geometry representation as the internal
156 @@ -122,6 +122,7 @@
157    //***************************************************************************
158    // Forwarded to vtkPVGeometryFilter
159    virtual void SetUseOutline(int);
160 +  void SetTriangulate(int);
161    void SetNonlinearSubdivisionLevel(int);
162  
163    //***************************************************************************
164 @@ -145,7 +146,7 @@
165    virtual void SetPosition(double, double, double);
166    virtual void SetScale(double, double, double);
167    virtual void SetTexture(vtkTexture*);
168 -  virtual void SetUserTransform(const double[16]); 
169 +  virtual void SetUserTransform(const double[16]);
170  
171    //***************************************************************************
172    // Forwarded to Mapper and LODMapper.
173 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx
174 --- ParaView-4.2.0_SRC/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx   2014-09-23 18:46:44.000000000 +0400
175 +++ ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx       2014-12-19 15:39:41.000000000 +0300
176 @@ -69,6 +69,7 @@
177  #ifdef PARAVIEW_ENABLE_PYTHON
178    // ensure Python interpreter is initialized.
179    vtkPythonInterpreter::Initialize();
180 +  VTK_PY_GIL_ENSURE
181    this->Internals->TraceModule.TakeReference(PyImport_ImportModule("paraview.smtrace"));
182    if (!this->Internals->TraceModule)
183      {
184 @@ -92,6 +93,7 @@
185        this->Internals->CreateItemFunction.TakeReference(NULL);
186        }
187      }
188 +  VTK_PY_GIL_RELEASE
189  #endif
190  }
191  
192 @@ -115,12 +117,15 @@
193  
194  #ifdef PARAVIEW_ENABLE_PYTHON
195    vtkPythonInterpreter::Initialize();
196 +  VTK_PY_GIL_ENSURE
197    try
198      {
199 +
200      vtkSmartPyObject module(PyImport_ImportModule("paraview.smstate"));
201      if (!module || PyErr_Occurred())
202        {
203        vtkGenericWarningMacro("Failed to import paraview.smstate module.");
204 +      VTK_PY_GIL_RELEASE
205        throw 1;
206        }
207  
208 @@ -132,9 +137,12 @@
209      if (!result || PyErr_Occurred())
210        {
211        vtkGenericWarningMacro("Failed to generate state.");
212 +      VTK_PY_GIL_RELEASE
213        throw 1;
214        }
215 -    return vtkStdString(PyString_AsString(result));
216 +    vtkStdString s(PyString_AsString(result));
217 +    VTK_PY_GIL_RELEASE
218 +    return s;
219      }
220    catch (int)
221      {
222 @@ -144,6 +152,7 @@
223        PyErr_Clear();
224        }
225      }
226 +  VTK_PY_GIL_RELEASE
227  #endif
228    (void)propertiesToTraceOnCreate;
229    (void)skipHiddenRepresentations;
230 @@ -164,9 +173,11 @@
231        }
232      else
233        {
234 +      VTK_PY_GIL_ENSURE
235        vtkSmartPyObject _start_trace_internal(
236          PyObject_CallMethod(vtkSMTrace::ActiveTracer->GetTraceModule(),
237            const_cast<char*>("_start_trace_internal"), NULL));
238 +      VTK_PY_GIL_RELEASE
239        vtkSMTrace::ActiveTracer->CheckForError();
240        }
241  #endif
242 @@ -192,6 +203,7 @@
243    vtkSMTrace::ActiveTracer = NULL;
244  
245  #ifdef PARAVIEW_ENABLE_PYTHON
246 +  VTK_PY_GIL_ENSURE
247    vtkSmartPyObject _stop_trace_internal(
248      PyObject_CallMethod(active->GetTraceModule(), const_cast<char*>("_stop_trace_internal"), NULL));
249    if (active->CheckForError() == false)
250 @@ -199,14 +211,18 @@
251      // no error.
252      if (Py_None != _stop_trace_internal.GetPointer() && _stop_trace_internal.GetPointer() != NULL)
253        {
254 -      return vtkStdString(PyString_AsString(_stop_trace_internal));
255 +       vtkStdString s(PyString_AsString(_stop_trace_internal));
256 +       VTK_PY_GIL_RELEASE
257 +       return s;
258        }
259      else
260        {
261        vtkGenericWarningMacro("Empty trace returned!!!");
262 +      VTK_PY_GIL_RELEASE
263        return vtkStdString();
264        }
265      }
266 +  VTK_PY_GIL_RELEASE
267  #endif
268    return vtkStdString();
269  }
270 @@ -223,13 +239,17 @@
271  
272  #ifdef PARAVIEW_ENABLE_PYTHON
273    vtkSMTrace* active = vtkSMTrace::ActiveTracer;
274 +  VTK_PY_GIL_ENSURE
275    vtkSmartPyObject get_current_trace_output(
276      PyObject_CallMethod(active->GetTraceModule(), const_cast<char*>("get_current_trace_output"), NULL));
277    if (active->CheckForError() == false && get_current_trace_output)
278      {
279      // no error.
280 -    return vtkStdString(PyString_AsString(get_current_trace_output));
281 +    vtkStdString s(PyString_AsString(get_current_trace_output));
282 +    VTK_PY_GIL_RELEASE
283 +    return s;
284      }
285 +  VTK_PY_GIL_RELEASE
286  #endif
287    return vtkStdString();
288  }
289 @@ -256,6 +276,7 @@
290  bool vtkSMTrace::CheckForError()
291  {
292  #ifdef PARAVIEW_ENABLE_PYTHON
293 +  VTK_PY_GIL_ENSURE
294    PyObject *exception = PyErr_Occurred();
295    if (exception)
296      {
297 @@ -264,12 +285,15 @@
298        // catch Untraceable exceptions. We can log them when debugging is
299        // enabled.
300        PyErr_Clear();
301 +      VTK_PY_GIL_RELEASE
302        return false;
303        }
304      PyErr_Print();
305      PyErr_Clear();
306 +    VTK_PY_GIL_RELEASE
307      return true;
308      }
309 +  VTK_PY_GIL_RELEASE
310  #endif
311    return false;
312  }
313 @@ -336,6 +360,7 @@
314    if (vtkSMTrace::GetActiveTracer())
315      {
316  #ifdef PARAVIEW_ENABLE_PYTHON
317 +    VTK_PY_GIL_ENSURE
318      vtkSmartPyObject keyObj(PyString_FromString(key));
319      vtkSmartPyObject valObj(vtkPythonUtil::GetObjectFromPointer(val));
320      assert(valObj && keyObj);
321 @@ -343,6 +368,7 @@
322      int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj);
323      (void)ret;
324      assert(ret == 0);
325 +    VTK_PY_GIL_RELEASE
326  #endif
327      }
328    (void)key;
329 @@ -358,6 +384,7 @@
330    if (vtkSMTrace::GetActiveTracer())
331      {
332  #ifdef PARAVIEW_ENABLE_PYTHON
333 +    VTK_PY_GIL_ENSURE
334      vtkSmartPyObject keyObj(PyString_FromString(key));
335      vtkSmartPyObject valObj;
336      if (val == NULL)
337 @@ -374,6 +401,7 @@
338      int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj);
339      (void)ret;
340      assert(ret == 0);
341 +    VTK_PY_GIL_RELEASE
342  #endif
343      }
344    (void)key;
345 @@ -389,6 +417,7 @@
346    if (vtkSMTrace::GetActiveTracer())
347      {
348  #ifdef PARAVIEW_ENABLE_PYTHON
349 +    VTK_PY_GIL_ENSURE
350      vtkSmartPyObject keyObj(PyString_FromString(key));
351      vtkSmartPyObject valObj(PyInt_FromLong(val));
352      assert(keyObj && valObj);
353 @@ -396,6 +425,7 @@
354      int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj);
355      (void)ret;
356      assert(ret == 0);
357 +    VTK_PY_GIL_RELEASE
358  #endif
359      }
360    (void)key;
361 @@ -411,6 +441,7 @@
362    if (vtkSMTrace::GetActiveTracer())
363      {
364  #ifdef PARAVIEW_ENABLE_PYTHON
365 +    VTK_PY_GIL_ENSURE
366      vtkSmartPyObject keyObj(PyString_FromString(key));
367      vtkSmartPyObject valObj(PyFloat_FromDouble(val));
368      assert(keyObj && valObj);
369 @@ -418,6 +449,7 @@
370      int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj);
371      (void)ret;
372      assert(ret == 0);
373 +    VTK_PY_GIL_RELEASE
374  #endif
375      }
376    (void)key;
377 @@ -432,6 +464,7 @@
378    if (vtkSMTrace::GetActiveTracer())
379      {
380  #ifdef PARAVIEW_ENABLE_PYTHON
381 +    VTK_PY_GIL_ENSURE
382      vtkSmartPyObject keyObj(PyString_FromString(key));
383      vtkSmartPyObject valObj(PyBool_FromLong(val? 1 : 0));
384      assert(keyObj && valObj);
385 @@ -439,6 +472,7 @@
386      int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj);
387      (void)ret;
388      assert(ret == 0);
389 +    VTK_PY_GIL_RELEASE
390  #endif
391      }
392    (void)key;
393 @@ -452,11 +486,13 @@
394    if (vtkSMTrace::GetActiveTracer())
395      {
396  #ifdef PARAVIEW_ENABLE_PYTHON
397 +    VTK_PY_GIL_ENSURE
398      vtkSmartPyObject valObj(vtkPythonUtil::GetObjectFromPointer(val));
399      assert(valObj);
400      int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj);
401      (void)ret;
402      assert(ret == 0);
403 +    VTK_PY_GIL_RELEASE
404  #endif
405      }
406    (void)val;
407 @@ -470,11 +506,13 @@
408    if (vtkSMTrace::GetActiveTracer())
409      {
410  #ifdef PARAVIEW_ENABLE_PYTHON
411 +    VTK_PY_GIL_ENSURE
412      vtkSmartPyObject valObj(PyString_FromString(val));
413      assert(valObj);
414      int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj);
415      (void)ret;
416      assert(ret == 0);
417 +    VTK_PY_GIL_RELEASE
418  #endif
419      }
420    (void)val;
421 @@ -487,11 +525,13 @@
422    if (vtkSMTrace::GetActiveTracer())
423      {
424  #ifdef PARAVIEW_ENABLE_PYTHON
425 +    VTK_PY_GIL_ENSURE
426      vtkSmartPyObject valObj(PyInt_FromLong(val));
427      assert(valObj);
428      int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj);
429      (void)ret;
430      assert(ret == 0);
431 +    VTK_PY_GIL_RELEASE
432  #endif
433      }
434    (void)val;
435 @@ -504,11 +544,13 @@
436    if (vtkSMTrace::GetActiveTracer())
437      {
438  #ifdef PARAVIEW_ENABLE_PYTHON
439 +    VTK_PY_GIL_ENSURE
440      vtkSmartPyObject valObj(PyFloat_FromDouble(val));
441      assert(valObj);
442      int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj);
443      (void)ret;
444      assert(ret == 0);
445 +    VTK_PY_GIL_RELEASE
446  #endif
447      }
448    (void)val;
449 @@ -521,11 +563,13 @@
450    if (vtkSMTrace::GetActiveTracer())
451      {
452  #ifdef PARAVIEW_ENABLE_PYTHON
453 +    VTK_PY_GIL_ENSURE
454      vtkSmartPyObject valObj(PyBool_FromLong(val? 1 : 0));
455      assert(valObj);
456      int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj);
457      (void)ret;
458      assert(ret == 0);
459 +    VTK_PY_GIL_RELEASE
460  #endif
461      }
462    (void)val;
463 @@ -557,9 +601,11 @@
464    vtkSMTrace* tracer = vtkSMTrace::GetActiveTracer();
465    if (tracer && this->Internals->PyItem)
466      {
467 +    VTK_PY_GIL_ENSURE
468      vtkSmartPyObject reply(
469        PyObject_CallMethod(this->Internals->PyItem,
470          const_cast<char*>("finalize"), NULL));
471 +    VTK_PY_GIL_RELEASE
472      tracer->CheckForError();
473      tracer->InvokeEvent(vtkCommand::UpdateEvent);
474      }
475 @@ -583,6 +629,7 @@
476    if (vtkSMTrace* tracer = vtkSMTrace::GetActiveTracer())
477      {
478  #ifdef PARAVIEW_ENABLE_PYTHON
479 +    VTK_PY_GIL_ENSURE
480      assert(tracer->GetTraceModule());
481      assert(tracer->GetCreateItemFunction());
482  
483 @@ -613,6 +660,7 @@
484      this->Internals->PyItem.TakeReference(
485        PyObject_Call(tracer->GetCreateItemFunction(), args, NULL));
486      tracer->CheckForError();
487 +    VTK_PY_GIL_RELEASE
488  #endif
489      }
490    (void)arguments;
491 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx
492 --- ParaView-4.2.0_SRC/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx      2014-09-23 18:46:44.000000000 +0400
493 +++ ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx  2014-12-19 15:39:41.000000000 +0300
494 @@ -276,7 +276,7 @@
495  {
496    if (!info)
497      {
498 -    vtkWarningMacro("Could not determine array range.");
499 +    // vtkWarningMacro("Could not determine array range.");
500      return false;
501      }
502  
503 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ServerManager/SMApplication/Resources/views_and_representations.xml ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/SMApplication/Resources/views_and_representations.xml
504 --- ParaView-4.2.0_SRC/ParaViewCore/ServerManager/SMApplication/Resources/views_and_representations.xml 2014-09-23 18:46:44.000000000 +0400
505 +++ ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/SMApplication/Resources/views_and_representations.xml     2014-12-19 15:39:41.000000000 +0300
506 @@ -2044,16 +2044,14 @@
507        <IntVectorProperty command="SetStereoRender"
508                           default_values="0"
509                           name="StereoRender"
510 -                         number_of_elements="1"
511 -                         is_internal="1">
512 +                         number_of_elements="1">
513          <BooleanDomain name="bool" />
514        </IntVectorProperty>
515        <IntVectorProperty command="SetStereoType"
516                           default_values="3"
517                           name="StereoType"
518                           panel_visibility="never"
519 -                         number_of_elements="1"
520 -                         is_internal="1">
521 +                         number_of_elements="1">
522          <EnumerationDomain name="enum">
523            <Entry text="Crystal Eyes"
524                   value="1" />
525 @@ -3139,6 +3137,8 @@
526                        panel_visibility="advanced" />
527              <Property name="UserTransform"
528                        panel_visibility="never" />
529 +            <Property name="Triangulate"
530 +                      panel_visibility="advanced" />
531              <Property name="NonlinearSubdivisionLevel"
532                        panel_visibility="advanced" />
533              <Property name="BlockVisibility"
534 @@ -8229,6 +8229,15 @@
535            <!--<Entry value="2" text="Phong" />-->
536          </EnumerationDomain>
537        </IntVectorProperty>
538 +      <IntVectorProperty command="SetTriangulate"
539 +                         default_values="0"
540 +                         name="Triangulate"
541 +                         number_of_elements="1">
542 +        <BooleanDomain name="bool" />
543 +        <Documentation>Triangulate the geometry internally to avoid rendering
544 +        issues of non-convex polygons. This feature has a processing and memory
545 +        cost, it should be enabled only when needed.</Documentation>
546 +      </IntVectorProperty>
547        <IntVectorProperty command="SetNonlinearSubdivisionLevel"
548                           default_values="1"
549                           name="NonlinearSubdivisionLevel"
550 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/VTKExtensions/Default/vtkPVImageReader.h ParaView-4.2.0_SRC.new/ParaViewCore/VTKExtensions/Default/vtkPVImageReader.h
551 --- ParaView-4.2.0_SRC/ParaViewCore/VTKExtensions/Default/vtkPVImageReader.h    2014-09-23 18:46:44.000000000 +0400
552 +++ ParaView-4.2.0_SRC.new/ParaViewCore/VTKExtensions/Default/vtkPVImageReader.h        2014-12-19 15:39:41.000000000 +0300
553 @@ -19,27 +19,15 @@
554  
555  #include "vtkPVVTKExtensionsDefaultModule.h" //needed for exports
556  
557 -#ifdef PARAVIEW_USE_MPI
558 -#include "vtkMPIImageReader.h"
559 -#else
560  #include "vtkImageReader.h"
561 -#endif
562  
563 -class VTKPVVTKEXTENSIONSDEFAULT_EXPORT vtkPVImageReader : public
564 -#ifdef PARAVIEW_USE_MPI
565 -vtkMPIImageReader
566 -#else
567 -vtkImageReader
568 -#endif
569 +class VTKPVVTKEXTENSIONSDEFAULT_EXPORT vtkPVImageReader : public vtkImageReader
570  {
571  public:
572    static vtkPVImageReader* New();
573  
574 -#ifdef PARAVIEW_USE_MPI
575 -  vtkTypeMacro(vtkPVImageReader, vtkMPIImageReader);
576 -#else
577 +
578    vtkTypeMacro(vtkPVImageReader, vtkImageReader);
579 -#endif
580  
581    void PrintSelf(ostream& os, vtkIndent indent);
582  
583 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.cxx ParaView-4.2.0_SRC.new/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.cxx
584 --- ParaView-4.2.0_SRC/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.cxx     2014-09-23 18:46:44.000000000 +0400
585 +++ ParaView-4.2.0_SRC.new/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.cxx 2014-12-19 15:39:41.000000000 +0300
586 @@ -64,6 +64,7 @@
587  #include "vtkStructuredGrid.h"
588  #include "vtkStructuredGridOutlineFilter.h"
589  #include "vtkTimerLog.h"
590 +#include "vtkTriangleFilter.h"
591  #include "vtkUniformGrid.h"
592  #include "vtkUnsignedCharArray.h"
593  #include "vtkUnsignedIntArray.h"
594 @@ -78,8 +79,6 @@
595  #include <set>
596  #include <algorithm>
597  
598 -#define VTK_CREATE(type, name) \
599 -  vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
600  
601  vtkStandardNewMacro(vtkPVGeometryFilter);
602  vtkCxxSetObjectMacro(vtkPVGeometryFilter, Controller, vtkMultiProcessController);
603 @@ -149,6 +148,7 @@
604    this->UseOutline = 1;
605    this->UseStrips = 0;
606    this->GenerateCellNormals = 1;
607 +  this->Triangulate = false;
608    this->NonlinearSubdivisionLevel = 1;
609  
610    this->DataSetSurfaceFilter = vtkDataSetSurfaceFilter::New();
611 @@ -1348,8 +1348,8 @@
612      {
613      this->OutlineFlag = 0;
614  
615 -    bool handleSubdivision = false;
616 -    if (this->NonlinearSubdivisionLevel > 0)
617 +    bool handleSubdivision = (this->Triangulate != 0);
618 +    if (!handleSubdivision && (this->NonlinearSubdivisionLevel > 0))
619        {
620        // Check to see if the data actually has nonlinear cells.  Handling
621        // nonlinear cells adds unnecessary work if we only have linear cells.
622 @@ -1445,6 +1445,16 @@
623        this->DataSetSurfaceFilter->UnstructuredGridExecute(input, output, updateghostlevel);
624        }
625  
626 +    if (this->Triangulate && (output->GetNumberOfPolys() > 0))
627 +      {
628 +      // Triangulate the polygonal mesh if requested to avoid rendering
629 +      // issues of non-convex polygons.
630 +      vtkNew<vtkTriangleFilter> triangleFilter;
631 +      triangleFilter->SetInputData(output);
632 +      triangleFilter->Update();
633 +      output->ShallowCopy(triangleFilter->GetOutput());
634 +      }
635 +
636      if (handleSubdivision)
637        {
638        // Restore state of DataSetSurfaceFilter.
639 @@ -1456,9 +1466,9 @@
640  
641        // Now use vtkPVRecoverGeometryWireframe to create an edge flag attribute
642        // that will cause the wireframe to be rendered correctly.
643 -      VTK_CREATE(vtkPolyData, nextStageInput);
644 +      vtkNew<vtkPolyData> nextStageInput;
645        nextStageInput->ShallowCopy(output);  // Yes output is correct.
646 -      this->RecoverWireframeFilter->SetInputData(nextStageInput);
647 +      this->RecoverWireframeFilter->SetInputData(nextStageInput.Get());
648  
649        // Observe the progress of the internal filter.
650        // TODO: Make the consecutive internal filter execution have monotonically
651 @@ -1489,7 +1499,7 @@
652            return;
653            }
654          vtkIdType numPts = polyPtIds2FacePtIds->GetNumberOfTuples();
655 -        VTK_CREATE(vtkIdTypeArray, polyPtIds2OriginalPtIds);
656 +        vtkNew<vtkIdTypeArray> polyPtIds2OriginalPtIds;
657          polyPtIds2OriginalPtIds->SetName("vtkOriginalPointIds");
658          polyPtIds2OriginalPtIds->SetNumberOfComponents(1);
659          polyPtIds2OriginalPtIds->SetNumberOfTuples(numPts);
660 @@ -1503,7 +1513,7 @@
661              }
662            polyPtIds2OriginalPtIds->SetValue(polyPtId, originalPtId);
663            }
664 -        output->GetPointData()->AddArray(polyPtIds2OriginalPtIds);
665 +        output->GetPointData()->AddArray(polyPtIds2OriginalPtIds.Get());
666          }
667        }
668  
669 @@ -1518,7 +1528,7 @@
670  
671  //----------------------------------------------------------------------------
672  void vtkPVGeometryFilter::PolyDataExecute(
673 -  vtkPolyData* input, vtkPolyData* out, int doCommunicate)
674 +  vtkPolyData* input, vtkPolyData* output, int doCommunicate)
675  {
676    if (!this->UseOutline)
677      {
678 @@ -1533,54 +1543,90 @@
679        inCopy->RemoveGhostCells(1);
680        stripper->SetInputData(inCopy);
681        stripper->Update();
682 -      out->CopyStructure(stripper->GetOutput());
683 -      out->GetPointData()->ShallowCopy(stripper->GetOutput()->GetPointData());
684 -      out->GetCellData()->ShallowCopy(stripper->GetOutput()->GetCellData());
685 +      output->CopyStructure(stripper->GetOutput());
686 +      output->GetPointData()->ShallowCopy(stripper->GetOutput()->GetPointData());
687 +      output->GetCellData()->ShallowCopy(stripper->GetOutput()->GetCellData());
688        inCopy->Delete();
689        stripper->Delete();
690        }
691      else
692        {
693 -      out->ShallowCopy(input);
694 +      output->ShallowCopy(input);
695        if (this->PassThroughCellIds)
696          {
697 -        vtkIdTypeArray *originalCellIds = vtkIdTypeArray::New();
698 +        vtkNew<vtkIdTypeArray> originalCellIds;
699          originalCellIds->SetName("vtkOriginalCellIds");
700          originalCellIds->SetNumberOfComponents(1);
701 -        vtkCellData *outputCD = out->GetCellData();
702 -        outputCD->AddArray(originalCellIds);
703 -        vtkIdType numTup = out->GetNumberOfCells();
704 +        vtkNew<vtkIdTypeArray> originalFaceIds;
705 +        originalFaceIds->SetName(vtkPVRecoverGeometryWireframe::ORIGINAL_FACE_IDS());
706 +        originalFaceIds->SetNumberOfComponents(1);
707 +        vtkCellData *outputCD = output->GetCellData();
708 +        outputCD->AddArray(originalCellIds.Get());
709 +        if (this->Triangulate)
710 +          {
711 +          outputCD->AddArray(originalFaceIds.Get());
712 +          }
713 +        vtkIdType numTup = output->GetNumberOfCells();
714          originalCellIds->SetNumberOfValues(numTup);
715 +        originalFaceIds->SetNumberOfValues(numTup);
716          for (vtkIdType cId = 0; cId < numTup; cId++)
717            {
718            originalCellIds->SetValue(cId, cId);
719 +          originalFaceIds->SetValue(cId, cId);
720            }
721 -        originalCellIds->Delete();
722 -        originalCellIds = NULL;
723          }
724        if (this->PassThroughPointIds)
725          {
726 -        vtkIdTypeArray *originalPointIds = vtkIdTypeArray::New();
727 +        vtkNew<vtkIdTypeArray> originalPointIds;
728          originalPointIds->SetName("vtkOriginalPointIds");
729          originalPointIds->SetNumberOfComponents(1);
730 -        vtkPointData *outputPD = out->GetPointData();
731 -        outputPD->AddArray(originalPointIds);
732 -        vtkIdType numTup = out->GetNumberOfPoints();
733 +        vtkPointData *outputPD = output->GetPointData();
734 +        outputPD->AddArray(originalPointIds.Get());
735 +        vtkIdType numTup = output->GetNumberOfPoints();
736          originalPointIds->SetNumberOfValues(numTup);
737          for (vtkIdType pId = 0; pId < numTup; pId++)
738            {
739            originalPointIds->SetValue(pId, pId);
740            }
741 -        originalPointIds->Delete();
742 -        originalPointIds = NULL;
743          }
744 -      out->RemoveGhostCells(1);
745 +
746 +      output->RemoveGhostCells(1);
747 +
748 +      if (this->Triangulate)
749 +        {
750 +        // Triangulate the polygonal mesh.
751 +        vtkNew<vtkTriangleFilter> triangleFilter;
752 +        triangleFilter->SetInputData(output);
753 +        triangleFilter->Update();
754 +
755 +        // Now use vtkPVRecoverGeometryWireframe to create an edge flag attribute
756 +        // that will cause the wireframe to be rendered correctly.
757 +        this->RecoverWireframeFilter->SetInputData(triangleFilter->GetOutput());
758 +
759 +        // Observe the progress of the internal filter.
760 +        // TODO: Make the consecutive internal filter execution have monotonically
761 +        // increasing progress rather than restarting for every internal filter.
762 +        this->RecoverWireframeFilter->AddObserver(
763 +          vtkCommand::ProgressEvent,
764 +          this->InternalProgressObserver);
765 +        this->RecoverWireframeFilter->Update();
766 +        // The internal filter finished.  Remove the observer.
767 +        this->RecoverWireframeFilter->RemoveObserver(
768 +          this->InternalProgressObserver);
769 +
770 +        this->RecoverWireframeFilter->SetInputData(NULL);
771 +
772 +        // Get what should be the final output.
773 +        output->ShallowCopy(this->RecoverWireframeFilter->GetOutput());
774 +
775 +        output->GetCellData()->RemoveArray(vtkPVRecoverGeometryWireframe::ORIGINAL_FACE_IDS());
776 +        }
777        }
778      return;
779      }
780  
781    this->OutlineFlag = 1;
782 -  this->DataSetExecute(input, out, doCommunicate);
783 +  this->DataSetExecute(input, output, doCommunicate);
784  }
785  
786  //----------------------------------------------------------------------------
787 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.h ParaView-4.2.0_SRC.new/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.h
788 --- ParaView-4.2.0_SRC/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.h       2014-09-23 18:46:44.000000000 +0400
789 +++ ParaView-4.2.0_SRC.new/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.h   2014-12-19 15:39:41.000000000 +0300
790 @@ -85,6 +85,13 @@
791    vtkBooleanMacro(GenerateCellNormals, int);
792  
793    // Description:
794 +  // Whether to triangulate mesh for rendering. This parameter avoid
795 +  // rendering issues of non-convex polygons.
796 +  vtkSetMacro(Triangulate, int);
797 +  vtkGetMacro(Triangulate, int);
798 +  vtkBooleanMacro(Triangulate, int);
799 +
800 +  // Description:
801    // Nonlinear faces are approximated with flat polygons.  This parameter
802    // controls how many times to subdivide nonlinear surface cells.  Higher
803    // subdivisions generate closer approximations but take more memory and
804 @@ -101,8 +108,7 @@
805    // Description:
806    // If on, the output polygonal dataset will have a celldata array that
807    // holds the cell index of the original 3D cell that produced each output
808 -  // cell. This is useful for picking. The default is off to conserve
809 -  // memory.
810 +  // cell. This is useful for picking but it takes memory. The default is on.
811    void SetPassThroughCellIds(int);
812    vtkGetMacro(PassThroughCellIds,int);
813    vtkBooleanMacro(PassThroughCellIds,int);
814 @@ -110,8 +116,7 @@
815    // Description:
816    // If on, the output polygonal dataset will have a pointdata array that
817    // holds the point index of the original vertex that produced each output
818 -  // vertex. This is useful for picking. The default is off to conserve
819 -  // memory.
820 +  // vertex. This is useful for picking but it takes memory. The default is on.
821    void SetPassThroughPointIds(int);
822    vtkGetMacro(PassThroughPointIds,int);
823    vtkBooleanMacro(PassThroughPointIds,int);
824 @@ -176,7 +181,7 @@
825    virtual vtkExecutive* CreateDefaultExecutive();
826  
827    // Description:
828 -  // Produce geometry for a block in the dataset. 
829 +  // Produce geometry for a block in the dataset.
830    // This does not handle producing outlines. Call only when this->UseOutline ==
831    // 0; \c extractface mask it is used to determine external faces.
832    void ExecuteAMRBlock(vtkUniformGrid* input,
833 @@ -250,6 +255,7 @@
834    int UseOutline;
835    int UseStrips;
836    int GenerateCellNormals;
837 +  int Triangulate;
838    int NonlinearSubdivisionLevel;
839  
840    vtkMultiProcessController* Controller;
841 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Qt/Components/pqPropertiesPanel.cxx ParaView-4.2.0_SRC.new/Qt/Components/pqPropertiesPanel.cxx
842 --- ParaView-4.2.0_SRC/Qt/Components/pqPropertiesPanel.cxx      2014-09-23 18:46:44.000000000 +0400
843 +++ ParaView-4.2.0_SRC.new/Qt/Components/pqPropertiesPanel.cxx  2014-12-19 15:39:41.000000000 +0300
844 @@ -383,6 +383,14 @@
845    this->Internals->Ui.DisplayButton->setVisible(has_multiples_types && has_display);
846    this->Internals->Ui.ViewButton->setVisible(has_multiples_types && has_view);
847  
848 +  // added to avoid unwanted save restore buttons
849 +  this->Internals->Ui.PropertiesSaveAsDefaults->setVisible(has_source);
850 +  this->Internals->Ui.PropertiesRestoreDefaults->setVisible(has_source);
851 +  this->Internals->Ui.DisplaySaveAsDefaults->setVisible(has_display);
852 +  this->Internals->Ui.DisplayRestoreDefaults->setVisible(has_display);
853 +  this->Internals->Ui.ViewSaveAsDefaults->setVisible(has_view);
854 +  this->Internals->Ui.ViewRestoreDefaults->setVisible(has_view);
855 +  
856    this->updatePanel();
857  }
858  
859 @@ -593,14 +601,15 @@
860  }
861  
862  //-----------------------------------------------------------------------------
863 -void pqPropertiesPanel::updateViewPanel (pqView* _view)
864 +void pqPropertiesPanel::updateViewPanel (pqView* argView)
865  {
866 +  pqView* _view = argView;
867    if ( (this->PanelMode & pqPropertiesPanel::VIEW_PROPERTIES) == 0)
868      {
869      _view = NULL;
870      }
871  
872 -  if (this->Internals->View != _view)
873 +  if (this->Internals->View != argView)
874      {
875      // The view has changed.
876      if (this->Internals->View)
877 @@ -611,8 +620,8 @@
878          delete this->Internals->ViewWidgets;
879          }
880        }
881 -    this->Internals->View = _view;
882 -    emit this->viewChanged(_view);
883 +    this->Internals->View = argView;
884 +    emit this->viewChanged(argView);
885      if (_view)
886        {
887        // create the widgets for this view
888 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Qt/Python/pqPythonShell.cxx ParaView-4.2.0_SRC.new/Qt/Python/pqPythonShell.cxx
889 --- ParaView-4.2.0_SRC/Qt/Python/pqPythonShell.cxx      2014-09-23 18:46:44.000000000 +0400
890 +++ ParaView-4.2.0_SRC.new/Qt/Python/pqPythonShell.cxx  2014-12-19 15:40:01.000000000 +0300
891 @@ -118,6 +118,7 @@
892    /// string list.
893    QStringList getPythonAttributes(const QString& pythonObjectName)
894      {
895 +    VTK_PY_GIL_ENSURE
896      if (this->Interpreter == NULL ||
897        this->Interpreter->GetInteractiveConsoleLocalsPyObject() == NULL)
898        {
899 @@ -191,7 +192,7 @@
900          }
901        Py_DECREF(object);
902        }
903 -
904 +    VTK_PY_GIL_RELEASE
905      return results;
906      }
907  };
908 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Qt/Python/pqPythonSyntaxHighlighter.cxx ParaView-4.2.0_SRC.new/Qt/Python/pqPythonSyntaxHighlighter.cxx
909 --- ParaView-4.2.0_SRC/Qt/Python/pqPythonSyntaxHighlighter.cxx  2014-09-23 18:46:44.000000000 +0400
910 +++ ParaView-4.2.0_SRC.new/Qt/Python/pqPythonSyntaxHighlighter.cxx      2014-12-19 15:39:41.000000000 +0300
911 @@ -65,6 +65,7 @@
912    this->Internals->TextEdit = textEdit;
913    this->Internals->TextEdit->installEventFilter(this);
914    vtkPythonInterpreter::Initialize();
915 +  VTK_PY_GIL_ENSURE
916    this->Internals->PygmentsModule.TakeReference(PyImport_ImportModule("pygments"));
917    if (this->Internals->PygmentsModule && this->Internals->TextEdit != NULL)
918    {
919 @@ -99,6 +100,7 @@
920      this->connect(this->Internals->TextEdit.data(), SIGNAL(textChanged()),
921                    this, SLOT(rehighlightSyntax()));
922    }
923 +  VTK_PY_GIL_RELEASE
924    this->Internals->IsSyntaxHighlighting = false;
925    // Replace tabs with 4 spaces
926    this->Internals->ReplaceTabs = true;
927 @@ -175,10 +177,12 @@
928      }
929      QString leadingWhitespace = text.left(leadingWhiteSpaceLength);
930      QString trailingWhitespace = text.right(trailingWhiteSpaceLength);
931 +    VTK_PY_GIL_ENSURE
932      vtkSmartPyObject args(Py_BuildValue("sOO",text.trimmed().toStdString().c_str(),
933                                         this->Internals->PythonLexer.GetPointer(),this->Internals->HtmlFormatter.GetPointer()));
934      vtkSmartPyObject resultingText(PyObject_Call(this->Internals->HighlightFunction,args,NULL));
935      const char *resultingTextAsCString = PyString_AsString(resultingText);
936 +    VTK_PY_GIL_RELEASE
937      QString pygmentsOutput(resultingTextAsCString);
938      // the first span tag always should follow the pre tag like this; <pre ...><span
939      int startOfPre = pygmentsOutput.indexOf(">",pygmentsOutput.indexOf("<pre"))+1;
940 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Utilities/VisItBridge/databases/Velodyne/VelodyneReader.C ParaView-4.2.0_SRC.new/Utilities/VisItBridge/databases/Velodyne/VelodyneReader.C
941 --- ParaView-4.2.0_SRC/Utilities/VisItBridge/databases/Velodyne/VelodyneReader.C        2014-09-23 18:46:46.000000000 +0400
942 +++ ParaView-4.2.0_SRC.new/Utilities/VisItBridge/databases/Velodyne/VelodyneReader.C    2014-12-19 15:39:41.000000000 +0300
943 @@ -2,7 +2,7 @@
944  // This code was contributed to the VisIt project by Corvid Technologies
945  // on February 10, 2010.
946  //
947 -
948 +#define H5Eset_auto_vers 2
949  #include <string.h>
950  #include <cstdlib>
951  
952 @@ -16,7 +16,6 @@
953  #endif
954  
955  #include <VelodyneReader.h>
956 -
957  #include <visit-hdf5.h>
958  
959  #include <set>
960 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Utilities/VisItBridge/databases/Vs/VsFilter.C ParaView-4.2.0_SRC.new/Utilities/VisItBridge/databases/Vs/VsFilter.C
961 --- ParaView-4.2.0_SRC/Utilities/VisItBridge/databases/Vs/VsFilter.C    2014-09-23 18:46:46.000000000 +0400
962 +++ ParaView-4.2.0_SRC.new/Utilities/VisItBridge/databases/Vs/VsFilter.C        2014-12-19 15:39:41.000000000 +0300
963 @@ -1,3 +1,7 @@
964 +#define H5Gopen_vers 2
965 +#define H5Dopen_vers 2
966 +#define H5Eset_auto_vers 2
967 +#define H5Aiterate_vers 2
968  #include <vtk_hdf5.h>
969  #include <visit-hdf5.h>
970  #if HDF5_VERSION_GE(1,8,1)
971 @@ -146,11 +150,7 @@
972        
973        // Get info of the linked object.
974        H5O_info_t objinfo;
975 -#ifndef H5_USE_16_API
976        hid_t obj_id = H5Oopen(locId, name, H5P_DEFAULT);
977 -#else
978 -      hid_t obj_id = H5Oopen(locId, name);        
979 -#endif
980        
981        if (obj_id < 0) {
982          VsLog::errorLog() <<"VsFilter::visitLinks() - unable to get id for external object " <<name <<std::endl;
983 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Utilities/VisItBridge/databases/Vs/VsH5File.C ParaView-4.2.0_SRC.new/Utilities/VisItBridge/databases/Vs/VsH5File.C
984 --- ParaView-4.2.0_SRC/Utilities/VisItBridge/databases/Vs/VsH5File.C    2014-09-23 18:46:46.000000000 +0400
985 +++ ParaView-4.2.0_SRC.new/Utilities/VisItBridge/databases/Vs/VsH5File.C        2014-12-19 15:39:41.000000000 +0300
986 @@ -4,7 +4,7 @@
987   *  Created on: Apr 27, 2010
988   *      Author: mdurant
989   */
990 -
991 +#define H5Eset_auto_vers 2
992  #include "VsH5File.h"
993  #include "VsLog.h"
994  #include "VsFilter.h"
995 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/CMake/vtkModuleTop.cmake ParaView-4.2.0_SRC.new/VTK/CMake/vtkModuleTop.cmake
996 --- ParaView-4.2.0_SRC/VTK/CMake/vtkModuleTop.cmake     2014-09-23 18:47:10.000000000 +0400
997 +++ ParaView-4.2.0_SRC.new/VTK/CMake/vtkModuleTop.cmake 2014-12-19 15:39:41.000000000 +0300
998 @@ -476,6 +476,7 @@
999    get_property(VTK_TARGETS GLOBAL PROPERTY VTK_TARGETS)
1000    if(VTK_TARGETS)
1001      install(EXPORT ${VTK_INSTALL_EXPORT_NAME}  DESTINATION ${VTK_INSTALL_PACKAGE_DIR})
1002 +    install(EXPORT ${VTK_INSTALL_EXPORT_NAME}  DESTINATION ${VTK_INSTALL_PACKAGE_DIR} FILE VTKTargets.cmake)
1003    else()
1004      set(CMAKE_CONFIGURABLE_FILE_CONTENT "# No targets!")
1005      configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in
1006 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx ParaView-4.2.0_SRC.new/VTK/Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx
1007 --- ParaView-4.2.0_SRC/VTK/Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx      2014-09-23 18:47:11.000000000 +0400
1008 +++ ParaView-4.2.0_SRC.new/VTK/Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx  2014-12-19 15:39:41.000000000 +0300
1009 @@ -48,7 +48,7 @@
1010  //----------------------------------------------------------------------------
1011  vtkMatplotlibMathTextUtilities::Availablity
1012  vtkMatplotlibMathTextUtilities::MPLMathTextAvailable =
1013 -vtkMatplotlibMathTextUtilities::NOT_TESTED;
1014 +vtkMatplotlibMathTextUtilities::UNAVAILABLE;
1015  
1016  // A macro that is used in New() to print warnings if VTK_MATPLOTLIB_DEBUG
1017  // is defined in the environment. Use vtkGenericWarningMacro to allow this to
1018 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/ThirdParty/verdict/vtkverdict/V_TetMetric.cpp ParaView-4.2.0_SRC.new/VTK/ThirdParty/verdict/vtkverdict/V_TetMetric.cpp
1019 --- ParaView-4.2.0_SRC/VTK/ThirdParty/verdict/vtkverdict/V_TetMetric.cpp        2014-09-23 18:47:11.000000000 +0400
1020 +++ ParaView-4.2.0_SRC.new/VTK/ThirdParty/verdict/vtkverdict/V_TetMetric.cpp    2014-12-19 15:39:41.000000000 +0300
1021 @@ -373,7 +373,7 @@
1022            coordinates[3][1] - coordinates[0][1],
1023            coordinates[3][2] - coordinates[0][2] );
1024    
1025 -  double detTet = ab % ( ac * ad );
1026 +  double detTet = fabs( ab % ( ac * ad ) );
1027    
1028    if( detTet < VERDICT_DBL_MIN ) 
1029      return (double)VERDICT_DBL_MAX;
1030 @@ -413,7 +413,7 @@
1031    D = bd.length();
1032    
1033    double aspect_ratio;
1034 -  aspect_ratio = normal_coeff * hm * ( A + B + C + D ) / fabs( detTet );
1035 +  aspect_ratio = normal_coeff * hm * ( A + B + C + D ) / detTet;
1036    
1037    if( aspect_ratio > 0 )
1038      return (double) VERDICT_MIN( aspect_ratio, VERDICT_DBL_MAX );
1039 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Utilities/Python/vtkPython.h ParaView-4.2.0_SRC.new/VTK/Utilities/Python/vtkPython.h
1040 --- ParaView-4.2.0_SRC/VTK/Utilities/Python/vtkPython.h 2014-09-23 18:47:11.000000000 +0400
1041 +++ ParaView-4.2.0_SRC.new/VTK/Utilities/Python/vtkPython.h     2014-12-19 15:39:41.000000000 +0300
1042 @@ -87,4 +87,14 @@
1043  #error "Python.h is different version from what VTK was configured with!!"
1044  #endif
1045  
1046 +#ifdef VTK_NO_PYTHON_THREADS
1047 +#  define VTK_PY_GIL_ENSURE
1048 +#  define VTK_PY_GIL_RELEASE
1049 +#else
1050 +#  define VTK_PY_GIL_ENSURE  PyGILState_STATE _gstate_avoid_clash = PyGILState_Ensure();
1051 +#  define VTK_PY_GIL_RELEASE PyGILState_Release(_gstate_avoid_clash);
1052 +#
1053 +#endif
1054 +
1055 +
1056  #endif
1057 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx ParaView-4.2.0_SRC.new/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx
1058 --- ParaView-4.2.0_SRC/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx      2014-09-23 18:47:11.000000000 +0400
1059 +++ ParaView-4.2.0_SRC.new/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx  2014-12-19 15:39:41.000000000 +0300
1060 @@ -45,6 +45,7 @@
1061  
1062    void CleanupPythonObjects()
1063      {
1064 +    VTK_PY_GIL_ENSURE
1065      Py_XDECREF(this->InteractiveConsoleLocals);
1066      Py_XDECREF(this->InteractiveConsole);
1067      this->InteractiveConsole = NULL;
1068 @@ -54,6 +55,7 @@
1069        const char* code = "import gc; gc.collect()\n";
1070        vtkPythonInterpreter::RunSimpleString(code);
1071        }
1072 +    VTK_PY_GIL_RELEASE
1073      }
1074  
1075    PyObject* GetInteractiveConsole()
1076 @@ -65,6 +67,7 @@
1077  
1078      vtkPythonInterpreter::Initialize();
1079  
1080 +    VTK_PY_GIL_ENSURE
1081      // set up the code.InteractiveConsole instance that we'll use.
1082      const char* code = "import code\n"
1083        "__vtkConsoleLocals={'__name__':'__vtkconsole__','__doc__':None}\n"
1084 @@ -83,6 +86,7 @@
1085        {
1086        vtkGenericWarningMacro(
1087          "Failed to locate the InteractiveConsole/InteractiveConsoleLocals object.");
1088 +      VTK_PY_GIL_RELEASE
1089        return NULL;
1090        }
1091      Py_INCREF(this->InteractiveConsole);
1092 @@ -105,7 +109,7 @@
1093        PySys_SetObject(const_cast<char*>("ps2"), ps2 = PyString_FromString("... "));
1094        Py_XDECREF(ps2);
1095        }
1096 -
1097 +    VTK_PY_GIL_RELEASE
1098      return this->InteractiveConsole;
1099      }
1100  };
1101 @@ -167,6 +171,7 @@
1102      i++;
1103      }
1104  
1105 +  VTK_PY_GIL_ENSURE
1106    bool ret_value = false;
1107    PyObject *res = PyObject_CallMethod(console,
1108      const_cast<char*>("push"), const_cast<char*>("z"), buffer.c_str());
1109 @@ -179,6 +184,7 @@
1110        }
1111      Py_DECREF(res);
1112      }
1113 +  VTK_PY_GIL_RELEASE
1114    return ret_value;
1115  }
1116  
1117 @@ -190,12 +196,14 @@
1118  
1119    this->Internals->GetInteractiveConsole(); //ensure the console is initialized
1120  
1121 +  VTK_PY_GIL_ENSURE
1122    PyObject* context = this->Internals->GetInteractiveConsoleLocalsPyObject();
1123    PyObject* result = PyRun_String(const_cast<char*>(script), Py_file_input, context, context);
1124  
1125    if (result == NULL)
1126      {
1127      PyErr_Print();
1128 +    VTK_PY_GIL_RELEASE
1129      return -1;
1130      }
1131  
1132 @@ -204,6 +212,7 @@
1133      {
1134      PyErr_Clear();
1135      }
1136 +  VTK_PY_GIL_RELEASE
1137    return 0;
1138  }
1139  
1140 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx ParaView-4.2.0_SRC.new/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx
1141 --- ParaView-4.2.0_SRC/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx 2014-09-23 18:47:11.000000000 +0400
1142 +++ ParaView-4.2.0_SRC.new/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx     2014-12-19 15:39:54.000000000 +0300
1143 @@ -60,10 +60,12 @@
1144  
1145    inline void vtkPrependPythonPath(const char* pathtoadd)
1146      {
1147 +    VTK_PY_GIL_ENSURE
1148      PyObject* path = PySys_GetObject(const_cast<char*>("path"));
1149      PyObject* newpath = PyString_FromString(pathtoadd);
1150      PyList_Insert(path, 0, newpath);
1151      Py_DECREF(newpath);
1152 +    VTK_PY_GIL_RELEASE
1153      }
1154  }
1155  
1156 @@ -107,7 +109,6 @@
1157  //----------------------------------------------------------------------------
1158  bool vtkPythonInterpreter::Initialize(int initsigs /*=0*/)
1159  {
1160 -  vtkPythonInterpreter::InitializedOnce = true;
1161    if (Py_IsInitialized() == 0)
1162      {
1163  #if (VTK_PYTHON_MAJOR_VERSION > 2) ||\
1164 @@ -117,11 +118,26 @@
1165      (void)initsigs;
1166      Py_Initialize();
1167  #endif
1168 -
1169  #ifdef SIGINT
1170      // Put default SIGINT handler back after Py_Initialize/Py_InitializeEx.
1171      signal(SIGINT, SIG_DFL);
1172  #endif
1173 +    }
1174 +
1175 +  if (! vtkPythonInterpreter::InitializedOnce)
1176 +    {
1177 +#ifndef VTK_NO_PYTHON_THREADS
1178 +    int threadInit = PyEval_ThreadsInitialized();
1179 +    PyEval_InitThreads(); // safe to call this multiple time
1180 +#endif
1181 +    // At this point we have GIL, or we are mono-thread.
1182 +    // Access to the static below is safe:
1183 +    vtkPythonInterpreter::InitializedOnce = true;
1184 +
1185 +#ifndef VTK_NO_PYTHON_THREADS
1186 +    if(!threadInit)
1187 +      PyEval_SaveThread(); // release GIL
1188 +#endif
1189      // HACK: Calling PyRun_SimpleString for the first time for some reason results in
1190      // a "\n" message being generated which is causing the error dialog to
1191      // popup. So we flush that message out of the system before setting up the
1192 @@ -134,15 +150,17 @@
1193      vtkPythonStdStreamCaptureHelper* wrapperErr =
1194        NewPythonStdStreamCaptureHelper(true);
1195  
1196 -    // Redirect Python's stdout and stderr and stdin
1197 -    PySys_SetObject(const_cast<char*>("stdout"),
1198 +    // Redirect Python's stdout and stderr and stdin - GIL protected operation
1199 +    VTK_PY_GIL_ENSURE
1200 +    int ret1 = PySys_SetObject(const_cast<char*>("stdout"),
1201        reinterpret_cast<PyObject*>(wrapperOut));
1202 -    PySys_SetObject(const_cast<char*>("stderr"),
1203 +    int ret2 = PySys_SetObject(const_cast<char*>("stderr"),
1204        reinterpret_cast<PyObject*>(wrapperErr));
1205 -    PySys_SetObject(const_cast<char*>("stdin"),
1206 +    int ret3 = PySys_SetObject(const_cast<char*>("stdin"),
1207        reinterpret_cast<PyObject*>(wrapperOut));
1208      Py_DECREF(wrapperOut);
1209      Py_DECREF(wrapperErr);
1210 +    VTK_PY_GIL_RELEASE
1211  
1212      for (size_t cc=0; cc < PythonPaths.size(); cc++)
1213        {
1214 @@ -162,6 +180,7 @@
1215    if (Py_IsInitialized() != 0)
1216      {
1217      NotifyInterpreters(vtkCommand::ExitEvent);
1218 +    VTK_PY_GIL_ENSURE
1219      Py_Finalize();
1220      }
1221  }
1222 @@ -221,7 +240,9 @@
1223      vtkPythonInterpreter::SetProgramName(argv[0]);
1224      }
1225    vtkPythonInterpreter::Initialize(1);
1226 +  VTK_PY_GIL_ENSURE
1227    return Py_Main(argc, argv);
1228 +  // Py_Main already does a finalize etc ...
1229  }
1230  
1231  //----------------------------------------------------------------------------
1232 @@ -235,7 +256,9 @@
1233    buffer.erase(std::remove(buffer.begin(), buffer.end(), '\r'), buffer.end());
1234  
1235    // The cast is necessary because PyRun_SimpleString() hasn't always been const-correct
1236 +  VTK_PY_GIL_ENSURE
1237    PyRun_SimpleString(const_cast<char*>(buffer.c_str()));
1238 +  VTK_PY_GIL_RELEASE
1239  }
1240  
1241  //----------------------------------------------------------------------------
1242 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx ParaView-4.2.0_SRC.new/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx
1243 --- ParaView-4.2.0_SRC/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx     2014-09-23 18:47:11.000000000 +0400
1244 +++ ParaView-4.2.0_SRC.new/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx 2014-12-19 15:39:41.000000000 +0300
1245 @@ -30,14 +30,18 @@
1246    vtkPythonUtil::UnRegisterPythonCommand(this);
1247    if (this->obj && Py_IsInitialized())
1248      {
1249 +    VTK_PY_GIL_ENSURE
1250      Py_DECREF(this->obj);
1251 +    VTK_PY_GIL_RELEASE
1252      }
1253    this->obj = NULL;
1254  }
1255  
1256  void vtkPythonCommand::SetObject(PyObject *o)
1257  {
1258 +  VTK_PY_GIL_ENSURE
1259    Py_INCREF(o);
1260 +  VTK_PY_GIL_RELEASE
1261    this->obj = o;
1262  }
1263  
1264 @@ -92,11 +96,11 @@
1265    // If a threadstate has been set using vtkPythonCommand::SetThreadState,
1266    // then swap it in here.  See the email to vtk-developers@vtk.org from
1267    // June 18, 2009 with subject "Py_NewInterpreter and vtkPythonCallback issue"
1268 -  PyThreadState* prevThreadState = NULL;
1269 -  if (this->ThreadState)
1270 -    {
1271 -    prevThreadState = PyThreadState_Swap(this->ThreadState);
1272 -    }
1273 +//  PyThreadState* prevThreadState = NULL;
1274 +//  if (this->ThreadState)
1275 +//    {
1276 +//    prevThreadState = PyThreadState_Swap(this->ThreadState);
1277 +//    }
1278  
1279    PyObject * obj2 = NULL;
1280    if (ptr && ptr->GetReferenceCount() > 0)
1281 @@ -237,10 +241,10 @@
1282      }
1283  
1284    // If we did the swap near the top of this function then swap back now.
1285 -  if (this->ThreadState)
1286 -    {
1287 -    PyThreadState_Swap(prevThreadState);
1288 -    }
1289 +//  if (this->ThreadState)
1290 +//    {
1291 +//    PyThreadState_Swap(prevThreadState);
1292 +//    }
1293  
1294  #ifndef VTK_NO_PYTHON_THREADS
1295  #if (PY_MAJOR_VERSION > 2) || \
1296 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Wrapping/PythonCore/vtkSmartPyObject.cxx ParaView-4.2.0_SRC.new/VTK/Wrapping/PythonCore/vtkSmartPyObject.cxx
1297 --- ParaView-4.2.0_SRC/VTK/Wrapping/PythonCore/vtkSmartPyObject.cxx     2014-09-23 18:47:11.000000000 +0400
1298 +++ ParaView-4.2.0_SRC.new/VTK/Wrapping/PythonCore/vtkSmartPyObject.cxx 2014-12-19 15:39:41.000000000 +0300
1299 @@ -30,37 +30,52 @@
1300  vtkSmartPyObject::vtkSmartPyObject(const vtkSmartPyObject &other) :
1301    Object(other.Object)
1302  {
1303 +  VTK_PY_GIL_ENSURE
1304    Py_XINCREF(this->Object);
1305 +  VTK_PY_GIL_RELEASE
1306  }
1307  
1308  //--------------------------------------------------------------------
1309  vtkSmartPyObject::~vtkSmartPyObject()
1310  {
1311 -  Py_XDECREF(this->Object);
1312 +  if (Py_IsInitialized())
1313 +    {
1314 +    VTK_PY_GIL_ENSURE
1315 +    Py_XDECREF(this->Object);
1316 +    VTK_PY_GIL_RELEASE
1317 +    }
1318 +  else
1319 +    Py_XDECREF(this->Object);
1320  }
1321  
1322  //--------------------------------------------------------------------
1323  vtkSmartPyObject &vtkSmartPyObject::operator=(const vtkSmartPyObject &other)
1324  {
1325 +  VTK_PY_GIL_ENSURE
1326    Py_XDECREF(this->Object);
1327    this->Object = other.Object;
1328    Py_XINCREF(this->Object);
1329 +  VTK_PY_GIL_RELEASE
1330    return *this;
1331  }
1332  
1333  //--------------------------------------------------------------------
1334  vtkSmartPyObject &vtkSmartPyObject::operator=(PyObject *obj)
1335  {
1336 +  VTK_PY_GIL_ENSURE
1337    Py_XDECREF(this->Object);
1338    this->Object = obj;
1339    Py_XINCREF(this->Object);
1340 +  VTK_PY_GIL_RELEASE
1341    return *this;
1342  }
1343  
1344  //--------------------------------------------------------------------
1345  void vtkSmartPyObject::TakeReference(PyObject *obj)
1346  {
1347 +  VTK_PY_GIL_ENSURE
1348    Py_XDECREF(this->Object);
1349 +  VTK_PY_GIL_RELEASE
1350    this->Object = obj;
1351  }
1352  
1353 @@ -99,6 +114,8 @@
1354  //--------------------------------------------------------------------
1355  PyObject *vtkSmartPyObject::GetAndIncreaseReferenceCount()
1356  {
1357 +  VTK_PY_GIL_ENSURE
1358    Py_XINCREF(this->Object);
1359 +  VTK_PY_GIL_RELEASE
1360    return this->Object;
1361  }
1362 diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Wrapping/Python/paraview/servermanager.py ParaView-4.2.0_SRC.new/Wrapping/Python/paraview/servermanager.py
1363 --- ParaView-4.2.0_SRC/Wrapping/Python/paraview/servermanager.py        2014-09-23 18:46:44.000000000 +0400
1364 +++ ParaView-4.2.0_SRC.new/Wrapping/Python/paraview/servermanager.py    2014-12-19 15:39:41.000000000 +0300
1365 @@ -1092,7 +1092,7 @@
1366          property = self.SMProperty
1367          nElems = property.GetNumberOfElements()
1368          if nElems%2 != 0:
1369 -            raise ValueError, "The SMProperty with XML label '%s' has a size that is not a multiple of 2." % property.GetXMLLabel()
1370 +            nElems -= 1
1371          self.__arrays = []
1372          for i in range(0, nElems, 2):
1373              if self.GetElement(i+1) != '0':