[HYDRO module - Feature #523] river, channel, embankment meshing

This commit is contained in:
eap 2015-06-15 21:31:23 +03:00
parent 6ae3c2c26f
commit 6dcb33ab2f
22 changed files with 3335 additions and 29 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -58,7 +58,8 @@ without geometrical objects.
There is also a number of more specific algorithms: There is also a number of more specific algorithms:
<ul> <ul>
<li>\subpage prism_3d_algo_page "for meshing prismatic shapes"</li> <li>\subpage prism_3d_algo_page "for meshing prismatic 3D shapes"</li>
<li>\subpage quad_from_ma_algo_page "for meshing faces with sinuous borders"</li>
<li>\subpage projection_algos_page "for meshing by projection of another mesh"</li> <li>\subpage projection_algos_page "for meshing by projection of another mesh"</li>
<li>\subpage import_algos_page "for meshing by importing elements from another mesh"</li> <li>\subpage import_algos_page "for meshing by importing elements from another mesh"</li>
<li>\subpage radial_prism_algo_page "for meshing geometrical objects with cavities"</li> <li>\subpage radial_prism_algo_page "for meshing geometrical objects with cavities"</li>

View File

@ -0,0 +1,30 @@
/*!
\page quad_from_ma_algo_page Medial Axis Projection Quadrangle meshing algorithm
Medial Axis Projection algorithm can be used for meshing faces with
sinuous borders and having channel-like shape, for which is it
difficult to define 1D hypotheses so that generated quadrangles to be
of good shape.
\image html quad_from_ma_mesh.png "A mesh of a river model"
The algorithm assures good shape of quadrangles by constructing Medial
Axis between sinuous borders of the face and using it to
discretize the borders.
\image html quad_from_ma_medial_axis.png "Media Axis between two blue sinuous borders"
The Medial Axis is used in two ways:
<ol>
<li>If there is a sub-mesh on either sinuous border, then the nodes of
this border are mapped to the opposite border via the Medial
Axis.</li>
<li> If there is no sub-meshes on the sinuous borders, then a part of
the Medial Axis that can be mapped to both borders is discretized
using a hypothesis assigned to the face or its ancestor shapes,
and the division points are mapped from the Medial Axis to the both
borders.</li>
</ol>
*/

View File

@ -1090,6 +1090,13 @@ module StdMeshers
{ {
}; };
/*!
* StdMeshers_QuadFromMedialAxis_1D2D: interface of "Quadrangle (Medial Axis Projection)" algorithm
*/
interface StdMeshers_QuadFromMedialAxis_1D2D : SMESH::SMESH_2D_Algo
{
};
/*! /*!
* StdMeshers_Hexa_3D: interface of "Hexahedron (i,j,k)" algorithm * StdMeshers_Hexa_3D: interface of "Hexahedron (i,j,k)" algorithm
*/ */

View File

@ -311,6 +311,19 @@
</python-wrap> </python-wrap>
</algorithm> </algorithm>
<algorithm type ="QuadFromMedialAxis_1D2D"
label-id ="Quadrangle (Medial Axis Projection)"
icon-id ="mesh_algo_quad.png"
opt-hypos="ViscousLayers2D"
input ="EDGE"
output ="QUAD"
dim ="2">
<python-wrap>
<algo>QuadFromMedialAxis_1D2D=Quadrangle(algo=smeshBuilder.QUAD_MA_PROJ)</algo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap>
</algorithm>
<algorithm type ="Hexa_3D" <algorithm type ="Hexa_3D"
label-id ="Hexahedron (i,j,k)" label-id ="Hexahedron (i,j,k)"
icon-id ="mesh_algo_hexa.png" icon-id ="mesh_algo_hexa.png"

View File

@ -32,6 +32,7 @@
#include "SMDS_IteratorOnIterators.hxx" #include "SMDS_IteratorOnIterators.hxx"
#include "SMDS_VolumeTool.hxx" #include "SMDS_VolumeTool.hxx"
#include "SMESH_Block.hxx" #include "SMESH_Block.hxx"
#include "SMESH_HypoFilter.hxx"
#include "SMESH_MeshAlgos.hxx" #include "SMESH_MeshAlgos.hxx"
#include "SMESH_ProxyMesh.hxx" #include "SMESH_ProxyMesh.hxx"
#include "SMESH_subMesh.hxx" #include "SMESH_subMesh.hxx"
@ -3206,6 +3207,28 @@ TopAbs_ShapeEnum SMESH_MesherHelper::GetGroupType(const TopoDS_Shape& group,
return TopAbs_SHAPE; return TopAbs_SHAPE;
} }
//================================================================================
/*!
* \brief Returns a shape, to which a hypothesis used to mesh a given shape is assigned
* \param [in] hyp - the hypothesis
* \param [in] shape - the shape, for meshing which the \a hyp is used
* \param [in] mesh - the mesh
* \return TopoDS_Shape - the shape the \a hyp is assigned to
*/
//================================================================================
TopoDS_Shape SMESH_MesherHelper::GetShapeOfHypothesis( const SMESHDS_Hypothesis * hyp,
const TopoDS_Shape& shape,
SMESH_Mesh* mesh)
{
const SMESH_Hypothesis* h = static_cast<const SMESH_Hypothesis*>( hyp );
SMESH_HypoFilter hypFilter( SMESH_HypoFilter::Is( h ));
TopoDS_Shape shapeOfHyp;
mesh->GetHypothesis( shape, hypFilter, /*checkAncestors=*/true, &shapeOfHyp );
return shapeOfHyp;
}
//======================================================================= //=======================================================================
//function : IsQuadraticMesh //function : IsQuadraticMesh
//purpose : Check mesh without geometry for: if all elements on this shape are quadratic, //purpose : Check mesh without geometry for: if all elements on this shape are quadratic,

