paraview-5.5.2 30.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
--- ParaView-git/CMake/ParaViewMacros.cmake.orig	2018-07-22 17:38:33.933614131 +0200
+++ ParaView-git/CMake/ParaViewMacros.cmake	2018-07-22 17:42:12.457612519 +0200
@@ -353,8 +353,9 @@
     set(qt_binary_dir_hints "${Qt5_DIR}/../../../bin")
   endif()
 
+  # The qhelpgenerator program may be installed as qhelpgenerator-qt5
   find_program(QT_HELP_GENERATOR
-    qhelpgenerator
+    NAMES qhelpgenerator qhelpgenerator-qt5
     HINTS "${qt_binary_dir_hints}"
     DOC "qhelpgenerator used to compile Qt help project files")
   mark_as_advanced(QT_HELP_GENERATOR)
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
--- ParaView-v5.5.2/VTK/ThirdParty/hdf5/vtkhdf5/src/H5detect.c.orig	2018-06-15 21:09:45.000000000 +0200
+++ ParaView-v5.5.2/VTK/ThirdParty/hdf5/vtkhdf5/src/H5detect.c	2018-07-07 13:20:40.641815285 +0200
@@ -1360,8 +1360,8 @@
  *
  *-------------------------------------------------------------------------
  */
-static void
-detect_C89_integers(void) HDF_NO_UBSAN
+static void HDF_NO_UBSAN
+detect_C89_integers(void)
 {
     DETECT_BYTE(signed char,	  SCHAR,        d_g[nd_g]); nd_g++;
     DETECT_BYTE(unsigned char,	  UCHAR,        d_g[nd_g]); nd_g++;
@@ -1388,8 +1388,8 @@
  *
  *-------------------------------------------------------------------------
  */
-static void
-detect_C89_floats(void) HDF_NO_UBSAN
+static void HDF_NO_UBSAN
+detect_C89_floats(void)
 {
     DETECT_F(float,     FLOAT,      d_g[nd_g]); nd_g++;
     DETECT_F(double,    DOUBLE,     d_g[nd_g]); nd_g++;
@@ -1410,8 +1410,8 @@
  *
  *-------------------------------------------------------------------------
  */
-static void
-detect_C99_integers8(void) HDF_NO_UBSAN
+static void HDF_NO_UBSAN
+detect_C99_integers8(void)
 {
 #if H5_SIZEOF_INT8_T>0
   #if H5_SIZEOF_INT8_T==1
@@ -1472,8 +1472,8 @@
  *
  *-------------------------------------------------------------------------
  */
-static void
-detect_C99_integers16(void) HDF_NO_UBSAN
+static void HDF_NO_UBSAN
+detect_C99_integers16(void)
 {
 #if H5_SIZEOF_INT16_T>0
     DETECT_I(int16_t, 		  INT16,        d_g[nd_g]); nd_g++;
@@ -1510,8 +1510,8 @@
  *
  *-------------------------------------------------------------------------
  */
-static void
-detect_C99_integers32(void) HDF_NO_UBSAN
+static void HDF_NO_UBSAN
+detect_C99_integers32(void)
 {
 #if H5_SIZEOF_INT32_T>0
     DETECT_I(int32_t, 		  INT32,        d_g[nd_g]); nd_g++;
@@ -1548,8 +1548,8 @@
  *
  *-------------------------------------------------------------------------
  */
-static void
-detect_C99_integers64(void) HDF_NO_UBSAN
+static void HDF_NO_UBSAN
+detect_C99_integers64(void)
 {
 #if H5_SIZEOF_INT64_T>0
     DETECT_I(int64_t, 		  INT64,        d_g[nd_g]); nd_g++;
@@ -1599,8 +1599,8 @@
  *
  *-------------------------------------------------------------------------
  */
-static void
-detect_C99_integers(void) HDF_NO_UBSAN
+static void HDF_NO_UBSAN
+detect_C99_integers(void)
 {
     /* break it down to more subroutines so that each module subroutine */
     /* is smaller and takes less time to compile with optimization on.  */
@@ -1625,8 +1625,8 @@
  *
  *-------------------------------------------------------------------------
  */
-static void
-detect_C99_floats(void) HDF_NO_UBSAN
+static void HDF_NO_UBSAN
+detect_C99_floats(void)
 {
 #if H5_SIZEOF_DOUBLE == H5_SIZEOF_LONG_DOUBLE
     /*
@@ -1656,8 +1656,8 @@
  *
  *-------------------------------------------------------------------------
  */
-static void
-detect_alignments(void) HDF_NO_UBSAN
+static void HDF_NO_UBSAN
+detect_alignments(void)
 {
     /* Detect structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */
     DETECT_M(void *,              POINTER,      m_g[na_g]); na_g++;
@@ -1744,8 +1744,8 @@
  *
  *-------------------------------------------------------------------------
  */
-int
-main(void) HDF_NO_UBSAN
+int HDF_NO_UBSAN
+main(void)
 {
 
 #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS)
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
--- ParaView-v5.5.0/VTK/ThirdParty/vtkm/vtk-m/CMake/VTKmDetermineVersion.cmake.orig	2018-04-06 22:03:33.000000000 +0200
+++ ParaView-v5.5.0/VTK/ThirdParty/vtkm/vtk-m/CMake/VTKmDetermineVersion.cmake	2018-04-23 12:00:23.708544206 +0200
@@ -51,6 +51,8 @@
         ERROR_QUIET
         OUTPUT_STRIP_TRAILING_WHITESPACE
         ERROR_STRIP_TRAILING_WHITESPACE)
+    else()
+      set(output)
     endif()
   else()
     set(result 0)
@@ -75,7 +77,7 @@
 
 # Extracts components from a version string. See determine_version() for usage.
 function(extract_version_components version_string var_prefix)
-  string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)[-]*(.*)"
+  string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)[-]*(.*)$"
     version_matches "${version_string}")
   if(CMAKE_MATCH_0)
     set(full ${CMAKE_MATCH_0})
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
--- ParaView-v5.5.0/CoProcessing/Catalyst/vtkCPProcessor.cxx.orig	2018-04-06 22:03:33.000000000 +0200
+++ ParaView-v5.5.0/CoProcessing/Catalyst/vtkCPProcessor.cxx	2018-05-11 12:02:26.894772713 +0200
@@ -38,6 +38,7 @@
 #include "vtkStringArray.h"
 
 #include <list>
+#include <vtksys/SystemTools.hxx>
 
 struct vtkCPProcessorInternals
 {
@@ -47,12 +48,13 @@
 };
 
 vtkStandardNewMacro(vtkCPProcessor);
-vtkMultiProcessController* vtkCPProcessor::Controller = NULL;
+vtkMultiProcessController* vtkCPProcessor::Controller = nullptr;
 //----------------------------------------------------------------------------
 vtkCPProcessor::vtkCPProcessor()
 {
   this->Internal = new vtkCPProcessorInternals;
-  this->InitializationHelper = NULL;
+  this->InitializationHelper = nullptr;
+  this->WorkingDirectory = nullptr;
 }
 
 //----------------------------------------------------------------------------
@@ -61,14 +63,15 @@
   if (this->Internal)
   {
     delete this->Internal;
-    this->Internal = NULL;
+    this->Internal = nullptr;
   }
 
   if (this->InitializationHelper)
   {
     this->InitializationHelper->Delete();
-    this->InitializationHelper = NULL;
+    this->InitializationHelper = nullptr;
   }
+  this->SetWorkingDirectory(nullptr);
 }
 
 //----------------------------------------------------------------------------
@@ -95,7 +98,7 @@
 {
   if (which < 0 || which >= this->GetNumberOfPipelines())
   {
-    return NULL;
+    return nullptr;
   }
   int counter = 0;
   vtkCPProcessorInternals::PipelineListIterator iter = this->Internal->Pipelines.begin();
@@ -108,7 +111,7 @@
     counter++;
     iter++;
   }
-  return NULL;
+  return nullptr;
 }
 
 //----------------------------------------------------------------------------
@@ -130,17 +133,41 @@
 }
 
 //----------------------------------------------------------------------------
-int vtkCPProcessor::Initialize()
+int vtkCPProcessor::Initialize(const char* workingDirectory)
 {
-  if (this->InitializationHelper == NULL)
+  if (this->InitializationHelper == nullptr)
   {
     this->InitializationHelper = this->NewInitializationHelper();
   }
+  // make sure the directory exists here so that we only do it once
+  if (workingDirectory)
+  {
+    vtkMultiProcessController* controller = vtkMultiProcessController::GetGlobalController();
+    int success = 1;
+    if (controller == nullptr || controller->GetLocalProcessId() == 0)
+    {
+      success = vtksys::SystemTools::MakeDirectory(workingDirectory) == true ? 1 : 0;
+      if (success == 0)
+      {
+        vtkWarningMacro("Could not make "
+          << workingDirectory << " directory. "
+          << "Results will be generated in current working directory instead.");
+      }
+    }
+    if (controller)
+    {
+      controller->Broadcast(&success, 1, 0);
+    }
+    if (success)
+    {
+      this->SetWorkingDirectory(workingDirectory);
+    }
+  }
   return 1;
 }
 
 //----------------------------------------------------------------------------
-int vtkCPProcessor::Initialize(vtkMPICommunicatorOpaqueComm& comm)
+int vtkCPProcessor::Initialize(vtkMPICommunicatorOpaqueComm& comm, const char* workingDirectory)
 {
 #ifdef PARAVIEW_USE_MPI
   if (vtkCPProcessor::Controller)
@@ -148,7 +175,7 @@
     vtkErrorMacro("Can only initialize with a communicator once per process.");
     return 0;
   }
-  if (this->InitializationHelper == NULL)
+  if (this->InitializationHelper == nullptr)
   {
     vtkMPICommunicator* communicator = vtkMPICommunicator::New();
     communicator->InitializeExternal(&comm);
@@ -157,12 +184,12 @@
     this->Controller = controller;
     this->Controller->SetGlobalController(controller);
     communicator->Delete();
-    return this->Initialize();
+    return this->Initialize(workingDirectory);
   }
   return 1;
 #else
   static_cast<void>(&comm); // get rid of variable not used warning
-  return this->Initialize();
+  return this->Initialize(workingDirectory);
 #endif
 }
 
@@ -225,6 +252,13 @@
       input->GetFieldData()->AddArray(catalystChannel);
     }
   }
