mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 02:10:35 +05:00
0022362: EDF SMESH: Quadrangle (mapping) algorithm: enforced vertices
This commit is contained in:
parent
046b185660
commit
9858978294
@ -807,6 +807,22 @@ module StdMeshers
|
|||||||
* Get the type of quadrangulation
|
* Get the type of quadrangulation
|
||||||
*/
|
*/
|
||||||
QuadType GetQuadType();
|
QuadType GetQuadType();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Set positions of enforced nodes
|
||||||
|
*/
|
||||||
|
void SetEnforcedNodes(in GEOM::ListOfGO vertices, in SMESH::nodes_array points)
|
||||||
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns positions of enforced nodes
|
||||||
|
*/
|
||||||
|
void GetEnforcedNodes(out GEOM::ListOfGO vertices, out SMESH::nodes_array points);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns entries of shapes defining enforced nodes
|
||||||
|
*/
|
||||||
|
SMESH::string_array GetEnfVertices();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -552,28 +552,56 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
|
|||||||
# same number of segments, the other pair must have an even difference
|
# same number of segments, the other pair must have an even difference
|
||||||
# between the numbers of segments on the sides.
|
# between the numbers of segments on the sides.
|
||||||
# @param triangleVertex: vertex of a trilateral geometrical face, around which triangles
|
# @param triangleVertex: vertex of a trilateral geometrical face, around which triangles
|
||||||
# will be created while other elements will be quadrangles.
|
# will be created while other elements will be quadrangles.
|
||||||
# Vertex can be either a GEOM_Object or a vertex ID within the
|
# Vertex can be either a GEOM_Object or a vertex ID within the
|
||||||
# shape to mesh
|
# shape to mesh
|
||||||
# @param UseExisting: if ==true - searches for the existing hypothesis created with
|
# @param enfVertices: list of shapes defining positions where nodes (enforced nodes)
|
||||||
# the same parameters, else (default) - creates a new one
|
# must be created by the mesher. Shapes can be of any type,
|
||||||
|
# vertices of given shapes define positions of enforced nodes.
|
||||||
|
# Only vertices successfully projected to the face are used.
|
||||||
|
# @param enfPoint: list of points giving positions of enforced nodes.
|
||||||
|
# Point can be defined either as SMESH.PointStruct's
|
||||||
|
# ([SMESH.PointStruct(x1,y1,z1), SMESH.PointStruct(x2,y2,z2),...])
|
||||||
|
# or triples of values ([[x1,y1,z1], [x2,y2,z2], ...]).
|
||||||
|
# In the case if the defined QuadrangleParameters() refer to a sole face,
|
||||||
|
# all given points must lie on this face, else the mesher fails.
|
||||||
|
# @param UseExisting: if \c True - searches for the existing hypothesis created with
|
||||||
|
# the same parameters, else (default) - creates a new one
|
||||||
# @ingroup l3_hypos_quad
|
# @ingroup l3_hypos_quad
|
||||||
def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0, UseExisting=0):
|
def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0,
|
||||||
import GEOM
|
enfVertices=[],enfPoints=[],UseExisting=0):
|
||||||
|
import GEOM, SMESH
|
||||||
vertexID = triangleVertex
|
vertexID = triangleVertex
|
||||||
if isinstance( triangleVertex, GEOM._objref_GEOM_Object ):
|
if isinstance( triangleVertex, GEOM._objref_GEOM_Object ):
|
||||||
vertexID = self.mesh.geompyD.GetSubShapeID( self.mesh.geom, triangleVertex )
|
vertexID = self.mesh.geompyD.GetSubShapeID( self.mesh.geom, triangleVertex )
|
||||||
|
if isinstance( enfVertices, int ) and not enfPoints and not UseExisting:
|
||||||
|
# a call of old syntax, before inserting enfVertices and enfPoints before UseExisting
|
||||||
|
UseExisting, enfVertices = enfVertices, []
|
||||||
|
pStructs, xyz = [], []
|
||||||
|
for p in enfPoints:
|
||||||
|
if isinstance( p, SMESH.PointStruct ):
|
||||||
|
xyz.append(( p.x, p.y, p.z ))
|
||||||
|
pStructs.append( p )
|
||||||
|
else:
|
||||||
|
xyz.append(( p[0], p[1], p[2] ))
|
||||||
|
pStructs.append( SMESH.PointStruct( p[0], p[1], p[2] ))
|
||||||
if not self.params:
|
if not self.params:
|
||||||
compFun = lambda hyp,args: \
|
compFun = lambda hyp,args: \
|
||||||
hyp.GetQuadType() == args[0] and \
|
hyp.GetQuadType() == args[0] and \
|
||||||
( hyp.GetTriaVertex()==args[1] or ( hyp.GetTriaVertex()<1 and args[1]<1))
|
(hyp.GetTriaVertex()==args[1] or ( hyp.GetTriaVertex()<1 and args[1]<1)) and \
|
||||||
self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID],
|
((hyp.GetEnforcedNodes()) == (args[2],args[3])) # True w/o enfVertices only
|
||||||
|
entries = [ shape.GetStudyEntry() for shape in enfVertices ]
|
||||||
|
self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID,entries,xyz],
|
||||||
UseExisting = UseExisting, CompareMethod=compFun)
|
UseExisting = UseExisting, CompareMethod=compFun)
|
||||||
pass
|
pass
|
||||||
if self.params.GetQuadType() != quadType:
|
if self.params.GetQuadType() != quadType:
|
||||||
self.params.SetQuadType(quadType)
|
self.params.SetQuadType(quadType)
|
||||||
if vertexID > 0:
|
if vertexID > 0:
|
||||||
self.params.SetTriaVertex( vertexID )
|
self.params.SetTriaVertex( vertexID )
|
||||||
|
from salome.smesh.smeshBuilder import AssureGeomPublished
|
||||||
|
for v in enfVertices:
|
||||||
|
AssureGeomPublished( self.mesh, v )
|
||||||
|
self.params.SetEnforcedNodes( enfVertices, pStructs )
|
||||||
return self.params
|
return self.params
|
||||||
|
|
||||||
## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
|
## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
|
||||||
|
@ -87,6 +87,43 @@ void StdMeshers_QuadrangleParams::SetQuadType (StdMeshers_QuadType type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Set positions of enforced nodes
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void StdMeshers_QuadrangleParams::
|
||||||
|
SetEnforcedNodes( const std::vector< TopoDS_Shape >& shapes,
|
||||||
|
const std::vector< gp_Pnt >& points )
|
||||||
|
{
|
||||||
|
bool isChanged = ( shapes != _enforcedVertices ||
|
||||||
|
points.size() != _enforcedPoints.size() );
|
||||||
|
for ( size_t i = 0; i < points.size() && !isChanged; ++i )
|
||||||
|
isChanged = ( _enforcedPoints[ i ].SquareDistance( points[i] ) > 1e-100 );
|
||||||
|
|
||||||
|
if ( isChanged )
|
||||||
|
{
|
||||||
|
_enforcedVertices = shapes;
|
||||||
|
_enforcedPoints = points;
|
||||||
|
NotifySubMeshesHypothesisModification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Returns positions of enforced nodes
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void StdMeshers_QuadrangleParams::
|
||||||
|
GetEnforcedNodes( std::vector< TopoDS_Shape >& shapes,
|
||||||
|
std::vector< gp_Pnt >& points ) const
|
||||||
|
{
|
||||||
|
shapes = _enforcedVertices;
|
||||||
|
points = _enforcedPoints;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
@ -98,6 +135,13 @@ ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save)
|
|||||||
save << _triaVertexID << " UNDEFINED " << int(_quadType);
|
save << _triaVertexID << " UNDEFINED " << int(_quadType);
|
||||||
else
|
else
|
||||||
save << _triaVertexID << " " << _objEntry << " " << int(_quadType);
|
save << _triaVertexID << " " << _objEntry << " " << int(_quadType);
|
||||||
|
|
||||||
|
save << " " << _enforcedPoints.size();
|
||||||
|
for ( size_t i = 0; i < _enforcedPoints.size(); ++i )
|
||||||
|
save << " " << _enforcedPoints[i].X()
|
||||||
|
<< " " << _enforcedPoints[i].Y()
|
||||||
|
<< " " << _enforcedPoints[i].Z();
|
||||||
|
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,29 +166,25 @@ istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
|
|||||||
if (isOK)
|
if (isOK)
|
||||||
_quadType = StdMeshers_QuadType(type);
|
_quadType = StdMeshers_QuadType(type);
|
||||||
|
|
||||||
|
// _enforcedVertices are loaded at StdMeshers_I level
|
||||||
|
// because GEOM objects are referred by study entry.
|
||||||
|
|
||||||
|
int nbP = 0;
|
||||||
|
double x,y,z;
|
||||||
|
if ( load >> nbP && nbP > 0 )
|
||||||
|
{
|
||||||
|
_enforcedPoints.reserve( nbP );
|
||||||
|
while ( _enforcedPoints.size() < _enforcedPoints.capacity() )
|
||||||
|
if ( load >> x &&
|
||||||
|
load >> y &&
|
||||||
|
load >> z )
|
||||||
|
_enforcedPoints.push_back( gp_Pnt( x,y,z ));
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
return load;
|
return load;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
/*!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//=============================================================================
|
|
||||||
ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
|
|
||||||
{
|
|
||||||
return hyp.SaveTo( save );
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
/*!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//=============================================================================
|
|
||||||
istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
|
|
||||||
{
|
|
||||||
return hyp.LoadFrom( load );
|
|
||||||
}
|
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Redifined method
|
* \brief Redifined method
|
||||||
|
@ -24,9 +24,12 @@
|
|||||||
#define _SMESH_QUADRANGLEPARAMS_HXX_
|
#define _SMESH_QUADRANGLEPARAMS_HXX_
|
||||||
|
|
||||||
#include "SMESH_StdMeshers.hxx"
|
#include "SMESH_StdMeshers.hxx"
|
||||||
|
|
||||||
#include "SMESH_Hypothesis.hxx"
|
#include "SMESH_Hypothesis.hxx"
|
||||||
#include "Utils_SALOME_Exception.hxx"
|
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
enum StdMeshers_QuadType
|
enum StdMeshers_QuadType
|
||||||
{
|
{
|
||||||
@ -38,8 +41,7 @@ enum StdMeshers_QuadType
|
|||||||
QUAD_NB_TYPES
|
QUAD_NB_TYPES
|
||||||
};
|
};
|
||||||
|
|
||||||
class STDMESHERS_EXPORT StdMeshers_QuadrangleParams:
|
class STDMESHERS_EXPORT StdMeshers_QuadrangleParams: public SMESH_Hypothesis
|
||||||
public SMESH_Hypothesis
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StdMeshers_QuadrangleParams(int hypId, int studyId, SMESH_Gen* gen);
|
StdMeshers_QuadrangleParams(int hypId, int studyId, SMESH_Gen* gen);
|
||||||
@ -54,12 +56,13 @@ public:
|
|||||||
void SetQuadType (StdMeshers_QuadType type);
|
void SetQuadType (StdMeshers_QuadType type);
|
||||||
StdMeshers_QuadType GetQuadType() const { return _quadType; }
|
StdMeshers_QuadType GetQuadType() const { return _quadType; }
|
||||||
|
|
||||||
|
void SetEnforcedNodes( const std::vector< TopoDS_Shape >& shapes,
|
||||||
|
const std::vector< gp_Pnt >& points );
|
||||||
|
void GetEnforcedNodes( std::vector< TopoDS_Shape >& shapes,
|
||||||
|
std::vector< gp_Pnt >& points ) const;
|
||||||
|
|
||||||
virtual std::ostream & SaveTo(std::ostream & save);
|
virtual std::ostream & SaveTo(std::ostream & save);
|
||||||
virtual std::istream & LoadFrom(std::istream & load);
|
virtual std::istream & LoadFrom(std::istream & load);
|
||||||
friend std::ostream& operator << (std::ostream & save,
|
|
||||||
StdMeshers_QuadrangleParams & hyp);
|
|
||||||
friend std::istream& operator >> (std::istream & load,
|
|
||||||
StdMeshers_QuadrangleParams & hyp);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize start and end length by the mesh built on the geometry
|
* \brief Initialize start and end length by the mesh built on the geometry
|
||||||
@ -78,9 +81,11 @@ public:
|
|||||||
const SMESH_Mesh* theMesh=0);
|
const SMESH_Mesh* theMesh=0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _triaVertexID;
|
int _triaVertexID;
|
||||||
std::string _objEntry;
|
std::string _objEntry;
|
||||||
StdMeshers_QuadType _quadType;
|
StdMeshers_QuadType _quadType;
|
||||||
|
std::vector< TopoDS_Shape > _enforcedVertices;
|
||||||
|
std::vector< gp_Pnt > _enforcedPoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -30,31 +30,77 @@
|
|||||||
#include "SMESH_Algo.hxx"
|
#include "SMESH_Algo.hxx"
|
||||||
#include "SMESH_ProxyMesh.hxx"
|
#include "SMESH_ProxyMesh.hxx"
|
||||||
#include "SMESH_StdMeshers.hxx"
|
#include "SMESH_StdMeshers.hxx"
|
||||||
|
#include "StdMeshers_FaceSide.hxx"
|
||||||
#include "StdMeshers_QuadrangleParams.hxx"
|
#include "StdMeshers_QuadrangleParams.hxx"
|
||||||
|
|
||||||
#include <TopoDS_Face.hxx>
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <Bnd_B2d.hxx>
|
||||||
|
|
||||||
class SMDS_MeshNode;
|
class SMDS_MeshNode;
|
||||||
class SMESH_Mesh;
|
class SMESH_Mesh;
|
||||||
class SMESH_MesherHelper;
|
class SMESH_MesherHelper;
|
||||||
class SMESH_ProxyMesh;
|
class SMESH_ProxyMesh;
|
||||||
class StdMeshers_FaceSide;
|
|
||||||
struct uvPtStruct;
|
struct uvPtStruct;
|
||||||
|
|
||||||
|
|
||||||
enum TSideID { QUAD_BOTTOM_SIDE=0, QUAD_RIGHT_SIDE, QUAD_TOP_SIDE, QUAD_LEFT_SIDE, NB_QUAD_SIDES };
|
enum TSideID { QUAD_BOTTOM_SIDE=0, QUAD_RIGHT_SIDE, QUAD_TOP_SIDE, QUAD_LEFT_SIDE, NB_QUAD_SIDES };
|
||||||
|
|
||||||
typedef uvPtStruct UVPtStruct;
|
typedef uvPtStruct UVPtStruct;
|
||||||
typedef struct faceQuadStruct
|
struct FaceQuadStruct
|
||||||
{
|
{
|
||||||
std::vector< StdMeshers_FaceSide*> side;
|
struct Side // a side of FaceQuadStruct
|
||||||
bool isEdgeOut[4]; // true, if an EDGE has more nodes, than an opposite one
|
{
|
||||||
UVPtStruct* uv_grid;
|
struct Contact // contact of two sides
|
||||||
TopoDS_Face face;
|
{
|
||||||
~faceQuadStruct();
|
int point; // index of a grid point of this side where two sides meat
|
||||||
void shift( size_t nb, bool keepUnitOri );
|
Side* other_side;
|
||||||
typedef boost::shared_ptr<faceQuadStruct> Ptr;
|
int other_point;
|
||||||
} FaceQuadStruct;
|
};
|
||||||
|
StdMeshers_FaceSidePtr grid;
|
||||||
|
int from, to; // indices of grid points used by the quad
|
||||||
|
std::set<int> forced_nodes; // indices of forced grid points
|
||||||
|
std::vector<Contact> contacts; // contacts with sides of other quads
|
||||||
|
int nbNodeOut; // nb of missing nodes on an opposite shorter side
|
||||||
|
|
||||||
|
Side(StdMeshers_FaceSidePtr theGrid = StdMeshers_FaceSidePtr());
|
||||||
|
Side& operator=(const Side& otherSide);
|
||||||
|
operator StdMeshers_FaceSidePtr() { return grid; }
|
||||||
|
operator const StdMeshers_FaceSidePtr() const { return grid; }
|
||||||
|
void AddContact( int ip, Side* side, int iop );
|
||||||
|
int ToSideIndex( int quadNodeIndex ) const;
|
||||||
|
int ToQuadIndex( int sideNodeIndex ) const;
|
||||||
|
bool IsForced( int nodeIndex ) const;
|
||||||
|
bool IsReversed() const { return nbNodeOut ? false : to < from; }
|
||||||
|
int NbPoints() const { return Abs( to - from ); }
|
||||||
|
double Param( int nodeIndex ) const;
|
||||||
|
double Length( int from=-1, int to=-1) const;
|
||||||
|
gp_XY Value2d( double x ) const;
|
||||||
|
// some sortcuts
|
||||||
|
const vector<UVPtStruct>& GetUVPtStruct(bool isXConst=0, double constValue=0) const
|
||||||
|
{ return nbNodeOut ?
|
||||||
|
grid->SimulateUVPtStruct( NbPoints()-nbNodeOut-1, isXConst, constValue ) :
|
||||||
|
grid->GetUVPtStruct( isXConst, constValue );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector< Side > side;
|
||||||
|
std::vector< UVPtStruct> uv_grid;
|
||||||
|
int iSize, jSize;
|
||||||
|
TopoDS_Face face;
|
||||||
|
Bnd_B2d uv_box;
|
||||||
|
|
||||||
|
FaceQuadStruct ( const TopoDS_Face& F = TopoDS_Face() );
|
||||||
|
UVPtStruct& UVPt( int i, int j ) { return uv_grid[ i + j * iSize ]; }
|
||||||
|
void shift ( size_t nb, bool keepUnitOri );
|
||||||
|
int & nbNodeOut( int iSide ) { return side[ iSide ].nbNodeOut; }
|
||||||
|
bool findCell ( const gp_XY& uv, int & i, int & j );
|
||||||
|
bool isNear ( const gp_XY& uv, int & i, int & j, int nbLoops=1 );
|
||||||
|
bool isEqual ( const gp_XY& uv, int i, int j );
|
||||||
|
void normPa2IJ( double x, double y, int & i, int & j );
|
||||||
|
void updateUV ( const gp_XY& uv, int i, int j, bool isVertical );
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<FaceQuadStruct> Ptr;
|
||||||
|
};
|
||||||
|
|
||||||
class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo
|
class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo
|
||||||
{
|
{
|
||||||
@ -89,16 +135,17 @@ protected:
|
|||||||
std::vector<int>& aNbNodes,
|
std::vector<int>& aNbNodes,
|
||||||
bool& IsQuadratic);
|
bool& IsQuadratic);
|
||||||
|
|
||||||
bool setNormalizedGrid(SMESH_Mesh& aMesh,
|
bool setNormalizedGrid(FaceQuadStruct::Ptr quad);
|
||||||
const TopoDS_Face& aFace,
|
|
||||||
FaceQuadStruct::Ptr& quad);
|
|
||||||
|
|
||||||
void splitQuad(SMESHDS_Mesh *theMeshDS,
|
void splitQuadFace(SMESHDS_Mesh * theMeshDS,
|
||||||
const int theFaceID,
|
const int theFaceID,
|
||||||
const SMDS_MeshNode* theNode1,
|
const SMDS_MeshNode* theNode1,
|
||||||
const SMDS_MeshNode* theNode2,
|
const SMDS_MeshNode* theNode2,
|
||||||
const SMDS_MeshNode* theNode3,
|
const SMDS_MeshNode* theNode3,
|
||||||
const SMDS_MeshNode* theNode4);
|
const SMDS_MeshNode* theNode4);
|
||||||
|
|
||||||
|
bool computeQuadDominant(SMESH_Mesh& aMesh,
|
||||||
|
const TopoDS_Face& aFace);
|
||||||
|
|
||||||
bool computeQuadDominant(SMESH_Mesh& aMesh,
|
bool computeQuadDominant(SMESH_Mesh& aMesh,
|
||||||
const TopoDS_Face& aFace,
|
const TopoDS_Face& aFace,
|
||||||
@ -108,6 +155,10 @@ protected:
|
|||||||
const TopoDS_Face& aFace,
|
const TopoDS_Face& aFace,
|
||||||
FaceQuadStruct::Ptr quad);
|
FaceQuadStruct::Ptr quad);
|
||||||
|
|
||||||
|
bool computeTriangles(SMESH_Mesh& aMesh,
|
||||||
|
const TopoDS_Face& aFace,
|
||||||
|
FaceQuadStruct::Ptr quad);
|
||||||
|
|
||||||
bool evaluateQuadPref(SMESH_Mesh& aMesh,
|
bool evaluateQuadPref(SMESH_Mesh& aMesh,
|
||||||
const TopoDS_Shape& aShape,
|
const TopoDS_Shape& aShape,
|
||||||
std::vector<int>& aNbNodes,
|
std::vector<int>& aNbNodes,
|
||||||
@ -129,20 +180,43 @@ protected:
|
|||||||
int & theNbDegenEdges,
|
int & theNbDegenEdges,
|
||||||
const bool considerMesh);
|
const bool considerMesh);
|
||||||
|
|
||||||
|
bool getEnforcedUV();
|
||||||
|
|
||||||
|
bool addEnforcedNodes();
|
||||||
|
|
||||||
|
int splitQuad(FaceQuadStruct::Ptr quad, int i, int j);
|
||||||
|
|
||||||
|
typedef std::map< StdMeshers_FaceSidePtr, std::vector< FaceQuadStruct::Ptr > > TQuadsBySide;
|
||||||
|
void updateSideUV( FaceQuadStruct::Side& side,
|
||||||
|
int iForced,
|
||||||
|
const TQuadsBySide& quads,
|
||||||
|
int * iNext=NULL);
|
||||||
|
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
|
||||||
// true if QuadranglePreference hypothesis is assigned that forces
|
|
||||||
// construction of quadrangles if the number of nodes on opposite edges
|
|
||||||
// is not the same in the case where the global number of nodes on edges
|
|
||||||
// is even
|
|
||||||
bool myQuadranglePreference;
|
bool myQuadranglePreference;
|
||||||
bool myTrianglePreference;
|
bool myTrianglePreference;
|
||||||
int myTriaVertexID;
|
int myTriaVertexID;
|
||||||
bool myNeedSmooth;
|
bool myNeedSmooth;
|
||||||
|
const StdMeshers_QuadrangleParams* myParams;
|
||||||
|
StdMeshers_QuadType myQuadType;
|
||||||
|
|
||||||
StdMeshers_QuadType myQuadType;
|
SMESH_MesherHelper* myHelper;
|
||||||
SMESH_MesherHelper* myHelper; // tool for working with quadratic elements
|
SMESH_ProxyMesh::Ptr myProxyMesh;
|
||||||
SMESH_ProxyMesh::Ptr myProxyMesh;
|
std::list< FaceQuadStruct::Ptr > myQuadList;
|
||||||
FaceQuadStruct::Ptr myQuadStruct;
|
|
||||||
|
struct ForcedPoint
|
||||||
|
{
|
||||||
|
gp_XY uv;
|
||||||
|
gp_XYZ xyz;
|
||||||
|
TopoDS_Vertex vertex;
|
||||||
|
|
||||||
|
double U() const { return uv.X(); }
|
||||||
|
double V() const { return uv.Y(); }
|
||||||
|
operator const gp_XY& () { return uv; }
|
||||||
|
};
|
||||||
|
std::vector< ForcedPoint > myForcedPnts;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,14 +21,17 @@
|
|||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
|
|
||||||
#include "StdMeshers_QuadrangleParams_i.hxx"
|
#include "StdMeshers_QuadrangleParams_i.hxx"
|
||||||
#include "SMESH_Gen_i.hxx"
|
|
||||||
#include "SMESH_Gen.hxx"
|
#include "SMESH_Gen.hxx"
|
||||||
|
#include "SMESH_Gen_i.hxx"
|
||||||
#include "SMESH_PythonDump.hxx"
|
#include "SMESH_PythonDump.hxx"
|
||||||
|
#include "StdMeshers_ObjRefUlils.hxx"
|
||||||
|
|
||||||
#include "Utils_CorbaException.hxx"
|
#include <Utils_CorbaException.hxx>
|
||||||
#include "utilities.h"
|
#include <utilities.h>
|
||||||
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <Standard_ErrorHandler.hxx>
|
||||||
|
#include "SMESH_TryCatch.hxx"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -82,13 +85,11 @@ void StdMeshers_QuadrangleParams_i::SetTriaVertex(CORBA::Long vertID)
|
|||||||
this->GetImpl()->SetTriaVertex( vertID );
|
this->GetImpl()->SetTriaVertex( vertID );
|
||||||
}
|
}
|
||||||
catch ( SALOME_Exception& S_ex ) {
|
catch ( SALOME_Exception& S_ex ) {
|
||||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||||
SALOME::BAD_PARAM );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Python script
|
// Update Python script
|
||||||
SMESH::TPythonDump() << _this() << ".SetTriaVertex( "
|
SMESH::TPythonDump() << _this() << ".SetTriaVertex( " << vertID << " )";
|
||||||
<< vertID << " )";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -147,8 +148,7 @@ char* StdMeshers_QuadrangleParams_i::GetObjectEntry()
|
|||||||
entry = this->GetImpl()->GetObjectEntry();
|
entry = this->GetImpl()->GetObjectEntry();
|
||||||
}
|
}
|
||||||
catch ( SALOME_Exception& S_ex ) {
|
catch ( SALOME_Exception& S_ex ) {
|
||||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||||
SALOME::BAD_PARAM );
|
|
||||||
}
|
}
|
||||||
return CORBA::string_dup( entry );
|
return CORBA::string_dup( entry );
|
||||||
}
|
}
|
||||||
@ -162,12 +162,6 @@ char* StdMeshers_QuadrangleParams_i::GetObjectEntry()
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type)
|
void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type)
|
||||||
{
|
{
|
||||||
//static char* quadTypes[5] = {"StdMeshers.QUAD_STANDARD",
|
|
||||||
// "StdMeshers.QUAD_TRIANGLE_PREF",
|
|
||||||
// "StdMeshers.QUAD_QUADRANGLE_PREF",
|
|
||||||
// "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED",
|
|
||||||
// "StdMeshers.QUAD_REDUCED"};
|
|
||||||
|
|
||||||
MESSAGE("StdMeshers_QuadrangleParams_i::SetQuadType");
|
MESSAGE("StdMeshers_QuadrangleParams_i::SetQuadType");
|
||||||
ASSERT(myBaseImpl);
|
ASSERT(myBaseImpl);
|
||||||
|
|
||||||
@ -199,7 +193,6 @@ void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type)
|
|||||||
quadType = "UNKNOWN";
|
quadType = "UNKNOWN";
|
||||||
}
|
}
|
||||||
SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadType << " )";
|
SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadType << " )";
|
||||||
//SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadTypes[int(type)] << " )";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -216,6 +209,100 @@ StdMeshers::QuadType StdMeshers_QuadrangleParams_i::GetQuadType()
|
|||||||
return StdMeshers::QuadType(int(this->GetImpl()->GetQuadType()));
|
return StdMeshers::QuadType(int(this->GetImpl()->GetQuadType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Set positions of enforced nodes
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void StdMeshers_QuadrangleParams_i::SetEnforcedNodes(const GEOM::ListOfGO& theVertices,
|
||||||
|
const SMESH::nodes_array& thePoints)
|
||||||
|
throw ( SALOME::SALOME_Exception )
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
std::vector< TopoDS_Shape > shapes;
|
||||||
|
std::vector< gp_Pnt > points;
|
||||||
|
shapes.reserve( theVertices.length() );
|
||||||
|
points.reserve( thePoints.length() );
|
||||||
|
|
||||||
|
myShapeEntries.clear();
|
||||||
|
|
||||||
|
for ( size_t i = 0; i < theVertices.length(); ++i )
|
||||||
|
{
|
||||||
|
if ( CORBA::is_nil( theVertices[i] ))
|
||||||
|
continue;
|
||||||
|
CORBA::String_var entry = theVertices[i]->GetStudyEntry();
|
||||||
|
if ( !entry.in() || !entry.in()[0] )
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION( "Not published enforced vertex shape", SALOME::BAD_PARAM );
|
||||||
|
|
||||||
|
shapes.push_back( StdMeshers_ObjRefUlils::GeomObjectToShape( theVertices[i].in() ));
|
||||||
|
myShapeEntries.push_back( entry.in() );
|
||||||
|
}
|
||||||
|
for ( size_t i = 0; i < thePoints.length(); ++i )
|
||||||
|
{
|
||||||
|
points.push_back( gp_Pnt( thePoints[i].x, thePoints[i].y, thePoints[i].z ));
|
||||||
|
}
|
||||||
|
this->GetImpl()->SetEnforcedNodes( shapes, points );
|
||||||
|
}
|
||||||
|
catch ( SALOME_Exception& S_ex ) {
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||||
|
}
|
||||||
|
// Update Python script
|
||||||
|
SMESH::TPythonDump() << _this() << ".SetEnforcedNodes( "
|
||||||
|
<< theVertices << ", " << thePoints << " )";
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Returns positions of enforced nodes
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void StdMeshers_QuadrangleParams_i::GetEnforcedNodes(GEOM::ListOfGO_out theVertices,
|
||||||
|
SMESH::nodes_array_out thePoints)
|
||||||
|
{
|
||||||
|
SMESH_TRY;
|
||||||
|
|
||||||
|
std::vector< TopoDS_Shape > shapes;
|
||||||
|
std::vector< gp_Pnt > points;
|
||||||
|
this->GetImpl()->GetEnforcedNodes( shapes, points );
|
||||||
|
|
||||||
|
theVertices = new GEOM::ListOfGO;
|
||||||
|
thePoints = new SMESH::nodes_array;
|
||||||
|
|
||||||
|
size_t i = 0;
|
||||||
|
theVertices->length( myShapeEntries.size() );
|
||||||
|
for ( i = 0; i < myShapeEntries.size(); ++i )
|
||||||
|
theVertices[i] =
|
||||||
|
StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject( myShapeEntries[i], shapes[i] );
|
||||||
|
|
||||||
|
thePoints->length( points.size() );
|
||||||
|
for ( i = 0; i < points.size(); ++i )
|
||||||
|
{
|
||||||
|
thePoints[i].x = points[i].X();
|
||||||
|
thePoints[i].y = points[i].Y();
|
||||||
|
thePoints[i].z = points[i].Z();
|
||||||
|
}
|
||||||
|
SMESH_CATCH( SMESH::doNothing );
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Returns study entries of shapes defining enforced nodes
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
SMESH::string_array* StdMeshers_QuadrangleParams_i::GetEnfVertices()
|
||||||
|
{
|
||||||
|
SMESH::string_array_var arr = new SMESH::string_array;
|
||||||
|
arr->length( myShapeEntries.size() );
|
||||||
|
|
||||||
|
for ( size_t i = 0; i < myShapeEntries.size(); ++i )
|
||||||
|
arr[ i ] = myShapeEntries[ i ].c_str();
|
||||||
|
|
||||||
|
return arr._retn();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* StdMeshers_QuadrangleParams_i::GetImpl
|
* StdMeshers_QuadrangleParams_i::GetImpl
|
||||||
@ -243,3 +330,58 @@ CORBA::Boolean StdMeshers_QuadrangleParams_i::IsDimSupported( SMESH::Dimension t
|
|||||||
{
|
{
|
||||||
return type == SMESH::DIM_2D;
|
return type == SMESH::DIM_2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Write parameters in a string
|
||||||
|
* \retval char* - resulting string
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
char* StdMeshers_QuadrangleParams_i::SaveTo()
|
||||||
|
{
|
||||||
|
ASSERT( myBaseImpl );
|
||||||
|
std::ostringstream os;
|
||||||
|
|
||||||
|
os << "ENTRIES: " << myShapeEntries.size();
|
||||||
|
for ( size_t i = 0; i < myShapeEntries.size(); ++i )
|
||||||
|
StdMeshers_ObjRefUlils::SaveToStream( myShapeEntries[ i ], os );
|
||||||
|
os << " ";
|
||||||
|
|
||||||
|
myBaseImpl->SaveTo( os );
|
||||||
|
|
||||||
|
return CORBA::string_dup( os.str().c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Retrieve parameters from the string
|
||||||
|
* \param theStream - the input string
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void StdMeshers_QuadrangleParams_i::LoadFrom( const char* theStream )
|
||||||
|
{
|
||||||
|
ASSERT( myBaseImpl );
|
||||||
|
|
||||||
|
bool hasEntries = ( strncmp( "ENTRIES: ", theStream, 9 ) == 0 );
|
||||||
|
std::istringstream is( theStream + ( hasEntries ? 9 : 0 ));
|
||||||
|
|
||||||
|
if ( hasEntries )
|
||||||
|
{
|
||||||
|
int nb = 0;
|
||||||
|
if ( is >> nb && nb > 0 )
|
||||||
|
{
|
||||||
|
std::vector< TopoDS_Shape > shapes;
|
||||||
|
std::vector< gp_Pnt > points;
|
||||||
|
myShapeEntries.resize( nb );
|
||||||
|
|
||||||
|
for ( int i = 0; i < nb; ++i )
|
||||||
|
shapes.push_back( StdMeshers_ObjRefUlils::LoadFromStream( is, & myShapeEntries[i] ));
|
||||||
|
|
||||||
|
GetImpl()->SetEnforcedNodes( shapes, points );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myBaseImpl->LoadFrom( is );
|
||||||
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
// File : StdMeshers_QuadrangleParams_i.hxx
|
// File : StdMeshers_QuadrangleParams_i.hxx
|
||||||
// Author : Sergey KUUL, OCC
|
// Author : Sergey KUUL, OCC
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
// $Header$
|
|
||||||
|
|
||||||
#ifndef _SMESH_QUADRANGLEPARAMS_I_HXX_
|
#ifndef _SMESH_QUADRANGLEPARAMS_I_HXX_
|
||||||
#define _SMESH_QUADRANGLEPARAMS_I_HXX_
|
#define _SMESH_QUADRANGLEPARAMS_I_HXX_
|
||||||
@ -47,13 +46,6 @@ public:
|
|||||||
// Destructor
|
// Destructor
|
||||||
virtual ~StdMeshers_QuadrangleParams_i();
|
virtual ~StdMeshers_QuadrangleParams_i();
|
||||||
|
|
||||||
// Set length
|
|
||||||
//void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
|
|
||||||
// throw ( SALOME::SALOME_Exception );
|
|
||||||
|
|
||||||
// Get length
|
|
||||||
//CORBA::Double GetLength(CORBA::Boolean theIsStart);
|
|
||||||
|
|
||||||
// Set base vertex for triangles
|
// Set base vertex for triangles
|
||||||
void SetTriaVertex (CORBA::Long vertID);
|
void SetTriaVertex (CORBA::Long vertID);
|
||||||
|
|
||||||
@ -72,11 +64,31 @@ public:
|
|||||||
// Get the type of quadrangulation
|
// Get the type of quadrangulation
|
||||||
StdMeshers::QuadType GetQuadType();
|
StdMeshers::QuadType GetQuadType();
|
||||||
|
|
||||||
|
// Set positions of enforced nodes
|
||||||
|
void SetEnforcedNodes(const GEOM::ListOfGO& vertices,
|
||||||
|
const SMESH::nodes_array& points) throw ( SALOME::SALOME_Exception );
|
||||||
|
|
||||||
|
// Returns positions of enforced nodes
|
||||||
|
void GetEnforcedNodes(GEOM::ListOfGO_out vertices, SMESH::nodes_array_out points);
|
||||||
|
|
||||||
|
// Returns entries of shapes defining enforced nodes
|
||||||
|
SMESH::string_array* GetEnfVertices();
|
||||||
|
|
||||||
|
|
||||||
// Get implementation
|
// Get implementation
|
||||||
::StdMeshers_QuadrangleParams* GetImpl();
|
::StdMeshers_QuadrangleParams* GetImpl();
|
||||||
|
|
||||||
// Verify whether hypothesis supports given entity type
|
// Verify whether hypothesis supports given entity type
|
||||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||||
|
|
||||||
|
// Redefined Persistence
|
||||||
|
virtual char* SaveTo();
|
||||||
|
virtual void LoadFrom( const char* theStream );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
std::vector<std::string> myShapeEntries;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user