mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0027570: Unacceptable performance during reading large STEP files
Improvement of translating assemblies from STEP.
This commit is contained in:
parent
1beb58d745
commit
9bba178dce
@ -15,6 +15,8 @@
|
|||||||
// :j4 16.03.99 gka S4134
|
// :j4 16.03.99 gka S4134
|
||||||
// abv 18.11.99 renamed from StepPDR_MakeItem
|
// abv 18.11.99 renamed from StepPDR_MakeItem
|
||||||
|
|
||||||
|
#include <Interface_EntityIterator.hxx>
|
||||||
|
#include <Interface_Graph.hxx>
|
||||||
#include <Interface_InterfaceModel.hxx>
|
#include <Interface_InterfaceModel.hxx>
|
||||||
#include <Standard_Transient.hxx>
|
#include <Standard_Transient.hxx>
|
||||||
#include <StepBasic_ApplicationContext.hxx>
|
#include <StepBasic_ApplicationContext.hxx>
|
||||||
@ -179,7 +181,7 @@ Handle(StepRepr_NextAssemblyUsageOccurrence) STEPConstruct_Assembly::GetNAUO ()
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Standard_Boolean STEPConstruct_Assembly::CheckSRRReversesNAUO(const Handle(Interface_InterfaceModel) &Model,
|
Standard_Boolean STEPConstruct_Assembly::CheckSRRReversesNAUO(const Interface_Graph& theGraph,
|
||||||
const Handle(StepShape_ContextDependentShapeRepresentation) &CDSR)
|
const Handle(StepShape_ContextDependentShapeRepresentation) &CDSR)
|
||||||
{
|
{
|
||||||
Handle(StepRepr_NextAssemblyUsageOccurrence) nauo =
|
Handle(StepRepr_NextAssemblyUsageOccurrence) nauo =
|
||||||
@ -191,26 +193,35 @@ Standard_Boolean STEPConstruct_Assembly::CheckSRRReversesNAUO(const Handle(Inter
|
|||||||
#endif
|
#endif
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(StepBasic_ProductDefinition) pd1, pd2;
|
Handle(StepBasic_ProductDefinition) pd1, pd2;
|
||||||
Handle(StepRepr_Representation) rep1 = CDSR->RepresentationRelation()->Rep1();
|
Handle(StepRepr_Representation) rep1 = CDSR->RepresentationRelation()->Rep1();
|
||||||
Handle(StepRepr_Representation) rep2 = CDSR->RepresentationRelation()->Rep2();
|
Handle(StepRepr_Representation) rep2 = CDSR->RepresentationRelation()->Rep2();
|
||||||
|
|
||||||
// find SDRs corresponding to Rep1 and Rep2 and remember their PDs
|
// find SDRs corresponding to Rep1 and Rep2 and remember their PDs
|
||||||
Handle(Standard_Type) tSDR = STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation);
|
Handle(Standard_Type) tSDR = STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation);
|
||||||
Standard_Integer nb = Model->NbEntities();
|
Interface_EntityIterator anIter = theGraph.Sharings(rep1);
|
||||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
for (; anIter.More() && pd1.IsNull(); anIter.Next()) {
|
||||||
Handle(Standard_Transient) enti = Model->Value(i);
|
Handle(Standard_Transient) enti = anIter.Value();
|
||||||
if (enti->DynamicType() == tSDR) {
|
if (enti->DynamicType() == tSDR) {
|
||||||
Handle(StepShape_ShapeDefinitionRepresentation) SDR =
|
Handle(StepShape_ShapeDefinitionRepresentation) SDR =
|
||||||
Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(enti);
|
Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(enti);
|
||||||
if ( SDR->UsedRepresentation() == rep1 )
|
if ( SDR->UsedRepresentation() == rep1 )
|
||||||
pd1 = SDR->Definition().PropertyDefinition()->Definition().ProductDefinition();
|
pd1 = SDR->Definition().PropertyDefinition()->Definition().ProductDefinition();
|
||||||
if ( SDR->UsedRepresentation() == rep2 )
|
|
||||||
pd2 = SDR->Definition().PropertyDefinition()->Definition().ProductDefinition();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anIter = theGraph.Sharings(rep2);
|
||||||
|
for (; anIter.More() && pd2.IsNull(); anIter.Next()) {
|
||||||
|
Handle(Standard_Transient) enti = anIter.Value();
|
||||||
|
if (enti->DynamicType() == tSDR) {
|
||||||
|
Handle(StepShape_ShapeDefinitionRepresentation) SDR =
|
||||||
|
Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(enti);
|
||||||
|
if ( SDR->UsedRepresentation() == rep2 )
|
||||||
|
pd2 = SDR->Definition().PropertyDefinition()->Definition().ProductDefinition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// checks..
|
// checks..
|
||||||
|
|
||||||
if ( pd1 == nauo->RelatedProductDefinition() && // OK
|
if ( pd1 == nauo->RelatedProductDefinition() && // OK
|
||||||
|
@ -29,6 +29,7 @@ class StepGeom_Axis2Placement3d;
|
|||||||
class StepRepr_NextAssemblyUsageOccurrence;
|
class StepRepr_NextAssemblyUsageOccurrence;
|
||||||
class Interface_InterfaceModel;
|
class Interface_InterfaceModel;
|
||||||
class StepShape_ContextDependentShapeRepresentation;
|
class StepShape_ContextDependentShapeRepresentation;
|
||||||
|
class Interface_Graph;
|
||||||
|
|
||||||
|
|
||||||
//! This operator creates and checks an item of an assembly, from its
|
//! This operator creates and checks an item of an assembly, from its
|
||||||
@ -70,7 +71,7 @@ public:
|
|||||||
|
|
||||||
//! Checks whether SRR's definition of assembly and component contradicts
|
//! Checks whether SRR's definition of assembly and component contradicts
|
||||||
//! with NAUO definition or not, according to model schema (AP214 or AP203)
|
//! with NAUO definition or not, according to model schema (AP214 or AP203)
|
||||||
Standard_EXPORT static Standard_Boolean CheckSRRReversesNAUO (const Handle(Interface_InterfaceModel)& Model, const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR);
|
Standard_EXPORT static Standard_Boolean CheckSRRReversesNAUO (const Interface_Graph& theGraph, const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
|
|||||||
IsDepend=Standard_True;
|
IsDepend=Standard_True;
|
||||||
Handle(StepRepr_RepresentationRelationship) RR = CDSR->RepresentationRelation();
|
Handle(StepRepr_RepresentationRelationship) RR = CDSR->RepresentationRelation();
|
||||||
if (RR.IsNull()) continue;
|
if (RR.IsNull()) continue;
|
||||||
SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Model(), CDSR );
|
SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR );
|
||||||
Handle(StepRepr_Representation) rep = ( SRRReversed ? RR->Rep2() : RR->Rep1() );
|
Handle(StepRepr_Representation) rep = ( SRRReversed ? RR->Rep2() : RR->Rep1() );
|
||||||
iatrsf = ComputeSRRWT ( RR, TP, Trsf );
|
iatrsf = ComputeSRRWT ( RR, TP, Trsf );
|
||||||
// find real ProductDefinition used rep
|
// find real ProductDefinition used rep
|
||||||
@ -928,7 +928,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
|
|||||||
//DeclareAndCast(StepRepr_RepresentationRelationship,SRR,CDSR->RepresentationRelation());
|
//DeclareAndCast(StepRepr_RepresentationRelationship,SRR,CDSR->RepresentationRelation());
|
||||||
if ( SRR.IsNull() ) return shbinder;
|
if ( SRR.IsNull() ) return shbinder;
|
||||||
|
|
||||||
Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Model(), CDSR );
|
Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Graph(), CDSR );
|
||||||
Handle(StepRepr_Representation) rep1 = ( SRRReversed ? SRR->Rep2() : SRR->Rep1() );
|
Handle(StepRepr_Representation) rep1 = ( SRRReversed ? SRR->Rep2() : SRR->Rep1() );
|
||||||
Handle(StepShape_ShapeRepresentation) rep = Handle(StepShape_ShapeRepresentation)::DownCast(rep1);
|
Handle(StepShape_ShapeRepresentation) rep = Handle(StepShape_ShapeRepresentation)::DownCast(rep1);
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ void STEPSelections_Counter::Count(const Interface_Graph& graph,
|
|||||||
if ( SRR.IsNull() ) return ;
|
if ( SRR.IsNull() ) return ;
|
||||||
|
|
||||||
Handle(StepRepr_Representation) rep;
|
Handle(StepRepr_Representation) rep;
|
||||||
Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph.Model(), CDSR );
|
Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR );
|
||||||
if(SRRReversed)
|
if(SRRReversed)
|
||||||
rep = SRR->Rep2();
|
rep = SRR->Rep2();
|
||||||
else
|
else
|
||||||
|
@ -106,7 +106,7 @@ static void AddInstances(const Handle(Standard_Transient)& start,
|
|||||||
if ( SRR.IsNull() ) return ;
|
if ( SRR.IsNull() ) return ;
|
||||||
|
|
||||||
Handle(StepRepr_Representation) rep;
|
Handle(StepRepr_Representation) rep;
|
||||||
Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph.Model(), CDSR );
|
Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR );
|
||||||
if(SRRReversed)
|
if(SRRReversed)
|
||||||
rep = SRR->Rep2();
|
rep = SRR->Rep2();
|
||||||
else
|
else
|
||||||
|
27
tests/bugs/step/bug27570
Normal file
27
tests/bugs/step/bug27570
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC27570"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
###########################################################
|
||||||
|
# Unacceptable performance during reading large STEP files
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
set max_time 8
|
||||||
|
|
||||||
|
dchrono cr reset
|
||||||
|
dchrono cr start
|
||||||
|
ReadStep D [locate_data_file bug27570.stp]
|
||||||
|
dchrono cr stop
|
||||||
|
|
||||||
|
# check time
|
||||||
|
set chrono_info [dchrono cr show]
|
||||||
|
regexp {CPU user time: ([-0-9.+eE]+) seconds} $chrono_info full CPU_time
|
||||||
|
if { $CPU_time > ${max_time} } {
|
||||||
|
puts "CPU user time of STEP translation is more than ${max_time} seconds - Error"
|
||||||
|
} else {
|
||||||
|
puts "CPU user time of STEP translation is less than ${max_time} seconds - OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
# check number of shapes
|
||||||
|
XGetOneShape result D
|
||||||
|
checknbshapes result -solid 1000 -compound 1111
|
Loading…
x
Reference in New Issue
Block a user