X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Gen_i.cxx;h=916a1f2221aebb4f30521f2abd379ee1ee2ae740;hp=983a3173b2072df0884602157da477409d10763f;hb=096485adbe5e66ace1182bf6c49dc6853f437d9c;hpb=b3cb4c5a571fe8f36ff6fa5bb90f5d9f122cafad diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 983a3173b..916a1f222 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -54,6 +54,7 @@ #include #else #include + #include // for basename function #endif #ifdef WIN32 @@ -63,7 +64,7 @@ #define UnLoadLib( handle ) FreeLibrary( handle ); #else #define LibHandle void* - #define LoadLib( name ) dlopen( name, RTLD_LAZY ) + #define LoadLib( name ) dlopen( name, RTLD_LAZY | RTLD_GLOBAL ) #define GetProc dlsym #define UnLoadLib( handle ) dlclose( handle ); #endif @@ -382,8 +383,10 @@ GenericHypothesisCreator_i* SMESH_Gen_i::getHypothesisCreator(const char* theHyp !strcmp( theLibName+libNameLen-3, ".so" )) { //the old format -#ifdef WIN32 +#if defined(WIN32) aPlatformLibName = std::string( theLibName+3, libNameLen-6 ) + ".dll"; +#elif defined(__APPLE__) + aPlatformLibName = std::string( theLibName, libNameLen-3 ) + ".dylib"; #else aPlatformLibName = theLibName; #endif @@ -391,11 +394,13 @@ GenericHypothesisCreator_i* SMESH_Gen_i::getHypothesisCreator(const char* theHyp else { //try to use new format -#ifdef WIN32 +#if defined(WIN32) aPlatformLibName = theLibName; aPlatformLibName += ".dll"; +#elif defined(__APPLE__) + aPlatformLibName = std::string( "lib" ) + std::string( theLibName ) + ".dylib"; #else - aPlatformLibName = "lib" + std::string( theLibName ) + ".so"; + aPlatformLibName = std::string( "lib" ) + std::string( theLibName ) + ".so"; #endif } } @@ -416,7 +421,7 @@ GenericHypothesisCreator_i* SMESH_Gen_i::getHypothesisCreator(const char* theHyp LibHandle libHandle = LoadLib( aPlatformLibName.c_str() ); if (!libHandle) { - // report any error, if occured + // report any error, if occurred #ifndef WIN32 const char* anError = dlerror(); throw(SALOME_Exception(anError)); @@ -876,10 +881,17 @@ CORBA::Boolean SMESH_Gen_i::GetSoleSubMeshUsingHyp( SMESH::SMESH_Hypothesis_ptr { if ( !foundMesh->_is_nil() ) // not a sole mesh { - GEOM::GEOM_Object_var s1 = mesh_i ->GetShapeToMesh(); - GEOM::GEOM_Object_var s2 = foundMesh->GetShapeToMesh(); - if ( ! ( isSole = s1->IsSame( s2 ))) - break; + if ( !foundMesh->HasShapeToMesh() || + !mesh_i ->HasShapeToMesh() ) + { + isSole = ( foundMesh->HasShapeToMesh() == mesh_i->HasShapeToMesh() ); + } + else + { + GEOM::GEOM_Object_var s1 = mesh_i ->GetShapeToMesh(); + GEOM::GEOM_Object_var s2 = foundMesh->GetShapeToMesh(); + isSole = s1->IsSame( s2 ); + } } foundMesh = SMESH::SMESH_Mesh::_narrow( obj ); } @@ -953,7 +965,7 @@ void SMESH_Gen_i::SetOption(const char* name, const char* value) { vector color; string str = value; - // color must be presented as a string of next form: + // color must be presented as a string of following form: if ( str.at(0) == '#' && str.length() == 7 ) { // hexadecimal color ("#ffaa00", for example) str = str.substr(1); for ( size_t i = 0; i < str.length()/2; i++ ) @@ -1162,7 +1174,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMEDorSAUV( const char* theFileNa _splitpath( theFileNameForPython, NULL, NULL, bname, NULL ); string aFileName = bname; #else - string aFileName = basename( theFileNameForPython ); + string aFileName = basename( const_cast(theFileNameForPython) ); #endif // Retrieve mesh names from the file DriverMED_R_SMESHDS_Mesh myReader; @@ -1205,11 +1217,11 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMEDorSAUV( const char* theFileNa // - as names of meshes are stored in MED file, we use them for data publishing // - as mesh name is not stored in UNV file, we use file name as name of mesh when publishing data aSO = PublishMesh( myCurrentStudy, mesh.in(), ( theFileName == theFileNameForPython ) ? (*it).c_str() : aFileName.c_str() ); + + // Python Dump if ( !aSO->_is_nil() ) { - // Python Dump aPythonDump << aSO; } else { - // Python Dump aPythonDump << "mesh_" << i; } @@ -1311,7 +1323,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromSTL( const char* theFileName _splitpath( theFileName, NULL, NULL, bname, NULL ); string aFileName = bname; #else - string aFileName = basename( theFileName ); + string aFileName = basename( const_cast(theFileName) ); #endif // publish mesh in the study if ( CanPublishInStudy( aMesh ) ) { @@ -1440,7 +1452,7 @@ SMESH_Gen_i::CreateMeshesFromGMF( const char* theFileName, _splitpath( theFileName, NULL, NULL, bname, NULL ); string aFileName = bname; #else - string aFileName = basename( theFileName ); + string aFileName = basename( const_cast(theFileName) ); #endif // publish mesh in the study if ( CanPublishInStudy( aMesh ) ) { @@ -1917,7 +1929,10 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh, // call implementation compute ::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); myGen.PrepareCompute( myLocMesh, myLocShape ); - bool ok = myGen.Compute( myLocMesh, myLocShape, myLocShape != myLocMesh.GetShapeToMesh()); + int how = ::SMESH_Gen::COMPACT_MESH; + if ( myLocShape != myLocMesh.GetShapeToMesh() ) // compute a sub-mesh + how |= ::SMESH_Gen::SHAPE_ONLY; + bool ok = myGen.Compute( myLocMesh, myLocShape, how ); meshServant->CreateGroupServants(); // algos can create groups (issue 0020918) myLocMesh.GetMeshDS()->Modified(); return ok; @@ -2001,7 +2016,7 @@ SMESH::MeshPreviewStruct* SMESH_Gen_i::Precompute( SMESH::SMESH_Mesh_ptr theMesh ::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); TSetOfInt shapeIds; ::MeshDimension aDim = (MeshDimension)theDimension; - if ( myGen.Compute( myLocMesh, myLocShape, false, false, aDim, &shapeIds ) ) + if ( myGen.Compute( myLocMesh, myLocShape, ::SMESH_Gen::COMPACT_MESH, aDim, &shapeIds ) ) { int nbShapeId = shapeIds.size(); theShapesId.length( nbShapeId ); @@ -2545,7 +2560,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray, const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" }; { // check of typeNames: compilation failure mains that NB_ELEMENT_TYPES changed: const int nbNames = sizeof(typeNames) / sizeof(const char*); - int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 2 : -1 ]; _assert[0]=_assert[1]; + int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 2 : -1 ]; _assert[0]=_assert[1]=0; } string groupName = "Gr"; SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, theMeshesArray[i] ); @@ -3127,7 +3142,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent, if( libname_len > 4 ) libname.resize( libname_len - 4 ); #else - // PAL17753 (Regresion: missing hypothesis in restored study) + // PAL17753 (Regression: missing hypothesis in restored study) // "lib" also should be removed from the beginning //if( libname_len > 3 ) //libname.resize( libname_len - 3 ); @@ -3196,7 +3211,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent, if( libname_len > 4 ) libname.resize( libname_len - 4 ); #else - // PAL17753 (Regresion: missing hypothesis in restored study) + // PAL17753 (Regression: missing hypothesis in restored study) // "lib" also should be removed from the beginning //if( libname_len > 3 ) //libname.resize( libname_len - 3 );