Salome HOME
To provide compatibility between VTK 4.2.2, 4.2.6 & 4.4 versions
[modules/smesh.git] / src / DriverUNV / DriverUNV_W_SMDS_Mesh.cxx
index fe181f78e10c588a9d5c7e1b0b4b746c95fac96a..b5b4dc7693896f372e18a266530bd3c72ebbdaaa 100644 (file)
@@ -22,6 +22,8 @@
 #include "DriverUNV_W_SMDS_Mesh.h"
 
 #include "SMDS_Mesh.hxx"
+#include "SMESHDS_GroupBase.hxx"
+//#include "SMESH_Group.hxx"
 #include "SMDS_QuadraticEdge.hxx"
 #include "SMDS_QuadraticFaceOfNodes.hxx"
 
@@ -29,6 +31,7 @@
 
 #include "UNV2411_Structure.hxx"
 #include "UNV2412_Structure.hxx"
+#include "UNV2417_Structure.hxx"
 #include "UNV_Utilities.hxx"
 
 using namespace std;
@@ -92,7 +95,7 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
           if( anElem->IsQuadratic() ) {
             aNodesIter = static_cast<const SMDS_QuadraticEdge* >
               ( anElem )->interlacedNodesElemIterator();
-            aRec.fe_descriptor_id = 21;
+            aRec.fe_descriptor_id = 22;
           } else {
             aNodesIter = anElem->nodesIterator();
             aRec.fe_descriptor_id = 11;
@@ -221,6 +224,78 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
       }
       UNV2412::Write(out_stream,aDataSet2412);
     }
+    {
+      using namespace UNV2417;
+      cout << "### MyGroups size " << myGroups.size() << endl;
+      if (myGroups.size() > 0) {
+       TDataSet aDataSet2417;
+       TGroupList::const_iterator aIter = myGroups.begin();
+       for (; aIter != myGroups.end(); aIter++) {
+         SMESHDS_GroupBase* aGroupDS = *aIter;
+         TRecord aRec;
+         aRec.GroupName = aGroupDS->GetStoreName();
+         cout << "### GrName = "<<aRec.GroupName<<endl;
+         cout << "### GrSize = "<<aGroupDS->Extent()<<endl;
+         cout << "### GrType = "<<aGroupDS->GetType()<<endl;
+
+         int i;
+         SMDS_ElemIteratorPtr aIter = aGroupDS->GetElements();
+         if (aGroupDS->GetType() == SMDSAbs_Node) {
+           aRec.NodeList.resize(aGroupDS->Extent());
+           i = 0;
+           while (aIter->more()) {
+             const SMDS_MeshElement* aElem = aIter->next();
+             aRec.NodeList[i] = aElem->GetID(); 
+             i++;
+           }
+         } else {
+           aRec.ElementList.resize(aGroupDS->Extent());
+           i = 0;
+           while (aIter->more()) {
+             const SMDS_MeshElement* aElem = aIter->next();
+             aRec.ElementList[i] = aElem->GetID(); 
+             i++;
+           }
+         }
+         aDataSet2417.insert(TDataSet::value_type(aGroupDS->GetID(), aRec));
+       }
+       UNV2417::Write(out_stream,aDataSet2417);
+       myGroups.clear();
+      }
+    }
+    /*    {
+      using namespace UNV2417;
+      TDataSet aDataSet2417;
+      for ( TGroupsMap::iterator it = myGroupsMap.begin(); it != myGroupsMap.end(); it++ ) {
+       SMESH_Group*       aGroup   = it->second;
+       SMESHDS_GroupBase* aGroupDS = aGroup->GetGroupDS();
+       if ( aGroupDS ) {
+         TRecord aRec;
+         aRec.GroupName = aGroup->GetName();
+         int i;
+         SMDS_ElemIteratorPtr aIter = aGroupDS->GetElements();
+         if (aGroupDS->GetType() == SMDSAbs_Node) {
+           aRec.NodeList.resize(aGroupDS->Extent());
+           i = 0;
+           while (aIter->more()) {
+             const SMDS_MeshElement* aElem = aIter->next();
+             aRec.NodeList[i] = aElem->GetID(); 
+             i++;
+           }
+         } else {
+           aRec.ElementList.resize(aGroupDS->Extent());
+           i = 0;
+           while (aIter->more()) {
+             const SMDS_MeshElement* aElem = aIter->next();
+             aRec.ElementList[i] = aElem->GetID(); 
+             i++;
+           }
+         }
+         aDataSet2417.insert(TDataSet::value_type(aGroupDS->GetID(), aRec));
+       }
+      }
+      UNV2417::Write(out_stream,aDataSet2417);
+      }*/
   }
   catch(const std::exception& exc){
     INFOS("Follow exception was cought:\n\t"<<exc.what());