The Open FUSION Toolkit 1.0.0-8905cc5
Modeling tools for plasma and fusion research and engineering
Loading...
Searching...
No Matches
Data Types | Functions/Subroutines | Variables
nurbs_cad Module Reference

Detailed Description

CAD utility functions and class definition for reconstruction of non-uniform rational bezier CAD objects.

This module supports internal refinement of CUBIT generated meshes while maintaining the true CAD boundary. Refinement uses MINPACK to minimize the weighted sum of distances between constraint points with the point constrained to the CAD object. Evaluation of CAD objects is provided by an interface to the OpenNURBS library.

Author
Chris Hansen
Date
May 2012

Data Types

type  nurbs_curve
 CAD curve class. More...
 
interface  nurbs_curve_domain
 Get the parametric domain of a NURBS curve. More...
 
interface  nurbs_curve_linear
 Test if NURBS curve is straight. More...
 
interface  nurbs_curve_name
 Get the name of a OpenNURBS curve. More...
 
interface  nurbs_curve_periodic
 Test periodicity of a NURBS curve. More...
 
interface  nurbs_dummy_eval
 Evaluate position from a NURBS object. More...
 
interface  nurbs_dummy_find
 Find the nearest location on a NURBS object to a given point. More...
 
interface  nurbs_dummy_grid
 Create a grid of points evenly spaced in parametric space. More...
 
interface  nurbs_dummy_unwrap
 Unwrap the periodic coordinates of a NURBS object to avoid parameter cuts. More...
 
interface  nurbs_dummy_wrap
 Wrap the periodic coordinates of a NURBS object into a single span. More...
 
type  nurbs_entity
 CAD entity class. More...
 
type  nurbs_entity_ptr
 List of CAD entities. More...
 
interface  nurbs_eval_curve
 Evalute the position along a NURBS curve. More...
 
interface  nurbs_eval_surf
 Evalute the position on a NURBS surface. More...
 
interface  nurbs_finalize
 Finalize the OpenNURBS library. More...
 
interface  nurbs_get_count
 Get a count of OpenNURBS objects in current file. More...
 
interface  nurbs_init
 Initialize the OpenNURBS library. More...
 
interface  nurbs_read_in
 Read-in a OpenNURBS *.3dm geometry file set objects as active. More...
 
type  nurbs_surf
 CAD surface class. More...
 
interface  nurbs_surf_domain
 Get the parametric domain of a NURBS surface. More...
 
interface  nurbs_surf_name
 Get the name of a OpenNURBS surface. More...
 
interface  nurbs_surf_periodic
 Test periodicity of a NURBS surface. More...
 
interface  nurbs_surf_planar
 Test if NURBS surface is planar. More...
 
interface  nurbs_surf_singular
 Test if edges of a NURBS surface are degenerate. More...
 

Functions/Subroutines

subroutine nurbs_cmid_error (m, n, uv, err, iflag)
 Evalute the error between a curve point and the current active points used in a 2 point minimization.
 
subroutine nurbs_curve_eval (self, pt, u, v)
 Map the parametric position on a curve to physical coordinates.
 
subroutine nurbs_curve_find (self, pt, u, v, ierr)
 Find the parametric representation of a boundary point in CAD representation on a curve.
 
subroutine nurbs_curve_grid (self)
 Evalute a grid of points evenly spaced in parametric space.
 
subroutine, public nurbs_curve_midpoint (self, pt, pt1, pt2, wt1, wt2, ierr)
 Compute the weighted midpoint of a curve edge.
 
subroutine nurbs_curve_unwrap (self, u1, u2, v1, v2)
 Unwrap the coordinate of a periodic NURBS curve to avoid parameter cuts.
 
subroutine nurbs_curve_wrap (self, u, v)
 Wrap the coordinate of a periodic NURBS curve into a single span.
 
subroutine nurbs_scenter_error (m, n, uv, err, iflag)
 Evalute the error between a surface point and the current active points used in a 3 point minimization.
 
subroutine nurbs_smid_error (m, n, uv, err, iflag)
 Evalute the error between a surface point and the current active points used in a 2 point minimization.
 
logical function nurbs_surf_atsingular (self, u, v)
 Detect if parametric location is at singular point.
 
subroutine, public nurbs_surf_avg (self, n, uin, vin, uavg, vavg)
 Needs docs?
 
subroutine, public nurbs_surf_center (self, pt, pt1, pt2, pt3, wt1, wt2, wt3, ierr)
 Compute the weighted center point of a surface triangle.
 
subroutine nurbs_surf_error (m, n, uv, err, iflag)
 Evalute the error between a surface point and the current active point used in a minimization.
 
subroutine nurbs_surf_eval (self, pt, u, v)
 Map the parametric position on a surface to physical coordinates.
 
