X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_2smeshpy.cxx;h=b36b31c13ea6f5d95e6836ef8329aeba6a9ed0f3;hp=a9fff0a6d6add7fdcb61761d2fcd42316a3c6aeb;hb=HEAD;hpb=33f226d32134089d08e1019cf80e9d4defd437f1 diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index a9fff0a6d..1e73de97a 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -301,6 +301,10 @@ namespace { // - FT_Deflection2D = 22 // v 9.3.0: FT_Undefined == 50, new items: // - FT_Length3D = 22 + // v 9.12.0: FT_Undefined == 51, new items: + // - FT_ScaledJacobian = 8 + // v 9.12.0: FT_Undefined == 52, new items: + // - FT_Warping3D = 4 // // It's necessary to continue recording this history and to fill // undef2newItems (see below) accordingly. @@ -325,6 +329,8 @@ namespace { undef2newItems[ 48 ].push_back( 22 ); undef2newItems[ 49 ].push_back( 22 ); undef2newItems[ 50 ].push_back( 22 ); + undef2newItems[ 51 ].push_back( 8 ); + undef2newItems[ 52 ].push_back( 4 ); ASSERT( undef2newItems.rbegin()->first == SMESH::FT_Undefined ); } @@ -694,6 +700,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand if ( objID == this->GetID() || objID == SMESH_2smeshpy::GenName()) { this->Process( aCommand ); + //addFilterUser( aCommand, theGen ); // protect filters from clearing return aCommand; } @@ -762,7 +769,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand meshID = aCommand->GetResultValue(); else if ( method == "MakeBoundaryMesh") meshID = aCommand->GetResultValue(1); - else if ( method == "MakeBoundaryElements") + else if ( method == "MakeBoundaryElements" || method == "MakeBoundaryOfEachElement" ) meshID = aCommand->GetResultValue(2); if ( method.Search("MakeGroups") != -1 || @@ -779,7 +786,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand groups = aCommand->GetResultValue(); else if ( method == "MakeBoundaryMesh" ) groups = aCommand->GetResultValue(2); - else if ( method == "MakeBoundaryElements") + else if ( method == "MakeBoundaryElements" || method == "MakeBoundaryOfEachElement" ) groups = aCommand->GetResultValue(3); else if ( method == "Create0DElementsOnAllNodes" && aCommand->GetArg(2).Length() > 2 ) // group name != '' @@ -932,11 +939,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 +962,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 "" @@ -1005,6 +1016,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand ) // Concatenate( [mesh1, ...], ... ) // CreateHypothesis( theHypType, theLibName ) // Compute( mesh, geom ) + // CheckCompute( mesh ) // Evaluate( mesh, geom ) // mesh creation TCollection_AsciiString method = theCommand->GetMethod(); @@ -1089,6 +1101,21 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand ) } } + // smeshgen.CheckCompute( mesh ) --> mesh.CheckCompute() + if ( method == "CheckCompute" ) + { + const _pyID& meshID = theCommand->GetArg( 1 ); + map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( meshID ); + if ( id_mesh != myMeshes.end() ) { + theCommand->SetObject( meshID ); + theCommand->RemoveArgs(); + id_mesh->second->Process( theCommand ); + id_mesh->second->AddProcessedCmd( theCommand ); + return; + } + } + + // smeshgen.Evaluate( mesh, geom ) --> mesh.Evaluate(geom) if ( method == "Evaluate" ) { @@ -1821,7 +1848,8 @@ _pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd, const _pyID& meshId): } else if ( theCreationCmd->GetMethod().Search("MakeMesh") != -1 || theCreationCmd->GetMethod() == "MakeBoundaryMesh" || - theCreationCmd->GetMethod() == "MakeBoundaryElements" ) + theCreationCmd->GetMethod() == "MakeBoundaryElements" || + theCreationCmd->GetMethod() == "MakeBoundaryOfEachElement" ) { // this mesh depends on a source mesh // (theCreationCmd is already Process()ed by _pyMeshEditor) @@ -1897,6 +1925,31 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) } Flush(); } + // in snapshot mode, clear the previous CheckCompute() + else if ( method == "CheckCompute" ) + { + if ( !theGen->IsToKeepAllCommands() ) // !historical + { + if ( !myLastCheckCmd.IsNull() ) + { + // check if the previously computed mesh has been edited, + // if so then we do not clear the previous Compute() + bool toClear = true; + list< Handle(_pyMeshEditor)>::iterator e = myEditors.begin(); + for ( ; e != myEditors.end() && toClear; ++e ) + { + list< Handle(_pyCommand)>& cmds = (*e)->GetProcessedCmds(); + list< Handle(_pyCommand) >::reverse_iterator cmd = cmds.rbegin(); + if ( cmd != cmds.rend() && + (*cmd)->GetOrderNb() > myLastCheckCmd->GetOrderNb() ) + toClear = false; + } + if ( toClear ) + myLastCheckCmd->Clear(); + } + myLastCheckCmd = theCommand; + } + } // ---------------------------------------------------------------------- else if ( method == "Clear" ) // in snapshot mode, clear all previous commands { @@ -2213,7 +2266,7 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand ) "GetElemFaceNodes", "GetFaceNormal", "FindElementByNodes", "IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor", "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder", - "SetNbThreads", "SetMesherNbThreads" + "SetNbThreads", "CheckCompute" ,"" }; // <- mark of end sameMethods.Insert( names ); } @@ -2514,7 +2567,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) "GetLastCreatedElems", "FaceGroupsSeparatedByEdges", "MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh","TranslateObjectMakeMesh", "Scale","ScaleMakeMesh","RotateMakeMesh","RotateObjectMakeMesh","MakeBoundaryMesh", - "MakeBoundaryElements", "SplitVolumesIntoTetra","SplitHexahedraIntoPrisms", + "MakeBoundaryElements", "MakeBoundaryOfEachElement", "SplitVolumesIntoTetra","SplitHexahedraIntoPrisms", "DoubleElements","DoubleNodes","DoubleNode","DoubleNodeGroup","DoubleNodeGroups", "DoubleNodeElem","DoubleNodeElemInRegion","DoubleNodeElemGroup","AffectedElemGroupsInRegion", "DoubleNodeElemGroupInRegion","DoubleNodeElemGroups","DoubleNodeElemGroupsInRegion", @@ -3123,7 +3176,7 @@ void _pyHypothesis::rememberCmdOfParameter( const Handle(_pyCommand) & theComman //================================================================================ /*! - * \brief Return true if a setting parameter command ha been used to compute mesh + * \brief Return true if a setting parameter command has been used to compute mesh */ //================================================================================