View File

@ -236,6 +236,10 @@ class SMESH_EXPORT SMESH_MesherHelper
static TopAbs_ShapeEnum GetGroupType(const TopoDS_Shape& group, static TopAbs_ShapeEnum GetGroupType(const TopoDS_Shape& group,
const bool avoidCompound=false); const bool avoidCompound=false);
static TopoDS_Shape GetShapeOfHypothesis( const SMESHDS_Hypothesis * hyp,
const TopoDS_Shape& shape,
SMESH_Mesh* mesh);
public: public:
// ---------- PUBLIC INSTANCE METHODS ---------- // ---------- PUBLIC INSTANCE METHODS ----------
@ -243,6 +247,8 @@ public:
// constructor // constructor
SMESH_MesherHelper(SMESH_Mesh& theMesh); SMESH_MesherHelper(SMESH_Mesh& theMesh);
SMESH_Gen* GetGen() const { return GetMesh()->GetGen(); }
SMESH_Mesh* GetMesh() const { return myMesh; } SMESH_Mesh* GetMesh() const { return myMesh; }
SMESHDS_Mesh* GetMeshDS() const { return GetMesh()->GetMeshDS(); } SMESHDS_Mesh* GetMeshDS() const { return GetMesh()->GetMeshDS(); }

View File

