Add new method DoubleNodeElemGroupsNew which allows to have the group of newly created elements.

This commit is contained in:
gdd 2011-01-18 14:45:18 +00:00
parent 44f80071d1
commit 9ae572587c
5 changed files with 98 additions and 7 deletions

View File

@ -900,12 +900,27 @@ module SMESH
* \param theAffectedElems - group of elements to which the replicated nodes * \param theAffectedElems - group of elements to which the replicated nodes
* should be associated to. * should be associated to.
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodes() * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
*/ */
boolean DoubleNodeElemGroups( in ListOfGroups theElems, boolean DoubleNodeElemGroups( in ListOfGroups theElems,
in ListOfGroups theNodesNot, in ListOfGroups theNodesNot,
in ListOfGroups theAffectedElems ); in ListOfGroups theAffectedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
* Works as DoubleNodeElemGroups() described above, but returns a new group with
* newly created elements.
* \param theElems - list of groups of elements (edges or faces) to be replicated
* \param theNodesNot - list of groups of nodes not to replicated
* \param theAffectedElems - group of elements to which the replicated nodes
* should be associated to.
* \return a new group with newly created elements
* \sa DoubleNodeElemGroups()
*/
SMESH_Group DoubleNodeElemGroupsNew( in ListOfGroups theElems,
in ListOfGroups theNodesNot,
in ListOfGroups theAffectedElems );
/*! /*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* This method provided for convenience works as DoubleNodes() described above. * This method provided for convenience works as DoubleNodes() described above.

View File

@ -1194,7 +1194,9 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
theCommand->SetMethod("FindCoincidentNodesOnPart"); theCommand->SetMethod("FindCoincidentNodesOnPart");
} }
// DoubleNodeElemGroupNew() -> DoubleNodeElemGroup() // DoubleNodeElemGroupNew() -> DoubleNodeElemGroup()
if ( !isPyMeshMethod && ( method == "DoubleNodeElemGroupNew" || method == "DoubleNodeGroupNew")) // DoubleNodeGroupNew() -> DoubleNodeGroup()
// DoubleNodeElemGroupsNew() -> DoubleNodeElemGroups()
if ( !isPyMeshMethod && ( method == "DoubleNodeElemGroupNew" || method == "DoubleNodeGroupNew" || method == "DoubleNodeElemGroupsNew"))
{ {
isPyMeshMethod=true; isPyMeshMethod=true;
theCommand->SetMethod( method.SubString( 1, method.Length()-3)); theCommand->SetMethod( method.SubString( 1, method.Length()-3));

View File

@ -5134,7 +5134,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroupInRegion(SMESH::SMESH_Grou
\param theAffectedElems - group of elements to which the replicated nodes \param theAffectedElems - group of elements to which the replicated nodes
should be associated to. should be associated to.
\return TRUE if operation has been completed successfully, FALSE otherwise \return TRUE if operation has been completed successfully, FALSE otherwise
\sa DoubleNodeGroup(), DoubleNodes() \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
*/ */
//================================================================================ //================================================================================
@ -5183,6 +5183,60 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroups(const SMESH::ListOfGroup
return aResult; return aResult;
} }
//================================================================================
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
\param theElems - list of groups of elements (edges or faces) to be replicated
\param theNodesNot - list of groups of nodes not to replicated
\param theAffectedElems - group of elements to which the replicated nodes
should be associated to.
* \return a new group with newly created elements
* \sa DoubleNodeElemGroups()
*/
//================================================================================
SMESH::SMESH_Group_ptr SMESH_MeshEditor_i::DoubleNodeElemGroupsNew(const SMESH::ListOfGroups& theElems,
const SMESH::ListOfGroups& theNodesNot,
const SMESH::ListOfGroups& theAffectedElems)
{
SMESH::SMESH_Group_var aNewGroup;
initData();
::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
TIDSortedElemSet anElems, aNodes, anAffected;
listOfGroupToSet(theElems, aMeshDS, anElems, false );
listOfGroupToSet(theNodesNot, aMeshDS, aNodes, true );
listOfGroupToSet(theAffectedElems, aMeshDS, anAffected, false );
bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
storeResult( aMeshEditor) ;
myMesh->GetMeshDS()->Modified();
if ( aResult ) {
myMesh->SetIsModified( true );
// Create group with newly created elements
SMESH::long_array_var anIds = GetLastCreatedElems();
if (anIds->length() > 0) {
SMESH::ElementType aGroupType = myMesh_i->GetElementType(anIds[0], true);
string anUnindexedName (theElems[0]->GetName());
string aNewName = generateGroupName(anUnindexedName + "_double");
aNewGroup = myMesh_i->CreateGroup(aGroupType, aNewName.c_str());
aNewGroup->Add(anIds);
}
}
// Update Python script
TPythonDump() << "createdElems = " << this << ".DoubleNodeElemGroupsNew( " << &theElems << ", "
<< &theNodesNot << ", " << &theAffectedElems << " )";
return aNewGroup._retn();
}
//================================================================================ //================================================================================
/*! /*!
\brief Creates a hole in a mesh by doubling the nodes of some particular elements \brief Creates a hole in a mesh by doubling the nodes of some particular elements

View File

@ -607,7 +607,7 @@ public:
* \param theAffectedElems - group of elements to which the replicated nodes * \param theAffectedElems - group of elements to which the replicated nodes
* should be associated to. * should be associated to.
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodes(), DoubleNodeGroups() * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
*/ */
CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems, CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
SMESH::SMESH_GroupBase_ptr theNodesNot, SMESH::SMESH_GroupBase_ptr theNodesNot,
@ -649,12 +649,26 @@ public:
* \param theAffectedElems - group of elements to which the replicated nodes * \param theAffectedElems - group of elements to which the replicated nodes
* should be associated to. * should be associated to.
* \return TRUE if operation has been completed successfully, FALSE otherwise * \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodeGroup(), DoubleNodes() * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
*/ */
CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems, CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
const SMESH::ListOfGroups& theNodesNot, const SMESH::ListOfGroups& theNodesNot,
const SMESH::ListOfGroups& theAffectedElems ); const SMESH::ListOfGroups& theAffectedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
* \param theElems - list of groups of elements (edges or faces) to be replicated
* \param theNodesNot - list of groups of nodes not to replicated
* \param theAffectedElems - group of elements to which the replicated nodes
* should be associated to.
* \return a new group with newly created elements
* \sa DoubleNodeElemGroups()
*/
SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
const SMESH::ListOfGroups& theNodesNot,
const SMESH::ListOfGroups& theAffectedElems );
/*! /*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements * \brief Creates a hole in a mesh by doubling the nodes of some particular elements

View File

@ -4064,6 +4064,8 @@ class Mesh:
# @param theAffectedElems - group of elements to which the replicated nodes # @param theAffectedElems - group of elements to which the replicated nodes
# should be associated to. # should be associated to.
# @param theMakeGroup forces the generation of a group containing new elements. # @param theMakeGroup forces the generation of a group containing new elements.
# @return TRUE or a created group if operation has been completed successfully,
# FALSE or None otherwise
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def DoubleNodeElemGroup(self, theElems, theNodesNot, theAffectedElems, theMakeGroup=False): def DoubleNodeElemGroup(self, theElems, theNodesNot, theAffectedElems, theMakeGroup=False):
if theMakeGroup: if theMakeGroup:
@ -4087,9 +4089,13 @@ class Mesh:
# @param theNodesNot - list of groups of nodes not to replicated # @param theNodesNot - list of groups of nodes not to replicated
# @param theAffectedElems - group of elements to which the replicated nodes # @param theAffectedElems - group of elements to which the replicated nodes
# should be associated to. # should be associated to.
# @return TRUE if operation has been completed successfully, FALSE otherwise # @param theMakeGroup forces the generation of a group containing new elements.
# @return TRUE or a created group if operation has been completed successfully,
# FALSE or None otherwise
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems): def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems, theMakeGroup=False):
if theMakeGroup:
return self.editor.DoubleNodeElemGroupsNew(theElems, theNodesNot, theAffectedElems)
return self.editor.DoubleNodeElemGroups(theElems, theNodesNot, theAffectedElems) return self.editor.DoubleNodeElemGroups(theElems, theNodesNot, theAffectedElems)
## Creates a hole in a mesh by doubling the nodes of some particular elements ## Creates a hole in a mesh by doubling the nodes of some particular elements