X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_2smeshpy.cxx;h=bd0ec817e67b633a229bd79562f797d118b7cec0;hp=9b622a1a98a37af5b20b6e5984a9516c24829902;hb=HEAD;hpb=fa95110a3b64cb8323176103200e3dd17f0ed67e diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 9b622a1a9..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 != '' @@ -1009,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(); @@ -1093,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" ) { @@ -1825,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) @@ -1901,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 { @@ -2216,7 +2265,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", "CheckCompute" ,"" }; // <- mark of end sameMethods.Insert( names ); } @@ -2517,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", @@ -3126,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 */ //================================================================================