Back to index

salome-paravis  6.5.0
vtkMedFamilyOnEntityOnProfile.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __vtkMedFamilyOnEntityOnProfile_h_
00021 #define __vtkMedFamilyOnEntityOnProfile_h_
00022 
00023 // Description :
00024 // This class represents the intersection between a family and an entity and
00025 // a cell profile.
00026 // This is the smallest partition of the the support in a med file.
00027 //
00028 // Fields on points are mapped on cell supports if and only if they
00029 // fully match the cell support.
00030 
00031 #include "vtkObject.h"
00032 #include "vtkMed.h"
00033 #include "vtkMedUtilities.h"
00034 
00035 class vtkMedFamilyOnEntity;
00036 class vtkMedProfile;
00037 
00038 class vtkBitArray;
00039 
00040 class VTK_EXPORT vtkMedFamilyOnEntityOnProfile : public vtkObject
00041 {
00042 public :
00043   static vtkMedFamilyOnEntityOnProfile* New();
00044   vtkTypeRevisionMacro(vtkMedFamilyOnEntityOnProfile, vtkObject)
00045   void PrintSelf(ostream& os, vtkIndent indent);
00046 
00047   // Description:
00048   // This is the family on entity of this support.
00049   virtual void  SetFamilyOnEntity(vtkMedFamilyOnEntity*);
00050   vtkGetObjectMacro(FamilyOnEntity, vtkMedFamilyOnEntity);
00051 
00052   // Description:
00053   // This is the profile of this support.
00054   virtual void  SetProfile(vtkMedProfile*);
00055   vtkGetObjectMacro(Profile, vtkMedProfile);
00056 
00057   // Description:
00058   // This flag informs on the intersection of the family on entity
00059   // and the profile.
00060   // The intersection can be :
00061   // 0 --> not computed
00062   // 1 --> exact superposition
00063   // 2 --> partial superposition
00064   // 3 --> no intersection.
00065   enum eIntersectionState
00066     {NotComputed = 0,
00067     ProfileIncludedInFamily = 1,
00068     ProfileIntersectsFamily = 2,
00069     NoIntersection = 3};
00070 
00071   vtkGetMacro(IntersectionStatus, eIntersectionState);
00072   vtkGetMacro(UseAllPoints, bool);
00073 
00074   // Description:
00075   // This method computes the IntersectionStatus and the UseAllPoints flags.
00076   virtual void  ComputeIntersection(vtkMedFieldOnProfile*);
00077 
00078   int CanShallowCopyCellField(vtkMedFieldOnProfile* fop);
00079   int CanShallowCopyPointField(vtkMedFieldOnProfile* fop);
00080   int CanShallowCopy(vtkMedFieldOnProfile* fop);
00081   int CanMapField(vtkMedFieldOnProfile* fop);
00082 
00083   enum ePointProfileVsSupportMatch
00084     {
00085     Unknown = 0,
00086     ProfileLargerThanSupport = 1,
00087     ProfileEqualsSupport = 2,
00088     BadOrNoIntersection = 3
00089     };
00090 
00091   // Description:
00092   // returns the index to use for this support on the vtk grid
00093   // from the index stored on the med file -1 (starting to 0)
00094   vtkIdType GetVTKPointIndex(vtkIdType medCIndex);
00095 
00096   // Description:
00097   // returns if this point is used by this support.
00098   bool KeepPoint(med_int index);
00099 
00100   // Description:
00101   // returns if this cell is used by this support. (only look at the family,
00102   // not at the profile)
00103   bool KeepCell(med_int index);
00104 
00105   // Description:
00106   // This flag is set to false when building the
00107   // connectivity if it is not valid.
00108   vtkGetMacro(Valid, int);
00109   vtkSetMacro(Valid, int);
00110 
00111 protected:
00112   vtkMedFamilyOnEntityOnProfile();
00113   virtual ~vtkMedFamilyOnEntityOnProfile();
00114 
00115   // Description:
00116   // Compute the UseAllPoints and IntersectionStatus ivars, depending
00117   // on the type of field and the type of support.
00118   virtual void  ComputeCellFamilyVsCellProfileMatch();
00119   virtual void  ComputePointFamilyVsPointProfileMatch();
00120   virtual void  ComputeCellFamilyVsPointProfileMatch(vtkMedProfile*);
00121 
00122   // this method compute the UseAllPoints flag, and the MedToVTKPointIndexMap
00123   // if the flag is set to false.
00124   virtual void  ComputeUsedPoints();
00125 
00126   vtkMedFamilyOnEntity* FamilyOnEntity;
00127   vtkMedProfile* Profile;
00128   eIntersectionState IntersectionStatus;
00129   bool UseAllPoints;
00130   int FieldType;
00131   med_geometry_type FieldGeometryType;
00132 
00133   std::map<med_int, med_int> MedToVTKPointIndexMap;
00134 
00135   std::map<vtkMedProfile*, ePointProfileVsSupportMatch> PointProfileMatch;
00136 
00137   bool MatchComputed;
00138   int Valid;
00139 
00140 private:
00141   vtkMedFamilyOnEntityOnProfile(const vtkMedFamilyOnEntityOnProfile&);
00142     // Not implemented.
00143   void operator=(const vtkMedFamilyOnEntityOnProfile&); // Not implemented.
00144 };
00145 
00146 #endif //__vtkMedFamilyOnEntityOnProfile_h_