Skip to content

Commit

Permalink
ADD documentation
Browse files Browse the repository at this point in the history
ADD example for quadrature
  • Loading branch information
hverhelst committed Dec 19, 2024
1 parent 0d1c2de commit d35b0ea
Show file tree
Hide file tree
Showing 22 changed files with 1,091 additions and 157 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ The Gismo.jl package can be directly downloaded from Julia's package management
```
] add Gismo
```
This command fetches the dependency [`gismo_jll`](LINK) contaning pre-compiled library files, and it fetches the current repository which calls `gismo_jll`.
This command fetches the dependency [`gismo_jll`](https://github.com/JuliaBinaryWrappers/gismo_jll.jl) contaning pre-compiled library files, and it fetches the current repository which calls `gismo_jll`.

### Enabling Gismo.jl locally
Alternatively, one can use a local build of G+Smo as a back-end for the Julia bindings. This requires the [`gsCInterface`](LINK) module to be compiled, and the Gismo.jl package to be fetched as a submodule in G+Smo.
Alternatively, one can use a local build of G+Smo as a back-end for the Julia bindings. This requires the [`gsCInterface`](https://github.com/gismo/gsCInterface) module to be compiled, and the Gismo.jl package to be fetched as a submodule in G+Smo.

#### a. Fetching and compiling the required G+Smo submodules
Enable the `gsCInterface` and the `Gismo.jl` modules inside G+Smo
Expand Down
6 changes: 3 additions & 3 deletions cmake/Gismo.jl.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module Gismo
# Forward declaration of structs
include("Declarations.jl")

# Load gsAssembler
include("gsAssembler.jl")

# Load gsCore
include("gsCore.jl")

# Load gsAssembler
include("gsAssembler.jl")

# Load gsHSplines
include("gsHSplines.jl")

Expand Down
9 changes: 6 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ DocMeta.setdocmeta!(Gismo,

# List of subsection pages
SUBSECTION_PAGES = [
"gsMatrix.md",
"gsCore.md",
"gsNurbs.md",
"gsHSplines.md"
"gsAssembler.md",
"gsHSplines.md",
"gsIO.md",
"gsMatrix.md",
"gsModeling.md",
"gsNurbs.md"
]

makedocs(
Expand Down
10 changes: 10 additions & 0 deletions docs/src/gsAssembler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# gsAssembler

The methods in `gsAssembler` contain methods used for assembly.

## Function Documentation
```@autodocs
Modules = [Gismo]
Pages = ["src/gsAssembler.jl"]
Order = [:function, :type]
```
6 changes: 2 additions & 4 deletions docs/src/gsCore.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# gsCore

The methods in `gsCore` contain basis, geometry and function methods.

## Function Documentation
```@autodocs
Modules = [Gismo]
Pages = ["src/gsCore.jl"]
Order = [:function, :type]
```

```@contents
Pages = Main.SUBSECTION_PAGES
```
2 changes: 2 additions & 0 deletions docs/src/gsHSplines.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# gsHSplines

The methods in `gsHSplines` contain methods for hierarchical splines.

## Function Documentation
```@autodocs
Modules = [Gismo]
Expand Down
10 changes: 10 additions & 0 deletions docs/src/gsIO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# gsIO

The methods in `gsIO` contain G+Smo's methods for input and output.

## Function Documentation
```@autodocs
Modules = [Gismo]
Pages = ["src/gsIO.jl"]
Order = [:function, :type]
```
6 changes: 2 additions & 4 deletions docs/src/gsMatrix.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# gsMatrix

The methods in `gsMatrix` are an interface to G+Smo's linear algebra, supported by `Eigen`.

## Function Documentation
```@autodocs
Modules = [Gismo]
Pages = ["src/gsMatrix.jl"]
Order = [:function, :type]
```

```@contents
Pages = Main.SUBSECTION_PAGES
```
10 changes: 10 additions & 0 deletions docs/src/gsModeling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# gsModeling

The methods in `gsModeling` contain methods for geometric modelling, such as fitting.

## Function Documentation
```@autodocs
Modules = [Gismo]
Pages = ["src/gsModeling.jl"]
Order = [:function, :type]
```
2 changes: 2 additions & 0 deletions docs/src/gsNurbs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# gsNurbs

The methods in `gsNurbs` contain methods related to NURBS and B-splines.

## Function Documentation
```@autodocs
Modules = [Gismo]
Expand Down
48 changes: 46 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,52 @@
Julia interface for the Geometry + Simulation modules (G+Smo)

## Installation instructions
# Gismo.jl: Geometry + Simulation Modules meet Julia
The Gismo.jl package provides an interface to the [Geometry + Simulation Modules](https://github.com/gismo/gismo) inside Julia.

## Getting started
We provide a hand full of examples in the `examples` directory, which can be run after [installation](#installation) of the package.

## Installation
There are two ways to install Gismo.jl: via Julia's package manager, or by linking it to a local build of G+Smo.

### Via `Pkg`
The Gismo.jl package can be directly downloaded from Julia's package management system `Pkg` using
```
] add Gismo
```
This command fetches the dependency [`gismo_jll`](https://github.com/JuliaBinaryWrappers/gismo_jll.jl) contaning pre-compiled library files, and it fetches the current repository which calls `gismo_jll`.

### Enabling Gismo.jl locally
Alternatively, one can use a local build of G+Smo as a back-end for the Julia bindings. This requires the [`gsCInterface`](https://github.com/gismo/gsCInterface) module to be compiled, and the Gismo.jl package to be fetched as a submodule in G+Smo.

#### a. Fetching and compiling the required G+Smo submodules
Enable the `gsCInterface` and the `Gismo.jl` modules inside G+Smo
```
cd path/to/gismo/build
cmake . -DGISMO_OPTIONAL="<OTHER OPTIONAL MODULES>;gsCInterface;Gismo.jl" \
-DGISMO_JL_DEVELOP=ON
```
And compile everything
```
make gismo
```
#### b. Link libgismo to Gismo.jl
In the file `Gismo.jl/src/Gismo.jl`, the shared library should be included as follows:
```
libgismo = "path/to/gismo/build/lib/libgismo"
```

#### c. Install Gismo.jl in Julia
Add the local package Gismo.jl to Julia's development packages
```
cd path/to/gismo/
cd optional
julia -e 'using Pkg; Pkg.develop(path="Gismo.jl")'
```

## Structure of the package
The package is structured according to the `src/` folder in `gismo`'s C++ library. That is, for every directory `dir` in `src/dir`, `Gismo.jl/src` contains a `jl` file.

## Function Documentation
```@docs
```

21 changes: 21 additions & 0 deletions examples/OptionList_example.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Gismo

options = Dict([("a",1), ("b",1.1), ("c", true), ("d", "one")])
println(options)
gsOptionList = OptionList(options)
println(gsOptionList)

Gismo.setInt(gsOptionList,"a",Int32(2))
Gismo.setReal(gsOptionList,"b",2.0)
Gismo.setSwitch(gsOptionList,"c",false)
Gismo.setString(gsOptionList,"d","two")
println(gsOptionList)

int::Int64 = Gismo.getInt(gsOptionList,"a")
println("Integer read from option list: ",int)
double::Float64 = Gismo.getReal(gsOptionList,"b")
println("Double read from option list: ",double)
bool::Bool = Gismo.getSwitch(gsOptionList,"c")
println("Bool read from option list: ",bool)
string::Cstring = Gismo.getString(gsOptionList,"d")
println("String read from option list: ",string)
15 changes: 15 additions & 0 deletions examples/QuadRule_example.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Gismo

# Gauss quadrature rule (1D)
rule1D = GaussRule(Int32(2))
nodes,weights = mapTo(rule1D,0.0,1.0)
println("Gauss nodes: ",asMatrix(nodes))
println("Gauss nodes: ",asVector(weights))

# Lobatto quadrature rule (2D)
rule2D = LobattoRule(Int32(2),Array{Int32}([2,2]))
low = Vector{Float64}([0.0,0.0])
upp = Vector{Float64}([1.0,1.0])
nodes,weights = mapTo(rule2D,low,upp)
println("Lobatto nodes: ",asMatrix(nodes))
println("Lobatto weights: ",asVector(weights))
2 changes: 2 additions & 0 deletions examples/TensorBSpline_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ coefs = rand(size(TBB),3)
# Create a BSpline geometry
TB = TensorBSpline(TBB,coefs)

Gismo.size(KV)

# Create a matrix of linearly spaced evaluation points
N = 10
points1D = range(0,stop=1,length=N)
Expand Down
8 changes: 4 additions & 4 deletions src/Gismo.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module Gismo

import gismo_jll:libgismo
libgismo = "/home/hverhelst/Documents/code/gismo_mex/build/lib/libgismo"

# Forward declaration of structs
include("Declarations.jl")

# Load gsAssembler
include("gsAssembler.jl")

# Load gsCore
include("gsCore.jl")

# Load gsAssembler
include("gsAssembler.jl")

# Load gsHSplines
include("gsHSplines.jl")

Expand Down
Loading

0 comments on commit d35b0ea

Please sign in to comment.