dim ="2">
<python-wrap>
<algo>Quadrangle_2D=Quadrangle(algo=smeshBuilder.QUADRANGLE)</algo>
- <hypo>QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex(),SetEnforcedNodes(1),SetEnforcedNodes(2))</hypo>
+ <hypo>QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex(),SetEnforcedNodes(1),SetEnforcedNodes(2),SetCorners())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap>
</algorithm>
* \retval int - 1 for U, 2 for V direction
*/
int GetPeriodicIndex() const { return myParIndex; }
+ /*!
+ * \brief Return period in given direction [1,2]
+ */
+ double GetPeriod(int perioIndex) const { return myPar2[ perioIndex-1 ] - myPar1[ perioIndex-1 ]; }
/*!
* \brief Return an alternative parameter for a node on seam
*/
if ( !obj->CanClear() )
allGroupsRemoved = false;
}
- if ( nbGroupsBefore == myGroups.size() ) // no new _pyGroup created
+ if ( nbGroupsBefore == myGroups.size() && !obj.IsNull() ) // no new _pyGroup created
obj->AddProcessedCmd( theCommand ); // to clear theCommand if all groups are removed
if ( !allGroupsRemoved && !theGen->IsToKeepAllCommands() )
_shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type
_requireShape = false;
_compatibleHypothesis.push_back("ViscousLayers");
+ _quadAlgo = new StdMeshers_Quadrangle_2D( gen->GetANewId(), _gen );
}
//=============================================================================
StdMeshers_Hexa_3D::~StdMeshers_Hexa_3D()
{
+ delete _quadAlgo;
+ _quadAlgo = 0;
}
//=============================================================================
for ( int i = 1; i < 6; ++i )
{
if ( !quad[i] ) continue;
- for ( unsigned iS = 0; iS < quad[i]->side.size(); ++iS )
+ for ( size_t iS = 0; iS < quad[i]->side.size(); ++iS )
{
const StdMeshers_FaceSidePtr side2 = quad[i]->side[iS];
if (( side->FirstVertex().IsSame( side2->FirstVertex() ) ||
if ( iS != Q_BOTTOM )
{
vector< FaceQuadStruct::Side > newSides;
- for ( unsigned j = iS; j < quad[i]->side.size(); ++j )
+ for ( size_t j = iS; j < quad[i]->side.size(); ++j )
newSides.push_back( quad[i]->side[j] );
- for ( unsigned j = 0; j < iS; ++j )
+ for ( size_t j = 0; j < iS; ++j )
newSides.push_back( quad[i]->side[j] );
quad[i]->side.swap( newSides );
}
if ( exp.Next(), exp.More() )
return error(COMPERR_BAD_SHAPE, "More than one SHELL in the geometry");
- TopTools_IndexedMapOfShape FF;
+ TopTools_IndexedMapOfShape FF, EE;
TopExp::MapShapes( aShape, TopAbs_FACE, FF);
if ( FF.Extent() != 6)
{
// Find sides of a cube
// ---------------------
-
+
+ // tool creating quadratic elements if needed
+ SMESH_MesherHelper helper (aMesh);
+ _quadraticMesh = helper.IsQuadraticSubMesh(aShape);
+
+ TopExp::MapShapes( aShape, TopAbs_EDGE, EE );
+ SMESH_MesherHelper* faceHelper = ( EE.Size() == 12 ) ? 0 : &helper;
+
FaceQuadStructPtr quad[ 6 ];
- StdMeshers_Quadrangle_2D quadAlgo( _gen->GetANewId(), _gen);
for ( int i = 0; i < 6; ++i )
{
- if ( !( quad[i] = FaceQuadStructPtr( quadAlgo.CheckNbEdges( aMesh, FF( i+1 ),
- /*considerMesh=*/true))))
- return error( quadAlgo.GetComputeError() );
+ if ( faceHelper )
+ faceHelper->SetSubShape( FF( i+1 ));
+ if ( !( quad[i] = FaceQuadStructPtr( _quadAlgo->CheckNbEdges( aMesh, FF( i+1 ),
+ /*considerMesh=*/true,
+ faceHelper))))
+ return error( _quadAlgo->GetComputeError() );
if ( quad[i]->side.size() != 4 )
return error( COMPERR_BAD_SHAPE, "Not a quadrangular box side" );
}
// Check presence of regular grid mesh on FACEs of the cube
// ------------------------------------------------------------
- // tool creating quadratic elements if needed
- SMESH_MesherHelper helper (aMesh);
- _quadraticMesh = helper.IsQuadraticSubMesh(aShape);
-
for ( int i = 0; i < 6; ++i )
{
const TopoDS_Face& F = aCubeSide[i]._quad->face;
if ( proxymesh )
for ( int i = 0; i < 6; ++i )
- for ( unsigned j = 0; j < aCubeSide[i]._columns.size(); ++j)
- for ( unsigned k = 0; k < aCubeSide[i]._columns[j].size(); ++k)
+ for ( size_t j = 0; j < aCubeSide[i]._columns.size(); ++j)
+ for ( size_t k = 0; k < aCubeSide[i]._columns[j].size(); ++k)
{
const SMDS_MeshNode* & n = aCubeSide[i]._columns[j][k];
n = proxymesh->GetProxyNode( n );
#include "SMESH_Algo.hxx"
-class StdMeshers_ViscousLayers;
class SMESH_MesherHelper;
+class StdMeshers_Quadrangle_2D;
+class StdMeshers_ViscousLayers;
class STDMESHERS_EXPORT StdMeshers_Hexa_3D : public SMESH_3D_Algo
{
protected:
const StdMeshers_ViscousLayers* _viscousLayersHyp;
+ StdMeshers_Quadrangle_2D* _quadAlgo;
};
#endif
#include <Geom_Surface.hxx>
#include <NCollection_DefineArray2.hxx>
#include <Precision.hxx>
+#include <ShapeAnalysis.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <TColgp_SequenceOfXY.hxx>
* \param [in] theNbCorners - the required number of sides, 3 or 4
* \param [in] theConsiderMesh - to considered only meshed VERTEXes
* \param [in] theFaceSide - the FACE EDGEs
+ * \param [in] theFixedVertices - VERTEXes to be used as corners
* \param [out] theVertices - the found corner vertices
+ * \param [out] theHaveConcaveVertices - return if there are concave vertices
*/
//================================================================================
return;
}
+ //================================================================================
+ /*!
+ * \brief Remove a seam and degenerated edge from a wire if the shape is
+ * a quadrangle with a seam inside.
+ */
+ //================================================================================
+
+ bool removeInternalSeam( std::list<TopoDS_Edge>& theWire,
+ SMESH_MesherHelper& theHelper)
+ {
+ if ( !theHelper.HasRealSeam() ||
+ theHelper.NbDegeneratedEdges() != 2 ) // 1 EDGE + 1 VERTEX
+ return false;
+
+ typedef std::list<TopoDS_Edge>::iterator TEdgeIter;
+ std::vector< TEdgeIter > edgesToRemove;
+ edgesToRemove.reserve( 5 );
+ for ( TEdgeIter eIt = theWire.begin(); eIt != theWire.end(); ++eIt )
+ {
+ int eID = theHelper.ShapeToIndex( *eIt );
+ if ( theHelper.IsRealSeam( eID ) || theHelper.IsDegenShape( eID ))
+ edgesToRemove.push_back( eIt );
+ }
+
+ if ( theWire.size() - edgesToRemove.size() < 4 )
+ return false; // cone e.g.
+
+ for ( size_t i = 0; i < edgesToRemove.size(); ++i )
+ theWire.erase( edgesToRemove[ i ]);
+
+ return true;
+ }
+
} // namespace
//================================================================================
if ( myHelper )
helper.CopySubShapeInfo( *myHelper );
+ if ( removeInternalSeam( theWire, helper ))
+ theNbDegenEdges = 1;
+
StdMeshers_FaceSide faceSide( theFace, theWire, &theMesh,
/*isFwd=*/true, /*skipMedium=*/true, &helper );
default:;
}
- // if ( isBad && myHelper->HasRealSeam() )
- // {
- // // detect a case where a face intersects the seam
- // for ( int iPar = 1; iPar < 3; ++iPar )
- // if ( iPar & myHelper->GetPeriodicIndex() )
- // {
- // double min = uv[0].Coord( iPar ), max = uv[0].Coord( iPar );
- // for ( int i = 1; i < nbN; ++i )
- // {
- // min = Min( min, uv[i].Coord( iPar ));
- // max = Max( max, uv[i].Coord( iPar ));
- // }
- // }
- // }
+ if ( isBad && myHelper->HasRealSeam() )
+ {
+ // fix uv for a case where a face intersects the seam
+ for ( int iPar = 1; iPar < 3; ++iPar )
+ if ( iPar & myHelper->GetPeriodicIndex() )
+ {
+ double max = uv[0].Coord( iPar );
+ for ( int i = 1; i < nbN; ++i )
+ max = Max( max, uv[i].Coord( iPar ));
+
+ for ( int i = 0; i < nbN; ++i )
+ {
+ double par = uv[i].Coord( iPar );
+ double shift = ShapeAnalysis::AdjustByPeriod( par, max, myHelper->GetPeriod( iPar ));
+ uv[i].SetCoord( iPar, par + shift );
+ }
+ }
+ double sign1 = getArea( uv[0], uv[1], uv[2] );
+ double sign2 = getArea( uv[0], uv[2], uv[3] );
+ if ( sign1 * sign2 < 0 )
+ {
+ sign2 = getArea( uv[1], uv[2], uv[3] );
+ sign1 = getArea( uv[1], uv[3], uv[0] );
+ if ( sign1 * sign2 < 0 )
+ continue; // this should not happen
+ }
+ isBad = ( sign1 * okSign < 0 );
+ }
+
if ( isBad )
badFaces.push_back ( f );
}
#define SPACING 6
#define MARGIN 11
-enum { TAB_TRANSITION, TAB_VERTEX, TAB_ENF_POINTS };
+enum { TAB_TRANSITION, TAB_VERTEX, TAB_CORNERS, TAB_ENF_POINTS };
//================================================================================
// function : Constructor
pointsLay->addWidget( shapesGroup );
pointsLay->addWidget( coordsGroup );
+ // Corners
+
+ myCornersSelWdg = new StdMeshersGUI_SubShapeSelectorWdg( fr, TopAbs_VERTEX );
+ myCornersSelWdg->layout()->setMargin( MARGIN );
+
// Tabs
myTabs = new QTabWidget( fr );
- myTabs->addTab( myTypeWdg, tr("TRANSITION"));
- myTabs->addTab( myVertexSelWdg, tr("SMESH_BASE_VERTEX"));
- myTabs->addTab( pointsFrame, tr("ENF_NODES"));
+ myTabs->addTab( myTypeWdg, tr("TRANSITION"));
+ myTabs->addTab( myVertexSelWdg, tr("SMESH_BASE_VERTEX"));
+ myTabs->addTab( myCornersSelWdg, tr("CORNERS"));
+ myTabs->addTab( pointsFrame, tr("ENF_NODES"));
lay->addWidget( myTabs, row, 0, 2, 3 );
if ( anEntry.isEmpty() )
anEntry = h->GetObjectEntry();
myVertexSelWdg->SetGeomShapeEntry(anEntry,aMainEntry);
+ myCornersSelWdg->SetGeomShapeEntry(anEntry,aMainEntry);
if ( !isCreation())
{
myVertexSelWdg->SetListOfIDs(aVec);
}
+ // corners
+ SMESH::long_array_var aVec = h->GetCorners();
+ myCornersSelWdg->SetListOfIDs( aVec );
+
// enforced nodes
GEOM::ListOfGO_var shapes;
SMESH::nodes_array_var points;
h->SetTriaVertex( -1 );
}
+ // corners
+ h->SetCorners( myCornersSelWdg->GetListOfIDs() );
+
// enfored nodes
GEOM::ListOfGO_var goList = new GEOM::ListOfGO;
void StdMeshersGUI_QuadrangleParamCreator::onTabChanged(int i)
{
myVertexSelWdg->ShowPreview( i == TAB_VERTEX );
+ myCornersSelWdg->ShowPreview( i == TAB_CORNERS );
}
//================================================================================
QLineEdit* myName;
StdMeshersGUI_QuadrangleParamWdg* myTypeWdg;
StdMeshersGUI_SubShapeSelectorWdg* myVertexSelWdg;
+ StdMeshersGUI_SubShapeSelectorWdg* myCornersSelWdg;
QListWidget* myShapesList;
QPushButton* myAddShapeBut;
QTreeWidget* myCoordsTreeWdg;
StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0,
TopAbs_ShapeEnum subShType = TopAbs_EDGE,
const bool toShowList = true,
- const bool toShowActivateBtn = false);
+ const bool toShowSelectBtn = false);
~StdMeshersGUI_SubShapeSelectorWdg();
SMESH::long_array_var GetListOfIDs();
<source>ENF_NODES</source>
<translation>Enforced nodes</translation>
</message>
+ <message>
+ <source>CORNERS</source>
+ <translation>Corner Vertices</translation>
+ </message>
</context>
<context>
<name>StdMeshersGUI_LayerDistributionParamWdg</name>