Salome HOME
21680: EDF 2288 SMESH: creation of 0D elements from other elements
[modules/smesh.git] / src / DriverUNV / UNV2411_Structure.cxx
index de4964d4c2dc95788b7c06db0a8324cc4d70de8d..13bcecdbcfbc240e79398d81ddcfa73eabaf9196 100644 (file)
@@ -1,24 +1,25 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  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
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #include <fstream>      
 #include <stdio.h>      
 
@@ -32,8 +33,8 @@ using namespace UNV2411;
 static string _label_dataset = "2411";
 
 UNV2411::TRecord::TRecord():
-  exp_coord_sys_num(0),
-  disp_coord_sys_num(0),
+  exp_coord_sys_num(1),
+  disp_coord_sys_num(1),
   color(11)//(0) -  0019936: EDF 794 SMESH : Export UNV : Node color and group id
 {}
 
@@ -53,16 +54,16 @@ void UNV2411::Read(std::ifstream& in_stream, TDataSet& theDataSet)
    * always 3 coordinates in the UNV file, no matter
    * which dimensionality libMesh is in
    */
-  TNodeLab aLabel;
   std::string num_buf;
-  for(; !in_stream.eof();){
-    in_stream >> aLabel ;
-    if(aLabel == -1){
+  while ( !in_stream.eof() )
+  {
+    TRecord aRec;
+    in_stream >> aRec.label ;
+    if ( aRec.label == -1 ) {
       // end of dataset is reached
       break;
     }
 
-    TRecord aRec;
     in_stream>>aRec.exp_coord_sys_num;
     in_stream>>aRec.disp_coord_sys_num;
     in_stream>>aRec.color;
@@ -76,7 +77,7 @@ void UNV2411::Read(std::ifstream& in_stream, TDataSet& theDataSet)
       aRec.coord[d] = D_to_e(num_buf);
     }
 
-    theDataSet.insert(TDataSet::value_type(aLabel,aRec));
+    theDataSet.push_back(aRec);
   }
 }
 
@@ -93,12 +94,12 @@ void UNV2411::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
   out_stream<<"  "<<_label_dataset<<"\n";
 
   TDataSet::const_iterator anIter = theDataSet.begin();
-  for(; anIter != theDataSet.end(); anIter++){
-    const TNodeLab& aLabel = anIter->first;
-    const TRecord& aRec = anIter->second;
+  for(; anIter != theDataSet.end(); anIter++)
+  {
+    const TRecord& aRec = *anIter;
     char buf[78];
     sprintf(buf, "%10d%10d%10d%10d\n", 
-            aLabel,
+            aRec.label,
             aRec.exp_coord_sys_num,
             aRec.disp_coord_sys_num,
             aRec.color);