Salome HOME
fix after review. Build completed
[modules/smesh.git] / src / SMESHDS / SMESHDS_Command.cxx
index fcec3af323a0de7ea0ecbf7935b3f53faf0bb4bf..62c5db0bfb5497abe5b5db91f430c93aaa3f4beb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -54,7 +54,7 @@ SMESHDS_Command::~SMESHDS_Command()
 //=======================================================================
 void SMESHDS_Command::AddNode(int NewNodeID, double x, double y, double z)
 {
-        if (!myType == SMESHDS_AddNode)
+        if ( myType != SMESHDS_AddNode)
         {
                 MESSAGE("SMESHDS_Command::AddNode : Bad Type");
                 return;
@@ -72,7 +72,7 @@ void SMESHDS_Command::AddNode(int NewNodeID, double x, double y, double z)
 //=======================================================================
 void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
 {
-        if (!myType == SMESHDS_MoveNode)
+        if ( myType != SMESHDS_MoveNode)
         {
                 MESSAGE("SMESHDS_Command::MoveNode : Bad Type");
                 return;
@@ -90,7 +90,7 @@ void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
 //=======================================================================
 void SMESHDS_Command::Add0DElement(int New0DElementID, int idnode)
 {
-  if (!myType == SMESHDS_Add0DElement)
+  if ( myType != SMESHDS_Add0DElement)
   {
     MESSAGE("SMESHDS_Command::Add0DElement : Bad Type");
     return;
@@ -106,7 +106,7 @@ void SMESHDS_Command::Add0DElement(int New0DElementID, int idnode)
 //=======================================================================
 void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
 {
-        if (!myType == SMESHDS_AddEdge)
+        if ( myType != SMESHDS_AddEdge)
         {
                 MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
                 return;
@@ -124,7 +124,7 @@ void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
 void SMESHDS_Command::AddFace(int NewFaceID,
         int idnode1, int idnode2, int idnode3)
 {
-        if (!myType == SMESHDS_AddTriangle)
+        if ( myType != SMESHDS_AddTriangle)
         {
                 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
                 return;
@@ -143,7 +143,7 @@ void SMESHDS_Command::AddFace(int NewFaceID,
 void SMESHDS_Command::AddFace(int NewFaceID,
         int idnode1, int idnode2, int idnode3, int idnode4)
 {
-        if (!myType == SMESHDS_AddQuadrangle)
+        if ( myType != SMESHDS_AddQuadrangle)
         {
                 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
                 return;
@@ -160,10 +160,10 @@ void SMESHDS_Command::AddFace(int NewFaceID,
 //function : 
 //purpose  : 
 //=======================================================================
-void SMESHDS_Command::AddVolume(int NewVolID,
-        int idnode1, int idnode2, int idnode3, int idnode4)
+void SMESHDS_Command::AddVolume(smIdType NewVolID,
+        smIdType idnode1, smIdType idnode2, smIdType idnode3, smIdType idnode4)
 {
-        if (!myType == SMESHDS_AddTetrahedron)
+        if ( myType != SMESHDS_AddTetrahedron)
         {
                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
                 return;
@@ -180,10 +180,10 @@ void SMESHDS_Command::AddVolume(int NewVolID,
 //function : 
 //purpose  : 
 //=======================================================================
-void SMESHDS_Command::AddVolume(int NewVolID,
-        int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
+void SMESHDS_Command::AddVolume(smIdType NewVolID,
+        smIdType idnode1, smIdType idnode2, smIdType idnode3, smIdType idnode4, smIdType idnode5)
 {
-        if (!myType == SMESHDS_AddPyramid)
+        if ( myType != SMESHDS_AddPyramid)
         {
                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
                 return;
@@ -201,11 +201,11 @@ void SMESHDS_Command::AddVolume(int NewVolID,
 //function : 
 //purpose  : 
 //=======================================================================
-void SMESHDS_Command::AddVolume(int NewVolID,
-        int idnode1,
-        int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
+void SMESHDS_Command::AddVolume(smIdType NewVolID,
+        smIdType idnode1,
+        smIdType idnode2, smIdType idnode3, smIdType idnode4, smIdType idnode5, smIdType idnode6)
 {
-        if (!myType == SMESHDS_AddPrism)
+        if ( myType != SMESHDS_AddPrism)
         {
                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
                 return;
@@ -224,13 +224,13 @@ void SMESHDS_Command::AddVolume(int NewVolID,
 //function : 
 //purpose  : 
 //=======================================================================
-void SMESHDS_Command::AddVolume(int NewVolID,
-        int idnode1,
-        int idnode2,
-        int idnode3,
-        int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
+void SMESHDS_Command::AddVolume(smIdType NewVolID,
+        smIdType idnode1,
+        smIdType idnode2,
+        smIdType idnode3,
+        smIdType idnode4, smIdType idnode5, smIdType idnode6, smIdType idnode7, smIdType idnode8)
 {
-        if (!myType == SMESHDS_AddHexahedron)
+        if ( myType != SMESHDS_AddHexahedron)
         {
                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
                 return;
@@ -247,10 +247,10 @@ void SMESHDS_Command::AddVolume(int NewVolID,
         myNumber++;
 }
 
-void SMESHDS_Command::AddVolume(int NewVolID,
-                                int idnode1,int idnode2,int idnode3,int idnode4,
-                                int idnode5, int idnode6, int idnode7, int idnode8,
-                                int idnode9, int idnode10, int idnode11, int idnode12)
+void SMESHDS_Command::AddVolume(smIdType NewVolID,
+                                smIdType idnode1,smIdType idnode2,smIdType idnode3,smIdType idnode4,
+                                smIdType idnode5, smIdType idnode6, smIdType idnode7, smIdType idnode8,
+                                smIdType idnode9, smIdType idnode10, smIdType idnode11, smIdType idnode12)
 {
   if (myType != SMESHDS_AddHexagonalPrism)
   {
@@ -277,10 +277,10 @@ void SMESHDS_Command::AddVolume(int NewVolID,
 //function : AddPolygonalFace
 //purpose  : 
 //=======================================================================
-void SMESHDS_Command::AddPolygonalFace (const int               ElementID,
-                                        const std::vector<int>& nodes_ids)
+void SMESHDS_Command::AddPolygonalFace (const smIdType               ElementID,
+                                        const std::vector<smIdType>& nodes_ids)
 {
-  if (!myType == SMESHDS_AddPolygon) {
+  if ( myType != SMESHDS_AddPolygon) {
     MESSAGE("SMESHDS_Command::AddPolygonalFace : Bad Type");
     return;
   }
@@ -295,15 +295,37 @@ void SMESHDS_Command::AddPolygonalFace (const int               ElementID,
   myNumber++;
 }
 
+//=======================================================================
+//function : AddQuadPolygonalFace
+//purpose  :
+//=======================================================================
+void SMESHDS_Command::AddQuadPolygonalFace (const smIdType               ElementID,
+                                            const std::vector<smIdType>& nodes_ids)
+{
+  if ( myType != SMESHDS_AddQuadPolygon) {
+    MESSAGE("SMESHDS_Command::AddQuadraticPolygonalFace : Bad Type");
+    return;
+  }
+  myIntegers.push_back(ElementID);
+
+  int i, nbNodes = nodes_ids.size();
+  myIntegers.push_back(nbNodes);
+  for (i = 0; i < nbNodes; i++) {
+    myIntegers.push_back(nodes_ids[i]);
+  }
+
+  myNumber++;
+}
+
 //=======================================================================
 //function : AddPolyhedralVolume
 //purpose  : 
 //=======================================================================
-void SMESHDS_Command::AddPolyhedralVolume (const int               ElementID,
-                                           const std::vector<int>& nodes_ids,
-                                           const std::vector<int>& quantities)
+void SMESHDS_Command::AddPolyhedralVolume (const smIdType               ElementID,
+                                           const std::vector<smIdType>& nodes_ids,
+                                           const std::vector<smIdType>& quantities)
 {
-  if (!myType == SMESHDS_AddPolyhedron) {
+  if ( myType != SMESHDS_AddPolyhedron) {
     MESSAGE("SMESHDS_Command::AddPolyhedralVolume : Bad Type");
     return;
   }
@@ -330,7 +352,7 @@ void SMESHDS_Command::AddPolyhedralVolume (const int               ElementID,
 //=======================================================================
 void SMESHDS_Command::RemoveNode(int NodeID)
 {
-        if (!myType == SMESHDS_RemoveNode)
+        if ( myType != SMESHDS_RemoveNode)
         {
                 MESSAGE("SMESHDS_Command::RemoveNode : Bad Type");
                 return;
@@ -345,7 +367,7 @@ void SMESHDS_Command::RemoveNode(int NodeID)
 //=======================================================================
 void SMESHDS_Command::RemoveElement(int ElementID)
 {
-        if (!myType == SMESHDS_RemoveElement)
+        if ( myType != SMESHDS_RemoveElement)
         {
                 MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
                 return;
@@ -361,7 +383,7 @@ void SMESHDS_Command::RemoveElement(int ElementID)
 
 void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes)
 {
-  if (!myType == SMESHDS_ChangeElementNodes)
+  if ( myType != SMESHDS_ChangeElementNodes)
   {
     MESSAGE("SMESHDS_Command::ChangeElementNodes : Bad Type");
     return;
@@ -411,7 +433,7 @@ void SMESHDS_Command::ChangePolyhedronNodes (const int               ElementID,
 
 void SMESHDS_Command::Renumber (const bool isNodes, const int startID, const int deltaID)
 {
-  if (!myType == SMESHDS_Renumber)
+  if ( myType != SMESHDS_Renumber)
   {
     MESSAGE("SMESHDS_Command::Renumber : Bad Type");
     return;
@@ -469,7 +491,7 @@ const list < double >&SMESHDS_Command::GetCoords()
 //=======================================================================
 void SMESHDS_Command::AddEdge(int NewEdgeID, int n1, int n2, int n12)
 {
-  if (!myType == SMESHDS_AddQuadEdge) {
+  if ( myType != SMESHDS_AddQuadEdge) {
     MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
     return;
   }
@@ -488,7 +510,7 @@ void SMESHDS_Command::AddFace(int NewFaceID,
                               int n1, int n2, int n3,
                               int n12, int n23, int n31)
 {
-  if (!myType == SMESHDS_AddQuadTriangle) {
+  if ( myType != SMESHDS_AddQuadTriangle) {
     MESSAGE("SMESHDS_Command::AddFace : Bad Type");
     return;
   }
@@ -510,7 +532,7 @@ void SMESHDS_Command::AddFace(int NewFaceID,
                               int n1, int n2, int n3,
                               int n12, int n23, int n31, int nCenter)
 {
-  if (!myType == SMESHDS_AddBiQuadTriangle) {
+  if ( myType != SMESHDS_AddBiQuadTriangle) {
     MESSAGE("SMESHDS_Command::AddFace : Bad Type");
     return;
   }
@@ -533,7 +555,7 @@ void SMESHDS_Command::AddFace(int NewFaceID,
                               int n1, int n2, int n3, int n4,
                               int n12, int n23, int n34, int n41)
 {
-  if (!myType == SMESHDS_AddQuadQuadrangle) {
+  if ( myType != SMESHDS_AddQuadQuadrangle) {
     MESSAGE("SMESHDS_Command::AddFace : Bad Type");
     return;
   }
@@ -582,7 +604,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
                                 int n12, int n23, int n31,
                                 int n14, int n24, int n34)
 {
-  if (!myType == SMESHDS_AddQuadTetrahedron) {
+  if ( myType != SMESHDS_AddQuadTetrahedron) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -609,7 +631,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2,
                                 int n12, int n23, int n34, int n41,
                                 int n15, int n25, int n35, int n45)
 {
-  if (!myType == SMESHDS_AddQuadPyramid) {
+  if ( myType != SMESHDS_AddQuadPyramid) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -640,7 +662,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2,
                                 int n45, int n56, int n64,
                                 int n14, int n25, int n36)
 {
-  if (!myType == SMESHDS_AddQuadPentahedron) {
+  if ( myType != SMESHDS_AddQuadPentahedron) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -662,6 +684,43 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2,
   myIntegers.push_back(n36);
   myNumber++;
 }
+//=======================================================================
+//function : AddVolume
+//purpose  :
+//=======================================================================
+void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2,
+                                int n3, int n4, int n5,int n6,
+                                int n12, int n23, int n31,
+                                int n45, int n56, int n64,
+                                int n14, int n25, int n36,
+                                int n1245, int n2356, int n1346)
+{
+  if ( myType != SMESHDS_AddBiQuadPentahedron) {
+    MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
+    return;
+  }
+  myIntegers.push_back(NewVolID);
+  myIntegers.push_back(n1);
+  myIntegers.push_back(n2);
+  myIntegers.push_back(n3);
+  myIntegers.push_back(n4);
+  myIntegers.push_back(n5);
+  myIntegers.push_back(n6);
+  myIntegers.push_back(n12);
+  myIntegers.push_back(n23);
+  myIntegers.push_back(n31);
+  myIntegers.push_back(n45);
+  myIntegers.push_back(n56);
+  myIntegers.push_back(n64);
+  myIntegers.push_back(n14);
+  myIntegers.push_back(n25);
+  myIntegers.push_back(n36);
+  myIntegers.push_back(n1245);
+  myIntegers.push_back(n2356);
+  myIntegers.push_back(n1346);
+  myNumber++;
+}
+
 
 //=======================================================================
 //function : AddVolume
@@ -673,7 +732,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3,
                                 int n56, int n67, int n78, int n85,
                                 int n15, int n26, int n37, int n48)
 {
-  if (!myType == SMESHDS_AddQuadHexahedron) {
+  if ( myType != SMESHDS_AddQuadHexahedron) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -713,7 +772,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3,
                                 int n1234,int n1256,int n2367,int n3478,
                                 int n1458,int n5678,int nCenter)
 {
-  if (!myType == SMESHDS_AddQuadHexahedron) {
+  if ( myType != SMESHDS_AddTriQuadHexa) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -756,7 +815,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3,
 
 void SMESHDS_Command::AddBall(int NewBallID, int node, double diameter)
 {
-  if (!myType == SMESHDS_AddBall)
+  if ( myType != SMESHDS_AddBall)
   {
     MESSAGE("SMESHDS_Command::SMESHDS_AddBall : Bad Type");
     return;