MantisBT - Community
View Issue Details
0029402Community[OCCT] OCCT:Application Frameworkpublic2017-12-25 18:132018-06-29 21:19
szy 
apn 
normalminor 
closedfixed 
[OCCT] 7.3.0 
[OCCT] 7.3.0[OCCT] 7.3.0 
persist fsd B2
0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
Customer complaint:

"I am still experiencing problem with fsd files written by the following code:
   Handle(StdStorage_Data) data = new StdStorage_Data();
   .....adding a few roots to data ...
  NCollection_Handle<Storage_BaseDriver> fileDriver(new FSD_File());
  fileDriver->Open(TCollection_ExtendedString(fileName), Storage_VSWrite);
  StdStorage::Write(*fileDriver, data);
The file is written but names associated with different roots are not well preserved in a following StdStorage::Read.
To be more precise the names are associated with wrong shapes in the sense that they are permuted.
I have observed that the proper name association can be reestablished applying a small change to the function "Standard_Boolean StdStorage_RootData::Write(Storage_BaseDriver& theDriver)" which is defined in "src/StdStorage/StdStorage_RootData.cxx".
The changed lines are the following:
  theDriver.SetRootSectionSize(NumberOfRoots());
  int I=0; //HERE A COUNTER IS ADDED
  for (StdStorage_MapOfRoots::Iterator anIt(myObjects); anIt.More(); anIt.Next())
  {
    const Handle(StdStorage_Root)& aRoot = anIt.Value();
    try
    {
      OCC_CATCH_SIGNALS
// theDriver.WriteRoot(aRoot->Name(), aRoot->Reference(), aRoot->Type());
      I++;
      theDriver.WriteRoot(aRoot->Name(), I, aRoot->Type()); // HERE THE COUNTER IS USED IN PLACE OF aRoot->Reference()
    }
    catch (Storage_StreamTypeMismatchError)
    {
      myErrorStatus = Storage_VSTypeMismatch;
      myErrorStatusExt = "ReadRoot";
      return Standard_False;
    }
  }
With this change the arguments passed to the function "theDriver.WriteRoot(const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& rootType)" are the same as it happens inside of the function
"void Storage_Schema::Write(Storage_BaseDriver& f, const Handle(Storage_Data)& aData) const"
which is defined in "src/Storage/Storage_Schema.cxx"
"

The problem is reproduced using Draw commands 'fsdwrite' & modified 'fsdread' .
The issue can be reproduced (tested) using new test case tests\persist\fsd\B2 and the modified Draw command "fsdread".
No tags attached.
Issue History
2017-12-25 18:13szyNew Issue
2017-12-25 18:13szyAssigned To => szy
2017-12-27 16:58szyStatusnew => assigned
2017-12-27 17:29gitNote Added: 0073175
2017-12-27 17:33szySteps to Reproduce Updatedbug_revision_view_page.php?rev_id=18403#r18403
2017-12-28 09:52szyNote Added: 0073176
2017-12-28 09:52szyAssigned Toszy => mpv
2017-12-28 09:52szyStatusassigned => resolved
2017-12-28 11:14mpvNote Added: 0073178
2017-12-28 11:14mpvAssigned Tompv => szy
2017-12-28 11:14mpvStatusresolved => assigned
2017-12-28 11:21gitNote Added: 0073179
2017-12-28 11:22szyNote Added: 0073180
2017-12-28 11:22szyAssigned Toszy => mpv
2017-12-28 11:22szyStatusassigned => resolved
2017-12-28 11:33mpvAssigned Tompv => bugmaster
2017-12-28 11:33mpvStatusresolved => reviewed
2017-12-28 11:42gitNote Added: 0073181
2017-12-28 12:28apnTest case number => persist fsd B2
2017-12-28 12:28apnNote Added: 0073182
2017-12-28 12:28apnStatusreviewed => tested
2017-12-30 18:43apnChangeset attached => occt master 409095ba
2017-12-30 18:43apnAssigned Tobugmaster => apn
2017-12-30 18:43apnStatustested => verified
2017-12-30 18:43apnResolutionopen => fixed
2018-01-11 11:10gitNote Added: 0073335
2018-01-11 11:10gitNote Added: 0073336
2018-02-18 23:38abvTarget Version7.4.0 => 7.3.0
2018-06-29 21:15aivFixed in Version => 7.3.0
2018-06-29 21:19aivStatusverified => closed

