X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYBRIDPlugin%2FHYBRIDPlugin_Hypothesis.cxx;h=fb18c5958dd3c3e15b98ce24448c8a6f99a3f5b5;hb=d65687cff09317795b1562b4a52e4ac84871fd66;hp=daff0cdd2ad15470b866d2549a860d46ed41fab2;hpb=78520ed35368b81ab003a3cf7d4377a9950fa592;p=plugins%2Fhybridplugin.git diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx index daff0cd..fb18c59 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -155,6 +155,32 @@ const std::vector& HYBRIDPlugin_Hypothesis::GetFacesWithImprinting() const return myFacesWithImprinting; } +//======================================================================= +//function : SetFacesWithSnapping +//purpose : Set IDs of faces that already have surface layers +//======================================================================= + +bool HYBRIDPlugin_Hypothesis::SetFacesWithSnapping(const std::vector& theVal) +{ + if ( myFacesWithSnapping != theVal ) + { + myFacesWithSnapping = theVal; + NotifySubMeshesHypothesisModification(); + return true; + } + return false; +} + +//======================================================================= +//function : GetFacesWithSnapping +//purpose : Return IDs of faces that already have surface layers +//======================================================================= + +const std::vector& HYBRIDPlugin_Hypothesis::GetFacesWithSnapping() const +{ + return myFacesWithSnapping; +} + //======================================================================= //function : SetToMeshHoles //======================================================================= @@ -906,14 +932,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, S elemRet = _enfEdges.insert(make_pair(elem,groupName)); added = added && elemRet.second; } - else if (elem->GetType() > SMDSAbs_Edge) { - SMDS_ElemIteratorPtr it = elem->edgesIterator(); - for (;it->more();) { - const SMDS_MeshElement* anEdge = it->next(); - elemRet = _enfEdges.insert(make_pair(anEdge,groupName)); - added = added && elemRet.second; - } - } break; case SMESH::FACE: if (elem->GetType() == SMDSAbs_Face) @@ -923,16 +941,6 @@ bool HYBRIDPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, S added = added && elemRet.second; } } - else if (elem->GetType() > SMDSAbs_Face) { // Group of faces - SMDS_ElemIteratorPtr it = elem->facesIterator(); - for (;it->more();) { - const SMDS_MeshElement* aFace = it->next(); - if (aFace->NbCornerNodes() == 3) { - elemRet = _enfTriangles.insert(make_pair(aFace,groupName)); - added = added && elemRet.second; - } - } - } break; default: break; @@ -1470,6 +1478,10 @@ std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save) for ( size_t i = 0; i < myFacesWithImprinting.size(); ++i ) save << " " << myFacesWithImprinting[i]; + save << " " << myFacesWithSnapping.size(); + for ( size_t i = 0; i < myFacesWithSnapping.size(); ++i ) + save << " " << myFacesWithSnapping[i]; + return save; } @@ -1801,6 +1813,7 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) } } + isOK = static_cast(load >> separator); if ( isOK ) { i = atoi( separator.c_str() ); @@ -1814,6 +1827,20 @@ std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load) } } + isOK = static_cast(load >> separator); + if ( isOK ) + { + i = atoi( separator.c_str() ); + isOK = ( i >= 0 ); + if ( isOK ) + { + myFacesWithSnapping.reserve( i ); + while (( myFacesWithSnapping.size() < myFacesWithSnapping.capacity() ) && + ( isOK = static_cast(load >> i)) ) + myFacesWithSnapping.push_back( i ); + } + } + return load; } @@ -1941,6 +1968,13 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* cmd << " --boundary_layer_imprinting yes --boundary_layer_imprinting_tags "; for ( size_t i = 0; i < faceImprintingIDs.size(); ++i ) cmd << faceImprintingIDs[i] << ","; + + // faces with snapping + const std::vector& faceSnappingIDs = hyp->GetFacesWithSnapping(); + if ( !faceSnappingIDs.empty() ) + cmd << " --boundary_layer_snapping yes --boundary_layer_snapping_tags "; + for ( size_t i = 0; i < faceSnappingIDs.size(); ++i ) + cmd << faceSnappingIDs[i] << ","; } } @@ -1979,7 +2013,11 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* const char* value[] = { "yes" , "no" }; cmd << " --smooth_normals " << value[ res ]; } - + + // options as text + if ( hyp && !hyp->myTextOption.empty() ) { + cmd += " " + hyp->myTextOption; + } #ifdef WIN32 cmd << " < NUL"; #endif