From: vsv Date: Mon, 27 Mar 2006 12:41:39 +0000 (+0000) Subject: Group management X-Git-Tag: T3_2_0b1_pre1~75 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c4637452d1faa00cea3621eb39975b87aad4199;p=modules%2Fsmesh.git Group management --- diff --git a/src/DriverUNV/Makefile.in b/src/DriverUNV/Makefile.in index 346769401..1e72090a4 100644 --- a/src/DriverUNV/Makefile.in +++ b/src/DriverUNV/Makefile.in @@ -51,7 +51,7 @@ LIB_SRC = \ DriverUNV_W_SMESHDS_Document.cxx \ DriverUNV_W_SMDS_Mesh.cxx \ DriverUNV_W_SMESHDS_Mesh.cxx \ - UNV_Utilities.cxx UNV2411_Structure.cxx UNV2412_Structure.cxx + UNV_Utilities.cxx UNV2411_Structure.cxx UNV2412_Structure.cxx UNV2417_Structure.cxx # Executables targets BIN = UNV_Test diff --git a/src/DriverUNV/UNV2417_Structure.cxx b/src/DriverUNV/UNV2417_Structure.cxx new file mode 100644 index 000000000..d68ef3b5b --- /dev/null +++ b/src/DriverUNV/UNV2417_Structure.cxx @@ -0,0 +1,68 @@ +#include "UNV2417_Structure.hxx" +#include "UNV_Utilities.hxx" + +using namespace std; +using namespace UNV; +using namespace UNV2417; + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + +static string _label_dataset = "2417"; + +void UNV2417::Read(std::ifstream& in_stream, TDataSet& theDataSet) +{ + if(!in_stream.good()) + EXCEPTION(runtime_error,"ERROR: Input file not good."); + + /* + * adjust the \p istream to our + * position + */ + if(!beginning_of_dataset(in_stream,_label_dataset)) + EXCEPTION(runtime_error,"WARNING: Could not find "<<_label_dataset<<" dataset!"); + + TGroupId aId; + for(; !in_stream.eof();){ + in_stream >> aId ; + if(aId == -1){ + // end of dataset is reached + break; + } + + int n_nodes; + TRecord aRec; + int aTmp; + in_stream>>aTmp; // miss not necessary values + in_stream>>aTmp; + in_stream>>aTmp; + in_stream>>aTmp; + in_stream>>aTmp; + in_stream>>n_nodes; + + int aElType; + int aElId; + int aNum; + for(int j=0; j < n_nodes; j++){ + in_stream>>aElType; + in_stream>>aElId; + switch (aElType) { + case 7: // Nodes + aNum = aRec.NodeList.size(); + aRec.NodeList.resize(aNum + 1); + aRec.NodeList[aNum] = aElId; + break; + case 8: // Elements + aNum = aRec.ElementList.size(); + aRec.ElementList.resize(aNum + 1); + aRec.ElementList[aNum] = aElId; + break; + } + } + theDataSet.insert(TDataSet::value_type(aId,aRec)); + } + +} diff --git a/src/DriverUNV/UNV2417_Structure.hxx b/src/DriverUNV/UNV2417_Structure.hxx new file mode 100644 index 000000000..de19e06de --- /dev/null +++ b/src/DriverUNV/UNV2417_Structure.hxx @@ -0,0 +1,44 @@ +// Copyright (C) 2003 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 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 +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#ifndef UNV2417_Structure_HeaderFile +#define UNV2417_Structure_HeaderFile + +#include +#include +#include + + +namespace UNV2417{ + + typedef std::vector TListOfId; // Nodal connectivitiesList of Id + + struct TRecord{ + TListOfId NodeList; + TListOfId ElementList; + }; + + typedef int TGroupId; // type of element label + typedef std::map TDataSet; + + void Read(std::ifstream& in_stream, TDataSet& theDataSet); +}; + + +#endif