From: vsr Date: Fri, 29 Aug 2008 12:14:30 +0000 (+0000) Subject: Migrate to SALOME 5.x and automake X-Git-Tag: V5_1_0_for_TC1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=63d08703777f8862665905711dd5c35f27905d0d;p=plugins%2Fghs3dprlplugin.git Migrate to SALOME 5.x and automake --- diff --git a/README b/README index 4190ec2..7289e65 100644 --- a/README +++ b/README @@ -16,8 +16,7 @@ Contents: The information in this file assumes that: * The SALOME platform is installed to the directory -* The blsurf product is installed to the directory /blsurf -* The decimesh binary is vaiable via environment variable PATH +* The GHS3DPRL (Tepal) product is installed to the directory /ghs3dprl --------------- 2. Installation @@ -35,10 +34,13 @@ tar zxf GHS3DPRLPLUGIN_SRC.tgz bash cd source env_build.sh -export GHS3DPRLHOME=/blsurf +export GHS3DPRLHOME=/ghs3dprl Note: you can avoid setting GHS3DPRLHOME environment variable but use ---with-blsurf key of configure script instead. +--with-ghs3dprl key of configure script instead. You can also compile +plugin withour GHS3DPRL product installation. But you'll need to add +path to the tepal executable to the PATH environment variable in order +to use GHS3DPRL meshing plugin within SALOME. * configure build system @@ -50,8 +52,8 @@ mkdir GHS3DPRLPLUGIN_BUILD cd GHS3DPRLPLUGIN_BUILD ../GHS3DPRLPLUGIN_SRC/configure --prefix=/GHS3DPRLPLUGIN_INSTALL -Note: you can use --with-blsurf option to pass the root directory of -blsurf product to the confogure script. In this case you can avoid +Note: you can use --with-ghs3dprl option to pass the root directory of +ghs3dprl product to the configure script. In this case you can avoid setting GHS3DPRLHOME environment variable. Try 'configure --help' command to learn more about available configure script options. @@ -59,7 +61,9 @@ Check "Summary" area in the log output of the configure script to verify that all pre-requisites required for the successful compilation of GHS3DPRLPLUFIN module have been found. All pre-requisite products should have status "yes". If any product has status "no", the -compilation procedure will fail. +compilation procedure will fail (the only exception is GHS3DPRL +product which is not required for the successful compilation of the +plugin; it is needed in run-time only). * compile and install plugin module @@ -83,11 +87,8 @@ cd source env_products.sh export GHS3DPRLPLUGIN_ROOT_DIR=/GHS3DPRLPLUGIN_INSTALL -export SalomeAppConfig=${GHS3DPRLPLUGIN_ROOT_DIR}/share/salome/resources/blsurfplugin -export DISTENE_LICENSE_FILE=/dlim8.key - -Note: DISTENE_LICENSE_FILE environment variable should point to the -blsurf product license file. +export SalomeAppConfig=${GHS3DPRLPLUGIN_ROOT_DIR}/share/salome/resources/ghs3dprlplugin +export PATH=/ghs3dprl:${PATH * run SALOME @@ -109,7 +110,7 @@ runSalome mouse in the Object Browser * In the "Create mesh" dialog box: -- activate "2D" page +- activate "3D" page - In the "Algorithm" combo box select "GHS3DPRL" - Click on the button at the right of the "Hypothesis" combo box and select "GHS3DPRL parameters" item in the drop-down menu diff --git a/adm_local/unix/config_files/check_GHS3DPRL.m4 b/adm_local/unix/config_files/check_GHS3DPRL.m4 index cb033fa..15ba265 100755 --- a/adm_local/unix/config_files/check_GHS3DPRL.m4 +++ b/adm_local/unix/config_files/check_GHS3DPRL.m4 @@ -41,7 +41,7 @@ GHS3DPRL_ok=no if test "$with_ghs3dprl" == "no" ; then AC_MSG_WARN(You have choosen building plugin without GHS3DPRL) else - elif test "$with_ghs3dprl" == "yes" || test "$with_ghs3dprl" == "auto"; then + if test "$with_ghs3dprl" == "yes" || test "$with_ghs3dprl" == "auto"; then GHS3DPRL_HOME="" else GHS3DPRL_HOME="$with_ghs3dprl" @@ -51,7 +51,7 @@ else if test "x$GHS3DPRLHOME" != "x" ; then GHS3DPRL_HOME=$GHS3DPRLHOME else - AC_MSG_FAILURE(Build plugin without GHS3DPRL) + AC_MSG_WARN(Build plugin without GHS3DPRL) fi fi diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am index 6c116b9..d31a1d0 100644 --- a/adm_local/unix/make_common_starter.am +++ b/adm_local/unix/make_common_starter.am @@ -63,11 +63,16 @@ docdir = $(datadir)/doc/@PACKAGE@ %.qm: %.ts $(LRELEASE) $< -qm $@ -EXTRA_DIST=$(MOC_FILES:%_moc.cxx=%.h) $(nodist_salomeres_DATA:%.qm=%.ts) +# uic-files generation +ui_%.h: %.ui + $(UIC) -o $@ $< + +EXTRA_DIST = $(MOC_FILES:%_moc.cxx=%.h) $(UIC_FILES:ui_%.h=%.ui) $(nodist_salomeres_DATA:%.qm=%.ts) mostlyclean-local: rm -f @builddir@/*_moc.cxx rm -f @builddir@/*.qm + rm -f @builddir@/ui_*.h # tests tests: unittest diff --git a/configure.ac b/configure.ac index 2828ab6..325cdd2 100644 --- a/configure.ac +++ b/configure.ac @@ -353,20 +353,36 @@ echo #AM_CONDITIONAL( USE_GFORTRAN, [test "$F77" = "gfortran"]) -echo Configure if test "${GHS3DPRLPLUGIN_WITH_GUI}" = "yes"; then -variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok SalomeGUI_ok GHS3DPRL_ok" +variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok SalomeGUI_ok" +opt_variables="GHS3DPRL_ok" fi if test "${GHS3DPRLPLUGIN_WITH_GUI}" = "no"; then -variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok GHS3DPRL_ok" +variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok" +opt_variables="GHS3DPRL_ok" fi +echo +echo --- Mandatory products : +echo + for var in $variables do printf " %10s : " `echo \$var | sed -e "s,_ok,,"` eval echo \$$var done +echo +echo --- Optional products : +echo + +for var in $opt_variables +do + printf " %10s : " `echo \$var | sed -e "s,_ok,,"` + eval echo \$$var +done + + echo echo "Default ORB : $DEFAULT_ORB" echo diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx index 4be6132..df17546 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx @@ -48,7 +48,7 @@ GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis (int hypId, int studyId, * */ //============================================================================= -static string cutOrReplaceBlancs(string theIn) +static std::string cutOrReplaceBlancs(std::string theIn) { // cut all blancs at the beginning and at the end of the string, // replace each blancs sequence of maximum length inside the string by one '_' symbol, @@ -78,14 +78,14 @@ static string cutOrReplaceBlancs(string theIn) } } str2[lastgood] = '\0'; - string anOut = str2; + std::string anOut = str2; return anOut; } -void GHS3DPRLPlugin_Hypothesis::SetMEDName(string theVal) { +void GHS3DPRLPlugin_Hypothesis::SetMEDName(std::string theVal) { //without whitespaces! ..from python? - string tmp1 = cutOrReplaceBlancs(theVal); - string tmp2 = _MEDName; + std::string tmp1 = cutOrReplaceBlancs(theVal); + std::string tmp2 = _MEDName; if (tmp1 != tmp2) { _MEDName = tmp1.c_str(); NotifySubMeshesHypothesisModification(); @@ -111,7 +111,7 @@ void GHS3DPRLPlugin_Hypothesis::SetKeepFiles(bool theVal) { * */ //============================================================================= -ostream & GHS3DPRLPlugin_Hypothesis::SaveTo(ostream & save) +std::ostream& GHS3DPRLPlugin_Hypothesis::SaveTo(std::ostream& save) { /*save << _MEDName ; //without whitespaces! save << " " << _NbPart; @@ -130,17 +130,17 @@ ostream & GHS3DPRLPlugin_Hypothesis::SaveTo(ostream & save) * */ //============================================================================= -istream & GHS3DPRLPlugin_Hypothesis::LoadFrom(istream & load) +std::istream& GHS3DPRLPlugin_Hypothesis::LoadFrom(std::istream& load) { //explicit inputs for future code compatibility of saved .hdf bool isOK = true; - string str1,str2,str3,str4; + std::string str1,str2,str3,str4; //save without any whitespaces! isOK = (load >> str1); if (!(isOK)) { //defaults values assumed - load.clear(ios::badbit | load.rdstate()); + load.clear(std::ios::badbit | load.rdstate()); return load; } int pos = 0; @@ -165,7 +165,7 @@ istream & GHS3DPRLPlugin_Hypothesis::LoadFrom(istream & load) * */ //============================================================================= -ostream & operator <<(ostream & save, GHS3DPRLPlugin_Hypothesis & hyp) +std::ostream& operator <<(std::ostream& save, GHS3DPRLPlugin_Hypothesis& hyp) { return hyp.SaveTo( save ); } @@ -175,7 +175,7 @@ ostream & operator <<(ostream & save, GHS3DPRLPlugin_Hypothesis & hyp) * */ //============================================================================= -istream & operator >>(istream & load, GHS3DPRLPlugin_Hypothesis & hyp) +std::istream& operator >>(std::istream& load, GHS3DPRLPlugin_Hypothesis& hyp) { return hyp.LoadFrom( load ); } @@ -190,13 +190,13 @@ istream & operator >>(istream & load, GHS3DPRLPlugin_Hypothesis & hyp) */ //================================================================================ bool GHS3DPRLPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh, - const TopoDS_Shape& theShape) + const TopoDS_Shape& theShape) { return false; } //============================================================================= -string GHS3DPRLPlugin_Hypothesis::GetDefaultMEDName() +std::string GHS3DPRLPlugin_Hypothesis::GetDefaultMEDName() { return "DOMAIN\0"; } diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx index c805f0e..a72df47 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx @@ -36,28 +36,28 @@ class GHS3DPRLPlugin_Hypothesis: public SMESH_Hypothesis { public: - GHS3DPRLPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen); + GHS3DPRLPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen* gen); - void SetMEDName(string theVal); - string GetMEDName() const { return _MEDName; } + void SetMEDName(std::string theVal); + std::string GetMEDName() const { return _MEDName; } - void SetNbPart(int theVal); - int GetNbPart() const { return _NbPart; } + void SetNbPart(int theVal); + int GetNbPart() const { return _NbPart; } - void SetKeepFiles(bool theVal); - bool GetKeepFiles() const { return _KeepFiles; } + void SetKeepFiles(bool theVal); + bool GetKeepFiles() const { return _KeepFiles; } // the parameters default values - static string GetDefaultMEDName(); - static int GetDefaultNbPart(); - static bool GetDefaultKeepFiles(); + static std::string GetDefaultMEDName(); + static int GetDefaultNbPart(); + static bool GetDefaultKeepFiles(); // Persistence - virtual ostream & SaveTo(ostream & save); - virtual istream & LoadFrom(istream & load); - friend ostream & operator <<(ostream & save, GHS3DPRLPlugin_Hypothesis & hyp); - friend istream & operator >>(istream & load, GHS3DPRLPlugin_Hypothesis & hyp); + virtual std::ostream& SaveTo(std::ostream& save); + virtual std::istream& LoadFrom(std::istream& load); + friend std::ostream& operator <<(std::ostream& save, GHS3DPRLPlugin_Hypothesis& hyp); + friend std::istream& operator >>(std::istream& load, GHS3DPRLPlugin_Hypothesis& hyp); /*! * \brief Does nothing @@ -65,16 +65,16 @@ public: * \param theShape - the geometry of interest * \retval bool - always false */ - virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); + virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); private: - int _countSubMesh; - int _countTotal; - int _nodeRefNumber; + int _countSubMesh; + int _countTotal; + int _nodeRefNumber; - string _MEDName; //generic path/name of med files - int _NbPart; //number of partitions - bool _KeepFiles; //keep intermediates tepal files or not + std::string _MEDName; // generic path/name of med files + int _NbPart; // number of partitions + bool _KeepFiles; // keep intermediates tepal files or not }; #endif diff --git a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx index bc577be..2f58c77 100755 --- a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx +++ b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx @@ -31,25 +31,21 @@ #include CORBA_SERVER_HEADER(GHS3DPRLPlugin_Algorithm) #include - +#include #include - #include -#include - -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include GHS3DPRLPluginGUI_HypothesisCreator::GHS3DPRLPluginGUI_HypothesisCreator( const QString& theHypType ) : SMESHGUI_GenericHypothesisCreator( theHypType ), - myIs3D(true) + myIs3D( true ) { } @@ -69,43 +65,50 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::checkParams() const QFrame* GHS3DPRLPluginGUI_HypothesisCreator::buildFrame() { - QString toto="myframe"; - QFrame* fr = new QFrame( 0, "myframe" ); - fr->setMinimumSize( QSize( 300, 140 ) ); - QVBoxLayout* lay = new QVBoxLayout( fr, 5, 0 ); + QFrame* fr = new QFrame( 0 ); + QVBoxLayout* lay = new QVBoxLayout( fr ); + lay->setMargin( 5 ); + lay->setSpacing( 0 ); - QGroupBox* GroupC1 = new QGroupBox( 2, Qt::Horizontal, fr, "GroupC1" ); + QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr ); lay->addWidget( GroupC1 ); - GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); - GroupC1->layout()->setSpacing( 6 ); - GroupC1->layout()->setMargin( 11 ); + QGridLayout* l = new QGridLayout( GroupC1 ); + l->setSpacing( 6 ); + l->setMargin( 11 ); + int row = 0; myName = 0; if( isCreation() ) { - myNameText = new QLabel( tr( "SMESH_NAME" ), GroupC1 ); - QWhatsThis::add( myNameText, tr( "GHS3DPRL_WhatsThis_Name" ) ); + QLabel* aNameLab = new QLabel( tr( "SMESH_NAME" ), GroupC1 ); + aNameLab->setWhatsThis( tr( "GHS3DPRL_WhatsThis_Name" ) ); + l->addWidget( aNameLab, row, 0, 1, 1 ); myName = new QLineEdit( GroupC1 ); + l->addWidget( myName, row++, 1, 1, 1 ); } - GHS3DPRLPlugin::GHS3DPRLPlugin_Hypothesis_var h = - GHS3DPRLPlugin::GHS3DPRLPlugin_Hypothesis::_narrow( initParamsHypothesis() ); + //GHS3DPRLPlugin::GHS3DPRLPlugin_Hypothesis_var h = + //GHS3DPRLPlugin::GHS3DPRLPlugin_Hypothesis::_narrow( initParamsHypothesis() ); - myMEDNameText = new QLabel( tr( "GHS3DPRL_MEDName" ), GroupC1 ); - QWhatsThis::add( myMEDNameText, tr( "GHS3DPRL_WhatsThis_MEDName" ) ); + QLabel* aMEDNameText = new QLabel( tr( "GHS3DPRL_MEDName" ), GroupC1 ); + aMEDNameText->setWhatsThis( tr( "GHS3DPRL_WhatsThis_MEDName" ) ); + l->addWidget( aMEDNameText, row, 0, 1, 1 ); myMEDName = new QLineEdit( GroupC1 ); - QLabel* myNbPartText = new QLabel( tr( "GHS3DPRL_NbPart" ), GroupC1 ); - QWhatsThis::add( myNbPartText, tr( "GHS3DPRL_WhatsThis_NbPart" ) ); + l->addWidget( myMEDName, row++, 1, 1, 1 ); + + QLabel* aNbPartText = new QLabel( tr( "GHS3DPRL_NbPart" ), GroupC1 ); + aNbPartText->setWhatsThis( tr( "GHS3DPRL_WhatsThis_NbPart" ) ); + l->addWidget( aNbPartText, row, 0, 1, 1 ); myNbPart = new QtxIntSpinBox( GroupC1 ); - // myHexesMinLevel->setMinValue( 3 ); - myNbPart->setMinValue( 1 ); - myNbPart->setMaxValue( 256 ); - myNbPart->setLineStep( 1 ); + l->addWidget( myNbPart, row++, 1, 1, 1 ); + myNbPart->setMinimum( 1 ); + myNbPart->setMaximum( 256 ); + myNbPart->setSingleStep( 1 ); myKeepFiles = new QCheckBox( tr( "GHS3DPRL_KeepFiles" ), GroupC1 ); - QWhatsThis::add( myKeepFiles, tr( "GHS3DPRL_WhatsThis_KeepFiles" ) ); + myKeepFiles->setWhatsThis( tr( "GHS3DPRL_WhatsThis_KeepFiles" ) ); + l->addWidget( myKeepFiles, row++, 0, 1, 2 ); - GroupC1->addSpace(0); myIs3D = true; return fr; @@ -116,11 +119,11 @@ void GHS3DPRLPluginGUI_HypothesisCreator::retrieveParams() const GHS3DPRLHypothesisData data; readParamsFromHypo( data ); - if( myName ) myName->setText( data.myName ); + if ( myName ) myName->setText( data.myName ); myMEDName->setText( data.myMEDName ); myNbPart->setValue( data.myNbPart ); myKeepFiles->setChecked( data.myKeepFiles ); - myNbPart->setEnabled(true); + //myNbPart->setEnabled( true ); } QString GHS3DPRLPluginGUI_HypothesisCreator::storeParams() const @@ -130,9 +133,9 @@ QString GHS3DPRLPluginGUI_HypothesisCreator::storeParams() const storeParamsToHypo( data ); QString valStr; - valStr += tr("GHS3DPRL_MEDName") + " = " + data.myMEDName + "; "; - valStr += tr("GHS3DPRL_NbPart") + " = " + QString::number( data.myNbPart ) + "; "; - valStr += tr("GHS3DPRL_KeepFiles") + " = " + QString::number( data.myKeepFiles ) + "; "; + valStr += tr( "GHS3DPRL_MEDName" ) + " = " + data.myMEDName + "; "; + valStr += tr( "GHS3DPRL_NbPart" ) + " = " + QString::number( data.myNbPart ) + "; "; + valStr += tr( "GHS3DPRL_KeepFiles" ) + " = " + QString::number( data.myKeepFiles ) + "; "; return valStr; } @@ -143,9 +146,9 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DPRLHypothesis GHS3DPRLPlugin::GHS3DPRLPlugin_Hypothesis::_narrow( initParamsHypothesis() ); HypothesisData* data = SMESH::GetHypothesisData( hypType() ); - h_data.myName = isCreation() && data ? data->Label : ""; - h_data.myMEDName = h->GetMEDName(); //"DOMAIN\0"; - h_data.myNbPart = h->GetNbPart(); + h_data.myName = isCreation() && data ? hypName() : ""; + h_data.myMEDName = h->GetMEDName(); //"DOMAIN\0"; + h_data.myNbPart = h->GetNbPart(); h_data.myKeepFiles = h->GetKeepFiles(); return true; @@ -159,16 +162,16 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DPRLHypot bool ok = true; try { - if( isCreation() ) - SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.latin1() ); + if ( isCreation() ) + SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() ); - h->SetMEDName( h_data.myMEDName ); + h->SetMEDName( h_data.myMEDName.toLatin1().constData() ); h->SetNbPart( h_data.myNbPart ); h->SetKeepFiles( h_data.myKeepFiles ); } - catch(const SALOME::SALOME_Exception& ex) + catch ( const SALOME::SALOME_Exception& ex ) { - SalomeApp_Tools::QtCatchCorbaException(ex); + SalomeApp_Tools::QtCatchCorbaException( ex ); ok = false; } return ok; @@ -176,29 +179,25 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DPRLHypot bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DPRLHypothesisData& h_data ) const { - h_data.myName = myName ? myName->text() : ""; - h_data.myMEDName = myMEDName->text(); - //without whitespaces! - //h_data.myMEDName.simplified(); //for qt4 - h_data.myMEDName.simplifyWhiteSpace(); //for qt3 - h_data.myMEDName.replace(QChar(' '),QChar('_')); - h_data.myNbPart = myNbPart->value(); + h_data.myName = myName ? myName->text() : ""; + h_data.myMEDName = myMEDName->text().simplified().replace(' ', '_'); + h_data.myNbPart = myNbPart->value(); h_data.myKeepFiles = myKeepFiles->isChecked(); return true; } QString GHS3DPRLPluginGUI_HypothesisCreator::caption() const { - return tr( QString( "GHS3DPRL_%1_TITLE" ).arg(myIs3D?QString("3D"):QString("3D")) ); + return myIs3D ? tr( "GHS3DPRL_3D_TITLE" ) : tr( "GHS3DPRL_3D_TITLE" ); // ??? 3D/2D ??? } QPixmap GHS3DPRLPluginGUI_HypothesisCreator::icon() const { - QString hypIconName = tr( QString("ICON_DLG_GHS3DPRL_PARAMETERS%1").arg(myIs3D?QString(""):QString("")) ); + QString hypIconName = myIs3D ? tr( "ICON_DLG_GHS3DPRL_PARAMETERS" ) : tr( "ICON_DLG_GHS3DPRL_PARAMETERS" ); // ??? 3D/2D ??? return SUIT_Session::session()->resourceMgr()->loadPixmap( "GHS3DPRLPlugin", hypIconName ); } QString GHS3DPRLPluginGUI_HypothesisCreator::type() const { - return tr( QString( "GHS3DPRL_%1_HYPOTHESIS" ).arg(myIs3D?QString("3D"):QString("3D")) ); + return myIs3D ? tr( "GHS3DPRL_3D_HYPOTHESIS" ): tr( "GHS3DPRL_3D_HYPOTHESIS" ); // ??? 3D/2D ??? } diff --git a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h index 1ceee8f..b14b4be 100755 --- a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h +++ b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h @@ -23,13 +23,12 @@ // // --- -#ifndef GHS3DPRLPLUGINGUI_HypothesisCreator_HeaderFile -#define GHS3DPRLPLUGINGUI_HypothesisCreator_HeaderFile +#ifndef GHS3DPRLPLUGINGUI_HypothesisCreator_H +#define GHS3DPRLPLUGINGUI_HypothesisCreator_H #include class QtxIntSpinBox; -class QtxDblSpinBox; class QCheckBox; class QLineEdit; @@ -52,31 +51,28 @@ public: GHS3DPRLPluginGUI_HypothesisCreator( const QString& ); virtual ~GHS3DPRLPluginGUI_HypothesisCreator(); - virtual bool checkParams() const; + virtual bool checkParams() const; protected: - virtual QFrame* buildFrame (); - virtual void retrieveParams() const; - virtual QString storeParams () const; + virtual QFrame* buildFrame (); + virtual void retrieveParams() const; + virtual QString storeParams () const; - virtual QString caption() const; - virtual QPixmap icon() const; - virtual QString type() const; + virtual QString caption() const; + virtual QPixmap icon() const; + virtual QString type() const; private: - bool readParamsFromHypo( GHS3DPRLHypothesisData& ) const; - bool readParamsFromWidgets( GHS3DPRLHypothesisData& ) const; - bool storeParamsToHypo( const GHS3DPRLHypothesisData& ) const; + bool readParamsFromHypo( GHS3DPRLHypothesisData& ) const; + bool readParamsFromWidgets( GHS3DPRLHypothesisData& ) const; + bool storeParamsToHypo( const GHS3DPRLHypothesisData& ) const; private: QLineEdit* myName; - QLabel* myNameText; QLineEdit* myMEDName; - QLabel* myMEDNameText; QtxIntSpinBox* myNbPart; - QLabel* myNbPartText; QCheckBox* myKeepFiles; - bool myIs3D; + bool myIs3D; }; -#endif +#endif // GHS3DPRLPLUGINGUI_HypothesisCreator_H diff --git a/src/tepal2med/Makefile.am b/src/tepal2med/Makefile.am index 07fe74f..1aa1ec0 100644 --- a/src/tepal2med/Makefile.am +++ b/src/tepal2med/Makefile.am @@ -33,18 +33,17 @@ dist_tepal2med_SOURCES = \ ghs3dprl_msg_parser.h \ ghs3dprl_msg_parser.cxx \ dlg_ghs3dmain.h \ - dlg_ghs3dmain.ui.h \ dlg_ghs3dmain.cxx \ tepal2med.cxx MOC_FILES = dlg_ghs3dmain_moc.cxx -nodist_tepal2med_SOURCES = $(MOC_FILES) +UIC_FILES = ui_dlg_ghs3dmain.h -libSUITApp_la_CPPFLAGS=$(QT_INCLUDES) $(PYTHON_INCLUDES) \ - -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx -I$(srcdir)/../Style +BUILT_SOURCES = $(UIC_FILES) -#tepal2med_CPPFLAGS=$(QT_INCLUDES) $(PYTHON_INCLUDES) \ -# -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx -I$(srcdir)/../Style +nodist_tepal2med_SOURCES = $(MOC_FILES) $(UIC_FILES) -#tepal2med_LDADD= libSUITApp.la ../Qtx/libqtx.la ../SUIT/libsuit.la ../Style/libSalomeStyle.la +tepal2med_CPPFLAGS = $(QT_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) + +tepal2med_LDADD = $(QT_LIBS) $(MED2_LIBS) $(HDF5_LIBS) diff --git a/src/tepal2med/dlg_ghs3dmain.cxx b/src/tepal2med/dlg_ghs3dmain.cxx index 3dae43d..d56048c 100755 --- a/src/tepal2med/dlg_ghs3dmain.cxx +++ b/src/tepal2med/dlg_ghs3dmain.cxx @@ -1,94 +1,46 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'dlg_ghs3dmain.ui' -** -** Created: mer fév 14 13:34:54 2007 -** by: The User Interface Compiler ($Id$) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ +// Copyright (C) 2007-2008 OPEN CASCADE, CEA/DEN, EDF R&D +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// --- +// +// File : dlg_gsh3dmain.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com) +// +// --- #include "dlg_ghs3dmain.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dlg_ghs3dmain.ui.h" -/* - * Constructs a dlg_ghs3dmain as a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - * - * The dialog will by default be modeless, unless you set 'modal' to - * TRUE to construct a modal dialog. - */ -dlg_ghs3dmain::dlg_ghs3dmain( QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, fl ) +dlg_ghs3dmain::dlg_ghs3dmain() { - if ( !name ) setName( "tepal2med" ); - setMinimumSize( QSize( 270, 150 ) ); - setMaximumSize( QSize( 270, 150 ) ); - setSizeGripEnabled( FALSE ); - - Parameters = new QGroupBox( this, "Parameters" ); - Parameters->setGeometry( QRect( 10, 10, 250, 91 ) ); - - NbPart = new QSpinBox( Parameters, "NbPart" ); - NbPart->setGeometry( QRect( 10, 20, 80, 31 ) ); - NbPart->setMaxValue( 256 ); - NbPart->setMinValue( 1 ); - - textNbPart = new QLabel( Parameters, "textNbPart" ); - textNbPart->setGeometry( QRect( 100, 20, 141, 31 ) ); - - KeepFiles = new QRadioButton( Parameters, "KeepFiles" ); - KeepFiles->setEnabled( TRUE ); - KeepFiles->setGeometry( QRect( 40, 50, 190, 31 ) ); - KeepFiles->setChecked( FALSE ); - - Ok = new QPushButton( this, "Ok" ); - Ok->setGeometry( QRect( 180, 112, 80, 30 ) ); - Ok->setAutoDefault( FALSE ); - languageChange(); - resize( QSize(270, 150).expandedTo(minimumSizeHint()) ); - clearWState( WState_Polished ); - - // signals and slots connections - connect( Ok, SIGNAL( clicked() ), this, SLOT( slotok() ) ); - //connect( Ok, SIGNAL( released() ), this, SLOT( close() ) ); - init(); + ui.setupUi( this ); + connect( ui.Ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); } -/* - * Destroys the object and frees any allocated resources - */ dlg_ghs3dmain::~dlg_ghs3dmain() { - destroy(); - // no need to delete child widgets, Qt does it all for us } -/* - * Sets the strings of the subwidgets using the current - * language. - */ -void dlg_ghs3dmain::languageChange() +int dlg_ghs3dmain::NbPart() const { - //setCaption( tr( "GHS3DPRL" ) ); - Parameters->setTitle( tr( "Parameters" ) ); - textNbPart->setText( tr( "Nb of partitions" ) ); - KeepFiles->setText( tr( " Keep files" ) ); - KeepFiles->setAccel( QKeySequence( QString::null ) ); - QToolTip::add( KeepFiles, QString::null ); - QWhatsThis::add( KeepFiles, tr( "Keep outputs files of tepal" ) ); - Ok->setText( tr( "Ok" ) ); - Ok->setAccel( QKeySequence( QString::null ) ); + return ui.NbPart->value(); } +bool dlg_ghs3dmain::KeepFiles() const +{ + return ui.KeepFiles->isChecked(); +} diff --git a/src/tepal2med/dlg_ghs3dmain.h b/src/tepal2med/dlg_ghs3dmain.h index 140cc7a..cc10918 100755 --- a/src/tepal2med/dlg_ghs3dmain.h +++ b/src/tepal2med/dlg_ghs3dmain.h @@ -1,56 +1,49 @@ -/**************************************************************************** -** Form interface generated from reading ui file 'dlg_ghs3dmain.ui' -** -** Created: mer fév 14 13:34:52 2007 -** by: The User Interface Compiler ($Id$) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ +// Copyright (C) 2007-2008 OPEN CASCADE, CEA/DEN, EDF R&D +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// --- +// +// File : dlg_gsh3dmain.h +// Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com) +// +// --- #ifndef DLG_GHS3DMAIN_H + #define DLG_GHS3DMAIN_H -#include -#include -#include +#include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QGroupBox; -class QSpinBox; -class QLabel; -class QRadioButton; -class QPushButton; +#include "ui_dlg_ghs3dmain.h" class dlg_ghs3dmain : public QDialog { - Q_OBJECT + Q_OBJECT public: - dlg_ghs3dmain( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~dlg_ghs3dmain(); - - QGroupBox* Parameters; - QSpinBox* NbPart; - QLabel* textNbPart; - QRadioButton* KeepFiles; - QPushButton* Ok; - - bool value_KeepFiles,value_Ok; - int value_NbPart; - -protected: - -protected slots: - virtual void languageChange(); - - virtual void init(); - virtual void destroy(); - virtual void slotok(); + dlg_ghs3dmain(); + ~dlg_ghs3dmain(); + int NbPart() const; + bool KeepFiles() const; +private: + Ui::dlg_ghs3dmain ui; }; #endif // DLG_GHS3DMAIN_H diff --git a/src/tepal2med/dlg_ghs3dmain.ui b/src/tepal2med/dlg_ghs3dmain.ui new file mode 100644 index 0000000..c6da925 --- /dev/null +++ b/src/tepal2med/dlg_ghs3dmain.ui @@ -0,0 +1,104 @@ + + dlg_ghs3dmain + + + + 0 + 0 + 209 + 145 + + + + + + + true + + + true + + + + + + Parameters + + + + + + Nb of partitions + + + + + + + + 70 + 0 + + + + 1 + + + 256 + + + + + + + Keep outputs files of tepal + + + Keep files + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &OK + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + diff --git a/src/tepal2med/dlg_ghs3dmain.ui.h b/src/tepal2med/dlg_ghs3dmain.ui.h deleted file mode 100755 index 748ae85..0000000 --- a/src/tepal2med/dlg_ghs3dmain.ui.h +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** ui.h extension file, included from the uic-generated form implementation. -** -** If you want to add, delete, or rename functions or slots, use -** Qt Designer to update this file, preserving your code. -** -** You should not define a constructor or destructor in this file. -** Instead, write your code in functions called init() and destroy(). -** These will automatically be called by the form's constructor and -** destructor. -*****************************************************************************/ - -#include - -using namespace std; - -void dlg_ghs3dmain::init() -{ - //cout<<"init"<value_KeepFiles=FALSE; - this->value_Ok=FALSE; - this->value_NbPart=1; -} - - -void dlg_ghs3dmain::destroy() -{ - //cout<<"destroy"<value_KeepFiles=KeepFiles->isChecked(); - this->value_Ok=TRUE; - this->value_NbPart=NbPart->value(); - //cout<<"ok "<close(); -} diff --git a/src/tepal2med/ghs3dprl_mesh_wrap.cxx b/src/tepal2med/ghs3dprl_mesh_wrap.cxx index 2a15d8b..2840573 100755 --- a/src/tepal2med/ghs3dprl_mesh_wrap.cxx +++ b/src/tepal2med/ghs3dprl_mesh_wrap.cxx @@ -1,97 +1,121 @@ +// Copyright (C) 2007-2008 OPEN CASCADE, CEA/DEN, EDF R&D +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// --- +// +// File : ghs3dprl_mesh_wrap.cxx +// Author : Christian VAN WAMBEKE (CEA) (from Hexotic plugin Lioka RAZAFINDRAZAKA) +// +// --- + +#include "ghs3dprl_mesh_wrap.h" #include #include #include #include -#include -#include -#include "ghs3dprl_mesh_wrap.h" -using namespace std; +#include +#include + using namespace med_2_2; //************************************ CVWtab::CVWtab(long nb, med_int *pmint) //constructor with pmint allocated yet with new { - //cout"***constructor med_int CVWtab***\n"; - size=nb; - type=1; //only tmint valide - tmint=pmint; - tmflo=NULL; + //std::cout"***constructor med_int CVWtab***\n"; + size=nb; + type=1; //only tmint valide + tmint=pmint; + tmflo=NULL; } //************************************ CVWtab::CVWtab(long nb, med_float *pmflo) //constructor with pmflo allocated yet with new { - //cout<<"***constructor med_float CVWtab***\n"; - size=nb; - type=2; //only tmflo valide - tmint=NULL; - tmflo=pmflo; + //std::cout<<"***constructor med_float CVWtab***\n"; + size=nb; + type=2; //only tmflo valide + tmint=NULL; + tmflo=pmflo; } //************************************ CVWtab::~CVWtab() { - bool ok; - //cout<<" destructor CVWtab *** "<filename<CVWtab_deallocate(); - //remove temporary file - if (this->filename!="_NO_FILE") - { - remove(this->filename); //#include - //cout<filename<<" successfully deleted\n"; - } - + bool ok; + //std::cout<<" destructor CVWtab *** "<filename<filename<<" successfully deleted\n"; + } } //************************************ bool CVWtab::CVWtab_deallocate() { - //cout<<" deallocate CVWtab*** "<size<type==1) cout<<"med_int tab1[0]="<tmint[0]<type==2) cout<<"med_float tab1[0]="<tmflo[0]<size!=tab2->size) return FALSE; - if (this->type!=tab2->type) return FALSE; - if (this->type==1) - { - if (!this->tmint) - { cout<<"***is_equal*** pb pointer NULL with tmint size="<size<size; i++) - if (this->tmint[i]!=tab2->tmint[i]) return FALSE; - } - if (this->type==2) - { - if (!this->tmflo) - { cout<<"***is_equal*** pb pointer NULL with tmflo size="<size<size; i++) - if (this->tmflo[i]!=tab2->tmflo[i]) return FALSE; - } - return TRUE; + //std::cout<<"is_equal tab1 tab2 type="<type<<" size="<size<<" "<size<type==1) std::cout<<"med_int tab1[0]="<tmint[0]<type==2) std::cout<<"med_float tab1[0]="<tmflo[0]<size!=tab2->size) return false; + if (this->type!=tab2->type) return false; + if (this->type==1) + { + if (!this->tmint) + { std::cout<<"***is_equal*** pb pointer NULL with tmint size="<size<size; i++) + if (this->tmint[i]!=tab2->tmint[i]) return false; + } + if (this->type==2) + { + if (!this->tmflo) + { std::cout<<"***is_equal*** pb pointer NULL with tmflo size="<size<size; i++) + if (this->tmflo[i]!=tab2->tmflo[i]) return false; + } + return true; } //************************************ @@ -101,190 +125,188 @@ bool CVW_is_equal_vertices(CVWtab *tab1, long i1, //verbose 1 for print vertices not equals //verbose 2 for print also vertices equals (debug) { - //cout<<"is_equal_vertice size="<size<<" "<size<=tab1->size) - { - cerr<<"BadIndice tab1 in is_equal_vertices "<< - di1<<" not in "<size<=tab2->size) - { - cerr<<"BadIndice tab2 in is_equal_vertices "<< - di2<<" not in "<size<tmflo+di1); - p2=(tab2->tmflo+di2); - if (p1[0]==p2[0] && p1[1]==p2[1] && p1[2]==p2[2]) ok=TRUE ; - if (!ok && verbose>0) printf( - "Vertices differents (%.16g %.16g %.16g) (%.16g %.16g %.16g)\n", - p1[0],p1[1],p1[2],p2[0],p2[1],p2[2]); - else - if (verbose>1) printf( - "Vertices equals (%.16g %.16g %.16g)\n", - p1[0],p1[1],p1[2]); - return ok; + //std::cout<<"is_equal_vertice size="<size<<" "<size<=tab1->size) + { + std::cerr<<"BadIndice tab1 in is_equal_vertices "<< + di1<<" not in "<size<=tab2->size) + { + std::cerr<<"BadIndice tab2 in is_equal_vertices "<< + di2<<" not in "<size<tmflo+di1); + p2=(tab2->tmflo+di2); + if (p1[0]==p2[0] && p1[1]==p2[1] && p1[2]==p2[2]) ok=true ; + if (!ok && verbose>0) printf("Vertices differents (%.16g %.16g %.16g) (%.16g %.16g %.16g)\n", + p1[0],p1[1],p1[2],p2[0],p2[1],p2[2]); + else + if (verbose>1) printf("Vertices equals (%.16g %.16g %.16g)\n", + p1[0],p1[1],p1[2]); + return ok; } //************************************ -bool CVW_FindString(const string &str,fstream &Ff, long &count) +bool CVW_FindString(const std::string &str, std::fstream &Ff, long &count) //find in file first line with string str in first position of line //converts count value expected after "='" in line found { - string line; - do - { - if (getline(Ff,line)) + std::string line; + do + { + if (getline(Ff,line)) + { + if (line[0]==str[0]) //faster { - if (line[0]==str[0]) //faster - { - if (line.find(str)==0) - { - QString tmp=line; - bool ok; - count=tmp.section('\'',1,1).toLong(&ok); - return ok; - } - } + if (line.find(str)==0) + { + QString tmp=line.c_str(); + bool ok; + count=tmp.section('\'',1,1).toLong(&ok); + return ok; + } } - else - { - cerr<<"Problem line '"<nofile); - ok=this->insert_key(tmp,montab); - } - - if (!CVW_FindString("nofile); - ok=this->insert_key(tmp,montab); - } - - if (!CVW_FindString("nofile); - ok=this->insert_key(tmp,montab); - } - - if (!CVW_FindString("nofile); - ok=this->insert_key(tmp,montab); - } - //Ferme le fichier : - Ff.close(); - this->nbfiles++; - return TRUE; + QString tmp; + std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); + std::string line; + long count; + bool ok; + + if (!Ff.is_open()) + { + std::cerr<<"Problem File '"<nofile); + ok=this->insert_key(tmp,montab); + } + + if (!CVW_FindString("nofile); + ok=this->insert_key(tmp,montab); + } + + if (!CVW_FindString("nofile); + ok=this->insert_key(tmp,montab); + } + + if (!CVW_FindString("nofile); + ok=this->insert_key(tmp,montab); + } + //Ferme le fichier : + Ff.close(); + this->nbfiles++; + return true; } //************************************ bool ghs3dprl_mesh_wrap::ReadFileFACES(const QString FileName) //read file .faces (wrap) { - QString tmp; - fstream Ff((const char *)FileName,ios_base::in); - string line; - long nbelem,ntype; - bool ok; - - if (!Ff.is_open()) - { - cerr<<"Problem File '"<verbose>2) cout<<"NumberOfElements="<>ntype; - if (ntype!=3) //only triangles - { - cerr<<"Problem on ntype != 3"<>tmint[i+j]; - //for (int j=0; j<7; j++) cout<verbose>4) cout<<"Elements "<nofile); - ok=this->insert_key(tmp,montab); - - Ff.close(); - this->nbfiles++; - return TRUE; + QString tmp; + std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); + std::string line; + long nbelem,ntype; + bool ok; + + if (!Ff.is_open()) + { + std::cerr<<"Problem File '"<verbose>2) std::cout<<"NumberOfElements="<>ntype; + if (ntype!=3) //only triangles + { + std::cerr<<"Problem on ntype != 3"<>tmint[i+j]; + //for (int j=0; j<7; j++) std::cout<verbose>4) std::cout<<"Elements "<nofile); + ok=this->insert_key(tmp,montab); + + Ff.close(); + this->nbfiles++; + return true; } //************************************ @@ -293,58 +315,58 @@ bool ghs3dprl_mesh_wrap::ReadFileNOBOITE(const QString FileName) //for huge files it could be better use ReadFileNOBOITEB (B=binary format) //(parameter option of ghs3d but NOT tepal) { - QString tmp; - fstream Ff((const char *)FileName,ios_base::in); - long ne,np,npfixe,subnumber,reste; - bool ok; - - if (!Ff.is_open()) - { - cerr<<"Problem File '"<>ne>>np>>npfixe; - if (this->verbose>2) - { - cout<<"NumberOfElements="<>tmint[i]; - if (this->verbose>4) cout<<"Elements "<nofile); - ok=this->insert_key(tmp,montab); - - med_float *tmflo=new med_float[np*3]; - for (int i=0; i>tmflo[i]; - if (this->verbose>4) cout<<"Vertices "<nofile); - ok=this->insert_key(tmp,montab); - - Ff>>subnumber; - if (this->verbose>2) cout<<"NumberOfSubdomains="<>tmint[i]; - if (this->verbose>4) cout<<"Subdomains "<nofile); - ok=this->insert_key(tmp,montab); - - //beware record 6 lenght 1 - //ferme le fichier : - Ff.close(); - this->nbfiles++; - return TRUE; + QString tmp; + std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in); + long ne,np,npfixe,subnumber,reste; + bool ok; + + if (!Ff.is_open()) + { + std::cerr<<"Problem File '"<>ne>>np>>npfixe; + if (this->verbose>2) + { + std::cout<<"NumberOfElements="<>tmint[i]; + if (this->verbose>4) std::cout<<"Elements "<nofile); + ok=this->insert_key(tmp,montab); + + med_float *tmflo=new med_float[np*3]; + for (int i=0; i>tmflo[i]; + if (this->verbose>4) std::cout<<"Vertices "<nofile); + ok=this->insert_key(tmp,montab); + + Ff>>subnumber; + if (this->verbose>2) std::cout<<"NumberOfSubdomains="<>tmint[i]; + if (this->verbose>4) std::cout<<"Subdomains "<nofile); + ok=this->insert_key(tmp,montab); + + //beware record 6 lenght 1 + //ferme le fichier : + Ff.close(); + this->nbfiles++; + return true; } //************************************ @@ -354,306 +376,293 @@ bool ghs3dprl_mesh_wrap::ReadFileNOBOITEB(const QString FileName) //but NOT parameter option of tepal //idem ReadFileNOBOITE with read unformatted { - bool ok; - - cerr<<"Problem function ReadFileNOBOITEB\n" - <<"(no FORTRAN binary format files in tepal)\n\n"; - - QString tmp; - //file binary - FILE *Ff=fopen((const char *)FileName,"rb"); - long ne,np,npfixe,reste,subnumber; /*,cube,npbli, - nbele,loele,nbelef,loelef, - nbpoi,lopoi,nbpoif,lopoif, - nbsub,losub,nbsubf,losubf,reste;*/ - - //http://www.math.utah.edu/software/c-with-fortran.html - //record 1 from format FORTRAN begins and ends with lengh of record - //=> 2*long(68) (68=17*4octets) - long r1[17+2]; - - if (!Ff) - { - cerr<<"Problem File '"<verbose>2) - { - cout<<"NumberOfElements="<nofile); - ok=this->insert_key(tmp,montab); - - fread(&reste,sizeof(long),1,Ff); - //cout<<"info "<verbose>4) printf("Vertices %g %g ... %g \n",tmflo[0],tmflo[1],tmflo[np*3-1]); - - montab=new CVWtab(np*3,tmflo); - tmp=tmp.sprintf("NB%ld VC",this->nofile); - ok=this->insert_key(tmp,montab); - - fread(&reste,sizeof(long),1,Ff); - fread(&subnumber,sizeof(long),1,Ff); - fread(&reste,sizeof(long),1,Ff); - if (this->verbose>2) cout<<"NumberOfSubdomains="<verbose>4) printf("Subdomains %ld %ld ... %ld \n",tlong[0],tlong[1],tlong[subnumber*3-1]); - - tmint=new med_int[subnumber*3]; - for (long i=0; inofile); - ok=this->insert_key(tmp,montab); - - //beware record 6 lenght 1 - //ferme le fichier : - fclose(Ff); - this->nbfiles++; - return TRUE; - + bool ok; + + std::cerr<<"Problem function ReadFileNOBOITEB\n" + <<"(no FORTRAN binary format files in tepal)\n\n"; + + QString tmp; + //file binary + FILE *Ff=fopen(FileName.toLatin1().constData(),"rb"); + long ne,np,npfixe,reste,subnumber; /*,cube,npbli, + nbele,loele,nbelef,loelef, + nbpoi,lopoi,nbpoif,lopoif, + nbsub,losub,nbsubf,losubf,reste;*/ + + //http://www.math.utah.edu/software/c-with-fortran.html + //record 1 from format FORTRAN begins and ends with lengh of record + //=> 2*long(68) (68=17*4octets) + long r1[17+2]; + + if (!Ff) + { + std::cerr<<"Problem File '"<verbose>2) + { + std::cout<<"NumberOfElements="<nofile); + ok=this->insert_key(tmp,montab); + + fread(&reste,sizeof(long),1,Ff); + //std::cout<<"info "<verbose>4) printf("Vertices %g %g ... %g \n",tmflo[0],tmflo[1],tmflo[np*3-1]); + + montab=new CVWtab(np*3,tmflo); + tmp=tmp.sprintf("NB%ld VC",this->nofile); + ok=this->insert_key(tmp,montab); + + fread(&reste,sizeof(long),1,Ff); + fread(&subnumber,sizeof(long),1,Ff); + fread(&reste,sizeof(long),1,Ff); + if (this->verbose>2) std::cout<<"NumberOfSubdomains="<verbose>4) printf("Subdomains %ld %ld ... %ld \n",tlong[0],tlong[1],tlong[subnumber*3-1]); + + tmint=new med_int[subnumber*3]; + for (long i=0; inofile); + ok=this->insert_key(tmp,montab); + + //beware record 6 lenght 1 + //ferme le fichier : + fclose(Ff); + this->nbfiles++; + return true; } //************************************ bool ghs3dprl_mesh_wrap::ReadFilePOINTS(const QString FileName) //read file .points (wrap) { - QString tmp; - long nb; - Q_ULONG maxlen=128; - Q_LONG lg; - bool ok=TRUE; - - //Lit les données : - QFile Ff(FileName); - //NOT Raw because Raw=non-buffered file access - ok=Ff.open(IO_ReadOnly|IO_Translate); - if (!ok) - { - cerr<<"Problem File '"<verbose>2) cout<<"NumberOfVertices="<verbose>2) std::cout<<"NumberOfVertices="<tmint nrs - tmp=tmp.sprintf("PO%ld NRS",this->nofile); - ok=this->insert_key(tmp,montab);} - - {CVWtab *montab=new CVWtab(nb,tmflo); //init montab->tmflo xyz - tmp=tmp.sprintf("PO%ld XYZ",this->nofile); - ok=this->insert_key(tmp,montab);} - - //Ferme le fichier : - Ff.close(); - this->nbfiles++; - return TRUE; + { + std::cerr<<"Problem conversion File '"<tmint nrs + tmp=tmp.sprintf("PO%ld NRS",this->nofile); + ok=this->insert_key(tmp,montab);} + + {CVWtab *montab=new CVWtab(nb,tmflo); //init montab->tmflo xyz + tmp=tmp.sprintf("PO%ld XYZ",this->nofile); + ok=this->insert_key(tmp,montab);} + + //Ferme le fichier : + Ff.close(); + this->nbfiles++; + return true; } //************************************ bool ghs3dprl_mesh_wrap::list_keys_mesh_wrap() { - QDictIterator it( this->mestab); - for ( ; it.current(); ++it ) - { - string nom=it.currentKey(); - nom.resize(20,' '); - cout< size="<size< it( this->mestab); + while ( it.hasNext() ) + { + it.next(); + QString nom = it.key().leftJustified(20,' '); + std::cout< size="<size<remove_key_mesh_wrap(QRegExp(".",TRUE,FALSE)); - return nb; + long nb=this->remove_key_mesh_wrap(QRegExp(".")); + return nb; } //************************************ long ghs3dprl_mesh_wrap::remove_key_mesh_wrap(const QRegExp &rxp) { - long nbremove=0; - bool remove; - QDictIterator it(this->mestab); - for ( ; it.current(); ++it ) - { - do - { - long i=it.currentKey().contains(rxp); - remove=FALSE; - if (i>0) - { - nbremove++; - if (this->verbose>4) cout<<"remove key "<mestab.remove(it.currentKey()); - remove=TRUE; - } - //All dictionary iterators that refer to the removed item - //will be set to point to the next item - //in the dictionary's traversal order - } while (remove); - } - return nbremove; + long nbremove=0; + QMutableHashIterator it(this->mestab); + while ( it.hasNext() ) + { + it.next(); + if (it.key().contains(rxp)) { + nbremove++; + if (this->verbose>4) std::cout<<"remove key "<filename=="_NO_FILE") - { - tab->filename=path+key+".tmp"; - tab->filename.replace(" ","_"); //replace " " by "_" - - //swap disque binaire - //montab->tmint=new long[10]; //for test - //for (int i=0; i<10; i++) montab->tmint[i]=i*2; - FILE *fichier=fopen(tab->filename,"wb"); - long taille; - taille=tab->size; - fwrite(&taille,sizeof(taille),1,fichier); - if (tab->tmint) - { - if (verbose>3) - cout<<"SwapOnFile in binary file "<filename<< - " number of elements "<tmint,sizeof(med_int),taille,fichier); - //fread(&gagnants,sizeof(gagnants),1,fichier); - } - if (tab->tmflo) - { - if (verbose>3) - cout<<"SwapOnFile in binary file "<filename<< - " number of elements "<tmflo,sizeof(med_float),taille,fichier); - } - fclose(fichier); - } - else - { - if (verbose>3) cout<<"SwapOnFile in binary file done yet "<filename<CVWtab_deallocate(); //free memory - return TRUE; + //return true; + if (tab->filename=="_NO_FILE") + { + tab->filename=path+key+".tmp"; + tab->filename.replace(" ","_"); //replace " " by "_" + + //swap disque binaire + //montab->tmint=new long[10]; //for test + //for (int i=0; i<10; i++) montab->tmint[i]=i*2; + FILE *fichier=fopen(tab->filename.toLatin1().constData(),"wb"); + long taille; + taille=tab->size; + fwrite(&taille,sizeof(taille),1,fichier); + if (tab->tmint) + { + if (verbose>3) + std::cout<<"SwapOnFile in binary file "<filename.toLatin1().constData()<< + " number of elements "<tmint,sizeof(med_int),taille,fichier); + //fread(&gagnants,sizeof(gagnants),1,fichier); + } + if (tab->tmflo) + { + if (verbose>3) + std::cout<<"SwapOnFile in binary file "<filename.toLatin1().constData()<< + " number of elements "<tmflo,sizeof(med_float),taille,fichier); + } + fclose(fichier); + } + else + { + if (verbose>3) std::cout<<"SwapOnFile in binary file done yet "<filename.toLatin1().constData()<CVWtab_deallocate(); //free memory + return true; } //************************************ long ghs3dprl_mesh_wrap::SwapOutOfMemory_key_mesh_wrap(const QRegExp &rxp) // { - long nb=0; - bool ok; - QDictIterator it(this->mestab); - for ( ; it.current(); ++it ) - { - long i=it.currentKey().contains(rxp); - if (i>0) - { - nb++; - if (it.current()->size>0) - ok=SwapOnFile(it.currentKey(),this->path,it.current(),this->verbose); //free memory - //if (this->verbose) cout<<"SwapOutOfMemory key "< it(this->mestab); + while ( it.hasNext() ) + { + it.next(); + if (it.key().contains(rxp)) + { + nb++; + if (it.value()->size>0) + ok=SwapOnFile(it.key(),this->path,it.value(),this->verbose); //free memory + //if (this->verbose) std::cout<<"SwapOutOfMemory key "<mestab[key]; - if (montab) - { - //cout<<"key "< size="<size<type==1) - for ( long i=0; isize; i++ ) - cout<tmint[i]<<" "; - if (montab->type==2) - for ( long i=0; isize; i++ ) - cout<tmflo[i]<<" "; - cout<mestab[key]; + if (montab) + { + //std::cout<<"key "< size="<size<type==1) + for ( long i=0; isize; i++ ) + std::cout<tmint[i]<<" "; + if (montab->type==2) + for ( long i=0; isize; i++ ) + std::cout<tmflo[i]<<" "; + std::cout<verbose>4) - cout<<"InsertKey "<nbelem_limit_swap < tab->size) - ok=SwapOnFile(key,this->path,tab,this->verbose); - this->mestab.insert(key,tab); - return TRUE; + bool ok; + if (this->verbose>4) + std::cout<<"InsertKey "<nbelem_limit_swap < tab->size) + ok=SwapOnFile(key,this->path,tab,this->verbose); + this->mestab.insert(key,tab); + return true; } //************************************ CVWtab* ghs3dprl_mesh_wrap::restore_key(const QString &key) @@ -678,165 +687,178 @@ CVWtab* ghs3dprl_mesh_wrap::restore_key(const QString &key) //alors swap disque dans getenv(tmp) fichier temporaire //alors lecture du fichier (et reallocate memory) { - CVWtab *tab=NULL; - tab=this->mestab[key]; - /*if (tab) cout<<" -> size in proc "<size< tab NULL\n";*/ - if (!tab) //it is NOT a problem - { - if (this->verbose>6) cout<<"restore_key key not found "<size > 0) - { - if (this->verbose>5) cout<<"restore_key direct from memory "<filename<< - " type unexpexted "<type<filename<filename,"rb"); - long taille; - fread(&taille,sizeof(long),1,fichier); - if (taille!=-tab->size) - { - cerr<<"Problem restore_key from binary file "<filename<< - " size unexpexted "<size<type==1) - { - if (this->verbose>5) - cout<<"restore_key from binary file "<filename<< - " number of elements "<tmint=new med_int[taille]; //allocate memory - fread(tab->tmint,sizeof(med_int),taille,fichier); - } - if (tab->type==2) - { - if (this->verbose>5) - cout<<"restore_key from binary file "<filename<< - " number of elements "<tmflo=new med_float[taille]; //allocate memory - for (int i=0; itmflo[i]=-1e0; - fread(tab->tmflo,sizeof(med_float),taille,fichier); - /*for (int i=0; itmflo[i]<<"/"; - cout<size=-tab->size; - return tab; + CVWtab *tab=NULL; + tab=this->mestab[key]; + /*if (tab) std::cout<<" -> size in proc "<size< tab NULL\n";*/ + if (!tab) //it is NOT a problem + { + if (this->verbose>6) std::cout<<"restore_key key not found "<size > 0) + { + if (this->verbose>5) std::cout<<"restore_key direct from memory "<filename.toLatin1().constData()<< + " type unexpexted "<type<filename<filename.toLatin1().constData(),"rb"); + long taille; + fread(&taille,sizeof(long),1,fichier); + if (taille!=-tab->size) + { + std::cerr<<"Problem restore_key from binary file "<filename.toLatin1().constData()<< + " size unexpexted "<size<type==1) + { + if (this->verbose>5) + std::cout<<"restore_key from binary file "<filename.toLatin1().constData()<< + " number of elements "<tmint=new med_int[taille]; //allocate memory + fread(tab->tmint,sizeof(med_int),taille,fichier); + } + if (tab->type==2) + { + if (this->verbose>5) + std::cout<<"restore_key from binary file "<filename.toLatin1().constData()<< + " number of elements "<tmflo=new med_float[taille]; //allocate memory + for (int i=0; itmflo[i]=-1e0; + fread(tab->tmflo,sizeof(med_float),taille,fichier); + /*for (int i=0; itmflo[i]<<"/"; + std::cout<size=-tab->size; + return tab; } //************************************ bool ghs3dprl_mesh_wrap::test_msg_wrap() //tests sur resultats fichiers msg { - QString key1,key2,typ="FA VE ED EL"; //pour faces vertice edges elements - CVWtab *tab1,*tab2; - bool ok=TRUE; - //test send=receive - //numerotations locales sont identiques - long nb=typ.contains(' ',TRUE) + 1; //nb chiffres detectes - for (long i=0; i < nb; i++) - for (long ifile=1; ifile <= this->nbfiles; ifile++) - for (long ineig=1; ineig <= this->nbfiles; ineig++) - { - if (ifile==ineig) continue; //impossible - key1=key1.sprintf("MS%ld NE%ld ",ifile,ineig)+typ.section(' ',i,i)+" SE"; - key2=key2.sprintf("MS%ld NE%ld ",ifile,ineig)+typ.section(' ',i,i)+" RE"; - //cout<<"key "<restore_key(key1); - //tab1=this->mestab[key1]; - tab2=this->restore_key(key2); - //tab2=this->mestab[key2]; - //cout<<"sortie key "<nbfiles; ifile++) + { + for (long ineig=1; ineig <= this->nbfiles; ineig++) { - if (!tab2) - { cout<<"key "<is_equal(tab2)) - { cout<<"key "<restore_key(key1); + //tab1=this->mestab[key1]; + tab2=this->restore_key(key2); + //tab2=this->mestab[key2]; + //std::cout<<"sortie key "<is_equal(tab2)) + { + std::cout<<"key "<nbfiles; ifile++) - for (long ineig=ifile+1; ineig <= this->nbfiles; ineig++) - { - if (ifile==ineig) continue; //cas impossible - key1=key1.sprintf("MS%ld NE%ld ",ifile,ineig)+typ.section(' ',i,i)+" SE"; - tab1=this->restore_key(key1); //tab1=this->mestab[key1]; - key2=key2.sprintf("MS%ld NE%ld ",ineig,ifile)+typ.section(' ',i,i)+" SE"; - tab2=this->restore_key(key2); //tab2=this->mestab[key2]; - if (!tab1 && !tab2) continue; //case not neighbours - if (!tab1) - { cout<<"key "<nbfiles; ifile++) + { + for (long ineig=ifile+1; ineig <= this->nbfiles; ineig++) { - if (!tab2) - { cout<<"key "<type!=tab2->type)||(tab1->size!=tab2->size)) - { cout<<"key "<restore_key(key1); //tab1=this->mestab[key1]; + key2=key2.sprintf("MS%ld NE%ld ",ineig,ifile)+typ.section(' ',i,i)+" SE"; + tab2=this->restore_key(key2); //tab2=this->mestab[key2]; + if (!tab1 && !tab2) continue; //case not neighbours + if (!tab1) + { + std::cout<<"key "<type!=tab2->type)||(tab1->size!=tab2->size)) + { + std::cout<<"key "<nbfiles; ifile++) - //for (int ineig=ifile+1; ineig <= this->nbfiles; ineig++) - for (int ifile=this->nbfiles; ifile >= 1; ifile--) - for (int ineig=this->nbfiles; ineig >= ifile+1; ineig--) - { + QString key1,key2,key11,key22,key11old,key22old; + CVWtab *tab1,*tab2,*tab11,*tab22; + bool ok=true; + key11old="_NO_KEY";key22old="_NO_KEY"; + //test size neighbourg=ifile + //numerotations locales sont differentes mais de tailles identiques + //pas besoin de verifier " RE " car deja fait au dessus + //for (int ifile=1; ifile <= this->nbfiles; ifile++) + //for (int ineig=ifile+1; ineig <= this->nbfiles; ineig++) + for (int ifile=this->nbfiles; ifile >= 1; ifile--) + { + for (int ineig=this->nbfiles; ineig >= ifile+1; ineig--) + { if (ifile==ineig) continue; //cas impossible key1=key1.sprintf("MS%d NE%d VE SE",ifile,ineig); key11=key11.sprintf("NB%d VC",ifile); @@ -847,477 +869,478 @@ bool ghs3dprl_mesh_wrap::test_vertices_wrap() if (!tab1 && !tab2) continue; //cas non voisins if (!tab1) { - cerr<<"TestEqualityCoordinates key "<size!=tab2->size) { - cerr<<"TestEqualityCoordinates key "<SwapOutOfMemory_key_mesh_wrap(QRegExp(key11old,TRUE,FALSE)); - if ((key22old!=key11)&&(key22old!=key22)) - this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key22old,TRUE,FALSE)); - - tab11=this->restore_key(key11); //tab11=this->mestab[key11]; - tab22=this->restore_key(key22); //tab22=this->mestab[key22]; - long i1,i2; - bool ok1=TRUE; - //test on equality of xyz_coordinates of commons vertices - for (long j=0; j < tab1->size-1; j++) - { - i1=tab1->tmint[j]; - i2=tab2->tmint[j]; - //1 for print vertices not equals - if (!CVW_is_equal_vertices(tab11,i1,tab22,i2,1)) - { - cerr<verbose>2)&&(ok1)) - cout<<"TestEqualityCoordinates "<size<< - " Vertices "<size<< - " Vertices "<SwapOutOfMemory_key_mesh_wrap(QRegExp(key11old)); + if ((key22old!=key11)&&(key22old!=key22)) + this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key22old)); + + tab11=this->restore_key(key11); //tab11=this->mestab[key11]; + tab22=this->restore_key(key22); //tab22=this->mestab[key22]; + long i1,i2; + bool ok1=true; + //test on equality of xyz_coordinates of commons vertices + for (long j=0; j < tab1->size-1; j++) + { + i1=tab1->tmint[j]; + i2=tab2->tmint[j]; + //1 for print vertices not equals + if (!CVW_is_equal_vertices(tab11,i1,tab22,i2,1)) + { + std::cerr<verbose>2)&&(ok1)) + std::cout<<"TestEqualityCoordinates "<size<< + " Vertices "<size<< + " Vertices "<SwapOutOfMemory_key_mesh_wrap(QRegExp(key11old,TRUE,FALSE)); - this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key22old,TRUE,FALSE)); - return ok; + } + } + //Swap out of memory (supposed no use?) + //NO because NB1&NB2 VC supposed future use + //YES precaution + this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key11old)); + this->SwapOutOfMemory_key_mesh_wrap(QRegExp(key22old)); + return ok; } //************************************ bool ghs3dprl_mesh_wrap::Write_MEDfiles() { - bool ok=FALSE,oklocal; - QString key1,tmp,filename; - CVWtab *tab1,*tab2; - med_err err; - char namelocal[MED_TAILLE_NOM+1]; //no more 32 - char distfilename[MED_TAILLE_DESC+1]; - char description[MED_TAILLE_DESC+1]; - - //remove path - //precaution because casename->med_namelocal no more 32 character - //if path, in this->path. - //20 preserve for add postfixes "_idom" etc... - this->casename=this->casename.section('/',-1); - if (this->casename.length()>20) - { - cerr<<"CaseNameMed truncated (no more 20 characters)"<casename.truncate(20); - } - filename=this->path+this->casename; - ofstream file(filename); //master file - file<<"#MED Fichier V 2.3"<<" "<nbfiles; - long nbtetrastotal=0; - file<med_namelocal no more 32 character + //if path, in this->path. + //20 preserve for add postfixes "_idom" etc... + this->casename=this->casename.section('/',-1); + if (this->casename.length()>20) + { + std::cerr<<"CaseNameMed truncated (no more 20 characters)"<casename.truncate(20); + } + filename=this->path+this->casename; + std::ofstream file(filename.toLatin1().constData()); //master file + file<<"#MED Fichier V 2.3"<<" "<nbfiles; + long nbtetrastotal=0; + file<verbose>0) + { + if (this->verbose>2) std::cout<casename+"_%d").toLatin1().constData(),idom); + file<casename.toLatin1().constData()<<" "<verbose>4) std::cout<<"File "<restore_key(key1); //tab1=this->mestab[key1]; + med_int nbnodes=tab1->size/3; + + /*(med_idt fid, char *maa, med_int mdim, med_float *coo, + med_mode_switch mode_switch, med_int n, + med_repere type_rep, char *nom, char *unit)*/ + err=MEDcoordEcr(fid,namelocal,3,tab1->tmflo,MED_FULL_INTERLACE, + nbnodes,MED_CART,nomcoo,unicoo); + if (err<0) std::cerr<<"Problem MEDcoordEcr"<verbose>4)std::cout<<"NumberOfNodes="<SwapOutOfMemory_key_mesh_wrap(QRegExp(key1)); + + //writing indices of nodes + med_int *arrayi=new med_int[nbnodes]; + for (long i=0; irestore_key(key1); //tab1=this->mestab[key1]; + med_int nbfaces=tab1->size/7; + if (this->verbose>4) std::cout<<"NumberOfTrianglesOfWrap="<tmint[i]; ii++; + arrayi[ii]=tab1->tmint[i+1]; ii++; + arrayi[ii]=tab1->tmint[i+2]; ii++; + i=i+7; + } + err=MEDconnEcr(fid,namelocal,3,arrayi,MED_FULL_INTERLACE,nbfaces,MED_FACE,MED_TRIA3,MED_NOD); + if (err<0) std::cerr<<"Problem MEDconnEcr for triangles connectivity"< arrayi[i]=!NBFACES!+i+1 + arrayi=new med_int[nbfaces]; + for (long i=0; i -numfam_ini_wrap-indice_of_neighbourg ([1;number_of_neighbourg]) + //(for existing joints) + int sizefamilies=nbfaces; + med_int *familiesi=new med_int[sizefamilies]; + for (int i=0; itmint[(i*7)+3]; + err=MEDfamEcr(fid,namelocal,arrayi,nbfaces,MED_FACE,MED_TRIA3); + if (err<0) std::cerr<<"Problem MEDfamEcr faces of wrap"<verbose>0) + //writing connectivity of tetraedes by nodes + key1=key1.sprintf("NB%d EV",idom); //files.NoBoite Elements Vertices (tetra only) + tab1=this->restore_key(key1); //tab1=this->mestab[key1]; + med_int nbtetras=tab1->size/4; + nbtetrastotal=nbtetrastotal + nbtetras; + std::cout<<"NumberOfTetraedes="<size]; + //for (long i=0; isize ; i++) arrayi[i]=tab1->tmint[i]; + err=MEDconnEcr(fid,namelocal,3,tab1->tmint,MED_FULL_INTERLACE,nbtetras,MED_MAILLE,MED_TETRA4,MED_NOD); + if (err<0) std::cerr<<"Problem MEDconnEcr for tetra connectivity"<SwapOutOfMemory_key_mesh_wrap(QRegExp(key1)); + + //writing indices of tetraedes + arrayi=new med_int[nbtetras]; + for (long i=0; irestore_key(key1); //tab1=this->mestab[key1]; + med_int nbwrap=tab1->size; + //families known in points in wrap + //more than 30 families is stupid? (too many)? + int itest,i2,ifam[30],imax=1,imess=0,numfam_ini_nodes=numfam_ini_wrap-100; + //caution numfam_ini_wrap!=numfam_ini_nodes + //ifam[:]<-existing values of nrs (in [0,97]) + //ifam[0]<-first family default=99 for new nodes IN volume (out of wrap) + ifam[0]=99; + for (int i=0; itmint[i]; + if ((itest<0)||(itest>97)) { - if (this->verbose>2) cout<casename+"_%d",idom); - file<casename<<" "<verbose>4) cout<<"File "<restore_key(key1); //tab1=this->mestab[key1]; - med_int nbnodes=tab1->size/3; - - /*(med_idt fid, char *maa, med_int mdim, med_float *coo, - med_mode_switch mode_switch, med_int n, - med_repere type_rep, char *nom, char *unit)*/ - err=MEDcoordEcr(fid,namelocal,3,tab1->tmflo,MED_FULL_INTERLACE, - nbnodes,MED_CART,nomcoo,unicoo); - if (err<0) cerr<<"Problem MEDcoordEcr"<verbose>4)cout<<"NumberOfNodes="<SwapOutOfMemory_key_mesh_wrap(QRegExp(key1,TRUE,FALSE)); - - //writing indices of nodes - med_int *arrayi=new med_int[nbnodes]; - for (long i=0; irestore_key(key1); //tab1=this->mestab[key1]; - med_int nbfaces=tab1->size/7; - if (this->verbose>4) cout<<"NumberOfTrianglesOfWrap="<tmint[i]; ii++; - arrayi[ii]=tab1->tmint[i+1]; ii++; - arrayi[ii]=tab1->tmint[i+2]; ii++; - i=i+7; + if (i2==imax) + { + ifam[imax]=itest ; imax++ ; break; + } + if (itest==ifam[i2]) break; + i2++; + if (i2>=30) break; } - err=MEDconnEcr(fid,namelocal,3,arrayi,MED_FULL_INTERLACE,nbfaces,MED_FACE,MED_TRIA3,MED_NOD); - if (err<0) cerr<<"Problem MEDconnEcr for triangles connectivity"< arrayi[i]=!NBFACES!+i+1 - arrayi=new med_int[nbfaces]; - for (long i=0; i=30) { + std::cerr<<"Problem more than 30 families of nodes"<verbose>2) std::cout<<"CreateFamilyOfNodes_"<verbose>4) std::cout<<"MEDfamCr (nodes) of "< -numfam_ini_wrap-indice_of_neighbourg ([1;number_of_neighbourg]) - //(for existing joints) - int sizefamilies=nbfaces; - med_int *familiesi=new med_int[sizefamilies]; - for (int i=0; itmint[(i*7)+3]; - err=MEDfamEcr(fid,namelocal,arrayi,nbfaces,MED_FACE,MED_TRIA3); - if (err<0) cerr<<"Problem MEDfamEcr faces of wrap"<restore_key(key1); //tab1=this->mestab[key1]; - med_int nbtetras=tab1->size/4; - nbtetrastotal=nbtetrastotal + nbtetras; - cout<<"NumberOfTetraedes="<size]; - //for (long i=0; isize ; i++) arrayi[i]=tab1->tmint[i]; - err=MEDconnEcr(fid,namelocal,3,tab1->tmint,MED_FULL_INTERLACE,nbtetras,MED_MAILLE,MED_TETRA4,MED_NOD); - if (err<0) cerr<<"Problem MEDconnEcr for tetra connectivity"<SwapOutOfMemory_key_mesh_wrap(QRegExp(key1,TRUE,FALSE)); - - //writing indices of tetraedes - arrayi=new med_int[nbtetras]; - for (long i=0; irestore_key(key1); //tab1=this->mestab[key1]; + nbnodes=tab1->size; + if (this->verbose>2) + std::cout<<"CreateMEDglobalNumerotation_Nodes "<size<size ; i++) arrayi[i]=tab1->tmint[i]; + //med_2_2::med_geometrie_element toto=MED_POINT1; + //std::cout<<"MED_POINT1="<restore_key(key1); //tab1=this->mestab[key1]; + nbfaces=tab1->size; + //arrayi=new med_int[nbfaces]; + //for (int i=0; isize ; i++) arrayi[i]=tab1->tmint[i]; + if (this->verbose>2) + std::cout<<"CreateMEDglobalNumerotation_Faces "<size<tmint,nbfaces,MED_FACE,MED_TRIA3); + if (err<0) std::cerr<<"Problem MEDglobalNumEcr faces"<restore_key(key1); //tab1=this->mestab[key1]; + med_int nbtetrasglo=tab1->size; + if (nbtetrasglo!=nbtetras) + std::cerr<<"Problem incorrect size of tetraedes global numbering"<size ; i++) arrayi[i]=tab1->tmint[i]; + if (this->verbose>2) + std::cout<<"CreateMEDglobalNumerotation_Tetraedes "<size<tmint,nbtetrasglo,MED_MAILLE,MED_TETRA4); + if (err<0) std::cerr<<"Problem MEDglobalNumEcr tetraedes"<restore_key(key1); + if (!tab1) continue; //case (ifile,ineig) are not neighbours=>no joints + key1=key1.sprintf("MS%d NE%d VE RE",idom,ineig); //SE or RE + tab2=tab1; //tab2=this->restore_key(key1); //no need because equals + if (!tab2) std::cerr<<"Problem nodes joint with no in file .msg"<size; + + if (this->verbose>4) + std::cout<<"NumberOfNodesOfJoint_"<casename+"_%d",ineig)); + err=MEDjointCr(fid,namelocal,namejnt,descjnt,ineig,namedist); + if (err<0) std::cerr<<"Problem MEDjointCr"< equals tab1->tmint[i]==tab2->tmint[i] + arrayi[ii]=tab1->tmint[i]; ii++; + arrayi[ii]=tab2->tmint[i]; ii++; + } + err=MEDjointEcr(fid,namelocal,namejnt,arrayi,nbnodes, + MED_NOEUD,medgeoele0,MED_NOEUD,medgeoele0); + if (err<0) std::cerr<<"Problem MEDjointEcr nodes"<restore_key(key1); //tab1=this->mestab[key1]; - med_int nbwrap=tab1->size; - //families known in points in wrap - //more than 30 families is stupid? (too many)? - int itest,i2,ifam[30],imax=1,imess=0,numfam_ini_nodes=numfam_ini_wrap-100; - //caution numfam_ini_wrap!=numfam_ini_nodes - //ifam[:]<-existing values of nrs (in [0,97]) - //ifam[0]<-first family default=99 for new nodes IN volume (out of wrap) - ifam[0]=99; - for (int i=0; itmint[i]; - if ((itest<0)||(itest>97)) - { - if (imess==0) - { - cerr<<"Problem for domain "<=30) break; - } - if (imax>=30) { - cerr<<"Problem more than 30 families of nodes"<verbose>4) + std::cout<<"NumberOfTrianglesOfJoint_"<no joints } - for (int i=0 ; irestore_key(key1); //no need because equals + if (!tab2) std::cerr<<"Problem triangles joint send with no receive"<size; + + if (this->verbose>4) + std::cout<<"NumberOfTrianglesOfJoint_"<verbose>2) cout<<"CreateFamilyOfNodes_"<verbose>4) cout<<"MEDfamCr (nodes) of "< equals tab1->tmint[i]==tab2->tmint[i] + arrayi[ii]=tab1->tmint[i]; ii++; + familiesi[tab1->tmint[i]-1]=-numfam_ini_wrap-ineig; + arrayi[ii]=tab2->tmint[i]; ii++; + //std::cout<restore_key(key1); //tab1=this->mestab[key1]; - nbnodes=tab1->size; + + tmp=tmp.sprintf("JOINT_%d",ineig); + strcpy(nomfam,tmp.toLatin1().constData()); + + //err=MEDnumEcr(fid,nomfam,arrayi,nbtriangles,MED_FACE,MED_TRIA3); + //if (err<0) std::cerr<<"Problem MEDnumEcr of triangles of "<verbose>2) - cout<<"CreateMEDglobalNumerotation_Nodes "<size<size ; i++) arrayi[i]=tab1->tmint[i]; - //med_2_2::med_geometrie_element toto=MED_POINT1; - //cout<<"MED_POINT1="<verbose>4) std::cout<<"MEDfamCr (faces) of "<restore_key(key1); //tab1=this->mestab[key1]; - nbfaces=tab1->size; - //arrayi=new med_int[nbfaces]; - //for (int i=0; isize ; i++) arrayi[i]=tab1->tmint[i]; - if (this->verbose>2) - cout<<"CreateMEDglobalNumerotation_Faces "<size<tmint,nbfaces,MED_FACE,MED_TRIA3); - if (err<0) cerr<<"Problem MEDglobalNumEcr faces"<restore_key(key1); //tab1=this->mestab[key1]; - med_int nbtetrasglo=tab1->size; - if (nbtetrasglo!=nbtetras) - cerr<<"Problem incorrect size of tetraedes global numbering"<size ; i++) arrayi[i]=tab1->tmint[i]; - if (this->verbose>2) - cout<<"CreateMEDglobalNumerotation_Tetraedes "<size<tmint,nbtetrasglo,MED_MAILLE,MED_TETRA4); - if (err<0) cerr<<"Problem MEDglobalNumEcr tetraedes"<restore_key(key1); - if (!tab1) continue; //case (ifile,ineig) are not neighbours=>no joints - key1=key1.sprintf("MS%d NE%d VE RE",idom,ineig); //SE or RE - tab2=tab1; //tab2=this->restore_key(key1); //no need because equals - if (!tab2) cerr<<"Problem nodes joint with no in file .msg"<size; - - if (this->verbose>4) - cout<<"NumberOfNodesOfJoint_"<casename+"_%d",ineig)); - err=MEDjointCr(fid,namelocal,namejnt,descjnt,ineig,namedist); - if (err<0) cerr<<"Problem MEDjointCr"< equals tab1->tmint[i]==tab2->tmint[i] - arrayi[ii]=tab1->tmint[i]; ii++; - arrayi[ii]=tab2->tmint[i]; ii++; - } - err=MEDjointEcr(fid,namelocal,namejnt,arrayi,nbnodes, - MED_NOEUD,medgeoele0,MED_NOEUD,medgeoele0); - if (err<0) cerr<<"Problem MEDjointEcr nodes"<restore_key(key1); //tab1=this->mestab[key1]; - if (!tab1) - { - if (this->verbose>4) - cout<<"NumberOfTrianglesOfJoint_"<no joints - } - key1=key1.sprintf("MS%d NE%d FA RE",idom,ineig); //SE or RE? - tab2=tab1; //tab2=this->restore_key(key1); //no need because equals - if (!tab2) cerr<<"Problem triangles joint send with no receive"<size; - - if (this->verbose>4) - cout<<"NumberOfTrianglesOfJoint_"< equals tab1->tmint[i]==tab2->tmint[i] - arrayi[ii]=tab1->tmint[i]; ii++; - familiesi[tab1->tmint[i]-1]=-numfam_ini_wrap-ineig; - arrayi[ii]=tab2->tmint[i]; ii++; - //cout<verbose>2) - cout<<"CreateFamilyOfFaces_"<verbose>4) cout<<"MEDfamCr (faces) of "<tlong[(i*7)+3]; - err=MEDfamEcr(fid,namelocal,familiesi,sizefamilies,MED_FACE,MED_TRIA3); - if (err<0) cerr<<"Problem MEDfamEcr faces of all joints"<tlong[(i*7)+3]; + err=MEDfamEcr(fid,namelocal,familiesi,sizefamilies,MED_FACE,MED_TRIA3); + if (err<0) std::cerr<<"Problem MEDfamEcr faces of all joints"<0 && attrs.localName(0)==count) - { - neighbourscount=attrs.value(0).toLong(&ok, 10); - neighbourcourant=-1; - if (verbose) cout<0 && attrs.localName(0)==count) - { - nbcount=attrs.value(0).toLong(&ok, 10); - if (verbose) cout<0 && attrs.localName(0)==count) - { - nbcount=attrs.value(0).toLong(&ok, 10); - if (verbose) cout<0 && attrs.localName(0)==count) - { - nbcount=attrs.value(0).toLong(&ok, 10); - if (verbose) cout<0 && attrs.localName(0)==count) - { - nbcount=attrs.value(0).toLong(&ok, 10); - if (verbose) cout<0 && attrs.localName(0)==count) + { + neighbourscount=attrs.value(0).toLong(&ok, 10); + neighbourcourant=-1; + if (verbose) std::cout<0 && attrs.localName(0)==count) + { + nbcount=attrs.value(0).toLong(&ok, 10); + if (verbose) std::cout<0 && attrs.localName(0)==count) + { + nbcount=attrs.value(0).toLong(&ok, 10); + if (verbose) std::cout<0 && attrs.localName(0)==count) + { + nbcount=attrs.value(0).toLong(&ok, 10); + if (verbose) std::cout<0 && attrs.localName(0)==count) + { + nbcount=attrs.value(0).toLong(&ok, 10); + if (verbose) std::cout<nbfiles++; - return TRUE; - } - return TRUE; + indent.remove((uint)0,3); + if (verbose) std::cout<nbfiles++; + return true; + } + return true; } //************************************ bool ghs3dprl_msg_parser::characters(const QString &strini) { - bool ok; - med_int *tmint=NULL; - long nb=0; - //filtre rc,lf,tab et blancs successifs - QString str=strini.simplifyWhiteSpace(); - //if ( str.length() == 1 && str=="\n" ) - if (str.length()==0) - { - //cout<<"EMPTY_LINE_CR"<1) + else return true; + } + nb=str.count(' ',Qt::CaseSensitive) + 1; //nb chiffres detectes + if (nb>1) + { + //lecture vecteurs d'entiers separateur blanc + long i=0; + tmint=new med_int[nb]; + //printf("%staille attendue=%i taille vue=%i\n",(const char *)indent.toLatin1().constData(),nbcount,nb); + do + { + tmint[i]=str.section(' ',i,i).toLong(&ok); + //printf("tmint[%i]=%i\n",i,tmint[i]); + i++; + } while ((inofile,neighbourindice)+ - shorttypel+shortsendreceive; - tmp=tmp.simplifyWhiteSpace(); - ok=mailw->insert_key(tmp,montab); - return TRUE; + } + + } + //lecture ok stockage de tlong dans mailw.mestab + CVWtab *montab=new CVWtab(nb,tmint); + QString tmp; + /*std::cout<<"InsertKey type="<nofile,neighbourindice)+ + shorttypel+shortsendreceive; + tmp=tmp.simplified(); + ok=mailw->insert_key(tmp,montab); + return true; } diff --git a/src/tepal2med/ghs3dprl_msg_parser.h b/src/tepal2med/ghs3dprl_msg_parser.h index 7343d6e..dafc39c 100755 --- a/src/tepal2med/ghs3dprl_msg_parser.h +++ b/src/tepal2med/ghs3dprl_msg_parser.h @@ -1,24 +1,37 @@ +// Copyright (C) 2007-2008 OPEN CASCADE, CEA/DEN, EDF R&D +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// --- +// +// File : ghs3dprl_mesh_parser.h +// Author : Christian VAN WAMBEKE (CEA) (from Hexotic plugin Lioka RAZAFINDRAZAKA) +// +// --- #ifndef GHS3DPRL_MSG_PARSER_H #define GHS3DPRL_MSG_PARSER_H #include "ghs3dprl_mesh_wrap.h" -#include - -/*//Med File V 2.2 attributes -#undef MED_H -#undef MED_PROTO_H -namespace med_2_2 { - extern "C" { -#include -#include - } -} -*/ +#include class ghs3dprl_msg_parser : public QXmlDefaultHandler { -public: + public: bool startDocument(); bool startElement(const QString&, const QString&, diff --git a/src/tepal2med/tepal2med.cxx b/src/tepal2med/tepal2med.cxx index 827cc5e..48064a0 100755 --- a/src/tepal2med/tepal2med.cxx +++ b/src/tepal2med/tepal2med.cxx @@ -1,3 +1,28 @@ +// Copyright (C) 2007-2008 OPEN CASCADE, CEA/DEN, EDF R&D +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// --- +// +// File : tepal2med.cxx +// Author : Christian VAN WAMBEKE (CEA) (from Hexotic plugin Lioka RAZAFINDRAZAKA) +// +// --- + /* ** prog principal de test de ghs3dprl */ @@ -7,351 +32,351 @@ #include #include #include -#include "ghs3dprl_msg_parser.h" -#include #include -#include -#include - +#include +#include +#include -#include +#include "ghs3dprl_msg_parser.h" #include "dlg_ghs3dmain.h" -using namespace std; using namespace med_2_2; //************************************ int main(int argc, char **argv) { - bool ok,is_test,is_menu,is_launchtepal; - int nbfiles,nbelem_limit_swap,verbose; - QString casename,casenamemed,tmp,cmd,format; - QString version="V0.2 beta"; - - - if ((argc > 11)||(argc < 2)) - { - cerr<<"tepal2med "<6]] [Test|noTest] [Menu|noMenu] [LaunchTepal|noLaunchTepal] CaseNameMed\n"; - return 1; - } - casename=argv[1]; - tmp=argv[2]; - nbfiles=tmp.toLong(&ok,10); - if (!ok) - { - cerr<<"NumberOfFiles: an integer is expected\n\n"; + bool ok,is_test,is_menu,is_launchtepal; + int nbfiles,nbelem_limit_swap,verbose; + QString casename,casenamemed,tmp,cmd,format; + QString version="V0.2 beta"; + + if ((argc > 11)||(argc < 2)) + { + std::cerr<<"tepal2med "<6]] [Test|noTest] [Menu|noMenu] [LaunchTepal|noLaunchTepal] CaseNameMed\n"; + return 1; + } + casename=argv[1]; + tmp=argv[2]; + nbfiles=tmp.toLong(&ok,10); + if (!ok) + { + std::cerr<<"NumberOfFiles: an integer is expected\n\n"; + return 1; + } + if (nbfiles<=0) + { + std::cerr<<"NumberOfFiles: a positive integer is expected\n\n"; + return 1; + } + if (nbfiles>512) //delirium in 2007 + { + std::cerr<<"NumberOfFiles: a positive integer <= 512 is expected\n\n"; + return 1; + } + + //default 1GOctet/8(for double)/10(for arrays in memory at the same time) + nbelem_limit_swap=1000000000/8/10; + if (argc > 3) + { + tmp=argv[3]; + nbelem_limit_swap=tmp.toLong(&ok,10); + if (!ok) + { + std::cerr<<"LimitSwap: an integer is expected\n\n"; return 1; - } - if (nbfiles<=0) - { - cerr<<"NumberOfFiles: a positive integer is expected\n\n"; + } + if (nbelem_limit_swap<=0) + { + std::cerr<<"LimitSwap: a positive integer is expected\n\n"; return 1; - } - if (nbfiles>512) //delirium in 2007 - { - cerr<<"NumberOfFiles: a positive integer <= 512 is expected\n\n"; + } + } + + verbose=1; //default + if (argc > 4) + { + tmp=argv[4]; + verbose=tmp.toLong(&ok,10); + if (!ok) + { + std::cerr<<"Verbose: an integer is expected\n\n"; return 1; - } - - //default 1GOctet/8(for double)/10(for arrays in memory at the same time) - nbelem_limit_swap=1000000000/8/10; - if (argc > 3) - { - tmp=argv[3]; - nbelem_limit_swap=tmp.toLong(&ok,10); - if (!ok) - { - cerr<<"LimitSwap: an integer is expected\n\n"; - return 1; - } - if (nbelem_limit_swap<=0) - { - cerr<<"LimitSwap: a positive integer is expected\n\n"; - return 1; - } - } - - verbose=1; //default - if (argc > 4) - { - tmp=argv[4]; - verbose=tmp.toLong(&ok,10); - if (!ok) - { - cerr<<"Verbose: an integer is expected\n\n"; - return 1; - } - if (verbose<0) - { - cerr<<"Verbose: a positive integer is expected\n\n"; - return 1; - } - } - - is_test=FALSE; //default - if (argc > 5) - { - tmp=argv[5]; - if (tmp=="Test") is_test=TRUE; - } - - is_menu=FALSE; //default - if (argc > 6) - { - tmp=argv[6]; - if (tmp=="Menu") is_menu=TRUE; - } - - is_launchtepal=FALSE; //default - if (argc > 7) - { - tmp=argv[7]; - if (tmp=="LaunchTepal") is_launchtepal=TRUE; - } - - casenamemed=casename; - if (argc > 8) - { - casenamemed=argv[8]; - } - - // We must always have an application - if (is_menu) - { - QApplication a(argc,argv); - dlg_ghs3dmain *m = new dlg_ghs3dmain(); - a.setMainWidget(m); // It is our main widget - m->setCaption("tepal2med "+version); - m->show(); // Show it... - a.exec(); // And run! - cout<<"parameters "<value_KeepFiles<<" "<value_NbPart<value_Ok) return 1; - nbfiles=m->value_NbPart; - } - - QString path; - int n=casenamemed.contains('/'); - if (n>0) - path=casenamemed.section('/',-n-1,-2)+"/"; - else - path="./"; - casenamemed=casenamemed.section('/',-1); - if (casenamemed.length()>20) - { - cerr<<"CaseNameMed truncated (no more 20 characters)"< "+path+"tepal.log"; - cout<<"\nLaunchTepal Command = "<nbfiles=0; - mymailw->nbelem_limit_swap=nbelem_limit_swap; //for huge cases big array swap in huge binary files - mymailw->verbose=verbose; - mymailw->casename=casenamemed; - mymailw->path=path; - - ghs3dprl_msg_parser handler; - //constructor later maybe - //handler.verbose=TRUE; - handler.mailw=mymailw; - - QXmlSimpleReader reader; - reader.setContentHandler(&handler); - format=format.sprintf("%d",nbfiles); - int nbf=format.length(); - format=format.sprintf(".%%.%dd.%%.%dd",nbf,nbf); - //read files .msg - for (int i=1; i<=nbfiles; i++) - { - mymailw->nofile=i; - //tmp=casename+tmp.sprintf(".%d.%d.msg",nbfiles,i); - tmp=casename+tmp.sprintf(format,nbfiles,i)+".msg"; - if (verbose>0) cout<<"FileName="<0) - cout<<"NumberOfFilesMSGAcquired="<nbfiles<<"\n"; - if (mymailw->nbfiles != nbfiles) - { - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n"; + } + if (verbose<0) + { + std::cerr<<"Verbose: a positive integer is expected\n\n"; return 1; - } - - if (is_test) - { - ok=mymailw->test_msg_wrap(); - if (ok) - { - if (verbose>0) cout<<"\nResult_test_msg_wrap=ok\n\n"; - } - else - { - cerr<<"\nResult_test_msg_wrap=NO_OK!\n\n"; - return 1; - } - } - - //after verification remove unusued data - //"NE0 FI" for/from 1.0 - //after verification remove duplicates data - //for debug but don't do that because reliability - // and locality of datas files - //" RE " for duplicates - //int nb=mymailw->remove_key_mesh_wrap(QRegExp("( NE0 | RE)",TRUE,FALSE)); - - //because equals - int nb=0; - nb=mymailw->remove_key_mesh_wrap(QRegExp("RE",TRUE,FALSE)); - if (verbose>3) cout<<"NumberOfKeysRemoved="<3) ok=mymailw->list_keys_mesh_wrap(); - - //test read files .noboiteb - //tmp=casename+".noboiteb"; - //ok=mymailw->ReadFileNOBOITEB(tmp); - - //read files .noboite - //supposed big files - mymailw->nbfiles=0; - for (int i=1; i<=nbfiles; i++) - { - mymailw->nofile=i; - tmp=casename+tmp.sprintf(format,nbfiles,i)+".noboite"; - if (verbose>0) cout<<"FileName="<ReadFileNOBOITE(tmp); - //mymailw->SwapOutOfMemory_key_mesh_wrap(QRegExp("NB",TRUE,FALSE)); - } - if (verbose>0) - cout<<"NumberOfFilesNOBOITEAcquired="<nbfiles<<"\n"; - if (mymailw->nbfiles != nbfiles) - { - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n"; + } + } + + is_test=false; //default + if (argc > 5) + { + tmp=argv[5]; + if (tmp=="Test") is_test=true; + } + + is_menu=false; //default + if (argc > 6) + { + tmp=argv[6]; + if (tmp=="Menu") is_menu=true; + } + + is_launchtepal=false; //default + if (argc > 7) + { + tmp=argv[7]; + if (tmp=="LaunchTepal") is_launchtepal=true; + } + + casenamemed=casename; + if (argc > 8) + { + casenamemed=argv[8]; + } + + // We must always have an application + if (is_menu) + { + QApplication a(argc,argv); + dlg_ghs3dmain *m = new dlg_ghs3dmain(); + m->setWindowTitle("tepal2med 2.1"); + m->show(); + a.exec(); + if ( m->result() == QDialog::Accepted ) { + std::cout<<"parameters "<KeepFiles()<<" "<NbPart()<NbPart(); + } + else { return 1; - } - - if (is_test) - { - ok=mymailw->test_vertices_wrap(); - if (ok) - { - if (verbose>0) cout<<"\nResult_test_vertices_wrap=ok\n\n"; - } - else - { - cerr<<"\nResult_test_vertices_wrap=NO_OK!\n\n"; - return 1; - } - } - - //read files .faces - mymailw->nbfiles=0; - for (int i=1; i<=nbfiles; i++) - { - mymailw->nofile=i; - tmp=casename+tmp.sprintf(format,nbfiles,i)+".faces"; - if (verbose>0) cout<<"FileName="<ReadFileFACES(tmp); - } - if (verbose>0) - cout<<"NumberOfFilesFACESAcquired="<nbfiles<<"\n\n"; - if (mymailw->nbfiles != nbfiles) - { - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + } + delete m; + } + + QString path; + int n=casenamemed.count('/'); + if (n>0) + path=casenamemed.section('/',-n-1,-2)+"/"; + else + path="./"; + casenamemed=casenamemed.section('/',-1); + if (casenamemed.length()>20) + { + std::cerr<<"CaseNameMed truncated (no more 20 characters)"< "+path+"tepal.log"; + std::cout<<"\nLaunchTepal Command = "<nbfiles=0; + mymailw->nbelem_limit_swap=nbelem_limit_swap; //for huge cases big array swap in huge binary files + mymailw->verbose=verbose; + mymailw->casename=casenamemed; + mymailw->path=path; + + ghs3dprl_msg_parser handler; + //constructor later maybe + //handler.verbose=true; + handler.mailw=mymailw; + + QXmlSimpleReader reader; + reader.setContentHandler(&handler); + format=format.sprintf("%d",nbfiles); + int nbf=format.length(); + format=format.sprintf(".%%.%dd.%%.%dd",nbf,nbf); + //read files .msg + for (int i=1; i<=nbfiles; i++) + { + mymailw->nofile=i; + //tmp=casename+tmp.sprintf(".%d.%d.msg",nbfiles,i); + tmp=casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".msg"; + if (verbose>0) std::cout<<"FileName="<0) + std::cout<<"NumberOfFilesMSGAcquired="<nbfiles<<"\n"; + if (mymailw->nbfiles != nbfiles) + { + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n"; + return 1; + } + + if (is_test) + { + ok=mymailw->test_msg_wrap(); + if (ok) + { + if (verbose>0) std::cout<<"\nResult_test_msg_wrap=ok\n\n"; + } + else + { + std::cerr<<"\nResult_test_msg_wrap=NO_OK!\n\n"; return 1; - } - - //read files .points - mymailw->nbfiles=0; - for (int i=1; i<=nbfiles; i++) - { - mymailw->nofile=i; - tmp=casename+tmp.sprintf(format,nbfiles,i)+".points"; - if (verbose>0) cout<<"FileName="<ReadFilePOINTS(tmp); - } - if (verbose>0) - cout<<"NumberOfFilesPOINTSAcquired="<nbfiles<<"\n\n"; - if (mymailw->nbfiles != nbfiles) - { - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + } + } + + //after verification remove unusued data + //"NE0 FI" for/from 1.0 + //after verification remove duplicates data + //for debug but don't do that because reliability + // and locality of datas files + //" RE " for duplicates + //int nb=mymailw->remove_key_mesh_wrap(QRegExp("( NE0 | RE)",true,false)); + + //because equals + int nb=0; + nb=mymailw->remove_key_mesh_wrap(QRegExp("RE")); + if (verbose>3) std::cout<<"NumberOfKeysRemoved="<3) ok=mymailw->list_keys_mesh_wrap(); + + //test read files .noboiteb + //tmp=casename+".noboiteb"; + //ok=mymailw->ReadFileNOBOITEB(tmp); + + //read files .noboite + //supposed big files + mymailw->nbfiles=0; + for (int i=1; i<=nbfiles; i++) + { + mymailw->nofile=i; + tmp=casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".noboite"; + if (verbose>0) std::cout<<"FileName="<ReadFileNOBOITE(tmp); + //mymailw->SwapOutOfMemory_key_mesh_wrap(QRegExp("NB",true,false)); + } + if (verbose>0) + std::cout<<"NumberOfFilesNOBOITEAcquired="<nbfiles<<"\n"; + if (mymailw->nbfiles != nbfiles) + { + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n"; + return 1; + } + + if (is_test) + { + ok=mymailw->test_vertices_wrap(); + if (ok) + { + if (verbose>0) std::cout<<"\nResult_test_vertices_wrap=ok\n\n"; + } + else + { + std::cerr<<"\nResult_test_vertices_wrap=NO_OK!\n\n"; return 1; - } - - //read files .glo - //supposed big files big arrays so don't read with parser - mymailw->nbfiles=0; - for (int i=1; i<=nbfiles; i++) - { - mymailw->nofile=i; - tmp=casename+tmp.sprintf(format,nbfiles,i)+".glo"; - if (verbose>0) cout<<"FileName="<ReadFileGLO(tmp); - //mymailw->SwapOutOfMemory_key_mesh_wrap(QRegExp("GL",TRUE,FALSE)); - } - if (verbose>0) - cout<<"NumberOfFilesGLOAcquired="<nbfiles<<"\n\n"; - if (mymailw->nbfiles != nbfiles) - { - cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + } + } + + //read files .faces + mymailw->nbfiles=0; + for (int i=1; i<=nbfiles; i++) + { + mymailw->nofile=i; + tmp=casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".faces"; + if (verbose>0) std::cout<<"FileName="<ReadFileFACES(tmp); + } + if (verbose>0) + std::cout<<"NumberOfFilesFACESAcquired="<nbfiles<<"\n\n"; + if (mymailw->nbfiles != nbfiles) + { + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + return 1; + } + + //read files .points + mymailw->nbfiles=0; + for (int i=1; i<=nbfiles; i++) + { + mymailw->nofile=i; + tmp=casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".points"; + if (verbose>0) std::cout<<"FileName="<ReadFilePOINTS(tmp); + } + if (verbose>0) + std::cout<<"NumberOfFilesPOINTSAcquired="<nbfiles<<"\n\n"; + if (mymailw->nbfiles != nbfiles) + { + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; + return 1; + } + + //read files .glo + //supposed big files big arrays so don't read with parser + mymailw->nbfiles=0; + for (int i=1; i<=nbfiles; i++) + { + mymailw->nofile=i; + tmp=casename+tmp.sprintf(format.toLatin1().constData(),nbfiles,i)+".glo"; + if (verbose>0) std::cout<<"FileName="<ReadFileGLO(tmp); + //mymailw->SwapOutOfMemory_key_mesh_wrap(QRegExp("GL",true,false)); + } + if (verbose>0) + std::cout<<"NumberOfFilesGLOAcquired="<nbfiles<<"\n\n"; + if (mymailw->nbfiles != nbfiles) + { + std::cerr<<"NumberOfFiles != NumberOfFilesAcquired is unexpected\n\n"; return 1; - } - - /*exemples - ok=mymailw->list_keys_mesh_wrap(); - tmp="FA RE NE4 FI1"; - ok=mymailw->list_onekey_mesh_wrap(tmp); - tmp="FA SE NE4 FI1"; - ok=mymailw->list_onekey_mesh_wrap(tmp); - tmp="FA RE NE1 FI4"; - ok=mymailw->list_onekey_mesh_wrap(tmp); - tmp="FA SE NE1 FI4"; - ok=mymailw->list_onekey_mesh_wrap(tmp); - - tmp="FA RE NE4 FI1"; - ok=mymailw->list_onekey_mesh_wrap(tmp);*/ - - //test remove points (type 3) - //nb=mymailw->remove_key_mesh_wrap(QRegExp("PO",TRUE,FALSE)); - //cout<<"***remove_key_mesh_wrap*** remove nb="<list_keys_mesh_wrap(); - - ok=mymailw->Write_MEDfiles(); - //int nb=mymailw->remove_key_mesh_wrap(QRegExp(".",TRUE,FALSE)); - nb=mymailw->remove_all_keys_mesh_wrap(); - if (verbose>3) - cout<<"***remove_all_key_mesh_wrap*** "<list_keys_mesh_wrap(); + tmp="FA RE NE4 FI1"; + ok=mymailw->list_onekey_mesh_wrap(tmp); + tmp="FA SE NE4 FI1"; + ok=mymailw->list_onekey_mesh_wrap(tmp); + tmp="FA RE NE1 FI4"; + ok=mymailw->list_onekey_mesh_wrap(tmp); + tmp="FA SE NE1 FI4"; + ok=mymailw->list_onekey_mesh_wrap(tmp); + + tmp="FA RE NE4 FI1"; + ok=mymailw->list_onekey_mesh_wrap(tmp);*/ + + //test remove points (type 3) + //nb=mymailw->remove_key_mesh_wrap(QRegExp("PO",true,false)); + //std::cout<<"***remove_key_mesh_wrap*** remove nb="<list_keys_mesh_wrap(); + + ok=mymailw->Write_MEDfiles(); + //int nb=mymailw->remove_key_mesh_wrap(QRegExp(".",true,false)); + nb=mymailw->remove_all_keys_mesh_wrap(); + if (verbose>3) + std::cout<<"***remove_all_key_mesh_wrap*** "<