mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-16 01:41:27 +05:00
Changes for working with quadratic elements.
This commit is contained in:
parent
ca9000e60d
commit
75b33910e0
@ -164,9 +164,9 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
|
|||||||
|
|
||||||
// Get nodes of the element
|
// Get nodes of the element
|
||||||
|
|
||||||
|
if(anElem->IsQuadratic()) {
|
||||||
const SMDS_QuadraticFaceOfNodes* F =
|
const SMDS_QuadraticFaceOfNodes* F =
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(anElem);
|
static_cast<const SMDS_QuadraticFaceOfNodes*>(anElem);
|
||||||
if(F) {
|
|
||||||
// use special nodes iterator
|
// use special nodes iterator
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
||||||
if ( anIter != 0 ) {
|
if ( anIter != 0 ) {
|
||||||
|
@ -616,15 +616,12 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
|
|||||||
else if ( theNbNodes == 6 ) return VTK_WEDGE;
|
else if ( theNbNodes == 6 ) return VTK_WEDGE;
|
||||||
else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
|
else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
|
||||||
else if ( theNbNodes == 10 ) {
|
else if ( theNbNodes == 10 ) {
|
||||||
cout<<"QUADRATIC_TETRA"<<endl;
|
|
||||||
return VTK_QUADRATIC_TETRA;
|
return VTK_QUADRATIC_TETRA;
|
||||||
}
|
}
|
||||||
else if ( theNbNodes == 20 ) {
|
else if ( theNbNodes == 20 ) {
|
||||||
cout<<"QUADRATIC_HEXAHEDRON"<<endl;
|
|
||||||
return VTK_QUADRATIC_HEXAHEDRON;
|
return VTK_QUADRATIC_HEXAHEDRON;
|
||||||
}
|
}
|
||||||
else if ( theNbNodes==13 || theNbNodes==15 ) {
|
else if ( theNbNodes==13 || theNbNodes==15 ) {
|
||||||
cout<<"QUADRATIC - CONVEX_POINT_SET"<<endl;
|
|
||||||
return VTK_CONVEX_POINT_SET;
|
return VTK_CONVEX_POINT_SET;
|
||||||
}
|
}
|
||||||
else return VTK_EMPTY_CELL;
|
else return VTK_EMPTY_CELL;
|
||||||
|
@ -1087,13 +1087,25 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
|||||||
if ( edge )
|
if ( edge )
|
||||||
Ok = const_cast<SMDS_MeshEdge*>( edge )->ChangeNodes( nodes[0], nodes[1] );
|
Ok = const_cast<SMDS_MeshEdge*>( edge )->ChangeNodes( nodes[0], nodes[1] );
|
||||||
}
|
}
|
||||||
|
else if ( nbnodes == 3 ) {
|
||||||
|
const SMDS_QuadraticEdge* edge = dynamic_cast<const SMDS_QuadraticEdge*>( elem );
|
||||||
|
if ( edge )
|
||||||
|
Ok = const_cast<SMDS_QuadraticEdge*>( edge )->ChangeNodes( nodes[0], nodes[1], nodes[2] );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMDSAbs_Face: {
|
case SMDSAbs_Face: {
|
||||||
const SMDS_FaceOfNodes* face = dynamic_cast<const SMDS_FaceOfNodes*>( elem );
|
const SMDS_FaceOfNodes* face = dynamic_cast<const SMDS_FaceOfNodes*>( elem );
|
||||||
if ( face ) {
|
if ( face ) {
|
||||||
Ok = const_cast<SMDS_FaceOfNodes*>( face )->ChangeNodes( nodes, nbnodes );
|
Ok = const_cast<SMDS_FaceOfNodes*>( face )->ChangeNodes( nodes, nbnodes );
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
const SMDS_QuadraticFaceOfNodes* QF =
|
||||||
|
dynamic_cast<const SMDS_QuadraticFaceOfNodes*>( elem );
|
||||||
|
if ( QF ) {
|
||||||
|
Ok = const_cast<SMDS_QuadraticFaceOfNodes*>( QF )->ChangeNodes( nodes, nbnodes );
|
||||||
|
}
|
||||||
|
else {
|
||||||
/// ??? begin
|
/// ??? begin
|
||||||
const SMDS_PolygonalFaceOfNodes* face = dynamic_cast<const SMDS_PolygonalFaceOfNodes*>(elem);
|
const SMDS_PolygonalFaceOfNodes* face = dynamic_cast<const SMDS_PolygonalFaceOfNodes*>(elem);
|
||||||
if (face) {
|
if (face) {
|
||||||
@ -1101,6 +1113,7 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
|||||||
}
|
}
|
||||||
/// ??? end
|
/// ??? end
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//case SMDSAbs_PolygonalFace: {
|
//case SMDSAbs_PolygonalFace: {
|
||||||
@ -1112,8 +1125,15 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
|||||||
//}
|
//}
|
||||||
case SMDSAbs_Volume: {
|
case SMDSAbs_Volume: {
|
||||||
const SMDS_VolumeOfNodes* vol = dynamic_cast<const SMDS_VolumeOfNodes*>( elem );
|
const SMDS_VolumeOfNodes* vol = dynamic_cast<const SMDS_VolumeOfNodes*>( elem );
|
||||||
if ( vol )
|
if ( vol ) {
|
||||||
Ok = const_cast<SMDS_VolumeOfNodes*>( vol )->ChangeNodes( nodes, nbnodes );
|
Ok = const_cast<SMDS_VolumeOfNodes*>( vol )->ChangeNodes( nodes, nbnodes );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const SMDS_QuadraticVolumeOfNodes* QV = dynamic_cast<const SMDS_QuadraticVolumeOfNodes*>( elem );
|
||||||
|
if ( QV ) {
|
||||||
|
Ok = const_cast<SMDS_QuadraticVolumeOfNodes*>( QV )->ChangeNodes( nodes, nbnodes );
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -1203,6 +1223,7 @@ bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement * elem,
|
|||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : FindEdge
|
//function : FindEdge
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1226,16 +1247,12 @@ const SMDS_MeshEdge* SMDS_Mesh::FindEdge(const SMDS_MeshNode * node1,
|
|||||||
SMDS_ElemIteratorPtr it1=node1->edgesIterator();
|
SMDS_ElemIteratorPtr it1=node1->edgesIterator();
|
||||||
//PROFILER_Get(0);
|
//PROFILER_Get(0);
|
||||||
//PROFILER_Set();
|
//PROFILER_Set();
|
||||||
while(it1->more())
|
while(it1->more()) {
|
||||||
{
|
const SMDS_MeshEdge * e=static_cast<const SMDS_MeshEdge *> (it1->next());
|
||||||
const SMDS_MeshEdge * e=static_cast<const SMDS_MeshEdge *>
|
|
||||||
(it1->next());
|
|
||||||
SMDS_ElemIteratorPtr it2=e->nodesIterator();
|
SMDS_ElemIteratorPtr it2=e->nodesIterator();
|
||||||
while(it2->more())
|
while(it2->more()) {
|
||||||
{
|
if(it2->next()->GetID()==node2->GetID()) {
|
||||||
if(it2->next()->GetID()==node2->GetID())
|
toReturn = e;
|
||||||
{
|
|
||||||
toReturn=e;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1245,19 +1262,64 @@ const SMDS_MeshEdge* SMDS_Mesh::FindEdge(const SMDS_MeshNode * node1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : FindEdgeOrCreate
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
SMDS_MeshEdge* SMDS_Mesh::FindEdgeOrCreate(const SMDS_MeshNode * node1,
|
SMDS_MeshEdge* SMDS_Mesh::FindEdgeOrCreate(const SMDS_MeshNode * node1,
|
||||||
const SMDS_MeshNode * node2)
|
const SMDS_MeshNode * node2)
|
||||||
{
|
{
|
||||||
SMDS_MeshEdge * toReturn=NULL;
|
SMDS_MeshEdge * toReturn=NULL;
|
||||||
toReturn=const_cast<SMDS_MeshEdge*>(FindEdge(node1,node2));
|
toReturn=const_cast<SMDS_MeshEdge*>(FindEdge(node1,node2));
|
||||||
if(toReturn==NULL)
|
if(toReturn==NULL) {
|
||||||
{
|
|
||||||
toReturn=new SMDS_MeshEdge(node1,node2);
|
toReturn=new SMDS_MeshEdge(node1,node2);
|
||||||
myEdges.Add(toReturn);
|
myEdges.Add(toReturn);
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : FindEdge
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
const SMDS_MeshEdge* SMDS_Mesh::FindEdge(int idnode1, int idnode2,
|
||||||
|
int idnode3) const
|
||||||
|
{
|
||||||
|
const SMDS_MeshNode * node1=FindNode(idnode1);
|
||||||
|
const SMDS_MeshNode * node2=FindNode(idnode2);
|
||||||
|
const SMDS_MeshNode * node3=FindNode(idnode3);
|
||||||
|
if( (node1==NULL) || (node2==NULL) || (node3==NULL) ) return NULL;
|
||||||
|
return FindEdge(node1,node2,node3);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshEdge* SMDS_Mesh::FindEdge(const SMDS_MeshNode * node1,
|
||||||
|
const SMDS_MeshNode * node2,
|
||||||
|
const SMDS_MeshNode * node3)
|
||||||
|
{
|
||||||
|
const SMDS_MeshEdge * toReturn = NULL;
|
||||||
|
SMDS_ElemIteratorPtr it1 = node1->edgesIterator();
|
||||||
|
while(it1->more()) {
|
||||||
|
const SMDS_MeshEdge * e = static_cast<const SMDS_MeshEdge *> (it1->next());
|
||||||
|
SMDS_ElemIteratorPtr it2 = e->nodesIterator();
|
||||||
|
int tmp = 0;
|
||||||
|
while(it2->more()) {
|
||||||
|
int nID = it2->next()->GetID();
|
||||||
|
if( nID==node2->GetID() || nID==node3->GetID() ) {
|
||||||
|
tmp++;
|
||||||
|
if(tmp==2) {
|
||||||
|
toReturn = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : FindFace
|
//function : FindFace
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1269,12 +1331,11 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace(int idnode1, int idnode2,
|
|||||||
const SMDS_MeshNode * node1=FindNode(idnode1);
|
const SMDS_MeshNode * node1=FindNode(idnode1);
|
||||||
const SMDS_MeshNode * node2=FindNode(idnode2);
|
const SMDS_MeshNode * node2=FindNode(idnode2);
|
||||||
const SMDS_MeshNode * node3=FindNode(idnode3);
|
const SMDS_MeshNode * node3=FindNode(idnode3);
|
||||||
if((node1==NULL)||(node2==NULL)||(node3==NULL)) return NULL;
|
if( (node1==NULL) || (node2==NULL) || (node3==NULL) ) return NULL;
|
||||||
return FindFace(node1, node2, node3);
|
return FindFace(node1, node2, node3);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SMDS_MeshFace* SMDS_Mesh::FindFace(
|
const SMDS_MeshFace* SMDS_Mesh::FindFace(const SMDS_MeshNode *node1,
|
||||||
const SMDS_MeshNode *node1,
|
|
||||||
const SMDS_MeshNode *node2,
|
const SMDS_MeshNode *node2,
|
||||||
const SMDS_MeshNode *node3)
|
const SMDS_MeshNode *node3)
|
||||||
{
|
{
|
||||||
@ -1282,58 +1343,55 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace(
|
|||||||
const SMDS_MeshElement * node;
|
const SMDS_MeshElement * node;
|
||||||
bool node2found, node3found;
|
bool node2found, node3found;
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr it1=node1->facesIterator();
|
SMDS_ElemIteratorPtr it1 = node1->facesIterator();
|
||||||
while(it1->more())
|
while(it1->more()) {
|
||||||
{
|
face = static_cast<const SMDS_MeshFace*>(it1->next());
|
||||||
face=static_cast<const SMDS_MeshFace*>(it1->next());
|
|
||||||
if(face->NbNodes()!=3) continue;
|
if(face->NbNodes()!=3) continue;
|
||||||
SMDS_ElemIteratorPtr it2=face->nodesIterator();
|
SMDS_ElemIteratorPtr it2 = face->nodesIterator();
|
||||||
node2found=false;
|
node2found = false;
|
||||||
node3found=false;
|
node3found = false;
|
||||||
while(it2->more())
|
while(it2->more()) {
|
||||||
{
|
node = it2->next();
|
||||||
node=it2->next();
|
if(node->GetID()==node2->GetID()) node2found = true;
|
||||||
if(node->GetID()==node2->GetID()) node2found=true;
|
if(node->GetID()==node3->GetID()) node3found = true;
|
||||||
if(node->GetID()==node3->GetID()) node3found=true;
|
|
||||||
}
|
}
|
||||||
if(node2found&&node3found)
|
if( node2found && node3found )
|
||||||
return face;
|
return face;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMDS_MeshFace* SMDS_Mesh::FindFaceOrCreate(
|
SMDS_MeshFace* SMDS_Mesh::FindFaceOrCreate(const SMDS_MeshNode *node1,
|
||||||
const SMDS_MeshNode *node1,
|
|
||||||
const SMDS_MeshNode *node2,
|
const SMDS_MeshNode *node2,
|
||||||
const SMDS_MeshNode *node3)
|
const SMDS_MeshNode *node3)
|
||||||
{
|
{
|
||||||
SMDS_MeshFace * toReturn=NULL;
|
SMDS_MeshFace * toReturn=NULL;
|
||||||
toReturn=const_cast<SMDS_MeshFace*>(FindFace(node1,node2,node3));
|
toReturn = const_cast<SMDS_MeshFace*>(FindFace(node1,node2,node3));
|
||||||
if(toReturn==NULL)
|
if(toReturn==NULL) {
|
||||||
{
|
toReturn = createTriangle(node1,node2,node3);
|
||||||
toReturn=createTriangle(node1,node2,node3);
|
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : FindFace
|
//function : FindFace
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
const SMDS_MeshFace* SMDS_Mesh::FindFace(int idnode1, int idnode2, int idnode3,
|
const SMDS_MeshFace* SMDS_Mesh::FindFace(int idnode1, int idnode2,
|
||||||
int idnode4) const
|
int idnode3, int idnode4) const
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode * node1=FindNode(idnode1);
|
const SMDS_MeshNode * node1=FindNode(idnode1);
|
||||||
const SMDS_MeshNode * node2=FindNode(idnode2);
|
const SMDS_MeshNode * node2=FindNode(idnode2);
|
||||||
const SMDS_MeshNode * node3=FindNode(idnode3);
|
const SMDS_MeshNode * node3=FindNode(idnode3);
|
||||||
const SMDS_MeshNode * node4=FindNode(idnode4);
|
const SMDS_MeshNode * node4=FindNode(idnode4);
|
||||||
if((node1==NULL)||(node2==NULL)||(node3==NULL)||(node4==NULL)) return NULL;
|
if( (node1==NULL) || (node2==NULL) || (node3==NULL) || (node4==NULL) )
|
||||||
|
return NULL;
|
||||||
return FindFace(node1, node2, node3, node4);
|
return FindFace(node1, node2, node3, node4);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SMDS_MeshFace* SMDS_Mesh::FindFace(
|
const SMDS_MeshFace* SMDS_Mesh::FindFace(const SMDS_MeshNode *node1,
|
||||||
const SMDS_MeshNode *node1,
|
|
||||||
const SMDS_MeshNode *node2,
|
const SMDS_MeshNode *node2,
|
||||||
const SMDS_MeshNode *node3,
|
const SMDS_MeshNode *node3,
|
||||||
const SMDS_MeshNode *node4)
|
const SMDS_MeshNode *node4)
|
||||||
@ -1341,43 +1399,148 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace(
|
|||||||
const SMDS_MeshFace * face;
|
const SMDS_MeshFace * face;
|
||||||
const SMDS_MeshElement * node;
|
const SMDS_MeshElement * node;
|
||||||
bool node2found, node3found, node4found;
|
bool node2found, node3found, node4found;
|
||||||
SMDS_ElemIteratorPtr it1=node1->facesIterator();
|
SMDS_ElemIteratorPtr it1 = node1->facesIterator();
|
||||||
while(it1->more())
|
while(it1->more()) {
|
||||||
{
|
face = static_cast<const SMDS_MeshFace *>(it1->next());
|
||||||
face=static_cast<const SMDS_MeshFace *>(it1->next());
|
|
||||||
if(face->NbNodes()!=4) continue;
|
if(face->NbNodes()!=4) continue;
|
||||||
SMDS_ElemIteratorPtr it2=face->nodesIterator();
|
SMDS_ElemIteratorPtr it2 = face->nodesIterator();
|
||||||
node2found=false;
|
node2found = false;
|
||||||
node3found=false;
|
node3found = false;
|
||||||
node4found=false;
|
node4found = false;
|
||||||
while(it2->more())
|
while(it2->more()) {
|
||||||
{
|
|
||||||
node=it2->next();
|
node=it2->next();
|
||||||
if(node->GetID()==node2->GetID()) node2found=true;
|
if(node->GetID()==node2->GetID()) node2found = true;
|
||||||
if(node->GetID()==node3->GetID()) node3found=true;
|
if(node->GetID()==node3->GetID()) node3found = true;
|
||||||
if(node->GetID()==node4->GetID()) node4found=true;
|
if(node->GetID()==node4->GetID()) node4found = true;
|
||||||
}
|
}
|
||||||
if(node2found&&node3found&&node4found)
|
if( node2found && node3found && node4found )
|
||||||
return face;
|
return face;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMDS_MeshFace* SMDS_Mesh::FindFaceOrCreate(
|
SMDS_MeshFace* SMDS_Mesh::FindFaceOrCreate(const SMDS_MeshNode *node1,
|
||||||
const SMDS_MeshNode *node1,
|
|
||||||
const SMDS_MeshNode *node2,
|
const SMDS_MeshNode *node2,
|
||||||
const SMDS_MeshNode *node3,
|
const SMDS_MeshNode *node3,
|
||||||
const SMDS_MeshNode *node4)
|
const SMDS_MeshNode *node4)
|
||||||
{
|
{
|
||||||
SMDS_MeshFace * toReturn=NULL;
|
SMDS_MeshFace * toReturn=NULL;
|
||||||
toReturn=const_cast<SMDS_MeshFace*>(FindFace(node1,node2,node3,node4));
|
toReturn=const_cast<SMDS_MeshFace*>(FindFace(node1,node2,node3,node4));
|
||||||
if(toReturn==NULL)
|
if(toReturn==NULL) {
|
||||||
{
|
|
||||||
toReturn=createQuadrangle(node1,node2,node3,node4);
|
toReturn=createQuadrangle(node1,node2,node3,node4);
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : FindFace
|
||||||
|
//purpose :quadratic triangle
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
const SMDS_MeshFace* SMDS_Mesh::FindFace(int idnode1, int idnode2,
|
||||||
|
int idnode3, int idnode4,
|
||||||
|
int idnode5, int idnode6) const
|
||||||
|
{
|
||||||
|
const SMDS_MeshNode * node1 = FindNode(idnode1);
|
||||||
|
const SMDS_MeshNode * node2 = FindNode(idnode2);
|
||||||
|
const SMDS_MeshNode * node3 = FindNode(idnode3);
|
||||||
|
const SMDS_MeshNode * node4 = FindNode(idnode4);
|
||||||
|
const SMDS_MeshNode * node5 = FindNode(idnode5);
|
||||||
|
const SMDS_MeshNode * node6 = FindNode(idnode6);
|
||||||
|
if( (node1==NULL) || (node2==NULL) || (node3==NULL) ||
|
||||||
|
(node4==NULL) || (node5==NULL) || (node6==NULL) ) return NULL;
|
||||||
|
return FindFace(node1, node2, node3, node4, node5, node6);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshFace* SMDS_Mesh::FindFace(const SMDS_MeshNode *node1,
|
||||||
|
const SMDS_MeshNode *node2,
|
||||||
|
const SMDS_MeshNode *node3,
|
||||||
|
const SMDS_MeshNode *node4,
|
||||||
|
const SMDS_MeshNode *node5,
|
||||||
|
const SMDS_MeshNode *node6)
|
||||||
|
{
|
||||||
|
const SMDS_MeshFace * face;
|
||||||
|
const SMDS_MeshElement * node;
|
||||||
|
SMDS_ElemIteratorPtr it1 = node1->facesIterator();
|
||||||
|
while(it1->more()) {
|
||||||
|
face = static_cast<const SMDS_MeshFace*>(it1->next());
|
||||||
|
if(face->NbNodes()!=6) continue;
|
||||||
|
SMDS_ElemIteratorPtr it2 = face->nodesIterator();
|
||||||
|
int tmp = 0;
|
||||||
|
while(it2->more()) {
|
||||||
|
node = it2->next();
|
||||||
|
if(node->GetID()==node2->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node3->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node4->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node5->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node6->GetID()) tmp++;
|
||||||
|
}
|
||||||
|
if( tmp==5 )
|
||||||
|
return static_cast<const SMDS_MeshFace*>(face);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : FindFace
|
||||||
|
//purpose : quadratic quadrangle
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
const SMDS_MeshFace* SMDS_Mesh::FindFace(int idnode1, int idnode2,
|
||||||
|
int idnode3, int idnode4,
|
||||||
|
int idnode5, int idnode6,
|
||||||
|
int idnode7, int idnode8) const
|
||||||
|
{
|
||||||
|
const SMDS_MeshNode * node1 = FindNode(idnode1);
|
||||||
|
const SMDS_MeshNode * node2 = FindNode(idnode2);
|
||||||
|
const SMDS_MeshNode * node3 = FindNode(idnode3);
|
||||||
|
const SMDS_MeshNode * node4 = FindNode(idnode4);
|
||||||
|
const SMDS_MeshNode * node5 = FindNode(idnode5);
|
||||||
|
const SMDS_MeshNode * node6 = FindNode(idnode6);
|
||||||
|
const SMDS_MeshNode * node7 = FindNode(idnode7);
|
||||||
|
const SMDS_MeshNode * node8 = FindNode(idnode8);
|
||||||
|
if( (node1==NULL) || (node2==NULL) || (node3==NULL) || (node4==NULL) ||
|
||||||
|
(node5==NULL) || (node6==NULL) || (node7==NULL) || (node8==NULL) )
|
||||||
|
return NULL;
|
||||||
|
return FindFace(node1, node2, node3, node4, node5, node6, node7, node8);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshFace* SMDS_Mesh::FindFace(const SMDS_MeshNode *node1,
|
||||||
|
const SMDS_MeshNode *node2,
|
||||||
|
const SMDS_MeshNode *node3,
|
||||||
|
const SMDS_MeshNode *node4,
|
||||||
|
const SMDS_MeshNode *node5,
|
||||||
|
const SMDS_MeshNode *node6,
|
||||||
|
const SMDS_MeshNode *node7,
|
||||||
|
const SMDS_MeshNode *node8)
|
||||||
|
{
|
||||||
|
const SMDS_MeshFace * face;
|
||||||
|
const SMDS_MeshElement * node;
|
||||||
|
SMDS_ElemIteratorPtr it1 = node1->facesIterator();
|
||||||
|
while(it1->more()) {
|
||||||
|
face = static_cast<const SMDS_MeshFace *>(it1->next());
|
||||||
|
if(face->NbNodes()!=8) continue;
|
||||||
|
SMDS_ElemIteratorPtr it2 = face->nodesIterator();
|
||||||
|
int tmp = 0;
|
||||||
|
while(it2->more()) {
|
||||||
|
node = it2->next();
|
||||||
|
if(node->GetID()==node2->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node3->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node4->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node5->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node6->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node7->GetID()) tmp++;
|
||||||
|
if(node->GetID()==node8->GetID()) tmp++;
|
||||||
|
}
|
||||||
|
if( tmp==7 )
|
||||||
|
return face;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : FindElement
|
//function : FindElement
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -378,7 +378,7 @@ public:
|
|||||||
const SMDS_MeshNode * n12,
|
const SMDS_MeshNode * n12,
|
||||||
const SMDS_MeshNode * n23,
|
const SMDS_MeshNode * n23,
|
||||||
const SMDS_MeshNode * n34,
|
const SMDS_MeshNode * n34,
|
||||||
const SMDS_MeshNode * n51,
|
const SMDS_MeshNode * n41,
|
||||||
const SMDS_MeshNode * n56,
|
const SMDS_MeshNode * n56,
|
||||||
const SMDS_MeshNode * n67,
|
const SMDS_MeshNode * n67,
|
||||||
const SMDS_MeshNode * n78,
|
const SMDS_MeshNode * n78,
|
||||||
@ -399,7 +399,7 @@ public:
|
|||||||
const SMDS_MeshNode * n12,
|
const SMDS_MeshNode * n12,
|
||||||
const SMDS_MeshNode * n23,
|
const SMDS_MeshNode * n23,
|
||||||
const SMDS_MeshNode * n34,
|
const SMDS_MeshNode * n34,
|
||||||
const SMDS_MeshNode * n51,
|
const SMDS_MeshNode * n41,
|
||||||
const SMDS_MeshNode * n56,
|
const SMDS_MeshNode * n56,
|
||||||
const SMDS_MeshNode * n67,
|
const SMDS_MeshNode * n67,
|
||||||
const SMDS_MeshNode * n78,
|
const SMDS_MeshNode * n78,
|
||||||
@ -456,11 +456,19 @@ public:
|
|||||||
|
|
||||||
const SMDS_MeshNode *FindNode(int idnode) const;
|
const SMDS_MeshNode *FindNode(int idnode) const;
|
||||||
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
|
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
|
||||||
|
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2, int idnode3) const;
|
||||||
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
|
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
|
||||||
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4) const;
|
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4) const;
|
||||||
|
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3,
|
||||||
|
int idnode4, int idnode5, int idnode6) const;
|
||||||
|
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
|
||||||
|
int idnode5, int idnode6, int idnode7, int idnode8) const;
|
||||||
const SMDS_MeshElement *FindElement(int IDelem) const;
|
const SMDS_MeshElement *FindElement(int IDelem) const;
|
||||||
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
|
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
|
||||||
const SMDS_MeshNode * n2);
|
const SMDS_MeshNode * n2);
|
||||||
|
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
|
||||||
|
const SMDS_MeshNode * n2,
|
||||||
|
const SMDS_MeshNode * n3);
|
||||||
static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
|
static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
|
||||||
const SMDS_MeshNode *n2,
|
const SMDS_MeshNode *n2,
|
||||||
const SMDS_MeshNode *n3);
|
const SMDS_MeshNode *n3);
|
||||||
@ -468,6 +476,20 @@ public:
|
|||||||
const SMDS_MeshNode *n2,
|
const SMDS_MeshNode *n2,
|
||||||
const SMDS_MeshNode *n3,
|
const SMDS_MeshNode *n3,
|
||||||
const SMDS_MeshNode *n4);
|
const SMDS_MeshNode *n4);
|
||||||
|
static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
|
||||||
|
const SMDS_MeshNode *n2,
|
||||||
|
const SMDS_MeshNode *n3,
|
||||||
|
const SMDS_MeshNode *n4,
|
||||||
|
const SMDS_MeshNode *n5,
|
||||||
|
const SMDS_MeshNode *n6);
|
||||||
|
static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
|
||||||
|
const SMDS_MeshNode *n2,
|
||||||
|
const SMDS_MeshNode *n3,
|
||||||
|
const SMDS_MeshNode *n4,
|
||||||
|
const SMDS_MeshNode *n5,
|
||||||
|
const SMDS_MeshNode *n6,
|
||||||
|
const SMDS_MeshNode *n7,
|
||||||
|
const SMDS_MeshNode *n8);
|
||||||
|
|
||||||
const SMDS_MeshFace *FindFace(std::vector<int> nodes_ids) const;
|
const SMDS_MeshFace *FindFace(std::vector<int> nodes_ids) const;
|
||||||
static const SMDS_MeshFace* FindFace(std::vector<const SMDS_MeshNode *> nodes);
|
static const SMDS_MeshFace* FindFace(std::vector<const SMDS_MeshNode *> nodes);
|
||||||
|
@ -218,7 +218,7 @@ bool SMDS_MeshElement::IsQuadratic() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMDS_MeshElement::IsMediumNode(class SMDS_MeshNode* node) const
|
bool SMDS_MeshElement::IsMediumNode(const SMDS_MeshNode* node) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
virtual bool IsPoly() const { return false; };
|
virtual bool IsPoly() const { return false; };
|
||||||
virtual bool IsQuadratic() const;
|
virtual bool IsQuadratic() const;
|
||||||
|
|
||||||
virtual bool IsMediumNode(class SMDS_MeshNode* node) const;
|
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
|
||||||
|
|
||||||
friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
|
friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
|
||||||
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
|
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
|
||||||
|
@ -970,7 +970,8 @@ bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, doub
|
|||||||
XYZ aVec13( p3 - p1 );
|
XYZ aVec13( p3 - p1 );
|
||||||
XYZ cross = aVec12.Crossed( aVec13 );
|
XYZ cross = aVec12.Crossed( aVec13 );
|
||||||
|
|
||||||
if ( myFaceNbNodes == 4 ) {
|
//if ( myFaceNbNodes == 4 ) {
|
||||||
|
if ( myFaceNbNodes >3 ) {
|
||||||
XYZ p4 ( myFaceNodes[3] );
|
XYZ p4 ( myFaceNodes[3] );
|
||||||
XYZ aVec14( p4 - p1 );
|
XYZ aVec14( p4 - p1 );
|
||||||
XYZ cross2 = aVec13.Crossed( aVec14 );
|
XYZ cross2 = aVec13.Crossed( aVec14 );
|
||||||
@ -1106,7 +1107,7 @@ bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
|
|||||||
bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
|
bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
|
||||||
const int theNode2Index) const
|
const int theNode2Index) const
|
||||||
{
|
{
|
||||||
if (myVolume->IsPoly()) {
|
if ( myVolume->IsPoly() ) {
|
||||||
return IsLinked(myVolumeNodes[theNode1Index], myVolumeNodes[theNode2Index]);
|
return IsLinked(myVolumeNodes[theNode1Index], myVolumeNodes[theNode2Index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1144,6 +1145,57 @@ bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
|
|||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 10:
|
||||||
|
{
|
||||||
|
switch ( minInd ) {
|
||||||
|
case 0: if( maxInd==4 || maxInd==6 || maxInd==7 ) return true;
|
||||||
|
case 1: if( maxInd==4 || maxInd==5 || maxInd==8 ) return true;
|
||||||
|
case 2: if( maxInd==5 || maxInd==6 || maxInd==9 ) return true;
|
||||||
|
case 3: if( maxInd==7 || maxInd==8 || maxInd==9 ) return true;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 13:
|
||||||
|
{
|
||||||
|
switch ( minInd ) {
|
||||||
|
case 0: if( maxInd==5 || maxInd==8 || maxInd==9 ) return true;
|
||||||
|
case 1: if( maxInd==5 || maxInd==6 || maxInd==10 ) return true;
|
||||||
|
case 2: if( maxInd==6 || maxInd==7 || maxInd==11 ) return true;
|
||||||
|
case 3: if( maxInd==7 || maxInd==8 || maxInd==12 ) return true;
|
||||||
|
case 4: if( maxInd==9 || maxInd==10 || maxInd==11 || maxInd==12 ) return true;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 15:
|
||||||
|
{
|
||||||
|
switch ( minInd ) {
|
||||||
|
case 0: if( maxInd==6 || maxInd==8 || maxInd==12 ) return true;
|
||||||
|
case 1: if( maxInd==6 || maxInd==7 || maxInd==13 ) return true;
|
||||||
|
case 2: if( maxInd==7 || maxInd==8 || maxInd==14 ) return true;
|
||||||
|
case 3: if( maxInd==9 || maxInd==11 || maxInd==12 ) return true;
|
||||||
|
case 4: if( maxInd==9 || maxInd==10 || maxInd==13 ) return true;
|
||||||
|
case 5: if( maxInd==10 || maxInd==11 || maxInd==14 ) return true;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 20:
|
||||||
|
{
|
||||||
|
switch ( minInd ) {
|
||||||
|
case 0: if( maxInd==8 || maxInd==11 || maxInd==16 ) return true;
|
||||||
|
case 1: if( maxInd==8 || maxInd==9 || maxInd==17 ) return true;
|
||||||
|
case 2: if( maxInd==9 || maxInd==10 || maxInd==18 ) return true;
|
||||||
|
case 3: if( maxInd==10 || maxInd==11 || maxInd==19 ) return true;
|
||||||
|
case 4: if( maxInd==12 || maxInd==15 || maxInd==16 ) return true;
|
||||||
|
case 5: if( maxInd==12 || maxInd==13 || maxInd==17 ) return true;
|
||||||
|
case 6: if( maxInd==13 || maxInd==14 || maxInd==18 ) return true;
|
||||||
|
case 7: if( maxInd==14 || maxInd==15 || maxInd==19 ) return true;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1185,8 +1237,7 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
|
|||||||
typedef map< const SMDS_MeshElement*, int > TElemIntMap;
|
typedef map< const SMDS_MeshElement*, int > TElemIntMap;
|
||||||
TElemIntMap volNbShared;
|
TElemIntMap volNbShared;
|
||||||
TElemIntMap::iterator vNbIt;
|
TElemIntMap::iterator vNbIt;
|
||||||
for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
|
for ( int iNode = 0; iNode < nbFaceNodes; iNode++ ) {
|
||||||
{
|
|
||||||
const SMDS_MeshNode* n = nodes[ iNode ];
|
const SMDS_MeshNode* n = nodes[ iNode ];
|
||||||
SMDS_ElemIteratorPtr eIt = n->GetInverseElementIterator();
|
SMDS_ElemIteratorPtr eIt = n->GetInverseElementIterator();
|
||||||
while ( eIt->more() ) {
|
while ( eIt->more() ) {
|
||||||
@ -1194,10 +1245,12 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
|
|||||||
if ( elem != myVolume && elem->GetType() == SMDSAbs_Volume ) {
|
if ( elem != myVolume && elem->GetType() == SMDSAbs_Volume ) {
|
||||||
int nbShared = 1;
|
int nbShared = 1;
|
||||||
vNbIt = volNbShared.find( elem );
|
vNbIt = volNbShared.find( elem );
|
||||||
if ( vNbIt == volNbShared.end() )
|
if ( vNbIt == volNbShared.end() ) {
|
||||||
volNbShared.insert ( TElemIntMap::value_type( elem, nbShared ));
|
volNbShared.insert ( TElemIntMap::value_type( elem, nbShared ));
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
nbShared = ++(*vNbIt).second;
|
nbShared = ++(*vNbIt).second;
|
||||||
|
}
|
||||||
if ( nbShared > maxNbShared )
|
if ( nbShared > maxNbShared )
|
||||||
maxNbShared = nbShared;
|
maxNbShared = nbShared;
|
||||||
}
|
}
|
||||||
@ -1213,8 +1266,7 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
|
|||||||
if ( IsFaceExternal( faceIndex ))
|
if ( IsFaceExternal( faceIndex ))
|
||||||
intNormal = XYZ( -intNormal.x, -intNormal.y, -intNormal.z );
|
intNormal = XYZ( -intNormal.x, -intNormal.y, -intNormal.z );
|
||||||
XYZ p0 ( nodes[0] ), baryCenter;
|
XYZ p0 ( nodes[0] ), baryCenter;
|
||||||
for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ )
|
for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ ) {
|
||||||
{
|
|
||||||
int nbShared = (*vNbIt).second;
|
int nbShared = (*vNbIt).second;
|
||||||
if ( nbShared >= 3 ) {
|
if ( nbShared >= 3 ) {
|
||||||
SMDS_VolumeTool volume( (*vNbIt).first );
|
SMDS_VolumeTool volume( (*vNbIt).first );
|
||||||
@ -1226,20 +1278,20 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
|
|||||||
// remove a volume from volNbShared map
|
// remove a volume from volNbShared map
|
||||||
volNbShared.erase( vNbIt );
|
volNbShared.erase( vNbIt );
|
||||||
}
|
}
|
||||||
|
|
||||||
// here volNbShared contains only volumes laying on the
|
// here volNbShared contains only volumes laying on the
|
||||||
// opposite side of the face
|
// opposite side of the face
|
||||||
if ( volNbShared.empty() )
|
if ( volNbShared.empty() ) {
|
||||||
return free; // is free
|
return free; // is free
|
||||||
|
}
|
||||||
|
|
||||||
// check if the whole area of a face is shared
|
// check if the whole area of a face is shared
|
||||||
bool isShared[] = { false, false, false, false }; // 4 triangle parts of a quadrangle
|
bool isShared[] = { false, false, false, false }; // 4 triangle parts of a quadrangle
|
||||||
for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ )
|
for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ ) {
|
||||||
{
|
|
||||||
SMDS_VolumeTool volume( (*vNbIt).first );
|
SMDS_VolumeTool volume( (*vNbIt).first );
|
||||||
bool prevLinkShared = false;
|
bool prevLinkShared = false;
|
||||||
int nbSharedLinks = 0;
|
int nbSharedLinks = 0;
|
||||||
for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
|
for ( int iNode = 0; iNode < nbFaceNodes; iNode++ ) {
|
||||||
{
|
|
||||||
bool linkShared = volume.IsLinked( nodes[ iNode ], nodes[ iNode + 1] );
|
bool linkShared = volume.IsLinked( nodes[ iNode ], nodes[ iNode + 1] );
|
||||||
if ( linkShared )
|
if ( linkShared )
|
||||||
nbSharedLinks++;
|
nbSharedLinks++;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
#include "SMESH_2D_Algo.hxx"
|
#include "SMESH_2D_Algo.hxx"
|
||||||
#include "SMESH_Gen.hxx"
|
#include "SMESH_Gen.hxx"
|
||||||
#include "SMESH_subMesh.hxx"
|
#include <TopExp.hxx>
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen)
|
|||||||
// _compatibleHypothesis.push_back("hypothese_2D_bidon");
|
// _compatibleHypothesis.push_back("hypothese_2D_bidon");
|
||||||
_type = ALGO_2D;
|
_type = ALGO_2D;
|
||||||
gen->_map2D_Algo[hypId] = this;
|
gen->_map2D_Algo[hypId] = this;
|
||||||
|
myCreateQuadratic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -55,6 +56,7 @@ SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen)
|
|||||||
|
|
||||||
SMESH_2D_Algo::~SMESH_2D_Algo()
|
SMESH_2D_Algo::~SMESH_2D_Algo()
|
||||||
{
|
{
|
||||||
|
myCreateQuadratic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -80,13 +82,16 @@ int SMESH_2D_Algo::NumberOfWires(const TopoDS_Shape& S)
|
|||||||
int SMESH_2D_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W)
|
int SMESH_2D_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W)
|
||||||
{
|
{
|
||||||
int nbPoints = 0;
|
int nbPoints = 0;
|
||||||
for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next())
|
for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next()) {
|
||||||
{
|
|
||||||
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
|
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
|
||||||
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||||
|
if(myCreateQuadratic)
|
||||||
|
nb = nb/2;
|
||||||
//SCRUTE(nb);
|
//SCRUTE(nb);
|
||||||
nbPoints += nb +1; // internal points plus 1 vertex of 2 (last point ?)
|
nbPoints += nb +1; // internal points plus 1 vertex of 2 (last point ?)
|
||||||
}
|
}
|
||||||
//SCRUTE(nbPoints);
|
//SCRUTE(nbPoints);
|
||||||
return nbPoints;
|
return nbPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
#define _SMESH_2D_ALGO_HXX_
|
#define _SMESH_2D_ALGO_HXX_
|
||||||
|
|
||||||
#include "SMESH_Algo.hxx"
|
#include "SMESH_Algo.hxx"
|
||||||
#include <TopoDS_Wire.hxx>
|
#include "SMESH_subMesh.hxx"
|
||||||
|
#include "TopoDS_Wire.hxx"
|
||||||
|
|
||||||
class SMESH_2D_Algo:
|
class SMESH_2D_Algo:
|
||||||
public SMESH_Algo
|
public SMESH_Algo
|
||||||
@ -41,6 +42,9 @@ public:
|
|||||||
|
|
||||||
int NumberOfWires(const TopoDS_Shape& S);
|
int NumberOfWires(const TopoDS_Shape& S);
|
||||||
int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W);
|
int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool myCreateQuadratic;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
#include "SMESH_3D_Algo.hxx"
|
#include "SMESH_3D_Algo.hxx"
|
||||||
#include "SMESH_Gen.hxx"
|
#include "SMESH_Gen.hxx"
|
||||||
#include "SMESH_subMesh.hxx"
|
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
@ -56,3 +55,5 @@ SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen)
|
|||||||
SMESH_3D_Algo::~SMESH_3D_Algo()
|
SMESH_3D_Algo::~SMESH_3D_Algo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ class SMESH_3D_Algo:
|
|||||||
public:
|
public:
|
||||||
SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen);
|
SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen);
|
||||||
virtual ~SMESH_3D_Algo();
|
virtual ~SMESH_3D_Algo();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,15 +33,18 @@
|
|||||||
|
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <gp_XY.hxx>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
class SMESH_Gen;
|
class SMESH_Gen;
|
||||||
class SMESH_Mesh;
|
class SMESH_Mesh;
|
||||||
class TopoDS_Face;
|
class TopoDS_Face;
|
||||||
class SMESHDS_Mesh;
|
class SMESHDS_Mesh;
|
||||||
|
class SMDS_MeshNode;
|
||||||
|
|
||||||
class SMESH_Algo:public SMESH_Hypothesis
|
class SMESH_Algo:public SMESH_Hypothesis
|
||||||
{
|
{
|
||||||
@ -97,6 +100,7 @@ class SMESH_Algo:public SMESH_Hypothesis
|
|||||||
std::vector<std::string> _compatibleHypothesis;
|
std::vector<std::string> _compatibleHypothesis;
|
||||||
std::list<const SMESHDS_Hypothesis *> _appliedHypList;
|
std::list<const SMESHDS_Hypothesis *> _appliedHypList;
|
||||||
std::list<const SMESHDS_Hypothesis *> _usedHypList;
|
std::list<const SMESHDS_Hypothesis *> _usedHypList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -861,7 +861,8 @@ int SMESH_Mesh::NbTriangles() throw(SALOME_Exception)
|
|||||||
const SMDS_MeshFace * curFace;
|
const SMDS_MeshFace * curFace;
|
||||||
while (itFaces->more()) {
|
while (itFaces->more()) {
|
||||||
curFace = itFaces->next();
|
curFace = itFaces->next();
|
||||||
if (!curFace->IsPoly() && curFace->NbNodes() == 3) Nb++;
|
if ( !curFace->IsPoly() &&
|
||||||
|
( curFace->NbNodes()==3 || curFace->NbNodes()==6 ) ) Nb++;
|
||||||
}
|
}
|
||||||
return Nb;
|
return Nb;
|
||||||
}
|
}
|
||||||
@ -879,7 +880,8 @@ int SMESH_Mesh::NbQuadrangles() throw(SALOME_Exception)
|
|||||||
const SMDS_MeshFace * curFace;
|
const SMDS_MeshFace * curFace;
|
||||||
while (itFaces->more()) {
|
while (itFaces->more()) {
|
||||||
curFace = itFaces->next();
|
curFace = itFaces->next();
|
||||||
if (!curFace->IsPoly() && curFace->NbNodes() == 4) Nb++;
|
if ( !curFace->IsPoly() &&
|
||||||
|
( curFace->NbNodes() == 4 || curFace->NbNodes()==8 ) ) Nb++;
|
||||||
}
|
}
|
||||||
return Nb;
|
return Nb;
|
||||||
}
|
}
|
||||||
@ -917,7 +919,8 @@ int SMESH_Mesh::NbTetras() throw(SALOME_Exception)
|
|||||||
const SMDS_MeshVolume * curVolume;
|
const SMDS_MeshVolume * curVolume;
|
||||||
while (itVolumes->more()) {
|
while (itVolumes->more()) {
|
||||||
curVolume = itVolumes->next();
|
curVolume = itVolumes->next();
|
||||||
if (!curVolume->IsPoly() && curVolume->NbNodes() == 4) Nb++;
|
if ( !curVolume->IsPoly() &&
|
||||||
|
( curVolume->NbNodes() == 4 || curVolume->NbNodes()==10 ) ) Nb++;
|
||||||
}
|
}
|
||||||
return Nb;
|
return Nb;
|
||||||
}
|
}
|
||||||
@ -931,7 +934,8 @@ int SMESH_Mesh::NbHexas() throw(SALOME_Exception)
|
|||||||
const SMDS_MeshVolume * curVolume;
|
const SMDS_MeshVolume * curVolume;
|
||||||
while (itVolumes->more()) {
|
while (itVolumes->more()) {
|
||||||
curVolume = itVolumes->next();
|
curVolume = itVolumes->next();
|
||||||
if (!curVolume->IsPoly() && curVolume->NbNodes() == 8) Nb++;
|
if ( !curVolume->IsPoly() &&
|
||||||
|
( curVolume->NbNodes() == 8 || curVolume->NbNodes()==20 ) ) Nb++;
|
||||||
}
|
}
|
||||||
return Nb;
|
return Nb;
|
||||||
}
|
}
|
||||||
@ -945,7 +949,8 @@ int SMESH_Mesh::NbPyramids() throw(SALOME_Exception)
|
|||||||
const SMDS_MeshVolume * curVolume;
|
const SMDS_MeshVolume * curVolume;
|
||||||
while (itVolumes->more()) {
|
while (itVolumes->more()) {
|
||||||
curVolume = itVolumes->next();
|
curVolume = itVolumes->next();
|
||||||
if (!curVolume->IsPoly() && curVolume->NbNodes() == 5) Nb++;
|
if ( !curVolume->IsPoly() &&
|
||||||
|
( curVolume->NbNodes() == 5 || curVolume->NbNodes()==13 ) ) Nb++;
|
||||||
}
|
}
|
||||||
return Nb;
|
return Nb;
|
||||||
}
|
}
|
||||||
@ -959,7 +964,8 @@ int SMESH_Mesh::NbPrisms() throw(SALOME_Exception)
|
|||||||
const SMDS_MeshVolume * curVolume;
|
const SMDS_MeshVolume * curVolume;
|
||||||
while (itVolumes->more()) {
|
while (itVolumes->more()) {
|
||||||
curVolume = itVolumes->next();
|
curVolume = itVolumes->next();
|
||||||
if (!curVolume->IsPoly() && curVolume->NbNodes() == 6) Nb++;
|
if ( !curVolume->IsPoly() &&
|
||||||
|
( curVolume->NbNodes() == 6 || curVolume->NbNodes()==15 ) ) Nb++;
|
||||||
}
|
}
|
||||||
return Nb;
|
return Nb;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -388,6 +388,35 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
|
|||||||
anActor = myActor;
|
anActor = myActor;
|
||||||
if (anActor != 0)
|
if (anActor != 0)
|
||||||
{
|
{
|
||||||
|
// skl 07.02.2006
|
||||||
|
SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
|
||||||
|
if( myFilterType == SMESHGUI_TriaFilter ||
|
||||||
|
myFilterType == SMESHGUI_QuadFilter ||
|
||||||
|
myFilterType == SMESHGUI_FaceFilter ) {
|
||||||
|
SMDS_FaceIteratorPtr it = aMesh->facesIterator();
|
||||||
|
while(it->more()) {
|
||||||
|
const SMDS_MeshFace* f = it->next();
|
||||||
|
if(myFilterType == SMESHGUI_FaceFilter) {
|
||||||
|
myIds.Add(f->GetID());
|
||||||
|
}
|
||||||
|
else if( myFilterType==SMESHGUI_TriaFilter &&
|
||||||
|
( f->NbNodes()==3 || f->NbNodes()==6 ) ) {
|
||||||
|
myIds.Add(f->GetID());
|
||||||
|
}
|
||||||
|
else if( myFilterType==SMESHGUI_QuadFilter &&
|
||||||
|
( f->NbNodes()==4 || f->NbNodes()==8 ) ) {
|
||||||
|
myIds.Add(f->GetID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(myFilterType == SMESHGUI_VolumeFilter) {
|
||||||
|
SMDS_VolumeIteratorPtr it = aMesh->volumesIterator();
|
||||||
|
while(it->more()) {
|
||||||
|
const SMDS_MeshVolume* f = it->next();
|
||||||
|
myIds.Add(f->GetID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* commented by skl 07.02.2006
|
||||||
TVisualObjPtr aVisualObj = anActor->GetObject();
|
TVisualObjPtr aVisualObj = anActor->GetObject();
|
||||||
vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid();
|
vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid();
|
||||||
if (aGrid != 0) {
|
if (aGrid != 0) {
|
||||||
@ -411,6 +440,7 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ EXPORT_HEADERS = \
|
|||||||
StdMeshers_AutomaticLength.hxx \
|
StdMeshers_AutomaticLength.hxx \
|
||||||
StdMeshers_Distribution.hxx \
|
StdMeshers_Distribution.hxx \
|
||||||
StdMeshers_QuadranglePreference.hxx \
|
StdMeshers_QuadranglePreference.hxx \
|
||||||
|
StdMeshers_Helper.hxx \
|
||||||
StdMeshers_QuadraticMesh.hxx
|
StdMeshers_QuadraticMesh.hxx
|
||||||
|
|
||||||
EXPORT_PYSCRIPTS =
|
EXPORT_PYSCRIPTS =
|
||||||
@ -78,6 +79,7 @@ LIB_SRC = \
|
|||||||
StdMeshers_AutomaticLength.cxx \
|
StdMeshers_AutomaticLength.cxx \
|
||||||
StdMeshers_Distribution.cxx \
|
StdMeshers_Distribution.cxx \
|
||||||
StdMeshers_QuadranglePreference.cxx \
|
StdMeshers_QuadranglePreference.cxx \
|
||||||
|
StdMeshers_Helper.cxx \
|
||||||
StdMeshers_QuadraticMesh.cxx
|
StdMeshers_QuadraticMesh.cxx
|
||||||
|
|
||||||
LIB_SERVER_IDL =
|
LIB_SERVER_IDL =
|
||||||
|
433
src/StdMeshers/StdMeshers_Helper.cxx
Normal file
433
src/StdMeshers/StdMeshers_Helper.cxx
Normal file
@ -0,0 +1,433 @@
|
|||||||
|
// File: StdMeshers_Helper.cxx
|
||||||
|
// Created: 15.02.06 15:22:41
|
||||||
|
// Author: Sergey KUUL
|
||||||
|
// Copyright: Open CASCADE 2006
|
||||||
|
|
||||||
|
|
||||||
|
#include "StdMeshers_Helper.hxx"
|
||||||
|
|
||||||
|
#include "TopTools_MapOfShape.hxx"
|
||||||
|
#include "BRepTools.hxx"
|
||||||
|
#include "BRepTools_WireExplorer.hxx"
|
||||||
|
#include "SMDS_FacePosition.hxx"
|
||||||
|
#include "SMDS_EdgePosition.hxx"
|
||||||
|
#include "SMESH_subMesh.hxx"
|
||||||
|
#include "Geom2d_Curve.hxx"
|
||||||
|
#include "Geom_Curve.hxx"
|
||||||
|
#include "Geom_Surface.hxx"
|
||||||
|
#include "BRep_Tool.hxx"
|
||||||
|
#include "gp_Pnt2d.hxx"
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : CheckShape
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
bool StdMeshers_Helper::IsQuadraticSubMesh(const TopoDS_Shape& aSh,
|
||||||
|
const bool QuadMode)
|
||||||
|
{
|
||||||
|
SMESHDS_Mesh* meshDS = GetMesh()->GetMeshDS();
|
||||||
|
myShapeID = meshDS->ShapeToIndex(aSh);
|
||||||
|
myCreateQuadratic = false;
|
||||||
|
if(QuadMode) {
|
||||||
|
// we can create quadratic elements only if each elements
|
||||||
|
// created on given shape is quadratic
|
||||||
|
// also we have to fill myNLinkNodeMap
|
||||||
|
myCreateQuadratic = true;
|
||||||
|
if(aSh.ShapeType()!=TopAbs_FACE) {
|
||||||
|
for (TopExp_Explorer exp(aSh, TopAbs_FACE); exp.More() && myCreateQuadratic; exp.Next()) {
|
||||||
|
const TopoDS_Face& F = TopoDS::Face(exp.Current());
|
||||||
|
SMDS_ElemIteratorPtr itf = GetMesh()->GetSubMesh(F)->GetSubMeshDS()->GetElements();
|
||||||
|
while(itf->more()) {
|
||||||
|
const SMDS_MeshElement* f = itf->next();
|
||||||
|
if( f->GetType()==SMDSAbs_Face && !f->IsQuadratic() ) {
|
||||||
|
myCreateQuadratic = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SMDS_ElemIteratorPtr itn = f->nodesIterator();
|
||||||
|
if(f->NbNodes()==6) {
|
||||||
|
const SMDS_MeshNode* Ns[6];
|
||||||
|
int i = 0;
|
||||||
|
while(itn->more()) {
|
||||||
|
Ns[i++] = static_cast<const SMDS_MeshNode*>( itn->next() );
|
||||||
|
}
|
||||||
|
AddNLinkNode(Ns[0],Ns[1],Ns[3]);
|
||||||
|
AddNLinkNode(Ns[1],Ns[2],Ns[4]);
|
||||||
|
AddNLinkNode(Ns[2],Ns[0],Ns[5]);
|
||||||
|
}
|
||||||
|
else if(f->NbNodes()==8) {
|
||||||
|
const SMDS_MeshNode* Ns[8];
|
||||||
|
int i = 0;
|
||||||
|
while(itn->more()) {
|
||||||
|
Ns[i++] = static_cast<const SMDS_MeshNode*>( itn->next() );
|
||||||
|
}
|
||||||
|
AddNLinkNode(Ns[0],Ns[1],Ns[4]);
|
||||||
|
AddNLinkNode(Ns[1],Ns[2],Ns[5]);
|
||||||
|
AddNLinkNode(Ns[2],Ns[3],Ns[6]);
|
||||||
|
AddNLinkNode(Ns[3],Ns[0],Ns[7]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TopTools_MapOfShape aMap;
|
||||||
|
// check edges
|
||||||
|
const TopoDS_Face& F = TopoDS::Face(aSh);
|
||||||
|
const TopoDS_Wire& W = BRepTools::OuterWire(F);
|
||||||
|
BRepTools_WireExplorer wexp (W, F);
|
||||||
|
for (wexp.Init(W, F); wexp.More() && myCreateQuadratic; wexp.Next()) {
|
||||||
|
const TopoDS_Edge& E = wexp.Current();
|
||||||
|
if(aMap.Contains(E))
|
||||||
|
continue;
|
||||||
|
aMap.Add(E);
|
||||||
|
SMDS_ElemIteratorPtr it = GetMesh()->GetSubMesh(E)->GetSubMeshDS()->GetElements();
|
||||||
|
while(it->more()) {
|
||||||
|
const SMDS_MeshElement* e = it->next();
|
||||||
|
if( e->GetType()==SMDSAbs_Edge && !e->IsQuadratic() ) {
|
||||||
|
myCreateQuadratic = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// fill NLinkNodeMap
|
||||||
|
SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
|
||||||
|
const SMDS_MeshNode* n1 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
const SMDS_MeshNode* n2 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
const SMDS_MeshNode* n3 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 ));
|
||||||
|
myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n3));
|
||||||
|
myNLinkNodeMap[link] = n3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!myCreateQuadratic) {
|
||||||
|
myNLinkNodeMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
return myCreateQuadratic;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsMedium
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
bool StdMeshers_Helper::IsMedium(const SMDS_MeshNode* n)
|
||||||
|
{
|
||||||
|
SMDS_ElemIteratorPtr it = n->GetInverseElementIterator();
|
||||||
|
while (it->more()) {
|
||||||
|
const SMDS_MeshElement* elem = it->next();
|
||||||
|
return elem->IsMediumNode(n);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : AddNLinkNode
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* Auxilary function for filling myNLinkNodeMap
|
||||||
|
*/
|
||||||
|
void StdMeshers_Helper::AddNLinkNode(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n12)
|
||||||
|
{
|
||||||
|
NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 ));
|
||||||
|
ItNLinkNode itLN = myNLinkNodeMap.find( link );
|
||||||
|
if ( itLN == myNLinkNodeMap.end() ) {
|
||||||
|
// add new record to map
|
||||||
|
myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GetNodeUV
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* Auxilary function for GetMediumNode()
|
||||||
|
*/
|
||||||
|
gp_XY StdMeshers_Helper::GetNodeUV(const TopoDS_Face& F,
|
||||||
|
const SMDS_MeshNode* n)
|
||||||
|
{
|
||||||
|
gp_Pnt2d p2d;
|
||||||
|
const SMDS_PositionPtr Pos = n->GetPosition();
|
||||||
|
if(Pos->GetTypeOfPosition()==SMDS_TOP_FACE) {
|
||||||
|
//cout<<"face"<<endl;
|
||||||
|
// node has position on face
|
||||||
|
const SMDS_FacePosition* fpos =
|
||||||
|
static_cast<const SMDS_FacePosition*>(n->GetPosition().get());
|
||||||
|
p2d = gp_Pnt2d(fpos->GetUParameter(),fpos->GetVParameter());
|
||||||
|
//cout<<"fpos->GetUParameter()="<<fpos->GetUParameter()<<" fpos->GetVParameter()="<<fpos->GetVParameter()<<endl;
|
||||||
|
}
|
||||||
|
else if(Pos->GetTypeOfPosition()==SMDS_TOP_EDGE) {
|
||||||
|
// node has position on edge => it is needed to find
|
||||||
|
// corresponding edge from face, get pcurve for this
|
||||||
|
// edge and recieve value from this pcurve
|
||||||
|
const SMDS_EdgePosition* epos =
|
||||||
|
static_cast<const SMDS_EdgePosition*>(n->GetPosition().get());
|
||||||
|
double param = epos->GetUParameter();
|
||||||
|
SMESHDS_Mesh* meshDS = GetMesh()->GetMeshDS();
|
||||||
|
int edgeID = Pos->GetShapeId();
|
||||||
|
const TopoDS_Edge& E = TopoDS::Edge(meshDS->IndexToShape(edgeID));
|
||||||
|
double f, l;
|
||||||
|
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
|
||||||
|
p2d = C2d->Value(param);
|
||||||
|
}
|
||||||
|
else { // vertex position
|
||||||
|
SMESHDS_Mesh * meshDS = GetMesh()->GetMeshDS();
|
||||||
|
const TopoDS_Wire& W = BRepTools::OuterWire(F);
|
||||||
|
BRepTools_WireExplorer wexp (W, F);
|
||||||
|
TopoDS_Edge E;
|
||||||
|
for (wexp.Init(W, F); wexp.More(); wexp.Next()) {
|
||||||
|
E = wexp.Current();
|
||||||
|
TopoDS_Vertex V1 = TopExp::FirstVertex(E);
|
||||||
|
TopoDS_Vertex V2 = TopExp::LastVertex(E);
|
||||||
|
if( meshDS->ShapeToIndex(V1) != Pos->GetShapeId() &&
|
||||||
|
meshDS->ShapeToIndex(V2) != Pos->GetShapeId() ) continue;
|
||||||
|
double f2, l2;
|
||||||
|
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f2, l2);
|
||||||
|
double f, l;
|
||||||
|
TopLoc_Location L;
|
||||||
|
Handle(Geom_Curve) C = BRep_Tool::Curve(E, L, f, l);
|
||||||
|
gp_Pnt P = C->Value(f);
|
||||||
|
if(!L.IsIdentity()) P = P.Transformed(L.Transformation());
|
||||||
|
double tol = BRep_Tool::Tolerance(E);
|
||||||
|
double dx = n->X() - P.X();
|
||||||
|
double dy = n->Y() - P.Y();
|
||||||
|
double dz = n->Z() - P.Z();
|
||||||
|
double dist = sqrt(dx*dx + dy*dy + dz*dz);
|
||||||
|
if(dist<tol) {
|
||||||
|
p2d = C2d->Value(f2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p2d = C2d->Value(l2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p2d.XY();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GetMediumNode
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* Special function for search or creation medium node
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* StdMeshers_Helper::GetMediumNode(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const bool force3d)
|
||||||
|
{
|
||||||
|
//cout<<"n1: "<<n1;
|
||||||
|
//cout<<"n2: "<<n2;
|
||||||
|
NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 ));
|
||||||
|
ItNLinkNode itLN = myNLinkNodeMap.find( link );
|
||||||
|
if ( itLN != myNLinkNodeMap.end() ) {
|
||||||
|
return (*itLN).second;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// create medium node
|
||||||
|
SMDS_MeshNode* n12;
|
||||||
|
SMESHDS_Mesh* meshDS = GetMesh()->GetMeshDS();
|
||||||
|
if(!force3d) {
|
||||||
|
// we try to create medium node using UV parameters of
|
||||||
|
// nodes, else - medium between corresponding 3d points
|
||||||
|
const SMDS_PositionPtr Pos1 = n1->GetPosition();
|
||||||
|
const SMDS_PositionPtr Pos2 = n2->GetPosition();
|
||||||
|
int faceID = -1;
|
||||||
|
if( Pos1->GetTypeOfPosition()==SMDS_TOP_FACE ) {
|
||||||
|
faceID = Pos1->GetShapeId();
|
||||||
|
}
|
||||||
|
else if( Pos2->GetTypeOfPosition()==SMDS_TOP_FACE ) {
|
||||||
|
faceID = Pos2->GetShapeId();
|
||||||
|
}
|
||||||
|
if(faceID>-1) {
|
||||||
|
TopoDS_Face F = TopoDS::Face(meshDS->IndexToShape(faceID));
|
||||||
|
gp_XY p1 = GetNodeUV(F,n1);
|
||||||
|
gp_XY p2 = GetNodeUV(F,n2);
|
||||||
|
double u = (p1.X()+p2.X())/2.;
|
||||||
|
double v = (p1.Y()+p2.Y())/2.;
|
||||||
|
Handle(Geom_Surface) S = BRep_Tool::Surface(F);
|
||||||
|
gp_Pnt P = S->Value(u, v);
|
||||||
|
n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
||||||
|
meshDS->SetNodeOnFace(n12, faceID, u, v);
|
||||||
|
myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12));
|
||||||
|
return n12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 3d variant
|
||||||
|
double x = ( n1->X() + n2->X() )/2.;
|
||||||
|
double y = ( n1->Y() + n2->Y() )/2.;
|
||||||
|
double z = ( n1->Z() + n2->Z() )/2.;
|
||||||
|
n12 = meshDS->AddNode(x,y,z);
|
||||||
|
meshDS->SetNodeInVolume(n12, myShapeID);
|
||||||
|
myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12));
|
||||||
|
return n12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : AddFace
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* Special function for creation quadratic triangle
|
||||||
|
*/
|
||||||
|
SMDS_MeshFace* StdMeshers_Helper::AddFace(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3)
|
||||||
|
{
|
||||||
|
SMESHDS_Mesh * meshDS = GetMesh()->GetMeshDS();
|
||||||
|
if(!myCreateQuadratic) {
|
||||||
|
return meshDS->AddFace(n1, n2, n3);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n12 = GetMediumNode(n1,n2,false);
|
||||||
|
const SMDS_MeshNode* n23 = GetMediumNode(n2,n3,false);
|
||||||
|
const SMDS_MeshNode* n31 = GetMediumNode(n3,n1,false);
|
||||||
|
|
||||||
|
return meshDS->AddFace(n1, n2, n3, n12, n23, n31);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : AddFace
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* Special function for creation quadratic quadrangle
|
||||||
|
*/
|
||||||
|
SMDS_MeshFace* StdMeshers_Helper::AddFace(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3,
|
||||||
|
const SMDS_MeshNode* n4)
|
||||||
|
{
|
||||||
|
SMESHDS_Mesh * meshDS = GetMesh()->GetMeshDS();
|
||||||
|
if(!myCreateQuadratic) {
|
||||||
|
return meshDS->AddFace(n1, n2, n3, n4);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n12 = GetMediumNode(n1,n2,false);
|
||||||
|
const SMDS_MeshNode* n23 = GetMediumNode(n2,n3,false);
|
||||||
|
const SMDS_MeshNode* n34 = GetMediumNode(n3,n4,false);
|
||||||
|
const SMDS_MeshNode* n41 = GetMediumNode(n4,n1,false);
|
||||||
|
|
||||||
|
return meshDS->AddFace(n1, n2, n3, n4, n12, n23, n34, n41);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : AddVolume
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* Special function for creation quadratic volume
|
||||||
|
*/
|
||||||
|
SMDS_MeshVolume* StdMeshers_Helper::AddVolume(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3,
|
||||||
|
const SMDS_MeshNode* n4,
|
||||||
|
const SMDS_MeshNode* n5,
|
||||||
|
const SMDS_MeshNode* n6)
|
||||||
|
{
|
||||||
|
SMESHDS_Mesh * meshDS = GetMesh()->GetMeshDS();
|
||||||
|
if(!myCreateQuadratic) {
|
||||||
|
return meshDS->AddVolume(n1, n2, n3, n4, n5, n6);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n12 = GetMediumNode(n1,n2,true);
|
||||||
|
const SMDS_MeshNode* n23 = GetMediumNode(n2,n3,true);
|
||||||
|
const SMDS_MeshNode* n31 = GetMediumNode(n3,n1,true);
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n45 = GetMediumNode(n4,n5,true);
|
||||||
|
const SMDS_MeshNode* n56 = GetMediumNode(n5,n6,true);
|
||||||
|
const SMDS_MeshNode* n64 = GetMediumNode(n6,n4,true);
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n14 = GetMediumNode(n1,n4,true);
|
||||||
|
const SMDS_MeshNode* n25 = GetMediumNode(n2,n5,true);
|
||||||
|
const SMDS_MeshNode* n36 = GetMediumNode(n3,n6,true);
|
||||||
|
|
||||||
|
return meshDS->AddVolume(n1, n2, n3, n4, n5, n6,
|
||||||
|
n12, n23, n31, n45, n56, n64, n14, n25, n36);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : AddVolume
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* Special function for creation quadratic volume
|
||||||
|
*/
|
||||||
|
SMDS_MeshVolume* StdMeshers_Helper::AddVolume(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3,
|
||||||
|
const SMDS_MeshNode* n4)
|
||||||
|
{
|
||||||
|
SMESHDS_Mesh * meshDS = GetMesh()->GetMeshDS();
|
||||||
|
if(!myCreateQuadratic) {
|
||||||
|
return meshDS->AddVolume(n1, n2, n3, n4);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n12 = GetMediumNode(n1,n2,true);
|
||||||
|
const SMDS_MeshNode* n23 = GetMediumNode(n2,n3,true);
|
||||||
|
const SMDS_MeshNode* n31 = GetMediumNode(n3,n1,true);
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n14 = GetMediumNode(n1,n4,true);
|
||||||
|
const SMDS_MeshNode* n24 = GetMediumNode(n2,n4,true);
|
||||||
|
const SMDS_MeshNode* n34 = GetMediumNode(n3,n4,true);
|
||||||
|
|
||||||
|
return meshDS->AddVolume(n1, n2, n3, n4, n12, n23, n31, n14, n24, n34);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : AddVolume
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
/*!
|
||||||
|
* Special function for creation quadratic volume
|
||||||
|
*/
|
||||||
|
SMDS_MeshVolume* StdMeshers_Helper::AddVolume(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3,
|
||||||
|
const SMDS_MeshNode* n4,
|
||||||
|
const SMDS_MeshNode* n5,
|
||||||
|
const SMDS_MeshNode* n6,
|
||||||
|
const SMDS_MeshNode* n7,
|
||||||
|
const SMDS_MeshNode* n8)
|
||||||
|
{
|
||||||
|
SMESHDS_Mesh * meshDS = GetMesh()->GetMeshDS();
|
||||||
|
if(!myCreateQuadratic) {
|
||||||
|
return meshDS->AddVolume(n1, n2, n3, n4, n5, n6, n7, n8);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n12 = GetMediumNode(n1,n2,true);
|
||||||
|
const SMDS_MeshNode* n23 = GetMediumNode(n2,n3,true);
|
||||||
|
const SMDS_MeshNode* n34 = GetMediumNode(n3,n4,true);
|
||||||
|
const SMDS_MeshNode* n41 = GetMediumNode(n4,n1,true);
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n56 = GetMediumNode(n5,n6,true);
|
||||||
|
const SMDS_MeshNode* n67 = GetMediumNode(n6,n7,true);
|
||||||
|
const SMDS_MeshNode* n78 = GetMediumNode(n7,n8,true);
|
||||||
|
const SMDS_MeshNode* n85 = GetMediumNode(n8,n5,true);
|
||||||
|
|
||||||
|
const SMDS_MeshNode* n15 = GetMediumNode(n1,n5,true);
|
||||||
|
const SMDS_MeshNode* n26 = GetMediumNode(n2,n6,true);
|
||||||
|
const SMDS_MeshNode* n37 = GetMediumNode(n3,n7,true);
|
||||||
|
const SMDS_MeshNode* n48 = GetMediumNode(n4,n8,true);
|
||||||
|
|
||||||
|
return meshDS->AddVolume(n1, n2, n3, n4, n5, n6, n7, n8,
|
||||||
|
n12, n23, n34, n41, n56, n67,
|
||||||
|
n78, n85, n15, n26, n37, n48);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
149
src/StdMeshers/StdMeshers_Helper.hxx
Normal file
149
src/StdMeshers/StdMeshers_Helper.hxx
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
// File: StdMeshers_Helper.hxx
|
||||||
|
// Created: 15.02.06 14:48:09
|
||||||
|
// Author: Sergey KUUL
|
||||||
|
// Copyright: Open CASCADE 2006
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef StdMeshers_Helper_HeaderFile
|
||||||
|
#define StdMeshers_Helper_HeaderFile
|
||||||
|
|
||||||
|
#include <SMESH_Mesh.hxx>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <SMDS_MeshNode.hxx>
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <gp_XY.hxx>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
typedef pair<const SMDS_MeshNode*, const SMDS_MeshNode*> NLink;
|
||||||
|
typedef map<NLink, const SMDS_MeshNode*> NLinkNodeMap;
|
||||||
|
typedef map<NLink, const SMDS_MeshNode*>::iterator ItNLinkNode;
|
||||||
|
|
||||||
|
/// Class StdMeshers_Helper
|
||||||
|
//
|
||||||
|
|
||||||
|
class StdMeshers_Helper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// ---------- PUBLIC METHODS ----------
|
||||||
|
|
||||||
|
/// Empty constructor
|
||||||
|
StdMeshers_Helper(SMESH_Mesh& theMesh)
|
||||||
|
{ myMesh=(void *)&theMesh; myCreateQuadratic = false; }
|
||||||
|
|
||||||
|
SMESH_Mesh* GetMesh() const
|
||||||
|
{ return (SMESH_Mesh*)myMesh; }
|
||||||
|
|
||||||
|
/// Copy constructor
|
||||||
|
//Standard_EXPORT StdMeshers_Helper (const StdMeshers_Helper& theOther);
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
//Standard_EXPORT virtual ~StdMeshers_Helper ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check submesh for given shape
|
||||||
|
* If QuadMode is true: check if all elements on this shape
|
||||||
|
* are quadratic, if yes => set true to myCreateQuadratic
|
||||||
|
* (default value is false). Also fill myNLinkNodeMap
|
||||||
|
* Returns myCreateQuadratic
|
||||||
|
*/
|
||||||
|
bool IsQuadraticSubMesh(const TopoDS_Shape& aSh, const bool QuadMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if given node is medium
|
||||||
|
*/
|
||||||
|
bool IsMedium(const SMDS_MeshNode* n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auxilary function for filling myNLinkNodeMap
|
||||||
|
*/
|
||||||
|
void AddNLinkNode(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auxilary function for filling myNLinkNodeMap
|
||||||
|
*/
|
||||||
|
void AddNLinkNodeMap(const NLinkNodeMap& aMap)
|
||||||
|
{ myNLinkNodeMap.insert(aMap.begin(), aMap.end()); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns myNLinkNodeMap
|
||||||
|
*/
|
||||||
|
const NLinkNodeMap& GetNLinkNodeMap() { return myNLinkNodeMap; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auxilary function for GetMediumNode()
|
||||||
|
*/
|
||||||
|
gp_XY GetNodeUV(const TopoDS_Face& F,
|
||||||
|
const SMDS_MeshNode* n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special function for search or creation medium node
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* GetMediumNode(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const bool force3d);
|
||||||
|
/**
|
||||||
|
* Special function for creation quadratic triangle
|
||||||
|
*/
|
||||||
|
SMDS_MeshFace* AddFace(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special function for creation quadratic quadrangle
|
||||||
|
*/
|
||||||
|
SMDS_MeshFace* AddFace(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3,
|
||||||
|
const SMDS_MeshNode* n4);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special function for creation quadratic tetraahedron
|
||||||
|
*/
|
||||||
|
SMDS_MeshVolume* AddVolume(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3,
|
||||||
|
const SMDS_MeshNode* n4);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special function for creation quadratic pentahedron
|
||||||
|
*/
|
||||||
|
SMDS_MeshVolume* AddVolume(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3,
|
||||||
|
const SMDS_MeshNode* n4,
|
||||||
|
const SMDS_MeshNode* n5,
|
||||||
|
const SMDS_MeshNode* n6);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special function for creation quadratic hexahedron
|
||||||
|
*/
|
||||||
|
SMDS_MeshVolume* AddVolume(const SMDS_MeshNode* n1,
|
||||||
|
const SMDS_MeshNode* n2,
|
||||||
|
const SMDS_MeshNode* n3,
|
||||||
|
const SMDS_MeshNode* n4,
|
||||||
|
const SMDS_MeshNode* n5,
|
||||||
|
const SMDS_MeshNode* n6,
|
||||||
|
const SMDS_MeshNode* n7,
|
||||||
|
const SMDS_MeshNode* n8);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void* myMesh;
|
||||||
|
|
||||||
|
int myShapeID;
|
||||||
|
|
||||||
|
// Key for creation quadratic faces
|
||||||
|
bool myCreateQuadratic;
|
||||||
|
|
||||||
|
// special map for using during creation quadratic faces
|
||||||
|
NLinkNodeMap myNLinkNodeMap;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -45,6 +45,7 @@ using namespace std;
|
|||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_ListOfShape.hxx>
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||||
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <Geom_Surface.hxx>
|
#include <Geom_Surface.hxx>
|
||||||
@ -146,6 +147,7 @@ static bool findIJ (const SMDS_MeshNode* node, const FaceQuadStruct * quad, int&
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* Hexahedron mesh on hexaedron like form
|
* Hexahedron mesh on hexaedron like form
|
||||||
@ -173,15 +175,18 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
// 0.1 - shape must be a solid (or a shell) with 6 faces
|
// 0.1 - shape must be a solid (or a shell) with 6 faces
|
||||||
//MESSAGE("---");
|
//MESSAGE("---");
|
||||||
|
|
||||||
|
bool QuadMode = true;
|
||||||
|
|
||||||
|
myTool = new StdMeshers_Helper(aMesh);
|
||||||
|
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||||
|
|
||||||
vector < SMESH_subMesh * >meshFaces;
|
vector < SMESH_subMesh * >meshFaces;
|
||||||
for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next())
|
for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||||
{
|
|
||||||
SMESH_subMesh *aSubMesh = aMesh.GetSubMeshContaining(exp.Current());
|
SMESH_subMesh *aSubMesh = aMesh.GetSubMeshContaining(exp.Current());
|
||||||
ASSERT(aSubMesh);
|
ASSERT(aSubMesh);
|
||||||
meshFaces.push_back(aSubMesh);
|
meshFaces.push_back(aSubMesh);
|
||||||
}
|
}
|
||||||
if (meshFaces.size() != 6)
|
if (meshFaces.size() != 6) {
|
||||||
{
|
|
||||||
SCRUTE(meshFaces.size());
|
SCRUTE(meshFaces.size());
|
||||||
// ASSERT(0);
|
// ASSERT(0);
|
||||||
return false;
|
return false;
|
||||||
@ -190,8 +195,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
// 0.2 - is each face meshed with Quadrangle_2D? (so, with a wire of 4 edges)
|
// 0.2 - is each face meshed with Quadrangle_2D? (so, with a wire of 4 edges)
|
||||||
//MESSAGE("---");
|
//MESSAGE("---");
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++) {
|
||||||
{
|
|
||||||
TopoDS_Shape aFace = meshFaces[i]->GetSubShape();
|
TopoDS_Shape aFace = meshFaces[i]->GetSubShape();
|
||||||
SMESH_Algo *algo = _gen->GetAlgo(aMesh, aFace);
|
SMESH_Algo *algo = _gen->GetAlgo(aMesh, aFace);
|
||||||
string algoName = algo->GetName();
|
string algoName = algo->GetName();
|
||||||
@ -201,15 +205,17 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
if ( sm ) {
|
if ( sm ) {
|
||||||
isAllQuad = true;
|
isAllQuad = true;
|
||||||
SMDS_ElemIteratorPtr eIt = sm->GetElements();
|
SMDS_ElemIteratorPtr eIt = sm->GetElements();
|
||||||
while ( isAllQuad && eIt->more() )
|
while ( isAllQuad && eIt->more() ) {
|
||||||
isAllQuad = ( eIt->next()->NbNodes() == 4 );
|
const SMDS_MeshElement* elem = eIt->next();
|
||||||
|
isAllQuad = ( elem->NbNodes()==4 ||(myCreateQuadratic && elem->NbNodes()==8) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! isAllQuad ) {
|
if ( ! isAllQuad ) {
|
||||||
//modified by NIZNHY-PKV Wed Nov 17 15:31:37 2004 f
|
//modified by NIZNHY-PKV Wed Nov 17 15:31:37 2004 f
|
||||||
bool bIsOk;
|
bool bIsOk;
|
||||||
//
|
//
|
||||||
bIsOk=ComputePentahedralMesh(aMesh, aShape);
|
bIsOk = ComputePentahedralMesh(aMesh, aShape);
|
||||||
if (bIsOk) {
|
if (bIsOk) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -221,13 +227,15 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
StdMeshers_Quadrangle_2D *quadAlgo =
|
StdMeshers_Quadrangle_2D *quadAlgo =
|
||||||
dynamic_cast < StdMeshers_Quadrangle_2D * >(algo);
|
dynamic_cast < StdMeshers_Quadrangle_2D * >(algo);
|
||||||
ASSERT(quadAlgo);
|
ASSERT(quadAlgo);
|
||||||
try
|
try {
|
||||||
{
|
_quads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aFace, myCreateQuadratic);
|
||||||
_quads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aFace);
|
// add links created in quadAlgo into myNLinkNodeMap
|
||||||
|
// NLinkNodeMap aMap = quadAlgo->GetNLinkNodeMap();
|
||||||
|
// myNLinkNodeMap.insert(aMap.begin(), aMap.end());
|
||||||
|
myTool->AddNLinkNodeMap(quadAlgo->GetNLinkNodeMap());
|
||||||
// *** to delete after usage
|
// *** to delete after usage
|
||||||
}
|
}
|
||||||
catch(SALOME_Exception & S_ex)
|
catch(SALOME_Exception & S_ex) {
|
||||||
{
|
|
||||||
// *** delete _quads
|
// *** delete _quads
|
||||||
// *** throw exception
|
// *** throw exception
|
||||||
// ASSERT(0);
|
// ASSERT(0);
|
||||||
@ -236,8 +244,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
// 0.2.1 - number of points on the opposite edges must be the same
|
// 0.2.1 - number of points on the opposite edges must be the same
|
||||||
if (_quads[i]->nbPts[0] != _quads[i]->nbPts[2] ||
|
if (_quads[i]->nbPts[0] != _quads[i]->nbPts[2] ||
|
||||||
_quads[i]->nbPts[1] != _quads[i]->nbPts[3])
|
_quads[i]->nbPts[1] != _quads[i]->nbPts[3]) {
|
||||||
{
|
|
||||||
MESSAGE("different number of points on the opposite edges of face " << i);
|
MESSAGE("different number of points on the opposite edges of face " << i);
|
||||||
// ASSERT(0);
|
// ASSERT(0);
|
||||||
return false;
|
return false;
|
||||||
@ -266,16 +273,13 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
|
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
|
||||||
TopoDS_Vertex VFirst, VLast;
|
TopoDS_Vertex VFirst, VLast;
|
||||||
TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
|
TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
|
||||||
bool isForward =
|
bool isForward = (((l - f) * (_quads[0]->last[i] - _quads[0]->first[i])) > 0);
|
||||||
(((l - f) * (_quads[0]->last[i] - _quads[0]->first[i])) > 0);
|
|
||||||
|
|
||||||
if (isForward)
|
if (isForward) {
|
||||||
{
|
|
||||||
_cube.V000 = VFirst; // will be (0,0,0) on the unit cube
|
_cube.V000 = VFirst; // will be (0,0,0) on the unit cube
|
||||||
_cube.V100 = VLast; // will be (1,0,0) on the unit cube
|
_cube.V100 = VLast; // will be (1,0,0) on the unit cube
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
_cube.V000 = VLast;
|
_cube.V000 = VLast;
|
||||||
_cube.V100 = VFirst;
|
_cube.V100 = VFirst;
|
||||||
}
|
}
|
||||||
@ -420,20 +424,19 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
int nbdown = quad->nbPts[0];
|
int nbdown = quad->nbPts[0];
|
||||||
int nbright = quad->nbPts[1];
|
int nbright = quad->nbPts[1];
|
||||||
|
|
||||||
|
|
||||||
SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
|
SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
|
||||||
|
|
||||||
while(itf->more())
|
while(itf->more()) {
|
||||||
{
|
|
||||||
const SMDS_MeshNode * node = itf->next();
|
const SMDS_MeshNode * node = itf->next();
|
||||||
|
if(myTool->IsMedium(node))
|
||||||
|
continue;
|
||||||
findIJ( node, quad, i1, j1 );
|
findIJ( node, quad, i1, j1 );
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
quad->uv_grid[ij1].node = node;
|
quad->uv_grid[ij1].node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i1 = 0; i1 < nbdown; i1++)
|
for (int i1 = 0; i1 < nbdown; i1++)
|
||||||
for (int j1 = 0; j1 < nbright; j1++)
|
for (int j1 = 0; j1 < nbright; j1++) {
|
||||||
{
|
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic; // j = x/face
|
int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic; // j = x/face
|
||||||
int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc; // k = y/face
|
int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc; // k = y/face
|
||||||
@ -454,17 +457,17 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
int nbdown = quad->nbPts[0];
|
int nbdown = quad->nbPts[0];
|
||||||
int nbright = quad->nbPts[1];
|
int nbright = quad->nbPts[1];
|
||||||
|
|
||||||
while(itf->more())
|
while(itf->more()) {
|
||||||
{
|
|
||||||
const SMDS_MeshNode * node = itf->next();
|
const SMDS_MeshNode * node = itf->next();
|
||||||
|
if(myTool->IsMedium(node))
|
||||||
|
continue;
|
||||||
findIJ( node, quad, i1, j1 );
|
findIJ( node, quad, i1, j1 );
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
quad->uv_grid[ij1].node = node;
|
quad->uv_grid[ij1].node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i1 = 0; i1 < nbdown; i1++)
|
for (int i1 = 0; i1 < nbdown; i1++)
|
||||||
for (int j1 = 0; j1 < nbright; j1++)
|
for (int j1 = 0; j1 < nbright; j1++) {
|
||||||
{
|
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic; // j = x/face
|
int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic; // j = x/face
|
||||||
int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc; // k = y/face
|
int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc; // k = y/face
|
||||||
@ -485,17 +488,17 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
int nbdown = quad->nbPts[0];
|
int nbdown = quad->nbPts[0];
|
||||||
int nbright = quad->nbPts[1];
|
int nbright = quad->nbPts[1];
|
||||||
|
|
||||||
while(itf->more())
|
while(itf->more()) {
|
||||||
{
|
|
||||||
const SMDS_MeshNode * node = itf->next();
|
const SMDS_MeshNode * node = itf->next();
|
||||||
|
if(myTool->IsMedium(node))
|
||||||
|
continue;
|
||||||
findIJ( node, quad, i1, j1 );
|
findIJ( node, quad, i1, j1 );
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
quad->uv_grid[ij1].node = node;
|
quad->uv_grid[ij1].node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i1 = 0; i1 < nbdown; i1++)
|
for (int i1 = 0; i1 < nbdown; i1++)
|
||||||
for (int j1 = 0; j1 < nbright; j1++)
|
for (int j1 = 0; j1 < nbright; j1++) {
|
||||||
{
|
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic; // i = x/face
|
int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic; // i = x/face
|
||||||
int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc; // k = y/face
|
int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc; // k = y/face
|
||||||
@ -516,17 +519,17 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
int nbdown = quad->nbPts[0];
|
int nbdown = quad->nbPts[0];
|
||||||
int nbright = quad->nbPts[1];
|
int nbright = quad->nbPts[1];
|
||||||
|
|
||||||
while(itf->more())
|
while(itf->more()) {
|
||||||
{
|
|
||||||
const SMDS_MeshNode * node = itf->next();
|
const SMDS_MeshNode * node = itf->next();
|
||||||
|
if(myTool->IsMedium(node))
|
||||||
|
continue;
|
||||||
findIJ( node, quad, i1, j1 );
|
findIJ( node, quad, i1, j1 );
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
quad->uv_grid[ij1].node = node;
|
quad->uv_grid[ij1].node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i1 = 0; i1 < nbdown; i1++)
|
for (int i1 = 0; i1 < nbdown; i1++)
|
||||||
for (int j1 = 0; j1 < nbright; j1++)
|
for (int j1 = 0; j1 < nbright; j1++) {
|
||||||
{
|
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic; // i = x/face
|
int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic; // i = x/face
|
||||||
int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc; // k = y/face
|
int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc; // k = y/face
|
||||||
@ -547,17 +550,17 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
int nbdown = quad->nbPts[0];
|
int nbdown = quad->nbPts[0];
|
||||||
int nbright = quad->nbPts[1];
|
int nbright = quad->nbPts[1];
|
||||||
|
|
||||||
while(itf->more())
|
while(itf->more()) {
|
||||||
{
|
|
||||||
const SMDS_MeshNode * node = itf->next();
|
const SMDS_MeshNode * node = itf->next();
|
||||||
|
if(myTool->IsMedium(node))
|
||||||
|
continue;
|
||||||
findIJ( node, quad, i1, j1 );
|
findIJ( node, quad, i1, j1 );
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
quad->uv_grid[ij1].node = node;
|
quad->uv_grid[ij1].node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i1 = 0; i1 < nbdown; i1++)
|
for (int i1 = 0; i1 < nbdown; i1++)
|
||||||
for (int j1 = 0; j1 < nbright; j1++)
|
for (int j1 = 0; j1 < nbright; j1++) {
|
||||||
{
|
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic; // i = x/face
|
int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic; // i = x/face
|
||||||
int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc; // j = y/face
|
int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc; // j = y/face
|
||||||
@ -578,17 +581,17 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
int nbdown = quad->nbPts[0];
|
int nbdown = quad->nbPts[0];
|
||||||
int nbright = quad->nbPts[1];
|
int nbright = quad->nbPts[1];
|
||||||
|
|
||||||
while(itf->more())
|
while(itf->more()) {
|
||||||
{
|
|
||||||
const SMDS_MeshNode * node = itf->next();
|
const SMDS_MeshNode * node = itf->next();
|
||||||
|
if(myTool->IsMedium(node))
|
||||||
|
continue;
|
||||||
findIJ( node, quad, i1, j1 );
|
findIJ( node, quad, i1, j1 );
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
quad->uv_grid[ij1].node = node;
|
quad->uv_grid[ij1].node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i1 = 0; i1 < nbdown; i1++)
|
for (int i1 = 0; i1 < nbdown; i1++)
|
||||||
for (int j1 = 0; j1 < nbright; j1++)
|
for (int j1 = 0; j1 < nbright; j1++) {
|
||||||
{
|
|
||||||
int ij1 = j1 * nbdown + i1;
|
int ij1 = j1 * nbdown + i1;
|
||||||
int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic; // i = x/face
|
int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic; // i = x/face
|
||||||
int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc; // j = y/face
|
int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc; // j = y/face
|
||||||
@ -623,12 +626,9 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
GetPoint(p110, nbx - 1, nby - 1, 0, nbx, nby, nbz, np, meshDS);
|
GetPoint(p110, nbx - 1, nby - 1, 0, nbx, nby, nbz, np, meshDS);
|
||||||
GetPoint(p111, nbx - 1, nby - 1, nbz - 1, nbx, nby, nbz, np, meshDS);
|
GetPoint(p111, nbx - 1, nby - 1, nbz - 1, nbx, nby, nbz, np, meshDS);
|
||||||
|
|
||||||
for (int i = 1; i < nbx - 1; i++)
|
for (int i = 1; i < nbx - 1; i++) {
|
||||||
{
|
for (int j = 1; j < nby - 1; j++) {
|
||||||
for (int j = 1; j < nby - 1; j++)
|
for (int k = 1; k < nbz - 1; k++) {
|
||||||
{
|
|
||||||
for (int k = 1; k < nbz - 1; k++)
|
|
||||||
{
|
|
||||||
// *** seulement maillage regulier
|
// *** seulement maillage regulier
|
||||||
// 12 points on edges
|
// 12 points on edges
|
||||||
GetPoint(px00, i, 0, 0, nbx, nby, nbz, np, meshDS);
|
GetPoint(px00, i, 0, 0, nbx, nby, nbz, np, meshDS);
|
||||||
@ -660,10 +660,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
double z = double (k) / double (nbz - 1); // *** regulier
|
double z = double (k) / double (nbz - 1); // *** regulier
|
||||||
|
|
||||||
Pt3 X;
|
Pt3 X;
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++) {
|
||||||
{
|
X[i] = (1 - x) * p0yz[i] + x * p1yz[i]
|
||||||
X[i] =
|
|
||||||
(1 - x) * p0yz[i] + x * p1yz[i]
|
|
||||||
+ (1 - y) * px0z[i] + y * px1z[i]
|
+ (1 - y) * px0z[i] + y * px1z[i]
|
||||||
+ (1 - z) * pxy0[i] + z * pxy1[i]
|
+ (1 - z) * pxy0[i] + z * pxy1[i]
|
||||||
- (1 - x) * ((1 - y) * p00z[i] + y * p01z[i])
|
- (1 - x) * ((1 - y) * p00z[i] + y * p01z[i])
|
||||||
@ -688,9 +686,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
// find orientation of furute volumes according to MED convention
|
// find orientation of furute volumes according to MED convention
|
||||||
vector< bool > forward( nbx * nby );
|
vector< bool > forward( nbx * nby );
|
||||||
SMDS_VolumeTool vTool;
|
SMDS_VolumeTool vTool;
|
||||||
for (int i = 0; i < nbx - 1; i++)
|
for (int i = 0; i < nbx - 1; i++) {
|
||||||
for (int j = 0; j < nby - 1; j++)
|
for (int j = 0; j < nby - 1; j++) {
|
||||||
{
|
|
||||||
int n1 = j * nbx + i;
|
int n1 = j * nbx + i;
|
||||||
int n2 = j * nbx + i + 1;
|
int n2 = j * nbx + i + 1;
|
||||||
int n3 = (j + 1) * nbx + i + 1;
|
int n3 = (j + 1) * nbx + i + 1;
|
||||||
@ -705,16 +702,15 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
vTool.Set( &tmpVol );
|
vTool.Set( &tmpVol );
|
||||||
forward[ n1 ] = vTool.IsForward();
|
forward[ n1 ] = vTool.IsForward();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//2.1 - for each node of the cube (less 3 *1 Faces):
|
//2.1 - for each node of the cube (less 3 *1 Faces):
|
||||||
// - store hexahedron in SMESHDS
|
// - store hexahedron in SMESHDS
|
||||||
MESSAGE("Storing hexahedron into the DS");
|
MESSAGE("Storing hexahedron into the DS");
|
||||||
for (int i = 0; i < nbx - 1; i++)
|
for (int i = 0; i < nbx - 1; i++) {
|
||||||
for (int j = 0; j < nby - 1; j++)
|
for (int j = 0; j < nby - 1; j++) {
|
||||||
{
|
|
||||||
bool isForw = forward.at( j * nbx + i );
|
bool isForw = forward.at( j * nbx + i );
|
||||||
for (int k = 0; k < nbz - 1; k++)
|
for (int k = 0; k < nbz - 1; k++) {
|
||||||
{
|
|
||||||
int n1 = k * nbx * nby + j * nbx + i;
|
int n1 = k * nbx * nby + j * nbx + i;
|
||||||
int n2 = k * nbx * nby + j * nbx + i + 1;
|
int n2 = k * nbx * nby + j * nbx + i + 1;
|
||||||
int n3 = k * nbx * nby + (j + 1) * nbx + i + 1;
|
int n3 = k * nbx * nby + (j + 1) * nbx + i + 1;
|
||||||
@ -725,28 +721,31 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
int n8 = (k + 1) * nbx * nby + (j + 1) * nbx + i;
|
int n8 = (k + 1) * nbx * nby + (j + 1) * nbx + i;
|
||||||
|
|
||||||
SMDS_MeshVolume * elt;
|
SMDS_MeshVolume * elt;
|
||||||
if ( isForw )
|
if ( isForw ) {
|
||||||
elt = meshDS->AddVolume(np[n1].node,
|
//elt = meshDS->AddVolume(np[n1].node, np[n2].node,
|
||||||
np[n2].node,
|
// np[n3].node, np[n4].node,
|
||||||
np[n3].node,
|
// np[n5].node, np[n6].node,
|
||||||
np[n4].node,
|
// np[n7].node, np[n8].node);
|
||||||
np[n5].node,
|
elt = myTool->AddVolume(np[n1].node, np[n2].node,
|
||||||
np[n6].node,
|
np[n3].node, np[n4].node,
|
||||||
np[n7].node,
|
np[n5].node, np[n6].node,
|
||||||
np[n8].node);
|
np[n7].node, np[n8].node);
|
||||||
else
|
}
|
||||||
elt = meshDS->AddVolume(np[n1].node,
|
else {
|
||||||
np[n4].node,
|
//elt = meshDS->AddVolume(np[n1].node, np[n4].node,
|
||||||
np[n3].node,
|
// np[n3].node, np[n2].node,
|
||||||
np[n2].node,
|
// np[n5].node, np[n8].node,
|
||||||
np[n5].node,
|
// np[n7].node, np[n6].node);
|
||||||
np[n8].node,
|
elt = myTool->AddVolume(np[n1].node, np[n4].node,
|
||||||
np[n7].node,
|
np[n3].node, np[n2].node,
|
||||||
np[n6].node);
|
np[n5].node, np[n8].node,
|
||||||
|
np[n7].node, np[n6].node);
|
||||||
|
}
|
||||||
|
|
||||||
meshDS->SetMeshElementOnShape(elt, shapeID);
|
meshDS->SetMeshElementOnShape(elt, shapeID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ( np ) delete [] np;
|
if ( np ) delete [] np;
|
||||||
//MESSAGE("End of StdMeshers_Hexa_3D::Compute()");
|
//MESSAGE("End of StdMeshers_Hexa_3D::Compute()");
|
||||||
return true;
|
return true;
|
||||||
@ -1066,3 +1065,4 @@ bool ComputePentahedralMesh(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
|
|||||||
return bOK;
|
return bOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#include "StdMeshers_Quadrangle_2D.hxx"
|
#include "StdMeshers_Quadrangle_2D.hxx"
|
||||||
#include "Utils_SALOME_Exception.hxx"
|
#include "Utils_SALOME_Exception.hxx"
|
||||||
|
|
||||||
|
#include "StdMeshers_Helper.hxx"
|
||||||
|
|
||||||
typedef struct point3Dstruct
|
typedef struct point3Dstruct
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode * node;
|
const SMDS_MeshNode * node;
|
||||||
@ -135,6 +137,9 @@ protected:
|
|||||||
int _indY1;
|
int _indY1;
|
||||||
int _indZ0;
|
int _indZ0;
|
||||||
int _indZ1;
|
int _indZ1;
|
||||||
|
|
||||||
|
bool myCreateQuadratic;
|
||||||
|
StdMeshers_Helper* myTool; // toll for working with quadratic elements
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -220,17 +220,20 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
|||||||
int iw = 1;
|
int iw = 1;
|
||||||
int nbpnt = 0;
|
int nbpnt = 0;
|
||||||
|
|
||||||
|
bool QuadMode = true;
|
||||||
|
|
||||||
|
myTool = new StdMeshers_Helper(aMesh);
|
||||||
|
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||||
|
|
||||||
myOuterWire = BRepTools::OuterWire(F);
|
myOuterWire = BRepTools::OuterWire(F);
|
||||||
nbpnt += NumberOfPoints(aMesh, myOuterWire);
|
nbpnt += NumberOfPoints(aMesh, myOuterWire);
|
||||||
if ( nbpnt < 3 ) // ex: a circle with 2 segments
|
if ( nbpnt < 3 ) // ex: a circle with 2 segments
|
||||||
return false;
|
return false;
|
||||||
nudslf[iw++] = nbpnt;
|
nudslf[iw++] = nbpnt;
|
||||||
|
|
||||||
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
|
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next()) {
|
||||||
{
|
|
||||||
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
|
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
|
||||||
if (!myOuterWire.IsSame(W))
|
if (!myOuterWire.IsSame(W)) {
|
||||||
{
|
|
||||||
nbpnt += NumberOfPoints(aMesh, W);
|
nbpnt += NumberOfPoints(aMesh, W);
|
||||||
nudslf[iw++] = nbpnt;
|
nudslf[iw++] = nbpnt;
|
||||||
}
|
}
|
||||||
@ -249,7 +252,7 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
|||||||
|
|
||||||
map<int, const SMDS_MeshNode*> mefistoToDS; // correspondence mefisto index--> points IDNodes
|
map<int, const SMDS_MeshNode*> mefistoToDS; // correspondence mefisto index--> points IDNodes
|
||||||
if ( !LoadPoints(aMesh, F, myOuterWire, uvslf, m,
|
if ( !LoadPoints(aMesh, F, myOuterWire, uvslf, m,
|
||||||
mefistoToDS, scalex, scaley, VWMap))
|
mefistoToDS, scalex, scaley, VWMap) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
|
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
|
||||||
@ -352,7 +355,8 @@ static bool fixCommonVertexUV (gp_Pnt2d & theUV,
|
|||||||
const TopoDS_Wire& theOW,
|
const TopoDS_Wire& theOW,
|
||||||
const TopoDS_Face& theF,
|
const TopoDS_Face& theF,
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape & theVWMap,
|
const TopTools_IndexedDataMapOfShapeListOfShape & theVWMap,
|
||||||
SMESH_Mesh & theMesh)
|
SMESH_Mesh & theMesh,
|
||||||
|
bool CreateQuadratic)
|
||||||
{
|
{
|
||||||
if( theW.IsSame( theOW ) ||
|
if( theW.IsSame( theOW ) ||
|
||||||
!theVWMap.Contains( theV )) return false;
|
!theVWMap.Contains( theV )) return false;
|
||||||
@ -415,10 +419,25 @@ static bool fixCommonVertexUV (gp_Pnt2d & theUV,
|
|||||||
umin = l;
|
umin = l;
|
||||||
umax = f;
|
umax = f;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
while ( nIt->more() ) {
|
while ( nIt->more() ) {
|
||||||
const SMDS_MeshNode* node = nIt->next();
|
const SMDS_MeshNode* node = nIt->next();
|
||||||
|
if(CreateQuadratic) {
|
||||||
|
// check if node is medium
|
||||||
|
bool IsMedium = false;
|
||||||
|
SMDS_ElemIteratorPtr itn = node->GetInverseElementIterator();
|
||||||
|
while (itn->more()) {
|
||||||
|
const SMDS_MeshElement* elem = itn->next();
|
||||||
|
if ( elem->GetType() != SMDSAbs_Edge )
|
||||||
|
continue;
|
||||||
|
if(elem->IsMediumNode(node)) {
|
||||||
|
IsMedium = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(IsMedium)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||||
double u = epos->GetUParameter();
|
double u = epos->GetUParameter();
|
||||||
@ -486,8 +505,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
|
TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
|
||||||
BRepTools_WireExplorer wexp(W, F);
|
BRepTools_WireExplorer wexp(W, F);
|
||||||
for (wexp.Init(W, F), iEdge = 0; wexp.More(); wexp.Next(), iEdge++)
|
for (wexp.Init(W, F), iEdge = 0; wexp.More(); wexp.Next(), iEdge++) {
|
||||||
{
|
|
||||||
const TopoDS_Edge & E = wexp.Current();
|
const TopoDS_Edge & E = wexp.Current();
|
||||||
|
|
||||||
// --- IDNodes of first and last Vertex
|
// --- IDNodes of first and last Vertex
|
||||||
@ -496,7 +514,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
|||||||
TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
|
TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
|
||||||
|
|
||||||
ASSERT(!VFirst.IsNull());
|
ASSERT(!VFirst.IsNull());
|
||||||
SMDS_NodeIteratorPtr lid=
|
SMDS_NodeIteratorPtr lid =
|
||||||
aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
|
aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
|
||||||
if ( !lid->more() ) {
|
if ( !lid->more() ) {
|
||||||
MESSAGE (" NO NODE BUILT ON VERTEX ");
|
MESSAGE (" NO NODE BUILT ON VERTEX ");
|
||||||
@ -505,7 +523,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
|||||||
const SMDS_MeshNode* idFirst = lid->next();
|
const SMDS_MeshNode* idFirst = lid->next();
|
||||||
|
|
||||||
ASSERT(!VLast.IsNull());
|
ASSERT(!VLast.IsNull());
|
||||||
lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
|
lid = aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
|
||||||
if ( !lid->more() ) {
|
if ( !lid->more() ) {
|
||||||
MESSAGE (" NO NODE BUILT ON VERTEX ");
|
MESSAGE (" NO NODE BUILT ON VERTEX ");
|
||||||
return false;
|
return false;
|
||||||
@ -514,6 +532,21 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
// --- edge internal IDNodes (relies on good order storage, not checked)
|
// --- edge internal IDNodes (relies on good order storage, not checked)
|
||||||
|
|
||||||
|
// if(myCreateQuadratic) {
|
||||||
|
// fill myNLinkNodeMap
|
||||||
|
// SMDS_ElemIteratorPtr iter = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetElements();
|
||||||
|
// while(iter->more()) {
|
||||||
|
// const SMDS_MeshElement* elem = iter->next();
|
||||||
|
// SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
|
||||||
|
// const SMDS_MeshNode* n1 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
// const SMDS_MeshNode* n2 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
// const SMDS_MeshNode* n3 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
// NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 ));
|
||||||
|
// myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n3));
|
||||||
|
// myNLinkNodeMap[link] = n3;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||||
|
|
||||||
double f, l;
|
double f, l;
|
||||||
@ -524,16 +557,41 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
|||||||
//bool isForward = (E.Orientation() == TopAbs_FORWARD);
|
//bool isForward = (E.Orientation() == TopAbs_FORWARD);
|
||||||
map<double, const SMDS_MeshNode*> params;
|
map<double, const SMDS_MeshNode*> params;
|
||||||
|
|
||||||
while(ite->more())
|
if(!myCreateQuadratic) {
|
||||||
{
|
while(ite->more()) {
|
||||||
const SMDS_MeshNode * node = ite->next();
|
const SMDS_MeshNode * node = ite->next();
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||||
double param = epos->GetUParameter();
|
double param = epos->GetUParameter();
|
||||||
params[param] = node;
|
params[param] = node;
|
||||||
}
|
}
|
||||||
if ( nbPoints != params.size())
|
}
|
||||||
{
|
else {
|
||||||
|
nbPoints = nbPoints/2;
|
||||||
|
while(ite->more()) {
|
||||||
|
const SMDS_MeshNode* node = ite->next();
|
||||||
|
// check if node is medium
|
||||||
|
bool IsMedium = false;
|
||||||
|
SMDS_ElemIteratorPtr itn = node->GetInverseElementIterator();
|
||||||
|
while (itn->more()) {
|
||||||
|
const SMDS_MeshElement* elem = itn->next();
|
||||||
|
if ( elem->GetType() != SMDSAbs_Edge )
|
||||||
|
continue;
|
||||||
|
if(elem->IsMediumNode(node)) {
|
||||||
|
IsMedium = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(IsMedium)
|
||||||
|
continue;
|
||||||
|
const SMDS_EdgePosition* epos =
|
||||||
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||||
|
double param = epos->GetUParameter();
|
||||||
|
params[param] = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( nbPoints != params.size()) {
|
||||||
MESSAGE( "BAD NODE ON EDGE POSITIONS" );
|
MESSAGE( "BAD NODE ON EDGE POSITIONS" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -542,10 +600,9 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
// --- load 2D values into MEFISTO structure,
|
// --- load 2D values into MEFISTO structure,
|
||||||
// add IDNodes in mefistoToDS map
|
// add IDNodes in mefistoToDS map
|
||||||
if (E.Orientation() == TopAbs_FORWARD)
|
if (E.Orientation() == TopAbs_FORWARD) {
|
||||||
{
|
|
||||||
gp_Pnt2d p = C2d->Value(f).XY().Multiplied( scale ); // first point = Vertex Forward
|
gp_Pnt2d p = C2d->Value(f).XY().Multiplied( scale ); // first point = Vertex Forward
|
||||||
if ( fixCommonVertexUV( p, VFirst, W, myOuterWire, F, VWMap, aMesh ))
|
if ( fixCommonVertexUV( p, VFirst, W, myOuterWire, F, VWMap, aMesh, myCreateQuadratic ))
|
||||||
myNodesOnCommonV.push_back( idFirst );
|
myNodesOnCommonV.push_back( idFirst );
|
||||||
uvslf[m].x = p.X();
|
uvslf[m].x = p.X();
|
||||||
uvslf[m].y = p.Y();
|
uvslf[m].y = p.Y();
|
||||||
@ -554,8 +611,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
|||||||
//MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
//MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||||
m++;
|
m++;
|
||||||
map<double, const SMDS_MeshNode*>::iterator itp = params.begin();
|
map<double, const SMDS_MeshNode*>::iterator itp = params.begin();
|
||||||
for (int i = 1; i <= nbPoints; i++) // nbPoints internal
|
for (int i = 1; i <= nbPoints; i++) { // nbPoints internal
|
||||||
{
|
|
||||||
double param = (*itp).first;
|
double param = (*itp).first;
|
||||||
gp_Pnt2d p = C2d->Value(param).XY().Multiplied( scale );
|
gp_Pnt2d p = C2d->Value(param).XY().Multiplied( scale );
|
||||||
uvslf[m].x = p.X();
|
uvslf[m].x = p.X();
|
||||||
@ -567,10 +623,9 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
|||||||
itp++;
|
itp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
gp_Pnt2d p = C2d->Value(l).XY().Multiplied( scale ); // last point = Vertex Reversed
|
gp_Pnt2d p = C2d->Value(l).XY().Multiplied( scale ); // last point = Vertex Reversed
|
||||||
if ( fixCommonVertexUV( p, VLast, W, myOuterWire, F, VWMap, aMesh ))
|
if ( fixCommonVertexUV( p, VLast, W, myOuterWire, F, VWMap, aMesh, myCreateQuadratic ))
|
||||||
myNodesOnCommonV.push_back( idLast );
|
myNodesOnCommonV.push_back( idLast );
|
||||||
uvslf[m].x = p.X();
|
uvslf[m].x = p.X();
|
||||||
uvslf[m].y = p.Y();
|
uvslf[m].y = p.Y();
|
||||||
@ -758,9 +813,11 @@ void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
SMDS_MeshElement * elt;
|
SMDS_MeshElement * elt;
|
||||||
if (triangleIsWellOriented)
|
if (triangleIsWellOriented)
|
||||||
elt = meshDS->AddFace(n1, n2, n3);
|
//elt = meshDS->AddFace(n1, n2, n3);
|
||||||
|
elt = myTool->AddFace(n1, n2, n3);
|
||||||
else
|
else
|
||||||
elt = meshDS->AddFace(n1, n3, n2);
|
//elt = meshDS->AddFace(n1, n3, n2);
|
||||||
|
elt = myTool->AddFace(n1, n3, n2);
|
||||||
|
|
||||||
meshDS->SetMeshElementOnShape(elt, faceID);
|
meshDS->SetMeshElementOnShape(elt, faceID);
|
||||||
m++;
|
m++;
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include "SMESH_2D_Algo.hxx"
|
#include "SMESH_2D_Algo.hxx"
|
||||||
#include <TopoDS_Wire.hxx>
|
#include <TopoDS_Wire.hxx>
|
||||||
|
|
||||||
|
#include "StdMeshers_Helper.hxx"
|
||||||
|
|
||||||
class SMDS_MeshNode;
|
class SMDS_MeshNode;
|
||||||
class TopTools_IndexedDataMapOfShapeListOfShape;
|
class TopTools_IndexedDataMapOfShapeListOfShape;
|
||||||
class TopoDS_Face;
|
class TopoDS_Face;
|
||||||
@ -95,6 +97,8 @@ protected:
|
|||||||
|
|
||||||
TopoDS_Wire myOuterWire;
|
TopoDS_Wire myOuterWire;
|
||||||
std::list<const SMDS_MeshNode*> myNodesOnCommonV;
|
std::list<const SMDS_MeshNode*> myNodesOnCommonV;
|
||||||
|
|
||||||
|
StdMeshers_Helper* myTool; // toll for working with quadratic elements
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,6 +51,9 @@
|
|||||||
#include <TopoDS_Shell.hxx>
|
#include <TopoDS_Shell.hxx>
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
|
#include <BRepTools.hxx>
|
||||||
|
#include <BRepTools_WireExplorer.hxx>
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -71,6 +74,8 @@ StdMeshers_Penta_3D::StdMeshers_Penta_3D()
|
|||||||
myWallNodesMaps.resize( SMESH_Block::NbFaces() );
|
myWallNodesMaps.resize( SMESH_Block::NbFaces() );
|
||||||
myShapeXYZ.resize( SMESH_Block::NbSubShapes() );
|
myShapeXYZ.resize( SMESH_Block::NbSubShapes() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Compute
|
//function : Compute
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -91,12 +96,23 @@ bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh,
|
|||||||
if (myErrorStatus){
|
if (myErrorStatus){
|
||||||
return bOK;
|
return bOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QuadMode = true;
|
||||||
|
|
||||||
|
myTool = new StdMeshers_Helper(aMesh);
|
||||||
|
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||||
|
|
||||||
//
|
//
|
||||||
MakeBlock();
|
MakeBlock();
|
||||||
if (myErrorStatus){
|
if (myErrorStatus){
|
||||||
return bOK;
|
return bOK;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
ClearMeshOnFxy1();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return bOK;
|
||||||
|
}
|
||||||
|
//
|
||||||
MakeNodes();
|
MakeNodes();
|
||||||
if (myErrorStatus){
|
if (myErrorStatus){
|
||||||
return bOK;
|
return bOK;
|
||||||
@ -104,11 +120,6 @@ bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh,
|
|||||||
//
|
//
|
||||||
MakeConnectingMap();
|
MakeConnectingMap();
|
||||||
//
|
//
|
||||||
ClearMeshOnFxy1();
|
|
||||||
if (myErrorStatus) {
|
|
||||||
return bOK;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
MakeMeshOnFxy1();
|
MakeMeshOnFxy1();
|
||||||
if (myErrorStatus) {
|
if (myErrorStatus) {
|
||||||
return bOK;
|
return bOK;
|
||||||
@ -118,6 +129,7 @@ bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh,
|
|||||||
//
|
//
|
||||||
return !bOK;
|
return !bOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : MakeNodes
|
//function : MakeNodes
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -144,12 +156,24 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
// 1.1 Horizontal size
|
// 1.1 Horizontal size
|
||||||
myJSize=0;
|
myJSize=0;
|
||||||
for (i=0; i<aNbSIDs; ++i) {
|
for (i=0; i<aNbSIDs; ++i) {
|
||||||
const TopoDS_Shape& aS=myBlock.Shape(aSIDs[i]);
|
const TopoDS_Shape& aS = myBlock.Shape(aSIDs[i]);
|
||||||
SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aS);
|
SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aS);
|
||||||
ASSERT(aSubMesh);
|
ASSERT(aSubMesh);
|
||||||
SMESHDS_SubMesh *aSM=aSubMesh->GetSubMeshDS();
|
SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
|
||||||
iNbN=aSM->NbNodes();
|
if(!myCreateQuadratic) {
|
||||||
myJSize+=iNbN;
|
iNbN = aSM->NbNodes();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
iNbN = 0;
|
||||||
|
SMDS_NodeIteratorPtr itn = aSM->GetNodes();
|
||||||
|
while(itn->more()) {
|
||||||
|
const SMDS_MeshNode* aNode = itn->next();
|
||||||
|
if(myTool->IsMedium(aNode))
|
||||||
|
continue;
|
||||||
|
iNbN++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myJSize += iNbN;
|
||||||
}
|
}
|
||||||
//printf("*** Horizontal: number of nodes summary=%d\n", myJSize);
|
//printf("*** Horizontal: number of nodes summary=%d\n", myJSize);
|
||||||
//
|
//
|
||||||
@ -159,9 +183,21 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_E00z);
|
const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_E00z);
|
||||||
SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aS);
|
SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aS);
|
||||||
ASSERT(aSubMesh);
|
ASSERT(aSubMesh);
|
||||||
SMESHDS_SubMesh *aSM=aSubMesh->GetSubMeshDS();
|
SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
|
||||||
iNbN=aSM->NbNodes();
|
if(!myCreateQuadratic) {
|
||||||
myISize+=iNbN;
|
iNbN = aSM->NbNodes();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
iNbN = 0;
|
||||||
|
SMDS_NodeIteratorPtr itn = aSM->GetNodes();
|
||||||
|
while(itn->more()) {
|
||||||
|
const SMDS_MeshNode* aNode = itn->next();
|
||||||
|
if(myTool->IsMedium(aNode))
|
||||||
|
continue;
|
||||||
|
iNbN++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myISize += iNbN;
|
||||||
}
|
}
|
||||||
//printf("*** Vertical: number of nodes on edges and vertices=%d\n", myISize);
|
//printf("*** Vertical: number of nodes on edges and vertices=%d\n", myISize);
|
||||||
//
|
//
|
||||||
@ -177,18 +213,19 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
// vertices
|
// vertices
|
||||||
for (k=0; k<aNbSIDs; ++k) {
|
for (k=0; k<aNbSIDs; ++k) {
|
||||||
aSID=aSIDs[k];
|
aSID=aSIDs[k];
|
||||||
const TopoDS_Shape& aS=myBlock.Shape(aSID);
|
const TopoDS_Shape& aS = myBlock.Shape(aSID);
|
||||||
SMDS_NodeIteratorPtr ite =pMesh->GetSubMeshContaining(aS)->GetSubMeshDS()->GetNodes();
|
SMDS_NodeIteratorPtr ite = pMesh->GetSubMeshContaining(aS)->GetSubMeshDS()->GetNodes();
|
||||||
while(ite->more()) {
|
while(ite->more()) {
|
||||||
const SMDS_MeshNode* aNode = ite->next();
|
const SMDS_MeshNode* aNode = ite->next();
|
||||||
|
if(myTool->IsMedium(aNode))
|
||||||
|
continue;
|
||||||
aNodeID=aNode->GetID();
|
aNodeID=aNode->GetID();
|
||||||
//
|
//
|
||||||
aTNode.SetNode(aNode);
|
aTNode.SetNode(aNode);
|
||||||
aTNode.SetShapeSupportID(aSID);
|
aTNode.SetShapeSupportID(aSID);
|
||||||
aTNode.SetBaseNodeID(aNodeID);
|
aTNode.SetBaseNodeID(aNodeID);
|
||||||
//
|
//
|
||||||
if ( SMESH_Block::IsEdgeID (aSID))
|
if ( SMESH_Block::IsEdgeID (aSID)) {
|
||||||
{
|
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(aNode->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(aNode->GetPosition().get());
|
||||||
myBlock.ComputeParameters( epos->GetUParameter(), aS, aCoords );
|
myBlock.ComputeParameters( epos->GetUParameter(), aS, aCoords );
|
||||||
@ -200,7 +237,7 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
aP3D.SetCoord(aX, aY, aZ);
|
aP3D.SetCoord(aX, aY, aZ);
|
||||||
myBlock.ComputeParameters(aP3D, aS, aCoords);
|
myBlock.ComputeParameters(aP3D, aS, aCoords);
|
||||||
}
|
}
|
||||||
iErr=myBlock.ErrorStatus();
|
iErr = myBlock.ErrorStatus();
|
||||||
if (iErr) {
|
if (iErr) {
|
||||||
MESSAGE("StdMeshers_Penta_3D::MakeNodes()," <<
|
MESSAGE("StdMeshers_Penta_3D::MakeNodes()," <<
|
||||||
"SMESHBlock: ComputeParameters operation failed");
|
"SMESHBlock: ComputeParameters operation failed");
|
||||||
@ -325,8 +362,7 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
|
|
||||||
// 3.3 set XYZ of vertices, and initialize of the rest
|
// 3.3 set XYZ of vertices, and initialize of the rest
|
||||||
SMESHDS_Mesh* aMesh = GetMesh()->GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMesh()->GetMeshDS();
|
||||||
for ( int id = SMESH_Block::ID_V000; id < SMESH_Block::ID_Shell; ++id )
|
for ( int id = SMESH_Block::ID_V000; id < SMESH_Block::ID_Shell; ++id ) {
|
||||||
{
|
|
||||||
if ( SMESH_Block::IsVertexID( id )) {
|
if ( SMESH_Block::IsVertexID( id )) {
|
||||||
TopoDS_Shape V = myBlock.Shape( id );
|
TopoDS_Shape V = myBlock.Shape( id );
|
||||||
SMESHDS_SubMesh* sm = aMesh->MeshElements( V );
|
SMESHDS_SubMesh* sm = aMesh->MeshElements( V );
|
||||||
@ -344,23 +380,46 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
SMESH_Block::TShapeID aSSID, aBNSSID;
|
SMESH_Block::TShapeID aSSID, aBNSSID;
|
||||||
StdMeshers_TNode aTN;
|
StdMeshers_TNode aTN;
|
||||||
//
|
//
|
||||||
for (j=0; j<myJSize; ++j)
|
|
||||||
{
|
// create top face and find UV for it's corners
|
||||||
|
const TopoDS_Face& TopFace = TopoDS::Face(myBlock.Shape(SMESH_Block::ID_Fxy1));
|
||||||
|
SMESHDS_Mesh* meshDS = pMesh->GetMeshDS();
|
||||||
|
int topfaceID = meshDS->ShapeToIndex(TopFace);
|
||||||
|
const TopoDS_Vertex& v001 = TopoDS::Vertex(myBlock.Shape(SMESH_Block::ID_V001));
|
||||||
|
SMDS_NodeIteratorPtr itn = pMesh->GetSubMeshContaining(v001)->GetSubMeshDS()->GetNodes();
|
||||||
|
const SMDS_MeshNode* N = itn->next();
|
||||||
|
gp_XY UV001 = myTool->GetNodeUV(TopFace,N);
|
||||||
|
const TopoDS_Vertex& v101 = TopoDS::Vertex(myBlock.Shape(SMESH_Block::ID_V101));
|
||||||
|
itn = pMesh->GetSubMeshContaining(v101)->GetSubMeshDS()->GetNodes();
|
||||||
|
N = itn->next();
|
||||||
|
gp_XY UV101 = myTool->GetNodeUV(TopFace,N);
|
||||||
|
const TopoDS_Vertex& v011 = TopoDS::Vertex(myBlock.Shape(SMESH_Block::ID_V011));
|
||||||
|
itn = pMesh->GetSubMeshContaining(v011)->GetSubMeshDS()->GetNodes();
|
||||||
|
N = itn->next();
|
||||||
|
gp_XY UV011 = myTool->GetNodeUV(TopFace,N);
|
||||||
|
const TopoDS_Vertex& v111 = TopoDS::Vertex(myBlock.Shape(SMESH_Block::ID_V111));
|
||||||
|
itn = pMesh->GetSubMeshContaining(v111)->GetSubMeshDS()->GetNodes();
|
||||||
|
N = itn->next();
|
||||||
|
gp_XY UV111 = myTool->GetNodeUV(TopFace,N);
|
||||||
|
|
||||||
|
for (j=0; j<myJSize; ++j) {
|
||||||
// base node info
|
// base node info
|
||||||
const StdMeshers_TNode& aBN=myTNodes[j];
|
const StdMeshers_TNode& aBN = myTNodes[j];
|
||||||
aBNSSID=(SMESH_Block::TShapeID)aBN.ShapeSupportID();
|
aBNSSID = (SMESH_Block::TShapeID)aBN.ShapeSupportID();
|
||||||
iBNID=aBN.BaseNodeID();
|
iBNID = aBN.BaseNodeID();
|
||||||
const gp_XYZ& aBNXYZ=aBN.NormCoord();
|
const gp_XYZ& aBNXYZ = aBN.NormCoord();
|
||||||
bool createNode = ( aBNSSID == SMESH_Block::ID_Fxy0 );
|
bool createNode = ( aBNSSID == SMESH_Block::ID_Fxy0 );
|
||||||
//
|
//
|
||||||
// set XYZ on horizontal edges and get node columns of faces:
|
// set XYZ on horizontal edges and get node columns of faces:
|
||||||
// 2 columns for each face, between which a base node is located
|
// 2 columns for each face, between which a base node is located
|
||||||
vector<const SMDS_MeshNode*>* nColumns[8];
|
vector<const SMDS_MeshNode*>* nColumns[8];
|
||||||
double ratio[4]; // base node position between columns [0.-1.]
|
double ratio[4]; // base node position between columns [0.-1.]
|
||||||
if ( createNode )
|
if ( createNode ) {
|
||||||
for ( k = 0; k < 4; ++k )
|
for ( k = 0; k < 4; ++k ) {
|
||||||
ratio[ k ] = SetHorizEdgeXYZ (aBNXYZ, wallFaceID[ k ],
|
ratio[ k ] = SetHorizEdgeXYZ (aBNXYZ, wallFaceID[ k ],
|
||||||
nColumns[k*2], nColumns[k*2+1]);
|
nColumns[k*2], nColumns[k*2+1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// XYZ on the bottom and top faces
|
// XYZ on the bottom and top faces
|
||||||
const SMDS_MeshNode* n = aBN.Node();
|
const SMDS_MeshNode* n = aBN.Node();
|
||||||
@ -368,8 +427,9 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
myShapeXYZ[ SMESH_Block::ID_Fxy1 ].SetCoord( 0., 0., 0. );
|
myShapeXYZ[ SMESH_Block::ID_Fxy1 ].SetCoord( 0., 0., 0. );
|
||||||
//
|
//
|
||||||
// first create or find a top node, then the rest ones in a column
|
// first create or find a top node, then the rest ones in a column
|
||||||
for (i=myISize-1; i>0; --i)
|
for (i=myISize-1; i>0; --i) {
|
||||||
{
|
bIsUpperLayer = (i==(myISize-1));
|
||||||
|
gp_XY UV_Ex01, UV_Ex11, UV_E0y1, UV_E1y1;
|
||||||
if ( createNode ) {
|
if ( createNode ) {
|
||||||
// set XYZ on vertical edges and faces
|
// set XYZ on vertical edges and faces
|
||||||
for ( k = 0; k < 4; ++k ) {
|
for ( k = 0; k < 4; ++k ) {
|
||||||
@ -377,11 +437,28 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
myShapeXYZ[ verticEdgeID[ k ] ].SetCoord( n->X(), n->Y(), n->Z() );
|
myShapeXYZ[ verticEdgeID[ k ] ].SetCoord( n->X(), n->Y(), n->Z() );
|
||||||
//
|
//
|
||||||
n = (*nColumns[k*2]) [ i ];
|
n = (*nColumns[k*2]) [ i ];
|
||||||
|
gp_XY tmp1;
|
||||||
|
if( i==myISize-1 ) {
|
||||||
|
tmp1 = myTool->GetNodeUV(TopFace,n);
|
||||||
|
tmp1 = ( 1. - ratio[ k ]) * tmp1;
|
||||||
|
}
|
||||||
gp_XYZ xyz( n->X(), n->Y(), n->Z() );
|
gp_XYZ xyz( n->X(), n->Y(), n->Z() );
|
||||||
myShapeXYZ[ wallFaceID[ k ]] = ( 1. - ratio[ k ]) * xyz;
|
myShapeXYZ[ wallFaceID[ k ]] = ( 1. - ratio[ k ]) * xyz;
|
||||||
n = (*nColumns[k*2+1]) [ i ];
|
n = (*nColumns[k*2+1]) [ i ];
|
||||||
xyz.SetCoord( n->X(), n->Y(), n->Z() );
|
xyz.SetCoord( n->X(), n->Y(), n->Z() );
|
||||||
myShapeXYZ[ wallFaceID[ k ]] += ratio[ k ] * xyz;
|
myShapeXYZ[ wallFaceID[ k ]] += ratio[ k ] * xyz;
|
||||||
|
if( i==myISize-1 ) {
|
||||||
|
gp_XY tmp2 = myTool->GetNodeUV(TopFace,n);
|
||||||
|
tmp1 += ratio[ k ] * tmp2;
|
||||||
|
if( k==0 )
|
||||||
|
UV_Ex01 = tmp1;
|
||||||
|
else if( k==1 )
|
||||||
|
UV_Ex11 = tmp1;
|
||||||
|
else if( k==2 )
|
||||||
|
UV_E0y1 = tmp1;
|
||||||
|
else
|
||||||
|
UV_E1y1 = tmp1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fill current node info
|
// fill current node info
|
||||||
@ -395,7 +472,6 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
aCoords.SetCoord(aX, aY, aZ);
|
aCoords.SetCoord(aX, aY, aZ);
|
||||||
//
|
//
|
||||||
// suporting shape ID
|
// suporting shape ID
|
||||||
bIsUpperLayer=(i==(myISize-1));
|
|
||||||
ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID);
|
ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID);
|
||||||
if (myErrorStatus) {
|
if (myErrorStatus) {
|
||||||
MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
|
MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
|
||||||
@ -418,6 +494,30 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
if ( bIsUpperLayer ) {
|
if ( bIsUpperLayer ) {
|
||||||
const SMDS_MeshNode* n = aTN.Node();
|
const SMDS_MeshNode* n = aTN.Node();
|
||||||
myShapeXYZ[ SMESH_Block::ID_Fxy1 ].SetCoord( n->X(), n->Y(), n->Z() );
|
myShapeXYZ[ SMESH_Block::ID_Fxy1 ].SetCoord( n->X(), n->Y(), n->Z() );
|
||||||
|
// set node on top face:
|
||||||
|
// find UV parameter for this node
|
||||||
|
// UV_Ex11
|
||||||
|
// UV011+-----+----------+UV111
|
||||||
|
// | |
|
||||||
|
// | |
|
||||||
|
// UV_E0y1+ +node +UV_E1y1
|
||||||
|
// | |
|
||||||
|
// | |
|
||||||
|
// | |
|
||||||
|
// UV001+-----+----------+UV101
|
||||||
|
// UV_Ex01
|
||||||
|
gp_Pnt2d aP;
|
||||||
|
double u = aCoords.X(), v = aCoords.Y();
|
||||||
|
double u1 = ( 1. - u ), v1 = ( 1. - v );
|
||||||
|
aP.ChangeCoord() = UV_Ex01 * v1;
|
||||||
|
aP.ChangeCoord() += UV_Ex11 * v;
|
||||||
|
aP.ChangeCoord() += UV_E0y1 * u1;
|
||||||
|
aP.ChangeCoord() += UV_E1y1 * u;
|
||||||
|
aP.ChangeCoord() -= UV001 * u1 * v1;
|
||||||
|
aP.ChangeCoord() -= UV101 * u * v1;
|
||||||
|
aP.ChangeCoord() -= UV011 * u1 * v;
|
||||||
|
aP.ChangeCoord() -= UV111 * u * v;
|
||||||
|
meshDS->SetNodeOnFace((SMDS_MeshNode*)n, topfaceID, aP.X(), aP.Y());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (myErrorStatus) {
|
if (myErrorStatus) {
|
||||||
@ -456,10 +556,13 @@ void StdMeshers_Penta_3D::MakeNodes()
|
|||||||
*/
|
*/
|
||||||
//DEB t
|
//DEB t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : FindNodeOnShape
|
//function : FindNodeOnShape
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
|
void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
|
||||||
const gp_XYZ& aParams,
|
const gp_XYZ& aParams,
|
||||||
const int z,
|
const int z,
|
||||||
@ -470,14 +573,13 @@ void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
|
|||||||
double aX, aY, aZ, aD, aTol2, minD;
|
double aX, aY, aZ, aD, aTol2, minD;
|
||||||
gp_Pnt aP1, aP2;
|
gp_Pnt aP1, aP2;
|
||||||
//
|
//
|
||||||
SMESH_Mesh* pMesh=GetMesh();
|
SMESH_Mesh* pMesh = GetMesh();
|
||||||
aTol2=myTol3D*myTol3D;
|
aTol2 = myTol3D*myTol3D;
|
||||||
minD = 1.e100;
|
minD = 1.e100;
|
||||||
SMDS_MeshNode* pNode=NULL;
|
SMDS_MeshNode* pNode = NULL;
|
||||||
//
|
//
|
||||||
if ( aS.ShapeType() == TopAbs_FACE ||
|
if ( aS.ShapeType() == TopAbs_FACE ||
|
||||||
aS.ShapeType() == TopAbs_EDGE )
|
aS.ShapeType() == TopAbs_EDGE ) {
|
||||||
{
|
|
||||||
// find a face ID to which aTN belongs to
|
// find a face ID to which aTN belongs to
|
||||||
int faceID;
|
int faceID;
|
||||||
if ( aS.ShapeType() == TopAbs_FACE )
|
if ( aS.ShapeType() == TopAbs_FACE )
|
||||||
@ -492,13 +594,13 @@ void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
|
|||||||
}
|
}
|
||||||
ASSERT( SMESH_Block::IsFaceID( faceID ));
|
ASSERT( SMESH_Block::IsFaceID( faceID ));
|
||||||
int fIndex = SMESH_Block::ShapeIndex( faceID );
|
int fIndex = SMESH_Block::ShapeIndex( faceID );
|
||||||
StdMeshers_IJNodeMap & ijNodes= myWallNodesMaps[ fIndex ];
|
StdMeshers_IJNodeMap & ijNodes = myWallNodesMaps[ fIndex ];
|
||||||
// look for a base node in ijNodes
|
// look for a base node in ijNodes
|
||||||
const SMDS_MeshNode* baseNode = pMesh->GetMeshDS()->FindNode( aTN.BaseNodeID() );
|
const SMDS_MeshNode* baseNode = pMesh->GetMeshDS()->FindNode( aTN.BaseNodeID() );
|
||||||
StdMeshers_IJNodeMap::const_iterator par_nVec = ijNodes.begin();
|
StdMeshers_IJNodeMap::const_iterator par_nVec = ijNodes.begin();
|
||||||
for ( ; par_nVec != ijNodes.end(); par_nVec++ )
|
for ( ; par_nVec != ijNodes.end(); par_nVec++ )
|
||||||
if ( par_nVec->second[ 0 ] == baseNode ) {
|
if ( par_nVec->second[ 0 ] == baseNode ) {
|
||||||
pNode=(SMDS_MeshNode*)par_nVec->second.at( z );
|
pNode = (SMDS_MeshNode*)par_nVec->second.at( z );
|
||||||
aTN.SetNode(pNode);
|
aTN.SetNode(pNode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -510,6 +612,8 @@ void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
|
|||||||
pMesh->GetSubMeshContaining(aS)->GetSubMeshDS()->GetNodes();
|
pMesh->GetSubMeshContaining(aS)->GetSubMeshDS()->GetNodes();
|
||||||
while(ite->more()) {
|
while(ite->more()) {
|
||||||
const SMDS_MeshNode* aNode = ite->next();
|
const SMDS_MeshNode* aNode = ite->next();
|
||||||
|
if(myTool->IsMedium(aNode))
|
||||||
|
continue;
|
||||||
aX=aNode->X();
|
aX=aNode->X();
|
||||||
aY=aNode->Y();
|
aY=aNode->Y();
|
||||||
aZ=aNode->Z();
|
aZ=aNode->Z();
|
||||||
@ -532,6 +636,7 @@ void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
|
|||||||
//myErrorStatus=11; // can not find the node;
|
//myErrorStatus=11; // can not find the node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetHorizEdgeXYZ
|
//function : SetHorizEdgeXYZ
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -583,6 +688,7 @@ double StdMeshers_Penta_3D::SetHorizEdgeXYZ(const gp_XYZ& aBase
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : MakeVolumeMesh
|
//function : MakeVolumeMesh
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -593,20 +699,20 @@ void StdMeshers_Penta_3D::MakeVolumeMesh()
|
|||||||
//
|
//
|
||||||
int i, j, ij, ik, i1, i2, aSSID;
|
int i, j, ij, ik, i1, i2, aSSID;
|
||||||
//
|
//
|
||||||
SMESH_Mesh* pMesh =GetMesh();
|
SMESH_Mesh* pMesh = GetMesh();
|
||||||
SMESHDS_Mesh* meshDS=pMesh->GetMeshDS();
|
SMESHDS_Mesh* meshDS = pMesh->GetMeshDS();
|
||||||
//
|
//
|
||||||
int shapeID = meshDS->ShapeToIndex( myShape );
|
int shapeID = meshDS->ShapeToIndex( myShape );
|
||||||
//
|
//
|
||||||
// 1. Set Node In Volume
|
// 1. Set Node In Volume
|
||||||
ik=myISize-1;
|
ik = myISize-1;
|
||||||
for (i=1; i<ik; ++i){
|
for (i=1; i<ik; ++i){
|
||||||
for (j=0; j<myJSize; ++j){
|
for (j=0; j<myJSize; ++j){
|
||||||
ij=i*myJSize+j;
|
ij=i*myJSize+j;
|
||||||
const StdMeshers_TNode& aTN=myTNodes[ij];
|
const StdMeshers_TNode& aTN = myTNodes[ij];
|
||||||
aSSID=aTN.ShapeSupportID();
|
aSSID=aTN.ShapeSupportID();
|
||||||
if (aSSID==SMESH_Block::ID_NONE) {
|
if (aSSID==SMESH_Block::ID_NONE) {
|
||||||
SMDS_MeshNode* aNode=(SMDS_MeshNode*)aTN.Node();
|
SMDS_MeshNode* aNode = (SMDS_MeshNode*)aTN.Node();
|
||||||
meshDS->SetNodeInVolume(aNode, shapeID);
|
meshDS->SetNodeInVolume(aNode, shapeID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -621,22 +727,28 @@ void StdMeshers_Penta_3D::MakeVolumeMesh()
|
|||||||
const TopoDS_Face& aFxy0=
|
const TopoDS_Face& aFxy0=
|
||||||
TopoDS::Face(myBlock.Shape(SMESH_Block::ID_Fxy0));
|
TopoDS::Face(myBlock.Shape(SMESH_Block::ID_Fxy0));
|
||||||
SMESH_subMesh *aSubMesh0 = pMesh->GetSubMeshContaining(aFxy0);
|
SMESH_subMesh *aSubMesh0 = pMesh->GetSubMeshContaining(aFxy0);
|
||||||
SMESHDS_SubMesh *aSM0=aSubMesh0->GetSubMeshDS();
|
SMESHDS_SubMesh *aSM0 = aSubMesh0->GetSubMeshDS();
|
||||||
//
|
//
|
||||||
itf=aSM0->GetElements();
|
itf = aSM0->GetElements();
|
||||||
while(itf->more()) {
|
while(itf->more()) {
|
||||||
const SMDS_MeshElement* pE0=itf->next();
|
const SMDS_MeshElement* pE0 = itf->next();
|
||||||
//
|
//
|
||||||
int nbFaceNodes = pE0->NbNodes();
|
int nbFaceNodes = pE0->NbNodes();
|
||||||
|
if(myCreateQuadratic)
|
||||||
|
nbFaceNodes = nbFaceNodes/2;
|
||||||
if ( aN.size() < nbFaceNodes * 2 )
|
if ( aN.size() < nbFaceNodes * 2 )
|
||||||
aN.resize( nbFaceNodes * 2 );
|
aN.resize( nbFaceNodes * 2 );
|
||||||
//
|
//
|
||||||
k=0;
|
k=0;
|
||||||
aItNodes=pE0->nodesIterator();
|
aItNodes=pE0->nodesIterator();
|
||||||
while (aItNodes->more()) {
|
while (aItNodes->more()) {
|
||||||
const SMDS_MeshElement* pNode=aItNodes->next();
|
//const SMDS_MeshElement* pNode = aItNodes->next();
|
||||||
aID0=pNode->GetID();
|
const SMDS_MeshNode* pNode =
|
||||||
aJ[k]=GetIndexOnLayer(aID0);
|
static_cast<const SMDS_MeshNode*> (aItNodes->next());
|
||||||
|
if(myTool->IsMedium(pNode))
|
||||||
|
continue;
|
||||||
|
aID0 = pNode->GetID();
|
||||||
|
aJ[k] = GetIndexOnLayer(aID0);
|
||||||
if (myErrorStatus) {
|
if (myErrorStatus) {
|
||||||
MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh");
|
MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh");
|
||||||
return;
|
return;
|
||||||
@ -646,19 +758,19 @@ void StdMeshers_Penta_3D::MakeVolumeMesh()
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
bool forward = true;
|
bool forward = true;
|
||||||
for (i=0; i<ik; ++i){
|
for (i=0; i<ik; ++i) {
|
||||||
i1=i;
|
i1=i;
|
||||||
i2=i+1;
|
i2=i+1;
|
||||||
for(j=0; j<nbFaceNodes; ++j) {
|
for(j=0; j<nbFaceNodes; ++j) {
|
||||||
ij=i1*myJSize+aJ[j];
|
ij = i1*myJSize+aJ[j];
|
||||||
const StdMeshers_TNode& aTN1=myTNodes[ij];
|
const StdMeshers_TNode& aTN1 = myTNodes[ij];
|
||||||
const SMDS_MeshNode* aN1=aTN1.Node();
|
const SMDS_MeshNode* aN1 = aTN1.Node();
|
||||||
aN[j]=aN1;
|
aN[j]=aN1;
|
||||||
//
|
//
|
||||||
ij=i2*myJSize+aJ[j];
|
ij=i2*myJSize+aJ[j];
|
||||||
const StdMeshers_TNode& aTN2=myTNodes[ij];
|
const StdMeshers_TNode& aTN2 = myTNodes[ij];
|
||||||
const SMDS_MeshNode* aN2=aTN2.Node();
|
const SMDS_MeshNode* aN2 = aTN2.Node();
|
||||||
aN[j+nbFaceNodes]=aN2;
|
aN[j+nbFaceNodes] = aN2;
|
||||||
}
|
}
|
||||||
// check if volume orientation will be ok
|
// check if volume orientation will be ok
|
||||||
if ( i == 0 ) {
|
if ( i == 0 ) {
|
||||||
@ -685,20 +797,30 @@ void StdMeshers_Penta_3D::MakeVolumeMesh()
|
|||||||
SMDS_MeshVolume* aV = 0;
|
SMDS_MeshVolume* aV = 0;
|
||||||
switch ( nbFaceNodes ) {
|
switch ( nbFaceNodes ) {
|
||||||
case 3:
|
case 3:
|
||||||
if ( forward )
|
if ( forward ) {
|
||||||
aV = meshDS->AddVolume(aN[0], aN[1], aN[2],
|
//aV = meshDS->AddVolume(aN[0], aN[1], aN[2],
|
||||||
aN[3], aN[4], aN[5]);
|
// aN[3], aN[4], aN[5]);
|
||||||
else
|
aV = myTool->AddVolume(aN[0], aN[1], aN[2], aN[3], aN[4], aN[5]);
|
||||||
aV = meshDS->AddVolume(aN[0], aN[2], aN[1],
|
}
|
||||||
aN[3], aN[5], aN[4]);
|
else {
|
||||||
|
//aV = meshDS->AddVolume(aN[0], aN[2], aN[1],
|
||||||
|
// aN[3], aN[5], aN[4]);
|
||||||
|
aV = myTool->AddVolume(aN[0], aN[2], aN[1], aN[3], aN[5], aN[4]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if ( forward )
|
if ( forward ) {
|
||||||
aV = meshDS->AddVolume(aN[0], aN[1], aN[2], aN[3],
|
//aV = meshDS->AddVolume(aN[0], aN[1], aN[2], aN[3],
|
||||||
|
// aN[4], aN[5], aN[6], aN[7]);
|
||||||
|
aV = myTool->AddVolume(aN[0], aN[1], aN[2], aN[3],
|
||||||
aN[4], aN[5], aN[6], aN[7]);
|
aN[4], aN[5], aN[6], aN[7]);
|
||||||
else
|
}
|
||||||
aV = meshDS->AddVolume(aN[0], aN[3], aN[2], aN[1],
|
else {
|
||||||
|
//aV = meshDS->AddVolume(aN[0], aN[3], aN[2], aN[1],
|
||||||
|
// aN[4], aN[7], aN[6], aN[5]);
|
||||||
|
aV = myTool->AddVolume(aN[0], aN[3], aN[2], aN[1],
|
||||||
aN[4], aN[7], aN[6], aN[5]);
|
aN[4], aN[7], aN[6], aN[5]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
@ -727,74 +849,68 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1()
|
|||||||
const TopoDS_Face& aFxy1=
|
const TopoDS_Face& aFxy1=
|
||||||
TopoDS::Face(myBlock.Shape(SMESH_Block::ID_Fxy1));
|
TopoDS::Face(myBlock.Shape(SMESH_Block::ID_Fxy1));
|
||||||
//
|
//
|
||||||
SMESH_Mesh* pMesh=GetMesh();
|
SMESH_Mesh* pMesh = GetMesh();
|
||||||
SMESHDS_Mesh * meshDS = pMesh->GetMeshDS();
|
SMESHDS_Mesh * meshDS = pMesh->GetMeshDS();
|
||||||
//
|
//
|
||||||
SMESH_subMesh *aSubMesh0 = pMesh->GetSubMeshContaining(aFxy0);
|
SMESH_subMesh *aSubMesh0 = pMesh->GetSubMeshContaining(aFxy0);
|
||||||
SMESHDS_SubMesh *aSM0=aSubMesh0->GetSubMeshDS();
|
SMESHDS_SubMesh *aSM0 = aSubMesh0->GetSubMeshDS();
|
||||||
//
|
//
|
||||||
// set nodes on aFxy1
|
// set nodes on aFxy1
|
||||||
aLevel=myISize-1;
|
aLevel = myISize-1;
|
||||||
itn=aSM0->GetNodes();
|
itn = aSM0->GetNodes();
|
||||||
aNbNodes=aSM0->NbNodes();
|
aNbNodes = aSM0->NbNodes();
|
||||||
//printf("** aNbNodes=%d\n", aNbNodes);
|
//printf("** aNbNodes=%d\n", aNbNodes);
|
||||||
while(itn->more()) {
|
|
||||||
const SMDS_MeshNode* aN0=itn->next();
|
|
||||||
aID0=aN0->GetID();
|
|
||||||
aJ=GetIndexOnLayer(aID0);
|
|
||||||
if (myErrorStatus) {
|
|
||||||
MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() ");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
ij=aLevel*myJSize+aJ;
|
|
||||||
const StdMeshers_TNode& aTN1=myTNodes[ij];
|
|
||||||
SMDS_MeshNode* aN1=(SMDS_MeshNode*)aTN1.Node();
|
|
||||||
//
|
|
||||||
meshDS->SetNodeOnFace(aN1, aFxy1);
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// set elements on aFxy1
|
// set elements on aFxy1
|
||||||
vector<const SMDS_MeshNode*> aNodes1;
|
vector<const SMDS_MeshNode*> aNodes1;
|
||||||
//
|
//
|
||||||
itf=aSM0->GetElements();
|
itf = aSM0->GetElements();
|
||||||
while(itf->more()) {
|
while(itf->more()) {
|
||||||
const SMDS_MeshElement * pE0=itf->next();
|
const SMDS_MeshElement* pE0 = itf->next();
|
||||||
aElementType=pE0->GetType();
|
aElementType = pE0->GetType();
|
||||||
if (!aElementType==SMDSAbs_Face) {
|
if (!aElementType==SMDSAbs_Face) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
aNbNodes=pE0->NbNodes();
|
aNbNodes = pE0->NbNodes();
|
||||||
|
if(myCreateQuadratic)
|
||||||
|
aNbNodes = aNbNodes/2;
|
||||||
// if (aNbNodes!=3) {
|
// if (aNbNodes!=3) {
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
if ( aNodes1.size() < aNbNodes )
|
if ( aNodes1.size() < aNbNodes )
|
||||||
aNodes1.resize( aNbNodes );
|
aNodes1.resize( aNbNodes );
|
||||||
//
|
//
|
||||||
k=aNbNodes-1; // reverse a face
|
k = aNbNodes-1; // reverse a face
|
||||||
aItNodes=pE0->nodesIterator();
|
aItNodes = pE0->nodesIterator();
|
||||||
while (aItNodes->more()) {
|
while (aItNodes->more()) {
|
||||||
const SMDS_MeshElement* pNode=aItNodes->next();
|
//const SMDS_MeshElement* pNode = aItNodes->next();
|
||||||
aID0=pNode->GetID();
|
const SMDS_MeshNode* pNode =
|
||||||
aJ=GetIndexOnLayer(aID0);
|
static_cast<const SMDS_MeshNode*> (aItNodes->next());
|
||||||
|
if(myTool->IsMedium(pNode))
|
||||||
|
continue;
|
||||||
|
aID0 = pNode->GetID();
|
||||||
|
aJ = GetIndexOnLayer(aID0);
|
||||||
if (myErrorStatus) {
|
if (myErrorStatus) {
|
||||||
MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() ");
|
MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
ij=aLevel*myJSize+aJ;
|
ij = aLevel*myJSize + aJ;
|
||||||
const StdMeshers_TNode& aTN1=myTNodes[ij];
|
const StdMeshers_TNode& aTN1 = myTNodes[ij];
|
||||||
const SMDS_MeshNode* aN1=aTN1.Node();
|
const SMDS_MeshNode* aN1 = aTN1.Node();
|
||||||
aNodes1[k]=aN1;
|
aNodes1[k] = aN1;
|
||||||
--k;
|
--k;
|
||||||
}
|
}
|
||||||
SMDS_MeshFace * face = 0;
|
SMDS_MeshFace * face = 0;
|
||||||
switch ( aNbNodes ) {
|
switch ( aNbNodes ) {
|
||||||
case 3:
|
case 3:
|
||||||
face = meshDS->AddFace(aNodes1[0], aNodes1[1], aNodes1[2]);
|
//face = meshDS->AddFace(aNodes1[0], aNodes1[1], aNodes1[2]);
|
||||||
|
face = myTool->AddFace(aNodes1[0], aNodes1[1], aNodes1[2]);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
face = meshDS->AddFace(aNodes1[0], aNodes1[1], aNodes1[2], aNodes1[3]);
|
//face = meshDS->AddFace(aNodes1[0], aNodes1[1], aNodes1[2], aNodes1[3]);
|
||||||
|
face = myTool->AddFace(aNodes1[0], aNodes1[1], aNodes1[2], aNodes1[3]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
@ -802,6 +918,7 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1()
|
|||||||
meshDS->SetMeshElementOnShape(face, aFxy1);
|
meshDS->SetMeshElementOnShape(face, aFxy1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ClearMeshOnFxy1
|
//function : ClearMeshOnFxy1
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -838,6 +955,7 @@ int StdMeshers_Penta_3D::GetIndexOnLayer(const int aID)
|
|||||||
j=(*aMapIt).second;
|
j=(*aMapIt).second;
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : MakeConnectingMap
|
//function : MakeConnectingMap
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -852,6 +970,7 @@ void StdMeshers_Penta_3D::MakeConnectingMap()
|
|||||||
myConnectingMap[aBNID]=j;
|
myConnectingMap[aBNID]=j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : CreateNode
|
//function : CreateNode
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -879,8 +998,7 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer,
|
|||||||
// // point inside solid
|
// // point inside solid
|
||||||
// myBlock.Point(aParams, aP);
|
// myBlock.Point(aParams, aP);
|
||||||
// }
|
// }
|
||||||
if (bIsUpperLayer)
|
if (bIsUpperLayer) {
|
||||||
{
|
|
||||||
double u = aParams.X(), v = aParams.Y();
|
double u = aParams.X(), v = aParams.Y();
|
||||||
double u1 = ( 1. - u ), v1 = ( 1. - v );
|
double u1 = ( 1. - u ), v1 = ( 1. - v );
|
||||||
aP.ChangeCoord() = myShapeXYZ[ SMESH_Block::ID_Ex01 ] * v1;
|
aP.ChangeCoord() = myShapeXYZ[ SMESH_Block::ID_Ex01 ] * v1;
|
||||||
@ -893,8 +1011,7 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer,
|
|||||||
aP.ChangeCoord() -= myShapeXYZ[ SMESH_Block::ID_V011 ] * u1 * v;
|
aP.ChangeCoord() -= myShapeXYZ[ SMESH_Block::ID_V011 ] * u1 * v;
|
||||||
aP.ChangeCoord() -= myShapeXYZ[ SMESH_Block::ID_V111 ] * u * v;
|
aP.ChangeCoord() -= myShapeXYZ[ SMESH_Block::ID_V111 ] * u * v;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
SMESH_Block::ShellPoint( aParams, myShapeXYZ, aP.ChangeCoord() );
|
SMESH_Block::ShellPoint( aParams, myShapeXYZ, aP.ChangeCoord() );
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -906,12 +1023,14 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer,
|
|||||||
//
|
//
|
||||||
aX=aP.X(); aY=aP.Y(); aZ=aP.Z();
|
aX=aP.X(); aY=aP.Y(); aZ=aP.Z();
|
||||||
//
|
//
|
||||||
SMESH_Mesh* pMesh=GetMesh();
|
SMESH_Mesh* pMesh = GetMesh();
|
||||||
SMESHDS_Mesh* pMeshDS=pMesh->GetMeshDS();
|
SMESHDS_Mesh* pMeshDS = pMesh->GetMeshDS();
|
||||||
//
|
//
|
||||||
pNode = pMeshDS->AddNode(aX, aY, aZ);
|
pNode = pMeshDS->AddNode(aX, aY, aZ);
|
||||||
|
|
||||||
aTN.SetNode(pNode);
|
aTN.SetNode(pNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ShapeSupportID
|
//function : ShapeSupportID
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -980,21 +1099,21 @@ void StdMeshers_Penta_3D::MakeBlock()
|
|||||||
SMDSAbs_ElementType aElementType;
|
SMDSAbs_ElementType aElementType;
|
||||||
SMESH_Mesh* pMesh=GetMesh();
|
SMESH_Mesh* pMesh=GetMesh();
|
||||||
//
|
//
|
||||||
iCnt=0;
|
iCnt = 0;
|
||||||
iNbF=aM.Extent();
|
iNbF = aM.Extent();
|
||||||
for (i=1; i<=iNbF; ++i) {
|
for (i=1; i<=iNbF; ++i) {
|
||||||
const TopoDS_Shape& aF=aM(i);
|
const TopoDS_Shape& aF = aM(i);
|
||||||
SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF);
|
SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF);
|
||||||
ASSERT(aSubMesh);
|
ASSERT(aSubMesh);
|
||||||
SMESHDS_SubMesh *aSM=aSubMesh->GetSubMeshDS();
|
SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
|
||||||
SMDS_ElemIteratorPtr itf=aSM->GetElements();
|
SMDS_ElemIteratorPtr itf = aSM->GetElements();
|
||||||
while(itf->more()) {
|
while(itf->more()) {
|
||||||
const SMDS_MeshElement * pElement=itf->next();
|
const SMDS_MeshElement * pElement = itf->next();
|
||||||
aElementType=pElement->GetType();
|
aElementType = pElement->GetType();
|
||||||
if (aElementType==SMDSAbs_Face) {
|
if (aElementType==SMDSAbs_Face) {
|
||||||
iNbNodes=pElement->NbNodes();
|
iNbNodes = pElement->NbNodes();
|
||||||
if (iNbNodes==3) {
|
if ( iNbNodes==3 || (myCreateQuadratic && iNbNodes==6) ) {
|
||||||
aFTr=aF;
|
aFTr = aF;
|
||||||
++iCnt;
|
++iCnt;
|
||||||
if (iCnt>1) {
|
if (iCnt>1) {
|
||||||
MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
|
MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
|
||||||
@ -1013,7 +1132,7 @@ void StdMeshers_Penta_3D::MakeBlock()
|
|||||||
TopExp::MapShapesAndAncestors(myShape, TopAbs_VERTEX, TopAbs_EDGE, aMVES);
|
TopExp::MapShapesAndAncestors(myShape, TopAbs_VERTEX, TopAbs_EDGE, aMVES);
|
||||||
//
|
//
|
||||||
// 1.1 Base vertex V000
|
// 1.1 Base vertex V000
|
||||||
iNbE=aME.Extent();
|
iNbE = aME.Extent();
|
||||||
if (iNbE!=4){
|
if (iNbE!=4){
|
||||||
MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
|
MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
|
||||||
myErrorStatus=7; // too few edges are in base face aFTr
|
myErrorStatus=7; // too few edges are in base face aFTr
|
||||||
@ -1080,7 +1199,7 @@ void StdMeshers_Penta_3D::MakeBlock()
|
|||||||
// 2. Load Block
|
// 2. Load Block
|
||||||
const TopoDS_Shell& aShell=TopoDS::Shell(aME(1));
|
const TopoDS_Shell& aShell=TopoDS::Shell(aME(1));
|
||||||
myBlock.Load(aShell, aV000, aV001);
|
myBlock.Load(aShell, aV000, aV001);
|
||||||
iErr=myBlock.ErrorStatus();
|
iErr = myBlock.ErrorStatus();
|
||||||
if (iErr) {
|
if (iErr) {
|
||||||
MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
|
MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
|
||||||
myErrorStatus=100; // SMESHBlock: Load operation failed
|
myErrorStatus=100; // SMESHBlock: Load operation failed
|
||||||
@ -1154,10 +1273,10 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
bool rev1, CumOri = false;
|
bool rev1, CumOri = false;
|
||||||
TopExp_Explorer exp( theFace, TopAbs_EDGE );
|
TopExp_Explorer exp( theFace, TopAbs_EDGE );
|
||||||
int nbEdges = 0;
|
int nbEdges = 0;
|
||||||
for ( ; exp.More(); exp.Next() )
|
for ( ; exp.More(); exp.Next() ) {
|
||||||
{
|
if ( ++nbEdges > 4 ) {
|
||||||
if ( ++nbEdges > 4 )
|
|
||||||
return false; // more than 4 edges in theFace
|
return false; // more than 4 edges in theFace
|
||||||
|
}
|
||||||
TopoDS_Edge e = TopoDS::Edge( exp.Current() );
|
TopoDS_Edge e = TopoDS::Edge( exp.Current() );
|
||||||
if ( theBaseEdge.IsSame( e ))
|
if ( theBaseEdge.IsSame( e ))
|
||||||
continue;
|
continue;
|
||||||
@ -1174,8 +1293,9 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
else
|
else
|
||||||
e2 = e;
|
e2 = e;
|
||||||
}
|
}
|
||||||
if ( nbEdges < 4 )
|
if ( nbEdges < 4 ) {
|
||||||
return false; // lass than 4 edges in theFace
|
return false; // less than 4 edges in theFace
|
||||||
|
}
|
||||||
|
|
||||||
// submeshes corresponding to shapes
|
// submeshes corresponding to shapes
|
||||||
SMESHDS_SubMesh* smFace = theMesh->MeshElements( theFace );
|
SMESHDS_SubMesh* smFace = theMesh->MeshElements( theFace );
|
||||||
@ -1200,13 +1320,32 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ( sm1->NbNodes() * smb->NbNodes() != smFace->NbNodes() ) {
|
if ( sm1->NbNodes() * smb->NbNodes() != smFace->NbNodes() ) {
|
||||||
|
// check quadratic case
|
||||||
|
if ( myCreateQuadratic ) {
|
||||||
|
int n1 = sm1->NbNodes()/2;
|
||||||
|
int n2 = smb->NbNodes()/2;
|
||||||
|
int n3 = sm1->NbNodes() - n1;
|
||||||
|
int n4 = smb->NbNodes() - n2;
|
||||||
|
int nf = sm1->NbNodes()*smb->NbNodes() - n3*n4;
|
||||||
|
if( nf != smFace->NbNodes() ) {
|
||||||
MESSAGE( "Wrong nb face nodes: " <<
|
MESSAGE( "Wrong nb face nodes: " <<
|
||||||
sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
|
sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MESSAGE( "Wrong nb face nodes: " <<
|
||||||
|
sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
// IJ size
|
// IJ size
|
||||||
int vsize = sm1->NbNodes() + 2;
|
int vsize = sm1->NbNodes() + 2;
|
||||||
int hsize = smb->NbNodes() + 2;
|
int hsize = smb->NbNodes() + 2;
|
||||||
|
if(myCreateQuadratic) {
|
||||||
|
vsize = vsize - sm1->NbNodes()/2 -1;
|
||||||
|
hsize = hsize - smb->NbNodes()/2 -1;
|
||||||
|
}
|
||||||
|
|
||||||
// load nodes from theBaseEdge
|
// load nodes from theBaseEdge
|
||||||
|
|
||||||
@ -1226,12 +1365,15 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
double range = l - f;
|
double range = l - f;
|
||||||
SMDS_NodeIteratorPtr nIt = smb->GetNodes();
|
SMDS_NodeIteratorPtr nIt = smb->GetNodes();
|
||||||
const SMDS_MeshNode* node;
|
const SMDS_MeshNode* node;
|
||||||
while ( nIt->more() )
|
while ( nIt->more() ) {
|
||||||
{
|
|
||||||
node = nIt->next();
|
node = nIt->next();
|
||||||
|
if(myTool->IsMedium(node))
|
||||||
|
continue;
|
||||||
const SMDS_EdgePosition* pos =
|
const SMDS_EdgePosition* pos =
|
||||||
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
|
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
|
||||||
if ( !pos ) return false;
|
if ( !pos ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
double u = ( pos->GetUParameter() - f ) / range;
|
double u = ( pos->GetUParameter() - f ) / range;
|
||||||
vector<const SMDS_MeshNode*> & nVec = theIJNodes[ u ];
|
vector<const SMDS_MeshNode*> & nVec = theIJNodes[ u ];
|
||||||
nVec.resize( vsize, nullNode );
|
nVec.resize( vsize, nullNode );
|
||||||
@ -1246,19 +1388,21 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
|
|
||||||
map< double, const SMDS_MeshNode*> sortedNodes; // sort by param on edge
|
map< double, const SMDS_MeshNode*> sortedNodes; // sort by param on edge
|
||||||
nIt = sm1->GetNodes();
|
nIt = sm1->GetNodes();
|
||||||
while ( nIt->more() )
|
while ( nIt->more() ) {
|
||||||
{
|
|
||||||
node = nIt->next();
|
node = nIt->next();
|
||||||
|
if(myTool->IsMedium(node))
|
||||||
|
continue;
|
||||||
const SMDS_EdgePosition* pos =
|
const SMDS_EdgePosition* pos =
|
||||||
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
|
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
|
||||||
if ( !pos ) return false;
|
if ( !pos ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
sortedNodes.insert( make_pair( pos->GetUParameter(), node ));
|
sortedNodes.insert( make_pair( pos->GetUParameter(), node ));
|
||||||
}
|
}
|
||||||
loadedNodes.insert( nVecf[ vsize - 1 ] = smVft->GetNodes()->next() );
|
loadedNodes.insert( nVecf[ vsize - 1 ] = smVft->GetNodes()->next() );
|
||||||
map< double, const SMDS_MeshNode*>::iterator u_n = sortedNodes.begin();
|
map< double, const SMDS_MeshNode*>::iterator u_n = sortedNodes.begin();
|
||||||
int row = rev1 ? vsize - 1 : 0;
|
int row = rev1 ? vsize - 1 : 0;
|
||||||
for ( ; u_n != sortedNodes.end(); u_n++ )
|
for ( ; u_n != sortedNodes.end(); u_n++ ) {
|
||||||
{
|
|
||||||
if ( rev1 ) row--;
|
if ( rev1 ) row--;
|
||||||
else row++;
|
else row++;
|
||||||
loadedNodes.insert( nVecf[ row ] = u_n->second );
|
loadedNodes.insert( nVecf[ row ] = u_n->second );
|
||||||
@ -1285,8 +1429,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
StdMeshers_IJNodeMap::iterator par_nVec_2 = par_nVec_1;
|
StdMeshers_IJNodeMap::iterator par_nVec_2 = par_nVec_1;
|
||||||
// loop on columns
|
// loop on columns
|
||||||
int col = 0;
|
int col = 0;
|
||||||
for ( par_nVec_2++; par_nVec_2 != theIJNodes.end(); par_nVec_1++, par_nVec_2++ )
|
for ( par_nVec_2++; par_nVec_2 != theIJNodes.end(); par_nVec_1++, par_nVec_2++ ) {
|
||||||
{
|
|
||||||
col++;
|
col++;
|
||||||
row = 0;
|
row = 0;
|
||||||
const SMDS_MeshNode* n1 = par_nVec_1->second[ row ];
|
const SMDS_MeshNode* n1 = par_nVec_1->second[ row ];
|
||||||
@ -1295,10 +1438,10 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
do {
|
do {
|
||||||
// look for a face by 2 nodes
|
// look for a face by 2 nodes
|
||||||
face = SMESH_MeshEditor::FindFaceInSet( n1, n2, allFaces, foundFaces );
|
face = SMESH_MeshEditor::FindFaceInSet( n1, n2, allFaces, foundFaces );
|
||||||
if ( face )
|
if ( face ) {
|
||||||
{
|
|
||||||
int nbFaceNodes = face->NbNodes();
|
int nbFaceNodes = face->NbNodes();
|
||||||
if ( nbFaceNodes > 4 ) {
|
if ( (!myCreateQuadratic && nbFaceNodes>4) ||
|
||||||
|
(myCreateQuadratic && nbFaceNodes>8) ) {
|
||||||
MESSAGE(" Too many nodes in a face: " << nbFaceNodes );
|
MESSAGE(" Too many nodes in a face: " << nbFaceNodes );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1308,6 +1451,8 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
eIt = face->nodesIterator() ;
|
eIt = face->nodesIterator() ;
|
||||||
while ( !found && eIt->more() ) {
|
while ( !found && eIt->more() ) {
|
||||||
node = static_cast<const SMDS_MeshNode*>( eIt->next() );
|
node = static_cast<const SMDS_MeshNode*>( eIt->next() );
|
||||||
|
if(myTool->IsMedium(node))
|
||||||
|
continue;
|
||||||
found = loadedNodes.insert( node ).second;
|
found = loadedNodes.insert( node ).second;
|
||||||
if ( !found && node != n1 && node != n2 )
|
if ( !found && node != n1 && node != n2 )
|
||||||
n3 = node;
|
n3 = node;
|
||||||
@ -1320,18 +1465,21 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
par_nVec_2->second[ row ] = node;
|
par_nVec_2->second[ row ] = node;
|
||||||
foundFaces.insert( face );
|
foundFaces.insert( face );
|
||||||
n2 = node;
|
n2 = node;
|
||||||
if ( nbFaceNodes == 4 )
|
if ( nbFaceNodes==4 || (myCreateQuadratic && nbFaceNodes==8) ) {
|
||||||
n1 = par_nVec_1->second[ row ];
|
n1 = par_nVec_1->second[ row ];
|
||||||
}
|
}
|
||||||
else if (nbFaceNodes == 3 &&
|
}
|
||||||
n3 == par_nVec_1->second[ row ] )
|
else if ( (nbFaceNodes==3 || (myCreateQuadratic && nbFaceNodes==6) ) &&
|
||||||
|
n3 == par_nVec_1->second[ row ] ) {
|
||||||
n1 = n3;
|
n1 = n3;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
MESSAGE( "Not quad mesh, column "<< col );
|
MESSAGE( "Not quad mesh, column "<< col );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while ( face && n1 && n2 );
|
}
|
||||||
|
while ( face && n1 && n2 );
|
||||||
|
|
||||||
if ( row < vsize - 1 ) {
|
if ( row < vsize - 1 ) {
|
||||||
MESSAGE( "Too few nodes in column "<< col <<": "<< row+1);
|
MESSAGE( "Too few nodes in column "<< col <<": "<< row+1);
|
||||||
@ -1390,17 +1538,18 @@ int StdMeshers_SMESHBlock::ErrorStatus() const
|
|||||||
{
|
{
|
||||||
return myErrorStatus;
|
return myErrorStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Load
|
//function : Load
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell)
|
void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell)
|
||||||
{
|
{
|
||||||
|
|
||||||
TopoDS_Vertex aV000, aV001;
|
TopoDS_Vertex aV000, aV001;
|
||||||
//
|
//
|
||||||
Load(theShell, aV000, aV001);
|
Load(theShell, aV000, aV001);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Load
|
//function : Load
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1416,12 +1565,13 @@ void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell,
|
|||||||
bool bOk;
|
bool bOk;
|
||||||
//
|
//
|
||||||
myShapeIDMap.Clear();
|
myShapeIDMap.Clear();
|
||||||
bOk=myTBlock.LoadBlockShapes(myShell, theV000, theV001, myShapeIDMap);
|
bOk = myTBlock.LoadBlockShapes(myShell, theV000, theV001, myShapeIDMap);
|
||||||
if (!bOk) {
|
if (!bOk) {
|
||||||
myErrorStatus=2;
|
myErrorStatus=2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ComputeParameters
|
//function : ComputeParameters
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1431,6 +1581,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt,
|
|||||||
{
|
{
|
||||||
ComputeParameters(thePnt, myShell, theXYZ);
|
ComputeParameters(thePnt, myShell, theXYZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ComputeParameters
|
//function : ComputeParameters
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1444,11 +1595,11 @@ void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt,
|
|||||||
int aID;
|
int aID;
|
||||||
bool bOk;
|
bool bOk;
|
||||||
//
|
//
|
||||||
aID=ShapeID(theShape);
|
aID = ShapeID(theShape);
|
||||||
if (myErrorStatus) {
|
if (myErrorStatus) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bOk=myTBlock.ComputeParameters(thePnt, theXYZ, aID);
|
bOk = myTBlock.ComputeParameters(thePnt, theXYZ, aID);
|
||||||
if (!bOk) {
|
if (!bOk) {
|
||||||
myErrorStatus=4; // problems with computation Parameters
|
myErrorStatus=4; // problems with computation Parameters
|
||||||
return;
|
return;
|
||||||
@ -1469,12 +1620,12 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
|
|||||||
int aID;
|
int aID;
|
||||||
bool bOk=false;
|
bool bOk=false;
|
||||||
//
|
//
|
||||||
aID=ShapeID(theShape);
|
aID = ShapeID(theShape);
|
||||||
if (myErrorStatus) {
|
if (myErrorStatus) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( SMESH_Block::IsEdgeID( aID ))
|
if ( SMESH_Block::IsEdgeID( aID ))
|
||||||
bOk=myTBlock.EdgeParameters( aID, theU, theXYZ );
|
bOk = myTBlock.EdgeParameters( aID, theU, theXYZ );
|
||||||
if (!bOk) {
|
if (!bOk) {
|
||||||
myErrorStatus=4; // problems with computation Parameters
|
myErrorStatus=4; // problems with computation Parameters
|
||||||
return;
|
return;
|
||||||
@ -1492,6 +1643,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
|
|||||||
//
|
//
|
||||||
Point(theParams, aS, aP3D);
|
Point(theParams, aS, aP3D);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Point
|
//function : Point
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1500,15 +1652,15 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
|
|||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
gp_Pnt& aP3D)
|
gp_Pnt& aP3D)
|
||||||
{
|
{
|
||||||
myErrorStatus=0;
|
myErrorStatus = 0;
|
||||||
//
|
//
|
||||||
int aID;
|
int aID;
|
||||||
bool bOk=false;
|
bool bOk = false;
|
||||||
gp_XYZ aXYZ(99.,99.,99.);
|
gp_XYZ aXYZ(99.,99.,99.);
|
||||||
aP3D.SetXYZ(aXYZ);
|
aP3D.SetXYZ(aXYZ);
|
||||||
//
|
//
|
||||||
if (theShape.IsNull()) {
|
if (theShape.IsNull()) {
|
||||||
bOk=myTBlock.ShellPoint(theParams, aXYZ);
|
bOk = myTBlock.ShellPoint(theParams, aXYZ);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
else {
|
else {
|
||||||
@ -1518,14 +1670,14 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (SMESH_Block::IsVertexID(aID)) {
|
if (SMESH_Block::IsVertexID(aID)) {
|
||||||
bOk=myTBlock.VertexPoint(aID, aXYZ);
|
bOk = myTBlock.VertexPoint(aID, aXYZ);
|
||||||
}
|
}
|
||||||
else if (SMESH_Block::IsEdgeID(aID)) {
|
else if (SMESH_Block::IsEdgeID(aID)) {
|
||||||
bOk=myTBlock.EdgePoint(aID, theParams, aXYZ);
|
bOk = myTBlock.EdgePoint(aID, theParams, aXYZ);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
else if (SMESH_Block::IsFaceID(aID)) {
|
else if (SMESH_Block::IsFaceID(aID)) {
|
||||||
bOk=myTBlock.FacePoint(aID, theParams, aXYZ);
|
bOk = myTBlock.FacePoint(aID, theParams, aXYZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bOk) {
|
if (!bOk) {
|
||||||
@ -1534,6 +1686,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
|
|||||||
}
|
}
|
||||||
aP3D.SetXYZ(aXYZ);
|
aP3D.SetXYZ(aXYZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ShapeID
|
//function : ShapeID
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1561,6 +1714,7 @@ int StdMeshers_SMESHBlock::ShapeID(const TopoDS_Shape& theShape)
|
|||||||
myErrorStatus=2; // unknown shape;
|
myErrorStatus=2; // unknown shape;
|
||||||
return aID;
|
return aID;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Shape
|
//function : Shape
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1580,3 +1734,5 @@ const TopoDS_Shape& StdMeshers_SMESHBlock::Shape(const int theID)
|
|||||||
const TopoDS_Shape& aS=myShapeIDMap.FindKey(theID);
|
const TopoDS_Shape& aS=myShapeIDMap.FindKey(theID);
|
||||||
return aS;
|
return aS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,9 +39,12 @@
|
|||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
#include <TopoDS_Shell.hxx>
|
#include <TopoDS_Shell.hxx>
|
||||||
#include <TopTools_IndexedMapOfOrientedShape.hxx>
|
#include <TopTools_IndexedMapOfOrientedShape.hxx>
|
||||||
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
|
|
||||||
#include "SMESH_Block.hxx"
|
#include "SMESH_Block.hxx"
|
||||||
|
|
||||||
|
#include "StdMeshers_Helper.hxx"
|
||||||
|
|
||||||
typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
|
typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
|
||||||
|
|
||||||
class StdMeshers_SMESHBlock {
|
class StdMeshers_SMESHBlock {
|
||||||
@ -181,7 +184,7 @@ class StdMeshers_Penta_3D {
|
|||||||
return myTol3D;
|
return myTol3D;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
bool LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
||||||
const TopoDS_Face& theFace,
|
const TopoDS_Face& theFace,
|
||||||
const TopoDS_Edge& theBaseEdge,
|
const TopoDS_Edge& theBaseEdge,
|
||||||
SMESHDS_Mesh* theMesh);
|
SMESHDS_Mesh* theMesh);
|
||||||
@ -251,6 +254,9 @@ class StdMeshers_Penta_3D {
|
|||||||
//
|
//
|
||||||
vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
|
vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
|
||||||
vector<gp_XYZ> myShapeXYZ; // point on each sub-shape
|
vector<gp_XYZ> myShapeXYZ; // point on each sub-shape
|
||||||
|
|
||||||
|
bool myCreateQuadratic;
|
||||||
|
StdMeshers_Helper* myTool; // toll for working with quadratic elements
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,6 +47,7 @@ using namespace std;
|
|||||||
#include <Geom2d_Curve.hxx>
|
#include <Geom2d_Curve.hxx>
|
||||||
#include <GeomAdaptor_Curve.hxx>
|
#include <GeomAdaptor_Curve.hxx>
|
||||||
#include <GCPnts_UniformAbscissa.hxx>
|
#include <GCPnts_UniformAbscissa.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
|
||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
#include <gp_Pnt2d.hxx>
|
#include <gp_Pnt2d.hxx>
|
||||||
@ -128,6 +129,11 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
|
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
|
||||||
aMesh.GetSubMesh(aShape);
|
aMesh.GetSubMesh(aShape);
|
||||||
|
|
||||||
|
bool QuadMode = true;
|
||||||
|
|
||||||
|
myTool = new StdMeshers_Helper(aMesh);
|
||||||
|
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||||
|
|
||||||
//FaceQuadStruct *quad = CheckAnd2Dcompute(aMesh, aShape);
|
//FaceQuadStruct *quad = CheckAnd2Dcompute(aMesh, aShape);
|
||||||
FaceQuadStruct* quad = CheckNbEdges(aMesh, aShape);
|
FaceQuadStruct* quad = CheckNbEdges(aMesh, aShape);
|
||||||
|
|
||||||
@ -212,7 +218,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
b = quad->uv_grid[j * nbhoriz + i + 1].node;
|
b = quad->uv_grid[j * nbhoriz + i + 1].node;
|
||||||
c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node;
|
c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node;
|
||||||
d = quad->uv_grid[(j + 1) * nbhoriz + i].node;
|
d = quad->uv_grid[(j + 1) * nbhoriz + i].node;
|
||||||
SMDS_MeshFace * face = meshDS->AddFace(a, b, c, d);
|
//SMDS_MeshFace * face = meshDS->AddFace(a, b, c, d);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,7 +266,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
// right bound reached, link with the rightmost node
|
// right bound reached, link with the rightmost node
|
||||||
near = iup;
|
near = iup;
|
||||||
c = quad->uv_grid[nbhoriz + iup].node;
|
c = quad->uv_grid[nbhoriz + iup].node;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// find in the grid node c, nearest to the b
|
// find in the grid node c, nearest to the b
|
||||||
double mind = RealLast();
|
double mind = RealLast();
|
||||||
for (int k = g; k <= iup; k++) {
|
for (int k = g; k <= iup; k++) {
|
||||||
@ -283,14 +291,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (near == g) { // make triangle
|
if (near == g) { // make triangle
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, b, c);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
} else { // make quadrangle
|
}
|
||||||
|
else { // make quadrangle
|
||||||
if (near - 1 < ilow)
|
if (near - 1 < ilow)
|
||||||
d = uv_e3[1].node;
|
d = uv_e3[1].node;
|
||||||
else
|
else
|
||||||
d = quad->uv_grid[nbhoriz + near - 1].node;
|
d = quad->uv_grid[nbhoriz + near - 1].node;
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
|
|
||||||
// if node d is not at position g - make additional triangles
|
// if node d is not at position g - make additional triangles
|
||||||
@ -301,7 +312,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
d = uv_e3[1].node;
|
d = uv_e3[1].node;
|
||||||
else
|
else
|
||||||
d = quad->uv_grid[nbhoriz + k - 1].node;
|
d = quad->uv_grid[nbhoriz + k - 1].node;
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, c, d);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,14 +375,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (near == g) { // make triangle
|
if (near == g) { // make triangle
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, b, c);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
} else { // make quadrangle
|
}
|
||||||
|
else { // make quadrangle
|
||||||
if (near + 1 > iup)
|
if (near + 1 > iup)
|
||||||
d = uv_e1[nbright - 2].node;
|
d = uv_e1[nbright - 2].node;
|
||||||
else
|
else
|
||||||
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + near + 1].node;
|
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + near + 1].node;
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
|
|
||||||
if (near + 1 < g) { // if d not is at g - make additional triangles
|
if (near + 1 < g) { // if d not is at g - make additional triangles
|
||||||
@ -380,7 +395,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
d = uv_e1[nbright - 2].node;
|
d = uv_e1[nbright - 2].node;
|
||||||
else
|
else
|
||||||
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node;
|
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node;
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, c, d);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,14 +444,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (near == g) { // make triangle
|
if (near == g) { // make triangle
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, b, c);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
} else { // make quadrangle
|
}
|
||||||
|
else { // make quadrangle
|
||||||
if (near - 1 < jlow)
|
if (near - 1 < jlow)
|
||||||
d = uv_e0[nbdown - 2].node;
|
d = uv_e0[nbdown - 2].node;
|
||||||
else
|
else
|
||||||
d = quad->uv_grid[nbhoriz*near - 2].node;
|
d = quad->uv_grid[nbhoriz*near - 2].node;
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
|
|
||||||
if (near - 1 > g) { // if d not is at g - make additional triangles
|
if (near - 1 > g) { // if d not is at g - make additional triangles
|
||||||
@ -445,7 +464,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
d = uv_e0[nbdown - 2].node;
|
d = uv_e0[nbdown - 2].node;
|
||||||
else
|
else
|
||||||
d = quad->uv_grid[nbhoriz*k - 2].node;
|
d = quad->uv_grid[nbhoriz*k - 2].node;
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, c, d);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -490,14 +510,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (near == g) { // make triangle
|
if (near == g) { // make triangle
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, b, c);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
} else { // make quadrangle
|
}
|
||||||
|
else { // make quadrangle
|
||||||
if (near + 1 > jup)
|
if (near + 1 > jup)
|
||||||
d = uv_e2[1].node;
|
d = uv_e2[1].node;
|
||||||
else
|
else
|
||||||
d = quad->uv_grid[nbhoriz*(near + 1) + 1].node;
|
d = quad->uv_grid[nbhoriz*(near + 1) + 1].node;
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
|
|
||||||
if (near + 1 < g) { // if d not is at g - make additional triangles
|
if (near + 1 < g) { // if d not is at g - make additional triangles
|
||||||
@ -507,7 +530,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
|||||||
d = uv_e2[1].node;
|
d = uv_e2[1].node;
|
||||||
else
|
else
|
||||||
d = quad->uv_grid[nbhoriz*(k + 1) + 1].node;
|
d = quad->uv_grid[nbhoriz*(k + 1) + 1].node;
|
||||||
SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
|
//SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
|
||||||
|
SMDS_MeshFace* face = myTool->AddFace(a, c, d);
|
||||||
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
meshDS->SetMeshElementOnShape(face, geomFaceID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,8 +581,14 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh,
|
|||||||
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||||
if (nbEdges < 4) {
|
if (nbEdges < 4) {
|
||||||
quad->edge[nbEdges] = E;
|
quad->edge[nbEdges] = E;
|
||||||
|
if(!myCreateQuadratic) {
|
||||||
quad->nbPts[nbEdges] = nb + 2; // internal points + 2 extrema
|
quad->nbPts[nbEdges] = nb + 2; // internal points + 2 extrema
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
int tmp = nb/2;
|
||||||
|
quad->nbPts[nbEdges] = tmp + 2; // internal not medium points + 2 extrema
|
||||||
|
}
|
||||||
|
}
|
||||||
nbEdges++;
|
nbEdges++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,15 +604,35 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
* CheckAnd2Dcompute
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
|
FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
|
||||||
(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) throw(SALOME_Exception)
|
(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) throw(SALOME_Exception)
|
||||||
|
{
|
||||||
|
bool QuadMode = true;
|
||||||
|
myTool = new StdMeshers_Helper(aMesh);
|
||||||
|
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||||
|
return CheckAnd2Dcompute(aMesh,aShape,myCreateQuadratic);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* CheckAnd2Dcompute
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
|
||||||
|
(SMESH_Mesh & aMesh,
|
||||||
|
const TopoDS_Shape & aShape,
|
||||||
|
const bool CreateQuadratic) throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
Unexpect aCatch(SalomeException);
|
||||||
|
|
||||||
|
myCreateQuadratic = CreateQuadratic;
|
||||||
|
|
||||||
FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
|
FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
|
||||||
|
|
||||||
if(!quad) return 0;
|
if(!quad) return 0;
|
||||||
@ -1185,13 +1235,13 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref
|
|||||||
for(j=1; j<nl; j++) {
|
for(j=1; j<nl; j++) {
|
||||||
if(WisF) {
|
if(WisF) {
|
||||||
SMDS_MeshFace* F =
|
SMDS_MeshFace* F =
|
||||||
meshDS->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j),
|
myTool->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j),
|
||||||
NodesL.Value(i+1,j+1), NodesL.Value(i,j+1));
|
NodesL.Value(i+1,j+1), NodesL.Value(i,j+1));
|
||||||
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SMDS_MeshFace* F =
|
SMDS_MeshFace* F =
|
||||||
meshDS->AddFace(NodesL.Value(i,j), NodesL.Value(i,j+1),
|
myTool->AddFace(NodesL.Value(i,j), NodesL.Value(i,j+1),
|
||||||
NodesL.Value(i+1,j+1), NodesL.Value(i+1,j));
|
NodesL.Value(i+1,j+1), NodesL.Value(i+1,j));
|
||||||
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
||||||
}
|
}
|
||||||
@ -1252,13 +1302,13 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref
|
|||||||
for(j=1; j<nr; j++) {
|
for(j=1; j<nr; j++) {
|
||||||
if(WisF) {
|
if(WisF) {
|
||||||
SMDS_MeshFace* F =
|
SMDS_MeshFace* F =
|
||||||
meshDS->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j),
|
myTool->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j),
|
||||||
NodesR.Value(i+1,j+1), NodesR.Value(i,j+1));
|
NodesR.Value(i+1,j+1), NodesR.Value(i,j+1));
|
||||||
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SMDS_MeshFace* F =
|
SMDS_MeshFace* F =
|
||||||
meshDS->AddFace(NodesR.Value(i,j), NodesR.Value(i,j+1),
|
myTool->AddFace(NodesR.Value(i,j), NodesR.Value(i,j+1),
|
||||||
NodesR.Value(i+1,j+1), NodesR.Value(i+1,j));
|
NodesR.Value(i+1,j+1), NodesR.Value(i+1,j));
|
||||||
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
||||||
}
|
}
|
||||||
@ -1335,13 +1385,13 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref
|
|||||||
for(j=1; j<nbv; j++) {
|
for(j=1; j<nbv; j++) {
|
||||||
if(WisF) {
|
if(WisF) {
|
||||||
SMDS_MeshFace* F =
|
SMDS_MeshFace* F =
|
||||||
meshDS->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
|
myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
|
||||||
NodesC.Value(i+1,j+1), NodesC.Value(i,j+1));
|
NodesC.Value(i+1,j+1), NodesC.Value(i,j+1));
|
||||||
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SMDS_MeshFace* F =
|
SMDS_MeshFace* F =
|
||||||
meshDS->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1),
|
myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1),
|
||||||
NodesC.Value(i+1,j+1), NodesC.Value(i+1,j));
|
NodesC.Value(i+1,j+1), NodesC.Value(i+1,j));
|
||||||
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
meshDS->SetMeshElementOnShape(F, geomFaceID);
|
||||||
}
|
}
|
||||||
@ -1387,9 +1437,26 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints2 (SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
// --- edge internal IDNodes (relies on good order storage, not checked)
|
// --- edge internal IDNodes (relies on good order storage, not checked)
|
||||||
|
|
||||||
|
// if(myCreateQuadratic) {
|
||||||
|
// fill myNLinkNodeMap
|
||||||
|
// SMDS_ElemIteratorPtr iter = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetElements();
|
||||||
|
// while(iter->more()) {
|
||||||
|
// const SMDS_MeshElement* elem = iter->next();
|
||||||
|
// SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
|
||||||
|
// const SMDS_MeshNode* n1 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
// const SMDS_MeshNode* n2 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
// const SMDS_MeshNode* n3 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
// NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 ));
|
||||||
|
// myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n3));
|
||||||
|
// myNLinkNodeMap[link] = n3;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
map<double, const SMDS_MeshNode *> params;
|
map<double, const SMDS_MeshNode *> params;
|
||||||
SMDS_NodeIteratorPtr ite = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
|
SMDS_NodeIteratorPtr ite = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
|
||||||
|
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||||
|
|
||||||
|
if(!myCreateQuadratic) {
|
||||||
while(ite->more()) {
|
while(ite->more()) {
|
||||||
const SMDS_MeshNode* node = ite->next();
|
const SMDS_MeshNode* node = ite->next();
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
@ -1397,8 +1464,37 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints2 (SMESH_Mesh & aMesh,
|
|||||||
double param = epos->GetUParameter();
|
double param = epos->GetUParameter();
|
||||||
params[param] = node;
|
params[param] = node;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vector<const SMDS_MeshNode*> nodes(nbPoints+2);
|
||||||
|
nodes[0] = idFirst;
|
||||||
|
nodes[nbPoints+1] = idLast;
|
||||||
|
nbPoints = nbPoints/2;
|
||||||
|
int nn = 1;
|
||||||
|
while(ite->more()) {
|
||||||
|
const SMDS_MeshNode* node = ite->next();
|
||||||
|
nodes[nn++] = node;
|
||||||
|
// check if node is medium
|
||||||
|
bool IsMedium = false;
|
||||||
|
SMDS_ElemIteratorPtr itn = node->GetInverseElementIterator();
|
||||||
|
while (itn->more()) {
|
||||||
|
const SMDS_MeshElement* elem = itn->next();
|
||||||
|
if ( elem->GetType() != SMDSAbs_Edge )
|
||||||
|
continue;
|
||||||
|
if(elem->IsMediumNode(node)) {
|
||||||
|
IsMedium = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(IsMedium)
|
||||||
|
continue;
|
||||||
|
const SMDS_EdgePosition* epos =
|
||||||
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||||
|
double param = epos->GetUParameter();
|
||||||
|
params[param] = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
|
||||||
if (nbPoints != params.size()) {
|
if (nbPoints != params.size()) {
|
||||||
MESSAGE( "BAD NODE ON EDGE POSITIONS" );
|
MESSAGE( "BAD NODE ON EDGE POSITIONS" );
|
||||||
return 0;
|
return 0;
|
||||||
@ -1523,21 +1619,60 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints (SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
// --- edge internal IDNodes (relies on good order storage, not checked)
|
// --- edge internal IDNodes (relies on good order storage, not checked)
|
||||||
|
|
||||||
|
// if(myCreateQuadratic) {
|
||||||
|
// fill myNLinkNodeMap
|
||||||
|
// SMDS_ElemIteratorPtr iter = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetElements();
|
||||||
|
// while(iter->more()) {
|
||||||
|
// const SMDS_MeshElement* elem = iter->next();
|
||||||
|
// SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
|
||||||
|
// const SMDS_MeshNode* n1 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
// const SMDS_MeshNode* n2 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
// const SMDS_MeshNode* n3 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
|
// NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 ));
|
||||||
|
// myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n3));
|
||||||
|
// myNLinkNodeMap[link] = n3;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
map<double, const SMDS_MeshNode *> params;
|
map<double, const SMDS_MeshNode *> params;
|
||||||
SMDS_NodeIteratorPtr ite = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
|
SMDS_NodeIteratorPtr ite = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
|
||||||
|
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||||
|
|
||||||
while(ite->more())
|
if(!myCreateQuadratic) {
|
||||||
{
|
while(ite->more()) {
|
||||||
const SMDS_MeshNode* node = ite->next();
|
const SMDS_MeshNode* node = ite->next();
|
||||||
const SMDS_EdgePosition* epos =
|
const SMDS_EdgePosition* epos =
|
||||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||||
double param = epos->GetUParameter();
|
double param = epos->GetUParameter();
|
||||||
params[param] = node;
|
params[param] = node;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nbPoints = nbPoints/2;
|
||||||
|
while(ite->more()) {
|
||||||
|
const SMDS_MeshNode* node = ite->next();
|
||||||
|
// check if node is medium
|
||||||
|
bool IsMedium = false;
|
||||||
|
SMDS_ElemIteratorPtr itn = node->GetInverseElementIterator();
|
||||||
|
while (itn->more()) {
|
||||||
|
const SMDS_MeshElement* elem = itn->next();
|
||||||
|
if ( elem->GetType() != SMDSAbs_Edge )
|
||||||
|
continue;
|
||||||
|
if(elem->IsMediumNode(node)) {
|
||||||
|
IsMedium = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(IsMedium)
|
||||||
|
continue;
|
||||||
|
const SMDS_EdgePosition* epos =
|
||||||
|
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||||
|
double param = epos->GetUParameter();
|
||||||
|
params[param] = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
if (nbPoints != params.size()) {
|
||||||
if (nbPoints != params.size())
|
|
||||||
{
|
|
||||||
MESSAGE( "BAD NODE ON EDGE POSITIONS" );
|
MESSAGE( "BAD NODE ON EDGE POSITIONS" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,11 @@
|
|||||||
#include "SMESH_Mesh.hxx"
|
#include "SMESH_Mesh.hxx"
|
||||||
#include "Utils_SALOME_Exception.hxx"
|
#include "Utils_SALOME_Exception.hxx"
|
||||||
|
|
||||||
class SMDS_MeshNode;
|
#include "gp_XY.hxx"
|
||||||
|
|
||||||
|
#include "StdMeshers_Helper.hxx"
|
||||||
|
|
||||||
|
//class SMDS_MeshNode;
|
||||||
|
|
||||||
typedef struct uvPtStruct
|
typedef struct uvPtStruct
|
||||||
{
|
{
|
||||||
@ -78,8 +82,18 @@ public:
|
|||||||
const TopoDS_Shape& aShape)
|
const TopoDS_Shape& aShape)
|
||||||
throw (SALOME_Exception);
|
throw (SALOME_Exception);
|
||||||
|
|
||||||
|
FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
|
||||||
|
const TopoDS_Shape& aShape,
|
||||||
|
const bool CreateQuadratic)
|
||||||
|
throw (SALOME_Exception);
|
||||||
|
|
||||||
static void QuadDelete(FaceQuadStruct* quad);
|
static void QuadDelete(FaceQuadStruct* quad);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns NLinkNodeMap from myTool
|
||||||
|
*/
|
||||||
|
const NLinkNodeMap& GetNLinkNodeMap() { return myTool->GetNLinkNodeMap(); }
|
||||||
|
|
||||||
ostream & SaveTo(ostream & save);
|
ostream & SaveTo(ostream & save);
|
||||||
istream & LoadFrom(istream & load);
|
istream & LoadFrom(istream & load);
|
||||||
friend ostream & operator << (ostream & save, StdMeshers_Quadrangle_2D & hyp);
|
friend ostream & operator << (ostream & save, StdMeshers_Quadrangle_2D & hyp);
|
||||||
@ -120,6 +134,8 @@ protected:
|
|||||||
// construction of quadrangles if the number of nodes on opposite edges
|
// construction of quadrangles if the number of nodes on opposite edges
|
||||||
// is not the same in the case where the global number of nodes on edges is even
|
// is not the same in the case where the global number of nodes on edges is even
|
||||||
bool myQuadranglePreference;
|
bool myQuadranglePreference;
|
||||||
|
|
||||||
|
StdMeshers_Helper* myTool; // toll for working with quadratic elements
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,7 +42,10 @@ StdMeshers_QuadraticMesh::StdMeshers_QuadraticMesh(int hypId,
|
|||||||
:SMESH_Hypothesis(hypId, studyId, gen)
|
:SMESH_Hypothesis(hypId, studyId, gen)
|
||||||
{
|
{
|
||||||
_name = "QuadraticMesh";
|
_name = "QuadraticMesh";
|
||||||
_param_algo_dim = 1; // is used by StdMeshers_Regular_1D
|
// only one hypo of the same dim can be assigned to the shape so
|
||||||
|
// we use -3 in order to distingush from any usual 1D hypothsis and
|
||||||
|
// from "NotConformAllowed" (-1) and "Propagation" (-2)
|
||||||
|
_param_algo_dim = -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -510,7 +510,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
|||||||
|
|
||||||
// quardatic mesh required?
|
// quardatic mesh required?
|
||||||
SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( "QuadraticMesh" ));
|
SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( "QuadraticMesh" ));
|
||||||
bool isQuadraticMesh = aMesh->GetHypothesis( aShape, filter, true );
|
bool QuadMode = aMesh.GetHypothesis( aShape, filter, true );
|
||||||
|
|
||||||
const TopoDS_Edge & EE = TopoDS::Edge(aShape);
|
const TopoDS_Edge & EE = TopoDS::Edge(aShape);
|
||||||
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
|
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
|
||||||
@ -533,15 +533,13 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
|||||||
|
|
||||||
ASSERT(!VLast.IsNull());
|
ASSERT(!VLast.IsNull());
|
||||||
lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
|
lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
|
||||||
if (!lid->more())
|
if (!lid->more()) {
|
||||||
{
|
|
||||||
MESSAGE (" NO NODE BUILT ON VERTEX ");
|
MESSAGE (" NO NODE BUILT ON VERTEX ");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const SMDS_MeshNode * idLast = lid->next();
|
const SMDS_MeshNode * idLast = lid->next();
|
||||||
|
|
||||||
if (!Curve.IsNull())
|
if (!Curve.IsNull()) {
|
||||||
{
|
|
||||||
list< double > params;
|
list< double > params;
|
||||||
bool reversed = false;
|
bool reversed = false;
|
||||||
if ( !_mainEdge.IsNull() )
|
if ( !_mainEdge.IsNull() )
|
||||||
@ -558,9 +556,14 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
|||||||
// only internal nodes receive an edge position with param on curve
|
// only internal nodes receive an edge position with param on curve
|
||||||
|
|
||||||
const SMDS_MeshNode * idPrev = idFirst;
|
const SMDS_MeshNode * idPrev = idFirst;
|
||||||
|
double parPrev = f;
|
||||||
|
double parLast = l;
|
||||||
|
if(reversed) {
|
||||||
|
parPrev = l;
|
||||||
|
parLast = f;
|
||||||
|
}
|
||||||
|
|
||||||
for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++)
|
for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++) {
|
||||||
{
|
|
||||||
double param = *itU;
|
double param = *itU;
|
||||||
gp_Pnt P = Curve->Value(param);
|
gp_Pnt P = Curve->Value(param);
|
||||||
|
|
||||||
@ -568,15 +571,37 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
|||||||
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
||||||
meshDS->SetNodeOnEdge(node, shapeID, param);
|
meshDS->SetNodeOnEdge(node, shapeID, param);
|
||||||
|
|
||||||
|
if(QuadMode) {
|
||||||
|
// create medium node
|
||||||
|
double prm = ( parPrev + param )/2;
|
||||||
|
gp_Pnt PM = Curve->Value(prm);
|
||||||
|
SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
|
||||||
|
meshDS->SetNodeOnEdge(NM, shapeID, prm);
|
||||||
|
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node, NM);
|
||||||
|
meshDS->SetMeshElementOnShape(edge, shapeID);
|
||||||
|
}
|
||||||
|
else {
|
||||||
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
|
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
|
||||||
meshDS->SetMeshElementOnShape(edge, shapeID);
|
meshDS->SetMeshElementOnShape(edge, shapeID);
|
||||||
idPrev = node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idPrev = node;
|
||||||
|
parPrev = param;
|
||||||
|
}
|
||||||
|
if(QuadMode) {
|
||||||
|
double prm = ( parPrev + parLast )/2;
|
||||||
|
gp_Pnt PM = Curve->Value(prm);
|
||||||
|
SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
|
||||||
|
meshDS->SetNodeOnEdge(NM, shapeID, prm);
|
||||||
|
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast, NM);
|
||||||
|
meshDS->SetMeshElementOnShape(edge, shapeID);
|
||||||
|
}
|
||||||
|
else {
|
||||||
SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
|
SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
|
||||||
meshDS->SetMeshElementOnShape(edge, shapeID);
|
meshDS->SetMeshElementOnShape(edge, shapeID);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else {
|
||||||
// Edge is a degenerated Edge : We put n = 5 points on the edge.
|
// Edge is a degenerated Edge : We put n = 5 points on the edge.
|
||||||
int NbPoints = 5;
|
int NbPoints = 5;
|
||||||
BRep_Tool::Range(E, f, l);
|
BRep_Tool::Range(E, f, l);
|
||||||
@ -588,19 +613,39 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
|||||||
gp_Pnt P = BRep_Tool::Pnt(V1);
|
gp_Pnt P = BRep_Tool::Pnt(V1);
|
||||||
|
|
||||||
const SMDS_MeshNode * idPrev = idFirst;
|
const SMDS_MeshNode * idPrev = idFirst;
|
||||||
for (int i = 2; i < NbPoints; i++)
|
for (int i = 2; i < NbPoints; i++) {
|
||||||
{
|
|
||||||
double param = f + (i - 1) * du;
|
double param = f + (i - 1) * du;
|
||||||
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
||||||
meshDS->SetNodeOnEdge(node, shapeID, param);
|
if(QuadMode) {
|
||||||
|
// create medium node
|
||||||
|
double prm = param - du/2.;
|
||||||
|
gp_Pnt PM = Curve->Value(prm);
|
||||||
|
SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
|
||||||
|
meshDS->SetNodeOnEdge(NM, shapeID, prm);
|
||||||
|
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node, NM);
|
||||||
|
meshDS->SetMeshElementOnShape(edge, shapeID);
|
||||||
|
}
|
||||||
|
else {
|
||||||
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
|
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
|
||||||
meshDS->SetMeshElementOnShape(edge, shapeID);
|
meshDS->SetMeshElementOnShape(edge, shapeID);
|
||||||
|
}
|
||||||
|
meshDS->SetNodeOnEdge(node, shapeID, param);
|
||||||
idPrev = node;
|
idPrev = node;
|
||||||
}
|
}
|
||||||
|
if(QuadMode) {
|
||||||
|
// create medium node
|
||||||
|
double prm = l - du/2.;
|
||||||
|
gp_Pnt PM = Curve->Value(prm);
|
||||||
|
SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
|
||||||
|
meshDS->SetNodeOnEdge(NM, shapeID, prm);
|
||||||
|
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast, NM);
|
||||||
|
meshDS->SetMeshElementOnShape(edge, shapeID);
|
||||||
|
}
|
||||||
|
else {
|
||||||
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
|
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
|
||||||
meshDS->SetMeshElementOnShape(edge, shapeID);
|
meshDS->SetMeshElementOnShape(edge, shapeID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user