@ -63,6 +63,7 @@ SET(SMESHUtils_HEADERS
SMESH_Utils.hxx SMESH_Utils.hxx
SMESH_TryCatch.hxx SMESH_TryCatch.hxx
SMESH_MeshAlgos.hxx SMESH_MeshAlgos.hxx
SMESH_MAT2d.hxx
) )
# --- sources --- # --- sources ---
@ -76,6 +77,7 @@ SET(SMESHUtils_SOURCES
SMESH_TryCatch.cxx SMESH_TryCatch.cxx
SMESH_File.cxx SMESH_File.cxx
SMESH_MeshAlgos.cxx SMESH_MeshAlgos.cxx
SMESH_MAT2d.cxx
) )
# --- rules --- # --- rules ---

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,224 @@
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MAT2d.hxx
// Created : Thu May 28 17:49:53 2015
// Author : Edward AGAPOV (eap)
#ifndef __SMESH_MAT2d_HXX__
#define __SMESH_MAT2d_HXX__
#include "SMESH_Utils.hxx"
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <vector>
#include <map>
#include <boost/polygon/polygon.hpp>
#include <boost/polygon/voronoi.hpp>
class Adaptor3d_Curve;
// Medial Axis Transform 2D
namespace SMESH_MAT2d
{
class MedialAxis; // MedialAxis is the entry point
class Branch;
class BranchEnd;
class Boundary;
struct BoundaryPoint;
typedef boost::polygon::voronoi_diagram<double> TVD;
typedef TVD::cell_type TVDCell;
typedef TVD::edge_type TVDEdge;
typedef TVD::vertex_type TVDVertex;
//-------------------------------------------------------------------------------------
// type of Branch end point
enum BranchEndType { BE_UNDEF,
BE_ON_VERTEX, // branch ends at a convex VRTEX
BE_BRANCH_POINT, // branch meats 2 or more other branches
BE_END // branch end equidistant from several adjacent segments
};
//-------------------------------------------------------------------------------------
/*!
* \brief End point of MA Branch
*/
struct SMESHUtils_EXPORT BranchEnd
{
const TVDVertex* _vertex;
BranchEndType _type;
std::vector< const Branch* > _branches;
BranchEnd(): _vertex(0), _type( BE_UNDEF ) {}
};
//-------------------------------------------------------------------------------------
/*!
* \brief Point on MA Branch
*/
struct SMESHUtils_EXPORT BranchPoint
{
const Branch* _branch;
std::size_t _iEdge; // MA edge index within the branch
double _edgeParam; // normalized param within the MA edge
BranchPoint(): _branch(0), _iEdge(0), _edgeParam(-1) {}
};
//-------------------------------------------------------------------------------------
/*!
* \brief Branch is a set of MA edges enclosed between branch points and/or MA ends.
* It's main feature is to return two BoundaryPoint's per a point on it.
*/
class SMESHUtils_EXPORT Branch
{
public:
bool getBoundaryPoints(double param, BoundaryPoint& bp1, BoundaryPoint& bp2 ) const;
bool getBoundaryPoints(std::size_t iMAEdge, double maEdgeParam,
BoundaryPoint& bp1, BoundaryPoint& bp2 ) const;
bool getBoundaryPoints(const BranchPoint& p,
BoundaryPoint& bp1, BoundaryPoint& bp2 ) const;
bool getParameter(const BranchPoint& p, double & u ) const;
std::size_t nbEdges() const { return _maEdges.size(); }
const BranchEnd* getEnd(bool the2nd) const { return & ( the2nd ? _endPoint2 : _endPoint1 ); }
bool hasEndOfType(BranchEndType type) const;
void getPoints( std::vector< gp_XY >& points, const double scale[2]) const;
void getGeomEdges( std::vector< std::size_t >& edgeIDs1,
std::vector< std::size_t >& edgeIDs2 ) const;
void getOppositeGeomEdges( std::vector< std::size_t >& edgeIDs1,
std::vector< std::size_t >& edgeIDs2,
std::vector< BranchPoint >& divPoints) const;
// construction
void init( std::vector<const TVDEdge*>& maEdges,
const Boundary* boundary,
std::map< const TVDVertex*, BranchEndType > endType);
void setBranchesToEnds( const std::vector< Branch >& branches);
static void setGeomEdge( std::size_t geomIndex, const TVDEdge* maEdge );
static std::size_t getGeomEdge( const TVDEdge* maEdge );
static void setBndSegment( std::size_t segIndex, const TVDEdge* maEdge );
static std::size_t getBndSegment( const TVDEdge* maEdge );
private:
bool addDivPntForConcaVertex( std::vector< std::size_t >& edgeIDs1,
std::vector< std::size_t >& edgeIDs2,
std::vector< BranchPoint >& divPoints,
const std::vector<const TVDEdge*>& maEdges,
const std::vector<const TVDEdge*>& maEdgesTwin,
size_t & i) const;
// association of _maEdges with boundary segments is stored in this way:
// index of an EDGE: TVDEdge->cell()->color()
// index of a segment on EDGE: TVDEdge->color()
std::vector<const TVDEdge*> _maEdges; // MA edges ending at points located at _params
std::vector<double> _params; // params of points on MA, normalized [0;1] within this branch
const Boundary* _boundary; // face boundary
BranchEnd _endPoint1;
BranchEnd _endPoint2;
};
//-------------------------------------------------------------------------------------
/*!
* \brief Data of a discretized EDGE allowing to get a point on MA by a parameter on EDGE
*/
struct BndPoints
{
std::vector< double > _params; // params of discretization points on an EDGE
std::vector< std::pair< const Branch*, int > > _maEdges; /* index of TVDEdge in branch;
index sign means orientation;
index == Branch->nbEdges() means
end point of a Branch */
};
//-------------------------------------------------------------------------------------
/*!
* \brief Face boundary is discretized so that each its segment to correspond to
* an edge of MA
*/
class Boundary
{
public:
Boundary( std::size_t nbEdges ): _pointsPerEdge( nbEdges ) {}
BndPoints& getPoints( std::size_t iEdge ) { return _pointsPerEdge[ iEdge ]; }
std::size_t nbEdges() const { return _pointsPerEdge.size(); }
bool getPoint( std::size_t iEdge, std::size_t iSeg, double u, BoundaryPoint& bp ) const;
bool getBranchPoint( const std::size_t iEdge, double u, BranchPoint& p ) const;
bool IsConcaveSegment( std::size_t iEdge, std::size_t iSeg ) const;
private:
std::vector< BndPoints > _pointsPerEdge;
};
//-------------------------------------------------------------------------------------
/*!
* \brief Point on FACE boundary
*/
struct SMESHUtils_EXPORT BoundaryPoint
{
std::size_t _edgeIndex; // index of an EDGE in a sequence passed to MedialAxis()
double _param; // parameter of this EDGE
};
//-------------------------------------------------------------------------------------
/*!
* \brief Medial axis (MA) is defined as the loci of centres of locally
* maximal balls inside 2D representation of a face. This class
* implements a piecewise approximation of MA.
*/
class SMESHUtils_EXPORT MedialAxis
{
public:
MedialAxis(const TopoDS_Face& face,
const std::vector< TopoDS_Edge >& edges,
const double minSegLen,
const bool ignoreCorners = false );
const Boundary& getBoundary() const { return _boundary; }
const std::vector< Branch >& getBranches() const { return _branch; }
const std::vector< const BranchEnd* >& getBranchPoints() const { return _branchPnt; }
void getPoints( const Branch& branch, std::vector< gp_XY >& points) const;
Adaptor3d_Curve* make3DCurve(const Branch& branch) const;
private:
private:
TopoDS_Face _face;
TVD _vd;
std::vector< Branch > _branch;
std::vector< const BranchEnd* > _branchPnt;
Boundary _boundary;
double _scale[2];
};
}
#endif

