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