X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_2smeshpy.cxx;h=def823814c7a5d1d431c76a383b5f003bbe53f28;hb=729271103404983b169bb2d30185035c8b76a3ae;hp=4ab71b44977e29027da7f1d171073e8ae71b4121;hpb=f6f19e7452a9a62395b87847c87e87d3b9469541;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 4ab71b449..def823814 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -458,7 +458,7 @@ namespace { initialized = true; filteredArgs.push_back( "SMESH.MED_V2_1" ); filteredArgs.push_back( "SMESH.MED_V2_2" ); - } + } return std::find( filteredArgs.begin(), filteredArgs.end(), theArg ) != filteredArgs.end(); } } @@ -584,7 +584,7 @@ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod // find a GEOM (aPass == 0) and SHAPERSTUDY (aPass == 1) entries for(int aPass = 0; aPass < 2; aPass++) { _pyID geomID; - SALOMEDS::SComponent_wrap geomComp = SMESH_Gen_i::getStudyServant()-> + SALOMEDS::SComponent_wrap geomComp = SMESH_Gen_i::GetSMESHGen()->getStudyServant()-> FindComponent(aPass == 0 ? "GEOM" : "SHAPERSTUDY"); if (geomComp->_is_nil()) continue; CORBA::String_var entry = geomComp->GetID(); @@ -932,11 +932,13 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand "Geom_POLYHEDRA", "Geom_BALL" }; if ( -1 < iGeom && iGeom < nbTypes ) Threshold = SMESH + types[ iGeom ]; -#ifdef _DEBUG_ - // is types complete? (compilation failure means that enum GeometryType changed) - static_assert( sizeof(types) / sizeof(const char*) == nbTypes, - "Update names of GeometryType's!!!" ); -#endif + + if (SALOME::VerbosityActivated()) + { + // is types complete? (compilation failure means that enum GeometryType changed) + static_assert( sizeof(types) / sizeof(const char*) == nbTypes, + "Update names of GeometryType's!!!" ); + } } if (Type == "SMESH.FT_EntityType") { @@ -953,11 +955,13 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand "Entity_Polyhedra", "Entity_Quad_Polyhedra", "Entity_Ball" }; if ( -1 < iGeom && iGeom < nbTypes ) Threshold = SMESH + types[ iGeom ]; -#ifdef _DEBUG_ - // is 'types' complete? (compilation failure means that enum EntityType changed) - static_assert( sizeof(types) / sizeof(const char*) == nbTypes, - "Update names of EntityType's!!!" ); -#endif + + if (SALOME::VerbosityActivated()) + { + // is 'types' complete? (compilation failure means that enum EntityType changed) + static_assert( sizeof(types) / sizeof(const char*) == nbTypes, + "Update names of EntityType's!!!" ); + } } } if ( ThresholdID.Length() != 2 ) // neither '' nor "" @@ -1013,10 +1017,16 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand ) { Handle(_pyMesh) mesh = new _pyMesh( theCommand ); AddObject( mesh ); + // set mesh name + _pyID id = mesh->GetID(), comma("'"); + if ( myObjectNames.IsBound( id )) + theCommand->SetArg( theCommand->GetNbArgs() + 1, + comma + myObjectNames( id ) + comma); return; } if ( method == "CreateMeshesFromUNV" || method == "CreateMeshesFromSTL" || + method == "CreateDualMesh" || method == "CopyMesh" ) // command result is a mesh { Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() ); @@ -1024,7 +1034,6 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand ) return; } if ( method == "CreateMeshesFromMED" || - method == "CreateMeshesFromSAUV"|| method == "CreateMeshesFromCGNS" || method == "CreateMeshesFromGMF" ) // command result is ( [mesh1,mesh2], status ) { @@ -1717,7 +1726,7 @@ bool _pyGen::IsNotPublished(const _pyID& theObjID) const // either the SMESH object is not in study or it is a GEOM object if ( IsGeomObject( theObjID )) { - SALOMEDS::SObject_wrap so = SMESH_Gen_i::getStudyServant()->FindObjectID( theObjID.ToCString() ); + SALOMEDS::SObject_wrap so = SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindObjectID( theObjID.ToCString() ); if ( so->_is_nil() ) return true; CORBA::Object_var obj = so->GetObject(); return CORBA::is_nil( obj ); @@ -1823,7 +1832,7 @@ _pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd, const _pyID& meshId): const _pyID& meshID = theCreationCmd->GetObject(); addFatherMesh( meshID ); } - + // convert my creation command Handle(_pyCommand) creationCmd = GetCreationCmd(); creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() ); @@ -2194,7 +2203,7 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand ) static TStringSet sameMethods; if ( sameMethods.empty() ) { const char * names[] = - { "ExportDAT","ExportUNV","ExportSTL","ExportSAUV", "RemoveGroup","RemoveGroupWithContents", + { "ExportDAT","ExportUNV","ExportSTL", "RemoveGroup","RemoveGroupWithContents", "GetGroups","UnionGroups","IntersectGroups","CutGroups","CreateDimGroup","GetLog","GetId", "ClearLog","HasDuplicatedGroupNamesMED","GetMEDMesh","NbNodes","NbElements", "NbEdges","NbEdgesOfOrder","NbFaces","NbFacesOfOrder","NbTriangles", @@ -2207,7 +2216,8 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand ) "GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces", "GetElemFaceNodes", "GetFaceNormal", "FindElementByNodes", "IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor", - "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder" + "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder", + "SetNbThreads" ,"" }; // <- mark of end sameMethods.Insert( names ); } @@ -2415,7 +2425,7 @@ void _pyMesh::ClearCommands() list< Handle(_pySubMesh) >::iterator sm = mySubmeshes.begin(); for ( ; sm != mySubmeshes.end(); ++sm ) (*sm)->ClearCommands(); - + list< Handle(_pyGroup) >::iterator gr = myGroups.begin(); for ( ; gr != myGroups.end(); ++gr ) (*gr)->ClearCommands(); @@ -2487,11 +2497,11 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) static TStringSet sameMethods; if ( sameMethods.empty() ) { const char * names[] = { - "RemoveElements","RemoveNodes","RemoveOrphanNodes", + "RemoveElements","RemoveNodes","RemoveOrphanNodes","RemoveNodeWithReconnection", "AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace","AddBall", - "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces", - "MoveNode", "MoveClosestNodeToPoint", - "InverseDiag","DeleteDiag","Reorient","ReorientObject","Reorient2DBy3D", + "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","AddNodeOnSegment", + "MoveNode", "MoveClosestNodeToPoint","InverseDiag","DeleteDiag","AddNodeOnFace", + "Reorient","ReorientObject","Reorient2DBy3D","Reorient2DByNeighbours", "TriToQuad","TriToQuadObject", "QuadTo4Tri", "SplitQuad","SplitQuadObject", "BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject", "ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements", @@ -2575,7 +2585,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) // 1. Remove "MakeGroups" from the Command TCollection_AsciiString aMethod = theCommand->GetMethod(); int nbArgsToAdd = diffLastTwoArgsMethods.Contains(aMethod) ? 2 : 1; - + if(is0DmethObj) pos = pos-2; //Remove "0D" from the Command too aMethod.Trunc(pos-1); @@ -3406,7 +3416,7 @@ void _pyLayerDistributionHypo::Flush() list< Handle(_pyCommand) >::iterator cmd = myArgCommands.begin(); _pyID prevNewName; for ( cmd = myArgCommands.begin(); cmd != myArgCommands.end(); ++cmd ) - { + { const _pyID& hyp1dID = (*cmd)->GetArg( 1 ); if ( hyp1dID.IsEmpty() ) continue; @@ -3430,7 +3440,7 @@ void _pyLayerDistributionHypo::Flush() } newName += "_Distribution"; prevNewName = newName; - + hyp1d->GetCreationCmd()->SetResultValue( newName ); } list< Handle(_pyCommand) >& cmds = theGen->GetCommands(); @@ -4627,7 +4637,7 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id) //================================================================================ /*! - * \brief Check if "[ group1, group2 ] = mesh.GetGroups()" creation command + * \brief Check if "[ group1, group2 ] = mesh.GetGroups()" creation command * can be cleared */ //================================================================================ @@ -4798,7 +4808,7 @@ void _pyFilter::Process( const Handle(_pyCommand)& theCommand) if ( !myNewID.IsEmpty() ) theCommand->SetObject( myNewID ); - + // Convert the following set of commands into smesh.GetFilterFromCriteria(criteria) // aFilter0x2aaab0487080 = aFilterManager.CreateFilter() // aFilter0x2aaab0487080.SetCriteria(aCriteria) @@ -4841,7 +4851,7 @@ void _pyFilter::Process( const Handle(_pyCommand)& theCommand) void _pyFilter::Flush() { if ( myNewID.IsEmpty() ) return; - + list< Handle(_pyCommand) >::iterator cmd = myArgCmds.begin(); for ( ; cmd != myArgCmds.end(); ++cmd ) if ( !(*cmd)->IsEmpty() ) @@ -4978,7 +4988,7 @@ _pyHypothesisReader::_pyHypothesisReader() // ... // dim="2"> // - // + // // SetEnforcedVertex, // SetEnforcedVertexNamed //