MantisBT - Open CASCADE
View Issue Details
0032485Open CASCADE[OCCT] OCCT:Modeling Algorithmspublic2021-07-19 12:422021-08-02 19:42
asuraven 
asuraven 
normalminor 
assignedopen 
 
[OCCT] 7.6.0* 
0032485: Modeling Algorithms - Add Clone() function for adapters
After the analysis, it was decided not to add thread safety to adapters, but to ensure thread safety when using them. This requires creating copies of adapters for each thread, which is what the Clone () function should provide.
The function must be implemented in the childs of the following classes:
Geom2dAdaptor_Curve
GeomAdaptor_Curve
GeomAdaptor_Surface
not required
No tags attached.
related to 0032449closed bugmaster Modeling Algorithms - make curves adaptors classes thread safe 
related to 0032450assigned asuraven Modeling Algorithms - change BRepLib_CheckCurveOnSurface & GeomLib_CheckCurveOnSurface interfaces to adaptors 
Issue History
2021-07-19 12:42asuravenNew Issue
2021-07-19 12:42asuravenAssigned To => asuraven
2021-07-19 12:43asuravenRelationship addedrelated to 0032449
2021-07-19 12:43asuravenRelationship addedrelated to 0032450
2021-07-19 19:20asuravenNote Added: 0102659
2021-07-20 18:44asuravenSummaryModeling Algorithms - Add Clone() function for adaptors => Modeling Algorithms - Add Clone() function for adapters
2021-07-23 15:55asuravenNote Added: 0102747
2021-07-26 12:40gitNote Added: 0102813
2021-07-26 12:41gitNote Added: 0102814
2021-07-27 18:46gitNote Added: 0102839
2021-07-28 11:27asuravenStatusnew => assigned
2021-07-28 11:27asuravenNote Added: 0102847
2021-07-28 17:30gitNote Added: 0102851
2021-07-29 12:36gitNote Added: 0102870
2021-07-29 19:03gitNote Added: 0102874
2021-07-30 14:08gitNote Added: 0102890
2021-07-30 15:34asuravenNote Added: 0102891
2021-07-30 15:34asuravenAssigned Toasuraven => msv
2021-07-30 15:34asuravenStatusassigned => resolved
2021-07-30 17:24kgvNote Added: 0102899
2021-07-30 17:25kgvNote Edited: 0102899bug_revision_view_page.php?bugnote_id=102899#r25564
2021-08-02 19:42msvNote Added: 0102935
2021-08-02 19:42msvAssigned Tomsv => asuraven
2021-08-02 19:42msvStatusresolved => assigned

Notes
(0102659)
asuraven   
2021-07-19 19:20   
(0102747)
asuraven   
2021-07-23 15:55   
(0102813)
git   
2021-07-26 12:40   
Branch CR32485 has been created by asuraven.

SHA-1: 4837af7895a106c3f915f55a1091dc3c5df2214d


Detailed log of new commits:

Author: asuraven
Date: Tue Jul 20 18:44:23 2021 +0300

    0032485: Modeling Algorithms - Add Clone() function for adapters

Author: asuraven
Date: Tue Jul 13 17:17:51 2021 +0300

    from patch

Author: asuraven
Date: Mon Jul 19 13:17:28 2021 +0300

    OSD_ThreadPool::Launcher instead OSD_Parallel::For
(0102814)
git   
2021-07-26 12:41   
Branch CR32485_1 has been created by asuraven.

SHA-1: fa5043119efa45c733eaca49afb5330164688c5c


Detailed log of new commits:

Author: asuraven
Date: Fri Jul 23 19:15:28 2021 +0300

    0032485: More ShallowCopy()

Author: asuraven
Date: Mon Jul 26 12:34:30 2021 +0300

    set isMultiThread = true

Author: asuraven
Date: Tue Jul 20 18:44:23 2021 +0300

    0032485: Modeling Algorithms - Add Clone() function for adapters

