smiths / caseStudies

Case studies of (manual) documentation for scientific computing software
3 stars 2 forks source link

GlassBR: Minor technicality in comment in param.py #68

Closed samm82 closed 6 years ago

samm82 commented 6 years ago

One line 16 of both caseStudies/CaseStudies/glass/Implementations/Python/Implementation/param.py and caseStudies/CaseStudies/glass/Implementations/Python_Simplified/Implementation/param.py, it should read "(element of ["AN", "HS", "GT"])" because of the word 'element'.

Here is the line in Python, but it is the same in Python_Simplified: https://github.com/smiths/caseStudies/blob/a7e8172200744cf297aab9ab861c72a2befda9d7/CaseStudies/glass/Implementations/Python/Implementation/param.py#L16

smiths commented 6 years ago

@samm82, please go ahead and make the proposed change to both param.py files. Is the same problem in the generated code for GlassBR? I'm not sure if we have comments in the generated code, but, I haven't looked.

What are your thoughts on the two implementations: Python and Python_Simplified. Based on the names, it is tempting to remove Python and just focus on the simplified code. What is the difference between the two?

samm82 commented 6 years ago

Note: in future, should work in the caseStudies repo be done on branches? I forgot to for my current changes.

It looks like focusing on the Python_Simplified code is a good idea, as discussed in JacquesCarette/Drasil#262 . Python_Simplified (PS) has a TestDocumentation folder that Python (P) does not. Also, the tests from P are saved in PS as OldTests, in addition to its own tests. The only concern I see is that certain implementations are drastically different from P to PS - I'm not sure how many examples you need, but here are some major ones from calculations.py: (forgive me if a table is the worst way to organize this)

Diff P PS
calc_q https://github.com/smiths/caseStudies/blob/0179d31a12e359ac6fa69f9ec341d8d5aa71ac35/CaseStudies/glass/Implementations/Python/Implementation/calculations.py#L14-L20 https://github.com/smiths/caseStudies/blob/0179d31a12e359ac6fa69f9ec341d8d5aa71ac35/CaseStudies/glass/Implementations/Python_Simplified/Implementation/calculations.py#L13-L15
is_safe https://github.com/smiths/caseStudies/blob/0179d31a12e359ac6fa69f9ec341d8d5aa71ac35/CaseStudies/glass/Implementations/Python/Implementation/calculations.py#L83-L100 https://github.com/smiths/caseStudies/blob/0179d31a12e359ac6fa69f9ec341d8d5aa71ac35/CaseStudies/glass/Implementations/Python_Simplified/Implementation/calculations.py#L40-L52
samm82 commented 6 years ago

Also, where can I find the generated code for GlassBR?

JacquesCarette commented 6 years ago

build/GlassBR/src, with 4 sub-directories for 4 languages.

samm82 commented 6 years ago

There isn't a comment in the generated code; however, the input file lists the thickness as "10" instead of "10.0" as in #76

JacquesCarette commented 6 years ago

That seems like a bug in the input file there too. We'll need to make sure the generated code knows that input should be a String (which I was fairly sure was the case).

The problem is the generated code isn't actually compiled & tested routinely. This is partly on purpose, as that would assume all Drasil devs need to have multiple development environments on their machine, which is too much to ask for. However, the Travis builds should! I thought there even was an issue for that too.

samm82 commented 6 years ago

@JacquesCarette It is a string - the problem is that the list of accepted glass thicknesses is: ["2.5", "2.7", "3.0", "4.0", "5.0", "6.0", "8.0", "10.0", "12.0", "16.0", "19.0", "22.0"], so "10" isn't recognized as being acceptable. It needs to be rendered as "10.0" as opposed to "10".

JacquesCarette commented 6 years ago

Good! So it is a pure bug in the input file.

smiths commented 6 years ago

@samm82, let us move to Python_Simplified. Please delete the Python folder with a note in the commit message that it is deprecated. It will stay under version control, so we can always look in the past to find it again. In looking at JacquesCarette/Drasil#262, I see that we are repeating conversations we have had in the past. Clearing out the Python folder will hopefully prevent us from going in the same circle again in the future. The issue you pointed to also shows that we expect the test cases to fail. I do not believe that they were properly updated, but @niazim3 can give you a better idea, since she worked on this issue last summer.

The simplified code was created by @palmerst last summer when he refactored the GlassBR example for code generation. Steven used the interpolation following the documentation I wrote, instead of how it was done in the original code. The first version (in the Python folder) is a straight conversion of the original Fortran code. The original Fortran unintentionally obfuscated the underlying algorithm. This made code generation almost impossible. The new code (Python simplified) shows the connection to linear interpolation more clearly.

samm82 commented 6 years ago

@smiths I just noticed this now, but Python_Simplified doesn't have a Documentation folder, so it is missing the SRS and the MG. Should I copy the one from Python over to it?

smiths commented 6 years ago

No, please do not copy the SRS and the MG to the Python_Simplified folder. Unless an SRS is very poorly written, it does not change with the implementation language. (The SRS should be abstract.) The design (MG) should also be language agnostic. This is why the Documentation and Implementation folders are at the same level of the folder hierarchy. The same documentation applies for all programming language Implementations. (We also don't have a separate SRS and MG for the C implementation - and we shouldn't!) All of the implementations share the same requirements and design.

samm82 commented 6 years ago

Right - ok, I think some changes I made to the README got undid somehow, so I had removed the Documentation reference in it previously.

samm82 commented 6 years ago

@smiths Is this issue closed then?

smiths commented 6 years ago

Yes, this issue can be closed. However, the test cases still fail. There is an issue for that #70. I have assigned you this issue along with @niazim3. The two of you should discuss this together. @elwazana is also working on testing documentation. Together you may want to propose modifications to the verification template that we are implicitly solving.