IPAL53051: 3D Extrusion fails

+ minor doc modifs
This commit is contained in:
eap 2016-03-16 19:59:08 +03:00
parent 14534b5557
commit a695ce3aee
8 changed files with 52 additions and 41 deletions

View File

@ -1,4 +1,4 @@
# Construction of a Submesh # Construction of a Sub-mesh
import salome import salome
salome.salome_init() salome.salome_init()
@ -20,27 +20,31 @@ EdgeX = geompy.GetEdgeNearPoint(box, p5)
geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]") geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
# create a hexahedral mesh on the box # create a hexahedral mesh on the box
quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh") mesh = smesh.Mesh(box, "Box : hexahedral 3D mesh")
# create a regular 1D algorithm for the faces # create a Regular_1D algorithm for discretization of edges
algo1D = quadra.Segment() algo1D = mesh.Segment()
# define "NumberOfSegments" hypothesis to cut # define "NumberOfSegments" hypothesis to cut
# all the edges in a fixed number of segments # all the edges in a fixed number of segments
algo1D.NumberOfSegments(4) algo1D.NumberOfSegments(4)
# create a quadrangle 2D algorithm for the faces # create a quadrangle 2D algorithm for the faces
quadra.Quadrangle() mesh.Quadrangle()
# construct a submesh on the edge with a local hypothesis # construct a sub-mesh on the edge with a local Regular_1D algorithm
algo_local = quadra.Segment(EdgeX) algo_local = mesh.Segment(EdgeX)
# define "Arithmetic1D" hypothesis to cut the edge in several segments with increasing arithmetic length # define "Arithmetic1D" hypothesis to cut EdgeX in several segments with length arithmetically
# increasing from 1.0 to 4.0
algo_local.Arithmetic1D(1, 4) algo_local.Arithmetic1D(1, 4)
# define "Propagation" hypothesis that propagates all other hypotheses # define "Propagation" hypothesis that propagates algo_local and "Arithmetic1D" hypothesis
# on all edges of the opposite side in case of quadrangular faces # on all parallel edges of the box
algo_local.Propagation() algo_local.Propagation()
# assign a hexahedral algorithm
mesh.Hexahedron()
# compute the mesh # compute the mesh
quadra.Compute() mesh.Compute()

View File

