From: eap Date: Tue, 18 Sep 2018 11:40:04 +0000 (+0300) Subject: 23586: [EDF] HYDRO: Copy mesh to new geometry X-Git-Tag: V9_2_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ecdefb9785fe86456b0bf09deb1045d8d6a0bca3;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 37031bd..601581f 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 21af792..edabc43 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx @@ -1023,3 +1023,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 3e6a82b..9dae477 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx @@ -185,6 +185,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