-// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 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
#include "Utils_ExceptHandlers.hxx"
#include <cstddef>
-
#include <numeric>
typedef SMESH_Comment TComm;
// check if the loaded grid corresponds to nb of quadrangles on the FACE
const SMESHDS_SubMesh* faceSubMesh =
proxymesh ? proxymesh->GetSubMesh( F ) : meshDS->MeshElements( F );
- const int nbQuads = faceSubMesh->NbElements();
+ const smIdType nbQuads = faceSubMesh->NbElements();
const int nbHor = aCubeSide[i]._u2nodesMap.size() - 1;
const int nbVer = aCubeSide[i]._u2nodesMap.begin()->second.size() - 1;
ok = ( nbQuads == nbHor * nbVer );
TopoDS_Shape aFace = aFaces.Value(i+1);
SMESH_Algo *algo = _gen->GetAlgo(aMesh, aFace);
if( !algo ) {
- std::vector<int> aResVec(SMDSEntity_Last);
+ std::vector<smIdType> 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));
if (algoName == "Quadrangle_2D") {
MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i]);
if( anIt == aResMap.end() ) continue;
- std::vector<int> aVec = (*anIt).second;
- int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+ std::vector<smIdType> aVec = (*anIt).second;
+ smIdType nbtri = std::max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
if( nbtri == 0 )
isAllQuad = true;
}
if( sm ) {
MapShapeNbElemsItr anIt = aResMap.find(sm);
if( anIt == aResMap.end() ) continue;
- std::vector<int> aVec = (*anIt).second;
- nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+ std::vector<smIdType> aVec = (*anIt).second;
+ nb1d += std::max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
if(IsFirst) {
IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
IsFirst = false;
if( i == OppNum ) continue;
MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] );
if( anIt == aResMap.end() ) continue;
- std::vector<int> aVec = (*anIt).second;
- nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+ std::vector<smIdType> aVec = (*anIt).second;
+ nb2d += std::max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
}
MapShapeNbElemsItr anIt = aResMap.find( meshFaces[0] );
- std::vector<int> aVec = (*anIt).second;
- int nb2d_face0 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
- int nb0d_face0 = aVec[SMDSEntity_Node];
+ std::vector<smIdType> aVec = (*anIt).second;
+ smIdType nb2d_face0 = std::max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+ smIdType nb0d_face0 = aVec[SMDSEntity_Node];
- std::vector<int> aResVec(SMDSEntity_Last);
+ std::vector<smIdType> aResVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
if(IsQuadratic) {
aResVec[SMDSEntity_Quad_Hexa] = nb2d_face0 * ( nb2d/nb1d );
- int nb1d_face0_int = ( nb2d_face0*4 - nb1d ) / 2;
+ smIdType nb1d_face0_int = ( nb2d_face0*4 - nb1d ) / 2;
aResVec[SMDSEntity_Node] = nb0d_face0 * ( 2*nb2d/nb1d - 1 ) - nb1d_face0_int * nb2d/nb1d;
}
else {
if ( nbFoundShells != 1 ) {
if ( toCheckAll ) return false;
continue;
- }
+ }
exp1.Init( exp0.Current(), TopAbs_FACE );
int nbEdges = SMESH_MesherHelper::Count( exp1.Current(), TopAbs_EDGE, /*ignoreSame=*/true );
bool ok = ( nbEdges > 3 );
if ( !toCheckAll && ok ) return true;
}
return toCheckAll;
-};
+}
//=======================================================================
//function : ComputePentahedralMesh
-//purpose :
+//purpose :
//=======================================================================
SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh,
SMESH_ProxyMesh* proxyMesh)
{
SMESH_ComputeErrorPtr err = SMESH_ComputeError::New();
- if ( proxyMesh )
- {
- err->myName = COMPERR_BAD_INPUT_MESH;
- err->myComment = "Can't build pentahedral mesh on viscous layers";
- return err;
- }
+
bool bOK;
StdMeshers_Penta_3D anAlgo;
//
err = aPrism3D->GetComputeError();
}
}
+ if ( !bOK && proxyMesh )
+ {
+ // check if VL elements are present on block FACEs
+ bool hasVLonFace = false;
+ for ( TopExp_Explorer exp( aShape, TopAbs_FACE ); exp.More(); exp.Next() )
+ {
+ const SMESHDS_SubMesh* sm1 = aMesh.GetSubMesh( exp.Current() )->GetSubMeshDS();
+ const SMESHDS_SubMesh* sm2 = proxyMesh->GetSubMesh( exp.Current() );
+ if (( hasVLonFace = ( sm2 && sm1->NbElements() != sm2->NbElements() )))
+ break;
+ }
+ if ( hasVLonFace )
+ {
+ err->myName = COMPERR_BAD_INPUT_MESH;
+ err->myComment = "Can't build pentahedral mesh on viscous layers";
+ }
+ }
+
return err;
}
//=======================================================================
//function : EvaluatePentahedralMesh
-//purpose :
+//purpose :
//=======================================================================
bool EvaluatePentahedralMesh(SMESH_Mesh & aMesh,