subroutine nurbs_surf_find (self, pt, u, v, ierr)
 Find the parametric representation of a boundary point in CAD representation on a surface.
 
subroutine nurbs_surf_grid (self)
 Evalute a grid of points evenly spaced in parametric space.
 
subroutine, public nurbs_surf_midpoint (self, pt, pt1, pt2, wt1, wt2, ierr)
 Compute the weighted midpoint of a surface edge.
 
subroutine nurbs_surf_unwrap (self, u1, u2, v1, v2)
 Unwrap the periodic coordinates of a NURBS surface to avoid parameter cuts.
 
subroutine nurbs_surf_wrap (self, u, v)
 Wrap the periodic coordinates of a NURBS surface into a single span.
 

Variables

class(nurbs_curve), pointer active_curve => NULL()
 Active curve for MINPACK fitting.
 
real(r8), dimension(3, 3) active_endpts
 Active constraint points for MINPACK fitting.
 
real(r8), dimension(3) active_pt
 Active fit point for MINPACK fitting.
 
class(nurbs_surf), pointer active_surf => NULL()
 Active surface for MINPACK fitting.
 
real(r8), dimension(3) active_wts
 Active constraint weights for MINPACK fitting.
 
integer(i4), parameter nurbs_ngrid = 20
 Number of grid points to use for object meshes.
 
real(r8), parameter nurbs_singstep = .1d0
 Distance to offset guesses from singular edges.
 

Function/Subroutine Documentation

◆ nurbs_cmid_error()

subroutine nurbs_cmid_error ( integer(i4), intent(in)  m,
integer(i4), intent(in)  n,
real(r8), dimension(n), intent(in)  uv,
real(r8), dimension(m), intent(out)  err,
integer(i4), intent(inout)  iflag 
)
private

Evalute the error between a curve point and the current active points used in a 2 point minimization.

Note
Designed to be used as the error function for minimization in nurbs_curve_midpoint
Parameters
[in]mNumber of spatial dimensions (3)
[in]nNumber of parametric dimensions (2)
[in]uvParametric position [n]
[out]errError vector between current and desired point [3]
[in,out]iflagUnused flag

◆ nurbs_curve_eval()

subroutine nurbs_curve_eval ( class(nurbs_curve), intent(in)  self,
real(r8), dimension(3), intent(out)  pt,
real(r8), intent(in)  u,
real(r8), intent(in)  v 
)
private

Map the parametric position on a curve to physical coordinates.

  • (u,v) -> (x,y,z)
    Parameters
    [out]ptPosition vector [3]
    [in]uParametric coordinate 1
    [in]vParametric coordinate 2 (ignored)

◆ nurbs_curve_find()

subroutine nurbs_curve_find ( class(nurbs_curve), intent(in), target  self,
real(r8), dimension(3), intent(in)  pt,
real(r8), intent(out)  u,
real(r8), intent(out)  v,
integer(i4), intent(out)  ierr 
)
private

Find the parametric representation of a boundary point in CAD representation on a curve.

  • (x,y,z) -> (u,v)
    Parameters
    [in]ptPosition vector [3]
    [out]uParametric coordinate 1
    [out]vParametric coordinate 2 (ignored)
    [out]ierrError status

◆ nurbs_curve_grid()

subroutine nurbs_curve_grid ( class(nurbs_curve), intent(inout)  self)
private

Evalute a grid of points evenly spaced in parametric space.

Parameters
[in,out]selfCurve object

◆ nurbs_curve_midpoint()

subroutine, public nurbs_curve_midpoint ( class(nurbs_curve), intent(in), target  self,
real(r8), dimension(3), intent(inout)  pt,
real(r8), dimension(3), intent(in)  pt1,
real(r8), dimension(3), intent(in)  pt2,
real(r8), intent(in)  wt1,
real(r8), intent(in)  wt2,
integer(i4), intent(out)  ierr 
)

Compute the weighted midpoint of a curve edge.

Locates the point on a given CAD curve which minimizes the weighted sum of distances to 2 constraint points.

\[ \sum_i w_i*(r_n - p_i)^2 \]

Parameters
[in]selfCurve object
[in,out]ptSolution point
[in]pt1Constraint point 1
[in]pt2Constraint point 2
[in]wt1Constraint weight 1
[in]wt2Constraint weight 2
[out]ierrError flag

◆ nurbs_curve_unwrap()

subroutine nurbs_curve_unwrap ( class(nurbs_curve), intent(in)  self,
real(r8), intent(inout)  u1,
real(r8), intent(inout)  u2,
real(r8), intent(inout)  v1,
real(r8), intent(inout)  v2 
)
private

