--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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
+//
+//
+// File: VISUConvertor.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#include "VISU_Convertor.hxx"
+
+#include <fstream>
+#include <strstream>
+#include <vtkCellType.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qstringlist.h>
+#include <memory>
+
+using namespace std;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+void parseFile(const char* theFileName) throw(std::runtime_error&){
+ try{
+ cout<<"'"<<theFileName<<"'...";
+ auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
+ const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
+ //return;
+ VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+ for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+ const string& aMeshName = aMeshMapIter->first;
+ const VISU::TMesh& aMesh = aMeshMapIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+ //Import fields
+ aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+ for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+ const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+ const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+ const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+ VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+ for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
+ const string& aFieldName = aFieldMapIter->first;
+ const VISU::TField& aField = aFieldMapIter->second;
+ const VISU::TField::TValField& aValField = aField.myValField;
+ VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+ for(; aValFieldIter != aValField.end(); aValFieldIter++){
+ int aTimeStamp = aValFieldIter->first;
+ aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+ }
+ }
+ }
+ //Importing groups
+ const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+ VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+ for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+ const string& aGroupName = aGroupMapIter->first;
+ aCon->GetMeshOnGroup(aMeshName,aGroupName);
+ }
+ //Import families
+ aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+ for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+ const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+ const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+ //aCon->GetMeshOnEntity(aMeshName,anEntity);
+ const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+ VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+ for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+ const string& aFamilyName = aFamilyMapIter->first;
+ aCon->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
+ }
+ }
+ //Import mesh on entity
+ aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+ for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+ const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+ aCon->GetMeshOnEntity(aMeshName,anEntity);
+ }
+ }
+ cout<<"OK"<<endl;
+ }catch(std::runtime_error& exc){
+ MESSAGE("Follow exception was accured in file:"<<theFileName<<"\n"<<exc.what());
+ }catch(...){
+ MESSAGE("Unknown exception was accured in VISU_Convertor_impl in file:"<<theFileName);
+ }
+}
+
+int main(int argc, char** argv){
+ try{
+ if(argc > 1){
+ QFileInfo fi(argv[1]);
+ for(int i = 0; i < 1; i++){
+ if(fi.exists()){
+ if(fi.isDir()){
+ QDir aDir(fi.absFilePath());
+ QStringList aStringList = aDir.entryList("*.med",QDir::Files);
+ int jEnd = aStringList.count();
+ for(int j = 0; j < jEnd; j++){
+ parseFile(aDir.filePath(aStringList[j]).latin1());
+ }
+ }else{
+ parseFile(argv[1]);
+ }
+ }
+ }
+ return 0;
+ }
+ }catch(std::runtime_error& exc){
+ cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
+ }catch(...){
+ cout<<"Unknown exception was accured in VISU_Convertor_impl"<<endl;
+ }
+ return 1;
+}