+ elem = meshDS->AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, id);
+ else
+ elem = meshDS->AddVolume(n1, n2, n3, n4, n5, n6, n7, n8);
+ }
+ else {
+ const SMDS_MeshNode* n12 = GetMediumNode(n1,n2,force3d);
+ const SMDS_MeshNode* n23 = GetMediumNode(n2,n3,force3d);
+ const SMDS_MeshNode* n34 = GetMediumNode(n3,n4,force3d);
+ const SMDS_MeshNode* n41 = GetMediumNode(n4,n1,force3d);
+
+ const SMDS_MeshNode* n56 = GetMediumNode(n5,n6,force3d);
+ const SMDS_MeshNode* n67 = GetMediumNode(n6,n7,force3d);
+ const SMDS_MeshNode* n78 = GetMediumNode(n7,n8,force3d);
+ const SMDS_MeshNode* n85 = GetMediumNode(n8,n5,force3d);
+
+ const SMDS_MeshNode* n15 = GetMediumNode(n1,n5,force3d);
+ const SMDS_MeshNode* n26 = GetMediumNode(n2,n6,force3d);
+ const SMDS_MeshNode* n37 = GetMediumNode(n3,n7,force3d);
+ const SMDS_MeshNode* n48 = GetMediumNode(n4,n8,force3d);
+
+ if(id)
+ elem = meshDS->AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8,
+ n12, n23, n34, n41, n56, n67,
+ n78, n85, n15, n26, n37, n48, id);
+ else
+ elem = meshDS->AddVolume(n1, n2, n3, n4, n5, n6, n7, n8,
+ n12, n23, n34, n41, n56, n67,
+ n78, n85, n15, n26, n37, n48);
+ }
+ if ( mySetElemOnShape && myShapeID > 0 )
+ meshDS->SetMeshElementOnShape( elem, myShapeID );
+
+ return elem;
+}
+
+//=======================================================================
+/*!
+ * \brief Load nodes bound to face into a map of node columns
+ * \param theParam2ColumnMap - map of node columns to fill
+ * \param theFace - the face on which nodes are searched for
+ * \param theBaseEdge - the edge nodes of which are columns' bases
+ * \param theMesh - the mesh containing nodes
+ * \retval bool - false if something is wrong
+ *
+ * The key of the map is a normalized parameter of each
+ * base node on theBaseEdge.
+ * This method works in supposition that nodes on the face
+ * forms a rectangular grid and elements can be quardrangles or triangles
+ */
+//=======================================================================
+
+bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap,
+ const TopoDS_Face& theFace,
+ const TopoDS_Edge& theBaseEdge,
+ SMESHDS_Mesh* theMesh)
+{
+ // get vertices of theBaseEdge
+ TopoDS_Vertex vfb, vlb, vft; // first and last, bottom and top vertices
+ TopoDS_Edge eFrw = TopoDS::Edge( theBaseEdge.Oriented( TopAbs_FORWARD ));
+ TopExp::Vertices( eFrw, vfb, vlb );
+
+ // find the other edges of theFace and orientation of e1
+ TopoDS_Edge e1, e2, eTop;
+ bool rev1, CumOri = false;
+ TopExp_Explorer exp( theFace, TopAbs_EDGE );
+ int nbEdges = 0;
+ for ( ; exp.More(); exp.Next() ) {
+ if ( ++nbEdges > 4 ) {
+ return false; // more than 4 edges in theFace
+ }
+ TopoDS_Edge e = TopoDS::Edge( exp.Current() );
+ if ( theBaseEdge.IsSame( e ))
+ continue;
+ TopoDS_Vertex vCommon;
+ if ( !TopExp::CommonVertex( theBaseEdge, e, vCommon ))
+ eTop = e;
+ else if ( vCommon.IsSame( vfb )) {
+ e1 = e;
+ vft = TopExp::LastVertex( e1, CumOri );
+ rev1 = vfb.IsSame( vft );
+ if ( rev1 )
+ vft = TopExp::FirstVertex( e1, CumOri );
+ }