Group management

This commit is contained in:
vsv 2006-03-27 12:41:39 +00:00
parent 146fbd48fb
commit 6c4637452d
3 changed files with 113 additions and 1 deletions

View File

@ -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

View File

@ -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));
}
}

View File

@ -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 <map>
#include <vector>
#include <fstream>
namespace UNV2417{
typedef std::vector<int> TListOfId; // Nodal connectivitiesList of Id
struct TRecord{
TListOfId NodeList;
TListOfId ElementList;
};
typedef int TGroupId; // type of element label
typedef std::map<TGroupId, TRecord> TDataSet;
void Read(std::ifstream& in_stream, TDataSet& theDataSet);
};
#endif