Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions julia/1D_basis_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"metadata": {},
"outputs": [],
"source": [
"kv = Gismo.KnotVector([0,0,0,0.25,0.50,0.75,1,1,1]);"
"kv = KnotVector([0,0,0,0.25,0.50,0.75,1,1,1]);"
]
},
{
Expand Down Expand Up @@ -108,7 +108,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"The knots of the basis are:\\n\",Gismo.knots(basis,Int32(0)));"
"print(\"The knots of the basis are:\\n\",knots(basis,0));"
]
},
{
Expand All @@ -126,7 +126,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"The size of the basis is: \",Gismo.size(basis));"
"print(\"The size of the basis is: \",size(basis));"
]
},
{
Expand Down Expand Up @@ -165,7 +165,7 @@
"const N = 100;\n",
"x = zeros(1,N);\n",
"x[1,:] = range(0,stop=1,length=100)\n",
"y = Gismo.asMatrix(Gismo.eval(basis,x));"
"y = asMatrix(val(basis,x));"
]
},
{
Expand All @@ -183,22 +183,12 @@
"metadata": {},
"outputs": [],
"source": [
"ev = zeros(Gismo.size(basis)+1,N);\n",
"for fun in 1:Gismo.size(basis)+1\n",
" ev[Int(fun),:] = Gismo.asMatrix(Gismo.evalSingle(basis,Int32(fun-1),x));\n",
"ev = zeros(size(basis)+1,N);\n",
"for fun in 1:size(basis)+1\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solve fun index out of bound

" ev[Int(fun),:] = asMatrix(val(basis,fun-1,x));\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0d2b6bd7",
"metadata": {},
"outputs": [],
"source": [
"print()"
]
},
{
"cell_type": "markdown",
"id": "4cdf8910",
Expand Down
34 changes: 10 additions & 24 deletions julia/2D_surface_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"metadata": {},
"outputs": [],
"source": [
"kv_u = kv_v = Gismo.KnotVector([0,0,0,0.25,0.50,0.75,1,1,1]);"
"kv_u = kv_v = KnotVector([0,0,0,0.25,0.50,0.75,1,1,1]);"
]
},
{
Expand All @@ -59,7 +59,7 @@
"metadata": {},
"outputs": [],
"source": [
"tbasis = Gismo.TensorBSplineBasis(kv_u, kv_v);"
"tbasis = TensorBSplineBasis(kv_u, kv_v);"
]
},
{
Expand Down Expand Up @@ -88,8 +88,8 @@
"metadata": {},
"outputs": [],
"source": [
"coefficients = zeros(Gismo.size(tbasis),3);\n",
"n = Int(sqrt(Gismo.size(tbasis)));"
"coefficients = zeros(size(tbasis),3);\n",
"n = Int(sqrt(size(tbasis)));"
]
},
{
Expand Down Expand Up @@ -150,7 +150,7 @@
"metadata": {},
"outputs": [],
"source": [
"surf = Gismo.TensorBSpline(tbasis,coefficients);"
"surf = TensorBSpline(tbasis,coefficients);"
]
},
{
Expand Down Expand Up @@ -191,7 +191,7 @@
"id": "ua76rgx92T1J"
},
"source": [
"The surface is simply evaluated using `eval`, and the result is properly reshaped into the format of the mesh grid:"
"The surface is simply evaluated using `val`, and the result is properly reshaped into the format of the mesh grid:"
]
},
{
Expand All @@ -200,7 +200,7 @@
"metadata": {},
"outputs": [],
"source": [
"S = Gismo.asMatrix(Gismo.eval(surf,pts));\n",
"S = asMatrix(val(surf,pts));\n",
"ZZ = reshape(S[3,:],(N,M));"
]
},
Expand Down Expand Up @@ -250,8 +250,8 @@
"outputs": [],
"source": [
"path = joinpath(@__DIR__,\"filedata/sphere.xml\");\n",
"XMLSurf = Gismo.Geometry(path);\n",
"XMLcoefs = copy(Gismo.asMatrix(Gismo.coefs(XMLSurf)));"
"XMLSurf = Geometry(path);\n",
"XMLcoefs = copy(asMatrix(coefs(XMLSurf)));"
]
},
{
Expand All @@ -276,7 +276,7 @@
"YY = (y' .* ones(N));\n",
"pts = vcat(reduce(vcat,XX)',reduce(vcat,YY)');\n",
"\n",
"S = Gismo.asMatrix(Gismo.eval(XMLSurf,pts));\n",
"S = asMatrix(val(XMLSurf,pts));\n",
"XX = reshape(S[1,:],(N,M));\n",
"YY = reshape(S[2,:],(N,M));\n",
"ZZ = reshape(S[3,:],(N,M));\n",
Expand All @@ -286,20 +286,6 @@
"# scatter!(XMLcoefs[:,1],XMLcoefs[:,2],XMLcoefs[:,3])\n",
"display(p)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down