From: eap Date: Tue, 18 Sep 2018 14:16:01 +0000 (+0300) Subject: 23586: [EDF] HYDRO: Copy mesh to new geometry X-Git-Tag: HYDRO_V2_0_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cde5b33490270be838464e8b7315fdf0d2d40b67;p=plugins%2Fghs3dplugin.git 23586: [EDF] HYDRO: Copy mesh to new geometry --- diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx index 951a050..e1e544f 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx @@ -247,11 +247,11 @@ public: TGHS3DEnforcedVertex* GetEnforcedVertex(double x, double y, double z) throw (std::invalid_argument); TGHS3DEnforcedVertex* GetEnforcedVertex(const std::string anEntry) throw (std::invalid_argument); bool RemoveEnforcedVertex(double x=0.0, double y=0.0, double z=0.0, const std::string anEntry="" ) throw (std::invalid_argument); - const TGHS3DEnforcedVertexCoordsValues _GetEnforcedVerticesCoordsSize() const {return _enfVertexCoordsSizeList; } - const TGHS3DEnforcedVertexEntryValues _GetEnforcedVerticesEntrySize() const {return _enfVertexEntrySizeList; } - const TGHS3DEnforcedVertexList _GetEnforcedVertices() const { return _enfVertexList; } - const TCoordsGHS3DEnforcedVertexMap _GetEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; } - const TGeomEntryGHS3DEnforcedVertexMap _GetEnforcedVerticesByEntry() const { return _geomEntryEnfVertexMap; } + const TGHS3DEnforcedVertexCoordsValues& _GetEnforcedVerticesCoordsSize() const {return _enfVertexCoordsSizeList; } + const TGHS3DEnforcedVertexEntryValues & _GetEnforcedVerticesEntrySize() const {return _enfVertexEntrySizeList; } + const TGHS3DEnforcedVertexList & _GetEnforcedVertices() const { return _enfVertexList; } + const TCoordsGHS3DEnforcedVertexMap & _GetEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; } + const TGeomEntryGHS3DEnforcedVertexMap& _GetEnforcedVerticesByEntry() const { return _geomEntryEnfVertexMap; } void ClearEnforcedVertices(); /*! @@ -369,7 +369,6 @@ protected: TIDSortedElemGroupMap _enfEdges; TIDSortedElemGroupMap _enfTriangles; TID2SizeMap _nodeIDToSizeMap; - std::map _entryToElemsMap; TSetStrings _groupsToRemove; }; diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx index 2da4c10..67856ed 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx @@ -1029,3 +1029,134 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type ) { return type == SMESH::DIM_3D; } + + +//================================================================================ +/*! + * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter + */ +//================================================================================ + +bool +GHS3DPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray, + std::vector< int > & subIDArray ) const +{ + typedef ::GHS3DPlugin_Hypothesis THyp; + const THyp* h = static_cast< const THyp*>( myBaseImpl ); + + { + const THyp::TGHS3DEnforcedVertexList& enfVertexList = h->_GetEnforcedVertices(); + THyp::TGHS3DEnforcedVertexList::const_iterator evIt = enfVertexList.begin(); + for ( ; evIt != enfVertexList.end(); ++evIt ) + { + const THyp::TGHS3DEnforcedVertex* ev = *evIt; + entryArray.push_back( ev->geomEntry ); + } + } + { + const THyp::TGHS3DEnforcedVertexEntryValues& + enfVertexEntrySizeList = h->_GetEnforcedVerticesEntrySize(); + THyp::TGHS3DEnforcedVertexEntryValues::const_iterator entry2size; + for ( entry2size = enfVertexEntrySizeList.cbegin(); + entry2size != enfVertexEntrySizeList.cend(); + entry2size++ ) + { + entryArray.push_back( entry2size->first ); + } + } + { + const THyp::TCoordsGHS3DEnforcedVertexMap& + coordsEnfVertexMap = h->_GetEnforcedVerticesByCoords(); + THyp::TCoordsGHS3DEnforcedVertexMap::const_iterator size2ev = coordsEnfVertexMap.cbegin(); + for ( ; size2ev != coordsEnfVertexMap.cend(); ++size2ev ) + { + const THyp::TGHS3DEnforcedVertex* ev = size2ev->second; + entryArray.push_back( ev->geomEntry ); + } + } + { + const THyp::TGeomEntryGHS3DEnforcedVertexMap& + geomEntryEnfVertexMap = h->_GetEnforcedVerticesByEntry(); + THyp::TGeomEntryGHS3DEnforcedVertexMap::const_iterator entry2ev; + for ( entry2ev = geomEntryEnfVertexMap.cbegin(); + entry2ev != geomEntryEnfVertexMap.cend(); + entry2ev++ ) + { + entryArray.push_back( entry2ev->first ); + + const THyp::TGHS3DEnforcedVertex* ev = entry2ev->second; + entryArray.push_back( ev->geomEntry ); + } + } + + return entryArray.size() > 0; +} + +//================================================================================ +/*! + * \brief Set new geometry instead of that returned by getObjectsDependOn() + */ +//================================================================================ + +bool +GHS3DPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray, + std::vector< int > & subIDArray ) +{ + typedef ::GHS3DPlugin_Hypothesis THyp; + THyp* h = static_cast< THyp*>( myBaseImpl ); + + size_t iEnt = 0; + { + THyp::TGHS3DEnforcedVertexList& enfVertexList = + const_cast( h->_GetEnforcedVertices() ); + THyp::TGHS3DEnforcedVertexList::iterator evIt = enfVertexList.begin(); + for ( ; evIt != enfVertexList.end(); ++evIt ) + { + THyp::TGHS3DEnforcedVertex* ev = *evIt; + ev->geomEntry = entryArray[ iEnt++ ]; + } + } + { + THyp::TGHS3DEnforcedVertexEntryValues& enfVertexEntrySizeListNew = + const_cast< THyp::TGHS3DEnforcedVertexEntryValues& > ( h->_GetEnforcedVerticesEntrySize() ); + THyp::TGHS3DEnforcedVertexEntryValues enfVertexEntrySizeList; + enfVertexEntrySizeList.swap( enfVertexEntrySizeListNew ); + THyp::TGHS3DEnforcedVertexEntryValues::const_iterator entry2size; + for ( entry2size = enfVertexEntrySizeList.cbegin(); + entry2size != enfVertexEntrySizeList.cend(); + entry2size++, ++iEnt ) + { + if ( entry2size->first.empty() == entryArray[ iEnt ].empty() ) + enfVertexEntrySizeListNew[ entryArray[ iEnt ]] = entry2size->second; + } + } + { + THyp::TCoordsGHS3DEnforcedVertexMap& coordsEnfVertexMap = + const_cast< THyp::TCoordsGHS3DEnforcedVertexMap& > ( h->_GetEnforcedVerticesByCoords() ); + THyp::TCoordsGHS3DEnforcedVertexMap::iterator size2ev = coordsEnfVertexMap.begin(); + for ( ; size2ev != coordsEnfVertexMap.end(); ++size2ev ) + { + THyp::TGHS3DEnforcedVertex* ev = size2ev->second; + ev->geomEntry = entryArray[ iEnt++ ]; + } + } + { + THyp::TGeomEntryGHS3DEnforcedVertexMap& geomEntryEnfVertexMapNew = + const_cast< THyp::TGeomEntryGHS3DEnforcedVertexMap& > ( h->_GetEnforcedVerticesByEntry() ); + THyp::TGeomEntryGHS3DEnforcedVertexMap geomEntryEnfVertexMap; + geomEntryEnfVertexMap.swap( geomEntryEnfVertexMapNew ); + THyp::TGeomEntryGHS3DEnforcedVertexMap::iterator entry2ev; + for ( entry2ev = geomEntryEnfVertexMap.begin(); + entry2ev != geomEntryEnfVertexMap.end(); + entry2ev++ ) + { + const std::string& entry = entryArray[ iEnt++ ]; + THyp::TGHS3DEnforcedVertex* ev = entry2ev->second; + ev->geomEntry = entryArray[ iEnt++ ]; + + geomEntryEnfVertexMapNew[ entry ] = ev; + } + } + + return iEnt == entryArray.size(); +} diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx index d515002..af3e427 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx @@ -186,6 +186,16 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + // Methods for copying mesh definition to other geometry + + // Return geometry this hypothesis depends on. Return false if there is no geometry parameter + virtual bool getObjectsDependOn( std::vector< std::string > & entryArray, + std::vector< int > & subIDArray ) const; + + // Set new geometry instead of that returned by getObjectsDependOn() + virtual bool setObjectsDependOn( std::vector< std::string > & entryArray, + std::vector< int > & subIDArray ); }; #endif