Salome HOME
IPAL0054631: NETGEN-1D2D3D fails on two adjacent boxes with Viscous Layers
[modules/smesh.git] / src / SMESH / SMESH_ProxyMesh.cxx
index 36d745f6511da3613a1464192e2f194a56204559..091c4733246083b667a6684fa7e738cb6931fae5 100644 (file)
@@ -639,6 +639,33 @@ SMDS_ElemIteratorPtr SMESH_ProxyMesh::GetInverseElementIterator(const SMDS_MeshN
   return iter;
 }
 
+//================================================================================
+/*!
+ * \brief Check if a FACE has prisms on its both sides
+ *  \param [in] smFace - sub-mesh of the FACE. NOT a proxy sub-mesh!
+ *  \return bool - true if there are prisms on the two sides
+ */
+//================================================================================
+
+bool SMESH_ProxyMesh::HasPrismsOnTwoSides( SMESHDS_SubMesh* smFace )
+{
+  if ( !smFace || smFace->NbElements() == 0 )
+    return false;
+
+  SMDS_ElemIteratorPtr faces = smFace->GetElements();
+  while ( faces->more() )
+  {
+    const SMDS_MeshElement* f = faces->next();
+    std::vector<const SMDS_MeshNode*> fNodes( f->begin_nodes(), f->end_nodes() );
+    std::vector<const SMDS_MeshElement*> vols;
+    if ( SMDS_Mesh::GetElementsByNodes( fNodes, vols, SMDSAbs_Volume ) < 2 )
+      return false;
+    return ( vols[0]->NbCornerNodes() == 2 * f->NbCornerNodes() &&
+             vols[1]->NbCornerNodes() == 2 * f->NbCornerNodes() );
+  }
+  return false;
+}
+
 //================================================================================
 /*!
  * \brief SubMesh Constructor