+
+  std::string originalWorkingDirectory;
+  if (this->WorkingDirectory)
+  {
+    originalWorkingDirectory = vtksys::SystemTools::GetCurrentWorkingDirectory();
+    vtksys::SystemTools::ChangeDirectory(this->WorkingDirectory);
+  }
   for (vtkCPProcessorInternals::PipelineListIterator iter = this->Internal->Pipelines.begin();
        iter != this->Internal->Pipelines.end(); iter++)
   {
@@ -248,6 +282,10 @@
       }
     }
   }
+  if (originalWorkingDirectory.empty() == false)
+  {
+    vtksys::SystemTools::ChangeDirectory(originalWorkingDirectory);
+  }
   // we want to reset everything here to make sure that new information
   // is properly passed in the next time.
   dataDescription->ResetAll();
@@ -259,7 +297,7 @@
 {
   if (this->Controller)
   {
-    this->Controller->SetGlobalController(NULL);
+    this->Controller->SetGlobalController(nullptr);
     this->Controller->Finalize(1);
     this->Controller->Delete();
   }
--- ParaView-v5.5.0/CoProcessing/Catalyst/vtkCPProcessor.h.orig	2018-04-06 22:03:33.000000000 +0200
+++ ParaView-v5.5.0/CoProcessing/Catalyst/vtkCPProcessor.h	2018-05-11 12:02:26.894772713 +0200
@@ -76,14 +76,16 @@
   virtual void RemoveAllPipelines();
 
   /// Initialize the co-processor. Returns 1 if successful and 0
-  /// otherwise.
   /// otherwise. If Catalyst is built with MPI then Initialize()
   /// can also be called with a specific MPI communicator if
   /// MPI_COMM_WORLD isn't the proper one. Catalyst is initialized
-  /// to use MPI_COMM_WORLD by default.
-  virtual int Initialize();
+  /// to use MPI_COMM_WORLD by default. Both methods have an optional
+  /// workingDirectory argument which will set *WorkingDirectory* so
+  /// that files will be put relative to this directory.
+  virtual int Initialize(const char* workingDirectory = nullptr);
 #ifndef __WRAP__
-  virtual int Initialize(vtkMPICommunicatorOpaqueComm& comm);
+  virtual int Initialize(
+    vtkMPICommunicatorOpaqueComm& comm, const char* workingDirectory = nullptr);
 #endif
 
   /// The Catalyst input field data string array name. This array will
@@ -111,6 +113,13 @@
   /// implementation an opportunity to clean up, before it is destroyed.
   virtual int Finalize();
 
+  /// Get the current working directory for outputting Catalyst files.
+  /// If not set then Catalyst output files will be relative to the
+  /// current working directory. This will not affect where Catalyst
+  /// looks for Python scripts. *WorkingDirectory* gets set through
+  /// the *Initialize()* methods.
+  vtkGetStringMacro(WorkingDirectory);
+
 protected:
   vtkCPProcessor();
   virtual ~vtkCPProcessor();
@@ -118,6 +127,11 @@
   /// Create a new instance of the InitializationHelper.
   virtual vtkObject* NewInitializationHelper();
 
+  /// Set the current working directory for outputting Catalyst files.
+  /// This is a protected method since simulation code adaptors should
+  /// set this through the *Initialize()* methods.
+  vtkSetStringMacro(WorkingDirectory);
+
 private:
   vtkCPProcessor(const vtkCPProcessor&) = delete;
   void operator=(const vtkCPProcessor&) = delete;
@@ -125,6 +139,7 @@
   vtkCPProcessorInternals* Internal;
   vtkObject* InitializationHelper;
   static vtkMultiProcessController* Controller;
+  char* WorkingDirectory;
 };
 
 #endif
