JacquesCarette / Drasil

Generate all the things (focusing on research software)
https://jacquescarette.github.io/Drasil
BSD 2-Clause "Simplified" License
142 stars 26 forks source link

Define inputs using DataDesc #373

Open palmerst opened 7 years ago

palmerst commented 7 years ago

For those of you with implementations that read inputs from a file, make a data description of the input file in your Drasil example. See https://github.com/JacquesCarette/literate-scientific-software/blob/master/code/Example/Drasil/GlassBR/DataDescriptions.hs as an example (ignore the read_table stuff).

You can add these modules to the generated code using the addModDefs functions -- see glassbr Body.hs line 120 (glassBR_code).

danscime commented 7 years ago

For SWHS, there are no code files in this repo, but there are in Dr. Smith's swhs-master repo. Should I add these to our repo or is there a reason that they are separate?

smiths commented 7 years ago

Yes, there is a reason for having the code files separate. The swhs repo is a public repo that I cite in some of my publications. I want anyone that is interested to be able to access the files, without being confused by Drasil. If the files are also in our Drasil (literate scientific software) repo, then we are maintaining them in two places, which is a maintenance nightmare waiting to happen. There is a link to the swhs repo in the README.md file.

I don't think you need a local copy of the code to address @palmerst request, but if you do, you can make a copy, with the understanding that it is a working/temporary copy, not the one that is actually maintained.

danscime commented 7 years ago

Okay that's fine. I don't think there's a need to copy anything over then. I was able to make the input file module for @palmerst

njericha commented 7 years ago

SSP has the following example for the input .dat file. Text in brackets is my annotations.

2   1 (preamble, #layers and slope direction)
5   20  5   15  15  15000   0.4 (first layer inputs)
0   25 (first layer co-ordinates)
20  25
30  20
40  15
70  15
4 25    10  18  18  12000   0.37 (second layer inputs)
0   20 (second layer co-ordinates)
36  17
40  15
70  15
7 (#water table geometry points)
9.8 (unit water weight)
0   22 (water table co-ordinates)
10.87   21.28
21.14   19.68
31.21   17.17
38.69   14.56
40  14
70  14

After reading the User guide a few times, I understand what these numbers mean. The exact specification is found on page 11-12. Essentially, the first row gives the number of layers and the layer direction. The next section is a line of input values for perimeters followed by a list of co-ordinates for the layer. Because this example has two slices this is repeated. The last section gives the number of geometry points for the water table (7) followed by the unit water weight and the water table co-ordinates.

I do not know how to enter this structure in as a DataDesc.

njericha commented 7 years ago

I can now see that Language\Drasil\Code\Imperative\Import.hs:204:22 raises an error because the types needed for this structure is not yet implemented.

balacij commented 1 month ago

Seeing as the two unfinished tasks are projects that don't generate code, we shouldn't keep the ticket open -- this issue should come up again in code review later on when those projects can generate code. However, we do have new projects since this ticket was mentioned.

@NoahCardoso , could you please check what the status of this ticket is in all of our examples? Can you please also figure out what kind of work is needed to finish this ticket?

Note: the link in the OP is broken (it references the pre-'Drasil' repo!).

NoahCardoso commented 1 month ago

I'm not really sure what the issue this ticket is trying to accomplish. Is it about adding a file DataDesc to each of the examples so that they can convert file inputs into data for Chunks?

JacquesCarette commented 1 month ago

No @NoahCardoso it is about adding a "data description" (inside Drasil itself) that corresponds to the input format of each example. If you know about XML Schemas, that would be a good analogy.