Salome HOME
Fix test case hang-up
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkExtractGroup.h
1 // Copyright (C) 2010-2013  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.
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 :
18 // webmaster.salome@opencascade.com
19 //
20
21 #ifndef vtkExtractGroup_h__
22 #define vtkExtractGroup_h__
23
24 #include "vtkMultiBlockDataSetAlgorithm.h"
25 class vtkMutableDirectedGraph;
26 class vtkInformation;
27 class vtkInformationVector;
28 class vtkDataArraySelection;
29 class vtkTimeStamp;
30 class vtkStringArray;
31
32 class VTK_EXPORT vtkExtractGroup: public vtkMultiBlockDataSetAlgorithm
33 {
34 public:
35   static vtkExtractGroup* New();
36   vtkTypeMacro(vtkExtractGroup, vtkMultiBlockDataSetAlgorithm)
37   void PrintSelf(ostream& os, vtkIndent indent);
38
39   // Description:
40   // Every time the SIL is updated a this will return a different value.
41   virtual int GetSILUpdateStamp();
42
43   // Description:
44   // use this method to enable/disable cell types
45   // the key is encoded with the vtkMedUtilities::CellTypeKey method
46   // which returns a string
47   // CELL_TYPE/MED_ENTITE_MAILLAGE/MED_GEOMETRIE_ELEMENT
48   virtual void SetEntityStatus(const char* key, int flag);
49
50   // Description:
51   // use this method to enable/disable a family support
52   // the key is formatted by the vtkMedUtilities::FamilyKey method which
53   // returns a string
54   // GROUP/MESH_NAME/OnPoint/FAMILY_NAME or GROUP/MESH_NAME/OnCell/FAMILY_NAME
55   virtual void SetGroupStatus(const char* key, int flag);
56
57   // Description :
58   // If set to 1, this filter will prune the empty parts in the output.
59   // If not, then empty datasets will be kept
60   vtkSetMacro(PruneOutput, int);
61   vtkGetMacro(PruneOutput, int);
62
63   int ModifyRequest(vtkInformation* request, int when);
64
65 protected:
66   vtkExtractGroup();
67   ~vtkExtractGroup();
68
69   int RequestInformation(vtkInformation *request,
70       vtkInformationVector **inputVector, vtkInformationVector *outputVector);
71
72   int RequestData(vtkInformation *request, vtkInformationVector **inputVector,
73       vtkInformationVector *outputVector);
74
75   // Description :
76   // returns 1 if this cell type is to be passed through
77   int IsEntitySelected(const char*);
78
79   // Description :
80   // returns 1 if this family is to be passed through
81   int IsFamilySelected(const char* meshName, const char* cellOrPoint,
82       const char* familyName);
83
84   // Description :
85   // removes empty blocks from the vtkMultiBlockDataSet.
86   void PruneEmptyBlocks(vtkMultiBlockDataSet* mb);
87
88   // Description:
89   // This SIL stores the structure of the mesh/groups/cell types
90   // that can be selected.
91   virtual void SetSIL(vtkMutableDirectedGraph*);
92   vtkGetObjectMacro(SIL, vtkMutableDirectedGraph);
93
94   virtual void BuildDefaultSIL(vtkMutableDirectedGraph*);
95
96   // Description:
97   // use this method to enable/disable a family support
98   // the key is formatted by the vtkMedUtilities::FamilyKey method which
99   // returns a string
100   // FAMILY/MESH_NAME/OnPoint/FAMILY_NAME or MESH_NAME/OnCell/FAMILY_NAME
101   virtual void SetFamilyStatus(const char* key, int flag);
102
103   // Description:
104   // Update the Family status from te group status.
105   // The family status is lazily updated when GetFamilyStatus is called.
106   virtual void SelectFamiliesFromGroups();
107
108   // Description:
109   // returns true if the block described by the given information
110   // is selected.
111   virtual int IsBlockSelected(vtkStringArray* path);
112
113   virtual void ClearSelections();
114
115   virtual vtkIdType FindVertex(const char* name);
116
117   vtkMutableDirectedGraph* SIL;
118
119   // Support selection
120   vtkDataArraySelection* Entities;
121   vtkDataArraySelection* Families;
122   vtkDataArraySelection* Groups;
123
124   vtkTimeStamp SILTime;
125   vtkTimeStamp FamilySelectionTime;
126   vtkTimeStamp GroupSelectionTime;
127
128   int PruneOutput;
129
130 private:
131   vtkExtractGroup(const vtkExtractGroup&);
132   void operator=(const vtkExtractGroup&); // Not implemented.
133 };
134
135 #endif