Author: asuraven
Date: Tue Jul 13 17:17:51 2021 +0300

    from patch
(0102839)
git   
2021-07-27 18:46   
Branch CR32485_1 has been updated by asuraven.

SHA-1: cdb8d56465a517a6789229df1b65eb30a0be5a28


Detailed log of new commits:

Author: asuraven
Date: Tue Jul 27 18:45:16 2021 +0300

    0032485: More ShallowCopy()+

(0102847)
asuraven   
2021-07-28 11:27   
(0102851)
git   
2021-07-28 17:30   
Branch CR32485_2 has been created by asuraven.

SHA-1: ecf82553c1cdaaf3e1f861c88ac170b1da059296


Detailed log of new commits:

Author: asuraven
Date: Tue Jul 20 18:44:23 2021 +0300

    0032485: Modeling Algorithms - Add Clone() function for adapters
(0102870)
git   
2021-07-29 12:36   
Branch CR32485_2 has been updated forcibly by asuraven.

SHA-1: 8efa0a5ef3df8e51fd9943b1ffe458281671f00e
(0102874)
git   
2021-07-29 19:03   
Branch CR32485_2 has been updated forcibly by asuraven.

SHA-1: 1a104a1e9842f2253e0acf847188da3408e3af8a
(0102890)
git   
2021-07-30 14:08   
Branch CR32485_2 has been updated forcibly by asuraven.

SHA-1: 9473a8f29c7acd41659d833222135c6b45cbb4cc
(0102891)
asuraven   
2021-07-30 15:34   
Please review the code in branch CR32485_2
yesterday's tests results (not available now):
http://jenkins-test-occt/view/CR32485_2-master-ASURAVEN/view/COMPARE/ [^]
has only one fail - 'bugs modalg_5 bug24012'
but now it has been fixed
(0102899)
kgv   
2021-07-30 17:24   
(edited on: 2021-07-30 17:25)
+Handle(Adaptor3d_Curve) Adaptor3d_Curve::ShallowCopy() const
+{
+  throw Standard_NotImplemented("Adaptor3d_Curve::ShallowCopy");
+}

I think that the stab implemented by base class in hierarchy of Adaptors is a legacy of old C++/CDL code.
Could you try declaring new interface (and try also updating old ones in these classes) as pure virtual methods?

Or there are real use cases, where sub-classes are supposed to not implement these methods?

(0102935)
msv   
2021-08-02 19:42   
src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.cxx
src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.cxx
  aCopy->mySurfaceCache   = mySurfaceCache;

Cache must not be copied.

src/Geom2dEvaluator/Geom2dEvaluator_OffsetCurve.cxx
src/GeomEvaluator/GeomEvaluator_OffsetCurve.cxx
src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx
src/GeomEvaluator/GeomEvaluator_SurfaceOfExtrusion.cxx
src/GeomEvaluator/GeomEvaluator_SurfaceOfRevolution.cxx
You should select what constructor to call depending on the condition "myBaseAdaptor.IsNull()".

src/ProjLib/ProjLib_CompProjectedCurve.cxx
myTabInt is rewritten in the methods NbIntervals/Intervals, so it must not be shared.

src/BRepAdaptor/BRepAdaptor_Curve.cxx
  aCopy->myCurve = myCurve;

src/BRepAdaptor/BRepAdaptor_Surface.cxx
  aCopy->mySurf = mySurf;

In such way the cache of curve/surface adaptor will be shared, you should avoid it. It is better to create a shallow copy, and then save the value under its handle, as you are doing in BRepAdaptor_CompCurve.

src/BRepAdaptor/BRepAdaptor_Curve2d.cxx
  aCopy->myCurveCache = myCurveCache;

Cache must not be copied.

src/ChFiDS/ChFiDS_ElSpine.cxx
Do not change type of the field "curve". Instead do the same as in BRepAdaptor_Curve.

In the commit message, add a sentence that it will allow using copies of the same adapter in multi-thread calculations.