Skip to content

Commit

Permalink
Improve create() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
gha3mi committed Apr 16, 2024
1 parent b24c5cc commit 4fd1ad1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/forcad_nurbs_curve.f90
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ pure subroutine create(this, res, Xt)
error stop 'Control points are not set.'
end if

if (.not.allocated(this%knot)) then
error stop 'Knot vector is not set.'
end if

! Set parameter values
if (present(Xt)) then
if (allocated(this%Xt)) deallocate(this%Xt)
Expand Down Expand Up @@ -534,7 +538,7 @@ pure subroutine modify_Wc(this,W,num)
knot = this%knot
call this%set(knot = knot, Xc = Xc, Wc = Wc)
else
call this%set(Xc = Xc, Wc = Wc)
call this%set(Xc = Xc, Wc = Wc)
end if
else
error stop 'The NURBS curve is not rational.'
Expand Down
4 changes: 4 additions & 0 deletions src/forcad_nurbs_surface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ pure subroutine create(this, res1, res2, Xt1, Xt2, Xt)
error stop 'Control points are not set.'
end if

if (.not.allocated(this%knot1) .or. .not.allocated(this%knot2)) then
error stop 'Knot vector(s) is/are not set.'
end if


! Set parameter values
if (present(Xt1)) then
Expand Down
4 changes: 4 additions & 0 deletions src/forcad_nurbs_volume.f90
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ pure subroutine create(this, res1, res2, res3, Xt1, Xt2, Xt3, Xt)
error stop 'Control points are not set.'
end if

if (.not.allocated(this%knot1) .or. .not.allocated(this%knot2) .or. .not.allocated(this%knot3)) then
error stop 'Knot vector(s) is/are not set.'
end if

! Set parameter values
if (present(Xt1)) then
if (allocated(this%Xt1)) deallocate(this%Xt1)
Expand Down

0 comments on commit 4fd1ad1

Please sign in to comment.