Salome HOME
0023064: [CEA 1471] Create and support quadratic polygons in SMESH
authoreap <eap@opencascade.com>
Wed, 24 Jun 2015 09:20:57 +0000 (12:20 +0300)
committereap <eap@opencascade.com>
Wed, 24 Jun 2015 09:20:57 +0000 (12:20 +0300)
src/SalomeApp/pluginsdemo/minmax_plugin.py
src/VTKViewer/VTKViewer_GeometryFilter.cxx

index f748327d631efadf747598ec401e1c908cc7c513..ee44188e578460d250ba5ea69de49ca23eb80a3d 100644 (file)
@@ -115,7 +115,7 @@ def minmax(context):
         mm = study.FindObjectID(objId).GetObject()
         mesh = None
         try:
-          mesh = mm.GetMEDMesh()
+          mesh = mm.Load()
         except:
           #print "No mesh selected"
           self.clearLineEdit()
index a0a1f5875affa614929eeb329efccef4510a4d41..484ff550ea7ff06eedd2bd08ed32b1e0025facb5 100755 (executable)
@@ -144,8 +144,7 @@ VTKViewer_GeometryFilter
 
 int
 VTKViewer_GeometryFilter
-::UnstructuredGridExecute(
-                          vtkDataSet *dataSetInput,
+::UnstructuredGridExecute(vtkDataSet *dataSetInput,
                           vtkPolyData *output,
                           vtkInformation *outInfo)
 {
@@ -275,7 +274,7 @@ VTKViewer_GeometryFilter
     }//if not all visible
 
   // Loop over all cells now that visibility is known
-  // (Have to compute visibility first for 3D cell boundarys)
+  // (Have to compute visibility first for 3D cell boundaries)
   int progressInterval = numCells/20 + 1;
   TMapOfVectorId aDimension2VTK2ObjIds;
   if(myStoreMapping){
@@ -707,6 +706,7 @@ VTKViewer_GeometryFilter
         case VTK_BIQUADRATIC_TRIANGLE:
         case VTK_QUADRATIC_QUAD:
         case VTK_BIQUADRATIC_QUAD:
+        case VTK_QUADRATIC_POLYGON:
         case VTK_QUADRATIC_TETRA:
         case VTK_QUADRATIC_HEXAHEDRON:
         case VTK_TRIQUADRATIC_HEXAHEDRON:
@@ -887,6 +887,26 @@ VTKViewer_GeometryFilter
                 BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
               break;
             }
+            case VTK_QUADRATIC_POLYGON: {
+              if(!myIsBuildArc)
+              {
+                aCellType = VTK_POLYGON;
+
+                for ( i = 0; i < npts/2; ++i )
+                {
+                  aNewPts[i*2  ] = pts[i];
+                  aNewPts[i*2+1] = pts[i+npts/2];
+                }
+                newCellId = output->InsertNextCell(aCellType,npts,aNewPts);
+                if(myStoreMapping)
+                  InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
+
+                outputCD->CopyData(cd,cellId,newCellId);
+              }
+              else
+                BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
+              break;
+            }
             case VTK_QUADRATIC_TETRA: {
               aCellType = VTK_POLYGON;
               numFacePts = 6;
@@ -1455,6 +1475,27 @@ void VTKViewer_GeometryFilter::BuildArcedPolygon(vtkIdType cellId,
       aScalarCollection.push_back(aBuilder4.GetScalarValues());
       break;
     }
+    case VTK_QUADRATIC_POLYGON:
+    {
+      int nbP = aCell->GetNumberOfPoints();
+      std::vector< Pnt > pVec( nbP + 2 );
+
+      for ( int i = 0; i < nbP/2; ++i )
+      {
+        pVec[i*2 + 0] = CreatePnt( aCell, inputScalars, i );
+        pVec[i*2 + 1] = CreatePnt( aCell, inputScalars, i + nbP/2 );
+      }
+      pVec[ nbP   ] = pVec[ 0 ];
+      pVec[ nbP+1 ] = pVec[ 1 ];
+
+      for ( int i = 0; i < nbP; i += 2 )
+      {      
+        VTKViewer_ArcBuilder aBuilder( pVec[i], pVec[i+1], pVec[i+2], myMaxArcAngle );
+        aCollection.push_back( aBuilder.GetPoints() );
+        aScalarCollection.push_back( aBuilder.GetScalarValues() );
+      }
+      break;
+    }
     default: //Unsupported cell type
       return;
   }