View File

@ -42,6 +42,8 @@ Hexa = "Hexa_3D"
QUADRANGLE = "Quadrangle_2D" QUADRANGLE = "Quadrangle_2D"
## Algorithm type: Radial Quadrangle 1D-2D algorithm, see StdMeshersBuilder_RadialQuadrangle1D2D ## Algorithm type: Radial Quadrangle 1D-2D algorithm, see StdMeshersBuilder_RadialQuadrangle1D2D
RADIAL_QUAD = "RadialQuadrangle_1D2D" RADIAL_QUAD = "RadialQuadrangle_1D2D"
## Algorithm type: Quadrangle (Medial Axis Projection) 1D-2D algorithm, see StdMeshersBuilder_QuadMA_1D2D
QUAD_MA_PROJ = "QuadFromMedialAxis_1D2D"
# import items of enums # import items of enums
for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e)) for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e))
@ -455,9 +457,6 @@ class StdMeshersBuilder_Segment_Python(Mesh_Algorithm):
algoType = PYTHON algoType = PYTHON
## doc string of the method ## doc string of the method
# @internal # @internal
docHelper = "Creates tetrahedron 3D algorithm for solids"
## doc string of the method
# @internal
docHelper = "Creates segment 1D algorithm for edges" docHelper = "Creates segment 1D algorithm for edges"
## Private constructor. ## Private constructor.
@ -856,7 +855,7 @@ class StdMeshersBuilder_Projection1D2D(StdMeshersBuilder_Projection2D):
algoType = "Projection_1D2D" algoType = "Projection_1D2D"
## doc string of the method ## doc string of the method
# @internal # @internal
docHelper = "Creates projection 1D-2D algorithm for edges and faces" docHelper = "Creates projection 1D-2D algorithm for faces"
## Private constructor. ## Private constructor.
# @param mesh parent mesh object algorithm is assigned to # @param mesh parent mesh object algorithm is assigned to
@ -1115,7 +1114,7 @@ class StdMeshersBuilder_RadialPrism3D(StdMeshersBuilder_Prism3D):
algoType = "RadialPrism_3D" algoType = "RadialPrism_3D"
## doc string of the method ## doc string of the method
# @internal # @internal
docHelper = "Creates prism 3D algorithm for volumes" docHelper = "Creates Raial Prism 3D algorithm for volumes"
## Private constructor. ## Private constructor.
# @param mesh parent mesh object algorithm is assigned to # @param mesh parent mesh object algorithm is assigned to
@ -1147,7 +1146,7 @@ class StdMeshersBuilder_RadialQuadrangle1D2D(Mesh_Algorithm):
algoType = RADIAL_QUAD algoType = RADIAL_QUAD
## doc string of the method ## doc string of the method
# @internal # @internal
docHelper = "Creates quadrangle 1D-2D algorithm for triangular faces" docHelper = "Creates quadrangle 1D-2D algorithm for faces having a shape of disk or a disk segment"
## Private constructor. ## Private constructor.
# @param mesh parent mesh object algorithm is assigned to # @param mesh parent mesh object algorithm is assigned to
@ -1258,6 +1257,35 @@ class StdMeshersBuilder_RadialQuadrangle1D2D(Mesh_Algorithm):
pass # end of StdMeshersBuilder_RadialQuadrangle1D2D class pass # end of StdMeshersBuilder_RadialQuadrangle1D2D class
## Defines a Quadrangle (Medial Axis Projection) 1D-2D algorithm
#
# It is created by calling smeshBuilder.Mesh.Quadrangle(smeshBuilder.QUAD_MA_PROJ,geom=0)
#
# @ingroup l2_algos_quad_ma
class StdMeshersBuilder_QuadMA_1D2D(Mesh_Algorithm):
## name of the dynamic method in smeshBuilder.Mesh class
# @internal
meshMethod = "Quadrangle"
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = QUAD_MA_PROJ
## doc string of the method
# @internal
docHelper = "Creates quadrangle 1D-2D algorithm for faces"
## Private constructor.
# @param mesh parent mesh object algorithm is assigned to
# @param geom geometry (shape/sub-shape) algorithm is assigned to;
# if it is @c 0 (default), the algorithm is assigned to the main shape
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
self.Create(mesh, geom, self.algoType)
pass
pass
## Defines a Use Existing Elements 1D algorithm ## Defines a Use Existing Elements 1D algorithm
# #
# It is created by calling smeshBuilder.Mesh.UseExisting1DElements(geom=0) # It is created by calling smeshBuilder.Mesh.UseExisting1DElements(geom=0)
@ -1327,7 +1355,7 @@ class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
isDefault = True isDefault = True
## doc string of the method ## doc string of the method
# @internal # @internal
docHelper = "Creates 1D-2D algorithm for edges/faces with reusing of existing mesh elements" docHelper = "Creates 1D-2D algorithm for faces with reusing of existing mesh elements"
## Private constructor. ## Private constructor.
# @param mesh parent mesh object algorithm is assigned to # @param mesh parent mesh object algorithm is assigned to
@ -1375,7 +1403,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
isDefault = True isDefault = True
## doc string of the method ## doc string of the method
# @internal # @internal
docHelper = "Creates body fitting 3D algorithm for volumes" docHelper = "Creates Body Fitting 3D algorithm for volumes"
## Private constructor. ## Private constructor.
# @param mesh parent mesh object algorithm is assigned to # @param mesh parent mesh object algorithm is assigned to
@ -1505,7 +1533,7 @@ class StdMeshersBuilder_UseExisting_1D(Mesh_Algorithm):
algoType = "UseExisting_1D" algoType = "UseExisting_1D"
## doc string of the method ## doc string of the method
# @internal # @internal
docHelper = "Creates 1D algorithm for edges with reusing of existing mesh elements" docHelper = "Creates 1D algorithm allowing batch meshing of edges"
## Private constructor. ## Private constructor.
# @param mesh parent mesh object algorithm is assigned to # @param mesh parent mesh object algorithm is assigned to
@ -1533,7 +1561,7 @@ class StdMeshersBuilder_UseExisting_2D(Mesh_Algorithm):
algoType = "UseExisting_2D" algoType = "UseExisting_2D"
## doc string of the method ## doc string of the method
# @internal # @internal
docHelper = "Creates 2D algorithm for faces with reusing of existing mesh elements" docHelper = "Creates 2D algorithm allowing batch meshing of faces"
## Private constructor. ## Private constructor.
# @param mesh parent mesh object algorithm is assigned to # @param mesh parent mesh object algorithm is assigned to

