fix MakeMeshOnFxy1(): set medium nodes to the Fxy1 face instead of volume

This commit is contained in:
eap 2009-08-27 10:43:10 +00:00
parent 20a656158d
commit e069a4fc65

View File

@ -69,7 +69,7 @@ enum { NB_WALL_FACES = 4 };
//purpose : //purpose :
//======================================================================= //=======================================================================
StdMeshers_Penta_3D::StdMeshers_Penta_3D() StdMeshers_Penta_3D::StdMeshers_Penta_3D()
: myErrorStatus(SMESH_ComputeError::New()) : myErrorStatus(SMESH_ComputeError::New())
{ {
myTol3D=0.1; myTol3D=0.1;
myWallNodesMaps.resize( SMESH_Block::NbFaces() ); myWallNodesMaps.resize( SMESH_Block::NbFaces() );
@ -262,11 +262,11 @@ void StdMeshers_Penta_3D::MakeNodes()
SMESH_Block::TShapeID wallFaceID[ NB_WALL_FACES ] = { SMESH_Block::TShapeID wallFaceID[ NB_WALL_FACES ] = {
SMESH_Block::ID_Fx0z, SMESH_Block::ID_Fx1z, SMESH_Block::ID_Fx0z, SMESH_Block::ID_Fx1z,
SMESH_Block::ID_F0yz, SMESH_Block::ID_F1yz SMESH_Block::ID_F0yz, SMESH_Block::ID_F1yz
}; };
SMESH_Block::TShapeID baseEdgeID[ NB_WALL_FACES ] = { SMESH_Block::TShapeID baseEdgeID[ NB_WALL_FACES ] = {
SMESH_Block::ID_Ex00, SMESH_Block::ID_Ex10, SMESH_Block::ID_Ex00, SMESH_Block::ID_Ex10,
SMESH_Block::ID_E0y0, SMESH_Block::ID_E1y0 SMESH_Block::ID_E0y0, SMESH_Block::ID_E1y0
}; };
for ( i = 0; i < NB_WALL_FACES ; ++i ) { for ( i = 0; i < NB_WALL_FACES ; ++i ) {
int fIndex = SMESH_Block::ShapeIndex( wallFaceID[ i ]); int fIndex = SMESH_Block::ShapeIndex( wallFaceID[ i ]);
bool ok = LoadIJNodes (myWallNodesMaps[ fIndex ], bool ok = LoadIJNodes (myWallNodesMaps[ fIndex ],
@ -437,7 +437,7 @@ void StdMeshers_Penta_3D::MakeNodes()
FindNodeOnShape(aS, aCoords, i, aTN); FindNodeOnShape(aS, aCoords, i, aTN);
} }
else{ else{
// create node and get it id // create node and get its id
CreateNode (bIsUpperLayer, aCoords, aTN); CreateNode (bIsUpperLayer, aCoords, aTN);
// //
if ( bIsUpperLayer ) { if ( bIsUpperLayer ) {
@ -477,33 +477,6 @@ void StdMeshers_Penta_3D::MakeNodes()
myTNodes[ij]=aTN; myTNodes[ij]=aTN;
} }
} }
//DEB
/*
{
int iSSID, iBNID, aID;
//
for (i=0; i<myISize; ++i) {
printf(" Layer# %d\n", i);
for (j=0; j<myJSize; ++j) {
ij=i*myJSize+j;
const StdMeshers_TNode& aTN=myTNodes[ij];
//const StdMeshers_TNode& aTN=aTNodes[ij];
const gp_XYZ& aXYZ=aTN.NormCoord();
iSSID=aTN.ShapeSupportID();
iBNID=aTN.BaseNodeID();
//
const SMDS_MeshNode* aNode=aTN.Node();
aID=aNode->GetID();
aX=aNode->X();
aY=aNode->Y();
aZ=aNode->Z();
printf("*** j:%d BNID#%d iSSID:%d ID:%d { %lf %lf %lf }, { %lf %lf %lf }\n",
j, iBNID, iSSID, aID, aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aX, aY, aZ);
}
}
}
*/
//DEB t
} }
@ -634,16 +607,16 @@ double StdMeshers_Penta_3D::SetHorizEdgeXYZ(const gp_XYZ& aBase
} }
else { else {
// this variant is better for other cases // this variant is better for other cases
// SMESH_MesherHelper helper( *GetMesh() ); // SMESH_MesherHelper helper( *GetMesh() );
// const TopoDS_Edge & edge = TopoDS::Edge( myBlock.Shape( edgeVec[ TOP ])); // const TopoDS_Edge & edge = TopoDS::Edge( myBlock.Shape( edgeVec[ TOP ]));
// double u1 = helper.GetNodeU( edge, n1 ); // double u1 = helper.GetNodeU( edge, n1 );
// double u2 = helper.GetNodeU( edge, n2 ); // double u2 = helper.GetNodeU( edge, n2 );
// double u = ( 1. - r ) * u1 + r * u2; // double u = ( 1. - r ) * u1 + r * u2;
// gp_XYZ topNodeParams; // gp_XYZ topNodeParams;
// myBlock.Block().EdgeParameters( edgeVec[ TOP ], u, topNodeParams ); // myBlock.Block().EdgeParameters( edgeVec[ TOP ], u, topNodeParams );
// myBlock.Block().EdgePoint( edgeVec[ TOP ], // myBlock.Block().EdgePoint( edgeVec[ TOP ],
// topNodeParams, // topNodeParams,
// myShapeXYZ[ edgeVec[ TOP ]]); // myShapeXYZ[ edgeVec[ TOP ]]);
} }
// base edge // base edge
@ -822,7 +795,7 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1()
itn = aSM0->GetNodes(); itn = aSM0->GetNodes();
aNbNodes = aSM0->NbNodes(); aNbNodes = aSM0->NbNodes();
//printf("** aNbNodes=%d\n", aNbNodes); //printf("** aNbNodes=%d\n", aNbNodes);
myTool->SetSubShape( aFxy1 ); // to set medium nodes to aFxy1
// //
// set elements on aFxy1 // set elements on aFxy1
vector<const SMDS_MeshNode*> aNodes1; vector<const SMDS_MeshNode*> aNodes1;
@ -873,6 +846,7 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1()
} }
meshDS->SetMeshElementOnShape(face, aFxy1); meshDS->SetMeshElementOnShape(face, aFxy1);
} }
myTool->SetSubShape( myShape );
// update compute state of top face submesh // update compute state of top face submesh
aSubMesh1->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); aSubMesh1->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
@ -949,15 +923,15 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer,
SMDS_MeshNode* pNode=NULL; SMDS_MeshNode* pNode=NULL;
aTN.SetNode(pNode); aTN.SetNode(pNode);
// //
// if (bIsUpperLayer) { // if (bIsUpperLayer) {
// // point on face Fxy1 // // point on face Fxy1
// const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_Fxy1); // const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_Fxy1);
// myBlock.Point(aParams, aS, aP); // myBlock.Point(aParams, aS, aP);
// } // }
// else { // else {
// // 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 );
@ -975,11 +949,11 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer,
SMESH_Block::ShellPoint( aParams, myShapeXYZ, aP.ChangeCoord() ); SMESH_Block::ShellPoint( aParams, myShapeXYZ, aP.ChangeCoord() );
} }
// //
// iErr=myBlock.ErrorStatus(); // iErr=myBlock.ErrorStatus();
// if (iErr) { // if (iErr) {
// myErrorStatus=12; // can not find the node point; // myErrorStatus=12; // can not find the node point;
// return; // return;
// } // }
// //
aX=aP.X(); aY=aP.Y(); aZ=aP.Z(); aX=aP.X(); aY=aP.Y(); aZ=aP.Z();
// //
@ -1000,38 +974,38 @@ void StdMeshers_Penta_3D::ShapeSupportID(const bool bIsUpperLayer,
SMESH_Block::TShapeID& aSSID) SMESH_Block::TShapeID& aSSID)
{ {
switch (aBNSSID) { switch (aBNSSID) {
case SMESH_Block::ID_V000: case SMESH_Block::ID_V000:
aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V001 : SMESH_Block::ID_E00z; aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V001 : SMESH_Block::ID_E00z;
break; break;
case SMESH_Block::ID_V100: case SMESH_Block::ID_V100:
aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V101 : SMESH_Block::ID_E10z; aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V101 : SMESH_Block::ID_E10z;
break; break;
case SMESH_Block::ID_V110: case SMESH_Block::ID_V110:
aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V111 : SMESH_Block::ID_E11z; aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V111 : SMESH_Block::ID_E11z;
break; break;
case SMESH_Block::ID_V010: case SMESH_Block::ID_V010:
aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V011 : SMESH_Block::ID_E01z; aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V011 : SMESH_Block::ID_E01z;
break; break;
case SMESH_Block::ID_Ex00: case SMESH_Block::ID_Ex00:
aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex01 : SMESH_Block::ID_Fx0z; aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex01 : SMESH_Block::ID_Fx0z;
break; break;
case SMESH_Block::ID_Ex10: case SMESH_Block::ID_Ex10:
aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex11 : SMESH_Block::ID_Fx1z; aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex11 : SMESH_Block::ID_Fx1z;
break; break;
case SMESH_Block::ID_E0y0: case SMESH_Block::ID_E0y0:
aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E0y1 : SMESH_Block::ID_F0yz; aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E0y1 : SMESH_Block::ID_F0yz;
break; break;
case SMESH_Block::ID_E1y0: case SMESH_Block::ID_E1y0:
aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E1y1 : SMESH_Block::ID_F1yz; aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E1y1 : SMESH_Block::ID_F1yz;
break; break;
case SMESH_Block::ID_Fxy0: case SMESH_Block::ID_Fxy0:
aSSID=SMESH_Block::ID_NONE;//(bIsUpperLayer) ? Shape_ID_Fxy1 : Shape_ID_NONE; aSSID=SMESH_Block::ID_NONE;//(bIsUpperLayer) ? Shape_ID_Fxy1 : Shape_ID_NONE;
break; break;
default: default:
aSSID=SMESH_Block::ID_NONE; aSSID=SMESH_Block::ID_NONE;
myErrorStatus->myName=10; // Can not find supporting shape ID myErrorStatus->myName=10; // Can not find supporting shape ID
myErrorStatus->myComment = "Internal error of StdMeshers_Penta_3D"; myErrorStatus->myComment = "Internal error of StdMeshers_Penta_3D";
break; break;
} }
return; return;
} }
@ -1434,7 +1408,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
SMESHDS_SubMesh* smVft = theMesh->MeshElements( vft ); SMESHDS_SubMesh* smVft = theMesh->MeshElements( vft );
if (!smFace || !smb || !smt || !sm1 || !sm2 || !smVfb || !smVlb || !smVft ) { if (!smFace || !smb || !smt || !sm1 || !sm2 || !smVfb || !smVlb || !smVft ) {
MESSAGE( "NULL submesh " <<smFace<<" "<<smb<<" "<<smt<<" "<< MESSAGE( "NULL submesh " <<smFace<<" "<<smb<<" "<<smt<<" "<<
sm1<<" "<<sm2<<" "<<smVfb<<" "<<smVlb<<" "<<smVft); sm1<<" "<<sm2<<" "<<smVfb<<" "<<smVlb<<" "<<smVft);
return false; return false;
} }
if ( smb->NbNodes() != smt->NbNodes() || sm1->NbNodes() != sm2->NbNodes() ) { if ( smb->NbNodes() != smt->NbNodes() || sm1->NbNodes() != sm2->NbNodes() ) {
@ -1455,13 +1429,13 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
int nf = sm1->NbNodes()*smb->NbNodes() - n3*n4; int nf = sm1->NbNodes()*smb->NbNodes() - n3*n4;
if( nf != smFace->NbNodes() ) { 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 { else {
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;
} }
} }
@ -1596,7 +1570,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
} }
} }
else if ( (nbFaceNodes==3 || (myCreateQuadratic && nbFaceNodes==6) ) && else if ( (nbFaceNodes==3 || (myCreateQuadratic && nbFaceNodes==6) ) &&
n3 == par_nVec_1->second[ row ] ) { n3 == par_nVec_1->second[ row ] ) {
n1 = n3; n1 = n3;
} }
else { else {
@ -1773,7 +1747,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
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;
@ -1784,8 +1758,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
//function : Point //function : Point
//purpose : //purpose :
//======================================================================= //=======================================================================
void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, gp_Pnt& aP3D)
gp_Pnt& aP3D)
{ {
TopoDS_Shape aS; TopoDS_Shape aS;
// //
@ -1796,9 +1769,9 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
//function : Point //function : Point
//purpose : //purpose :
//======================================================================= //=======================================================================
void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams,
const TopoDS_Shape& theShape, const TopoDS_Shape& theShape,
gp_Pnt& aP3D) gp_Pnt& aP3D)
{ {
myErrorStatus = 0; myErrorStatus = 0;
// //