mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +05:00
Usage de medcoupling pour le nom du maillage
This commit is contained in:
parent
6b6029858b
commit
36da803449
@ -24,6 +24,7 @@
|
|||||||
#include "MG_ADAPTGUI.hxx"
|
#include "MG_ADAPTGUI.hxx"
|
||||||
|
|
||||||
#include "MEDFileData.hxx"
|
#include "MEDFileData.hxx"
|
||||||
|
#include "MEDLoader.hxx"
|
||||||
|
|
||||||
#include "SUIT_Desktop.h"
|
#include "SUIT_Desktop.h"
|
||||||
#include "SUIT_Application.h"
|
#include "SUIT_Application.h"
|
||||||
@ -1278,82 +1279,32 @@ med_idt OuvrirFichier(QString aFile)
|
|||||||
QString lireNomMaillage(QString aFile, med_int& meshdim)
|
QString lireNomMaillage(QString aFile, med_int& meshdim)
|
||||||
{
|
{
|
||||||
QString nomMaillage = QString::null ;
|
QString nomMaillage = QString::null ;
|
||||||
int erreur = 0 ;
|
|
||||||
med_idt medIdt ;
|
|
||||||
|
|
||||||
// Ouverture du fichier
|
std::vector<std::string> listMeshesNames = MEDCoupling::GetMeshNames(aFile.toStdString());
|
||||||
medIdt = OuvrirFichier(aFile);
|
|
||||||
if ( medIdt < 0 )
|
std::size_t numberOfMeshes(listMeshesNames.size());
|
||||||
{
|
// std::cout << "numberOfMeshes:" << numberOfMeshes << std::endl;
|
||||||
erreur = 1 ;
|
|
||||||
return nomMaillage;
|
|
||||||
}
|
|
||||||
med_int numberOfMeshes = MEDnMesh(medIdt) ;
|
|
||||||
if (numberOfMeshes == 0 )
|
if (numberOfMeshes == 0 )
|
||||||
{
|
{
|
||||||
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"),
|
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"),
|
||||||
QObject::tr("MG_ADAPT_MED_FILE_2") );
|
QObject::tr("MG_ADAPT_MED_FILE_2") );
|
||||||
erreur = 2 ;
|
|
||||||
return nomMaillage;
|
return nomMaillage;
|
||||||
}
|
}
|
||||||
if (numberOfMeshes > 1 )
|
if (numberOfMeshes > 1 )
|
||||||
{
|
{
|
||||||
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"),
|
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"),
|
||||||
QObject::tr("MG_ADAPT_MED_FILE_3") );
|
QObject::tr("MG_ADAPT_MED_FILE_3") );
|
||||||
erreur = 3 ;
|
|
||||||
return nomMaillage;
|
return nomMaillage;
|
||||||
}
|
}
|
||||||
|
|
||||||
nomMaillage = lireNomMaillage2(medIdt,1, meshdim);
|
// std::cout << "numberOfMeshes:" << numberOfMeshes << std::endl;
|
||||||
// Fermeture du fichier
|
std::cout << "nomMaillage:" << listMeshesNames[0] << std::endl;
|
||||||
if ( medIdt > 0 ) MEDfileClose(medIdt);
|
nomMaillage = QString(listMeshesNames[0].c_str());
|
||||||
|
|
||||||
return nomMaillage;
|
return nomMaillage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// =======================================================================
|
|
||||||
QString lireNomMaillage2(med_idt medIdt,int meshId, med_int& meshdim )
|
|
||||||
{
|
|
||||||
QString NomMaillage=QString::null;
|
|
||||||
char meshname[MED_NAME_SIZE+1];
|
|
||||||
med_int spacedim;
|
|
||||||
med_mesh_type meshtype;
|
|
||||||
char descriptionription[MED_COMMENT_SIZE+1];
|
|
||||||
char dtunit[MED_SNAME_SIZE+1];
|
|
||||||
med_sorting_type sortingtype;
|
|
||||||
med_int nstep;
|
|
||||||
med_axis_type axistype;
|
|
||||||
int naxis = MEDmeshnAxis(medIdt,1);
|
|
||||||
char *axisname=new char[naxis*MED_SNAME_SIZE+1];
|
|
||||||
char *axisunit=new char[naxis*MED_SNAME_SIZE+1];
|
|
||||||
med_err aRet = MEDmeshInfo(medIdt,
|
|
||||||
meshId,
|
|
||||||
meshname,
|
|
||||||
&spacedim,
|
|
||||||
&meshdim,
|
|
||||||
&meshtype,
|
|
||||||
descriptionription,
|
|
||||||
dtunit,
|
|
||||||
&sortingtype,
|
|
||||||
&nstep,
|
|
||||||
&axistype,
|
|
||||||
axisname,
|
|
||||||
axisunit);
|
|
||||||
|
|
||||||
if ( aRet < 0 ) {
|
|
||||||
QMessageBox::critical( 0, QObject::tr("MG_ADAPT_ERROR"), \
|
|
||||||
QObject::tr("MG_ADAPT_MED_FILE_4") );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
NomMaillage=QString(meshname);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] axisname ;
|
|
||||||
delete[] axisunit ;
|
|
||||||
|
|
||||||
return NomMaillage;
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage)
|
std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage)
|
||||||
|
@ -99,7 +99,6 @@ class QFileDialog;
|
|||||||
|
|
||||||
std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage = true);
|
std::map<QString, int> GetListeChamps(QString aFile, bool errorMessage = true);
|
||||||
QString lireNomMaillage(QString aFile, med_int& meshDim);
|
QString lireNomMaillage(QString aFile, med_int& meshDim);
|
||||||
QString lireNomMaillage2(med_idt medIdt,int meshId, med_int& meshDim);
|
|
||||||
med_idt OuvrirFichier(QString aFile);
|
med_idt OuvrirFichier(QString aFile);
|
||||||
std::string remove_extension(const std::string& filename);
|
std::string remove_extension(const std::string& filename);
|
||||||
|
|
||||||
|
@ -396,10 +396,6 @@
|
|||||||
<source>MG_ADAPT_MED_FILE_5</source>
|
<source>MG_ADAPT_MED_FILE_5</source>
|
||||||
<translation>No field in this MED file.</translation>
|
<translation>No field in this MED file.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>MG_ADAPT_MED_FILE_6</source>
|
|
||||||
<translation>The field(s) in this MED file cannot be read.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>MG_ADAPT_ERROR</source>
|
<source>MG_ADAPT_ERROR</source>
|
||||||
<translation>Error</translation>
|
<translation>Error</translation>
|
||||||
|
@ -396,10 +396,6 @@
|
|||||||
<source>MG_ADAPT_MED_FILE_5</source>
|
<source>MG_ADAPT_MED_FILE_5</source>
|
||||||
<translation>Ce fichier MED ne contient aucun champ.</translation>
|
<translation>Ce fichier MED ne contient aucun champ.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>MG_ADAPT_MED_FILE_6</source>
|
|
||||||
<translation>Impossible de lire le(s) champ(s) de ce fichier MED.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>MG_ADAPT_ERROR</source>
|
<source>MG_ADAPT_ERROR</source>
|
||||||
<translation>Erreur</translation>
|
<translation>Erreur</translation>
|
||||||
|
Loading…
Reference in New Issue
Block a user