Salome HOME
Minor: removing annoying print message
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedFamilyOnEntityOnProfile.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 : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __vtkMedFamilyOnEntityOnProfile_h_
21 #define __vtkMedFamilyOnEntityOnProfile_h_
22
23 // Description :
24 // This class represents the intersection between a family and an entity and
25 // a cell profile.
26 // This is the smallest partition of the the support in a med file.
27 //
28 // Fields on points are mapped on cell supports if and only if they
29 // fully match the cell support.
30
31 #include "vtkObject.h"
32 #include "vtkMed.h"
33 #include "vtkMedUtilities.h"
34
35 class vtkMedFamilyOnEntity;
36 class vtkMedProfile;
37
38 class vtkBitArray;
39
40 class VTK_EXPORT vtkMedFamilyOnEntityOnProfile : public vtkObject
41 {
42 public :
43   static vtkMedFamilyOnEntityOnProfile* New();
44   vtkTypeMacro(vtkMedFamilyOnEntityOnProfile, vtkObject)
45   void PrintSelf(ostream& os, vtkIndent indent);
46
47   // Description:
48   // This is the family on entity of this support.
49   virtual void  SetFamilyOnEntity(vtkMedFamilyOnEntity*);
50   vtkGetObjectMacro(FamilyOnEntity, vtkMedFamilyOnEntity);
51
52   // Description:
53   // This is the profile of this support.
54   virtual void  SetProfile(vtkMedProfile*);
55   vtkGetObjectMacro(Profile, vtkMedProfile);
56
57   // Description:
58   // This flag informs on the intersection of the family on entity
59   // and the profile.
60   // The intersection can be :
61   // 0 --> not computed
62   // 1 --> exact superposition
63   // 2 --> partial superposition
64   // 3 --> no intersection.
65   enum eIntersectionState
66     {NotComputed = 0,
67     ProfileIncludedInFamily = 1,
68     ProfileIntersectsFamily = 2,
69     NoIntersection = 3};
70
71   vtkGetMacro(IntersectionStatus, eIntersectionState);
72   vtkGetMacro(UseAllPoints, bool);
73
74   // Description:
75   // This method computes the IntersectionStatus and the UseAllPoints flags.
76   virtual void  ComputeIntersection(vtkMedFieldOnProfile*);
77
78   int CanShallowCopyCellField(vtkMedFieldOnProfile* fop);
79   int CanShallowCopyPointField(vtkMedFieldOnProfile* fop);
80   int CanShallowCopy(vtkMedFieldOnProfile* fop);
81   int CanMapField(vtkMedFieldOnProfile* fop);
82
83   enum ePointProfileVsSupportMatch
84     {
85     Unknown = 0,
86     ProfileLargerThanSupport = 1,
87     ProfileEqualsSupport = 2,
88     BadOrNoIntersection = 3
89     };
90
91   // Description:
92   // returns the index to use for this support on the vtk grid
93   // from the index stored on the med file -1 (starting to 0)
94   vtkIdType GetVTKPointIndex(vtkIdType medCIndex);
95
96   // Description:
97   // returns if this point is used by this support.
98   bool KeepPoint(med_int index);
99
100   // Description:
101   // returns if this cell is used by this support. (only look at the family,
102   // not at the profile)
103   bool KeepCell(med_int index);
104
105   // Description:
106   // This flag is set to false when building the
107   // connectivity if it is not valid.
108   vtkGetMacro(Valid, int);
109   vtkSetMacro(Valid, int);
110
111 protected:
112   vtkMedFamilyOnEntityOnProfile();
113   virtual ~vtkMedFamilyOnEntityOnProfile();
114
115   // Description:
116   // Compute the UseAllPoints and IntersectionStatus ivars, depending
117   // on the type of field and the type of support.
118   virtual void  ComputeCellFamilyVsCellProfileMatch();
119   virtual void  ComputePointFamilyVsPointProfileMatch();
120   virtual void  ComputeCellFamilyVsPointProfileMatch(vtkMedProfile*);
121
122   // this method compute the UseAllPoints flag, and the MedToVTKPointIndexMap
123   // if the flag is set to false.
124   virtual void  ComputeUsedPoints();
125
126   vtkMedFamilyOnEntity* FamilyOnEntity;
127   vtkMedProfile* Profile;
128   eIntersectionState IntersectionStatus;
129   bool UseAllPoints;
130   int FieldType;
131   med_geometry_type FieldGeometryType;
132
133   std::map<med_int, med_int> MedToVTKPointIndexMap;
134
135   std::map<vtkMedProfile*, ePointProfileVsSupportMatch> PointProfileMatch;
136
137   bool MatchComputed;
138   int Valid;
139
140 private:
141   vtkMedFamilyOnEntityOnProfile(const vtkMedFamilyOnEntityOnProfile&);
142     // Not implemented.
143   void operator=(const vtkMedFamilyOnEntityOnProfile&); // Not implemented.
144 };
145
146 #endif //__vtkMedFamilyOnEntityOnProfile_h_