1 // Copyright (C) 2010-2022 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay
21 #ifndef __vtkMEDReader_h_
22 #define __vtkMEDReader_h_
26 #include "vtkMultiBlockDataSetAlgorithm.h"
27 #include "vtkInformationDoubleVectorKey.h"
30 class vtkDataArraySelection;
32 class vtkMutableDirectedGraph;
33 class vtkInformationDataObjectMetaDataKey;
34 class ExportedTinyInfo;
36 class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
39 vtkMEDReader(const vtkMEDReader&); // Not implemented.
40 void operator=(const vtkMEDReader&); // Not implemented.
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)"; }
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);
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*);
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();
68 // ReloadInternals will delete the internal reader and recreate it
69 virtual void ReloadInternals();
71 virtual void GenerateVectors(int);
72 virtual void ChangeMode(int);
73 virtual void GhostCellGeneratorCallForPara(int);
74 static const char *GetSeparator();
77 // Static information key used to transfer the meta data graph along the pipeline
78 static vtkInformationDataObjectMetaDataKey* META_DATA();
79 static vtkInformationDoubleVectorKey* GAUSS_DATA();
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);
89 virtual ~vtkMEDReader();
90 virtual int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
91 virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
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);
101 class vtkMEDReaderInternal;
102 vtkMEDReaderInternal* Internal;
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;
112 bool DistributeWithMPI = true;
115 #endif //__vtkMEDReader_h_