Problem 2322

Summary: GDML element name with pointers
Product: Geant4 Reporter: Shang Jiaxuan <shangjiaxuan>
Component: persistency/gdmlAssignee: Witold.Pokorski
Status: ASSIGNED ---    
Severity: minor CC: shangjiaxuan
Priority: P4    
Version: 10.7   
Hardware: All   
OS: Windows   

Description Shang Jiaxuan 2021-02-03 08:13:03 CET
In function G4GDMLWrite::GenerateName in G4GDMLWrite.cpp, the serializer may put the pointer of the object in the end to ensure correct reference on name conflict. However, the stripping mechanism in G4GDMLRead::StripName searches for the string "0x" to find the pointer, which msvc sdk does not prepend. A workaround is to add a specific sequence before the pointer value and strip from there.

This is a minor issue, since this will only cause the name to be longer and longer on save and load, and make locating  the volume with name difficult.

Also a minor issue when exporting regions, in G4GDMLParser::Write the region evaluation happens before the ref parameter in the function updates G4GDMLWrite::addPointerToName. This will make the gdml file invalid if the parser is set not to add pointer name, Write set to making refs. This can be avoided by careful coding, but setting the value in the first place may be a better solution.
Comment 1 Gabriele Cosmo 2021-02-03 09:44:40 CET
As noted in GitHub PR#19, fixes will be be included in next patch release.
Comment 2 Gabriele Cosmo 2021-02-03 09:48:13 CET
Restored as closed by mistake...
Comment 3 shangjiaxuan 2022-05-20 11:33:26 CEST
(In reply to Gabriele Cosmo from comment #1)
> As noted in GitHub PR#19, fixes will be be included in next patch release.

Still current in 4.11 release branch. May be a regression problem.
Comment 4 shangjiaxuan 2022-05-20 11:44:45 CEST
(In reply to shangjiaxuan from comment #3)
> (In reply to Gabriele Cosmo from comment #1)
> > As noted in GitHub PR#19, fixes will be be included in next patch release.
> 
> Still current in 4.11 release branch. May be a regression problem.

The G4GDMLParser::Write parameter is respected, but the '0x' prepending problem is still present.