From 81a42f6507af7d522109aeec1d2d107988d01ff6 Mon Sep 17 00:00:00 2001 From: enk Date: Fri, 18 Feb 2005 07:32:07 +0000 Subject: [PATCH] Added support for polygones and polyhedres --- src/DriverMED/DriverMED_Family.cxx | 9 +- src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx | 157 +++++++++++- src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx | 269 +++++++++++++------- src/OBJECT/SMESH_Actor.cxx | 1 + src/OBJECT/SMESH_Object.cxx | 185 ++++++++++---- src/SMDS/Makefile.in | 4 + src/SMDS/SMDS_Mesh.cxx | 195 +++++++++++++- src/SMDS/SMDS_Mesh.hxx | 25 ++ src/SMDS/SMDS_MeshElement.hxx | 2 + src/SMDS/SMDS_MeshGroup.cxx | 2 +- src/SMDS/SMDS_PolygonalFaceOfNodes.cxx | 174 +++++++++++++ src/SMDS/SMDS_PolygonalFaceOfNodes.hxx | 60 +++++ src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx | 180 +++++++++++++ src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx | 72 ++++++ src/SMESHDS/SMESHDS_Command.cxx | 83 +++++- src/SMESHDS/SMESHDS_Command.hxx | 9 + src/SMESHDS/SMESHDS_CommandType.hxx | 3 + src/SMESHDS/SMESHDS_Mesh.cxx | 123 ++++++++- src/SMESHDS/SMESHDS_Mesh.hxx | 25 ++ src/SMESHDS/SMESHDS_Script.cxx | 33 +++ src/SMESHDS/SMESHDS_Script.hxx | 13 +- src/SMESHGUI/SMESHGUI.cxx | 6 + src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx | 76 ++++-- src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h | 1 + src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx | 16 ++ src/SMESHGUI/SMESHGUI_MeshInfosDlg.h | 2 + src/SMESHGUI/SMESH_icons.po | 8 + src/SMESHGUI/SMESH_msg_en.po | 16 ++ 28 files changed, 1581 insertions(+), 168 deletions(-) create mode 100644 src/SMDS/SMDS_PolygonalFaceOfNodes.cxx create mode 100644 src/SMDS/SMDS_PolygonalFaceOfNodes.hxx create mode 100644 src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx create mode 100644 src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx index 2115c4e8b..207571d5e 100644 --- a/src/DriverMED/DriverMED_Family.cxx +++ b/src/DriverMED/DriverMED_Family.cxx @@ -223,9 +223,12 @@ DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper, aValue = aStr.str(); - MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description, - MED::TIntVector anAttrIds (1, myId); // Id=0, - MED::TIntVector anAttrVals (1, myId); // Value=0 + MED::TStringVector anAttrDescs; + MED::TIntVector anAttrIds; + MED::TIntVector anAttrVals; + //MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description, + //MED::TIntVector anAttrIds (1, myId); // Id=0, + //MED::TIntVector anAttrVals (1, myId); // Value=0 MED::PFamilyInfo anInfo = theWrapper->CrFamilyInfo(theMeshInfo, aValue, diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index 1433e3208..6f44c4e8b 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -268,7 +268,160 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform() MED::TGeom::const_iterator anTGeomIter = aTGeom.begin(); for(; anTGeomIter != aTGeom.end(); anTGeomIter++){ const EGeometrieElement& aGeom = anTGeomIter->first; - if(aGeom == ePOINT1) continue; + + if (aGeom == ePOINT1) { + continue; + + } else if (aGeom == ePOLYGONE) { + PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom); + EBooleen anIsElemNum = takeNumbers ? aPolygoneInfo->IsElemNum() : eFAUX; + + TElemNum aConn = aPolygoneInfo->GetConnectivite(); + TElemNum aIndex = aPolygoneInfo->GetIndex(); + + TInt nbPolygons = aPolygoneInfo->GetNbElem(); + for (TInt iPG = 0; iPG < nbPolygons; iPG++) { + // get nodes + TInt aCurrPG_FirstNodeIndex = aIndex[iPG] - 1; + int aNbNodes = aPolygoneInfo->GetNbConn(iPG); + std::vector nodes_ids (aNbNodes); + for (TInt inode = 0; inode < aNbNodes; inode++) { + nodes_ids[inode] = aConn[aCurrPG_FirstNodeIndex + inode]; + } + + bool isRenum = false; + SMDS_MeshElement* anElement = NULL; + TInt aFamNum = aPolygoneInfo->GetFamNum(iPG); + + try { + if (anIsElemNum) { + anElement = myMesh->AddPolygonalFaceWithID + (nodes_ids, aPolygoneInfo->GetElemNum(iPG)); + } + if (!anElement) { + std::vector nodes (aNbNodes); + for (int inode = 0; inode < aNbNodes; inode++) { + nodes[inode] = FindNode(myMesh, nodes_ids[inode]); + } + anElement = myMesh->AddPolygonalFace(nodes); + isRenum = anIsElemNum; + } + + } catch (const std::exception& exc) { + aResult = DRS_FAIL; + INFOS("Follow exception was cought:\n\t"<more(); iElem++){ const SMDS_MeshFace* anElem = anIter->next(); TInt aNbNodes = anElem->NbNodes(); @@ -448,41 +460,42 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() MED::TIntVector* anElemNums; MED::TIntVector* aFamilyNums; MED::TIntVector* aConnectivity; - switch(aNbNodes){ - case 3: - aNbConnectivity = aNbTriaConn; - anElemNums = &anTriaElemNums; - aFamilyNums = &aTriaFamilyNums; - aConnectivity = &aTriaConn; - break; - case 4: - aNbConnectivity = aNbQuadConn; - anElemNums = &aQuadElemNums; - aFamilyNums = &aQuadFamilyNums; - aConnectivity = &aQuadConn; - break; - } + if (anElem->IsPoly()) { + aNbConnectivity = aNbNodes; + anElemNums = &aPolygoneElemNums; + aFamilyNums = &aPolygoneFamilyNums; + aConnectivity = &aPolygoneConn; + } else { + switch(aNbNodes){ + case 3: + aNbConnectivity = aNbTriaConn; + anElemNums = &anTriaElemNums; + aFamilyNums = &aTriaFamilyNums; + aConnectivity = &aTriaConn; + break; + case 4: + aNbConnectivity = aNbQuadConn; + anElemNums = &aQuadElemNums; + aFamilyNums = &aQuadFamilyNums; + aConnectivity = &aQuadConn; + break; + default: + break; + } + } MED::TIntVector aVector(aNbNodes); for(TInt iNode = 0; aNodesIter->more(); iNode++){ const SMDS_MeshElement* aNode = aNodesIter->next(); +#ifdef _EDF_NODE_IDS_ + aVector[iNode] = aNodeIdMap[aNode->GetID()]; +#else aVector[iNode] = aNode->GetID(); +#endif } TInt aSize = aConnectivity->size(); aConnectivity->resize(aSize+aNbConnectivity); - // There is some differnce between SMDS and MED in cells mapping -#ifdef _EDF_NODE_IDS_ - switch(aNbNodes){ - case 4: - (*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]]; - (*aConnectivity)[aSize+1] = aNodeIdMap[aVector[1]]; - (*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]]; - (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]]; - default: - for(TInt iNode = 0; iNode < aNbNodes; iNode++) - (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]]; - } -#else + // There is some differences between SMDS and MED in cells mapping switch(aNbNodes){ case 4: (*aConnectivity)[aSize+0] = aVector[0]; @@ -493,7 +506,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() for(TInt iNode = 0; iNode < aNbNodes; iNode++) (*aConnectivity)[aSize+iNode] = aVector[iNode]; } -#endif + + if (anElem->IsPoly()) { + // fill indices for polygonal element + TInt aPrevPos = aPolygoneInds.back(); + aPolygoneInds.push_back(aPrevPos + aNbNodes); + } + anElemNums->push_back(anElem->GetID()); if (anElemFamMap.find(anElem) != anElemFamMap.end()) @@ -523,6 +542,22 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() MESSAGE("Perform - anEntity = "<NbFaces(); + for (int iface = 1; iface <= aNbFaces; iface++) { + int aNbFaceNodes = aPolyedre->NbFaceNodes(iface); + for (int inode = 1; inode <= aNbFaceNodes; inode++) { + aNodeId = aPolyedre->GetFaceNode(iface, inode)->GetID(); #ifdef _EDF_NODE_IDS_ - switch(aNbNodes){ - case 5: - (*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]]; - (*aConnectivity)[aSize+1] = aNodeIdMap[aVector[3]]; - (*aConnectivity)[aSize+2] = aNodeIdMap[aVector[2]]; - (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]]; - (*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]]; - default: - for(TInt iNode = 0; iNode < aNbNodes; iNode++) - (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]]; - } + aPolyedreConn.push_back(aNodeIdMap[aNodeId]); #else - switch(aNbNodes){ - case 5: - (*aConnectivity)[aSize+0] = aVector[0]; - (*aConnectivity)[aSize+1] = aVector[3]; - (*aConnectivity)[aSize+2] = aVector[2]; - (*aConnectivity)[aSize+3] = aVector[1]; - (*aConnectivity)[aSize+4] = aVector[4]; - default: - for(TInt iNode = 0; iNode < aNbNodes; iNode++) - (*aConnectivity)[aSize+iNode] = aVector[iNode]; - } + aPolyedreConn.push_back(aNodeId); #endif - anElemNums->push_back(anElem->GetID()); + } + TInt aPrevPos = aPolyedreFaces.back(); + aPolyedreFaces.push_back(aPrevPos + aNbFaceNodes); + } + TInt aPrevPos = aPolyedreInds.back(); + aPolyedreInds.push_back(aPrevPos + aNbFaces); + + } else { + TInt aNbNodes = anElem->NbNodes(); + SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); + TInt aNbConnectivity; + MED::TIntVector* aConnectivity; + switch(aNbNodes){ + case 4: + aNbConnectivity = aNbTetraConn; + anElemNums = &anTetraElemNums; + aFamilyNums = &aTetraFamilyNums; + aConnectivity = &aTetraConn; + break; + case 5: + aNbConnectivity = aNbPyraConn; + anElemNums = &anPyraElemNums; + aFamilyNums = &aPyraFamilyNums; + aConnectivity = &aPyraConn; + break; + case 6: + aNbConnectivity = aNbPentaConn; + anElemNums = &anPentaElemNums; + aFamilyNums = &aPentaFamilyNums; + aConnectivity = &aPentaConn; + break; + case 8: + aNbConnectivity = aNbHexaConn; + anElemNums = &aHexaElemNums; + aFamilyNums = &aHexaFamilyNums; + aConnectivity = &aHexaConn; + } + + TInt aSize = aConnectivity->size(); + aConnectivity->resize(aSize + aNbConnectivity); + + MED::TIntVector aVector(aNbNodes); + for(TInt iNode = 0; aNodesIter->more(); iNode++){ + const SMDS_MeshElement* aNode = aNodesIter->next(); +#ifdef _EDF_NODE_IDS_ + aVector[iNode] = aNodeIdMap[aNode->GetID()]; +#else + aVector[iNode] = aNode->GetID(); +#endif + } + // There is some difference between SMDS and MED in cells mapping + switch(aNbNodes){ + case 5: + (*aConnectivity)[aSize+0] = aVector[0]; + (*aConnectivity)[aSize+1] = aVector[3]; + (*aConnectivity)[aSize+2] = aVector[2]; + (*aConnectivity)[aSize+3] = aVector[1]; + (*aConnectivity)[aSize+4] = aVector[4]; + default: + for(TInt iNode = 0; iNode < aNbNodes; iNode++) + (*aConnectivity)[aSize+iNode] = aVector[iNode]; + } + } + + anElemNums->push_back(anElem->GetID()); if (anElemFamMap.find(anElem) != anElemFamMap.end()) aFamilyNums->push_back(anElemFamMap[anElem]); @@ -682,6 +754,23 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() MESSAGE("Perform - anEntity = "<RegisterCellsWithType(VTK_HEXAHEDRON); aFilter->RegisterCellsWithType(VTK_WEDGE); aFilter->RegisterCellsWithType(VTK_PYRAMID); + aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); //Definition 1D divice of the actor diff --git a/src/OBJECT/SMESH_Object.cxx b/src/OBJECT/SMESH_Object.cxx index 4b43e56ac..5d3e5622e 100644 --- a/src/OBJECT/SMESH_Object.cxx +++ b/src/OBJECT/SMESH_Object.cxx @@ -160,6 +160,30 @@ namespace{ } + inline void AddPolygonsWithID(SMDS_Mesh* theMesh, + SMESH::log_array_var& theSeq, + CORBA::Long theId) + { + const SMESH::long_array& anIndexes = theSeq[theId].indexes; + CORBA::Long anIndexId = 0, aNbElems = theSeq[theId].number; + + for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++) { + int aFaceId = anIndexes[anIndexId++]; + + int aNbNodes = anIndexes[anIndexId++]; + std::vector nodes_ids (aNbNodes); + for (int i = 0; i < aNbNodes; i++) { + nodes_ids[i] = anIndexes[anIndexId++]; + } + + SMDS_MeshElement* anElem = theMesh->AddPolygonalFaceWithID(nodes_ids, aFaceId); + if (!anElem) + EXCEPTION(runtime_error, "SMDS_Mesh::FindElement - cannot AddPolygonalFaceWithID for ID = " + << anElemId); + } + } + + inline void AddTetrasWithID(SMDS_Mesh* theMesh, SMESH::log_array_var& theSeq, CORBA::Long theId) @@ -175,7 +199,7 @@ namespace{ anIndexes[anIndexId+4], anIndexes[anIndexId]); if(!anElem) - EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<0){ for( vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++ ) SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]); - + } break; } default: @@ -581,7 +673,7 @@ void SMESH_VisualObjDef::buildElemPrs() } aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( getCellType( aType, aNbNodes ) ); + aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(),aNbNodes ) ); iElem++; } @@ -694,25 +786,27 @@ void SMESH_MeshObj::Update( int theIsClear ) if( !aLength ) return; - + for ( CORBA::Long anId = 0; anId < aLength; anId++) { const SMESH::double_array& aCoords = aSeq[anId].coords; const SMESH::long_array& anIndexes = aSeq[anId].indexes; CORBA::Long anElemId = 0, aNbElems = aSeq[anId].number; CORBA::Long aCommand = aSeq[anId].commandType; - + switch(aCommand) { - case SMESH::ADD_NODE : AddNodesWithID ( myMesh, aSeq, anId ); break; - case SMESH::ADD_EDGE : AddEdgesWithID ( myMesh, aSeq, anId ); break; - case SMESH::ADD_TRIANGLE : AddTriasWithID ( myMesh, aSeq, anId ); break; - case SMESH::ADD_QUADRANGLE : AddQuadsWithID ( myMesh, aSeq, anId ); break; - case SMESH::ADD_TETRAHEDRON: AddTetrasWithID ( myMesh, aSeq, anId ); break; - case SMESH::ADD_PYRAMID : AddPiramidsWithID( myMesh, aSeq, anId ); break; - case SMESH::ADD_PRISM : AddPrismsWithID ( myMesh, aSeq, anId ); break; - case SMESH::ADD_HEXAHEDRON : AddHexasWithID ( myMesh, aSeq, anId ); break; - + case SMESH::ADD_NODE : AddNodesWithID ( myMesh, aSeq, anId ); break; + case SMESH::ADD_EDGE : AddEdgesWithID ( myMesh, aSeq, anId ); break; + case SMESH::ADD_TRIANGLE : AddTriasWithID ( myMesh, aSeq, anId ); break; + case SMESH::ADD_QUADRANGLE : AddQuadsWithID ( myMesh, aSeq, anId ); break; + case SMESH::ADD_POLYGON : AddPolygonsWithID ( myMesh, aSeq, anId ); break; + case SMESH::ADD_TETRAHEDRON: AddTetrasWithID ( myMesh, aSeq, anId ); break; + case SMESH::ADD_PYRAMID : AddPiramidsWithID ( myMesh, aSeq, anId ); break; + case SMESH::ADD_PRISM : AddPrismsWithID ( myMesh, aSeq, anId ); break; + case SMESH::ADD_HEXAHEDRON : AddHexasWithID ( myMesh, aSeq, anId ); break; + case SMESH::ADD_POLYHEDRON : AddPolyhedronsWithID( myMesh, aSeq, anId ); break; + case SMESH::REMOVE_NODE: for( ; anElemId < aNbElems; anElemId++ ) myMesh->RemoveNode( FindNode( myMesh, anIndexes[anElemId] ) ); @@ -749,6 +843,9 @@ void SMESH_MeshObj::Update( int theIsClear ) } break; + case SMESH::CHANGE_POLYHEDRON_NODES: + ChangePolyhedronNodes(myMesh, aSeq, anId); + break; case SMESH::RENUMBER: for(CORBA::Long i=0; anElemId < aNbElems; anElemId++, i+=3) { diff --git a/src/SMDS/Makefile.in b/src/SMDS/Makefile.in index d64abd6fe..e066e25e0 100644 --- a/src/SMDS/Makefile.in +++ b/src/SMDS/Makefile.in @@ -55,8 +55,10 @@ LIB_SRC = \ SMDS_IteratorOfElements.cxx \ SMDS_VolumeOfFaces.cxx \ SMDS_VolumeOfNodes.cxx \ + SMDS_PolyhedralVolumeOfNodes.cxx \ SMDS_FaceOfEdges.cxx \ SMDS_FaceOfNodes.cxx \ + SMDS_PolygonalFaceOfNodes.cxx \ SMDS_VolumeTool.cxx # SMDS_Tria3OfNodes.cxx \ # SMDS_HexahedronOfNodes.cxx @@ -107,8 +109,10 @@ EXPORT_HEADERS= \ SMDS_IteratorOfElements.hxx \ SMDS_VolumeOfFaces.hxx \ SMDS_VolumeOfNodes.hxx \ + SMDS_PolyhedralVolumeOfNodes.hxx \ SMDS_FaceOfEdges.hxx \ SMDS_FaceOfNodes.hxx \ + SMDS_PolygonalFaceOfNodes.hxx \ SMDS_VolumeTool.hxx # SMDS_Tria3OfNodes.hxx \ # SMDS_HexahedronOfNodes.hxx diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 763d61c47..e6751c3f0 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -29,6 +29,8 @@ #include "SMDS_VolumeOfFaces.hxx" #include "SMDS_FaceOfNodes.hxx" #include "SMDS_FaceOfEdges.hxx" +#include "SMDS_PolyhedralVolumeOfNodes.hxx" +#include "SMDS_PolygonalFaceOfNodes.hxx" #include #include @@ -786,6 +788,126 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1, return volume; } +/////////////////////////////////////////////////////////////////////////////// +/// Add a polygon defined by its nodes IDs +/////////////////////////////////////////////////////////////////////////////// + +SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID (std::vector nodes_ids, + const int ID) +{ + int nbNodes = nodes_ids.size(); + std::vector nodes (nbNodes); + for (int i = 0; i < nbNodes; i++) { + nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]); + if (!nodes[i]) return NULL; + } + return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID); +} + +/////////////////////////////////////////////////////////////////////////////// +/// Add a polygon defined by its nodes +/////////////////////////////////////////////////////////////////////////////// + +SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID + (std::vector nodes, + const int ID) +{ + SMDS_MeshFace * face; + + if (hasConstructionEdges()) + { + MESSAGE("Error : Not implemented"); + return NULL; + } + else + { + face = new SMDS_PolygonalFaceOfNodes(nodes); + myFaces.Add(face); + } + + if (!registerElement(ID, face)) { + RemoveElement(face, false); + face = NULL; + } + return face; +} + +/////////////////////////////////////////////////////////////////////////////// +/// Add a polygon defined by its nodes. +/// An ID is automatically affected to the created face. +/////////////////////////////////////////////////////////////////////////////// + +SMDS_MeshFace* SMDS_Mesh::AddPolygonalFace (std::vector nodes) +{ + return SMDS_Mesh::AddPolygonalFaceWithID(nodes, myElementIDFactory->GetFreeID()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// Create a new polyhedral volume and add it to the mesh. +/// @param ID The ID of the new volume +/// @return The created volume or NULL if an element with this ID already exists +/// or if input nodes are not found. +/////////////////////////////////////////////////////////////////////////////// + +SMDS_MeshVolume * SMDS_Mesh::AddPolyhedralVolumeWithID + (std::vector nodes_ids, + std::vector quantities, + const int ID) +{ + int nbNodes = nodes_ids.size(); + std::vector nodes (nbNodes); + for (int i = 0; i < nbNodes; i++) { + nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]); + if (!nodes[i]) return NULL; + } + return SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID); +} + +/////////////////////////////////////////////////////////////////////////////// +/// Create a new polyhedral volume and add it to the mesh. +/// @param ID The ID of the new volume +/// @return The created volume +/////////////////////////////////////////////////////////////////////////////// + +SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolumeWithID + (std::vector nodes, + std::vector quantities, + const int ID) +{ + SMDS_MeshVolume* volume; + if (hasConstructionFaces()) { + MESSAGE("Error : Not implemented"); + return NULL; + } else if (hasConstructionEdges()) { + MESSAGE("Error : Not implemented"); + return NULL; + } else { + volume = new SMDS_PolyhedralVolumeOfNodes(nodes, quantities); + myVolumes.Add(volume); + } + + if (!registerElement(ID, volume)) { + RemoveElement(volume, false); + volume = NULL; + } + return volume; +} + +/////////////////////////////////////////////////////////////////////////////// +/// Create a new polyhedral volume and add it to the mesh. +/// @return The created volume +/////////////////////////////////////////////////////////////////////////////// + +SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolume + (std::vector nodes, + std::vector quantities) +{ + int ID = myElementIDFactory->GetFreeID(); + SMDS_MeshVolume * v = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID); + if (v == NULL) myElementIDFactory->ReleaseID(ID); + return v; +} + /////////////////////////////////////////////////////////////////////////////// /// Registers element with the given ID, maintains inverse connections /////////////////////////////////////////////////////////////////////////////// @@ -966,10 +1088,25 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem, } case SMDSAbs_Face: { const SMDS_FaceOfNodes* face = dynamic_cast( elem ); - if ( face ) + if ( face ) { Ok = const_cast( face )->ChangeNodes( nodes, nbnodes ); + } else { + /// ??? begin + const SMDS_PolygonalFaceOfNodes* face = dynamic_cast(elem); + if (face) { + Ok = const_cast(face)->ChangeNodes(nodes, nbnodes); + } + /// ??? end + } break; } + //case SMDSAbs_PolygonalFace: { + // const SMDS_PolygonalFaceOfNodes* face = dynamic_cast(elem); + // if (face) { + // Ok = const_cast(face)->ChangeNodes(nodes, nbnodes); + // } + // break; + //} case SMDSAbs_Volume: { const SMDS_VolumeOfNodes* vol = dynamic_cast( elem ); if ( vol ) @@ -1007,6 +1144,62 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem, return Ok; } +//======================================================================= +//function : ChangePolyhedronNodes +//purpose : to change nodes of polyhedral volume +//======================================================================= +bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement * elem, + std::vector nodes, + std::vector quantities) +{ + if (elem->GetType() != SMDSAbs_Volume) { + MESSAGE("WRONG ELEM TYPE"); + return false; + } + + const SMDS_PolyhedralVolumeOfNodes* vol = dynamic_cast(elem); + if (!vol) { + return false; + } + + // keep current nodes of elem + set oldNodes; + SMDS_ElemIteratorPtr itn = elem->nodesIterator(); + while (itn->more()) { + oldNodes.insert(itn->next()); + } + + // change nodes + bool Ok = const_cast(vol)->ChangeNodes(nodes, quantities); + if (!Ok) { + return false; + } + + // update InverseElements + + // AddInverseElement to new nodes + int nbnodes = nodes.size(); + for (int i = 0; i < nbnodes; i++) { + if (oldNodes.find(nodes[i]) == oldNodes.end()) { + // new node + const_cast(nodes[i])->AddInverseElement(elem); + } else { + // remove from oldNodes a node that remains in elem + oldNodes.erase(nodes[i]); + } + } + + // RemoveInverseElement from the nodes removed from elem + set::iterator it; + for (it = oldNodes.begin(); it != oldNodes.end(); it++) { + SMDS_MeshNode * n = static_cast + (const_cast( *it )); + n->RemoveInverseElement(elem); + } + + return Ok; +} + //======================================================================= //function : FindEdge //purpose : diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx index 1aa9dda92..6f693dc57 100644 --- a/src/SMDS/SMDS_Mesh.hxx +++ b/src/SMDS/SMDS_Mesh.hxx @@ -201,6 +201,28 @@ public: const SMDS_MeshFace * f5, const SMDS_MeshFace * f6); + virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector nodes_ids, + const int ID); + + virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector nodes, + const int ID); + + virtual SMDS_MeshFace* AddPolygonalFace (std::vector nodes); + + virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID + (std::vector nodes_ids, + std::vector quantities, + const int ID); + + virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID + (std::vector nodes, + std::vector quantities, + const int ID); + + virtual SMDS_MeshVolume* AddPolyhedralVolume + (std::vector nodes, + std::vector quantities); + virtual void RemoveElement(const SMDS_MeshElement * elem, std::list& removedElems, std::list& removedNodes, @@ -217,6 +239,9 @@ public: static bool ChangeElementNodes(const SMDS_MeshElement * elem, const SMDS_MeshNode * nodes[], const int nbnodes); + static bool ChangePolyhedronNodes(const SMDS_MeshElement * elem, + std::vector nodes, + std::vector quantities); virtual void Renumber (const bool isNodes, const int startID = 1, const int deltaID = 1); // Renumber all nodes or elements. diff --git a/src/SMDS/SMDS_MeshElement.hxx b/src/SMDS/SMDS_MeshElement.hxx index 3d9d13afe..b9f61351b 100644 --- a/src/SMDS/SMDS_MeshElement.hxx +++ b/src/SMDS/SMDS_MeshElement.hxx @@ -59,6 +59,8 @@ class SMDS_MeshElement:public SMDS_MeshObject ///Return the type of the current element virtual SMDSAbs_ElementType GetType() const = 0; + virtual bool IsPoly() const { return false; }; + friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *); friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem); diff --git a/src/SMDS/SMDS_MeshGroup.cxx b/src/SMDS/SMDS_MeshGroup.cxx index 0acb246a8..0cb481c50 100644 --- a/src/SMDS/SMDS_MeshGroup.cxx +++ b/src/SMDS/SMDS_MeshGroup.cxx @@ -125,7 +125,7 @@ void SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem) // the type of the group is determined by the first element added if (myElements.empty()) myType = theElem->GetType(); else if (theElem->GetType() != myType) - MESSAGE("SMDS_MeshGroup::Add : Type Mismatch"); + MESSAGE("SMDS_MeshGroup::Add : Type Mismatch "<GetType()<<"!="< nodes) +{ + myNodes = nodes; +} + +//======================================================================= +//function : GetType +//purpose : +//======================================================================= +SMDSAbs_ElementType SMDS_PolygonalFaceOfNodes::GetType() const +{ + return SMDSAbs_Face; + //return SMDSAbs_PolygonalFace; +} + +//======================================================================= +//function : ChangeNodes +//purpose : +//======================================================================= +bool SMDS_PolygonalFaceOfNodes::ChangeNodes (std::vector nodes) +{ + if (nodes.size() < 3) + return false; + + myNodes = nodes; + + return true; +} + +//======================================================================= +//function : ChangeNodes +//purpose : to support the same interface, as SMDS_FaceOfNodes +//======================================================================= +bool SMDS_PolygonalFaceOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[], + const int nbNodes) +{ + if (nbNodes < 3) + return false; + + myNodes.resize(nbNodes); + int i = 0; + for (; i < nbNodes; i++) { + myNodes[i] = nodes[i]; + } + + return true; +} + +//======================================================================= +//function : NbNodes +//purpose : +//======================================================================= +int SMDS_PolygonalFaceOfNodes::NbNodes() const +{ + return myNodes.size(); +} + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= +int SMDS_PolygonalFaceOfNodes::NbEdges() const +{ + return NbNodes(); +} + +//======================================================================= +//function : NbFaces +//purpose : +//======================================================================= +int SMDS_PolygonalFaceOfNodes::NbFaces() const +{ + return 1; +} + +//======================================================================= +//function : Print +//purpose : +//======================================================================= +void SMDS_PolygonalFaceOfNodes::Print(ostream & OS) const +{ + OS << "polygonal face <" << GetID() << " > : "; + int i, nbNodes = myNodes.size(); + for (i = 0; i < nbNodes - 1; i++) + OS << myNodes[i] << ","; + OS << myNodes[i] << ") " << endl; +} + +//======================================================================= +//function : elementsIterator +//purpose : +//======================================================================= +class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_ElemIterator +{ + //const SMDS_MeshNode* const *mySet; + const std::vector mySet; + //int myLength; + int index; + public: + //SMDS_PolygonalFaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l): + // mySet(s),myLength(l),index(0) {} + SMDS_PolygonalFaceOfNodes_MyIterator(const std::vector s): + mySet(s),index(0) {} + + bool more() + { + return index < mySet.size(); + } + + const SMDS_MeshElement* next() + { + index++; + return mySet[index-1]; + } +}; + +SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator + (SMDSAbs_ElementType type) const +{ + switch(type) + { + case SMDSAbs_Face: + return SMDS_MeshElement::elementsIterator(SMDSAbs_Face); + case SMDSAbs_Node: + return SMDS_ElemIteratorPtr(new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes)); + case SMDSAbs_Edge: + MESSAGE("Error : edge iterator for SMDS_PolygonalFaceOfNodes not implemented"); + break; + default: + return SMDS_ElemIteratorPtr + (new SMDS_IteratorOfElements + (this,type,SMDS_ElemIteratorPtr + (new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes)))); + } + return SMDS_ElemIteratorPtr(); +} diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx new file mode 100644 index 000000000..567746259 --- /dev/null +++ b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx @@ -0,0 +1,60 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#ifndef _SMDS_PolygonalFaceOfNodes_HeaderFile +#define _SMDS_PolygonalFaceOfNodes_HeaderFile + +#include "SMDS_MeshFace.hxx" +//#include "SMDS_FaceOfNodes.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_Iterator.hxx" + +#include + +//class SMDS_PolygonalFaceOfNodes:public SMDS_FaceOfNodes +class SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace +{ + public: + SMDS_PolygonalFaceOfNodes (std::vector nodes); + + virtual SMDSAbs_ElementType GetType() const; + virtual bool IsPoly() const { return true; }; + + bool ChangeNodes (std::vector nodes); + + bool ChangeNodes (const SMDS_MeshNode* nodes[], + const int nbNodes); + // to support the same interface, as SMDS_FaceOfNodes + + virtual int NbNodes() const; + virtual int NbEdges() const; + virtual int NbFaces() const; + + virtual void Print (std::ostream & OS) const; + + protected: + virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const; + + private: + std::vector myNodes; +}; + +#endif diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx new file mode 100644 index 000000000..e2b81ffe5 --- /dev/null +++ b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx @@ -0,0 +1,180 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#ifdef _MSC_VER +#pragma warning(disable:4786) +#endif + +#include "SMDS_PolyhedralVolumeOfNodes.hxx" +#include "SMDS_MeshNode.hxx" +#include "utilities.h" + +#include + +using namespace std; + +//======================================================================= +//function : Constructor +//purpose : Create a volume of many faces +//======================================================================= +SMDS_PolyhedralVolumeOfNodes::SMDS_PolyhedralVolumeOfNodes + (std::vector nodes, + std::vector quantities) +: SMDS_VolumeOfNodes(NULL, NULL, NULL, NULL) +{ + ChangeNodes(nodes, quantities); +} + +//======================================================================= +//function : GetType +//purpose : +//======================================================================= +SMDSAbs_ElementType SMDS_PolyhedralVolumeOfNodes::GetType() const +{ +// return SMDSAbs_PolyhedralVolume; + return SMDSAbs_Volume; +} + +//======================================================================= +//function : ChangeNodes +//purpose : +//======================================================================= +bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector nodes, + std::vector quantities) +{ + myNodesByFaces = nodes; + myQuantities = quantities; + + // Init fields of parent class + int aNbNodes = 0; + std::set aSet; + int nodes_len = nodes.size(); + for (int j = 0; j < nodes_len; j++) { + if (aSet.find(nodes[j]) == aSet.end()) { + aSet.insert(nodes[j]); + aNbNodes++; + } + } + + int k = 0; + const SMDS_MeshNode* aNodes [aNbNodes]; + std::set::iterator anIter = aSet.begin(); + for (; anIter != aSet.end(); anIter++, k++) { + aNodes[k] = *anIter; + } + + //SMDS_VolumeOfNodes::ChangeNodes(aNodes, aNbNodes); + delete [] myNodes; + myNbNodes = aNbNodes; + myNodes = new const SMDS_MeshNode* [myNbNodes]; + for (int i = 0; i < myNbNodes; i++) { + myNodes[i] = aNodes[i]; + } + + return true; +} + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= +int SMDS_PolyhedralVolumeOfNodes::NbEdges() const +{ + int nbEdges = 0; + + for (int ifa = 0; ifa < myQuantities.size(); ifa++) { + nbEdges += myQuantities[ifa]; + } + nbEdges /= 2; + + return nbEdges; +} + +//======================================================================= +//function : NbFaces +//purpose : +//======================================================================= +int SMDS_PolyhedralVolumeOfNodes::NbFaces() const +{ + return myQuantities.size(); +} + +//======================================================================= +//function : NbFaceNodes +//purpose : +//======================================================================= +int SMDS_PolyhedralVolumeOfNodes::NbFaceNodes (const int face_ind) const +{ + if (face_ind < 1 || myQuantities.size() < face_ind) + return 0; + return myQuantities[face_ind - 1]; +} + +//======================================================================= +//function : GetFaceNode +//purpose : +//======================================================================= +const SMDS_MeshNode* SMDS_PolyhedralVolumeOfNodes::GetFaceNode (const int face_ind, + const int node_ind) const +{ + if (node_ind < 1 || NbFaceNodes(face_ind) < node_ind) + return NULL; + + int i, first_node = 0; + for (i = 0; i < face_ind - 1; i++) { + first_node += myQuantities[i]; + } + + return myNodesByFaces[first_node + node_ind - 1]; +} + +//======================================================================= +//function : Print +//purpose : +//======================================================================= +void SMDS_PolyhedralVolumeOfNodes::Print (ostream & OS) const +{ + OS << "polyhedral volume <" << GetID() << "> : "; + + int faces_len = myQuantities.size(); + //int nodes_len = myNodesByFaces.size(); + int cur_first_node = 0; + + int i, j; + for (i = 0; i < faces_len; i++) { + OS << "face_" << i << " ("; + for (j = 0; j < myQuantities[i] - 1; j++) { + OS << myNodesByFaces[cur_first_node + j] << ","; + } + OS << myNodesByFaces[cur_first_node + j] << ") "; + cur_first_node += myQuantities[i]; + } +} + +//======================================================================= +//function : ChangeNodes +//purpose : usage disabled +//======================================================================= +bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[], + const int nbNodes) +{ + return false; +} diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx new file mode 100644 index 000000000..d7cfeeed5 --- /dev/null +++ b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx @@ -0,0 +1,72 @@ +// SMESH SMDS : implementaion of Salome mesh data structure +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SMDS_PolyhedralVolumeOfNodes.hxx +// Module : SMESH + +#ifndef _SMDS_PolyhedralVolumeOfNodes_HeaderFile +#define _SMDS_PolyhedralVolumeOfNodes_HeaderFile + +#include "SMDS_VolumeOfNodes.hxx" + +class SMDS_PolyhedralVolumeOfNodes:public SMDS_VolumeOfNodes +{ + public: + SMDS_PolyhedralVolumeOfNodes (std::vector nodes, + std::vector quantities); + + //virtual ~SMDS_PolyhedralVolumeOfNodes(); + + virtual SMDSAbs_ElementType GetType() const; + virtual bool IsPoly() const { return true; }; + + bool ChangeNodes (std::vector nodes, + std::vector quantities); + + //virtual int NbNodes() const; + virtual int NbEdges() const; + virtual int NbFaces() const; + + int NbFaceNodes (const int face_ind) const; + // 1 <= face_ind <= NbFaces() + + const SMDS_MeshNode* GetFaceNode (const int face_ind, const int node_ind) const; + // 1 <= face_ind <= NbFaces() + // 1 <= node_ind <= NbFaceNodes() + + virtual void Print (std::ostream & OS) const; + + protected: + //virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const; + + private: + // usage disabled + bool ChangeNodes (const SMDS_MeshNode* nodes[], + const int nbNodes); + + private: + std::vector myNodesByFaces; + std::vector myQuantities; +}; + +#endif diff --git a/src/SMESHDS/SMESHDS_Command.cxx b/src/SMESHDS/SMESHDS_Command.cxx index 4e7dc3f3b..b55b5af1c 100644 --- a/src/SMESHDS/SMESHDS_Command.cxx +++ b/src/SMESHDS/SMESHDS_Command.cxx @@ -224,6 +224,57 @@ void SMESHDS_Command::AddVolume(int NewVolID, myNumber++; } +//======================================================================= +//function : AddPolygonalFace +//purpose : +//======================================================================= +void SMESHDS_Command::AddPolygonalFace (const int ElementID, + std::vector nodes_ids) +{ + if (!myType == SMESHDS_AddPolygon) { + MESSAGE("SMESHDS_Command::AddPolygonalFace : Bad Type"); + return; + } + myIntegers.push_back(ElementID); + + int i, nbNodes = nodes_ids.size(); + myIntegers.push_back(nbNodes); + for (i = 0; i < nbNodes; i++) { + myIntegers.push_back(nodes_ids[i]); + } + + myNumber++; +} + +//======================================================================= +//function : AddPolyhedralVolume +//purpose : +//======================================================================= +void SMESHDS_Command::AddPolyhedralVolume (const int ElementID, + std::vector nodes_ids, + std::vector quantities) +{ + if (!myType == SMESHDS_AddPolyhedron) { + MESSAGE("SMESHDS_Command::AddPolyhedralVolume : Bad Type"); + return; + } + myIntegers.push_back(ElementID); + + int i, nbNodes = nodes_ids.size(); + myIntegers.push_back(nbNodes); + for (i = 0; i < nbNodes; i++) { + myIntegers.push_back(nodes_ids[i]); + } + + int nbFaces = quantities.size(); + myIntegers.push_back(nbFaces); + for (i = 0; i < nbFaces; i++) { + myIntegers.push_back(quantities[i]); + } + + myNumber++; +} + //======================================================================= //function : //purpose : @@ -263,7 +314,7 @@ void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes { if (!myType == SMESHDS_ChangeElementNodes) { - MESSAGE("SMESHDS_Command::RemoveElement : Bad Type"); + MESSAGE("SMESHDS_Command::ChangeElementNodes : Bad Type"); return; } myIntegers.push_back(ElementID); @@ -274,6 +325,36 @@ void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes myNumber++; } +//======================================================================= +//function : ChangePolyhedronNodes +//purpose : +//======================================================================= +void SMESHDS_Command::ChangePolyhedronNodes (const int ElementID, + std::vector nodes_ids, + std::vector quantities) +{ + if (myType != SMESHDS_ChangePolyhedronNodes) + { + MESSAGE("SMESHDS_Command::ChangePolyhedronNodes : Bad Type"); + return; + } + myIntegers.push_back(ElementID); + + int i, nbNodes = nodes_ids.size(); + myIntegers.push_back(nbNodes); + for (i = 0; i < nbNodes; i++) { + myIntegers.push_back(nodes_ids[i]); + } + + int nbFaces = quantities.size(); + myIntegers.push_back(nbFaces); + for (i = 0; i < nbFaces; i++) { + myIntegers.push_back(quantities[i]); + } + + myNumber++; +} + //======================================================================= //function : Renumber //purpose : diff --git a/src/SMESHDS/SMESHDS_Command.hxx b/src/SMESHDS/SMESHDS_Command.hxx index b72b21b86..3ecd762f3 100644 --- a/src/SMESHDS/SMESHDS_Command.hxx +++ b/src/SMESHDS/SMESHDS_Command.hxx @@ -29,6 +29,7 @@ #include "SMESHDS_CommandType.hxx" #include +#include class SMESHDS_Command { @@ -48,10 +49,18 @@ class SMESHDS_Command int idnode4, int idnode5, int idnode6); void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3, int idnode4, int idnode5, int idnode6, int idnode7, int idnode8); + void AddPolygonalFace (const int ElementID, + std::vector nodes_ids); + void AddPolyhedralVolume (const int ElementID, + std::vector nodes_ids, + std::vector quantities); void MoveNode(int NewNodeID, double x, double y, double z); void RemoveNode(int NodeID); void RemoveElement(int ElementID); void ChangeElementNodes(int ElementID, int nodes[], int nbnodes); + void ChangePolyhedronNodes(const int ElementID, + std::vector nodes_ids, + std::vector quantities); void Renumber (const bool isNodes, const int startID, const int deltaID); SMESHDS_CommandType GetType(); int GetNumber(); diff --git a/src/SMESHDS/SMESHDS_CommandType.hxx b/src/SMESHDS/SMESHDS_CommandType.hxx index e906020cb..f2c505b1f 100644 --- a/src/SMESHDS/SMESHDS_CommandType.hxx +++ b/src/SMESHDS/SMESHDS_CommandType.hxx @@ -34,14 +34,17 @@ enum SMESHDS_CommandType { SMESHDS_AddEdge, SMESHDS_AddTriangle, SMESHDS_AddQuadrangle, + SMESHDS_AddPolygon, SMESHDS_AddTetrahedron, SMESHDS_AddPyramid, SMESHDS_AddPrism, SMESHDS_AddHexahedron, + SMESHDS_AddPolyhedron, SMESHDS_RemoveNode, SMESHDS_RemoveElement, SMESHDS_MoveNode, SMESHDS_ChangeElementNodes, + SMESHDS_ChangePolyhedronNodes, SMESHDS_Renumber }; diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 416da54aa..c0c758c74 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -171,8 +171,9 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem, if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes )) return false; - ASSERT( nbnodes < 9 ); - int i, IDs[ 8 ]; + //ASSERT( nbnodes < 9 ); + //int i, IDs[ 8 ]; + int i, IDs[ nbnodes ]; for ( i = 0; i < nbnodes; i++ ) IDs [ i ] = nodes[ i ]->GetID(); myScript->ChangeElementNodes( elem->GetID(), IDs, nbnodes); @@ -180,6 +181,30 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem, return true; } +//======================================================================= +//function : ChangePolyhedronNodes +//purpose : +//======================================================================= +bool SMESHDS_Mesh::ChangePolyhedronNodes + (const SMDS_MeshElement * elem, + std::vector nodes, + std::vector quantities) +{ + ASSERT(nodes.size() > 3); + + if (!SMDS_Mesh::ChangePolyhedronNodes(elem, nodes, quantities)) + return false; + + int i, len = nodes.size(); + std::vector nodes_ids (len); + for (i = 0; i < len; i++) { + nodes_ids[i] = nodes[i]->GetID(); + } + myScript->ChangePolyhedronNodes(elem->GetID(), nodes_ids, quantities); + + return true; +} + //======================================================================= //function : Renumber //purpose : @@ -472,6 +497,100 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1, n8->GetID()); return anElem; } + +//======================================================================= +//function : AddPolygonalFace +//purpose : +//======================================================================= +SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID (std::vector nodes_ids, + const int ID) +{ + SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes_ids, ID); + if (anElem) { + myScript->AddPolygonalFace(ID, nodes_ids); + } + return anElem; +} + +SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID + (std::vector nodes, + const int ID) +{ + SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID); + if (anElem) { + int i, len = nodes.size(); + std::vector nodes_ids (len); + for (i = 0; i < len; i++) { + nodes_ids[i] = nodes[i]->GetID(); + } + myScript->AddPolygonalFace(ID, nodes_ids); + } + return anElem; +} + +SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFace + (std::vector nodes) +{ + SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFace(nodes); + if (anElem) { + int i, len = nodes.size(); + std::vector nodes_ids (len); + for (i = 0; i < len; i++) { + nodes_ids[i] = nodes[i]->GetID(); + } + myScript->AddPolygonalFace(anElem->GetID(), nodes_ids); + } + return anElem; +} + +//======================================================================= +//function : AddPolyhedralVolume +//purpose : +//======================================================================= +SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID (std::vector nodes_ids, + std::vector quantities, + const int ID) +{ + SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes_ids, quantities, ID); + if (anElem) { + myScript->AddPolyhedralVolume(ID, nodes_ids, quantities); + } + return anElem; +} + +SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID + (std::vector nodes, + std::vector quantities, + const int ID) +{ + SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID); + if (anElem) { + int i, len = nodes.size(); + std::vector nodes_ids (len); + for (i = 0; i < len; i++) { + nodes_ids[i] = nodes[i]->GetID(); + } + myScript->AddPolyhedralVolume(ID, nodes_ids, quantities); + } + return anElem; +} + +SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolume + (std::vector nodes, + std::vector quantities) +{ + SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolume(nodes, quantities); + if (anElem) { + int i, len = nodes.size(); + std::vector nodes_ids (len); + for (i = 0; i < len; i++) { + nodes_ids[i] = nodes[i]->GetID(); + } + myScript->AddPolyhedralVolume(anElem->GetID(), nodes_ids, quantities); + } + return anElem; +} + //======================================================================= //function : removeFromContainers //purpose : diff --git a/src/SMESHDS/SMESHDS_Mesh.hxx b/src/SMESHDS/SMESHDS_Mesh.hxx index 459d30848..115ab3756 100644 --- a/src/SMESHDS/SMESHDS_Mesh.hxx +++ b/src/SMESHDS/SMESHDS_Mesh.hxx @@ -158,12 +158,37 @@ public: const SMDS_MeshNode * n7, const SMDS_MeshNode * n8); + virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector nodes_ids, + const int ID); + + virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector nodes, + const int ID); + + virtual SMDS_MeshFace* AddPolygonalFace (std::vector nodes); + + virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID + (std::vector nodes_ids, + std::vector quantities, + const int ID); + + virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID + (std::vector nodes, + std::vector quantities, + const int ID); + + virtual SMDS_MeshVolume* AddPolyhedralVolume + (std::vector nodes, + std::vector quantities); + void MoveNode(const SMDS_MeshNode *, double x, double y, double z); virtual void RemoveNode(const SMDS_MeshNode *); void RemoveElement(const SMDS_MeshElement *); bool ChangeElementNodes(const SMDS_MeshElement * elem, const SMDS_MeshNode * nodes[], const int nbnodes); + bool ChangePolyhedronNodes(const SMDS_MeshElement * elem, + std::vector nodes, + std::vector quantities); void Renumber (const bool isNodes, const int startID=1, const int deltaID=1); void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S); diff --git a/src/SMESHDS/SMESHDS_Script.cxx b/src/SMESHDS/SMESHDS_Script.cxx index 97e158432..369ab4697 100644 --- a/src/SMESHDS/SMESHDS_Script.cxx +++ b/src/SMESHDS/SMESHDS_Script.cxx @@ -148,6 +148,27 @@ void SMESHDS_Script::AddVolume(int NewID, idnode5, idnode6, idnode7, idnode8); } +//======================================================================= +//function : AddPolygonalFace +//purpose : +//======================================================================= +void SMESHDS_Script::AddPolygonalFace (int NewFaceID, std::vector nodes_ids) +{ + getCommand(SMESHDS_AddPolygon)->AddPolygonalFace(NewFaceID, nodes_ids); +} + +//======================================================================= +//function : AddPolyhedralVolume +//purpose : +//======================================================================= +void SMESHDS_Script::AddPolyhedralVolume (int NewID, + std::vector nodes_ids, + std::vector quantities) +{ + getCommand(SMESHDS_AddPolyhedron)->AddPolyhedralVolume + (NewID, nodes_ids, quantities); +} + //======================================================================= //function : //purpose : @@ -185,6 +206,18 @@ void SMESHDS_Script::ChangeElementNodes(int ElementID, int nodes[], int nbnodes) getCommand(SMESHDS_ChangeElementNodes)->ChangeElementNodes( ElementID, nodes, nbnodes ); } +//======================================================================= +//function : ChangePolyhedronNodes +//purpose : +//======================================================================= +void SMESHDS_Script::ChangePolyhedronNodes (const int ElementID, + std::vector nodes_ids, + std::vector quantities) +{ + getCommand(SMESHDS_ChangePolyhedronNodes)->ChangePolyhedronNodes + (ElementID, nodes_ids, quantities); +} + //======================================================================= //function : Renumber //purpose : diff --git a/src/SMESHDS/SMESHDS_Script.hxx b/src/SMESHDS/SMESHDS_Script.hxx index e51d3ec98..3874facfc 100644 --- a/src/SMESHDS/SMESHDS_Script.hxx +++ b/src/SMESHDS/SMESHDS_Script.hxx @@ -30,6 +30,7 @@ #include "SMESHDS_Command.hxx" #include +#include class SMESHDS_Script @@ -48,10 +49,20 @@ class SMESHDS_Script int idnode4, int idnode5, int idnode6); void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3, int idnode4, int idnode5, int idnode6, int idnode7, int idnode8); - void MoveNode(int NewNodeID, double x, double y, double z); + + void AddPolygonalFace (const int NewFaceID, + std::vector nodes_ids); + void AddPolyhedralVolume (const int NewVolID, + std::vector nodes_ids, + std::vector quantities); + + void MoveNode(int NewNodeID, double x, double y, double z); void RemoveNode(int NodeID); void RemoveElement(int ElementID); void ChangeElementNodes(int ElementID, int nodes[], int nbnodes); + void ChangePolyhedronNodes(const int ElementID, + std::vector nodes_ids, + std::vector quantities); void Renumber (const bool isNodes, const int startID, const int deltaID); void Clear(); const std::list & GetCommands(); diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index bf4ae7f76..3c0830dbe 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1915,8 +1915,10 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent) case 401: // GEOM::EDGE case 4021: // TRIANGLE case 4022: // QUAD + case 4023: // POLYGON case 4031: // TETRA case 4032: // HEXA + case 4033: // POLYHEDRON { if(checkLock(aStudy)) break; if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { @@ -1929,10 +1931,14 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent) type = SMDSAbs_Face; nbNodes = 3; break; case 4022: // QUAD type = SMDSAbs_Face; nbNodes = 4; break; + case 4023: // POLYGON + type = SMDSAbs_Face; nbNodes = 5; break; // 5 - identificator for POLYGON case 4031: // TETRA type = SMDSAbs_Volume; nbNodes = 4; break; case 4032: // HEXA type = SMDSAbs_Volume; nbNodes = 8; break; + case 4033: // POLYHEDRE + type = SMDSAbs_Volume; nbNodes = 9; break; // 9 - identificator for POLYHEDRE default:; } new SMESHGUI_AddMeshElementDlg(parent, "", Sel, type, nbNodes); diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 792ca5c46..ffdfb5113 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -203,19 +203,15 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose) { + myIsPoly = false; mySimulation = new SMESH::TElementSimulation(SMESH::GetActiveStudy()); - + // verify nb nodes and type myNbNodes = nbNodes; myElementType = ElementType; switch ( ElementType ) { case SMDSAbs_Face: - if ( myNbNodes != 3 && myNbNodes != 4 ) - myNbNodes = 3; - break; case SMDSAbs_Volume: - if ( myNbNodes != 4 && myNbNodes != 8 ) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7) - myNbNodes = 4; break; default: myElementType = SMDSAbs_Edge; @@ -223,16 +219,26 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c } QString elemName; - switch ( myNbNodes ) { - case 2: elemName = "EDGE"; break; - case 3: elemName = "TRIANGLE"; break; - case 4: elemName = - myElementType == SMDSAbs_Face ? elemName = "QUADRANGLE" : elemName = "TETRAS"; break; -// case 5: -// case 6: - default: // 8 + if (myNbNodes == 2) + elemName = "EDGE"; + else if (myNbNodes == 3) + elemName = "TRIANGLE"; + else if (myNbNodes == 4) + if (myElementType == SMDSAbs_Face) + elemName = "QUADRANGLE"; + else + elemName = "TETRAS"; + else if (myNbNodes == 8) elemName = "HEXAS"; + else if (myElementType == SMDSAbs_Face){ + elemName = "POLYGON"; + myIsPoly = true; } + else { + elemName = "POLYHEDRON"; + myIsPoly = true; + } + QString iconName = tr( QString("ICON_DLG_%1").arg(elemName) ); QString buttonGrTitle = tr( QString("SMESH_%1").arg(elemName) ); QString caption = tr( QString("SMESH_ADD_%1_TITLE").arg(elemName) ); @@ -329,7 +335,8 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); // LineEditC1A1->setReadOnly( TRUE ); - LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator", myNbNodes )); + if (elemName != "POLYGON" && elemName != "POLYHEDRON") + LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator", myNbNodes)); GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); if ( myElementType == SMDSAbs_Face ) { @@ -514,7 +521,20 @@ void SMESHGUI_AddMeshElementDlg::onTextChange(const QString& theNewText) else allOk = false; } - myOkNodes = (allOk && myNbNodes == aListId.count() ); + + bool aNodesOK = false; + if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){ + myNbNodes = aListId.count(); + cout << __LINE__<<": ENK::DEBUG myNbNodes" << myNbNodes << endl; + aNodesOK = true; + } else if (myIsPoly && myElementType == SMDSAbs_Volume && aListId.count() >=4 ){ + myNbNodes = aListId.count(); + cout << __LINE__<<": ENK::DEBUG myNbNodes" << myNbNodes << endl; + aNodesOK = true; + } else if (!myIsPoly){ + aNodesOK = (myNbNodes == aListId.count()); + } + myOkNodes = (allOk && aNodesOK);//myNbNodes == aListId.count() ); if ( myOkNodes ) { buttonOk->setEnabled( true ); @@ -573,7 +593,9 @@ void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument() myBusy = true; myEditCurrentArgument->setText( aString ); myBusy = false; - if ( myNbNodes != nbNodes ) + if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes>=3 ) { + } else if (myIsPoly && myElementType == SMDSAbs_Volume && nbNodes>=4){ + } else if (myNbNodes != nbNodes) return; // OK @@ -604,12 +626,20 @@ void SMESHGUI_AddMeshElementDlg::displaySimulation() reverse(anIds.begin(),anIds.end()); vtkIdType aType = 0; - switch ( myNbNodes ) { - case 2: aType = VTK_LINE; break; - case 3: aType = VTK_TRIANGLE; break; - case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break; - case 8: aType = VTK_HEXAHEDRON; break; - default: return; + if (myIsPoly) + switch ( myElementType ) { + case SMDSAbs_Face : aType = VTK_POLYGON; break; + case SMDSAbs_Volume: aType = VTK_CONVEX_POINT_SET; break; + default: return; + } + else { + switch ( myNbNodes ) { + case 2: aType = VTK_LINE; break; + case 3: aType = VTK_TRIANGLE; break; + case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break; + case 8: aType = VTK_HEXAHEDRON; break; + default: return; + } } mySimulation->SetPosition(myActor,aType,anIds); diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h index 4a785bbc5..fb4df3030 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h @@ -92,6 +92,7 @@ private: int myElementType ; int myNbNodes; + bool myIsPoly; SMESH::SMESH_Mesh_var myMesh; SMESH_Actor* myActor; diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx index dd130b2fe..5421db7bc 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx @@ -150,6 +150,11 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent, const char* name QLabel* myMeshNbQuadranglesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_QUADRANGLES" ) ), myMeshFacesGroup, "myMeshNbQuadranglesLab" ); myMeshNbQuadrangles = new QLabel( myMeshFacesGroup, "myMeshNbQuadrangles" ); myMeshNbQuadrangles->setMinimumWidth( 100 ); + + // --> faces --> quadrangles + QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup, "myMeshNbPolygonesLab" ); + myMeshNbPolygones = new QLabel( myMeshFacesGroup, "myMeshNbPolygones" ); + myMeshNbPolygones->setMinimumWidth( 100 ); myMeshFacesGroupLayout->addWidget( myMeshNbFacesLab, 0, 0 ); myMeshFacesGroupLayout->addWidget( myMeshNbFaces, 0, 1 ); @@ -157,6 +162,8 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent, const char* name myMeshFacesGroupLayout->addWidget( myMeshNbTriangles, 1, 1 ); myMeshFacesGroupLayout->addWidget( myMeshNbQuadranglesLab, 2, 0 ); myMeshFacesGroupLayout->addWidget( myMeshNbQuadrangles, 2, 1 ); + myMeshFacesGroupLayout->addWidget( myMeshNbPolygonesLab, 3, 0 ); + myMeshFacesGroupLayout->addWidget( myMeshNbPolygones, 3, 1 ); // --> volumes myMeshVolumesGroup = new QGroupBox( tr( "SMESH_MESHINFO_VOLUMES" ), myMeshWidget, "myMeshVolumesGroup" ); @@ -192,6 +199,11 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent, const char* name QLabel* myMeshNbPyraLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_PYRAS" ) ), myMeshVolumesGroup, "myMeshNbPyraLab" ); myMeshNbPyra = new QLabel( myMeshVolumesGroup, "myMeshNbPyra" ); myMeshNbPyra->setMinimumWidth( 100 ); + + // --> volumes --> polyherones + QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup, "myMeshNbPolyhedronLab" ); + myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup, "myMeshNbPolyhedrones" ); + myMeshNbPolyhedrones->setMinimumWidth( 100 ); myMeshVolumesGroupLayout->addWidget( myMeshNbVolumesLab, 0, 0 ); myMeshVolumesGroupLayout->addWidget( myMeshNbVolumes, 0, 1 ); @@ -203,6 +215,8 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent, const char* name myMeshVolumesGroupLayout->addWidget( myMeshNbPrism, 3, 1 ); myMeshVolumesGroupLayout->addWidget( myMeshNbPyraLab, 4, 0 ); myMeshVolumesGroupLayout->addWidget( myMeshNbPyra, 4, 1 ); + myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedronesLab, 5, 0 ); + myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedrones, 5, 1 ); aMeshLayout->addWidget( myMeshNameLab, 0, 0 ); aMeshLayout->addWidget( myMeshName, 0, 1 ); @@ -391,11 +405,13 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos() myMeshNbFaces->setNum( (int)aMesh->NbFaces() ); myMeshNbTriangles->setNum( (int)aMesh->NbTriangles() ); myMeshNbQuadrangles->setNum( (int)aMesh->NbQuadrangles() ); + myMeshNbPolygones->setNum( (int)aMesh->NbPolygones() ); myMeshNbVolumes->setNum( (int)aMesh->NbVolumes() ); myMeshNbTetra->setNum( (int)aMesh->NbTetras() ); myMeshNbHexa->setNum( (int)aMesh->NbHexas() ); myMeshNbPrism->setNum( (int)aMesh->NbPrisms() ); myMeshNbPyra->setNum( (int)aMesh->NbPyramids() ); + myMeshNbPolyhedrones->setNum( (int)aMesh->NbPolyhedrones() ); return; } SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( anObject ); diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h index c8123d8c0..216661951 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h @@ -75,12 +75,14 @@ private: QLabel* myMeshNbFaces; QLabel* myMeshNbTriangles; QLabel* myMeshNbQuadrangles; + QLabel* myMeshNbPolygones; QGroupBox* myMeshVolumesGroup; QLabel* myMeshNbVolumes; QLabel* myMeshNbTetra; QLabel* myMeshNbHexa; QLabel* myMeshNbPyra; QLabel* myMeshNbPrism; + QLabel* myMeshNbPolyhedrones; QWidget* mySubMeshWidget; QLabel* mySubMeshName; diff --git a/src/SMESHGUI/SMESH_icons.po b/src/SMESHGUI/SMESH_icons.po index 60dff5a19..1275f600e 100644 --- a/src/SMESHGUI/SMESH_icons.po +++ b/src/SMESHGUI/SMESH_icons.po @@ -147,6 +147,10 @@ msgstr "mesh_triangle.png" msgid "ICON_DLG_QUADRANGLE" msgstr "mesh_quad.png" +#Polygone +msgid "ICON_DLG_POLYGON" +msgstr "mesh_polygon.png" + #triangle msgid "ICON_DLG_TETRAS" msgstr "mesh_tetra.png" @@ -155,6 +159,10 @@ msgstr "mesh_tetra.png" msgid "ICON_DLG_HEXAS" msgstr "mesh_hexa.png" +#Polyhedre +msgid "ICON_DLG_POLYHEDRON" +msgstr "mesh_polyhedron.png" + #----------------------------------------------------------- # ObjectBrowser diff --git a/src/SMESHGUI/SMESH_msg_en.po b/src/SMESHGUI/SMESH_msg_en.po index a58c6a758..c1d150b05 100644 --- a/src/SMESHGUI/SMESH_msg_en.po +++ b/src/SMESHGUI/SMESH_msg_en.po @@ -444,6 +444,14 @@ msgstr "Add Edge" msgid "SMESH_ADD_TETRAS" msgstr "Add Tetrahedron" +#Add Polygone +msgid "SMESH_ADD_POLYGONE" +msgstr "Add Polygone" + +#Add Polyedre +msgid "SMESH_ADD_POLYEDRE" +msgstr "Add Polyedre" + #Add Hexahedron msgid "SMESH_ADD_HEXAS" msgstr "Add Hexahedron" @@ -774,6 +782,14 @@ msgstr "Hexahedrons" msgid "SMESH_MESHINFO_PYRAS" msgstr "Pyramids" +#Polygones : +msgid "SMESH_MESHINFO_POLYGONES" +msgstr "Polygones" + +#Polyedres : +msgid "SMESH_MESHINFO_POLYEDRES" +msgstr "Polyedres" + #Prisms : msgid "SMESH_MESHINFO_PRISMS" msgstr "Prisms" -- 2.39.2