]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
1. To introduce forward and backward ID's mapping
authorapo <apo@opencascade.com>
Tue, 30 Aug 2005 08:12:55 +0000 (08:12 +0000)
committerapo <apo@opencascade.com>
Tue, 30 Aug 2005 08:12:55 +0000 (08:12 +0000)
2. To separate MeshOnEntity and Family handling (first step)

src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx

index def332d0d0389edb28bb5d7e5e8c67275e0b8331..25e8ac3f02a5f552464509c462c1f68a51aab82c 100644 (file)
@@ -58,7 +58,7 @@ static float ERR_SIZE_CALC = 1.00;
 static int MYVTKDEBUG = 0;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 static int MYDEBUGWITHFILES = 0;
 #else
 static int MYDEBUG = 0;
@@ -160,6 +160,9 @@ namespace VISU
     TPointCoords::Init(theNbPoints,theDim);
     myPointsDim.resize(theDim);
     myVectorID = theVectorID;
+
+    for(vtkIdType anID = 0, anEnd = theVectorID.size(); anID < anEnd; anID++)
+      myObj2VTKID[theVectorID[anID]] = anID;
   }
 
   std::string&
@@ -187,6 +190,20 @@ namespace VISU
   }
 
 
+  vtkIdType
+  TNamedPointCoords
+  ::GetVTKID(vtkIdType theID) const
+  {
+    if(myObj2VTKID.empty())
+      return theID;
+    else{
+      TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
+      if(anIter != myObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
   //---------------------------------------------------------------
   TMeshImpl::TMeshImpl():
     myNamedPointCoords(new TNamedPointCoords()),
@@ -205,13 +222,6 @@ namespace VISU
   }
 
 
-  vtkIdType
-  TSubProfileImpl
-  ::GetNodeObjID(vtkIdType theID) const
-  {
-    return theID;
-  }
-
   vtkIdType
   TSubProfileImpl
   ::GetElemObjID(vtkIdType theID) const
@@ -242,11 +252,7 @@ namespace VISU
   TProfileImpl
   ::GetNodeObjID(vtkIdType theID) const
   {
-    vtkIdType anInputID;
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    vtkIdType aID = anAppendFilter->GetNodeObjId(theID,anInputID);
-    const TSubProfileImpl& aSubProfileImpl = mySubProfileArr[anInputID];
-    return aSubProfileImpl.GetNodeObjID(aID);
+    return myNamedPointCoords->GetObjID(theID);
   }
 
   vtkIdType
@@ -259,30 +265,44 @@ namespace VISU
     const TSubProfileImpl& aSubProfileImpl = mySubProfileArr[anInputID];
     return aSubProfileImpl.GetElemObjID(aID);
   }
-  //modified by NIZNHY-PKV Tue Aug 30 11:18:46 2005f
-  //---------------------------------------------------------------
-  vtkCell* TProfileImpl::GetElemCell(int theObjID)
+
+  vtkIdType
+  TProfileImpl
+  ::GetElemVTKID(vtkIdType theID) const
   {
-    int aVtkID;
-    vtkIdType aObjID;
-    //
-    aObjID=GetElemObjID(theObjID);
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    aVtkID=anAppendFilter->GetElemVtkID(aObjID);
-    return anAppendFilter->GetOutput()->GetCell(aVtkID);
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TElemObj2VTKID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
   }
-  //---------------------------------------------------------------
-  float*  TProfileImpl::GetNodeCoord(int theObjID)
+
+  vtkIdType
+  TProfileImpl
+  ::GetNodeVTKID(vtkIdType theID) const
   {
-    int aVtkID;
-    vtkIdType aObjID;
-    //
-    aObjID=GetNodeObjID(theObjID);
-    const TVTKAppendFilter& anAppendFilter = GetFilter();
-    aVtkID=anAppendFilter->GetElemVtkID(theObjID);
-    return anAppendFilter->GetOutput()->GetPoint(aVtkID);
+    return myNamedPointCoords->GetVTKID(theID);
   }
-  //modified by NIZNHY-PKV Tue Aug 30 11:18:49 2005t
+
+  vtkCell* 
+  TProfileImpl
+  ::GetElemCell(int theObjID)
+  {
+    vtkIdType aVtkID = GetElemVTKID(theObjID);
+    return GetFilter()->GetOutput()->GetCell(aVtkID);
+  }
+
+  float*  
+  TProfileImpl
+  ::GetNodeCoord(int theObjID)
+  {
+    vtkIdType aVtkID = GetNodeVTKID(theObjID);
+    return GetFilter()->GetOutput()->GetPoint(aVtkID);
+  }
+
 
   //---------------------------------------------------------------
   TGaussSubMeshImpl::TGaussSubMeshImpl():
@@ -672,7 +692,7 @@ namespace
   void
   GetCellsOnEntity(const TVTKSource& theSource,
                   const PMeshOnEntityImpl& theMeshOnEntity, 
-                  const std::string& theFamilyName) 
+                  const std::string& theFamilyName = ""
   {
     //Check on existing family
     PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
@@ -921,6 +941,7 @@ namespace
   void
   GetCells(const TVTKSource& theSource,
           const PSubProfileImpl& theSubProfile,
+          const PProfileImpl& theProfile,
           const PMeshOnEntityImpl& theMeshOnEntity)
   {
     vtkIdType aNbCells = theSubProfile->myNbCells;
@@ -942,12 +963,16 @@ namespace
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
     
+    VISU::TElemObj2VTKID& anElemObj2VTKID = theProfile->myElemObj2VTKID;
     if(theSubProfile->myStatus == eAddAll){
       VISU::TCell2Connect::const_iterator anIter = aCell2Connect.begin();
       for(vtkIdType anId = 0, aConnId = 0; anIter != aCell2Connect.end(); anIter++){
        const TConnect& anArray = aCell2Connect[anId];
        PrintCells(aConnId,aConnectivity,anArray);
        aCellTypesArray->SetValue(anId,(unsigned char)aGeom);
+
+       anElemObj2VTKID[theSubProfile->GetElemObjID(anId)] = anId;
+
        aConnId += aNbNodes;
        anId++;
       }
@@ -958,6 +983,9 @@ namespace
        const TConnect& anArray = aCell2Connect[aSubId];
        PrintCells(aConnId,aConnectivity,anArray);
        aCellTypesArray->SetValue(anId,(unsigned char)aGeom);
+
+       anElemObj2VTKID[theSubProfile->GetElemObjID(anId)] = anId;
+
        aConnId += aNbNodes;
        anId++;
       }
@@ -994,7 +1022,7 @@ namespace
     
     GetPoints(aSource,theMesh);
     INITMSGA(MYDEBUG,0,"GetNumberOfPoints - "<<aSource->GetNumberOfPoints()<<endl);
-    GetCells(aSource,theSubProfile,theMeshOnEntity);
+    GetCells(aSource,theSubProfile,theProfile,theMeshOnEntity);
     BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
     
     theSubProfile->myIsVTKDone = true;
@@ -1266,6 +1294,21 @@ namespace
   }
 
 
+  //---------------------------------------------------------------
+  void
+  PrintMemorySize(vtkUnstructuredGrid* theDataSet)
+  {
+    theDataSet->Update();
+    BEGMSG(1,"GetPoints() = "<<float(theDataSet->GetPoints()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetCells() = "<<float(theDataSet->GetCells()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetCellTypesArray() = "<<float(theDataSet->GetCellTypesArray()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetCellLocationsArray() = "<<float(theDataSet->GetCellLocationsArray()->GetActualMemorySize()*1000)<<endl);
+    theDataSet->BuildLinks();
+    BEGMSG(1,"GetCellLinks() = "<<float(theDataSet->GetCellLinks()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetPointData() = "<<float(theDataSet->GetPointData()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetCellData() = "<<float(theDataSet->GetCellData()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetActualMemorySize() = "<<float(theDataSet->GetActualMemorySize()*1000)<<endl);
+  }
 }
 
 
@@ -1290,47 +1333,107 @@ VISU_Convertor_impl
                  const VISU::TEntity& theEntity,
                  const string& theFamilyName)
 {
-  INITMSG(MYDEBUG,"GetMeshOnEntity"<<
+  if(theFamilyName == "")
+    return GetMeshOnEntity2(theMeshName,theEntity);
+  else
+    return GetFamilyOnEntity(theMeshName,theEntity,theFamilyName);
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor::TOutput* 
+VISU_Convertor_impl
+::GetMeshOnEntity2(const string& theMeshName, 
+                  const VISU::TEntity& theEntity)
+{
+  INITMSG(MYDEBUG,"GetMeshOnEntity2"<<
          "; theMeshName = '"<<theMeshName<<"'"<<
          "; theEntity = "<<theEntity<<
-         "; theFamilyName = '"<<theFamilyName<<"'"<<
          endl);
 
   //Cheching possibility do the query
-  TFindMeshOnEntity aFindMeshOnEntity = FindMeshOnEntity(theMeshName,
-                                                        theEntity,
-                                                        theFamilyName);
+  TFindMeshOnEntity aFindMeshOnEntity = 
+    FindMeshOnEntity(theMeshName,theEntity);
+
   PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
-  PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
   PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
 
-  TVTKSource aSource;
-  bool *anIsInitialized;
-  if(aFamily){
-    aSource = aFamily->GetSource();
-    anIsInitialized = &(aFamily->myIsVTKDone);
-  }else{
-    aSource = aMeshOnEntity->GetSource();
-    anIsInitialized = &(aMeshOnEntity->myIsVTKDone);
+  //Main part of code
+  const TVTKSource& aSource = aMeshOnEntity->GetSource();
+#ifndef _DEXCEPT_
+  try{
+#endif
+    if(!aMeshOnEntity->myIsVTKDone){
+      if(MYVTKDEBUG) aSource->DebugOn();
+
+      LoadMeshOnEntity(aMeshOnEntity);
+      GetPoints(aSource,aMesh);
+      GetCellsOnEntity(aSource,aMeshOnEntity);
+
+      aMeshOnEntity->myIsVTKDone = true;
+
+      if(MYDEBUGWITHFILES){
+       std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       aFileName += aMeshName + dtos("-%d-",int(theEntity)) + "-Conv.vtk";
+       VISU::WriteToFile(aSource.GetPointer(),aFileName);
+      }
+    }
+
+    if(MYVTKDEBUG){
+      GetMeshOnEntitySize(theMeshName,theEntity);
+      PrintMemorySize(aSource.GetPointer());
+    }
+
+#ifndef _DEXCEPT_
+  }catch(...){
+    throw;
   }
+#endif
+
+  return aSource.GetPointer();
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor::TOutput* 
+VISU_Convertor_impl
+::GetFamilyOnEntity(const std::string& theMeshName, 
+                   const VISU::TEntity& theEntity,
+                   const std::string& theFamilyName)
+{
+  INITMSG(MYDEBUG,"GetFamilyOnEntity"<<
+         "; theMeshName = '"<<theMeshName<<"'"<<
+         "; theEntity = "<<theEntity<<
+         "; theFamilyName = '"<<theFamilyName<<"'"<<
+         endl);
+
+  //Cheching possibility do the query
+  TFindFamilyOnEntity aFindFamilyOnEntity = 
+    FindFamilyOnEntity(theMeshName,theEntity,theFamilyName);
+
+  PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);;
+  PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
 
   //Main part of code
+  const TVTKSource& aSource = aFamily->GetSource();
 #ifndef _DEXCEPT_
   try{
 #endif
-    if(!(*anIsInitialized)){
+    if(!aFamily->myIsVTKDone){
       if(MYVTKDEBUG) aSource->DebugOn();
 
       LoadMeshOnEntity(aMeshOnEntity,theFamilyName);
       GetPoints(aSource,aMesh);
       GetCellsOnEntity(aSource,aMeshOnEntity,theFamilyName);
 
-      (*anIsInitialized) = true;
+      aFamily->myIsVTKDone = true;
 
       if(MYDEBUGWITHFILES){
-       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-       string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
-       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
        aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk";
        VISU::WriteToFile(aSource.GetPointer(),aFileName);
       }
@@ -1338,15 +1441,9 @@ VISU_Convertor_impl
 
     if(MYVTKDEBUG){
       GetMeshOnEntitySize(theMeshName,theEntity,theFamilyName);
-      aSource->Update();
-      BEGMSG(MYVTKDEBUG,"GetPoints() = "<<float(aSource->GetPoints()->GetActualMemorySize()*1000)<<endl);
-      BEGMSG(MYVTKDEBUG,"GetCells() = "<<float(aSource->GetCells()->GetActualMemorySize()*1000)<<endl);
-      BEGMSG(MYVTKDEBUG,"GetCellTypesArray() = "<<float(aSource->GetCellTypesArray()->GetActualMemorySize()*1000)<<endl);
-      BEGMSG(MYVTKDEBUG,"GetCellLocationsArray() = "<<float(aSource->GetCellLocationsArray()->GetActualMemorySize()*1000)<<endl);
-      aSource->BuildLinks();
-      BEGMSG(MYVTKDEBUG,"GetCellLinks() = "<<float(aSource->GetCellLinks()->GetActualMemorySize()*1000)<<endl);
-      BEGMSG(MYVTKDEBUG,"GetActualMemorySize() = "<<float(aSource->GetActualMemorySize()*1000)<<endl);
+      PrintMemorySize(aSource.GetPointer());
     }
+
 #ifndef _DEXCEPT_
   }catch(...){
     throw;
@@ -1491,12 +1588,14 @@ VISU_Convertor_impl
   return aSource.GetPointer();
 }
 
+
 //---------------------------------------------------------------
 VISU::PProfile 
-VISU_Convertor_impl::GetProfile(const std::string& theMeshName, 
-                               const VISU::TEntity& theEntity,
-                               const std::string& theFieldName,
-                               int theStampsNum)
+VISU_Convertor_impl
+::GetProfile(const std::string& theMeshName, 
+            const VISU::TEntity& theEntity,
+            const std::string& theFieldName,
+            int theStampsNum)
 {
   GetTimeStampOnMesh(theMeshName, theEntity, theFieldName, theStampsNum);
   TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
@@ -1508,6 +1607,7 @@ VISU_Convertor_impl::GetProfile(const std::string& theMeshName,
   return aProfile;
 }
 
+
 //---------------------------------------------------------------
 VISU_Convertor::TOutput* 
 VISU_Convertor_impl
@@ -1625,8 +1725,7 @@ VISU_Convertor_impl
 VISU_Convertor_impl::TFindMeshOnEntity
 VISU_Convertor_impl
 ::FindMeshOnEntity(const string& theMeshName,
-                  const VISU::TEntity& theEntity,
-                  const string& theFamilyName)
+                  const VISU::TEntity& theEntity)
 {
   PMeshImpl aMesh = FindMesh(theMeshName);
   VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
@@ -1635,10 +1734,30 @@ VISU_Convertor_impl
     EXCEPTION(runtime_error,"FindMeshOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
 
   PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
-
+  
   return TFindMeshOnEntity(aMesh,
-                          aMeshOnEntityMap[theEntity],
-                          GetFamily(aMeshOnEntity,theFamilyName));
+                          aMeshOnEntity);
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor_impl::TFindFamilyOnEntity
+VISU_Convertor_impl
+::FindFamilyOnEntity(const string& theMeshName,
+                    const VISU::TEntity& theEntity,
+                    const string& theFamilyName)
+{
+  PMeshImpl aMesh = FindMesh(theMeshName);
+  VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+  VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(theEntity);
+  if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
+    EXCEPTION(runtime_error,"FindFamilyOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
+
+  PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
+
+  return TFindFamilyOnEntity(aMesh,
+                            aMeshOnEntity,
+                            VISU::GetFamily(aMeshOnEntity,theFamilyName));
 }
 
 
@@ -1695,29 +1814,79 @@ VISU_Convertor_impl
 }
 
 
+//---------------------------------------------------------------
 float
 VISU_Convertor_impl
 ::GetMeshOnEntitySize(const std::string& theMeshName, 
                      const VISU::TEntity& theEntity,
                      const std::string& theFamilyName)
+{
+  if(theFamilyName == "")
+    return GetMeshOnEntitySize2(theMeshName,theEntity);
+  else
+    return GetFamilyOnEntitySize(theMeshName,theEntity,theFamilyName);
+}
+
+
+//---------------------------------------------------------------
+float
+VISU_Convertor_impl
+::GetMeshOnEntitySize2(const std::string& theMeshName, 
+                      const VISU::TEntity& theEntity)
 {
   TFindMeshOnEntity aFindMeshOnEntity = 
-    FindMeshOnEntity(theMeshName,theEntity,theFamilyName);
+    FindMeshOnEntity(theMeshName,theEntity);
+
   PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);
-  PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
   PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
 
   vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
-  vtkIdType aNbCells, aCellsSize;
-
-  if(!aFamily){
-    aNbCells = aMeshOnEntity->myNbCells;
-    aCellsSize = aMeshOnEntity->myCellsSize;
-  }else{
-    aNbCells = aFamily->myNbCells;
-    aCellsSize = aFamily->myCellsSize;
+  vtkIdType aNbCells = aMeshOnEntity->myNbCells;
+  vtkIdType aCellsSize = aMeshOnEntity->myCellsSize;
+
+  vtkIdType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
+  vtkIdType aTypesSize = aNbCells*sizeof(char);
+  vtkIdType aLocationsSize = aNbCells*sizeof(int);
+  float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
+  vtkIdType aLinksSize = aMesh->myNbPoints * 
+    (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
+  aLinksSize = 0;
+  vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
+
+  MSG(MYDEBUG,"GetMeshOnEntitySize2 "<<
+      "- aResult = "<<float(aResult)<<
+      "; theMeshName = '"<<theMeshName<<"'"<<
+      "; theEntity = "<<theEntity);
+  if(MYDEBUG){
+    INITMSG(MYVTKDEBUG,"- aPointsSize = "<<float(aPointsSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aConnectivitySize = "<<float(aConnectivitySize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aTypesSize = "<<float(aTypesSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aLocationsSize = "<<float(aLocationsSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aLinksSize = "<<float(aLinksSize)<<"\n");
   }
 
+  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
+  return aResult;
+}
+
+
+//---------------------------------------------------------------
+float
+VISU_Convertor_impl
+::GetFamilyOnEntitySize(const std::string& theMeshName, 
+                       const VISU::TEntity& theEntity,
+                       const std::string& theFamilyName)
+{
+  TFindFamilyOnEntity aFindFamilyOnEntity = 
+    FindFamilyOnEntity(theMeshName,theEntity,theFamilyName);
+  PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);
+  PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
+
+  vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
+  vtkIdType aNbCells = aFamily->myNbCells;
+  vtkIdType aCellsSize = aFamily->myCellsSize;
+
   vtkIdType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
   vtkIdType aTypesSize = aNbCells*sizeof(char);
   vtkIdType aLocationsSize = aNbCells*sizeof(int);
@@ -1726,21 +1895,26 @@ VISU_Convertor_impl
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
   aLinksSize = 0;
   vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
+
+  MSG(MYDEBUG,"GetFamilyOnEntitySize "<<
+      "- aResult = "<<float(aResult)<<
+      "; theMeshName = '"<<theMeshName<<"'"<<
+      "; theEntity = "<<theEntity<<
+      "; theFamilyName = '"<<theFamilyName<<"'");
   if(MYDEBUG){
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aPointsSize = "<<float(aPointsSize));
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aConnectivitySize = "<<float(aConnectivitySize));
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aTypesSize = "<<float(aTypesSize));
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aLocationsSize = "<<float(aLocationsSize));
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aLinksSize = "<<float(aLinksSize));
+    INITMSG(MYVTKDEBUG,"- aPointsSize = "<<float(aPointsSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aConnectivitySize = "<<float(aConnectivitySize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aTypesSize = "<<float(aTypesSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aLocationsSize = "<<float(aLocationsSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aLinksSize = "<<float(aLinksSize)<<"\n");
   }
-  MSG(MYDEBUG,"GetMeshOnEntitySize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
-      "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
 
   aResult = vtkIdType(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
 
+//---------------------------------------------------------------
 VISU_Convertor_impl::TFindMeshOnGroup
 VISU_Convertor_impl
 ::FindMeshOnGroup(const std::string& theMeshName, 
@@ -1795,9 +1969,10 @@ VISU_Convertor_impl
            const VISU::TEntity& theEntity, 
            const string& theFieldName)
 {
-  TFindMeshOnEntity aFindMeshOnEntity = FindMeshOnEntity(theMeshName,theEntity,"");
+  TFindMeshOnEntity aFindMeshOnEntity = 
+    FindMeshOnEntity(theMeshName,theEntity);
+
   PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
-  PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
   PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
 
   VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
index 571a1f63e8d4b76a120314bfc33ade3c6472379f..b9bb7bcf046c73e7f8fe912a1ec65a7569b44a0a 100644 (file)
@@ -120,11 +120,14 @@ namespace VISU
 
   //---------------------------------------------------------------
   typedef TVector<vtkIdType> TVectorID;
+  typedef std::map<vtkIdType,vtkIdType> TObj2VTKID;
+
   class TNamedPointCoords: public virtual TPointCoords
   {
     typedef TVector<std::string> TPointsDim;
     TPointsDim myPointsDim;
     TVectorID myVectorID;
+    TObj2VTKID myObj2VTKID;
 
   public:
 
@@ -142,6 +145,10 @@ namespace VISU
     virtual
     vtkIdType
     GetObjID(vtkIdType theID) const;
+
+    virtual
+    vtkIdType
+    GetVTKID(vtkIdType theID) const;
   };
   typedef SharedPtr<TNamedPointCoords> PNamedPointCoords;
 
@@ -171,10 +178,6 @@ namespace VISU
     vtkIdType myGeom;
     std::string myName;
 
-    virtual 
-    vtkIdType 
-    GetNodeObjID(int theVtkI) const;
-
     virtual 
     vtkIdType 
     GetElemObjID(int theVtkI) const;
@@ -186,6 +189,7 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  typedef std::map<vtkIdType,vtkIdType> TElemObj2VTKID;
   typedef std::vector<PSubProfileImpl> TSubProfileArr;
   typedef std::map<vtkIdType,PSubProfileImpl> TGeom2SubProfile;
 
@@ -202,15 +206,23 @@ namespace VISU
     vtkIdType 
     GetElemObjID(int theVtkI) const;
 
-    //pkv f
+    virtual 
+    vtkIdType 
+    GetElemVTKID(int theID) const;
+
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(int theID) const;
+
     virtual
     vtkCell* 
     GetElemCell(int theObjID);
+
     virtual
     float* 
     GetNodeCoord(int theObjID);
-    //pkv t
 
+    TElemObj2VTKID myElemObj2VTKID;
     PNamedPointCoords myNamedPointCoords;
 
     TSubProfileArr mySubProfileArr;
@@ -384,6 +396,17 @@ public:
                      const VISU::TEntity& theEntity,
                      const std::string& theFamilyName = "");
 
+  virtual 
+  float 
+  GetMeshOnEntitySize2(const std::string& theMeshName, 
+                      const VISU::TEntity& theEntity);
+
+  virtual 
+  float 
+  GetFamilyOnEntitySize(const std::string& theMeshName, 
+                       const VISU::TEntity& theEntity,
+                       const std::string& theFamilyName);
+
   virtual 
   float 
   GetMeshOnGroupSize(const std::string& theMeshName, 
@@ -430,6 +453,17 @@ public:
                  const VISU::TEntity& theEntity,
                  const std::string& theFamilyName = "");
 
+  virtual 
+  TOutput* 
+  GetMeshOnEntity2(const std::string& theMeshName, 
+                  const VISU::TEntity& theEntity);
+
+  virtual 
+  TOutput* 
+  GetFamilyOnEntity(const std::string& theMeshName, 
+                   const VISU::TEntity& theEntity,
+                   const std::string& theFamilyName);
+
   virtual 
   TOutput* 
   GetMeshOnGroup(const std::string& theMeshName, 
@@ -466,11 +500,16 @@ protected:
   VISU::PMeshImpl 
   FindMesh(const std::string& theMeshName);
 
-  typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindMeshOnEntity;
+  typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
   TFindMeshOnEntity
   FindMeshOnEntity(const std::string& theMeshName,
-                  const VISU::TEntity& theEntity,
-                  const std::string& theFamilyName);
+                  const VISU::TEntity& theEntity);
+
+  typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
+  TFindFamilyOnEntity
+  FindFamilyOnEntity(const std::string& theMeshName,
+                   const VISU::TEntity& theEntity,
+                   const std::string& theFamilyName);
 
   typedef boost::tuple<VISU::PMeshImpl,VISU::PGroupImpl> TFindMeshOnGroup;
   TFindMeshOnGroup
index d66a8df2dd7ad245fe2ceec5c8321f3f7a6a31eb..4913822586e6d8b783183e1e735e58941a67db17 100644 (file)
@@ -736,13 +736,6 @@ namespace
 
 
   //---------------------------------------------------------------
-  vtkIdType
-  TMEDSubProfile
-  ::GetNodeObjID(vtkIdType theID) const
-  {
-    return myNamedPointCoords->GetObjID(theID);
-  }
-  
   vtkIdType
   TMEDSubProfile
   ::GetElemObjID(vtkIdType theID) const
@@ -976,7 +969,7 @@ VISU_MedConvertor
     PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
     aMeshOnEntity->myEntity = NODE_ENTITY;
     aMeshOnEntity->myMeshName = theMesh->myName;
-    PMEDFamily aFamily = GetFamily(aMeshOnEntity,theFamilyName);
+    PMEDFamily aFamily = VISU::GetFamily(aMeshOnEntity,theFamilyName);
 
     //Check on loading already done
     if(theMesh->myIsDone)
@@ -1055,7 +1048,7 @@ VISU_MedConvertor
 #endif
 
     //Check on existing family
-    PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
+    PFamilyImpl aFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
 
     //Check on loading already done
     bool isCellsLoaded = !theMeshOnEntity->myGeom2Cell2Connect.empty();
@@ -1306,10 +1299,10 @@ LoadProfile(const MED::PWrapper& theMed,
       aSubProfile->myIsElemNum = anElemInfo->IsElemNum();
       if(aSubProfile->myIsElemNum)
        aSubProfile->myElemNum = anElemInfo->myElemNum;
-
-      aSubProfile->myNamedPointCoords = theMesh->myNamedPointCoords;
     }
   }
+  aProfile->myNamedPointCoords = theMesh->myNamedPointCoords;
+
   aProfile->myIsDone = true;
 }
 
index fd51f28fd5cba609caae5467010ed3dd41b5f455..3394876ef4b14c045b68296fcdeb1bff6bca76e3 100644 (file)
@@ -34,16 +34,10 @@ namespace VISU
 
     MED::EBooleen myIsElemNum;
     MED::TElemNum myElemNum;
-    PNamedPointCoords myNamedPointCoords;
-
-    virtual 
-    vtkIdType 
-    GetNodeObjID(vtkIdType theID) const;
 
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
-
   };
   typedef SharedPtr<TMEDSubProfile> PMEDSubProfile;