Back to index

salome-paravis  6.5.0
vtkMedMesh.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 __vtkMedMesh_h_
00021 #define __vtkMedMesh_h_
00022 
00023 #include "vtkObject.h"
00024 #include "vtkMedSetGet.h"
00025 #include "vtkMed.h"
00026 #include "vtkMedUtilities.h"
00027 
00028 class vtkMedGrid;
00029 class vtkMedFamily;
00030 class vtkMedGroup;
00031 class vtkMedString;
00032 class vtkMedIntArray;
00033 class vtkMedComputeStep;
00034 class vtkMedFile;
00035 class vtkStringArray;
00036 
00037 #include <set>
00038 
00039 class VTK_EXPORT vtkMedMesh: public vtkObject
00040 {
00041 public:
00042   static vtkMedMesh* New();
00043   vtkTypeRevisionMacro(vtkMedMesh, vtkObject);
00044   void PrintSelf(ostream& os, vtkIndent indent);
00045 
00046   // Description:
00047   // The name of the mesh in the med file.
00048   vtkGetStringMacro(Name);
00049   vtkSetStringMacro(Name);
00050 
00051   // Description:
00052   // The universal name of the mesh.
00053   vtkGetStringMacro(UniversalName);
00054   vtkSetStringMacro(UniversalName);
00055 
00056   // Description:
00057   // The name of the mesh in the med file.
00058   vtkGetStringMacro(Description);
00059   vtkSetStringMacro(Description);
00060 
00061   // Description:
00062   // The unit of the time steps.
00063   vtkGetStringMacro(TimeUnit);
00064   vtkSetStringMacro(TimeUnit);
00065 
00066   // Description:
00067   // The dimension of the space this mesh lives in
00068   vtkSetMacro(SpaceDimension, med_int);
00069   vtkGetMacro(SpaceDimension, med_int);
00070 
00071   // Description:
00072   // The dimension of this mesh
00073   vtkSetMacro(MeshDimension, med_int);
00074   vtkGetMacro(MeshDimension, med_int);
00075 
00076   // Description:
00077   // The type of grid used by this mesh
00078   vtkSetMacro(MeshType, med_mesh_type);
00079   vtkGetMacro(MeshType, med_mesh_type);
00080 
00081   // Description:
00082   // This stores how the compute steps should be iterated over
00083   // either first by time or first by iteration
00084   vtkSetMacro(SortingType, med_sorting_type);
00085   vtkGetMacro(SortingType, med_sorting_type);
00086 
00087   // Description:
00088   // This is the type of the axis
00089   // MED_CARTESIAN, MED_CYLINDRICAL, MED_SPHERICAL or MED_UNDEF_AXIS_TYPE
00090   vtkSetMacro(AxisType, med_axis_type);
00091   vtkGetMacro(AxisType, med_axis_type);
00092 
00093   // Description:
00094   // This is the type of the axis
00095   // MED_CARTESIAN, MED_CYLINDRICAL, MED_SPHERICAL or MED_UNDEF_AXIS_TYPE
00096   vtkSetMacro(StructuredGridType, med_grid_type);
00097   vtkGetMacro(StructuredGridType, med_grid_type);
00098 
00099   // Description:
00100   // a mesh can be modified over time, so this stores the
00101   // different compute steps of a given mesh
00102   void  AddGridStep(vtkMedGrid*);
00103   void  ClearGridStep();
00104   vtkMedGrid* GetGridStep(const vtkMedComputeStep&);
00105   vtkMedGrid* FindGridStep(const vtkMedComputeStep&, int);
00106   med_int GetNumberOfGridStep();
00107   vtkMedGrid* GetGridStep(med_int);
00108   void  GatherGridTimes(std::set<med_float>&);
00109   void  GatherGridIterations(med_float,std::set<med_int>&);
00110 
00111   // Description:
00112   // Container of the cell families in this mesh
00113   vtkGetObjectVectorMacro(CellFamily, vtkMedFamily);
00114   vtkSetObjectVectorMacro(CellFamily, vtkMedFamily);
00115   virtual vtkMedFamily* GetOrCreateCellFamilyById(med_int);
00116 
00117   // Description:
00118   // Get the Point Families
00119   vtkGetObjectVectorMacro(PointFamily, vtkMedFamily);
00120   vtkSetObjectVectorMacro(PointFamily, vtkMedFamily);
00121   virtual vtkMedFamily* GetOrCreatePointFamilyById(med_int);
00122 
00123   int GetNumberOfFamily();
00124   vtkMedFamily* GetFamily(int);
00125 
00126   // Description:
00127   // Container of the groups in this mesh
00128   vtkGetObjectVectorMacro(PointGroup, vtkMedGroup);
00129   vtkSetObjectVectorMacro(PointGroup, vtkMedGroup);
00130   vtkGetObjectVectorMacro(CellGroup, vtkMedGroup);
00131   vtkSetObjectVectorMacro(CellGroup, vtkMedGroup);
00132   virtual vtkMedGroup*  GetOrCreateGroup(int pointOrCell, const char*);
00133 
00134   // Description:
00135   // this id is the id to use when reading the med file
00136   vtkSetMacro(MedIterator, med_int);
00137   vtkGetMacro(MedIterator, med_int);
00138 
00139   // Description:
00140   // This stores the name of each axis
00141   vtkGetObjectMacro(AxisName, vtkStringArray);
00142 
00143   // Description:
00144   // This stores the unit of each axis
00145   vtkGetObjectMacro(AxisUnit, vtkStringArray);
00146 
00147   // Description:
00148   // This sets the number of axis of this mesh, and also allocates
00149   // the arrays to store the name and unit of each axis.
00150   void  SetNumberOfAxis(int);
00151   int GetNumberOfAxis();
00152 
00153   // Description:
00154   // free the memory used by this mesh (coordinates, connectivity)
00155   virtual void  ClearMedSupports();
00156 
00157   // Description:
00158   // The name of the mesh in the med file.
00159   virtual void  SetParentFile(vtkMedFile*);
00160   vtkGetObjectMacro(ParentFile, vtkMedFile);
00161 
00162   // Description:
00163   // This helper method fills the std::set with all vtkMedEntity types used in the first grid step
00164   // MED specifies that all types must be present in the first step for a varying mesh to be valid
00165   virtual void  GatherMedEntities(std::set<vtkMedEntity>& entities);
00166 
00167 protected:
00168   vtkMedMesh();
00169   virtual ~vtkMedMesh();
00170 
00171   char* Name;
00172   char* UniversalName;
00173   char* Description;
00174   char* TimeUnit;
00175   med_int MedIterator;
00176   med_int SpaceDimension;
00177   med_int MeshDimension;
00178   med_mesh_type MeshType;
00179   med_sorting_type SortingType;
00180   med_axis_type AxisType;
00181   med_grid_type StructuredGridType;
00182 
00183   vtkMedFile* ParentFile;
00184 
00185   vtkObjectVector<vtkMedFamily>* CellFamily;
00186   vtkObjectVector<vtkMedFamily>* PointFamily;
00187 
00188   vtkObjectVector<vtkMedGroup>* PointGroup;
00189   vtkObjectVector<vtkMedGroup>* CellGroup;
00190 
00191   vtkStringArray* AxisName;
00192   vtkStringArray* AxisUnit;
00193 
00194   vtkMedComputeStepMap<vtkMedGrid>* GridStep;
00195 
00196   bool IsSupportMesh;
00197 
00198 private:
00199   vtkMedMesh(const vtkMedMesh&); // Not implemented.
00200   void operator=(const vtkMedMesh&); // Not implemented.
00201 
00202 };
00203 
00204 #endif //__vtkMedMesh_h_