Back to index

salome-paravis  6.5.0
vtkMedField.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 __vtkMedField_h_
00021 #define __vtkMedField_h_
00022 
00023 #include "vtkObject.h"
00024 #include "vtkMedSetGet.h"
00025 #include "vtkMed.h"
00026 
00027 #include "vtkSmartPointer.h"
00028 
00029 #include <set>
00030 
00031 class vtkStringArray;
00032 
00033 class vtkMedInterpolation;
00034 class vtkMedFieldOverEntity;
00035 class vtkMedString;
00036 class vtkMedFieldStep;
00037 class vtkMedComputeStep;
00038 template <class T>
00039 class vtkMedComputeStepMap;
00040 class vtkMedFile;
00041 
00042 class VTK_EXPORT vtkMedField: public vtkObject
00043 {
00044 public:
00045   static vtkMedField* New();
00046   vtkTypeRevisionMacro(vtkMedField, vtkObject);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00049   // Description:
00050   // The number of component of this field
00051   virtual void  SetNumberOfComponent(int);
00052   vtkGetMacro(NumberOfComponent, int);
00053 
00054   // Description:
00055   // The type of data stored in this field
00056   vtkSetMacro(DataType, med_field_type);
00057   vtkGetMacro(DataType, med_field_type);
00058 
00059   // Description:
00060   // The name of this field
00061   vtkGetStringMacro(Name);
00062   vtkSetStringMacro(Name);
00063 
00064   // Description:
00065   // The name of this mesh this field is on
00066   vtkGetStringMacro(MeshName);
00067   vtkSetStringMacro(MeshName);
00068 
00069   // Description:
00070   // The name of this mesh this field is on
00071   vtkGetStringMacro(TimeUnit);
00072   vtkSetStringMacro(TimeUnit);
00073 
00074   // Description:
00075   // The units of each component of this field
00076   vtkGetObjectMacro(Unit, vtkStringArray);
00077 
00078   // Description:
00079   // The name of each component of this field
00080   vtkGetObjectMacro(ComponentName, vtkStringArray);
00081 
00082   // Description:
00083   // add a cell type as support to this field
00084   void  AddFieldStep(vtkMedFieldStep*);
00085   void  ClearFieldStep();
00086   vtkMedFieldStep* GetFieldStep(const vtkMedComputeStep&);
00087   vtkMedFieldStep* FindFieldStep(const vtkMedComputeStep&, int);
00088   med_int GetNumberOfFieldStep();
00089   vtkMedFieldStep* GetFieldStep(med_int);
00090   void  GatherFieldTimes(std::set<med_float>&);
00091   void  GatherFieldIterations(med_float,std::set<med_int>&);
00092 
00093   // Description:
00094   // returns if the field is on point, cell, quadrature point or elno
00095   //BTX
00096   enum {
00097     UnknownFieldType = 0x00,
00098     PointField = 0x01,
00099     CellField = 0x02,
00100     QuadratureField = 0x04,
00101     ElnoField = 0x08};
00102   //ETX
00103   //Description:
00104   // returns the type of field this is. The returned code is and OR between
00105   // the different possible types.
00106   vtkGetMacro(FieldType, int);
00107 
00108   // This computes the FieldType
00109   // (currently, it does it by looking only at the first compute step)
00110   virtual void  ComputeFieldType();
00111 
00112   // Description:
00113   // This returns true if the FieldType is composed of several types
00114   virtual int HasManyFieldTypes();
00115 
00116   // Description:
00117   // returns the first support type this field is on.
00118   virtual int GetFirstType();
00119 
00120   // Description:
00121   // This methods extracts from the other field all the fields that are
00122   // on the given support type and add them to the current field.
00123   // It also updates the other FieldType ivar.
00124   virtual void  ExtractFieldType(vtkMedField* otherfield, int type);
00125 
00126   // Description:
00127   // The index of this field in the med file
00128   vtkSetMacro(MedIterator, med_int);
00129   vtkGetMacro(MedIterator, med_int);
00130 
00131   // Description:
00132   // if the mesh is local or not.
00133   vtkSetMacro(Local, med_int);
00134   vtkGetMacro(Local, med_int);
00135 
00136   // Description:
00137   // The interpolation functions associated with this field
00138   vtkGetObjectVectorMacro(Interpolation, vtkMedInterpolation);
00139   vtkSetObjectVectorMacro(Interpolation, vtkMedInterpolation);
00140 
00141   // Description:
00142   // This stores the file this field is stored on.
00143   virtual void  SetParentFile(vtkMedFile*);
00144   vtkGetObjectMacro(ParentFile, vtkMedFile);
00145 
00146 protected:
00147   vtkMedField();
00148   virtual ~vtkMedField();
00149 
00150   vtkSetMacro(FieldType, int);
00151 
00152   int NumberOfComponent;
00153   med_field_type DataType;
00154   med_int MedIterator;
00155   med_int Local;
00156   char* Name;
00157   char* MeshName;
00158   char* TimeUnit;
00159   int FieldType;
00160   vtkMedFile* ParentFile;
00161 
00162   //BTX
00163   vtkMedComputeStepMap<vtkMedFieldStep>* FieldStep;
00164   vtkObjectVector<vtkMedInterpolation>* Interpolation;
00165   //ETX
00166 
00167   vtkStringArray* Unit;
00168   vtkStringArray* ComponentName;
00169 
00170 private:
00171   vtkMedField(const vtkMedField&); // Not implemented.
00172   void operator=(const vtkMedField&); // Not implemented.
00173 
00174 };
00175 
00176 #endif //__vtkMedField_h_