Salome HOME
52233: TC7.3.0: unexpected mesh computation failed
[plugins/hexoticplugin.git] / src / HexoticPlugin / HexoticPlugin_Hexotic.cxx
index 1c1bfa00ad766d830adc47870987bd23fea3ff82..9db08d46f536bfaab1cf7485ef0d9d16757d28e3 100644 (file)
@@ -369,6 +369,23 @@ static void removeHexoticFiles(TCollection_AsciiString file_In, TCollection_Asci
   removeFile( file_Out );
 }
 
+//=======================================================================
+//function : splitQuads
+//purpose  : splits all quadrangles into triangles
+//=======================================================================
+
+static void splitQuads(SMESH_Mesh& aMesh)
+{
+  SMESH_MeshEditor spliter( &aMesh );
+
+  TIDSortedElemSet elems;
+  SMDS_ElemIteratorPtr eIt = aMesh.GetMeshDS()->elementsIterator();
+  while( eIt->more() )
+    elems.insert( elems.end(), eIt->next() );
+  
+  spliter.QuadToTri ( elems, /*the13Diag=*/true);
+}
+
 //=======================================================================
 //function : readResult
 //purpose  : Read GMF file in case of a mesh with geometry
@@ -1496,6 +1513,7 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh&          aMesh,
 #endif
       Hexotic_In  = aTmpDir + "Hexotic"+getSuffix()+"_In.mesh";
       removeHexoticFiles(Hexotic_In, Hexotic_Out);
+      splitQuads(aMesh); // quadrangles are no longer acceptable as input
       cout << std::endl;
       cout << "Creating Hexotic input mesh file : " << Hexotic_In << std::endl;
       aMesh.ExportGMF(Hexotic_In.ToCString(), meshDS, true);
@@ -1651,6 +1669,8 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHel
 
   removeHexoticFiles(Hexotic_In, Hexotic_Out);
 
+  splitQuads(aMesh); // quadrangles are no longer acceptable as input
+
   cout << std::endl;
   cout << "Creating Hexotic input mesh file : " << Hexotic_In << std::endl;
   aMesh.ExportGMF(Hexotic_In.ToCString(), aHelper->GetMeshDS());