Salome HOME
updated copyright message
[modules/paravis.git] / src / Plugins / MEDReader / plugin / MEDReaderIO / vtkMEDReader.h
1 // Copyright (C) 2010-2023  CEA, EDF
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 "vtkInformationGaussDoubleVectorKey.h"
28 #include "vtkNew.h"
29
30 class vtkDataArraySelection;
31 class vtkDataSet;
32 class vtkMutableDirectedGraph;
33 class vtkInformationDataObjectMetaDataKey;
34 class vtkInformationDoubleVectorKey;
35 class ExportedTinyInfo;
36
37 class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
38 {
39  private:
40   vtkMEDReader(const vtkMEDReader&); // Not implemented.
41   void operator=(const vtkMEDReader&); // Not implemented.
42  public:
43   static vtkMEDReader *New();
44   vtkTypeMacro(vtkMEDReader, vtkMultiBlockDataSetAlgorithm)
45   void PrintSelf(ostream& os, vtkIndent indent);
46   virtual void SetFileName(const char*);
47   virtual char *GetFileName();
48   virtual const char *GetFileExtensions() { return ".med .rmed"; }
49   virtual const char *GetDescriptiveName() { return "MED file (Data Exchange Model)"; }
50   //
51   virtual void SetFieldsStatus(const char *name, int status);
52   virtual int GetNumberOfFieldsTreeArrays();
53   virtual const char *GetFieldsTreeArrayName(int index);
54   virtual int GetFieldsTreeArrayStatus(const char *name);
55   //
56   virtual int GetTimesFlagsArrayStatus(const char *name);
57   virtual void SetTimesFlagsStatus(const char *name, int status);
58   virtual int GetNumberOfTimesFlagsArrays();
59   virtual const char *GetTimesFlagsArrayName(int index);
60   //! Build the graph used to pass information to the client on the supports
61   virtual std::string BuildSIL(vtkMutableDirectedGraph*);
62
63   // Description
64   // Reload will delete the internal reader and recreate it with default properties
65   // As well as reset public properties to their default values, except for the FileName
66   virtual void Reload();
67
68   // Description
69   // ReloadInternals will delete the internal reader and recreate it
70   virtual void ReloadInternals();
71
72   static const char *GetSeparator();
73
74   // Description
75   // Static information key used to transfer the meta data graph along the pipeline
76   static vtkInformationDataObjectMetaDataKey* META_DATA();
77   static vtkInformationGaussDoubleVectorKey* GAUSS_DATA();
78
79   // Description
80   // Control if MPI should be used for distribution when using a distributed server
81   // Only has an effect if MEDREADER_USE_MPI is defined.
82   // Default is true
83   vtkSetMacro(DistributeWithMPI, bool);
84   vtkGetMacro(DistributeWithMPI, bool);
85
86   // Description
87   // Control if vectors should be generated
88   // Default is false
89   void GenerateVectors(int);
90   vtkGetMacro(GenerateVect, bool);
91
92   // Description
93   // Control to set is std or mode should be used
94   // Default is false
95   void ChangeMode(int);
96   vtkGetMacro(IsStdOrMode, bool);
97
98   // Description
99   // Control if a Ghost Cell Generator should be used
100   // Default is true
101   void GhostCellGeneratorCallForPara(int);
102   vtkGetMacro(GCGCP, bool);
103   
104   // Description
105   // Control if mesh debug arrays should be removed or not
106   // Default is true
107   void GetRidOffDebugArrays(int);
108   vtkGetMacro(RemoveDebugArrays, bool);
109
110
111  protected:
112   vtkMEDReader();
113   virtual ~vtkMEDReader();
114   virtual int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
115   virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
116  private:
117   void UpdateSIL(vtkInformation * request, vtkInformation * info);
118   virtual double PublishTimeStepsIfNeeded(vtkInformation*, bool& isUpdated);
119   virtual void FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS, ExportedTinyInfo *internalInfo=0);
120   vtkDataSet *RetrieveDataSetAtTime(double reqTS, ExportedTinyInfo *internalInfo);
121  private:
122   //BTX
123   //ETX
124
125   class vtkMEDReaderInternal;
126   vtkMEDReaderInternal* Internal;
127
128   vtkNew<vtkDataArraySelection> FieldSelection;
129   vtkNew<vtkDataArraySelection> TimeFlagSelection;
130   std::string FileName;
131   //when false -> std, true -> mode. By default std (false).
132   bool IsStdOrMode = false;
133   //when false -> do nothing. When true cut off or extend to nbOfCompo=3 vector arrays.
134   bool GenerateVect = false;
135   bool GCGCP = true;
136   bool DistributeWithMPI = true;
137   bool RemoveDebugArrays = false;
138 };
139
140 #endif //__vtkMEDReader_h_