]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
[Bug PAL7252] DEVELOPMENT: Porting to MED2.2
authorapo <apo@opencascade.com>
Thu, 13 Jan 2005 10:25:41 +0000 (10:25 +0000)
committerapo <apo@opencascade.com>
Thu, 13 Jan 2005 10:25:41 +0000 (10:25 +0000)
src/CONVERTOR/VISU_DatConvertor.cxx [deleted file]
src/CONVERTOR/VISU_DatConvertor.hxx [deleted file]

diff --git a/src/CONVERTOR/VISU_DatConvertor.cxx b/src/CONVERTOR/VISU_DatConvertor.cxx
deleted file mode 100644 (file)
index c85ac82..0000000
+++ /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<int> 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<int>* pCellsType)
-{
-  /*
-  ifstream &stmIn = *pStmIn;
-  vector<int>& 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 = "<<aField.myMeshName<<"; myNbComp = "<<aField.myNbComp);
-  for(int i = 0, tmp; i < iEnd; i++) {
-    stmIn>>tmp;
-    VISU::TField::TTime aTime(0.0,"");
-    VISU::TField::TValForCellsWithType &anArray = aField.myValField[aTime][aCellsType[i]];
-    for(int j = 0; j < aField.myNbComp; j++){
-      float tmp;  stmIn>>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 = "<<iEnd);
-  vector<float> &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<int>* pCellsType) 
-{
-  /*
-  ifstream &stmIn = *pStmIn;
-  vector<int>& 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 - "<<theFileName);
-  if(!myIsDone && Build() != NULL) myIsDone = true;
-  ofstream stmOut(theFileName.c_str(),ios::out);
-  stmOut.precision(PRECISION);
-  stmOut.setf(ios::scientific,ios::floatfield);
-  
-  VISU::TMeshMap::const_iterator aMeshIter = myMeshMap.begin();
-  if(aMeshIter != myMeshMap.end()){
-    const VISU::TMesh &aMesh = aMeshIter->second;
-    if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - aMeshName = "<<aMeshIter->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<<aNbPoints<<"\t"<<aNbCells<<"\t"<<aFieldMap.size()<<endl;
-      if(MYDEBUG) 
-       MESSAGE("VISU_Convertor_impl::ToDatFile - aNbPoints = "<<aNbPoints<<
-               "; aNbCells = "<<aNbCells<<"; aNbFields = "<<aFieldMap.size());
-      for(int i = 0, j = 0; i < aNbPoints; i++, j = 3*i){
-       stmOut<<(i+1)<<"\t"; 
-       stmOut<<aMesh.myPointsCoord[j]<<"\t"; 
-       stmOut<<aMesh.myPointsCoord[j+1]<<"\t";
-       stmOut<<aMesh.myPointsCoord[j+2]<<endl;
-      } 
-      const VISU::TMeshOnEntity::TCellsConn &aCellsConn = aMeshOnEntity.myCellsConn;
-      VISU::TMeshOnEntity::TCellsConn::const_iterator iter = aCellsConn.begin();
-      for(int i = 0; iter != aCellsConn.end(); iter++){
-       if(MYDEBUG) 
-         MESSAGE("VISU_Convertor_impl::ToDatFile - vtkCellType = "<<iter->first);
-       const VISU::TMeshOnEntity::TConnForCellType& anArray = iter->second;
-       for(int j = 0, jEnd = anArray.size(); j < jEnd; j++){
-         stmOut<<(++i)<<"\t";
-         stmOut<<vtk2medCellType(iter->first)<<"\t";
-         const vector<int>& aVector = anArray[j];
-         int kEnd = aVector.size();
-         for(int k = 0; k < kEnd; k++)
-           stmOut<<aVector[k]<<"\t";
-         stmOut<<endl;
-       }
-      }
-      if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - Beginning of Field Conversion");
-      VISU::TFieldMap::const_iterator aFieldIter = aFieldMap.begin();
-      for(int i = 0; aFieldIter != aFieldMap.end(); aFieldIter++){
-       const VISU::TField &aField = aFieldIter->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 = "<<i);
-         const VISU::TField::TValForTime& aValForTime = iter->second;
-         VISU::TField::TValForTime::const_iterator jter = aValForTime.begin();
-         stmOut<<(++i)<<endl;
-         int prefix = (aField.myEntity == VISU::CELL_ENTITY? 100: 200);
-         int jEnd = (aField.myEntity == VISU::CELL_ENTITY? aNbCells: aNbPoints);
-         string aName = GenerateName((aFieldIter->first).c_str(),i);
-         stmOut<<aName<<endl;
-         stmOut<<(prefix + aField.myNbComp)<<"\t"<<jEnd<<endl;
-         if(MYDEBUG) 
-           MESSAGE("VISU_Convertor_impl::ToDatFile - aName = "<<aName<<"; jEnd = "<<jEnd);
-         for(int j = 0; jter != aValForTime.end(); jter++) {
-           const VISU::TField::TValForCellsWithType& anArray = jter->second;
-           int kEnd = anArray.size(), aVtkType = jter->first;
-           switch(aField.myNbComp) {
-           case 1:
-             for (int k = 0; k < kEnd;) {
-               stmOut<<(++j)<<"\t";
-               stmOut<<anArray[k++]<<"\n";
-             }
-             break;
-           case 2:
-             for (int k = 0; k < kEnd;){
-               stmOut<<(++j)<<"\t";
-               stmOut<<anArray[k++]<<"\t";
-               stmOut<<anArray[k++]<<"\t";
-               stmOut<<0.0<<"\n";
-             }
-             break;
-           case 3: 
-             for (int k = 0; k < kEnd;){
-               stmOut<<(++j)<<"\t";
-               stmOut<<anArray[k++]<<"\t";
-               stmOut<<anArray[k++]<<"\t";
-               stmOut<<anArray[k++]<<"\n";
-             }
-             break;
-           }
-         }
-       }
-      }
-    }
-  }
-  return 1;
-}
-*/
diff --git a/src/CONVERTOR/VISU_DatConvertor.hxx b/src/CONVERTOR/VISU_DatConvertor.hxx
deleted file mode 100644 (file)
index 2fa8856..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : VISU_DatConvertor.hxx
-//  Author : Alexey PETROV
-//  Module : VISU
-
-#ifndef VISU_DatConvertor_HeaderFile
-#define VISU_DatConvertor_HeaderFile
-
-#include "VISU_Convertor_impl.hxx"
-#include <fstream>     
-
-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<int>* aCellsType) ;
-    
-  int ImportField(ifstream*, int theNbPoints, vector<int>* 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