+ SMDS_MeshFace* AddPolygonalFace (const std::vector<const SMDS_MeshNode*>& nodes,

+  SMDS_MeshVolume* AddPolyhedralVolume (const std::vector<const SMDS_MeshNode*>& nodes,
This commit is contained in:
eap 2010-10-04 11:25:52 +00:00
parent 679fca4c8a
commit 7b7daf5e4b
2 changed files with 111 additions and 0 deletions

View File

@ -1089,6 +1089,45 @@ SMDS_MeshFace* SMESH_MesherHelper::AddFace(const SMDS_MeshNode* n1,
return elem;
}
//=======================================================================
//function : AddPolygonalFace
//purpose : Creates polygon, with additional nodes in quadratic mesh
//=======================================================================
SMDS_MeshFace* SMESH_MesherHelper::AddPolygonalFace (const vector<const SMDS_MeshNode*>& nodes,
const int id,
const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshFace* elem = 0;
if(!myCreateQuadratic) {
if(id)
elem = meshDS->AddPolygonalFaceWithID(nodes, id);
else
elem = meshDS->AddPolygonalFace(nodes);
}
else {
vector<const SMDS_MeshNode*> newNodes;
for ( int i = 0; i < nodes.size(); ++i )
{
const SMDS_MeshNode* n1 = nodes[i];
const SMDS_MeshNode* n2 = nodes[(i+1)/nodes.size()];
const SMDS_MeshNode* n12 = GetMediumNode(n1,n2,force3d);
newNodes.push_back( n1 );
newNodes.push_back( n12 );
}
if(id)
elem = meshDS->AddPolygonalFaceWithID(newNodes, id);
else
elem = meshDS->AddPolygonalFace(newNodes);
}
if ( mySetElemOnShape && myShapeID > 0 )
meshDS->SetMeshElementOnShape( elem, myShapeID );
return elem;
}
//=======================================================================
//function : AddVolume
//purpose : Creates quadratic or linear prism
@ -1279,6 +1318,62 @@ SMDS_MeshVolume* SMESH_MesherHelper::AddVolume(const SMDS_MeshNode* n1,
return elem;
}
//=======================================================================
//function : AddPolyhedralVolume
//purpose : Creates polyhedron. In quadratic mesh, adds medium nodes
//=======================================================================
SMDS_MeshVolume*
SMESH_MesherHelper::AddPolyhedralVolume (const std::vector<const SMDS_MeshNode*>& nodes,
const std::vector<int>& quantities,
const int id,
const bool force3d)
{
SMESHDS_Mesh * meshDS = GetMeshDS();
SMDS_MeshVolume* elem = 0;
if(!myCreateQuadratic)
{
if(id)
elem = meshDS->AddPolyhedralVolumeWithID(nodes, quantities, id);
else
elem = meshDS->AddPolyhedralVolume(nodes, quantities);
}
else
{
vector<const SMDS_MeshNode*> newNodes;
vector<int> newQuantities;
for ( int iFace=0, iN=0; iFace < quantities.size(); ++iFace)
{
int nbNodesInFace = quantities[iFace];
newQuantities.push_back(0);
for ( int i = 0; i < nbNodesInFace; ++i )
{
const SMDS_MeshNode* n1 = nodes[ iN + i ];
newNodes.push_back( n1 );
newQuantities.back()++;
const SMDS_MeshNode* n2 = nodes[ iN + ( i+1==nbNodesInFace ? 0 : i+1 )];
// if ( n1->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE &&
// n2->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE )
{
const SMDS_MeshNode* n12 = GetMediumNode(n1,n2,force3d);
newNodes.push_back( n12 );
newQuantities.back()++;
}
}
iN += nbNodesInFace;
}
if(id)
elem = meshDS->AddPolyhedralVolumeWithID( newNodes, newQuantities, id );
else
elem = meshDS->AddPolyhedralVolume( newNodes, newQuantities );
}
if ( mySetElemOnShape && myShapeID > 0 )
meshDS->SetMeshElementOnShape( elem, myShapeID );
return elem;
}
//=======================================================================
//function : LoadNodeColumns
//purpose : Load nodes bound to face into a map of node columns

View File

@ -39,6 +39,7 @@
#include <gp_Pnt2d.hxx>
#include <map>
#include <vector>
class GeomAPI_ProjectPointOnSurf;
@ -221,6 +222,13 @@ public:
const SMDS_MeshNode* n4,
const int id = 0,
const bool force3d = false);
/*!
* Creates polygon, with additional nodes in quadratic mesh
*/
SMDS_MeshFace* AddPolygonalFace (const std::vector<const SMDS_MeshNode*>& nodes,
const int id = 0,
const bool force3d = false);
/*!
* Creates quadratic or linear tetraahedron
*/
@ -264,6 +272,14 @@ public:
const SMDS_MeshNode* n8,
const int id = 0,
bool force3d = true);
/*!
* Creates polyhedron. In quadratic mesh, adds medium nodes
*/
SMDS_MeshVolume* AddPolyhedralVolume (const std::vector<const SMDS_MeshNode*>& nodes,
const std::vector<int>& quantities,
const int ID=0,
const bool force3d = true);
/*!
* \brief Return U of the given node on the edge
*/