Notes
(0073175)
git   
2017-12-27 17:29   
Branch CR29402 has been created by szy.

SHA-1: 68100ac965bb785a0e0ca6b2cddead9a2b60b821


Detailed log of new commits:

Author: szy
Date: Wed Dec 27 17:28:54 2017 +0300

    0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
    
    //the issue is fixed using another solution (changing DataMap to IndexedDataMap).
(0073176)
szy   
2017-12-28 09:52   
The issue is fixed by replacing DataMap to IndexedDataMap and tested:
- http://jenkins-test-10.nnov.opencascade.com:8080/job/CR29402-master-szy-OCCT-Windows-64-VC10-opt-tests-compare-windows/1/ [^]
- http://jenkins-test-10.nnov.opencascade.com:8080/job/CR29402-master-szy-OCCT-Debian70-64-opt-tests-compare-linux/1/ [^]
- http://jenkins-test-10.nnov.opencascade.com:8080/job/CR29402-master-szy-Products-Windows-64-VC10-opt-tests-compare-windows/1/ [^]
- http://jenkins-test-10.nnov.opencascade.com:8080/job/CR29402-master-szy-Products-Debian70-64-opt-tests-compare-linux/1/ [^]

(0073178)
mpv   
2017-12-28 11:14   
Please, correct the usage-text in DDocStd_ShapeSchemaCommands.cxx DDocStd_fsdread method.
(0073179)
git   
2017-12-28 11:21   
Branch CR29402 has been updated by szy.

SHA-1: b0c1144165b6e4895f3e462e8edadd9dc9589ab6


Detailed log of new commits:

Author: szy
Date: Thu Dec 28 11:21:04 2017 +0300

    0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
    
    //Fixed misprint in comments to Draw command fsdread.

(0073180)
szy   
2017-12-28 11:22   
The misprint fixed.
Review it, please.
(0073181)
git   
2017-12-28 11:42   
Branch CR29402_1 has been created by szy.

SHA-1: 5dee3b206404004ac3cd0bf208a569d384225781


Detailed log of new commits:

Author: szy
Date: Wed Dec 27 17:28:54 2017 +0300

    0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
    
    //Fixed misprint in comments to Draw command fsdread.
    
    0029402: In OCCT7.2.1-dev the names written into a FSD_File are associated with the wrong shapes.
    
    The issue of incorrect Roots indexing is fixed by changing DataMap to IndexedDataMap.
    //Also Draw command fsdread is improved to allow restoring of shapes with kept names.
(0073182)
apn   
2017-12-28 12:28   
Combination -
OCCT branch : CR29402 SHA - 68100ac965bb785a0e0ca6b2cddead9a2b60b821
Products branch : master SHA - 8cfd04a34de609800e36c28f29ee8e42919a0098
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

Test case:
persist fsd B2 - OK

CPU differences:
Debian70-64:
OCCT
Total CPU difference: 18443.819999999672 / 18513.219999999714 [-0.37%]
Products
Total CPU difference: 7502.219999999996 / 7509.620000000005 [-0.10%]
Windows-64-VC10:
OCCT
Total CPU difference: 17890.272680498576 / 17919.33566679854 [-0.16%]
Products
Total CPU difference: 8078.090582299989 / 8016.251785899991 [+0.77%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0073335)
git   
2018-01-11 11:10   
Branch CR29402 has been deleted by kgv.

SHA-1: b0c1144165b6e4895f3e462e8edadd9dc9589ab6
(0073336)
git   
2018-01-11 11:10   
Branch CR29402_1 has been deleted by kgv.

SHA-1: 5dee3b206404004ac3cd0bf208a569d384225781