mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0025445: Draw command incmesh should support all parameters used in BRepMesh
Test-case for issue #25445
This commit is contained in:
parent
2fa97a4304
commit
49cfd13dca
@ -54,6 +54,7 @@
|
|||||||
#include <Geom_Surface.hxx>
|
#include <Geom_Surface.hxx>
|
||||||
#include <Draw_Marker3D.hxx>
|
#include <Draw_Marker3D.hxx>
|
||||||
#include <Draw_Segment2D.hxx>
|
#include <Draw_Segment2D.hxx>
|
||||||
|
#include <TCollection_AsciiString.hxx>
|
||||||
|
|
||||||
#include <GCPnts_UniformAbscissa.hxx>
|
#include <GCPnts_UniformAbscissa.hxx>
|
||||||
#include <GeomAdaptor_Curve.hxx>
|
#include <GeomAdaptor_Curve.hxx>
|
||||||
@ -118,33 +119,66 @@ OSD_Chronometer chIsos, chPointsOnIsos;
|
|||||||
//function : incrementalmesh
|
//function : incrementalmesh
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
static Standard_Integer incrementalmesh(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
|
static Standard_Integer incrementalmesh(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
|
||||||
{
|
{
|
||||||
if (nbarg < 3) {
|
if (nbarg < 3)
|
||||||
di << " use incmesh shape deflection [inParallel (0/1) : 0 by default]\n";
|
{
|
||||||
|
di << "\
|
||||||
|
Builds triangular mesh for the shape\n\
|
||||||
|
usage: incmesh Shape LinearDeflection [options]\n\
|
||||||
|
options:\n\
|
||||||
|
-a val angular deflection in deg (default ~28.64 deg = 0.5 rad)\n\
|
||||||
|
-relative notifies that relative deflection is used\n\
|
||||||
|
(switched off by default)\n\
|
||||||
|
-parallel enables parallel execution (switched off by default)\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TopoDS_Shape aShape = DBRep::Get(argv[1]);
|
TopoDS_Shape aShape = DBRep::Get(argv[1]);
|
||||||
if (aShape.IsNull()) {
|
if (aShape.IsNull())
|
||||||
di << " null shapes is not allowed here\n";
|
{
|
||||||
|
di << " Null shapes are not allowed here\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Standard_Real aDeflection = Draw::Atof(argv[2]);
|
|
||||||
|
|
||||||
|
Standard_Real aLinDeflection = Max(Draw::Atof(argv[2]), Precision::Confusion());
|
||||||
|
Standard_Real aAngDeflection = 0.5;
|
||||||
|
Standard_Boolean isRelative = Standard_False;
|
||||||
Standard_Boolean isInParallel = Standard_False;
|
Standard_Boolean isInParallel = Standard_False;
|
||||||
if (nbarg == 4) {
|
|
||||||
isInParallel = Draw::Atoi(argv[3]) == 1;
|
if (nbarg > 3)
|
||||||
|
{
|
||||||
|
Standard_Integer i = 3;
|
||||||
|
while (i < nbarg)
|
||||||
|
{
|
||||||
|
TCollection_AsciiString aOpt(argv[i++]);
|
||||||
|
aOpt.LowerCase();
|
||||||
|
|
||||||
|
if (aOpt == "")
|
||||||
|
continue;
|
||||||
|
else if (aOpt == "-relative")
|
||||||
|
isRelative = Standard_True;
|
||||||
|
else if (aOpt == "-parallel")
|
||||||
|
isInParallel = Standard_True;
|
||||||
|
else if (i < nbarg)
|
||||||
|
{
|
||||||
|
Standard_Real aVal = Draw::Atof(argv[i++]);
|
||||||
|
if (aOpt == "-a")
|
||||||
|
aAngDeflection = aVal * M_PI / 180.;
|
||||||
|
else
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
di << "Incremental Mesh, multi-threading "
|
di << "Incremental Mesh, multi-threading "
|
||||||
<< (isInParallel ? "ON\n" : "OFF\n");
|
<< (isInParallel ? "ON" : "OFF") << "\n";
|
||||||
|
|
||||||
BRepMesh_IncrementalMesh MESH(aShape, aDeflection, Standard_False, 0.5, isInParallel);
|
BRepMesh_IncrementalMesh aMesher(aShape, aLinDeflection, isRelative,
|
||||||
Standard_Integer statusFlags = MESH.GetStatusFlags();
|
aAngDeflection, isInParallel);
|
||||||
|
|
||||||
di << "Meshing statuses: ";
|
di << "Meshing statuses: ";
|
||||||
|
Standard_Integer statusFlags = aMesher.GetStatusFlags();
|
||||||
if( !statusFlags )
|
if( !statusFlags )
|
||||||
{
|
{
|
||||||
di << "NoError";
|
di << "NoError";
|
||||||
@ -1542,7 +1576,7 @@ void MeshTest::Commands(Draw_Interpretor& theCommands)
|
|||||||
|
|
||||||
g = "Mesh Commands";
|
g = "Mesh Commands";
|
||||||
|
|
||||||
theCommands.Add("incmesh","incmesh shape deflection [inParallel (0/1) : 0 by default]",__FILE__, incrementalmesh, g);
|
theCommands.Add("incmesh","Builds triangular mesh for the shape, run w/o args for help",__FILE__, incrementalmesh, g);
|
||||||
theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g);
|
theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g);
|
||||||
theCommands.Add("fastdiscret","fastdiscret shape deflection [shared [nbiter]]",__FILE__, fastdiscret, g);
|
theCommands.Add("fastdiscret","fastdiscret shape deflection [shared [nbiter]]",__FILE__, fastdiscret, g);
|
||||||
theCommands.Add("mesh","mesh result Shape deflection",__FILE__, triangule, g);
|
theCommands.Add("mesh","mesh result Shape deflection",__FILE__, triangule, g);
|
||||||
|
28
tests/bugs/demo/bug25445
Normal file
28
tests/bugs/demo/bug25445
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC25445"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Draw command incmesh should support all parameters used in BRepMesh
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
pcone aCone 100 10 100
|
||||||
|
|
||||||
|
tclean aCone
|
||||||
|
incmesh aCone 0.01 -a 0.4
|
||||||
|
set bug_info [trinfo aCone]
|
||||||
|
set NbTrian_1 [lindex $bug_info 3]
|
||||||
|
set NbNodes_1 [lindex $bug_info 5]
|
||||||
|
|
||||||
|
tclean aCone
|
||||||
|
incmesh aCone 0.01 -a 0.3
|
||||||
|
set bug_info [trinfo aCone]
|
||||||
|
set NbTrian_2 [lindex $bug_info 3]
|
||||||
|
set NbNodes_2 [lindex $bug_info 5]
|
||||||
|
|
||||||
|
if {$NbTrian_1 == $NbTrian_2} {
|
||||||
|
puts "ERROR: OCC25445 is not fixed. Number of triangles are equal for both meshes."
|
||||||
|
}
|
||||||
|
if {$NbNodes_1 == $NbNodes_2} {
|
||||||
|
puts "ERROR: OCC25445 is not fixed. Number of nodes are equal for both meshes."
|
||||||
|
}
|
@ -13,7 +13,7 @@ restore [locate_data_file bug24968_Shape_1.brep] result
|
|||||||
tclean result
|
tclean result
|
||||||
dchrono h reset
|
dchrono h reset
|
||||||
dchrono h start
|
dchrono h start
|
||||||
incmesh result 0.1 0
|
incmesh result 0.1
|
||||||
dchrono h stop
|
dchrono h stop
|
||||||
|
|
||||||
set info [dchrono h show]
|
set info [dchrono h show]
|
||||||
|
@ -13,7 +13,7 @@ restore [locate_data_file bug24968_Shape_1.brep] result
|
|||||||
tclean result
|
tclean result
|
||||||
dchrono h reset
|
dchrono h reset
|
||||||
dchrono h start
|
dchrono h start
|
||||||
incmesh result 0.1 1
|
incmesh result 0.1 -parallel
|
||||||
dchrono h stop
|
dchrono h stop
|
||||||
|
|
||||||
set info [dchrono h show]
|
set info [dchrono h show]
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
set command incmesh
|
set command incmesh
|
||||||
set group advanced
|
set group advanced
|
||||||
set parallel 0
|
set parallel ""
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
set command incmesh
|
set command incmesh
|
||||||
set group advanced
|
set group advanced
|
||||||
set parallel 1
|
set parallel -parallel
|
||||||
|
@ -33,7 +33,7 @@ if { [string compare $command "incmesh"] == 0 } {
|
|||||||
if {[array get env os_type] != ""} {
|
if {[array get env os_type] != ""} {
|
||||||
set os $env(os_type)
|
set os $env(os_type)
|
||||||
}
|
}
|
||||||
if { $parallel != 1 || [info exists count_parallel] == 0 } {
|
if { [string compare $parallel "-parallel"] != 0 || [info exists count_parallel] == 0 } {
|
||||||
set count_parallel 1
|
set count_parallel 1
|
||||||
}
|
}
|
||||||
for {set i 1} {$i <= $count_parallel} {incr i} {
|
for {set i 1} {$i <= $count_parallel} {incr i} {
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
set command incmesh
|
set command incmesh
|
||||||
set group standard
|
set group standard
|
||||||
set parallel 0
|
set parallel ""
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
set command incmesh
|
set command incmesh
|
||||||
set group standard
|
set group standard
|
||||||
set parallel 1
|
set parallel -parallel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user