-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// 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
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// SMESH StdMeshers_Penta_3D implementaion of SMESH idl descriptions
// File : StdMeshers_Penta_3D.cxx
// Module : SMESH
//purpose :
//=======================================================================
StdMeshers_Penta_3D::StdMeshers_Penta_3D()
-: myErrorStatus(SMESH_ComputeError::New())
+ : myErrorStatus(SMESH_ComputeError::New())
{
myTol3D=0.1;
myWallNodesMaps.resize( SMESH_Block::NbFaces() );
//
if ( SMESH_Block::IsEdgeID (aSID)) {
const SMDS_EdgePosition* epos =
- static_cast<const SMDS_EdgePosition*>(aNode->GetPosition().get());
+ static_cast<const SMDS_EdgePosition*>(aNode->GetPosition());
myBlock.ComputeParameters( epos->GetUParameter(), aS, aCoords );
}
else {
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
- };
+ };
for ( i = 0; i < NB_WALL_FACES ; ++i ) {
int fIndex = SMESH_Block::ShapeIndex( wallFaceID[ i ]);
bool ok = LoadIJNodes (myWallNodesMaps[ fIndex ],
FindNodeOnShape(aS, aCoords, i, aTN);
}
else{
- // create node and get it id
+ // create node and get its id
CreateNode (bIsUpperLayer, aCoords, aTN);
//
if ( bIsUpperLayer ) {
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
}
}
else {
// this variant is better for other cases
-// 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 ]]);
}
// base edge
if ( aN.size() < nbFaceNodes * 2 )
aN.resize( nbFaceNodes * 2 );
//
- 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;
aID0 = pNode->GetID();
aJ[k] = GetIndexOnLayer(aID0);
if (!myErrorStatus->IsOK()) {
MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh");
return;
}
- //
- ++k;
}
//
bool forward = true;
itn = aSM0->GetNodes();
aNbNodes = aSM0->NbNodes();
//printf("** aNbNodes=%d\n", aNbNodes);
-
+ myTool->SetSubShape( aFxy1 ); // to set medium nodes to aFxy1
//
// set elements on aFxy1
vector<const SMDS_MeshNode*> aNodes1;
}
meshDS->SetMeshElementOnShape(face, aFxy1);
}
+ myTool->SetSubShape( myShape );
// update compute state of top face submesh
aSubMesh1->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
// assure that mesh on the top face will be cleaned when it is cleaned
// on the bottom face
SMESH_subMesh* volSM = pMesh->GetSubMesh( myTool->GetSubShape() );
- volSM->SetEventListener( new SMESH_subMeshEventListener(true),
+ volSM->SetEventListener( new SMESH_subMeshEventListener(true, // deletable by SMESH_subMesh
+ "StdMeshers_Penta_3D"),
SMESH_subMeshEventListenerData::MakeData( aSubMesh1 ),
aSubMesh0 ); // translate CLEAN event of aSubMesh0 to aSubMesh1
}
SMDS_MeshNode* pNode=NULL;
aTN.SetNode(pNode);
//
-// 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);
+ // }
if (bIsUpperLayer) {
double u = aParams.X(), v = aParams.Y();
double u1 = ( 1. - u ), v1 = ( 1. - v );
SMESH_Block::ShellPoint( aParams, myShapeXYZ, aP.ChangeCoord() );
}
//
-// iErr=myBlock.ErrorStatus();
-// if (iErr) {
-// myErrorStatus=12; // can not find the node point;
-// return;
-// }
+ // iErr=myBlock.ErrorStatus();
+ // if (iErr) {
+ // myErrorStatus=12; // can not find the node point;
+ // return;
+ // }
//
aX=aP.X(); aY=aP.Y(); aZ=aP.Z();
//
SMESHDS_Mesh* pMeshDS = pMesh->GetMeshDS();
//
pNode = pMeshDS->AddNode(aX, aY, aZ);
-
+
aTN.SetNode(pNode);
}
SMESH_Block::TShapeID& aSSID)
{
switch (aBNSSID) {
- 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;
}
return;
}
iNb=aM.Extent();
if (iNb!=iNbEx[i]){
MESSAGE("StdMeshers_Penta_3D::CheckData() ");
- myErrorStatus->myName=4; // number of subshape is not compatible
- myErrorStatus->myComment="Wrong number of subshapes of a block";
+ myErrorStatus->myName=4; // number of sub-shape is not compatible
+ myErrorStatus->myComment="Wrong number of sub-shapes of a block";
return;
}
}
SMESHDS_SubMesh* smVft = theMesh->MeshElements( vft );
if (!smFace || !smb || !smt || !sm1 || !sm2 || !smVfb || !smVlb || !smVft ) {
MESSAGE( "NULL submesh " <<smFace<<" "<<smb<<" "<<smt<<" "<<
- sm1<<" "<<sm2<<" "<<smVfb<<" "<<smVlb<<" "<<smVft);
+ sm1<<" "<<sm2<<" "<<smVfb<<" "<<smVlb<<" "<<smVft);
return false;
}
if ( smb->NbNodes() != smt->NbNodes() || sm1->NbNodes() != sm2->NbNodes() ) {
int nf = sm1->NbNodes()*smb->NbNodes() - n3*n4;
if( nf != smFace->NbNodes() ) {
MESSAGE( "Wrong nb face nodes: " <<
- sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
+ sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
return false;
}
}
else {
MESSAGE( "Wrong nb face nodes: " <<
- sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
+ sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
return false;
}
}
if(myTool->IsMedium(node))
continue;
const SMDS_EdgePosition* pos =
- dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
+ dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition() );
if ( !pos ) {
return false;
}
if(myTool->IsMedium(node))
continue;
const SMDS_EdgePosition* pos =
- dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
+ dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition() );
if ( !pos ) {
return false;
}
}
}
else if ( (nbFaceNodes==3 || (myCreateQuadratic && nbFaceNodes==6) ) &&
- n3 == par_nVec_1->second[ row ] ) {
+ n3 == par_nVec_1->second[ row ] ) {
n1 = n3;
}
else {
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 6: text = "Can't detect block subshapes. Not a block?"; break;
+ case 6: text = "Can't detect block sub-shapes. Not a block?"; break;
}
if (!text.empty())
err->myName = myErrorStatus;
return;
}
if ( SMESH_Block::IsEdgeID( aID ))
- bOk = myTBlock.EdgeParameters( aID, theU, theXYZ );
+ bOk = myTBlock.EdgeParameters( aID, theU, theXYZ );
if (!bOk) {
myErrorStatus=4; // problems with computation Parameters
return;
//function : Point
//purpose :
//=======================================================================
- void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams,
- gp_Pnt& aP3D)
+void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, gp_Pnt& aP3D)
{
TopoDS_Shape aS;
//
//function : Point
//purpose :
//=======================================================================
- void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams,
- const TopoDS_Shape& theShape,
- gp_Pnt& aP3D)
+void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams,
+ const TopoDS_Shape& theShape,
+ gp_Pnt& aP3D)
{
myErrorStatus = 0;
//
std::vector<int> aVec = (*anIt).second;
nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
}
-
+
MapShapeNbElemsItr anIt = aResMap.find( meshFaces[NumBase-1] );
std::vector<int> aVec = (*anIt).second;
int nb2d_face0 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);