X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_MeshEditor.cxx;h=f5bc661fbe1db0e0597e36aff91ac17280bab22c;hp=6d3e74d4e62167dc7d24cf358ebb756b1a6bfe30;hb=85cd6043817a6218e3ff7c01b62f247d791a434f;hpb=bd8f1aee7c78f7d2eb82bd4fec5e08c9e3d280ce diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 6d3e74d4e..f5bc661fb 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -107,9 +107,6 @@ using namespace std; using namespace SMESH::Controls; -typedef map > TElemOfNodeListMap; -typedef map > TElemOfElemListMap; - typedef SMDS_SetIterator< SMDS_pElement, TIDSortedElemSet::const_iterator> TSetIterator; //======================================================================= @@ -6028,8 +6025,8 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens, const SMDSAbs_ElementType type = groupDS->GetType(); SMESHDS_Group* newGroup = new SMESHDS_Group( newGroupID++, mesh->GetMeshDS(), type ); SMESHDS_Group* newTopGroup = new SMESHDS_Group( newGroupID++, mesh->GetMeshDS(), type ); - groupsByType[ groupDS->GetType() ].push_back( make_tuple( groupDS, newGroup, newTopGroup )); - orderedOldNewGroups.push_back( & groupsByType[ groupDS->GetType() ].back() ); + groupsByType[ type ].push_back( make_tuple( groupDS, newGroup, newTopGroup )); + orderedOldNewGroups.push_back( & groupsByType[ type ].back() ); } // Loop on nodes and elements to add them in new groups @@ -6065,7 +6062,26 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens, if ( resElem != sourceElem ) resultElems.push_back( resElem ); - // add resultElems to groups made by ones the sourceElem belongs to + // there must be a top element + const SMDS_MeshElement* topElem = 0; + if ( isNodes ) + { + topElem = resultElems.back(); + resultElems.pop_back(); + } + else + { + list< const SMDS_MeshElement* >::reverse_iterator resElemIt = resultElems.rbegin(); + for ( ; resElemIt != resultElems.rend() ; ++resElemIt ) + if ( (*resElemIt)->GetType() == sourceElem->GetType() ) + { + topElem = *resElemIt; + resultElems.erase( --(resElemIt.base()) ); // erase *resElemIt + break; + } + } + + // add resultElems to groups originted from ones the sourceElem belongs to list< TOldNewGroup >::iterator gOldNew, gLast = groupsOldNew.end(); for ( gOldNew = groupsOldNew.begin(); gOldNew != gLast; ++gOldNew ) { @@ -6074,19 +6090,15 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens, { // fill in a new group SMDS_MeshGroup & newGroup = gOldNew->get<1>()->SMDSGroup(); - list< const SMDS_MeshElement* > rejectedElems; // elements of other type list< const SMDS_MeshElement* >::iterator resLast = resultElems.end(), resElemIt; for ( resElemIt = resultElems.begin(); resElemIt != resLast; ++resElemIt ) - if ( !newGroup.Add( *resElemIt )) - rejectedElems.push_back( *resElemIt ); + newGroup.Add( *resElemIt ); - // fill "top" group - if ( !rejectedElems.empty() ) + // fill a "top" group + if ( topElem ) { SMDS_MeshGroup & newTopGroup = gOldNew->get<2>()->SMDSGroup(); - resLast = rejectedElems.end(); - for ( resElemIt = rejectedElems.begin(); resElemIt != resLast; ++resElemIt ) - !newTopGroup.Add( *resElemIt ); + newTopGroup.Add( topElem ); } } } @@ -6116,7 +6128,9 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens, // make a name const bool isTop = ( nbNewGroups == 2 && - newGroupDS->GetType() == oldGroupDS->GetType() ); + newGroupDS->GetType() == oldGroupDS->GetType() && + is2nd ); + string name = oldGroupDS->GetStoreName(); if ( !targetMesh ) { string suffix = ( isTop ? "top": postfix.c_str() ); @@ -11251,11 +11265,14 @@ double SMESH_MeshEditor::OrientedAngle(const gp_Pnt& p0, const gp_Pnt& p1, const /*! * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand. - * The list of groups must describe a partition of the mesh volumes. - * The nodes of the internal faces at the boundaries of the groups are doubled. - * In option, the internal faces are replaced by flat elements. - * Triangles are transformed in prisms, and quadrangles in hexahedrons. - * The flat elements are stored in groups of volumes. + * The list of groups must contain at least two groups. The groups have to be disjoint: no common element into two different groups. + * The nodes of the internal faces at the boundaries of the groups are doubled. Optionally, the internal faces are replaced by flat elements. + * Triangles are transformed into prisms, and quadrangles into hexahedrons. + * The flat elements are stored in groups of volumes. These groups are named according to the position of the group in the list: + * the group j_n_p is the group of the flat elements that are built between the group #n and the group #p in the list. + * If there is no shared faces between the group #n and the group #p in the list, the group j_n_p is not created. + * All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation). + * The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples". * @param theElems - list of groups of volumes, where a group of volume is a set of * SMDS_MeshElements sorted by Id. * @param createJointElems - if TRUE, create the elements @@ -11289,6 +11306,32 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector emptySet; emptyMap.clear(); + MESSAGE(".. Number of domains :"<FindElement(smdsId); if (! domain.count(elem)) // neighbor is in another domain : face is shared { - DownIdType face(downIds[n], downTypes[n]); - if (!faceDomains.count(face)) - faceDomains[face] = emptyMap; // create an empty entry for face - if (!faceDomains[face].count(idom)) - { - faceDomains[face][idom] = vtkId; // volume associated to face in this domain - celldom[vtkId] = idom; - //MESSAGE(" cell with a border " << vtkId << " domain " << idom); - } + bool ok = false ; + for (int idombis = 0; idombis < theElems.size(); idombis++) // check if the neighbor belongs to another domain of the list + { + // MESSAGE("Domain " << idombis); + const TIDSortedElemSet& domainbis = theElems[idombis]; + if ( domainbis.count(elem)) ok = true ; // neighbor is in a correct domain : face is kept + } + if ( ok ) // the characteristics of the face is stored + { + DownIdType face(downIds[n], downTypes[n]); + if (!faceDomains.count(face)) + faceDomains[face] = emptyMap; // create an empty entry for face + if (!faceDomains[face].count(idom)) + { + faceDomains[face][idom] = vtkId; // volume associated to face in this domain + celldom[vtkId] = idom; + //MESSAGE(" cell with a border " << vtkId << " domain " << idom); + } + } } } } @@ -11396,6 +11449,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector > mutipleNodes; // nodes multi domains with domain order std::map > mutipleNodesToFace; // nodes multi domains with domain order to transform in Face (junction between 3 or more 2D domains) + MESSAGE(".. Duplication of the nodes"); for (int idomain = 0; idomain < theElems.size(); idomain++) { itface = faceDomains.begin(); @@ -11458,6 +11512,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector > nodeQuadDomains; std::map mapOfJunctionGroups; + MESSAGE(".. Creation of elements: simple junction"); if (createJointElems) { int idg; @@ -11637,6 +11693,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector >::const_iterator itnod = nodeDomains.begin();