Skip to content

Commit

Permalink
Update insert_knot and add elevate_degree
Browse files Browse the repository at this point in the history
- Update Example nurbs_curve.f90
- Update README.md
  • Loading branch information
gha3mi committed Apr 3, 2024
1 parent 163966d commit afe79ad
Show file tree
Hide file tree
Showing 3 changed files with 357 additions and 63 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ ford ford.yml
- [x] Add `insert_knot()` method for curves.
- [ ] Add `insert_knot()` method for surfaces and volumes.
- [ ] Add `remove_knot()` method for curves, surfaces and volumes.
- [ ] Add `elevate_degree()` method for curves, surfaces and volumes.
- [x] Add `elevate_degree()` method for curves.
- [ ] Add `elevate_degree()` method for surfaces and volumes.
- [ ] Add `reduce_degree()` method for curves, surfaces and volumes.
- [ ] Add `derivative()` method.
- [ ] Add support for multiple patches.
Expand Down
18 changes: 17 additions & 1 deletion example/nurbs_curve.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ program example_nurbs_curve

! Define weights for the control points
allocate(Wc(3))
Wc = [1.0_rk, 2.0_rk, 1.0_rk]
Wc = [1.0_rk, 2.0_rk, 0.3_rk]

! Define knot vector
knot = [0.0_rk, 0.0_rk, 0.0_rk, 1.0_rk, 1.0_rk, 1.0_rk]
Expand All @@ -43,6 +43,22 @@ program example_nurbs_curve
! Export the generated curve to a VTK file
call nurbs%export_Xg('vtk/nurbs_curve_Xg.vtk')

!-----------------------------------------------------------------------------
! Refinements
!-----------------------------------------------------------------------------

! Insert knots
call nurbs%insert_knot([0.25_rk, 0.75_rk])

! Elevate the degree of the curve (2 times)
call nurbs%elevate_degree(2)

! Export updated control points to a VTK file
call nurbs%export_Xc('vtk/nurbs_curve_Xc2.vtk')

! Export the refined generated curve to a VTK file
call nurbs%export_Xg('vtk/nurbs_curve_Xg2.vtk')

!-----------------------------------------------------------------------------
! Finalizing
!-----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit afe79ad

Please sign in to comment.