View File

@ -130,6 +130,7 @@ SET(StdMeshers_HEADERS
StdMeshers_Projection_1D2D.hxx StdMeshers_Projection_1D2D.hxx
StdMeshers_CartesianParameters3D.hxx StdMeshers_CartesianParameters3D.hxx
StdMeshers_Cartesian_3D.hxx StdMeshers_Cartesian_3D.hxx
StdMeshers_QuadFromMedialAxis_1D2D.hxx
) )
IF(SALOME_SMESH_ENABLE_MEFISTO) IF(SALOME_SMESH_ENABLE_MEFISTO)
@ -193,6 +194,7 @@ SET(StdMeshers_SOURCES
StdMeshers_CartesianParameters3D.cxx StdMeshers_CartesianParameters3D.cxx
StdMeshers_Cartesian_3D.cxx StdMeshers_Cartesian_3D.cxx
StdMeshers_Adaptive1D.cxx StdMeshers_Adaptive1D.cxx
StdMeshers_QuadFromMedialAxis_1D2D.cxx
) )
IF(SALOME_SMESH_ENABLE_MEFISTO) IF(SALOME_SMESH_ENABLE_MEFISTO)

View File

@ -696,7 +696,7 @@ void StdMeshers_MEFISTO_2D::ComputeScaleOnFace(SMESH_Mesh & aMesh,
double xmax = -1.e300; double xmax = -1.e300;
double ymin = 1.e300; double ymin = 1.e300;
double ymax = -1.e300; double ymax = -1.e300;
int nbp = 23; const int nbp = 23;
scalex = 1; scalex = 1;
scaley = 1; scaley = 1;
@ -720,13 +720,8 @@ void StdMeshers_MEFISTO_2D::ComputeScaleOnFace(SMESH_Mesh & aMesh,
ymin = p.Y(); ymin = p.Y();
if (p.Y() > ymax) if (p.Y() > ymax)
ymax = p.Y(); ymax = p.Y();
// MESSAGE(" "<< f<<" "<<l<<" "<<param<<" "<<xmin<<" "<<xmax<<" "<<ymin<<" "<<ymax);
} }
} }
// SCRUTE(xmin);
// SCRUTE(xmax);
// SCRUTE(ymin);
// SCRUTE(ymax);
double xmoy = (xmax + xmin) / 2.; double xmoy = (xmax + xmin) / 2.;
double ymoy = (ymax + ymin) / 2.; double ymoy = (ymax + ymin) / 2.;
double xsize = xmax - xmin; double xsize = xmax - xmin;
@ -754,23 +749,14 @@ void StdMeshers_MEFISTO_2D::ComputeScaleOnFace(SMESH_Mesh & aMesh,
} }
scalex = length_x / xsize; scalex = length_x / xsize;
scaley = length_y / ysize; scaley = length_y / ysize;
// SCRUTE(xsize);
// SCRUTE(ysize);
double xyratio = xsize*scalex/(ysize*scaley); double xyratio = xsize*scalex/(ysize*scaley);
const double maxratio = 1.e2; const double maxratio = 1.e2;
//SCRUTE(xyratio);
if (xyratio > maxratio) { if (xyratio > maxratio) {
SCRUTE( scaley );
scaley *= xyratio / maxratio; scaley *= xyratio / maxratio;
SCRUTE( scaley );
} }
else if (xyratio < 1./maxratio) { else if (xyratio < 1./maxratio) {
SCRUTE( scalex );
scalex *= 1 / xyratio / maxratio; scalex *= 1 / xyratio / maxratio;
SCRUTE( scalex );
} }
ASSERT(scalex);
ASSERT(scaley);
} }
// namespace // namespace

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : StdMeshers_QuadFromMedialAxis_1D2D.hxx
// Created : Wed Jun 3 17:22:35 2015
// Author : Edward AGAPOV (eap)
#ifndef __StdMeshers_QuadFromMedialAxis_1D2D_HXX__
#define __StdMeshers_QuadFromMedialAxis_1D2D_HXX__
#include "StdMeshers_Quadrangle_2D.hxx"
#include <vector>
/*!
* \brief Quadrangle mesher using Medial Axis
*/
class STDMESHERS_EXPORT StdMeshers_QuadFromMedialAxis_1D2D: public StdMeshers_Quadrangle_2D
{
public:
StdMeshers_QuadFromMedialAxis_1D2D(int hypId, int studyId, SMESH_Gen* gen);
virtual ~StdMeshers_QuadFromMedialAxis_1D2D();
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
Hypothesis_Status& aStatus);
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
virtual bool Evaluate(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap);
private:
bool computeQuads( SMESH_MesherHelper& theHelper,
const TopoDS_Face& theFace,
const std::vector<TopoDS_Edge> theSinuEdges[2],
const std::vector<TopoDS_Edge> theShortEdges[2]);
class Algo1D;
Algo1D* _regular1D;
};
#endif

