Transfert brutal des sources du module HOMARD

This commit is contained in:
Gérald NICOLAS 2020-05-20 17:28:22 +02:00
parent b4bc7656bb
commit a174b69248
114 changed files with 35840 additions and 0 deletions

View File

@ -276,6 +276,16 @@ MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC) MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
MARK_AS_ADVANCED(SALOME_SMESH_INSTALL_RES_DATA SALOME_SMESH_INSTALL_PLUGINS) MARK_AS_ADVANCED(SALOME_SMESH_INSTALL_RES_DATA SALOME_SMESH_INSTALL_PLUGINS)
# Specific to ADAPT:
# SET(SALOME_ADAPT_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/adapt" CACHE PATH
# "Install path: SALOME ADAPT specific data")
SET(SALOME_ADAPT_INSTALL_SAMPLES share/salome/adaptsamples CACHE PATH
"Install path: SALOME ADAPT samples")
SET(SALOME_ADAPT_INSTALL_TEST ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test CACHE PATH
"Install path: SALOME ADAPT Test files")
SET(SALOME_ADAPT_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/adapt" CACHE PATH
"Install path: SALOME ADAPT specific data")
# Accumulate environment variables for SMESH module # Accumulate environment variables for SMESH module
SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS} SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}

75
src/ADAPT/CMakeLists.txt Normal file
View File

@ -0,0 +1,75 @@
# Copyright (C) 2012-2020 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, or (at your option) any later version.
#
# 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
#
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
${KERNEL_INCLUDE_DIRS}
)
# additional preprocessor / compiler flags
ADD_DEFINITIONS(
${KERNEL_DEFINITIONS}
)
# libraries to link to
SET(_link_LIBRARIES
${KERNEL_SALOMELocalTrace}
)
# --- headers ---
# header files
SET(ADAPTImpl_HEADERS
HOMARD.hxx
HOMARD_Cas.hxx
HOMARD_Boundary.hxx
HOMARD_Hypothesis.hxx
HOMARD_Iteration.hxx
HOMARD_Zone.hxx
HOMARD_Gen.hxx
HOMARD_DriverTools.hxx
HOMARD_YACS.hxx
HomardDriver.hxx
YACSDriver.hxx
)
# --- sources ---
# sources / static
SET(ADAPTImpl_SOURCES
HOMARD_Cas.cxx
HOMARD_Boundary.cxx
HOMARD_Hypothesis.cxx
HOMARD_Iteration.cxx
HOMARD_Zone.cxx
HOMARD_Gen.cxx
HOMARD_DriverTools.cxx
HOMARD_YACS.cxx
HomardDriver.cxx
YACSDriver.cxx
)
# --- rules ---
ADD_LIBRARY(ADAPTImpl ${ADAPTImpl_SOURCES})
TARGET_LINK_LIBRARIES(ADAPTImpl ${_link_LIBRARIES} )
INSTALL(TARGETS ADAPTImpl EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${ADAPTImpl_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})

53
src/ADAPT/HOMARD.hxx Normal file
View File

@ -0,0 +1,53 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD.hxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
#ifndef _HOMARD_HXX_
#define _HOMARD_HXX_
// C'est le ASSERT de SALOMELocalTrace/utilities.h dans KERNEL
#ifndef VERIFICATION
#define VERIFICATION(condition) \
if (!(condition)){INTERRUPTION("CONDITION "<<#condition<<" NOT VERIFIED")}
#endif /* VERIFICATION */
#ifdef WIN32
#if defined HOMARDIMPL_EXPORTS || defined HOMARDImpl_EXPORTS
#define HOMARDIMPL_EXPORT __declspec( dllexport )
#else
#define HOMARDIMPL_EXPORT __declspec( dllimport )
#endif
#else
#define HOMARDIMPL_EXPORT
#endif
// La gestion des repertoires
#ifndef CHDIR
#ifdef WIN32
#define CHDIR _chdir
#else
#define CHDIR chdir
#endif
#endif
#endif

View File

@ -0,0 +1,324 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Boundary.cxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#include "HOMARD_Boundary.hxx"
#include "HOMARD.hxx"
#include "utilities.h"
//=============================================================================
/*!
* default constructor:
*/
//=============================================================================
HOMARD_Boundary::HOMARD_Boundary():
_Name( "" ),_Type( 1 ),
_Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
_Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ),
_Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ),
_Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
{
MESSAGE("HOMARD_Boundary");
}
//=============================================================================
HOMARD_Boundary::~HOMARD_Boundary()
{
MESSAGE("~HOMARD_Boundary");
}
//=============================================================================
//=============================================================================
// Generalites
//=============================================================================
//=============================================================================
void HOMARD_Boundary::SetName( const char* Name )
{
_Name = std::string( Name );
}
//=============================================================================
std::string HOMARD_Boundary::GetName() const
{
return _Name;
}
//=============================================================================
std::string HOMARD_Boundary::GetDumpPython() const
{
std::ostringstream aScript;
aScript << "\n# Creation of the ";
//
switch (_Type)
{
case -1:
{
aScript << "CAO boundary " << _Name << "\n";
aScript << "\t" << _Name << " = homard.CreateBoundaryCAO(\"" << _Name << "\", ";
aScript << "\"" << _DataFile << "\")\n";
break ;
}
case 0:
{
aScript << "discrete boundary " << _Name << "\n";
aScript << "\t" << _Name << " = homard.CreateBoundaryDi(\"" << _Name << "\", ";
aScript << "\"" << _MeshName << "\", ";
aScript << "\"" << _DataFile << "\")\n";
break ;
}
case 1:
{
aScript << "cylinder " << _Name << "\n";
aScript << "\t" << _Name << " = homard.CreateBoundaryCylinder(\"" << _Name << "\", ";
aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n";
break ;
}
case 2:
{
aScript << "sphere " << _Name << "\n";
aScript << "\t" << _Name << " = homard.CreateBoundarySphere(\"" << _Name << "\", ";
aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
break ;
}
case 3:
{
aScript << "cone " << _Name << "\n";
aScript << "\t" << _Name << " = homard.CreateBoundaryConeA(\"" << _Name << "\", ";
aScript << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Angle << ", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ")\n";
break ;
}
case 4:
{
aScript << "cone " << _Name << "\n";
aScript << "\t" << _Name << " = homard.CreateBoundaryConeR(\"" << _Name << "\", ";
aScript << _Xcentre1 << ", " << _Ycentre1 << ", " << _Zcentre1 << ", " << _Rayon1 << ", " << _Xcentre2 << ", " << _Ycentre2 << ", " << _Zcentre2 << ", " << _Rayon2 << ")\n";
break ;
}
case 5:
{
aScript << "tore " << _Name << "\n";
aScript << "\t" << _Name << " = homard.CreateBoundaryTorus(\"" << _Name << "\", ";
aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon1 << ", " << _Rayon2 << ")\n";
break ;
}
}
return aScript.str();
}
//=============================================================================
//=============================================================================
// Caracteristiques
//=============================================================================
//=============================================================================
void HOMARD_Boundary::SetType( int Type )
{
_Type = Type;
}
//=============================================================================
int HOMARD_Boundary::GetType() const
{
return _Type;
}
//=============================================================================
void HOMARD_Boundary::SetMeshName( const char* MeshName )
{
_MeshName = std::string( MeshName );
}
//=============================================================================
std::string HOMARD_Boundary::GetMeshName() const
{
return _MeshName;
}
//=============================================================================
void HOMARD_Boundary::SetDataFile( const char* DataFile )
{
_DataFile = std::string( DataFile );
}
//=============================================================================
std::string HOMARD_Boundary::GetDataFile() const
{
return _DataFile;
}
//=======================================================================================
void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
double X3, double X4, double X5, double X6 )
{
_Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
_Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
_rayon = X6;
}
//======================================================================
void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 )
{
_Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
_rayon = X3;
}
//======================================================================
void HOMARD_Boundary::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
{
_Xcentre1 = Xcentre1; _Ycentre1 = Ycentre1; _Zcentre1 = Zcentre1;
_Rayon1 = Rayon1;
_Xcentre2 = Xcentre2; _Ycentre2 = Ycentre2; _Zcentre2 = Zcentre2;
_Rayon2 = Rayon2;
}
//======================================================================
void HOMARD_Boundary::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
double Xcentre, double Ycentre, double Zcentre)
{
_Xaxe = Xaxe; _Yaxe = Yaxe; _Zaxe = Zaxe;
_Angle = Angle;
_Xcentre = Xcentre; _Ycentre = Ycentre; _Zcentre = Zcentre;
}
//=======================================================================================
void HOMARD_Boundary::SetTorus( double X0, double X1, double X2,
double X3, double X4, double X5, double X6, double X7 )
{
_Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
_Xaxe = X3; _Yaxe = X4; _Zaxe = X5;
_Rayon1 = X6;
_Rayon2 = X7;
}
//=======================================================================================
std::vector<double> HOMARD_Boundary::GetCoords() const
{
std::vector<double> mesCoor;
//
switch (_Type)
{
// Cylindre
case 1:
{
mesCoor.push_back( _Xcentre );
mesCoor.push_back( _Ycentre );
mesCoor.push_back( _Zcentre );
mesCoor.push_back( _Xaxe );
mesCoor.push_back( _Yaxe );
mesCoor.push_back( _Zaxe );
mesCoor.push_back( _rayon );
break ;
}
// Sphere
case 2:
{
mesCoor.push_back( _Xcentre );
mesCoor.push_back( _Ycentre );
mesCoor.push_back( _Zcentre );
mesCoor.push_back( _rayon );
break ;
}
// Cone defini par un axe et un angle
case 3:
{
mesCoor.push_back( _Xaxe );
mesCoor.push_back( _Yaxe );
mesCoor.push_back( _Zaxe );
mesCoor.push_back( _Angle );
mesCoor.push_back( _Xcentre );
mesCoor.push_back( _Ycentre );
mesCoor.push_back( _Zcentre );
break ;
}
// Cone defini par les 2 rayons
case 4:
{
mesCoor.push_back( _Xcentre1 );
mesCoor.push_back( _Ycentre1 );
mesCoor.push_back( _Zcentre1 );
mesCoor.push_back( _Rayon1 );
mesCoor.push_back( _Xcentre2 );
mesCoor.push_back( _Ycentre2 );
mesCoor.push_back( _Zcentre2 );
mesCoor.push_back( _Rayon2 );
break ;
}
// Tore
case 5:
{
mesCoor.push_back( _Xcentre );
mesCoor.push_back( _Ycentre );
mesCoor.push_back( _Zcentre );
mesCoor.push_back( _Xaxe );
mesCoor.push_back( _Yaxe );
mesCoor.push_back( _Zaxe );
mesCoor.push_back( _Rayon1 );
mesCoor.push_back( _Rayon2 );
break ;
}
VERIFICATION( (_Type>=1) && (_Type<=5) ) ;
}
return mesCoor;
}
//======================================================================
void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 )
{
_Xincr = X0; _Yincr = X1; _Zincr = X2;
}
//=======================================================================================
std::vector<double> HOMARD_Boundary::GetLimit() const
{
std::vector<double> mesLimit;
mesLimit.push_back( _Xincr );
mesLimit.push_back( _Yincr );
mesLimit.push_back( _Zincr );
return mesLimit;
}
//=============================================================================
void HOMARD_Boundary::AddGroup( const char* Group)
{
_ListGroupSelected.push_back(Group);
}
//=============================================================================
void HOMARD_Boundary::SetGroups( const std::list<std::string>& ListGroup )
{
_ListGroupSelected.clear();
std::list<std::string>::const_iterator it = ListGroup.begin();
while(it != ListGroup.end())
_ListGroupSelected.push_back((*it++));
}
//=============================================================================
const std::list<std::string>& HOMARD_Boundary::GetGroups() const
{
return _ListGroupSelected;
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
{
_NomCasCreation = std::string( NomCasCreation );
}
//=============================================================================
std::string HOMARD_Boundary::GetCaseCreation() const
{
return _NomCasCreation;
}
//=============================================================================

View File

@ -0,0 +1,111 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Boundary.hxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#ifndef _HOMARD_Boundary_HXX_
#define _HOMARD_Boundary_HXX_
#include "HOMARD.hxx"
#include <vector>
#include <string>
#include <list>
#if defined WIN32
#pragma warning ( disable: 4251 )
#endif
class HOMARDIMPL_EXPORT HOMARD_Boundary
{
public:
HOMARD_Boundary();
~HOMARD_Boundary();
// Generalites
void SetName( const char* Name );
std::string GetName() const;
std::string GetDumpPython() const;
// Caracteristiques
void SetType( int Type );
int GetType() const;
void SetMeshName( const char* MeshName );
std::string GetMeshName() const;
void SetDataFile( const char* DataFile );
std::string GetDataFile() const;
void SetCylinder( double X0, double X1, double X2, double X3,
double X4, double X5, double X6 );
void SetSphere( double X0, double X1, double X2, double X3 );
void SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2);
void SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
double Xcentre, double Ycentre, double ZCentre);
void SetTorus( double X0, double X1, double X2, double X3,
double X4, double X5, double X6, double X7 );
std::vector<double> GetCoords() const;
void SetLimit( double X0, double X1, double X2 );
std::vector<double> GetLimit() const;
void AddGroup( const char* LeGroupe);
void SetGroups(const std::list<std::string>& ListGroup );
const std::list<std::string>& GetGroups() const;
// Liens avec les autres structures
std::string GetCaseCreation() const;
void SetCaseCreation( const char* NomCasCreation );
private:
std::string _Name;
std::string _NomCasCreation;
std::string _DataFile;
std::string _MeshName;
int _Type;
double _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax;
double _Xaxe, _Yaxe, _Zaxe;
double _Xcentre, _Ycentre, _Zcentre, _rayon;
double _Xincr, _Yincr, _Zincr;
double _Xcentre1, _Ycentre1, _Zcentre1, _Rayon1;
double _Xcentre2, _Ycentre2, _Zcentre2, _Rayon2;
double _Angle;
std::list<std::string> _ListGroupSelected;
};
#endif

283
src/ADAPT/HOMARD_Cas.cxx Normal file
View File

@ -0,0 +1,283 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Cas.cxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#include "HOMARD_Cas.hxx"
#include "utilities.h"
#include "HOMARD.hxx"
#include <iostream>
#include <sys/stat.h>
#ifndef WIN32
#include <unistd.h>
#else
#include <direct.h>
#endif
//=============================================================================
/*!
* default constructor:
* Par defaut, l'adaptation est conforme, sans suivi de frontiere
*/
//=============================================================================
HOMARD_Cas::HOMARD_Cas():
_Name(""), _NomDir("/tmp"), _ConfType(0), _ExtType(0)
{
MESSAGE("HOMARD_Cas");
}
//=============================================================================
HOMARD_Cas::~HOMARD_Cas()
//=============================================================================
{
MESSAGE("~HOMARD_Cas");
}
//=============================================================================
//=============================================================================
// Generalites
//=============================================================================
//=============================================================================
void HOMARD_Cas::SetName( const char* Name )
{
_Name = std::string( Name );
}
//=============================================================================
std::string HOMARD_Cas::GetName() const
{
return _Name;
}
//=============================================================================
std::string HOMARD_Cas::GetDumpPython() const
{
std::ostringstream aScript;
aScript << "\t" <<_Name << ".SetDirName(\"";
aScript << _NomDir << "\")\n";
aScript << "\t" <<_Name << ".SetConfType(";
aScript << _ConfType << ")\n";
aScript << "\t" <<_Name << ".SetExtType(";
aScript << _ExtType << ")\n";
// Suivi de frontieres
std::list<std::string>::const_iterator it = _ListBoundaryGroup.begin();
while(it != _ListBoundaryGroup.end())
{
aScript << "\t" <<_Name << ".AddBoundaryGroup(\"";
aScript << *it << "\", \"";
it++;
aScript << *it << "\")\n";
it++;
}
if ( _Pyram > 0 )
{
aScript << "\t" <<_Name << ".SetPyram(";
aScript << _Pyram << ")\n";
}
return aScript.str();
}
//=============================================================================
//=============================================================================
// Caracteristiques
//=============================================================================
//=============================================================================
int HOMARD_Cas::SetDirName( const char* NomDir )
{
// MESSAGE("SetDirName, NomDir : "<<NomDir);
// MESSAGE("SetDirName, _NomDir : "<<_NomDir);
int erreur = 0 ;
// On vérifie qu'aucun calcul n'a eu lieu pour ce cas
// MESSAGE("SetDirName, _ListIter.size() : "<<_ListIter.size());
if ( _ListIter.size() > 1 ) { erreur = 1 ; }
// Creation
if ( CHDIR(NomDir) == 0 )
{ _NomDir = std::string( NomDir ); }
else
{
#ifndef WIN32
if ( mkdir(NomDir, S_IRWXU|S_IRGRP|S_IXGRP) == 0 )
#else
if ( _mkdir(NomDir) == 0 )
#endif
{
if ( CHDIR(NomDir) == 0 ) { _NomDir = std::string( NomDir ); }
else { erreur = 2 ; }
}
else { erreur = 2 ; }
};
return erreur ;
}
//=============================================================================
std::string HOMARD_Cas::GetDirName() const
{
return _NomDir;
}
//=============================================================================
int HOMARD_Cas::GetNumberofIter()
{
return _ListIter.size();
}
//
// Le type de conformite ou non conformite
//
//=============================================================================
void HOMARD_Cas::SetConfType( int Conftype )
{
// VERIFICATION( (Conftype>=-2) && (Conftype<=3) );
_ConfType = Conftype;
}
//=============================================================================
const int HOMARD_Cas::GetConfType() const
{
return _ConfType;
}
//
// Le type exterieur
//
//=============================================================================
void HOMARD_Cas::SetExtType( int ExtType )
{
// VERIFICATION( (ExtType>=0) && (ExtType<=2) );
_ExtType = ExtType;
}
//=============================================================================
const int HOMARD_Cas::GetExtType() const
{
return _ExtType;
}
//
// La boite englobante
//
//=============================================================================
void HOMARD_Cas::SetBoundingBox( const std::vector<double>& extremas )
{
_Boite.clear();
_Boite.resize( extremas.size() );
for ( int i = 0; i < extremas.size(); i++ )
_Boite[i] = extremas[i];
}
//=============================================================================
const std::vector<double>& HOMARD_Cas::GetBoundingBox() const
{
return _Boite;
}
//
// Les groupes
//
//=============================================================================
void HOMARD_Cas::AddGroup( const char* Group )
{
_ListGroup.push_back(Group);
}
//=============================================================================
void HOMARD_Cas::SetGroups( const std::list<std::string>& ListGroup )
{
_ListGroup.clear();
std::list<std::string>::const_iterator it = ListGroup.begin();
while(it != ListGroup.end())
{
_ListGroup.push_back((*it++));
}
}
//=============================================================================
const std::list<std::string>& HOMARD_Cas::GetGroups() const
{
return _ListGroup;
}
//=============================================================================
void HOMARD_Cas::SupprGroups()
{
_ListGroup.clear();
}
//
// Les frontieres
//
//=============================================================================
void HOMARD_Cas::AddBoundary( const char* Boundary )
{
// MESSAGE ( ". HOMARD_Cas::AddBoundary : Boundary = " << Boundary );
const char* Group = "";
AddBoundaryGroup( Boundary, Group );
}
//=============================================================================
void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
{
// MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary );
// MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group );
_ListBoundaryGroup.push_back( Boundary );
_ListBoundaryGroup.push_back( Group );
}
//=============================================================================
const std::list<std::string>& HOMARD_Cas::GetBoundaryGroup() const
{
return _ListBoundaryGroup;
}
//=============================================================================
void HOMARD_Cas::SupprBoundaryGroup()
{
_ListBoundaryGroup.clear();
}
//=============================================================================
void HOMARD_Cas::SetPyram( int Pyram )
{
_Pyram = Pyram;
}
//=============================================================================
const int HOMARD_Cas::GetPyram() const
{
return _Pyram;
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
std::string HOMARD_Cas::GetIter0Name() const
{
// Par construction de la liste, l'iteration a ete mise en tete.
return (*(_ListIter.begin()));
}
//=============================================================================
void HOMARD_Cas::AddIteration( const char* NomIteration )
{
_ListIter.push_back( std::string( NomIteration ) );
}
//=============================================================================
const std::list<std::string>& HOMARD_Cas::GetIterations() const
{
return _ListIter;
}
//=============================================================================
void HOMARD_Cas::SupprIterations()
{
_ListIter.clear();
}

112
src/ADAPT/HOMARD_Cas.hxx Normal file
View File

@ -0,0 +1,112 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Cas.hxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#ifndef _HOMARD_CAS_HXX_
#define _HOMARD_CAS_HXX_
#include "HOMARD.hxx"
#include <string>
#include <list>
#include <vector>
#if defined WIN32
#pragma warning ( disable: 4251 )
#endif
class HOMARDIMPL_EXPORT HOMARD_Cas
{
public:
HOMARD_Cas();
~HOMARD_Cas();
// Generalites
void SetName( const char* Name );
std::string GetName() const;
std::string GetDumpPython() const;
// Caracteristiques
int SetDirName( const char* NomDir );
std::string GetDirName() const;
int GetNumberofIter();
void SetConfType( int ConfType );
const int GetConfType() const;
void SetExtType( int ExtType );
const int GetExtType() const;
void SetBoundingBox( const std::vector<double>& extremas );
const std::vector<double>& GetBoundingBox() const;
void AddGroup( const char* Group);
void SetGroups( const std::list<std::string>& ListGroup );
const std::list<std::string>& GetGroups() const;
void SupprGroups();
void AddBoundary( const char* Boundary );
void AddBoundaryGroup( const char* Boundary, const char* Group );
const std::list<std::string>& GetBoundaryGroup() const;
void SupprBoundaryGroup();
void SetPyram( int Pyram );
const int GetPyram() const;
// Liens avec les autres structures
std::string GetIter0Name() const;
void AddIteration( const char* NomIteration );
const std::list<std::string>& GetIterations() const;
void SupprIterations();
private:
std::string _Name;
std::string _NomDir;
int _ConfType;
int _ExtType;
int _Etat;
std::vector<double> _Boite; // cf HomardQTCommun pour structure du vecteur
std::list<std::string> _ListGroup;
std::list<std::string> _ListBoundaryGroup;
int _Pyram;
typedef std::string IterName;
typedef std::list<IterName> IterNames;
IterNames _ListIter;
};
#endif

View File

@ -0,0 +1,840 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_DriverTools.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
// ----------------------------------------------------------------------------
#include "HOMARD_DriverTools.hxx"
#include "HOMARD_Boundary.hxx"
#include "HOMARD_Cas.hxx"
#include "HOMARD_Hypothesis.hxx"
#include "HOMARD_Iteration.hxx"
#include "HOMARD_Zone.hxx"
#include "HOMARD_YACS.hxx"
#include <sstream>
#include <cstdlib>
#include "utilities.h"
namespace HOMARD
{
std::string SEPARATOR = "|" ;
/*!
\brief Read next chunk of data from the string
\internal
The function tries to read next chunk of the data from the input string \a str.
The parameter \a start specifies the start position of next chunk. If the operation
read the chunk successfully, after its completion this parameter will refer to the
start position of the next chunk. The function returns resulting chunk as a string.
The status of the operation is returned via \a ok parameter.
\param str source data stream string
\param start start position to get next chunk
\param ok in this variable the status of the chunk reading operation is returned
\return next chunk read from the string
*/
static std::string getNextChunk( const std::string& str, std::string::size_type& start, bool& ok )
{
std::string chunk = "";
ok = false;
if ( start <= str.size() ) {
std::string::size_type end = str.find( separator(), start );
chunk = str.substr( start, end == std::string::npos ? std::string::npos : end-start );
start = end == std::string::npos ? str.size()+1 : end + separator().size();
ok = true;
}
return chunk;
}
/*!
\brief Get persistence signature
\param type persistence entity type
\return persistence signature
*/
std::string GetSignature( SignatureType type )
{
std::string signature = "";
switch ( type ) {
case Case: signature = "CASE"; break;
case Zone: signature = "ZONE"; break;
case Hypothesis: signature = "HYPO"; break;
case Iteration: signature = "ITER"; break;
case Boundary: signature = "BOUNDARY"; break;
case YACS: signature = "YACS"; break;
default: break;
}
signature += separator();
return signature;
}
/*!
\brief Get data separator
\return string that is used to separate data entities in the stream
*/
std::string separator()
{
return SEPARATOR ;
}
// =======================
// 1.1. Case
// =======================
/*!
\brief Dump case to the string
\param cas case being dumped
\return string representation of the case
*/
std::string Dump( const HOMARD_Cas& cas )
{
std::stringstream os;
std::string saux ;
// ...
MESSAGE( ". Sauvegarde du cas "<<cas.GetName());
os << cas.GetName();
os << separator() << cas.GetDirName();
os << separator() << cas.GetConfType();
os << separator() << cas.GetExtType();
std::vector<double> coor = cas.GetBoundingBox();
os << separator() << coor.size();
for ( int i = 0; i < coor.size(); i++ )
os << separator() << coor[i];
std::list<std::string> ListString = cas.GetIterations();
os << separator() << ListString.size();
std::list<std::string>::const_iterator it;
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
ListString = cas.GetGroups();
os << separator() << ListString.size();
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
ListString = cas.GetBoundaryGroup();
os << separator() << ListString.size();
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
os << separator() << cas.GetPyram();
saux = os.str();
// MESSAGE( ". Fin avec "<<saux);
return saux ;
}
//
// ==============
// 1.2. Iteration
// ==============
//
/*!
\brief Dump iteration to the string
\param iteration iteration being dumped
\return string representation of the iteration
*/
std::string Dump( const HOMARD_Iteration& iteration )
{
std::stringstream os;
std::string saux ;
// ...
MESSAGE( ". Sauvegarde de l'iteration "<<iteration.GetName());
os << iteration.GetName();
os << separator() << iteration.GetState();
os << separator() << iteration.GetNumber();
os << separator() << iteration.GetMeshFile();
os << separator() << iteration.GetLogFile();
os << separator() << iteration.GetMeshName();
os << separator() << iteration.GetFieldFile();
os << separator() << iteration.GetTimeStep();
os << separator() << iteration.GetRank();
os << separator() << iteration.GetIterParentName();
//
std::list<std::string> ListString = iteration.GetIterations();
os << separator() << ListString.size();
std::list<std::string>::const_iterator it;
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
os << separator() << iteration.GetHypoName();
os << separator() << iteration.GetCaseName();
os << separator() << iteration.GetDirNameLoc();
saux = os.str();
// MESSAGE( ". Fin avec "<<saux);
return saux ;
}
//
// ==============
// 1.3. hypothese
// ==============
/*!
\brief Dump hypothesis to the string
\param hypothesis hypothesis being dumped
\return string representation of the hypothesis
*/
std::string Dump( const HOMARD_Hypothesis& hypothesis )
{
std::stringstream os;
std::string saux ;
// ...
MESSAGE( ". Sauvegarde de l'hypothese "<<hypothesis.GetName());
os << hypothesis.GetName();
os << separator() << hypothesis.GetCaseCreation();
os << separator() << hypothesis.GetAdapType();
os << separator() << hypothesis.GetRefinType();
os << separator() << hypothesis.GetUnRefType();
os << separator() << hypothesis.GetFieldName();
os << separator() << hypothesis.GetRefinThrType();
os << separator() << hypothesis.GetThreshR();
os << separator() << hypothesis.GetUnRefThrType();
os << separator() << hypothesis.GetThreshC();
os << separator() << hypothesis.GetUseField();
os << separator() << hypothesis.GetUseComp();
os << separator() << hypothesis.GetTypeFieldInterp();
std::list<std::string> ListString = hypothesis.GetIterations();
std::list<std::string>::const_iterator it;
os << separator() << ListString.size();
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
ListString = hypothesis.GetZones();
os << separator() << ListString.size();
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
ListString = hypothesis.GetComps();
os << separator() << ListString.size();
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
ListString = hypothesis.GetGroups();
os << separator() << ListString.size();
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
ListString = hypothesis.GetFieldInterps();
os << separator() << ListString.size();
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
os << separator() << hypothesis.GetNivMax();
os << separator() << hypothesis.GetDiamMin();
os << separator() << hypothesis.GetAdapInit();
os << separator() << hypothesis.GetExtraOutput();
saux = os.str();
// MESSAGE( ". Fin avec "<<saux);
return saux ;
}
//
// =========
// 1.4. Zone
// =========
/*!
\brief Dump zone to the string
\param zone zone being dumped
\return string representation of the zone
*/
std::string Dump( const HOMARD_Zone& zone )
{
std::stringstream os;
std::string saux ;
MESSAGE( ". Sauvegarde de la zone "<<zone.GetName());
os << zone.GetName();
os << separator() << zone.GetType();
std::vector<double> coords = zone.GetCoords();
for ( int i = 0; i < coords.size(); i++ )
os << separator() << ( i < coords.size() ? coords[i] : 0. );
std::vector<double> limit = zone.GetLimit();
for ( int i = 0; i < 3; i++ )
os << separator() << ( i < limit.size() ? limit[i] : 0. );
std::list<std::string> hypos = zone.GetHypo();
os << separator() << hypos.size();
std::list<std::string>::const_iterator it;
for ( it = hypos.begin(); it != hypos.end(); ++it )
os << separator() << *it;
saux = os.str();
// MESSAGE( ". Fin avec "<<saux);
return saux ;
}
//
// ==============================
// 1.5. Archivage d'une frontiere
// ==============================
/*!
\brief Dump boundary to the string
\param boundary boundary being dumped
\return string representation of the boundary
*/
std::string Dump( const HOMARD_Boundary& boundary )
{
std::stringstream os;
std::string saux ;
MESSAGE( ". Sauvegarde de la frontiere "<<boundary.GetName());
int BoundaryType = boundary.GetType() ;
os << boundary.GetName() ;
os << separator() << BoundaryType ;
os << separator() << boundary.GetCaseCreation() ;
if ( BoundaryType == -1 )
{
os << separator() << boundary.GetDataFile();
}
else if ( BoundaryType == 0 )
{
os << separator() << boundary.GetMeshName();
os << separator() << boundary.GetDataFile();
}
else {
std::vector<double> coor = boundary.GetCoords() ;
for ( int i = 0; i < coor.size(); i++ )
os << separator() << coor[i];
std::vector<double> limit = boundary.GetLimit();
for ( int i = 0; i < limit.size(); i++ )
os << separator() << limit[i];
}
std::list<std::string> ListString = boundary.GetGroups();
std::list<std::string>::const_iterator it;
os << separator() << ListString.size();
for ( it = ListString.begin(); it != ListString.end(); ++it )
os << separator() << *it;
saux = os.str();
// MESSAGE( ". Fin avec "<<saux);
return saux ;
}
//
// =========
// 1.6. YACS
// =========
/*!
\brief Dump YACS to the string
\param yacs yacs being dumped
\return string representation of the zone
*/
std::string Dump( const HOMARD_YACS& yacs )
{
std::stringstream os;
std::string saux ;
MESSAGE( ". Sauvegarde du schema YACS "<<yacs.GetName());
os << yacs.GetName();
os << separator() << yacs.GetType();
saux = os.str();
// MESSAGE( ". Fin avec "<<saux);
return saux ;
}
//
// 2. Restauration des objets
// ==========================
// 2.1. Case
// ==========================
//
/*!
\brief Restore case from the string
\param cas case being restored
\param stream string representation of the case
\return \c true if case is correctly restored or \c false otherwise
*/
bool Restore( HOMARD_Cas& cas, const std::string& stream )
{
MESSAGE( ". Restoration du cas ");
std::string::size_type start = 0;
std::string chunk, chunkNext;
bool ok;
// ...
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
cas.SetName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
cas.SetDirName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
cas.SetConfType( atoi( chunk.c_str() ) );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
cas.SetExtType( atoi( chunk.c_str() ) );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int size = atoi( chunk.c_str() );
std::vector<double> boite;
boite.resize( size );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
boite[i] = strtod( chunk.c_str(), 0 );
}
cas.SetBoundingBox( boite );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
cas.AddIteration( chunk.c_str() );
}
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ )
{
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
cas.AddGroup( chunk.c_str() );
}
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
i++;
chunkNext = getNextChunk( stream, start, ok );
if ( !ok ) return false;
cas.AddBoundaryGroup( chunk.c_str(), chunkNext.c_str() );
}
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
cas.SetPyram( atoi( chunk.c_str() ) );
return true;
}
//
// ==============
// 2.2. Iteration
// ==============
/*!
\brief Restore iteration from the string
\param iteration iteration being restored
\param stream string representation of the iteration
\return \c true if iteration is correctly restored or \c false otherwise
*/
bool Restore( HOMARD_Iteration& iteration, const std::string& stream )
{
std::string::size_type start = 0;
std::string chunk;
bool ok;
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetState( atoi( chunk.c_str() ) );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetNumber( atoi( chunk.c_str() ) );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetMeshFile( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetLogFile( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetMeshName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetFieldFile( chunk.c_str() );
// .
int timestep, rank;
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
timestep = atoi( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
rank = atoi( chunk.c_str() );
iteration.SetTimeStepRank( timestep, rank );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetIterParentName( chunk.c_str() );
//
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.LinkNextIteration( chunk.c_str() );
}
//
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetHypoName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetCaseName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
iteration.SetDirNameLoc( chunk.c_str() );
return true;
}
//
// ==============
// 2.3. hypothese
// ==============
/*!
\brief Restore hypothesis from the string
\param hypothesis hypothesis being restored
\param stream string representation of the hypothesis
\return \c true if hypothesis is correctly restored or \c false otherwise
*/
bool Restore( HOMARD_Hypothesis& hypothesis, const std::string& stream )
{
std::string::size_type start = 0;
std::string chunk, chunkNext;
bool ok;
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetCaseCreation( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetAdapType( atoi( chunk.c_str() ) );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int typeraff = atoi( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int typedera = atoi( chunk.c_str() );
hypothesis.SetRefinTypeDera( typeraff, typedera );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetField( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int typethr = atoi( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
double threshr = strtod( chunk.c_str(), 0 );
hypothesis.SetRefinThr( typethr, threshr );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int typethc = atoi( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
double threshc = strtod( chunk.c_str(), 0 );
hypothesis.SetUnRefThr( typethc, threshc );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetUseField(atoi(chunk.c_str()));
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetUseComp(atoi(chunk.c_str()));
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetTypeFieldInterp(atoi(chunk.c_str()));
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.LinkIteration( chunk.c_str() );
}
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
i++;
chunkNext = getNextChunk( stream, start, ok );
int typeuse = atoi( chunkNext.c_str() );
if ( !ok ) return false;
hypothesis.AddZone( chunk.c_str(), typeuse );
}
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.AddComp( chunk.c_str() );
}
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.AddGroup( chunk.c_str() );
}
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
i++;
chunkNext = getNextChunk( stream, start, ok );
int TypeInterp = atoi( chunkNext.c_str() );
if ( !ok ) return false;
hypothesis.AddFieldInterpType( chunk.c_str(), TypeInterp );
}
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetNivMax( atoi( chunk.c_str() ) );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetDiamMin( strtod( chunk.c_str(), 0 ) );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetAdapInit( strtod( chunk.c_str(), 0 ) );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
hypothesis.SetExtraOutput( strtod( chunk.c_str(), 0 ) );
return true;
}
//
// =========
// 2.4. Zone
// =========
/*!
\brief Restore zone from the string
\param zone zone being restored
\param stream string representation of the zone
\return \c true if zone is correctly restored or \c false otherwise
*/
bool Restore( HOMARD_Zone& zone, const std::string& stream )
{
std::string::size_type start = 0;
std::string chunk;
bool ok;
//
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
zone.SetName( chunk.c_str() );
//
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int ZoneType = atoi( chunk.c_str() ) ;
zone.SetType( ZoneType );
// Les coordonnees des zones : le nombre depend du type
std::vector<double> coords;
int lgcoords ;
if ( ZoneType == 2 || ( ZoneType >= 11 && ZoneType <= 13 ) ) { lgcoords = 6 ; }
else if ( ZoneType == 4 ) { lgcoords = 4 ; }
else if ( ZoneType == 5 || ( ZoneType >= 31 && ZoneType <= 33 ) ) { lgcoords = 8 ; }
else if ( ZoneType == 7 || ( ZoneType >= 61 && ZoneType <= 63 ) ) { lgcoords = 9 ; }
else return false;
coords.resize( lgcoords );
for ( int i = 0; i < lgcoords; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
coords[i] = strtod( chunk.c_str(), 0 );
}
if ( ZoneType == 2 || ( ZoneType >= 11 && ZoneType <= 13 ) )
{ zone.SetBox( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5] ); }
else if ( ZoneType == 4 )
{ zone.SetSphere( coords[0], coords[1], coords[2], coords[3] ); }
else if ( ZoneType == 5 || ( ZoneType >= 31 && ZoneType <= 33 ) )
{ zone.SetCylinder( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7] ); }
else if ( ZoneType == 7 || ( ZoneType >= 61 && ZoneType <= 63 ) )
{ zone.SetPipe( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7], coords[8] ); }
// Remarque : la taille de coords est suffisante pour les limites
for ( int i = 0; i < 3; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
coords[i] = strtod( chunk.c_str(), 0 );
}
zone.SetLimit( coords[0], coords[1], coords[2]);
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
zone.AddHypo( chunk.c_str() );
}
return true;
}
//
// =================================
// 2.5. Restauration d'une frontiere
// =================================
/*!
\brief Restore boundary from the string
\param boundary boundary being restored
\param stream string representation of the boundary
\return \c true if the boundary is correctly restored or \c false otherwise
*/
bool Restore( HOMARD_Boundary& boundary, const std::string& stream )
{
std::string::size_type start = 0;
std::string chunk;
bool ok;
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
boundary.SetName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int BoundaryType = atoi( chunk.c_str() ) ;
boundary.SetType( BoundaryType );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
boundary.SetCaseCreation( chunk.c_str() );
// Si analytique, les coordonnees des frontieres : le nombre depend du type
// Si discret, le maillage
// Si CAO, la géométrie
int lgcoords ;
if ( BoundaryType == -1 ) { lgcoords = -1 ; }
else if ( BoundaryType == 1 ) { lgcoords = 7 ; }
else if ( BoundaryType == 2 ) { lgcoords = 4 ; }
else { lgcoords = 0 ; }
//
if ( lgcoords == -1 )
{
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
boundary.SetDataFile( chunk.c_str() );
}
else if ( lgcoords == 0 )
{
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
boundary.SetMeshName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
boundary.SetDataFile( chunk.c_str() );
}
else
{ std::vector<double> coords;
coords.resize( lgcoords );
for ( int i = 0; i < lgcoords; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
coords[i] = strtod( chunk.c_str(), 0 );
}
if ( BoundaryType == 1 )
{ boundary.SetCylinder(coords[0],coords[1],coords[2],coords[3],coords[4],coords[5],coords[6]); }
else if ( BoundaryType == 2 )
{ boundary.SetSphere( coords[0], coords[1], coords[2], coords[3]); }
else if ( BoundaryType == 3 )
{ boundary.SetConeA( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6]); }
else if ( BoundaryType == 4 )
{ boundary.SetConeR( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7]); }
// Remarque : la taille de coords est suffisante pour les limites
for ( int i = 0; i < 3; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
coords[i] = strtod( chunk.c_str(), 0 );
}
boundary.SetLimit( coords[0], coords[1], coords[2]);
}
// Les groupes
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int size = atoi( chunk.c_str() );
for ( int i = 0; i < size; i++ ) {
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
boundary.AddGroup( chunk.c_str() );
}
return true;
}
//
// ==================================
// 2.6. Restauration d'un schema YACS
// ==================================
/*!
\brief Restore a schema YACS from the string
\param yacs yacs being restored
\param stream string representation of the schema yacs
\return \c true if yacs is correctly restored or \c false otherwise
*/
bool Restore( HOMARD_YACS& yacs, const std::string& stream )
{
std::string::size_type start = 0;
std::string chunk;
bool ok;
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
yacs.SetName( chunk.c_str() );
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
int YACSType = atoi( chunk.c_str() ) ;
yacs.SetType( YACSType );
return true;
}
} // namespace HOMARD /end/

View File

@ -0,0 +1,76 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_DriverTools.hxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
// ----------------------------------------------------------------------------
#ifndef HOMARD_DRIVERTOOLS_H
#define HOMARD_DRIVERTOOLS_H
#include "HOMARD.hxx"
#include <string>
class HOMARD_Boundary;
class HOMARD_Cas;
class HOMARD_Iteration;
class HOMARD_Hypothesis;
class HOMARD_Zone;
class HOMARD_YACS;
namespace HOMARD
{
//! persistence entity type
typedef enum { Case, Zone, Hypothesis, Iteration, Boundary, YACS } SignatureType;
//! get persistence signature
HOMARDIMPL_EXPORT std::string GetSignature( SignatureType type );
//! get data separator
HOMARDIMPL_EXPORT std::string separator();
//! dump boundary to the string
HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_Boundary& boundary );
//! dump case to the string
HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_Cas& cas );
//! dump iteration to the string
HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_Iteration& iteration );
//! dump hypothesis to the string
HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_Hypothesis& hypothesis );
//! dump zone to the string
HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_Zone& zone );
//! dump yacs to the string
HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_YACS& yacs );
//! restore boundary from the string
HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Boundary& boundary, const std::string& stream );
//! restore case from the string
HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Cas& cas, const std::string& stream );
//! restore hypothesis from the string
HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Hypothesis& hypothesis, const std::string& stream );
//! restore iteration from the string
HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Iteration& iteration, const std::string& stream );
//! restore zone from the string
HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Zone& zone, const std::string& stream );
//! restore yacs from the string
HOMARDIMPL_EXPORT bool Restore( ::HOMARD_YACS& yacs, const std::string& stream );
};
#endif // HOMARD_DRIVERTOOLS_H

41
src/ADAPT/HOMARD_Gen.cxx Normal file
View File

@ -0,0 +1,41 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Gen.cxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
#include "HOMARD_Gen.hxx"
#include "utilities.h"
//=============================================================================
//=============================================================================
HOMARD_Gen::HOMARD_Gen()
{
MESSAGE("HOMARD_Gen");
}
//=============================================================================
//=============================================================================
HOMARD_Gen::~HOMARD_Gen()
{
MESSAGE("~HOMARD_Gen");
}
//=============================================================================

37
src/ADAPT/HOMARD_Gen.hxx Normal file
View File

@ -0,0 +1,37 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Gen.hxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
#ifndef _HOMARD_GEN_HXX_
#define _HOMARD_GEN_HXX_
#include "HOMARD.hxx"
class HOMARDIMPL_EXPORT HOMARD_Gen
{
public :
HOMARD_Gen();
~HOMARD_Gen();
};
#endif

View File

@ -0,0 +1,524 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Hypothesis.cxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#include "HOMARD_Hypothesis.hxx"
#include "HOMARD.hxx"
#include "utilities.h"
//=============================================================================
/*!
* default constructor:
*/
//=============================================================================
HOMARD_Hypothesis::HOMARD_Hypothesis():
_Name(""), _NomCasCreation(""),
_TypeAdap(-1), _TypeRaff(0), _TypeDera(0),
_Field(""),
_TypeThR(0), _ThreshR(0),
_TypeThC(0), _ThreshC(0),
_UsField(0), _UsCmpI(0), _TypeFieldInterp(0)
{
MESSAGE("HOMARD_Hypothesis");
}
//=============================================================================
/*!
*/
//=============================================================================
HOMARD_Hypothesis::~HOMARD_Hypothesis()
{
MESSAGE("~HOMARD_Hypothesis");
}
//=============================================================================
//=============================================================================
// Generalites
//=============================================================================
//=============================================================================
void HOMARD_Hypothesis::SetName( const char* Name )
{
_Name = std::string( Name );
}
//=============================================================================
std::string HOMARD_Hypothesis::GetName() const
{
return _Name;
}
//=============================================================================
std::string HOMARD_Hypothesis::GetDumpPython() const
{
std::ostringstream aScript;
aScript << "\n# Creation of the hypothesis " << _Name << "\n" ;
aScript << "\t" << _Name << " = homard.CreateHypothesis(\"" << _Name << "\")\n";
if ( _TypeAdap == -1 )
{
int TypeRaffDera ;
if ( _TypeRaff == 1 ) { TypeRaffDera = 1 ; }
else { TypeRaffDera = -1 ; }
aScript << "\t" << _Name << ".SetUnifRefinUnRef(" << TypeRaffDera << ")\n";
}
// Raffinement selon des zones geometriques
std::list<std::string>::const_iterator it = _ListZone.begin();
int TypeUse ;
while(it != _ListZone.end())
{
aScript << "\t" << _Name << ".AddZone(\"" << *it;
it++;
if ( *it == "1" ) { TypeUse = 1 ; }
else { TypeUse = -1 ; }
aScript << "\", " << TypeUse << ")\n";
it++;
}
// Raffinement selon un champ
if ( _TypeAdap == 1 )
{
aScript << "\t" << _Name << ".SetField(\"" << _Field << "\")\n";
aScript << "\t" << _Name << ".SetUseField(" << _UsField << ")\n";
aScript << "\t" << _Name << ".SetUseComp(" << _UsCmpI << ")\n";
std::list<std::string>::const_iterator it_comp = _ListComp.begin();
while(it_comp != _ListComp.end())
{
aScript << "\t" << _Name << ".AddComp(\"" << *it_comp << "\")\n";
it_comp++;
}
if ( _TypeRaff == 1 )
{
aScript << "\t" << _Name << ".SetRefinThr(" << _TypeThR << ", " << _ThreshR << ")\n";
}
if ( _TypeDera == 1 )
{
aScript << "\t" << _Name << ".SetUnRefThr(" << _TypeThC << ", " << _ThreshC << ")\n";
}
}
// Filtrage du raffinement par des groupes
for ( it=_ListGroupSelected.begin(); it!=_ListGroupSelected.end();it++)
aScript << "\t" << _Name << ".AddGroup(\"" << (*it) << "\")\n" ;
// Interpolation des champs
if ( _TypeFieldInterp == 2 )
{
std::list<std::string>::const_iterator it_champ = _ListFieldInterp.begin();
while(it_champ != _ListFieldInterp.end())
{
aScript << "\t" << _Name << ".AddFieldInterpType( \"" << *it_champ << "\" " ;
it_champ++;
aScript << ", " << *it_champ << ")\n";
it_champ++;
}
}
else if ( _TypeFieldInterp != 0 )
{
aScript << "\t" << _Name << ".SetTypeFieldInterp(" << _TypeFieldInterp << ")\n";
}
if ( _NivMax > 0 )
{
aScript << "\t" <<_Name << ".SetNivMax(" << _NivMax << ")\n";
}
if ( _DiamMin > 0 )
{
aScript << "\t" <<_Name << ".SetDiamMin(" << _DiamMin << ")\n";
}
if ( _AdapInit != 0 )
{
aScript << "\t" <<_Name << ".SetAdapInit(" << _AdapInit << ")\n";
}
if ( _ExtraOutput != 1 )
{
aScript << "\t" <<_Name << ".SetExtraOutput(" << _ExtraOutput << ")\n";
}
return aScript.str();
}
//=============================================================================
//=============================================================================
// Caracteristiques
//=============================================================================
//=============================================================================
void HOMARD_Hypothesis::SetAdapType( int TypeAdap )
{
VERIFICATION( (TypeAdap>=-1) && (TypeAdap<=1) );
_TypeAdap = TypeAdap;
}
//=============================================================================
int HOMARD_Hypothesis::GetAdapType() const
{
return _TypeAdap;
}
//=============================================================================
void HOMARD_Hypothesis::SetRefinTypeDera( int TypeRaff, int TypeDera )
{
VERIFICATION( (TypeRaff>=-1) && (TypeRaff<=1) );
_TypeRaff = TypeRaff;
VERIFICATION( (TypeDera>=-1) && (TypeDera<=1) );
_TypeDera = TypeDera;
}
//=============================================================================
int HOMARD_Hypothesis::GetRefinType() const
{
return _TypeRaff;
}
//=============================================================================
int HOMARD_Hypothesis::GetUnRefType() const
{
return _TypeDera;
}
//=============================================================================
void HOMARD_Hypothesis::SetField( const char* FieldName )
{
_Field = std::string( FieldName );
MESSAGE( "SetField : FieldName = " << FieldName );
}
//=============================================================================
std::string HOMARD_Hypothesis::GetFieldName() const
{
return _Field;
}
//=============================================================================
void HOMARD_Hypothesis::SetUseField( int UsField )
{
VERIFICATION( (UsField>=0) && (UsField<=1) );
_UsField = UsField;
}
//=============================================================================
int HOMARD_Hypothesis::GetUseField() const
{
return _UsField;
}
//=============================================================================
void HOMARD_Hypothesis::SetUseComp( int UsCmpI )
{
MESSAGE ("SetUseComp pour UsCmpI = "<<UsCmpI) ;
VERIFICATION( (UsCmpI>=0) && (UsCmpI<=2) );
_UsCmpI = UsCmpI;
}
//=============================================================================
int HOMARD_Hypothesis::GetUseComp() const
{
return _UsCmpI;
}
//=============================================================================
void HOMARD_Hypothesis::AddComp( const char* NomComp )
{
// On commence par supprimer la composante au cas ou elle aurait deja ete inseree
// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
// definition de l'hypothese
SupprComp( NomComp ) ;
// Insertion veritable
_ListComp.push_back( std::string( NomComp ) );
}
//=============================================================================
void HOMARD_Hypothesis::SupprComp( const char* NomComp )
{
MESSAGE ("SupprComp pour "<<NomComp) ;
std::list<std::string>::iterator it = find( _ListComp.begin(), _ListComp.end(), NomComp );
if ( it != _ListComp.end() ) { it = _ListComp.erase( it ); }
}
//=============================================================================
void HOMARD_Hypothesis::SupprComps()
{
_ListComp.clear();
}
//=============================================================================
const std::list<std::string>& HOMARD_Hypothesis::GetComps() const
{
return _ListComp;
}
//=============================================================================
void HOMARD_Hypothesis::SetRefinThr( int TypeThR, double ThreshR )
{
MESSAGE( "SetRefinThr : TypeThR = " << TypeThR << ", ThreshR = " << ThreshR );
VERIFICATION( (TypeThR>=0) && (TypeThR<=4) );
_TypeThR = TypeThR;
_ThreshR = ThreshR;
}
//=============================================================================
int HOMARD_Hypothesis::GetRefinThrType() const
{
return _TypeThR;
}
//=============================================================================
double HOMARD_Hypothesis::GetThreshR() const
{
return _ThreshR;
}
//=============================================================================
void HOMARD_Hypothesis::SetUnRefThr( int TypeThC, double ThreshC )
{
VERIFICATION( (TypeThC>=0) && (TypeThC<=4) );
_TypeThC = TypeThC;
_ThreshC = ThreshC;
}
//=============================================================================
int HOMARD_Hypothesis::GetUnRefThrType() const
{
return _TypeThC;
}
//=============================================================================
double HOMARD_Hypothesis::GetThreshC() const
{
return _ThreshC;
}
//=============================================================================
void HOMARD_Hypothesis::SetNivMax( int NivMax )
//=============================================================================
{
_NivMax = NivMax;
}
//=============================================================================
const int HOMARD_Hypothesis::GetNivMax() const
//=============================================================================
{
return _NivMax;
}
//=============================================================================
void HOMARD_Hypothesis::SetDiamMin( double DiamMin )
//=============================================================================
{
_DiamMin = DiamMin;
}
//=============================================================================
const double HOMARD_Hypothesis::GetDiamMin() const
//=============================================================================
{
return _DiamMin;
}
//=============================================================================
void HOMARD_Hypothesis::SetAdapInit( int AdapInit )
//=============================================================================
{
_AdapInit = AdapInit;
}
//=============================================================================
const int HOMARD_Hypothesis::GetAdapInit() const
//=============================================================================
{
return _AdapInit;
}
//=============================================================================
void HOMARD_Hypothesis::SetExtraOutput( int ExtraOutput )
//=============================================================================
{
_ExtraOutput = ExtraOutput;
}
//=============================================================================
const int HOMARD_Hypothesis::GetExtraOutput() const
//=============================================================================
{
return _ExtraOutput;
}
//=============================================================================
void HOMARD_Hypothesis::AddGroup( const char* Group)
{
// On commence par supprimer le groupe au cas ou il aurait deja ete insere
// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
// definition de l'hypothese
SupprGroup( Group ) ;
// Insertion veritable
_ListGroupSelected.push_back(Group);
}
//=============================================================================
void HOMARD_Hypothesis::SupprGroup( const char* Group )
{
MESSAGE ("SupprGroup pour "<<Group) ;
std::list<std::string>::iterator it = find( _ListGroupSelected.begin(), _ListGroupSelected.end(), Group );
if ( it != _ListGroupSelected.end() ) { it = _ListGroupSelected.erase( it ); }
}
//=============================================================================
void HOMARD_Hypothesis::SupprGroups()
{
_ListGroupSelected.clear();
}
//=============================================================================
void HOMARD_Hypothesis::SetGroups( const std::list<std::string>& ListGroup )
{
_ListGroupSelected.clear();
std::list<std::string>::const_iterator it = ListGroup.begin();
while(it != ListGroup.end())
_ListGroupSelected.push_back((*it++));
}
//=============================================================================
const std::list<std::string>& HOMARD_Hypothesis::GetGroups() const
{
return _ListGroupSelected;
}
//=============================================================================
// Type d'interpolation des champs :
// 0 : aucun champ n'est interpole
// 1 : tous les champs sont interpoles
// 2 : certains champs sont interpoles
void HOMARD_Hypothesis::SetTypeFieldInterp( int TypeFieldInterp )
{
VERIFICATION( (TypeFieldInterp>=0) && (TypeFieldInterp<=2) );
_TypeFieldInterp = TypeFieldInterp;
}
//=============================================================================
int HOMARD_Hypothesis::GetTypeFieldInterp() const
{
return _TypeFieldInterp;
}
//=============================================================================
void HOMARD_Hypothesis::AddFieldInterpType( const char* FieldInterp, int TypeInterp )
{
MESSAGE ("Dans AddFieldInterpType pour " << FieldInterp << " et TypeInterp = " << TypeInterp) ;
// On commence par supprimer le champ au cas ou il aurait deja ete insere
// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
// definition de l'hypothese
SupprFieldInterp( FieldInterp ) ;
// Insertion veritable
// . Nom du champ
_ListFieldInterp.push_back( std::string( FieldInterp ) );
// . Usage du champ
std::stringstream saux1 ;
saux1 << TypeInterp ;
_ListFieldInterp.push_back( saux1.str() );
// . Indication generale : certains champs sont a interpoler
SetTypeFieldInterp ( 2 ) ;
}
//=============================================================================
void HOMARD_Hypothesis::SupprFieldInterp( const char* FieldInterp )
{
MESSAGE ("Dans SupprFieldInterp pour " << FieldInterp) ;
std::list<std::string>::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp ) ;
// Attention a supprimer le nom du champ et le type d'usage
if ( it != _ListFieldInterp.end() )
{
it = _ListFieldInterp.erase( it ) ;
it = _ListFieldInterp.erase( it ) ;
}
// Decompte du nombre de champs restant a interpoler
it = _ListFieldInterp.begin() ;
int cpt = 0 ;
while(it != _ListFieldInterp.end())
{
cpt += 1 ;
(*it++);
}
MESSAGE("Nombre de champ restants = "<<cpt/2);
// . Indication generale : aucun champ ne reste a interpoler
if ( cpt == 0 )
{
SetTypeFieldInterp ( 0 ) ;
}
}
//=============================================================================
void HOMARD_Hypothesis::SupprFieldInterps()
{
MESSAGE ("SupprFieldInterps") ;
_ListFieldInterp.clear();
// . Indication generale : aucun champ ne reste a interpoler
SetTypeFieldInterp ( 0 ) ;
}
//=============================================================================
const std::list<std::string>& HOMARD_Hypothesis::GetFieldInterps() const
{
return _ListFieldInterp;
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
void HOMARD_Hypothesis::SetCaseCreation( const char* NomCasCreation )
{
_NomCasCreation = std::string( NomCasCreation );
}
//=============================================================================
std::string HOMARD_Hypothesis::GetCaseCreation() const
{
return _NomCasCreation;
}
//=============================================================================
void HOMARD_Hypothesis::LinkIteration( const char* NomIteration )
{
_ListIter.push_back( std::string( NomIteration ) );
}
//=============================================================================
void HOMARD_Hypothesis::UnLinkIteration( const char* NomIteration )
{
std::list<std::string>::iterator it = find( _ListIter.begin(), _ListIter.end(), NomIteration ) ;
if ( it != _ListIter.end() )
{
MESSAGE ("Dans UnLinkIteration pour " << NomIteration) ;
it = _ListIter.erase( it ) ;
}
}
//=============================================================================
void HOMARD_Hypothesis::UnLinkIterations()
{
_ListIter.clear();
}
//=============================================================================
const std::list<std::string>& HOMARD_Hypothesis::GetIterations() const
{
return _ListIter;
}
//=============================================================================
void HOMARD_Hypothesis::AddZone( const char* NomZone, int TypeUse )
{
MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse) ;
// On commence par supprimer la zone au cas ou elle aurait deja ete inseree
// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la
// definition de l'hypothese
SupprZone( NomZone ) ;
// Insertion veritable
// . Nom de la zone
_ListZone.push_back( std::string( NomZone ) );
// . Usage de la zone
std::stringstream saux1 ;
saux1 << TypeUse ;
_ListZone.push_back( saux1.str() );
}
//=============================================================================
void HOMARD_Hypothesis::SupprZone( const char* NomZone )
{
MESSAGE ("Dans SupprZone pour " << NomZone) ;
std::list<std::string>::iterator it = find( _ListZone.begin(), _ListZone.end(), NomZone );
// Attention a supprimer le nom de zone et le type d'usage
if ( it != _ListZone.end() )
{
it = _ListZone.erase( it );
it = _ListZone.erase( it );
}
}
//=============================================================================
void HOMARD_Hypothesis::SupprZones()
{
_ListZone.clear();
}
//=============================================================================
const std::list<std::string>& HOMARD_Hypothesis::GetZones() const
{
return _ListZone;
}

View File

@ -0,0 +1,157 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Hypothesis.hxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#ifndef _HOMARD_HYPOTHESIS_HXX_
#define _HOMARD_HYPOTHESIS_HXX_
#include "HOMARD.hxx"
#include <string>
#include <list>
#if defined WIN32
#pragma warning ( disable: 4251 )
#endif
class HOMARDIMPL_EXPORT HOMARD_Hypothesis
{
public:
HOMARD_Hypothesis();
~HOMARD_Hypothesis();
// Generalites
void SetName( const char* Name );
std::string GetName() const;
std::string GetDumpPython() const;
// Caracteristiques
void SetAdapType( int TypeAdap );
int GetAdapType() const;
void SetRefinTypeDera( int TypeRaff, int TypeDera );
int GetRefinType() const;
int GetUnRefType() const;
void SetField( const char* FieldName );
std::string GetFieldName() const;
void SetUseField( int UsField );
int GetUseField() const;
void SetUseComp( int UsCmpI );
int GetUseComp() const;
void AddComp( const char* NomComp );
void SupprComp( const char* NomComp );
void SupprComps();
const std::list<std::string>& GetComps() const;
void SetRefinThr( int TypeThR, double ThreshR );
int GetRefinThrType() const;
double GetThreshR() const;
void SetUnRefThr( int TypeThC, double ThreshC );
int GetUnRefThrType() const;
double GetThreshC() const;
void SetNivMax( int NivMax );
const int GetNivMax() const;
void SetDiamMin( double DiamMin );
const double GetDiamMin() const;
void SetAdapInit( int AdapInit );
const int GetAdapInit() const;
void SetExtraOutput( int ExtraOutput );
const int GetExtraOutput() const;
void AddGroup( const char* Group);
void SupprGroup( const char* Group );
void SupprGroups();
void SetGroups(const std::list<std::string>& ListGroup );
const std::list<std::string>& GetGroups() const;
void SetTypeFieldInterp( int TypeFieldInterp );
int GetTypeFieldInterp() const;
void AddFieldInterpType( const char* FieldInterp, int TypeInterp );
void SupprFieldInterp( const char* FieldInterp );
void SupprFieldInterps();
const std::list<std::string>& GetFieldInterps() const;
// Liens avec les autres structures
void SetCaseCreation( const char* NomCasCreation );
std::string GetCaseCreation() const;
void LinkIteration( const char* NomIter );
void UnLinkIteration( const char* NomIter );
void UnLinkIterations();
const std::list<std::string>& GetIterations() const;
void AddZone( const char* NomZone, int TypeUse );
void SupprZone( const char* NomZone );
void SupprZones();
const std::list<std::string>& GetZones() const;
private:
std::string _Name;
std::string _NomCasCreation;
int _TypeAdap; // -1 pour une adapation Uniforme,
// 0 si l adaptation depend des zones,
// 1 pour des champs
int _TypeRaff;
int _TypeDera;
std::string _Field;
int _TypeThR;
int _TypeThC;
double _ThreshR;
double _ThreshC;
int _UsField;
int _UsCmpI;
int _TypeFieldInterp; // 0 pour aucune interpolation,
// 1 pour interpolation de tous les champs,
// 2 pour une liste
int _NivMax;
double _DiamMin;
int _AdapInit;
int _ExtraOutput;
std::list<std::string> _ListIter;
std::list<std::string> _ListZone;
std::list<std::string> _ListComp;
std::list<std::string> _ListGroupSelected;
std::list<std::string> _ListFieldInterp;
};
#endif

View File

@ -0,0 +1,394 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Iteration.cxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#include "HOMARD_Iteration.hxx"
#include "HOMARD.hxx"
#include "utilities.h"
//=============================================================================
/*!
* default constructor:
*/
//=============================================================================
HOMARD_Iteration::HOMARD_Iteration():
_Name( "" ), _Etat( 0 ),
_NumIter( -1 ),
_NomMesh( "" ), _MeshFile( "" ),
_FieldFile( "" ), _TimeStep( -1 ), _Rank( -1 ),
_LogFile( "" ),
_IterParent( "" ),
_NomHypo( "" ), _NomCas( "" ), _NomDir( "" ),
_FileInfo( "" ),
_MessInfo( 1 )
{
MESSAGE("HOMARD_Iteration");
}
//=============================================================================
/*!
*
*/
//=============================================================================
HOMARD_Iteration::~HOMARD_Iteration()
{
MESSAGE("~HOMARD_Iteration");
}
//=============================================================================
//=============================================================================
// Generalites
//=============================================================================
//=============================================================================
void HOMARD_Iteration::SetName( const char* Name )
{
_Name = std::string( Name );
}
//=============================================================================
std::string HOMARD_Iteration::GetName() const
{
return _Name;
}
//=============================================================================
std::string HOMARD_Iteration::GetDumpPython() const
{
if (_IterParent == "") return std::string(" ") ; // Pas de creation explicite de iteration 0";
MESSAGE (". Ecriture de l iteration " << _Name );
std::ostringstream aScript;
aScript << "\n# Creation of the iteration " << _Name << "\n";
if( _NumIter == 1 )
{
aScript << "\t" << _Name << " = " << _NomCas << ".NextIteration(\"" << _Name << "\")\n";
}
else
{
aScript << "\t" << _Name << " = " << _IterParent << ".NextIteration(\"" << _Name << "\")\n";
}
// L'hypothese (doit etre au debut)
aScript << "\t" << _Name << ".AssociateHypo(\"" << _NomHypo << "\")\n";
// Le nom du maillage produit
// MESSAGE (".. maillage produit " << _NomMesh );
aScript << "\t" << _Name << ".SetMeshName(\"" << _NomMesh << "\")\n" ;
// Le fichier du maillage produit
aScript << "\t" << _Name << ".SetMeshFile(\"" << _MeshFile << "\")\n";
// Le fichier des champs
if ( _FieldFile != "" )
{
aScript << "\t" << _Name << ".SetFieldFile(\"" << _FieldFile << "\")\n";
}
// Si champ de pilotage, valeurs de pas de temps
MESSAGE (". champ de pilotage : _TimeStep = " << _TimeStep << ", _Rank : " << _Rank);
if ( _TimeStep != -1 )
{
if ( _TimeStep == -2 ) {
aScript << "\t" << _Name << ".SetTimeStepRankLast()\n";
}
else
{
if ( _TimeStep != -1 )
{
if ( _Rank == -1 )
{
aScript << "\t" << _Name << ".SetTimeStep( " << _TimeStep << " )\n";
}
else
{
aScript << "\t" << _Name << ".SetTimeStepRank( " << _TimeStep << ", " << _Rank << " )\n";
}
}
}
}
// Les instants d'interpolation
MESSAGE (". instants d'interpolation ");
std::list<std::string>::const_iterator it = _ListFieldInterpTSR.begin() ;
while(it != _ListFieldInterpTSR.end())
{
std::string FieldName = std::string((*it)) ;
// MESSAGE ("... FieldName = "<< FieldName);
(*it++);
std::string TimeStepstr = std::string((*it)) ;
// MESSAGE ("... TimeStepstr = "<< TimeStepstr);
(*it++);
std::string Rankstr = std::string((*it)) ;
// MESSAGE ("... Rankstr = "<< Rankstr);
(*it++);
aScript << "\t" << _Name << ".SetFieldInterpTimeStepRank( \"" << FieldName << "\"" ;
aScript << ", " << TimeStepstr ;
aScript << ", " << Rankstr << " )\n" ;
}
// Compute
MESSAGE (". Compute ");
if ( _Etat == 2 ) { aScript << "\tcodret = " <<_Name << ".Compute(1, 1)\n"; }
else { aScript << "\t#codret = " <<_Name << ".Compute(1, 1)\n"; }
// MESSAGE (". Fin de l ecriture de l iteration " << _Name );
return aScript.str();
}
//=============================================================================
//=============================================================================
// Caracteristiques
//=============================================================================
//=============================================================================
void HOMARD_Iteration::SetDirNameLoc( const char* NomDir )
{
_NomDir = std::string( NomDir );
}
//=============================================================================
std::string HOMARD_Iteration::GetDirNameLoc() const
{
return _NomDir;
}
//=============================================================================
void HOMARD_Iteration::SetNumber( int NumIter )
{
_NumIter = NumIter;
}
//=============================================================================
int HOMARD_Iteration::GetNumber() const
{
return _NumIter;
}
//=============================================================================
void HOMARD_Iteration::SetState( int etat )
{
_Etat = etat;
}
//=============================================================================
int HOMARD_Iteration::GetState() const
{
return _Etat;
}
//=============================================================================
void HOMARD_Iteration::SetMeshName( const char* NomMesh )
{
_NomMesh = std::string( NomMesh );
}
//=============================================================================
std::string HOMARD_Iteration::GetMeshName() const
{
return _NomMesh;
}
//=============================================================================
void HOMARD_Iteration::SetMeshFile( const char* MeshFile )
{
_MeshFile = std::string( MeshFile );
}
//=============================================================================
std::string HOMARD_Iteration::GetMeshFile() const
{
return _MeshFile;
}
//=============================================================================
void HOMARD_Iteration::SetFieldFile( const char* FieldFile )
{
_FieldFile = std::string( FieldFile );
}
//=============================================================================
std::string HOMARD_Iteration::GetFieldFile() const
{
return _FieldFile;
}
//=============================================================================
// Instants pour le champ de pilotage
//=============================================================================
void HOMARD_Iteration::SetTimeStep( int TimeStep )
{
_TimeStep = TimeStep;
}
//=============================================================================
void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank )
{
_TimeStep = TimeStep;
_Rank = Rank;
}
//=============================================================================
void HOMARD_Iteration::SetTimeStepRankLast()
{
_TimeStep = -2;
}
//=============================================================================
int HOMARD_Iteration::GetTimeStep() const
{
return _TimeStep;
}
//=============================================================================
int HOMARD_Iteration::GetRank() const
{
return _Rank;
}
//=============================================================================
// Instants pour un champ a interpoler
//=============================================================================
void HOMARD_Iteration::SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep )
{
SetFieldInterpTimeStepRank( FieldInterp, TimeStep, TimeStep ) ;
}
//=============================================================================
void HOMARD_Iteration::SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank )
{
MESSAGE("Champ " << FieldInterp << ", hypothese " << _NomHypo )
// Verification de la presence du champ dans l'hypothese
std::list<std::string>::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp );
if ( it == _ListFieldInterp.end() )
{
INFOS("Champ " << FieldInterp << " ; hypothese " << _NomHypo )
VERIFICATION("Le champ est inconnu dans l'hypothese associee a cette iteration." == 0);
}
// . Nom du champ
_ListFieldInterpTSR.push_back( std::string( FieldInterp ) );
// . Pas de temps
std::stringstream saux1 ;
saux1 << TimeStep ;
_ListFieldInterpTSR.push_back( saux1.str() );
// . Numero d'ordre
std::stringstream saux2 ;
saux2 << Rank ;
_ListFieldInterpTSR.push_back( saux2.str() );
}
//=============================================================================
const std::list<std::string>& HOMARD_Iteration::GetFieldInterpsTimeStepRank() const
{
return _ListFieldInterpTSR;
}
//=============================================================================
void HOMARD_Iteration::SetFieldInterp( const char* FieldInterp )
{
_ListFieldInterp.push_back( std::string( FieldInterp ) );
}
//=============================================================================
const std::list<std::string>& HOMARD_Iteration::GetFieldInterps() const
{
return _ListFieldInterp;
}
//=============================================================================
void HOMARD_Iteration::SupprFieldInterps()
{
_ListFieldInterp.clear();
}
//=============================================================================
void HOMARD_Iteration::SetLogFile( const char* LogFile )
{
_LogFile = std::string( LogFile );
}
//=============================================================================
std::string HOMARD_Iteration::GetLogFile() const
{
return _LogFile;
}
//=============================================================================
void HOMARD_Iteration::SetFileInfo( const char* FileInfo )
{
_FileInfo = std::string( FileInfo );
}
//=============================================================================
std::string HOMARD_Iteration::GetFileInfo() const
{
return _FileInfo;
}
//=============================================================================
//=============================================================================
// Liens avec les autres iterations
//=============================================================================
//=============================================================================
void HOMARD_Iteration::LinkNextIteration( const char* NomIteration )
{
_mesIterFilles.push_back( std::string( NomIteration ) );
}
//=============================================================================
void HOMARD_Iteration::UnLinkNextIteration( const char* NomIteration )
{
std::list<std::string>::iterator it = find( _mesIterFilles.begin(), _mesIterFilles.end(), NomIteration ) ;
if ( it != _mesIterFilles.end() )
{
MESSAGE ("Dans UnLinkNextIteration pour " << NomIteration) ;
it = _mesIterFilles.erase( it ) ;
}
}
//=============================================================================
void HOMARD_Iteration::UnLinkNextIterations()
{
_mesIterFilles.clear();
}
//=============================================================================
const std::list<std::string>& HOMARD_Iteration::GetIterations() const
{
return _mesIterFilles;
}
//=============================================================================
void HOMARD_Iteration::SetIterParentName( const char* IterParent )
{
_IterParent = IterParent;
}
//=============================================================================
std::string HOMARD_Iteration::GetIterParentName() const
{
return _IterParent;
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
void HOMARD_Iteration::SetCaseName( const char* NomCas )
{
_NomCas = std::string( NomCas );
}
//=============================================================================
std::string HOMARD_Iteration::GetCaseName() const
{
return _NomCas;
}
//=============================================================================
void HOMARD_Iteration::SetHypoName( const char* NomHypo )
{
_NomHypo = std::string( NomHypo );
}
//=============================================================================
std::string HOMARD_Iteration::GetHypoName() const
{
return _NomHypo;
}
//=============================================================================
//=============================================================================
// Divers
//=============================================================================
//=============================================================================
void HOMARD_Iteration::SetInfoCompute( int MessInfo )
{
_MessInfo = MessInfo;
}
//=============================================================================
int HOMARD_Iteration::GetInfoCompute() const
{
return _MessInfo;
}

View File

@ -0,0 +1,139 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Iteration.hxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#ifndef _HOMARD_ITER_HXX_
#define _HOMARD_ITER_HXX_
#include "HOMARD.hxx"
#include <string>
#include <list>
#if defined WIN32
#pragma warning ( disable: 4251 )
#endif
class HOMARDIMPL_EXPORT HOMARD_Iteration
{
public:
HOMARD_Iteration();
~HOMARD_Iteration();
// Generalites
void SetName( const char* Name );
std::string GetName() const;
std::string GetDumpPython() const;
// Caracteristiques
void SetDirNameLoc( const char* NomDir );
std::string GetDirNameLoc() const;
void SetNumber( int NumIter );
int GetNumber() const;
void SetState( int etat );
int GetState() const;
void SetMeshName( const char* NomMesh );
std::string GetMeshName() const;
void SetMeshFile( const char* MeshFile );
std::string GetMeshFile() const;
void SetFieldFile( const char* FieldFile );
std::string GetFieldFile() const;
// Instants pour le champ de pilotage
void SetTimeStep( int TimeStep );
void SetTimeStepRank( int TimeStep, int Rank );
void SetTimeStepRankLast();
int GetTimeStep() const;
int GetRank() const;
// Instants pour un champ a interpoler
void SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep );
void SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank );
const std::list<std::string>& GetFieldInterpsTimeStepRank() const;
void SetFieldInterp( const char* FieldInterp );
const std::list<std::string>& GetFieldInterps() const;
void SupprFieldInterps();
void SetLogFile( const char* LogFile );
std::string GetLogFile() const;
void SetFileInfo( const char* FileInfo );
std::string GetFileInfo() const;
// Liens avec les autres iterations
void LinkNextIteration( const char* NomIteration );
void UnLinkNextIteration( const char* NomIteration );
void UnLinkNextIterations();
const std::list<std::string>& GetIterations() const;
void SetIterParentName( const char* iterParent );
std::string GetIterParentName() const;
// Liens avec les autres structures
void SetCaseName( const char* NomCas );
std::string GetCaseName() const;
void SetHypoName( const char* NomHypo );
std::string GetHypoName() const;
// Divers
void SetInfoCompute( int MessInfo );
int GetInfoCompute() const;
private:
std::string _Name;
int _Etat;
int _NumIter;
std::string _NomMesh;
std::string _MeshFile;
std::string _FieldFile;
int _TimeStep;
int _Rank;
std::string _LogFile;
std::string _IterParent;
std::string _NomHypo;
std::string _NomCas;
std::string _NomDir;
std::list<std::string> _mesIterFilles;
std::string _FileInfo;
int _MessInfo;
// La liste des champs retenus par l'hypothese
std::list<std::string> _ListFieldInterp;
// La liste des triplets (champs, pas de temps, numero d'ordre) retenus par l'iteration
std::list<std::string> _ListFieldInterpTSR;
};
#endif

219
src/ADAPT/HOMARD_YACS.cxx Normal file
View File

@ -0,0 +1,219 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_YACS.cxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#include "HOMARD_YACS.hxx"
#include "utilities.h"
//=============================================================================
/*!
* default constructor:
*/
//=============================================================================
HOMARD_YACS::HOMARD_YACS():
_Name( "" ),
_NomCas( "" ),
_NomDir( "" ),
_MeshFile( "" ),
_ScriptFile( "" )
{
MESSAGE("HOMARD_YACS");
}
//=============================================================================
/*!
*
*/
//=============================================================================
HOMARD_YACS::~HOMARD_YACS()
{
MESSAGE("~HOMARD_YACS");
}
//=============================================================================
//=============================================================================
// Generalites
//=============================================================================
//=============================================================================
void HOMARD_YACS::SetName( const char* Name )
{
_Name = std::string( Name );
}
//=============================================================================
std::string HOMARD_YACS::GetName() const
{
return _Name;
}
//=============================================================================
std::string HOMARD_YACS::GetDumpPython() const
{
MESSAGE (". Ecriture du schema " << _Name );
std::ostringstream aScript;
aScript << "\n# Creation of the schema " << _Name << "\n";
// Creation du schema
aScript << "\t" << _Name << " = " << _NomCas << ".CreateYACSSchema(\"" << _Name << "\", \"" << _ScriptFile << "\", \"" << _NomDir << "\", \"" << _MeshFile << "\")\n";
// Le type de schema
aScript << "\t" << _Name << ".SetType(" << _Type << ")\n";
// Les controles de convergences
if ( _MaxIter > 0 ) { aScript << "\t" << _Name << ".SetMaxIter(" << _MaxIter << ")\n"; }
if ( _MaxNode > 0 ) { aScript << "\t" << _Name << ".SetMaxNode(" << _MaxNode << ")\n"; }
if ( _MaxElem > 0 ) { aScript << "\t" << _Name << ".SetMaxElem(" << _MaxElem << ")\n"; }
// L'ecriture du schema
aScript << "\tcodret = " << _Name << ".Write()\n";
MESSAGE (". Fin de l ecriture du schema " << _Name );
return aScript.str();
}
//=============================================================================
//=============================================================================
// Caracteristiques de la convergence
//=============================================================================
//=============================================================================
void HOMARD_YACS::SetType( int Type )
{
_Type = Type;
}
//=============================================================================
int HOMARD_YACS::GetType() const
{
return _Type;
}
//=============================================================================
void HOMARD_YACS::SetMaxIter( int MaxIter )
{
_MaxIter = MaxIter;
}
//=============================================================================
int HOMARD_YACS::GetMaxIter() const
{
return _MaxIter;
}
//=============================================================================
void HOMARD_YACS::SetMaxNode( int MaxNode )
{
_MaxNode = MaxNode;
}
//=============================================================================
int HOMARD_YACS::GetMaxNode() const
{
return _MaxNode;
}
//=============================================================================
void HOMARD_YACS::SetMaxElem( int MaxElem )
{
_MaxElem = MaxElem;
}
//=============================================================================
int HOMARD_YACS::GetMaxElem() const
{
return _MaxElem;
}
//=============================================================================
void HOMARD_YACS::SetTestConvergence( int TypeTest, double VRef )
{
_TypeTest = TypeTest;
_VRef = VRef;
}
//=============================================================================
int HOMARD_YACS::GetTestConvergenceType() const
{
return _TypeTest;
}
//=============================================================================
double HOMARD_YACS::GetTestConvergenceVRef() const
{
return _VRef;
}
//=============================================================================
//=============================================================================
// Repertoire et fichiers
//=============================================================================
//=============================================================================
//=============================================================================
void HOMARD_YACS::SetDirName( const char* NomDir )
{
_NomDir = std::string( NomDir );
}
//=============================================================================
std::string HOMARD_YACS::GetDirName() const
{
return _NomDir;
}
//=============================================================================
void HOMARD_YACS::SetMeshFile( const char* MeshFile )
{
_MeshFile = std::string( MeshFile );
}
//=============================================================================
std::string HOMARD_YACS::GetMeshFile() const
{
return _MeshFile;
}
//=============================================================================
void HOMARD_YACS::SetScriptFile( const char* ScriptFile )
{
_ScriptFile = std::string( ScriptFile );
}
//=============================================================================
std::string HOMARD_YACS::GetScriptFile() const
{
return _ScriptFile;
}
//=============================================================================
void HOMARD_YACS::SetXMLFile( const char* XMLFile )
{
_XMLFile = std::string( XMLFile );
}
//=============================================================================
std::string HOMARD_YACS::GetXMLFile() const
{
return _XMLFile;
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
void HOMARD_YACS::SetCaseName( const char* NomCas )
{
_NomCas = std::string( NomCas );
}
//=============================================================================
std::string HOMARD_YACS::GetCaseName() const
{
return _NomCas;
}
//=============================================================================
//=============================================================================
// Divers
//=============================================================================
//=============================================================================

103
src/ADAPT/HOMARD_YACS.hxx Normal file
View File

@ -0,0 +1,103 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_YACS.hxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#ifndef _HOMARD_YACS_HXX_
#define _HOMARD_YACS_HXX_
#include "HOMARD.hxx"
#include <string>
#include <list>
class HOMARDIMPL_EXPORT HOMARD_YACS
{
public:
HOMARD_YACS();
~HOMARD_YACS();
// Generalites
void SetName( const char* Name );
std::string GetName() const;
std::string GetDumpPython() const;
// Caracteristiques
void SetType( int Type );
int GetType() const;
void SetMaxIter( int MaxIter );
int GetMaxIter() const;
void SetMaxNode( int MaxNode );
int GetMaxNode() const;
void SetMaxElem( int MaxElem );
int GetMaxElem() const;
void SetTestConvergence( int TypeTest, double VRef );
int GetTestConvergenceType() const;
double GetTestConvergenceVRef() const;
void SetDirName( const char* NomDir );
std::string GetDirName() const;
void SetMeshFile( const char* MeshFile );
std::string GetMeshFile() const;
void SetScriptFile( const char* ScriptFile );
std::string GetScriptFile() const;
void SetXMLFile( const char* XMLFile );
std::string GetXMLFile() const;
// Liens avec les autres structures
void SetCaseName( const char* NomCas );
std::string GetCaseName() const;
// Divers
private:
std::string _Name;
std::string _NomCas;
std::string _NomDir;
std::string _MeshFile;
std::string _ScriptFile;
int _Type;
int _MaxIter;
int _MaxNode;
int _MaxElem;
int _TypeTest;
double _VRef;
std::string _XMLFile;
};
#endif

325
src/ADAPT/HOMARD_Zone.cxx Normal file
View File

@ -0,0 +1,325 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Zone.cxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#include "HOMARD_Zone.hxx"
#include "HOMARD.hxx"
#include "utilities.h"
//=============================================================================
/*!
* default constructor:
*/
//=============================================================================
HOMARD_Zone::HOMARD_Zone():
_Name( "" ),_Type( 2 ),
_Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
_Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _Rayon( 0 ),
_Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ), _Haut( 0 ),
_Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
{
MESSAGE("HOMARD_Zone") ;
}
//=============================================================================
HOMARD_Zone::~HOMARD_Zone()
{
MESSAGE("~HOMARD_Zone") ;
}
//=============================================================================
//=============================================================================
// Generalites
//=============================================================================
//=============================================================================
void HOMARD_Zone::SetName( const char* Name )
{
_Name = std::string( Name );
}
//=============================================================================
std::string HOMARD_Zone::GetName() const
{
return _Name;
}
//=============================================================================
std::string HOMARD_Zone::GetDumpPython() const
{
// MESSAGE("GetDumpPython avec _Type " << _Type) ;
// MESSAGE("GetDumpPython avec _Name " << _Name) ;
std::ostringstream aScript;
aScript << "\n# Creation of the ";
if ( _Type >= 11 && _Type <= 13 ) { aScript << "rectangle " ; }
else if ( _Type == 2 ) { aScript << "box " ;}
else if ( _Type >= 31 && _Type <= 33 ) { aScript << "disk " ;}
else if ( _Type == 4 ) { aScript << "sphere " ; }
else if ( _Type == 5 ) { aScript << "cylinder " ; }
else if ( _Type >= 61 && _Type <= 63 ) { aScript << "disk with hole " ;}
else if ( _Type == 7 ) { aScript << "pipe " ; }
aScript << _Name << "\n" ;
//
aScript << "\t" << _Name << " = homard.CreateZone" ;
//
switch (_Type)
{
case 11:
{ aScript << "Box2D( \"" << _Name << "\", " << _Xmin << ", " << _Xmax << ", " << _Ymin << ", " << _Ymax << ", 1 )\n";
break ;
}
case 12:
{ aScript << "Box2D( \"" << _Name << "\", " << _Ymin << ", " << _Ymax << ", " << _Zmin << ", " << _Zmax << ", 2 )\n";
break ;
}
case 13:
{ aScript << "Box2D( \"" << _Name << "\", " << _Zmin << ", " << _Zmax << ", " << _Xmin << ", " << _Xmax << ", 3 )\n";
break ;
}
case 2:
{ aScript << "Box( \"" << _Name << "\", " << _Xmin << ", " << _Xmax << ", " << _Ymin << ", " << _Ymax << ", " << _Zmin << ", " << _Zmax << ")\n";
break ;
}
case 4:
{ aScript << "Sphere( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Rayon << ")\n";
break ;
}
case 31:
{ aScript << "Disk( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Rayon << ", 1 )\n";
break ;
}
case 32:
{ aScript << "Disk( \"" << _Name << "\", " << _Ycentre << ", " << _Zcentre << ", " << _Rayon << ", 2 )\n";
break ;
}
case 33:
{ aScript << "Disk( \"" << _Name << "\", " << _Zcentre << ", " << _Xcentre << ", " << _Rayon << ", 3 )\n";
break ;
}
case 5:
{ aScript << "Cylinder( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon << ", " << _Haut << ")\n";
break ;
}
case 61:
{ aScript << "DiskWithHole( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Rayon << ", " << _Rayonint << ", 1 )\n";
break ;
}
case 62:
{ aScript << "DiskWithHole( \"" << _Name << "\", " << _Ycentre << ", " << _Zcentre << ", " << _Rayon << ", " << _Rayonint << ", 2 )\n";
break ;
}
case 63:
{ aScript << "DiskWithHole( \"" << _Name << "\", " << _Zcentre << ", " << _Xcentre << ", " << _Rayon << ", " << _Rayonint << ", 3 )\n";
break ;
}
case 7:
{ aScript << "Pipe( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon << ", " << _Haut << ", " << _Rayonint << ")\n";
break ;
}
}
return aScript.str() ;
}
//=============================================================================
//=============================================================================
// Caracteristiques
//=============================================================================
//=============================================================================
void HOMARD_Zone::SetType( int Type )
{
_Type = Type;
}
//=============================================================================
int HOMARD_Zone::GetType() const
{
return _Type;
}
//=======================================================================================
void HOMARD_Zone::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 )
{
_Xmin = X0; _Xmax = X1;
_Ymin = X2; _Ymax = X3;
_Zmin = X4; _Zmax = X5;
}
//=======================================================================================
void HOMARD_Zone::SetCylinder( double X0, double X1, double X2,
double X3, double X4, double X5, double X6, double X7 )
{
_Xcentre = X0;
_Ycentre = X1;
_Zcentre = X2;
_Xaxe = X3;
_Yaxe = X4;
_Zaxe = X5;
_Rayon = X6;
_Haut = X7;
}
//=======================================================================================
void HOMARD_Zone::SetPipe( double X0, double X1, double X2,
double X3, double X4, double X5, double X6, double X7, double X8 )
{
_Xcentre = X0;
_Ycentre = X1;
_Zcentre = X2;
_Xaxe = X3;
_Yaxe = X4;
_Zaxe = X5;
_Rayon = X6;
_Haut = X7;
_Rayonint = X8;
}
//======================================================================
void HOMARD_Zone::SetSphere( double X0, double X1, double X2, double X3 )
{
_Xcentre = X0;
_Ycentre = X1;
_Zcentre = X2;
_Rayon = X3;
}
//=======================================================================================
std::vector<double> HOMARD_Zone::GetCoords() const
{
std::vector<double> mesCoor;
//
switch (_Type)
{
// Rectangle ou parallelepipede
case 11:
{ }
case 12:
{ }
case 13:
{ }
case 2:
{
mesCoor.push_back( _Xmin ) ;
mesCoor.push_back( _Xmax ) ;
mesCoor.push_back( _Ymin ) ;
mesCoor.push_back( _Ymax ) ;
mesCoor.push_back( _Zmin ) ;
mesCoor.push_back( _Zmax ) ;
break ;
}
// Sphere
case 4:
{
mesCoor.push_back( _Xcentre ) ;
mesCoor.push_back( _Ycentre ) ;
mesCoor.push_back( _Zcentre ) ;
mesCoor.push_back( _Rayon ) ;
break ;
}
// Disque ou cylindre
case 31:
{ }
case 32:
{ }
case 33:
{ }
case 5:
{
mesCoor.push_back( _Xcentre ) ;
mesCoor.push_back( _Ycentre ) ;
mesCoor.push_back( _Zcentre ) ;
mesCoor.push_back( _Xaxe ) ;
mesCoor.push_back( _Yaxe ) ;
mesCoor.push_back( _Zaxe ) ;
mesCoor.push_back( _Rayon ) ;
mesCoor.push_back( _Haut ) ;
break ;
}
// Disque avec trou ou tuyau
case 61:
{ }
case 62:
{ }
case 63:
{ }
case 7:
{
mesCoor.push_back( _Xcentre ) ;
mesCoor.push_back( _Ycentre ) ;
mesCoor.push_back( _Zcentre ) ;
mesCoor.push_back( _Xaxe ) ;
mesCoor.push_back( _Yaxe ) ;
mesCoor.push_back( _Zaxe ) ;
mesCoor.push_back( _Rayon ) ;
mesCoor.push_back( _Haut ) ;
mesCoor.push_back( _Rayonint ) ;
break ;
}
VERIFICATION ( ( (_Type>10) && (_Type<14) ) || (_Type==2) || ( (_Type>30) && (_Type<34) ) || (_Type==4) || (_Type==5) || ( (_Type>60) && (_Type<64) ) || (_Type==7) ) ;
}
return mesCoor;
}
//======================================================================
void HOMARD_Zone::SetLimit( double X0, double X1, double X2 )
{
_Xincr = X0; _Yincr = X1; _Zincr = X2;
}
//=======================================================================================
std::vector<double> HOMARD_Zone::GetLimit() const
{
std::vector<double> mesLimit;
mesLimit.push_back( _Xincr ) ;
mesLimit.push_back( _Yincr ) ;
mesLimit.push_back( _Zincr ) ;
return mesLimit;
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
void HOMARD_Zone::AddHypo( const char* NomHypo )
{
_ListHypo.push_back( std::string( NomHypo ) ) ;
}
//=============================================================================
const std::list<std::string>& HOMARD_Zone::GetHypo() const
{
return _ListHypo;
}
//=============================================================================
void HOMARD_Zone::SupprHypo( const char* NomHypo )
{
std::list<std::string>::iterator it = find( _ListHypo.begin(), _ListHypo.end(), NomHypo ) ;
if ( it != _ListHypo.end() )
{
MESSAGE ("Dans SupprHypo pour " << NomHypo) ;
it = _ListHypo.erase( it ) ;
}
}
//=============================================================================
void HOMARD_Zone::SupprHypos()
{
_ListHypo.clear() ;
}

95
src/ADAPT/HOMARD_Zone.hxx Normal file
View File

@ -0,0 +1,95 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARD_Zone.hxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
#ifndef _HOMARD_Zone_HXX_
#define _HOMARD_Zone_HXX_
#include "HOMARD.hxx"
#include <vector>
#include <string>
#include <list>
#if defined WIN32
#pragma warning ( disable: 4251 )
#endif
class HOMARDIMPL_EXPORT HOMARD_Zone
{
public:
HOMARD_Zone();
~HOMARD_Zone();
// Generalites
void SetName( const char* Name );
std::string GetName() const;
std::string GetDumpPython() const;
// Caracteristiques
void SetType( int Type );
int GetType() const;
void SetBox( double X0, double X1, double X2,
double X3, double X4, double X5 );
void SetCylinder( double X0, double X1, double X2, double X3,
double X4, double X5, double X6, double X7 );
void SetPipe( double X0, double X1, double X2, double X3,
double X4, double X5, double X6, double X7, double X8 );
void SetSphere( double X0, double X1, double X2, double X3 );
std::vector<double> GetCoords() const;
void SetLimit( double X0, double X1, double X2 );
std::vector<double> GetLimit() const;
// Liens avec les autres structures
void AddHypo( const char* NomHypo );
const std::list<std::string>& GetHypo() const;
void SupprHypo( const char* NomHypo );
void SupprHypos();
private:
std::string _Name;
int _Type;
std::list<std::string> _ListHypo;
double _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax;
double _Xcentre, _Ycentre, _Zcentre, _Rayon, _Rayonint;
double _Xaxe, _Yaxe, _Zaxe, _Haut;
double _Xincr, _Yincr, _Zincr;
};
#endif

1106
src/ADAPT/HomardDriver.cxx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
# ifndef _HOMARDDRIVER_HXX_
# define _HOMARDDRIVER_HXX_
#include "HOMARD.hxx"
#include <iostream>
#include <fstream>
class HOMARDIMPL_EXPORT HomardDriver
{
public:
HomardDriver(const std::string siter, const std::string siterp1);
~HomardDriver();
//
void TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue );
void TexteInfo( int TypeBila, int NumeIter );
void TexteMajCoords( int NumeIter );
void CreeFichierDonn();
void TexteAdap( int ExtType );
void CreeFichier();
void TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres );
void TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres );
void TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera );
void TexteZone( int NumeZone, int ZoneType, int TypeUse, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8 );
void TexteGroup( const std::string GroupName );
void TexteField( const std::string FieldName, const std::string FieldFile,
int TimeStep, int Rank,
int TypeThR, double ThreshR, int TypeThC, double ThreshC,
int UsField, int UsCmpI );
void TexteCompo( int NumeComp, const std::string NomCompo);
void TexteBoundaryOption( int BoundaryOption );
void TexteBoundaryCAOGr( const std::string GroupName );
void TexteBoundaryDi( const std::string MeshName, const std::string MeshFile );
void TexteBoundaryDiGr( const std::string GroupName );
void TexteBoundaryAn( const std::string NameBoundary, int NumeBoundary, int BoundaryType, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7 );
void TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName );
void TexteFieldInterp( const std::string FieldFile, const std::string MeshFile );
void TexteFieldInterpAll();
void TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank );
void TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput );
void TexteInfoCompute( int MessInfo );
//
int ExecuteHomard(int option);
//
public:
int _modeHOMARD;
std::string _HOMARD_Exec;
std::string _NomDir;
std::string _NomFichierConfBase;
std::string _NomFichierConf;
std::string _NomFichierDonn;
std::string _siter;
std::string _siterp1;
std::string _Texte;
int _TimeStep;
int _Rank;
bool _bLu;
};
# endif /* # ifndef _HOMARDDRIVER_HXX_ */

684
src/ADAPT/YACSDriver.cxx Normal file
View File

@ -0,0 +1,684 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
// Pilote l'ecriture du fichier xml pour lancer un schema YACS
#include <cstring>
#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/stat.h>
#include "YACSDriver.hxx"
#include "HOMARD.hxx"
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
//=============================================================================
//=============================================================================
YACSDriver::YACSDriver(const std::string XMLFile, const std::string DirName, const std::string LangueShort):
_XMLFile( "" ), _DirName( "" ),
_Texte( "" ),
_Texte_parametres( "" ),
_noeud_1( "CreateCase" ),
_LangueShort( "" ),
_bLu( false )
{
MESSAGE("XMLFile = "<<XMLFile<<", DirName ="<<DirName);
_XMLFile = XMLFile;
_DirName = DirName;
_LangueShort = LangueShort;
}
//=============================================================================
//=============================================================================
YACSDriver::~YACSDriver()
{
}
//===============================================================================
// Ajout d'une ligne simple
//===============================================================================
void YACSDriver::TexteAdd( const std::string ligne )
{
// MESSAGE("TexteAdd, ligne ="<<ligne);
//
_Texte += ligne + "\n" ;
//
}
//===============================================================================
// Nom du fichier du maillage initial
//===============================================================================
void YACSDriver::Texte_DataInit_MeshFile( const std::string Meshfile )
{
MESSAGE("TexteInitMeshfile, Meshfile ="<<Meshfile);
//
_Texte += " <value><string>" ;
_Texte += Meshfile ;
_Texte += "</string></value>\n" ;
//
}
//===============================================================================
// Le repertoire de calcul
// Le script de lancement
//===============================================================================
void YACSDriver::Texte_Alternance_Calcul_HOMARD_Calcul( const std::string FileName )
{
MESSAGE("Texte_Alternance_Calcul_HOMARD_Calcul, FileName : "<<FileName);
//
int position = FileName.find_last_of( '/' ) ;
std::string nomfic = FileName.substr( position+1 ) ;
position = nomfic.find_last_of( '.' ) ;;
nomfic = nomfic.substr( 0, position ) ;
MESSAGE("nomfic : "<<nomfic) ;
//
_Texte += "rep_calc = \"" + _DirName + "\"\n" ;
_Texte += "rep_script = os.path.dirname(\"" + FileName + "\")\n" ;
_Texte += "sys.path.append(rep_script)\n" ;
_Texte += "from " + nomfic + " import Script\n" ;
//
}
//===============================================================================
// Les options du cas
//===============================================================================
void YACSDriver::Texte_Iter_1_Case_Options( const std::string pythonTexte )
{
MESSAGE("Texte_Iter_1_Case_Options, pythonTexte\n"<<pythonTexte);
//
_Texte += "DirName = \"" + _DirName + "/HOMARD\"\n" ;
_Texte += "Case.SetDirName(DirName)\n" ;
Texte_python_1( pythonTexte, 1, "Case" ) ;
//
}
//===============================================================================
// La description des zones
// ZoneType : le type de la zone
// pythonStructure : le python correspondant a la zone
// methode : methode associee a la creation de la zone
// ZoneName : nom de la zone
//===============================================================================
std::string YACSDriver::Texte_Iter_1_Zone( int ZoneType, const std::string pythonStructure, const std::string methode, const std::string ZoneName )
{
MESSAGE("Texte_Iter_1_Zone, ZoneType = "<<ZoneType<<", pythonStructure = "<<pythonStructure);
MESSAGE("methode = "<<methode<<", ZoneName = "<<ZoneName );
//
// 1. Le nom du noeud
std::string noeud_2 = methode + "_" + ZoneName ;
std::string node ;
if ( _LangueShort == "fr" ) { node = "Boucle_de_convergence.Alternance_Calcul_HOMARD" ; }
else { node = "Convergence_Loop.Alternation_Computation_HOMARD" ; }
node += ".Adaptation.p0_Adaptation_HOMARD.HOMARD_Initialisation.p1_Iter_1." ;
node += noeud_2 ;
// 2. Texte de controle : le noeud precedent est _noeud_1, le noeud courant noeud_2.
// A la fin, on bascule le courant dans le precedent
std::string texte_control = Texte_control (_noeud_1, noeud_2, 1) ;
_noeud_1 = noeud_2 ;
// 3. Definition du service
std::string motcle ;
_Texte += " <service name=\"" + noeud_2 + "\">\n" ;
INFOS("_LangueShort = "<<_LangueShort );
if ( _LangueShort == "fr" ) { motcle = "Etude_Initialisation" ; }
else { motcle = "Study_Initialisation" ; }
INFOS("motcle = "<<motcle );
_Texte += " <node>" + motcle + ".UpdateStudy</node>\n" ;
_Texte += " <method>" + methode + "</method>\n" ;
// 4. Les inports
// 4.1. Le nom de la zone
_Texte += Texte_inport( "string", "ZoneName" ) ;
TexteParametre( node, "ZoneName", "string", ZoneName ) ;
// 4.2. Les valeurs numeriques
// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl
// 4.2.1. Decodage des valeurs
// La chaine pythonStructure est de ce genre :
// CreateZoneBox( "Zone_1", 0.144, 0.216, 0.096, 0.1464, 0.076, 0.12)
std::string ligne = pythonStructure ;
// On commence par ne garder que ce qui suit la premiere virgule
ligne = GetStringInTexte( ligne, ",", 1 );
// On boucle pour isoler toutes les chaines dans les virgules
std::string lignebis ;
std::string x0, x1, x2, x3, x4, x5, x6, x7, x8 ;
int iaux = 0 ;
while ( ligne != lignebis )
{
lignebis = GetStringInTexte ( ligne, ",", 0 ) ;
// MESSAGE("lignebis = "<<lignebis );
if ( iaux == 0 ) { x0 = lignebis ; }
else if ( iaux == 1 ) { x1 = lignebis ; }
else if ( iaux == 2 ) { x2 = lignebis ; }
else if ( iaux == 3 ) { x3 = lignebis ; }
else if ( iaux == 4 ) { x4 = lignebis ; }
else if ( iaux == 5 ) { x5 = lignebis ; }
else if ( iaux == 6 ) { x6 = lignebis ; }
else if ( iaux == 7 ) { x7 = lignebis ; }
ligne = GetStringInTexte( ligne, ",", 1 );
iaux += 1 ;
}
// La derniere valeur est toujours mise dans x8
x8 = GetStringInTexte ( ligne, ")", 0 ) ;
MESSAGE("coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6<<","<<x7<<","<<x8);
// 4.2.2. Cas du parallelepipede (2)
if ( ZoneType == 2 )
{
_Texte += Texte_inport( "double", "Xmini" ) ;
_Texte += Texte_inport( "double", "Xmaxi" ) ;
_Texte += Texte_inport( "double", "Ymini" ) ;
_Texte += Texte_inport( "double", "Ymaxi" ) ;
_Texte += Texte_inport( "double", "Zmini" ) ;
_Texte += Texte_inport( "double", "Zmaxi" ) ;
TexteParametre( node, "Xmini", "double", x0 ) ;
TexteParametre( node, "Xmaxi", "double", x1 ) ;
TexteParametre( node, "Ymini", "double", x2 ) ;
TexteParametre( node, "Ymaxi", "double", x3 ) ;
TexteParametre( node, "Zmini", "double", x4 ) ;
TexteParametre( node, "Zmaxi", "double", x8 ) ;
}
//
// 4.2.3. Cas du rectangle (11, 12, 13)
else if ( ( ZoneType > 10 ) && ( ZoneType < 14 ) )
{
_Texte += Texte_inport( "double", "Umini" ) ;
_Texte += Texte_inport( "double", "Umaxi" ) ;
_Texte += Texte_inport( "double", "Vmini" ) ;
_Texte += Texte_inport( "double", "Vmaxi" ) ;
_Texte += Texte_inport( "long", "Orient" ) ;
TexteParametre( node, "Umini", "double", x0 ) ;
TexteParametre( node, "Umaxi", "double", x1 ) ;
TexteParametre( node, "Vmini", "double", x2 ) ;
TexteParametre( node, "Vmaxi", "double", x3 ) ;
TexteParametre( node, "Orient", "int", x8 ) ;
}
//
// 4.2.4. Cas du disque (31, 32, 33) ou du disque perce (61, 62, 63)
else if ( ( ( ZoneType > 30 ) && ( ZoneType < 34 ) ) || ( ( ZoneType > 60 ) && ( ZoneType < 64 ) ) )
{
_Texte += Texte_inport( "double", "Ucentre" ) ;
_Texte += Texte_inport( "double", "Vcentre" ) ;
_Texte += Texte_inport( "double", "Radius" ) ;
TexteParametre( node, "Ucentre", "double", x0 ) ;
TexteParametre( node, "Vcentre", "double", x1 ) ;
TexteParametre( node, "Radius", "double", x2 ) ;
if ( ZoneType > 60 )
{
_Texte += Texte_inport( "double", "InternalRadius" ) ;
TexteParametre( node, "InternalRadius", "double", x3 ) ;
}
_Texte += Texte_inport( "long", "Orient" ) ;
TexteParametre( node, "Orient", "int", x8 ) ;
}
//
// 4.2.5. Cas de la sphere (4)
else if ( ZoneType == 4 )
{
_Texte += Texte_inport( "double", "Xcentre" ) ;
_Texte += Texte_inport( "double", "Ycentre" ) ;
_Texte += Texte_inport( "double", "Zcentre" ) ;
_Texte += Texte_inport( "double", "Radius" ) ;
TexteParametre( node, "Xcentre", "double", x0 ) ;
TexteParametre( node, "Ycentre", "double", x1 ) ;
TexteParametre( node, "Zcentre", "double", x2 ) ;
TexteParametre( node, "Radius", "double", x8 ) ;
}
//
// 4.2.6. Cas du cylindre (5) ou du tuyau (7)
else if ( ZoneType == 5 || ZoneType == 7 )
{
_Texte += Texte_inport( "double", "Xcentre" ) ;
_Texte += Texte_inport( "double", "Ycentre" ) ;
_Texte += Texte_inport( "double", "Zcentre" ) ;
_Texte += Texte_inport( "double", "Xaxis" ) ;
_Texte += Texte_inport( "double", "Yaxis" ) ;
_Texte += Texte_inport( "double", "Zaxis" ) ;
_Texte += Texte_inport( "double", "Radius" ) ;
_Texte += Texte_inport( "double", "Height" ) ;
TexteParametre( node, "Xcentre", "double", x0 ) ;
TexteParametre( node, "Ycentre", "double", x1 ) ;
TexteParametre( node, "Zcentre", "double", x2 ) ;
TexteParametre( node, "Xaxis", "double", x3 ) ;
TexteParametre( node, "Yaxis", "double", x4 ) ;
TexteParametre( node, "Zaxis", "double", x5 ) ;
TexteParametre( node, "Radius", "double", x6 ) ;
if ( ZoneType == 5 )
{
TexteParametre( node, "Height", "double", x8 ) ;
}
else
{
_Texte += Texte_inport( "double", "InternalRadius" ) ;
TexteParametre( node, "Height", "double", x7 ) ;
TexteParametre( node, "InternalRadius", "double", x8 ) ;
}
}
//
// 4.2.7. Erreur
else
{ VERIFICATION("Type de zone inconnu." == 0); }
//
// 5. La fin
_Texte += " <outport name=\"return\" type=\"HOMARD_Zone\"/>\n" ;
_Texte += " </service>\n" ;
//
return texte_control ;
//
}
//===============================================================================
// La description des frontieres
// BoundaryType : le type de la frontiere
// pythonStructure : le python correspondant a la frontiere
// methode : methode associee a la creation de la frontiere
// BoundaryName : nom de la frontiere
// MeshName : nom du maillage dans le cas d'une frontiere discrete
// MeshFile : nom du fichier du maillage dans le cas d'une frontiere discrete
//===============================================================================
std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::string pythonStructure, const std::string methode, const std::string BoundaryName, const std::string MeshName, const std::string MeshFile )
{
MESSAGE("Texte_Iter_1_Boundary, BoundaryType = "<<BoundaryType<<", pythonStructure = "<<pythonStructure);
MESSAGE("methode = "<<methode<<", BoundaryName = "<<BoundaryName );
if (BoundaryType == 0) { MESSAGE("MeshName = "<<MeshName<<", MeshFile = "<<MeshFile ); }
//
// 1. Le nom du noeud
std::string noeud_2 = methode + "_" + BoundaryName ;
std::string node ;
if ( _LangueShort == "fr" ) { node = "Boucle_de_convergence.Alternance_Calcul_HOMARD" ; }
else { node = "Convergence_Loop.Alternation_Computation_HOMARD" ; }
node += ".Adaptation.p0_Adaptation_HOMARD.HOMARD_Initialisation.p1_Iter_1." ;
node += noeud_2 ;
// 2. Texte de controle : le noeud precedent est _noeud_1, le noeud courant noeud_2.
// A la fin, on bascule le courant dans le precedent
std::string texte_control = Texte_control (_noeud_1, noeud_2, 1) ;
_noeud_1 = noeud_2 ;
// 3. Definition du service
std::string motcle ;
_Texte += " <service name=\"" + noeud_2 + "\">\n" ;
if ( _LangueShort == "fr" ) { motcle = "Etude_Initialisation" ; }
else { motcle = "Study_Initialisation" ; }
_Texte += " <node>" + motcle + ".UpdateStudy</node>\n" ;
_Texte += " <method>" + methode + "</method>\n" ;
// 4. Les inports
// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl
// 4.1. Le nom de la frontiere
_Texte += Texte_inport( "string", "BoundaryName" ) ;
TexteParametre( node, "BoundaryName", "string", BoundaryName ) ;
// 4.2. Cas d une frontiere discrete
if (BoundaryType == 0)
{
_Texte += Texte_inport( "string", "MeshName" ) ;
TexteParametre( node, "MeshName", "string", MeshName ) ;
_Texte += Texte_inport( "string", "FileName" ) ;
TexteParametre( node, "FileName", "string", MeshFile ) ;
}
// 4.3. Cas d'une frontiere analytique : les valeurs numeriques
else
{
// 4.3.1. Decodage des valeurs
// La chaine pythonStructure est de ce genre :
// CreateBoundaryCylinder('cyl_2', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
// CreateBoundaryDi("intersection", "PIQUAGE", "/scratch/D68518/Salome/script/sfr_2d_piquage.fr.med")
std::string ligne = pythonStructure ;
// On commence par ne garder que ce qui suit la premiere virgule
ligne = GetStringInTexte( ligne, ",", 1 );
// On boucle pour isoler toutes les chaines dans les virgules
std::string lignebis ;
std::string x0, x1, x2, x3, x4, x5, x6, x7 ;
int iaux = 0 ;
while ( ligne != lignebis )
{
lignebis = GetStringInTexte ( ligne, ",", 0 ) ;
// MESSAGE("lignebis = "<<lignebis );
if ( iaux == 0 ) { x0 = lignebis ; }
else if ( iaux == 1 ) { x1 = lignebis ; }
else if ( iaux == 2 ) { x2 = lignebis ; }
else if ( iaux == 3 ) { x3 = lignebis ; }
else if ( iaux == 4 ) { x4 = lignebis ; }
else if ( iaux == 5 ) { x5 = lignebis ; }
else if ( iaux == 6 ) { x6 = lignebis ; }
ligne = GetStringInTexte( ligne, ",", 1 );
iaux += 1 ;
}
// La derniere valeur est toujours mise dans x7
x7 = GetStringInTexte ( ligne, ")", 0 ) ;
MESSAGE("Valeurs = "<< x0<<", "<<x1<< ", "<< x2<< ", "<< x3<<", "<<x4<<", "<<x5<<", "<<x6<<", x7"<<x7);
//
// 4.3.2. Cas du cylindre (1)
if ( BoundaryType == 1 )
{
_Texte += Texte_inport( "double", "Xcentre" ) ;
_Texte += Texte_inport( "double", "Ycentre" ) ;
_Texte += Texte_inport( "double", "Zcentre" ) ;
_Texte += Texte_inport( "double", "Xaxis" ) ;
_Texte += Texte_inport( "double", "Yaxis" ) ;
_Texte += Texte_inport( "double", "Zaxis" ) ;
_Texte += Texte_inport( "double", "Radius" ) ;
TexteParametre( node, "Xcentre", "double", x0 ) ;
TexteParametre( node, "Ycentre", "double", x1 ) ;
TexteParametre( node, "Zcentre", "double", x2 ) ;
TexteParametre( node, "Xaxis", "double", x3 ) ;
TexteParametre( node, "Yaxis", "double", x4 ) ;
TexteParametre( node, "Zaxis", "double", x5 ) ;
TexteParametre( node, "Radius", "double", x7 ) ;
}
//
// 4.3.3. Cas de la sphere (2)
else if ( BoundaryType == 2 )
{
_Texte += Texte_inport( "double", "Xcentre" ) ;
_Texte += Texte_inport( "double", "Ycentre" ) ;
_Texte += Texte_inport( "double", "Zcentre" ) ;
_Texte += Texte_inport( "double", "Radius" ) ;
TexteParametre( node, "Xcentre", "double", x0 ) ;
TexteParametre( node, "Ycentre", "double", x1 ) ;
TexteParametre( node, "Zcentre", "double", x2 ) ;
TexteParametre( node, "Radius", "double", x7 ) ;
}
//
// 4.3.4. Cas d un cone defini par un axe et un angle
else if ( BoundaryType == 3 )
{
_Texte += Texte_inport( "double", "Xaxis" ) ;
_Texte += Texte_inport( "double", "Yaxis" ) ;
_Texte += Texte_inport( "double", "Zaxis" ) ;
_Texte += Texte_inport( "double", "Angle" ) ;
_Texte += Texte_inport( "double", "Xcentre" ) ;
_Texte += Texte_inport( "double", "Ycentre" ) ;
_Texte += Texte_inport( "double", "Zcentre" ) ;
TexteParametre( node, "Xaxis", "double", x0 ) ;
TexteParametre( node, "Yaxis", "double", x1 ) ;
TexteParametre( node, "Zaxis", "double", x2 ) ;
TexteParametre( node, "Angle", "double", x3 ) ;
TexteParametre( node, "Xcentre", "double", x4 ) ;
TexteParametre( node, "Ycentre", "double", x5 ) ;
TexteParametre( node, "Zcentre", "double", x7 ) ;
}
//
// 4.3.5. Cas d un cone defini par les 2 rayons
else if ( BoundaryType == 4 )
{
_Texte += Texte_inport( "double", "Xcentre1" ) ;
_Texte += Texte_inport( "double", "Ycentre1" ) ;
_Texte += Texte_inport( "double", "Zcentre1" ) ;
_Texte += Texte_inport( "double", "Radius1" ) ;
_Texte += Texte_inport( "double", "Xcentre2" ) ;
_Texte += Texte_inport( "double", "Ycentre2" ) ;
_Texte += Texte_inport( "double", "Zcentre2" ) ;
_Texte += Texte_inport( "double", "Radius2" ) ;
TexteParametre( node, "Xcentre1", "double", x0 ) ;
TexteParametre( node, "Ycentre1", "double", x1 ) ;
TexteParametre( node, "Zcentre1", "double", x2 ) ;
TexteParametre( node, "Radius1", "double", x3 ) ;
TexteParametre( node, "Xcentre2", "double", x4 ) ;
TexteParametre( node, "Ycentre2", "double", x5 ) ;
TexteParametre( node, "Zcentre2", "double", x6 ) ;
TexteParametre( node, "Radius2", "double", x7 ) ;
}
// 4.3.6. Cas du tore (5)
else if ( BoundaryType == 5 )
{
_Texte += Texte_inport( "double", "Xcentre" ) ;
_Texte += Texte_inport( "double", "Ycentre" ) ;
_Texte += Texte_inport( "double", "Zcentre" ) ;
_Texte += Texte_inport( "double", "Xaxis" ) ;
_Texte += Texte_inport( "double", "Yaxis" ) ;
_Texte += Texte_inport( "double", "Zaxis" ) ;
_Texte += Texte_inport( "double", "RRev" ) ;
_Texte += Texte_inport( "double", "RPri" ) ;
TexteParametre( node, "Xcentre", "double", x0 ) ;
TexteParametre( node, "Ycentre", "double", x1 ) ;
TexteParametre( node, "Zcentre", "double", x2 ) ;
TexteParametre( node, "Xaxis", "double", x3 ) ;
TexteParametre( node, "Yaxis", "double", x4 ) ;
TexteParametre( node, "Zaxis", "double", x5 ) ;
TexteParametre( node, "RRev", "double", x6 ) ;
TexteParametre( node, "RPri", "double", x7 ) ;
}
//
// 4.3.7. Erreur
else
{ VERIFICATION("Type de frontiere inconnu." == 0); }
}
//
// 5. La fin
_Texte += " <outport name=\"return\" type=\"HOMARD_Boundary\"/>\n" ;
_Texte += " </service>\n" ;
//
return texte_control ;
//
}
//===============================================================================
// Fin du controle des enchainements de noeud dans le noeud Iter_1
//===============================================================================
std::string YACSDriver::Texte_Iter_1_control()
{
MESSAGE("Texte_Iter_1_control");
//
std::string texte ;
texte = Texte_control (_noeud_1, "CreateHypothesis", 1) ;
texte += Texte_control ("CreateHypothesis", "Case_Options", 0) ;
//
return texte ;
//
}
//===============================================================================
// Controle des enchainements de noeuds
// noeud_1 : noeud de depart
// noeud_2 : noeud d'arrivee
// option : 0 : sans caractere de saut de ligne a la fin
// 1 : avec caractere de saut de ligne a la fin
//===============================================================================
std::string YACSDriver::Texte_control( const std::string noeud_1, const std::string noeud_2, int option )
{
MESSAGE("Texte_control, noeud_1 = "<<noeud_1<<", noeud_2 = "<<noeud_2<<", option = "<<option);
//
std::string texte ;
texte = " <control> " ;
texte += "<fromnode>" + noeud_1 + "</fromnode>" ;
texte += " <tonode>" + noeud_2 + "</tonode>" ;
texte += " </control>" ;
if ( option == 1 ) { texte += "\n" ; }
return texte ;
//
}
//===============================================================================
// Inport
// inport_type : type de la donnee a importer
// inport_nom : nom de la donnee a importer
//===============================================================================
std::string YACSDriver::Texte_inport( const std::string inport_type, const std::string inport_nom )
{
// MESSAGE("Texte_inport, inport_type = "<<inport_type<<", inport_nom = "<<inport_nom);
//
std::string texte ;
texte = " <inport " ;
texte += "name=\"" + inport_nom + "\" " ;
texte += "type=\"" + inport_type + "\"" ;
texte += "/>\n" ;
return texte ;
//
}
//===============================================================================
// Le repertoire d'execution
//===============================================================================
void YACSDriver::Texte_HOMARD_Exec_DirName( )
{
MESSAGE("Texte_HOMARD_Exec_DirName");
//
_Texte += "DirName = \"" + _DirName + "\"\n" ;
//
}
//===============================================================================
// Le nom du maillage
//===============================================================================
void YACSDriver::Texte_HOMARD_Exec_MeshName( const std::string MeshName )
{
MESSAGE("Texte_HOMARD_Exec_MeshName pour "<<MeshName);
//
_Texte += "MeshName = \"" + MeshName + "\"\n" ;
//
}
//===============================================================================
// Manipulation des instructions python - 1
// pythonTexte : le texte des instructions python a manipuler
// indice : numero de la premiere ligne voulue
// concept : nom du concept a inserer
//===============================================================================
void YACSDriver::Texte_python_1( const std::string pythonTexte, int indice, const std::string concept )
{
MESSAGE("Texte_python_1, pythonTexte\n"<<pythonTexte);
MESSAGE("indice = "<<indice<<", concept = "<<concept);
//
// Conversion de type
std::istringstream tout (pythonTexte) ;
// MESSAGE("\ntout :"<<tout);
std::string ligne; // variable contenant chaque ligne de python
std::string ligne_bis ; // variable contenant la portion de ligne de python apres '.'
int cptr = 0 ;
indice -= 1 ;
while ( std::getline( tout, ligne ) )
{
if ( cptr > indice )
{
int position = ligne.find_first_of( "." ) ;
MESSAGE("\nposition : "<< position);
if ( position > 0 )
{
ligne_bis = ligne.substr( position );
MESSAGE("\nligne_bis : "<< ligne_bis);
_Texte += concept + ligne_bis + "\n" ;
}
}
cptr += 1 ;
}
//
}
//===============================================================================
// Manipulation des instructions python - 2
// pythonTexte : le texte des instructions python a manipuler
// mot_cle : mot-cle dans les lignes a inserer
// concept : nom du concept a inserer
//===============================================================================
void YACSDriver::Texte_python_2( const std::string pythonTexte, const std::string mot_cle, const std::string concept )
{
MESSAGE("Texte_python_2, pythonTexte\n"<<pythonTexte);
MESSAGE("mot_cle = "<<mot_cle<<", concept = "<<concept);
//
// Conversion de type
std::istringstream tout (pythonTexte) ;
// MESSAGE("\ntout :"<<tout);
std::string ligne; // variable contenant chaque ligne de python
std::string ligne_bis ; // variable contenant la portion de ligne de python apres '.'
while ( std::getline( tout, ligne ) )
{
int reperage = ligne.find( mot_cle ) ;
if ( reperage > 0 )
{
int position = ligne.find_first_of( "." ) ;
// MESSAGE("\nposition : "<< position);
if ( position > 0 )
{
ligne_bis = ligne.substr( position );
// MESSAGE("\nligne_bis : "<< ligne_bis);
_Texte += concept + ligne_bis + "\n" ;
}
}
}
//
}
//===============================================================================
// Parametres de tests de convergence
//===============================================================================
void YACSDriver::TexteAnalyse_Test_Convergence( int MaxIter, int MaxNode, int MaxElem )
{
//
// MESSAGE("TexteAnalyse_Test_Convergence");
std::string chaine ;
std::ostringstream oss1;
oss1 << MaxIter;
chaine = oss1.str();
_Texte += "MaxIter = " + chaine + "\n" ;
std::ostringstream oss2;
oss2 << MaxNode;
chaine = oss2.str();
_Texte += "MaxNode = " + chaine + "\n" ;
std::ostringstream oss3;
oss3 << MaxElem;
chaine = oss3.str();
_Texte += "MaxElem = " + chaine + "\n" ;
//
}
//===============================================================================
// Creation d'un parametre
//===============================================================================
void YACSDriver::TexteParametre( const std::string node, const std::string port, const std::string type_value, const std::string value )
{
//
// MESSAGE("TexteParametre");
_Texte_parametres += " <parameter>\n" ;
_Texte_parametres += " <tonode>" + node + "</tonode>" ;
_Texte_parametres += "<toport>" + port + "</toport>\n" ;
_Texte_parametres += " <value><" + type_value + ">" + value + "</" + type_value + "></value>\n" ;
_Texte_parametres += " </parameter>\n" ;
//
}
//===============================================================================
// Ajout des parametres
//===============================================================================
void YACSDriver::TexteAddParametres( )
{
//
MESSAGE("TexteAddParametres");
TexteAdd(_Texte_parametres) ;
//
}
//===============================================================================
void YACSDriver::CreeFichier( )
{
//
MESSAGE("CreeFichier sur le fichier "<<_XMLFile);
std::ofstream Fic(_XMLFile.c_str(), std::ios::out ) ;
if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
Fic.close() ;
//
}
//===============================================================================
// REMARQUE : on devrait utiliser le GetStringInTexte de HOMARD_Gen_i mais je ne sais pas
// comment l'appeler. ALors je clone.
// Recuperation de la chaine de caracteres par rapport l'apparition d'un texte
// ligne : la ligne a manipuler
// texte : le texte a reperer
// option : 0 : la chaine avant le texte
// 1 : la chaine apres le texte
// Si le texte est absent, on retourne la chaine totale
//===============================================================================
std::string YACSDriver::GetStringInTexte( const std::string ligne, const std::string texte, int option )
{
// MESSAGE("GetStringInTexte, recherche de '"<<texte<<"' dans '"<<ligne<<"'"<<", option = "<<option);
//
std::string chaine = ligne ;
int position = ligne.find_first_of( texte ) ;
if ( position > 0 )
{
if ( option == 0 ) { chaine = ligne.substr( 0, position ) ; }
else { chaine = ligne.substr( position+1 ) ; }
}
// Conversion de type
return chaine ;
//
}

68
src/ADAPT/YACSDriver.hxx Normal file
View File

@ -0,0 +1,68 @@
// HOMARD HOMARD : implementation of HOMARD idl descriptions
//
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
# ifndef __YACSDRIVER_H__
# define __YACSDRIVER_H__
#include "HOMARD.hxx"
#include <iostream>
#include <fstream>
class HOMARDIMPL_EXPORT YACSDriver
{
public:
YACSDriver(const std::string XMLFile, const std::string DirName, const std::string LangueShort) ;
~YACSDriver() ;
//
void TexteAdd( const std::string ligne ) ;
void Texte_DataInit_MeshFile( const std::string Meshfile ) ;
void Texte_Alternance_Calcul_HOMARD_Calcul( const std::string FileName ) ;
void Texte_Iter_1_Case_Options( const std::string pythonCas ) ;
std::string Texte_Iter_1_Boundary( int BoundaryType, const std::string pythonStructure, const std::string methode, const std::string BoundaryName, const std::string MeshName, const std::string MeshFile ) ;
std::string Texte_Iter_1_Zone( int ZoneType, const std::string pythonStructure, const std::string methode, const std::string ZoneName ) ;
std::string Texte_Iter_1_control() ;
std::string Texte_control( const std::string noeud_1, const std::string noeud_2, int option ) ;
std::string Texte_inport( const std::string inport_type, const std::string inport_nom ) ;
void Texte_HOMARD_Exec_DirName( ) ;
void Texte_HOMARD_Exec_MeshName( const std::string MeshName ) ;
void Texte_python_1( const std::string pythonTexte, int indice, const std::string concept ) ;
void Texte_python_2( const std::string pythonTexte, const std::string mot_cle, const std::string concept ) ;
void TexteParametre( const std::string node, const std::string port, const std::string type_value, const std::string value ) ;
void TexteAnalyse_Test_Convergence( int MaxIter, int MaxNode, int MaxElem ) ;
void TexteAddParametres( ) ;
void CreeFichier() ;
//
public:
std::string _XMLFile ;
std::string _DirName ;
std::string _Texte ;
std::string _Texte_parametres ;
std::string _noeud_1 ;
std::string _LangueShort ;
bool _bLu;
private :
std::string GetStringInTexte( const std::string Texte, const std::string String, int option ) ;
};
# endif /* # ifndef __YACSDRIVER_H__ */

View File

@ -0,0 +1,459 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="en_GB">
<context>
<name>@default</name>
<message>
<source>HOM_MEN_HOMARD</source>
<translation>HOMARD</translation>
</message>
<message>
<source>HOM_MEN_MODIFICATION</source>
<translation>Modification</translation>
</message>
<message>
<source>HOM_MEN_INFORMATION</source>
<translation>Information</translation>
</message>
<message>
<source>HOM_MEN_YACS</source>
<translation>YACS</translation>
</message>
<message>
<source>HOM_MEN_NEW_CASE</source>
<translation>New case</translation>
</message>
<message>
<source>HOM_MEN_NEW_ITERATION</source>
<translation>Next iteration</translation>
</message>
<message>
<source>HOM_MEN_PURSUE_ITERATION</source>
<translation>Case: pursuit of a stored iteration</translation>
</message>
<message>
<source>HOM_MEN_COMPUTE</source>
<translation>Compute</translation>
</message>
<message>
<source>HOM_MEN_COMPUTE_PUBLISH</source>
<translation>Compute and publish</translation>
</message>
<message>
<source>HOM_MEN_EDIT</source>
<translation>Edit</translation>
</message>
<message>
<source>HOM_MEN_DELETE</source>
<translation>Delete</translation>
</message>
<message>
<source>HOM_MEN_MESH_INFO</source>
<translation>Mesh analysis</translation>
</message>
<message>
<source>HOM_MEN_MESH_PUBLICATION</source>
<translation>Mesh publication</translation>
</message>
<message>
<source>HOM_MEN_EDIT_MESS_FILE</source>
<translation>Show the file</translation>
</message>
<message>
<source>HOM_MEN_WRITE</source>
<translation>Write</translation>
</message>
<message>
<source>HOM_TOP_HOMARD</source>
<translation>HOMARD</translation>
</message>
<message>
<source>HOM_TOP_NEW_CASE</source>
<translation>New case</translation>
</message>
<message>
<source>HOM_TOP_NEW_ITERATION</source>
<translation>Next iteration</translation>
</message>
<message>
<source>HOM_TOP_PURSUE_ITERATION</source>
<translation>Case: pursuit of a stored iteration</translation>
</message>
<message>
<source>HOM_TOP_COMPUTE</source>
<translation>Compute</translation>
</message>
<message>
<source>HOM_TOP_COMPUTE_PUBLISH</source>
<translation>Compute and publish</translation>
</message>
<message>
<source>HOM_TOP_EDIT</source>
<translation>Edit</translation>
</message>
<message>
<source>HOM_TOP_DELETE</source>
<translation>Delete</translation>
</message>
<message>
<source>HOM_TOP_EDIT_MESS_FILE</source>
<translation>Show the file</translation>
</message>
<message>
<source>HOM_STB_HOMARD</source>
<translation>HOMARD</translation>
</message>
<message>
<source>HOM_STB_NEW_CASE</source>
<translation>New case</translation>
</message>
<message>
<source>HOM_STB_NEW_ITERATION</source>
<translation>Next iteration</translation>
</message>
<message>
<source>HOM_STB_PURSUE_ITERATION</source>
<translation>Case: pursuit of a stored iteration</translation>
</message>
<message>
<source>HOM_STB_COMPUTE</source>
<translation>Compute</translation>
</message>
<message>
<source>HOM_STB_COMPUTE_PUBLISH</source>
<translation>Compute and publish</translation>
</message>
<message>
<source>HOM_STB_EDIT</source>
<translation>Edit</translation>
</message>
<message>
<source>HOM_STB_DELETE</source>
<translation>Delete</translation>
</message>
<message>
<source>HOM_STB_EDIT_MESS_FILE</source>
<translation>Show the file</translation>
</message>
<message>
<source>HOM_WARNING</source>
<translation>Warning</translation>
</message>
<message>
<source>HOM_ERROR</source>
<translation>Error</translation>
</message>
<message>
<source>HOM_INACTIVE_BUTTON</source>
<translation>Inactive button</translation>
</message>
<message>
<source>HOM_SELECT_OBJECT_1</source>
<translation>Select an object.</translation>
</message>
<message>
<source>HOM_SELECT_OBJECT_2</source>
<translation>Select only one object.</translation>
</message>
<message>
<source>HOM_SELECT_OBJECT_3</source>
<translation>Select an object with type %1.</translation>
</message>
<message>
<source>HOM_SELECT_OBJECT_4</source>
<translation>The name of the object is already selected. Modify it or cancel.</translation>
</message>
<message>
<source>HOM_SELECT_FILE_0</source>
<translation>File selection</translation>
</message>
<message>
<source>HOM_SELECT_FILE_1</source>
<translation>Select a file.</translation>
</message>
<message>
<source>HOM_SELECT_FILE_2</source>
<translation>Select only one file.</translation>
</message>
<message>
<source>HOM_SELECT_FILE_3</source>
<translation>This file cannot be opened.</translation>
</message>
<message>
<source>HOM_SCRIPT_FILE</source>
<translation>A script file must be given.</translation>
</message>
<message>
<source>HOM_MED_FILE_1</source>
<translation>This MED file cannot be read.</translation>
</message>
<message>
<source>HOM_MED_FILE_2</source>
<translation>No mesh in this MED file.</translation>
</message>
<message>
<source>HOM_MED_FILE_3</source>
<translation>More than one mesh in this MED file.</translation>
</message>
<message>
<source>HOM_MED_FILE_4</source>
<translation>The mesh in this MED file cannot be read.</translation>
</message>
<message>
<source>HOM_MED_FILE_5</source>
<translation>No field in this MED file.</translation>
</message>
<message>
<source>HOM_MED_FILE_6</source>
<translation>The field(s) in this MED file cannot be read.</translation>
</message>
<message>
<source>HOM_SELECT_STUDY</source>
<translation>Select a study object with associated MED file \n or select a MED file.</translation>
</message>
<message>
<source>HOM_CASE_NAME</source>
<translation>The case must be named.</translation>
</message>
<message>
<source>HOM_CASE_DIRECTORY_1</source>
<translation>A directory for the case must be selected.</translation>
</message>
<message>
<source>HOM_CASE_DIRECTORY_2</source>
<translation>This directory is already used by the case </translation>
</message>
<message>
<source>HOM_CASE_DIRECTORY_3</source>
<translation>A valid directory for the case must be selected.</translation>
</message>
<message>
<source>HOM_CASE_DIRECTORY_4</source>
<translation>A directory for the computation must be selected.</translation>
</message>
<message>
<source>HOM_START_DIRECTORY_1</source>
<translation>A starting directory for the pursuit must be selected.</translation>
</message>
<message>
<source>HOM_START_DIRECTORY_3</source>
<translation>A valid directory for the pursuit must be selected.</translation>
</message>
<message>
<source>HOM_CASE_MESH</source>
<translation>The file of the initial mesh must be selected.</translation>
</message>
<message>
<source>HOM_CASE_GROUP</source>
<translation>The group &quot;%1&quot; cannot be given for more than 1 boundary.</translation>
</message>
<message>
<source>HOM_CASE_EDIT_WINDOW_TITLE</source>
<translation>Edition of a case</translation>
</message>
<message>
<source>HOM_CASE_EDIT_STATE_0</source>
<translation>Initial mesh.</translation>
</message>
<message>
<source>HOM_CASE_EDIT_STATE</source>
<translation>Pursuit of an iteration.</translation>
</message>
<message>
<source>HOM_CASE_PURSUE_WINDOW_TITLE</source>
<translation>Case: pursuit of a stored iteration</translation>
</message>
<message>
<source>HOM_ITER_NAME</source>
<translation>The iteration must be named.</translation>
</message>
<message>
<source>HOM_ITER_STARTING_POINT</source>
<translation>The previous iteration must be given.</translation>
</message>
<message>
<source>HOM_ITER_MESH</source>
<translation>Give a name for the final mesh.</translation>
</message>
<message>
<source>HOM_ITER_HYPO</source>
<translation>A hypothesis must be selected.</translation>
</message>
<message>
<source>HOM_ITER_FIELD_FILE</source>
<translation>With this hypothesis, a file for the field must be given.</translation>
</message>
<message>
<source>HOM_ITER_STARTING_POINT_0</source>
<translation>Mesh</translation>
</message>
<message>
<source>HOM_ITER_STARTING_POINT_1</source>
<translation>First iteration of the case.</translation>
</message>
<message>
<source>HOM_ITER_STARTING_POINT_2</source>
<translation>First iteration of the case for the pursuit.</translation>
</message>
<message>
<source>HOM_ITER_EDIT_WINDOW_TITLE</source>
<translation>Edition of an iteration</translation>
</message>
<message>
<source>HOM_HYPO_NAME</source>
<translation>The hypothesis must be named.</translation>
</message>
<message>
<source>HOM_HYPO_FIELD_FILE</source>
<translation>A file for the field must be given.</translation>
</message>
<message>
<source>HOM_HYPO_ZONE_1</source>
<translation>A zone must be selected.</translation>
</message>
<message>
<source>HOM_HYPO_ZONE_2</source>
<translation>At least, one zone must be selected.</translation>
</message>
<message>
<source>HOM_HYPO_ZONE_3</source>
<translation>Either refinement or coarsening, but not both.</translation>
</message>
<message>
<source>HOM_HYPO_NORM_L2</source>
<translation>L2 norm</translation>
</message>
<message>
<source>HOM_HYPO_NORM_INF</source>
<translation>Infinite norm</translation>
</message>
<message>
<source>HOM_HYPO_NORM_ABS</source>
<translation>Absolute</translation>
</message>
<message>
<source>HOM_HYPO_NORM_REL</source>
<translation>Relative</translation>
</message>
<message>
<source>HOM_HYPO_COMP</source>
<translation>At least, one component must be selected.</translation>
</message>
<message>
<source>HOM_HYPO_EDIT_WINDOW_TITLE</source>
<translation>Edition of a hypothesis</translation>
</message>
<message>
<source>HOM_ZONE_NAME</source>
<translation>The zone must be named.</translation>
</message>
<message>
<source>HOM_ZONE_LIMIT</source>
<translation>%1 maxi must be greater than %1 mini.</translation>
</message>
<message>
<source>HOM_ZONE_RAYON</source>
<translation>The external radius must be greater than the internal radius.</translation>
</message>
<message>
<source>HOM_ZONE_EDIT_WINDOW_TITLE</source>
<translation>Edition of a zone</translation>
</message>
<message>
<source>HOM_BOUN_NAME</source>
<translation>The boundary must be named.</translation>
</message>
<message>
<source>HOM_BOUN_MESH</source>
<translation>The file for the mesh of the boundary must be selected.</translation>
</message>
<message>
<source>HOM_BOUN_CAO</source>
<translation>The file for the CAO must be selected.</translation>
</message>
<message>
<source>HOM_BOUN_CASE</source>
<translation>The meshfile of the case is unknown.</translation>
</message>
<message>
<source>HOM_AXE</source>
<translation>The axis must be a non 0 vector.</translation>
</message>
<message>
<source>HOM_BOUN_C_EDIT_WINDOW_TITLE</source>
<translation>Edition of a CAO based boundary</translation>
</message>
<message>
<source>HOM_BOUN_A_EDIT_WINDOW_TITLE</source>
<translation>Edition of an analytical boundary</translation>
</message>
<message>
<source>HOM_BOUN_D_EDIT_WINDOW_TITLE</source>
<translation>Edition of a discrete boundary</translation>
</message>
<message>
<source>HOM_GROU_EDIT_WINDOW_TITLE</source>
<translation>Selected groups</translation>
</message>
<message>
<source>HOM_MESH_INFO_0</source>
<translation>Mesh analysis</translation>
</message>
<message>
<source>HOM_MESH_INFO_1</source>
<translation>Select at least one option.</translation>
</message>
<message>
<source>HOM_MESH_INFO_2</source>
<translation>Analysis in the object browser, file </translation>
</message>
<message>
<source>HOM_YACS_EDIT_WINDOW_TITLE</source>
<translation>Edition of a schema YACS</translation>
</message>
<message>
<source>PREF_TAB_GENERAL</source>
<translation>General</translation>
</message>
<message>
<source>PREF_PUBLICATION</source>
<translation>Publication</translation>
</message>
<message>
<source>PREF_PUBLICATION_MAILLAGE_IN</source>
<translation>IN meshes</translation>
</message>
<message>
<source>PREF_PUBLICATION_MAILLAGE_OUT</source>
<translation>OUT meshes</translation>
</message>
<message>
<source>PREF_YACS</source>
<translation>YACS</translation>
</message>
<message>
<source>PREF_YACS_MAX</source>
<translation>Maximum numbers</translation>
</message>
<message>
<source>PREF_YACS_MAX_ITER</source>
<translation>Iterations</translation>
</message>
<message>
<source>PREF_YACS_MAX_NODE</source>
<translation>Nodes</translation>
</message>
<message>
<source>PREF_YACS_MAX_ELEM</source>
<translation>Elements</translation>
</message>
<message>
<source>PREF_YACS_CONVERGENCE</source>
<translation>Convergence</translation>
</message>
<message>
<source>PREF_YACS_TYPE_TEST</source>
<translation>Test type</translation>
</message>
</context>
</TS>

1171
src/ADAPTGUI/ADAPT_msg_fr.ts Normal file

File diff suppressed because it is too large Load Diff

1148
src/ADAPTGUI/ADAPT_msg_ja.ts Normal file

File diff suppressed because it is too large Load Diff

177
src/ADAPTGUI/CMakeLists.txt Normal file
View File

@ -0,0 +1,177 @@
# Copyright (C) 2012-2020 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, or (at your option) any later version.
#
# 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
#
INCLUDE(UseQtExt)
INCLUDE(UsePyQt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
${QT_INCLUDES}
${OpenCASCADE_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${MEDFILE_INCLUDE_DIRS}
${HDF5_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${KERNEL_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/idl
${PROJECT_BINARY_DIR}/adm_local/unix
${PROJECT_SOURCE_DIR}/src/ADAPT
${PROJECT_SOURCE_DIR}/src/ADAPT_I
)
# additional preprocessor / compiler flags
ADD_DEFINITIONS(
${OMNIORB_DEFINITIONS}
${OpenCASCADE_DEFINITIONS}
${KERNEL_DEFINITIONS}
)
# libraries to link to
SET(_link_LIBRARIES
${MEDFILE_C_LIBRARIES}
${KERNEL_SalomeLifeCycleCORBA}
${KERNEL_SalomeDS}
${GUI_SalomeApp}
SalomeIDLADAPT
ADAPTEngine
)
# --- resources ---
# resource files / to be processed by lrelease
SET(_ts_RESOURCES
ADAPT_msg_en.ts
ADAPT_msg_fr.ts
ADAPT_msg_ja.ts
)
# resource files / to be processed by uic
SET(_uic_FILES
CreateBoundaryCAO.ui
CreateBoundaryAn.ui
CreateBoundaryDi.ui
CreateCase.ui
CreateHypothesis.ui
CreateIteration.ui
CreateListGroup.ui
CreateYACS.ui
CreateZone.ui
EditFile.ui
IterInfo.ui
MeshInfo.ui
PursueIteration.ui
)
# --- headers ---
# header files / to be processed by moc
SET(_moc_HEADERS
HOMARDGUI.h
MonCreateBoundaryCAO.h
MonCreateBoundaryAn.h
MonCreateBoundaryDi.h
MonEditBoundaryCAO.h
MonEditBoundaryAn.h
MonEditBoundaryDi.h
MonCreateCase.h
MonEditCase.h
MonCreateZone.h
MonEditZone.h
MonCreateHypothesis.h
MonEditHypothesis.h
MonCreateListGroup.h
MonCreateListGroupCAO.h
MonEditListGroup.h
MonEditListGroupCAO.h
MonCreateIteration.h
MonEditIteration.h
MonPursueIteration.h
MonMeshInfo.h
MonIterInfo.h
MonCreateYACS.h
MonEditYACS.h
MonEditFile.h
)
# header files / uic wrappings
QT_WRAP_UIC(_uic_HEADERS ${_uic_FILES})
# header files / static
SET(_other_HEADERS
HOMARDGUI_Utils.h
HomardQtCommun.h
HOMARDGUI_Exports.hxx
)
# header files / to install
SET(ADAPT_HEADERS ${_other_HEADERS} ${_moc_HEADERS} ${_uic_HEADERS})
# --- sources ---
# sources / moc wrappings
QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
HOMARDGUI.cxx
HOMARDGUI_Utils.cxx
MonCreateBoundaryCAO.cxx
MonCreateBoundaryAn.cxx
MonCreateBoundaryDi.cxx
MonEditBoundaryCAO.cxx
MonEditBoundaryAn.cxx
MonEditBoundaryDi.cxx
MonCreateCase.cxx
MonEditCase.cxx
MonCreateHypothesis.cxx
MonEditHypothesis.cxx
MonCreateListGroup.cxx
MonCreateListGroupCAO.cxx
MonEditListGroup.cxx
MonEditListGroupCAO.cxx
MonCreateIteration.cxx
MonEditIteration.cxx
MonPursueIteration.cxx
MonCreateZone.cxx
MonEditZone.cxx
MonMeshInfo.cxx
MonIterInfo.cxx
MonCreateYACS.cxx
MonEditYACS.cxx
MonEditFile.cxx
HomardQtCommun.cxx
)
# sources / to compile
SET(ADAPT_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS})
# --- rules ---
ADD_LIBRARY(ADAPT ${ADAPT_SOURCES})
TARGET_LINK_LIBRARIES(ADAPT ${_link_LIBRARIES} )
INSTALL(TARGETS ADAPT EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${ADAPT_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_ADAPT_INSTALL_RES_DATA}")

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateBoundaryCAO</class>
<widget class="QDialog" name="CreateBoundaryCAO">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>566</width>
<height>195</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Get CAO</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="3" column="0" colspan="3">
<widget class="QGroupBox" name="GBButtons">
<property name="title">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="3">
<widget class="QPushButton" name="buttonHelp">
<property name="text">
<string>Help</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="buttonCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonApply">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="CBGroupe">
<property name="text">
<string>Filtering with groups</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="LEFileName">
<property name="minimumSize">
<size>
<width>370</width>
<height>21</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="PushFichier">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="XAO">
<property name="text">
<string>XAO</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="LEName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
<property name="maxLength">
<number>32</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="Name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateBoundaryDi</class>
<widget class="QDialog" name="CreateBoundaryDi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>566</width>
<height>169</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Create a discrete boundary</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="3" column="0" colspan="3">
<widget class="QGroupBox" name="GBButtons">
<property name="title">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="3">
<widget class="QPushButton" name="buttonHelp">
<property name="text">
<string>Help</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="buttonCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonApply">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="CBGroupe">
<property name="text">
<string>Filtering with groups</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="LEFileName">
<property name="minimumSize">
<size>
<width>370</width>
<height>21</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="PushFichier">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="Mesh">
<property name="text">
<string>Mesh</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="LEName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
<property name="maxLength">
<number>32</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="Name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

777
src/ADAPTGUI/CreateCase.ui Normal file
View File

@ -0,0 +1,777 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateCase</class>
<widget class="QDialog" name="CreateCase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>1150</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>320</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
<property name="baseSize">
<size>
<width>600</width>
<height>320</height>
</size>
</property>
<property name="windowTitle">
<string>Create a case</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QWidget" name="WName" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="Name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="LEName"/>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>199</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="5">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="Directory">
<property name="text">
<string>Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PushDir">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LEDirName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="4">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="5">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="Mesh">
<property name="text">
<string>Mesh</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PushFichier">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LEFileName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="5">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="GBTypeConf">
<property name="title">
<string>Conformity type</string>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<widget class="QRadioButton" name="RBConforme">
<property name="text">
<string>Conformal</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RBNonConforme">
<property name="text">
<string>Non conformal</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0" colspan="4">
<widget class="QGroupBox" name="GBTypeBoun">
<property name="title">
<string>Boundary type</string>
</property>
<layout class="QHBoxLayout" name="_3">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<widget class="QRadioButton" name="RBBoundaryNo">
<property name="text">
<string>No boundary</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RBBoundaryCAO">
<property name="text">
<string>CAO</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RBBoundaryNonCAO">
<property name="text">
<string>Non CAO</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="6">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0" colspan="3">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="CBBoundaryD">
<property name="text">
<string>Discrete boundary</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CBBoundaryA">
<property name="text">
<string>Analytical boundary</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0" colspan="2">
<widget class="QGroupBox" name="GBBoundaryC">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>CAO</string>
</property>
<layout class="QGridLayout" name="_2">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="3">
<widget class="QPushButton" name="PBBoundaryCAOEdit">
<property name="text">
<string>Edit</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="PBBoundaryCAOHelp">
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QComboBox" name="CBBoundaryCAO">
<property name="currentIndex">
<number>-1</number>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="PBBoundaryCAONew">
<property name="text">
<string>New</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="7" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="0" colspan="4">
<widget class="QGroupBox" name="GBBoundaryD">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Discrete boundary</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QComboBox" name="CBBoundaryDi">
<property name="currentIndex">
<number>-1</number>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="PBBoundaryDiEdit">
<property name="text">
<string>Edit</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="PBBoundaryDiHelp">
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="PBBoundaryDiNew">
<property name="text">
<string>New</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="9" column="0" colspan="7">
<widget class="QGroupBox" name="GBBoundaryA">
<property name="minimumSize">
<size>
<width>548</width>
<height>200</height>
</size>
</property>
<property name="title">
<string>Analytical boundary</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QTableWidget" name="TWBoundary">
<property name="editTriggers">
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
</property>
<property name="showGrid">
<bool>true</bool>
</property>
<property name="rowCount">
<number>0</number>
</property>
<property name="columnCount">
<number>1</number>
</property>
<column>
<property name="text">
<string>a_virer</string>
</property>
</column>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="0">
<widget class="QPushButton" name="PBBoundaryAnEdit">
<property name="text">
<string>Edit</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="PBBoundaryAnNew">
<property name="text">
<string>New</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="PBBoundaryAnHelp">
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="10" column="0">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>239</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="0">
<widget class="QCheckBox" name="CBAdvanced">
<property name="text">
<string>Advanced options</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="3">
<widget class="QGroupBox" name="GBAdvancedOptions">
<property name="title">
<string>Advanced options</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QCheckBox" name="CBPyramid">
<property name="text">
<string>Authorized pyramids</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="GBConforme">
<property name="title">
<string>Conformity +</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QRadioButton" name="RBStandard">
<property name="text">
<string>Standard</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RBBox">
<property name="text">
<string>Box</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RBNC1NpA">
<property name="text">
<string>1 node per edge</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RBNCQuelconque">
<property name="text">
<string>Free</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="GBFormat">
<property name="title">
<string>Format</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="RBMED">
<property name="text">
<string>MED</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="RBSaturne">
<property name="text">
<string>Saturne</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QRadioButton" name="RBSaturne2D">
<property name="text">
<string>Saturne 2D</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="12" column="4" colspan="3">
<spacer name="spacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>128</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="13" column="0">
<spacer name="spacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>239</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
<item row="14" column="0">
<widget class="QLabel" name="Comment">
<property name="text">
<string> No comment.</string>
</property>
</widget>
</item>
<item row="14" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>35</height>
</size>
</property>
</spacer>
</item>
<item row="15" column="0" colspan="2">
<widget class="QGroupBox" name="GroupButtons">
<property name="title">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="4">
<widget class="QPushButton" name="buttonHelp">
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonApply">
<property name="text">
<string>Apply</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="buttonCancel">
<property name="text">
<string>Cancel</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="15" column="3" colspan="2">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>128</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
</layout>
<zorder>WName</zorder>
<zorder>GBTypeConf</zorder>
<zorder>GBBoundaryD</zorder>
<zorder>GBBoundaryA</zorder>
<zorder>CBAdvanced</zorder>
<zorder>GBAdvancedOptions</zorder>
<zorder>Comment</zorder>
<zorder>GroupButtons</zorder>
<zorder>GBBoundaryC</zorder>
<zorder>GBTypeBoun</zorder>
</widget>
<resources/>
<connections/>
</ui>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,600 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateIteration</class>
<widget class="QScrollArea" name="CreateIteration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>777</width>
<height>668</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>750</width>
<height>400</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
<property name="baseSize">
<size>
<width>750</width>
<height>400</height>
</size>
</property>
<property name="windowTitle">
<string>Create an iteration</string>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>773</width>
<height>664</height>
</rect>
</property>
<property name="sizeGripEnabled" stdset="0">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="Iteration_Name">
<property name="text">
<string>Iteration Name</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>117</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" colspan="2">
<widget class="QLineEdit" name="LEName">
<property name="minimumSize">
<size>
<width>290</width>
<height>21</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="0" column="5">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="Iter_Parent">
<property name="text">
<string>Previous iteration</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="PBIterParent">
<property name="enabled">
<bool>true</bool>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>27</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="3" colspan="2">
<widget class="QLineEdit" name="LEIterationParentName">
<property name="minimumSize">
<size>
<width>0</width>
<height>21</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="Mesh_n">
<property name="text">
<string>Mesh n</string>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>117</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3" colspan="3">
<widget class="QLineEdit" name="LEMeshName_n">
<property name="minimumSize">
<size>
<width>290</width>
<height>21</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="6">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="Mesh_np1">
<property name="text">
<string>Mesh n+1</string>
</property>
</widget>
</item>
<item row="3" column="2">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>117</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3" colspan="3">
<widget class="QLineEdit" name="LEMeshName_np1">
<property name="minimumSize">
<size>
<width>290</width>
<height>21</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="3" column="6">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>62</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" colspan="6">
<widget class="QGroupBox" name="GBField">
<property name="title">
<string>Field information</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="2" colspan="5">
<widget class="QLineEdit" name="LEFieldFile">
<property name="minimumSize">
<size>
<width>282</width>
<height>21</height>
</size>
</property>
</widget>
</item>
<item row="1" column="3" colspan="4">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>138</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="6">
<widget class="QRadioButton" name="RBChosen">
<property name="text">
<string>Chosen time step</string>
</property>
</widget>
</item>
<item row="4" column="6">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>255</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="5">
<widget class="QSpinBox" name="SpinBox_Rank">
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>1010000</number>
</property>
<property name="value">
<number>-1</number>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QLabel" name="Rank">
<property name="text">
<string>Rank</string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="SpinBox_TimeStep">
<property name="minimum">
<number>-2</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>-1</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="TimeStep">
<property name="text">
<string>Time step</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>138</width>
<height>28</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3" colspan="3">
<widget class="QRadioButton" name="RBLast">
<property name="text">
<string>Last time step</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QRadioButton" name="RBNo">
<property name="text">
<string>No time step</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="PushFieldFile">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="FieldFile">
<property name="text">
<string>Field file</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="6">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>69</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0" colspan="4">
<widget class="QGroupBox" name="Hypothese">
<property name="title">
<string>Hypothesis</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QComboBox" name="CBHypothese">
<property name="currentIndex">
<number>-1</number>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="PBHypoEdit">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="PBHypoNew">
<property name="text">
<string>New</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="7" column="4" colspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0" colspan="4">
<widget class="QGroupBox" name="GroupButtons">
<property name="title">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonApply">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="buttonCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="buttonHelp">
<property name="text">
<string>Help</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="9" column="4" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>139</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,121 @@
<ui version="4.0" >
<class>CreateListGroup</class>
<widget class="QDialog" name="CreateListGroup" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>717</width>
<height>600</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Selection of groups</string>
</property>
<property name="autoFillBackground" >
<bool>true</bool>
</property>
<property name="sizeGripEnabled" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" >
<widget class="QGroupBox" name="GBButtons" >
<property name="title" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="3" >
<widget class="QPushButton" name="buttonHelp" >
<property name="text" >
<string>Help</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="buttonCancel" >
<property name="text" >
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="buttonApply" >
<property name="text" >
<string>Apply</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QPushButton" name="buttonOk" >
<property name="text" >
<string>OK</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" >
<widget class="QGroupBox" name="GBOptions" >
<property name="title" >
<string>Selected groups</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QTableWidget" name="TWGroupe" >
<property name="showGrid" >
<bool>true</bool>
</property>
<property name="rowCount" >
<number>0</number>
</property>
<property name="columnCount" >
<number>2</number>
</property>
<column>
<property name="text" >
<string>Selection</string>
</property>
</column>
<column>
<property name="text" >
<string>Group</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

526
src/ADAPTGUI/CreateYACS.ui Normal file
View File

@ -0,0 +1,526 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateYACS</class>
<widget class="QScrollArea" name="CreateYACS">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>684</width>
<height>649</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>500</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
<property name="baseSize">
<size>
<width>600</width>
<height>500</height>
</size>
</property>
<property name="windowTitle">
<string>Create YACS</string>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>680</width>
<height>645</height>
</rect>
</property>
<property name="sizeGripEnabled" stdset="0">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QWidget" name="WName" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="Name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="LEName">
<property name="maxLength">
<number>32</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>131</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="Case">
<property name="text">
<string>Case</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="PBCaseName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>27</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="LECaseName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="_2">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="Script">
<property name="text">
<string>Script</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBScriptFile">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LEScriptFile">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="DirectoryStart">
<property name="text">
<string>Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBDir">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LEDirName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<layout class="QHBoxLayout" name="_3">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="MeshFile">
<property name="text">
<string>Mesh file</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PBMeshFile">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LEMeshFile">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QGroupBox" name="GBTypeSchema">
<property name="title">
<string>Type of schema</string>
</property>
<layout class="QHBoxLayout" name="_4">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<widget class="QRadioButton" name="RBConstant">
<property name="text">
<string>Constant</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RBVariable">
<property name="text">
<string>Variable</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<widget class="QGroupBox" name="GBMax">
<property name="title">
<string>Maximum of ...</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="TLMaxIteration">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Iterations</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="SpinBoxMaxIter">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>999999999</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="TLMaxNodes">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Nodes</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="SpinBoxMaxNode">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>999999999</number>
</property>
<property name="singleStep">
<number>1000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="TLMaxElem">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Elements</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="SpinBoxMaxElem">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>999999999</number>
</property>
<property name="singleStep">
<number>1000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>269</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0">
<widget class="QGroupBox" name="GBConvergence">
<property name="title">
<string>Test of convergence</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QRadioButton" name="RBNone">
<property name="text">
<string>None</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="RBVMinAbs">
<property name="text">
<string>Vtest &gt; Vref</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QRadioButton" name="RBVMaxAbs">
<property name="text">
<string>Vtest &lt; Vref</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelVref">
<property name="text">
<string>Vref</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxConvergence">
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>-999999999.000000000000000</double>
</property>
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="7" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>269</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="0">
<widget class="QGroupBox" name="GroupButtons">
<property name="title">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="4">
<widget class="QPushButton" name="buttonHelp">
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonApply">
<property name="text">
<string>Apply</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="buttonCancel">
<property name="text">
<string>Cancel</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="8" column="1">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>128</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

1139
src/ADAPTGUI/CreateZone.ui Normal file

File diff suppressed because it is too large Load Diff

115
src/ADAPTGUI/EditFile.ui Normal file
View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditFile</class>
<widget class="QWidget" name="EditFile">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>675</width>
<height>901</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit a file</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>331</width>
<height>49</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="GroupButtons">
<property name="title">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1">
<widget class="QPushButton" name="buttonPrint">
<property name="text">
<string>Print</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="buttonQuit">
<property name="text">
<string>Quit</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>14</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QTextBrowser" name="QTBEditFile">
<property name="minimumSize">
<size>
<width>530</width>
<height>800</height>
</size>
</property>
<property name="font">
<font>
<family>Courier New</family>
</font>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

909
src/ADAPTGUI/HOMARDGUI.cxx Normal file
View File

@ -0,0 +1,909 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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 : HOMARDGUI.cxx
// Author : Gerald NICOLAS, EDF
// Module : HOMARD
#include "HOMARDGUI.h"
// SALOME Includes
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SUIT_ResourceMgr.h"
#include "SUIT_MessageBox.h"
#include "SUIT_Session.h"
#include "SUIT_ViewWindow.h"
#include "SUIT_ViewManager.h"
#include <SUIT_Desktop.h>
#include "CAM_Module.h"
#include "OB_Browser.h"
#include "SALOME_ListIO.hxx"
#include "SalomeApp_Application.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Study.h"
#include "LightApp_SelectionMgr.h"
#include "LightApp_Selection.h"
#include <LightApp_Preferences.h>
#include "SalomeApp_Module.h"
#include "SALOMEconfig.h"
#include <SALOME_LifeCycleCORBA.hxx>
#include <utilities.h>
// QT Includes
#include <QMenu>
#include "MonCreateCase.h"
#include "MonCreateIteration.h"
#include "MonPursueIteration.h"
#include "MonCreateYACS.h"
#include "MonEditBoundaryCAO.h"
#include "MonEditBoundaryAn.h"
#include "MonEditBoundaryDi.h"
#include "MonEditCase.h"
#include "MonEditHypothesis.h"
#include "MonEditIteration.h"
#include "MonEditYACS.h"
#include "MonEditZone.h"
#include "MonMeshInfo.h"
#include "MonIterInfo.h"
#include "MonEditFile.h"
#include "HomardQtCommun.h"
// BOOST Includes
#include <boost/shared_ptr.hpp>
//Pour le _CAST
#include "SALOMEDS_Study.hxx"
#include "HOMARDGUI_Utils.h"
using namespace std;
static CORBA::ORB_var _orb;
//=======================================================================
// function : HOMARDGUI()
// purpose : Constructor
//=======================================================================
HOMARDGUI::HOMARDGUI(const QString&) :
SalomeApp_Module( "HOMARD" ) // default name
{
}
//=======================================================================
// function : ~HOMARDGUI()
// purpose : Destructor
//=======================================================================
HOMARDGUI::~HOMARDGUI()
{
}
//=======================================================================
// function : InitHOMARDGen
// launch HOMARD component and return a handle
//=======================================================================
HOMARD::HOMARD_Gen_var HOMARDGUI::InitHOMARDGen(SalomeApp_Application* app)
{
Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","HOMARD" );
HOMARD::HOMARD_Gen_var clr = HOMARD::HOMARD_Gen::_narrow(comp);
ASSERT(!CORBA::is_nil(clr));
return clr;
}
//=======================================================================
// Module's initialization
void HOMARDGUI::initialize( CAM_Application* app )
//=======================================================================
{
SalomeApp_Module::initialize( app );
InitHOMARDGen(dynamic_cast<SalomeApp_Application*>( app ));
anId = 0;
createActions();
createMenus();
recupPreferences();
}
//================================================
// function : createHOMARDAction
// create an item in status bar and Homard menu
//================================================
void HOMARDGUI::createHOMARDAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle )
{
// MESSAGE("createHOMARDAction");
QIcon icon;
QWidget* parent = application()->desktop();
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
QPixmap pix;
if ( icon_id.length() )
pix = resMgr->loadPixmap( "HOMARD", tr( icon_id .toLatin1().data()) );
else
pix = resMgr->loadPixmap( "HOMARD", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data()), false );
if ( !pix.isNull() )
icon = QIcon( pix );
QString tooltip = tr(QString( "HOM_TOP_%1" ).arg( po_id ).toLatin1().data()),
menu = tr(QString( "HOM_MEN_%1" ).arg( po_id ).toLatin1().data()),
status_bar = tr(QString( "HOM_STB_%1" ).arg( po_id ).toLatin1().data());
createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) );
}
//================================================
// function : createAction
// constructs Homard menu
// calls createHOMARDAction for each item
//================================================
void HOMARDGUI::createActions(){
//
createHOMARDAction( 1101, "NEW_CASE", "cas_calcule.png" );
createHOMARDAction( 1102, "PURSUE_ITERATION", "iter_poursuite.png" );
createHOMARDAction( 1103, "NEW_ITERATION", "iter_next.png" );
createHOMARDAction( 1111, "COMPUTE", "mesh_compute.png" );
createHOMARDAction( 1112, "COMPUTE_PUBLISH", "mesh_compute.png" );
createHOMARDAction( 1121, "MESH_INFO", "advanced_mesh_info.png" );
createHOMARDAction( 1131, "MESH_PUBLICATION", "mesh_tree_mesh.png" );
//
createHOMARDAction( 1201, "EDIT", "loop.png" );
createHOMARDAction( 1211, "DELETE", "delete.png" );
//
createHOMARDAction( 1301, "MESH_INFO", "advanced_mesh_info.png" );
createHOMARDAction( 1302, "EDIT_MESS_FILE", "texte.png" );
//
createHOMARDAction( 1401, "YACS", "table_view.png" );
//
}
//================================================
// function : createPreferences
//================================================
void HOMARDGUI::createPreferences()
{
MESSAGE("createPreferences")
int Onglet, Bloc, Pref ;
// 1. Generalites
Onglet = addPreference( tr( "PREF_TAB_GENERAL" ) );
// Onglet = addPreference( tr( "PREF_TAB_SETTINGS" ) ) ;
Bloc = addPreference( tr( "PREF_PUBLICATION" ), Onglet );
setPreferenceProperty( Bloc, "columns", 1 );
Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_IN" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_in" );
Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_OUT" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_out" );
// 2. YACS
Onglet = addPreference( tr( "PREF_YACS" ) ) ;
Bloc = addPreference( tr( "PREF_YACS_MAX" ), Onglet );
setPreferenceProperty( Bloc, "columns", 1 );
Pref = addPreference( tr( "PREF_YACS_MAX_ITER" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_iter" );
setPreferenceProperty( Pref, "min", 0 );
setPreferenceProperty( Pref, "max", 100000000 );
setPreferenceProperty( Pref, "step", 1 );
Pref = addPreference( tr( "PREF_YACS_MAX_NODE" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_node" );
setPreferenceProperty( Pref, "min", 0 );
setPreferenceProperty( Pref, "max", 100000000 );
setPreferenceProperty( Pref, "step", 1000 );
Pref = addPreference( tr( "PREF_YACS_MAX_ELEM" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_elem" );
setPreferenceProperty( Pref, "min", 0 );
setPreferenceProperty( Pref, "max", 100000000 );
setPreferenceProperty( Pref, "step", 1000 );
Bloc = addPreference( tr( "PREF_YACS_CONVERGENCE" ), Onglet );
setPreferenceProperty( Bloc, "columns", 1 );
Pref = addPreference( tr( "PREF_YACS_TYPE_TEST" ), Bloc, LightApp_Preferences::Selector, "HOMARD", "yacs_type_test" );
QStringList aListOfTypeTest;
aListOfTypeTest << "None";
aListOfTypeTest << "VTest > VRef";
aListOfTypeTest << "VTest < VRef";
setPreferenceProperty( Pref, "strings", aListOfTypeTest );
}
//================================================
// function : createMenus
//================================================
void HOMARDGUI::createMenus()
{
MESSAGE("createMenus")
//
int HOMARD_Id = createMenu( tr( "HOM_MEN_HOMARD" ), -1, 5, 10 );
createMenu( 1101, HOMARD_Id, -1 ); //Create_Case
createMenu( 1102, HOMARD_Id, -1 ); //Pursue_Iteration
createMenu( separator(), HOMARD_Id,-1);
createMenu( 1103, HOMARD_Id, -1 ); //Create_Iteration
createMenu( 1111, HOMARD_Id, -1 ); //Compute
createMenu( 1112, HOMARD_Id, -1 ); //Compute and publish
//
HOMARD_Id = createMenu( tr( "HOM_MEN_MODIFICATION" ), -1, 5, 10 );
createMenu( 1201, HOMARD_Id, -1 ); //Edit
createMenu( 1211, HOMARD_Id, -1 ); //Delete
//
HOMARD_Id = createMenu( tr( "HOM_MEN_INFORMATION" ), -1, 5, 10 );
createMenu( 1301, HOMARD_Id, -1 ); //Information sur un maillage
createMenu( 1131, HOMARD_Id, -1 ); //Mesh publication
createMenu( separator(), HOMARD_Id,-1);
createMenu( 1302, HOMARD_Id, -1 ); //EditAsciiFile pour le fichier listeStd ou bilan
createMenu( separator(), HOMARD_Id,-1);
createMenu( 1201, HOMARD_Id, -1 ); //Edit
createMenu( separator(), HOMARD_Id,-1);
//
HOMARD_Id = createMenu( tr( "HOM_MEN_YACS" ), -1, 5, 10 );
createMenu( 1401, HOMARD_Id, -1 ); // Création d'un schéma YACS
createMenu( separator(), HOMARD_Id,-1);
}
//================================================
// function : recupPreferences
// Pour chaque valeur, le defaut est la valeur definie dans HOMARD_Gen
// . Si la recuperation dans config/salome s'est bien passee a la creation de HOMARD_Gen,
// ces valeurs sont les valeurs definies.
// . Si cela ne s'est pas bien passe, ce sont les valeurs par defaut de HOMARD_Gen
//================================================
void HOMARDGUI::recupPreferences()
{
MESSAGE("recupPreferences")
//
// A. Declarations
//
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() );
HOMARD::HOMARD_Gen_var homardGen = HOMARDGUI::InitHOMARDGen(app);
int defaut_i ;
std::string defaut_s ;
QString QString_v ;
//
// B. Les valeurs
// B.1. La langue
//
defaut_s = homardGen->GetLanguageShort();
SUIT_ResourceMgr* resMgr = getApp()->resourceMgr();
_LanguageShort = resMgr->stringValue("language", "language", QString(defaut_s.c_str()) );
//
// B.2. Les publications
bool publish_mesh ;
//
_PublisMeshIN = homardGen->GetPublisMeshIN();
if ( _PublisMeshIN == 1 ) { publish_mesh = true ; }
else { publish_mesh = false ; }
publish_mesh = resMgr->booleanValue("HOMARD", "publish_mesh_in", publish_mesh );
if ( publish_mesh ) { _PublisMeshIN = 1 ; }
else { _PublisMeshIN = 0 ; }
//
_PublisMeshOUT = homardGen->GetPublisMeshOUT();
if ( _PublisMeshOUT == 1 ) { publish_mesh = true ; }
else { publish_mesh = false ; }
publish_mesh = resMgr->booleanValue("HOMARD", "publish_mesh_out", publish_mesh );
if ( publish_mesh ) { _PublisMeshOUT = 1 ; }
else { _PublisMeshOUT = 0 ; }
//
// B.3. Les maximum pour YACS
//
defaut_i = homardGen->GetYACSMaxIter();
_YACSMaxIter = resMgr->integerValue("HOMARD", "yacs_max_iter", defaut_i );
//
defaut_i = homardGen->GetYACSMaxNode();
_YACSMaxNode = resMgr->integerValue("HOMARD", "yacs_max_node", defaut_i );
//
defaut_i = homardGen->GetYACSMaxElem();
_YACSMaxElem = resMgr->integerValue("HOMARD", "yacs_max_elem", defaut_i );
//
// B.4. La convergence pour YACS
//
defaut_i = homardGen->GetYACSConvergenceType();
if ( defaut_i == 1 ) { QString_v = tr("VTest > VRef") ; }
else if ( defaut_i == 2 ) { QString_v = tr("VTest < VRef") ; }
else { QString_v = tr("None") ; }
QString_v = resMgr->stringValue ( "HOMARD", "yacs_type_test", QString_v );
if ( ( QString_v == "VTest > VRef" ) || ( QString_v == "VTest &gt; VRef" ) ) { _YACSTypeTest = 1 ; }
else if ( ( QString_v == "VTest < VRef" ) || ( QString_v == "VTest &lt; VRef" ) ) { _YACSTypeTest = 2 ; }
else { _YACSTypeTest = 0 ; }
//
// C. Enregistrement dans l'objet general
//
MESSAGE ("Enregistrement de LanguageShort = " << _LanguageShort.toStdString().c_str() );
MESSAGE ("Enregistrement de PublisMeshIN = " << _PublisMeshIN<<", PublisMeshOUT = "<< _PublisMeshOUT);
MESSAGE ("Enregistrement de YACSMaxIter = " << _YACSMaxIter<<", YACSMaxNode = "<< _YACSMaxNode<<", YACSMaxElem = "<< _YACSMaxElem);
MESSAGE ("Enregistrement de YACSTypeTest = " << _YACSTypeTest);
//
homardGen->SetLanguageShort(_LanguageShort.toStdString().c_str());
homardGen->SetPublisMesh(_PublisMeshIN, _PublisMeshOUT);
homardGen->SetYACSMaximum(_YACSMaxIter, _YACSMaxNode, _YACSMaxElem);
//
homardGen->SetYACSConvergenceType(_YACSTypeTest);
}
//================================================
void HOMARDGUI::OnGUIEvent()
//================================================
{
MESSAGE("OnGUIEvent()")
setOrb();
const QObject* obj = sender();
if ( !obj || !obj->inherits( "QAction" ) ) { return; }
int id = actionId((QAction*)obj);
if ( id != -1 ) { bool ret = OnGUIEvent( id ); }
MESSAGE("Fin de OnGUIEvent()");
}
//=======================================================================
// Method OnGUIEvent pour Homard
//=======================================================================
bool HOMARDGUI::OnGUIEvent (int theCommandID)
{
MESSAGE("OnGUIEvent avec theCommandID = "<<theCommandID);
// A. Controles
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() );
if ( !app ) return false;
SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
if ( !stud )
{
MESSAGE ( "FAILED to cast active study to SalomeApp_Study" );
return false;
}
SUIT_Desktop* parent = application()->desktop();
HOMARD::HOMARD_Gen_var homardGen = HOMARDGUI::InitHOMARDGen(app);
if (!CORBA::is_nil(homardGen))
homardGen->UpdateStudy();
getApp()->updateObjectBrowser();
// B. Choix selon les commandes
SCRUTE(theCommandID);
switch (theCommandID)
{
case 1101: // Creation d un Cas
{
MESSAGE("command " << theCommandID << " activated");
MonCreateCase *aDlg = new MonCreateCase( true,
HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
aDlg->show();
break;
}
case 1102: // Poursuite d une iteration
{
MESSAGE("command " << theCommandID << " activated");
MonPursueIteration *aDlg = new MonPursueIteration( true,
HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
aDlg->show();
break;
}
case 1103: // Creation d une Iteration
{
MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
MonCreateIteration *IterDlg = new MonCreateIteration( parent, true,
HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
IterDlg->show();
break;
}
case 1111: // Compute une iteration
{
MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
try { homardGen->Compute(_ObjectName.toStdString().c_str(), 0, 1, -1, 1); }
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
getApp()->updateObjectBrowser();
return false;
}
break;
}
case 1112: // Compute une iteration et publication
{
MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
try { homardGen->Compute(_ObjectName.toStdString().c_str(), 0, 1, -1, 2); }
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
getApp()->updateObjectBrowser();
return false;
}
break;
}
case 1121: // Information sur le maillage de l'iteration
{
MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
MonIterInfo *IterDlg = new MonIterInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
IterDlg->show();
break;
}
case 1131: // Publication du maillage de l'iteration
{
MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
homardGen->PublishMeshIterInSmesh(_ObjectName.toStdString().c_str());
break;
}
case 1132: // Publication du maillage de l'iteration a partir du fichier
{
MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
homardGen->PublishResultInSmesh(_ObjectName.toStdString().c_str(), 1);
break;
}
case 1201: // Edition d'un objet
{
MESSAGE("command " << theCommandID << " activated");
QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1);
if (nomObjet == QString("")) break;
_PTR(SObject) obj = chercheMonObjet();
if (obj)
{
// Edition d'une frontiere CAO
if (HOMARD_UTILS::isBoundaryCAO(obj))
{
MonEditBoundaryCAO *aDlg = new MonEditBoundaryCAO(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
aDlg->show();
}
// Edition d'une frontiere discrete
else if (HOMARD_UTILS::isBoundaryDi(obj))
{
MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
aDlg->show();
}
// Edition d'une frontiere analytique
else if (HOMARD_UTILS::isBoundaryAn(obj))
{
MonEditBoundaryAn *aDlg = new MonEditBoundaryAn(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
aDlg->show();
}
// Edition d'un cas
else if (HOMARD_UTILS::isCase(obj))
{
MonEditCase *aDlg = new MonEditCase(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
aDlg->show();
}
// Edition d'une hypothese
else if (HOMARD_UTILS::isHypo(obj))
{
MonEditHypothesis *aDlg = new MonEditHypothesis(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, QString(""), QString("")) ;
aDlg->show();
}
// Edition d'une iteration
else if (HOMARD_UTILS::isIter(obj))
{
MonEditIteration *aDlg = new MonEditIteration(parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
aDlg->show();
}
// Edition d'un schema YACS
else if (HOMARD_UTILS::isYACS(obj))
{
MESSAGE("appel de MonEditYACS");
MonEditYACS *aDlg = new MonEditYACS(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName) ;
aDlg->show();
}
// Edition d'une zone
else if (HOMARD_UTILS::isZone(obj))
{
MonEditZone *aDlg = new MonEditZone(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
aDlg->show();
}
}
break;
}
case 1211: // Suppression d'un objet
{
MESSAGE("command " << theCommandID << " activated");
QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1);
if (nomObjet == QString("")) break;
_PTR(SObject) obj = chercheMonObjet();
if (obj)
{
// Suppression d'une frontiere
if ( HOMARD_UTILS::isBoundaryCAO(obj) || HOMARD_UTILS::isBoundaryDi(obj) || HOMARD_UTILS::isBoundaryAn(obj) )
{
try
{ homardGen->DeleteBoundary(_ObjectName.toStdString().c_str()); }
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
getApp()->updateObjectBrowser();
return false;
}
}
// Suppression d'un cas
else if (HOMARD_UTILS::isCase(obj))
{
try
{ homardGen->DeleteCase(_ObjectName.toStdString().c_str(), 1); }
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
getApp()->updateObjectBrowser();
return false;
}
}
// Suppression d'une hypothese
else if (HOMARD_UTILS::isHypo(obj))
{
try
{ homardGen->DeleteHypo(_ObjectName.toStdString().c_str()); }
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
getApp()->updateObjectBrowser();
return false;
}
}
// Suppression d'une iteration
else if (HOMARD_UTILS::isIter(obj))
{
try
{ homardGen->DeleteIteration(_ObjectName.toStdString().c_str(), 1); }
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
getApp()->updateObjectBrowser();
return false;
}
}
// Suppression d'un schema YACS
else if (HOMARD_UTILS::isYACS(obj))
{
try
{ homardGen->DeleteYACS(_ObjectName.toStdString().c_str(), 1); }
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
getApp()->updateObjectBrowser();
return false;
}
}
// Suppression d'une zone
else if (HOMARD_UTILS::isZone(obj))
{
try
{ homardGen->DeleteZone(_ObjectName.toStdString().c_str()); }
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
getApp()->updateObjectBrowser();
return false;
}
}
}
break;
}
case 1301: // Information sur un maillage
{
MESSAGE("etape 1301")
MESSAGE("command " << theCommandID << " activated");
MonMeshInfo *aDlg = new MonMeshInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ;
aDlg->show();
break;
}
case 1302: // Affichage de fichier texte
{
MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
_PTR(SObject) obj = chercheMonObjet();
if ( (obj) && ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) ) )
{
MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, 0 ) ;
if ( aDlg->_codret == 0 ) { aDlg->show(); }
}
break;
}
case 1401: // Création d'un schema YACS
{
MESSAGE("etape 1401")
MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
MonCreateYACS *aDlg = new MonCreateYACS( true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ;
aDlg->show();
break;
}
case 1402: // Ecriture d'un schéma YACS
{
MESSAGE("etape 1402")
MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() );
try { homardGen->YACSWrite(_ObjectName.toStdString().c_str()); }
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
getApp()->updateObjectBrowser();
return false;
}
break;
}
}
getApp()->updateObjectBrowser();
return true;
}
//=============================================================================
/*!
*
*/
//=============================================================================
// Module's engine IOR
//=============================================================================
QString HOMARDGUI::engineIOR() const
//=============================================================================
{
CORBA::String_var anIOR = getApp()->orb()->object_to_string( InitHOMARDGen(getApp()) );
return QString( anIOR.in() );
}
// Module's activation
//=============================================================================
bool HOMARDGUI::activateModule( SUIT_Study* theStudy )
//=============================================================================
{
bool bOk = SalomeApp_Module::activateModule( theStudy );
setMenuShown( true );
setToolShown( true );
return bOk;
}
// Module's deactivation
//=============================================================================
bool HOMARDGUI::deactivateModule( SUIT_Study* theStudy )
//=============================================================================
{
setMenuShown( false );
setToolShown( false );
return SalomeApp_Module::deactivateModule( theStudy );
}
// Default windows
//=============================================================================
void HOMARDGUI::windows( QMap<int, int>& theMap ) const
//=============================================================================
{
theMap.clear();
theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
#ifndef DISABLE_PYCONSOLE
theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
#endif
}
//=============================================================================
void HOMARDGUI::setOrb()
//=============================================================================
{
try
{
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
_orb = init( 0 , 0 );
}
catch (...)
{
INFOS("internal error : orb not found");
_orb = 0;
}
ASSERT(! CORBA::is_nil(_orb));
}
//========================================
_PTR(SObject) HOMARDGUI::chercheMonObjet()
//========================================
{
SALOMEDSClient_SObject* aSO = NULL;
_PTR(SObject) obj;
SALOME_ListIO lst;
getApp()->selectionMgr()->selectedObjects( lst );
if ( lst.Extent() == 1 )
{
Handle(SALOME_InteractiveObject) io = lst.First();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
_PTR(Study) study = appStudy->studyDS();
_PTR(SObject) obj = study->FindObjectID( io->getEntry() );
_ObjectName = QString( obj->GetName().c_str() );
return obj;
}
else { return _PTR(SObject)(aSO); }
}
//=============================================================================
void HOMARDGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
//=============================================================================
{
MESSAGE("Debut de contextMenuPopup");
_PTR(SObject) obj = chercheMonObjet();
if ( obj )
{
title = QString( obj->GetName().c_str() );
_ObjectName = title;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
//
QPixmap pix ;
bool DeleteObject = false ;
bool EditObject = false ;
//
if ( HOMARD_UTILS::isBoundaryCAO(obj) )
{
EditObject = true ;
DeleteObject = true ;
}
else if ( HOMARD_UTILS::isBoundaryAn(obj) )
{
EditObject = true ;
DeleteObject = true ;
}
else if ( HOMARD_UTILS::isBoundaryDi(obj) )
{
EditObject = true ;
DeleteObject = true ;
}
else if ( HOMARD_UTILS::isCase(obj) )
{
pix = resMgr->loadPixmap( "HOMARD", "table_view.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_YACS").toLatin1().data()), this, SLOT(YACSCreate()));
EditObject = true ;
DeleteObject = true ;
}
else if ( HOMARD_UTILS::isHypo(obj) )
{
EditObject = true ;
DeleteObject = true ;
}
else if ( HOMARD_UTILS::isIter(obj) )
{
pix = resMgr->loadPixmap( "HOMARD", "iter_next.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_NEW_ITERATION").toLatin1().data()), this, SLOT(NextIter()));
pix = resMgr->loadPixmap( "HOMARD", "mesh_compute.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_COMPUTE").toLatin1().data()), this, SLOT(LanceCalcul0()));
pix = resMgr->loadPixmap( "HOMARD", "mesh_compute.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_COMPUTE_PUBLISH").toLatin1().data()), this, SLOT(LanceCalcul1()));
pix = resMgr->loadPixmap( "HOMARD", "advanced_mesh_info.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_INFO").toLatin1().data()), this, SLOT(IterInfo()));
pix = resMgr->loadPixmap( "HOMARD", "mesh_tree_mesh.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_PUBLICATION").toLatin1().data()), this, SLOT(MeshPublish0()));
EditObject = true ;
DeleteObject = true ;
}
else if ( HOMARD_UTILS::isYACS(obj) )
{
pix = resMgr->loadPixmap( "HOMARD", "write.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_WRITE").toLatin1().data()), this, SLOT(YACSWrite()));
EditObject = true ;
DeleteObject = true ;
}
else if ( HOMARD_UTILS::isZone(obj) )
{
EditObject = true ;
DeleteObject = true ;
}
else if ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) )
{
pix = resMgr->loadPixmap( "HOMARD", "texte.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT_MESS_FILE").toLatin1().data()), this, SLOT(EditAsciiFile()));
}
else if ( HOMARD_UTILS::isFileType(obj,QString("Mesh")) )
{
pix = resMgr->loadPixmap( "HOMARD", "mesh_tree_mesh.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_PUBLICATION").toLatin1().data()), this, SLOT(MeshPublish1()));
}
// Ajout d'un menu d'edition pour les objets qui le proposent
if ( EditObject )
{
pix = resMgr->loadPixmap( "HOMARD", "loop.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT").toLatin1().data()), this, SLOT(Edit()));
}
// Ajout d'un menu de destruction pour les objets qui le proposent
if ( DeleteObject )
{
pix = resMgr->loadPixmap( "HOMARD", "delete.png" );
menu->addAction(QIcon(pix), tr(QString("HOM_MEN_DELETE").toLatin1().data()), this, SLOT(Delete()));
}
}
}
void HOMARDGUI::NextIter()
{
this->OnGUIEvent(1103);
}
void HOMARDGUI::LanceCalcul0()
{
this->OnGUIEvent(1111);
}
void HOMARDGUI::LanceCalcul1()
{
this->OnGUIEvent(1112);
}
void HOMARDGUI::IterInfo()
{
this->OnGUIEvent(1121);
}
void HOMARDGUI::MeshPublish0()
{
this->OnGUIEvent(1131);
}
void HOMARDGUI::MeshPublish1()
{
this->OnGUIEvent(1132);
}
void HOMARDGUI::Edit()
{
this->OnGUIEvent(1201);
}
void HOMARDGUI::Delete()
{
this->OnGUIEvent(1211);
}
void HOMARDGUI::EditAsciiFile()
{
this->OnGUIEvent(1302);
}
void HOMARDGUI::YACSCreate()
{
this->OnGUIEvent(1401);
}
void HOMARDGUI::YACSWrite()
{
this->OnGUIEvent(1402);
}
//
//=============================================================================
// Export the module
//=============================================================================
extern "C" {
Standard_EXPORT CAM_Module* createModule()
{
return new HOMARDGUI("");
}
}

105
src/ADAPTGUI/HOMARDGUI.h Normal file
View File

@ -0,0 +1,105 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
// HOMARDGUI : HOMARD component GUI implemetation
//
#ifndef _HOMARDGUI_H_
#define _HOMARDGUI_H_
#include "HOMARDGUI_Exports.hxx"
#include <SalomeApp_Module.h>
#include "SalomeApp_Study.h"
#include <SALOMEconfig.h>
#include <SALOME_LifeCycleCORBA.hxx>
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include CORBA_CLIENT_HEADER(HOMARD_Hypothesis)
#include <QString>
class SalomeApp_Application;
class HOMARD_EXPORT HOMARDGUI: public SalomeApp_Module
{
Q_OBJECT
public:
HOMARDGUI(const QString&);
~HOMARDGUI();
virtual bool OnGUIEvent (int theCommandID);
void initialize( CAM_Application* );
QString engineIOR() const;
void windows( QMap<int, int>& ) const;
static HOMARD::HOMARD_Gen_var InitHOMARDGen(SalomeApp_Application* );
public slots:
bool deactivateModule( SUIT_Study* );
bool activateModule( SUIT_Study* );
static void setOrb();
private slots:
void OnGUIEvent();
void EditAsciiFile();
void LanceCalcul0();
void LanceCalcul1();
void IterInfo();
void NextIter();
void MeshPublish0();
void MeshPublish1();
void YACSCreate();
void YACSWrite();
void Edit();
void Delete();
public:
virtual void contextMenuPopup( const QString&, QMenu*, QString& );
private:
void createHOMARDAction( const int id, const QString& po_id, const QString& icon_id = QString(""),
const int key = 0, const bool toggle = false );
void createActions();
void createMenus();
void recupPreferences();
void createPopupMenus();
_PTR(SObject) chercheMonObjet();
virtual void createPreferences();
HOMARD::HOMARD_Gen_var myComponentHomard;
int anId;
QString _ObjectName;
QString _LanguageShort ;
int _PublisMeshIN ;
int _PublisMeshOUT ;
int _YACSMaxIter ;
int _YACSMaxNode ;
int _YACSMaxElem ;
int _YACSTypeTest ;
};
#endif

View File

@ -0,0 +1,35 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef _HOMARDGUI_EXPORTS_H_
#define _HOMARDGUI_EXPORTS_H_
#ifdef WIN32
#if defined HOMARD_EXPORTS || defined Homard_EXPORTS
#define HOMARD_EXPORT __declspec( dllexport )
#else
#define HOMARD_EXPORT __declspec( dllimport )
#endif
#else
#define HOMARD_EXPORT
#endif
#endif //_HOMARDGUI_EXPORTS_H_

View File

@ -0,0 +1,278 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "HOMARDGUI_Utils.h"
#include "OB_Browser.h"
#include "SUIT_Desktop.h"
#include "SUIT_Application.h"
#include "SUIT_Session.h"
#include "LightApp_SelectionMgr.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Module.h"
#include "SalomeApp_Study.h"
#include "SALOME_ListIO.hxx"
#include "SALOMEconfig.h"
#include "utilities.h"
#include <string>
#include <HOMARDGUI.h>
#include <qstring.h>
#include <qstringlist.h>
#include <sys/stat.h>
#ifndef WIN32
#include <dirent.h>
#endif
SALOME_ListIO HOMARD_UTILS::mySelected;
//================================================================
// Function : GetActiveStudy
// Returne un pointeur sur l'etude active
//================================================================
SUIT_Study* HOMARD_UTILS::GetActiveStudy()
{
SUIT_Application* app = SUIT_Session::session()->activeApplication();
if (app)
return app->activeStudy();
else
return NULL;
}
//================================================================
// Function : getStudy
// Returne un pointeur sur l'etude active
//================================================================
_PTR(Study) HOMARD_UTILS::getStudy()
{
static _PTR(Study) _study;
if(!_study)
_study = SalomeApp_Application::getStudy();
return _study;
}
//================================================================
// Function : updateObjBrowser
// Purpose : met a jour l arbre d 'etude pour Homard
//================================================================
void HOMARD_UTILS::updateObjBrowser()
{
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
if (app) {
// Le nom identifiant doit etre la valeur du parametre
// name de la section HOMARD du fichier SalomeApp.xml
CAM_Module* module = app->module("Homard" );
SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>( module );
if ( appMod ) {
app->updateObjectBrowser();
appMod->updateObjBrowser( true );
}
else
MESSAGE( "--- HOMARD::updateObjBrowser: appMod = NULL");
}
}
//================================================================
// Function : selectedIO
// Return the list of selected SALOME_InteractiveObject's
//================================================================
const SALOME_ListIO& HOMARD_UTILS::selectedIO()
{
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > ( SUIT_Session::session()->activeApplication() );
LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr();
if( aSelectionMgr )
{
aSelectionMgr->selectedObjects( mySelected );
for (SALOME_ListIteratorOfListIO it (mySelected); it.More(); it.Next())
SCRUTE(it.Value()->getEntry());
};
return mySelected;
}
//================================================================
// Function : IObjectCount
// Return the number of selected objects
//================================================================
int HOMARD_UTILS::IObjectCount()
{
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr();
if( aSelectionMgr )
{
aSelectionMgr->selectedObjects( mySelected );
SCRUTE(mySelected.Extent());
return mySelected.Extent();
}
return 0;
}
//================================================================
// Function : firstIObject
// Purpose : Return the first selected object in the selected object list
//================================================================
Handle(SALOME_InteractiveObject) HOMARD_UTILS::firstIObject()
{
const SALOME_ListIO& aList = selectedIO();
return aList.Extent() > 0 ? aList.First() : Handle(SALOME_InteractiveObject)();
}
//================================================================
// Function : lastIObject
// Return the last selected object in the selected object list
//================================================================
Handle(SALOME_InteractiveObject) HOMARD_UTILS::lastIObject()
{
const SALOME_ListIO& aList = selectedIO();
return aList.Extent() > 0 ? aList.Last() : Handle(SALOME_InteractiveObject)();
}
//================================================================
// Retourne vrai si l'objet est du type voulu
// . Dans le cas d'un cas, d'une hypothese, d'une zone, on se contente
// d'une comparaison simple entre le type stocke et TypeObject.
// . Pour l'iteration, le type stocke en attribut est sous la forme
// "IterationHomard" + le nom de l'iteration precedente.
// Il faut donc regarder si la chaine commence par TypeObject.
// . Idem pour le fichier de messages : "Mess " + numero d'iteration
//
// On filtre ce genre de situation avec option :
// -1 : comparaison totale
// 0 : comparaison sur le debut de la chaine
//================================================================
bool HOMARD_UTILS::isObject(_PTR(SObject) MonObj, QString TypeObject, int option)
{
// MESSAGE("isObject, TypeObject = "<<TypeObject.toStdString().c_str()<<", option = "<<option);
// Existence d'un attribut ?
_PTR(GenericAttribute) anAttr;
if ( !MonObj->FindAttribute(anAttr, "AttributeComment") ) return false;
// Quel type ?
_PTR(AttributeComment) aComment (anAttr);
QString Type = QString(aComment->Value().c_str());
// MESSAGE("Type = "<<Type.toStdString().c_str());
// Est-ce le bon ?
bool bOK = false ;
if ( option == 0 )
{
int position = Type.lastIndexOf(TypeObject);
// MESSAGE("position = "<<position);
if ( position == 0 ) { bOK = true ; }
}
else
{
if ( Type == TypeObject ) { bOK = true ; }
}
return bOK ;
}
//================================================================
// Retourne vrai si l'objet est une frontiere CAO
//================================================================
bool HOMARD_UTILS::isBoundaryCAO(_PTR(SObject) MonObj)
{
return isObject( MonObj, QString("BoundaryCAOHomard"), -1 ) ;
}
//================================================================
// Retourne vrai si l'objet est une frontiere analytique
//================================================================
bool HOMARD_UTILS::isBoundaryAn(_PTR(SObject) MonObj)
{
return isObject( MonObj, QString("BoundaryAnHomard"), -1 ) ;
}
//================================================================
// Retourne vrai si l'objet est une frontiere discrete
//================================================================
bool HOMARD_UTILS::isBoundaryDi(_PTR(SObject) MonObj)
{
return isObject( MonObj, QString("BoundaryDiHomard"), -1 ) ;
}
//================================================================
// Retourne vrai si l'objet est un cas
//================================================================
bool HOMARD_UTILS::isCase(_PTR(SObject) MonObj)
{
return isObject( MonObj, QString("CasHomard"), -1 ) ;
}
//================================================================
// Retourne vrai si l'objet est une Hypothese
//================================================================
bool HOMARD_UTILS::isHypo(_PTR(SObject) MonObj)
{
return isObject( MonObj, QString("HypoHomard"), -1 ) ;
}
//================================================================
// Retourne vrai si l'objet est une iteration
//================================================================
bool HOMARD_UTILS::isIter(_PTR(SObject) MonObj)
{
return isObject( MonObj, QString("IterationHomard"), 0 ) ;
}
//================================================================
// Retourne vrai si l'objet est un schema YACS
//================================================================
bool HOMARD_UTILS::isYACS(_PTR(SObject) MonObj)
{
return isObject( MonObj, QString("YACSHomard"), -1 ) ;
}
//================================================================
// Retourne vrai si l'objet est une zone
//================================================================
bool HOMARD_UTILS::isZone(_PTR(SObject) MonObj)
{
return isObject( MonObj, QString("ZoneHomard"), -1 ) ;
}
//================================================================
// Retourne vrai si l'objet est un fichier de type TypeFile
//================================================================
bool HOMARD_UTILS::isFileType(_PTR(SObject) MonObj, QString TypeFile)
{
return isObject( MonObj, TypeFile, 0 ) ;
}
//=========================================================================================================
void HOMARD_UTILS::PushOnHelp(QString monFichierAide, QString contexte, QString LanguageShort)
{
MESSAGE("Debut de PushOnHelp avec monFichierAide = "<< monFichierAide.toStdString().c_str());
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
{
HOMARDGUI* aHomardGUI = dynamic_cast<HOMARDGUI*>( app->module( "Homard" ) );
// Repertoire de reference de la documentation
QString rep = aHomardGUI ? app->moduleName(aHomardGUI->moduleName()) : QString("") ;
// WARNING/ATTENTION : si on savait recuperer la langue depuis les preferences, on ne ferait pas le passage par argument
// SUIT_ResourceMgr* resMgr = getApp()->resourceMgr();
// SUIT_ResourceMgr* resMgr = myModule->getApp()->resourceMgr();
// QString langue = resMgr->stringValue("language", "language", "en");
// QString langue = "fr" ;
MESSAGE(". LanguageShort " << LanguageShort.toStdString().c_str()) ;
// Complement du fichier
QString fichier = QString(LanguageShort+"/"+monFichierAide) ;
MESSAGE(". Appel de onHelpContextModule avec :");
MESSAGE(" rep = "<< rep.toStdString().c_str());
MESSAGE(" fichier = "<< fichier.toStdString().c_str());
MESSAGE(" contexte = "<< contexte.toStdString().c_str());
app->onHelpContextModule(rep, fichier, contexte);
}
}
//=========================================================================================================

View File

@ -0,0 +1,90 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef HOMARD_H_UTILS
#define HOMARD_H_UTILS
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <omniORB4/CORBA.h>
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include "SALOMEDSClient_definitions.hxx"
#include "SALOME_InteractiveObject.hxx"
#include "LightApp_DataOwner.h"
#include "SalomeApp_Application.h"
#include <SALOME_ListIO.hxx>
class QString;
class QStringList;
class SUIT_ViewWindow;
class SUIT_Desktop;
class SUIT_Study;
class SUIT_ResourceMgr;
class CAM_Module;
class SALOMEDSClient_Study;
class SALOMEDSClient_SObject;
class SalomeApp_Study;
class SalomeApp_Module;
class LightApp_SelectionMgr;
namespace HOMARD_UTILS {
HOMARD_EXPORT SUIT_Study* GetActiveStudy();
HOMARD_EXPORT _PTR(Study) getStudy();
HOMARD_EXPORT void updateObjBrowser();
HOMARD_EXPORT const SALOME_ListIO& selectedIO(); // Function returns a list of SALOME_InteractiveObject's from
// selection manager in GUI
HOMARD_EXPORT int IObjectCount() ; // Function returns the number of selected objects
HOMARD_EXPORT Handle(SALOME_InteractiveObject) firstIObject() ;
// Function returns the first selected object in the list
// of selected objects
HOMARD_EXPORT Handle(SALOME_InteractiveObject) lastIObject() ;
// Function returns the last selected object in the list
// of selected objects
HOMARD_EXPORT bool isBoundaryCAO(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isBoundaryAn(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isBoundaryDi(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isCase(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isHypo(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isIter(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isYACS(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isZone(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isFileType(_PTR(SObject) MonObj, QString TypeFile);
HOMARD_EXPORT bool isObject(_PTR(SObject) MonObj, QString TypeObject, int option );
HOMARD_EXPORT void PushOnHelp(QString monFichierAide, QString contexte, QString LanguageShort);
extern SALOME_ListIO mySelected;
}
#endif // ifndef HOMARD_H_UTILS

View File

@ -0,0 +1,453 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "HomardQtCommun.h"
#include "HOMARDGUI_Utils.h"
#include <utilities.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qfiledialog.h>
#include <qstring.h>
#include <stdlib.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/stat.h>
#include "SalomeApp_Tools.h"
using namespace std;
#include <med.h>
// ============================================================================
QString HOMARD_QT_COMMUN::SelectionArbreEtude(QString commentaire, int option )
// ============================================================================
// Retourne l'objet selectionne dans l'arbre d'etudes
// commentaire :
// . si le commentaire est une chaine vide, on ne tient pas compte du type de l'objet
// et on retourne le nom de cet objet
// . sinon :
// . si l'objet est du type defini par commentaire, retourne le nom de cet objet
// . sinon on retourne une QString("")
// option :
// . Si option = 0, ce n'est pas grave de ne rien trouver ; aucun message n'est emis
// . Si option = 1, ce n'est pas grave de ne rien trouver mais on emet un message
{
// MESSAGE("SelectionArbreEtude : commentaire = " << commentaire.toStdString().c_str() << " et option = " << option);
int nbSel = HOMARD_UTILS::IObjectCount() ;
if ( nbSel == 0 )
{
if ( option == 1 )
{
QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
QObject::tr("HOM_SELECT_OBJECT_1") );
}
return QString("");
}
if ( nbSel > 1 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_SELECT_OBJECT_2") );
return QString("");
}
//
Handle(SALOME_InteractiveObject) aIO = HOMARD_UTILS::firstIObject();
if ( aIO->hasEntry() )
{
// MESSAGE("aIO->getEntry() = " << aIO->getEntry());
_PTR(Study) aStudy = HOMARD_UTILS::getStudy();
_PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) );
_PTR(GenericAttribute) anAttr;
if (aSO->FindAttribute(anAttr, "AttributeComment") )
{
if ( commentaire != "" )
{
_PTR(AttributeComment) attributComment = anAttr;
QString aComment= QString(attributComment->Value().data());
// MESSAGE("... aComment = " << aComment.toStdString().c_str());
int iaux = aComment.lastIndexOf(commentaire);
// MESSAGE("... iaux = " << iaux);
if ( iaux !=0 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_SELECT_OBJECT_3").arg(commentaire) );
return QString("");
}
}
if (aSO->FindAttribute(anAttr, "AttributeName") )
{
_PTR(AttributeName) attributName = anAttr;
QString aName= QString(attributName->Value().data());
return aName;
}
}
}
//
return QString("");
}
// =======================================================================
QString HOMARD_QT_COMMUN::SelectionCasEtude()
// =======================================================================
{
QString aName = QString("");
int nbSel = HOMARD_UTILS::IObjectCount() ;
if ( nbSel == 0 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_SELECT_OBJECT_1") );
return QString("");
}
if ( nbSel > 1 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_SELECT_OBJECT_2") );
return QString("");
}
Handle(SALOME_InteractiveObject) aIO = HOMARD_UTILS::firstIObject();
if ( aIO->hasEntry() )
{
_PTR(Study) aStudy = HOMARD_UTILS::getStudy();
_PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) );
_PTR(SObject) aSObjCas = aSO->GetFather();
_PTR(GenericAttribute) anAttr;
if (aSObjCas->FindAttribute(anAttr, "AttributeName") )
{
_PTR(AttributeName) attributName = anAttr;
aName= QString(attributName->Value().data());
}
return aName;
}
return QString("");
}
// =======================================================================
QString HOMARD_QT_COMMUN::PushNomFichier(bool avertir, QString TypeFichier)
// =======================================================================
// Gestion les boutons qui permettent de
// 1) retourne le nom d'un fichier par une fenetre de dialogue si aucun
// objet est selectionne dans l arbre d etude
// 2) retourne le nom du fichier asocie a l objet
// selectionne dans l arbre d etude
{
// MESSAGE("PushNomFichier avec avertir "<<avertir<<" et TypeFichier = "<<TypeFichier.toStdString().c_str());
QString aFile = QString::null;
//
// A. Filtre
QString filtre ;
//
if ( TypeFichier == "med" ) { filtre = QString("Med") ; }
else if ( TypeFichier == "py" ) { filtre = QString("Python") ; }
else { filtre = TypeFichier ; }
//
if ( TypeFichier != "" ) { filtre += QString(" files (*.") + TypeFichier + QString(");;") ; }
//
filtre += QString("all (*) ") ;
//
// B. Selection
int nbSel = HOMARD_UTILS::IObjectCount() ;
// MESSAGE("nbSel ="<<nbSel);
// B.1. Rien n'est selectionne
if ( nbSel == 0 )
{
// aFile = QFileDialog::getOpenFileName(0, QObject::tr("HOM_SELECT_FILE_0"), QString(""), QString("Med files (*.med);;all (*) ") );
aFile = QFileDialog::getOpenFileName(0, QObject::tr("HOM_SELECT_FILE_0"), QString(""), filtre );
}
// B.2. Un objet est selectionne
else if (nbSel == 1)
{
Handle(SALOME_InteractiveObject) aIO = HOMARD_UTILS::firstIObject();
if ( aIO->hasEntry() )
{
_PTR(Study) aStudy = HOMARD_UTILS::getStudy();
_PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) );
_PTR(GenericAttribute) anAttr;
_PTR(AttributeFileType) aFileType;
_PTR(AttributeExternalFileDef) aFileName;
if (aSO) {
if (aSO->FindAttribute(anAttr, "AttributeFileType") ) {
aFileType=anAttr;
QString fileType=QString(aFileType->Value().data());
if ( fileType==QString("FICHIERMED")) {
if (aSO->FindAttribute(anAttr,"AttributeExternalFileDef")) {
aFileName=anAttr;
aFile= QString(aFileName->Value().data()); }
}
}
}
}
if ( aFile==QString::null )
{
if ( avertir ) {
QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
QObject::tr("HOM_SELECT_STUDY") );
}
aFile = QFileDialog::getOpenFileName(0, QObject::tr("HOM_SELECT_FILE_0"), QString(""), filtre );
}
}
// B.3. Bizarre
else
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_SELECT_FILE_2") );
}
return aFile;
}
// =======================================================================
med_idt HOMARD_QT_COMMUN::OuvrirFichier(QString aFile)
// =======================================================================
// renvoie le medId associe au fichier Med apres ouverture
{
med_idt medIdt = MEDfileOpen(aFile.toStdString().c_str(),MED_ACC_RDONLY);
if (medIdt <0)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_1") );
}
return medIdt;
}
// ======================================================
QString HOMARD_QT_COMMUN::LireNomMaillage(QString aFile)
// ========================================================
{
QString nomMaillage = "" ;
int erreur = 0 ;
med_idt medIdt ;
while ( erreur == 0 )
{
// Ouverture du fichier
medIdt = HOMARD_QT_COMMUN::OuvrirFichier(aFile);
if ( medIdt < 0 )
{
erreur = 1 ;
break ;
}
med_int numberOfMeshes = MEDnMesh(medIdt) ;
if (numberOfMeshes == 0 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_2") );
erreur = 2 ;
break ;
}
if (numberOfMeshes > 1 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_3") );
erreur = 3 ;
break ;
}
nomMaillage = HOMARD_QT_COMMUN::LireNomMaillage2(medIdt,1);
break ;
}
// Fermeture du fichier
if ( medIdt > 0 ) MEDfileClose(medIdt);
return nomMaillage;
}
// =======================================================================
QString HOMARD_QT_COMMUN::LireNomMaillage2(med_idt medIdt ,int meshId)
// =======================================================================
{
QString NomMaillage=QString::null;
char meshname[MED_NAME_SIZE+1];
med_int spacedim,meshdim;
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("HOM_ERROR"), \
QObject::tr("HOM_MED_FILE_4") ); }
else { NomMaillage=QString(meshname); }
delete[] axisname ;
delete[] axisunit ;
return NomMaillage;
}
// =======================================================================
std::list<QString> HOMARD_QT_COMMUN::GetListeChamps(QString aFile)
// =======================================================================
{
// Il faut voir si plusieurs maillages
MESSAGE("GetListeChamps");
std::list<QString> ListeChamp ;
med_err erreur = 0 ;
med_idt medIdt ;
while ( erreur == 0 )
{
// Ouverture du fichier
SCRUTE(aFile.toStdString());
medIdt = HOMARD_QT_COMMUN::OuvrirFichier(aFile);
if ( medIdt < 0 )
{
erreur = 1 ;
break ;
}
// Lecture du nombre de champs
med_int ncha = MEDnField(medIdt) ;
if (ncha < 1 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_5") );
erreur = 2 ;
break ;
}
// Lecture des caracteristiques des champs
for (int i=0; i< ncha; i++)
{
// Lecture du nombre de composantes
med_int ncomp = MEDfieldnComponent(medIdt,i+1);
// Lecture du type du champ, des noms des composantes et du nom de l'unite
char nomcha [MED_NAME_SIZE+1];
char meshname[MED_NAME_SIZE+1];
char * comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
char * unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
char dtunit[MED_SNAME_SIZE+1];
med_bool local;
med_field_type typcha;
med_int nbofcstp;
erreur = MEDfieldInfo(medIdt,i+1,nomcha,meshname,&local,&typcha,comp,unit,dtunit,&nbofcstp) ;
free(comp);
free(unit);
if ( erreur < 0 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_6") );
break ;
}
ListeChamp.push_back(QString(nomcha));
}
break ;
}
// Fermeture du fichier
if ( medIdt > 0 ) MEDfileClose(medIdt);
return ListeChamp;
}
// ======================================================================================
std::list<QString> HOMARD_QT_COMMUN::GetListeComposants(QString aFile, QString aChamp)
// ======================================================================================
{
MESSAGE ( "GetListeComposants pour le fichier " << aFile.toStdString().c_str());
MESSAGE ( "GetListeComposants pour le champ " << aChamp.toStdString().c_str());
std::list<QString> ListeComposants;
med_err erreur = 0 ;
med_idt medIdt ;
while ( erreur == 0 )
{
// Ouverture du fichier
SCRUTE(aFile.toStdString());
medIdt = HOMARD_QT_COMMUN::OuvrirFichier(aFile);
if ( medIdt < 0 )
{
erreur = 1 ;
break ;
}
// Lecture du nombre de champs
med_int ncha = MEDnField(medIdt) ;
if (ncha < 1 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_5") );
erreur = 2 ;
break ;
}
// Lecture des caracteristiques des champs
for (int i=0; i< ncha; i++)
{
// Lecture du nombre de composantes
med_int ncomp = MEDfieldnComponent(medIdt,i+1);
// Lecture du type du champ, des noms des composantes et du nom de l'unite
char nomcha [MED_NAME_SIZE+1];
char meshname[MED_NAME_SIZE+1];
char * comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
char * unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
char dtunit[MED_SNAME_SIZE+1];
med_bool local;
med_field_type typcha;
med_int nbofcstp;
erreur = MEDfieldInfo(medIdt,i+1,nomcha,meshname,&local,&typcha,comp,unit,dtunit,&nbofcstp) ;
free(unit);
if ( erreur < 0 )
{
free(comp);
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_6") );
break ;
}
// Lecture des composantes si c'est le bon champ
if ( QString(nomcha) == aChamp )
{
for (int j = 0; j <ncomp; j++)
{
char cible[MED_SNAME_SIZE +1];
strncpy(cible,comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE );
cible[MED_SNAME_SIZE ]='\0';
ListeComposants.push_back(QString(cible));
}
}
// Menage
free(comp);
// Sortie si c'est bon
if ( QString(nomcha) == aChamp ) { break ; }
}
break ;
}
// Fermeture du fichier
if ( medIdt > 0 ) MEDfileClose(medIdt);
return ListeComposants;
}

View File

@ -0,0 +1,58 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef HOMARDQTCOMMUN_H
#define HOMARDQTCOMMUN_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include "SALOME_Selection.h"
#include <SalomeApp_Module.h>
#include <med.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include <qstring.h>
#include <vector>
#include <set>
class QComboBox;
namespace HOMARD_QT_COMMUN
{
HOMARD_EXPORT QString PushNomFichier(bool avertir, QString TypeFichier="");
HOMARD_EXPORT QString LireNomMaillage(QString aFile);
HOMARD_EXPORT QString LireNomMaillage2(med_idt Medidt,int MeshId);
HOMARD_EXPORT med_idt OuvrirFichier(QString aFile);
HOMARD_EXPORT std::list<QString> GetListeChamps(QString aFile);
HOMARD_EXPORT std::list<QString> GetListeComposants(QString aFile, QString aChamp);
HOMARD_EXPORT QString SelectionArbreEtude(QString commentaire, int grave );
HOMARD_EXPORT QString SelectionCasEtude();
};
#endif // HOMARDQTCOMMUN_H

129
src/ADAPTGUI/IterInfo.ui Normal file
View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>IterInfo</class>
<widget class="QDialog" name="IterInfo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>220</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Information on a mesh</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2" colspan="2">
<widget class="QGroupBox" name="GBOptions">
<property name="title">
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="CBQuality">
<property name="text">
<string>Quality</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="CBConnection">
<property name="text">
<string>Connection</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="CBDiametre">
<property name="text">
<string>Diametre</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="CBBlockSize">
<property name="text">
<string>Group size</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="CBEntanglement">
<property name="text">
<string>Entanglement</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="GroupButtons">
<property name="title">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="4">
<widget class="QPushButton" name="buttonHelp">
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonApply">
<property name="text">
<string>Apply</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="buttonCancel">
<property name="text">
<string>Cancel</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

285
src/ADAPTGUI/MeshInfo.ui Normal file
View File

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MeshInfo</class>
<widget class="QDialog" name="MeshInfo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>536</width>
<height>372</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Information on a mesh</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="Name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LECaseName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="Directory">
<property name="text">
<string>Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PushDir">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LEDirName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="Mesh_2">
<property name="text">
<string>Mesh</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PushFichier">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LEFileName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QGroupBox" name="GBOptions">
<property name="title">
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="CBQuality">
<property name="text">
<string>Quality</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="CBConnection">
<property name="text">
<string>Connection</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="CBDiametre">
<property name="text">
<string>Diametre</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="CBBlockSize">
<property name="text">
<string>Group size</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="CBEntanglement">
<property name="text">
<string>Entanglement</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0">
<widget class="QGroupBox" name="GroupButtons">
<property name="title">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="4">
<widget class="QPushButton" name="buttonHelp">
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonApply">
<property name="text">
<string>Apply</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="buttonCancel">
<property name="text">
<string>Cancel</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="7" column="1">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>128</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,809 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateBoundaryAn.h"
#include "MonCreateCase.h"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
#include "math.h"
#define PI 3.141592653589793
using namespace std;
// ------------------------------------------------------------------------------------------------------------------------
MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen0,
QString caseName) :
// ------------------------------------------------------------------------------------------------------------------------------
/* Constructs a MonCreateBoundaryAn
appele pour une vraie creation
initialise un cylindre et non une sphere
*/
QDialog(0), Ui_CreateBoundaryAn(),
_parent(parent),
_Name (""),
_aCaseName(caseName),
_Xmin(0), _Xmax(0), _Xincr(0), _Ymin(0), _Ymax(0), _Yincr(0), _Zmin(0), _Zmax(0), _Zincr(0), _DMax(0),
_Type(1),
_BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0),
_BoundaryAnXaxis(0), _BoundaryAnYaxis(0), _BoundaryAnZaxis(0),
_Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0),
_BoundaryAnXcone1(0), _BoundaryAnYcone1(0), _BoundaryAnZcone1(0), _BoundaryAnRayon1(0),
_BoundaryAnXcone2(0), _BoundaryAnYcone2(0), _BoundaryAnZcone2(0), _BoundaryAnRayon2(0),
_BoundaryAnXaxisCone(0), _BoundaryAnYaxisCone(0), _BoundaryAnZaxisCone(0),
_BoundaryAngle(0),
_BoundaryAnToreXcentre(0), _BoundaryAnToreYcentre(0), _BoundaryAnToreZcentre(0),
_BoundaryAnToreXaxe(0), _BoundaryAnToreYaxe(0), _BoundaryAnToreZaxe(0),
_BoundaryAnToreRRev(0), _BoundaryAnToreRPri(0),
Chgt (false)
{
MESSAGE("Constructeur") ;
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
setModal(modal);
// Gestion des icones
QPixmap pix ;
QIcon IS ;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" );
IS=QIcon(pix);
RBSphere->setIcon(IS);
pix = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" );
IS=QIcon(pix);
RBCylindre->setIcon(IS);
pix = resMgr->loadPixmap( "HOMARD", "cone.png" );
IS=QIcon(pix);
RBCone->setIcon(IS);
pix = resMgr->loadPixmap( "HOMARD", "conepointvector.png" );
IS=QIcon(pix);
RB_Def_angle->setIcon(IS);
pix = resMgr->loadPixmap( "HOMARD", "conedxyz.png" );
IS=QIcon(pix);
RB_Def_radius->setIcon(IS);
pix = resMgr->loadPixmap( "HOMARD", "toruspointvector.png" );
IS=QIcon(pix);
RBTore->setIcon(IS);
InitConnect( );
SetNewName() ;
InitValBoundaryAn(); // Cherche les valeurs de la boite englobante le maillage
InitMinMax(); // Initialise les bornes des boutons
SetCylinder(); // Propose un cylindre en premier choix
}
// --------------------------------------------------------------------------------------------------------------
MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent,
HOMARD::HOMARD_Gen_var myHomardGen0,
QString caseName):
// --------------------------------------------------------------------------------------------------------------
//
QDialog(0), Ui_CreateBoundaryAn(),
myHomardGen(myHomardGen0),
_parent(parent),
_Name (""),
_aCaseName(caseName),
_Type(1),
_BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0),
_BoundaryAnXaxis(0), _BoundaryAnYaxis(0), _BoundaryAnZaxis(0),
// Pour affichage lors de l edition d une BoundaryAn sans nom de Cas
_Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0),
_Xmin(1), _Xmax(1), _Xincr(1), _Ymin(1), _Ymax(1), _Yincr(1), _Zmin(1), _Zmax(1), _Zincr(1), _DMax(1),
Chgt (false)
{
// MESSAGE("Debut de MonCreateBoundaryAn")
setupUi(this);
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
QPixmap pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" );
QIcon IS=QIcon(pix);
RBSphere->setIcon(IS);
QPixmap pix2 = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" );
QIcon IS2=QIcon(pix2);
RBCylindre->setIcon(IS2);
QPixmap pix3 = resMgr->loadPixmap( "HOMARD", "cone.png" );
QIcon IS3=QIcon(pix3);
RBCone->setIcon(IS3);
QPixmap pix4 = resMgr->loadPixmap( "HOMARD", "conepointvector.png" );
QIcon IS4=QIcon(pix4);
RB_Def_angle->setIcon(IS4);
QPixmap pix5 = resMgr->loadPixmap( "HOMARD", "conedxyz.png" );
QIcon IS5=QIcon(pix5);
RB_Def_radius->setIcon(IS5);
setModal(true);
InitConnect();
}
// ------------------------------------------------------------------------
MonCreateBoundaryAn::~MonCreateBoundaryAn()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::InitConnect()
// ------------------------------------------------------------------------
{
connect( RBCylindre, SIGNAL(clicked()) , this, SLOT(SetCylinder()) ) ;
connect( RBSphere, SIGNAL(clicked()) , this, SLOT(SetSphere()) ) ;
connect( RBCone, SIGNAL(clicked()) , this, SLOT(SetCone()) ) ;
connect( RB_Def_radius, SIGNAL(clicked()) , this, SLOT(SetConeR()) );
connect( RB_Def_angle, SIGNAL(clicked()) , this, SLOT(SetConeA()) );
connect( RBTore, SIGNAL(clicked()) , this, SLOT(SetTore()) ) ;
connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) );
connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) );
connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) );
connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) );
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::InitValBoundaryAn()
// ------------------------------------------------------------------------
{
//
// 1. Les coordonnees extremes du maillage
//
if (_aCaseName == QString("")) { return; }
HOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase(_aCaseName.toStdString().c_str());
HOMARD::extrema_var MesExtremes = aCas->GetBoundingBox();
int num = MesExtremes->length() ;
ASSERT(num == 10);
_Xmin=MesExtremes[0]; _Xmax=MesExtremes[1]; _Xincr=MesExtremes[2];
_Ymin=MesExtremes[3]; _Ymax=MesExtremes[4]; _Yincr=MesExtremes[5];
_Zmin=MesExtremes[6]; _Zmax=MesExtremes[7]; _Zincr=MesExtremes[8];
_DMax=MesExtremes[9];
MESSAGE ("_Xmin : " << _Xmin << " _Xmax : " << _Xmax << " _Xincr : " << _Xincr ) ;
MESSAGE ("_Ymin : " << _Ymin << " _Ymax : " << _Ymax << " _Yincr : " << _Yincr ) ;
MESSAGE ("_Zmin : " << _Zmin << " _Zmax : " << _Zmax << " _Zincr : " << _Zincr) ;
MESSAGE ("_DMax : " << _DMax);
// 2. Caracteristiques des frontieres
// en X
_Xcentre=(_Xmin + _Xmax)/2.;
// en Y
_Ycentre=(_Ymin + _Ymax)/2.;
// en Z
_Zcentre=(_Zmin + _Zmax)/2.;
// Rayon
_Rayon= _DMax/4.;
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::InitMinMax()
// ------------------------------------------------------------------------
{
// Cylindre
// . X du centre
SpinBox_Xcent->setValue(_Xcentre);
SpinBox_Xcent->setSingleStep(_Xincr);
// . Y du centre
SpinBox_Ycent->setValue(_Ycentre);
SpinBox_Ycent->setSingleStep(_Yincr);
// . Z du centre
SpinBox_Zcent->setValue(_Zcentre);
SpinBox_Zcent->setSingleStep(_Zincr);
// . X de l'axe
SpinBox_Xaxis->setValue(0.);
SpinBox_Xaxis->setSingleStep(0.1);
// . Y de l'axe
SpinBox_Yaxis->setValue(0.);
SpinBox_Yaxis->setSingleStep(0.1);
// . Z de l'axe
SpinBox_Zaxis->setValue(1.);
SpinBox_Zaxis->setSingleStep(0.1);
// . Rayon
SpinBox_Radius->setValue(_Rayon);
SpinBox_Radius->setSingleStep(_Rayon/10.);
// Sphere
// . X du centre
SpinBox_Xcentre->setValue(_Xcentre);
SpinBox_Xcentre->setSingleStep(_Xincr);
// . Y du centre
SpinBox_Ycentre->setValue(_Ycentre);
SpinBox_Ycentre->setSingleStep(_Yincr);
// . Z du centre
SpinBox_Zcentre->setValue(_Zcentre);
SpinBox_Zcentre->setSingleStep(_Zincr);
// . Rayon
SpinBox_Rayon->setValue(_Rayon);
SpinBox_Rayon->setSingleStep(_Rayon/10.);
// Cone en rayons
// . X des centres
_BoundaryAnXcone1 = _Xcentre ;
SpinBox_Cone_X1->setSingleStep(_Xincr);
_BoundaryAnXcone2 = _Xcentre ;
SpinBox_Cone_X2->setSingleStep(_Xincr);
// . Y des centres
_BoundaryAnYcone1 = _Ycentre ;
SpinBox_Cone_Y1->setSingleStep(_Yincr);
_BoundaryAnYcone2 = _Ycentre ;
SpinBox_Cone_Y2->setSingleStep(_Yincr);
// . Z des centres
_BoundaryAnZcone1 = _Zmin ;
SpinBox_Cone_Z1->setSingleStep(_Zincr);
_BoundaryAnZcone2 = _Zmax ;
SpinBox_Cone_Z2->setSingleStep(_Zincr);
// . Rayons/Angles
_BoundaryAnRayon1 = 0. ;
_BoundaryAnRayon2 = _Rayon ;
SpinBox_Cone_V2->setSingleStep(_Rayon/10.);
// Cone en angle
convertRayonAngle(1) ;
SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone);
SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone);
SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone);
SpinBox_Cone_V1->setValue(_BoundaryAngle);
SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone);
SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone);
SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone);
// Tore
// . X du centre
SpinBoxToreXcent->setValue(_Xcentre);
SpinBoxToreXcent->setSingleStep(_Xincr);
// . Y du centre
SpinBoxToreYcent->setValue(_Ycentre);
SpinBoxToreYcent->setSingleStep(_Yincr);
// . Z du centre
SpinBoxToreZcent->setValue(_Zcentre);
SpinBoxToreZcent->setSingleStep(_Zincr);
// . X de l'axe
SpinBoxToreXaxe->setValue(0.);
SpinBoxToreXaxe->setSingleStep(0.1);
// . Y de l'axe
SpinBoxToreYaxe->setValue(0.);
SpinBoxToreYaxe->setSingleStep(0.1);
// . Z de l'axe
SpinBoxToreZaxe->setValue(1.);
SpinBoxToreZaxe->setSingleStep(0.1);
// . Rayon de revolution
SpinBoxToreRRev->setValue(_Rayon);
SpinBoxToreRRev->setSingleStep(_Rayon/10.);
// . Rayon primaire
SpinBoxToreRPri->setValue(_Rayon/3.);
SpinBoxToreRPri->setSingleStep(_Rayon/20.);
}
// ------------------------------------------------------------------------
bool MonCreateBoundaryAn::PushOnApply()
// ------------------------------------------------------------------------
// Appele lorsque l'un des boutons Ok ou Apply est presse
//
{
if (LEName->text().trimmed()=="")
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_BOUN_NAME") );
return false;
}
switch (_Type)
{
case 1 : // il s agit d un cylindre
{
if ((_BoundaryAnXcentre != SpinBox_Xcent->value()) ||
(_BoundaryAnYcentre != SpinBox_Ycent->value()) ||
(_BoundaryAnZcentre != SpinBox_Zcent->value()) ||
(_BoundaryAnRayon != SpinBox_Radius->value()) ||
(_BoundaryAnXaxis != SpinBox_Xaxis->value()) ||
(_BoundaryAnYaxis != SpinBox_Yaxis->value()) ||
(_BoundaryAnZaxis != SpinBox_Zaxis->value()) )
{
Chgt = true;
_BoundaryAnXaxis= SpinBox_Xaxis->value();
_BoundaryAnYaxis= SpinBox_Yaxis->value();
_BoundaryAnZaxis= SpinBox_Zaxis->value();
_BoundaryAnXcentre=SpinBox_Xcent->value();
_BoundaryAnYcentre=SpinBox_Ycent->value();
_BoundaryAnZcentre=SpinBox_Zcent->value();
_BoundaryAnRayon=SpinBox_Radius->value();
}
break;
}
case 2 : // il s agit d une sphere
{
if ((_BoundaryAnXcentre != SpinBox_Xcentre->value()) ||
(_BoundaryAnYcentre != SpinBox_Ycentre->value()) ||
(_BoundaryAnZcentre != SpinBox_Zcentre->value()) ||
(_BoundaryAnRayon != SpinBox_Rayon->value()) )
{
Chgt = true;
_BoundaryAnXcentre=SpinBox_Xcentre->value();
_BoundaryAnYcentre=SpinBox_Ycentre->value();
_BoundaryAnZcentre=SpinBox_Zcentre->value();
_BoundaryAnRayon=SpinBox_Rayon->value();
}
break;
}
case 3 : // il s agit d un cone defini par un axe et un angle
{
if ((_BoundaryAnXaxisCone != SpinBox_Cone_X1->value()) ||
(_BoundaryAnYaxisCone != SpinBox_Cone_Y1->value()) ||
(_BoundaryAnZaxisCone != SpinBox_Cone_Z1->value()) ||
(_BoundaryAnXorigCone != SpinBox_Cone_X2->value()) ||
(_BoundaryAnYorigCone != SpinBox_Cone_Y2->value()) ||
(_BoundaryAnZorigCone != SpinBox_Cone_Z2->value()) ||
(_BoundaryAngle != SpinBox_Cone_V1->value()) )
{
Chgt = true;
_BoundaryAnXaxisCone = SpinBox_Cone_X1->value() ;
_BoundaryAnYaxisCone = SpinBox_Cone_Y1->value() ;
_BoundaryAnZaxisCone = SpinBox_Cone_Z1->value() ;
_BoundaryAnXorigCone = SpinBox_Cone_X2->value() ;
_BoundaryAnYorigCone = SpinBox_Cone_Y2->value() ;
_BoundaryAnZorigCone = SpinBox_Cone_Z2->value() ;
_BoundaryAngle = SpinBox_Cone_V1->value() ;
}
break;
}
case 4 : // il s agit d un cone defini par les 2 rayons
{
if ((_BoundaryAnXcone1 != SpinBox_Cone_X1->value()) ||
(_BoundaryAnYcone1 != SpinBox_Cone_Y1->value()) ||
(_BoundaryAnZcone1 != SpinBox_Cone_Z1->value()) ||
(_BoundaryAnRayon1 != SpinBox_Cone_V1->value()) ||
(_BoundaryAnXcone2 != SpinBox_Cone_X2->value()) ||
(_BoundaryAnYcone2 != SpinBox_Cone_Y2->value()) ||
(_BoundaryAnZcone2 != SpinBox_Cone_Z2->value()) ||
(_BoundaryAnRayon2 != SpinBox_Cone_V2->value()) )
{
Chgt = true;
_BoundaryAnXcone1 = SpinBox_Cone_X1->value() ;
_BoundaryAnYcone1 = SpinBox_Cone_Y1->value() ;
_BoundaryAnZcone1 = SpinBox_Cone_Z1->value() ;
_BoundaryAnRayon1 = SpinBox_Cone_V1->value() ;
_BoundaryAnXcone2 = SpinBox_Cone_X2->value() ;
_BoundaryAnYcone2 = SpinBox_Cone_Y2->value() ;
_BoundaryAnZcone2 = SpinBox_Cone_Z2->value() ;
_BoundaryAnRayon2 = SpinBox_Cone_V2->value() ;
}
break;
}
case 5 : // il s agit d un tore
{
if ((_BoundaryAnToreXcentre != SpinBoxToreXcent->value()) ||
(_BoundaryAnToreYcentre != SpinBoxToreYcent->value()) ||
(_BoundaryAnToreZcentre != SpinBoxToreZcent->value()) ||
(_BoundaryAnToreRRev != SpinBoxToreRRev->value()) ||
(_BoundaryAnToreRPri != SpinBoxToreRPri->value()) ||
(_BoundaryAnToreXaxe != SpinBoxToreXaxe->value()) ||
(_BoundaryAnToreYaxe != SpinBoxToreYaxe->value()) ||
(_BoundaryAnToreZaxe != SpinBoxToreZaxe->value()) )
{
Chgt = true;
_BoundaryAnToreXcentre= SpinBoxToreXcent->value();
_BoundaryAnToreYcentre= SpinBoxToreYcent->value();
_BoundaryAnToreZcentre= SpinBoxToreZcent->value();
_BoundaryAnToreRRev=SpinBoxToreRRev->value();
_BoundaryAnToreRPri=SpinBoxToreRPri->value();
_BoundaryAnToreXaxe=SpinBoxToreXaxe->value();
_BoundaryAnToreYaxe=SpinBoxToreYaxe->value();
_BoundaryAnToreZaxe=SpinBoxToreZaxe->value();
}
break;
}
}
// Controles
// L'axe pour un cylindre
if ( _Type == 5 )
{
double daux = _BoundaryAnXaxis*_BoundaryAnXaxis + _BoundaryAnYaxis*_BoundaryAnYaxis + _BoundaryAnZaxis*_BoundaryAnZaxis ;
if ( daux < 0.0000001 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_AXE") );
return false;
}
}
//
// Création ou mise à jour de la frontière
//
bool bOK = CreateOrUpdateBoundaryAn();
if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; }
return bOK;
}
// ---------------------------------------------------
bool MonCreateBoundaryAn::CreateOrUpdateBoundaryAn()
//----------------------------------------------------
// Creation de l'objet boundary
{
MESSAGE("Debut de CreateOrUpdateBoundaryAn avec _Type ="<<_Type<<", _Name ="<<_Name.toStdString().c_str()<<" et LEName ="<<LEName->text().trimmed().toStdString().c_str());
//
if (_Name != LEName->text().trimmed())
{
_Name = LEName->text().trimmed() ;
try
{
switch (_Type)
{
case 1 : // il s agit d un cylindre
{ aBoundaryAn = myHomardGen->CreateBoundaryCylinder(CORBA::string_dup(_Name.toStdString().c_str()), \
_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon );
break;
}
case 2 : // il s agit d une sphere
{ aBoundaryAn = myHomardGen->CreateBoundarySphere(CORBA::string_dup(_Name.toStdString().c_str()), \
_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon);
break;
}
case 3 : // il s agit d un cone defini par un axe et un angle
{ aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_Name.toStdString().c_str()), \
_BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \
_BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone);
break;
}
case 4 : // il s agit d un cone defini par les 2 rayons
{ aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_Name.toStdString().c_str()), \
_BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \
_BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2);
break;
}
case 5 : // il s agit d un tore
{ aBoundaryAn = myHomardGen->CreateBoundaryTorus(CORBA::string_dup(_Name.toStdString().c_str()), \
_BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre, _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe, _BoundaryAnToreRRev, _BoundaryAnToreRPri );
break;
}
}
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false ;
}
_parent->AddBoundaryAn(_Name);
return true;
}
else {
QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
QObject::tr("HOM_SELECT_OBJECT_4") );
return false ;
}
MESSAGE("Fin de CreateOrUpdateBoundaryAn");
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::PushOnOK()
// ------------------------------------------------------------------------
{
if (PushOnApply()) this->close();
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::PushOnHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("un-cylindre"), QString(LanguageShort.c_str()));
}
// -----------------------------------
void MonCreateBoundaryAn::SetNewName()
// -----------------------------------
{
// Recherche d'un nom par defaut qui n'existe pas encore
HOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName();
int num = 0; QString aName="";
while (aName=="" )
{
aName.setNum(num+1) ;
aName.insert(0, QString("Boun_")) ;
for ( int i=0; i<MyObjects->length(); i++)
{
if ( aName == QString(MyObjects[i]))
{
num ++ ;
aName = "" ;
break ;
}
}
}
LEName->setText(aName);
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::SetCylinder()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetCylinder")
gBCylindre->setVisible(1);
gBSphere->setVisible(0);
gBCone->setVisible(0);
gBTore->setVisible(0);
//
_Type=1;
//
adjustSize();
// MESSAGE("Fin de SetCylinder")
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::SetSphere()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetSphere")
gBCylindre->setVisible(0);
gBSphere->setVisible(1);
gBCone->setVisible(0);
gBTore->setVisible(0);
//
_Type=2;
//
adjustSize();
// MESSAGE("Fin de SetSphere")
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::SetConeR()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetConeR")
//
// Stockage et conversion des valeurs si elles ont change
if ((_BoundaryAnXaxisCone != SpinBox_Cone_X1->value()) ||
(_BoundaryAnYaxisCone != SpinBox_Cone_Y1->value()) ||
(_BoundaryAnZaxisCone != SpinBox_Cone_Z1->value()) ||
(_BoundaryAnXorigCone != SpinBox_Cone_X2->value()) ||
(_BoundaryAnYorigCone != SpinBox_Cone_Y2->value()) ||
(_BoundaryAnZorigCone != SpinBox_Cone_Z2->value()) ||
(_BoundaryAngle != SpinBox_Cone_V1->value()) )
{
MESSAGE("Stockage et conversion")
_BoundaryAnXaxisCone = SpinBox_Cone_X1->value() ;
_BoundaryAnYaxisCone = SpinBox_Cone_Y1->value() ;
_BoundaryAnZaxisCone = SpinBox_Cone_Z1->value() ;
_BoundaryAnXorigCone = SpinBox_Cone_X2->value() ;
_BoundaryAnYorigCone = SpinBox_Cone_Y2->value() ;
_BoundaryAnZorigCone = SpinBox_Cone_Z2->value() ;
_BoundaryAngle = SpinBox_Cone_V1->value() ;
convertRayonAngle(-1) ;
}
//
_Type=4;
//
TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0));
SpinBox_Cone_X1->setValue(_BoundaryAnXcone1);
TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0));
SpinBox_Cone_Y1->setValue(_BoundaryAnYcone1);
TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0));
SpinBox_Cone_Z1->setValue(_BoundaryAnZcone1);
//
TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0));
SpinBox_Cone_V1->setSingleStep(_Rayon/10.);
SpinBox_Cone_V1->setMaximum(100000.*_DMax);
SpinBox_Cone_V1->setValue(_BoundaryAnRayon1);
//
TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0));
SpinBox_Cone_X2->setValue(_BoundaryAnXcone2);
TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0));
SpinBox_Cone_Y2->setValue(_BoundaryAnYcone2);
TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0));
SpinBox_Cone_Z2->setValue(_BoundaryAnZcone2);
//
TLCone_V2->setVisible(1);
SpinBox_Cone_V2->setVisible(1);
TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0));
SpinBox_Cone_V2->setValue(_BoundaryAnRayon2);
//
// MESSAGE("Fin de SetConeR")
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::SetConeA()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetConeA")
// Stockage et conversion des valeurs si elles ont change
if ((_BoundaryAnXcone1 != SpinBox_Cone_X1->value()) ||
(_BoundaryAnYcone1 != SpinBox_Cone_Y1->value()) ||
(_BoundaryAnZcone1 != SpinBox_Cone_Z1->value()) ||
(_BoundaryAnRayon1 != SpinBox_Cone_V1->value()) ||
(_BoundaryAnXcone2 != SpinBox_Cone_X2->value()) ||
(_BoundaryAnYcone2 != SpinBox_Cone_Y2->value()) ||
(_BoundaryAnZcone2 != SpinBox_Cone_Z2->value()) ||
(_BoundaryAnRayon2 != SpinBox_Cone_V2->value()) )
{
MESSAGE("Stockage et conversion")
_BoundaryAnXcone1 = SpinBox_Cone_X1->value() ;
_BoundaryAnYcone1 = SpinBox_Cone_Y1->value() ;
_BoundaryAnZcone1 = SpinBox_Cone_Z1->value() ;
_BoundaryAnRayon1 = SpinBox_Cone_V1->value() ;
_BoundaryAnXcone2 = SpinBox_Cone_X2->value() ;
_BoundaryAnYcone2 = SpinBox_Cone_Y2->value() ;
_BoundaryAnZcone2 = SpinBox_Cone_Z2->value() ;
_BoundaryAnRayon2 = SpinBox_Cone_V2->value() ;
convertRayonAngle(1) ;
}
//
_Type=3;
//
TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0));
SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone);
TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0));
SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone);
TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0));
SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone);
//
TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0));
SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone);
TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0));
SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone);
TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0));
SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone);
//
TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0));
SpinBox_Cone_V1->setValue(_BoundaryAngle);
SpinBox_Cone_V1->setSingleStep(1.);
SpinBox_Cone_V1->setMaximum(90.);
//
TLCone_V2->setVisible(0);
SpinBox_Cone_V2->setVisible(0);
// MESSAGE("Fin de SetConeA")
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::SetCone()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetCone")
gBCylindre->setVisible(0);
gBSphere->setVisible(0);
gBCone->setVisible(1);
gBTore->setVisible(0);
//
if ( RB_Def_radius->isChecked() )
{
SetConeR();
}
else
{
SetConeA();
}
//
adjustSize();
// MESSAGE("Fin de SetCone")
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::SetTore()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetTore")
gBCylindre->setVisible(0);
gBSphere->setVisible(0);
gBCone->setVisible(0);
gBTore->setVisible(1);
//
_Type=5;
//
adjustSize();
// MESSAGE("Fin de SetTore")
}
// ------------------------------------------------------------------------
void MonCreateBoundaryAn::convertRayonAngle(int option)
// ------------------------------------------------------------------------
// Conversion entre les deux formulations du cone :
// par deux rayons ou avec un axe et un angle.
// Voir sfcoi1 de HOMARD
{
MESSAGE("Debut de convertRayonAngle, option = "<<option)
//
// o
// ! .
// ! .
// RA! .
// ! o
// ! RB! .
// ! ! .
// A----------------B----------O
//
// Thales : RA/RB = AO/BO ==> BO = AB*RB/(RA-RB)
// Angle : tg(alpha) = RA/AO
//
double daux ;
// De rayon vers angle :
if ( option == 1 )
{
double xa, ya, za, ra ;
double xb, yb, zb, rb ;
// Positionnement de A vers B, avec RA>RB
if ( _BoundaryAnRayon1 > _BoundaryAnRayon2 )
{
xa = _BoundaryAnXcone1 ;
ya = _BoundaryAnYcone1 ;
za = _BoundaryAnZcone1 ;
ra = _BoundaryAnRayon1 ;
xb = _BoundaryAnXcone2 ;
yb = _BoundaryAnYcone2 ;
zb = _BoundaryAnZcone2 ;
rb = _BoundaryAnRayon2 ;
}
else
{
xa = _BoundaryAnXcone2 ;
ya = _BoundaryAnYcone2 ;
za = _BoundaryAnZcone2 ;
ra = _BoundaryAnRayon2 ;
xb = _BoundaryAnXcone1 ;
yb = _BoundaryAnYcone1 ;
zb = _BoundaryAnZcone1 ;
rb = _BoundaryAnRayon1 ;
}
// Axe : relie les deux centres, de A vers B. L'axe est normalise
_BoundaryAnXaxisCone = xb - xa ;
_BoundaryAnYaxisCone = yb - ya ;
_BoundaryAnZaxisCone = zb - za ;
daux = sqrt ( _BoundaryAnXaxisCone*_BoundaryAnXaxisCone + _BoundaryAnYaxisCone*_BoundaryAnYaxisCone + _BoundaryAnZaxisCone*_BoundaryAnZaxisCone ) ;
_BoundaryAnXaxisCone = _BoundaryAnXaxisCone/daux ;
_BoundaryAnYaxisCone = _BoundaryAnYaxisCone/daux ;
_BoundaryAnZaxisCone = _BoundaryAnZaxisCone/daux ;
// Origine
daux = daux * rb / (ra-rb) ;
_BoundaryAnXorigCone = xb + daux*_BoundaryAnXaxisCone ;
_BoundaryAnYorigCone = yb + daux*_BoundaryAnYaxisCone ;
_BoundaryAnZorigCone = zb + daux*_BoundaryAnZaxisCone ;
// Angle en degre
daux = ra / sqrt((_BoundaryAnXorigCone-xa)*(_BoundaryAnXorigCone-xa) + (_BoundaryAnYorigCone-ya)*(_BoundaryAnYorigCone-ya) + (_BoundaryAnZorigCone-za)*(_BoundaryAnZorigCone-za) ) ;
_BoundaryAngle = atan(daux)*180./PI ;
}
// D'angle vers rayon :
else
{
double xax, yax, zax ;
// L'axe est normalise
daux = sqrt ( _BoundaryAnXaxisCone*_BoundaryAnXaxisCone + _BoundaryAnYaxisCone*_BoundaryAnYaxisCone + _BoundaryAnZaxisCone*_BoundaryAnZaxisCone ) ;
xax = _BoundaryAnXaxisCone/daux ;
yax = _BoundaryAnYaxisCone/daux ;
zax = _BoundaryAnZaxisCone/daux ;
// Centre 1 : l'origine
_BoundaryAnXcone1 = _BoundaryAnXorigCone ;
_BoundaryAnYcone1 = _BoundaryAnYorigCone ;
_BoundaryAnZcone1 = _BoundaryAnZorigCone ;
// Rayon 1 : nul
_BoundaryAnRayon1 = 0. ;
// Centre 2 : l'origine decalee d'une longueur arbitraire le long de l'axe
_BoundaryAnXcone2 = _BoundaryAnXorigCone + _DMax*xax ;
_BoundaryAnYcone2 = _BoundaryAnYorigCone + _DMax*yax ;
_BoundaryAnZcone2 = _BoundaryAnZorigCone + _DMax*zax ;
// Rayon 2 : a calculer
_BoundaryAnRayon2 = _DMax*tan(_BoundaryAngle*PI/180.) ;
}
// MESSAGE("Fin de convertRayonAngle")
}

View File

@ -0,0 +1,96 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATEBOUNDARYAN_H
#define MON_CREATEBOUNDARYAN_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Boundary)
#include "ui_CreateBoundaryAn.h"
#include <QDialog>
class MonCreateCase;
class HOMARD_EXPORT MonCreateBoundaryAn : public QDialog, public Ui_CreateBoundaryAn
{
Q_OBJECT
public:
MonCreateBoundaryAn( MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName);
virtual ~MonCreateBoundaryAn();
protected :
MonCreateBoundaryAn( MonCreateCase* parent,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName);
MonCreateCase * _parent;
QString _Name;
QString _aCaseName;
int _Type;
double _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon;
double _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis;
double _Xcentre, _Ycentre, _Zcentre, _Rayon ;
double _Xmin, _Xmax, _Xincr, _Ymin, _Ymax, _Yincr, _Zmin, _Zmax, _Zincr, _DMax ;
double _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1;
double _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2;
double _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone;
double _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnZorigCone;
double _BoundaryAngle;
double _BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre;
double _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe;
double _BoundaryAnToreRRev, _BoundaryAnToreRPri;
bool Chgt;
HOMARD::HOMARD_Boundary_var aBoundaryAn ;
HOMARD::HOMARD_Gen_var myHomardGen;
virtual void InitConnect();
virtual void InitValBoundaryAn();
virtual void InitMinMax();
virtual void SetNewName();
virtual bool CreateOrUpdateBoundaryAn();
virtual void convertRayonAngle(int option);
public slots:
virtual void SetCylinder();
virtual void SetSphere();
virtual void SetCone();
virtual void SetConeR();
virtual void SetConeA();
virtual void SetTore();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_CREATEBOUNDARYAN_H

View File

@ -0,0 +1,202 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateBoundaryCAO.h"
#include "MonCreateListGroupCAO.h"
#include "MonCreateCase.h"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
// -------------------------------------------------------------------------------
MonCreateBoundaryCAO::MonCreateBoundaryCAO(MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen0,
QString caseName, QString aName)
// ---------------------------------------------------------------------------------
/* Constructs a MonCreateBoundaryCAO */
:
QDialog(0), Ui_CreateBoundaryCAO(),
_parent(parent), _aName(aName),
myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen0)),
_aCaseName(caseName)
{
MESSAGE("Constructeur") ;
setupUi(this);
setModal(modal);
InitConnect();
if ( _aName == QString("") ) {SetNewName();};
}
// ------------------------------------------------------------------------
MonCreateBoundaryCAO::~MonCreateBoundaryCAO()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateBoundaryCAO::InitConnect()
// ------------------------------------------------------------------------
{
connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetCAOFile()));
connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT( SetFiltrage()));
}
// ------------------------------------------------------------------------
bool MonCreateBoundaryCAO::PushOnApply()
// ------------------------------------------------------------------------
// Appele lorsque l'un des boutons Ok ou Apply est presse
//
{
// Verifications
QString aName=LEName->text().trimmed();
if (aName=="") {
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_BOUN_NAME") );
return false;
}
// La CAO
QString aCAOFile=LEFileName->text().trimmed();
if (aCAOFile ==QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_BOUN_CAO") );
return false;
}
// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
if ( _aName != aName )
{
try
{
_aName=aName;
aBoundary=myHomardGen->CreateBoundaryCAO(CORBA::string_dup(_aName.toStdString().c_str()), aCAOFile.toStdString().c_str());
_parent->AddBoundaryCAO(_aName);
aBoundary->SetCaseCreation(_aCaseName.toStdString().c_str());
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false;
}
}
// Les groupes
AssocieLesGroupes();
HOMARD_UTILS::updateObjBrowser();
return true;
}
// ------------------------------------------------------------------------
void MonCreateBoundaryCAO::PushOnOK()
// ------------------------------------------------------------------------
{
if (PushOnApply()) this->close();
if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
}
// ------------------------------------------------------------------------
void MonCreateBoundaryCAO::PushOnHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str()));
}
// ------------------------------------------------------------------------
void MonCreateBoundaryCAO::AssocieLesGroupes()
// ------------------------------------------------------------------------
{
HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
aSeqGroupe->length(_listeGroupesBoundary.size());
QStringList::const_iterator it;
int i=0;
for (it = _listeGroupesBoundary.constBegin(); it != _listeGroupesBoundary.constEnd(); it++)
aSeqGroupe[i++]=(*it).toStdString().c_str();
aBoundary->SetGroups(aSeqGroupe);
}
// -------------------------------------------------
void MonCreateBoundaryCAO::SetNewName()
// --------------------------------------------------
{
HOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName();
int num = 0; QString aName="";
while (aName == QString("") )
{
aName.setNum(num+1) ;
aName.insert(0, QString("Boun_")) ;
for ( int i=0; i<MyObjects->length(); i++)
{
if ( aName == QString(MyObjects[i]))
{
num ++ ;
aName = "" ;
break ;
}
}
}
LEName->setText(aName);
}
// ------------------------------------------------------------------------
void MonCreateBoundaryCAO::SetCAOFile()
// ------------------------------------------------------------------------
{
QString aCAOFile = HOMARD_QT_COMMUN::PushNomFichier( false, QString("xao") );
if (!(aCAOFile.isEmpty())) LEFileName->setText(aCAOFile);
}
// ------------------------------------------------------------------------
void MonCreateBoundaryCAO::setGroups (QStringList listGroup)
// ------------------------------------------------------------------------
{
_listeGroupesBoundary = listGroup;
}
// ------------------------------------------------------------------------
void MonCreateBoundaryCAO::SetFiltrage()
// // ------------------------------------------------------------------------
{
if (!CBGroupe->isChecked()) return;
if (_aCaseName.toStdString().c_str() == QString()) {
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_BOUN_CASE") );
return;
}
MonCreateListGroupCAO *aDlg = new MonCreateListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),
_aCaseName, _listeGroupesBoundary) ;
aDlg->show();
}

View File

@ -0,0 +1,73 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATEBOUNDARYCAO_H
#define MON_CREATEBOUNDARYCAO_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Boundary)
#include "ui_CreateBoundaryCAO.h"
#include <QDialog>
class MonCreateCase;
class HOMARD_EXPORT MonCreateBoundaryCAO : public QDialog, public Ui_CreateBoundaryCAO
{
Q_OBJECT
public:
MonCreateBoundaryCAO( MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString BoundaryName );
~MonCreateBoundaryCAO();
virtual void setGroups (QStringList listGroup);
protected :
MonCreateCase *_parent;
QString _aName;
QString _aCaseName;
HOMARD::HOMARD_Boundary_var aBoundary;
HOMARD::HOMARD_Gen_var myHomardGen;
QStringList _listeGroupesBoundary;
virtual void AssocieLesGroupes();
virtual void InitConnect();
virtual void SetNewName();
public slots:
virtual void SetCAOFile();
virtual void SetFiltrage();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_CREATEBOUNDARYCAO_H

View File

@ -0,0 +1,211 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateBoundaryDi.h"
#include "MonCreateListGroup.h"
#include "MonCreateCase.h"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
// -------------------------------------------------------------------------------
MonCreateBoundaryDi::MonCreateBoundaryDi(MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen0,
QString caseName, QString aName)
// ---------------------------------------------------------------------------------
/* Constructs a MonCreateBoundaryDi */
:
QDialog(0), Ui_CreateBoundaryDi(),
_parent(parent), _aName(aName),
myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen0)),
_aCaseName(caseName)
{
MESSAGE("Constructeur") ;
setupUi(this);
setModal(modal);
InitConnect();
if ( _aName == QString("") ) {SetNewName();};
}
// ------------------------------------------------------------------------
MonCreateBoundaryDi::~MonCreateBoundaryDi()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateBoundaryDi::InitConnect()
// ------------------------------------------------------------------------
{
connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetMeshFile()));
connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT( SetFiltrage()));
}
// ------------------------------------------------------------------------
bool MonCreateBoundaryDi::PushOnApply()
// ------------------------------------------------------------------------
// Appele lorsque l'un des boutons Ok ou Apply est presse
//
{
// Verifications
QString aName=LEName->text().trimmed();
if (aName=="") {
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_BOUN_NAME") );
return false;
}
// Le maillage de la frontiere discrete
QString aMeshFile=LEFileName->text().trimmed();
if (aMeshFile ==QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_BOUN_MESH") );
return false;
}
// Le nom du maillage de la frontiere discrete
QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aMeshFile);
if (aMeshName == "" )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_2") );
return false;
}
// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
if ( _aName != aName )
{
try
{
_aName=aName;
aBoundary=myHomardGen->CreateBoundaryDi(CORBA::string_dup(_aName.toStdString().c_str()), aMeshName.toStdString().c_str(), aMeshFile.toStdString().c_str());
_parent->AddBoundaryDi(_aName);
aBoundary->SetCaseCreation(_aCaseName.toStdString().c_str());
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false;
}
}
// Les groupes
AssocieLesGroupes();
HOMARD_UTILS::updateObjBrowser();
return true;
}
// ------------------------------------------------------------------------
void MonCreateBoundaryDi::PushOnOK()
// ------------------------------------------------------------------------
{
if (PushOnApply()) this->close();
if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
}
// ------------------------------------------------------------------------
void MonCreateBoundaryDi::PushOnHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str()));
}
// ------------------------------------------------------------------------
void MonCreateBoundaryDi::AssocieLesGroupes()
// ------------------------------------------------------------------------
{
HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
aSeqGroupe->length(_listeGroupesBoundary.size());
QStringList::const_iterator it;
int i=0;
for (it = _listeGroupesBoundary.constBegin(); it != _listeGroupesBoundary.constEnd(); it++)
aSeqGroupe[i++]=(*it).toStdString().c_str();
aBoundary->SetGroups(aSeqGroupe);
}
// -------------------------------------------------
void MonCreateBoundaryDi::SetNewName()
// --------------------------------------------------
{
HOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName();
int num = 0; QString aName="";
while (aName == QString("") )
{
aName.setNum(num+1) ;
aName.insert(0, QString("Boun_")) ;
for ( int i=0; i<MyObjects->length(); i++)
{
if ( aName == QString(MyObjects[i]))
{
num ++ ;
aName = "" ;
break ;
}
}
}
LEName->setText(aName);
}
// ------------------------------------------------------------------------
void MonCreateBoundaryDi::SetMeshFile()
// ------------------------------------------------------------------------
{
QString aMeshFile = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") );
if (!(aMeshFile.isEmpty())) LEFileName->setText(aMeshFile);
}
// ------------------------------------------------------------------------
void MonCreateBoundaryDi::setGroups (QStringList listGroup)
// ------------------------------------------------------------------------
{
_listeGroupesBoundary = listGroup;
}
// ------------------------------------------------------------------------
void MonCreateBoundaryDi::SetFiltrage()
// // ------------------------------------------------------------------------
{
if (!CBGroupe->isChecked()) return;
if (_aCaseName.toStdString().c_str() == QString()) {
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_BOUN_CASE") );
return;
}
MonCreateListGroup *aDlg = new MonCreateListGroup(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),
_aCaseName, _listeGroupesBoundary) ;
aDlg->show();
}

View File

@ -0,0 +1,73 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATEBOUNDARYDI_H
#define MON_CREATEBOUNDARYDI_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Boundary)
#include "ui_CreateBoundaryDi.h"
#include <QDialog>
class MonCreateCase;
class HOMARD_EXPORT MonCreateBoundaryDi : public QDialog, public Ui_CreateBoundaryDi
{
Q_OBJECT
public:
MonCreateBoundaryDi( MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString BoundaryName );
~MonCreateBoundaryDi();
virtual void setGroups (QStringList listGroup);
protected :
MonCreateCase *_parent;
QString _aName;
QString _aCaseName;
HOMARD::HOMARD_Boundary_var aBoundary;
HOMARD::HOMARD_Gen_var myHomardGen;
QStringList _listeGroupesBoundary;
virtual void AssocieLesGroupes();
virtual void InitConnect();
virtual void SetNewName();
public slots:
virtual void SetMeshFile();
virtual void SetFiltrage();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_CREATEBOUNDARYDI_H

View File

@ -0,0 +1,694 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateCase.h"
#include "MonCreateBoundaryCAO.h"
#include "MonEditBoundaryCAO.h"
#include "MonCreateBoundaryAn.h"
#include "MonEditBoundaryAn.h"
#include "MonCreateBoundaryDi.h"
#include "MonEditBoundaryDi.h"
#include "HOMARD.hxx"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
#ifdef WIN32
#include <direct.h>
#endif
using namespace std;
// -----------------------------------------------------------------------------------------
/* Constructs a MonCreateCase
* Inherits from CasHomard
* Sets attributes to default values
*/
// -----------------------------------------------------------------------------------------
MonCreateCase::MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 )
:
Ui_CreateCase(),
_aCaseName(""),_aDirName(""),
_ConfType(0),
_ExtType(0),
_Pyram(0)
{
MESSAGE("Debut du constructeur de MonCreateCase");
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
setModal(modal);
InitConnect();
SetNewName() ;
GBBoundaryC->setVisible(0);
GBBoundaryA->setVisible(0);
GBBoundaryD->setVisible(0);
CBBoundaryA->setVisible(0);
CBBoundaryD->setVisible(0);
GBAdvancedOptions->setVisible(0);
Comment->setVisible(0);
CBPyramid->setChecked(false);
//
adjustSize();
// MESSAGE("Fin du constructeur de MonCreateCase");
}
// ------------------------------------------------------------------------
MonCreateCase::~MonCreateCase()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateCase::InitConnect()
// ------------------------------------------------------------------------
{
connect( LEName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged()));
connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName()));
connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName()));
connect( RBConforme, SIGNAL(clicked()), this, SLOT(SetConforme()));
connect( RBNonConforme, SIGNAL(clicked()), this, SLOT(SetNonConforme()));
connect( RBBoundaryNo, SIGNAL(clicked()), this, SLOT(SetBoundaryNo()));
connect( RBBoundaryCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryCAO()));
connect( RBBoundaryNonCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryNonCAO()));
connect( PBBoundaryCAONew, SIGNAL(pressed()), this, SLOT(PushBoundaryCAONew()));
connect( PBBoundaryCAOEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOEdit()) );
connect( PBBoundaryCAOHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOHelp()) );
connect( CBBoundaryD, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD()));
connect( PBBoundaryDiNew, SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew()));
connect( PBBoundaryDiEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) );
connect( PBBoundaryDiHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) );
connect( CBBoundaryA, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA()));
connect( PBBoundaryAnNew, SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew()));
connect( PBBoundaryAnEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) );
connect( PBBoundaryAnHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) );
connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
connect( RBStandard, SIGNAL(clicked()), this, SLOT(SetStandard()));
connect( RBBox, SIGNAL(clicked()), this, SLOT(SetBox()));
connect( RBNC1NpA, SIGNAL(clicked()), this, SLOT(SetNC1NpA()));
connect( RBNCQuelconque, SIGNAL(clicked()), this, SLOT(SetNCQuelconque()));
connect( RBMED, SIGNAL(clicked()), this, SLOT(SetMED()));
connect( RBSaturne, SIGNAL(clicked()), this, SLOT(SetSaturne()));
connect( RBSaturne2D, SIGNAL(clicked()), this, SLOT(SetSaturne2D()));
connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply(0)));
connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp()));
}
// ------------------------------------------------------------------------
void MonCreateCase::InitBoundarys()
// ------------------------------------------------------------------------
// Initialisation des menus avec les frontieres deja enregistrees
{
MESSAGE("InitBoundarys");
// Pour les frontieres analytiques : la colonne des groupes
HOMARD::ListGroupType_var _listeGroupesCas = aCase->GetGroups();
QTableWidgetItem *__colItem = new QTableWidgetItem();
__colItem->setText(QApplication::translate("CreateCase", "", 0));
TWBoundary->setHorizontalHeaderItem(0, __colItem);
for ( int i = 0; i < _listeGroupesCas->length(); i++ )
{
TWBoundary->insertRow(i);
TWBoundary->setItem( i, 0, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed()));
TWBoundary->item( i, 0 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
}
// Pour les frontieres CAO : la liste a saisir
// Pour les frontieres discretes : la liste a saisir
// Pour les frontieres analytiques : les colonnes de chaque frontiere
HOMARD::HOMARD_Boundary_var myBoundary ;
HOMARD::listeBoundarys_var mesBoundarys = myHomardGen->GetAllBoundarysName();
// MESSAGE("Nombre de frontieres enregistrees : "<<mesBoundarys->length());
for (int i=0; i<mesBoundarys->length(); i++)
{
myBoundary = myHomardGen->GetBoundary(mesBoundarys[i]);
int type_obj = myBoundary->GetType() ;
if ( type_obj==-1 ) { CBBoundaryCAO->addItem(QString(mesBoundarys[i])); }
else if ( type_obj==0 ) { CBBoundaryDi->addItem(QString(mesBoundarys[i])); }
else { AddBoundaryAn(QString(mesBoundarys[i])); }
}
// Ajustement
TWBoundary->resizeColumnsToContents();
TWBoundary->resizeRowsToContents();
TWBoundary->clearSelection();
}
// -------------------------------
bool MonCreateCase::PushOnApply(int option)
// --------------------------------
{
MESSAGE("PushOnApply");
QString aCaseName=LEName->text().trimmed();
if ( aCaseName == "" )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_NAME") );
return false;
}
QString aDirName=LEDirName->text().trimmed();
if (aDirName == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_1") );
return false;
}
if ( aDirName != _aDirName)
{ QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ;
if ( ( CaseNameDir != "" ) & ( CaseNameDir != aCaseName ) )
{
QString texte ;
texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ;
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
texte );
return false;
}
}
if (CHDIR(aDirName.toStdString().c_str()) != 0)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_3") );
return false;
}
QString aFileName=LEFileName->text().trimmed();
if (aFileName ==QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_MESH") );
return false;
}
QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName);
if (aMeshName == "" )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_2") );
return false;
}
// On verifie qu'un groupe n'est pas associe a deux frontieres differentes
if (CBBoundaryA->isChecked())
{
QStringList ListeGroup ;
QString NomGroup ;
int nbcol = TWBoundary->columnCount();
int nbrow = TWBoundary->rowCount();
for ( int col=1; col< nbcol; col++)
{
for ( int row=0; row< nbrow; row++)
{
if ( TWBoundary->item( row, col )->checkState() == Qt::Checked )
{
// Nom du groupe
NomGroup = QString(TWBoundary->item(row, 0)->text()) ;
// MESSAGE("NomGroup "<<NomGroup.toStdString().c_str());
for ( int nugr = 0 ; nugr<ListeGroup.size(); nugr++)
{
// MESSAGE("....... "<<ListeGroup[nugr].toStdString().c_str());
if ( NomGroup == ListeGroup[nugr] )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_GROUP").arg(NomGroup) );
return false;
}
}
ListeGroup.insert(0, NomGroup );
}
}
}
}
// Creation du cas
if (aCaseName != _aCaseName )
{
_aCaseName = aCaseName;
try
{
aCase = myHomardGen->CreateCase( \
CORBA::string_dup(_aCaseName.toStdString().c_str()), \
CORBA::string_dup(aMeshName.toStdString().c_str()), \
CORBA::string_dup(aFileName.toStdString().c_str()) );
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false;
}
LEFileName->setReadOnly(true);
PushFichier->hide();
InitBoundarys();
}
// Repertoire et type
aCase->SetDirName(aDirName.toStdString().c_str());
_aDirName=aDirName;
aCase->SetConfType(_ConfType);
aCase->SetExtType(_ExtType);
// Menage des eventuelles frontieres deja enregistrees
aCase->SupprBoundaryGroup() ;
// Enregistrement et publication dans l'arbre d'etudes a la sortie definitive
if ( option > 0 )
{
if (RBBoundaryCAO->isChecked())
{
QString monBoundaryCAOName=CBBoundaryCAO->currentText();
if (monBoundaryCAOName != "" )
{
aCase->AddBoundary(monBoundaryCAOName.toStdString().c_str());
}
}
if (CBBoundaryD->isChecked())
{
QString monBoundaryDiName=CBBoundaryDi->currentText();
if (monBoundaryDiName != "" )
{
aCase->AddBoundary(monBoundaryDiName.toStdString().c_str());
}
}
if (CBBoundaryA->isChecked())
{
QString NomGroup ;
int nbcol = TWBoundary->columnCount();
int nbrow = TWBoundary->rowCount();
for ( int col=1; col< nbcol; col++)
{
for ( int row=0; row< nbrow; row++)
{
if ( TWBoundary->item( row, col )->checkState() == Qt::Checked )
{
// Nom du groupe
NomGroup = QString(TWBoundary->item(row, 0)->text()) ;
// Nom de la frontiere
QTableWidgetItem *__colItem = new QTableWidgetItem();
__colItem = TWBoundary->horizontalHeaderItem(col);
aCase->AddBoundaryGroup(QString(__colItem->text()).toStdString().c_str(), NomGroup.toStdString().c_str());
}
}
}
}
}
// Options avancees
if (CBAdvanced->isChecked())
{
// Autorisation des pyramides
if (CBPyramid->isChecked()) { _Pyram = 1 ; }
}
aCase->SetPyram(_Pyram);
HOMARD_UTILS::updateObjBrowser();
return true;
}
// ---------------------------
void MonCreateCase::PushOnOK()
// ---------------------------
{
bool bOK = PushOnApply(1);
if ( bOK ) this->close();
}
//------------------------------
void MonCreateCase::PushOnHelp()
//-------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str()));
}
// ---------------------------------
void MonCreateCase::SetNewName()
// ------------------------------
{
HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName();
int num = 0; QString aCaseName="";
while (aCaseName=="" )
{
aCaseName.setNum(num+1) ;
aCaseName.insert(0, QString("Case_")) ;
for ( int i=0; i<MyCases->length(); i++)
{
if ( aCaseName == QString((MyCases)[i]))
{
num ++ ;
aCaseName = "" ;
break ;
}
}
}
LEName->clear() ;
LEName->insert(aCaseName);
}
// ------------------------------------------------------------------------
void MonCreateCase::SetDirName()
// ------------------------------------------------------------------------
{
QString aDirName=QFileDialog::getExistingDirectory ();
if (!(aDirName.isEmpty()))LEDirName->setText(aDirName);
}
// ------------------------------------------------------------------------
void MonCreateCase::SetFileName()
// ------------------------------------------------------------------------
{
QString fileName0 = LEFileName->text().trimmed();
QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ;
if (fileName.isEmpty()) fileName = fileName0 ;
LEFileName->setText(fileName);
}
// ------------------------------------------------------------------------
void MonCreateCase::SetConforme()
// ------------------------------------------------------------------------
{
//
_ConfType=0;
RBNC1NpA->setVisible(0);
RBNCQuelconque->setVisible(0);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateCase::SetNonConforme()
// ------------------------------------------------------------------------
{
//
_ConfType=1;
RBNC1NpA->setVisible(1);
RBNCQuelconque->setVisible(1);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateCase::SetStandard()
// ------------------------------------------------------------------------
{
if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = 0 ; }
else { _ConfType = 1 ; }
RBStandard->setChecked(true);
}
// ------------------------------------------------------------------------
void MonCreateCase::SetBox()
// ------------------------------------------------------------------------
{
if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = -1 ; }
else { _ConfType = -2 ; }
}
// ------------------------------------------------------------------------
void MonCreateCase::SetNC1NpA()
// ------------------------------------------------------------------------
{
_ConfType = 2;
}
// ------------------------------------------------------------------------
void MonCreateCase::SetNCQuelconque()
// ------------------------------------------------------------------------
{
_ConfType = 3;
}
// ------------------------------------------------------------------------
void MonCreateCase::SetMED()
// ------------------------------------------------------------------------
{
_ExtType = 0 ;
RBMED->setChecked(true);
}
// ------------------------------------------------------------------------
void MonCreateCase::SetSaturne()
// ------------------------------------------------------------------------
{
_ExtType = 1 ;
RBSaturne->setChecked(true);
}
// ------------------------------------------------------------------------
void MonCreateCase::SetSaturne2D()
// ------------------------------------------------------------------------
{
_ExtType = 2 ;
RBSaturne2D->setChecked(true);
}
// ------------------------------------------------------------------------
void MonCreateCase::SetBoundaryNo()
// ------------------------------------------------------------------------
{
//
GBBoundaryC->setVisible(0);
GBBoundaryA->setVisible(0);
GBBoundaryD->setVisible(0);
CBBoundaryD->setVisible(0);
CBBoundaryA->setVisible(0);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateCase::SetBoundaryCAO()
// ------------------------------------------------------------------------
{
//
GBBoundaryC->setVisible(1);
GBBoundaryA->setVisible(0);
GBBoundaryD->setVisible(0);
CBBoundaryD->setVisible(0);
CBBoundaryA->setVisible(0);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateCase::SetBoundaryNonCAO()
// ------------------------------------------------------------------------
{
//
GBBoundaryC->setVisible(0);
CBBoundaryD->setVisible(1);
CBBoundaryA->setVisible(1);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateCase::AddBoundaryCAO(QString newBoundary)
// ------------------------------------------------------------------------
{
CBBoundaryCAO->insertItem(0,newBoundary);
CBBoundaryCAO->setCurrentIndex(0);
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryCAONew()
// ------------------------------------------------------------------------
{
MonCreateBoundaryCAO *BoundaryDlg = new MonCreateBoundaryCAO(this, true,
HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ;
BoundaryDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryCAOEdit()
// ------------------------------------------------------------------------
{
if (CBBoundaryCAO->currentText() == QString("")) return;
MonEditBoundaryCAO *BoundaryDlg = new MonEditBoundaryCAO(this, true,
HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryCAO->currentText() ) ;
BoundaryDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryCAOHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str()));
}
// ------------------------------------------------------------------------
void MonCreateCase::SetBoundaryD()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetBoundaryD ");
if (CBBoundaryD->isChecked())
{
bool bOK = PushOnApply(0);
if (bOK) { GBBoundaryD->setVisible(1); }
else { GBBoundaryD->setVisible(0);
CBBoundaryD->setChecked(0);
CBBoundaryD->setCheckState(Qt::Unchecked); }
}
else { GBBoundaryD->setVisible(0); }
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateCase::AddBoundaryDi(QString newBoundary)
// ------------------------------------------------------------------------
{
CBBoundaryDi->insertItem(0,newBoundary);
CBBoundaryDi->setCurrentIndex(0);
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryDiNew()
// ------------------------------------------------------------------------
{
MonCreateBoundaryDi *BoundaryDlg = new MonCreateBoundaryDi(this, true,
HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ;
BoundaryDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryDiEdit()
// ------------------------------------------------------------------------
{
if (CBBoundaryDi->currentText() == QString("")) return;
MonEditBoundaryDi *BoundaryDlg = new MonEditBoundaryDi(this, true,
HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryDi->currentText() ) ;
BoundaryDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryDiHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str()));
}
// ------------------------------------------------------------------------
void MonCreateCase::SetBoundaryA()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetBoundaryA ");
if (CBBoundaryA->isChecked())
{
bool bOK = PushOnApply(0);
if (bOK) { GBBoundaryA->setVisible(1); }
else { GBBoundaryA->setVisible(0);
CBBoundaryA->setChecked(0);
CBBoundaryA->setCheckState(Qt::Unchecked); }
}
else { GBBoundaryA->setVisible(0); }
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateCase::AddBoundaryAn(QString newBoundary)
// ------------------------------------------------------------------------
{
MESSAGE("Debut de AddBoundaryAn ");
// Ajout d'une nouvelle colonne
int nbcol = TWBoundary->columnCount();
// MESSAGE("nbcol " << nbcol);
nbcol += 1 ;
TWBoundary->setColumnCount ( nbcol ) ;
QTableWidgetItem *__colItem = new QTableWidgetItem();
__colItem->setText(QApplication::translate("CreateCase", newBoundary.toStdString().c_str(), 0));
TWBoundary->setHorizontalHeaderItem(nbcol-1, __colItem);
/* TWBoundary->horizontalHeaderItem(nbcol-1)->setFlags( Qt::ItemIsSelectable|Qt::ItemIsEnabled );*/
// Chaque case est a cocher
int nbrow = TWBoundary->rowCount();
// MESSAGE("nbrow " << nbrow);
for ( int i = 0; i < nbrow; i++ )
{
TWBoundary->setItem( i, nbcol-1, new QTableWidgetItem( QString ("") ) );
TWBoundary->item( i, nbcol-1 )->setFlags( 0 );
TWBoundary->item( i, nbcol-1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
TWBoundary->item( i, nbcol-1 )->setCheckState( Qt::Unchecked );
}
TWBoundary->resizeColumnToContents(nbcol-1);
// TWBoundary->resizeRowsToContents();
// MESSAGE("Fin de AddBoundaryAn ");
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryAnNew()
// ------------------------------------------------------------------------
{
MonCreateBoundaryAn *BoundaryDlg = new MonCreateBoundaryAn(this, true,
HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
BoundaryDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryAnEdit()
// ------------------------------------------------------------------------
{
QString nom="";
int nbcol = TWBoundary->columnCount();
for ( int i = 1; i < nbcol; i++ )
{
QTableWidgetItem *__colItem = new QTableWidgetItem();
__colItem = TWBoundary->horizontalHeaderItem(i);
nom = QString(__colItem->text()) ;
MESSAGE("nom "<<nom.toStdString().c_str());
if (nom != QString(""))
{ MonEditBoundaryAn *BoundaryDlg = new MonEditBoundaryAn(this, true,
HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, nom ) ;
BoundaryDlg->show(); }
}
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryAnHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-analytique"), QString(LanguageShort.c_str()));
}
// ------------------------------------------------------------------------
void MonCreateCase::CaseNameChanged()
// ------------------------------------------------------------------------
{
if (_aCaseName != LEName->text().trimmed())
{
LEFileName->setReadOnly(false);
PushFichier->show();
}
}
// ------------------------------------------------------------------------
void MonCreateCase::SetAdvanced()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetAdvanced ");
if (CBAdvanced->isChecked())
{ GBAdvancedOptions->setVisible(1);
GBConforme->setVisible(1);
RBStandard->setVisible(1);
RBBox->setVisible(1);
if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) )
{ RBNC1NpA->setVisible(0);
RBNCQuelconque->setVisible(0);}
else
{ RBNC1NpA->setVisible(1);
RBNCQuelconque->setVisible(1);}
GBFormat->setVisible(1);
RBMED->setVisible(1);
RBSaturne2D->setVisible(1);
}
else
{ GBAdvancedOptions->setVisible(0);
CBPyramid->setChecked(false);
_Pyram = 0 ;
SetStandard() ;
SetMED() ;
}
//
adjustSize();
}

View File

@ -0,0 +1,102 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATECASE_H
#define MON_CREATECASE_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include "ui_CreateCase.h"
#include <QWidget>
class HOMARD_EXPORT MonCreateCase : public QDialog, public Ui_CreateCase
{
Q_OBJECT
public:
MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen );
~MonCreateCase();
void AddBoundaryCAO(QString newBoundary);
void AddBoundaryAn(QString newBoundary);
void AddBoundaryDi(QString newBoundary);
protected :
QString _aCaseName;
QString _aDirName;
int _ConfType;
int _ExtType;
int _Pyram;
HOMARD::HOMARD_Cas_var aCase ;
HOMARD::HOMARD_Gen_var myHomardGen;
virtual void InitConnect();
virtual void InitBoundarys();
virtual void SetNewName();
public slots:
virtual void SetDirName();
virtual void SetFileName();
virtual void SetConforme();
virtual void SetNonConforme();
virtual void SetStandard();
virtual void SetBox();
virtual void SetNC1NpA();
virtual void SetNCQuelconque();
virtual void SetMED();
virtual void SetSaturne();
virtual void SetSaturne2D();
virtual void SetBoundaryNo();
virtual void SetBoundaryCAO();
virtual void SetBoundaryNonCAO();
virtual void PushBoundaryCAONew();
virtual void PushBoundaryCAOEdit();
virtual void PushBoundaryCAOHelp();
virtual void SetBoundaryD();
virtual void PushBoundaryDiNew();
virtual void PushBoundaryDiEdit();
virtual void PushBoundaryDiHelp();
virtual void SetBoundaryA();
virtual void PushBoundaryAnNew();
virtual void PushBoundaryAnEdit();
virtual void PushBoundaryAnHelp();
virtual void SetAdvanced();
virtual void PushOnOK();
virtual bool PushOnApply(int option);
virtual void PushOnHelp();
virtual void CaseNameChanged();
};
#endif // MON_CREATECASE_H

View File

@ -0,0 +1,945 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateHypothesis.h"
#include "MonCreateListGroup.h"
#include "MonCreateIteration.h"
#include "MonCreateZone.h"
#include "MonEditZone.h"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
// -------------------------------------------------------------------------------
MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen0,
QString Name,
QString caseName, QString aFieldFile)
// ---------------------------------------------------------------------------------
/* Constructs a MonCreateHypothesis */
:
QScrollArea(0), Ui_CreateHypothesis(),
_parent(parent), _Name(Name),
_aCaseName(caseName), _aFieldFile(aFieldFile),
_aFieldName(""),
_aTypeAdap(-2), _aTypeRaff(1), _aTypeDera(0),
_TypeThR(3), _ThreshR(0),
_TypeThC(0), _ThreshC(0),
_UsField(0), _UsCmpI(0), _TypeFieldInterp(0),
_NivMax(-1),
_DiamMin(-1.),
_AdapInit(0),
_ExtraOutput(1)
{
MESSAGE("Constructeur") ;
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
if ( modal ) { setWindowModality(Qt::WindowModal); }
else { setWindowModality(Qt::NonModal); }
setWindowFlags( Qt::WindowStaysOnTopHint ) ;
InitConnect();
SetNewName();
if (_aFieldFile != QString(""))
{ RBChamp->setChecked(1);
SetChamp();
}
else
{ RBUniforme->setChecked(1);
SetUniforme();
}
SetFieldNo();
GBAdvancedOptions->setVisible(0);
CBOutputLevel->setChecked(false);
CBOutputQuality->setChecked(false);
CBOutputDiameter->setChecked(false);
CBOutputParent->setChecked(false);
CBOutputVoisins->setChecked(false);
_ExtraOutput = 1 ;
//
adjustSize();
}
// ------------------------------------------------------------------------
MonCreateHypothesis::~MonCreateHypothesis()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::InitConnect()
// ------------------------------------------------------------------------
{
connect( RBUniforme, SIGNAL(clicked()), this, SLOT(SetUniforme()));
connect( RBChamp, SIGNAL(clicked()), this, SLOT(SetChamp()));
connect( RBZone, SIGNAL(clicked()), this, SLOT(SetZone()));
connect( RBUniRaff, SIGNAL(clicked()), this, SLOT(SetUniRaff()));
connect( RBUniDera, SIGNAL(clicked()), this, SLOT(SetUniDera()));
connect( CBFieldName, SIGNAL(activated(int)), this, SLOT( SetFieldName()));
connect( RBRPE, SIGNAL(clicked()), this, SLOT(SetRPE()));
connect( RBRRel, SIGNAL(clicked()), this, SLOT(SetRRel()));
connect( RBRMuSigma, SIGNAL(clicked()), this, SLOT(SetRMS()));
connect( RBRAbs, SIGNAL(clicked()), this, SLOT(SetRAbs()));
connect( RBRNo, SIGNAL(clicked()), this, SLOT(SetRNo()));
connect( RBCPE, SIGNAL(clicked()), this, SLOT(SetCPE()));
connect( RBCRel, SIGNAL(clicked()), this, SLOT(SetCRel()));
connect( RBCMuSigma, SIGNAL(clicked()), this, SLOT(SetCMS()));
connect( RBCAbs, SIGNAL(clicked()), this, SLOT(SetCAbs()));
connect( RBCNo, SIGNAL(clicked()), this, SLOT(SetCNo()));
connect( RBL2, SIGNAL(clicked()), this, SLOT(SetUCL2()));
connect( RBInf, SIGNAL(clicked()), this, SLOT(SetUCInf()));
connect( CBJump, SIGNAL(stateChanged(int)), this, SLOT(SetUseField()));
connect( PBZoneNew, SIGNAL(pressed()), this, SLOT(PushZoneNew()));
connect( PBZoneEdit, SIGNAL(pressed()), this, SLOT(PushZoneEdit()) );
connect( PBZoneDelete, SIGNAL(pressed()), this, SLOT(PushZoneDelete()) );
connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT(SetFiltrage()));
connect( RBFieldNo, SIGNAL(clicked()), this, SLOT(SetFieldNo()));
connect( RBFieldAll, SIGNAL(clicked()), this, SLOT(SetFieldAll()));
connect( RBFieldChosen,SIGNAL(clicked()), this, SLOT(SetFieldChosen()));
connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
connect( RBAIN, SIGNAL(clicked()), this, SLOT(SetAIN()));
connect( RBAIR, SIGNAL(clicked()), this, SLOT(SetAIR()));
connect( RBAID, SIGNAL(clicked()), this, SLOT(SetAID()));
connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
}
// ------------------------------------------------------------------------
bool MonCreateHypothesis::PushOnApply()
// ------------------------------------------------------------------------
// Appele lorsque l'un des boutons Ok ou Apply est presse
//
{
// Verifications
if (LEName->text().trimmed()=="") {
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_HYPO_NAME") );
return false;
}
if (VerifieZone() == false) return false;
if (VerifieComposant() == false) return false;
// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
if (LEName->text().trimmed() != _Name)
{
_Name=LEName->text().trimmed();
try
{
aHypothesis=myHomardGen->CreateHypothesis(CORBA::string_dup(_Name.toStdString().c_str()) );
_parent->addHypothese(_Name);
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QString(CORBA::string_dup(S_ex.details.text)) );
return false;
}
}
// Mise en place des attributs
if ( _aTypeAdap == -1 )
{
int TypeRaffDera ;
if ( _aTypeRaff == 1 ) { TypeRaffDera = 1 ; }
else { TypeRaffDera = -1 ; }
aHypothesis->SetUnifRefinUnRef(TypeRaffDera);
}
aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
AssocieLesZones();
AssocieComposants();
AssocieLesGroupes();
AssocieFieldInterp();
// Options avancees
if (CBAdvanced->isChecked())
{
// Enregistrement du niveau maximal
_NivMax = SpinBoxNivMax->value() ;
aHypothesis->SetNivMax(_NivMax);
// Enregistrement du diametre minimal
_DiamMin = doubleSpinBoxDiamMin->value() ;
aHypothesis->SetDiamMin(_DiamMin);
// Enregistrement de l'intialisation de l'adaptation
aHypothesis->SetAdapInit(_AdapInit);
// Sortie optionnelle des niveaux de raffinement, des diametres, des qualites
_ExtraOutput = 1 ;
if (CBOutputLevel->isChecked()) { _ExtraOutput = 2 ; }
if (CBOutputQuality->isChecked()) { _ExtraOutput = 3*_ExtraOutput ; }
if (CBOutputDiameter->isChecked()) { _ExtraOutput = 5*_ExtraOutput ; }
if (CBOutputParent->isChecked()) { _ExtraOutput = 7*_ExtraOutput ; }
if (CBOutputVoisins->isChecked()) { _ExtraOutput = 11*_ExtraOutput ; }
aHypothesis->SetExtraOutput(_ExtraOutput);
}
HOMARD_UTILS::updateObjBrowser() ;
return true;
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::PushOnOK()
// ------------------------------------------------------------------------
{
if (PushOnApply()) this->close();
if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::PushOnHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str()));
}
// -------------------------------------------------
void MonCreateHypothesis::SetNewName()
// --------------------------------------------------
{
HOMARD::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName();
int num = 0;//
QString aName="";
while (aName=="" )
{
aName.setNum(num+1) ;
aName.insert(0, QString("Hypo_")) ;
for ( int i=0; i<MyObjects->length(); i++)
{
if ( aName == QString(MyObjects[i]))
{
num ++ ;
aName = "" ;
break ;
}
}
}
LEName->setText(aName);
}
//
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetUniforme()
// ------------------------------------------------------------------------
{
GBFieldManagement->setVisible(0);
if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
else { GBFieldFile->setVisible(1); }
GBAreaManagement->setVisible(0);
GBUniform->setVisible(1);
_aTypeAdap = -1 ;
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetChamp()
// ------------------------------------------------------------------------
{
if (_aFieldFile == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_HYPO_FIELD_FILE") );
close();
if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
return;
}
LEFieldFile->setText(_aFieldFile);
LEFieldFile->setReadOnly(1);
InitFields();
GBUniform->setVisible(0);
GBAreaManagement->setVisible(0);
GBFieldManagement->setVisible(1);
GBFieldFile->setVisible(1);
GBUniform->adjustSize();
GBAreaManagement->adjustSize();
GBFieldManagement->adjustSize();
GBFieldFile->adjustSize();
_aTypeAdap = 1 ;
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetZone()
// ------------------------------------------------------------------------
{
GetAllZones();
GBUniform->setVisible(0);
GBFieldManagement->setVisible(0);
if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
else { GBFieldFile->setVisible(1); }
GBAreaManagement->setVisible(1);
_aTypeRaff = 1 ;
_aTypeDera = 0 ;
_aTypeAdap = 0 ;
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::PushZoneNew()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
MonCreateZone *aDlg = new MonCreateZone(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
aDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::PushZoneEdit()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
int colonne = TWZone->currentColumn();
QTableWidgetItem * monItem = TWZone->currentItem();
if (colonne !=2 || monItem == NULL)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_HYPO_ZONE_1") );
return;
}
QString zoneName = monItem->text().trimmed();
MonEditZone *aDlg = new MonEditZone(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ;
aDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::PushZoneDelete()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
QObject::tr("HOM_INACTIVE_BUTTON") );
return;
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::GetAllZones()
// ------------------------------------------------------------------------
// Recuperation de toutes les zones enregistrees dans l'arbre d'etude
// et affichage dans le tableau
// Par defaut, aucune n'est selectionnee
{
MESSAGE("Debut de GetAllZones") ;
HOMARD::listeZones_var mesZones = myHomardGen->GetAllZonesName();
int nbrow=TWZone->rowCount();
for ( int row=0; row< nbrow; row++)
{
TWZone->removeRow(row);
}
TWZone->setRowCount(0);
int row=0;
for (int i=0; i<mesZones->length(); i++)
{
TWZone->insertRow(row);
//
TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
TWZone->item( row, 0 )->setFlags( 0 );
TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
//
TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
TWZone->item( row, 1 )->setFlags( 0 );
TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
//
TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
//
row += 1;
}
TWZone->resizeColumnsToContents();
TWZone->resizeRowsToContents();
TWZone->clearSelection();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::addZoneinTWZone(QString newZone)
// ------------------------------------------------------------------------
{
MESSAGE("Debut de addZoneinTWZone") ;
int row = TWZone->rowCount() ;
// Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement
TWZone->setRowCount( row+1 );
//
TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
TWZone->item( row, 0 )->setCheckState( Qt::Checked );
//
TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
//
TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) );
TWZone->scrollToItem( TWZone->item( row, 2 ) );
//
TWZone->resizeRowsToContents();
TWZone->resizeColumnToContents(1);
TWZone->clearSelection();
//
TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
}
// ------------------------------------------------------------------------
QStringList MonCreateHypothesis::GetZonesChecked()
// ------------------------------------------------------------------------
// Retourne les zones enregistrees
{
MESSAGE("Debut de GetZonesChecked") ;
QStringList ListeZone ;
// On ne peut pas avoir selectionne les deux options
int Pbm = 0 ;
for ( int row=0; row< TWZone->rowCount(); row++)
{
if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) && ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_HYPO_ZONE_3") );
Pbm = 1 ;
}
}
// Si tout va bien, on affecte
// Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone
if ( Pbm == 0 )
{
QString Raff = "1" ;
QString Dera = "-1" ;
for ( int row=0; row< TWZone->rowCount(); row++)
{
// MESSAGE ("row "<<row<<", zone : "<<TWZone->item(row, 2)->text().toStdString());
// En raffinement :
if ( TWZone->item(row,0)->checkState() == Qt::Checked )
{ ListeZone.insert(0, Raff) ;
ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
// En deraffinement :
if ( TWZone->item(row,1)->checkState() == Qt::Checked )
{ ListeZone.insert(0, Dera) ;
ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
}
MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<<ListeZone.count()) ;
}
//
return ListeZone ;
}
// ------------------------------------------------------------------------
QStringList MonCreateHypothesis::GetListCompChecked()
// ------------------------------------------------------------------------
// Retourne les composantes retenues
{
MESSAGE( "Debut de GetListCompChecked" );
QStringList ListeComposant ;
ListeComposant.clear();
for ( int row=0; row< TWCMP->rowCount(); row++)
if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
// Choix du texte des radio-boutons selon 1 ou plusieurs composantes
if ( ListeComposant.count() < 2 )
{ RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
}
else
{ RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
}
return ListeComposant ;
//
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::AssocieFieldInterp()
// ------------------------------------------------------------------------
{
if ( _TypeFieldInterp != 2 ) return;
for ( int row=0; row< TWField->rowCount(); row++)
{
if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
{
aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str());
}
}
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetUniRaff()
// ------------------------------------------------------------------------
{
_aTypeRaff = 1 ;
_aTypeDera = 0 ;
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetUniDera()
// ------------------------------------------------------------------------
{
_aTypeRaff = 0 ;
_aTypeDera = 1 ;
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::InitFields()
// ------------------------------------------------------------------------
{
CBFieldName->clear();
std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
// Mise en place de la liste dans le menu pour l'indicateur d'erreur
std:: list<QString>::const_iterator it;
for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
{
CBFieldName->insertItem(0,QString(*it));
}
SetFieldName();
}
// ---------------------------------------
void MonCreateHypothesis::SetFieldName()
// -------------------------------------------
{
MESSAGE("Debut de SetFieldName");
_aFieldName=CBFieldName->currentText();
if (QString(_aFieldFile) == QString("") || QString(_aFieldName) == QString("") ) { return; }
int nbrow= TWCMP->rowCount() ;
for ( int row=0; row < nbrow ; row++)
{
TWCMP->removeRow(row);
}
TWCMP->setRowCount(0);
//TWCMP->resizeRowsToContents();
std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
std::list<QString>::const_iterator it;
for ( it=maListe.begin() ; it != maListe.end(); it++)
{
TWCMP->insertRow(0);
TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
TWCMP->item( 0, 0 )->setFlags( 0 );
TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
}
TWCMP->resizeColumnsToContents();
TWCMP->resizeRowsToContents();
TWCMP->clearSelection();
// Choix du texte des radio-boutons selon 1 ou plusieurs composantes
if ( TWCMP->rowCount() == 1 )
{ RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
}
else
{ RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
}
// Par defaut, on propose la valeur absolue / norme L2
SetUCL2();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetRPE()
// ------------------------------------------------------------------------
{
_aTypeRaff = 1 ;
_TypeThR = 3 ;
RBRPE->setChecked(true);
SpinBox_RPE->setEnabled(true);
SpinBox_RRel->setEnabled(false);
SpinBox_RAbs->setEnabled(false);
SpinBox_RMuSigma->setEnabled(false);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetRRel()
// ------------------------------------------------------------------------
{
_aTypeRaff = 1 ;
_TypeThR = 2 ;
RBRRel->setChecked(true);
SpinBox_RPE->setEnabled(false);
SpinBox_RRel->setEnabled(true);
SpinBox_RAbs->setEnabled(false);
SpinBox_RMuSigma->setEnabled(false);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetRAbs()
// ------------------------------------------------------------------------
{
_aTypeRaff = 1 ;
_TypeThR = 1 ;
RBRAbs->setChecked(true);
SpinBox_RPE->setEnabled(false);
SpinBox_RRel->setEnabled(false);
SpinBox_RAbs->setEnabled(true);
SpinBox_RMuSigma->setEnabled(false);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetRMS()
// ------------------------------------------------------------------------
{
_aTypeRaff = 1 ;
_TypeThR = 4 ;
RBRMuSigma->setChecked(true);
SpinBox_RPE->setEnabled(false);
SpinBox_RRel->setEnabled(false);
SpinBox_RAbs->setEnabled(false);
SpinBox_RMuSigma->setEnabled(true);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetRNo()
// ------------------------------------------------------------------------
{
_aTypeRaff = 0 ;
_TypeThR = 0;
RBRNo->setChecked(true);
SpinBox_RPE->setEnabled(false);
SpinBox_RRel->setEnabled(false);
SpinBox_RAbs->setEnabled(false);
SpinBox_RMuSigma->setEnabled(false);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetCPE()
// ------------------------------------------------------------------------
{
_aTypeDera = 1 ;
_TypeThC = 3 ;
RBCPE->setChecked(true);
SpinBox_CPE->setEnabled(true);
SpinBox_CRel->setEnabled(false);
SpinBox_CAbs->setEnabled(false);
SpinBox_CMuSigma->setEnabled(false);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetCRel()
// ------------------------------------------------------------------------
{
_aTypeDera = 1 ;
_TypeThC = 2 ;
RBCRel->setChecked(true);
SpinBox_CPE->setEnabled(false);
SpinBox_CRel->setEnabled(true);
SpinBox_CAbs->setEnabled(false);
SpinBox_CMuSigma->setEnabled(false);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetCAbs()
// ------------------------------------------------------------------------
{
_aTypeDera = 1 ;
_TypeThC = 1 ;
RBCAbs->setChecked(true);
SpinBox_CPE->setEnabled(false);
SpinBox_CRel->setEnabled(false);
SpinBox_CAbs->setEnabled(true);
SpinBox_CMuSigma->setEnabled(false);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetCMS()
// ------------------------------------------------------------------------
{
_aTypeDera = 1 ;
_TypeThC = 4 ;
RBCMuSigma->setChecked(true);
SpinBox_CPE->setEnabled(false);
SpinBox_CRel->setEnabled(false);
SpinBox_CAbs->setEnabled(false);
SpinBox_CMuSigma->setEnabled(true);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetCNo()
// ------------------------------------------------------------------------
{
_aTypeDera = 0 ;
_TypeThC = 0;
RBCNo->setChecked(true);
SpinBox_CPE->setEnabled(false);
SpinBox_CRel->setEnabled(false);
SpinBox_CAbs->setEnabled(false);
SpinBox_CMuSigma->setEnabled(false);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetUCL2()
// ------------------------------------------------------------------------
{
_UsCmpI = 0 ;
RBL2->setChecked(true);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetUCInf()
// ------------------------------------------------------------------------
{
if ( TWCMP->rowCount() == 1 ) { _UsCmpI = 2 ; }
else { _UsCmpI = 1 ; }
RBInf->setChecked(true);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetUseField()
// ------------------------------------------------------------------------
{
if ( CBJump->isChecked() ) { _UsField = 1 ; }
else { _UsField = 0 ; }
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetFiltrage()
// ------------------------------------------------------------------------
{
if (!CBGroupe->isChecked()) return;
MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ;
aDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::setGroups(QStringList listGroup)
// ------------------------------------------------------------------------
{
_aListeGroupes=listGroup;
}
// ------------------------------------------------------------------------
bool MonCreateHypothesis::VerifieZone()
// ------------------------------------------------------------------------
{
if ( _aTypeAdap != 0 ) return true;
MESSAGE("Debut de VerifieZone") ;
_aListeZone = GetZonesChecked() ;
MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
if (_aListeZone.count() == 0)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_HYPO_ZONE_2") );
return false;
}
MESSAGE("Fin de VerifieZone") ;
return true;
}
// ------------------------------------------------------------------------
bool MonCreateHypothesis::VerifieComposant()
// ------------------------------------------------------------------------
{
if ( _aTypeAdap != 1 ) return true;
_aListeComposant = GetListCompChecked() ;
if (_aListeComposant.count() == 0)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_HYPO_COMP") );
return false;
}
return true;
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::AssocieLesZones()
// ------------------------------------------------------------------------
{
MESSAGE( "Debut de AssocieLesZones" );
if ( _aTypeAdap != 0 ) return;
_aListeZone = GetZonesChecked() ;
MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
QString Raff = "1" ;
int TypeUse ;
for ( int i=0 ; i< _aListeZone.count() ; i++ )
{ if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; }
else { TypeUse = -1 ; }
aHypothesis->AddZone(_aListeZone[i].toStdString().c_str(), TypeUse);
i += 1 ;
}
MESSAGE( "Fin de AssocieLesZones" );
};
// ------------------------------------------------------------------------
void MonCreateHypothesis::AssocieComposants()
// ------------------------------------------------------------------------
{
if ( _aTypeAdap != 1 ) return;
MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
_ThreshR = 0;
if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
if ( _TypeThR == 4 ) { _ThreshR = SpinBox_RMuSigma->value(); }
_ThreshC = 0;
if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
if ( _TypeThC == 4 ) { _ThreshC = SpinBox_CMuSigma->value(); }
_aFieldName=CBFieldName->currentText();
aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
if ( _TypeThR > 0 ) { aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ; }
if ( _TypeThC > 0 ) { aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ; }
aHypothesis->SetUseField( _UsField ) ;
aHypothesis->SetUseComp( _UsCmpI ) ;
_aListeComposant = GetListCompChecked() ;
for ( int i=0 ; i< _aListeComposant.count() ; i++ )
{ aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
};
// ------------------------------------------------------------------------
void MonCreateHypothesis::AssocieLesGroupes()
// ------------------------------------------------------------------------
{
HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
aSeqGroupe->length(_aListeGroupes.size());
QStringList::const_iterator it;
int i=0;
for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
aSeqGroupe[i++]=(*it).toStdString().c_str();
aHypothesis->SetGroups(aSeqGroupe);
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetFieldNo()
// ------------------------------------------------------------------------
// Par defaut, on n'interpole rien
{
if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
else { GBFieldFile->setVisible(0); }
TWField->setVisible(0);
//
_TypeFieldInterp = 0 ;
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetFieldAll()
// ------------------------------------------------------------------------
// Par defaut, on interpole tout
{
if (_aFieldFile == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_HYPO_FIELD_FILE") );
close();
if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
return;
}
LEFieldFile->setText(_aFieldFile);
LEFieldFile->setReadOnly(1);
GBFieldFile->setVisible(1);
TWField->setVisible(0);
//
_TypeFieldInterp = 1 ;
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetFieldChosen()
// ------------------------------------------------------------------------
{
if (_aFieldFile == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_HYPO_FIELD_FILE") );
close();
if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
return;
}
LEFieldFile->setText(_aFieldFile);
LEFieldFile->setReadOnly(1);
GBFieldFile->setVisible(1);
// Recuperation de la liste des champs contenus dans le fichier _aFieldFile
std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
// Initialisation de la table
TWField->clear();
int nbrow=TWField->rowCount();
for ( int row=0; row< nbrow; row++)
{
TWField->removeRow(row);
}
TWField->setRowCount(0);
std:: list<QString>::const_iterator it;
int row=0;
for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
{
TWField->insertRow(row);
TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
TWField->item( row, 0 )->setFlags( 0 );
TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
row=row+1;
}
TWField->resizeColumnsToContents();
TWField->resizeRowsToContents();
TWField->clearSelection();
TWField->setVisible(1);
_TypeFieldInterp = 2 ;
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetAdvanced()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetAdvanced ");
if (CBAdvanced->isChecked())
{ GBAdvancedOptions->setVisible(1);
if (_aFieldFile != QString("")) { GBAdapInit->setVisible(1) ; }
else { GBAdapInit->setVisible(0) ; }
}
else
{ GBAdvancedOptions->setVisible(0);
_NivMax = -1 ;
_DiamMin = -1. ;
_AdapInit = 0 ;
CBOutputLevel->setChecked(false);
CBOutputQuality->setChecked(false);
CBOutputDiameter->setChecked(false);
CBOutputParent->setChecked(false);
CBOutputVoisins->setChecked(false);
_ExtraOutput = 1 ;
}
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetAIN()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetAIN ");
_AdapInit = 0 ;
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetAIR()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetAIR ");
_AdapInit = 1 ;
}
// ------------------------------------------------------------------------
void MonCreateHypothesis::SetAID()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetAID ");
_AdapInit = -1 ;
}

View File

@ -0,0 +1,138 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATEHYPOTHESIS_H
#define MON_CREATEHYPOTHESIS_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Hypothesis)
#include "ui_CreateHypothesis.h"
#include <QScrollArea>
class MonCreateIteration;
class HOMARD_EXPORT MonCreateHypothesis : public QScrollArea, public Ui_CreateHypothesis
{
Q_OBJECT
public:
MonCreateHypothesis( MonCreateIteration* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen,
QString aHypotheseName, QString caseName, QString aFieldFile);
~MonCreateHypothesis();
virtual void addZoneinTWZone(QString newZone);
virtual void setGroups(QStringList listGroup);
protected :
// MonCreateHypothesis( MonCreateIteration* parent, HOMARD::HOMARD_Gen_var myHomardGen,
// QString caseName, QString aFieldFile);
MonCreateIteration *_parent;
QString _Name;
QString _aFieldFile ;
QString _aFieldName;
QString _aCaseName;
int _aTypeAdap;
int _aTypeRaff;
int _aTypeDera;
int _TypeThR;
double _ThreshR;
int _TypeThC;
double _ThreshC;
int _UsField;
int _UsCmpI;
int _TypeFieldInterp;
int _NivMax;
double _DiamMin;
int _AdapInit;
int _ExtraOutput;
HOMARD::HOMARD_Hypothesis_var aHypothesis;
HOMARD::HOMARD_Gen_var myHomardGen;
QStringList _aListeZone;
QStringList _aListeComposant;
QStringList _aListeGroupes;
virtual void InitConnect();
virtual void InitFields();
virtual void GetAllZones();
virtual void SetNewName();
virtual void AssocieFieldInterp();
virtual void AssocieLesZones();
virtual void AssocieComposants();
virtual void AssocieLesGroupes();
virtual bool VerifieZone();
virtual bool VerifieComposant();
virtual QStringList GetZonesChecked();
virtual QStringList GetListCompChecked();
public slots:
virtual void SetUniforme();
virtual void SetChamp();
virtual void SetZone();
virtual void SetUniRaff();
virtual void SetUniDera();
virtual void SetFieldName();
virtual void SetRPE();
virtual void SetRAbs();
virtual void SetRRel();
virtual void SetRMS();
virtual void SetRNo();
virtual void SetCPE();
virtual void SetCAbs();
virtual void SetCRel();
virtual void SetCMS();
virtual void SetCNo();
virtual void SetUCL2();
virtual void SetUCInf();
virtual void SetUseField();
virtual void PushZoneNew();
virtual void PushZoneEdit();
virtual void PushZoneDelete();
virtual void SetFiltrage();
virtual void SetFieldNo();
virtual void SetFieldAll();
virtual void SetFieldChosen();
virtual void SetAdvanced();
virtual void SetAIN();
virtual void SetAIR();
virtual void SetAID();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_CREATEHYPOTHESIS_H

View File

@ -0,0 +1,339 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateIteration.h"
#include "MonCreateHypothesis.h"
#include "MonEditHypothesis.h"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
// -----------------------------------------------------------------------------------------------------
MonCreateIteration::MonCreateIteration(QWidget* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen0, QString IterParentName ):
// -----------------------------------------------------------------------------------------------------
/* Constructs a MonCreateIteration
* Inherits from CasHomard
* Sets attributes to default values
*/
QScrollArea(0),
Ui_CreateIteration(),
_Name(""),
_IterParentName(IterParentName),
_CaseName("")
{
MESSAGE("Constructeur");
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
if ( modal ) { setWindowModality(Qt::WindowModal); }
else { setWindowModality(Qt::NonModal); }
InitConnect();
SetNewName();
GetHypotheses();
if (_IterParentName != QString("")) { SetIterParentName(); }
else { setWindowModality(Qt::NonModal) ; /* permet selection de l'iteration dans l arbre d etude */}
SetTSNo();
//
adjustSize();
}
// ------------------------------------------------------------------------
MonCreateIteration::~MonCreateIteration()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateIteration::InitConnect()
// ------------------------------------------------------------------------
{
connect( PBIterParent, SIGNAL(pressed()), this, SLOT( SetIterParentName()));
connect( PBHypoEdit, SIGNAL(pressed()), this, SLOT( PushHypoEdit() ) );
connect( PBHypoNew, SIGNAL(pressed()), this, SLOT( PushHypoNew() ) );
connect( PushFieldFile, SIGNAL(pressed()), this, SLOT( SetFieldFile() ) );
connect( RBNo, SIGNAL(clicked()), this, SLOT( SetTSNo()));
connect( RBLast, SIGNAL(clicked()), this, SLOT( SetTSLast()));
connect( RBChosen, SIGNAL(clicked()), this, SLOT( SetTSChosen()));
connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK() ) );
connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply() ) );
connect( buttonCancel, SIGNAL(pressed()), this, SLOT( close() ) );
connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp() ) );
}
// ------------------------------------------------------------------------
void MonCreateIteration::GetHypotheses()
// ------------------------------------------------------------------------
{
HOMARD::listeHypotheses_var mesHypotheses = myHomardGen->GetAllHypothesesName();
for (int i=0; i<mesHypotheses->length(); i++)
{
CBHypothese->addItem(QString(mesHypotheses[i]));
}
}
// ------------------------------------------------------------------------
bool MonCreateIteration::PushOnApply()
// ------------------------------------------------------------------------
// Appele lorsque l'un des boutons Ok ou Apply est presse
{
MESSAGE("PushOnApply");
//
QString aName = LEName->text().trimmed();
if ( aName == QString (""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ITER_NAME") );
return false;
}
if ( _IterParentName == QString (""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ITER_STARTING_POINT") );
return false;
}
QString aMeshName_np1=LEMeshName_np1->text().trimmed();
if (aMeshName_np1 == "" )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ITER_MESH") );
return false;
}
QString monHypoName=CBHypothese->currentText();
if (monHypoName == "" )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ITER_HYPO") );
return false;
}
HOMARD::HOMARD_Hypothesis_var _myHypothesis = myHomardGen->GetHypothesis(monHypoName.toStdString().c_str());
HOMARD::listeTypes_var ListTypes (_myHypothesis->GetAdapRefinUnRef());
int TypeAdap = ListTypes[0];
if ( TypeAdap == 1 && LEFieldFile->text().trimmed() == QString("") )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ITER_FIELD_FILE") );
return false;
}
MESSAGE ("aMeshName_np1.toStdString " << aMeshName_np1.toStdString());
MESSAGE ("_CaseName.toStdString " << _CaseName.toStdString() );
MESSAGE ("_IterParentName.toStdString " << _IterParentName.toStdString() );
// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
if (_Name != aName)
{
try
{
_Name = aName;
std::cerr << _Name.toStdString() << std::endl;
aIter = myHomardGen->CreateIteration( \
CORBA::string_dup(_Name.toStdString().c_str()),
CORBA::string_dup(_IterParentName.toStdString().c_str()));
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false;
}
}
// Mise en place des attributs
std::string IterName = aIter->GetName() ;
if ( LEFieldFile->text().trimmed() != QString(""))
{
QString FieldFile=LEFieldFile->text().trimmed();
aIter->SetFieldFile(CORBA::string_dup(FieldFile.toStdString().c_str()));
int rank = SpinBox_Rank->value();
int step = SpinBox_TimeStep->value();
if ( step == -2 ) { aIter->SetTimeStepRankLast(); }
else { aIter->SetTimeStepRank(step,rank); }
}
myHomardGen->AssociateIterHypo (IterName.c_str(), monHypoName.toStdString().c_str());
aIter->SetMeshName(CORBA::string_dup(aMeshName_np1.toStdString().c_str()));
HOMARD_UTILS::updateObjBrowser() ;
return true;
}
// ------------------------------------------------------------------------
void MonCreateIteration::PushOnOK()
// ------------------------------------------------------------------------
{
bool bOK = PushOnApply();
if ( bOK ) this->close();
}
// ------------------------------------------------------------------------
void MonCreateIteration::PushOnHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_iteration.html"), QString(""), QString(LanguageShort.c_str()));
}
// ------------------------------------------------------------------------
void MonCreateIteration::SetIterParentName()
// ------------------------------------------------------------------------
{
if (_IterParentName == QString("")) {
_IterParentName=HOMARD_QT_COMMUN::SelectionArbreEtude(QString("IterationHomard"), 1);
if (_IterParentName == QString("")) { raise();return;};
}
_CaseName=HOMARD_QT_COMMUN::SelectionCasEtude();
HOMARD::HOMARD_Iteration_var aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str()) ;
QString MeshName = aIterParent->GetMeshName();
LEMeshName_n->setText(MeshName);
LEMeshName_n->setReadOnly(1);
LEMeshName_np1->setText(MeshName);
LEIterationParentName->setText(_IterParentName);
}
// -------------------------------------------------
void MonCreateIteration::SetNewName()
// --------------------------------------------------
{
// Recherche d'un nom par defaut qui n'existe pas encore
HOMARD::listeIterations_var MyObjects=myHomardGen->GetAllIterationsName();
int num = 0;//
QString aName="";
while (aName=="" )
{
aName.setNum(num+1) ;
aName.insert(0, QString("Iter_"));
for ( int i=0; i< MyObjects->length(); i++)
{
if ( aName == QString((MyObjects)[i]))
{
num ++ ;
aName = "" ;
break ;
}
}
}
LEName->setText(aName);
}
// ------------------------------------------------------------------------
void MonCreateIteration::PushHypoEdit()
// ------------------------------------------------------------------------
{
if (CBHypothese->currentText() == QString("")) return;
if (_IterParentName == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ITER_STARTING_POINT") );
raise();
return;
}
QString aFieldFile=LEFieldFile->text().trimmed();
MonEditHypothesis *HypoDlg = new MonEditHypothesis(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),CBHypothese->currentText(), _CaseName, aFieldFile) ;
HypoDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateIteration::addHypothese(QString newHypothese)
// ------------------------------------------------------------------------
{
CBHypothese->insertItem(0,newHypothese);
CBHypothese->setCurrentIndex(0);
}
// ------------------------------------------------------------------------
void MonCreateIteration::PushHypoNew()
// ------------------------------------------------------------------------
{
if (_IterParentName == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ITER_STARTING_POINT") );
raise();
return;
}
if ( _CaseName == QString(""))
{
HOMARD::HOMARD_Iteration_var aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str()) ;
_CaseName = aIterParent->GetCaseName();
}
QString aFieldFile=LEFieldFile->text().trimmed();
MonCreateHypothesis *HypoDlg = new MonCreateHypothesis(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), QString(""), _CaseName, aFieldFile) ;
HypoDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateIteration::SetFieldFile()
// ------------------------------------------------------------------------
{
QString fileName0 = LEFieldFile->text().trimmed();
QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ;
if (fileName.isEmpty()) fileName = fileName0 ;
LEFieldFile->setText(fileName);
raise();
}
// ------------------------------------------------------------------------
void MonCreateIteration::SetTSNo()
// ------------------------------------------------------------------------
// Si on ne tient pas compte du pas de temps, on declare que le pas de temps
// vaut -1, valeur par defaut de med
{
Rank->setVisible(0);
SpinBox_Rank->setVisible(0);
SpinBox_Rank->setValue(-1);
TimeStep->setVisible(0);
SpinBox_TimeStep->setVisible(0);
SpinBox_TimeStep->setValue(-1);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateIteration::SetTSLast()
// ------------------------------------------------------------------------
// Si on choisit le dernier instant, on declare que le pas de temps vaut -2
{
Rank->setVisible(0);
SpinBox_Rank->setVisible(0);
SpinBox_Rank->setValue(-2);
TimeStep->setVisible(0);
SpinBox_TimeStep->setVisible(0);
SpinBox_TimeStep->setValue(-2);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonCreateIteration::SetTSChosen()
// ------------------------------------------------------------------------
// Si choisit un instant, on prepositionne a 0
{
Rank->setVisible(1);
SpinBox_Rank->setVisible(1);
SpinBox_Rank->setValue(0);
TimeStep->setVisible(1);
SpinBox_TimeStep->setVisible(1);
SpinBox_TimeStep->setValue(0);
//
adjustSize();
}

View File

@ -0,0 +1,78 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATEITERATION_H
#define MON_CREATEITERATION_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include "ui_CreateIteration.h"
#include <QScrollArea>
class HOMARD_EXPORT MonCreateIteration : public QScrollArea, public Ui_CreateIteration
{
Q_OBJECT
public:
MonCreateIteration( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString IterParentName );
~MonCreateIteration();
void addHypothese(QString newHypothese);
protected :
MonCreateIteration( QWidget* parent, HOMARD::HOMARD_Gen_var myHomardGen, QString IterParentName );
QString _Name;
QString _IterParentName;
QString _CaseName;
HOMARD::HOMARD_Iteration_var aIter ;
HOMARD::HOMARD_Iteration_var aIterParent ;
HOMARD::HOMARD_Cas_var aCas ;
HOMARD::HOMARD_Gen_var myHomardGen;
virtual void InitConnect();
virtual void GetHypotheses();
virtual void SetNewName();
public slots:
virtual void SetIterParentName();
virtual void PushHypoEdit();
virtual void PushHypoNew();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
virtual void SetFieldFile();
virtual void SetTSNo();
virtual void SetTSLast();
virtual void SetTSChosen();
};
#endif // MON_CREATEITERATION_H

View File

@ -0,0 +1,153 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateListGroup.h"
#include "MonCreateHypothesis.h"
#include "MonCreateBoundaryDi.h"
#include <QFileDialog>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
using namespace std;
// --------------------------------------------------------------------------------------------------------------
MonCreateListGroup::MonCreateListGroup(MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) :
// --------------------------------------------------------------------------------------------------------------
//
QDialog(0), Ui_CreateListGroup(),
_aCaseName (aCaseName),
_listeGroupesHypo (listeGroupesHypo),
_parentHyp(parentHyp),
_parentBound(parentBound)
{
MESSAGE("Debut de MonCreateListGroup")
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
setModal(modal);
InitConnect();
InitGroupes();
}
// --------------------------------------------------------------------------------------------------------------
MonCreateListGroup::MonCreateListGroup(MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound,
HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) :
// --------------------------------------------------------------------------------------------------------------
//
QDialog(0), Ui_CreateListGroup(),
_aCaseName (aCaseName),
_listeGroupesHypo (listeGroupesHypo),
_parentHyp(parentHyp),
_parentBound(parentBound)
{
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen);
setupUi(this);
InitConnect();
}
// ------------------------------------------------------------------------
MonCreateListGroup::~MonCreateListGroup()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateListGroup::InitConnect()
// ------------------------------------------------------------------------
{
connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) );
connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) );
connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) );
connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) );
}
// ------------------------------------------------------------------------
bool MonCreateListGroup::PushOnApply()
// ------------------------------------------------------------------------
// Appele lorsque l'un des boutons Ok ou Apply est presse
//
{
QStringList ListeGroup ;
for ( int row=0; row< TWGroupe->rowCount(); row++)
{
if ( TWGroupe->item( row, 0 )->checkState() == Qt::Checked )
ListeGroup.insert(0, QString(TWGroupe->item(row, 1)->text()) );
}
if ( _parentHyp ) { _parentHyp->setGroups(ListeGroup);};
if ( _parentBound ) { _parentBound->setGroups(ListeGroup);};
return true;
}
// ------------------------------------------------------------------------
void MonCreateListGroup::PushOnOK()
// ------------------------------------------------------------------------
{
if (PushOnApply())
{
this->close();
if ( _parentHyp ) { _parentHyp->raise(); _parentHyp->activateWindow(); };
if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); };
}
}
// ------------------------------------------------------------------------
void MonCreateListGroup::PushOnHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str()));
}
// ------------------------------------------------------------------------
void MonCreateListGroup::InitGroupes()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de MonCreateListGroup::InitGroupes ");
for ( int row=0; row< TWGroupe->rowCount(); row++)
TWGroupe->removeRow(row);
TWGroupe->setRowCount(0);
if (_aCaseName == QString("")) { return; };
HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str());
HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
for ( int i = 0; i < _listeGroupesCas->length(); i++ )
{
TWGroupe->insertRow(i);
TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) );
TWGroupe->item( i, 0 )->setFlags( 0 );
TWGroupe->item( i, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
if (_listeGroupesHypo.contains (QString((_listeGroupesCas)[i])))
{TWGroupe->item( i, 0 )->setCheckState( Qt::Checked );}
else
{TWGroupe->item( i, 0 )->setCheckState( Qt::Unchecked );}
TWGroupe->setItem( i, 1, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed()));
TWGroupe->item( i, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
}
TWGroupe->resizeColumnsToContents();
TWGroupe->resizeRowsToContents();
TWGroupe->clearSelection();
// MESSAGE("Fin de MonCreateListGroup::InitGroupes ");
}

View File

@ -0,0 +1,64 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATELISTGROUP_H
#define MON_CREATELISTGROUP_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include "ui_CreateListGroup.h"
#include <QDialog>
class MonCreateHypothesis;
class MonCreateBoundaryDi;
class HOMARD_EXPORT MonCreateListGroup : public QDialog, public Ui_CreateListGroup
{
Q_OBJECT
public:
MonCreateListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo);
MonCreateListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo);
virtual ~MonCreateListGroup();
protected :
HOMARD::HOMARD_Gen_var myHomardGen;
MonCreateHypothesis * _parentHyp;
MonCreateBoundaryDi * _parentBound;
QString _aCaseName;
QStringList _listeGroupesHypo;
virtual void InitConnect();
virtual void InitGroupes();
public slots:
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_CREATELISTGROUP_H

View File

@ -0,0 +1,150 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateListGroupCAO.h"
#include "MonCreateHypothesis.h"
#include "MonCreateBoundaryCAO.h"
#include <QFileDialog>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
using namespace std;
// --------------------------------------------------------------------------------------------------------------
MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) :
// --------------------------------------------------------------------------------------------------------------
//
QDialog(0), Ui_CreateListGroup(),
_aCaseName (aCaseName),
_listeGroupesHypo (listeGroupesHypo),
_parentHyp(parentHyp),
_parentBound(parentBound)
{
MESSAGE("Debut de MonCreateListGroupCAO")
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
setModal(modal);
InitConnect();
InitGroupes();
}
// --------------------------------------------------------------------------------------------------------------
MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound,
HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) :
// --------------------------------------------------------------------------------------------------------------
//
QDialog(0), Ui_CreateListGroup(),
_aCaseName (aCaseName),
_listeGroupesHypo (listeGroupesHypo),
_parentHyp(parentHyp),
_parentBound(parentBound)
{
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen);
setupUi(this);
InitConnect();
}
// ------------------------------------------------------------------------
MonCreateListGroupCAO::~MonCreateListGroupCAO()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateListGroupCAO::InitConnect()
// ------------------------------------------------------------------------
{
connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) );
connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) );
connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) );
connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) );
}
// ------------------------------------------------------------------------
bool MonCreateListGroupCAO::PushOnApply()
// ------------------------------------------------------------------------
// Appele lorsque l'un des boutons Ok ou Apply est presse
//
{
QStringList ListeGroup ;
for ( int row=0; row< TWGroupe->rowCount(); row++)
{
if ( TWGroupe->item( row, 0 )->checkState() == Qt::Checked )
ListeGroup.insert(0, QString(TWGroupe->item(row, 1)->text()) );
}
if ( _parentHyp ) { _parentHyp->setGroups(ListeGroup);};
if ( _parentBound ) { _parentBound->setGroups(ListeGroup);};
return true;
}
// ------------------------------------------------------------------------
void MonCreateListGroupCAO::PushOnOK()
// ------------------------------------------------------------------------
{
if (PushOnApply()) this->close();
if ( _parentHyp ) { _parentHyp->raise(); _parentHyp->activateWindow(); };
if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); };
}
// ------------------------------------------------------------------------
void MonCreateListGroupCAO::PushOnHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str()));
}
// ------------------------------------------------------------------------
void MonCreateListGroupCAO::InitGroupes()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de MonCreateListGroupCAO::InitGroupes ");
for ( int row=0; row< TWGroupe->rowCount(); row++)
TWGroupe->removeRow(row);
TWGroupe->setRowCount(0);
if (_aCaseName == QString("")) { return; };
HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str());
HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
for ( int i = 0; i < _listeGroupesCas->length(); i++ )
{
TWGroupe->insertRow(i);
TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) );
TWGroupe->item( i, 0 )->setFlags( 0 );
TWGroupe->item( i, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
if (_listeGroupesHypo.contains (QString((_listeGroupesCas)[i])))
{TWGroupe->item( i, 0 )->setCheckState( Qt::Checked );}
else
{TWGroupe->item( i, 0 )->setCheckState( Qt::Unchecked );}
TWGroupe->setItem( i, 1, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed()));
TWGroupe->item( i, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
}
TWGroupe->resizeColumnsToContents();
TWGroupe->resizeRowsToContents();
TWGroupe->clearSelection();
// MESSAGE("Fin de MonCreateListGroupCAO::InitGroupes ");
}

View File

@ -0,0 +1,64 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATELISTGROUPCAO_H
#define MON_CREATELISTGROUPCAO_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include "ui_CreateListGroup.h"
#include <QDialog>
class MonCreateHypothesis;
class MonCreateBoundaryCAO;
class HOMARD_EXPORT MonCreateListGroupCAO : public QDialog, public Ui_CreateListGroup
{
Q_OBJECT
public:
MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo);
MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo);
virtual ~MonCreateListGroupCAO();
protected :
HOMARD::HOMARD_Gen_var myHomardGen;
MonCreateHypothesis * _parentHyp;
MonCreateBoundaryCAO * _parentBound;
QString _aCaseName;
QStringList _listeGroupesHypo;
virtual void InitConnect();
virtual void InitGroupes();
public slots:
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_CREATELISTGROUPCAO_H

View File

@ -0,0 +1,342 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateYACS.h"
#include "HOMARD.hxx"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
#ifdef WIN32
#include <direct.h>
#endif
using namespace std;
// ----------------------------------------------------------------------
MonCreateYACS::MonCreateYACS (bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, QString CaseName ):
// ----------------------------------------------------------------------
/* Constructs a MonCreateYACS
* Sets attributes to default values
*/
// ----------------------------------------------------------------------
Ui_CreateYACS(),
_aCaseName(CaseName),
_aScriptFile(""),
_aDirName(""),
_aMeshFile(""),
_Type(1)
// Les valeurs de _Type, _MaxIter, _MaxNode, _MaxElem doivent etre les memes que celles dans HOMARD_Gen_i::CreateYACSSchema
// et doivent correspondre aux defauts des boutons
{
// MESSAGE("Debut du constructeur de MonCreateYACS");
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
if ( modal ) { setWindowModality(Qt::WindowModal); }
else { setWindowModality(Qt::NonModal); }
InitConnect();
SetNewName() ;
if (_aCaseName != QString("")) { SetCaseName(); }
else { setWindowModality(Qt::NonModal); /* permet selection du cas dans l arbre d etude */}
//
// Les valeurs definies dans les preferences
_MaxIter = myHomardGen->GetYACSMaxIter();
_MaxNode = myHomardGen->GetYACSMaxNode();
_MaxElem = myHomardGen->GetYACSMaxElem();
MESSAGE ("Valeur par defaut de MaxIter = " << _MaxIter<<", MaxNode = "<< _MaxNode<<", MaxElem = "<< _MaxElem);
SpinBoxMaxIter->setValue(_MaxIter) ;
SpinBoxMaxNode->setValue(_MaxNode) ;
SpinBoxMaxElem->setValue(_MaxElem) ;
//
adjustSize();
}
// ----------------------------------------------------------------------
MonCreateYACS::MonCreateYACS(HOMARD::HOMARD_Gen_var myHomardGen0,
QString caseName):
// ----------------------------------------------------------------------
// Constructeur appele par MonEditYACS
//
myHomardGen(myHomardGen0),
_Name (""),
Chgt (false)
{
// MESSAGE("Debut du constructeur de MonCreateYACS appele par MonEditYACS");
setupUi(this) ;
setWindowModality(Qt::WindowModal);
InitConnect() ;
//
adjustSize();
}
// ------------------------------------------------------------------------
MonCreateYACS::~MonCreateYACS()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateYACS::InitConnect()
// ------------------------------------------------------------------------
{
connect( PBCaseName, SIGNAL(pressed()), this, SLOT(SetCaseName()));
connect( PBScriptFile, SIGNAL(pressed()), this, SLOT(SetScriptFile()));
connect( PBDir, SIGNAL(pressed()), this, SLOT(SetDirName()));
connect( PBMeshFile, SIGNAL(pressed()), this, SLOT(SetMeshFile()));
connect( RBConstant, SIGNAL(clicked()), this, SLOT(SetConstant()));
connect( RBVariable, SIGNAL(clicked()), this, SLOT(SetVariable()));
connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply()));
connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp()));
}
// -------------------------------
bool MonCreateYACS::PushOnApply()
// --------------------------------
{
MESSAGE("PushOnApply");
// Le fichier du script
QString aFileName=LEScriptFile->text().trimmed();
if (aFileName ==QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_SCRIPT_FILE") );
return false;
}
// Le repertoire de calcul
QString aDirName=LEDirName->text().trimmed();
if (aDirName == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_4") );
return false;
}
if ( aDirName != _aDirName)
{ QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ;
if ( CaseNameDir != "" )
{
QString texte ;
texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ;
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
texte );
return false;
}
}
if (CHDIR(aDirName.toStdString().c_str()) != 0)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_3") );
return false;
}
// Le fichier du tout premier maillage
aFileName=LEMeshFile->text().trimmed();
if (aFileName ==QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_MESH") );
return false;
}
QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName);
if (aMeshName == "" )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_2") );
return false;
}
bool bOK = CreateOrUpdate() ;
if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; }
return bOK;
}
// ---------------------------------------------------
bool MonCreateYACS:: CreateOrUpdate()
//----------------------------------------------------
// Creation ou modification du schema
{
MESSAGE("CreateOrUpdate");
bool bOK = true ;
// 1. Verification des donnees
// 1.1. Le cas
if ( _aCaseName == QString (""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_NAME") );
return false;
}
// 1.2. Les donnees
QString aScriptFile=LEScriptFile->text().trimmed();
if ( aScriptFile != _aScriptFile )
{
_aScriptFile = aScriptFile ;
Chgt = true ;
}
QString aDirName=LEDirName->text().trimmed();
if ( aDirName != _aDirName )
{
_aDirName = aDirName ;
Chgt = true ;
}
QString aMeshFile=LEMeshFile->text().trimmed();
if ( aMeshFile != _aMeshFile )
{
_aMeshFile = aMeshFile ;
Chgt = true ;
}
// 2. Creation de l'objet CORBA
try
{
_Name=LEName->text().trimmed();
aYACS=myHomardGen->CreateYACSSchema(CORBA::string_dup(_Name.toStdString().c_str()), CORBA::string_dup(_aCaseName.toStdString().c_str()), CORBA::string_dup(_aScriptFile.toStdString().c_str()), CORBA::string_dup(_aDirName.toStdString().c_str()), CORBA::string_dup(_aMeshFile.toStdString().c_str()));
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
bOK = false;
}
// 3. Options
if ( bOK )
{
// 3.1. Le type du schema
aYACS->SetType(_Type) ;
// 3.2. Les maximums
_MaxIter = SpinBoxMaxIter->value() ;
aYACS->SetMaxIter(_MaxIter) ;
_MaxNode = SpinBoxMaxNode->value() ;
aYACS->SetMaxNode(_MaxNode) ;
_MaxElem = SpinBoxMaxElem->value() ;
aYACS->SetMaxElem(_MaxElem) ;
}
// 4. Ecriture du fichier
if ( bOK )
{
int codret = aYACS->Write() ;
if ( codret != 0 ) { bOK = false ; }
}
return bOK;
}
// ---------------------------
void MonCreateYACS::PushOnOK()
// ---------------------------
{
bool bOK = PushOnApply();
if ( bOK ) this->close();
}
//------------------------------
void MonCreateYACS::PushOnHelp()
//-------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("yacs.html"), QString(""), QString(LanguageShort.c_str()));
}
// -------------------------------------------------
void MonCreateYACS::SetNewName()
// --------------------------------------------------
{
HOMARD::listeYACSs_var MyObjects = myHomardGen->GetAllYACSsName();
int num = 0; QString aName="";
while (aName == QString("") )
{
aName.setNum(num+1) ;
aName.insert(0, QString("YACS_")) ;
for ( int i=0; i<MyObjects->length(); i++)
{
if ( aName == QString(MyObjects[i]))
{
num ++ ;
aName = "" ;
break ;
}
}
}
LEName->setText(aName);
}
// ------------------------------------------------------------------------
void MonCreateYACS::SetCaseName()
// ------------------------------------------------------------------------
{
MESSAGE ("SetCaseName avec _aCaseName = " << _aCaseName.toStdString() );
if (_aCaseName == QString(""))
{
_aCaseName=HOMARD_QT_COMMUN::SelectionArbreEtude(QString("CasHomard"), 1);
if (_aCaseName == QString("")) { raise();return;};
}
LECaseName->setText(_aCaseName);
}
// ------------------------------------------------------------------------
void MonCreateYACS::SetDirName()
// ------------------------------------------------------------------------
{
QString aDirName=QFileDialog::getExistingDirectory ();
if (!(aDirName.isEmpty()))LEDirName->setText(aDirName);
}
// ------------------------------------------------------------------------
void MonCreateYACS::SetScriptFile()
// ------------------------------------------------------------------------
{
QString fileName0 = LEScriptFile->text().trimmed();
QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("py") ) ;
if (fileName.isEmpty()) fileName = fileName0 ;
LEScriptFile->setText(fileName);
}
// ------------------------------------------------------------------------
void MonCreateYACS::SetMeshFile()
// ------------------------------------------------------------------------
{
QString fileName0 = LEMeshFile->text().trimmed();
QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ;
if (fileName.isEmpty()) fileName = fileName0 ;
LEMeshFile->setText(fileName);
}
// ------------------------------------------------------------------------
void MonCreateYACS::SetConstant()
// ------------------------------------------------------------------------
{
_Type = 1 ;
}
// ------------------------------------------------------------------------
void MonCreateYACS::SetVariable()
// ------------------------------------------------------------------------
{
_Type = 2 ;
}

View File

@ -0,0 +1,84 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATEYACS_H
#define MON_CREATEYACS_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include "ui_CreateYACS.h"
#include <QScrollArea>
class HOMARD_EXPORT MonCreateYACS : public QScrollArea, public Ui_CreateYACS
{
Q_OBJECT
public:
MonCreateYACS( bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString CaseName);
virtual ~MonCreateYACS();
protected :
MonCreateYACS( HOMARD::HOMARD_Gen_var myHomardGen, QString CaseName);
QString _Name;
QString _aCaseName;
QString _aScriptFile;
QString _aDirName;
QString _aMeshFile;
int _Type;
int _MaxIter;
int _MaxNode;
int _MaxElem;
bool Chgt;
HOMARD::HOMARD_YACS_var aYACS;
HOMARD::HOMARD_Gen_var myHomardGen;
virtual void InitConnect();
virtual bool CreateOrUpdate();
public slots:
virtual void SetNewName();
virtual void SetCaseName();
virtual void SetDirName();
virtual void SetScriptFile();
virtual void SetMeshFile();
// virtual void SetType(int Type);
virtual void SetConstant();
virtual void SetVariable();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_CREATEYACS_H

View File

@ -0,0 +1,713 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonCreateZone.h"
#include "MonCreateHypothesis.h"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
using namespace std;
// ----------------------------------------------------------------------
MonCreateZone::MonCreateZone(MonCreateHypothesis* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen0,
QString caseName) :
// ----------------------------------------------------------------------
/* Constructs a MonCreateZone
appele pour une vraie creation
initialise une boite et non une sphere
*/
QDialog(0), Ui_CreateZone(),
_parent(parent),
_Name (""),
_aCaseName(caseName),
_Orient(0),
_Type(2),
_Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0),
_ZoneXcentre(0), _ZoneYcentre(0), _ZoneZcentre(0), _ZoneRayon(0),
_Xmin(0), _Xmax(0), _Xincr(0), _Ymin(0), _Ymax(0), _Yincr(0), _Zmin(0), _Zmax(0), _Zincr(0),
_ZoneXmin(0), _ZoneXmax(0), _ZoneYmin(0), _ZoneYmax(0), _ZoneZmin(0), _ZoneZmax(0),
_Xaxis(0), _Yaxis(0), _Zaxis(0), _RayonInt(0), _Haut(0),
_ZoneXaxis(0), _ZoneYaxis(0), _ZoneZaxis(0), _ZoneRayonInt(0), _ZoneHaut(0),
_DMax(0),
Chgt (false)
{
MESSAGE("Constructeur") ;
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0) ;
setupUi(this) ;
setModal(modal) ;
InitConnect( ) ;
SetNewName() ;
InitValZone() ; // Cherche les valeurs de la boite englobante le maillage
InitMinMax() ; // Initialise les bornes des boutons
SetBox() ; // Propose une boite en premier choix
}
// ----------------------------------------------------------------------
MonCreateZone::MonCreateZone(MonCreateHypothesis* parent,
HOMARD::HOMARD_Gen_var myHomardGen0,
QString caseName):
// ----------------------------------------------------------------------
// Constructeur appele par MonEditZone
//
QDialog(0), Ui_CreateZone(),
myHomardGen(myHomardGen0),
_parent(parent),
_Name (""),
_aCaseName(caseName),
_Orient(0),
_Type(2),
_Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0),
_ZoneXcentre(0), _ZoneYcentre(0), _ZoneZcentre(0), _ZoneRayon(0),
_ZoneXmin(0), _ZoneXmax(0), _ZoneYmin(0), _ZoneYmax(0), _ZoneZmin(0), _ZoneZmax(0),
_Xaxis(0), _Yaxis(0), _Zaxis(0), _RayonInt(0), _Haut(0),
_ZoneXaxis(0), _ZoneYaxis(0), _ZoneZaxis(0), _ZoneRayonInt(0), _ZoneHaut(0),
// Pour affichage lors de l edition d une Zone sans nom de Cas
_Xmin(1), _Xmax(1), _Xincr(1), _Ymin(1), _Ymax(1), _Yincr(1), _Zmin(1), _Zmax(1), _Zincr(1),
_DMax(1),
Chgt (false)
{
// MESSAGE("Debut de MonCreateZone")
setupUi(this) ;
setModal(true) ;
InitConnect() ;
}
// ------------------------------------------------------------------------
MonCreateZone::~MonCreateZone()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonCreateZone::InitConnect()
// ------------------------------------------------------------------------
{
connect( RBBox, SIGNAL(clicked()) , this, SLOT(SetBox()) ) ;
connect( RBSphere, SIGNAL(clicked()) , this, SLOT(SetSphere()) ) ;
connect( RBCylinder, SIGNAL(clicked()) , this, SLOT(SetCylinder()) ) ;
connect( RBPipe, SIGNAL(clicked()) , this, SLOT(SetPipe()) ) ;
connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) ) ;
connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) ) ;
connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) ) ;
connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) ) ;
}
// ------------------------------------------------------------------------
void MonCreateZone::InitValZone()
// ------------------------------------------------------------------------
{
//
// 1. Les coordonnees extremes du maillage
//
if (_aCaseName == QString("")) { return; }
HOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase(_aCaseName.toStdString().c_str()) ;
HOMARD::extrema_var MesExtremes = aCas->GetBoundingBox() ;
int num = MesExtremes->length() ;
ASSERT(num == 10) ;
_Xmin=MesExtremes[0]; _Xmax=MesExtremes[1]; _Xincr=MesExtremes[2];
_Ymin=MesExtremes[3]; _Ymax=MesExtremes[4]; _Yincr=MesExtremes[5];
_Zmin=MesExtremes[6]; _Zmax=MesExtremes[7]; _Zincr=MesExtremes[8];
_DMax=MesExtremes[9];
if ( _Xincr < 0 ) { _Orient = 2 ; }
else if ( _Yincr < 0 ) { _Orient = 3 ; }
else if ( _Zincr < 0 ) { _Orient = 1 ; }
MESSAGE ("_Xmin : " << _Xmin << " _Xmax : " << _Xmax << " _Xincr : " << _Xincr ) ;
MESSAGE ("_Ymin : " << _Ymin << " _Ymax : " << _Ymax << " _Yincr : " << _Yincr ) ;
MESSAGE ("_Zmin : " << _Zmin << " _Zmax : " << _Zmax << " _Zincr : " << _Zincr) ;
MESSAGE ("_DMax : " << _DMax) ;
MESSAGE ("_Orient : " << _Orient) ;
// 2. Caracteristiques des zones
// en X
if ( _Xincr < 0 )
{
_ZoneXmin = _Xmin;
_ZoneXmax = _Xmax;
}
else
{
_ZoneXmin = _Xmin - _Xincr;
_ZoneXmax = _Xmax + _Xincr;
}
_Xcentre=(_Xmin + _Xmax)/2.;
// en Y
if ( _Yincr < 0 )
{
_ZoneYmin = _Ymin;
_ZoneYmax = _Ymax;
}
else
{
_ZoneYmin = _Ymin - _Yincr;
_ZoneYmax = _Ymax + _Yincr;
}
_Ycentre=(_Ymin + _Ymax)/2.;
// en Z
if ( _Zincr < 0 )
{
_ZoneZmin = _Zmin;
_ZoneZmax = _Zmax;
}
else
{
_ZoneZmin = _Zmin - _Zincr;
_ZoneZmax = _Zmax + _Zincr;
}
_Zcentre=(_Zmin + _Zmax)/2.;
// Rayons
_Rayon= _DMax/4.;
_RayonInt= _DMax/8.;
// Axe et hauteur pour cylindre et tuyau
_Haut= _DMax/2.;
// 3. Gestion des icones
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr() ;
QPixmap pix = resMgr->loadPixmap( "HOMARD", "boxdxyz.png" ) ;
if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "boxdxyz.png" ) ; }
else { pix = resMgr->loadPixmap( "HOMARD", "boxdxy.png" ) ; }
QIcon IS=QIcon(pix) ;
RBBox->setIcon(IS) ;
if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" ) ; }
else { pix = resMgr->loadPixmap( "HOMARD", "disk.png" ) ;
RBCylinder->setText(QApplication::translate("CreateZone", "Disk", 0));
TLXbase->setText(QApplication::translate("CreateZone", "X centre", 0));
TLYbase->setText(QApplication::translate("CreateZone", "Y centre", 0));
TLZbase->setText(QApplication::translate("CreateZone", "Z centre", 0)); }
IS=QIcon(pix) ;
RBCylinder->setIcon(IS) ;
if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "pipe.png" ) ; }
else { pix = resMgr->loadPixmap( "HOMARD", "diskwithhole.png" ) ;
RBPipe->setText(QApplication::translate("CreateZone", "Disk with hole", 0));
TLXbase_p->setText(QApplication::translate("CreateZone", "X centre", 0));
TLYbase_p->setText(QApplication::translate("CreateZone", "Y centre", 0));
TLZbase_p->setText(QApplication::translate("CreateZone", "Z centre", 0)); }
IS=QIcon(pix) ;
RBPipe->setIcon(IS) ;
if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" ) ;
IS=QIcon(pix) ;
RBSphere->setIcon(IS) ; }
else { RBSphere->setVisible(0) ; }
}
// ------------------------------------------------------------------------
void MonCreateZone::InitMinMax()
// ------------------------------------------------------------------------
{
// en X
if ( _Xincr > 0) {
SpinBox_Xmini->setRange(_ZoneXmin,_ZoneXmax) ;
SpinBox_Xmaxi->setRange(_ZoneXmin,_ZoneXmax) ;
SpinBox_Xmini->setSingleStep(_Xincr) ;
SpinBox_Xmaxi->setSingleStep(_Xincr) ;
SpinBox_Xcentre->setSingleStep(_Xincr) ;
}
else {
SpinBox_Xmini->setValue(_ZoneXmin) ;
SpinBox_Xmaxi->setValue(_ZoneXmax) ;
SpinBox_Xcentre->setValue(_Xcentre) ;
SpinBox_Xbase->setValue(_Xcentre) ;
SpinBox_Xbase_p->setValue(_Xcentre) ;
SpinBox_Xmini->setEnabled(false) ;
SpinBox_Xmaxi->setEnabled(false) ;
SpinBox_Xcentre->setEnabled(false) ;
SpinBox_Xbase->setEnabled(false) ;
SpinBox_Xbase_p->setEnabled(false) ;
}
// en Y
if ( _Yincr > 0) {
SpinBox_Ymini->setRange(_ZoneYmin,_ZoneYmax) ;
SpinBox_Ymaxi->setRange(_ZoneYmin,_ZoneYmax) ;
SpinBox_Ymini->setSingleStep(_Yincr) ;
SpinBox_Ymaxi->setSingleStep(_Yincr) ;
SpinBox_Ycentre->setSingleStep(_Yincr) ;
}
else {
SpinBox_Ymini->setValue(_ZoneYmin) ;
SpinBox_Ymaxi->setValue(_ZoneYmax) ;
SpinBox_Ycentre->setValue(_Ycentre) ;
SpinBox_Ybase->setValue(_Ycentre) ;
SpinBox_Ybase_p->setValue(_Ycentre) ;
SpinBox_Ymini->setEnabled(false) ;
SpinBox_Ymaxi->setEnabled(false) ;
SpinBox_Ycentre->setEnabled(false) ;
SpinBox_Ybase->setEnabled(false) ;
SpinBox_Ybase_p->setEnabled(false) ;
}
// en Z
if ( _Zincr > 0) {
SpinBox_Zmini->setRange(_ZoneZmin,_ZoneZmax) ;
SpinBox_Zmaxi->setRange(_ZoneZmin,_ZoneZmax) ;
SpinBox_Zmini->setSingleStep(_Zincr) ;
SpinBox_Zmaxi->setSingleStep(_Zincr) ;
SpinBox_Zcentre->setSingleStep(_Zincr) ;
}
else {
SpinBox_Zmini->setValue(_ZoneZmin) ;
SpinBox_Zmaxi->setValue(_ZoneZmax) ;
SpinBox_Zcentre->setValue(_Zcentre) ;
SpinBox_Zbase->setValue(_Zcentre) ;
SpinBox_Zbase_p->setValue(_Zcentre) ;
SpinBox_Zmini->setEnabled(false) ;
SpinBox_Zmaxi->setEnabled(false) ;
SpinBox_Zcentre->setEnabled(false) ;
SpinBox_Zbase->setEnabled(false) ;
SpinBox_Zbase_p->setEnabled(false) ;
}
// Rayons
SpinBox_Rayon->setSingleStep(_Rayon/10.) ;
SpinBox_Radius->setSingleStep(_Rayon/10.) ;
SpinBox_Radius_int->setSingleStep(_Rayon/20.) ;
SpinBox_Radius_ext->setSingleStep(_Rayon/10.) ;
// Axe et hauteur
// Si une coordonnee est constante, inutile de demander l'axe et la hauteur
if ( _Orient > 0) {
SpinBox_Xaxis->setVisible(0) ;
SpinBox_Yaxis->setVisible(0) ;
SpinBox_Zaxis->setVisible(0) ;
SpinBox_Haut->setVisible(0) ;
TLXaxis->setVisible(0) ;
TLYaxis->setVisible(0) ;
TLZaxis->setVisible(0) ;
TLHaut->setVisible(0) ;
SpinBox_Xaxis_p->setVisible(0) ;
SpinBox_Yaxis_p->setVisible(0) ;
SpinBox_Zaxis_p->setVisible(0) ;
SpinBox_Haut_p->setVisible(0) ;
TLXaxis_p->setVisible(0) ;
TLYaxis_p->setVisible(0) ;
TLZaxis_p->setVisible(0) ;
TLHaut_p->setVisible(0) ;
}
else {
SpinBox_Haut->setSingleStep(_Rayon/10.) ;
SpinBox_Haut_p->setSingleStep(_Rayon/10.) ;
}
}
// ------------------------------------------------------------------------
bool MonCreateZone::PushOnApply()
// ------------------------------------------------------------------------
// Appele lorsque l'un des boutons Ok ou Apply est presse
//
{
if (LEName->text().trimmed()=="")
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ZONE_NAME") ) ;
return false;
}
switch (_Type)
{
case 11 : // il s agit d un rectangle
{ }
case 12 : // il s agit d un rectangle
{ }
case 13 : // il s agit d un rectangle
{ }
case 2 : // il s agit d un parallelipipede rectangle
{
if ( (_ZoneXmin != SpinBox_Xmini->value()) ||
(_ZoneXmax != SpinBox_Xmaxi->value()) ||
(_ZoneYmin != SpinBox_Ymini->value()) ||
(_ZoneYmax != SpinBox_Ymaxi->value()) ||
(_ZoneZmin != SpinBox_Zmini->value()) ||
(_ZoneZmax != SpinBox_Zmaxi->value()) )
{
Chgt = true;
_ZoneXmin= SpinBox_Xmini->value() ; _ZoneXmax= SpinBox_Xmaxi->value() ;
_ZoneYmin= SpinBox_Ymini->value() ; _ZoneYmax= SpinBox_Ymaxi->value() ;
_ZoneZmin= SpinBox_Zmini->value() ; _ZoneZmax= SpinBox_Zmaxi->value() ;
}
break ;
}
case 4 : // il s agit d une sphere
{
if ( (_ZoneXcentre != SpinBox_Xcentre->value()) ||
(_ZoneYcentre != SpinBox_Ycentre->value()) ||
(_ZoneZcentre != SpinBox_Zbase->value()) ||
(_ZoneRayon != SpinBox_Rayon->value()) )
{
Chgt = true;
_ZoneXcentre=SpinBox_Xcentre->value() ;
_ZoneYcentre=SpinBox_Ycentre->value() ;
_ZoneZcentre=SpinBox_Zcentre->value() ;
_ZoneRayon=SpinBox_Rayon->value() ;
}
break ;
}
case 31 : // il s agit d un disque issu d'un cylindre
{ }
case 32 : // il s agit d un disque issu d'un cylindre
{ }
case 33 : // il s agit d un disque issu d'un cylindre
{ }
case 5 : // il s agit d un cylindre
{
if ( (_ZoneXcentre != SpinBox_Xbase->value()) ||
(_ZoneYcentre != SpinBox_Ybase->value()) ||
(_ZoneZcentre != SpinBox_Zbase->value()) ||
(_ZoneRayon != SpinBox_Radius->value()) ||
(_ZoneHaut != SpinBox_Haut->value()) ||
(_ZoneXaxis != SpinBox_Xaxis->value()) ||
(_ZoneYaxis != SpinBox_Yaxis->value()) ||
(_ZoneZaxis != SpinBox_Zaxis->value()) )
{
Chgt = true;
_ZoneXcentre=SpinBox_Xbase->value() ;
_ZoneYcentre=SpinBox_Ybase->value() ;
_ZoneZcentre=SpinBox_Zbase->value() ;
_ZoneXaxis=SpinBox_Xaxis->value() ;
_ZoneYaxis=SpinBox_Yaxis->value() ;
_ZoneZaxis=SpinBox_Zaxis->value() ;
_ZoneRayon=SpinBox_Radius->value() ;
_ZoneHaut=SpinBox_Haut->value() ;
}
break ;
}
case 61 : // il s agit d un disque avec trou
{ }
case 62 : // il s agit d un disque avec trou
{ }
case 63 : // il s agit d un disque avec trou
{ }
case 7 : // il s agit d un tuyau
{
if ( (_ZoneXcentre != SpinBox_Xbase_p->value()) ||
(_ZoneYcentre != SpinBox_Ybase_p->value()) ||
(_ZoneZcentre != SpinBox_Zbase_p->value()) ||
(_ZoneRayonInt != SpinBox_Radius_int->value()) ||
(_ZoneRayon != SpinBox_Radius_ext->value()) ||
(_ZoneHaut != SpinBox_Haut_p->value()) ||
(_ZoneXaxis != SpinBox_Xaxis_p->value()) ||
(_ZoneYaxis != SpinBox_Yaxis_p->value()) ||
(_ZoneZaxis != SpinBox_Zaxis_p->value()) )
{
Chgt = true;
_ZoneXcentre=SpinBox_Xbase_p->value() ;
_ZoneYcentre=SpinBox_Ybase_p->value() ;
_ZoneZcentre=SpinBox_Zbase_p->value() ;
_ZoneXaxis=SpinBox_Xaxis_p->value() ;
_ZoneYaxis=SpinBox_Yaxis_p->value() ;
_ZoneZaxis=SpinBox_Zaxis_p->value() ;
_ZoneRayonInt=SpinBox_Radius_int->value() ;
_ZoneRayon=SpinBox_Radius_ext->value() ;
_ZoneHaut=SpinBox_Haut_p->value() ;
}
break ;
}
}
// Controles
// Pour un rectangle ou un parallelepipede :
if ( ( _Type >= 11 && _Type <= 13 ) || _Type == 2 )
{
if ((_ZoneXmin >= _ZoneXmax) && (_Xincr > 0)) {
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ZONE_LIMIT").arg("X") ) ;
return false; }
if ((_ZoneYmin >= _ZoneYmax) && (_Yincr > 0)) {
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ZONE_LIMIT").arg("Y") ) ;
return false; }
if ((_ZoneZmin >= _ZoneZmax) && (_Zincr > 0)) {
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ZONE_LIMIT").arg("Z") ) ;
return false; }
}
// L'axe pour un cylindre ou un tuyau :
if ( _Type == 5 || _Type == 7 )
{
double daux = _ZoneXaxis*_ZoneXaxis + _ZoneYaxis*_ZoneYaxis + _ZoneZaxis*_ZoneZaxis ;
if ( daux < 0.0000001 )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_AXE") );
return false;
}
}
// Rayons pour disque avec trou ou un tuyau :
if ( ( _Type >= 61 && _Type <= 63 ) || _Type == 7 )
{
if ( _ZoneRayonInt >= _ZoneRayon )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_ZONE_RAYON") );
return false;
}
}
//
// Création ou mise à jour de la zone
//
bool bOK = CreateOrUpdateZone() ;
if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; }
return bOK;
}
// ---------------------------------------------------
bool MonCreateZone::CreateOrUpdateZone()
//----------------------------------------------------
// Creation de la zone
{
MESSAGE("Debut de CreateOrUpdateZone avec _Type ="<<_Type<<", _Name ="<<_Name.toStdString().c_str()<<" et LEName ="<<LEName->text().trimmed().toStdString().c_str());
//
if (_Name != LEName->text().trimmed())
{
_Name = LEName->text().trimmed() ;
try
{
switch (_Type)
{
case 11 : // il s agit d un rectangle, dans le plan (X,Y)
{ aZone = myHomardGen->CreateZoneBox2D(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _Orient );
break;
}
case 12 : // il s agit d un rectangle, dans le plan (Y,Z)
{ aZone = myHomardGen->CreateZoneBox2D(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax, _Orient );
break;
}
case 13 : // il s agit d un rectangle, dans le plan (Z,X)
{ aZone = myHomardGen->CreateZoneBox2D(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneZmin, _ZoneZmax, _ZoneXmin, _ZoneXmax, _Orient );
break;
}
case 2 : // il s agit d un parallelepipede
{ aZone = myHomardGen->CreateZoneBox(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax );
break;
}
case 4 : // il s agit d une sphere
{ aZone = myHomardGen->CreateZoneSphere(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneRayon );
break;
}
case 31 : // il s agit d un disque issu d'un cylindre, dans le plan (X,Y)
{ aZone = myHomardGen->CreateZoneDisk(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneXcentre, _ZoneYcentre, _ZoneRayon, _Orient );
break;
}
case 32 : // il s agit d un disque issu d'un cylindre, dans le plan (Y,Z)
{ aZone = myHomardGen->CreateZoneDisk(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneYcentre, _ZoneZcentre, _ZoneRayon, _Orient );
break;
}
case 33 : // il s agit d un disque issu d'un cylindre, dans le plan (Z,X)
{ aZone = myHomardGen->CreateZoneDisk(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneZcentre, _ZoneXcentre, _ZoneRayon, _Orient );
break;
}
case 5 : // il s agit d un cylindre
{ aZone = myHomardGen->CreateZoneCylinder(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut );
break;
}
case 61 : // il s agit d un disque avec trou, dans le plan (X,Y)
{ aZone = myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneXcentre, _ZoneYcentre, _ZoneRayon, _ZoneRayonInt, _Orient );
break;
}
case 62 : // il s agit d un disque avec trou, dans le plan (Y,Z)
{ aZone = myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneYcentre, _ZoneZcentre, _ZoneRayon, _ZoneRayonInt, _Orient );
break;
}
case 63 : // il s agit d un disque avec trou, dans le plan (Z,X)
{ aZone = myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneZcentre, _ZoneXcentre, _ZoneRayon, _ZoneRayonInt, _Orient );
break;
}
case 7 : // il s agit d un tuyau
{ aZone = myHomardGen->CreateZonePipe(CORBA::string_dup(_Name.toStdString().c_str()), \
_ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut, _ZoneRayonInt );
break;
}
}
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false ;
}
_parent->addZoneinTWZone(_Name) ;
// Mise en place des attributs
aZone->SetLimit(_Xincr, _Yincr, _Zincr) ;
return true;
}
else {
QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
QObject::tr("HOM_SELECT_OBJECT_4") );
return false ;
}
MESSAGE("Fin de CreateOrUpdateZone");
}
// ------------------------------------------------------------------------
void MonCreateZone::PushOnOK()
// ------------------------------------------------------------------------
{
if (PushOnApply()) this->close() ;
}
// ------------------------------------------------------------------------
void MonCreateZone::PushOnHelp()
// ------------------------------------------------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_zone.html"), QString(""), QString(LanguageShort.c_str()));
}
// -----------------------------------
void MonCreateZone::SetNewName()
// -----------------------------------
{
MESSAGE("SetNewName");
// Recherche d'un nom par defaut qui n'existe pas encore
HOMARD::listeZones_var MyObjects = myHomardGen->GetAllZonesName() ;
int num = 0; QString aName="";
while (aName=="" )
{
aName.setNum(num+1) ;
aName.insert(0, QString("Zone_")) ;
for ( int i=0; i<MyObjects->length() ; i++)
{
if ( aName == QString(MyObjects[i]))
{
num ++ ;
aName = "" ;
break ;
}
}
}
LEName->setText(aName);
MESSAGE("SetNewName aName ="<<aName.toStdString().c_str());
}
// ------------------------------------------------------------------------
void MonCreateZone::SetBox()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetBox")
gBBox->setVisible(1) ;
gBSphere->setVisible(0) ;
gBCylindre->setVisible(0) ;
gBPipe->setVisible(0) ;
adjustSize() ;
_Type=2;
// Sachant que l'increment est le 1/100eme de l'ecart (min/max), cela revient
// a initialiser la boite sur une boite 'centrale' comprise entre 2/5 et 3/5
if ( _Xincr > 0 ) { SpinBox_Xmini->setValue(_Xcentre-10*_Xincr) ;
SpinBox_Xmaxi->setValue(_Xcentre+10*_Xincr) ; }
else { _Type=12 ; }
if ( _Yincr > 0 ) { SpinBox_Ymini->setValue(_Ycentre-10*_Yincr) ;
SpinBox_Ymaxi->setValue(_Ycentre+10*_Yincr) ; }
else { _Type=13 ; }
if ( _Zincr > 0 ) { SpinBox_Zmini->setValue(_Zcentre-10*_Zincr) ;
SpinBox_Zmaxi->setValue(_Zcentre+10*_Zincr) ; }
else { _Type=11 ; }
MESSAGE("Fin de SetBox")
}
// ------------------------------------------------------------------------
void MonCreateZone::SetSphere()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetSphere")
gBBox->setVisible(0) ;
gBSphere->setVisible(1) ;
gBCylindre->setVisible(0) ;
gBPipe->setVisible(0) ;
adjustSize() ;
_Type=4;
SpinBox_Xcentre->setValue(_Xcentre) ;
SpinBox_Ycentre->setValue(_Ycentre) ;
SpinBox_Zcentre->setValue(_Zcentre) ;
SpinBox_Rayon->setValue(_Rayon) ;
MESSAGE("Fin de SetSphere")
}
// ------------------------------------------------------------------------
void MonCreateZone::SetCylinder()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetCylinder")
gBBox->setVisible(0) ;
gBSphere->setVisible(0) ;
gBCylindre->setVisible(1) ;
gBPipe->setVisible(0) ;
adjustSize() ;
_Type=5;
if ( _Xincr > 0 ) { SpinBox_Xbase->setValue(_Xcentre) ;
SpinBox_Xaxis->setValue(0.) ; }
else { _Type=32 ; }
if ( _Yincr > 0 ) { SpinBox_Ybase->setValue(_Ycentre) ;
SpinBox_Yaxis->setValue(0.) ; }
else { _Type=33 ; }
if ( _Zincr > 0 ) { SpinBox_Zbase->setValue(_Zcentre) ;
SpinBox_Zaxis->setValue(1.) ; }
else { _Type=31 ; }
SpinBox_Radius->setValue(_Rayon) ;
SpinBox_Haut->setValue(_Haut) ;
MESSAGE("Fin de SetCylinder")
}
// ------------------------------------------------------------------------
void MonCreateZone::SetPipe()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetPipe")
gBBox->setVisible(0) ;
gBSphere->setVisible(0) ;
gBCylindre->setVisible(0) ;
gBPipe->setVisible(1) ;
adjustSize() ;
_Type=7;
if ( _Xincr > 0 ) { SpinBox_Xbase_p->setValue(_Xcentre) ;
SpinBox_Xaxis_p->setValue(0.) ; }
else { _Type=62 ; }
if ( _Yincr > 0 ) { SpinBox_Ybase_p->setValue(_Ycentre) ;
SpinBox_Yaxis_p->setValue(0.) ; }
else { _Type=63 ; }
if ( _Zincr > 0 ) { SpinBox_Zbase_p->setValue(_Zcentre) ;
SpinBox_Zaxis_p->setValue(1.) ; }
else { _Type=61 ; }
SpinBox_Radius_int->setValue(_RayonInt) ;
SpinBox_Radius_ext->setValue(_Rayon) ;
SpinBox_Haut_p->setValue(_Haut) ;
MESSAGE("Fin de SetPipe")
}

View File

@ -0,0 +1,87 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_CREATEZONE_H
#define MON_CREATEZONE_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include "ui_CreateZone.h"
#include <QDialog>
class MonCreateHypothesis;
class HOMARD_EXPORT MonCreateZone : public QDialog, public Ui_CreateZone
{
Q_OBJECT
public:
MonCreateZone( MonCreateHypothesis* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName);
virtual ~MonCreateZone();
protected :
MonCreateZone( MonCreateHypothesis* parent,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName);
MonCreateHypothesis * _parent;
QString _Name;
QString _aCaseName;
int _Orient;
int _Type;
double _Xcentre, _Ycentre, _Zcentre, _Rayon ;
double _Xmin, _Xmax, _Xincr, _Ymin, _Ymax, _Yincr, _Zmin, _Zmax, _Zincr ;
double _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneRayon ;
double _ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax ;
double _Xaxis, _Yaxis, _Zaxis, _RayonInt, _Haut ;
double _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayonInt, _ZoneHaut ;
double _DMax ;
bool Chgt;
HOMARD::HOMARD_Zone_var aZone ;
HOMARD::HOMARD_Gen_var myHomardGen;
virtual void InitConnect();
virtual void InitValZone();
virtual void InitMinMax();
virtual void SetNewName();
virtual bool CreateOrUpdateZone();
public slots:
virtual void SetBox();
virtual void SetSphere();
virtual void SetCylinder();
virtual void SetPipe();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_CREATEZONE_H

View File

@ -0,0 +1,399 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditBoundaryAn.h"
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include <utilities.h>
using namespace std;
// ------------------------------------------------------------------------
MonEditBoundaryAn::MonEditBoundaryAn( MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString Name ):
// ------------------------------------------------------------------------
/* Constructs a MonEditBoundaryAn
herite de MonCreateBoundaryAn
*/
MonCreateBoundaryAn(parent, myHomardGen, caseName)
{
MESSAGE("Debut de MonEditBoundaryAn pour " << Name.toStdString().c_str());
setWindowTitle(QObject::tr("HOM_BOUN_A_EDIT_WINDOW_TITLE"));
_Name=Name;
aBoundaryAn = myHomardGen->GetBoundary(_Name.toStdString().c_str());
InitValEdit();
}
// ------------------------------------------------------------------------
MonEditBoundaryAn::~MonEditBoundaryAn()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::InitValEdit()
// ------------------------------------------------------------------------
{
LEName->setText(_Name);
LEName->setReadOnly(true);
_Type = aBoundaryAn->GetType();
MESSAGE("_Type : "<<_Type);
InitValBoundaryAnLimit();
if (_aCaseName != QString("")) InitValBoundaryAn();
switch (_Type)
{
case 1 : // il s agit d un cylindre
{
InitValBoundaryAnCylindre();
SetCylinder();
break;
}
case 2: // il s agit d une sphere
{
InitValBoundaryAnSphere();
SetSphere();
break;
}
case 3: // il s agit d un cone defini par un axe et un angle
{
InitValBoundaryAnConeA();
SetConeA();
break;
}
case 4: // il s agit d un cone defini par les 2 rayons
{
InitValBoundaryAnConeR();
SetConeR();
break;
}
case 5: // il s agit d un tore
{
InitValBoundaryAnTore();
SetTore();
break;
}
};
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::InitValBoundaryAnLimit()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordLimits = aBoundaryAn->GetLimit();
ASSERT(mesCoordLimits->length() == 3 );
_Xincr=mesCoordLimits[0];
_Yincr=mesCoordLimits[1];
_Zincr=mesCoordLimits[2];
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::InitValBoundaryAnCylindre()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords();
ASSERT(mesCoordBoundary->length() == 7 );
_BoundaryAnXcentre=mesCoordBoundary[0];
_BoundaryAnYcentre=mesCoordBoundary[1];
_BoundaryAnZcentre=mesCoordBoundary[2];
_BoundaryAnXaxis=mesCoordBoundary[3];
_BoundaryAnYaxis=mesCoordBoundary[4];
_BoundaryAnZaxis=mesCoordBoundary[5];
_BoundaryAnRayon=mesCoordBoundary[6];
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::InitValBoundaryAnSphere()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords();
ASSERT(mesCoordBoundary->length() == 4 );
_BoundaryAnXcentre=mesCoordBoundary[0];
_BoundaryAnYcentre=mesCoordBoundary[1];
_BoundaryAnZcentre=mesCoordBoundary[2];
_BoundaryAnRayon=mesCoordBoundary[3];
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::InitValBoundaryAnConeA()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords();
ASSERT(mesCoordBoundary->length() == 7 );
_BoundaryAnXaxisCone=mesCoordBoundary[0];
_BoundaryAnYaxisCone=mesCoordBoundary[1];
_BoundaryAnZaxisCone=mesCoordBoundary[2];
_BoundaryAngle=mesCoordBoundary[3];
_BoundaryAnXorigCone=mesCoordBoundary[4];
_BoundaryAnYorigCone=mesCoordBoundary[5];
_BoundaryAnZorigCone=mesCoordBoundary[6];
convertRayonAngle(-1) ;
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::InitValBoundaryAnConeR()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords();
ASSERT(mesCoordBoundary->length() == 8 );
_BoundaryAnXcone1=mesCoordBoundary[0];
_BoundaryAnYcone1=mesCoordBoundary[1];
_BoundaryAnZcone1=mesCoordBoundary[2];
_BoundaryAnRayon1=mesCoordBoundary[3];
_BoundaryAnXcone2=mesCoordBoundary[4];
_BoundaryAnYcone2=mesCoordBoundary[5];
_BoundaryAnZcone2=mesCoordBoundary[6];
_BoundaryAnRayon2=mesCoordBoundary[7];
convertRayonAngle(1) ;
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::InitValBoundaryAnTore()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords();
ASSERT(mesCoordBoundary->length() == 8 );
_BoundaryAnXcentre=mesCoordBoundary[0];
_BoundaryAnYcentre=mesCoordBoundary[1];
_BoundaryAnZcentre=mesCoordBoundary[2];
_BoundaryAnXaxis=mesCoordBoundary[3];
_BoundaryAnYaxis=mesCoordBoundary[4];
_BoundaryAnZaxis=mesCoordBoundary[5];
_BoundaryAnRayon1=mesCoordBoundary[6];
_BoundaryAnRayon2=mesCoordBoundary[7];
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::SetCylinder()
// ------------------------------------------------------------------------
{
gBCylindre->setVisible(1);
gBSphere->setVisible(0);
gBCone->setVisible(0);
gBTore->setVisible(0);
RBCylindre->setChecked(1);
_Type=1;
RBSphere->setDisabled(true);
RBCone->setDisabled(true);
RBTore->setDisabled(true);
SpinBox_Xcent->setValue(_BoundaryAnXcentre);
SpinBox_Ycent->setValue(_BoundaryAnYcentre);
SpinBox_Zcent->setValue(_BoundaryAnZcentre);
SpinBox_Xaxis->setValue(_BoundaryAnXaxis);
SpinBox_Yaxis->setValue(_BoundaryAnYaxis);
SpinBox_Zaxis->setValue(_BoundaryAnZaxis);
SpinBox_Xaxis->setSingleStep(0.1);
SpinBox_Xcentre->setSingleStep(_Xincr);
SpinBox_Yaxis->setSingleStep(0.1);
SpinBox_Ycentre->setSingleStep(_Yincr);
SpinBox_Zaxis->setSingleStep(0.1);
SpinBox_Zcentre->setSingleStep(_Zincr);
// Rayon
SpinBox_Radius->setValue(_BoundaryAnRayon);
SpinBox_Radius->setSingleStep(_BoundaryAnRayon/10.);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::SetSphere()
// ------------------------------------------------------------------------
{
gBCylindre->setVisible(0);
gBSphere->setVisible(1);
RBSphere->setChecked(1);
gBCone->setVisible(0);
gBTore->setVisible(0);
RBCylindre->setDisabled(true);
RBCone->setDisabled(true);
RBTore->setDisabled(true);
_Type=2 ;
SpinBox_Xcentre->setValue(_BoundaryAnXcentre);
if ( _Xincr > 0) { SpinBox_Xcentre->setSingleStep(_Xincr); }
else { SpinBox_Xcentre->setSingleStep(1) ; }
SpinBox_Ycentre->setValue(_BoundaryAnYcentre);
if ( _Yincr > 0) { SpinBox_Ycentre->setSingleStep(_Yincr); }
else { SpinBox_Ycentre->setSingleStep(1) ; }
SpinBox_Zcentre->setValue(_BoundaryAnZcentre);
if ( _Zincr > 0) { SpinBox_Zcentre->setSingleStep(_Zincr); }
else { SpinBox_Zcentre->setSingleStep(1);}
SpinBox_Rayon->setValue(_BoundaryAnRayon);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::SetConeA()
// ------------------------------------------------------------------------
{
gBCylindre->setVisible(0);
gBSphere->setVisible(0);
gBCone->setVisible(1);
RBCone->setChecked(1);
gBTore->setVisible(0);
RB_Def_angle->setChecked(1);
RBCylindre->setDisabled(true);
RBSphere->setDisabled(true);
RBTore->setDisabled(true);
_Type=3;
//
TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0));
SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone);
TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0));
SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone);
TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0));
SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone);
//
TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0));
SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone);
TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0));
SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone);
TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0));
SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone);
//
TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0));
SpinBox_Cone_V1->setValue(_BoundaryAngle);
SpinBox_Cone_V1->setSingleStep(1.);
SpinBox_Cone_V1->setMaximum(90.);
//
TLCone_V2->setVisible(0);
SpinBox_Cone_V2->setVisible(0);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::SetConeR()
// ------------------------------------------------------------------------
{
gBCylindre->setVisible(0);
gBSphere->setVisible(0);
gBCone->setVisible(1);
gBTore->setVisible(0);
RBCone->setChecked(1);
RB_Def_radius->setChecked(1);
RBCylindre->setDisabled(true);
RBSphere->setDisabled(true);
RBTore->setDisabled(true);
_Type=4;
//
TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0));
SpinBox_Cone_X1->setValue(_BoundaryAnXcone1);
TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0));
SpinBox_Cone_Y1->setValue(_BoundaryAnYcone1);
TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0));
SpinBox_Cone_Z1->setValue(_BoundaryAnZcone1);
//
TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0));
SpinBox_Cone_V1->setSingleStep(_Rayon/10.);
SpinBox_Cone_V1->setMaximum(100000.*_DMax);
SpinBox_Cone_V1->setValue(_BoundaryAnRayon1);
//
TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0));
SpinBox_Cone_X2->setValue(_BoundaryAnXcone2);
TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0));
SpinBox_Cone_Y2->setValue(_BoundaryAnYcone2);
TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0));
SpinBox_Cone_Z2->setValue(_BoundaryAnZcone2);
//
TLCone_V2->setVisible(1);
SpinBox_Cone_V2->setVisible(1);
TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0));
SpinBox_Cone_V2->setValue(_BoundaryAnRayon2);
//
adjustSize();
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::SetTore()
// ------------------------------------------------------------------------
{
gBCylindre->setVisible(0);
gBSphere->setVisible(0);
gBCone->setVisible(0);
gBTore->setVisible(1);
RBTore->setChecked(1);
_Type=5;
RBCylindre->setDisabled(true);
RBSphere->setDisabled(true);
RBCone->setDisabled(true);
SpinBoxToreXcent->setValue(_BoundaryAnXcentre);
SpinBoxToreYcent->setValue(_BoundaryAnYcentre);
SpinBoxToreZcent->setValue(_BoundaryAnZcentre);
SpinBoxToreXaxe->setValue(_BoundaryAnXaxis);
SpinBoxToreYaxe->setValue(_BoundaryAnYaxis);
SpinBoxToreZaxe->setValue(_BoundaryAnZaxis);
SpinBoxToreXaxe->setSingleStep(0.1);
SpinBoxToreXcent->setSingleStep(_Xincr);
SpinBoxToreYaxe->setSingleStep(0.1);
SpinBoxToreYcent->setSingleStep(_Yincr);
SpinBoxToreZaxe->setSingleStep(0.1);
SpinBoxToreZcent->setSingleStep(_Zincr);
// Rayon de revolution
SpinBoxToreRRev->setValue(_BoundaryAnRayon1);
SpinBoxToreRRev->setSingleStep(_BoundaryAnRayon1/10.);
// Rayon primaire
SpinBoxToreRPri->setValue(_BoundaryAnRayon2);
SpinBoxToreRPri->setSingleStep(_BoundaryAnRayon2/10.);
//
adjustSize();
}
// ---------------------------------------------------
bool MonEditBoundaryAn::CreateOrUpdateBoundaryAn()
//----------------------------------------------------
// Mise a jour des attributs de la BoundaryAn
{
switch (_Type)
{
case 1 : // il s agit d un cylindre
{
aBoundaryAn->SetCylinder(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon );
break;
}
case 2 : // il s agit d une sphere
{
aBoundaryAn->SetSphere(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon);
break;
}
case 3 : // il s agit d un cone defini par un axe et un angle
{
aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_Name.toStdString().c_str()), \
_BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \
_BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone);
break;
}
case 4 : // il s agit d un cone defini par les 2 rayons
{
aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_Name.toStdString().c_str()), \
_BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \
_BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2);
break;
}
case 5 : // il s agit d un tore
{
aBoundaryAn->SetTorus(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon1, _BoundaryAnRayon2 );
break;
}
}
if (Chgt) myHomardGen->InvalideBoundary(_Name.toStdString().c_str());
HOMARD_UTILS::updateObjBrowser();
return true;
}

View File

@ -0,0 +1,61 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITBOUNDARYAN_H
#define MON_EDITBOUNDARYAN_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateBoundaryAn.h>
class HOMARD_EXPORT MonEditBoundaryAn : public MonCreateBoundaryAn
{
Q_OBJECT
public:
MonEditBoundaryAn( MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString Name);
virtual ~MonEditBoundaryAn();
protected :
bool CreateOrUpdateBoundaryAn();
void InitValEdit();
void InitValBoundaryAnLimit();
void SetCylinder();
void SetSphere();
void SetConeR();
void SetConeA();
void SetTore();
void InitValBoundaryAnCylindre();
void InitValBoundaryAnSphere();
void InitValBoundaryAnConeR();
void InitValBoundaryAnConeA();
void InitValBoundaryAnTore();
public slots:
};
#endif // MON_EDITZONE_H

View File

@ -0,0 +1,105 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditBoundaryCAO.h"
#include "MonEditListGroupCAO.h"
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
// -------------------------------------------------------------------------------------------------------------------------------------
MonEditBoundaryCAO::MonEditBoundaryCAO( MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString Name):
// -------------------------------------------------------------------------------------------------------------------------------------
/* Constructs a MonEditBoundaryCAO
herite de MonCreateBoundaryCAO
*/
MonCreateBoundaryCAO(parent, modal, myHomardGen, caseName, Name)
{
MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str());
setWindowTitle(QObject::tr("HOM_BOUN_C_EDIT_WINDOW_TITLE"));
try
{
aBoundary=myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str()));
if (caseName==QString("")) { _aCaseName=aBoundary->GetCaseCreation();}
InitValEdit();
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return;
}
HOMARD::ListGroupType_var maListe = aBoundary->GetGroups();
for ( int i = 0; i < maListe->length(); i++ )
_listeGroupesBoundary << QString(maListe[i]);
}
// ------------------------------
MonEditBoundaryCAO::~MonEditBoundaryCAO()
// ------------------------------
{
}
// ------------------------------
void MonEditBoundaryCAO::InitValEdit()
// ------------------------------
{
LEName->setText(_aName);
LEName->setReadOnly(true);
QString aDataFile = aBoundary->GetDataFile();
LEFileName->setText(aDataFile);
LEFileName->setReadOnly(1);
PushFichier->setVisible(0);
//
adjustSize();
}
// ------------------------------
bool MonEditBoundaryCAO::PushOnApply()
// ------------------------------
{
return true;
}
// ------------------------------------------------------------------------
void MonEditBoundaryCAO::SetFiltrage()
// // ------------------------------------------------------------------------
{
if (!CBGroupe->isChecked()) return;
if (_aCaseName.toStdString().c_str() == QString())
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_BOUN_CASE") );
return;
}
HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str());
HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
MonEditListGroupCAO *aDlg = new MonEditListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),
_aCaseName, _listeGroupesBoundary) ;
aDlg->show();
}

View File

@ -0,0 +1,51 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITBOUNDARYCAO_H
#define MON_EDITBOUNDARYCAO_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateBoundaryCAO.h>
class HOMARD_EXPORT MonEditBoundaryCAO : public MonCreateBoundaryCAO
{
Q_OBJECT
public:
MonEditBoundaryCAO( MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString Name );
virtual ~MonEditBoundaryCAO();
protected :
virtual void InitValEdit();
virtual bool PushOnApply();
virtual void SetFiltrage();
public slots:
};
#endif

View File

@ -0,0 +1,105 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditBoundaryDi.h"
#include "MonEditListGroup.h"
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
// -------------------------------------------------------------------------------------------------------------------------------------
MonEditBoundaryDi::MonEditBoundaryDi( MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString Name):
// -------------------------------------------------------------------------------------------------------------------------------------
/* Constructs a MonEditBoundaryDi
herite de MonCreateBoundaryDi
*/
MonCreateBoundaryDi(parent, modal, myHomardGen, caseName, Name)
{
MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str());
setWindowTitle(QObject::tr("HOM_BOUN_D_EDIT_WINDOW_TITLE"));
try
{
aBoundary=myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str()));
if (caseName==QString("")) { _aCaseName=aBoundary->GetCaseCreation();}
InitValEdit();
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return;
}
HOMARD::ListGroupType_var maListe = aBoundary->GetGroups();
for ( int i = 0; i < maListe->length(); i++ )
_listeGroupesBoundary << QString(maListe[i]);
}
// ------------------------------
MonEditBoundaryDi::~MonEditBoundaryDi()
// ------------------------------
{
}
// ------------------------------
void MonEditBoundaryDi::InitValEdit()
// ------------------------------
{
LEName->setText(_aName);
LEName->setReadOnly(true);
QString aDataFile = aBoundary->GetDataFile();
LEFileName->setText(aDataFile);
LEFileName->setReadOnly(1);
PushFichier->setVisible(0);
//
adjustSize();
}
// ------------------------------
bool MonEditBoundaryDi::PushOnApply()
// ------------------------------
{
return true;
}
// ------------------------------------------------------------------------
void MonEditBoundaryDi::SetFiltrage()
// // ------------------------------------------------------------------------
{
if (!CBGroupe->isChecked()) return;
if (_aCaseName.toStdString().c_str() == QString())
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_BOUN_CASE") );
return;
}
HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str());
HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
MonEditListGroup *aDlg = new MonEditListGroup(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),
_aCaseName, _listeGroupesBoundary) ;
aDlg->show();
}

View File

@ -0,0 +1,51 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITBOUNDARYDI_H
#define MON_EDITBOUNDARYDI_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateBoundaryDi.h>
class HOMARD_EXPORT MonEditBoundaryDi : public MonCreateBoundaryDi
{
Q_OBJECT
public:
MonEditBoundaryDi( MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString Name );
virtual ~MonEditBoundaryDi();
protected :
virtual void InitValEdit();
virtual bool PushOnApply();
virtual void SetFiltrage();
public slots:
};
#endif

View File

@ -0,0 +1,269 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditCase.h"
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
// -------------------------------------------------------------
/* Constructs a MonEditCase
herite de MonCreateCase
*/
// -------------------------------------------------------------
MonEditCase::MonEditCase ( bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString CaseName ):
MonCreateCase(modal, myHomardGen)
{
MESSAGE("Debut de MonEditCase" << CaseName.toStdString().c_str());
setWindowTitle(QObject::tr("HOM_CASE_EDIT_WINDOW_TITLE"));
_aCaseName = CaseName;
aCase = myHomardGen->GetCase(_aCaseName.toStdString().c_str());
InitValEdit();
}
// ------------------------------
MonEditCase::~MonEditCase()
// ------------------------------
{
}
// ------------------------------
void MonEditCase::InitValEdit()
// ------------------------------
{
MESSAGE("InitValEdit");
LEName->setText(_aCaseName);
LEName->setReadOnly(true);
QString aDirName = aCase->GetDirName();
LEDirName->setText(aDirName);
LEDirName->setReadOnly(true);
PushDir->setVisible(0);
QString _aitername=aCase->GetIter0Name();
HOMARD::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(_aitername.toStdString().c_str());
QString aFileName = aIter->GetMeshFile();
LEFileName->setText(aFileName);
LEFileName->setReadOnly(true);
PushFichier->setVisible(0);
int ConfType=aCase->GetConfType();
if ( ( ConfType == 0 ) || ( ConfType == -1 ) ) { RBConforme->setChecked(true); }
else { RBNonConforme->setChecked(true); };
RBConforme->setEnabled(false);
RBNonConforme->setEnabled(false);
int ExtType=aCase->GetExtType();
// Suivi de frontiere
// A priori, aucun affichage
GBTypeBoun->setVisible(0);
CBBoundaryD->setVisible(0);
CBBoundaryA->setVisible(0);
GBBoundaryC->setVisible(0);
GBBoundaryD->setVisible(0);
GBBoundaryA->setVisible(0);
// On passe en revue tous les couples (frontiere,groupe) du cas
HOMARD::ListBoundaryGroupType_var mesBoundarys = aCase->GetBoundaryGroup();
if (mesBoundarys->length()>0)
{
QStringList ListeFron ;
QString NomFron ;
bool BounCAO = false ;
bool BounDi = false ;
bool BounAn = false ;
for (int i=0; i<mesBoundarys->length(); i++)
{
// Nom de la frontiere
NomFron = mesBoundarys[i++];
MESSAGE("NomFron "<<NomFron.toStdString().c_str());
// L'objet associe pour en deduire le type
HOMARD::HOMARD_Boundary_var myBoundary = myHomardGen->GetBoundary(NomFron.toStdString().c_str());
int type_obj = myBoundary->GetType() ;
MESSAGE("type_obj "<<type_obj);
// C'est une frontiere CAO
// Remarque : on ne gere pas les groupes
if ( type_obj==-1 )
{
BounCAO = true ;
CBBoundaryCAO->addItem(NomFron);
}
// C'est une frontiere discrete
// Rermarque : on ne gere pas les groupes
else if ( type_obj==0 )
{
BounDi = true ;
CBBoundaryDi->addItem(NomFron);
}
// C'est une frontiere analytique
else
{
BounAn = true ;
int nbcol = TWBoundary->columnCount();
// On ajoute une ligne pour le groupe
TWBoundary->insertRow(0);
// La colonne 0 comporte le nom du groupe
TWBoundary->setItem( 0, 0, new QTableWidgetItem(QString(mesBoundarys[i]).trimmed()));
// TWBoundary->item( 0, 0 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
// Chacune des colonnes suivantes est associé a une frontiere deja presente : on y met une
// case non cochee
for ( int j = 1; j < nbcol; j++ )
{
TWBoundary->setItem( 0, j, new QTableWidgetItem( QString ("") ) );
TWBoundary->item( 0, j )->setFlags( 0 );
TWBoundary->item( 0, j )->setFlags( Qt::ItemIsUserCheckable );
TWBoundary->item( 0, j )->setCheckState( Qt::Unchecked );
}
// On cherche si la frontiere en cours d'examen a deja ete rencontree :
// si oui, on stocke son numero de colonne
int ok = -1 ;
for ( int nufr = 0 ; nufr<ListeFron.size(); nufr++)
{ if ( ListeFron[nufr] == NomFron ) ok = nufr+1 ; }
// si non, on ajoute une colonne
if ( ok < 0 )
{
ListeFron.append(NomFron);
ok = ListeFron.size() ;
AddBoundaryAn(NomFron);
}
// on coche la case correspondant au couple (frontiere,groupe) en cours d'examen
TWBoundary->item( 0, ok )->setCheckState( Qt::Checked );
}
}
MESSAGE("BounCAO "<<BounCAO<<",BounDi "<<BounDi<<", BounAn "<<BounAn);
GBTypeBoun->setVisible(1);
if ( BounCAO )
{ RBBoundaryCAO->setChecked(true);
GBBoundaryC->setVisible(1);
CBBoundaryCAO->setDisabled(true);
PBBoundaryCAONew->setVisible(0);
PBBoundaryCAOHelp->setVisible(0); }
if ( BounDi )
{ RBBoundaryNonCAO->setChecked(true);
GBBoundaryD->setVisible(1);
CBBoundaryDi->setDisabled(true);
PBBoundaryDiNew->setVisible(0);
PBBoundaryDiHelp->setVisible(0); }
if ( BounAn )
{ RBBoundaryNonCAO->setChecked(true);
GBBoundaryA->setVisible(1);
// On rend les cases non modifiables.
// On ne peut pas le faire pour tout le tableau sinon on perd l'ascenseur !
int nbcol = TWBoundary->columnCount();
int nbrow = TWBoundary->rowCount();
for ( int i = 0; i < nbrow; i++ )
{ for ( int j = 0; j < nbcol; j++ ) TWBoundary->item( i, j )->setFlags( Qt::ItemIsSelectable ); }
// on met un nom blanc au coin
QTableWidgetItem *__colItem = new QTableWidgetItem();
__colItem->setText(QApplication::translate("CreateCase", "", 0));
TWBoundary->setHorizontalHeaderItem(0, __colItem);
// on cache les boutons inutiles
PBBoundaryAnNew->setVisible(0);
PBBoundaryAnHelp->setVisible(0);
}
RBBoundaryNo->setEnabled(false);
RBBoundaryCAO->setEnabled(false);
RBBoundaryNonCAO->setEnabled(false);
}
//
// Les options avancees (non modifiables)
CBAdvanced->setVisible(0) ;
CBAdvanced->setEnabled(false) ;
int Pyram = aCase->GetPyram();
MESSAGE("Pyram "<<Pyram);
if ( ( Pyram > 0 ) || ( ConfType < 0 ) || ( ConfType > 1 ) || ( ExtType > 0 ) )
{ GBAdvancedOptions->setVisible(1);
//
if ( Pyram > 0 )
{ CBPyramid->setChecked(true);
CBPyramid->setVisible(1);
}
else
{ CBPyramid->setChecked(false);
CBPyramid->setVisible(0);
}
CBPyramid->setEnabled(false);
//
if ( ( ConfType == 0 ) || ( ConfType == -1 ) )
{ if ( ConfType == 0 ) { RBStandard->setChecked(true); }
else { RBBox->setChecked(true); }
RBStandard->setVisible(1);
RBBox->setVisible(1);
RBNC1NpA->setVisible(0);
RBNCQuelconque->setVisible(0);
}
else
{ if (ConfType==-2) { RBBox->setChecked(true);};
if (ConfType==1) { RBStandard->setChecked(true);};
if (ConfType==2) { RBNC1NpA->setChecked(true);};
if (ConfType==3) { RBNCQuelconque->setChecked(true);};
RBStandard->setVisible(1);
RBBox->setVisible(1);
RBNC1NpA->setVisible(1);
RBNCQuelconque->setVisible(1);
}
RBStandard->setEnabled(false);
RBBox->setEnabled(false);
RBNC1NpA->setEnabled(false);
RBNCQuelconque->setEnabled(false);
//
if ( ExtType == 0 )
{ GBFormat->setVisible(0);
RBMED->setChecked(true);
}
else
{ GBFormat->setVisible(1);
RBMED->setVisible(1);
RBSaturne->setVisible(1);
RBSaturne2D->setVisible(1);
if ( ExtType == 1 ) { RBSaturne->setChecked(true); }
else { RBSaturne2D->setChecked(true); }
}
RBMED->setEnabled(false);
RBSaturne->setEnabled(false);
RBSaturne2D->setEnabled(false);
}
else
{ GBAdvancedOptions->setVisible(0);
CBPyramid->setChecked(false);
RBStandard->setChecked(true);
RBMED->setChecked(true);
}
//
// L'etat
int etat = aCase->GetState();
MESSAGE("etat "<<etat);
if ( etat == 0 ) { Comment->setText(QApplication::translate("CreateCase", "HOM_CASE_EDIT_STATE_0", 0)); }
else { Comment->setText(QApplication::translate("CreateCase", "HOM_CASE_EDIT_STATE", 0)); }
Comment->setVisible(1);
//
adjustSize();
}
// -------------------------------------
bool MonEditCase::PushOnApply()
// -------------------------------------
{
return true ;
};

View File

@ -0,0 +1,50 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITCASE_H
#define MON_EDITCASE_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateCase.h>
class HOMARD_EXPORT MonEditCase : public MonCreateCase
{
Q_OBJECT
public:
MonEditCase( bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString Name );
virtual ~MonEditCase();
protected :
virtual void InitValEdit();
virtual bool PushOnApply();
public slots:
};
#endif

View File

@ -0,0 +1,119 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditFile.h"
#include <QFile>
#include <QTextStream>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
/* ---------------------------------------------------------
* MonEditFile classe derivee de EditFile
* elle meme generee par uic
* Ouvre le fichier passe en parametre
* et affiche le texte correspondant dans la fenetre de log
* ---------------------------------------------------------
*/
/* ---------------------------------------------------------
* MonEditFile Constructeur
* ---------------------------------------------------------
*/
MonEditFile::MonEditFile( QWidget* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString aFileName, int option):
// QWidget(0),
Ui_EditFile(),
_aFileName (aFileName),
_option (option),
_codret (0)
{
MESSAGE("Debut de MonEditFile " << aFileName.toStdString().c_str());
setupUi(this);
InitConnect();
EditText();
}
/*
* Destroys the object and frees any allocated resources
*/
MonEditFile::~MonEditFile()
{
MESSAGE("Destructeur de ~MonEditFile");
}
// ------------------------------------------------------------------------
void MonEditFile::InitConnect()
// ------------------------------------------------------------------------
{
connect( buttonQuit, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonPrint, SIGNAL(pressed()), this, SLOT(PushOnPrint()));
}
// ------------------------------------------------------------------------
void MonEditFile::EditText()
// ------------------------------------------------------------------------
{
// Creation de l'objet fichier QT associe
QFile file( _aFileName );
// Ouverture
bool bOpen = file.open( QIODevice::ReadOnly | QIODevice::Text ) ;
//
if ( bOpen )
{
// Lecture
// Remarque : il serait plus clair de tout lire d'un coup mais cela ne marche pas !
// alors on fait ligne par ligne et on cumule en ajoutant un saut de ligne.
QTextStream stream( &file );
QString tout;
while ( !stream.atEnd() )
{
tout = tout + stream.readLine() + "\n" ;
}
// tout = stream.readAll() ;
QTBEditFile->setPlainText( tout );
}
else
{
// Option = 0 : emission d'un message d'erreur
if ( _option == 0 )
{
MESSAGE( "EditText " << _aFileName.toStdString().c_str() << " est impossible a ouvrir ");
QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
QObject::tr("HOM_SELECT_FILE_3") );
}
// Sinon : rien
_codret = 1 ;
}
}
// ------------------------------------------------------------------------
void MonEditFile::PushOnPrint()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de MonEditFile::PushOnPrint")
QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
QObject::tr("HOM_INACTIVE_BUTTON") );
return;
}

View File

@ -0,0 +1,64 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITFILE_H
#define MON_EDITFILE_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include "SALOME_Selection.h"
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include "ui_EditFile.h"
#include <QWidget>
class QListBox;
class QDialog;
class HOMARD_EXPORT MonEditFile : public QWidget, public Ui_EditFile
{
Q_OBJECT
public:
MonEditFile( QWidget* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString FileName, int option );
~MonEditFile();
int _codret ;
protected :
HOMARD::HOMARD_Gen_var myHomardGen;
QString _aFileName ;
int _option ;
virtual void InitConnect();
virtual void EditText();
public slots:
virtual void PushOnPrint();
};
#endif // MON_EDITFILE_H

View File

@ -0,0 +1,463 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditHypothesis.h"
#include "MonEditListGroup.h"
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include "HOMARD.hxx"
#include <utilities.h>
using namespace std;
// ----------------------------------------------------------------------------
MonEditHypothesis::MonEditHypothesis( MonCreateIteration* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString Name,
QString caseName, QString aFieldFile ):
// ----------------------------------------------------------------------------
/* Constructs a MonEditHypothesis
herite de MonCreateHypothesis
*/
MonCreateHypothesis(parent, modal,myHomardGen, Name, caseName, aFieldFile)
{
MESSAGE("Hypothese " << Name.toStdString().c_str());
setWindowTitle(QObject::tr("HOM_HYPO_EDIT_WINDOW_TITLE"));
aHypothesis = myHomardGen->GetHypothesis(_Name.toStdString().c_str());
if (caseName == QString("") ){ _aCaseName = aHypothesis->GetCaseCreation();}
InitValEdit();
InitGroupes();
}
// ------------------------------
MonEditHypothesis::~MonEditHypothesis()
// ------------------------------
{
}
// ------------------------------
void MonEditHypothesis::InitGroupes()
// ------------------------------
{
HOMARD::ListGroupType_var maListe = aHypothesis->GetGroups();
for ( int i = 0; i < maListe->length(); i++ )
_aListeGroupes << QString(maListe[i]);
if (maListe->length() == 0) { CBGroupe->hide();}
}
// ------------------------------
void MonEditHypothesis::InitValEdit()
// ------------------------------
{
MESSAGE("Debut de InitValEdit");
LEName->setText(_Name);
LEName->setReadOnly(true);
HOMARD::listeTypes_var ListTypes (aHypothesis->GetAdapRefinUnRef());
ASSERT( ListTypes->length()==3) ;
_aTypeAdap = ListTypes[0];
_aTypeRaff = ListTypes[1];
_aTypeDera = ListTypes[2];
if (_aTypeAdap == -1) InitAdaptUniforme();
if (_aTypeAdap == 0) InitAdaptZone();
if (_aTypeAdap == 1) InitAdaptChamps();
RBUniDera->setDisabled(true);
RBUniRaff->setDisabled(true);
InitFieldInterp();
if (_aTypeAdap == 1 || _TypeFieldInterp >= 1 )
{
if (_aFieldFile == QString("")) { GBFieldFile->setVisible(0); }
else
{
GBFieldFile->setVisible(1);
LEFieldFile->setText(_aFieldFile);
LEFieldFile->setReadOnly(1);
}
}
else
{
GBFieldFile->setVisible(0);
}
// Les options avancees (non modifiables)
CBAdvanced->setVisible(0) ;
int NivMax = aHypothesis->GetNivMax();
double DiamMin = aHypothesis->GetDiamMin();
int AdapInit = aHypothesis->GetAdapInit();
int ExtraOutput = aHypothesis->GetExtraOutput();
if ( NivMax > 0 || DiamMin > 0 || AdapInit != 0 || ExtraOutput != 1 )
{ GBAdvancedOptions->setVisible(1);
if ( NivMax > 0 )
{ SpinBoxNivMax->setValue(NivMax);
SpinBoxNivMax->setDisabled(true); }
else
{ TLMaximalLevel->setVisible(0);
SpinBoxNivMax->setVisible(0); }
if ( DiamMin > 0 )
{ doubleSpinBoxDiamMin->setValue(DiamMin);
doubleSpinBoxDiamMin->setDisabled(true); }
else
{ TLMinimalDiameter->setVisible(0);
doubleSpinBoxDiamMin->setVisible(0); }
if ( AdapInit != 0 )
{
if ( AdapInit > 0 )
{ RBAIR->setChecked(true); }
else
{ RBAID->setChecked(true); }
RBAIN->setEnabled(false);
RBAIR->setEnabled(false);
RBAID->setEnabled(false);
}
else
{ GBAdapInit->setVisible(0) ;
}
if ( ExtraOutput % 2 == 0 )
{
CBOutputLevel->setChecked(true);
CBOutputLevel->setEnabled(false);
}
else { CBOutputLevel->setVisible(0) ; }
if ( ExtraOutput % 3 == 0 )
{
CBOutputQuality->setChecked(true);
CBOutputQuality->setEnabled(false);
}
else { CBOutputQuality->setVisible(0) ; }
if ( ExtraOutput % 5 == 0 )
{
CBOutputDiameter->setChecked(true);
CBOutputDiameter->setEnabled(false);
}
else { CBOutputDiameter->setVisible(0) ; }
if ( ExtraOutput % 7 == 0 )
{
CBOutputParent->setChecked(true);
CBOutputParent->setEnabled(false);
}
else { CBOutputParent->setVisible(0) ; }
if ( ExtraOutput % 11 == 0 )
{
CBOutputVoisins->setChecked(true);
CBOutputVoisins->setEnabled(false);
}
else { CBOutputVoisins->setVisible(0) ; }
}
else
{ GBAdvancedOptions->setVisible(0); }
//
}
// ----------------------------------------
void MonEditHypothesis::InitAdaptUniforme()
// ----------------------------------------
// Affichage des informations pour une adaptation uniforme
{
// Choix des options generales
GBFieldManagement->setVisible(0);
GBAreaManagement->setVisible(0);
GBUniform->setVisible(1);
RBUniforme->setChecked(true);
RBUniforme->setEnabled(false);
RBChamp->setEnabled(false);
RBZone->setEnabled(false);
//
// Raffinement ou deraffinement ?
if (_aTypeDera == 0)
{
VERIFICATION(_aTypeRaff==1);
RBUniDera->setChecked(false);
RBUniRaff->setChecked(true);
}
if (_aTypeDera == 1)
{
VERIFICATION(_aTypeRaff==0);
RBUniDera->setChecked(true);
RBUniRaff->setChecked(false);
}
//
adjustSize();
//
}
// -------------------------------------
void MonEditHypothesis::InitAdaptZone()
// -------------------------------------
// Affichage des informations pour une adaptation selon des zones :
{
MESSAGE ("Debut de InitAdaptZone");
// Choix des options generales
GBUniform->setVisible(0);
GBFieldManagement->setVisible(0);
GBAreaManagement->setVisible(1);
RBZone->setChecked(true);
RBChamp->setEnabled(false);
RBUniforme->setEnabled(false);
RBZone->setEnabled(false);
// Recuperation de toutes les zones decrites et notation de celles retenues
GetAllZones();
HOMARD::listeZonesHypo_var mesZonesAvant = aHypothesis->GetZones();
for (int i=0; i<mesZonesAvant->length(); i++)
{
MESSAGE ("i"<<i<<", zone :"<<string(mesZonesAvant[i])<<", type :"<<string(mesZonesAvant[i+1]));
for ( int j =0 ; j < TWZone->rowCount(); j++)
{
MESSAGE (". j"<<j<<", zone :"<<TWZone->item(j,2)->text().toStdString());
if ( TWZone->item(j,2)->text().toStdString() == string(mesZonesAvant[i]) )
{
MESSAGE ("OK avec "<<string(mesZonesAvant[i]));
if ( string(mesZonesAvant[i+1]) == "1" )
{
MESSAGE ("... RAFF");
TWZone->item( j,0 )->setCheckState( Qt::Checked );
TWZone->item( j,1 )->setCheckState( Qt::Unchecked ); }
else
{
MESSAGE ("... DERA");
TWZone->item( j,0 )->setCheckState( Qt::Unchecked );
TWZone->item( j,1 )->setCheckState( Qt::Checked ); }
break;
}
}
i += 1 ;
}
//
// Inactivation des choix
for ( int j =0 ; j < TWZone->rowCount(); j++)
{
TWZone->item( j, 0 )->setFlags(0);
TWZone->item( j, 1 )->setFlags(0);
}
PBZoneNew->setVisible(0);
//
adjustSize();
//
}
// -------------------------------------
void MonEditHypothesis::InitAdaptChamps()
// -------------------------------------
// Affichage des informations pour une adaptation selon un champ :
// . Nom du champ
// . Composantes
// . Seuils
// . Absolu/relatif
{
MESSAGE ("Debut de InitAdaptChamps");
// Choix des options generales
GBUniform->setVisible(0);
GBAreaManagement->setVisible(0);
GBFieldManagement->setVisible(1);
RBChamp->setChecked(true);
RBUniforme->setEnabled(false);
RBChamp->setEnabled(false);
RBZone->setEnabled(false);
HOMARD::InfosHypo_var aInfosHypo = aHypothesis->GetField();
_aFieldName = aInfosHypo->FieldName;
_TypeThR = aInfosHypo->TypeThR;
_ThreshR = aInfosHypo->ThreshR;
_TypeThC = aInfosHypo->TypeThC;
_ThreshC = aInfosHypo->ThreshC;
_UsField = aInfosHypo->UsField;
_UsCmpI = aInfosHypo->UsCmpI;
CBFieldName->insertItem(0,_aFieldName);
CBFieldName->setCurrentIndex(0);
CBFieldName->setEnabled(false);
//SetFieldName(Qt::Unchecked);
HOMARD::listeComposantsHypo_var mesComposantsAvant = aHypothesis->GetComps();
TWCMP->clear();
TWCMP->setRowCount(0);
TWCMP->resizeRowsToContents();
for (int i=0; i<mesComposantsAvant->length(); i++)
{
TWCMP->insertRow(0);
TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
TWCMP->item( 0, 0 )->setCheckState(Qt::Checked );
TWCMP->item( 0, 0 )->setFlags( 0 );
TWCMP->setItem( 0, 1, new QTableWidgetItem(QString(mesComposantsAvant[i]).trimmed()));
TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
}
TWCMP->resizeColumnsToContents();
TWCMP->resizeRowsToContents();
TWCMP->clearSelection();
// Les seuils de raffinement
RBRAbs->setEnabled(false) ;
RBRRel->setEnabled(false) ;
RBRPE->setEnabled(false) ;
RBRMuSigma->setEnabled(false) ;
RBRNo->setEnabled(false) ;
if (_aTypeRaff== 0 )
{
SetRNo();
RBRNo->setEnabled(true) ;
}
else
{
if ( _TypeThR == 1 ) { SpinBox_RAbs->setValue(_ThreshR); SetRAbs(); RBRAbs->setEnabled(true);}
if ( _TypeThR == 2 ) { SpinBox_RRel->setValue(_ThreshR); SetRRel(); RBRRel->setEnabled(true);}
if ( _TypeThR == 3 ) { SpinBox_RPE->setValue(_ThreshR); SetRPE(); RBRPE->setEnabled(true);}
if ( _TypeThR == 4 ) { SpinBox_RMuSigma->setValue(_ThreshR); SetRMS(); RBRMuSigma->setEnabled(true);}
}
// Les seuils de deraffinement
RBCAbs->setEnabled(false) ;
RBCRel->setEnabled(false) ;
RBCPE->setEnabled(false) ;
RBCMuSigma->setEnabled(false) ;
RBCNo->setEnabled(false) ;
if (_aTypeDera== 0 )
{
SetCNo();
RBCNo->setEnabled(true) ;
}
else
{
if ( _TypeThC == 1 ) { SpinBox_CAbs->setValue(_ThreshC); SetCAbs(); RBCAbs->setEnabled(true);}
if ( _TypeThC == 2 ) { SpinBox_CRel->setValue(_ThreshC); SetCRel(); RBCRel->setEnabled(true);}
if ( _TypeThC == 3 ) { SpinBox_CPE->setValue(_ThreshC); SetCPE(); RBCPE->setEnabled(true);}
if ( _TypeThC == 4 ) { SpinBox_CMuSigma->setValue(_ThreshC); SetCMS(); RBCMuSigma->setEnabled(true);}
}
// Le choix de la prise en compte des composantes
if ( TWCMP->rowCount() == 1 )
{ RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
}
else
{ RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
}
if ( _UsField == 0 ) { CBJump->hide(); }
else
{
CBJump->setChecked(true);
CBJump->setEnabled(false);
}
if ( _UsCmpI == 0 )
{
RBL2->setChecked(true);
RBL2->setEnabled(true);
RBInf->setEnabled(false) ;
}
else
{
RBL2->setEnabled(false) ;
RBInf->setChecked(true);
RBInf->setEnabled(true);
}
//
adjustSize();
}
// -------------------------------------
void MonEditHypothesis::InitFieldInterp()
// -------------------------------------
// Affichage des informations pour les interpolations
{
MESSAGE ("Debut de InitFieldInterp");
// Choix des options generales
_TypeFieldInterp = aHypothesis->GetTypeFieldInterp();
MESSAGE ("_TypeFieldInterp = " << _TypeFieldInterp);
//
// Aucune interpolation
if ( _TypeFieldInterp == 0 )
{
RBFieldNo->setChecked(true);
TWField->setVisible(0);
}
// Interpolation de tous les champs
if ( _TypeFieldInterp == 1 )
{
RBFieldAll->setChecked(true);
TWField->setVisible(0);
}
// Interpolation de champs choisis
if ( _TypeFieldInterp == 2 )
{
RBFieldChosen->setChecked(true);
//
TWField->setVisible(1);
HOMARD::listeFieldInterpsHypo_var mesChampsAvant = aHypothesis->GetFieldInterps();
TWField->clear();
TWField->setRowCount(0);
TWField->resizeRowsToContents();
for (int iaux=0; iaux<mesChampsAvant->length(); iaux++)
{
TWField->insertRow(0);
TWField->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
TWField->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
TWField->item( 0, 0 )->setCheckState(Qt::Checked );
TWField->item( 0, 0 )->setFlags( 0 );
TWField->setItem( 0, 1, new QTableWidgetItem(QString(mesChampsAvant[iaux]).trimmed()));
TWField->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
iaux++;
}
TWField->resizeColumnsToContents();
TWField->resizeRowsToContents();
TWField->clearSelection();
}
RBFieldNo->setEnabled(false) ;
RBFieldAll->setEnabled(false) ;
RBFieldChosen->setEnabled(false) ;
}
// -------------------------------------
bool MonEditHypothesis::PushOnApply()
// -------------------------------------
{
// Pour du raffinement selon un champ, les seuils ont-ils change ?
if ( _aTypeAdap == 1 )
{
if (_aTypeRaff!= 0 )
{
if (_TypeThR == 1) { _ThreshR = SpinBox_RAbs->value(); }
if (_TypeThR == 2) { _ThreshR = SpinBox_RRel->value(); }
if (_TypeThR == 3) { _ThreshR = SpinBox_RPE->value(); }
if (_TypeThR == 4) { _ThreshR = SpinBox_RMuSigma->value(); }
aHypothesis->SetRefinThr(_TypeThR, _ThreshR) ;
}
if (_aTypeDera!= 0 )
{
if (_TypeThC == 1) { _ThreshC = SpinBox_CAbs->value() ; }
if (_TypeThC == 2) { _ThreshC = SpinBox_CRel->value() ; }
if (_TypeThC == 3) { _ThreshC = SpinBox_CPE->value() ; }
if (_TypeThC == 4) { _ThreshC = SpinBox_CMuSigma->value() ; }
aHypothesis->SetUnRefThr(_TypeThC, _ThreshC) ;
}
myHomardGen->InvalideHypo(_Name.toStdString().c_str());
HOMARD_UTILS::updateObjBrowser();
}
return true;
};
// ------------------------------------------------------------------------
void MonEditHypothesis::SetFiltrage()
// ------------------------------------------------------------------------
{
if (CBGroupe->isChecked())
{
MonEditListGroup *aDlg = new MonEditListGroup(this, NULL, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ;
aDlg->show();
}
}

View File

@ -0,0 +1,56 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITHYPOTHESIS_H
#define MON_EDITHYPOTHESIS_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateHypothesis.h>
class HOMARD_EXPORT MonEditHypothesis : public MonCreateHypothesis
{
Q_OBJECT
public:
MonEditHypothesis( MonCreateIteration* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString Name, QString aFieldFile );
virtual ~MonEditHypothesis();
protected :
virtual void InitValEdit();
virtual void InitAdaptUniforme();
virtual void InitAdaptZone();
virtual void InitAdaptChamps();
virtual void InitGroupes();
virtual void InitFieldInterp();
virtual void SetFiltrage();
virtual bool PushOnApply();
public slots:
};
#endif

View File

@ -0,0 +1,186 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditIteration.h"
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
// -------------------------------------------------------------------------------------------------------------------------------------
MonEditIteration::MonEditIteration ( QWidget* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString IterParentName, QString IterName ):
// -------------------------------------------------------------------------------------------------------------------------------------
/* Constructs a MonEditIteration
herite de MonCreateIteration
*/
MonCreateIteration(parent, modal, myHomardGen, IterParentName),
_rank(-1), _step(-1), _IterationName(""), _FieldFile(""),_aTypeAdap()
{
MESSAGE("Debut de MonEditIteration" << IterName.toStdString().c_str());
setWindowTitle(QObject::tr("HOM_ITER_EDIT_WINDOW_TITLE"));
_IterationName = IterName;
aIter = myHomardGen->GetIteration(_IterationName.toStdString().c_str());
// Attention au cas ou c'est une iteration initiale : il faut inhiber l'essentiel
int etat = aIter->GetState() ;
if ( etat <= 0 ) { InitValEdit0(etat); }
else { InitValEdit(); }
}
// ------------------------------
MonEditIteration::~MonEditIteration()
// ------------------------------
{
}
// ------------------------------
void MonEditIteration::InitValEdit0(int etat)
// ------------------------------
// Cas d'une iteration initiale d'un cas (initial ou poursuite)
{
//
LEName->setText(_IterationName);
LEName->setReadOnly(true);
// Invisibilite de l'iteration parent
Iter_Parent->setVisible(0);
PBIterParent->setVisible(0);
LEIterationParentName->setVisible(0);
// Affichage bloque du nom du maillage de l'iteration courante
QString MeshName = aIter->GetMeshName();
Mesh_n->setText(QObject::tr("HOM_ITER_STARTING_POINT_0"));
LEMeshName_n->setText(MeshName);
LEMeshName_n->setReadOnly(1);
// Message general
if ( etat == 0 ) { Mesh_np1->setText(QObject::tr("HOM_ITER_STARTING_POINT_1")) ; }
else { Mesh_np1->setText(QObject::tr("HOM_ITER_STARTING_POINT_2")) ; }
LEMeshName_np1->setVisible(0);
//
// Invisibilite des hypotheses et des champs
Hypothese->setVisible(0);
GBField->setVisible(0);
//
}
// ------------------------------
void MonEditIteration::InitValEdit()
// ------------------------------
// Cas d'une iteration courante
{
// Affichage bloque du nom de l'iteration
LEName->setText(_IterationName);
LEName->setReadOnly(true);
// Affichage bloque du nom de l'iteration parent
_IterParentName = aIter->GetIterParentName();
LEIterationParentName->setText(_IterParentName);
LEIterationParentName->setReadOnly(true);
PBIterParent->setEnabled(false);
PBIterParent->setVisible(0);
// Affichage bloque du nom du maillage de l'iteration parent
aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str());
QString MeshNameParent = aIterParent->GetMeshName();
LEMeshName_n->setText(MeshNameParent);
LEMeshName_n->setReadOnly(1);
// Affichage bloque du nom du maillage de l'iteration courante
QString MeshName = aIter->GetMeshName();
LEMeshName_np1->setText(MeshName);
LEMeshName_np1->setReadOnly(1);
// Affichage de la bonne hypothese
QString HypoName = aIter->GetHypoName();
CBHypothese->insertItem(0,HypoName);
CBHypothese->setCurrentIndex(0);
CBHypothese->setEnabled(false);
PBHypoNew->setVisible(0);
// Pour une adaptation selon un champ
HOMARD::HOMARD_Hypothesis_var myHypo = myHomardGen->GetHypothesis(HypoName.toStdString().c_str()) ;
_aTypeAdap = myHypo->GetAdapType() ;
if ( _aTypeAdap == 1 )
{
_FieldFile = aIter->GetFieldFile();
LEFieldFile->setText(_FieldFile);
_step = aIter->GetTimeStep() ;
SpinBox_TimeStep->setValue(_step);
_rank = aIter->GetRank() ;
SpinBox_Rank->setValue(_rank);
// Cas ou on prend le dernier pas de temps ou sans pas de temps
if ( _step <= -1 )
{
Rank->setVisible(0);
SpinBox_Rank->setVisible(0);
TimeStep->setVisible(0);
SpinBox_TimeStep->setVisible(0);
if ( _step == -2 ) { RBLast->setChecked(true); }
else { RBNo->setChecked(true); }
}
// Cas avec pas de temps
else
{
Rank->setVisible(1);
SpinBox_Rank->setVisible(1);
TimeStep->setVisible(1);
SpinBox_TimeStep->setVisible(1);
RBChosen->setChecked(true);
}
}
else
{
GBField->setVisible(0);
}
//
adjustSize();
//
}
// -------------------------------------
bool MonEditIteration::PushOnApply()
// -------------------------------------
{
if ( _aTypeAdap == 1)
{
// Pour du raffinement selon un champ, les instants ont-ils change ?
if ( (_FieldFile != LEFieldFile->text().trimmed()) ||
( _rank != SpinBox_Rank->value()) ||
( _step != SpinBox_TimeStep->value()))
{
_FieldFile = LEFieldFile->text().trimmed();
aIter->SetFieldFile(CORBA::string_dup(_FieldFile.toStdString().c_str()));
_rank = SpinBox_Rank->value();
_step = SpinBox_TimeStep->value();
if ( _step == -2 ) { aIter->SetTimeStepRankLast(); }
else { aIter->SetTimeStepRank(_step, _rank); }
myHomardGen->InvalideIter(_IterationName.toStdString().c_str());
HOMARD_UTILS::updateObjBrowser();
}
}
return true;
};

View File

@ -0,0 +1,57 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITITERATION_H
#define MON_EDITITERATION_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateIteration.h>
class HOMARD_EXPORT MonEditIteration : public MonCreateIteration
{
Q_OBJECT
public:
MonEditIteration( QWidget* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString IterParentName, QString Name );
virtual ~MonEditIteration();
protected :
QString _FieldFile ;
QString _IterationName ;
int _aTypeAdap ;
int _rank ;
int _step ;
virtual void InitValEdit();
virtual void InitValEdit0(int etat);
virtual bool PushOnApply();
public slots:
};
#endif

View File

@ -0,0 +1,61 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditListGroup.h"
#include <utilities.h>
using namespace std;
//---------------------------------------------------------------------
MonEditListGroup::MonEditListGroup( MonCreateHypothesis* parentHyp,
MonCreateBoundaryDi* parentBound,
bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString aCaseName,
QStringList listeGroupesHypo):
//---------------------------------------------------------------------
MonCreateListGroup(parentHyp,parentBound,myHomardGen,aCaseName,listeGroupesHypo)
{
MESSAGE("Debut de MonEditListGroup");
setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE"));
setModal(true);
InitGroupes();
}
//------------------------------------
MonEditListGroup:: ~MonEditListGroup()
//------------------------------------
{
}
// -------------------------------------
void MonEditListGroup:: InitGroupes()
// -------------------------------------
{
for (int i = 0; i < _listeGroupesHypo.size(); i++ )
{
std::cerr << _listeGroupesHypo[i].toStdString().c_str() << std::endl;
TWGroupe->insertRow(i);
TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) );
TWGroupe->item( i, 0 )->setFlags( 0 );
TWGroupe->item( i, 0 )->setCheckState( Qt::Checked );
TWGroupe->setItem( i, 1, new QTableWidgetItem(_listeGroupesHypo[i]));
}
TWGroupe->resizeRowsToContents();
}

View File

@ -0,0 +1,49 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITLISTGROUP_H
#define MON_EDITLISTGROUP_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateListGroup.h>
class MonCreateHypothesis;
class MonCreateBoundaryDi;
class HOMARD_EXPORT MonEditListGroup : public MonCreateListGroup
{
Q_OBJECT
public:
MonEditListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo);
virtual ~MonEditListGroup();
protected :
virtual void InitGroupes();
};
#endif // MON_EDITLISTGROUP_H

View File

@ -0,0 +1,61 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditListGroupCAO.h"
#include <utilities.h>
using namespace std;
//---------------------------------------------------------------------
MonEditListGroupCAO::MonEditListGroupCAO( MonCreateHypothesis* parentHyp,
MonCreateBoundaryCAO* parentBound,
bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString aCaseName,
QStringList listeGroupesHypo):
//---------------------------------------------------------------------
MonCreateListGroupCAO(parentHyp,parentBound,myHomardGen,aCaseName,listeGroupesHypo)
{
MESSAGE("Debut de MonEditListGroupCAO");
setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE"));
setModal(true);
InitGroupes();
}
//------------------------------------
MonEditListGroupCAO:: ~MonEditListGroupCAO()
//------------------------------------
{
}
// -------------------------------------
void MonEditListGroupCAO:: InitGroupes()
// -------------------------------------
{
for (int i = 0; i < _listeGroupesHypo.size(); i++ )
{
std::cerr << _listeGroupesHypo[i].toStdString().c_str() << std::endl;
TWGroupe->insertRow(i);
TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) );
TWGroupe->item( i, 0 )->setFlags( 0 );
TWGroupe->item( i, 0 )->setCheckState( Qt::Checked );
TWGroupe->setItem( i, 1, new QTableWidgetItem(_listeGroupesHypo[i]));
}
TWGroupe->resizeRowsToContents();
}

View File

@ -0,0 +1,49 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITLISTGROUPCAO_H
#define MON_EDITLISTGROUPCAO_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateListGroupCAO.h>
class MonCreateHypothesis;
class MonCreateBoundaryCAO;
class HOMARD_EXPORT MonEditListGroupCAO : public MonCreateListGroupCAO
{
Q_OBJECT
public:
MonEditListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo);
virtual ~MonEditListGroupCAO();
protected :
virtual void InitGroupes();
};
#endif // MON_EDITLISTGROUPCAO_H

View File

@ -0,0 +1,148 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditYACS.h"
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
using namespace std;
// -------------------------------------------------------------
/* Constructs a MonEditYACS
herite de MonCreateYACS
*/
// -------------------------------------------------------------
MonEditYACS::MonEditYACS ( bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString Name ):
MonCreateYACS(myHomardGen, Name)
{
MESSAGE("Debut de MonEditYACS" << Name.toStdString().c_str());
setWindowTitle(QObject::tr("HOM_YACS_EDIT_WINDOW_TITLE"));
_Name = Name;
aYACS = myHomardGen->GetYACS(_Name.toStdString().c_str());
InitValEdit();
}
// ------------------------------
MonEditYACS::~MonEditYACS()
// ------------------------------
{
}
// ------------------------------
void MonEditYACS::InitValEdit()
// ------------------------------
{
MESSAGE("InitValEdit");
LEName->setText(_Name);
LEName->setReadOnly(true);
_aCaseName = aYACS->GetCaseName();
LECaseName->setText(_aCaseName);
LECaseName->setReadOnly(true);
PBCaseName->setVisible(0);
_aScriptFile = aYACS->GetScriptFile();
LEScriptFile->setText(_aScriptFile);
_aDirName = aYACS->GetDirName();
LEDirName->setText(_aDirName);
LEDirName->setReadOnly(true);
_aMeshFile = aYACS->GetMeshFile();
LEMeshFile->setText(_aMeshFile);
_Type=aYACS->GetType();
if(_Type==1) { RBConstant->setChecked(true); }
else { RBVariable->setChecked(true); };
RBConstant->setEnabled(false);
RBVariable->setEnabled(false);
_MaxIter = aYACS->GetMaxIter();
SpinBoxMaxIter->setValue(_MaxIter) ;
_MaxNode = aYACS->GetMaxNode();
SpinBoxMaxNode->setValue(_MaxNode) ;
_MaxElem = aYACS->GetMaxElem();
SpinBoxMaxElem->setValue(_MaxElem) ;
//
}
// ---------------------------------------------------
bool MonEditYACS:: CreateOrUpdate()
//----------------------------------------------------
// Edition/modification du schema
{
MESSAGE("CreateOrUpdate");
bool chgt = false ;
int valeur_i ;
// A. Recuperation et comparaison des valeurs
// A.1. Le script de lancement
QString aScriptFile=LEScriptFile->text().trimmed();
if ( aScriptFile != _aScriptFile )
{
// MESSAGE("modification de ScriptFile : "<<_aScriptFile.toStdString()<<" devient "<<aScriptFile.toStdString());
_aScriptFile = aScriptFile ;
aYACS->SetScriptFile(CORBA::string_dup(_aScriptFile.toStdString().c_str())) ;
chgt = true ;
}
// A.2. Le maillage initial
QString aMeshFile=LEMeshFile->text().trimmed();
if ( aMeshFile != _aMeshFile )
{
// MESSAGE("modification de aMeshFile : "<<_aMeshFile.toStdString()<<" devient "<<aMeshFile.toStdString());
_aMeshFile = aMeshFile ;
aYACS->SetMeshFile(CORBA::string_dup(_aMeshFile.toStdString().c_str())) ;
chgt = true ;
}
// A.3. La convergence
valeur_i = SpinBoxMaxIter->value() ;
if ( valeur_i != _MaxIter )
{
// MESSAGE("modification de MaxIter : "<<_MaxIter<<" devient "<<valeur_i);
_MaxIter = valeur_i ;
aYACS->SetMaxIter(_MaxIter) ;
chgt = true ;
}
valeur_i = SpinBoxMaxNode->value() ;
if ( valeur_i != _MaxNode )
{
// MESSAGE("modification de MaxNode : "<<_MaxNode<<" devient "<<valeur_i);
_MaxNode = valeur_i ;
aYACS->SetMaxNode(_MaxNode) ;
chgt = true ;
}
valeur_i = SpinBoxMaxElem->value() ;
if ( valeur_i != _MaxElem )
{
// MESSAGE("modification de MaxElem : "<<_MaxElem<<" devient "<<valeur_i);
_MaxElem = valeur_i ;
aYACS->SetMaxElem(_MaxElem) ;
chgt = true ;
}
// B. Si changement
if ( chgt )
{
myHomardGen->InvalideYACS(_Name.toStdString().c_str());
}
HOMARD_UTILS::updateObjBrowser();
return true ;
}

View File

@ -0,0 +1,50 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITYACS_H
#define MON_EDITYACS_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateYACS.h>
class HOMARD_EXPORT MonEditYACS : public MonCreateYACS
{
Q_OBJECT
public:
MonEditYACS( bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString Name );
virtual ~MonEditYACS();
protected :
virtual void InitValEdit();
virtual bool CreateOrUpdate();
public slots:
};
#endif

View File

@ -0,0 +1,432 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonEditZone.h"
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include <utilities.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
using namespace std;
// ------------------------------------------------------------------------
MonEditZone::MonEditZone( MonCreateHypothesis* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString Name ):
// ------------------------------------------------------------------------
/* Constructs a MonEditZone
herite de MonCreateZone
*/
MonCreateZone(parent, myHomardGen, caseName)
{
MESSAGE("Debut de MonEditZone pour " << Name.toStdString().c_str());
setWindowTitle(QObject::tr("HOM_ZONE_EDIT_WINDOW_TITLE"));
_Name=Name;
aZone = myHomardGen->GetZone(_Name.toStdString().c_str());
InitValEdit();
}
// ------------------------------------------------------------------------
MonEditZone::~MonEditZone()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonEditZone::InitValEdit()
// ------------------------------------------------------------------------
{
MESSAGE("InitValEdit ");
LEName->setText(_Name);
LEName->setReadOnly(true);
_Type = aZone->GetType();
MESSAGE("InitValEdit _Type ="<<_Type);
InitValZoneLimit();
if (_aCaseName != QString("")) InitValZone();
switch (_Type)
{
case 11 : // il s agit d un rectangle
{ }
case 12 : // il s agit d un rectangle
{ }
case 13 : // il s agit d un rectangle
{ }
case 2 : // il s agit d une boite
{
InitValZoneBox();
SetBox();
break;
}
case 4 : // il s agit d une sphere
{
InitValZoneSphere();
SetSphere();
break;
}
case 31 : // il s agit d un cercle issu d'un cylindre
{ }
case 32 : // il s agit d un cercle issu d'un cylindre
{ }
case 33 : // il s agit d un cercle issu d'un cylindre
{ }
case 5 : // il s agit d un cylindre
{
InitValZoneCylinder();
SetCylinder();
break;
}
case 61 : // il s agit d un disque avec trou issu d'un tuyau
{ }
case 62 : // il s agit d un disque avec trou issu d'un tuyau
{ }
case 63 : // il s agit d un disque avec trou issu d'un tuyau
{ }
case 7 : // il s agit d un tuyau
{
InitValZonePipe();
SetPipe();
break;
}
};
}
// ------------------------------------------------------------------------
void MonEditZone::InitValZoneLimit()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordLimits = aZone->GetLimit();
ASSERT(mesCoordLimits->length() == 3 );
_Xincr=mesCoordLimits[0];
_Yincr=mesCoordLimits[1];
_Zincr=mesCoordLimits[2];
}
// ------------------------------------------------------------------------
void MonEditZone::InitValZoneBox()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordZones = aZone->GetCoords();
ASSERT(mesCoordZones->length() == 6 );
_ZoneXmin=mesCoordZones[0];
_ZoneXmax=mesCoordZones[1];
_ZoneYmin=mesCoordZones[2];
_ZoneYmax=mesCoordZones[3];
_ZoneZmin=mesCoordZones[4];
_ZoneZmax=mesCoordZones[5];
}
// ------------------------------------------------------------------------
void MonEditZone::InitValZoneSphere()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordZones = aZone->GetCoords();
ASSERT(mesCoordZones->length() == 4 );
_ZoneXcentre=mesCoordZones[0];
_ZoneYcentre=mesCoordZones[1];
_ZoneZcentre=mesCoordZones[2];
_ZoneRayon=mesCoordZones[3];
}
// ------------------------------------------------------------------------
void MonEditZone::InitValZoneCylinder()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordZones = aZone->GetCoords();
ASSERT(mesCoordZones->length() == 8 );
_ZoneXcentre=mesCoordZones[0];
_ZoneYcentre=mesCoordZones[1];
_ZoneZcentre=mesCoordZones[2];
_ZoneXaxis=mesCoordZones[3];
_ZoneYaxis=mesCoordZones[4];
_ZoneZaxis=mesCoordZones[5];
_ZoneRayon=mesCoordZones[6];
_ZoneHaut=mesCoordZones[7];
}
// ------------------------------------------------------------------------
void MonEditZone::InitValZonePipe()
// ------------------------------------------------------------------------
{
HOMARD::double_array_var mesCoordZones = aZone->GetCoords();
ASSERT(mesCoordZones->length() == 9 );
_ZoneXcentre=mesCoordZones[0];
_ZoneYcentre=mesCoordZones[1];
_ZoneZcentre=mesCoordZones[2];
_ZoneXaxis=mesCoordZones[3];
_ZoneYaxis=mesCoordZones[4];
_ZoneZaxis=mesCoordZones[5];
_ZoneRayon=mesCoordZones[6];
_ZoneHaut=mesCoordZones[7];
_ZoneRayonInt=mesCoordZones[8];
}
// ------------------------------------------------------------------------
void MonEditZone::SetBox()
// ------------------------------------------------------------------------
{
MESSAGE("SetBox ");
gBBox->setVisible(1);
gBSphere->setVisible(0);
gBCylindre->setVisible(0) ;
gBPipe->setVisible(0) ;
RBBox->setChecked(1);
adjustSize();
RBCylinder->setDisabled(true);
RBPipe->setDisabled(true);
if ( _Type == 2 ) { RBSphere->setDisabled(true); }
else { RBSphere->setVisible(0);
RBPipe->setText(QApplication::translate("CreateZone", "Disk with hole", 0));
RBCylinder->setText(QApplication::translate("CreateZone", "Disk", 0));
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr() ;
QPixmap pix = resMgr->loadPixmap( "HOMARD", "boxdxy.png" ) ;
QIcon IS=QIcon(pix) ;
RBBox->setIcon(IS) ; }
adjustSize();
SpinBox_Xmini->setValue(_ZoneXmin);
SpinBox_Xmaxi->setValue(_ZoneXmax);
double incr ;
if ( _Xincr > 0 ) {incr=_Xincr;} else{incr=1.;}
SpinBox_Xmini->setSingleStep(incr);
SpinBox_Xmaxi->setSingleStep(incr);
SpinBox_Ymini->setValue(_ZoneYmin);
SpinBox_Ymaxi->setValue(_ZoneYmax);
if ( _Yincr > 0 ) {incr=_Yincr;} else{incr=1.;}
SpinBox_Ymini->setSingleStep(incr);
SpinBox_Ymaxi->setSingleStep(incr);
SpinBox_Zmini->setValue(_ZoneZmin);
SpinBox_Zmaxi->setValue(_ZoneZmax);
if ( _Zincr > 0 ) {incr=_Zincr;} else{incr=1.;}
SpinBox_Zmini->setSingleStep(incr);
SpinBox_Zmaxi->setSingleStep(incr);
if ( _Type == 12 ) { SpinBox_Xmini->setDisabled(true) ;
SpinBox_Xmaxi->setDisabled(true) ; }
else if ( _Type == 13 ) { SpinBox_Ymini->setDisabled(true) ;
SpinBox_Ymaxi->setDisabled(true) ; }
else if ( _Type == 11 ) { SpinBox_Zmini->setDisabled(true) ;
SpinBox_Zmaxi->setDisabled(true) ; }
}
// ------------------------------------------------------------------------
void MonEditZone::SetSphere()
// ------------------------------------------------------------------------
{
gBBox->setVisible(0);
gBSphere->setVisible(1);
gBCylindre->setVisible(0) ;
gBPipe->setVisible(0) ;
RBSphere->setChecked(1);
RBBox->setDisabled(true);
RBCylinder->setDisabled(true);
RBPipe->setDisabled(true);
adjustSize();
SpinBox_Xcentre->setValue(_ZoneXcentre);
if ( _Xincr > 0) { SpinBox_Xcentre->setSingleStep(_Xincr); }
else { SpinBox_Xcentre->setSingleStep(1) ; }
SpinBox_Ycentre->setValue(_ZoneYcentre);
if ( _Yincr > 0) { SpinBox_Ycentre->setSingleStep(_Yincr); }
else { SpinBox_Ycentre->setSingleStep(1) ; }
SpinBox_Zcentre->setValue(_ZoneZcentre);
if ( _Zincr > 0) { SpinBox_Zcentre->setSingleStep(_Zincr); }
else { SpinBox_Zcentre->setSingleStep(1);}
SpinBox_Rayon->setValue(_ZoneRayon);
}
// ------------------------------------------------------------------------
void MonEditZone::SetCylinder()
// ------------------------------------------------------------------------
{
MESSAGE("SetCylinder _Xincr ="<<_Xincr<< " _Yincr ="<<_Yincr<< " _Zincr ="<<_Zincr);
gBBox->setVisible(0);
gBSphere->setVisible(0);
gBCylindre->setVisible(1) ;
gBPipe->setVisible(0) ;
RBCylinder->setChecked(1);
RBBox->setDisabled(true);
RBPipe->setDisabled(true);
if ( _Type == 5 ) { RBSphere->setDisabled(true); }
else { RBSphere->setVisible(0);
RBPipe->setText(QApplication::translate("CreateZone", "Disk with hole", 0));
RBCylinder->setText(QApplication::translate("CreateZone", "Disk", 0));
TLXbase->setText(QApplication::translate("CreateZone", "X centre", 0));
TLYbase->setText(QApplication::translate("CreateZone", "Y centre", 0));
TLZbase->setText(QApplication::translate("CreateZone", "Z centre", 0));
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr() ;
QPixmap pix = resMgr->loadPixmap( "HOMARD", "disk.png" ) ;
QIcon IS=QIcon(pix) ;
RBCylinder->setIcon(IS) ; }
adjustSize();
SpinBox_Xbase->setValue(_ZoneXcentre);
if ( _Xincr > 0) { SpinBox_Xbase->setSingleStep(_Xincr); }
else { SpinBox_Xbase->setSingleStep(1) ; }
SpinBox_Ybase->setValue(_ZoneYcentre);
if ( _Yincr > 0) { SpinBox_Ybase->setSingleStep(_Yincr); }
else { SpinBox_Ybase->setSingleStep(1) ; }
SpinBox_Zbase->setValue(_ZoneZcentre);
if ( _Zincr > 0) { SpinBox_Zbase->setSingleStep(_Zincr); }
else { SpinBox_Zbase->setSingleStep(1) ;}
SpinBox_Radius->setValue(_ZoneRayon);
if ( _Type == 5 )
{ SpinBox_Xaxis->setValue(_ZoneXaxis) ;
SpinBox_Yaxis->setValue(_ZoneYaxis) ;
SpinBox_Zaxis->setValue(_ZoneZaxis) ;
SpinBox_Haut->setValue(_ZoneHaut) ;
}
else
{ SpinBox_Xaxis->setVisible(0) ;
SpinBox_Yaxis->setVisible(0) ;
SpinBox_Zaxis->setVisible(0) ;
SpinBox_Haut->setVisible(0) ;
TLXaxis->setVisible(0) ;
TLYaxis->setVisible(0) ;
TLZaxis->setVisible(0) ;
TLHaut->setVisible(0) ;
if ( _Type == 32 ) { SpinBox_Xbase->setDisabled(true) ; }
else if ( _Type == 33 ) { SpinBox_Ybase->setDisabled(true) ; }
else if ( _Type == 31 ) { SpinBox_Zbase->setDisabled(true) ; }
}
}
// ------------------------------------------------------------------------
void MonEditZone::SetPipe()
// ------------------------------------------------------------------------
{
MESSAGE("SetPipe _Xincr ="<<_Xincr<< " _Yincr ="<<_Yincr<< " _Zincr ="<<_Zincr);
gBBox->setVisible(0);
gBSphere->setVisible(0);
gBCylindre->setVisible(0) ;
gBPipe->setVisible(1) ;
RBPipe->setChecked(1);
RBBox->setDisabled(true);
RBCylinder->setDisabled(true);
if ( _Type == 7 ) { RBSphere->setDisabled(true); }
else { RBSphere->setVisible(0);
RBPipe->setText(QApplication::translate("CreateZone", "Disk with hole", 0));
RBCylinder->setText(QApplication::translate("CreateZone", "Disk", 0));
TLXbase_p->setText(QApplication::translate("CreateZone", "X centre", 0));
TLYbase_p->setText(QApplication::translate("CreateZone", "Y centre", 0));
TLZbase_p->setText(QApplication::translate("CreateZone", "Z centre", 0));
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr() ;
QPixmap pix = resMgr->loadPixmap( "HOMARD", "diskwithhole.png" ) ;
QIcon IS=QIcon(pix) ;
RBPipe->setIcon(IS) ; }
adjustSize();
SpinBox_Xbase_p->setValue(_ZoneXcentre);
if ( _Xincr > 0) { SpinBox_Xbase_p->setSingleStep(_Xincr); }
else { SpinBox_Xbase_p->setSingleStep(1) ; }
SpinBox_Ybase_p->setValue(_ZoneYcentre);
if ( _Yincr > 0) { SpinBox_Ybase_p->setSingleStep(_Yincr); }
else { SpinBox_Ybase_p->setSingleStep(1) ; }
SpinBox_Zbase_p->setValue(_ZoneZcentre);
if ( _Zincr > 0) { SpinBox_Zbase_p->setSingleStep(_Zincr); }
else { SpinBox_Zbase_p->setSingleStep(1) ;}
SpinBox_Radius_int->setValue(_ZoneRayonInt);
SpinBox_Radius_ext->setValue(_ZoneRayon);
if ( _Type == 7 )
{ SpinBox_Xaxis_p->setValue(_ZoneXaxis) ;
SpinBox_Yaxis_p->setValue(_ZoneYaxis) ;
SpinBox_Zaxis_p->setValue(_ZoneZaxis) ;
SpinBox_Haut_p->setValue(_ZoneHaut) ;
}
else
{ SpinBox_Xaxis_p->setVisible(0) ;
SpinBox_Yaxis_p->setVisible(0) ;
SpinBox_Zaxis_p->setVisible(0) ;
SpinBox_Haut_p->setVisible(0) ;
TLXaxis_p->setVisible(0) ;
TLYaxis_p->setVisible(0) ;
TLZaxis_p->setVisible(0) ;
TLHaut_p->setVisible(0) ;
if ( _Type == 62 ) { SpinBox_Xbase_p->setDisabled(true) ; }
else if ( _Type == 63 ) { SpinBox_Ybase_p->setDisabled(true) ; }
else if ( _Type == 61 ) { SpinBox_Zbase_p->setDisabled(true) ; }
}
}
// ---------------------------------------------------
bool MonEditZone::CreateOrUpdateZone()
//----------------------------------------------------
// Pas de Creation de la zone
// Mise a jour des attributs de la Zone
{
try
{
switch (_Type)
{
case 11 : // il s agit d un rectangle
{ }
case 12 : // il s agit d un rectangle
{ }
case 13 : // il s agit d un rectangle
{ }
case 2 : // il s agit d un parallelepipede
{ aZone->SetBox( _ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax );
break;
}
case 4 : // il s agit d une sphere
{ aZone->SetSphere( _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneRayon );
break;
}
case 31 : // il s agit d un disque issu d'un cylindre
{ }
case 32 : // il s agit d un disque issu d'un cylindre
{ }
case 33 : // il s agit d un disque issu d'un cylindre
{ }
case 5 : // il s agit d un cylindre
{ aZone->SetCylinder( _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut );
break;
}
case 61 : // il s agit d un disque issu d'un cylindre
{ }
case 62 : // il s agit d un disque issu d'un cylindre
{ }
case 63 : // il s agit d un disque issu d'un cylindre
{ }
case 7 : // il s agit d un tuyau
{ aZone->SetPipe( _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut, _ZoneRayonInt );
break;
}
}
if (Chgt) myHomardGen->InvalideZone(_Name.toStdString().c_str());
HOMARD_UTILS::updateObjBrowser();
}
catch( const SALOME::SALOME_Exception& S_ex ) {
SalomeApp_Tools::QtCatchCorbaException( S_ex );
return false;
}
return true;
}

View File

@ -0,0 +1,59 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_EDITZONE_H
#define MON_EDITZONE_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include <MonCreateZone.h>
class HOMARD_EXPORT MonEditZone : public MonCreateZone
{
Q_OBJECT
public:
MonEditZone( MonCreateHypothesis* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
QString caseName, QString Name);
virtual ~MonEditZone();
protected :
void SetBox();
void SetSphere();
void SetCylinder();
void SetPipe();
bool CreateOrUpdateZone();
void InitValEdit();
void InitValZoneLimit();
void InitValZoneBox();
void InitValZoneSphere();
void InitValZoneCylinder();
void InitValZonePipe();
public slots:
};
#endif // MON_EDITZONE_H

View File

@ -0,0 +1,175 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonIterInfo.h"
#include <QFile>
#include <QTextStream>
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include "MonEditFile.h"
#include <utilities.h>
using namespace std;
// -----------------------------------------------------------------------------------------
MonIterInfo::MonIterInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, QString IterName)
// -----------------------------------------------------------------------------------------
/* Constructs a MonIterInfo
* Inherits from CasHomard
* Sets attributes to default values
*/
:
Ui_IterInfo(),
_IterName(IterName),
_aCaseName(""),
_BlockSize(0),
_Connection(0),
_Diametre(0),
_Entanglement(0),
_Quality(0),
_Option(-1)
{
MESSAGE("appel de _duplicate");
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
setModal(modal);
InitConnect();
adjustSize();
}
// ------------------------------------------------------------------------
MonIterInfo::~MonIterInfo()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonIterInfo::InitConnect()
// ------------------------------------------------------------------------
{
MESSAGE("InitConnect");
connect( CBBlockSize, SIGNAL(stateChanged(int)), this, SLOT(SetBlockSize()));
connect( CBConnection, SIGNAL(stateChanged(int)), this, SLOT(SetConnection()));
connect( CBDiametre, SIGNAL(stateChanged(int)), this, SLOT(SetDiametre()));
connect( CBEntanglement, SIGNAL(stateChanged(int)), this, SLOT(SetEntanglement()));
connect( CBQuality, SIGNAL(stateChanged(int)), this, SLOT(SetQuality()));
connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply()));
connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp()));
}
// -------------------------------
bool MonIterInfo::PushOnApply()
// --------------------------------
{
MESSAGE("PushOnApply");
// Au moins une option a ete choisie
if ( ( _Quality == 0 ) && ( _Diametre == 0 ) && ( _Connection == 0 ) && ( _BlockSize == 0 ) && ( _Entanglement == 0 ) )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MESH_INFO_1") );
return false;
}
// Recuperation de l'iteration
aIter = myHomardGen->GetIteration(_IterName.toStdString().c_str()) ;
// Lancement de l'analyse
try
{
aIter->MeshInfoOption( _Quality, _Diametre, _Connection, _BlockSize, _Entanglement, _Option );
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false;
}
// Le bilan de l'analyse a afficher
QString aFileName = aIter->GetFileInfo() ;
MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), aFileName, 0 ) ;
if ( aDlg->_codret == 0 ) { aDlg->show(); }
HOMARD_UTILS::updateObjBrowser();
return true;
}
// ---------------------------
void MonIterInfo::PushOnOK()
// ---------------------------
{
bool bOK = PushOnApply();
if ( bOK ) this->close();
}
//------------------------------
void MonIterInfo::PushOnHelp()
//-------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_mesh_info.html"), QString(""), QString(LanguageShort.c_str()));
}
// ------------------------------------------------------------------------
void MonIterInfo::SetBlockSize()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetBlockSize ");
if ( CBBlockSize->isChecked() ) { _BlockSize = 1 ; }
else { _BlockSize = 0 ; }
}
// ------------------------------------------------------------------------
void MonIterInfo::SetConnection()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetConnection ");
if ( CBConnection->isChecked() ) { _Connection = 1 ; }
else { _Connection = 0 ; }
}
// ------------------------------------------------------------------------
void MonIterInfo::SetDiametre()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetDiametre ");
if ( CBDiametre->isChecked() ) { _Diametre = 1 ; }
else { _Diametre = 0 ; }
}
// ------------------------------------------------------------------------
void MonIterInfo::SetEntanglement()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetEntanglement ");
if ( CBEntanglement->isChecked() ) { _Entanglement = 1 ; }
else { _Entanglement = 0 ; }
}
// ------------------------------------------------------------------------
void MonIterInfo::SetQuality()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetQuality ");
if ( CBQuality->isChecked() ) { _Quality = 1 ; }
else { _Quality = 0 ; }
}

View File

@ -0,0 +1,78 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_ITERINFO_H
#define MON_ITERINFO_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include "ui_IterInfo.h"
#include <QDialog>
#include <QWidget>
class QListBox;
class HOMARD_EXPORT MonIterInfo : public QDialog, public Ui_IterInfo
{
Q_OBJECT
public:
MonIterInfo( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString IterName);
~MonIterInfo();
protected :
MonIterInfo( QWidget* parent, HOMARD::HOMARD_Gen_var myHomardGen, QString IterName );
QString _IterName;
QString _aCaseName;
int _BlockSize;
int _Connection;
int _Diametre;
int _Entanglement;
int _Quality;
int _Option;
HOMARD::HOMARD_Iteration_var aIter ;
HOMARD::HOMARD_Gen_var myHomardGen;
virtual void InitConnect();
public slots:
virtual void SetBlockSize();
virtual void SetConnection();
virtual void SetEntanglement();
virtual void SetDiametre();
virtual void SetQuality();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_ITERINFO_H

View File

@ -0,0 +1,281 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonMeshInfo.h"
#include "HOMARD.hxx"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include "MonEditFile.h"
#include <utilities.h>
#ifdef WIN32
#include <direct.h>
#endif
using namespace std;
// -----------------------------------------------------------------------------------------
MonMeshInfo::MonMeshInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0)
// -----------------------------------------------------------------------------------------
/* Constructs a MonMeshInfo
* Inherits from CasHomard
* Sets attributes to default values
*/
:
Ui_MeshInfo(),
_aCaseName(""),_aDirName(""),
_BlockSize(0),
_Connection(0),
_Diametre(0),
_Entanglement(0),
_Quality(0)
{
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
setModal(modal);
InitConnect();
SetNewCaseName() ;
adjustSize();
}
// ------------------------------------------------------------------------
MonMeshInfo::~MonMeshInfo()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonMeshInfo::InitConnect()
// ------------------------------------------------------------------------
{
connect( LECaseName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged()));
connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName()));
connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName()));
connect( CBBlockSize, SIGNAL(stateChanged(int)), this, SLOT(SetBlockSize()));
connect( CBConnection, SIGNAL(stateChanged(int)), this, SLOT(SetConnection()));
connect( CBDiametre, SIGNAL(stateChanged(int)), this, SLOT(SetDiametre()));
connect( CBEntanglement, SIGNAL(stateChanged(int)), this, SLOT(SetEntanglement()));
connect( CBQuality, SIGNAL(stateChanged(int)), this, SLOT(SetQuality()));
connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply()));
connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp()));
}
// -------------------------------
bool MonMeshInfo::PushOnApply()
// --------------------------------
{
MESSAGE("PushOnApply");
QString aCaseName=LECaseName->text().trimmed();
if ( aCaseName == "" )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_NAME") );
return false;
}
QString aDirName=LEDirName->text().trimmed();
if (aDirName == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_1") );
return false;
}
if ( aDirName != _aDirName)
{ QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ;
if ( CaseNameDir != "" )
{
QString texte ;
texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ;
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
texte );
return false;
}
}
if (CHDIR(aDirName.toStdString().c_str()) != 0)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_3") );
return false;
}
QString aFileName=LEFileName->text().trimmed();
if (aFileName ==QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_MESH") );
return false;
}
QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName);
if (aMeshName == "" )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MED_FILE_2") );
return false;
}
if ( ( _Quality == 0 ) && ( _Diametre == 0 ) && ( _Connection == 0 ) && ( _BlockSize == 0 ) && ( _Entanglement == 0 ) )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_MESH_INFO") );
return false;
}
if (aCaseName != _aCaseName )
{
_aCaseName = aCaseName;
try
{
myHomardGen->MeshInfo( \
CORBA::string_dup(_aCaseName.toStdString().c_str()), \
CORBA::string_dup(aMeshName.toStdString().c_str()), \
CORBA::string_dup(aFileName.toStdString().c_str()), \
CORBA::string_dup(aDirName.toStdString().c_str()), \
_Quality, _Diametre, _Connection, _BlockSize, _Entanglement );
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false;
}
}
// Le bilan de l'analyse a afficher
aCase = myHomardGen->GetCase(_aCaseName.toStdString().c_str());
string iter0 = aCase->GetIter0Name();
HOMARD::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(iter0.c_str());
aFileName = aIter->GetFileInfo() ;
MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), aFileName, 1 ) ;
if ( aDlg->_codret == 0 ) { aDlg->show(); }
HOMARD_UTILS::updateObjBrowser();
return true;
}
// ---------------------------
void MonMeshInfo::PushOnOK()
// ---------------------------
{
bool bOK = PushOnApply();
if ( bOK ) this->close();
}
//------------------------------
void MonMeshInfo::PushOnHelp()
//-------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str()));
}
// ---------------------------------
void MonMeshInfo::SetNewCaseName()
// ------------------------------
{
HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName();
int num = 0; QString aCaseName="";
while (aCaseName=="" )
{
aCaseName.setNum(num+1) ;
aCaseName.insert(0, QString("Case_")) ;
for ( int i=0; i<MyCases->length(); i++)
{
if ( aCaseName == QString((MyCases)[i]) )
{
num ++ ;
aCaseName = "" ;
break ;
}
}
}
LECaseName->clear() ;
LECaseName->insert(aCaseName);
}
// ------------------------------------------------------------------------
void MonMeshInfo::SetDirName()
// ------------------------------------------------------------------------
{
QString aDirName=QFileDialog::getExistingDirectory ();
if (!(aDirName.isEmpty()))LEDirName->setText(aDirName);
}
// ------------------------------------------------------------------------
void MonMeshInfo::SetFileName()
// ------------------------------------------------------------------------
{
QString fileName0 = LEFileName->text().trimmed();
QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ;
if (fileName.isEmpty()) fileName = fileName0 ;
LEFileName->setText(fileName);
}
// ------------------------------------------------------------------------
void MonMeshInfo::CaseNameChanged()
// ------------------------------------------------------------------------
{
if (_aCaseName != LECaseName->text().trimmed())
{
LEFileName->setReadOnly(false);
PushFichier->show();
}
}
// ------------------------------------------------------------------------
void MonMeshInfo::SetBlockSize()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetBlockSize ");
if ( CBBlockSize->isChecked() ) { _BlockSize = 1 ; }
else { _BlockSize = 0 ; }
}
// ------------------------------------------------------------------------
void MonMeshInfo::SetConnection()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetConnection ");
if ( CBConnection->isChecked() ) { _Connection = 1 ; }
else { _Connection = 0 ; }
}
// ------------------------------------------------------------------------
void MonMeshInfo::SetDiametre()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetDiametre ");
if ( CBDiametre->isChecked() ) { _Diametre = 1 ; }
else { _Diametre = 0 ; }
}
// ------------------------------------------------------------------------
void MonMeshInfo::SetEntanglement()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetEntanglement ");
if ( CBEntanglement->isChecked() ) { _Entanglement = 1 ; }
else { _Entanglement = 0 ; }
}
// ------------------------------------------------------------------------
void MonMeshInfo::SetQuality()
// ------------------------------------------------------------------------
{
MESSAGE("Debut de SetQuality ");
if ( CBQuality->isChecked() ) { _Quality = 1 ; }
else { _Quality = 0 ; }
}

View File

@ -0,0 +1,76 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_MESHINFO_H
#define MON_MESHINFO_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include "ui_MeshInfo.h"
#include <QWidget>
class HOMARD_EXPORT MonMeshInfo : public QDialog, public Ui_MeshInfo
{
Q_OBJECT
public:
MonMeshInfo( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen);
~MonMeshInfo();
protected :
QString _aCaseName;
QString _aDirName;
int _BlockSize;
int _Connection;
int _Diametre;
int _Entanglement;
int _Quality;
HOMARD::HOMARD_Cas_var aCase ;
HOMARD::HOMARD_Gen_var myHomardGen;
virtual void InitConnect();
virtual void SetNewCaseName();
public slots:
virtual void SetDirName();
virtual void SetFileName();
virtual void SetBlockSize();
virtual void SetConnection();
virtual void SetEntanglement();
virtual void SetDiametre();
virtual void SetQuality();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
virtual void CaseNameChanged();
};
#endif // MON_MESHINFO_H

View File

@ -0,0 +1,288 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#include "MonPursueIteration.h"
#include "HOMARD.hxx"
#include <QFileDialog>
#include <QMessageBox>
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
#include <utilities.h>
#ifdef WIN32
#include <direct.h>
#endif
using namespace std;
// -----------------------------------------------------------------------------------------
/* Constructs a MonPursueIteration
* Sets attributes to default values
*/
// -----------------------------------------------------------------------------------------
MonPursueIteration::MonPursueIteration ( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 )
:
Ui_PursueIteration(),
_aCaseName(""), _aDirName(""), _aDirNameStart("")
{
MESSAGE("Debut du constructeur de MonPursueIteration");
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
setModal(modal);
InitConnect();
SetNewCaseName() ;
_Type = 1 ;
GBIterationintoCase->setVisible(0);
SpinBoxNumber->setVisible(0);
adjustSize();
MESSAGE("Fin du constructeur de MonPursueIteration");
}
// ------------------------------------------------------------------------
MonPursueIteration::~MonPursueIteration()
// ------------------------------------------------------------------------
{
// no need to delete child widgets, Qt does it all for us
}
// ------------------------------------------------------------------------
void MonPursueIteration::InitConnect()
// ------------------------------------------------------------------------
{
connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName()));
connect( RBIteration, SIGNAL(clicked()), this, SLOT(FromIteration()));
connect( RBCase, SIGNAL(clicked()), this, SLOT(FromCase()));
connect( PushDirStart, SIGNAL(pressed()), this, SLOT(SetDirNameStart()));
connect( RBCaseLastIteration, SIGNAL(clicked()), this, SLOT(CaseLastIteration()));
connect( RBCaseNIteration, SIGNAL(clicked()), this, SLOT(CaseNIteration()));
connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply()));
connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp()));
}
// -------------------------------
bool MonPursueIteration::PushOnApply()
// --------------------------------
{
MESSAGE("PushOnApply");
// 1. Enregistrement du repertoire du cas
QString aDirName=LEDirName->text().trimmed();
if (aDirName == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_1") );
return false;
}
if ( aDirName != _aDirName)
{ QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ;
if ( CaseNameDir != "" )
{
QString texte ;
texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ;
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
texte );
return false;
}
}
if (CHDIR(aDirName.toStdString().c_str()) != 0)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_3") );
return false;
}
// 2. Enregistrement du repertoire de depart
QString aDirNameStart=LEDirNameStart->text().trimmed();
if (aDirNameStart == QString(""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_START_DIRECTORY_1") );
return false;
}
if (CHDIR(aDirNameStart.toStdString().c_str()) != 0)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_START_DIRECTORY_3") );
return false;
}
// 3. Enregistrement du numero d'iteration
int Number ;
if ( _Type == 3 ) { Number = SpinBoxNumber->value() ; }
// 4. Creation du cas
QString _aCaseName=LECaseName->text().trimmed();
_aDirNameStart=aDirNameStart;
MESSAGE("_aCaseName = "<<_aCaseName.toStdString().c_str());
MESSAGE("_aDirNameStart = "<<_aDirNameStart.toStdString().c_str());
MESSAGE("_Type = "<<_Type);
switch (_Type)
{
case 1 : // Poursuite a partir d'une iteration
{
try
{
MESSAGE("Poursuite a partir d'une iteration");
aCase = myHomardGen->CreateCaseFromIteration( \
CORBA::string_dup(_aCaseName.toStdString().c_str()), \
CORBA::string_dup(_aDirNameStart.toStdString().c_str()) );
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false ;
}
break;
}
case 2 : // Poursuite a partir de la derniere iteration dans un cas
{
try
{
MESSAGE("Poursuite a partir de la derniere iteration dans un cas");
aCase = myHomardGen->CreateCaseFromCaseLastIteration( \
CORBA::string_dup(_aCaseName.toStdString().c_str()), \
CORBA::string_dup(_aDirNameStart.toStdString().c_str()) );
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false ;
}
break;
}
case 3 : // Poursuite a partir d'une iteration dans un cas
{
try
{
MESSAGE("Poursuite a partir d'une iteration dans un cas");
aCase = myHomardGen->CreateCaseFromCaseIteration( \
CORBA::string_dup(_aCaseName.toStdString().c_str()), \
CORBA::string_dup(_aDirNameStart.toStdString().c_str()), \
Number );
}
catch( SALOME::SALOME_Exception& S_ex )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
return false ;
}
break;
}
}
aCase->SetDirName(aDirName.toStdString().c_str());
_aDirName=aDirName;
HOMARD_UTILS::updateObjBrowser();
return true;
}
// ---------------------------
void MonPursueIteration::PushOnOK()
// ---------------------------
{
bool bOK = PushOnApply();
if ( bOK ) this->close();
}
//------------------------------
void MonPursueIteration::PushOnHelp()
//-------------------------------
{
std::string LanguageShort = myHomardGen->GetLanguageShort();
HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str()));
}
// ---------------------------------
void MonPursueIteration::SetNewCaseName()
// ------------------------------
{
HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName();
int num = 0; QString aCaseName="";
while (aCaseName=="" )
{
aCaseName.setNum(num+1) ;
aCaseName.insert(0, QString("Case_")) ;
for ( int i=0; i<MyCases->length(); i++)
{
if ( aCaseName == QString((MyCases)[i]))
{
num ++ ;
aCaseName = "" ;
break ;
}
}
}
LECaseName->clear() ;
LECaseName->insert(aCaseName);
}
// ------------------------------------------------------------------------
void MonPursueIteration::SetDirName()
// ------------------------------------------------------------------------
{
QString aDirName=QFileDialog::getExistingDirectory ();
if (!(aDirName.isEmpty()))LEDirName->setText(aDirName);
}
// ------------------------------------------------------------------------
void MonPursueIteration::SetDirNameStart()
// ------------------------------------------------------------------------
{
QString aDirName=QFileDialog::getExistingDirectory ();
if (!(aDirName.isEmpty()))LEDirNameStart->setText(aDirName);
}
// ------------------------------------------------------------------------
void MonPursueIteration::FromIteration()
// ------------------------------------------------------------------------
{
GBIterationintoCase->setVisible(0);
SpinBoxNumber->setVisible(0);
_Type = 1 ;
adjustSize();
}
// ------------------------------------------------------------------------
void MonPursueIteration::FromCase()
// ------------------------------------------------------------------------
{
GBIterationintoCase->setVisible(1);
CaseLastIteration();
}
// ------------------------------------------------------------------------
void MonPursueIteration::CaseLastIteration()
// ------------------------------------------------------------------------
{
SpinBoxNumber->setVisible(0);
_Type = 2 ;
adjustSize();
}
// ------------------------------------------------------------------------
void MonPursueIteration::CaseNIteration()
// ------------------------------------------------------------------------
{
SpinBoxNumber->setVisible(1);
_Type = 3 ;
adjustSize();
}

View File

@ -0,0 +1,72 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
#ifndef MON_PURSUEITERATION_H
#define MON_PURSUEITERATION_H
#include "HOMARDGUI_Exports.hxx"
#include <SALOMEconfig.h>
#include <SalomeApp_Module.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(HOMARD_Gen)
#include CORBA_CLIENT_HEADER(HOMARD_Cas)
#include "ui_PursueIteration.h"
#include <QWidget>
class HOMARD_EXPORT MonPursueIteration : public QDialog, public Ui_PursueIteration
{
Q_OBJECT
public:
MonPursueIteration( bool modal, HOMARD::HOMARD_Gen_var myHomardGen );
virtual ~MonPursueIteration();
protected :
QString _aCaseName;
QString _aDirName;
QString _aDirNameStart;
int _Type ;
HOMARD::HOMARD_Cas_var aCase ;
HOMARD::HOMARD_Gen_var myHomardGen;
virtual void InitConnect();
virtual void SetNewCaseName();
public slots:
virtual void SetDirName();
virtual void FromIteration();
virtual void FromCase();
virtual void SetDirNameStart();
virtual void CaseLastIteration();
virtual void CaseNIteration();
virtual void PushOnOK();
virtual bool PushOnApply();
virtual void PushOnHelp();
};
#endif // MON_PURSUEITERATION_H

View File

@ -0,0 +1,252 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PursueIteration</class>
<widget class="QDialog" name="PursueIteration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>601</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Pursue an iteration</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="Name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LECaseName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="3">
<layout class="QHBoxLayout" name="_2">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="Directory">
<property name="text">
<string>Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PushDir">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LEDirName">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="RBIteration">
<property name="text">
<string>From an iteration</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QRadioButton" name="RBCase">
<property name="text">
<string>From a case</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="DirectoryStart">
<property name="text">
<string>Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PushDirStart">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LEDirNameStart">
<property name="minimumSize">
<size>
<width>382</width>
<height>21</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="GBIterationintoCase">
<property name="title">
<string>Iteration into the case</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="RBCaseLastIteration">
<property name="text">
<string>Last iteration</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="RBCaseNIteration">
<property name="text">
<string>Iteration number</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="SpinBoxNumber">
<property name="maximum">
<number>1789</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QGroupBox" name="GroupButtons">
<property name="title">
<string/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="4">
<widget class="QPushButton" name="buttonHelp">
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonApply">
<property name="text">
<string>Apply</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="buttonCancel">
<property name="text">
<string>Cancel</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="2">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>128</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,93 @@
# Copyright (C) 2012-2020 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, or (at your option) any later version.
#
# 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
#
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
${OMNIORB_INCLUDE_DIR}
${KERNEL_INCLUDE_DIRS}
${MEDFILE_INCLUDE_DIRS}
${SMESH_INCLUDE_DIRS}
${GEOM_INCLUDE_DIRS}
${HDF5_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/idl
${PROJECT_BINARY_DIR}/adm_local/unix
${PROJECT_SOURCE_DIR}/src/FrontTrack
${PROJECT_SOURCE_DIR}/src/ADAPT
${PROJECT_SOURCE_DIR}/src/ADAPTGUI
)
# additional preprocessor / compiler flags
ADD_DEFINITIONS(
${OMNIORB_DEFINITIONS}
)
# libraries to link to
SET(_link_LIBRARIES
${MEDFILE_C_LIBRARIES}
${KERNEL_SalomeContainer}
${KERNEL_SalomeNS}
${KERNEL_Registry}
${KERNEL_SalomeHDFPersist}
${KERNEL_SalomeLifeCycleCORBA}
${KERNEL_TOOLSDS}
${KERNEL_SalomeGenericObj}
${SMESH_SalomeIDLSMESH}
${SMESH_SMESHEngine}
FrontTrack
SalomeIDLADAPT
ADAPTImpl
)
# --- headers ---
# header files / no moc processing
SET(ADAPTEngine_HEADERS
HOMARD_Cas_i.hxx
HOMARD_Hypothesis_i.hxx
HOMARD_Iteration_i.hxx
HOMARD_Zone_i.hxx
HOMARD_Gen_i.hxx
HOMARD_Boundary_i.hxx
HOMARD_YACS_i.hxx
HomardMedCommun.h
HOMARD_i.hxx
)
# --- sources ---
# sources / static
SET(ADAPTEngine_SOURCES
HOMARD_Cas_i.cxx
HOMARD_Hypothesis_i.cxx
HOMARD_Iteration_i.cxx
HOMARD_Gen_i.cxx
HOMARD_Zone_i.cxx
HOMARD_Boundary_i.cxx
HOMARD_YACS_i.cxx
HomardMedCommun.cxx
)
# --- rules ---
ADD_LIBRARY(ADAPTEngine ${ADAPTEngine_SOURCES})
TARGET_LINK_LIBRARIES(ADAPTEngine ${_link_LIBRARIES} )
INSTALL(TARGETS ADAPTEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${ADAPTEngine_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})

View File

@ -0,0 +1,262 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
//
#include "HOMARD_Boundary_i.hxx"
#include "HOMARD_Gen_i.hxx"
#include "HOMARD_Boundary.hxx"
#include "HOMARD_DriverTools.hxx"
#include "utilities.h"
//=============================================================================
/*!
* standard constructor
*/
//=============================================================================
HOMARD_Boundary_i::HOMARD_Boundary_i()
{
MESSAGE( "Default constructor, not for use" );
ASSERT( 0 );
}
//=============================================================================
/*!
* standard constructor
*/
//=============================================================================
HOMARD_Boundary_i::HOMARD_Boundary_i( CORBA::ORB_ptr orb,
HOMARD::HOMARD_Gen_var engine )
{
MESSAGE( "HOMARD_Boundary_i" );
_gen_i = engine;
_orb = orb;
myHomardBoundary = new ::HOMARD_Boundary();
ASSERT( myHomardBoundary );
}
//=============================================================================
/*!
* standard destructor
*/
//=============================================================================
HOMARD_Boundary_i::~HOMARD_Boundary_i()
{
}
//=============================================================================
//=============================================================================
// Generalites
//=============================================================================
//=============================================================================
void HOMARD_Boundary_i::SetName( const char* Name )
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetName( Name );
}
//=============================================================================
char* HOMARD_Boundary_i::GetName()
{
ASSERT( myHomardBoundary );
return CORBA::string_dup( myHomardBoundary->GetName().c_str() );
}
//=============================================================================
CORBA::Long HOMARD_Boundary_i::Delete()
{
ASSERT( myHomardBoundary );
char* BoundaryName = GetName() ;
MESSAGE ( "Delete : destruction de la frontiere " << BoundaryName );
return _gen_i->DeleteBoundary(BoundaryName) ;
}
//=============================================================================
char* HOMARD_Boundary_i::GetDumpPython()
{
ASSERT( myHomardBoundary );
return CORBA::string_dup( myHomardBoundary->GetDumpPython().c_str() );
}
//=============================================================================
std::string HOMARD_Boundary_i::Dump() const
{
return HOMARD::Dump( *myHomardBoundary );
}
//=============================================================================
bool HOMARD_Boundary_i::Restore( const std::string& stream )
{
return HOMARD::Restore( *myHomardBoundary, stream );
}
//=============================================================================
//=============================================================================
// Caracteristiques
//=============================================================================
//=============================================================================
void HOMARD_Boundary_i::SetType( CORBA::Long Type )
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetType( Type );
}
//=============================================================================
CORBA::Long HOMARD_Boundary_i::GetType()
{
ASSERT( myHomardBoundary );
return CORBA::Long( myHomardBoundary->GetType() );
}
//=============================================================================
void HOMARD_Boundary_i::SetMeshName( const char* MeshName )
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetMeshName( MeshName );
}
//=============================================================================
char* HOMARD_Boundary_i::GetMeshName()
{
ASSERT( myHomardBoundary );
return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() );
}
//=============================================================================
void HOMARD_Boundary_i::SetDataFile( const char* DataFile )
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetDataFile( DataFile );
int PublisMeshIN = _gen_i->GetPublisMeshIN () ;
if ( PublisMeshIN != 0 ) { _gen_i->PublishResultInSmesh(DataFile, 0); }
}
//=============================================================================
char* HOMARD_Boundary_i::GetDataFile()
{
ASSERT( myHomardBoundary );
return CORBA::string_dup( myHomardBoundary->GetDataFile().c_str() );
}
//=============================================================================
void HOMARD_Boundary_i::SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 )
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetCylinder( X0, X1, X2, X3, X4, X5, X6 );
}
//=============================================================================
void HOMARD_Boundary_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double rayon )
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetSphere( Xcentre, Ycentre, ZCentre, rayon );
}
//=============================================================================
void HOMARD_Boundary_i::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2)
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 );
}
//=============================================================================
void HOMARD_Boundary_i::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, double Xcentre, double Ycentre, double Zcentre)
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre );
}
//=============================================================================
void HOMARD_Boundary_i::SetTorus( double X0, double X1, double X2, double X3, double X4, double X5, double X6, double X7 )
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetTorus( X0, X1, X2, X3, X4, X5, X6, X7 );
}
//=============================================================================
HOMARD::double_array* HOMARD_Boundary_i::GetCoords()
{
ASSERT( myHomardBoundary );
HOMARD::double_array_var aResult = new HOMARD::double_array();
std::vector<double> mesCoor = myHomardBoundary->GetCoords();
aResult->length( mesCoor .size() );
std::vector<double>::const_iterator it;
int i = 0;
for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
aResult[i++] = (*it);
return aResult._retn();
}
//=============================================================================
void HOMARD_Boundary_i::SetLimit( double Xincr, double Yincr, double Zincr )
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetLimit( Xincr, Yincr, Zincr );
}
//=============================================================================
HOMARD::double_array* HOMARD_Boundary_i::GetLimit()
{
ASSERT( myHomardBoundary );
HOMARD::double_array_var aResult = new HOMARD::double_array();
std::vector<double> mesCoor = myHomardBoundary->GetLimit();
aResult->length( mesCoor .size() );
std::vector<double>::const_iterator it;
int i = 0;
for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
aResult[i++] = (*it);
return aResult._retn();
}
//=============================================================================
void HOMARD_Boundary_i::AddGroup( const char* Group)
{
ASSERT( myHomardBoundary );
myHomardBoundary->AddGroup( Group );
}
//=============================================================================
void HOMARD_Boundary_i::SetGroups(const HOMARD::ListGroupType& ListGroup)
{
ASSERT( myHomardBoundary );
std::list<std::string> ListString;
for ( int i = 0; i < ListGroup.length(); i++ )
{
ListString.push_back(std::string(ListGroup[i]));
}
myHomardBoundary->SetGroups( ListString );
}
//=============================================================================
HOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups()
{
ASSERT( myHomardBoundary );
const std::list<std::string>& ListString = myHomardBoundary->GetGroups();
HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType;
aResult->length( ListString.size() );
std::list<std::string>::const_iterator it;
int i = 0;
for ( it = ListString.begin(); it != ListString.end(); it++ )
{
aResult[i++] = CORBA::string_dup( (*it).c_str() );
}
return aResult._retn();
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
void HOMARD_Boundary_i::SetCaseCreation( const char* NomCaseCreation )
{
ASSERT( myHomardBoundary );
myHomardBoundary->SetCaseCreation( NomCaseCreation );
}
//=============================================================================
char* HOMARD_Boundary_i::GetCaseCreation()
{
ASSERT( myHomardBoundary );
return CORBA::string_dup( myHomardBoundary->GetCaseCreation().c_str() );
}

View File

@ -0,0 +1,112 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
//
#ifndef _HOMARD_Boundary_I_HXX_
#define _HOMARD_Boundary_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(HOMARD_Gen)
#include CORBA_SERVER_HEADER(HOMARD_Boundary)
#include "HOMARD_i.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
#include "Utils_CorbaException.hxx"
#include <string>
class HOMARD_Boundary;
class HOMARDENGINE_EXPORT HOMARD_Boundary_i:
public virtual Engines_Component_i,
public virtual POA_HOMARD::HOMARD_Boundary,
public virtual PortableServer::ServantBase
{
public:
HOMARD_Boundary_i( CORBA::ORB_ptr orb, HOMARD::HOMARD_Gen_var gen_i );
HOMARD_Boundary_i();
virtual ~HOMARD_Boundary_i();
// Generalites
void SetName( const char* Name );
char* GetName();
CORBA::Long Delete();
char* GetDumpPython();
std::string Dump() const;
bool Restore( const std::string& stream );
// Caracteristiques
void SetType( CORBA::Long Type );
CORBA::Long GetType();
void SetMeshName( const char* MeshName );
char* GetMeshName();
void SetDataFile( const char* DataFile );
char* GetDataFile();
void SetCylinder( double Xcentre, double Ycentre, double ZCentre,
double Xaxe, double Yaxe, double Zaxe,
double rayon );
void SetSphere( double Xcentre, double Ycentre, double ZCentre,
double rayon );
void SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2);
void SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
double Xcentre, double Ycentre, double ZCentre);
void SetTorus( double Xcentre, double Ycentre, double ZCentre,
double Xaxe, double Yaxe, double Zaxe,
double rayonRev, double rayonPri );
HOMARD::double_array* GetCoords();
void SetLimit( double Xincr, double Yincr, double Zincr);
HOMARD::double_array* GetLimit();
void AddGroup( const char* Group);
void SetGroups(const HOMARD::ListGroupType& ListGroup);
HOMARD::ListGroupType* GetGroups();
// Liens avec les autres structures
void SetCaseCreation( const char* NomCaseCreation );
char* GetCaseCreation();
private:
::HOMARD_Boundary* myHomardBoundary;
CORBA::ORB_ptr _orb;
HOMARD::HOMARD_Gen_var _gen_i;
};
#endif

View File

@ -0,0 +1,599 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
//
#include "HOMARD_Cas_i.hxx"
#include "HOMARD_Gen_i.hxx"
#include "HOMARD_Cas.hxx"
#include "HOMARD_DriverTools.hxx"
#include "HOMARD.hxx"
#include "utilities.h"
#include <vector>
#include <sys/stat.h>
#ifdef WIN32
#include <direct.h>
#endif
//=============================================================================
/*!
* standard constructor
*/
//=============================================================================
HOMARD_Cas_i::HOMARD_Cas_i()
{
MESSAGE( "Default constructor, not for use" );
ASSERT( 0 );
}
//=============================================================================
/*!
* standard constructor
*/
//=============================================================================
HOMARD_Cas_i::HOMARD_Cas_i( CORBA::ORB_ptr orb,
HOMARD::HOMARD_Gen_var engine )
{
MESSAGE( "HOMARD_Cas_i" );
_gen_i = engine;
_orb = orb;
myHomardCas = new ::HOMARD_Cas();
ASSERT( myHomardCas );
}
//=============================================================================
/*!
* standard destructor
*/
//=============================================================================
HOMARD_Cas_i::~HOMARD_Cas_i()
{
}
//=============================================================================
//=============================================================================
// Generalites
//=============================================================================
//=============================================================================
void HOMARD_Cas_i::SetName( const char* Name )
{
ASSERT( myHomardCas );
myHomardCas->SetName( Name );
}
//=============================================================================
char* HOMARD_Cas_i::GetName()
{
ASSERT( myHomardCas );
return CORBA::string_dup( myHomardCas->GetName().c_str() );
}
//=============================================================================
CORBA::Long HOMARD_Cas_i::Delete( CORBA::Long Option )
{
ASSERT( myHomardCas );
char* CaseName = GetName() ;
MESSAGE ( "Delete : destruction du cas " << CaseName << ", Option = " << Option );
return _gen_i->DeleteCase(CaseName, Option) ;
}
//=============================================================================
char* HOMARD_Cas_i::GetDumpPython()
{
ASSERT( myHomardCas );
return CORBA::string_dup( myHomardCas->GetDumpPython().c_str() );
}
//=============================================================================
std::string HOMARD_Cas_i::Dump() const
{
return HOMARD::Dump( *myHomardCas );
}
//=============================================================================
bool HOMARD_Cas_i::Restore( const std::string& stream )
{
return HOMARD::Restore( *myHomardCas, stream );
}
//=============================================================================
//=============================================================================
// Caracteristiques
//=============================================================================
//=============================================================================
void HOMARD_Cas_i::SetDirName( const char* NomDir )
{
ASSERT( myHomardCas );
int codret ;
// A. recuperation du nom ; on ne fait rien si c'est le meme
char* oldrep = GetDirName() ;
if ( strcmp(oldrep,NomDir) == 0 )
{
return ;
}
MESSAGE ( "SetDirName : passage de oldrep = "<< oldrep << " a NomDir = "<<NomDir);
// B. controle de l'usage du repertoire
char* CaseName = GetName() ;
char* casenamedir = _gen_i->VerifieDir(NomDir) ;
if ( ( std::string(casenamedir).size() > 0 ) & ( strcmp(CaseName,casenamedir)!=0 ) )
{
INFOS ( "Le repertoire " << NomDir << " est deja utilise pour le cas "<< casenamedir );
SALOME::ExceptionStruct es;
es.type = SALOME::BAD_PARAM;
std::string text ;
text = "The directory " + std::string(NomDir) + " is already used for the case " + std::string(casenamedir) ;
es.text = CORBA::string_dup(text.c_str());
throw SALOME::SALOME_Exception(es);
}
// C. Changement/creation du repertoire
codret = myHomardCas->SetDirName( NomDir );
if ( codret != 0 )
{
SALOME::ExceptionStruct es;
es.type = SALOME::BAD_PARAM;
std::string text ;
if ( codret == 1 ) { text = "The directory for the case cannot be modified because some iterations are already defined." ; }
else { text = "The directory for the case cannot be reached." ; }
es.text = CORBA::string_dup(text.c_str());
throw SALOME::SALOME_Exception(es);
}
// D. En cas de reprise, deplacement du point de depart
if ( GetState() != 0 )
{
MESSAGE ( "etat : " << GetState() ) ;
// D.1. Nom local du repertoire de l'iteration de depart dans le repertoire actuel du cas
HOMARD::HOMARD_Iteration_ptr Iter = GetIter0() ;
char* DirNameIter = Iter->GetDirNameLoc() ;
MESSAGE ( "SetDirName : nom actuel pour le repertoire de l iteration, DirNameIter = "<< DirNameIter);
// D.2. Recherche d'un nom local pour l'iteration de depart dans le futur repertoire du cas
char* nomDirIter = _gen_i->CreateDirNameIter(NomDir, 0 );
MESSAGE ( "SetDirName : nom futur pour le repertoire de l iteration, nomDirIter = "<< nomDirIter);
// D.3. Creation du futur repertoire local pour l'iteration de depart
std::string nomDirIterTotal ;
nomDirIterTotal = std::string(NomDir) + "/" + std::string(nomDirIter) ;
#ifndef WIN32
if (mkdir(nomDirIterTotal.c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0)
#else
if (_mkdir(nomDirIterTotal.c_str()) != 0)
#endif
{
MESSAGE ( "nomDirIterTotal : " << nomDirIterTotal ) ;
SALOME::ExceptionStruct es;
es.type = SALOME::BAD_PARAM;
std::string text = "The directory for the starting iteration cannot be created." ;
es.text = CORBA::string_dup(text.c_str());
throw SALOME::SALOME_Exception(es);
}
// D.4. Deplacement du contenu du repertoire
std::string oldnomDirIterTotal ;
oldnomDirIterTotal = std::string(oldrep) + "/" + std::string(DirNameIter) ;
std::string commande = "mv " + std::string(oldnomDirIterTotal) + "/*" + " " + std::string(nomDirIterTotal) ;
codret = system(commande.c_str()) ;
if ( codret != 0 )
{
SALOME::ExceptionStruct es;
es.type = SALOME::BAD_PARAM;
std::string text = "The starting point for the case cannot be moved into the new directory." ;
es.text = CORBA::string_dup(text.c_str());
throw SALOME::SALOME_Exception(es);
}
commande = "rm -rf " + std::string(oldnomDirIterTotal) ;
codret = system(commande.c_str()) ;
if ( codret != 0 )
{
SALOME::ExceptionStruct es;
es.type = SALOME::BAD_PARAM;
std::string text = "The starting point for the case cannot be deleted." ;
es.text = CORBA::string_dup(text.c_str());
throw SALOME::SALOME_Exception(es);
}
// D.5. Memorisation du nom du repertoire de l'iteration
Iter->SetDirNameLoc(nomDirIter) ;
}
return ;
}
//=============================================================================
char* HOMARD_Cas_i::GetDirName()
{
ASSERT( myHomardCas );
return CORBA::string_dup( myHomardCas->GetDirName().c_str() );
}
//=============================================================================
CORBA::Long HOMARD_Cas_i::GetState()
{
ASSERT( myHomardCas );
// Nom de l'iteration initiale
char* Iter0Name = GetIter0Name() ;
HOMARD::HOMARD_Iteration_ptr Iter = _gen_i->GetIteration(Iter0Name) ;
int state = Iter->GetNumber() ;
return state ;
}
//=============================================================================
CORBA::Long HOMARD_Cas_i::GetNumberofIter()
{
ASSERT( myHomardCas );
return myHomardCas->GetNumberofIter();
}
//=============================================================================
void HOMARD_Cas_i::SetConfType( CORBA::Long ConfType )
{
ASSERT( myHomardCas );
// VERIFICATION( (ConfType>=-2) && (ConfType<=3) );
myHomardCas->SetConfType( ConfType );
}
//=============================================================================
CORBA::Long HOMARD_Cas_i::GetConfType()
{
ASSERT( myHomardCas );
return myHomardCas->GetConfType();
}
//=============================================================================
void HOMARD_Cas_i::SetExtType( CORBA::Long ExtType )
{
ASSERT( myHomardCas );
// VERIFICATION( (ExtType>=0) && (ExtType<=2) );
myHomardCas->SetExtType( ExtType );
}
//=============================================================================
CORBA::Long HOMARD_Cas_i::GetExtType()
{
ASSERT( myHomardCas );
return myHomardCas->GetExtType();
}
//=============================================================================
void HOMARD_Cas_i::SetBoundingBox( const HOMARD::extrema& LesExtrema )
{
ASSERT( myHomardCas );
std::vector<double> VExtrema;
ASSERT( LesExtrema.length() == 10 );
VExtrema.resize( LesExtrema.length() );
for ( int i = 0; i < LesExtrema.length(); i++ )
{
VExtrema[i] = LesExtrema[i];
}
myHomardCas->SetBoundingBox( VExtrema );
}
//=============================================================================
HOMARD::extrema* HOMARD_Cas_i::GetBoundingBox()
{
ASSERT(myHomardCas );
HOMARD::extrema_var aResult = new HOMARD::extrema();
std::vector<double> LesExtremes = myHomardCas->GetBoundingBox();
ASSERT( LesExtremes.size() == 10 );
aResult->length( 10 );
for ( int i = 0; i < LesExtremes.size(); i++ )
{
aResult[i] = LesExtremes[i];
}
return aResult._retn();
}
//=============================================================================
void HOMARD_Cas_i::AddGroup( const char* Group)
{
ASSERT( myHomardCas );
myHomardCas->AddGroup( Group );
}
//=============================================================================
void HOMARD_Cas_i::SetGroups( const HOMARD::ListGroupType& ListGroup )
{
ASSERT( myHomardCas );
std::list<std::string> ListString ;
for ( int i = 0; i < ListGroup.length(); i++ )
{
ListString.push_back(std::string(ListGroup[i]));
}
myHomardCas->SetGroups( ListString );
}
//=============================================================================
HOMARD::ListGroupType* HOMARD_Cas_i::GetGroups()
{
ASSERT(myHomardCas );
const std::list<std::string>& ListString = myHomardCas->GetGroups();
HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType();
aResult->length( ListString.size() );
std::list<std::string>::const_iterator it;
int i = 0;
for ( it = ListString.begin(); it != ListString.end(); it++ )
{
aResult[i++] = CORBA::string_dup( (*it).c_str() );
}
return aResult._retn();
}
//=============================================================================
void HOMARD_Cas_i::AddBoundary(const char* BoundaryName)
{
MESSAGE ("HOMARD_Cas_i::AddBoundary : BoundaryName = "<< BoundaryName );
const char * Group = "" ;
AddBoundaryGroup( BoundaryName, Group) ;
}
//=============================================================================
void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group)
{
MESSAGE ("HOMARD_Cas_i::AddBoundaryGroup : BoundaryName = "<< BoundaryName << ", Group = " << Group );
ASSERT( myHomardCas );
// A. Préalables
// A.1. Caractéristiques de la frontière à ajouter
HOMARD::HOMARD_Boundary_ptr myBoundary = _gen_i->GetBoundary(BoundaryName) ;
ASSERT(!CORBA::is_nil(myBoundary));
int BoundaryType = myBoundary->GetType();
MESSAGE ( ". BoundaryType = " << BoundaryType );
// A.2. La liste des frontiere+groupes
const std::list<std::string>& ListBoundaryGroup = myHomardCas->GetBoundaryGroup();
std::list<std::string>::const_iterator it;
// B. Controles
const char * boun ;
int erreur = 0 ;
while ( erreur == 0 )
{
// B.1. Si on ajoute une frontière CAO, elle doit être la seule frontière
if ( BoundaryType == -1 )
{
for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
{
boun = (*it).c_str() ;
MESSAGE (".. Frontiere enregistrée : "<< boun );
if ( *it != BoundaryName )
{ erreur = 1 ;
break ; }
// On saute le nom du groupe
it++ ;
}
}
if ( erreur != 0 ) { break ; }
// B.2. Si on ajoute une frontière non CAO, il ne doit pas y avoir de frontière CAO
if ( BoundaryType != -1 )
{
for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
{
boun = (*it).c_str() ;
MESSAGE (".. Frontiere enregistrée : "<< boun );
HOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ;
int BoundaryType_0 = myBoundary_0->GetType();
MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 );
if ( BoundaryType_0 == -1 )
{ erreur = 2 ;
break ; }
// On saute le nom du groupe
it++ ;
}
if ( erreur != 0 ) { break ; }
}
// B.3. Si on ajoute une frontière discrète, il ne doit pas y avoir d'autre frontière discrète
if ( BoundaryType == 0 )
{
for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
{
boun = (*it).c_str() ;
MESSAGE (".. Frontiere enregistrée : "<< boun );
if ( boun != BoundaryName )
{
HOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ;
int BoundaryType_0 = myBoundary_0->GetType();
MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 );
if ( BoundaryType_0 == 0 )
{ erreur = 3 ;
break ; }
}
// On saute le nom du groupe
it++ ;
}
if ( erreur != 0 ) { break ; }
}
// B.4. Pour une nouvelle frontiere, publication dans l'arbre d'etudes sous le cas
bool existe = false ;
for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
{
MESSAGE (".. Frontiere : "<< *it );
if ( *it == BoundaryName ) { existe = true ; }
// On saute le nom du groupe
it++ ;
}
if ( !existe )
{
char* CaseName = GetName() ;
MESSAGE ( "AddBoundaryGroup : insertion de la frontiere dans l'arbre de " << CaseName );
_gen_i->PublishBoundaryUnderCase(CaseName, BoundaryName) ;
}
// B.5. Le groupe est-il deja enregistre pour une frontiere de ce cas ?
for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
{
boun = (*it).c_str() ;
it++ ;
MESSAGE (".. Groupe enregistré : "<< *it );
if ( *it == Group )
{ erreur = 5 ;
break ; }
}
if ( erreur != 0 ) { break ; }
//
break ;
}
// F. Si aucune erreur, enregistrement du couple (frontiere,groupe) dans la reference du cas
// Sinon, arrêt
if ( erreur == 0 )
{ myHomardCas->AddBoundaryGroup( BoundaryName, Group ); }
else
{
std::stringstream ss;
ss << erreur;
std::string str = ss.str();
std::string texte ;
texte = "Erreur numéro " + str + " pour la frontière à enregistrer : " + std::string(BoundaryName) ;
if ( erreur == 1 ) { texte += "\nIl existe déjà la frontière " ; }
else if ( erreur == 2 ) { texte += "\nIl existe déjà la frontière CAO " ; }
else if ( erreur == 3 ) { texte += "\nIl existe déjà une frontière discrète : " ; }
else if ( erreur == 5 ) { texte += "\nLe groupe " + std::string(Group) + " est déjà enregistré pour la frontière " ; }
texte += std::string(boun) ;
//
SALOME::ExceptionStruct es;
es.type = SALOME::BAD_PARAM;
#ifdef _DEBUG_
texte += "\nInvalid AddBoundaryGroup";
#endif
INFOS(texte) ;
es.text = CORBA::string_dup(texte.c_str());
throw SALOME::SALOME_Exception(es);
}
}
//=============================================================================
HOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup()
{
MESSAGE ("GetBoundaryGroup");
ASSERT(myHomardCas );
const std::list<std::string>& ListBoundaryGroup = myHomardCas->GetBoundaryGroup();
HOMARD::ListBoundaryGroupType_var aResult = new HOMARD::ListBoundaryGroupType();
aResult->length( ListBoundaryGroup.size() );
std::list<std::string>::const_iterator it;
int i = 0;
for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
{
aResult[i++] = CORBA::string_dup( (*it).c_str() );
}
return aResult._retn();
}
//=============================================================================
void HOMARD_Cas_i::SupprBoundaryGroup()
{
MESSAGE ("SupprBoundaryGroup");
ASSERT(myHomardCas );
myHomardCas->SupprBoundaryGroup();
}
//=============================================================================
void HOMARD_Cas_i::SetPyram( CORBA::Long Pyram )
{
MESSAGE ("SetPyram, Pyram = " << Pyram );
ASSERT( myHomardCas );
myHomardCas->SetPyram( Pyram );
}
//=============================================================================
CORBA::Long HOMARD_Cas_i::GetPyram()
{
MESSAGE ("GetPyram");
ASSERT( myHomardCas );
return myHomardCas->GetPyram();
}
//=============================================================================
void HOMARD_Cas_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte)
{
MESSAGE ( "MeshInfo : information sur le maillage initial du cas" );
ASSERT( myHomardCas );
//
// Nom de l'iteration
char* IterName = GetIter0Name() ;
CORBA::Long etatMenage = -1 ;
CORBA::Long modeHOMARD = 7 ;
CORBA::Long Option1 = 1 ;
CORBA::Long Option2 = 1 ;
if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5 ; }
if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19 ; }
if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11 ; }
if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13 ; }
if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3 ; }
CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option1, Option2) ;
MESSAGE ( "MeshInfo : codret = " << codret );
return ;
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
char* HOMARD_Cas_i::GetIter0Name()
{
ASSERT( myHomardCas );
return CORBA::string_dup( myHomardCas->GetIter0Name().c_str() );
}
//=============================================================================
HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::GetIter0()
{
// Nom de l'iteration initiale
char* Iter0Name = GetIter0Name() ;
MESSAGE ( "GetIter0 : Iter0Name = " << Iter0Name );
return _gen_i->GetIteration(Iter0Name) ;
}
//=============================================================================
HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::NextIteration( const char* IterName )
{
// Nom de l'iteration parent
char* NomIterParent = GetIter0Name() ;
MESSAGE ( "NextIteration : IterName = " << IterName );
MESSAGE ( "NextIteration : NomIterParent = " << NomIterParent );
return _gen_i->CreateIteration(IterName, NomIterParent) ;
}
//=============================================================================
HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::LastIteration( )
{
HOMARD::HOMARD_Iteration_ptr Iter ;
HOMARD::listeIterFilles_var ListeIterFilles ;
char* IterName ;
// Iteration initiale du cas
IterName = GetIter0Name() ;
// On va explorer la descendance de cette iteration initiale
// jusqu'a trouver celle qui n'a pas de filles
int nbiterfilles = 1 ;
while ( nbiterfilles == 1 )
{
// L'iteration associee
// MESSAGE ( ".. IterName = " << IterName );
Iter = _gen_i->GetIteration(IterName) ;
// Les filles de cette iteration
ListeIterFilles = Iter->GetIterations() ;
nbiterfilles = ListeIterFilles->length() ;
// MESSAGE ( ".. nbiterfilles = " << nbiterfilles );
// S'il y a au moins 2 filles, arret : on ne sait pas faire
VERIFICATION( nbiterfilles <= 1 ) ;
// S'il y a une fille unique, on recupere le nom de la fille et on recommence
if ( nbiterfilles == 1 )
{ IterName = ListeIterFilles[0] ; }
}
//
return Iter ;
}
//=============================================================================
void HOMARD_Cas_i::AddIteration( const char* NomIteration )
{
ASSERT( myHomardCas );
myHomardCas->AddIteration( NomIteration );
}
//=============================================================================
//=============================================================================
// YACS
//=============================================================================
//=============================================================================
//=============================================================================
// Creation d'un schema YACS
// YACSName : nom du schema
// ScriptFile : nom du fichier contenant le script de lancement du calcul
// DirName : le repertoire de lancement des calculs du sch?ma
// MeshFile : nom du fichier contenant le maillage pour le premier calcul
//=============================================================================
HOMARD::HOMARD_YACS_ptr HOMARD_Cas_i::CreateYACSSchema( const char* YACSName, const char* ScriptFile, const char* DirName, const char* MeshFile )
{
// Nom du cas
const char* CaseName = GetName() ;
MESSAGE ( "CreateYACSSchema : Schema YACS pour le cas " << YACSName);
MESSAGE ( "nomCas : " << CaseName);
MESSAGE ( "ScriptFile : " << ScriptFile);
MESSAGE ( "DirName : " << DirName);
MESSAGE ( "MeshFile : " << MeshFile);
return _gen_i->CreateYACSSchema(YACSName, CaseName, ScriptFile, DirName, MeshFile) ;
}

View File

@ -0,0 +1,119 @@
// Copyright (C) 2011-2020 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, or (at your option) any later version.
//
// 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
//
// Remarques :
// L'ordre de description des fonctions est le meme dans tous les fichiers
// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
// 2. Les caracteristiques
// 3. Le lien avec les autres structures
//
// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
//
#ifndef _HOMARD_CAS_I_HXX_
#define _HOMARD_CAS_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(HOMARD_Gen)
#include CORBA_SERVER_HEADER(HOMARD_Cas)
#include "HOMARD_i.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
#include "Utils_CorbaException.hxx"
#include <string>
class HOMARD_Cas;
class HOMARDENGINE_EXPORT HOMARD_Cas_i:
public virtual Engines_Component_i,
public virtual POA_HOMARD::HOMARD_Cas,
public virtual PortableServer::ServantBase
{
public:
HOMARD_Cas_i( CORBA::ORB_ptr orb, HOMARD::HOMARD_Gen_var gen_i );
HOMARD_Cas_i();
virtual ~HOMARD_Cas_i();
// Generalites
void SetName( const char* Name );
char* GetName();
CORBA::Long Delete( CORBA::Long Option );
char* GetDumpPython();
std::string Dump() const;
bool Restore( const std::string& stream );
// Caracteristiques
void SetDirName( const char* NomDir );
char* GetDirName();
CORBA::Long GetState();
CORBA::Long GetNumberofIter();
void SetConfType( CORBA::Long ConfType );
CORBA::Long GetConfType();
void SetExtType( CORBA::Long ExtType );
CORBA::Long GetExtType();
void SetBoundingBox( const HOMARD::extrema& LesExtremes );
HOMARD::extrema* GetBoundingBox();
void AddGroup( const char* Group);
void SetGroups(const HOMARD::ListGroupType& ListGroup);
HOMARD::ListGroupType* GetGroups();
void AddBoundary(const char* Boundary);
void AddBoundaryGroup(const char* Boundary, const char* Group);
HOMARD::ListBoundaryGroupType* GetBoundaryGroup();
void SupprBoundaryGroup( );
void SetPyram( CORBA::Long Pyram );
CORBA::Long GetPyram();
void MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte);
// Liens avec les autres structures
char* GetIter0Name();
HOMARD::HOMARD_Iteration_ptr GetIter0() ;
HOMARD::HOMARD_Iteration_ptr NextIteration( const char* Name ) ;
HOMARD::HOMARD_Iteration_ptr LastIteration() ;
void AddIteration( const char* NomIteration );
// YACS
HOMARD::HOMARD_YACS_ptr CreateYACSSchema( const char* YACSName, const char* ScriptFile, const char* DirName, const char* MeshFile );
private:
::HOMARD_Cas* myHomardCas;
CORBA::ORB_ptr _orb;
HOMARD::HOMARD_Gen_var _gen_i;
};
#endif

Some files were not shown because too many files have changed in this diff Show More