Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simulator settings not loaded correctly #535

Closed
lkeegan opened this issue May 20, 2021 · 1 comment · Fixed by #536
Closed

simulator settings not loaded correctly #535

lkeegan opened this issue May 20, 2021 · 1 comment · Fixed by #536
Labels
bug Something isn't working GUI Graphical user interface

Comments

@lkeegan
Copy link
Member

lkeegan commented May 20, 2021

Describe the bug
When loading an sme file with v1.1.0, the simulation options are not correctly imported

To Reproduce
Open built-in brusselator model, save as sme file, open this file, look at simulation options

Expected behavior
Simulation options should be saved & re-imported on load.

Screenshots
before saving:

options_before

after saving & re-loading model:

options_after

log output shows the values are correctly stored as xml annotation in the saved model, so presumably something is going wrong with the conversion from xml to Settings;

I][xml_annotation.cpp:  63] getSbmlAnnotation :: annotation: '<settings>
  <cereal_class_version>0</cereal_class_version>                                                                                                                                                                   
  <simulationSettings>                                                                                                                                                                                             
    <cereal_class_version>1</cereal_class_version>                                                                                                                                                                 
    <times size="dynamic"/>                                                                                                                                                                                        
    <options>                                                                                                                                                                                                      
      <cereal_class_version>0</cereal_class_version>                                                                                                                                                               
      <dune>                                                                                                                                                                                                       
        <cereal_class_version>0</cereal_class_version>                                                                                                                                                             
        <discretization>0</discretization>                                                                                                                                                                         
        <integrator>alexander_2</integrator>                                                                                                                                                                       
        <dt>0.10000000000000001</dt>                                                                                                                                                                               
        <minDt>1e-10</minDt>                                                                                                                                                                                       
        <maxDt>10000</maxDt>                                                                                                                                                                                       
        <increase>1.5</increase>                                                                                                                                                                                   
        <decrease>0.5</decrease>                                                                                                                                                                                   
        <writeVTKfiles>false</writeVTKfiles>                                                                                                                                                                       
        <newtonRelErr>1e-08</newtonRelErr>                                                                                                                                                                         
        <newtonAbsErr>9.9999999999999998e-13</newtonAbsErr>                                                                                                                                                        
      </dune>                                                                                                                                                                                                      
      <pixel>                                                                                                                                                                                                      
        <cereal_class_version>0</cereal_class_version>                                                                                                                                                             
        <integrator>1</integrator>                                                                                                                                                                                 
        <maxErr>                                                                                                                                                                                                   
          <cereal_class_version>0</cereal_class_version>                                                                                                                                                           
          <abs>1.7976931348623157e+308</abs>                                                                                                                                                                       
          <rel>0.0050000000000000001</rel>                                                                                                                                                                         
        </maxErr>                                                                                                                                                                                                  
        <maxTimestep>1.7976931348623157e+308</maxTimestep>                                                                                                                                                         
        <enableMultiThreading>false</enableMultiThreading>                                                                                                                                                         
        <maxThreads>0</maxThreads>                                                                                                                                                                                 
        <doCSE>true</doCSE>                                                                                                                                                                                        
        <optLevel>3</optLevel>                                                                                                                                                                                     
      </pixel>                                                                                                                                                                                                     
    </options>                                                                                                                                                                                                     
    <simulatorType>0</simulatorType>                                                                                                                                                                               
  </simulationSettings>                                                                                                                                                                                            
  <displayOptions>                                                                                                                                                                                                 
    <cereal_class_version>0</cereal_class_version>                                                                                                                                                                 
    <showSpecies size="dynamic"/>                                                                                                                                                                                  
    <showMinMax>true</showMinMax>                                                                                                                                                                                  
    <normaliseOverAllTimepoints>true</normaliseOverAllTimepoints>                                                                                                                                                  
    <normaliseOverAllSpecies>true</normaliseOverAllSpecies>                                                                                                                                                        
    <showGeometryGrid>false</showGeometryGrid>                                                                                                                                                                     
    <showGeometryScale>false</showGeometryScale>                                                                                                                                                                   
  </displayOptions>                                                                                                                                                                                                
  <meshParameters>                                                                                                                                                                                                 
    <cereal_class_version>0</cereal_class_version>                                                                                                                                                                 
    <maxPoints size="dynamic">                                                                                                                                                                                     
      <value0>19</value0>                                                                                                                                                                                          
    </maxPoints>                                                                                                                                                                                                   
    <maxAreas size="dynamic">                                                                                                                                                                                      
      <value0>26</value0>                                                                                                                                                                                          
    </maxAreas>                                                                                                                                                                                                    
  </meshParameters>                                                                                                                                                                                                
  <speciesColours size="dynamic">                                                                                                                                                                                  
    <value0>                                                                                                                                                                                                       
      <key>A</key>                                                                                                                                                                                                 
      <value>4294959385</value>                                                                                                                                                                                    
    </value0>                                                                                                                                                                                                      
    <value1>                                                                                                                                                                                                       
      <key>B</key>                                                                                                                                                                                                 
      <value>4278223560</value>                                                                                                                                                                                    
    </value1>                                                                                                                                                                                                      
    <value2>                                                                                                                                                                                                       
      <key>D</key>                                                                                                                                                                                                 
      <value>4294279728</value>                                                                                                                                                                                    
    </value2>                                                                                                                                                                                                      
    <value3>                                                                                                                                                                                                       
      <key>E</key>                                                                                                                                                                                                 
      <value>4287700660</value>                                                                                                                                                                                    
    </value3>                                                                                                                                                                                                      
    <value4>                                                                                                                                                                                                       
      <key>X</key>                                                                                                                                                                                                 
      <value>4293269835</value>                                                                                                                                                                                    
    </value4>                                                                                                                                                                                                      
    <value5>                                                                                                                                                                                                       
      <key>Y</key>                                                                                                                                                                                                 
      <value>4282168395</value>                                                                                                                                                                                    
    </value5>                                                                                                                                                                                                      
  </speciesColours>                                                                                                                                                                                                
</settings>'                                          
@lkeegan lkeegan added bug Something isn't working GUI Graphical user interface labels May 20, 2021
@lkeegan
Copy link
Member Author

lkeegan commented May 20, 2021

This is a reincarnation of the bug we had with symengine where doubles were sometimes mysteriously incorrectly parsed, and is caused by Qt setting the locale, which if e.g. DE breaks strtod (see symengine/symengine#1566)

For now we can apply the same workaround as for symengine: temporarily set the locale to the C one while importing settings from xml

lkeegan added a commit that referenced this issue May 20, 2021
- temporarily set locale to C while reading/writing xml settings
- avoids locale affecting how doubles are read/written (e.g. 3.12 -> 3 if locale is DE, etc)
- resolves #535
lkeegan added a commit that referenced this issue May 20, 2021
- temporarily set locale to C while reading/writing xml settings
- avoids locale affecting how doubles are read/written (e.g. 3.12 -> 3 if locale is DE, etc)
- resolves #535
lkeegan added a commit that referenced this issue May 20, 2021
- temporarily set locale to C while reading/writing xml settings
- avoids locale affecting how doubles are read/written (e.g. 3.12 -> 3 if locale is DE, etc)
- resolves #535
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI Graphical user interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant