mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-22 18:15:37 +05:00
0021459: EDF 1495 SMESH: Manipulation of discrete elements with attributes
SMDS_MeshElement* AddElement(const std::vector<const SMDS_MeshNode*> & nodes, const SMDSAbs_ElementType type, const bool isPoly, const int ID = -1, + const double ballDiameter=0.); Adjust Transform() and FindElementsByPoint()
This commit is contained in:
parent
baade10114
commit
bcaa0ad2ee
@ -20,7 +20,6 @@
|
|||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
|
||||||
// SMESH SMESH : idl implementation based on 'SMESH' unit's classes
|
|
||||||
// File : SMESH_MeshEditor.cxx
|
// File : SMESH_MeshEditor.cxx
|
||||||
// Created : Mon Apr 12 16:10:22 2004
|
// Created : Mon Apr 12 16:10:22 2004
|
||||||
// Author : Edward AGAPOV (eap)
|
// Author : Edward AGAPOV (eap)
|
||||||
@ -78,6 +77,7 @@
|
|||||||
#include <TopTools_SequenceOfShape.hxx>
|
#include <TopTools_SequenceOfShape.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Face.hxx>
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <TopoDS_Solid.hxx>
|
||||||
#include <gp.hxx>
|
#include <gp.hxx>
|
||||||
#include <gp_Ax1.hxx>
|
#include <gp_Ax1.hxx>
|
||||||
#include <gp_Dir.hxx>
|
#include <gp_Dir.hxx>
|
||||||
@ -130,7 +130,8 @@ SMDS_MeshElement*
|
|||||||
SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & node,
|
SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & node,
|
||||||
const SMDSAbs_ElementType type,
|
const SMDSAbs_ElementType type,
|
||||||
const bool isPoly,
|
const bool isPoly,
|
||||||
const int ID)
|
const int ID,
|
||||||
|
const double ballDiameter)
|
||||||
{
|
{
|
||||||
//MESSAGE("AddElement " <<node.size() << " " << type << " " << isPoly << " " << ID);
|
//MESSAGE("AddElement " <<node.size() << " " << type << " " << isPoly << " " << ID);
|
||||||
SMDS_MeshElement* e = 0;
|
SMDS_MeshElement* e = 0;
|
||||||
@ -285,6 +286,11 @@ SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & node,
|
|||||||
else e = mesh->AddNode (node[0]->X(), node[0]->Y(), node[0]->Z());
|
else e = mesh->AddNode (node[0]->X(), node[0]->Y(), node[0]->Z());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SMDSAbs_Ball:
|
||||||
|
if ( ID >= 1 ) e = mesh->AddBallWithID(node[0], ballDiameter, ID);
|
||||||
|
else e = mesh->AddBall (node[0], ballDiameter);
|
||||||
|
break;
|
||||||
|
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
if ( e ) myLastCreatedElems.Append( e );
|
if ( e ) myLastCreatedElems.Append( e );
|
||||||
@ -3921,6 +3927,9 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SMDSEntity_Ball:
|
||||||
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5694,17 +5703,15 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
|
|||||||
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
|
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
|
||||||
{
|
{
|
||||||
const SMDS_MeshElement* elem = *itElem;
|
const SMDS_MeshElement* elem = *itElem;
|
||||||
if ( !elem || elem->GetType() == SMDSAbs_Node )
|
if ( !elem ) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
|
SMDSAbs_GeometryType geomType = elem->GetGeomType();
|
||||||
int nbNodes = elem->NbNodes();
|
int nbNodes = elem->NbNodes();
|
||||||
int elemType = elem->GetType();
|
if ( geomType == SMDSGeom_POINT ) continue; // node
|
||||||
|
|
||||||
if (elem->IsPoly()) {
|
switch ( geomType ) {
|
||||||
|
|
||||||
// polygon or polyhedral volume
|
case SMDSGeom_POLYGON: // ---------------------- polygon
|
||||||
switch ( elemType ) {
|
|
||||||
case SMDSAbs_Face:
|
|
||||||
{
|
{
|
||||||
vector<const SMDS_MeshNode*> poly_nodes (nbNodes);
|
vector<const SMDS_MeshNode*> poly_nodes (nbNodes);
|
||||||
int iNode = 0;
|
int iNode = 0;
|
||||||
@ -5739,7 +5746,8 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SMDSAbs_Volume:
|
|
||||||
|
case SMDSGeom_POLYHEDRA: // ------------------ polyhedral volume
|
||||||
{
|
{
|
||||||
const SMDS_VtkVolume* aPolyedre =
|
const SMDS_VtkVolume* aPolyedre =
|
||||||
dynamic_cast<const SMDS_VtkVolume*>( elem );
|
dynamic_cast<const SMDS_VtkVolume*>( elem );
|
||||||
@ -5749,7 +5757,7 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
|
|||||||
}
|
}
|
||||||
|
|
||||||
vector<const SMDS_MeshNode*> poly_nodes; poly_nodes.reserve( nbNodes );
|
vector<const SMDS_MeshNode*> poly_nodes; poly_nodes.reserve( nbNodes );
|
||||||
vector<int> quantities;
|
vector<int> quantities; quantities.reserve( nbNodes );
|
||||||
|
|
||||||
bool allTransformed = true;
|
bool allTransformed = true;
|
||||||
int nbFaces = aPolyedre->NbFaces();
|
int nbFaces = aPolyedre->NbFaces();
|
||||||
@ -5784,13 +5792,28 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:;
|
|
||||||
|
case SMDSGeom_BALL: // -------------------- Ball
|
||||||
|
{
|
||||||
|
if ( !theCopy && !theTargetMesh ) continue;
|
||||||
|
|
||||||
|
TNodeNodeMap::iterator nodeMapIt = nodeMap.find( elem->GetNode(0) );
|
||||||
|
if (nodeMapIt == nodeMap.end())
|
||||||
|
continue; // not all nodes transformed
|
||||||
|
|
||||||
|
double diameter = static_cast<const SMDS_BallElement*>(elem)->GetDiameter();
|
||||||
|
if ( theTargetMesh ) {
|
||||||
|
myLastCreatedElems.Append(aTgtMesh->AddBall( nodeMapIt->second, diameter ));
|
||||||
|
srcElems.Append( elem );
|
||||||
}
|
}
|
||||||
continue;
|
else {
|
||||||
|
myLastCreatedElems.Append(aMesh->AddBall( nodeMapIt->second, diameter ));
|
||||||
|
srcElems.Append( elem );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
} // elem->isPoly()
|
default: // ----------------------- Regular elements
|
||||||
|
|
||||||
// Regular elements
|
|
||||||
|
|
||||||
while ( iForw.size() < nbNodes ) iForw.push_back( iForw.size() );
|
while ( iForw.size() < nbNodes ) iForw.push_back( iForw.size() );
|
||||||
const std::vector<int>& iRev = SMDS_MeshCell::reverseSmdsOrder( elem->GetEntityType() );
|
const std::vector<int>& iRev = SMDS_MeshCell::reverseSmdsOrder( elem->GetEntityType() );
|
||||||
@ -5827,6 +5850,7 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
|
|||||||
if ( nbNodes > 2 )
|
if ( nbNodes > 2 )
|
||||||
aMesh->ChangeElementNodes( elem, &nodes[0], nbNodes );
|
aMesh->ChangeElementNodes( elem, &nodes[0], nbNodes );
|
||||||
}
|
}
|
||||||
|
} // switch ( geomType )
|
||||||
|
|
||||||
} // loop on elements
|
} // loop on elements
|
||||||
|
|
||||||
@ -6627,7 +6651,7 @@ void SMESH_ElementSearcherImpl::findOuterBoundary(const SMDS_MeshElement* outerF
|
|||||||
* \brief Find elements of given type where the given point is IN or ON.
|
* \brief Find elements of given type where the given point is IN or ON.
|
||||||
* Returns nb of found elements and elements them-selves.
|
* Returns nb of found elements and elements them-selves.
|
||||||
*
|
*
|
||||||
* 'ALL' type means elements of any type excluding nodes and 0D elements
|
* 'ALL' type means elements of any type excluding nodes, balls and 0D elements
|
||||||
*/
|
*/
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
@ -6641,7 +6665,7 @@ FindElementsByPoint(const gp_Pnt& point,
|
|||||||
double tolerance = getTolerance();
|
double tolerance = getTolerance();
|
||||||
|
|
||||||
// =================================================================================
|
// =================================================================================
|
||||||
if ( type == SMDSAbs_Node || type == SMDSAbs_0DElement )
|
if ( type == SMDSAbs_Node || type == SMDSAbs_0DElement || type == SMDSAbs_Ball)
|
||||||
{
|
{
|
||||||
if ( !_nodeSearcher )
|
if ( !_nodeSearcher )
|
||||||
_nodeSearcher = new SMESH_NodeSearcherImpl( _mesh );
|
_nodeSearcher = new SMESH_NodeSearcherImpl( _mesh );
|
||||||
@ -6658,7 +6682,7 @@ FindElementsByPoint(const gp_Pnt& point,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SMDS_ElemIteratorPtr elemIt = closeNode->GetInverseElementIterator( SMDSAbs_0DElement );
|
SMDS_ElemIteratorPtr elemIt = closeNode->GetInverseElementIterator( type );
|
||||||
while ( elemIt->more() )
|
while ( elemIt->more() )
|
||||||
foundElements.push_back( elemIt->next() );
|
foundElements.push_back( elemIt->next() );
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
|
||||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
|
|
||||||
// File : SMESH_MeshEditor.hxx
|
// File : SMESH_MeshEditor.hxx
|
||||||
// Created : Mon Apr 12 14:56:19 2004
|
// Created : Mon Apr 12 14:56:19 2004
|
||||||
// Author : Edward AGAPOV (eap)
|
// Author : Edward AGAPOV (eap)
|
||||||
@ -117,7 +116,8 @@ public:
|
|||||||
SMDS_MeshElement* AddElement(const std::vector<const SMDS_MeshNode*> & nodes,
|
SMDS_MeshElement* AddElement(const std::vector<const SMDS_MeshNode*> & nodes,
|
||||||
const SMDSAbs_ElementType type,
|
const SMDSAbs_ElementType type,
|
||||||
const bool isPoly,
|
const bool isPoly,
|
||||||
const int ID = -1);
|
const int ID = -1,
|
||||||
|
const double ballDiameter=0.);
|
||||||
/*!
|
/*!
|
||||||
* \brief Add element
|
* \brief Add element
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user