-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019 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
// 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SMESH StdMeshers_Penta_3D implementaion of SMESH idl descriptions
+// SMESH StdMeshers_Penta_3D implementation of SMESH idl descriptions
// File : StdMeshers_Penta_3D.cxx
// Module : SMESH
//
#include "SMDS_MeshElement.hxx"
#include "SMDS_VolumeOfNodes.hxx"
#include "SMDS_VolumeTool.hxx"
+#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
+#include "SMESH_Comment.hxx"
#include "SMESH_Mesh.hxx"
+#include "SMESH_MeshAlgos.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_subMeshEventListener.hxx"
-#include "SMESH_Comment.hxx"
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
- MESSAGE("StdMeshers_Penta_3D::Compute()");
- //
bool bOK=false;
//
myShape=aShape;
aTNode.SetBaseNodeID(aNodeID);
//
if ( SMESH_Block::IsEdgeID (aSID)) {
- const SMDS_EdgePosition* epos =
- static_cast<const SMDS_EdgePosition*>(aNode->GetPosition());
+ SMDS_EdgePositionPtr epos = aNode->GetPosition();
myBlock.ComputeParameters( epos->GetUParameter(), aS, aCoords );
}
else {
// set XYZ on horizontal edges and get node columns of faces:
// 2 columns for each face, between which a base node is located
vector<const SMDS_MeshNode*>* nColumns[8];
- double ratio[ NB_WALL_FACES ]; // base node position between columns [0.-1.]
+ double ratio[ NB_WALL_FACES ] = {0,0,0,0}; // base node position between columns [0.-1.]
if ( createNode ) {
for ( k = 0; k < NB_WALL_FACES ; ++k ) {
ratio[ k ] = SetHorizEdgeXYZ (aBNXYZ, wallFaceID[ k ],
aZ=(double)i/(double)(myISize-1);
aCoords.SetCoord(aX, aY, aZ);
//
- // suporting shape ID
+ // supporting shape ID
ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID);
if (!myErrorStatus->IsOK()) {
- MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
+ MESSAGE("StdMeshers_Penta_3D::MakeNodes() pb");
return;
}
//
}
}
if (!myErrorStatus->IsOK()) {
- MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
+ MESSAGE("StdMeshers_Penta_3D::MakeNodes() err");
return;
}
//
SMESH_Block::GetFaceEdgesIDs( aFaceID, edgeVec );
//
int coord = SMESH_Block::GetCoordIndOnEdge( edgeVec[ BASE ] );
- bool isForward = myBlock.IsForwadEdge( edgeVec[ BASE ] );
+ bool isForward = myBlock.IsForwardEdge( edgeVec[ BASE ] );
double param = aBaseNodeParams.Coord( coord );
if ( !isForward)
}
//
// 2. Make pentahedrons
- int aID0, k , aJ[3];
+ int aID0, k , aJ[4];
vector<const SMDS_MeshNode*> aN;
//
SMDS_ElemIteratorPtr itf, aItNodes;
int nbFaceNodes = pE0->NbNodes();
if(myCreateQuadratic)
nbFaceNodes = nbFaceNodes/2;
- if ( aN.size() < nbFaceNodes * 2 )
+ if ( (int) aN.size() < nbFaceNodes * 2 )
aN.resize( nbFaceNodes * 2 );
//
for ( k=0; k<nbFaceNodes; ++k ) {
aID0 = pNode->GetID();
aJ[k] = GetIndexOnLayer(aID0);
if (!myErrorStatus->IsOK()) {
- MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh");
+ MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh pb");
return;
}
}
aNbNodes = pE0->NbNodes();
if(myCreateQuadratic)
aNbNodes = aNbNodes/2;
- if ( aNodes1.size() < aNbNodes )
+ if ( (int) aNodes1.size() < aNbNodes )
aNodes1.resize( aNbNodes );
//
k = aNbNodes-1; // reverse a face
aID0 = pNode->GetID();
aJ = GetIndexOnLayer(aID0);
if (!myErrorStatus->IsOK()) {
- MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() ");
+ MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() pb");
return;
}
//
if (iCnt>1) {
// \begin{E.A.}
// The current algorithm fails if there is more that one
- // face wich contains triangles ...
+ // face which contains triangles ...
// In that case, replace return by break to try another
// method (coded in "if (iCnt != 1) { ... }")
//
// 1.1 Base vertex V000
iNbE = aME.Extent();
if (iNbE!= NB_WALL_FACES ){
- MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
+ MESSAGE("StdMeshers_Penta_3D::MakeBlock() err");
myErrorStatus->myName=7; // too few edges are in base face aFTr
myErrorStatus->myComment=SMESH_Comment("Not a quadrilateral face #")
<<pMesh->GetMeshDS()->ShapeToIndex( aFTr )<<": "<<iNbE<<" edges" ;
}
iNbEV=aMEV.Extent();
if (iNbEV!=3){
- MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
+ MESSAGE("StdMeshers_Penta_3D::MakeBlock() err");
myErrorStatus->myName=7; // too few edges meet in base vertex
myErrorStatus->myComment=SMESH_Comment("3 edges must share vertex #")
<<pMesh->GetMeshDS()->ShapeToIndex( aV000 )<<" but there are "<<iNbEV<<" edges";
}
//
if (!bFound) {
- MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
+ MESSAGE("StdMeshers_Penta_3D::MakeBlock() err");
myErrorStatus->myName=8; // can not find reper V001
myErrorStatus->myComment=SMESH_Comment("Can't find opposite vertex for vertex #")
<<pMesh->GetMeshDS()->ShapeToIndex( aV000 );
// find the other edges of theFace and orientation of e1
TopoDS_Edge e1, e2, eTop;
- bool rev1, CumOri = false;
+ bool rev1 = false, CumOri = false;
TopExp_Explorer exp( theFace, TopAbs_EDGE );
int nbEdges = 0;
for ( ; exp.More(); exp.Next() ) {
node = nIt->next();
if(myTool->IsMedium(node))
continue;
- const SMDS_EdgePosition* pos =
- dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition() );
- if ( !pos ) {
+ SMDS_EdgePositionPtr pos = node->GetPosition();
+ if ( !pos )
return false;
- }
double u = ( pos->GetUParameter() - f ) / range;
vector<const SMDS_MeshNode*> & nVec = theIJNodes[ u ];
nVec.resize( vsize, nullNode );
loadedNodes.insert( nVec[ 0 ] = node );
}
- if ( theIJNodes.size() != hsize ) {
+ if ( (int) theIJNodes.size() != hsize ) {
MESSAGE( "Wrong node positions on theBaseEdge" );
return false;
}
node = nIt->next();
if(myTool->IsMedium(node))
continue;
- const SMDS_EdgePosition* pos =
- dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition() );
- if ( !pos ) {
+ SMDS_EdgePositionPtr pos = node->GetPosition();
+ if ( !pos )
return false;
- }
sortedNodes.insert( make_pair( pos->GetUParameter(), node ));
}
loadedNodes.insert( nVecf[ vsize - 1 ] = smVft->GetNodes()->next() );
const SMDS_MeshElement* face = 0;
do {
// look for a face by 2 nodes
- face = SMESH_MeshEditor::FindFaceInSet( n1, n2, allFaces, foundFaces );
+ face = SMESH_MeshAlgos::FindFaceInSet( n1, n2, allFaces, foundFaces );
if ( face ) {
int nbFaceNodes = face->NbNodes();
if ( (!myCreateQuadratic && nbFaceNodes>4) ||
}
// look for a not loaded node of the <face>
bool found = false;
- const SMDS_MeshNode* n3 = 0; // a node defferent from n1 and n2
+ const SMDS_MeshNode* n3 = 0; // a node different from n1 and n2
eIt = face->nodesIterator() ;
while ( !found && eIt->more() ) {
node = static_cast<const SMDS_MeshNode*>( eIt->next() );
}
//=======================================================================
-//function : IsForwadEdge
+//function : IsForwardEdge
//purpose :
//=======================================================================
-bool StdMeshers_SMESHBlock::IsForwadEdge(const int theEdgeID)
+bool StdMeshers_SMESHBlock::IsForwardEdge(const int theEdgeID)
{
int index = myTBlock.ShapeIndex( theEdgeID );
if ( !myTBlock.IsEdgeID( theEdgeID ))
const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap)
{
- MESSAGE("StdMeshers_Penta_3D::Evaluate()");
-
// find face contains only triangles
vector < SMESH_subMesh * >meshFaces;
TopTools_SequenceOfShape aFaces;