1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 #include "UNV2411_Structure.hxx"
23 #include "UNV_Utilities.hxx"
27 using namespace UNV2411;
30 static int MYDEBUG = 1;
32 static int MYDEBUG = 0;
35 static string _label_dataset = "2411";
37 UNV2411::TRecord::TRecord():
39 disp_coord_sys_num(0),
43 void UNV2411::Read(std::ifstream& in_stream, TDataSet& theDataSet)
46 EXCEPTION(runtime_error,"ERROR: Input file not good.");
49 * adjust the \p istream to our
52 if(!beginning_of_dataset(in_stream,_label_dataset))
53 EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
56 * always 3 coordinates in the UNV file, no matter
57 * which dimensionality libMesh is in
61 for(; !in_stream.eof();){
64 // end of dataset is reached
69 in_stream>>aRec.exp_coord_sys_num;
70 in_stream>>aRec.disp_coord_sys_num;
71 in_stream>>aRec.color;
77 for(int d = 0; d < 3; d++){
79 aRec.coord[d] = D_to_e(num_buf);
82 theDataSet.insert(TDataSet::value_type(aLabel,aRec));
87 void UNV2411::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
89 if(!out_stream.good())
90 EXCEPTION(runtime_error,"ERROR: Output file not good.");
93 * Write beginning of dataset
96 out_stream<<" "<<_label_dataset<<"\n";
98 TDataSet::const_iterator anIter = theDataSet.begin();
99 for(; anIter != theDataSet.end(); anIter++){
100 const TNodeLab& aLabel = anIter->first;
101 const TRecord& aRec = anIter->second;
103 sprintf(buf, "%10d%10d%10d%10d\n",
105 aRec.exp_coord_sys_num,
106 aRec.disp_coord_sys_num,
111 sprintf(buf, "%25.16E%25.16E%25.16E\n",
120 * Write end of dataset