Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef VISU_MeshValue_HeaderFile
00029 #define VISU_MeshValue_HeaderFile
00030
00036 #include "VISU_Convertor.hxx"
00037 #include "VISU_ConvertorDef_impl.hxx"
00038
00039 #include "MED_SliceArray.hxx"
00040 #include "MED_Vector.hxx"
00041
00042 namespace VISU
00043 {
00044
00046 class VISU_CONVERTOR_EXPORT TMeshValueBase
00047 {
00048 public:
00050 void
00051 Init(vtkIdType theNbElem,
00052 vtkIdType theNbGauss,
00053 vtkIdType theNbComp);
00054
00056 virtual
00057 unsigned long int
00058 GetMemorySize() const = 0;
00059
00061 vtkIdType
00062 GetNbElem() const;
00063
00065 vtkIdType
00066 GetNbComp() const;
00067
00069 vtkIdType
00070 GetNbGauss() const;
00071
00072 size_t
00073 size() const;
00074
00075 protected:
00076 vtkIdType myNbElem;
00077 vtkIdType myNbComp;
00078 vtkIdType myNbGauss;
00079 vtkIdType myStep;
00080 };
00081 typedef MED::SharedPtr<TMeshValueBase> PMeshValue;
00082
00083
00084
00086 template<class TValueType>
00087 class VISU_CONVERTOR_EXPORT TTMeshValue: public virtual TMeshValueBase
00088 {
00089 public:
00090 typedef MED::TSlice<TValueType> TValueSlice;
00091 typedef MED::TCSlice<TValueType> TCValueSlice;
00092
00093 typedef TVector<TCValueSlice> TCValueSliceArr;
00094 typedef TVector<TValueSlice> TValueSliceArr;
00095
00096 virtual
00097 const TValueType*
00098 GetPointer() const = 0;
00099
00100 virtual
00101 TValueType*
00102 GetPointer() = 0;
00103
00105 TCValueSliceArr
00106 GetGaussValueSliceArr(vtkIdType theElemId) const
00107 {
00108 TCValueSliceArr aValueSliceArr(this->myNbGauss);
00109 vtkIdType anId = theElemId * this->myStep;
00110 for(vtkIdType aGaussId = 0; aGaussId < this->myNbGauss; aGaussId++){
00111 aValueSliceArr[aGaussId] =
00112 TCValueSlice(this->GetPointer(),
00113 this->size(),
00114 std::slice(anId, this->myNbComp, 1));
00115 anId += this->myNbComp;
00116 }
00117 return aValueSliceArr;
00118 }
00119
00121 TValueSliceArr
00122 GetGaussValueSliceArr(vtkIdType theElemId)
00123 {
00124 TValueSliceArr aValueSliceArr(this->myNbGauss);
00125 vtkIdType anId = theElemId * this->myStep;
00126 for(vtkIdType aGaussId = 0; aGaussId < this->myNbGauss; aGaussId++){
00127 aValueSliceArr[aGaussId] =
00128 TValueSlice(this->GetPointer(),
00129 this->size(),
00130 std::slice(anId, this->myNbComp, 1));
00131 anId += this->myNbComp;
00132 }
00133 return aValueSliceArr;
00134 }
00135
00137 TCValueSliceArr
00138 GetCompValueSliceArr(vtkIdType theElemId) const
00139 {
00140 TCValueSliceArr aValueSliceArr(this->myNbComp);
00141 vtkIdType anId = theElemId * this->myStep;
00142 for(vtkIdType aCompId = 0; aCompId < this->myNbComp; aCompId++){
00143 aValueSliceArr[aCompId] =
00144 TCValueSlice(this->GetPointer(),
00145 this->size(),
00146 std::slice(anId, this->myNbGauss, this->myNbComp));
00147 anId += 1;
00148 }
00149 return aValueSliceArr;
00150 }
00151
00153 TValueSliceArr
00154 GetCompValueSliceArr(vtkIdType theElemId)
00155 {
00156 TValueSliceArr aValueSliceArr(this->myNbComp);
00157 vtkIdType anId = theElemId * this->myStep;
00158 for(vtkIdType aCompId = 0; aCompId < this->myNbComp; aCompId++){
00159 aValueSliceArr[aCompId] =
00160 TValueSlice(this->GetPointer(),
00161 this->size(),
00162 std::slice(anId, this->myNbGauss, this->myNbComp));
00163 anId += 1;
00164 }
00165 return aValueSliceArr;
00166 }
00167
00169 virtual
00170 unsigned long int
00171 GetMemorySize() const
00172 {
00173 return this->size() * sizeof(TValueType);
00174 }
00175 };
00176
00177
00178
00180 template<class TValueType, class TContainerType>
00181 class TTMeshValueHolder: public virtual TTMeshValue<TValueType>
00182 {
00183 public:
00185 void
00186 Init(vtkIdType theNbElem,
00187 vtkIdType theNbGauss,
00188 vtkIdType theNbComp,
00189 const TContainerType& theContainer)
00190 {
00191 TMeshValueBase::Init(theNbElem, theNbGauss, theNbComp);
00192 myContainer = theContainer;
00193 }
00194
00195 protected:
00196 mutable TContainerType myContainer;
00197 };
00198
00199
00200
00201
00202 void
00203 GetTimeStampOnProfile(const PUnstructuredGrid& theSource,
00204 const PFieldImpl& theField,
00205 const PValForTimeImpl& theValForTime,
00206 const VISU::TEntity& theEntity);
00207
00208
00209
00210
00211 void
00212 GetTimeStampOnGaussMesh(const PPolyData& theSource,
00213 const PFieldImpl& theField,
00214 const PValForTimeImpl& theValForTime);
00215
00216 void
00217 InitMed2VisuArray(std::vector<int>& anArray, EGeometry aEGeom);
00218
00219
00220
00221 }
00222
00223 #endif