@ -1,4 +1,4 @@
# Change priority of submeshes in Mesh # Change priority of sub-meshes in Mesh
import salome import salome
salome.salome_init() salome.salome_init()
@ -16,47 +16,44 @@ Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
# create Mesh object on Box shape # create Mesh object on Box shape
Mesh_1 = smesh.Mesh(Box_1) Mesh_1 = smesh.Mesh(Box_1)
# assign mesh algorithms # assign mesh algorithms and hypotheses
Regular_1D = Mesh_1.Segment() Regular_1D = Mesh_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(20) Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
Nb_Segments_1.SetDistrType( 0 )
MEFISTO_2D = Mesh_1.Triangle() MEFISTO_2D = Mesh_1.Triangle()
Max_Element_Area_1 = MEFISTO_2D.MaxElementArea(1200) Max_Element_Area_1 = MEFISTO_2D.MaxElementArea(1200)
Tetrahedron = Mesh_1.Tetrahedron() Tetrahedron = Mesh_1.Tetrahedron()
Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000) Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000)
# create submesh and assign algorithms on Face_1 # create sub-mesh and assign algorithms on Face_1
Regular_1D_1 = Mesh_1.Segment(geom=Face_1) Regular_1D_1 = Mesh_1.Segment(geom=Face_1)
Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4) Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4)
Nb_Segments_2.SetDistrType( 0 )
MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1) MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1)
Length_From_Edges_2D = MEFISTO_2D_1.LengthFromEdges()
SubMesh_1 = MEFISTO_2D_1.GetSubMesh() SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
# create submesh and assign algorithms on Face_2 # create sub-mesh and assign algorithms on Face_2
Regular_1D_2 = Mesh_1.Segment(geom=Face_2) Regular_1D_2 = Mesh_1.Segment(geom=Face_2)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8) Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8)
Nb_Segments_3.SetDistrType( 0 )
MEFISTO_2D_2 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_2) MEFISTO_2D_2 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_2)
Length_From_Edges_2D_1 = MEFISTO_2D_2.LengthFromEdges()
SubMesh_2 = MEFISTO_2D_2.GetSubMesh() SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
# create submesh and assign algorithms on Face_3 # create sub-mesh and assign algorithms on Face_3
Regular_1D_3 = Mesh_1.Segment(geom=Face_3) Regular_1D_3 = Mesh_1.Segment(geom=Face_3)
Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12) Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12)
Nb_Segments_4.SetDistrType( 0 )
MEFISTO_2D_3 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_3) MEFISTO_2D_3 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_3)
Length_From_Edges_2D_2 = MEFISTO_2D_3.LengthFromEdges()
SubMesh_3 = MEFISTO_2D_3.GetSubMesh() SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
# check exisiting submesh priority order # check exisiting sub-mesh priority order
[ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder() [ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder()
# set new submesh order isDone = Mesh_1.Compute()
print "Nb elements at initial order of sub-meshes:", Mesh_1.NbElements()
# set new sub-mesh order
isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ]) isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ])
# compute mesh # compute mesh
isDone = Mesh_1.Compute() isDone = Mesh_1.Compute()
print "Nb elements at new order of sub-meshes:", Mesh_1.NbElements()
# clear mesh result and compute with other submesh order # compute with other sub-mesh order
Mesh_1.Clear()
isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ]) isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ])
isDone = Mesh_1.Compute() isDone = Mesh_1.Compute()
print "Nb elements at another order of sub-meshes:", Mesh_1.NbElements()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -41,7 +41,8 @@ The \b Global algorithms and hypotheses to be chosen at
<li> 1D algorithm and hypothesis that will be applied for meshing <li> 1D algorithm and hypothesis that will be applied for meshing
(logically) vertical edges of the prism (which connect the top and the (logically) vertical edges of the prism (which connect the top and the
base faces of the prism). In the sample picture above these are base faces of the prism). In the sample picture above these are
"Regular_1D" algorithm and "Nb. Segments_1" hypothesis.</li> "Regular_1D" algorithm and "Nb. Segments" hypothesis named "Vertical
Nb. Segments".</li>
</ul> </ul>
The \b Local algorithms and hypotheses to be chosen at The \b Local algorithms and hypotheses to be chosen at
@ -51,9 +52,9 @@ The \b Local algorithms and hypotheses to be chosen at
meshing the top and the base prism faces. These faces can be meshed meshing the top and the base prism faces. These faces can be meshed
with any type of 2D elements: quadrangles, triangles, polygons or with any type of 2D elements: quadrangles, triangles, polygons or
their mix. It is enough to define a sub-mesh on either the top or the base their mix. It is enough to define a sub-mesh on either the top or the base
face. In the sample picture above, "BLSURF" algorithm meshes face. In the sample picture above, "NETGEN_1D2D" algorithm meshes
"Face_1" base surface with triangles. (1D algorithm is not "bottom disk" face with triangles. (1D algorithm is not
assigned as "BLSURF" does not require divided edges to create a 2D mesh.) assigned as "NETGEN_1D2D" does not require divided edges to create a 2D mesh.)
</li> </li>
<li> Optionally you can define a 1D sub-mesh on some vertical edges <li> Optionally you can define a 1D sub-mesh on some vertical edges
of stacked prisms, which will override the global 1D hypothesis mentioned of stacked prisms, which will override the global 1D hypothesis mentioned

View File

@ -20,8 +20,8 @@ The algorithm treats any face as quadrangle. If a face is bound by
more than four edges, four most sharp vertices are considered as more than four edges, four most sharp vertices are considered as
corners of the quadrangle and all edges between these vertices are corners of the quadrangle and all edges between these vertices are
treated as quadrangle sides. In the case of three edges, the vertex treated as quadrangle sides. In the case of three edges, the vertex
specified by the user is considered as a degenerated side of the specified by the user is considered as a fourth degenerated side of the
quadrangle. quadrangle.
\image html quad_meshes.png "Algorithm generates a structured mesh on complex faces provided that edges are properly discretized" \image html quad_meshes.png "Algorithm generates a structured mesh on complex faces provided that edges are properly discretized"