Unwrap the coordinate of a periodic NURBS curve to avoid parameter cuts.

  • Example: For a periodic domain of \( [0,2 \pi] (3 \pi/4,0) -> (-\pi/4,0) \)
    Parameters
    [in]selfCurve object
    [in,out]u1Parametric coordinate 1 of first point
    [in,out]u2Parametric coordinate 2 of first point (unused)
    [in,out]v1Parametric coordinate 1 of second point
    [in,out]v2Parametric coordinate 2 of second point (unused)

◆ nurbs_curve_wrap()

subroutine nurbs_curve_wrap ( class(nurbs_curve), intent(in)  self,
real(r8), intent(inout)  u,
real(r8), intent(inout)  v 
)
private

Wrap the coordinate of a periodic NURBS curve into a single span.

  • Example: For a periodic domain of \( [0,2 \pi] (-\pi/4,0) -> (3 \pi/4,0) \)
Parameters
[in,out]uParametric coordinate 1
[in,out]vParametric coordinate 2 (unused)
[in]selfCurve object
[in,out]uParametric coordinate 1
[in,out]vParametric coordinate 2 (unused)

◆ nurbs_scenter_error()

subroutine nurbs_scenter_error ( integer(i4), intent(in)  m,
integer(i4), intent(in)  n,
real(r8), dimension(n), intent(in)  uv,
real(r8), dimension(m), intent(out)  err,
integer(i4), intent(inout)  iflag 
)
private

Evalute the error between a surface point and the current active points used in a 3 point minimization.

Note
Designed to be used as the error function for minimization in nurbs_surf_center
Parameters
[in]mNumber of spatial dimensions (3)
[in]nNumber of parametric dimensions (2)
[in]uvParametric position [n]
[out]errError vector between current and desired point [3]
[in,out]iflagUnused flag

◆ nurbs_smid_error()

subroutine nurbs_smid_error ( integer(i4), intent(in)  m,
integer(i4), intent(in)  n,
real(r8), dimension(n), intent(in)  uv,
real(r8), dimension(m), intent(out)  err,
integer(i4), intent(inout)  iflag 
)
private

Evalute the error between a surface point and the current active points used in a 2 point minimization.

Note
Designed to be used as the error function for minimization in nurbs_surf_midpoint
Parameters
[in]mNumber of spatial dimensions (3)
[in]nNumber of parametric dimensions (2)
[in]uvParametric position [n]
[out]errError vector between current and desired point [3]
[in,out]iflagUnused flag

◆ nurbs_surf_atsingular()

logical function nurbs_surf_atsingular ( class(nurbs_surf), intent(in)  self,
real(r8), intent(inout)  u,
real(r8), intent(inout)  v 
)
private

Detect if parametric location is at singular point.

Parameters
[in]selfSurface object
[in,out]uParametric coordinate 1
[in,out]vParametric coordinate 2

◆ nurbs_surf_avg()

subroutine, public nurbs_surf_avg ( class(nurbs_entity), intent(in), target  self,
integer(i4), intent(in)  n,
real(r8), dimension(n), intent(in)  uin,
real(r8), dimension(n), intent(in)  vin,
real(r8), intent(out)  uavg,
real(r8), intent(out)  vavg 
)

Needs docs?

Parameters
[in]selfSurface object
[in]nNeeds docs
[in]uinNeeds docs
[in]vinNeeds docs
[out]uavgNeeds docs
[out]vavgNeeds docs

◆ nurbs_surf_center()

subroutine, public nurbs_surf_center ( class(nurbs_surf), intent(in), target  self,
real(r8), dimension(3), intent(inout)  pt,
real(r8), dimension(3), intent(in)  pt1,
real(r8), dimension(3), intent(in)  pt2,
real(r8), dimension(3), intent(in)  pt3,
real(r8), intent(in)  wt1,
real(r8), intent(in)  wt2,
real(r8), intent(in)  wt3,
integer(i4), intent(out)  ierr 
)

Compute the weighted center point of a surface triangle.

Locates the point on a given CAD surface which minimizes the weighted sum of distances to 3 constraint points.

\[ \sum_i w_i*(r_n - p_i)^2 \]

Parameters
[in]selfSurface object
[in,out]ptSolution point
[in]pt1Constraint point 1
[in]pt2Constraint point 2
[in]pt3Constraint point 3
[in]wt1Constraint weight 1
[in]wt2Constraint weight 2
[in]wt3Constraint weight 3
[out]ierrError flag

◆ nurbs_surf_error()

subroutine nurbs_surf_error ( integer(i4), intent(in)  m,
integer(i4), intent(in)  n,
real(r8), dimension(n), intent(in)  uv,
real(r8), dimension(m), intent(out)  err,
integer(i4), intent(inout)  iflag 
)
private