--- ParaView-v5.5.0/CoProcessing/Catalyst/vtkCPXMLPWriterPipeline.cxx.orig	2018-04-06 22:03:33.000000000 +0200
+++ ParaView-v5.5.0/CoProcessing/Catalyst/vtkCPXMLPWriterPipeline.cxx	2018-05-11 12:02:26.894772713 +0200
@@ -31,6 +31,7 @@
 #include <vtkSmartPointer.h>
 #include <vtkUnstructuredGrid.h>
 
+#include <algorithm>
 #include <sstream>
 #include <string>
 
@@ -174,7 +175,7 @@
 
   for (unsigned int i = 0; i < dataDescription->GetNumberOfInputDescriptions(); i++)
   {
-    const char* inputName = dataDescription->GetInputDescriptionName(i);
+    std::string inputName = dataDescription->GetInputDescriptionName(i);
     vtkCPInputDataDescription* idd = dataDescription->GetInputDescription(i);
     vtkDataObject* grid = idd->GetGrid();
     if (grid == nullptr)
@@ -206,6 +207,8 @@
         vtkSMStringVectorProperty* fileName =
           vtkSMStringVectorProperty::SafeDownCast(writer->GetProperty("FileName"));
 
+        // If we have a / in the channel name we take it out of the filename we're going to write to
+        inputName.erase(std::remove(inputName.begin(), inputName.end(), '/'), inputName.end());
         std::ostringstream o;
         if (this->Path.empty() == false)
         {
--- ParaView-v5.5.0/Wrapping/Python/paraview/coprocessing.py.orig	2018-04-06 22:03:33.000000000 +0200
+++ ParaView-v5.5.0/Wrapping/Python/paraview/coprocessing.py	2018-05-11 12:02:27.038772408 +0200
@@ -11,22 +11,12 @@
 from paraview.vtk.vtkPVVTKExtensionsCore import *
 import math
 
-# -----------------------------------------------------------------------------
-def IsInModulo(timestep, frequencyArray):
-    """
-    Return True if the given timestep is in one of the provided frequency.
-    This can be interpreted as follow::
-
-        isFM = IsInModulo(timestep, [2,3,7])
-
-    is similar to::
+# If the user created a filename in a location that doesn't exist by default we'll
+# make the directory for them. This can be changed though by setting createDirectoriesIfNeeded
+# to False.
+createDirectoriesIfNeeded = True
 
-        isFM = (timestep % 2 == 0) or (timestep % 3 == 0) or (timestep % 7 == 0)
-    """
-    for frequency in frequencyArray:
-        if frequency > 0 and (timestep % frequency == 0):
-            return True
-    return False
+# -----------------------------------------------------------------------------
 
 class CoProcessor(object):
     """Base class for co-processing Pipelines.
@@ -68,6 +58,9 @@
         self.__CinemaTracks = {}
         self.__InitialFrequencies = {}
         self.__PrintEnsightFormatString = False
+        self.__TimeStepToStartOutputAt=0
+        self.__ForceOutputAtFirstCall=False
+        self.__FirstTimeStepIndex = None
 
     def SetPrintEnsightFormatString(self, enable):
         """If outputting ExodusII files with the purpose of reading them into
@@ -87,6 +80,17 @@
                  "Incorrect argument type: %s, must be a dict" % type(frequencies))
         self.__InitialFrequencies = frequencies
 
+    def SetInitialOutputOptions(self, timeStepToStartOutputAt, forceOutputAtFirstCall):
+        """Set the frequencies at which the pipeline needs to be updated.
+           Typically, this is called by the subclass once it has determined what
+           timesteps co-processing will be needed to be done.
+           frequencies is a map, with key->string name of for the simulation
+           input, and value is a list of frequencies.
+           """
+
+        self.__TimeStepToStartOutputAt=timeStepToStartOutputAt
+        self.__ForceOutputAtFirstCall=forceOutputAtFirstCall
+
     def EnableLiveVisualization(self, enable, frequency = 1):
         """Call this method to enable live-visualization. When enabled,
         DoLiveVisualization() will communicate with ParaView server if possible
@@ -115,7 +119,7 @@
         # if this is a time step to do live then all of the inputs
         # must be made available. note that we want the pipeline built
         # before we do the actual first live connection.
-        if self.__EnableLiveVisualization and timestep % self.__LiveVisualizationFrequency == 0 \
+        if self.__EnableLiveVisualization and self.NeedToOutput(timestep, self.__LiveVisualizationFrequency) \
            and self.__LiveVisualizationLink:
             if self.__LiveVisualizationLink.Initialize(servermanager.ActiveConnection.Session.GetSessionProxyManager()):
                 num_inputs = datadescription.GetNumberOfInputDescriptions()
@@ -132,13 +136,13 @@
         # hasn't been set up yet). If we don't have live enabled
         # we know that the output frequencies aren't changed and can
         # just use the initial frequencies.
-        if self.__InitialFrequencies or not self.__EnableLiveVisualization:
+        if self.__ForceOutputAtFirstCall or self.__InitialFrequencies or not self.__EnableLiveVisualization:
             num_inputs = datadescription.GetNumberOfInputDescriptions()
             for cc in range(num_inputs):
                 input_name = datadescription.GetInputDescriptionName(cc)
 
                 freqs = self.__InitialFrequencies.get(input_name, [])
-                if self.__EnableLiveVisualization or ( self and IsInModulo(timestep, freqs) ):
+                if self.__EnableLiveVisualization or ( self and self.IsInModulo(timestep, freqs) ):
                         datadescription.GetInputDescription(cc).AllFieldsOn()
                         datadescription.GetInputDescription(cc).GenerateMeshOn()
         else:
@@ -149,15 +153,14 @@
             for writer in self.__WritersList:
                 frequency = writer.parameters.GetProperty(
                     "WriteFrequency").GetElement(0)
-                if (timestep % frequency) == 0 or \
-                   datadescription.GetForceOutput() == True:
+                if self.NeedToOutput(timestep, frequency) or datadescription.GetForceOutput() == True:
                     writerinputs = cpstate.locate_simulation_inputs(writer)
                     for writerinput in writerinputs:
                         datadescription.GetInputDescriptionByName(writerinput).AllFieldsOn()
                         datadescription.GetInputDescriptionByName(writerinput).GenerateMeshOn()
 
             for view in self.__ViewsList:
-                if (view.cpFrequency and timestep % view.cpFrequency == 0) or \
+                if (view.cpFrequency and self.NeedToOutput(timestep, view.cpFrequency)) or \
                    datadescription.GetForceOutput() == True:
                     viewinputs = cpstate.locate_simulation_inputs_for_view(view)
                     for viewinput in viewinputs:
@@ -192,8 +195,7 @@
         for writer in self.__WritersList:
             frequency = writer.parameters.GetProperty(
                 "WriteFrequency").GetElement(0)
-            if (timestep % frequency) == 0 or \
-                    datadescription.GetForceOutput() == True:
+            if self.NeedToOutput(timestep, frequency) or datadescription.GetForceOutput() == True:
                 fileName = writer.parameters.GetProperty("FileName").GetElement(0)
                 paddingamount = writer.parameters.GetProperty("PaddingAmount").GetElement(0)
                 helperName = writer.GetXMLName()
@@ -203,6 +205,23 @@
                 else:
                     ts = str(timestep).rjust(paddingamount, '0')
                     writer.FileName = fileName.replace("%t", ts)
+                if '/' in writer.FileName and createDirectoriesIfNeeded:
+                    oktowrite = [1.]
+                    import vtk
+                    comm = vtk.vtkMultiProcessController.GetGlobalController()
+                    if comm.GetLocalProcessId() == 0:
+                        import os
+                        newDir = writer.FileName[0:writer.FileName.rfind('/')]
+                        try:
+                            os.makedirs(newDir)
+                        except OSError:
+                            if not os.path.isdir(newDir):
+                                print ("ERROR: Cannot make directory for", writer.FileName, ". No data will be written.")
+                                oktowrite[0] = 0.
+                    comm.Broadcast(oktowrite, 1, 0)
+                    if oktowrite[0] == 0:
+                        # we can't make the directory so no reason to update the pipeline
+                        return
                 writer.UpdatePipeline(datadescription.GetTime())
 
     def WriteImages(self, datadescription, rescale_lookuptable=False,
@@ -240,7 +259,7 @@
 
         cinema_dirs = []
         for view in self.__ViewsList:
-            if (view.cpFrequency and timestep % view.cpFrequency == 0) or \
+            if (view.cpFrequency and self.NeedToOutput(timestep, view.cpFrequency)) or \
                datadescription.GetForceOutput() == True:
                 fname = view.cpFileName
                 ts = str(timestep).rjust(padding_amount, '0')
@@ -267,6 +286,24 @@
                     if dirname:
                         cinema_dirs.append(dirname)
                 else:
+                    if '/' in fname and createDirectoriesIfNeeded:
+                        oktowrite = [1.]
+                        import vtk
+                        comm = vtk.vtkMultiProcessController.GetGlobalController()
+                        if comm.GetLocalProcessId() == 0:
+                            import os
+                            newDir = fname[0:fname.rfind('/')]
+                            try:
+                                os.makedirs(newDir)
+                            except OSError:
+                                if not os.path.isdir(newDir):
+                                    print ("ERROR: Cannot make directory for", fname, ". No image will be output.")
+                                    oktowrite[0] = 0.
+                        comm.Broadcast(oktowrite, 1, 0)
+                        if oktowrite[0] == 0:
+                            # we can't make the directory so no reason to update the pipeline
+                            return
+
                     if image_quality is None and fname.endswith('png'):
                         # for png quality = 0 means no compression. compression can be a potentially
                         # very costly serial operation on process 0
@@ -307,7 +344,7 @@
 
 
         timeStep = datadescription.GetTimeStep()
-        if self.__EnableLiveVisualization and timeStep % self.__LiveVisualizationFrequency == 0:
+        if self.__EnableLiveVisualization and self.NeedToOutput(timeStep, self.__LiveVisualizationFrequency):
             if not self.__LiveVisualizationLink.Initialize(servermanager.ActiveConnection.Session.GetSessionProxyManager()):
                 return
 
@@ -412,7 +449,7 @@
         """
         controller = servermanager.ParaViewPipelineController()
         # assume that a client only proxy with the same name as a writer
-        # is available in "insitu_writer_paramters"
+        # is available in "insitu_writer_parameters"
 
         # Since coprocessor sometimes pass writer as a custom object and not
         # a proxy, we need to handle that. Just creating any arbitrary writer
@@ -666,3 +703,42 @@
         #restore what we showed
         pv_introspect.restore_visibility(pxystate)
         return os.path.basename(vfname)
+
+    def IsInModulo(self, timestep, frequencies):
+        """
+        Return True if the given timestep is in one of the provided frequency.
+        This can be interpreted as follow::
+
+        isFM = IsInModulo(timestep-timeStepToStartOutputAt, [2,3,7])
+
+        is similar to::
+
+        isFM = (timestep-timeStepToStartOutputAt % 2 == 0) or (timestep-timeStepToStartOutputAt % 3 == 0) or (timestep-timeStepToStartOutputAt % 7 == 0)
+
+        The timeStepToStartOutputAt is the first timestep that will potentially be output.
+        """
+        if timestep < self.__TimeStepToStartOutputAt and not self.__ForceOutputAtFirstCall:
+            return False
+        for frequency in frequencies:
+            if frequency > 0 and self.NeedToOutput(timestep, frequency):
+                return True
+
+        return False
+
+
+    def NeedToOutput(self, timestep, frequency):
+        """
+        Return True if we need to output based on the input timestep and frequency. Checks based
+        __FirstTimeStepIndex, __FirstTimeStepIndex, __ForceOutputAtFirstCall and __TimeStepToStartOutputAt
+        member variables.
+        """
+        if self.__FirstTimeStepIndex == None:
+            self.__FirstTimeStepIndex = timestep
+
+        if self.__ForceOutputAtFirstCall and self.__FirstTimeStepIndex == timestep:
+            return True
+
+        if self.__TimeStepToStartOutputAt <= timestep and (timestep-self.__TimeStepToStartOutputAt) % frequency == 0:
+            return True
+
+        return False
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
--- ParaView-v5.5.1/ParaViewCore/ServerManager/SMApplication/Resources/readers.xml.orig	2018-06-01 21:23:15.000000000 +0200
+++ ParaView-v5.5.1/ParaViewCore/ServerManager/SMApplication/Resources/readers.xml	2018-06-19 20:50:55.128914062 +0200
@@ -3769,7 +3769,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="vtm vtmb"
+        <ReaderFactory extensions="vtm vtm.series vtmb vtmb.series"
                        file_description="VTK MultiBlock Data Files" />
       </Hints>
       <!-- end of XMLMultiBlockDataReader -->
@@ -3824,7 +3824,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="vthb vth"
+        <ReaderFactory extensions="vthb vthb.series vth vth.series"
                        file_description="VTK Hierarchical Box Data Files" />
       </Hints>
       <!-- end of XMLUniformGridAMRReader -->
@@ -3933,7 +3933,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="vtp"
+        <ReaderFactory extensions="vtp vtp.series"
                        file_description="VTK PolyData Files" />
       </Hints>
     </SourceProxy>
@@ -3990,7 +3990,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="vtt"
+        <ReaderFactory extensions="vtt vtt.series"
                        file_description="VTK Table Files" />
       </Hints>
     </SourceProxy>
@@ -4050,7 +4050,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="vtu"
+        <ReaderFactory extensions="vtu vtu.series"
                        file_description="VTK UnstructuredGrid Files" />
       </Hints>
     </SourceProxy>
@@ -4108,7 +4108,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="vti"
+        <ReaderFactory extensions="vti vti.series"
                        file_description="VTK ImageData Files" />
       </Hints>
     </SourceProxy>
@@ -4166,7 +4166,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="vts"
+        <ReaderFactory extensions="vts vts.series"
                        file_description="VTK StructuredGrid Files" />
       </Hints>
     </SourceProxy>
@@ -4224,7 +4224,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="vtr"
+        <ReaderFactory extensions="vtr vtr.series"
                        file_description="VTK RectilinearGrid Files" />
       </Hints>
     </SourceProxy>
@@ -4284,7 +4284,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="pvtp"
+        <ReaderFactory extensions="pvtp pvtp.series"
                        file_description="VTK PolyData Files (partitioned)" />
       </Hints>
     </SourceProxy>
@@ -4346,7 +4346,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="pvtu"
+        <ReaderFactory extensions="pvtu pvtu.series"
                        file_description="VTK UnstructuredGrid Files (partitioned)" />
       </Hints>
     </SourceProxy>
@@ -4406,7 +4406,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="pvtt"
+        <ReaderFactory extensions="pvtt pvtt.series"
                        file_description="VTK Table (partitioned)" />
       </Hints>
     </SourceProxy>
@@ -4467,7 +4467,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="pvti"
+        <ReaderFactory extensions="pvti pvti.series"
                        file_description="VTK ImageData Files (partitioned)" />
       </Hints>
     </SourceProxy>
@@ -4529,7 +4529,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="pvts"
+        <ReaderFactory extensions="pvts pvts.series"
                        file_description="VTK StructuredGrid Files (partitioned)" />
       </Hints>
     </SourceProxy>
@@ -4591,7 +4591,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="pvtr"
+        <ReaderFactory extensions="pvtr pvtr.series"
                        file_description="VTK RectilinearGrid Files (partitioned)" />
       </Hints>
     </SourceProxy>
@@ -4702,7 +4702,7 @@
         Partitioned Legacy VTK reader.</Documentation>
       </StringVectorProperty>
       <Hints>
-        <ReaderFactory extensions="pvtk"
+        <ReaderFactory extensions="pvtk pvtk.series"
                        file_description="Legacy VTK Files (partitioned)" />
       </Hints>
       <!-- End pvtkfile -->
@@ -5102,7 +5102,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="ply"
+        <ReaderFactory extensions="ply ply.series"
                        file_description="PLY Polygonal File Format" />
       </Hints>
     </SourceProxy>
@@ -5230,7 +5230,7 @@
         <Documentation>Available timestep values.</Documentation>
       </DoubleVectorProperty>
       <Hints>
-        <ReaderFactory extensions="stl"
+        <ReaderFactory extensions="stl stl.series"
                        file_description="Stereo Lithography" />
       </Hints>
       <!-- End stlreader-->