View File

@ -1599,7 +1599,7 @@ void StdMeshers_Quadrangle_2D::shiftQuad(FaceQuadStruct::Ptr& quad, const int nu
//================================================================================ //================================================================================
/*! /*!
* \brief Rotate sides of a quad by given nb of quartes * \brief Rotate sides of a quad CCW by given nb of quartes
* \param nb - number of rotation quartes * \param nb - number of rotation quartes
* \param ori - to keep orientation of sides as in an unit quad or not * \param ori - to keep orientation of sides as in an unit quad or not
* \param keepGrid - if \c true Side::grid is not changed, Side::from and Side::to * \param keepGrid - if \c true Side::grid is not changed, Side::from and Side::to
@ -1611,6 +1611,8 @@ void FaceQuadStruct::shift( size_t nb, bool ori, bool keepGrid )
{ {
if ( nb == 0 ) return; if ( nb == 0 ) return;
nb = nb % NB_QUAD_SIDES;
vector< Side > newSides( side.size() ); vector< Side > newSides( side.size() );
vector< Side* > sidePtrs( side.size() ); vector< Side* > sidePtrs( side.size() );
for (int i = QUAD_BOTTOM_SIDE; i < NB_QUAD_SIDES; ++i) for (int i = QUAD_BOTTOM_SIDE; i < NB_QUAD_SIDES; ++i)
@ -1640,8 +1642,34 @@ void FaceQuadStruct::shift( size_t nb, bool ori, bool keepGrid )
} }
newSides.swap( side ); newSides.swap( side );
if ( keepGrid && !uv_grid.empty() )
{
if ( nb == 2 ) // "PI"
{
std::reverse( uv_grid.begin(), uv_grid.end() );
}
else
{
FaceQuadStruct newQuad;
newQuad.uv_grid.resize( uv_grid.size() );
newQuad.iSize = jSize;
newQuad.jSize = iSize;
int i, j, iRev, jRev;
int *iNew = ( nb == 1 ) ? &jRev : &j;
int *jNew = ( nb == 1 ) ? &i : &iRev;
for ( i = 0, iRev = iSize-1; i < iSize; ++i, --iRev )
for ( j = 0, jRev = jSize-1; j < jSize; ++j, --jRev )
newQuad.UVPt( *iNew, *jNew ) = UVPt( i, j );
std::swap( iSize, jSize );
std::swap( uv_grid, newQuad.uv_grid );
}
}
else
{
uv_grid.clear(); uv_grid.clear();
} }
}
//======================================================================= //=======================================================================
//function : calcUV //function : calcUV

View File

@ -119,6 +119,8 @@ struct FaceQuadStruct
FaceQuadStruct ( const TopoDS_Face& F = TopoDS_Face(), const std::string& nm="main" ); FaceQuadStruct ( const TopoDS_Face& F = TopoDS_Face(), const std::string& nm="main" );
UVPtStruct& UVPt( int i, int j ) { return uv_grid[ i + j * iSize ]; } UVPtStruct& UVPt( int i, int j ) { return uv_grid[ i + j * iSize ]; }
double& U( int i, int j ) { return UVPt( i, j ).u; }
double& V( int i, int j ) { return UVPt( i, j ).v; }
void shift ( size_t nb, bool keepUnitOri, bool keepGrid=false ); void shift ( size_t nb, bool keepUnitOri, bool keepGrid=false );
int & nbNodeOut( int iSide ) { return side[ iSide ].nbNodeOut; } int & nbNodeOut( int iSide ) { return side[ iSide ].nbNodeOut; }
bool findCell ( const gp_XY& uv, int & i, int & j ); bool findCell ( const gp_XY& uv, int & i, int & j );

View File

@ -143,6 +143,10 @@
<source>ICON_SMESH_TREE_ALGO_RadialQuadrangle_1D2D</source> <source>ICON_SMESH_TREE_ALGO_RadialQuadrangle_1D2D</source>
<translation>mesh_tree_algo_radial_quadrangle_1D2D.png</translation> <translation>mesh_tree_algo_radial_quadrangle_1D2D.png</translation>
</message> </message>
<message>
<source>ICON_SMESH_TREE_ALGO_QuadFromMedialAxis_1D2D</source>
<translation>mesh_tree_algo_quad.png</translation>
</message>
<message> <message>
<source>ICON_SMESH_TREE_ALGO_Prism_3D</source> <source>ICON_SMESH_TREE_ALGO_Prism_3D</source>
<translation>mesh_tree_algo_prism.png</translation> <translation>mesh_tree_algo_prism.png</translation>

View File

@ -32,6 +32,8 @@
#include "Utils_CorbaException.hxx" #include "Utils_CorbaException.hxx"
#include "utilities.h" #include "utilities.h"
#include "StdMeshers_QuadFromMedialAxis_1D2D.hxx"
using namespace std; using namespace std;
//============================================================================= //=============================================================================
@ -98,3 +100,39 @@ CORBA::Boolean StdMeshers_Quadrangle_2D_i::IsApplicable( const TopoDS_Shape &S,
return ::StdMeshers_Quadrangle_2D::IsApplicable( S, toCheckAll ); return ::StdMeshers_Quadrangle_2D::IsApplicable( S, toCheckAll );
} }
//=============================================================================
/*!
* StdMeshers_QuadFromMedialAxis_1D2D_i::StdMeshers_QuadFromMedialAxis_1D2D_i
*
* Constructor
*/
//=============================================================================
StdMeshers_QuadFromMedialAxis_1D2D_i::
StdMeshers_QuadFromMedialAxis_1D2D_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_Algo_i( thePOA ),
SMESH_2D_Algo_i( thePOA )
{
MESSAGE( "StdMeshers_QuadFromMedialAxis_1D2D_i::StdMeshers_QuadFromMedialAxis_1D2D_i" );
myBaseImpl = new ::StdMeshers_QuadFromMedialAxis_1D2D( theGenImpl->GetANewId(),
theStudyId,
theGenImpl );
}
//=============================================================================
/*!
* StdMeshers_QuadFromMedialAxis_1D2D_i::~StdMeshers_QuadFromMedialAxis_1D2D_i
*
* Destructor
*
*/
//=============================================================================
StdMeshers_QuadFromMedialAxis_1D2D_i::~StdMeshers_QuadFromMedialAxis_1D2D_i()
{
MESSAGE( "StdMeshers_QuadFromMedialAxis_1D2D_i::~StdMeshers_QuadFromMedialAxis_1D2D_i" );
}

View File

@ -62,4 +62,27 @@ class STDMESHERS_I_EXPORT StdMeshers_Quadrangle_2D_i:
static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll); static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll);
}; };
// ======================================================
// Quadrangle (Medial Axis Projection) 2d algorithm
// ======================================================
class STDMESHERS_I_EXPORT StdMeshers_QuadFromMedialAxis_1D2D_i:
public virtual POA_StdMeshers::StdMeshers_QuadFromMedialAxis_1D2D,
public virtual SMESH_2D_Algo_i
{
public:
// Constructor
StdMeshers_QuadFromMedialAxis_1D2D_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~StdMeshers_QuadFromMedialAxis_1D2D_i();
// Get implementation
//::StdMeshers_Quadrangle_2D* GetImpl();
// Return true if the algorithm is applicable to a shape
//static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll);
};
#endif #endif

View File

@ -216,6 +216,8 @@ STDMESHERS_I_EXPORT
#endif #endif
else if (strcmp(aHypName, "Quadrangle_2D") == 0) else if (strcmp(aHypName, "Quadrangle_2D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_Quadrangle_2D_i, StdMeshers_Quadrangle_2D_i>; aCreator = new StdHypothesisCreator_i<StdMeshers_Quadrangle_2D_i, StdMeshers_Quadrangle_2D_i>;
else if (strcmp(aHypName, "QuadFromMedialAxis_1D2D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_QuadFromMedialAxis_1D2D_i, StdMeshers_Quadrangle_2D_i>;
else if (strcmp(aHypName, "Hexa_3D") == 0) else if (strcmp(aHypName, "Hexa_3D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_Hexa_3D_i, StdMeshers_Hexa_3D_i>; aCreator = new StdHypothesisCreator_i<StdMeshers_Hexa_3D_i, StdMeshers_Hexa_3D_i>;
else if (strcmp(aHypName, "Projection_1D") == 0) else if (strcmp(aHypName, "Projection_1D") == 0)