*/
//=============================================================================
-SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESH_Mesh_i* theMesh, bool isPreview)
+SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESH_Mesh_i* theMesh, bool isPreview):
+ myMesh_i( theMesh ),
+ myMesh( &theMesh->GetImpl() ),
+ myEditor( myMesh ),
+ myPreviewMode ( isPreview )
{
- myMesh_i = theMesh;
- myMesh = & theMesh->GetImpl();
- myPreviewMode = isPreview;
}
//================================================================================
void SMESH_MeshEditor_i::initData(bool deleteSearchers)
{
if ( myPreviewMode ) {
- myPreviewData = new SMESH::MeshPreviewStruct();
+ //myPreviewData = new SMESH::MeshPreviewStruct();
}
else {
- myLastCreatedElems = new SMESH::long_array();
- myLastCreatedNodes = new SMESH::long_array();
if ( deleteSearchers )
TSearchersDeleter::Delete();
}
}
+//================================================================================
+/*!
+ * \brief Now does nothing
+ */
+//================================================================================
+
+void SMESH_MeshEditor_i::storeResult(::SMESH_MeshEditor& )
+{
+}
+
+//================================================================================
+/*!
+ * Return data of mesh edition preview
+ */
+//================================================================================
+
+SMESH::MeshPreviewStruct* SMESH_MeshEditor_i::GetPreviewData()
+{
+ if ( myPreviewMode ) { // --- MeshPreviewStruct filling ---
+
+ list<int> aNodesConnectivity;
+ typedef map<int, int> TNodesMap;
+ TNodesMap nodesMap;
+
+ TPreviewMesh * aPreviewMesh = dynamic_cast< TPreviewMesh* >( myEditor.GetMesh() );
+ SMDSAbs_ElementType previewType = aPreviewMesh->myPreviewType;
+
+ SMESHDS_Mesh* aMeshDS = myEditor.GetMeshDS();
+ int nbEdges = aMeshDS->NbEdges();
+ int nbFaces = aMeshDS->NbFaces();
+ int nbVolum = aMeshDS->NbVolumes();
+ switch ( previewType ) {
+ case SMDSAbs_Edge : nbFaces = nbVolum = 0; break;
+ case SMDSAbs_Face : nbEdges = nbVolum = 0; break;
+ case SMDSAbs_Volume: nbEdges = nbFaces = 0; break;
+ default:;
+ }
+ myPreviewData = new SMESH::MeshPreviewStruct();
+ myPreviewData->nodesXYZ.length(aMeshDS->NbNodes());
+ myPreviewData->elementTypes.length(nbEdges + nbFaces + nbVolum);
+ int i = 0, j = 0;
+ SMDS_ElemIteratorPtr itMeshElems = aMeshDS->elementsIterator();
+
+ while ( itMeshElems->more() ) {
+ const SMDS_MeshElement* aMeshElem = itMeshElems->next();
+ if ( previewType != SMDSAbs_All && aMeshElem->GetType() != previewType )
+ continue;
+
+ SMDS_ElemIteratorPtr itElemNodes = aMeshElem->nodesIterator();
+ while ( itElemNodes->more() ) {
+ const SMDS_MeshNode* aMeshNode =
+ static_cast<const SMDS_MeshNode*>( itElemNodes->next() );
+ int aNodeID = aMeshNode->GetID();
+ TNodesMap::iterator anIter = nodesMap.find(aNodeID);
+ if ( anIter == nodesMap.end() ) {
+ // filling the nodes coordinates
+ myPreviewData->nodesXYZ[j].x = aMeshNode->X();
+ myPreviewData->nodesXYZ[j].y = aMeshNode->Y();
+ myPreviewData->nodesXYZ[j].z = aMeshNode->Z();
+ anIter = nodesMap.insert( make_pair(aNodeID, j) ).first;
+ j++;
+ }
+ aNodesConnectivity.push_back(anIter->second);
+ }
+
+ // filling the elements types
+ SMDSAbs_ElementType aType = aMeshElem->GetType();
+ bool isPoly = aMeshElem->IsPoly();
+
+ myPreviewData->elementTypes[i].SMDS_ElementType = (SMESH::ElementType) aType;
+ myPreviewData->elementTypes[i].isPoly = isPoly;
+ myPreviewData->elementTypes[i].nbNodesInElement = aMeshElem->NbNodes();
+ i++;
+
+ }
+ myPreviewData->nodesXYZ.length( j );
+
+ // filling the elements connectivities
+ list<int>::iterator aConnIter = aNodesConnectivity.begin();
+ myPreviewData->elementConnectivities.length(aNodesConnectivity.size());
+ for( int i = 0; aConnIter != aNodesConnectivity.end(); aConnIter++, i++ )
+ myPreviewData->elementConnectivities[i] = *aConnIter;
+ }
+
+ return myPreviewData._retn();
+}
+
+//================================================================================
+/*!
+ * \brief Returns list of it's IDs of created nodes
+ * \retval SMESH::long_array* - list of node ID
+ */
+//================================================================================
+
+SMESH::long_array* SMESH_MeshEditor_i::GetLastCreatedNodes()
+{
+ SMESH::long_array_var myLastCreatedNodes = new SMESH::long_array();
+ const SMESH_SequenceOfElemPtr& aSeq = myEditor.GetLastCreatedNodes();
+ myLastCreatedNodes->length( aSeq.Length() );
+ for (int i = 1; i <= aSeq.Length(); i++)
+ myLastCreatedNodes[i-1] = aSeq.Value(i)->GetID();
+ return myLastCreatedNodes._retn();
+}
+
+//================================================================================
+/*!
+ * \brief Returns list of it's IDs of created elements
+ * \retval SMESH::long_array* - list of elements' ID
+ */
+//================================================================================
+
+SMESH::long_array* SMESH_MeshEditor_i::GetLastCreatedElems()
+{
+ SMESH::long_array_var myLastCreatedElems = new SMESH::long_array();
+ const SMESH_SequenceOfElemPtr& aSeq = myEditor.GetLastCreatedElems();
+ myLastCreatedElems->length( aSeq.Length() );
+ for ( int i = 1; i <= aSeq.Length(); i++ )
+ myLastCreatedElems[i-1] = aSeq.Value(i)->GetID();
+ return myLastCreatedElems._retn();
+}
+
//=======================================================================
//function : MakeIDSource
//purpose : Wrap a sequence of ids in a SMESH_IDSource
{
initData();
- ::SMESH_MeshEditor anEditor( myMesh );
list< int > IdList;
for (int i = 0; i < IDsOfElements.length(); i++)
TPythonDump() << "isDone = " << this << ".RemoveElements( " << IDsOfElements << " )";
// Remove Elements
- bool ret = anEditor.Remove( IdList, false );
+ bool ret = myEditor.Remove( IdList, false );
myMesh->GetMeshDS()->Modified();
if ( IDsOfElements.length() )
myMesh->SetIsModified( true ); // issue 0020693
{
initData();
- ::SMESH_MeshEditor anEditor( myMesh );
list< int > IdList;
for (int i = 0; i < IDsOfNodes.length(); i++)
IdList.push_back( IDsOfNodes[i] );
// Update Python script
TPythonDump() << "isDone = " << this << ".RemoveNodes( " << IDsOfNodes << " )";
- bool ret = anEditor.Remove( IdList, true );
+ bool ret = myEditor.Remove( IdList, true );
myMesh->GetMeshDS()->Modified();
if ( IDsOfNodes.length() )
myMesh->SetIsModified( true ); // issue 0020693
{
initData();
- ::SMESH_MeshEditor anEditor( myMesh );
// Update Python script
TPythonDump() << "nbRemoved = " << this << ".RemoveOrphanNodes()";
IdList.push_back( seq[i] );
int nbNodesBefore = myMesh->NbNodes();
- anEditor.Remove( IdList, true );
+ myEditor.Remove( IdList, true );
myMesh->GetMeshDS()->Modified();
if ( IdList.size() )
myMesh->SetIsModified( true );
//=============================================================================
/*!
- *
+ * Add a new node.
*/
//=============================================================================
//=============================================================================
/*!
- *
+ * Create 0D element on the given node.
*/
//=============================================================================
+
CORBA::Long SMESH_MeshEditor_i::Add0DElement(CORBA::Long IDOfNode)
{
initData();
//=============================================================================
/*!
- *
+ * Create a ball element on the given node.
+ */
+//=============================================================================
+
+CORBA::Long SMESH_MeshEditor_i::AddBall(CORBA::Long IDOfNode, CORBA::Double diameter)
+ throw (SALOME::SALOME_Exception)
+{
+ initData();
+
+ if ( diameter < std::numeric_limits<double>::min() )
+ THROW_SALOME_CORBA_EXCEPTION("Invalid diameter", SALOME::BAD_PARAM);
+
+ const SMDS_MeshNode* aNode = GetMeshDS()->FindNode(IDOfNode);
+ SMDS_MeshElement* elem = GetMeshDS()->AddBall(aNode, diameter);
+
+ // Update Python script
+ TPythonDump() << "ballElem = "
+ << this << ".AddBall( " << IDOfNode << ", " << diameter <<" )";
+
+ myMesh->GetMeshDS()->Modified();
+ myMesh->SetIsModified( true ); // issue 0020693
+
+ if (elem)
+ return elem->GetID();
+
+ return 0;
+}
+
+//=============================================================================
+/*!
+ * Create an edge, either linear and quadratic (this is determed
+ * by number of given nodes, two or three)
*/
//=============================================================================
//=============================================================================
/*!
- *
+ * Create volume, either linear and quadratic (this is determed
+ * by number of given nodes)
*/
//=============================================================================
<< NodeID1 << ", " << NodeID2 << " )";
- ::SMESH_MeshEditor aMeshEditor( myMesh );
- int ret = aMeshEditor.InverseDiag ( n1, n2 );
+ int ret = myEditor.InverseDiag ( n1, n2 );
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true );
return ret;
TPythonDump() << "isDone = " << this << ".DeleteDiag( "
<< NodeID1 << ", " << NodeID2 << " )";
- ::SMESH_MeshEditor aMeshEditor( myMesh );
- bool stat = aMeshEditor.DeleteDiag ( n1, n2 );
+ bool stat = myEditor.DeleteDiag ( n1, n2 );
myMesh->GetMeshDS()->Modified();
if ( stat )
myMesh->SetIsModified( true ); // issue 0020693
- storeResult(aMeshEditor);
+ storeResult(myEditor);
return stat;
}
{
initData();
- ::SMESH_MeshEditor anEditor( myMesh );
for (int i = 0; i < IDsOfElements.length(); i++)
{
CORBA::Long index = IDsOfElements[i];
const SMDS_MeshElement * elem = GetMeshDS()->FindElement(index);
if ( elem )
- anEditor.Reorient( elem );
+ myEditor.Reorient( elem );
}
// Update Python script
TPythonDump() << "isDone = " << this << ".Reorient( " << IDsOfElements << " )";
if ( !idSourceToSet( the2Dgroup, GetMeshDS(), elements, SMDSAbs_Face, /*emptyIfIsMesh=*/1))
THROW_SALOME_CORBA_EXCEPTION("No faces in given group", SALOME::BAD_PARAM);
- ::SMESH_MeshEditor anEditor( myMesh );
const SMDS_MeshElement* face = 0;
if ( theFace > 0 )
if ( myMesh->NbFaces() == 0 )
THROW_SALOME_CORBA_EXCEPTION("No faces in the mesh", SALOME::BAD_PARAM);
- theElementSearcher = anEditor.GetElementSearcher();
+ theElementSearcher = myEditor.GetElementSearcher();
}
else
{
typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator > TIter;
SMDS_ElemIteratorPtr elemsIt( new TIter( elements.begin(), elements.end() ));
- theElementSearcher = anEditor.GetElementSearcher(elemsIt);
+ theElementSearcher = myEditor.GetElementSearcher(elemsIt);
}
}
// find a face
if ( dirVec.Magnitude() < std::numeric_limits< double >::min() )
THROW_SALOME_CORBA_EXCEPTION("Zero size vector", SALOME::BAD_PARAM);
- int nbReori = anEditor.Reorient2D( elements, dirVec, face );
- storeResult(anEditor);
+ int nbReori = myEditor.Reorient2D( elements, dirVec, face );
+ storeResult(myEditor);
if ( nbReori ) {
myMesh->SetIsModified( true );
TPythonDump() << "isDone = " << this << ".TriToQuad( "
<< IDsOfElements << ", " << aNumericalFunctor << ", " << TVar( MaxAngle ) << " )";
- ::SMESH_MeshEditor anEditor( myMesh );
- bool stat = anEditor.TriToQuad( faces, aCrit, MaxAngle );
+ bool stat = myEditor.TriToQuad( faces, aCrit, MaxAngle );
myMesh->GetMeshDS()->Modified();
if ( stat )
myMesh->SetIsModified( true ); // issue 0020693
- storeResult(anEditor);
+ storeResult(myEditor);
return stat;
}
// Update Python script
TPythonDump() << "isDone = " << this << ".QuadToTri( " << IDsOfElements << ", " << aNumericalFunctor << " )";
- ::SMESH_MeshEditor anEditor( myMesh );
- CORBA::Boolean stat = anEditor.QuadToTri( faces, aCrit );
+ CORBA::Boolean stat = myEditor.QuadToTri( faces, aCrit );
myMesh->GetMeshDS()->Modified();
if ( stat )
myMesh->SetIsModified( true ); // issue 0020693
- storeResult(anEditor);
+ storeResult(myEditor);
return stat;
}
TPythonDump() << "isDone = " << this << ".SplitQuad( "
<< IDsOfElements << ", " << Diag13 << " )";
- ::SMESH_MeshEditor anEditor( myMesh );
- CORBA::Boolean stat = anEditor.QuadToTri( faces, Diag13 );
+ CORBA::Boolean stat = myEditor.QuadToTri( faces, Diag13 );
myMesh->GetMeshDS()->Modified();
if ( stat )
myMesh->SetIsModified( true ); // issue 0020693
- storeResult(anEditor);
+ storeResult(myEditor);
return stat;
}
else
aCrit.reset(new SMESH::Controls::AspectRatio());
- ::SMESH_MeshEditor anEditor (myMesh);
- return anEditor.BestSplit(quad, aCrit);
+ return myEditor.BestSplit(quad, aCrit);
}
return -1;
}
TIDSortedElemSet elemSet;
arrayToSet( anElementsId, GetMeshDS(), elemSet, SMDSAbs_Volume );
- ::SMESH_MeshEditor anEditor (myMesh);
- anEditor.SplitVolumesIntoTetra( elemSet, int( methodFlags ));
+ myEditor.SplitVolumesIntoTetra( elemSet, int( methodFlags ));
myMesh->GetMeshDS()->Modified();
- storeResult(anEditor);
+ storeResult(myEditor);
// if ( myLastCreatedElems.length() ) - it does not influence Compute()
// myMesh->SetIsModified( true ); // issue 0020693
if ( Method != SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH )
method = ::SMESH_MeshEditor::CENTROIDAL;
- ::SMESH_MeshEditor anEditor( myMesh );
- anEditor.Smooth(elements, fixedNodes, method,
+ myEditor.Smooth(elements, fixedNodes, method,
MaxNbOfIterations, MaxAspectRatio, IsParametric );
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true ); // issue 0020693
- storeResult(anEditor);
+ storeResult(myEditor);
// Update Python script
TPythonDump() << "isDone = " << this << "."
gp_Ax1 Ax1 (gp_Pnt( theAxis.x, theAxis.y, theAxis.z ),
gp_Vec( theAxis.vx, theAxis.vy, theAxis.vz ));
- ::SMESH_MeshEditor anEditor( mesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.RotationSweep (*workElements, Ax1, theAngleInRadians,
+ myEditor.RotationSweep (*workElements, Ax1, theAngleInRadians,
theNbOfSteps, theTolerance, theMakeGroups, makeWalls);
- storeResult(anEditor);
+ storeResult(myEditor);
myMesh->GetMeshDS()->Modified();
// myMesh->SetIsModified( true ); -- it does not influence Compute()
}
TElemOfElemListMap aHystory;
- ::SMESH_MeshEditor anEditor( mesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.ExtrusionSweep (*workElements, stepVec, theNbOfSteps, aHystory, theMakeGroups);
+ myEditor.ExtrusionSweep (*workElements, stepVec, theNbOfSteps, aHystory, theMakeGroups);
myMesh->GetMeshDS()->Modified();
- storeResult(anEditor);
+ storeResult(myEditor);
return theMakeGroups ? getGroups(groupIds.get()) : 0;
const SMESH::PointStruct * P = &theStepVector.PS;
gp_Vec stepVec( P->x, P->y, P->z );
- ::SMESH_MeshEditor anEditor( myMesh );
TElemOfElemListMap aHystory;
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory,
+ myEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory,
theMakeGroups, theExtrFlags, theSewTolerance);
- storeResult(anEditor);
+ storeResult(myEditor);
return theMakeGroups ? getGroups(groupIds.get()) : 0;
}
int nbOldGroups = myMesh->NbGroup();
- ::SMESH_MeshEditor anEditor( myMesh );
::SMESH_MeshEditor::Extrusion_Error error =
- anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart,
+ myEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart,
theHasAngles, angles, false,
theHasRefPoint, refPnt, theMakeGroups );
myMesh->GetMeshDS()->Modified();
- storeResult(anEditor);
+ storeResult(myEditor);
theError = convExtrError( error );
if ( theMakeGroups ) {
MakeGroups = false;
}
- ::SMESH_MeshEditor anEditor( mesh );
::SMESH_MeshEditor::Extrusion_Error error;
if ( SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( Path ))
Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
return EmptyGr;
}
- error = anEditor.ExtrusionAlongTrack( *workElements, &(aMeshImp->GetImpl()), aNodeStart,
+ error = myEditor.ExtrusionAlongTrack( *workElements, &(aMeshImp->GetImpl()), aNodeStart,
HasAngles, angles, LinearVariation,
HasRefPoint, refPnt, MakeGroups );
myMesh->GetMeshDS()->Modified();
}
SMESH_subMesh* aSubMesh =
aMeshImp->GetImpl().GetSubMeshContaining(aSubMeshImp->GetId());
- error = anEditor.ExtrusionAlongTrack( *workElements, aSubMesh, aNodeStart,
+ error = myEditor.ExtrusionAlongTrack( *workElements, aSubMesh, aNodeStart,
HasAngles, angles, LinearVariation,
HasRefPoint, refPnt, MakeGroups );
myMesh->GetMeshDS()->Modified();
return EmptyGr;
}
- storeResult(anEditor);
+ storeResult(myEditor);
Error = convExtrError( error );
if ( MakeGroups ) {
theMakeGroups = false;
}
- ::SMESH_MeshEditor anEditor( mesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+ myEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
if(theCopy || myPreviewMode)
- storeResult(anEditor); // store preview data or new elements
+ storeResult(myEditor); // store preview data or new elements
if ( !myPreviewMode )
{
theMakeGroups = false;
}
- ::SMESH_MeshEditor anEditor( mesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+ myEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
if(theCopy || myPreviewMode)
- storeResult(anEditor);
+ storeResult(myEditor);
if ( !myPreviewMode )
{
theMakeGroups = false;
}
- ::SMESH_MeshEditor anEditor( mesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+ myEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
if(theCopy || myPreviewMode)
- storeResult(anEditor);
+ storeResult(myEditor);
if ( !myPreviewMode )
{
theMakeGroups = false;
}
- ::SMESH_MeshEditor anEditor( mesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+ myEditor.Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
if(theCopy || myPreviewMode )
- storeResult(anEditor);
+ storeResult(myEditor);
if ( !myPreviewMode )
{
initData();
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
- ::SMESH_MeshEditor anEditor( myMesh );
TIDSortedNodeSet nodes; // no input nodes
- anEditor.FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
+ myEditor.FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
GroupsOfNodes = new SMESH::array_of_long_array;
GroupsOfNodes->length( aListOfListOfNodes.size() );
idSourceToNodeSet( theObject, GetMeshDS(), nodes );
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
- ::SMESH_MeshEditor anEditor( myMesh );
if(!nodes.empty())
- anEditor.FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
+ myEditor.FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
GroupsOfNodes = new SMESH::array_of_long_array;
GroupsOfNodes->length( aListOfListOfNodes.size() );
nodes.erase( *avoidNode );
}
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
- ::SMESH_MeshEditor anEditor( myMesh );
if(!nodes.empty())
- anEditor.FindCoincidentNodes( nodes, theTolerance, aListOfListOfNodes );
+ myEditor.FindCoincidentNodes( nodes, theTolerance, aListOfListOfNodes );
theGroupsOfNodes = new SMESH::array_of_long_array;
theGroupsOfNodes->length( aListOfListOfNodes.size() );
if ( i > 0 ) aTPythonDump << ", ";
aTPythonDump << aNodeGroup;
}
- ::SMESH_MeshEditor anEditor( myMesh );
- anEditor.MergeNodes( aListOfListOfNodes );
+ myEditor.MergeNodes( aListOfListOfNodes );
aTPythonDump << "])";
myMesh->GetMeshDS()->Modified();
}
::SMESH_MeshEditor::TListOfListOfElementsID aListOfListOfElementsID;
- ::SMESH_MeshEditor anEditor( myMesh );
- anEditor.FindEqualElements( elems, aListOfListOfElementsID );
+ myEditor.FindEqualElements( elems, aListOfListOfElementsID );
GroupsOfElementsID = new SMESH::array_of_long_array;
GroupsOfElementsID->length( aListOfListOfElementsID.size() );
aTPythonDump << anElemsIDGroup;
}
- ::SMESH_MeshEditor anEditor( myMesh );
- anEditor.MergeElements(aListOfListOfElementsID);
+ myEditor.MergeElements(aListOfListOfElementsID);
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true );
{
initData();
- ::SMESH_MeshEditor anEditor( myMesh );
- anEditor.MergeEqualElements();
+ myEditor.MergeEqualElements();
myMesh->GetMeshDS()->Modified();
if ( nodeCpy1 )
tmpMesh.GetMeshDS()->MoveNode(nodeCpy1, x, y, z);
// fill preview data
- ::SMESH_MeshEditor anEditor( & tmpMesh );
- storeResult( anEditor );
+ storeResult( myEditor );
}
else if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly
theNodeSearcher->MoveNode(node, gp_Pnt( x,y,z ));
theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
if ( !theNodeSearcher ) {
- ::SMESH_MeshEditor anEditor( myMesh );
- theNodeSearcher = anEditor.GetNodeSearcher();
+ theNodeSearcher = myEditor.GetNodeSearcher();
}
gp_Pnt p( x,y,z );
if ( const SMDS_MeshNode* node = theNodeSearcher->FindClosestTo( p ))
if ( !node ) // preview moving node
{
if ( !theNodeSearcher ) {
- ::SMESH_MeshEditor anEditor( myMesh );
- theNodeSearcher = anEditor.GetNodeSearcher();
+ theNodeSearcher = myEditor.GetNodeSearcher();
}
gp_Pnt p( x,y,z );
node = theNodeSearcher->FindClosestTo( p );
if ( node )
tmpMesh.GetMeshDS()->MoveNode(node, x, y, z);
// fill preview data
- ::SMESH_MeshEditor anEditor( & tmpMesh );
- storeResult( anEditor );
+ storeResult( myEditor );
}
else if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly
{
theSearchersDeleter.Set( myMesh );
if ( !theElementSearcher ) {
- ::SMESH_MeshEditor anEditor( myMesh );
- theElementSearcher = anEditor.GetElementSearcher();
+ theElementSearcher = myEditor.GetElementSearcher();
}
theElementSearcher->FindElementsByPoint( gp_Pnt( x,y,z ),
SMDSAbs_ElementType( type ),
SMESH::array_of_ElementType_var types = elementIDs->GetTypes();
if ( types->length() == 1 && // a part contains only nodes or 0D elements
- ( types[0] == SMESH::NODE || types[0] == SMESH::ELEM0D ) &&
+ ( types[0] == SMESH::NODE || types[0] == SMESH::ELEM0D || types[0] == SMESH::BALL) &&
type != types[0] ) // but search of elements of dim > 0
return res._retn();
typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator > TIter;
SMDS_ElemIteratorPtr elemsIt( new TIter( elements.begin(), elements.end() ));
- ::SMESH_MeshEditor anEditor( myMesh );
- theElementSearcher = anEditor.GetElementSearcher(elemsIt);
+ theElementSearcher = myEditor.GetElementSearcher(elemsIt);
}
vector< const SMDS_MeshElement* > foundElems;
{
theSearchersDeleter.Set( myMesh );
if ( !theElementSearcher ) {
- ::SMESH_MeshEditor anEditor( myMesh );
- theElementSearcher = anEditor.GetElementSearcher();
+ theElementSearcher = myEditor.GetElementSearcher();
}
return CORBA::Short( theElementSearcher->GetPointState( gp_Pnt( x,y,z )));
}
<< CreatePolygons<< ", "
<< CreatePolyedrs<< " )";
- ::SMESH_MeshEditor anEditor( myMesh );
SMESH::SMESH_MeshEditor::Sew_Error error =
- convError( anEditor.SewFreeBorder (aBorderFirstNode,
+ convError( myEditor.SewFreeBorder (aBorderFirstNode,
aBorderSecondNode,
aBorderLastNode,
aSide2FirstNode,
CreatePolygons,
CreatePolyedrs) );
- storeResult(anEditor);
+ storeResult(myEditor);
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true );
<< FirstNodeID2 << ", "
<< SecondNodeID2 << " )";
- ::SMESH_MeshEditor anEditor( myMesh );
SMESH::SMESH_MeshEditor::Sew_Error error =
- convError( anEditor.SewFreeBorder (aBorderFirstNode,
+ convError( myEditor.SewFreeBorder (aBorderFirstNode,
aBorderSecondNode,
aBorderLastNode,
aSide2FirstNode,
true,
false, false) );
- storeResult(anEditor);
+ storeResult(myEditor);
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true );
<< CreatePolygons << ", "
<< CreatePolyedrs << ") ";
- ::SMESH_MeshEditor anEditor( myMesh );
SMESH::SMESH_MeshEditor::Sew_Error error =
- convError( anEditor.SewFreeBorder (aBorderFirstNode,
+ convError( myEditor.SewFreeBorder (aBorderFirstNode,
aBorderSecondNode,
aBorderLastNode,
aSide2FirstNode,
CreatePolygons,
CreatePolyedrs) );
- storeResult(anEditor);
+ storeResult(myEditor);
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true );
<< NodeID2OfSide1ToMerge << ", "
<< NodeID2OfSide2ToMerge << ")";
- ::SMESH_MeshEditor anEditor( myMesh );
SMESH::SMESH_MeshEditor::Sew_Error error =
- convError( anEditor.SewSideElements (aSide1Elems, aSide2Elems,
+ convError( myEditor.SewSideElements (aSide1Elems, aSide2Elems,
aFirstNode1ToMerge,
aFirstNode2ToMerge,
aSecondNode1ToMerge,
aSecondNode2ToMerge));
- storeResult(anEditor);
+ storeResult(myEditor);
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true );
return res;
}
-//================================================================================
-/*!
- * \brief Update myLastCreated* or myPreviewData
- * \param anEditor - it contains last modification results
- */
-//================================================================================
-
-void SMESH_MeshEditor_i::storeResult(::SMESH_MeshEditor& anEditor)
-{
- if ( myPreviewMode ) { // --- MeshPreviewStruct filling ---
-
- list<int> aNodesConnectivity;
- typedef map<int, int> TNodesMap;
- TNodesMap nodesMap;
-
- TPreviewMesh * aPreviewMesh = dynamic_cast< TPreviewMesh* >( anEditor.GetMesh() );
- SMDSAbs_ElementType previewType = aPreviewMesh->myPreviewType;
-
- SMESHDS_Mesh* aMeshDS = anEditor.GetMeshDS();
- int nbEdges = aMeshDS->NbEdges();
- int nbFaces = aMeshDS->NbFaces();
- int nbVolum = aMeshDS->NbVolumes();
- switch ( previewType ) {
- case SMDSAbs_Edge : nbFaces = nbVolum = 0; break;
- case SMDSAbs_Face : nbEdges = nbVolum = 0; break;
- case SMDSAbs_Volume: nbEdges = nbFaces = 0; break;
- default:;
- }
- myPreviewData->nodesXYZ.length(aMeshDS->NbNodes());
- myPreviewData->elementTypes.length(nbEdges + nbFaces + nbVolum);
- int i = 0, j = 0;
- SMDS_ElemIteratorPtr itMeshElems = aMeshDS->elementsIterator();
-
- while ( itMeshElems->more() ) {
- const SMDS_MeshElement* aMeshElem = itMeshElems->next();
- if ( previewType != SMDSAbs_All && aMeshElem->GetType() != previewType )
- continue;
-
- SMDS_ElemIteratorPtr itElemNodes = aMeshElem->nodesIterator();
- while ( itElemNodes->more() ) {
- const SMDS_MeshNode* aMeshNode =
- static_cast<const SMDS_MeshNode*>( itElemNodes->next() );
- int aNodeID = aMeshNode->GetID();
- TNodesMap::iterator anIter = nodesMap.find(aNodeID);
- if ( anIter == nodesMap.end() ) {
- // filling the nodes coordinates
- myPreviewData->nodesXYZ[j].x = aMeshNode->X();
- myPreviewData->nodesXYZ[j].y = aMeshNode->Y();
- myPreviewData->nodesXYZ[j].z = aMeshNode->Z();
- anIter = nodesMap.insert( make_pair(aNodeID, j) ).first;
- j++;
- }
- aNodesConnectivity.push_back(anIter->second);
- }
-
- // filling the elements types
- SMDSAbs_ElementType aType;
- bool isPoly;
- /*if (aMeshElem->GetType() == SMDSAbs_Volume) {
- aType = SMDSAbs_Node;
- isPoly = false;
- }
- else*/ {
- aType = aMeshElem->GetType();
- isPoly = aMeshElem->IsPoly();
- }
-
- myPreviewData->elementTypes[i].SMDS_ElementType = (SMESH::ElementType) aType;
- myPreviewData->elementTypes[i].isPoly = isPoly;
- myPreviewData->elementTypes[i].nbNodesInElement = aMeshElem->NbNodes();
- i++;
-
- }
- myPreviewData->nodesXYZ.length( j );
-
- // filling the elements connectivities
- list<int>::iterator aConnIter = aNodesConnectivity.begin();
- myPreviewData->elementConnectivities.length(aNodesConnectivity.size());
- for( int i = 0; aConnIter != aNodesConnectivity.end(); aConnIter++, i++ )
- myPreviewData->elementConnectivities[i] = *aConnIter;
-
- return;
- }
-
- {
- // append new nodes into myLastCreatedNodes
- const SMESH_SequenceOfElemPtr& aSeq = anEditor.GetLastCreatedNodes();
- int j = myLastCreatedNodes->length();
- int newLen = j + aSeq.Length();
- myLastCreatedNodes->length( newLen );
- for(int i=0; j<newLen; i++,j++)
- myLastCreatedNodes[j] = aSeq.Value(i+1)->GetID();
- }
- {
- // append new elements into myLastCreatedElems
- const SMESH_SequenceOfElemPtr& aSeq = anEditor.GetLastCreatedElems();
- int j = myLastCreatedElems->length();
- int newLen = j + aSeq.Length();
- myLastCreatedElems->length( newLen );
- for(int i=0; j<newLen; i++,j++)
- myLastCreatedElems[j] = aSeq.Value(i+1)->GetID();
- }
-}
-
-//================================================================================
-/*!
- * Return data of mesh edition preview
- */
-//================================================================================
-
-SMESH::MeshPreviewStruct* SMESH_MeshEditor_i::GetPreviewData()
-{
- return myPreviewData._retn();
-}
-
-//================================================================================
-/*!
- * \brief Returns list of it's IDs of created nodes
- * \retval SMESH::long_array* - list of node ID
- */
-//================================================================================
-
-SMESH::long_array* SMESH_MeshEditor_i::GetLastCreatedNodes()
-{
- return myLastCreatedNodes._retn();
-}
-
-//================================================================================
-/*!
- * \brief Returns list of it's IDs of created elements
- * \retval SMESH::long_array* - list of elements' ID
- */
-//================================================================================
-
-SMESH::long_array* SMESH_MeshEditor_i::GetLastCreatedElems()
-{
- return myLastCreatedElems._retn();
-}
-
//=======================================================================
//function : ConvertToQuadratic
//purpose :
void SMESH_MeshEditor_i::ConvertToQuadratic(CORBA::Boolean theForce3d)
{
- ::SMESH_MeshEditor anEditor( myMesh );
- anEditor.ConvertToQuadratic(theForce3d);
+ myEditor.ConvertToQuadratic(theForce3d);
TPythonDump() << this << ".ConvertToQuadratic( " << theForce3d << " )";
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true );
CORBA::Boolean SMESH_MeshEditor_i::ConvertFromQuadratic()
{
- ::SMESH_MeshEditor anEditor( myMesh );
- CORBA::Boolean isDone = anEditor.ConvertFromQuadratic();
+ CORBA::Boolean isDone = myEditor.ConvertFromQuadratic();
TPythonDump() << this << ".ConvertFromQuadratic()";
myMesh->GetMeshDS()->Modified();
if ( isDone )
}
else
{
- ::SMESH_MeshEditor anEditor( myMesh );
- anEditor.ConvertToQuadratic(theForce3d, elems);
+ myEditor.ConvertToQuadratic(theForce3d, elems);
}
}
myMesh->GetMeshDS()->Modified();
}
else
{
- ::SMESH_MeshEditor anEditor( myMesh );
- anEditor.ConvertFromQuadratic(elems);
+ myEditor.ConvertFromQuadratic(elems);
}
}
myMesh->GetMeshDS()->Modified();
{
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
list< int > aListOfNodes;
int i, n;
for ( i = 0, n = theNodes.length(); i < n; i++ )
for ( i = 0, n = theModifiedElems.length(); i < n; i++ )
aListOfElems.push_back( theModifiedElems[ i ] );
- bool aResult = aMeshEditor.DoubleNodes( aListOfNodes, aListOfElems );
+ bool aResult = myEditor.DoubleNodes( aListOfNodes, aListOfElems );
myMesh->GetMeshDS()->Modified();
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
if ( aResult )
myMesh->SetIsModified( true );
{
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
std::list< int > aNodes;
int i, n, j, m;
}
}
- bool aResult = aMeshEditor.DoubleNodes( aNodes, anElems );
+ bool aResult = myEditor.DoubleNodes( aNodes, anElems );
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
if ( aResult )
{
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
TIDSortedElemSet anElems, aNodes, anAffected;
arrayToSet(theNodesNot, aMeshDS, aNodes, SMDSAbs_Node);
arrayToSet(theAffectedElems, aMeshDS, anAffected, SMDSAbs_All);
- bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
+ bool aResult = myEditor.DoubleNodes( anElems, aNodes, anAffected );
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
if ( aResult )
{
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
TIDSortedElemSet anElems, aNodes;
arrayToSet(theNodesNot, aMeshDS, aNodes, SMDSAbs_Node);
TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theShape );
- bool aResult = aMeshEditor.DoubleNodesInRegion( anElems, aNodes, aShape );
+ bool aResult = myEditor.DoubleNodesInRegion( anElems, aNodes, aShape );
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
if ( aResult )
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
TIDSortedElemSet anElems, aNodes, anAffected;
idSourceToSet( theNodesNot, aMeshDS, aNodes, SMDSAbs_Node );
idSourceToSet( theAffectedElems, aMeshDS, anAffected, SMDSAbs_All );
- bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
+ bool aResult = myEditor.DoubleNodes( anElems, aNodes, anAffected );
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
if ( aResult )
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
TIDSortedElemSet anElems, aNodes, anAffected;
idSourceToSet( theAffectedElems, aMeshDS, anAffected, SMDSAbs_All );
- bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
+ bool aResult = myEditor.DoubleNodes( anElems, aNodes, anAffected );
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
TPythonDump pyDump;
// Create group with newly created elements
CORBA::String_var elemGroupName = theElems->GetName();
string aNewName = generateGroupName( string(elemGroupName.in()) + "_double");
- if ( !aMeshEditor.GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
+ if ( !myEditor.GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
{
SMESH::long_array_var anIds = GetLastCreatedElems();
SMESH::ElementType aGroupType = myMesh_i->GetElementType(anIds[0], true);
aNewElemGroup = myMesh_i->CreateGroup(aGroupType, aNewName.c_str());
aNewElemGroup->Add(anIds);
}
- if ( !aMeshEditor.GetLastCreatedNodes().IsEmpty() && theNodeGroupNeeded )
+ if ( !myEditor.GetLastCreatedNodes().IsEmpty() && theNodeGroupNeeded )
{
SMESH::long_array_var anIds = GetLastCreatedNodes();
aNewNodeGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str());
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
TIDSortedElemSet anElems, aNodes, anAffected;
idSourceToSet( theNodesNot, aMeshDS, aNodes, SMDSAbs_Node );
TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theShape );
- bool aResult = aMeshEditor.DoubleNodesInRegion( anElems, aNodes, aShape );
+ bool aResult = myEditor.DoubleNodesInRegion( anElems, aNodes, aShape );
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
if ( aResult )
{
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
TIDSortedElemSet anElems, aNodes, anAffected;
listOfGroupToSet(theNodesNot, aMeshDS, aNodes, true );
listOfGroupToSet(theAffectedElems, aMeshDS, anAffected, false );
- bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
+ bool aResult = myEditor.DoubleNodes( anElems, aNodes, anAffected );
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
if ( aResult )
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
TIDSortedElemSet anElems, aNodes, anAffected;
listOfGroupToSet(theNodesNot, aMeshDS, aNodes, true );
listOfGroupToSet(theAffectedElems, aMeshDS, anAffected, false );
- bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
+ bool aResult = myEditor.DoubleNodes( anElems, aNodes, anAffected );
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
TPythonDump pyDump;
// Create group with newly created elements
CORBA::String_var elemGroupName = theElems[0]->GetName();
string aNewName = generateGroupName( string(elemGroupName.in()) + "_double");
- if ( !aMeshEditor.GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
+ if ( !myEditor.GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
{
SMESH::long_array_var anIds = GetLastCreatedElems();
SMESH::ElementType aGroupType = myMesh_i->GetElementType(anIds[0], true);
aNewElemGroup = myMesh_i->CreateGroup(aGroupType, aNewName.c_str());
aNewElemGroup->Add(anIds);
}
- if ( !aMeshEditor.GetLastCreatedNodes().IsEmpty() && theNodeGroupNeeded )
+ if ( !myEditor.GetLastCreatedNodes().IsEmpty() && theNodeGroupNeeded )
{
SMESH::long_array_var anIds = GetLastCreatedNodes();
aNewNodeGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str());
{
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
TIDSortedElemSet anElems, aNodes;
listOfGroupToSet(theNodesNot, aMeshDS, aNodes, true );
TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theShape );
- bool aResult = aMeshEditor.DoubleNodesInRegion( anElems, aNodes, aShape );
+ bool aResult = myEditor.DoubleNodesInRegion( anElems, aNodes, aShape );
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
if ( aResult )
{
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
- bool aResult = aMeshEditor.Make2DMeshFrom3D();
- storeResult( aMeshEditor) ;
+ bool aResult = myEditor.Make2DMeshFrom3D();
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
TPythonDump() << "isDone = " << this << ".Make2DMeshFrom3D()";
return aResult;
{
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
}
}
- bool aResult = aMeshEditor.DoubleNodesOnGroupBoundaries( domains, createJointElems );
+ bool aResult = myEditor.DoubleNodesOnGroupBoundaries( domains, createJointElems );
// TODO publish the groups of flat elements in study
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
// Update Python script
{
initData();
- ::SMESH_MeshEditor aMeshEditor( myMesh );
SMESHDS_Mesh* aMeshDS = GetMeshDS();
}
}
- bool aResult = aMeshEditor.CreateFlatElementsOnFacesGroups( faceGroups );
+ bool aResult = myEditor.CreateFlatElementsOnFacesGroups( faceGroups );
// TODO publish the groups of flat elements in study
- storeResult( aMeshEditor) ;
+ storeResult( myEditor) ;
myMesh->GetMeshDS()->Modified();
// Update Python script
}
// do it
- ::SMESH_MeshEditor aMeshEditor( myMesh );
- aMeshEditor.MakeBoundaryMesh( elements,
+ myEditor.MakeBoundaryMesh( elements,
::SMESH_MeshEditor::Bnd_Dimension(dim),
smesh_group,
smesh_mesh,
toCopyElements,
toCopyExistingBondary);
- storeResult( aMeshEditor );
+ storeResult( myEditor );
if ( smesh_mesh )
smesh_mesh->GetMeshDS()->Modified();
{
SMESH::Bnd_Dimension bdim =
( elemType == SMDSAbs_Volume ) ? SMESH::BND_2DFROM3D : SMESH::BND_1DFROM2D;
- ::SMESH_MeshEditor aMeshEditor( srcMesh );
- nbAdded += aMeshEditor.MakeBoundaryMesh( elements,
+ nbAdded += myEditor.MakeBoundaryMesh( elements,
::SMESH_MeshEditor::Bnd_Dimension(bdim),
smesh_group,
tgtMesh,
/*toCopyExistingBondary=*/srcMesh != tgtMesh,
/*toAddExistingBondary=*/true,
/*aroundElements=*/true);
- storeResult( aMeshEditor );
+ storeResult( myEditor );
}
}
}
else
{
- ::SMESH_MeshEditor aMeshEditor( srcMesh );
- nbAdded += aMeshEditor.MakeBoundaryMesh( elements,
+ nbAdded += myEditor.MakeBoundaryMesh( elements,
::SMESH_MeshEditor::Bnd_Dimension(dim),
smesh_group,
tgtMesh,
/*toCopyElements=*/false,
/*toCopyExistingBondary=*/srcMesh != tgtMesh,
/*toAddExistingBondary=*/true);
- storeResult( aMeshEditor );
+ storeResult( myEditor );
}
tgtMesh->GetMeshDS()->Modified();