+
+ //================================================================================
+ /*!
+ * \brief Appends a range of node columns from a map to another map
+ */
+ template< class TMapIterator >
+ void append( TParam2ColumnMap& toMap, TMapIterator from, TMapIterator to )
+ {
+ const SMDS_MeshNode* lastNode = toMap.rbegin()->second[0];
+ const SMDS_MeshNode* firstNode = from->second[0];
+ if ( lastNode == firstNode )
+ from++;
+ double u = toMap.rbegin()->first;
+ for (; from != to; ++from )
+ {
+ u += 1;
+ TParam2ColumnMap::iterator u2nn = toMap.insert( toMap.end(), make_pair ( u, TNodeColumn()));
+ u2nn->second.swap( from->second );
+ }
+ }
+
+ //================================================================================
+ /*!
+ * \brief Finds FaceQuadStruct having a side equal to a given one and rearranges
+ * the found FaceQuadStruct::side to have the given side at a Q_BOTTOM place
+ */
+ FaceQuadStructPtr getQuadWithBottom( StdMeshers_FaceSide* side,
+ FaceQuadStructPtr quad[ 6 ])
+ {
+ FaceQuadStructPtr foundQuad;
+ for ( int i = 1; i < 6; ++i )
+ {
+ if ( !quad[i] ) continue;
+ for ( unsigned iS = 0; iS < quad[i]->side.size(); ++iS )
+ {
+ const StdMeshers_FaceSide* side2 = quad[i]->side[iS];
+ if (( side->FirstVertex().IsSame( side2->FirstVertex() ) ||
+ side->FirstVertex().IsSame( side2->LastVertex() ))
+ &&
+ ( side->LastVertex().IsSame( side2->FirstVertex() ) ||
+ side->LastVertex().IsSame( side2->LastVertex() ))
+ )
+ {
+ if ( iS != Q_BOTTOM )
+ {
+ vector< StdMeshers_FaceSide*> newSides;
+ for ( unsigned j = iS; j < quad[i]->side.size(); ++j )
+ newSides.push_back( quad[i]->side[j] );
+ for ( unsigned j = 0; j < iS; ++j )
+ newSides.push_back( quad[i]->side[j] );
+ quad[i]->side.swap( newSides );
+ }
+ foundQuad.swap(quad[i]);
+ return foundQuad;
+ }
+ }
+ }
+ return foundQuad;
+ }
+ //================================================================================
+ /*!
+ * \brief Returns true if the 1st base node of sideGrid1 belongs to sideGrid2
+ */
+ //================================================================================
+
+ bool beginsAtSide( const _FaceGrid& sideGrid1,
+ const _FaceGrid& sideGrid2,
+ SMESH_ProxyMesh::Ptr proxymesh )
+ {
+ const TNodeColumn& col0 = sideGrid2._u2nodesMap.begin()->second;
+ const TNodeColumn& col1 = sideGrid2._u2nodesMap.rbegin()->second;
+ const SMDS_MeshNode* n00 = col0.front();
+ const SMDS_MeshNode* n01 = col0.back();
+ const SMDS_MeshNode* n10 = col1.front();
+ const SMDS_MeshNode* n11 = col1.back();
+ const SMDS_MeshNode* n = (sideGrid1._u2nodesMap.begin()->second)[0];
+ if ( proxymesh )
+ {
+ n00 = proxymesh->GetProxyNode( n00 );
+ n10 = proxymesh->GetProxyNode( n10 );
+ n01 = proxymesh->GetProxyNode( n01 );
+ n11 = proxymesh->GetProxyNode( n11 );
+ n = proxymesh->GetProxyNode( n );
+ }
+ return ( n == n00 || n == n01 || n == n10 || n == n11 );
+ }