//
}
////=============================================================================
-void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile, const std::string GroupName )
+void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
{
MESSAGE("Dans HomardDriver::TexteBoundaryDi, MeshName = "<<MeshName);
MESSAGE("Dans HomardDriver::TexteBoundaryDi, MeshFile = "<<MeshFile);
- MESSAGE("Dans HomardDriver::TexteBoundaryDi, GroupName = "<<GroupName);
//
_Texte += "CCNoMFro " + MeshName + "\n" ;
_Texte += "CCFronti " + MeshFile + "\n" ;
- if ( GroupName.size() > 0 ) _Texte += "CCGroFro " + GroupName + "\n" ;
//
}
////=============================================================================
-void HomardDriver::TexteBoundaryAn( int NumeBoundary, int BoundaryType, const std::string Group, double x0, double x1, double x2, double x3, double x4, double x5, double x6 )
+void HomardDriver::TexteBoundaryDiGr( const std::string GroupName )
{
+ MESSAGE("Dans HomardDriver::TexteBoundaryDiGr, GroupName = "<<GroupName);
+//
+ _Texte += "CCGroFro " + GroupName + "\n" ;
+//
+}
+////=============================================================================
+void HomardDriver::TexteBoundaryAn( const std::string NameBoundary, int NumeBoundary, int BoundaryType, double x0, double x1, double x2, double x3, double x4, double x5, double x6 )
+{
+ MESSAGE("Dans HomardDriver::TexteBoundaryAn, NameBoundary = "<<NameBoundary);
MESSAGE("Dans HomardDriver::TexteBoundaryAn, NumeBoundary = "<<NumeBoundary);
MESSAGE("Dans HomardDriver::TexteBoundaryAn, BoundaryType = "<<BoundaryType);
MESSAGE("Dans HomardDriver::TexteBoundaryAn, coor = "<< x0<<","<<x1<< ","<< x2<< ","<< x3<<","<<x4<<","<<x5<<","<<x6);
//
std::string saux, saux2 ;
//
-// Type de zones
+// Commentaires
//
std::stringstream saux1 ;
saux1 << NumeBoundary ;
{ saux += "# Cylindre\n" ; }
if ( BoundaryType == 2 )
{ saux += "# Sphere\n" ; }
+//
+// Le nom de la frontiere
//
{ std::stringstream saux1 ;
- saux1 << NumeBoundary << " " << BoundaryType ;
+ saux1 << NumeBoundary ;
saux2 = saux1.str() ;
- saux += "FAType " + saux2 + "\n" ;
+ saux += "FANom " + saux2 + " '" + NameBoundary + "'\n" ;
}
//
-// Le groupe
+// Type de frontiere
//
{ std::stringstream saux1 ;
- saux1 << NumeBoundary ;
+ saux1 << NumeBoundary << " " << BoundaryType ;
saux2 = saux1.str() ;
- saux += "FAGroupe " + saux2 + " '" + Group + "'\n" ;
+ saux += "FAType " + saux2 + "\n" ;
}
//
// Cas du cylindre
//
}
////=============================================================================
+void HomardDriver::TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName )
+{
+ MESSAGE("Dans HomardDriver::TexteBoundaryAnGr, NameBoundary = "<<NameBoundary);
+ MESSAGE("Dans HomardDriver::TexteBoundaryAnGr, NumeBoundary = "<<NumeBoundary);
+ MESSAGE("Dans HomardDriver::TexteBoundaryAnGr, GroupName = "<<GroupName);
+//
+// Commentaires
+//
+ std::string saux, saux2 ;
+ std::stringstream saux1 ;
+ saux1 << NumeBoundary ;
+ saux2 = saux1.str() ;
+ saux = "#\n# Lien Frontiere/Groupe numero " + saux2 + "\n" ;
+//
+ saux += "FGNomFro " + saux2 + " '" + NameBoundary + "'\n" ;
+ saux += "FGNomGro " + saux2 + " '" + GroupName + "'\n" ;
+//
+ _Texte += saux + "#\n" ;
+//
+}
+////=============================================================================
void HomardDriver::TexteFieldInterp( int TypeFieldInterp, const std::string FieldFile, const std::string MeshFile, int TimeStep, int Rank )
{
MESSAGE("Dans HomardDriver::TexteFieldInterp, TypeFieldInterp = "<<TypeFieldInterp);
void TexteCompo( int NumeComp, const std::string NomCompo);
void TexteBoundaryOption( int BoundaryOption );
- void TexteBoundaryDi( const std::string MeshName, const std::string MeshFile, const std::string GroupName );
- void TexteBoundaryAn( int NumeBoundary, int BoundaryType, const std::string Group, double x0, double x1, double x2, double x3, double x4, double x5, double x6 );
+ 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 );
+ void TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName );
void TexteFieldInterp( int TypeFieldInterp, const std::string FieldFile, const std::string MeshFile,
int TimeStep, int Rank );
using namespace std;
+//=======================================================================
+//function : RemoveTabulation
+//purpose :
+//=======================================================================
+std::string RemoveTabulation( std::string theScript )
+{
+ std::string::size_type aPos = 0;
+ while( aPos < theScript.length() )
+ {
+ aPos = theScript.find( "\n\t", aPos );
+ if( aPos == std::string::npos )
+ break;
+ theScript.replace( aPos, 2, "\n" );
+ aPos++;
+ }
+ return theScript;
+}
+
//=============================================================================
/*!
* standard constructor
}
// E.5. Ajout des informations liees a l'eventuel suivi de frontiere
+ // On ecrit d'abord la definition des frontieres, puis les liens avec les groupes
+ std::list<std::string> ListeBoundaryTraitees ;
HOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup();
int numberOfitems = ListBoundaryGroupType->length();
MESSAGE ( "... number of string for Boundary+Group = " << numberOfitems);
int BoundaryOption = 1 ;
int NumBoundaryAnalytical = 0 ;
for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2)
+ {
+ std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]);
+ MESSAGE ( "... BoundaryName = " << BoundaryName);
+ int A_faire = 1 ;
+ std::list<std::string>::const_iterator it = ListeBoundaryTraitees.begin();
+ while (it != ListeBoundaryTraitees.end())
+ {
+ MESSAGE ( "... BoundaryNameTraitee = " << *it);
+ if ( BoundaryName == *it ) { A_faire = 0 ; }
+ it++;
+ }
+ if ( A_faire == 1 )
+ {
+// Caracteristiques de la frontiere
+ HOMARD::HOMARD_Boundary_var myBoundary = myContextMap[GetCurrentStudyID()]._mesBoundarys[BoundaryName];
+ ASSERT(!CORBA::is_nil(myBoundary));
+ int BoundaryType = myBoundary->GetBoundaryType();
+ MESSAGE ( "... BoundaryType = " << BoundaryType );
+// Ecriture selon le type
+ if (BoundaryType == 0) // Cas d une frontiere discrete
+ {
+ const char* MeshName = myBoundary->GetMeshName() ;
+ const char* MeshFile = myBoundary->GetMeshFile() ;
+ myDriver->TexteBoundaryDi( MeshName, MeshFile);
+ BoundaryOption = BoundaryOption*2 ;
+ }
+ else if (BoundaryType == 1) // Cas d un cylindre
+ {
+ NumBoundaryAnalytical++ ;
+ HOMARD::double_array* coor = myBoundary->GetCylinder();
+ myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6]);
+ BoundaryOption = BoundaryOption*3 ;
+ }
+ else if (BoundaryType == 2) // Cas d une sphere
+ {
+ NumBoundaryAnalytical++ ;
+ HOMARD::double_array* coor = myBoundary->GetSphere();
+ myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], 0., 0., 0.);
+ BoundaryOption = BoundaryOption*3 ;
+ }
+// Memorisation du traitement
+ ListeBoundaryTraitees.push_back( BoundaryName );
+ }
+ }
+ NumBoundaryAnalytical = 0 ;
+ for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2)
+ {
+ std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]);
+ MESSAGE ( "... BoundaryName = " << BoundaryName);
+ HOMARD::HOMARD_Boundary_var myBoundary = myContextMap[GetCurrentStudyID()]._mesBoundarys[BoundaryName];
+ ASSERT(!CORBA::is_nil(myBoundary));
+ int BoundaryType = myBoundary->GetBoundaryType();
+ MESSAGE ( "... BoundaryType = " << BoundaryType );
+// Recuperation du nom du groupe
+ std::string GroupName = std::string((*ListBoundaryGroupType)[NumBoundary+1]);
+ MESSAGE ( "... GroupName = " << GroupName);
+ if (BoundaryType == 0) // Cas d une frontiere discrete
+ {
+ if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryDiGr ( GroupName ) ; }
+ }
+ else // Cas d une frontiere analytique
+ {
+ NumBoundaryAnalytical++ ;
+ myDriver->TexteBoundaryAnGr ( BoundaryName, NumBoundaryAnalytical, GroupName ) ;
+ }
+ }
+/* for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2)
{
std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]);
MESSAGE ( "... BoundaryName = " << BoundaryName);
myDriver->TexteBoundaryAn(NumBoundaryAnalytical, BoundaryType, GroupName, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], 0., 0., 0.);
BoundaryOption = BoundaryOption*3 ;
}
- }
+ }*/
myDriver->TexteBoundaryOption(BoundaryOption);
// E.6. Ajout des informations liees a l'eventuelle interpolation des champs
//==========================================================================
Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
CORBA::Boolean isPublished,
+ CORBA::Boolean isMultiFile,
CORBA::Boolean& isValidScript)
{
MESSAGE ("Entree dans DumpPython");
aScript += "\"\"\"\n";
aScript += "__revision__ = \"V1.2\"\n";
aScript += "import HOMARD\n";
- aScript += "import salome\n";
+ if( isMultiFile )
+ aScript += "import salome\n";
aScript += "homard = salome.lcc.FindOrLoadComponent('FactoryServer','HOMARD')\n";
- aScript += "def RebuildData(theStudy):\n";
- aScript += "\thomard.SetCurrentStudy(theStudy)\n";
+ if( isMultiFile ) {
+ aScript += "def RebuildData(theStudy):\n";
+ aScript += "\thomard.SetCurrentStudy(theStudy)\n";
+ }
+ else
+ aScript += "\thomard.SetCurrentStudy(salome.myStudy)\n";
if (myContextMap[GetCurrentStudyID()]._mesBoundarys.size() > 0)
std::string dumpIter = dumpCorbaIter.in();
aScript+=dumpIter;
}
-
-
+
+ if( isMultiFile )
+ aScript += "\n\tpass";
+ aScript += "\n";
+
+ if( !isMultiFile ) // remove unnecessary tabulation
+ aScript = RemoveTabulation( aScript );
+
const size_t aLen = strlen(aScript.c_str());
char* aBuffer = new char[aLen+1];
strcpy(aBuffer, aScript.c_str());