Back to index

salome-paravis  6.5.0
vtkMedGrid.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 __vtkMedGrid_h_
00021 #define __vtkMedGrid_h_
00022 
00023 #include "vtkObject.h"
00024 #include "vtkMedSetGet.h"
00025 #include "vtkMedUtilities.h"
00026 #include "vtkMed.h"
00027 #include "vtkMedIntArray.h"
00028 
00029 class vtkMedString;
00030 class vtkMedFamilyOnEntity;
00031 class vtkMedIntArray;
00032 
00033 class VTK_EXPORT vtkMedGrid : public vtkObject
00034 {
00035 public :
00036   vtkTypeRevisionMacro(vtkMedGrid, vtkObject)
00037   void PrintSelf(ostream& os, vtkIndent indent);
00038 
00039   // Description:
00040   // This identifies the time and iteration of this grid
00041   void  SetComputeStep(vtkMedComputeStep cs)
00042     {
00043     this->ComputeStep = cs;
00044     }
00045   vtkMedComputeStep  GetComputeStep()
00046     {
00047     return this->ComputeStep;
00048     }
00049 
00050   // Description:
00051   // returns the number of points. Each sub class has to implement this method.
00052   virtual med_int GetNumberOfPoints() = 0;
00053 
00054   // Description:
00055   // Initialize the global Ids of the first element of each MedEntityArray
00056   virtual void  InitializeCellGlobalIds(){;}
00057 
00058   // Description:
00059   // this stores the array giving the family id for each point of this mesh.
00060   //vtkGetObjectVectorMacro(PointFamilyData, vtkMedFamilyOnEntity);
00061   //vtkSetObjectVectorMacro(PointFamilyData, vtkMedFamilyOnEntity);
00062   //virtual vtkMedFamilyOnEntity* GetPointFamilyDataById(med_int id);
00063 
00064   // Description:
00065   // Gather the families that are present on this mesh nodes
00066   //virtual void ComputePointFamilies();
00067 
00068   // Description:
00069   // this array contains the global ids of the points used by the grid.
00070   virtual void  SetPointGlobalIds(vtkMedIntArray*);
00071   vtkGetObjectMacro(PointGlobalIds, vtkMedIntArray);
00072 
00073   // Description:
00074   // this array contains the family ids of the points used by the grid.
00075   //virtual void  SetPointFamilyIds(vtkMedIntArray*);
00076   //vtkGetObjectMacro(PointFamilyIds, vtkMedIntArray);
00077 
00078   // Description:
00079   // The mesh that use this grid
00080   virtual void  SetParentMesh(vtkMedMesh*);
00081   vtkGetObjectMacro(ParentMesh, vtkMedMesh);
00082 
00083   // Description:
00084   // The mesh that use this grid
00085   virtual void  SetPreviousGrid(vtkMedGrid*);
00086   vtkGetObjectMacro(PreviousGrid, vtkMedGrid);
00087 
00088   // Description:
00089   // returns 1 if the global Ids array is set, and the
00090   //  number of tuples matches the number of points
00091   virtual int IsPointGlobalIdsLoaded();
00092 
00093   // Description:
00094   // clear the entity arrays storing the connectivity
00095   virtual void  ClearMedSupports();
00096 
00097   // Description:
00098   // This is the coordinate system the grid live in.
00099   vtkSetMacro(CoordinateSystem, med_axis_type);
00100   vtkGetMacro(CoordinateSystem, med_axis_type);
00101 
00102   // Description:
00103   // This flag is set during the information loading, and tells if the
00104   // coordinates of this grid at this step has changed from the previous step.
00105   // if not, you should request the coordinates array from the previous grid
00106   // instead of this one.
00107   vtkSetMacro(UsePreviousCoordinates, bool);
00108   vtkGetMacro(UsePreviousCoordinates, bool);
00109 
00110   // Description:
00111   // Add a cell array to this unstructured grid.
00112   // each cell array represents a different cell type.
00113   vtkGetObjectVectorMacro(EntityArray, vtkMedEntityArray);
00114   vtkSetObjectVectorMacro(EntityArray, vtkMedEntityArray);
00115 
00116   // Description:
00117   // load the family ids using the driver
00118   //void  LoadPointFamilyIds();
00119 
00120   virtual void  LoadCoordinates() = 0;
00121   virtual int  IsCoordinatesLoaded() = 0;
00122 
00123   // Description:
00124   // return the vtkMedEntityArray that match the Entity type, if any.
00125   virtual vtkMedEntityArray* GetEntityArray(const vtkMedEntity&);
00126 
00127   virtual double* GetCoordTuple(med_int index) = 0;
00128 
00129   // Description:
00130   // This will instanciate a new vtkDataSet object.
00131   // The caller is responsible for deleting it.
00132   virtual vtkDataSet* CreateVTKDataSet(vtkMedFamilyOnEntityOnProfile*) = 0;
00133   
00134   //  Description:
00135   // This utility method returns all vtkMedEntity types present in this grid
00136   virtual void  GatherMedEntities(std::set<vtkMedEntity>& entities);
00137 
00138 protected:
00139   vtkMedGrid();
00140   virtual ~vtkMedGrid();
00141 
00142   vtkMedComputeStep ComputeStep;
00143   vtkMedIntArray* PointGlobalIds;
00144   //vtkMedIntArray* PointFamilyIds;
00145 
00146   vtkMedMesh* ParentMesh;
00147 
00148   vtkMedGrid* PreviousGrid;
00149 
00150   //BTX
00151   //vtkObjectVector<vtkMedFamilyOnEntity>* PointFamilyData;
00152   //ETX
00153 
00154   bool UsePreviousCoordinates;
00155   med_axis_type CoordinateSystem;
00156   //BTX
00157   vtkObjectVector<vtkMedEntityArray>* EntityArray;
00158   //ETX
00159 
00160 private:
00161   vtkMedGrid(const vtkMedGrid&); // Not implemented.
00162   void operator=(const vtkMedGrid&); // Not implemented.
00163 
00164 };
00165 
00166 #endif //__vtkMedGrid_h_