-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
SMESH_Block::TShapeID wallFaceID[ NB_WALL_FACES ] = {
SMESH_Block::ID_Fx0z, SMESH_Block::ID_Fx1z,
SMESH_Block::ID_F0yz, SMESH_Block::ID_F1yz
SMESH_Block::TShapeID wallFaceID[ NB_WALL_FACES ] = {
SMESH_Block::ID_Fx0z, SMESH_Block::ID_Fx1z,
SMESH_Block::ID_F0yz, SMESH_Block::ID_F1yz
SMESH_Block::TShapeID baseEdgeID[ NB_WALL_FACES ] = {
SMESH_Block::ID_Ex00, SMESH_Block::ID_Ex10,
SMESH_Block::ID_E0y0, SMESH_Block::ID_E1y0
SMESH_Block::TShapeID baseEdgeID[ NB_WALL_FACES ] = {
SMESH_Block::ID_Ex00, SMESH_Block::ID_Ex10,
SMESH_Block::ID_E0y0, SMESH_Block::ID_E1y0
for ( i = 0; i < NB_WALL_FACES ; ++i ) {
int fIndex = SMESH_Block::ShapeIndex( wallFaceID[ i ]);
bool ok = LoadIJNodes (myWallNodesMaps[ fIndex ],
for ( i = 0; i < NB_WALL_FACES ; ++i ) {
int fIndex = SMESH_Block::ShapeIndex( wallFaceID[ i ]);
bool ok = LoadIJNodes (myWallNodesMaps[ fIndex ],
ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID);
if (!myErrorStatus->IsOK()) {
MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID);
if (!myErrorStatus->IsOK()) {
MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
- // try to find the node
- const TopoDS_Shape& aS=myBlock.Shape((int)aSSID);
- FindNodeOnShape(aS, aCoords, i, aTN);
+ // try to find the node
+ const TopoDS_Shape& aS=myBlock.Shape((int)aSSID);
+ FindNodeOnShape(aS, aCoords, i, 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
-// SMESH_MesherHelper helper( *GetMesh() );
-// const TopoDS_Edge & edge = TopoDS::Edge( myBlock.Shape( edgeVec[ TOP ]));
-// double u1 = helper.GetNodeU( edge, n1 );
-// double u2 = helper.GetNodeU( edge, n2 );
-// double u = ( 1. - r ) * u1 + r * u2;
-// gp_XYZ topNodeParams;
-// myBlock.Block().EdgeParameters( edgeVec[ TOP ], u, topNodeParams );
-// myBlock.Block().EdgePoint( edgeVec[ TOP ],
-// topNodeParams,
-// myShapeXYZ[ edgeVec[ TOP ]]);
+ // SMESH_MesherHelper helper( *GetMesh() );
+ // const TopoDS_Edge & edge = TopoDS::Edge( myBlock.Shape( edgeVec[ TOP ]));
+ // double u1 = helper.GetNodeU( edge, n1 );
+ // double u2 = helper.GetNodeU( edge, n2 );
+ // double u = ( 1. - r ) * u1 + r * u2;
+ // gp_XYZ topNodeParams;
+ // myBlock.Block().EdgeParameters( edgeVec[ TOP ], u, topNodeParams );
+ // myBlock.Block().EdgePoint( edgeVec[ TOP ],
+ // topNodeParams,
+ // myShapeXYZ[ edgeVec[ TOP ]]);
- k=0;
- aItNodes=pE0->nodesIterator();
- while (aItNodes->more()) {
- //const SMDS_MeshElement* pNode = aItNodes->next();
- const SMDS_MeshNode* pNode =
- static_cast<const SMDS_MeshNode*> (aItNodes->next());
- if(myTool->IsMedium(pNode))
- continue;
+ for ( k=0; k<nbFaceNodes; ++k ) {
+ const SMDS_MeshNode* pNode = pE0->GetNode(k);
+// if(myTool->IsMedium(pNode))
+// continue;
- ij = i1*myJSize+aJ[j];
- const StdMeshers_TNode& aTN1 = myTNodes[ij];
- const SMDS_MeshNode* aN1 = aTN1.Node();
- aN[j]=aN1;
- //
- ij=i2*myJSize+aJ[j];
- const StdMeshers_TNode& aTN2 = myTNodes[ij];
- const SMDS_MeshNode* aN2 = aTN2.Node();
- aN[j+nbFaceNodes] = aN2;
+ ij = i1*myJSize+aJ[j];
+ const StdMeshers_TNode& aTN1 = myTNodes[ij];
+ const SMDS_MeshNode* aN1 = aTN1.Node();
+ aN[j]=aN1;
+ //
+ ij=i2*myJSize+aJ[j];
+ const StdMeshers_TNode& aTN2 = myTNodes[ij];
+ const SMDS_MeshNode* aN2 = aTN2.Node();
+ aN[j+nbFaceNodes] = aN2;
-// if (bIsUpperLayer) {
-// // point on face Fxy1
-// const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_Fxy1);
-// myBlock.Point(aParams, aS, aP);
-// }
-// else {
-// // point inside solid
-// myBlock.Point(aParams, aP);
-// }
+ // if (bIsUpperLayer) {
+ // // point on face Fxy1
+ // const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_Fxy1);
+ // myBlock.Point(aParams, aS, aP);
+ // }
+ // else {
+ // // point inside solid
+ // myBlock.Point(aParams, aP);
+ // }
- case SMESH_Block::ID_V000:
- aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V001 : SMESH_Block::ID_E00z;
- break;
- case SMESH_Block::ID_V100:
- aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V101 : SMESH_Block::ID_E10z;
- break;
- case SMESH_Block::ID_V110:
- aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V111 : SMESH_Block::ID_E11z;
- break;
- case SMESH_Block::ID_V010:
- aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V011 : SMESH_Block::ID_E01z;
- break;
- case SMESH_Block::ID_Ex00:
- aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex01 : SMESH_Block::ID_Fx0z;
- break;
- case SMESH_Block::ID_Ex10:
- aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex11 : SMESH_Block::ID_Fx1z;
- break;
- case SMESH_Block::ID_E0y0:
- aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E0y1 : SMESH_Block::ID_F0yz;
- break;
- case SMESH_Block::ID_E1y0:
- aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E1y1 : SMESH_Block::ID_F1yz;
- break;
- case SMESH_Block::ID_Fxy0:
- aSSID=SMESH_Block::ID_NONE;//(bIsUpperLayer) ? Shape_ID_Fxy1 : Shape_ID_NONE;
- break;
- default:
- aSSID=SMESH_Block::ID_NONE;
- myErrorStatus->myName=10; // Can not find supporting shape ID
- myErrorStatus->myComment = "Internal error of StdMeshers_Penta_3D";
- break;
+ case SMESH_Block::ID_V000:
+ aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V001 : SMESH_Block::ID_E00z;
+ break;
+ case SMESH_Block::ID_V100:
+ aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V101 : SMESH_Block::ID_E10z;
+ break;
+ case SMESH_Block::ID_V110:
+ aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V111 : SMESH_Block::ID_E11z;
+ break;
+ case SMESH_Block::ID_V010:
+ aSSID=(bIsUpperLayer) ? SMESH_Block::ID_V011 : SMESH_Block::ID_E01z;
+ break;
+ case SMESH_Block::ID_Ex00:
+ aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex01 : SMESH_Block::ID_Fx0z;
+ break;
+ case SMESH_Block::ID_Ex10:
+ aSSID=(bIsUpperLayer) ? SMESH_Block::ID_Ex11 : SMESH_Block::ID_Fx1z;
+ break;
+ case SMESH_Block::ID_E0y0:
+ aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E0y1 : SMESH_Block::ID_F0yz;
+ break;
+ case SMESH_Block::ID_E1y0:
+ aSSID=(bIsUpperLayer) ? SMESH_Block::ID_E1y1 : SMESH_Block::ID_F1yz;
+ break;
+ case SMESH_Block::ID_Fxy0:
+ aSSID=SMESH_Block::ID_NONE;//(bIsUpperLayer) ? Shape_ID_Fxy1 : Shape_ID_NONE;
+ break;
+ default:
+ aSSID=SMESH_Block::ID_NONE;
+ myErrorStatus->myName=10; // Can not find supporting shape ID
+ myErrorStatus->myComment = "Internal error of StdMeshers_Penta_3D";
+ break;
- iNbNodes = pElement->NbNodes();
- if ( iNbNodes==3 || (pElement->IsQuadratic() && iNbNodes==6) ) {
- aFTr = aF;
- ++iCnt;
- if (iCnt>1) {
- // \begin{E.A.}
- // The current algorithm fails if there is more that one
- // face wich contains triangles ...
- // In that case, replace return by break to try another
- // method (coded in "if (iCnt != 1) { ... }")
- //
+ iNbNodes = pElement->NbNodes();
+ if ( iNbNodes==3 || (pElement->IsQuadratic() && iNbNodes==6) ) {
+ aFTr = aF;
+ ++iCnt;
+ if (iCnt>1) {
+ // \begin{E.A.}
+ // The current algorithm fails if there is more that one
+ // face wich contains triangles ...
+ // In that case, replace return by break to try another
+ // method (coded in "if (iCnt != 1) { ... }")
+ //
- int ok = 1;
- const TopoDS_Shape& aF = aM(i);
- SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF);
- SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
- SMDS_ElemIteratorPtr itf = aSM->GetElements();
- while(itf->more()) {
- const SMDS_MeshElement * pElement = itf->next();
- aElementType = pElement->GetType();
- if (aElementType==SMDSAbs_Face) {
- iNbNodes = pElement->NbNodes();
- if ( iNbNodes!=4 ) {
- ok = 0;
- break ;
- }
- }
- }
- if (i==1) has_only_quad_f1 = ok ;
- if (i==2) has_only_quad_f2 = ok ;
- if (i==3) has_only_quad_f3 = ok ;
- if (i==4) has_only_quad_f4 = ok ;
- if (i==5) has_only_quad_f5 = ok ;
- if (i==6) has_only_quad_f6 = ok ;
+ int ok = 1;
+ const TopoDS_Shape& aF = aM(i);
+ SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF);
+ SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
+ SMDS_ElemIteratorPtr itf = aSM->GetElements();
+ while(itf->more()) {
+ const SMDS_MeshElement * pElement = itf->next();
+ aElementType = pElement->GetType();
+ if (aElementType==SMDSAbs_Face) {
+ iNbNodes = pElement->NbNodes();
+ if ( iNbNodes!=4 ) {
+ ok = 0;
+ break ;
+ }
+ }
+ }
+ if (i==1) has_only_quad_f1 = ok ;
+ if (i==2) has_only_quad_f2 = ok ;
+ if (i==3) has_only_quad_f3 = ok ;
+ if (i==4) has_only_quad_f4 = ok ;
+ if (i==5) has_only_quad_f5 = ok ;
+ if (i==6) has_only_quad_f6 = ok ;
- //
- int nb_e01 = pMesh->GetSubMeshContaining(aE(1))->GetSubMeshDS()->NbElements();
- int nb_e02 = pMesh->GetSubMeshContaining(aE(2))->GetSubMeshDS()->NbElements();
- int nb_e03 = pMesh->GetSubMeshContaining(aE(3))->GetSubMeshDS()->NbElements();
- int nb_e04 = pMesh->GetSubMeshContaining(aE(4))->GetSubMeshDS()->NbElements();
- int nb_e05 = pMesh->GetSubMeshContaining(aE(5))->GetSubMeshDS()->NbElements();
- int nb_e06 = pMesh->GetSubMeshContaining(aE(6))->GetSubMeshDS()->NbElements();
- int nb_e07 = pMesh->GetSubMeshContaining(aE(7))->GetSubMeshDS()->NbElements();
- int nb_e08 = pMesh->GetSubMeshContaining(aE(8))->GetSubMeshDS()->NbElements();
- int nb_e09 = pMesh->GetSubMeshContaining(aE(9))->GetSubMeshDS()->NbElements();
- int nb_e10 = pMesh->GetSubMeshContaining(aE(10))->GetSubMeshDS()->NbElements();
- int nb_e11 = pMesh->GetSubMeshContaining(aE(11))->GetSubMeshDS()->NbElements();
- int nb_e12 = pMesh->GetSubMeshContaining(aE(12))->GetSubMeshDS()->NbElements();
- //
- int nb_ok = 0 ;
- //
- if ( (nb_e01==nb_e03) && (nb_e03==nb_e05) && (nb_e05==nb_e07) ) {
- if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f3 && has_only_quad_f4 ) {
- if ( (nb_e09==nb_e10) && (nb_e08==nb_e06) && (nb_e11==nb_e12) && (nb_e04==nb_e02) ) {
- if (nb_f5==nb_f6) {
- nb_ok += 1;
- aFTr = aM(5);
- }
- }
- }
- }
- if ( (nb_e02==nb_e04) && (nb_e04==nb_e06) && (nb_e06==nb_e08) ) {
- if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f5 && has_only_quad_f6 ) {
- if ( (nb_e01==nb_e03) && (nb_e10==nb_e12) && (nb_e05==nb_e07) && (nb_e09==nb_e11) ) {
- if (nb_f3==nb_f4) {
- nb_ok += 1;
- aFTr = aM(3);
- }
- }
- }
- }
- if ( (nb_e09==nb_e10) && (nb_e10==nb_e11) && (nb_e11==nb_e12) ) {
- if ( has_only_quad_f3 && has_only_quad_f4 && has_only_quad_f5 && has_only_quad_f6 ) {
- if ( (nb_e01==nb_e05) && (nb_e02==nb_e06) && (nb_e03==nb_e07) && (nb_e04==nb_e08) ) {
- if (nb_f1==nb_f2) {
- nb_ok += 1;
- aFTr = aM(1);
- }
- }
- }
- }
- //
- if ( nb_ok == 1 ) {
- isOK = 1;
- }
- //
+ //
+ int nb_e01 = pMesh->GetSubMeshContaining(aE(1))->GetSubMeshDS()->NbElements();
+ int nb_e02 = pMesh->GetSubMeshContaining(aE(2))->GetSubMeshDS()->NbElements();
+ int nb_e03 = pMesh->GetSubMeshContaining(aE(3))->GetSubMeshDS()->NbElements();
+ int nb_e04 = pMesh->GetSubMeshContaining(aE(4))->GetSubMeshDS()->NbElements();
+ int nb_e05 = pMesh->GetSubMeshContaining(aE(5))->GetSubMeshDS()->NbElements();
+ int nb_e06 = pMesh->GetSubMeshContaining(aE(6))->GetSubMeshDS()->NbElements();
+ int nb_e07 = pMesh->GetSubMeshContaining(aE(7))->GetSubMeshDS()->NbElements();
+ int nb_e08 = pMesh->GetSubMeshContaining(aE(8))->GetSubMeshDS()->NbElements();
+ int nb_e09 = pMesh->GetSubMeshContaining(aE(9))->GetSubMeshDS()->NbElements();
+ int nb_e10 = pMesh->GetSubMeshContaining(aE(10))->GetSubMeshDS()->NbElements();
+ int nb_e11 = pMesh->GetSubMeshContaining(aE(11))->GetSubMeshDS()->NbElements();
+ int nb_e12 = pMesh->GetSubMeshContaining(aE(12))->GetSubMeshDS()->NbElements();
+ //
+ int nb_ok = 0 ;
+ //
+ if ( (nb_e01==nb_e03) && (nb_e03==nb_e05) && (nb_e05==nb_e07) ) {
+ if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f3 && has_only_quad_f4 ) {
+ if ( (nb_e09==nb_e10) && (nb_e08==nb_e06) && (nb_e11==nb_e12) && (nb_e04==nb_e02) ) {
+ if (nb_f5==nb_f6) {
+ nb_ok += 1;
+ aFTr = aM(5);
+ }
+ }
+ }
+ }
+ if ( (nb_e02==nb_e04) && (nb_e04==nb_e06) && (nb_e06==nb_e08) ) {
+ if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f5 && has_only_quad_f6 ) {
+ if ( (nb_e01==nb_e03) && (nb_e10==nb_e12) && (nb_e05==nb_e07) && (nb_e09==nb_e11) ) {
+ if (nb_f3==nb_f4) {
+ nb_ok += 1;
+ aFTr = aM(3);
+ }
+ }
+ }
+ }
+ if ( (nb_e09==nb_e10) && (nb_e10==nb_e11) && (nb_e11==nb_e12) ) {
+ if ( has_only_quad_f3 && has_only_quad_f4 && has_only_quad_f5 && has_only_quad_f6 ) {
+ if ( (nb_e01==nb_e05) && (nb_e02==nb_e06) && (nb_e03==nb_e07) && (nb_e04==nb_e08) ) {
+ if (nb_f1==nb_f2) {
+ nb_ok += 1;
+ aFTr = aM(1);
+ }
+ }
+ }
+ }
+ //
+ if ( nb_ok == 1 ) {
+ isOK = 1;
+ }
+ //
SMESHDS_SubMesh* smVft = theMesh->MeshElements( vft );
if (!smFace || !smb || !smt || !sm1 || !sm2 || !smVfb || !smVlb || !smVft ) {
MESSAGE( "NULL submesh " <<smFace<<" "<<smb<<" "<<smt<<" "<<
SMESHDS_SubMesh* smVft = theMesh->MeshElements( vft );
if (!smFace || !smb || !smt || !sm1 || !sm2 || !smVfb || !smVlb || !smVft ) {
MESSAGE( "NULL submesh " <<smFace<<" "<<smb<<" "<<smt<<" "<<
case 3: text = "Internal error of StdMeshers_Penta_3D"; break;
case 4: text = "Can't compute normalized parameters of a point inside a block"; break;
case 5: text = "Can't compute coordinates by normalized parameters inside a block"; break;
case 3: text = "Internal error of StdMeshers_Penta_3D"; break;
case 4: text = "Can't compute normalized parameters of a point inside a block"; break;
case 5: text = "Can't compute coordinates by normalized parameters inside a block"; break;
- if(NumBase==0) return false;
+ if(NumBase==0) {
+ std::vector<int> aResVec(SMDSEntity_Last);
+ for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+ SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+ aResMap.insert(std::make_pair(sm,aResVec));
+ myErrorStatus->myName = COMPERR_ALGO_FAILED;
+ myErrorStatus->myComment = "Submesh can not be evaluated";
+ return false;
+ }