]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To implement mapping a pseudo Gauss Points that is located at BaryCenter of the mesh...
authorapo <apo@opencascade.com>
Wed, 3 Aug 2005 12:27:48 +0000 (12:27 +0000)
committerapo <apo@opencascade.com>
Wed, 3 Aug 2005 12:27:48 +0000 (12:27 +0000)
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_MedConvertor.cxx

index ae2be549f84b7ef0ee224b2505431ea1601d8cab..a0ece5a69d8957492ced711299ac92894a06ae6a 100644 (file)
@@ -334,12 +334,14 @@ namespace VISU
   ::GetNbGauss(vtkIdType theGeom) const
   {
     PGaussMeshImpl aGaussMesh = myGaussMesh;
-    const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
-    TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.find(theGeom);
-    if(anIter != aGeom2GaussSubMesh.end()){
-      PGaussSubMesh aGaussSubMesh = anIter->second;
-      PGaussImpl aGauss = aGaussSubMesh->myGauss;
-      return aGauss->myNbPoints;
+    if(aGaussMesh){
+      const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+      TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.find(theGeom);
+      if(anIter != aGeom2GaussSubMesh.end()){
+       PGaussSubMesh aGaussSubMesh = anIter->second;
+       PGaussImpl aGauss = aGaussSubMesh->myGauss;
+       return aGauss->myNbPoints;
+      }
     }
     return myNbGauss;
   }
@@ -1327,15 +1329,15 @@ VISU_Convertor_impl
       
       PProfileImpl aProfile = aValForTime->myProfile;
       PGaussMeshImpl aGaussMesh = aValForTime->myGaussMesh;
-      const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
-      INITMSG(MYDEBUG,"aGeom2GaussSubMesh.size() = "<<aGeom2GaussSubMesh.size()<<endl);
-      if(aGeom2GaussSubMesh.empty()){
+      INITMSG(MYDEBUG,"aGaussMesh = "<<bool(aGaussMesh)<<endl);
+      if(!aGaussMesh){
        GetMeshOnProfile(aMesh,aVTKMeshOnEntity,aProfile);
      
        TVTKAppendFilter& anAppendFilter = aProfile->myFilter;
        aSource->ShallowCopy(anAppendFilter->GetOutput());
        GetTimeStampOnProfile(aSource,aField,aValForTime);
       }else{
+       const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
        GetGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh);
      
        TVTKAppendFilter& anAppendFilter = aGaussMesh->myFilter;
index fb77179933125c17ddb25a0532201ff7db239b02..e073dde3faec84a116f38232f4f0d25d823e2df3 100644 (file)
@@ -47,7 +47,7 @@ using MED::TFloat;
 using MED::EBooleen;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 static int MY_FAMILY_DEBUG = 0;
 static int MY_GROUP_DEBUG = 0;
 #else
@@ -257,10 +257,10 @@ namespace
   {
     INITMSG(MYDEBUG,"GetGaussKey"<<endl);
 
+    TGaussKey aGaussKey;
     PMEDProfile aProfile = theValForTime.myProfile;
     TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
 
-    TGaussKey aGaussKey;
     const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
     const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
     const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
@@ -276,45 +276,45 @@ namespace
        INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
        continue;
       }
+      PMEDSubProfile aSubProfile = anIter2->second;
 
       MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
       if(aTimeStampIter != theGeom2Size.end()){
-       MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
-       if(aGaussIter != aGeom2Gauss.end()){
-         PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh());
-         
-         PMEDSubProfile aSubProfile = anIter2->second;
-         aGaussSubMesh->mySubProfile = aSubProfile;
-         aGaussSubMesh->myStatus = aSubProfile->myStatus;
+       TInt aNbCells = aTimeStampIter->second;
+
+       PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh());
+       aGaussSubMesh->mySubProfile = aSubProfile;
+       aGaussSubMesh->myStatus = aSubProfile->myStatus;
          
-         PMEDGauss aGauss(new TMEDGauss());
-         aGaussSubMesh->myGauss = aGauss;
-         aGauss->myGeom = aVGeom;
+       PMEDGauss aGauss(new TMEDGauss());
+       aGaussSubMesh->myGauss = aGauss;
+       aGauss->myGeom = aVGeom;
+
+       TInt aNbGauss = 1;
+       std::string aName;
 
+       MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
+       if(aGaussIter != aGeom2Gauss.end()){
          MED::PGaussInfo aGaussInfo = aGaussIter->second;
          aGauss->myGaussInfo = aGaussInfo;
-
-         std::string aName = aGaussInfo->GetName();
-         aGauss->myName = aName;
-
-         TInt aNbCells = aTimeStampIter->second;
-         TInt aNbGauss = aGaussInfo->GetNbGauss();
-         aGauss->myNbPoints = aNbGauss;
-
-         aGaussSubMesh->myNbCells = aNbCells*aNbGauss;
-         aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2;
-
-         INITMSGA(MYDEBUG,0,
-                  "- aVGeom = "<<aVGeom<<
-                  "; aName = '"<<aName<<"'"<<
-                  "; aNbGauss = "<<aNbGauss<<
-                  "; aStatus = "<<aGaussSubMesh->myStatus<<
-                  "; aNbCells = "<<aGaussSubMesh->myNbCells<<
-                  "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
-                  endl);
-         
-         aGaussKey.insert(aGaussSubMesh);
+         aName = aGauss->myName = aGaussInfo->GetName();
+         aNbGauss = aGauss->myNbPoints = aGaussInfo->GetNbGauss();
        }
+       
+       aGauss->myNbPoints = aNbGauss;
+       aGaussSubMesh->myNbCells = aNbCells*aNbGauss;
+       aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2;
+
+       aGaussKey.insert(aGaussSubMesh);
+
+       INITMSGA(MYDEBUG,0,
+                "- aVGeom = "<<aVGeom<<
+                "; aName = '"<<aName<<"'"<<
+                "; aNbGauss = "<<aNbGauss<<
+                "; aStatus = "<<aGaussSubMesh->myStatus<<
+                "; aNbCells = "<<aGaussSubMesh->myNbCells<<
+                "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
+                endl);
       }
     }
 
