From: gdd Date: Tue, 3 May 2011 16:30:50 +0000 (+0000) Subject: Fixes by Gérald NICOLAS X-Git-Tag: V6_3_0b1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=35c54c4edd721a432942ab086a4479fd3e0ad6ff;p=modules%2Fhomard.git Fixes by Gérald NICOLAS Fix by Gilles DAVID (Python Dump) --- diff --git a/src/HOMARD/HomardDriver.cxx b/src/HOMARD/HomardDriver.cxx index da930133..caaa95b3 100644 --- a/src/HOMARD/HomardDriver.cxx +++ b/src/HOMARD/HomardDriver.cxx @@ -342,27 +342,34 @@ void HomardDriver::TexteBoundaryOption( int BoundaryOption ) // } ////============================================================================= -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 = "< 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 = "< 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::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); @@ -1234,7 +1321,7 @@ CORBA::Boolean HOMARD_Gen_i::Compute(const char* nomIteration, CORBA::Long etatM 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 @@ -2352,6 +2439,7 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::newZone() //========================================================================== Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished, + CORBA::Boolean isMultiFile, CORBA::Boolean& isValidScript) { MESSAGE ("Entree dans DumpPython"); @@ -2370,10 +2458,15 @@ Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Object_ptr theStudy, 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) @@ -2461,8 +2554,14 @@ Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Object_ptr theStudy, 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()); diff --git a/src/HOMARD_I/HOMARD_Gen_i.hxx b/src/HOMARD_I/HOMARD_Gen_i.hxx index 6f44d12b..cac1cefe 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.hxx +++ b/src/HOMARD_I/HOMARD_Gen_i.hxx @@ -164,6 +164,7 @@ private: virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished, + CORBA::Boolean isMultiFile, CORBA::Boolean& isValidScript); diff --git a/tests/test_1.00.med b/tests/test_1.00.med index 767d4f62..316e1405 100644 Binary files a/tests/test_1.00.med and b/tests/test_1.00.med differ diff --git a/tests/test_1.01.med b/tests/test_1.01.med index 91d7fb34..661ce231 100644 Binary files a/tests/test_1.01.med and b/tests/test_1.01.med differ diff --git a/tests/test_1.02.med b/tests/test_1.02.med index 4e94dcdd..1a9688c1 100644 Binary files a/tests/test_1.02.med and b/tests/test_1.02.med differ diff --git a/tests/test_2.00.med b/tests/test_2.00.med index 05e3849b..b4ada0fe 100644 Binary files a/tests/test_2.00.med and b/tests/test_2.00.med differ diff --git a/tests/test_2.fr.med b/tests/test_2.fr.med index 48ceb7d0..33315ed5 100644 Binary files a/tests/test_2.fr.med and b/tests/test_2.fr.med differ diff --git a/tests/test_3.00.med b/tests/test_3.00.med index 0b41f328..c76b750e 100644 Binary files a/tests/test_3.00.med and b/tests/test_3.00.med differ diff --git a/tests/test_3.fr.med b/tests/test_3.fr.med index 657ab6d2..99b15ca6 100644 Binary files a/tests/test_3.fr.med and b/tests/test_3.fr.med differ