Back to index

salome-paravis  6.5.0
vtkMedEntityArray.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 __vtkMedEntityArray_h_
00021 #define __vtkMedEntityArray_h_
00022 
00023 #include "vtkObject.h"
00024 #include "vtkMedSetGet.h"
00025 #include "vtkMedUtilities.h"
00026 #include "vtkMed.h"
00027 #include "vtkMedFilter.h"
00028 
00029 class vtkMedIntArray;
00030 class vtkFamilyIdSet;
00031 class vtkMedFamily;
00032 class vtkMedFamilyOnEntity;
00033 class vtkMedMesh;
00034 class vtkMedGrid;
00035 class vtkIdList;
00036 class vtkMedStructElement;
00037 class vtkMedVariableAttribute;
00038 
00039 class VTK_EXPORT vtkMedEntityArray: public vtkObject
00040 {
00041 public:
00042   static vtkMedEntityArray* New();
00043   vtkTypeRevisionMacro(vtkMedEntityArray, vtkObject)
00044   void PrintSelf(ostream& os, vtkIndent indent);
00045 
00046   // Description:
00047   // This is the number of cells of this entity type.
00048   vtkSetMacro(NumberOfEntity, vtkIdType);
00049   vtkGetMacro(NumberOfEntity, vtkIdType);
00050 
00051   // Description:
00052   // the support of the cells : one of
00053   void  SetEntity(const vtkMedEntity& entity){this->Entity = entity;}
00054   const vtkMedEntity& GetEntity(){return this->Entity;}
00055 
00056   // Description:
00057   // This connectivity type of this entity : one of
00058   // MED_NODAL, MED_DESCENDING, MED_NO_CMODE
00059   vtkSetMacro(Connectivity, med_connectivity_mode);
00060   vtkGetMacro(Connectivity, med_connectivity_mode);
00061 
00062   // Description:
00063   // This array stores the family ids of each entity.
00064   virtual void SetConnectivityArray(vtkMedIntArray*);
00065   vtkGetObjectMacro(ConnectivityArray, vtkMedIntArray);
00066 
00067   // Description:
00068   // This array stores the connectivity array for this entity.
00069   virtual void SetFamilyIds(vtkMedIntArray*);
00070   virtual med_int GetFamilyId(med_int id);
00071 
00072   // Description:
00073   // This array stores the global Ids of the entities.
00074   virtual void SetGlobalIds(vtkMedIntArray*);
00075   vtkGetObjectMacro(GlobalIds, vtkMedIntArray);
00076 
00077   // Description:
00078   // For polygons, this array stores the index of each edge described in
00079   // the connectivity array
00080   // For polyhedrons, this arrays stores the index of each face described
00081   // in the NodeIndex array
00082   virtual void SetFaceIndex(vtkMedIntArray*);
00083   vtkGetObjectMacro(FaceIndex, vtkMedIntArray);
00084 
00085   // Description:
00086   // For polyhedrons, this arrays can store either
00087   // the index of each node of each face described in the Index1 array
00088   // (node connectivity) or the type each face described in the Index1
00089   // array (hierarchical connectivity)
00090   virtual void SetNodeIndex(vtkMedIntArray*);
00091   vtkGetObjectMacro(NodeIndex, vtkMedIntArray);
00092 
00093   // Description:
00094   // Arrays of entities are partitionned over families.
00095   vtkSetObjectVectorMacro(FamilyOnEntity, vtkMedFamilyOnEntity);
00096   vtkGetObjectVectorMacro(FamilyOnEntity, vtkMedFamilyOnEntity);
00097 
00098   // Description:
00099   // For polyhedrons, this arrays can store either
00100   // the index of each node of each face described in the Index1 array
00101   // (node connectivity) or the type each face described in the Index1
00102   // array (hierarchical connectivity)
00103   virtual void  SetParentGrid(vtkMedGrid*);
00104   vtkGetObjectMacro(ParentGrid, vtkMedGrid);
00105 
00106   // Description:
00107   // Compute the list of families that are on this array
00108   virtual void  ComputeFamilies();
00109 
00110   // Description:
00111   // returns true if there are cells of the given family on this entity.
00112   virtual int HasFamily(vtkMedFamily*);
00113 
00114   // Description:
00115   // returns 1 if the connectivity array is set and matches the number of
00116   // connectivity elements.
00117   virtual int IsConnectivityLoaded();
00118 
00119   // Description:
00120   // returns 1 if the family ids is set and matches the number of entities.
00121   virtual int IsFamilyIdsLoaded();
00122 
00123   // Description:
00124   // returns 1 if the global ids is set and matches the number of entities.
00125   virtual int IsGlobalIdsLoaded();
00126 
00127   // Description :
00128   // This gives the global id of the first element of this array.
00129   vtkSetMacro(InitialGlobalId, vtkIdType);
00130   vtkGetMacro(InitialGlobalId, vtkIdType);
00131 
00132   // Description :
00133   // resets all to default status, release memory
00134   virtual void Initialize();
00135 
00136   // Description:
00137   // Get the indices of the vertices used by a given cell.
00138   void  GetCellVertices(vtkIdType, vtkIdList*);
00139 
00140   virtual void  LoadConnectivity();
00141 
00142   // Descritpion:
00143   // This is a pointer to the StructElement object if any
00144   // This pointer is set during the LinkMedInfo pass
00145   virtual void  SetStructElement(vtkMedStructElement*);
00146   vtkGetObjectMacro(StructElement, vtkMedStructElement);
00147 
00148   void  SetVariableAttributeValues(vtkMedVariableAttribute*,
00149                                    vtkAbstractArray*);
00150   vtkAbstractArray* GetVariableAttributeValue(vtkMedVariableAttribute*);
00151 
00152   // Description:
00153   // Get/Set of the MED Filter for parallel reading.
00154   void  SetFilter(vtkMedFilter* filter){this->Filter = filter;}
00155   vtkMedFilter* GetFilter(){return this->Filter;}
00156 
00157 protected:
00158   vtkMedEntityArray();
00159   virtual ~vtkMedEntityArray();
00160 
00161   vtkIdType NumberOfEntity;
00162   vtkMedEntity Entity;
00163 
00164   vtkMedFilter* Filter;
00165 
00166   med_connectivity_mode Connectivity;
00167   vtkIdType InitialGlobalId;
00168 
00169   vtkMedGrid* ParentGrid;
00170 
00171   vtkMedIntArray* FamilyIds;
00172   vtkMedIntArray* GlobalIds;
00173   vtkMedIntArray* ConnectivityArray;
00174   vtkMedIntArray* FaceIndex;
00175   vtkMedIntArray* NodeIndex;
00176 
00177   vtkMedStructElement* StructElement;
00178 
00179   int FamilyIdStatus;
00180   enum{
00181     FAMILY_ID_NOT_LOADED,
00182     FAMILY_ID_IMPLICIT,
00183     FAMILY_ID_EXPLICIT
00184   };
00185 
00186   //BTX
00187   vtkObjectVector<vtkMedFamilyOnEntity>* FamilyOnEntity;
00188 
00189   std::map<vtkMedVariableAttribute*, vtkSmartPointer<vtkAbstractArray> >
00190       VariableAttributeValue;
00191   //ETX
00192 
00193   int Valid;
00194 
00195 private:
00196   vtkMedEntityArray(const vtkMedEntityArray&); // Not implemented.
00197   void operator=(const vtkMedEntityArray&); // Not implemented.
00198 };
00199 
00200 #endif //__vtkMedEntityArray_h_