From: apo Date: Thu, 13 Jan 2005 10:25:41 +0000 (+0000) Subject: [Bug PAL7252] DEVELOPMENT: Porting to MED2.2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5081dc160005c3ab5e1d96add7aceb4bcb9d6d3f;p=modules%2Fvisu.git [Bug PAL7252] DEVELOPMENT: Porting to MED2.2 --- diff --git a/src/CONVERTOR/VISU_DatConvertor.cxx b/src/CONVERTOR/VISU_DatConvertor.cxx deleted file mode 100644 index c85ac823..00000000 --- a/src/CONVERTOR/VISU_DatConvertor.cxx +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : VISU_DatConvertor.cxx -// Author : Alexey PETROV -// Module : VISU - -using namespace std; -#include "VISU_DatConvertor.hxx" -using namespace std; - -#ifdef DEBUG -static int MYDEBUG = 1; -#else -static int MYDEBUG = 0; -#endif -static int PRECISION = 7; - -extern "C" -VISU_Convertor* CreateDatConvertor(const string& theFileName) { - VISU_DatConvertor* aConvertor = new VISU_DatConvertor(theFileName); - aConvertor->Build(); - return aConvertor; -} -VISU_DatConvertor::VISU_DatConvertor(const string& theFileName) { - myFileInfo.setFile(QString(theFileName.c_str())); - myName = (const char*)(myFileInfo.baseName()); -} - -VISU_Convertor* VISU_DatConvertor::Build() { - /* - ifstream stmIn(myFileInfo.absFilePath()); - if(!stmIn.good()) - throw std::runtime_error(string("VISU_DatConvertor::CreateResult() >> can't open file - ") + - (const char*)myFileInfo.absFilePath()); - int aNbPoints, aNbCells, aNbFields; - ImportHead(&stmIn,&aNbPoints,&aNbCells,&aNbFields); - ImportPoints(&stmIn,aNbPoints); - vector aCellsType(aNbCells); - ImportCells(&stmIn,&aCellsType); - for(int i = 0; i < aNbFields; i++) - ImportField(&stmIn,aNbPoints,&aCellsType); - myIsDone = true; - */ - return this; -} - -int VISU_DatConvertor::ImportField(ifstream* pStmIn, int theNbPoints, vector* pCellsType) -{ - /* - ifstream &stmIn = *pStmIn; - vector& aCellsType = *pCellsType; - int aNbCells = aCellsType.size(); - string aName; stmIn>>aName; stmIn>>aName; - VISU::TMesh& aMesh = myMeshMap[myName]; - VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[VISU::CELL_ENTITY]; - VISU::TField& aField = aMeshOnEntity.myFieldMap[aName]; - aField.myMeshName = myName; - stmIn>>(aField.myNbComp); - aField.myNbComp %= 100; - int iEnd; stmIn>>iEnd; - if(iEnd == theNbPoints) - aField.myEntity = VISU::NODE_ENTITY; - else if(iEnd == aNbCells) - aField.myEntity = VISU::CELL_ENTITY; - else - throw std::runtime_error("ImportChamp >> elements doesn't connected to points or cells"); - if(MYDEBUG) - MESSAGE("FieldInfo - myMeshName = "<>tmp; - anArray.push_back(tmp); - } - } - */ - return 0; -} - -int VISU_DatConvertor::ImportHead(ifstream* pStmIn, int* theNbPoints, - int* theNbCells, int* theNbFields) -{ - /* - ifstream &stmIn = *pStmIn; - const int BUFSIZE = 256; - char buf[BUFSIZE]; - stmIn.getline(buf,BUFSIZE); - istrstream strIn(buf); - VISU::TMesh& aMesh = myMeshMap[myName]; - *theNbFields = 0; - strIn>>(*theNbPoints); strIn>>(*theNbCells); strIn>>(*theNbFields); - if(MYDEBUG) - MESSAGE("ImportHead - theNbPoints = "<<(*theNbPoints)<< - "; theNbCells = "<<(*theNbCells)<< - "; theNbFields = "<<(*theNbFields)); - */ - return 0; -} - -int VISU_DatConvertor::ImportPoints(ifstream* pStmIn, int theNbPoints) -{ - /* - ifstream &stmIn = *pStmIn; - VISU::TMesh& aMesh = myMeshMap[myName]; - aMesh.myName = myName; - aMesh.myDim = 3; - int iEnd = aMesh.myDim*theNbPoints; - if(MYDEBUG) MESSAGE("ImportPoints - iEnd = "< &aPointsCoord = aMesh.myPointsCoord; - aPointsCoord.resize(iEnd); - for(int i = 0, tmp; i < iEnd;){ - stmIn>>tmp; - stmIn>>aPointsCoord[i++]; stmIn>>aPointsCoord[i++]; stmIn>>aPointsCoord[i++]; - } - */ - return 0; -} - -int VISU_DatConvertor::ImportCells(ifstream* pStmIn, vector* pCellsType) -{ - /* - ifstream &stmIn = *pStmIn; - vector& aCellsType = *pCellsType; - int aNbCells = aCellsType.size(); - if(MYDEBUG) MESSAGE("ImportCells - theNbCells - Beginning"); - VISU::TMesh& aMesh = myMeshMap[myName]; - VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[VISU::CELL_ENTITY]; - aMeshOnEntity.myEntity = VISU::CELL_ENTITY; - aMeshOnEntity.myMeshName = myName; - for(int i = 0, aMedType, aVtkType; i < aNbCells; i++){ - stmIn>>aMedType; stmIn>>aMedType; - aCellsType[i] = aVtkType = med2vtkCellType(aMedType); - VISU::TMeshOnEntity::TConnForCellType& anArray = aMeshOnEntity.myCellsConn[aVtkType]; - anArray.push_back(VISU::TMeshOnEntity::TConnect()); - VISU::TMeshOnEntity::TConnect& aVector = anArray.back(); - int jEnd = getNbMedNodes(aMedType); - aVector.resize(jEnd); - for(int j = 0, tmp; j < jEnd; j++){ - stmIn>>tmp; - aVector[j] = tmp - 1; - } - } - if(MYDEBUG) MESSAGE("ImportCells - theNbCells - End"); - */ - return 0; -} - -/* -int VISU_Convertor_impl::ToDatFile(const string& theFileName) throw(std::runtime_error&){ - if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - "<second; - if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - aMeshName = "<first); - VISU::TFieldMap aFieldMap = GetFieldMapForMesh(aMeshIter->first); - const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap; - VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(VISU::CELL_ENTITY); - if(aMeshOnEntityMapIter != aMeshOnEntityMap.end()){ - const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second; - int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim; - int aNbCells = aMeshOnEntity.GetCellsDims().first; - stmOut<first)<<"\t"; - const vector& aVector = anArray[j]; - int kEnd = aVector.size(); - for(int k = 0; k < kEnd; k++) - stmOut<second; - const VISU::TField::TValField &aValField = aField.myValField; - VISU::TField::TValField::const_reverse_iterator iter = aField.myValField.rbegin(); - for(int i = 0; iter != aValField.rend(); iter++, i++) { - if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - aTime = "<second; - VISU::TField::TValForTime::const_iterator jter = aValForTime.begin(); - stmOut<<(++i)<first).c_str(),i); - stmOut< - -using namespace std; - -class VISU_DatConvertor: public VISU_Convertor_impl{ - VISU_DatConvertor(); - VISU_DatConvertor(const VISU_DatConvertor&); -public: - VISU_DatConvertor(const string& theFileName) ; - virtual VISU_Convertor* Build() ; -protected: - QFileInfo myFileInfo; - int ImportHead(ifstream* pStmIn, int* theNbPoints, int* theNbCells, int* theNbFields) ; - - int ImportPoints(ifstream*, int theNbPoints) ; - - int ImportCells(ifstream*, vector* aCellsType) ; - - int ImportField(ifstream*, int theNbPoints, vector* aCellsType) ; - - protected: - virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, - const string& theFamilyName = "") - {return 1;} - virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, - const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) - {return 1;} - virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, - VISU::TMeshOnEntity& theMeshOnEntity, - VISU::TField& theField, - VISU::TField::TValForTime& theValForTime) - {return 1;} -}; - -#endif