1 // Copyright (C) 2010-2013 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.
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
20 #ifndef __vtkMedFamilyOnEntityOnProfile_h_
21 #define __vtkMedFamilyOnEntityOnProfile_h_
24 // This class represents the intersection between a family and an entity and
26 // This is the smallest partition of the the support in a med file.
28 // Fields on points are mapped on cell supports if and only if they
29 // fully match the cell support.
31 #include "vtkObject.h"
33 #include "vtkMedUtilities.h"
35 class vtkMedFamilyOnEntity;
40 class VTK_EXPORT vtkMedFamilyOnEntityOnProfile : public vtkObject
43 static vtkMedFamilyOnEntityOnProfile* New();
44 vtkTypeMacro(vtkMedFamilyOnEntityOnProfile, vtkObject)
45 void PrintSelf(ostream& os, vtkIndent indent);
48 // This is the family on entity of this support.
49 virtual void SetFamilyOnEntity(vtkMedFamilyOnEntity*);
50 vtkGetObjectMacro(FamilyOnEntity, vtkMedFamilyOnEntity);
53 // This is the profile of this support.
54 virtual void SetProfile(vtkMedProfile*);
55 vtkGetObjectMacro(Profile, vtkMedProfile);
58 // This flag informs on the intersection of the family on entity
60 // The intersection can be :
62 // 1 --> exact superposition
63 // 2 --> partial superposition
64 // 3 --> no intersection.
65 enum eIntersectionState
67 ProfileIncludedInFamily = 1,
68 ProfileIntersectsFamily = 2,
71 vtkGetMacro(IntersectionStatus, eIntersectionState);
72 vtkGetMacro(UseAllPoints, bool);
75 // This method computes the IntersectionStatus and the UseAllPoints flags.
76 virtual void ComputeIntersection(vtkMedFieldOnProfile*);
78 int CanShallowCopyCellField(vtkMedFieldOnProfile* fop);
79 int CanShallowCopyPointField(vtkMedFieldOnProfile* fop);
80 int CanShallowCopy(vtkMedFieldOnProfile* fop);
81 int CanMapField(vtkMedFieldOnProfile* fop);
83 enum ePointProfileVsSupportMatch
86 ProfileLargerThanSupport = 1,
87 ProfileEqualsSupport = 2,
88 BadOrNoIntersection = 3
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);
97 // returns if this point is used by this support.
98 bool KeepPoint(med_int index);
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);
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);
112 vtkMedFamilyOnEntityOnProfile();
113 virtual ~vtkMedFamilyOnEntityOnProfile();
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*);
122 // this method compute the UseAllPoints flag, and the MedToVTKPointIndexMap
123 // if the flag is set to false.
124 virtual void ComputeUsedPoints();
126 vtkMedFamilyOnEntity* FamilyOnEntity;
127 vtkMedProfile* Profile;
128 eIntersectionState IntersectionStatus;
131 med_geometry_type FieldGeometryType;
133 std::map<med_int, med_int> MedToVTKPointIndexMap;
135 std::map<vtkMedProfile*, ePointProfileVsSupportMatch> PointProfileMatch;
141 vtkMedFamilyOnEntityOnProfile(const vtkMedFamilyOnEntityOnProfile&);
143 void operator=(const vtkMedFamilyOnEntityOnProfile&); // Not implemented.
146 #endif //__vtkMedFamilyOnEntityOnProfile_h_