From: GERALD NICOLAS Date: Wed, 10 Feb 2021 15:31:01 +0000 (+0100) Subject: les champs par medcoupling X-Git-Tag: V9_7_0a1~18^2~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b54385ddd41b61114e7d1088048f2f1131c30f1d;p=modules%2Fsmesh.git les champs par medcoupling --- diff --git a/src/SMESH/MG_ADAPT.cxx b/src/SMESH/MG_ADAPT.cxx index e73758b5d..d22075995 100644 --- a/src/SMESH/MG_ADAPT.cxx +++ b/src/SMESH/MG_ADAPT.cxx @@ -1152,22 +1152,31 @@ void MgAdapt::copyMgAdaptHypothesisData( const MgAdaptHypothesisData* from) data->myVerboseLevel = from->myVerboseLevel; } +std::vector MgAdapt::getListFieldsNames(std::string fileIn) +{ + MEDCoupling::MCAuto mfd = MEDCoupling::MEDFileData::New(fileIn); + std::vector listFieldsNames(mfd->getFields()->getFieldsNames()); + return listFieldsNames ; +} + bool MgAdapt::checkFieldName(std::string fileIn) { bool ret = false ; - MEDCoupling::MCAuto mfd = MEDCoupling::MEDFileData::New(fileIn); - std::vector fieldNames(mfd->getFields()->getFieldsNames()); - std::size_t jaux(fieldNames.size()); + std::vector listFieldsNames = getListFieldsNames(fileIn); + std::size_t jaux(listFieldsNames.size()); for(std::size_t j=0;j getListFieldsNames(std::string fileIn) ; bool checkFieldName(std::string fileIn) ; bool checkTimeStepRank(std::string fileIn) ; diff --git a/src/SMESHGUI/CMakeLists.txt b/src/SMESHGUI/CMakeLists.txt index 5b5bd4a8c..237f63801 100644 --- a/src/SMESHGUI/CMakeLists.txt +++ b/src/SMESHGUI/CMakeLists.txt @@ -42,7 +42,6 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/Controls ${PROJECT_SOURCE_DIR}/src/SMESHClient ${PROJECT_SOURCE_DIR}/src/MEDWrapper - ${PROJECT_SOURCE_DIR}/src/ADAPT ${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}/idl ${MEDCOUPLING_INCLUDE_DIRS} diff --git a/src/SMESHGUI/MG_ADAPTGUI.cxx b/src/SMESHGUI/MG_ADAPTGUI.cxx index 8e7a593b1..401b97484 100644 --- a/src/SMESHGUI/MG_ADAPTGUI.cxx +++ b/src/SMESHGUI/MG_ADAPTGUI.cxx @@ -23,6 +23,8 @@ #include "MG_ADAPTGUI.hxx" +#include "MEDFileData.hxx" + #include "SUIT_Desktop.h" #include "SUIT_Application.h" #include "SUIT_Session.h" @@ -1363,21 +1365,13 @@ std::map GetListeChamps(QString aFile, bool errorMessage) std::map ListeChamp ; med_err erreur = 0 ; - med_idt medIdt ; while ( erreur == 0 ) { - // Ouverture du fichier - SCRUTE(aFile.toStdString()); - medIdt = OuvrirFichier(aFile); - if ( medIdt < 0 ) - { - erreur = 1 ; - break ; - } - // Lecture du nombre de champs - med_int ncha = MEDnField(medIdt) ; - if (ncha < 1 ) + MEDCoupling::MCAuto mfd = MEDCoupling::MEDFileData::New(aFile.toStdString()); + std::vector listFieldsNames(mfd->getFields()->getFieldsNames()); + std::size_t jaux(listFieldsNames.size()); + if (jaux < 1 ) { if(errorMessage) { @@ -1387,40 +1381,14 @@ std::map GetListeChamps(QString aFile, bool errorMessage) erreur = 2 ; break ; } - // Lecture des caracteristiques des champs - for (int i=0; i< ncha; i++) + med_int nbofcstp = 1; + for(std::size_t j=0;j (QString(nomcha), nbofcstp)); - +// std::cout << listFieldsNames[j] << std::endl; + ListeChamp.insert(std::pair (QString(listFieldsNames[j].c_str()), nbofcstp)); } break ; } - // Fermeture du fichier - if ( medIdt > 0 ) MEDfileClose(medIdt); return ListeChamp; } diff --git a/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h b/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h index f68398525..20e09dd95 100644 --- a/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h +++ b/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h @@ -43,9 +43,7 @@ #include #include // model -//~#include "MG_ADAPT.h" #include "MG_ADAPTGUI.hxx" -//~#include "MG_ADAPT.hxx" #include CORBA_SERVER_HEADER(MG_ADAPT)