Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / CONVERTOR / VISU_Convertor.cxx
index 8238d72a15b37a8eb74c7705e9ce1a5d65bac9f7..f417ad07a5c079b770a87d1c2c9196039d062163 100644 (file)
 #include "VISU_Convertor.hxx"
 #include "VISU_ConvertorUtils.hxx"
 
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
+#include <qstring.h>
 
-extern "C" {
-  VISU_Convertor* CreateConvertor(const string& theFileName) {
-    if(QFileInfo(theFileName.c_str()).extension(false) == "med")
-      return CreateMedConvertor(theFileName);
-    else
-      return CreateDatConvertor(theFileName);
-  }
-}
+using namespace std;
 
 namespace VISU{
-  inline int GetNbOfPoints(int theVTKCellType){
+
+  inline
+  int
+  GetNbOfPoints(int theVTKCellType)
+  {
     switch(theVTKCellType){
     case VTK_VERTEX : return 1;
     case VTK_LINE : return 2;
@@ -58,92 +49,21 @@ namespace VISU{
     default: return -1;
     }
   }
-
-  pair<int,int> TMeshOnEntity::GetCellsDims(const string& theFamilyName) const
-  {
-    bool isFamilyPresent = (theFamilyName != "");
-    int aNbCells = 0, aCellsSize = 0;
-    if(!isFamilyPresent){
-      TCellsConn::const_iterator aCellsConnIter = myCellsConn.begin();
-      for(; aCellsConnIter != myCellsConn.end(); aCellsConnIter++){
-       const TConnForCellType& aConnForCellType = aCellsConnIter->second;
-       if(!aConnForCellType.empty()){
-         aNbCells += aConnForCellType.size();
-         aCellsSize += aConnForCellType.size()*(aConnForCellType[0].size()+1);
-       }
-      }
-    }else{
-      TFamilyMap::const_iterator aFamilyMapIter = myFamilyMap.find(theFamilyName);
-      if(aFamilyMapIter == myFamilyMap.end())
-       throw std::runtime_error("GetCellsDims >> There is no family on the mesh with entity !!!");
-      const TFamily& aFamily = aFamilyMapIter->second; 
-      const TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
-      TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.begin();
-      for(; aSubMeshIter != aSubMesh.end(); aSubMeshIter++){
-       const TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
-       if(!aSubMeshOnCellType.empty()){
-         int tmp = aSubMeshOnCellType.size();
-         aNbCells += tmp;
-         int aVtkType = aSubMeshIter->first;
-         int aVtkSize = GetNbOfPoints(aVtkType);
-         aCellsSize += tmp*(aVtkSize+1);
-       }
-      }
-    }
-    return make_pair(aNbCells,aCellsSize);
-  }
-  
-  const TField* TMesh::GetField(const string& theFieldName) const {
-    TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = myMeshOnEntityMap.begin();
-    for(; aMeshOnEntityMapIter != myMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-      const TFieldMap& aFieldMap = (aMeshOnEntityMapIter->second).myFieldMap;
-      TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-      for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++)
-       if(theFieldName == aFieldMapIter->first) return &(aFieldMapIter->second);
-    }
-    return NULL;
-  }
-
-  const TFamily* GetFamily(const VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
-  {
-    if(theFamilyName == "") return NULL;
-    const VISU::TFamilyMap& aFamilyMap = theMeshOnEntity.myFamilyMap;
-    VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
-    if(aFamilyMapIter == aFamilyMap.end())
-      throw std::runtime_error("GetFamily >> There is no family on the mesh with entity !!!");
-    const VISU::TFamily& aFamily = aFamilyMapIter->second;
-    return &aFamily;
-  }
-  
-  TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
-  {
-    if(theFamilyName == "") return NULL;
-    VISU::TFamilyMap& aFamilyMap = theMeshOnEntity.myFamilyMap;
-    VISU::TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
-    if(aFamilyMapIter == aFamilyMap.end())
-      throw std::runtime_error("GetFamily >> There is no family on the mesh with entity !!!");
-    VISU::TFamily& aFamily = aFamilyMapIter->second;
-    return &aFamily;
-  }
-  
-  void TField::ShallowCopy(const TField& aField){
-    myEntity = aField.myEntity;
-    myMeshName = aField.myMeshName;
-    myNbComp = aField.myNbComp;
-    VISU::TField::TValField::const_iterator iter = aField.myValField.begin();
-    for(; iter != aField.myValField.end(); iter++)
-      myValField[iter->first];
-  }
 }
 
 
-const VISU::TMeshMap& VISU_Convertor::GetMeshMap() { 
-  if(!myIsDone) { myIsDone = true;  Build();}
+const VISU::TMeshMap& 
+VISU_Convertor
+::GetMeshMap() 
+{ 
   return myMeshMap;
 }
 
 
-string VISU_Convertor::GenerateName(const VISU::TField::TTime& aTime){
+string
+VISU_Convertor
+::GenerateName(const VISU::TTime& aTime)
+{
   static QString aName;
   const string aUnits = aTime.second, tmp(aUnits.size(),' ');
   if(aUnits == "" || aUnits == tmp)
@@ -154,7 +74,11 @@ string VISU_Convertor::GenerateName(const VISU::TField::TTime& aTime){
   return aName.latin1();
 }
 
-string VISU_Convertor::GenerateName(const string& theName, unsigned int theTimeId) {
+string
+VISU_Convertor
+::GenerateName(const string& theName, 
+              unsigned int theTimeId) 
+{
   static QString aName;
   aName = QString(theName.c_str()).simplifyWhiteSpace();
   int iEnd = strlen(aName);