Salome HOME
Fix MEDWRITER_0 test and try to fix VoroGauss. Avoid duplicity of symbols in VTKToMEDMem
[modules/paravis.git] / src / Plugins / MEDReader / plugin / MEDReaderIO / vtkMEDReader.h
1 // Copyright (C) 2010-2022  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay
20
21 #ifndef __vtkMEDReader_h_
22 #define __vtkMEDReader_h_
23
24 #include <string>
25
26 #include "vtkMultiBlockDataSetAlgorithm.h"
27 #include "vtkInformationDoubleVectorKey.h"
28 #include "vtkNew.h"
29
30 class vtkDataArraySelection;
31 class vtkDataSet;
32 class vtkMutableDirectedGraph;
33 class vtkInformationDataObjectMetaDataKey;
34 class ExportedTinyInfo;
35
36 class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
37 {
38  private:
39   vtkMEDReader(const vtkMEDReader&); // Not implemented.
40   void operator=(const vtkMEDReader&); // Not implemented.
41  public:
42   static vtkMEDReader *New();
43   vtkTypeMacro(vtkMEDReader, vtkMultiBlockDataSetAlgorithm)
44   void PrintSelf(ostream& os, vtkIndent indent);
45   virtual void SetFileName(const char*);
46   virtual char *GetFileName();
47   virtual const char *GetFileExtensions() { return ".med .rmed"; }
48   virtual const char *GetDescriptiveName() { return "MED file (Data Exchange Model)"; }
49   //
50   virtual void SetFieldsStatus(const char *name, int status);
51   virtual int GetNumberOfFieldsTreeArrays();
52   virtual const char *GetFieldsTreeArrayName(int index);
53   virtual int GetFieldsTreeArrayStatus(const char *name);
54   //
55   virtual int GetTimesFlagsArrayStatus(const char *name);
56   virtual void SetTimesFlagsStatus(const char *name, int status);
57   virtual int GetNumberOfTimesFlagsArrays();
58   virtual const char *GetTimesFlagsArrayName(int index);
59   //! Build the graph used to pass information to the client on the supports
60   virtual std::string BuildSIL(vtkMutableDirectedGraph*);
61
62   // Description
63   // Reload will delete the internal reader and recreate it with default properties
64   // As well as reset public properties to their default values, except for the FileName
65   virtual void Reload();
66
67   // Description
68   // ReloadInternals will delete the internal reader and recreate it
69   virtual void ReloadInternals();
70
71   virtual void GenerateVectors(int);
72   virtual void ChangeMode(int);
73   virtual void GhostCellGeneratorCallForPara(int);
74   static const char *GetSeparator();
75
76   // Description
77   // Static information key used to transfer the meta data graph along the pipeline
78   static vtkInformationDataObjectMetaDataKey* META_DATA();
79   static vtkInformationDoubleVectorKey* GAUSS_DATA();
80
81   // Description
82   // Control if MPI should be used for distribution when using a distributed server
83   // Only has an effect if MEDREADER_USE_MPI is defined.
84   vtkSetMacro(DistributeWithMPI, bool);
85   vtkGetMacro(DistributeWithMPI, bool);
86
87  protected:
88   vtkMEDReader();
89   virtual ~vtkMEDReader();
90   virtual int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
91   virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
92  private:
93   void UpdateSIL(vtkInformation * request, vtkInformation * info);
94   virtual double PublishTimeStepsIfNeeded(vtkInformation*, bool& isUpdated);
95   virtual void FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS, ExportedTinyInfo *internalInfo=0);
96   vtkDataSet *RetrieveDataSetAtTime(double reqTS, ExportedTinyInfo *internalInfo);
97  private:
98   //BTX
99   //ETX
100
101   class vtkMEDReaderInternal;
102   vtkMEDReaderInternal* Internal;
103
104   vtkNew<vtkDataArraySelection> FieldSelection;
105   vtkNew<vtkDataArraySelection> TimeFlagSelection;
106   std::string FileName;
107   //when false -> std, true -> mode. By default std (false).
108   bool IsStdOrMode = false;
109   //when false -> do nothing. When true cut off or extend to nbOfCompo=3 vector arrays.
110   bool GenerateVect = false;
111   bool GCGCP = true;
112   bool DistributeWithMPI = true;
113 };
114
115 #endif //__vtkMEDReader_h_