Back to index

salome-med  6.5.0
MED_Structures.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : 
00024 //  Author : 
00025 //  Module : 
00026 //  $Header: /home/server/cvs/MED/MED_SRC/src/MEDWrapper/Base/MED_Structures.hxx,v 1.7.2.2.4.3.10.1 2012-04-13 08:48:43 vsr Exp $
00027 //
00028 #ifndef MED_Structures_HeaderFile
00029 #define MED_Structures_HeaderFile
00030 
00031 #include "MED_Common.hxx"
00032 #include "MED_Utilities.hxx"
00033 
00034 #ifdef WNT
00035 #pragma warning(disable:4251)
00036 #endif
00037 
00038 namespace MED
00039 {
00040 
00041   //---------------------------------------------------------------
00043   typedef TVector<char> TString; 
00044   typedef SharedPtr<TString> PString;
00045 
00047   MEDWRAPPER_EXPORT
00048   std::string 
00049   GetString(TInt theId, TInt theStep, 
00050             const TString& theString);
00051   
00053   MEDWRAPPER_EXPORT 
00054   void
00055   SetString(TInt theId, TInt theStep, 
00056                  TString& theString, 
00057                  const std::string& theValue);
00058 
00060   MEDWRAPPER_EXPORT
00061   void
00062   SetString(TInt theId, TInt theStep, 
00063                  TString& theString, 
00064                  const TString& theValue);
00065 
00066   //---------------------------------------------------------------
00068   struct MEDWRAPPER_EXPORT TBase
00069   {
00070     virtual ~TBase() {} 
00071   };
00072 
00073 
00074   //---------------------------------------------------------------
00076   struct MEDWRAPPER_EXPORT TNameInfo: virtual TBase
00077   {
00078     TString myName; 
00079     virtual std::string GetName() const = 0; 
00080     virtual void SetName(const std::string& theValue) = 0; 
00081     virtual void SetName(const TString& theValue) = 0; 
00082   };
00083 
00084 
00085   //---------------------------------------------------------------
00087 
00091   struct MEDWRAPPER_EXPORT TModeSwitchInfo: virtual TBase
00092   {
00094     TModeSwitchInfo():
00095       myModeSwitch(eFULL_INTERLACE)
00096     {}
00097 
00099     TModeSwitchInfo(EModeSwitch theModeSwitch):
00100       myModeSwitch(theModeSwitch)
00101     {}
00102 
00103     EModeSwitch myModeSwitch; 
00104     EModeSwitch GetModeSwitch() const { return myModeSwitch;}
00105   };
00106 
00107 
00108   //---------------------------------------------------------------
00110   struct MEDWRAPPER_EXPORT TMeshInfo: virtual TNameInfo
00111   {
00112     TInt myDim; 
00113     TInt GetDim() const { return myDim;} 
00114 
00115     TInt mySpaceDim;
00116     TInt GetSpaceDim() const { return mySpaceDim; }
00117 
00118     EMaillage myType; 
00119     EMaillage GetType() const { return myType;} 
00120 
00121     TString myDesc; 
00122     virtual std::string GetDesc() const = 0; 
00123     virtual void SetDesc(const std::string& theValue) = 0; 
00124 
00125     
00126   };
00127   
00128 
00129   //---------------------------------------------------------------
00130   typedef TVector<TInt> TIntVector;
00131   typedef TSlice<TInt> TIntVecSlice;
00132   typedef TCSlice<TInt> TCIntVecSlice;
00133 
00134   typedef TIntVector TFamAttr;
00135 
00137   struct MEDWRAPPER_EXPORT TFamilyInfo: virtual TNameInfo
00138   {
00139     PMeshInfo myMeshInfo; 
00140 
00141     const PMeshInfo& GetMeshInfo() const { return myMeshInfo;} 
00142 
00143     TInt myId; 
00144     TInt GetId() const { return myId;} 
00145     void SetId(TInt theId) { myId = theId;} 
00146 
00147     TInt myNbGroup; 
00148 
00149     TInt GetNbGroup() const { return myNbGroup;} 
00150 
00152     TString myGroupNames; 
00154     virtual std::string GetGroupName(TInt theId) const = 0;
00156     virtual void SetGroupName(TInt theId, const std::string& theValue) = 0;
00157 
00158     TInt myNbAttr; 
00159 
00160     TInt GetNbAttr() const { return myNbAttr;} 
00161 
00163     TFamAttr myAttrId; 
00165     TInt GetAttrId(TInt theId) const;
00167     void SetAttrId(TInt theId, TInt theVal);
00168 
00170     TFamAttr myAttrVal;
00172     TInt GetAttrVal(TInt theId) const;
00174     void SetAttrVal(TInt theId, TInt theVal);
00175 
00177     TString myAttrDesc;
00179     virtual std::string GetAttrDesc(TInt theId) const = 0;
00181     virtual void SetAttrDesc(TInt theId, const std::string& theValue) = 0;
00182   };
00183 
00184 
00185   //---------------------------------------------------------------
00186   typedef TIntVector TElemNum;
00187   typedef SharedPtr<TElemNum> PElemNum;
00188   
00190   struct MEDWRAPPER_EXPORT TElemInfo: virtual TBase
00191   {
00192     PMeshInfo myMeshInfo; 
00193 
00194     const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
00195 
00196     TInt myNbElem; //<! Number of corresponding mesh entities
00197     TInt GetNbElem() const { return myNbElem;} 
00198     
00200     PElemNum myFamNum; 
00202     TInt GetFamNum(TInt theId) const;
00204     void SetFamNum(TInt theId, TInt theVal);
00205 
00207     EBooleen myIsElemNum;
00209     EBooleen IsElemNum() const { return myIsElemNum;}
00210     
00212     EBooleen myIsFamNum;
00214     EBooleen IsFamNum() const { return myIsFamNum;}
00215     
00216 
00218     PElemNum myElemNum;
00220     TInt GetElemNum(TInt theId) const;
00222     void SetElemNum(TInt theId, TInt theVal);
00223 
00225     EBooleen myIsElemNames;
00227     EBooleen IsElemNames() const { return myIsElemNames;}
00228 
00230     PString myElemNames;
00232     virtual std::string GetElemName(TInt theId) const = 0;
00234     virtual void SetElemName(TInt theId, const std::string& theValue) = 0;
00235   };
00236 
00237 
00238   //---------------------------------------------------------------
00239   typedef TVector<TFloat> TFloatVector;
00240   typedef TSlice<TFloat> TFloatVecSlice;
00241   typedef TCSlice<TFloat> TCFloatVecSlice;
00242 
00243   typedef TFloatVector TNodeCoord;
00244   typedef SharedPtr<TNodeCoord> PNodeCoord;
00245 
00246   typedef TFloatVecSlice TCoordSlice;
00247   typedef TCFloatVecSlice TCCoordSlice;
00248 
00250   struct MEDWRAPPER_EXPORT TNodeInfo: 
00251     virtual TElemInfo,
00252     virtual TModeSwitchInfo 
00253   {
00254     PNodeCoord myCoord; 
00255 
00257     TCCoordSlice GetCoordSlice(TInt theId) const;
00259     TCoordSlice GetCoordSlice(TInt theId);
00260 
00261     ERepere mySystem; 
00262 
00263     ERepere GetSystem() const { return mySystem;}
00265     void SetSystem(ERepere theSystem) { mySystem = theSystem;}
00266 
00267     TString myCoordNames; 
00268 
00269     virtual std::string GetCoordName(TInt theId) const = 0;
00271     virtual void SetCoordName(TInt theId, const std::string& theValue) = 0;
00272 
00273     TString myCoordUnits; 
00274 
00275     virtual std::string GetCoordUnit(TInt theId) const = 0;
00277     virtual void SetCoordUnit(TInt theId, const std::string& theValue) = 0;
00278   };
00279 
00280 
00281   //---------------------------------------------------------------
00282   typedef TIntVecSlice TConnSlice;
00283   typedef TCIntVecSlice TCConnSlice;
00284 
00286   struct MEDWRAPPER_EXPORT TCellInfo: 
00287     virtual TElemInfo,
00288     virtual TModeSwitchInfo 
00289   {
00290     EEntiteMaillage myEntity; 
00291 
00292     EEntiteMaillage GetEntity() const { return myEntity;}
00293 
00294     EGeometrieElement myGeom; 
00295 
00296     EGeometrieElement GetGeom() const { return myGeom;}
00297 
00298     EConnectivite myConnMode; 
00299 
00300     EConnectivite GetConnMode() const { return myConnMode;}
00301 
00302     virtual TInt GetConnDim() const = 0; 
00303 
00304     PElemNum myConn; 
00305 
00307     TCConnSlice GetConnSlice(TInt theElemId) const;
00309     TConnSlice GetConnSlice(TInt theElemId);
00310   };
00311 
00312   //---------------------------------------------------------------
00314   struct MEDWRAPPER_EXPORT TPolygoneInfo: 
00315     virtual TElemInfo
00316   {
00318     EEntiteMaillage myEntity; // MED_FACE|MED_MAILLE
00320     EEntiteMaillage GetEntity() const { return myEntity;}
00321 
00323     EGeometrieElement myGeom; // ePOLYGONE
00325     EGeometrieElement GetGeom() const { return ePOLYGONE;}
00326 
00328     EConnectivite myConnMode; // eNOD|eDESC(eDESC not used)
00330     EConnectivite GetConnMode() const { return myConnMode;}
00331 
00332     PElemNum myConn; 
00333     PElemNum myIndex; 
00334 
00336     TInt GetNbConn(TInt theElemId) const;
00337 
00339     TCConnSlice GetConnSlice(TInt theElemId) const;
00341     TConnSlice GetConnSlice(TInt theElemId);
00342   };
00343 
00344   //---------------------------------------------------------------
00345   typedef TVector<TCConnSlice> TCConnSliceArr;
00346   typedef TVector<TConnSlice> TConnSliceArr;
00347 
00349   struct MEDWRAPPER_EXPORT TPolyedreInfo: 
00350     virtual TElemInfo
00351   {
00353     EEntiteMaillage myEntity; // MED_FACE|MED_MAILLE
00355     EEntiteMaillage GetEntity() const { return myEntity;}
00356 
00358     EGeometrieElement myGeom; // ePOLYEDRE
00360     EGeometrieElement GetGeom() const { return ePOLYEDRE;}
00361 
00363     EConnectivite myConnMode; // eNOD|eDESC(eDESC not used)
00365     EConnectivite GetConnMode() const { return myConnMode;}
00366 
00367     PElemNum myConn; 
00368     PElemNum myFaces; 
00369     PElemNum myIndex; 
00370 
00372     TInt GetNbFaces(TInt theElemId) const;
00374     TInt GetNbNodes(TInt theElemId) const;
00375 
00377     TCConnSliceArr GetConnSliceArr(TInt theElemId) const;
00379     TConnSliceArr GetConnSliceArr(TInt theElemId);
00380   };
00381 
00382   //---------------------------------------------------------------
00384   struct MEDWRAPPER_EXPORT TFieldInfo: 
00385     virtual TNameInfo
00386   {
00387     PMeshInfo myMeshInfo; 
00388 
00389     const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
00390 
00391     ETypeChamp myType; 
00392 
00393     ETypeChamp GetType() const { return myType;}
00394 
00395     TInt myNbComp; 
00396 
00397     TInt GetNbComp() const { return myNbComp;}
00398 
00399     EBooleen myIsLocal; 
00400 
00401     EBooleen GetIsLocal() const { return myIsLocal;}
00402 
00403     TInt myNbRef; 
00404 
00405     TInt GetNbRef() const { return myNbRef;}
00406 
00407     TString myCompNames; 
00408 
00409     virtual std::string GetCompName(TInt theId) const = 0;
00411     virtual void SetCompName(TInt theId, const std::string& theValue) = 0;
00412 
00413     TString myUnitNames; 
00414 
00415     virtual std::string GetUnitName(TInt theId) const = 0;
00417     virtual void SetUnitName(TInt theId, const std::string& theValue) = 0;
00418 
00419   };
00420 
00421 
00422   //---------------------------------------------------------------
00424   MEDWRAPPER_EXPORT
00425   TInt
00426   GetDimGaussCoord(EGeometrieElement theGeom);
00427 
00429   MEDWRAPPER_EXPORT
00430   TInt
00431   GetNbRefCoord(EGeometrieElement theGeom);
00432 
00433   typedef TFloatVector TWeight;
00434 
00436   struct MEDWRAPPER_EXPORT TGaussInfo: 
00437     virtual TNameInfo,
00438     virtual TModeSwitchInfo 
00439   {
00440     typedef boost::tuple<EGeometrieElement,std::string> TKey;
00441     typedef boost::tuple<TKey,TInt> TInfo;
00442     struct MEDWRAPPER_EXPORT TLess
00443     {
00444       bool
00445       operator()(const TKey& theLeft, const TKey& theRight) const;
00446 
00447       bool
00448       operator()(const TGaussInfo& theLeft, const TGaussInfo& theRight) const;
00449     };
00450 
00452     EGeometrieElement myGeom; 
00454     EGeometrieElement GetGeom() const { return myGeom;}
00455 
00457     TNodeCoord myRefCoord; 
00458 
00460     TCCoordSlice GetRefCoordSlice(TInt theId) const;
00462     TCoordSlice GetRefCoordSlice(TInt theId);
00463 
00465     TNodeCoord myGaussCoord;
00466 
00468     TCCoordSlice GetGaussCoordSlice(TInt theId) const;
00470     TCoordSlice GetGaussCoordSlice(TInt theId);
00471 
00473     TWeight myWeight;
00474 
00476     TInt GetNbRef() const { return GetNbRefCoord(GetGeom());}
00477 
00479     TInt GetDim() const { return GetDimGaussCoord(GetGeom());}
00480 
00482     TInt GetNbGauss() const { return (TInt)(myGaussCoord.size()/GetDim());}
00483   };
00484 
00485 
00486   //---------------------------------------------------------------
00487   typedef std::map<EGeometrieElement,PGaussInfo> TGeom2Gauss;
00488   typedef std::map<EGeometrieElement,TInt> TGeom2NbGauss;
00489 
00491   struct MEDWRAPPER_EXPORT TTimeStampInfo: 
00492     virtual TBase
00493   {
00494     PFieldInfo myFieldInfo; 
00495 
00496     const PFieldInfo& GetFieldInfo() const { return myFieldInfo;}
00497 
00499     EEntiteMaillage myEntity;
00501     EEntiteMaillage GetEntity() const { return myEntity;}
00502 
00504     TGeom2Size myGeom2Size;
00506     const TGeom2Size& GetGeom2Size() const { return myGeom2Size;}
00507 
00508     TGeom2NbGauss myGeom2NbGauss; 
00509     TInt GetNbGauss(EGeometrieElement theGeom) const; 
00510 
00511     TInt myNumDt; 
00512     TInt GetNumDt() const { return myNumDt;} 
00513 
00514     TInt myNumOrd; 
00515     TInt GetNumOrd() const { return myNumOrd;} 
00516 
00517     TFloat myDt; 
00518     TFloat GetDt() const { return myDt;} 
00519 
00521     TGeom2Gauss myGeom2Gauss;
00523     const TGeom2Gauss& GetGeom2Gauss() const { return myGeom2Gauss;}
00524 
00525     TString myUnitDt; 
00526 
00527     virtual std::string GetUnitDt() const = 0;
00529     virtual void SetUnitDt(const std::string& theValue) = 0;
00530   };
00531   
00532 
00533   //---------------------------------------------------------------
00535   struct MEDWRAPPER_EXPORT TProfileInfo: 
00536     virtual TNameInfo
00537   {
00538     typedef std::string TKey;
00539     typedef boost::tuple<TKey,TInt> TInfo;
00540 
00541     EModeProfil myMode; 
00542 
00543     EModeProfil GetMode() const { return myMode;}
00545     void SetMode(EModeProfil theMode) { myMode = theMode;}
00546 
00547     PElemNum myElemNum; 
00548 
00549     TInt GetElemNum(TInt theId) const;
00551     void SetElemNum(TInt theId, TInt theVal);
00552 
00554     bool IsPresent() const { return GetName() != "";}
00555 
00557     TInt GetSize() const { return (TInt)myElemNum->size();}
00558   };
00559 
00560 
00561   //---------------------------------------------------------------
00563   struct MEDWRAPPER_EXPORT TMeshValueBase:
00564     virtual TModeSwitchInfo 
00565   {
00566     TInt myNbElem;
00567     TInt myNbComp;
00568     TInt myNbGauss;
00569     TInt myStep;
00570 
00571     TMeshValueBase();
00572 
00574     void
00575     Allocate(TInt theNbElem,
00576              TInt theNbGauss,
00577              TInt theNbComp,
00578              EModeSwitch theMode = eFULL_INTERLACE);
00579 
00581     size_t
00582     GetSize() const;
00583     
00585     size_t
00586     GetNbVal() const;
00587     
00589     size_t
00590     GetNbGauss() const;
00591     
00593     size_t
00594     GetStep() const;
00595     
00597     virtual
00598     unsigned char*
00599     GetValuePtr() = 0;
00600   };
00601 
00602   //---------------------------------------------------------------
00604   template<class TValueType>
00605   struct TTMeshValue:
00606     virtual TMeshValueBase 
00607   {
00608     typedef TValueType TValue;
00609     typedef typename TValueType::value_type TElement;
00610 
00611     typedef TSlice<TElement> TValueSlice;
00612     typedef TCSlice<TElement> TCValueSlice;
00613     
00614     typedef TVector<TCValueSlice> TCValueSliceArr;
00615     typedef TVector<TValueSlice> TValueSliceArr;
00616     
00617     TValue myValue;
00618 
00620     void
00621     Allocate(TInt theNbElem,
00622              TInt theNbGauss,
00623              TInt theNbComp,
00624              EModeSwitch theMode = eFULL_INTERLACE)
00625     {
00626       TMeshValueBase::Allocate(theNbElem, theNbGauss, theNbComp, theMode);
00627       myValue.resize(theNbElem * this->GetStep());
00628     }
00629 
00631     virtual
00632     unsigned char*
00633     GetValuePtr()
00634     {
00635       return (unsigned char*)&myValue[0];
00636     }
00637 
00639     virtual
00640     TElement*
00641     GetPointer()
00642     {
00643       return &myValue[0];
00644     }
00645 
00647     virtual
00648     const TElement*
00649     GetPointer() const
00650     {
00651       return &myValue[0];
00652     }
00653 
00655     TCValueSliceArr
00656     GetGaussValueSliceArr(TInt theElemId) const
00657     {
00658       TCValueSliceArr aValueSliceArr(myNbGauss);
00659       if(GetModeSwitch() == eFULL_INTERLACE){
00660         TInt anId = theElemId * myStep;
00661         for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
00662           aValueSliceArr[aGaussId] =
00663             TCValueSlice(myValue, std::slice(anId, myNbComp, 1));
00664           anId += myNbComp;
00665         }
00666       }
00667       else{
00668         for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
00669           aValueSliceArr[aGaussId] =
00670             TCValueSlice(myValue, std::slice(theElemId, myNbComp, myStep));
00671         }
00672       }
00673       return aValueSliceArr;
00674     }
00675 
00677     TValueSliceArr 
00678     GetGaussValueSliceArr(TInt theElemId)
00679     {
00680       TValueSliceArr aValueSliceArr(myNbGauss);
00681       if(GetModeSwitch() == eFULL_INTERLACE){
00682         TInt anId = theElemId*myStep;
00683         for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
00684           aValueSliceArr[aGaussId] =
00685             TValueSlice(myValue, std::slice(anId, myNbComp, 1));
00686           anId += myNbComp;
00687         }
00688       }
00689       else{
00690         for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
00691           aValueSliceArr[aGaussId] =
00692             TValueSlice(myValue, std::slice(theElemId, myNbComp, myStep));
00693         }
00694       }
00695       return aValueSliceArr;
00696     }
00697 
00699     TCValueSliceArr
00700     GetCompValueSliceArr(TInt theElemId) const
00701     {
00702       TCValueSliceArr aValueSliceArr(myNbComp);
00703       if(GetModeSwitch() == eFULL_INTERLACE){
00704         TInt anId = theElemId*myStep;
00705         for(TInt aCompId = 0; aCompId < myNbComp; aCompId++){
00706           aValueSliceArr[aCompId] =
00707             TCValueSlice(myValue, std::slice(anId, myNbGauss, myNbComp));
00708           anId += 1;
00709         }
00710       }
00711       else{
00712         for(TInt aCompId = 0; aCompId < myNbComp; aCompId++){
00713           aValueSliceArr[aCompId] =
00714             TCValueSlice(myValue, std::slice(theElemId, myNbGauss, myStep));
00715         }
00716       }
00717       return aValueSliceArr;
00718     }
00719 
00721     TValueSliceArr 
00722     GetCompValueSliceArr(TInt theElemId)
00723     {
00724       if(GetModeSwitch() == eFULL_INTERLACE){
00725         TValueSliceArr aValueSliceArr(myNbComp);
00726         TInt anId = theElemId*myStep;
00727         for(TInt aCompId = 0; aCompId < myNbComp; aCompId++){
00728           aValueSliceArr[aCompId] =
00729             TValueSlice(myValue, std::slice(anId, myNbGauss, myNbComp));
00730           anId += 1;
00731         }
00732         return aValueSliceArr;
00733       }
00734       else{
00735         TValueSliceArr aValueSliceArr(myNbGauss);
00736         for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
00737           aValueSliceArr[aGaussId] =
00738             TValueSlice(myValue,std::slice(theElemId, myNbComp, myStep));
00739         }
00740         return aValueSliceArr;
00741       }
00742     }
00743   };
00744 
00745   typedef TTMeshValue<TFloatVector> TFloatMeshValue;
00746   typedef TTMeshValue<TIntVector> TIntMeshValue;
00747 
00748   //---------------------------------------------------------------
00749   // Backward compatibility  declarations
00750   typedef TFloatVector TValue;
00751   typedef TSlice<TFloat> TValueSlice;
00752   typedef TCSlice<TFloat> TCValueSlice;
00753   
00754   typedef TVector<TCValueSlice> TCValueSliceArr;
00755   typedef TVector<TValueSlice> TValueSliceArr;
00756     
00757   typedef TFloatMeshValue TMeshValue;
00758   typedef std::map<EGeometrieElement,TMeshValue> TGeom2Value;
00759 
00760   //---------------------------------------------------------------
00761   typedef std::map<EGeometrieElement,PProfileInfo> TGeom2Profile;
00762   typedef std::set<EGeometrieElement> TGeom;
00763 
00765   struct MEDWRAPPER_EXPORT TTimeStampValueBase: 
00766     virtual TModeSwitchInfo 
00767   {
00769     PTimeStampInfo myTimeStampInfo;
00771     const PTimeStampInfo& GetTimeStampInfo() const { return myTimeStampInfo;}
00772 
00774     TGeomSet myGeomSet;
00775     const TGeomSet& GetGeomSet() const { return myGeomSet;}
00776 
00778     TGeom2Profile myGeom2Profile;
00780     const TGeom2Profile& GetGeom2Profile() const { return myGeom2Profile;}
00781 
00783     virtual 
00784     ETypeChamp
00785     GetTypeChamp() const = 0;
00786 
00788     virtual 
00789     void
00790     AllocateValue(EGeometrieElement theGeom,
00791                   TInt theNbElem,
00792                   TInt theNbGauss,
00793                   TInt theNbComp,
00794                   EModeSwitch theMode = eFULL_INTERLACE) = 0;
00795     
00796     virtual 
00797     size_t
00798     GetValueSize(EGeometrieElement theGeom) const = 0;
00799     
00800     virtual 
00801     size_t
00802     GetNbVal(EGeometrieElement theGeom) const = 0;
00803     
00804     virtual 
00805     size_t
00806     GetNbGauss(EGeometrieElement theGeom) const = 0;
00807 
00808     virtual 
00809     unsigned char*
00810     GetValuePtr(EGeometrieElement theGeom) = 0;
00811   };
00812 
00813 
00814   //---------------------------------------------------------------
00816   template<class TMeshValueType>
00817   struct TTimeStampValue: 
00818     virtual TTimeStampValueBase 
00819   {
00820     typedef TMeshValueType TTMeshValue;
00821     typedef SharedPtr<TMeshValueType> PTMeshValue;
00822     typedef typename TMeshValueType::TElement TElement;
00823     typedef std::map<EGeometrieElement, PTMeshValue> TTGeom2Value;
00824 
00825     ETypeChamp myTypeChamp; //<! Keeps type of the champ
00826 
00828     virtual 
00829     ETypeChamp
00830     GetTypeChamp() const
00831     {
00832       return myTypeChamp;
00833     }
00834 
00836     TTGeom2Value myGeom2Value;
00837 
00838     const TTGeom2Value& 
00839     GetGeom2Value() const
00840     {
00841       return myGeom2Value;
00842     }
00843 
00845     const PTMeshValue& 
00846     GetMeshValuePtr(EGeometrieElement theGeom) const
00847     {
00848       typename TTGeom2Value::const_iterator anIter = myGeom2Value.find(theGeom);
00849       if(anIter == myGeom2Value.end())
00850         EXCEPTION(std::runtime_error,"TTimeStampValue::GetMeshValuePtr - myGeom2Value.find(theGeom) fails");
00851       return anIter->second;
00852     }
00853 
00855     PTMeshValue& 
00856     GetMeshValuePtr(EGeometrieElement theGeom)
00857     {
00858       myGeomSet.insert(theGeom);
00859       if(myGeom2Value.find(theGeom) == myGeom2Value.end()){
00860         myGeom2Value[theGeom] = PTMeshValue(new TTMeshValue());
00861         return myGeom2Value[theGeom];
00862       }
00863       return myGeom2Value[theGeom];
00864     }
00865 
00867     const TTMeshValue& 
00868     GetMeshValue(EGeometrieElement theGeom) const
00869     {
00870       return *(this->GetMeshValuePtr(theGeom));
00871     }
00872 
00874     TTMeshValue& 
00875     GetMeshValue(EGeometrieElement theGeom)
00876     {
00877       return *(this->GetMeshValuePtr(theGeom));
00878     }
00879   };
00880 
00881 
00882   //---------------------------------------------------------------
00883   typedef TTimeStampValue<TFloatMeshValue> TFloatTimeStampValue;
00884   typedef SharedPtr<TFloatTimeStampValue> PFloatTimeStampValue;
00885 
00886   PFloatTimeStampValue MEDWRAPPER_EXPORT
00887   CastToFloatTimeStampValue(const PTimeStampValueBase& theTimeStampValue);
00888 
00889   typedef TTimeStampValue<TIntMeshValue> TIntTimeStampValue;
00890   typedef SharedPtr<TIntTimeStampValue> PIntTimeStampValue;
00891   
00892   PIntTimeStampValue MEDWRAPPER_EXPORT
00893   CastToIntTimeStampValue(const PTimeStampValueBase& theTimeStampValue);
00894 
00895 
00896   //---------------------------------------------------------------
00897   template<class TMeshValueTypeFrom, class TMeshValueTypeTo>
00898   void
00899   CopyTimeStampValue(SharedPtr<TTimeStampValue<TMeshValueTypeFrom> > theTimeStampValueFrom,
00900                      SharedPtr<TTimeStampValue<TMeshValueTypeTo> > theTimeStampValueTo)
00901   {
00902     typedef TTimeStampValue<TMeshValueTypeFrom> TimeStampValueTypeFrom;
00903     typedef TTimeStampValue<TMeshValueTypeTo> TimeStampValueTypeTo;
00904     typedef typename TMeshValueTypeTo::TElement TElementTo;
00905 
00906     typename TimeStampValueTypeFrom::TTGeom2Value& aGeom2Value = theTimeStampValueFrom->myGeom2Value;
00907     typename TimeStampValueTypeFrom::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
00908     for(; anIter != aGeom2Value.end(); anIter++){
00909       const EGeometrieElement& aGeom = anIter->first;
00910       const typename TimeStampValueTypeFrom::TTMeshValue& aMeshValue = *anIter->second;
00911       typename TimeStampValueTypeTo::TTMeshValue& aMeshValue2 = theTimeStampValueTo->GetMeshValue(aGeom);
00912       aMeshValue2.Allocate(aMeshValue.myNbElem, 
00913                            aMeshValue.myNbGauss, 
00914                            aMeshValue.myNbComp,
00915                            aMeshValue.myModeSwitch);
00916       const typename TimeStampValueTypeFrom::TTMeshValue::TValue& aValue = aMeshValue.myValue;
00917       typename TimeStampValueTypeTo::TTMeshValue::TValue& aValue2 = aMeshValue2.myValue;
00918       TInt aSize = aValue.size();
00919       for(TInt anId = 0; anId < aSize; anId++)
00920         aValue2[anId] = TElementTo(aValue[anId]);
00921     }
00922   }
00923 
00924   template<class TMeshValueType>
00925   void
00926   CopyTimeStampValue(SharedPtr<TTimeStampValue<TMeshValueType> > theTimeStampValueFrom,
00927                      SharedPtr<TTimeStampValue<TMeshValueType> > theTimeStampValueTo)
00928   {
00929     typedef TTimeStampValue<TMeshValueType> TimeStampValueType;
00930     typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValueFrom->myGeom2Value;
00931     typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
00932     for(; anIter != aGeom2Value.end(); anIter++){
00933       const EGeometrieElement& aGeom = anIter->first;
00934       const typename TimeStampValueType::TTMeshValue& aMeshValue = *anIter->second;
00935       typename TimeStampValueType::TTMeshValue& aMeshValue2 = theTimeStampValueTo->GetMeshValue(aGeom);
00936       aMeshValue2 = aMeshValue;
00937     }
00938   }
00939 
00940   //---------------------------------------------------------------
00941   inline
00942   void
00943   CopyTimeStampValueBase(const PTimeStampValueBase& theValueFrom, 
00944                          const PTimeStampValueBase& theValueTo)
00945   {
00946     if(theValueFrom->GetTypeChamp() == theValueTo->GetTypeChamp()){
00947       if(theValueFrom->GetTypeChamp() == eFLOAT64)
00948         CopyTimeStampValue<TFloatMeshValue>(theValueFrom, theValueTo);
00949       else if(theValueFrom->GetTypeChamp() == eINT)
00950         CopyTimeStampValue<TIntMeshValue>(theValueFrom, theValueTo);
00951     }else{
00952       if(theValueFrom->GetTypeChamp() == eFLOAT64 && theValueTo->GetTypeChamp() == eINT)
00953         CopyTimeStampValue<TFloatMeshValue, TIntMeshValue>(theValueFrom, theValueTo);
00954       else if(theValueFrom->GetTypeChamp() == eINT && theValueTo->GetTypeChamp() == eFLOAT64)
00955         CopyTimeStampValue<TIntMeshValue, TFloatMeshValue>(theValueFrom, theValueTo);
00956     }
00957   }
00958 
00959 
00960   //---------------------------------------------------------------
00961   // Backward compatibility  declarations
00962   typedef TFloatTimeStampValue TTimeStampVal;
00963   typedef PFloatTimeStampValue PTimeStampVal;
00964 
00965   //---------------------------------------------------------------
00966   typedef std::map<TInt,TFloatVector> TIndexes;
00967   typedef std::map<TInt,TString> TNames;
00968   
00970   struct MEDWRAPPER_EXPORT TGrilleInfo:
00971     virtual TModeSwitchInfo
00972   {
00973 
00974     PMeshInfo myMeshInfo;
00975     const PMeshInfo& GetMeshInfo() const { return myMeshInfo;} 
00976 
00977     TNodeCoord myCoord; 
00978 
00979     const TNodeCoord& GetNodeCoord() const;
00980     TNodeCoord& GetNodeCoord();
00982     TNodeCoord GetCoord(TInt theId);
00984     TIntVector GetConn(TInt theId, const bool isSub=false);
00985 
00986     EGrilleType myGrilleType; 
00987 
00988     const EGrilleType& GetGrilleType() const;
00990     EGrilleType GetGrilleType();
00992     void SetGrilleType(EGrilleType theGrilleType);
00993 
00994 
00995     
00996     TString myCoordNames; 
00997 
00998     virtual std::string GetCoordName(TInt theId) const = 0 ;
01000     virtual void SetCoordName(TInt theId, const std::string& theValue) = 0;
01001 
01002     TString myCoordUnits; 
01003 
01004     virtual std::string GetCoordUnit(TInt theId) const = 0;
01006     virtual void SetCoordUnit(TInt theId, const std::string& theValue) = 0;
01007 
01008 
01010     TIndexes myIndixes;
01012     const TIndexes& GetMapOfIndexes() const ;
01014     TIndexes& GetMapOfIndexes();
01016     const TFloatVector& GetIndexes(TInt theAxisNumber) const;
01018     TFloatVector& GetIndexes(TInt theAxisNumber);
01020     TInt GetNbIndexes(TInt theAxisNumber);
01021     
01022     TInt GetNbNodes();
01023     TInt GetNbCells();
01024     TInt GetNbSubCells();
01025     EGeometrieElement GetGeom();
01026     EGeometrieElement GetSubGeom();
01027     EEntiteMaillage GetEntity();
01028     EEntiteMaillage GetSubEntity();
01029 
01033     TIntVector myGrilleStructure;
01035     const TIntVector& GetGrilleStructure() const;
01037     TIntVector GetGrilleStructure();
01039     void SetGrilleStructure(TInt theAxis,TInt theNb);
01040     
01044     TElemNum myFamNum; 
01046     TInt GetFamNum(TInt theId) const;
01048     void SetFamNum(TInt theId, TInt theVal);
01049     
01053     TElemNum myFamSubNum; 
01055     TInt GetFamSubNum(TInt theId) const;
01057     void SetFamSubNum(TInt theId, TInt theVal);
01058     
01062     TElemNum myFamNumNode;
01064     TInt GetFamNumNode(TInt theId) const;
01066     void SetFamNumNode(TInt theId, TInt theVal);
01067 
01068   };
01069 
01070 
01071 }
01072 
01073 #endif