+
+/**
+ * @brief Compute the list of already meshed Surface elements and info
+ * on their orientation and if they are internal
+ *
+ * @param aMesh Global Mesh
+ * @param aShape Shape associated to the mesh
+ * @param proxyMesh pointer to mesh used fo find the elements
+ * @param internals information on internal sub shapes
+ * @param helper helper associated to the mesh
+ * @param listElements map of surface element associated with
+ * their orientation and internal status
+ * @return true if their was some error
+ */
+bool NETGENPlugin_NETGEN_3D::getSurfaceElements(
+ SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ SMESH_ProxyMesh::Ptr proxyMesh,
+ NETGENPlugin_Internals &internals,
+ SMESH_MesherHelper &helper,
+ std::map<const SMDS_MeshElement*, tuple<bool, bool>, TIDCompare>& listElements
+)
+{
+ SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
+ TopAbs_ShapeEnum mainType = aMesh.GetShapeToMesh().ShapeType();
+ bool checkReverse = ( mainType == TopAbs_COMPOUND || mainType == TopAbs_COMPSOLID );
+
+ for ( TopExp_Explorer exFa( aShape, TopAbs_FACE ); exFa.More(); exFa.Next())
+ {
+ const TopoDS_Shape& aShapeFace = exFa.Current();
+ int faceID = meshDS->ShapeToIndex( aShapeFace );
+ bool isInternalFace = internals.isInternalShape( faceID );
+ bool isRev = false;
+ if ( checkReverse && !isInternalFace &&
+ helper.NbAncestors(aShapeFace, aMesh, aShape.ShapeType()) > 1 )
+ // IsReversedSubMesh() can work wrong on strongly curved faces,
+ // so we use it as less as possible
+ isRev = helper.IsReversedSubMesh( TopoDS::Face( aShapeFace ));
+
+ const SMESHDS_SubMesh * aSubMeshDSFace = proxyMesh->GetSubMesh( aShapeFace );
+ if ( !aSubMeshDSFace ) continue;
+
+ SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements();
+ if ( _quadraticMesh &&
+ dynamic_cast< const SMESH_ProxyMesh::SubMesh*>( aSubMeshDSFace ))
+ {
+ // add medium nodes of proxy triangles to helper (#16843)
+ while ( iteratorElem->more() )
+ helper.AddTLinks( static_cast< const SMDS_MeshFace* >( iteratorElem->next() ));
+
+ iteratorElem = aSubMeshDSFace->GetElements();
+ }
+ while(iteratorElem->more()){
+ const SMDS_MeshElement* elem = iteratorElem->next();
+ // check mesh face
+ if ( !elem ){
+ return error( COMPERR_BAD_INPUT_MESH, "Null element encounters");
+ }
+ if ( elem->NbCornerNodes() != 3 ){
+ return error( COMPERR_BAD_INPUT_MESH, "Not triangle element encounters");
+ }
+ listElements[elem] = tuple(isRev, isInternalFace);
+ }
+ }
+
+ return false;
+}
+
+/**
+ * @brief Part of Compute: adding already meshed elements
+ * into netgen structure
+ *
+ * @param aMesh Global mesh
+ * @param aShape Shape associated with the mesh
+ * @param nodeVec Mapping between nodes mesh id and netgen structure id
+ * @param ngLib Wrapper on netgen lib
+ * @param helper helper assocaited to the mesh
+ * @param Netgen_NbOfNodes Number of nodes in netge structure
+ * @return true if there was some error
+ */
+
+bool NETGENPlugin_NETGEN_3D::computeFillNgMesh(
+ SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ vector< const SMDS_MeshNode* > &nodeVec,
+ NETGENPlugin_NetgenLibWrapper &ngLib,
+ SMESH_MesherHelper &helper,
+ int &Netgen_NbOfNodes)