+ //================================================================================
+ /*!
+ * \brief Returns a medium node either existing in SMESH of created by NETGEN
+ * \param [in] corner1 - corner node 1
+ * \param [in] corner2 - corner node 2
+ * \param [in] defaultMedium - the node created by NETGEN
+ * \param [in] helper - holder of medium nodes existing in SMESH
+ * \return const SMDS_MeshNode* - the result node
+ */
+ //================================================================================
+
+ const SMDS_MeshNode* mediumNode( const SMDS_MeshNode* corner1,
+ const SMDS_MeshNode* corner2,
+ const SMDS_MeshNode* defaultMedium,
+ const SMESH_MesherHelper* helper)
+ {
+ if ( helper )
+ {
+ TLinkNodeMap::const_iterator l2n =
+ helper->GetTLinkNodeMap().find( SMESH_TLink( corner1, corner2 ));
+ if ( l2n != helper->GetTLinkNodeMap().end() )
+ defaultMedium = l2n->second;
+ }
+ return defaultMedium;
+ }
+
+ //================================================================================
+ /*!
+ * \brief Assure that mesh on given shapes is quadratic
+ */
+ //================================================================================
+
+ void makeQuadratic( const TopTools_IndexedMapOfShape& shapes,
+ SMESH_Mesh* mesh )
+ {
+ for ( int i = 1; i <= shapes.Extent(); ++i )
+ {
+ SMESHDS_SubMesh* smDS = mesh->GetMeshDS()->MeshElements( shapes(i) );
+ if ( !smDS ) continue;
+ SMDS_ElemIteratorPtr elemIt = smDS->GetElements();
+ if ( !elemIt->more() ) continue;
+ const SMDS_MeshElement* e = elemIt->next();
+ if ( !e || e->IsQuadratic() )
+ continue;
+
+ TIDSortedElemSet elems;
+ elems.insert( e );
+ while ( elemIt->more() )
+ elems.insert( elems.end(), elemIt->next() );
+
+ SMESH_MeshEditor( mesh ).ConvertToQuadratic( /*3d=*/false, elems, /*biQuad=*/false );
+ }
+ }
+