Evalute the error between a surface point and the current active point used in a minimization.

Note
Designed to be used with MINPACK for non-linear least square location of nearest surface point
Parameters
[in]mNumber of spatial dimensions (3)
[in]nNumber of parametric dimensions (2)
[in]uvParametric position [n]
[out]errError vector between current and desired point [3]
[in,out]iflagUnused flag

◆ nurbs_surf_eval()

subroutine nurbs_surf_eval ( class(nurbs_surf), intent(in)  self,
real(r8), dimension(3), intent(out)  pt,
real(r8), intent(in)  u,
real(r8), intent(in)  v 
)
private

Map the parametric position on a surface to physical coordinates.

  • (u,v) -> (x,y,z)
    Parameters
    [in]selfSurface object
    [out]ptPhysical position [3]
    [in]uParametric coordinate 1
    [in]vParametric coordinate 2

◆ nurbs_surf_find()

subroutine nurbs_surf_find ( class(nurbs_surf), intent(in), target  self,
real(r8), dimension(3), intent(in)  pt,
real(r8), intent(out)  u,
real(r8), intent(out)  v,
integer(i4), intent(out)  ierr 
)
private

Find the parametric representation of a boundary point in CAD representation on a surface.

  • (x,y,z) -> (u,v)
    Parameters
    [in]selfSurface object
    [in]ptPosition vector [3]
    [out]uParametric coordinate 1
    [out]vParametric coordinate 2

◆ nurbs_surf_grid()

subroutine nurbs_surf_grid ( class(nurbs_surf), intent(inout)  self)
private

Evalute a grid of points evenly spaced in parametric space.

Parameters
[in,out]selfSurface object

◆ nurbs_surf_midpoint()

subroutine, public nurbs_surf_midpoint ( class(nurbs_surf), intent(in), target  self,
real(r8), dimension(3), intent(inout)  pt,
real(r8), dimension(3), intent(in)  pt1,
real(r8), dimension(3), intent(in)  pt2,
real(r8), intent(in)  wt1,
real(r8), intent(in)  wt2,
integer(i4), intent(out)  ierr 
)

Compute the weighted midpoint of a surface edge.

Locates the point on a given CAD surface which minimizes the weighted sum of distances to 2 constraint points.

\[ \sum_i w_i*(r_n - p_i)^2 \]

Parameters
[in]selfSurface object
[in,out]ptSolution point
[in]pt1Constraint point 1
[in]pt2Constraint point 2
[in]wt1Constraint weight 1
[in]wt2Constraint weight 2
[out]ierrError flag

◆ nurbs_surf_unwrap()

subroutine nurbs_surf_unwrap ( class(nurbs_surf), intent(in)  self,
real(r8), intent(inout)  u1,
real(r8), intent(inout)  u2,
real(r8), intent(inout)  v1,
real(r8), intent(inout)  v2 
)
private

Unwrap the periodic coordinates of a NURBS surface to avoid parameter cuts.

  • Example: For a periodic domain of \( [0,2 \pi] (3 \pi/4,0) -> (-\pi/4,0) \)
    Parameters
    [in]selfSurface object
    [in,out]u1Parametric coordinate 1 of first point
    [in,out]u2Parametric coordinate 2 of first point
    [in,out]v1Parametric coordinate 1 of second point
    [in,out]v2Parametric coordinate 2 of second point

◆ nurbs_surf_wrap()

subroutine nurbs_surf_wrap ( class(nurbs_surf), intent(in)  self,
real(r8), intent(inout)  u,
real(r8), intent(inout)  v 
)
private

Wrap the periodic coordinates of a NURBS surface into a single span.

  • Example: For a periodic domain of \( [0,2 \pi] (-\pi/4,0) -> (3 \pi/4,0) \)
    Parameters
    [in]selfSurface object
    [in,out]uParametric coordinate 1
    [in,out]vParametric coordinate 2

Variable Documentation

◆ active_curve

class(nurbs_curve), pointer active_curve => NULL()
private

Active curve for MINPACK fitting.

◆ active_endpts

real(r8), dimension(3,3) active_endpts
private

Active constraint points for MINPACK fitting.

◆ active_pt

real(r8), dimension(3) active_pt
private

Active fit point for MINPACK fitting.

◆ active_surf

class(nurbs_surf), pointer active_surf => NULL()
private

Active surface for MINPACK fitting.

◆ active_wts

real(r8), dimension(3) active_wts
private

Active constraint weights for MINPACK fitting.

◆ nurbs_ngrid

integer(i4), parameter nurbs_ngrid = 20
private

Number of grid points to use for object meshes.

◆ nurbs_singstep

real(r8), parameter nurbs_singstep = .1d0
private

Distance to offset guesses from singular edges.