-// Copyright (C) 2007-2010 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>
static string _label_dataset = "2412";
UNV2412::TRecord::TRecord():
+ label(-1),
+ fe_descriptor_id(-1),
phys_prop_tab_num(2),
mat_prop_tab_num(1),
color(7),
beam_orientation(0),
- beam_fore_end(0),
- beam_aft_end(0)
+ beam_fore_end(1), // default values
+ beam_aft_end(1) // default values
{}
void UNV2412::Read(std::ifstream& in_stream, TDataSet& theDataSet)
if(!beginning_of_dataset(in_stream,_label_dataset))
EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
- TElementLab aLabel;
- for(; !in_stream.eof();){
- in_stream >> aLabel ;
- if(aLabel == -1){
+ TRecord aRec;
+ while( !in_stream.eof())
+ {
+ in_stream >> aRec.label ;
+ if (aRec.label == -1)
// end of dataset is reached
break;
- }
int n_nodes;
- TRecord aRec;
in_stream>>aRec.fe_descriptor_id;
in_stream>>aRec.phys_prop_tab_num;
in_stream>>aRec.mat_prop_tab_num;
}
aRec.node_labels.resize(n_nodes);
- for(int j=0; j < n_nodes; j++){
+ for(int j=0; j < n_nodes; j++)
// read node labels
in_stream>>aRec.node_labels[j];
- }
- theDataSet.insert(TDataSet::value_type(aLabel,aRec));
+ theDataSet.push_back(aRec);
}
}
out_stream<<" "<<_label_dataset<<"\n";
TDataSet::const_iterator anIter = theDataSet.begin();
- for(; anIter != theDataSet.end(); anIter++){
- const TElementLab& aLabel = anIter->first;
- const TRecord& aRec = anIter->second;
- out_stream<<std::setw(10)<<aLabel; /* element ID */
+ for(; anIter != theDataSet.end(); anIter++)
+ {
+ const TRecord& aRec = *anIter;
+ out_stream<<std::setw(10)<<aRec.label; /* element ID */
out_stream<<std::setw(10)<<aRec.fe_descriptor_id; /* type of element */
out_stream<<std::setw(10)<<aRec.phys_prop_tab_num;
out_stream<<std::setw(10)<<aRec.mat_prop_tab_num;
out_stream<<std::setw(10)<<aRec.color;
out_stream<<std::setw(10)<<aRec.node_labels.size()<<std::endl; /* No. of nodes per element */
- if(IsBeam(aRec.fe_descriptor_id)){
+ if(IsBeam(aRec.fe_descriptor_id))
+ {
out_stream<<std::setw(10)<<aRec.beam_orientation;
out_stream<<std::setw(10)<<aRec.beam_fore_end;
out_stream<<std::setw(10)<<aRec.beam_aft_end<<std::endl;