Version: 6.3.1

src/CONVERTOR/VISU_Structures_impl.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 //  File   : 
00024 //  Author : Alexey PETROV
00025 //  Module : VISU
00026 //
00027 #ifndef VISU_Structures_impl_HeaderFile
00028 #define VISU_Structures_impl_HeaderFile
00029 
00035 #include "VISUConvertor.hxx"
00036 #include "VISU_Structures.hxx"
00037 #include "VISU_ConvertorDef_impl.hxx"
00038 
00039 class vtkPointSet;
00040 
00041 
00042 namespace VISU
00043 {
00044   //---------------------------------------------------------------
00046   struct VISU_CONVERTOR_EXPORT TSizeCounter: virtual TIsVTKDone
00047   {
00048     TSizeCounter();
00049     vtkIdType myNbCells; 
00050     vtkIdType myCellsSize; 
00051   };
00052 
00053 
00054   //---------------------------------------------------------------
00056   class TPolyDataHolder: public virtual TSizeCounter
00057   {
00058   protected:
00059     mutable PPolyData mySource;
00060   public:
00061     TPolyDataHolder();
00062 
00064     const PPolyData& 
00065     GetSource() const;
00066 
00067     virtual
00068     vtkPolyData* 
00069     GetPolyDataOutput();
00070 
00072     virtual
00073     unsigned long int
00074     GetMemorySize();
00075   };
00076 
00077 
00078   //---------------------------------------------------------------
00080   class VISU_CONVERTOR_EXPORT TUnstructuredGridHolder: public virtual TSizeCounter
00081   {
00082   public:
00083     TUnstructuredGridHolder();
00084 
00086     const PUnstructuredGrid& 
00087     GetSource() const;
00088 
00089     virtual
00090     vtkUnstructuredGrid* 
00091     GetUnstructuredGridOutput();
00092 
00094     virtual
00095     unsigned long int
00096     GetMemorySize();
00097 
00098   protected:
00099     mutable PUnstructuredGrid mySource;
00100   };
00101 
00102 
00103   //---------------------------------------------------------------
00105   struct VISU_CONVERTOR_EXPORT TMemoryCheckIDMapper: public virtual TIsVTKDone,
00106                                public virtual TIDMapper
00107   {
00109     virtual
00110     unsigned long int
00111     GetMemorySize();
00112   };
00113 
00114 
00115   //---------------------------------------------------------------
00117 
00120   class VISU_CONVERTOR_EXPORT TAppendFilterHolder: public virtual TMemoryCheckIDMapper
00121   {
00122   protected:
00123     mutable PAppendFilter myFilter;
00124   public:
00125     TAppendFilterHolder();
00126 
00128     const PAppendFilter& 
00129     GetFilter() const;
00130 
00132     virtual
00133     vtkUnstructuredGrid* 
00134     GetUnstructuredGridOutput();
00135   };
00136 
00140   //---------------------------------------------------------------
00142 
00145   class TAppendPolyDataHolder: public virtual TMemoryCheckIDMapper
00146   {
00147   protected:
00148     mutable PAppendPolyData myFilter;
00149   public:
00150     TAppendPolyDataHolder();
00151 
00153     const PAppendPolyData& 
00154     GetFilter() const;
00155 
00157     virtual
00158     vtkPolyData* 
00159     GetPolyDataOutput();
00160   };
00161 
00162 
00163   //---------------------------------------------------------------
00165 
00168   class TMergeFilterHolder: public virtual TMemoryCheckIDMapper
00169   {
00170   protected:
00171     mutable PMergeFilter myFilter;
00172   public:
00173     TMergeFilterHolder();
00174 
00176     const PMergeFilter& 
00177     GetFilter() const;
00178 
00180     virtual
00181     vtkDataSet*
00182     GetOutput();
00183   };
00184 
00185 
00186   //---------------------------------------------------------------
00188   struct VISU_CONVERTOR_EXPORT TMeshImpl: virtual TMesh, 
00189                     virtual TIsVTKDone
00190   {
00191     PNamedPointCoords myNamedPointCoords; 
00192     vtkIdType myNbPoints; 
00193 
00194     TMeshImpl();
00195 
00196     vtkIdType
00197     GetNbPoints() const;
00198 
00199     vtkIdType
00200     GetDim() const;
00201 
00202     vtkPointSet*
00203     GetPointSet(); 
00204   };
00205 
00206 
00207   //---------------------------------------------------------------
00208   typedef TVector<vtkIdType> TSubMeshID;
00209   typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; 
00210 
00212   struct VISU_CONVERTOR_EXPORT TSubProfileImpl: virtual TSubProfile, 
00213                           virtual TUnstructuredGridHolder
00214   {
00215     TSubProfileImpl();
00216 
00217     EGeometry myGeom; 
00218     std::string myName; 
00219 
00221     virtual 
00222     vtkIdType 
00223     GetElemObjID(vtkIdType theVtkI) const;
00224 
00226     virtual
00227     vtkIdType 
00228     GetElemVTKID(vtkIdType theID) const;
00229     
00232     virtual
00233     bool 
00234     isDefault() const;
00235 
00237     virtual
00238     unsigned long int
00239     GetMemorySize();
00240 
00242 
00246     ESubMeshStatus myStatus; 
00247     TSubMeshID mySubMeshID; 
00248   };
00249 
00250 
00251   //---------------------------------------------------------------
00252   typedef std::map<vtkIdType,vtkIdType> TID2ID;
00253   typedef TVector<PSubProfileImpl> TSubProfileArr;
00254   typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
00255 
00257   struct VISU_CONVERTOR_EXPORT TProfileImpl: virtual TProfile, 
00258                        virtual TAppendFilterHolder
00259   {
00260     TProfileImpl();
00261     bool myIsAll; 
00262    
00264     virtual 
00265     vtkIdType 
00266     GetNodeObjID(vtkIdType theID) const;
00267 
00269     virtual 
00270     vtkIdType 
00271     GetNodeVTKID(vtkIdType theID) const;
00272 
00274     virtual 
00275     vtkFloatingPointType*  
00276     GetNodeCoord(vtkIdType theObjID);
00277 
00279     virtual 
00280     vtkIdType 
00281     GetElemObjID(vtkIdType theID) const;
00282 
00284     virtual 
00285     vtkIdType 
00286     GetElemVTKID(vtkIdType theID) const;
00287 
00289     virtual
00290     vtkCell* 
00291     GetElemCell(vtkIdType theObjID);
00292     
00294     virtual
00295     vtkUnstructuredGrid* 
00296     GetUnstructuredGridOutput();
00297 
00299     virtual
00300     unsigned long int
00301     GetMemorySize();
00302 
00304     virtual
00305     std::string 
00306     GetNodeName(vtkIdType theObjID) const;
00307 
00309     virtual
00310     std::string 
00311     GetElemName(vtkIdType theObjID) const;
00312 
00313     TID2ID myElemObj2VTKID; 
00314     TSubProfileArr mySubProfileArr; 
00315     PNamedPointCoords myNamedPointCoords; 
00316     TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
00317 
00318     TGeom2SubProfile myGeom2SubProfile; 
00319   };
00320 
00321 
00322   //---------------------------------------------------------------
00324   struct TUnstructuredGridIDMapperImpl: virtual TMergeFilterHolder,
00325                                         virtual TUnstructuredGridIDMapper
00326   {
00327     PAppendFilterHolder myIDMapper; 
00328     PCommonCellsFilter myCommonCellsFilter;
00329 
00330     TUnstructuredGridIDMapperImpl();
00331     
00333     virtual 
00334     vtkIdType 
00335     GetNodeObjID(vtkIdType theID) const;
00336 
00338     virtual 
00339     vtkIdType 
00340     GetNodeVTKID(vtkIdType theID) const;
00341 
00343     virtual 
00344     vtkFloatingPointType*  
00345     GetNodeCoord(vtkIdType theObjID);
00346 
00348     virtual 
00349     vtkIdType 
00350     GetElemObjID(vtkIdType theID) const;
00351 
00353     virtual 
00354     vtkIdType 
00355     GetElemVTKID(vtkIdType theID) const;
00356 
00358     virtual
00359     vtkCell* 
00360     GetElemCell(vtkIdType theObjID);
00361     
00363     virtual
00364     vtkUnstructuredGrid* 
00365     GetUnstructuredGridOutput();
00366 
00368     virtual
00369     vtkDataSet* 
00370     GetOutput();
00371 
00373     virtual
00374     unsigned long int
00375     GetMemorySize();
00376     
00377     void 
00378     SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper );
00379 
00380     PUnstructuredGrid 
00381     GetSource();
00382 
00383   protected:
00384     void Build();
00385 
00386     TUnstructuredGridHolder mySource; 
00387   };
00388 
00389   //---------------------------------------------------------------
00391   struct TPolyDataIDMapperImpl: virtual TMergeFilterHolder,
00392                                 virtual TPolyDataIDMapper
00393   {
00394     PAppendPolyDataHolder myIDMapper; 
00395 
00397     virtual 
00398     vtkIdType 
00399     GetNodeObjID(vtkIdType theID) const;
00400 
00402     virtual 
00403     vtkIdType 
00404     GetNodeVTKID(vtkIdType theID) const;
00405 
00407     virtual 
00408     vtkFloatingPointType*  
00409     GetNodeCoord(vtkIdType theObjID);
00410 
00412     virtual 
00413     vtkIdType 
00414     GetElemObjID(vtkIdType theID) const;
00415 
00417     virtual 
00418     vtkIdType 
00419     GetElemVTKID(vtkIdType theID) const;
00420 
00422     virtual
00423     vtkCell* 
00424     GetElemCell(vtkIdType theObjID);
00425     
00427     virtual
00428     vtkPolyData* 
00429     GetPolyDataOutput();
00430 
00432     virtual
00433     vtkDataSet* 
00434     GetOutput();
00435 
00437     virtual
00438     unsigned long int
00439     GetMemorySize();
00440 
00441     PPolyData 
00442     GetSource();
00443 
00444   protected:
00445     void Build();
00446 
00447     TPolyDataHolder mySource; 
00448   };
00449 
00450 
00451   //---------------------------------------------------------------
00453   struct VISU_CONVERTOR_EXPORT TGaussImpl: virtual TGauss
00454   {
00455     EGeometry myGeom; 
00456     std::string myName; 
00457     vtkIdType myNbPoints; //<! Keeps number of points for the MED GAUSS entity
00458 
00459     TGaussImpl();
00460 
00462     virtual
00463     void
00464     LessThan(const PGaussImpl& theGauss,
00465              bool& theResult) const;
00466   };
00467 
00468 
00469   //---------------------------------------------------------------
00471   struct VISU_CONVERTOR_EXPORT TGaussSubMeshImpl: virtual TGaussSubMesh, 
00472                             virtual TPolyDataHolder
00473   {
00474     TGaussSubMeshImpl();
00475 
00477     virtual
00478     TGaussPointID
00479     GetObjID(vtkIdType theID) const;
00480 
00482     virtual
00483     vtkIdType
00484     GetVTKID(const TGaussPointID& theID) const;
00485     
00486     virtual 
00487     vtkIdType 
00488     GetElemObjID(vtkIdType theID) const;
00489 
00490     virtual 
00491     vtkIdType 
00492     GetElemVTKID(vtkIdType theID) const;
00493     
00494     virtual
00495     vtkIdType
00496     GetGlobalID(vtkIdType theID) const;
00497     
00499     virtual
00500     unsigned long int
00501     GetMemorySize();
00502 
00503     PGaussImpl myGauss; //<! Keep reference to corresponding TGauss structure
00504 
00506 
00510     ESubMeshStatus myStatus;
00511 
00512     vtkIdType myStartID;
00513     PPointCoords myPointCoords; 
00514   };
00515 
00516 
00517   //---------------------------------------------------------------
00518   typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
00519   typedef std::map<EGeometry, PGaussSubMeshImpl> TGeom2GaussSubMesh;
00520 
00522   struct VISU_CONVERTOR_EXPORT TGaussMeshImpl: virtual TGaussMesh, 
00523                          virtual TAppendPolyDataHolder
00524   {
00525     TGaussMeshImpl();
00526 
00528     virtual
00529     TGaussPointID
00530     GetObjID(vtkIdType theID) const;
00531 
00533     virtual
00534     vtkIdType 
00535     GetVTKID(const TGaussPointID& theID) const;
00536 
00538     virtual
00539     vtkPolyData* 
00540     GetPolyDataOutput();
00541 
00543     virtual
00544     unsigned long int
00545     GetMemorySize();
00546 
00548     virtual 
00549     TNamedIDMapper*
00550     GetParent() const;
00551 
00552     TNamedIDMapper* myParent; 
00553     TGaussSubMeshArr myGaussSubMeshArr; 
00554     TGeom2GaussSubMesh myGeom2GaussSubMesh; 
00555   };
00556 
00557 
00558   //---------------------------------------------------------------
00560   struct VISU_CONVERTOR_EXPORT TGaussPtsIDFilter: virtual TPolyDataIDMapperImpl,
00561                             virtual TGaussPtsIDMapper
00562   { 
00563     PGaussPtsIDMapper myGaussPtsIDMapper;
00564 
00566     virtual 
00567     TGaussPointID 
00568     GetObjID(vtkIdType theID) const;
00569 
00571     virtual 
00572     vtkIdType 
00573     GetVTKID(const TGaussPointID& theID) const;
00574 
00577     virtual 
00578     TNamedIDMapper*
00579     GetParent() const;
00580 
00582     virtual
00583     vtkPolyData* 
00584     GetPolyDataOutput();
00585 
00587     virtual
00588     vtkDataSet*
00589     GetOutput();
00590   };
00591 
00592 
00593   //---------------------------------------------------------------
00594   typedef TVector<vtkIdType> TConnect;
00595   typedef TVector<TConnect> TCell2Connect;
00596 
00598   struct VISU_CONVERTOR_EXPORT TSubMeshImpl: virtual TUnstructuredGridHolder
00599   {
00600     TSubMeshImpl();
00601 
00603     virtual
00604     void
00605     CopyStructure( PStructured theStructured );
00606 
00608     virtual 
00609     vtkIdType 
00610     GetElemObjID(vtkIdType theID) const;
00611 
00613     virtual
00614     std::string 
00615     GetElemName(vtkIdType theObjID) const;
00616 
00618     virtual
00619     unsigned long int
00620     GetMemorySize();
00621 
00622     vtkIdType myStartID;
00623     TCell2Connect myCell2Connect; 
00624   };
00625 
00626 
00627   //---------------------------------------------------------------
00628   typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
00629   typedef TVector<PSubMeshImpl> TSubMeshArr;
00630 
00632   struct VISU_CONVERTOR_EXPORT TMeshOnEntityImpl: virtual TMeshOnEntity, 
00633                             virtual TAppendFilterHolder, 
00634                             virtual TSizeCounter
00635   {
00636     TMeshOnEntityImpl();
00637 
00639     virtual
00640     void
00641     CopyStructure( PStructured theStructured );
00642 
00644     virtual 
00645     vtkIdType 
00646     GetNodeVTKID(vtkIdType theID) const;
00647 
00649     virtual 
00650     vtkIdType 
00651     GetNodeObjID(vtkIdType theID) const;
00652 
00654     virtual 
00655     vtkIdType 
00656     GetElemVTKID(vtkIdType theID) const;
00657 
00659     virtual 
00660     vtkIdType 
00661     GetElemObjID(vtkIdType theID) const;
00662 
00664     virtual
00665     std::string 
00666     GetNodeName(vtkIdType theObjID) const;
00667 
00669     virtual
00670     std::string 
00671     GetElemName(vtkIdType theObjID) const;
00672 
00674     virtual
00675     vtkUnstructuredGrid* 
00676     GetUnstructuredGridOutput();
00677 
00679     virtual
00680     unsigned long int
00681     GetMemorySize();
00682 
00683     TID2ID myElemObj2VTKID; 
00684     TSubMeshArr mySubMeshArr; 
00685     PNamedPointCoords myNamedPointCoords; 
00686 
00687     TGeom2SubMesh myGeom2SubMesh; 
00688   };
00689 
00690 
00691   //---------------------------------------------------------------
00692   typedef std::map<EGeometry,TSubMeshID> TGeom2SubMeshID;
00693 
00695   struct VISU_CONVERTOR_EXPORT TFamilyImpl: virtual TFamily, 
00696                       virtual TUnstructuredGridHolder
00697   {
00699     virtual
00700     void
00701     CopyStructure( PStructured theStructured );
00702 
00704     vtkIdType 
00705     GetNodeObjID(vtkIdType theID) const ;
00706 
00708     virtual 
00709     vtkIdType 
00710     GetNodeVTKID(vtkIdType theID) const ;
00711 
00713     virtual 
00714     vtkIdType 
00715     GetElemVTKID(vtkIdType theID) const;
00716 
00718     virtual 
00719     vtkIdType 
00720     GetElemObjID(vtkIdType theID) const;
00721 
00723     virtual
00724     vtkUnstructuredGrid* 
00725     GetUnstructuredGridOutput();
00726 
00728     virtual
00729     unsigned long int
00730     GetMemorySize();
00731 
00732     PNamedPointCoords myNamedPointCoords;  
00733     TID2ID myElemObj2VTKID; 
00734     TSubMeshID myMeshID; 
00735 
00736     TGeom2SubMeshID myGeom2SubMeshID; 
00737 
00738     TNames myGroupNames; 
00739   };
00740 
00741 
00742   //---------------------------------------------------------------
00743   typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
00744   typedef TVector<PFamilyImpl> TFamilyArr;
00745 
00747   struct VISU_CONVERTOR_EXPORT TGroupImpl: virtual TGroup, 
00748                      virtual TAppendFilterHolder
00749   {
00751     virtual
00752     void
00753     CopyStructure( PStructured theStructured );
00754 
00756     TNbASizeCells 
00757     GetNbASizeCells() const;
00758 
00760     virtual 
00761     vtkIdType 
00762     GetElemVTKID(vtkIdType theID) const;
00763 
00765     virtual 
00766     vtkIdType 
00767     GetElemObjID(vtkIdType theID) const;
00768 
00770     virtual 
00771     vtkIdType 
00772     GetNodeObjID(vtkIdType theID) const;
00773 
00775     virtual 
00776     vtkIdType 
00777     GetNodeVTKID(vtkIdType theID) const;
00778 
00780     virtual
00781     vtkUnstructuredGrid* 
00782     GetUnstructuredGridOutput();
00783 
00785     virtual
00786     unsigned long int
00787     GetMemorySize();
00788 
00789     TID2ID myElemObj2VTKID; 
00790     TFamilyArr myFamilyArr; 
00791     PNamedPointCoords myNamedPointCoords; 
00792   };
00793 
00794 
00795   //---------------------------------------------------------------
00796   typedef            TVector<TMinMax>              TComp2MinMax;
00797   typedef       TVector<TComp2MinMax>       TMetric2Comp2MinMax;
00798 
00799   typedef     std::map<TName,TMinMax>             TGroup2MinMax;
00800   typedef      TVector<TGroup2MinMax>        TComp2Group2MinMax;
00801   typedef TVector<TComp2Group2MinMax> TMetric2Comp2Group2MinMax;
00802 
00804   struct VISU_CONVERTOR_EXPORT TFieldImpl: virtual TField
00805   {
00806     TFieldImpl();
00807 
00809     void 
00810     Init(vtkIdType theNbComp,
00811          vtkIdType theDataType);
00812 
00814     vtkIdType
00815     GetDataType() const;
00816 
00818     virtual
00819     TMinMax 
00820     GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC);
00821 
00823     virtual
00824     TMinMax 
00825     GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC);
00826 
00827     vtkIdType myDataSize; 
00828     vtkIdType myDataType; 
00829     TMetric2Comp2MinMax myMetric2Comp2MinMax; 
00830     TMetric2Comp2MinMax myMetric2Comp2AverageMinMax; 
00831 
00832 
00833     TMetric2Comp2Group2MinMax myMetric2Comp2Group2MinMax;
00834     TMetric2Comp2Group2MinMax myMetric2Comp2Group2AverageMinMax;
00835   };
00836 
00837 
00838   //---------------------------------------------------------------
00839   typedef std::map<EGeometry, PMeshValue> TGeom2MeshValue;
00840 
00841   class TGeom2Value: public virtual TBaseStructure
00842   {
00843     TGeom2MeshValue myGeom2MeshValue;
00844   public:
00845 
00847     const PMeshValue& 
00848     GetMeshValue(EGeometry theGeom) const;
00849 
00851     PMeshValue& 
00852     GetMeshValue(EGeometry theGeom);
00853 
00855     TGeom2MeshValue& 
00856     GetGeom2MeshValue();
00857     
00859     const TGeom2MeshValue& 
00860     GetGeom2MeshValue() const;
00861 
00863     PMeshValue
00864     GetFirstMeshValue() const;
00865   };
00866 
00867 
00868   //---------------------------------------------------------------
00869   typedef std::map<EGeometry,vtkIdType> TGeom2NbGauss;
00870 
00872   struct VISU_CONVERTOR_EXPORT TValForTimeImpl: virtual TValForTime
00873   {
00874     PGaussPtsIDFilter myGaussPtsIDFilter; 
00875     PUnstructuredGridIDMapperImpl myUnstructuredGridIDMapper; 
00876     TGeom2Value myGeom2Value; 
00877     TGeom2NbGauss myGeom2NbGauss; 
00878     bool myIsFilled;              
00879    
00880     TValForTimeImpl();
00881 
00882     TGeom2MeshValue& 
00883     GetGeom2MeshValue();
00884     
00885     const TGeom2MeshValue& 
00886     GetGeom2MeshValue() const;
00887     
00889     const PMeshValue& 
00890     GetMeshValue(EGeometry theGeom) const;
00891 
00893     PMeshValue& 
00894     GetMeshValue(EGeometry theGeom);
00895 
00897     PMeshValue
00898     GetFirstMeshValue() const;
00899 
00901     virtual
00902     int
00903     GetNbGauss(EGeometry theGeom) const;
00904 
00906     virtual
00907     int
00908     GetMaxNbGauss() const;
00909 
00911     virtual
00912     unsigned long int
00913     GetMemorySize();
00914   };
00915 
00916 
00917   //---------------------------------------------------------------
00918 }
00919 
00920 
00921 #endif
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