Salome HOME
Export UNV
authorvsv <vsv@opencascade.com>
Thu, 6 Apr 2006 10:17:24 +0000 (10:17 +0000)
committervsv <vsv@opencascade.com>
Thu, 6 Apr 2006 10:17:24 +0000 (10:17 +0000)
src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx
src/DriverUNV/DriverUNV_W_SMDS_Mesh.h
src/DriverUNV/UNV2417_Structure.cxx
src/SMESH/SMESH_Mesh.cxx

index 9e4fed760b4b18303920bb34adfe00d0f81b7e01..b5b4dc7693896f372e18a266530bd3c72ebbdaaa 100644 (file)
@@ -224,6 +224,45 @@ 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;
index 93fa10790d9f27db6476846473facdc5554e8a11..17e8880d67a83bf27219cb015e47fa268b96929b 100644 (file)
 #define _INCLUDE_DRIVERUNV_W_SMDS_MESH
 
 #include "Driver_SMDS_Mesh.h"
-//#include "SMESH_Group.hxx"
-#include <map>
+#include "SMESHDS_GroupBase.hxx"
+#include <list>
 
 
-//typedef std::map<int, SMESH_Group*> TGroupsMap;
+typedef std::list<SMESHDS_GroupBase*> TGroupList;
 
 class DriverUNV_W_SMDS_Mesh: public Driver_SMDS_Mesh
 {
  public:
   virtual Status Perform();
 
-  //  void SetGroups(const TGroupsMap& theGroupsMap) { myGroupsMap = theGroupsMap; }
+  void AddGroup(SMESHDS_GroupBase* theGroup) { myGroups.push_back(theGroup); }
 
  private:
-  //  TGroupsMap myGroupsMap;
+  TGroupList myGroups;
 };
 
 
index d52dd1e80937af76a84aa6c6c75551f3a355f383..485a81bd4e6f2928d1d264caf0bb05fe5b32c5c5 100644 (file)
@@ -18,7 +18,7 @@ static int MYDEBUG = 0;
 static string _group_labels[] = {"2417", "2429", "2430", "2432", "2435", "2452", "2467"};
 #define NBGROUP 7
 
-static string _label_dataset = "2429";
+static string _label_dataset = "2467";
 
 void UNV2417::Read(std::ifstream& in_stream, TDataSet& theDataSet)
 {
@@ -134,21 +134,25 @@ void UNV2417::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
     int aRow = 0;
     int i;
     for (i = 0; i < aNbNodes; i++) {
-      if (aRow == 4) {
+      if (aRow == 2) {
        out_stream<<std::endl; 
        aRow = 0;
       }
       out_stream<<std::setw(10)<<7;
       out_stream<<std::setw(10)<<aRec.NodeList[i];
+      out_stream<<std::setw(10)<<0;
+      out_stream<<std::setw(10)<<0;
       aRow++;
     }
     for (i = 0; i < aNbElements; i++) {
-      if (aRow == 4) {
+      if (aRow == 2) {
        out_stream<<std::endl; 
        aRow = 0;
       }
       out_stream<<std::setw(10)<<8;
       out_stream<<std::setw(10)<<aRec.ElementList[i];
+      out_stream<<std::setw(10)<<0;
+      out_stream<<std::setw(10)<<0;
       aRow++;
     }
     out_stream<<std::endl; 
index d870ae59f91f1874888803303d87b0bcc9ccb944..340682ea0e0bc607d50b6668a897dba7b4b7a89b 100644 (file)
@@ -949,6 +949,16 @@ void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception)
   myWriter.SetMesh(_myMeshDS);
   myWriter.SetMeshId(_idDoc);
   //  myWriter.SetGroups(_mapGroup);
+
+  for ( map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
+    SMESH_Group*       aGroup   = it->second;
+    SMESHDS_GroupBase* aGroupDS = aGroup->GetGroupDS();
+    if ( aGroupDS ) {
+      string aGroupName = aGroup->GetName();
+      aGroupDS->SetStoreName( aGroupName.c_str() );
+      myWriter.AddGroup( aGroupDS );
+    }
+  }
   myWriter.Perform();
 }