Salome HOME
untabify
[modules/smesh.git] / src / OBJECT / SMESH_Object.cxx
index 943f0896d712cf52163efd1da8b9c17a76baa616..a6908f78ef24f6ceac8a8c47a0969cb9dc33ac6f 100644 (file)
@@ -46,7 +46,7 @@
 #include <vtkUnstructuredGrid.h>
 
 #include <memory>
-#include <sstream>     
+#include <sstream>      
 #include <stdexcept>
 #include <set>
 
@@ -81,7 +81,7 @@ static int MYDEBUGWITHFILES = 0;
 // purpose  : Get type of VTK cell
 //=================================================================================
 static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
-                                    const bool thePoly,
+                                     const bool thePoly,
                                      const int theNbNodes )
 {
   switch( theType )
@@ -263,7 +263,7 @@ namespace{
   typedef std::vector<const SMDS_MeshElement*> TConnect;
 
   int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter, 
-                TConnect& theConnect)
+                 TConnect& theConnect)
   {
     theConnect.clear();
     for(; theNodesIter->more();)
@@ -273,10 +273,10 @@ namespace{
   
   inline 
   void SetId(vtkIdList *theIdList, 
-            const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes, 
-            const TConnect& theConnect, 
-            int thePosition,
-            int theId)
+             const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes, 
+             const TConnect& theConnect, 
+             int thePosition,
+             int theId)
   {
     theIdList->SetId(thePosition,theSMDS2VTKNodes.find(theConnect[theId]->GetID())->second);
   }
@@ -372,12 +372,12 @@ void SMESH_VisualObjDef::buildElemPrs()
         myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
 
         SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
-       switch (aType) {
-       case SMDSAbs_Volume:{
+        switch (aType) {
+        case SMDSAbs_Volume:{
           aConnect.clear();
-         std::vector<int> aConnectivities;
-         // Convertions connectivities from SMDS to VTK
-         if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
+          std::vector<int> aConnectivities;
+          // Convertions connectivities from SMDS to VTK
+          if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
 
             if ( const SMDS_PolyhedralVolumeOfNodes* ph =
                  dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
@@ -385,67 +385,67 @@ void SMESH_VisualObjDef::buildElemPrs()
               aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
               anIdList->SetNumberOfIds( aNbNodes );
             }
-           for (int k = 0; k < aNbNodes; k++)
-             aConnectivities.push_back(k);
+            for (int k = 0; k < aNbNodes; k++)
+              aConnectivities.push_back(k);
 
           } else if (aNbNodes == 4) {
-           static int anIds[] = {0,2,1,3};
-           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+            static int anIds[] = {0,2,1,3};
+            for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
 
-         } else if (aNbNodes == 5) {
-           static int anIds[] = {0,3,2,1,4};
-           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+          } else if (aNbNodes == 5) {
+            static int anIds[] = {0,3,2,1,4};
+            for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
 
-         } else if (aNbNodes == 6) {
-           static int anIds[] = {0,1,2,3,4,5};
-           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+          } else if (aNbNodes == 6) {
+            static int anIds[] = {0,1,2,3,4,5};
+            for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
 
-         }
+          }
           else if (aNbNodes == 8) {
-           static int anIds[] = {0,3,2,1,4,7,6,5};
-           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+            static int anIds[] = {0,3,2,1,4,7,6,5};
+            for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
 
-         }
+          }
           else if (aNbNodes == 10) {
-           static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
-           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
-         }
+            static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
+            for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+          }
           else if (aNbNodes == 13) {
-           static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
-           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
-         }
+            static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
+            for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+          }
           else if (aNbNodes == 15) {
             //static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
             static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
-           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
-           //for (int k = 0; k < aNbNodes; k++) {
+            for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+            //for (int k = 0; k < aNbNodes; k++) {
             //  int nn = aConnectivities[k];
             //  const SMDS_MeshNode* N = static_cast<const SMDS_MeshNode*> (aConnect[nn]);
             //  cout<<"k="<<k<<"  N("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl;
             //}
-         }
+          }
           else if (aNbNodes == 20) {
-           static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
-           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
-         }
+            static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
+            for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+          }
           else {
           }
 
           if ( aConnect.empty() )
             GetConnect(aNodesIter,aConnect);
 
-         if (aConnectivities.size() > 0) {
-           for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
-             SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
-         }
-         break;
-       }
-       default:
-         for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
-           const SMDS_MeshElement* aNode = aNodesIter->next();
-           anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
-         }
-       }
+          if (aConnectivities.size() > 0) {
+            for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
+              SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
+          }
+          break;
+        }
+        default:
+          for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
+            const SMDS_MeshElement* aNode = aNodesIter->next();
+            anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
+          }
+        }
 
         aConnectivity->InsertNextCell( anIdList );
         aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
@@ -483,9 +483,9 @@ void SMESH_VisualObjDef::buildElemPrs()
 // purpose  : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
 //=================================================================================
 bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
-                                      const int theEdgeNum,
-                                      int&      theNodeId1,
-                                      int&      theNodeId2 ) const
+                                       const int theEdgeNum,
+                                       int&      theNodeId1,
+                                       int&      theNodeId2 ) const
 {
   const SMDS_Mesh* aMesh = GetMesh();
   if ( aMesh == 0 )
@@ -905,7 +905,7 @@ int SMESH_subMeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
     case SMDSAbs_Volume:
     {
       SMESH::long_array_var anIds = 
-       mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
+        mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
       return anIds->length();
     }
     default:
@@ -942,7 +942,7 @@ int SMESH_subMeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityLis
     else
     {
       SMESH::long_array_var anIds = 
-       mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
+        mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
       return getPointers( theType, anIds, aMesh, theResList );
     }
   }