@@ -330,7 +330,10 @@ namespace
                VISU::TMEDValForTime& theValForTime)
   {
     INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
-    
+
+    if(theMeshOnEntity.myEntity == NODE_ENTITY)
+      return;
+
     TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
     
     TGaussKey aGaussKey = GetGaussKey(theTimeStampVal,
@@ -1138,7 +1141,7 @@ LoadGaussMesh(const MED::PWrapper& theMed,
   INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
 
   PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
-  if(aGaussMesh->myIsDone)
+  if(!aGaussMesh || aGaussMesh->myIsDone)
     return;
 
   const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
@@ -1150,33 +1153,33 @@ LoadGaussMesh(const MED::PWrapper& theMed,
   const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
   const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
   const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
-  MED::TGeom2Gauss::const_iterator anIter = aGeom2Gauss.begin();
-  for(; anIter != aGeom2Gauss.end(); anIter++){
-    MED::PGaussInfo aGaussInfo = anIter->second;
-    MED::EGeometrieElement aMGeom = anIter->first;
-    vtkIdType aVGeom = MEDGeomToVTK(aMGeom);
 
-    TGeom2GaussSubMesh::const_iterator anIter2 = aGeom2GaussSubMesh.find(aVGeom);
-    if(anIter2 != aGeom2GaussSubMesh.end()){
-      PMEDGaussSubMesh aGaussSubMesh = anIter2->second;
+  TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
+  for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
+    PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
+    vtkIdType aVGeom = aSubMeshIter->first;
+    
+    if(aGaussSubMesh->myIsDone)
+      continue;
+
+    PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
+    const TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+    MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
 
-      if(aGaussSubMesh->myIsDone)
-       continue;
+    MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,
+                                                   aMEntity, 
+                                                   aMGeom);
+      
+    std::string aName;
+    MED::TGaussCoord aGaussCoord;
+    bool anIsGaussCoord3D = false;
 
+    MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
+    if(aGaussIter != aGeom2Gauss.end()){
       PMEDGauss aGauss = aGaussSubMesh->myGauss;
       MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
-      
       if(aGaussInfo){
-       MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,
-                                                       aMEntity, 
-                                                       aMGeom);
-
-       MED::TGaussCoord aGaussCoord;
-
-       PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
-       const TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
-
-       bool anIsGaussCoord3D = false;
+       aName = aGaussInfo->GetName();
        if(!aSubMeshID.empty()){
          MED::PProfileInfo aProfileInfo = aSubProfile->myProfileInfo;
          const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
@@ -1190,41 +1193,46 @@ LoadGaussMesh(const MED::PWrapper& theMed,
                                                  aCellInfo,
                                                  aNodeInfo,
                                                  aGaussCoord);
-
-       if(anIsGaussCoord3D){
-         TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
-         TInt aNbGauss = aGaussCoord.GetNbGauss();
-         TInt aNbElem = aGaussCoord.GetNbElem();
-         TInt aDim = aGaussCoord.GetDim();
-         vtkIdType aNbCells = aNbElem*aNbGauss;
-         aCoords.Init(aNbCells,aDim);
-         for(TInt anElemId = 0, aNodeId = 0; anElemId < aNbElem; anElemId++){
-           MED::TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId);
-           for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aNodeId++){
-             MED::TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
-             TCoordSlice aSlice = aCoords.GetCoordSlice(aNodeId);
-             for(TInt aDimId = 0; aDimId < aDim; aDimId++)
-               aSlice[aDimId] = aCoordSlice[aDimId];
-           }
-         }
-         
-         aGaussSubMesh->myIsDone = true;;
-         
-         INITMSG(MYDEBUG,
-                 "- aVGeom = "<<aVGeom<<
-                 "; aName = '"<<aGaussInfo->GetName()<<"'"<<
-                 "; aStatus = "<<aGaussSubMesh->myStatus<<
-                 "; aNbCells = "<<aNbCells<<
-                 endl);
+      }
+    }else{
+      if(!aSubMeshID.empty()){
+       MED::PProfileInfo aProfileInfo = aSubProfile->myProfileInfo;
+       const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
+       anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
+                                             aNodeInfo,
+                                             aGaussCoord,
+                                             anElemNum);
+      }else
+       anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
+                                             aNodeInfo,
+                                             aGaussCoord);
+    }
+    
+    if(anIsGaussCoord3D){
+      TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
+      TInt aNbGauss = aGaussCoord.GetNbGauss();
+      TInt aNbElem = aGaussCoord.GetNbElem();
+      TInt aDim = aGaussCoord.GetDim();
+      vtkIdType aNbCells = aNbElem*aNbGauss;
+      aCoords.Init(aNbCells,aDim);
+      for(TInt anElemId = 0, aNodeId = 0; anElemId < aNbElem; anElemId++){
+       MED::TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId);
+       for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aNodeId++){
+         MED::TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
+         TCoordSlice aSlice = aCoords.GetCoordSlice(aNodeId);
+         for(TInt aDimId = 0; aDimId < aDim; aDimId++)
+           aSlice[aDimId] = aCoordSlice[aDimId];
        }
-
-      }else{
-
-       INITMSG(MYDEBUG,
-               "- aVGeom = "<<aVGeom<<
-               "; aStatus = "<<aGaussSubMesh->myStatus<<
-               endl);
       }
+      
+      aGaussSubMesh->myIsDone = true;;
+      
+      INITMSG(MYDEBUG,
+             "- aVGeom = "<<aVGeom<<
+             "; aName = '"<<aName<<"'"<<
+             "; aStatus = "<<aGaussSubMesh->myStatus<<
+             "; aNbCells = "<<aNbCells<<
+             endl);
     }
   }