Skip to content

Commit

Permalink
Documentation site updates
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilSoleymani committed Aug 18, 2022
1 parent f36afde commit 8c79ea6
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 15 deletions.
5 changes: 4 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ using vdisp
include("../src/OutputFormat/CalculationBehaviour.jl")
using .CalculationBehaviour

include("../src/InputParser.jl")
using .InputParser

makedocs(
sitename = "vdisp",
format = Documenter.HTML(),
modules = [vdisp, CalculationBehaviour]
modules = [vdisp, CalculationBehaviour, InputParser]
)

# Documenter can also automatically deploy documentation to gh-pages.
Expand Down
50 changes: 49 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,59 @@
# vdisp.jl

`VDisp` is a one-dimensional soil settlement analysis software created to aid undergraduate civil engineering students in their studies of geotechnical engineering. It is created using the `Julia` programming language, and `Qt/QML` markup language for the front-end GUI.

## Calculations

`VDisp` calculations are handled by the `CalculationBehaviour.jl` module. The following functions are responsible for calculating the *effective stresses* of the soil before placing any load, the *effective stresses* **after** placing the load, and any method specific calculations required afterwards.

```@docs
vdisp.readInputFile
CalculationBehaviour.getEffectiveStress
CalculationBehaviour.getSurchargePressure
CalculationBehaviour.getValue
CalculationBehaviour.schmertmannApproximation
```

## Input Files

`VDisp` input files are parsed using the `InputParser.jl` module. This module is responsible for parsing input files, creating `InputData` instances, and reporting any possible errors in the input file format in a descriptive and helpful manner.

> Note: `VDisp` still contains code that parses the old input file format from the original `VDispl` project. This code is kept in mainly for testing purposes, in which we test the new `VDisp`'s results against that of the original program's. This also allows flexibility for any future developers or contributors to the project!
```@docs
InputParser.parseCurrentLine
InputParser.InputData
InputParser.GUIData
vdisp.createOutputDataFromGUI
vdisp.writeGUIDataToFile
```

### Error Handling

As mentioned above, the `InputParser.jl` module is also responsible for handling any errors that might come up in input files. The following
are custom defined exceptions to help in this process.

```@docs
InputParser.ParsingError
InputParser.FoundationError
InputParser.SoilNumberError
InputParser.NotEnoughValuesError
InputParser.ModelError
InputParser.UnitError
InputParser.FoundationTypeError
InputParser.FloatConvertError
InputParser.IntConvertError
InputParser.BoolConvertError
InputParser.DimensionNegativeError
InputParser.MaterialIndexOutOfBoundsError
InputParser.PropertyError
```

## Old Functions

The `VDisp` program has kept in some of the old functionality of `VDispl`, like parsing the old input file format and directly writing to an output file. The functions assisting with this process are still available for any future contributors or curious developers to play around with and are listed below:

```@docs
vdisp.readInputFile
```

Documentation for vdisp.jl
29 changes: 16 additions & 13 deletions src/InputParser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ This is usually thrown when the module has already caught a specific error while
in another function, and given user the neccessary feedback. This error is then thrown so
it can be caught and handled gracefuly by the script calling the function.
> Note: Old input file type is no longer used in the modern version of `VDisp`. The parsing has been
left in for developers who would like to test it out.
> Note: Old input file type is no longer used in the modern version of `VDisp`. The parsing has been left in for developers who would like to test it out.
"""
struct ParsingError <: Exception
id::Int
Expand All @@ -30,8 +29,7 @@ Base.showerror(io::IO, e::ParsingError) = print(io, "Could not parse file.")
The foundationOption was not read as 1 or 2 in old input file type.
> Note: Old input file type is no longer used in the modern version of `VDisp`. The parsing has been
left in for developers who would like to test it out.
> Note: Old input file type is no longer used in the modern version of `VDisp`. The parsing has been left in for developers who would like to test it out.
"""
struct FoundationError <: Exception
id::Int
Expand All @@ -52,8 +50,7 @@ Ex. The soilLayerNumber of layer 12 is given before layer 11. Invalid sequence:
16 3
```
> Note: Old input file type is no longer used in the modern version of `VDisp`. The parsing has been
left in for developers who would like to test it out.
> Note: Old input file type is no longer used in the modern version of `VDisp`. The parsing has been left in for developers who would like to test it out.
"""
struct SoilNumberError <: Exception
id::Int
Expand Down Expand Up @@ -206,16 +203,17 @@ Base.showerror(io::IO, e::PropertyError) = print(io, e.msg)
export Model, Units, Foundation, ErrorID, GUIData, InputData, ParsingError, SoilNumberError, ModelError, UnitError, FoundationTypeError, FloatConvertError, IntConvertError, BoolConvertError, DimensionNegativeError, MaterialIndexOutOfBoundsError, PropertyError

"""
parseCurrentLine(input, items, index)
parseCurrentLine(input::Array{String}, items::Int, index::Int, delimiter::String=" ")
Parses the string and *index*-th index of *input* array. Makes sure there are *items*
values separated by spaces in the string.
Given an array of `String` values, `input`, the index of a string in this array to parse, `index`, and the number of values expected to be parsed
in this string, `items`, `parseCurrentLine()` returns an `Array` of values parsed from the specified line, or a `NotEnoughValuesError` if not enough values
were found. There is also an optional argument, `delimiter`, which specifies the delimiter which separates each value. The default value for `delimiter` is a single space.
"""
function parseCurrentLine(input::Array{String}, items::Int, index::Int, splitString::String=" ")
function parseCurrentLine(input::Array{String}, items::Int, index::Int, delimiter::String=" ")
currentLine = input[index]
# Tabs ruin splitting by space
currentLine = replace(currentLine, "\t" => " ")
currentLineData = split(currentLine, splitString)
currentLineData = split(currentLine, delimiter)
currentLineData = filter(x -> x != "", currentLineData)
# Check if data is there
if size(currentLineData)[1] < items
Expand All @@ -229,7 +227,11 @@ end
The `InputData` struct contains all the variables needed to perform `VDisp` calculations.
It is constructed either by parsing an input file, or by converting data entered in GUI.
There are two main ways to construct an instance of `InputData`:
* Parse an input file which follows the speciication of the **old** `VDispl` file format. Details about this file format can be found in Appendix F of [this](https://www.publications.usace.army.mil/Portals/76/Publications/EngineerManuals/EM_1110-1-1904.pdf) publication. This functionality is not used in the modern version of `VDisp`, it has only been kept to allow people to parse the old input files if they want.
* By converting values entered in the GUI into the values that populate the fields of an `InputData` instance. This is the way `VDisp` creates `InputData`instances, which are then used to make `OutputData`instances, in the `createOutputDataFromGUI()` function.
"""
struct InputData
problemName::String
Expand Down Expand Up @@ -975,7 +977,8 @@ end
"""
GUIData()
The `GUIData` struct contains all the information parsed from new input file format.
The `GUIData` struct contains all the information parsed from new input file format. This information
is used to populate the GUI entries, significantly speeding up the process and improving the user experience.
"""
struct GUIData
# Stage 1
Expand Down

0 comments on commit 8c79ea6

Please sign in to comment.