- /* retrieve mesh data (see meshgems/mesh.h) */
- integer nv, ne, nt, nq, vtx[4], tag;
- integer *evedg, *evtri, *evquad, type;
- real xyz[3];
-
- mesh_get_vertex_count(msh, &nv);
- mesh_get_edge_count(msh, &ne);
- mesh_get_triangle_count(msh, &nt);
- mesh_get_quadrangle_count(msh, &nq);
-
- evedg = (integer *)mesh_calloc_generic_buffer(msh);
- evtri = (integer *)mesh_calloc_generic_buffer(msh);
- evquad = (integer *)mesh_calloc_generic_buffer(msh);
-
- SMDS_MeshNode** nodes = new SMDS_MeshNode*[nv+1];
- bool* tags = new bool[nv+1];
-
- /* enumerated vertices */
- for(int iv=1;iv<=nv;iv++) {
- mesh_get_vertex_coordinates(msh, iv, xyz);
- mesh_get_vertex_tag(msh, iv, &tag);
- // Issue 0020656. Use vertex coordinates
- if ( tag > 0 && tag <= pmap.Extent() ) {
- TopoDS_Vertex v = TopoDS::Vertex(pmap(tag));
- double tol = BRep_Tool::Tolerance( v );
- gp_Pnt p = BRep_Tool::Pnt( v );
- if ( p.IsEqual( gp_Pnt( xyz[0], xyz[1], xyz[2]), 2*tol))
- xyz[0] = p.X(), xyz[1] = p.Y(), xyz[2] = p.Z();
- else
- tag = 0; // enforced or attracted vertex
- }
- nodes[iv] = meshDS->AddNode(xyz[0], xyz[1], xyz[2]);
-
- // Create group of enforced vertices if requested
- BLSURFPlugin_Hypothesis::TEnfVertexCoords projVertex;
- projVertex.clear();
- projVertex.push_back((double)xyz[0]);
- projVertex.push_back((double)xyz[1]);
- projVertex.push_back((double)xyz[2]);
- std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(projVertex);
- if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end()) {
- MESSAGE("Found enforced vertex @ " << xyz[0] << ", " << xyz[1] << ", " << xyz[2]);
- BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator enfListIt = enfCoordsIt->second.begin();
- BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
- for (; enfListIt != enfCoordsIt->second.end(); ++enfListIt) {
- currentEnfVertex = (*enfListIt);
- if (currentEnfVertex->grpName != "") {
- bool groupDone = false;
- SMESH_Mesh::GroupIteratorPtr grIt = aMesh.GetGroups();
- MESSAGE("currentEnfVertex->grpName: " << currentEnfVertex->grpName);
- MESSAGE("Parsing the groups of the mesh");
- while (grIt->more()) {
- SMESH_Group * group = grIt->next();
- if ( !group ) continue;
- MESSAGE("Group: " << group->GetName());
- SMESHDS_GroupBase* groupDS = group->GetGroupDS();
- if ( !groupDS ) continue;
- MESSAGE("group->SMDSGroup().GetType(): " << (groupDS->GetType()));
- MESSAGE("group->SMDSGroup().GetType()==SMDSAbs_Node: " << (groupDS->GetType()==SMDSAbs_Node));
- MESSAGE("currentEnfVertex->grpName.compare(group->GetStoreName())==0: " << (currentEnfVertex->grpName.compare(group->GetName())==0));
- if ( groupDS->GetType()==SMDSAbs_Node && currentEnfVertex->grpName.compare(group->GetName())==0) {
- SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( groupDS );
- aGroupDS->SMDSGroup().Add(nodes[iv]);
- MESSAGE("Node ID: " << nodes[iv]->GetID());
- // How can I inform the hypothesis ?
- // _hypothesis->AddEnfVertexNodeID(currentEnfVertex->grpName,nodes[iv]->GetID());
- groupDone = true;
- MESSAGE("Successfully added enforced vertex to existing group " << currentEnfVertex->grpName);
- break;
- }
- }
- if (!groupDone)
- {
- int groupId;
- SMESH_Group* aGroup = aMesh.AddGroup(SMDSAbs_Node, currentEnfVertex->grpName.c_str(), groupId);
- aGroup->SetName( currentEnfVertex->grpName.c_str() );
- SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
+ /* retrieve mesh data (see meshgems/mesh.h) */
+ integer nv, ne, nt, nq, vtx[4], tag;
+ integer *evedg, *evtri, *evquad, type;
+ real xyz[3];
+
+ mesh_get_vertex_count(msh, &nv);
+ mesh_get_edge_count(msh, &ne);
+ mesh_get_triangle_count(msh, &nt);
+ mesh_get_quadrangle_count(msh, &nq);
+
+ evedg = (integer *)mesh_calloc_generic_buffer(msh);
+ evtri = (integer *)mesh_calloc_generic_buffer(msh);
+ evquad = (integer *)mesh_calloc_generic_buffer(msh);
+
+ SMDS_MeshNode** nodes = new SMDS_MeshNode*[nv+1];
+ bool* tags = new bool[nv+1];
+
+ /* enumerated vertices */
+ for(int iv=1;iv<=nv;iv++) {
+ mesh_get_vertex_coordinates(msh, iv, xyz);
+ mesh_get_vertex_tag(msh, iv, &tag);
+ // Issue 0020656. Use vertex coordinates
+ if ( tag > 0 && tag <= pmap.Extent() ) {
+ TopoDS_Vertex v = TopoDS::Vertex(pmap(tag));
+ double tol = BRep_Tool::Tolerance( v );
+ gp_Pnt p = BRep_Tool::Pnt( v );
+ if ( p.IsEqual( gp_Pnt( xyz[0], xyz[1], xyz[2]), 2*tol))
+ xyz[0] = p.X(), xyz[1] = p.Y(), xyz[2] = p.Z();
+ else
+ tag = 0; // enforced or attracted vertex
+ }
+ nodes[iv] = meshDS->AddNode(xyz[0], xyz[1], xyz[2]);
+
+ // Create group of enforced vertices if requested
+ BLSURFPlugin_Hypothesis::TEnfVertexCoords projVertex;
+ projVertex.clear();
+ projVertex.push_back((double)xyz[0]);
+ projVertex.push_back((double)xyz[1]);
+ projVertex.push_back((double)xyz[2]);
+ std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(projVertex);
+ if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end()) {
+ MESSAGE("Found enforced vertex @ " << xyz[0] << ", " << xyz[1] << ", " << xyz[2]);
+ BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator enfListIt = enfCoordsIt->second.begin();
+ BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
+ for (; enfListIt != enfCoordsIt->second.end(); ++enfListIt) {
+ currentEnfVertex = (*enfListIt);
+ if (currentEnfVertex->grpName != "") {
+ bool groupDone = false;
+ SMESH_Mesh::GroupIteratorPtr grIt = aMesh.GetGroups();
+ MESSAGE("currentEnfVertex->grpName: " << currentEnfVertex->grpName);
+ MESSAGE("Parsing the groups of the mesh");
+ while (grIt->more()) {
+ SMESH_Group * group = grIt->next();
+ if ( !group ) continue;
+ MESSAGE("Group: " << group->GetName());
+ SMESHDS_GroupBase* groupDS = group->GetGroupDS();
+ if ( !groupDS ) continue;
+ MESSAGE("group->SMDSGroup().GetType(): " << (groupDS->GetType()));
+ MESSAGE("group->SMDSGroup().GetType()==SMDSAbs_Node: " << (groupDS->GetType()==SMDSAbs_Node));
+ MESSAGE("currentEnfVertex->grpName.compare(group->GetStoreName())==0: " << (currentEnfVertex->grpName.compare(group->GetName())==0));
+ if ( groupDS->GetType()==SMDSAbs_Node && currentEnfVertex->grpName.compare(group->GetName())==0) {
+ SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( groupDS );