View File

@ -1330,7 +1330,7 @@ bool StdMeshers_Prism_3D::compute(const Prism_3D::TPrismTopo& thePrism)
// update state of sub-meshes (mostly in order to erase improper errors) // update state of sub-meshes (mostly in order to erase improper errors)
SMESH_subMesh* sm = myHelper->GetMesh()->GetSubMesh( thePrism.myShape3D ); SMESH_subMesh* sm = myHelper->GetMesh()->GetSubMesh( thePrism.myShape3D );
SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/false); SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true);
while ( smIt->more() ) while ( smIt->more() )
{ {
sm = smIt->next(); sm = smIt->next();

View File

@ -1868,7 +1868,7 @@ StdMeshers_ProjectionUtils::GetPropagationEdge( SMESH_Mesh* aMes
int prevChainSize = aChain.Extent(); int prevChainSize = aChain.Extent();
if ( aChain.Add(anOppE) > prevChainSize ) { // ... anOppE is not in aChain if ( aChain.Add(anOppE) > prevChainSize ) { // ... anOppE is not in aChain
// Add found edge to the chain oriented so that to // Add found edge to the chain oriented so that to
// have it co-directed with a forward MainEdge // have it co-directed with a fromEdge
TopAbs_Orientation ori = anE.Orientation(); TopAbs_Orientation ori = anE.Orientation();
if ( anOppE.Orientation() == fourEdges[found].Orientation() ) if ( anOppE.Orientation() == fourEdges[found].Orientation() )
ori = TopAbs::Reverse( ori ); ori = TopAbs::Reverse( ori );
@ -1931,7 +1931,7 @@ FindMatchingNodesOnFaces( const TopoDS_Face& face1,
helper1.SetSubShape( face1 ); helper1.SetSubShape( face1 );
helper2.SetSubShape( face2 ); helper2.SetSubShape( face2 );
if ( helper1.HasSeam() != helper2.HasSeam() ) if ( helper1.HasRealSeam() != helper2.HasRealSeam() )
RETURN_BAD_RESULT("Different faces' geometry"); RETURN_BAD_RESULT("Different faces' geometry");
// Data to call SMESH_MeshEditor::FindMatchingNodes(): // Data to call SMESH_MeshEditor::FindMatchingNodes():

View File

@ -821,8 +821,8 @@ namespace {
// find trsf // find trsf
const int totNbSeg = 50; const int totNbSeg = 50;
vector< gp_XY > srcPnts, tgtPnts; vector< gp_XY > srcPnts, tgtPnts;
srcPnts.resize( totNbSeg ); srcPnts.reserve( totNbSeg );
tgtPnts.resize( totNbSeg ); tgtPnts.reserve( totNbSeg );
for ( size_t iW = 0; iW < srcWires.size(); ++iW ) for ( size_t iW = 0; iW < srcWires.size(); ++iW )
{ {
const double minSegLen = srcWires[iW]->Length() / totNbSeg; const double minSegLen = srcWires[iW]->Length() / totNbSeg;
@ -1392,10 +1392,19 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
} }
} }
} }
else if ( nbEdgesInWires.front() == 1 ) else if ( nbEdgesInWires.front() == 1 ) // a sole edge in a wire
{ {
// TODO::Compare orientation of curves in a sole edge TopoDS_Edge srcE1 = srcEdges.front(), tgtE1 = tgtEdges.front();
//RETURN_BAD_RESULT("Not implemented case"); for ( size_t iW = 0; iW < srcWires.size(); ++iW )
{
StdMeshers_FaceSidePtr srcWire = srcWires[iW];
for ( int iE = 0; iE < srcWire->NbEdges(); ++iE )
if ( srcE1.IsSame( srcWire->Edge( iE )))
{
reverse = ( tgtE1.Orientation() != tgtWires[iW]->Edge( iE ).Orientation() );
break;
}
}
} }
else else
{ {