Version: 6.3.1

src/VISU_I/VISU_CorbaMedConvertor.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 //  VISU OBJECT : interactive object for VISU entities implementation
00024 //  File   : VISU_CorbaMedConvertor.hxx
00025 //  Author : Alexey PETROV
00026 //  Module : VISU
00027 //  $Header: /home/server/cvs/VISU/VISU_SRC/src/VISU_I/VISU_CorbaMedConvertor.hxx,v 1.15.2.1.6.2.6.1 2011-06-02 06:00:23 vsr Exp $
00028 //
00029 #ifndef VISU_CorbaMedConvertor_HeaderFile
00030 #define VISU_CorbaMedConvertor_HeaderFile
00031 
00032 #include "VISUConfig.hh"
00033 #include "VISU_Convertor_impl.hxx"
00034 #include "VISU_Structures_impl.hxx"
00035 #include "VISU_PointCoords.hxx"
00036 #include "VISU_MeshValue.hxx"
00037 
00038 #include <string>       
00039 
00040 namespace VISU
00041 {
00042   //---------------------------------------------------------------
00043   typedef std::pair<int, int> TIndexAndSize; // 
00044   typedef std::map<SALOME_MED::medGeometryElement, TIndexAndSize> TCellsFirstIndex; // key: SALOME_MED::medGeometryElement
00045 
00046   //---------------------------------------------------------------
00047   struct TCMEDCoordHolder: TCoordHolder<SALOME_TYPES::ListOfDouble_var>
00048   {
00049     virtual
00050     const TCoord*
00051     GetPointer() const
00052     {
00053       return &myCoord[0];
00054     }
00055 
00056     virtual
00057     TCoord*
00058     GetPointer()
00059     {
00060       return &myCoord[0];
00061     }
00062   };
00063 
00064 
00065   //---------------------------------------------------------------
00066   template<class TValueType, class TContainerType>
00067   struct TTCMEDMeshValue: TTMeshValueHolder<TValueType, TContainerType>
00068   {
00069     typedef TTMeshValueHolder<TValueType, TContainerType> TSuperClass;
00070     vtkIdType myStartIndex;
00071 
00073     void
00074     Init(vtkIdType theNbElem,
00075          vtkIdType theNbGauss,
00076          vtkIdType theNbComp,
00077          const TContainerType& theContainer,
00078          vtkIdType theStartIndex)
00079     {
00080       TSuperClass::Init(theNbElem, theNbGauss, theNbComp, theContainer);
00081       myStartIndex = theStartIndex;
00082     }
00083 
00084     virtual
00085     const TValueType*
00086     GetPointer() const
00087     {
00088       return &(this->myContainer[myStartIndex]);
00089     }
00090 
00091     virtual
00092     TValueType*
00093     GetPointer()
00094     {
00095       return &(this->myContainer[myStartIndex]);
00096     }
00097   };
00098 
00099 
00100   //---------------------------------------------------------------
00101   struct TCMesh: virtual TMeshImpl
00102   {
00103     SALOME_MED::MESH_var myMesh;
00104   };
00105   typedef MED::SharedPtr<TCMesh> PCMesh;
00106 
00107   //---------------------------------------------------------------
00108   struct TCSubProfile: virtual TSubProfileImpl
00109   {
00110     SALOME_MED::medGeometryElement myMGeom;
00111   };
00112   typedef SharedPtr<TCSubProfile> PCSubProfile;
00113 
00114   //---------------------------------------------------------------
00115   struct TCProfile: virtual TProfileImpl
00116   {};
00117   typedef MED::SharedPtr<TCProfile> PCProfile;
00118 
00119   //---------------------------------------------------------------
00120   struct TCGauss: virtual TGaussImpl
00121   {
00122   };
00123   typedef SharedPtr<TCGauss> PCGauss;
00124   
00125   struct TCGaussSubMesh: virtual TGaussSubMeshImpl
00126   {
00127   };
00128   typedef SharedPtr<TCGaussSubMesh> PCGaussSubMesh;
00129 
00130 
00131   //---------------------------------------------------------------
00132   struct TCGaussMesh: virtual TGaussMeshImpl
00133   {};
00134   typedef SharedPtr<TCGaussMesh> PCGaussMesh;
00135 
00136 
00137   //---------------------------------------------------------------
00138   struct TCSubMesh: virtual TSubMeshImpl
00139   {};
00140   typedef MED::SharedPtr<TCSubMesh> PCSubMesh;
00141 
00142 
00143   //---------------------------------------------------------------
00144   struct TCMeshOnEntity: virtual TMeshOnEntityImpl
00145   {
00146     SALOME_MED::SUPPORT_var mySupport;
00147     TCellsFirstIndex myCellsFirstIndex;
00148   };
00149   typedef MED::SharedPtr<TCMeshOnEntity> PCMeshOnEntity;
00150   
00151 
00152   //---------------------------------------------------------------
00153   struct TCFamily: virtual TFamilyImpl
00154   {
00155     SALOME_MED::FAMILY_var myFamily;
00156   };
00157   typedef MED::SharedPtr<TCFamily> PCFamily;
00158   
00159 
00160   //---------------------------------------------------------------
00161   struct TCGroup: virtual TGroupImpl
00162   {
00163     SALOME_MED::GROUP_var myGroup;
00164   };
00165   typedef MED::SharedPtr<TCGroup> PCGroup;
00166 
00167 
00168   //---------------------------------------------------------------
00169   struct TCField: virtual TFieldImpl
00170   {};
00171   typedef MED::SharedPtr<TCField> PCField;
00172 
00173 
00174   //---------------------------------------------------------------
00175   struct TCValForTime: virtual TValForTimeImpl
00176   {
00177     SALOME_MED::FIELD_var myField;
00178   };
00179   typedef MED::SharedPtr<TCValForTime> PCValForTime;
00180 
00181 }
00182 
00183 
00184 //---------------------------------------------------------------
00185 class VISU_MEDConvertor: public VISU_Convertor_impl
00186 {
00187  protected:
00188   SALOMEDS::SObject_var mySObject;
00189   VISU_MEDConvertor() {};
00190 
00191  public:
00192   VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject): 
00193     mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) 
00194   {}
00195 
00196   virtual
00197   VISU_Convertor* 
00198   Build();
00199 
00200  protected:
00201 
00202   VISU_Convertor* 
00203   Build(SALOME_MED::MED_ptr theMED);
00204   
00205   VISU_Convertor* 
00206   Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator);
00207 
00208   virtual
00209   int
00210   LoadMeshOnEntity(VISU::PMeshImpl theMesh,
00211                    VISU::PMeshOnEntityImpl theMeshOnEntity);
00212   
00213   virtual
00214   int
00215   LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
00216                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
00217                      VISU::PFamilyImpl theFamily);
00218   
00219   virtual
00220   int
00221   LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
00222                   const VISU::TFamilySet& theFamilySet);
00223 
00224   virtual 
00225   int
00226   LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
00227                        VISU::PMeshOnEntityImpl theMeshOnEntity, 
00228                        VISU::PFieldImpl theField, 
00229                        VISU::PValForTimeImpl theValForTime);
00230 
00231   virtual
00232   int
00233   LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
00234                            VISU::PMeshOnEntityImpl theMeshOnEntity, 
00235                            VISU::PFieldImpl theField, 
00236                            VISU::PValForTimeImpl theValForTime)
00237   {
00238     return 0;
00239   }
00240 
00241   int 
00242   LoadPoints(VISU::PCMesh theMesh) ;
00243 
00244   int 
00245   LoadPointsOnFamily(VISU::PCMesh theMesh, 
00246                      VISU::PCFamily theFamily) ;
00247 
00248   int 
00249   LoadCellsOnEntity(VISU::PCMesh theMesh,
00250                     VISU::PCMeshOnEntity theMeshOnEntity);
00251   
00252   int 
00253   LoadCellsOnFamily(VISU::PCMesh theMesh,
00254                     VISU::PCMeshOnEntity theMeshOnEntity, 
00255                     VISU::PCFamily theFamily);
00256   
00257   int 
00258   LoadField(VISU::PCMesh theMesh,
00259             VISU::PCMeshOnEntity theMeshOnEntity,
00260             VISU::PField theField, 
00261             VISU::PCValForTime theValForTime);
00262 
00263 };
00264 
00265 
00266 //---------------------------------------------------------------
00267 class VISU_MEDFieldConvertor: public VISU_MEDConvertor
00268 {
00269  protected:
00270   SALOME_MED::FIELD_var myField;
00271 
00272  public:
00273 
00274   VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : 
00275     myField(SALOME_MED::FIELD::_duplicate(theField)) 
00276   {}
00277 
00278   virtual 
00279   VISU_Convertor* 
00280   Build();
00281 };
00282 
00283 extern "C" {
00284   VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) ;
00285   VISU_Convertor* CreateMEDFieldConvertor(SALOME_MED::FIELD_ptr theField) ;
00286 }
00287 
00288 #endif
00289 
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS