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
bezier_cad Module Reference

Detailed Description

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

This module supports internal refinement of T3D 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.

Author
Chris Hansen
Date
June 2010

Data Types

type  cad_curve
 CAD curve class. More...
 
interface  cad_dummy_eval
 Map the parametric possition on an entity to physical coordinates. More...
 
interface  cad_dummy_find
 Find the parametric representation of a boundary point in CAD representation. More...
 
type  cad_entity
 CAD entity class. More...
 
type  cad_entity_ptr
 List of CAD entities. More...
 
type  cad_surf
 CAD surface class. More...
 
type  cad_vertex
 CAD vertex class. More...
 

Functions/Subroutines

real(r8) function, public bernstein (x, i, j)
 Evaluates the bernstein polynomial.
 
subroutine cad_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.
 
integer(i4) function, public cad_curve_cast (self, source)
 Cast cad_entity to cad_curve.
 
subroutine cad_curve_eval (self, pt, u, v)
 Map the parametric possition on a curve to physical coordinates.
 
subroutine cad_curve_find (self, pt, u, v)
 Find the parametric representation of a boundary point in CAD representation on a curve.
 
subroutine cad_curve_grid (self)
 Evalute a grid of points evenly spaced in parametric space.
 
subroutine, public cad_curve_midpoint (self, pt, pt1, pt2, wt1, wt2, ierr)
 Compute the weighted midpoint of a curve edge.
 
subroutine cad_curve_reflect (self, copy, tol, k)
 Reflect a curve object across a given plane.
 
subroutine cad_curve_tang (self, tang, u)
 Compute unit tangent vector for a CAD curve at a given location.
 
subroutine cad_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 cad_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.
 
integer(i4) function, public cad_surf_cast (self, source)
 Cast cad_entity to cad_surf.
 
subroutine, public cad_surf_center (self, pt, pt1, pt2, pt3, wt1, wt2, wt3, ierr)
 Compute the weighted center point of a surface triangle.
 
subroutine cad_surf_eval (self, pt, u, v)
 Map the parametric possition on a surface to physical coordinates.
 
subroutine cad_surf_find (self, pt, u, v)
 Find the parametric representation of a boundary point in CAD representation on a surface.
 
subroutine cad_surf_grid (self)
 Evalute a grid of points evenly spaced in parametric space.
 
subroutine, public cad_surf_midpoint (self, pt, pt1, pt2, wt1, wt2, ierr)
 Compute the weighted midpoint of a surface edge.
 
subroutine cad_surf_norm (self, norm, u, v)
 Compute unit normal vector for a CAD surface at a specified position.
 
subroutine cad_surf_reflect (self, copy, tol, k)
 Reflect a surface object across a given plane.
 
subroutine cad_vertex_eval (self, pt, u, v)
 Map parametric possition of a vertex to physical coordinates.
 
subroutine cad_vertex_find (self, pt, u, v)
 Find the parametric representation of a boundary point in CAD representation on a vertex.
 
subroutine cad_vertex_reflect (self, copy, tol, k)
 Reflect a vertex object across a given plane.
 

Variables

class(cad_curve), pointer active_curve => NULL()
 Active curve for MINPACK fitting.
 
real(r8), dimension(3, 3) active_endpts
 Active constraint points for MINPACK fitting.
 
class(cad_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 cad_ngrid = 20
 Number of grid points to use for object meshes.
 

Function/Subroutine Documentation

◆ bernstein()

real(r8) function, public bernstein ( real(r8), intent(in)  x,
integer(i4), intent(in)  i,
integer(i4), intent(in)  j 
)

Evaluates the bernstein polynomial.

f(x) = \( B_{ij}(x) \)

Returns
\( B_{ij}(x) \)
Parameters
[in]xPoint to evaluate
[in]iPolynomial degree
[in]jPolynomial kind

◆ cad_cmid_error()

subroutine cad_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 cad_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

◆ cad_curve_cast()

integer(i4) function, public cad_curve_cast ( class(cad_curve), intent(out), pointer  self,
class(cad_entity), intent(in), target  source 
)

Cast cad_entity to cad_curve.

Returns
Error flag
Parameters
[out]selfObject of desired type, unassociated if cast fails
[in]sourceSource object to cast

◆ cad_curve_eval()

subroutine cad_curve_eval ( class(cad_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 possition 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)

◆ cad_curve_find()

subroutine cad_curve_find ( class(cad_curve), intent(in)  self,
real(r8), dimension(3), intent(in)  pt,
real(r8), intent(out)  u,
real(r8), intent(out)  v 
)
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)

◆ cad_curve_grid()

subroutine cad_curve_grid ( class(cad_curve), intent(inout)  self)
private

Evalute a grid of points evenly spaced in parametric space.

◆ cad_curve_midpoint()

subroutine, public cad_curve_midpoint ( class(cad_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 [3]
[in]pt1Constraint point 1 [3]
[in]pt2Constraint point 2 [3]
[in]wt1Weight for constraint point 1
[in]wt2Weight for constraint point 2
[out]ierrError flag

◆ cad_curve_reflect()

subroutine cad_curve_reflect ( class(cad_curve), intent(in)  self,
class(cad_curve), intent(out)  copy,
real(r8), intent(in)  tol,
integer(i4), intent(in)  k 
)
private

Reflect a curve object across a given plane.

Parameters
[in]selfSource object to copy
[out]copyReflected copy of the source curve
[in]tolMinimum distance from plane
[in]kCoordinate index for the reflection plane

◆ cad_curve_tang()

subroutine cad_curve_tang ( class(cad_curve), intent(in)  self,
real(r8), dimension(3), intent(out)  tang,
real(r8), intent(in)  u 
)
private

Compute unit tangent vector for a CAD curve at a given location.

Parameters
[out]tangCurve tangent unit vector [3]
[in]uParametric coordinate

◆ cad_scenter_error()

subroutine cad_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 cad_surf_center
Parameters
[in]mNumber of spatial dimensions (3)
[in]nNumber of parametric dimensions (2)
[in]uvParametric possition [n]
[out]errError vector between current and desired point [3]
[in,out]iflagUnused flag

◆ cad_smid_error()

subroutine cad_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 cad_surf_midpoint
Parameters
[in]mNumber of spatial dimensions (3)
[in]nNumber of parametric dimensions (2)
[in]uvParametric possition [n]
[out]errError vector between current and desired point [3]
[in,out]iflagUnused flag

◆ cad_surf_cast()

integer(i4) function, public cad_surf_cast ( class(cad_surf), intent(out), pointer  self,
class(cad_entity), intent(in), target  source 
)

Cast cad_entity to cad_surf.

Returns
Error flag
Parameters
[out]selfObject of desired type, unassociated if cast fails
[in]sourceSource object to cast

◆ cad_surf_center()

subroutine, public cad_surf_center ( class(cad_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 [3]
[in]pt1Constraint point 1 [3]
[in]pt2Constraint point 2 [3]
[in]pt3Constraint point 3 [3]
[in]wt1Weight for constraint point 1
[in]wt2Weight for constraint point 2
[in]wt3Weight for constraint point 3
[out]ierrError flag

◆ cad_surf_eval()

subroutine cad_surf_eval ( class(cad_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 possition on a surface to physical coordinates.

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

◆ cad_surf_find()

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

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

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

◆ cad_surf_grid()

subroutine cad_surf_grid ( class(cad_surf), intent(inout)  self)
private

Evalute a grid of points evenly spaced in parametric space.

◆ cad_surf_midpoint()

subroutine, public cad_surf_midpoint ( class(cad_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 [3]
[in]pt1Constraint point 1 [3]
[in]pt2Constraint point 2 [3]
[in]wt1Weight for constraint point 1
[in]wt2Weight for constraint point 2
[out]ierrError flag

◆ cad_surf_norm()

subroutine cad_surf_norm ( class(cad_surf), intent(in)  self,
real(r8), dimension(3), intent(out)  norm,
real(r8), intent(in)  u,
real(r8), intent(in)  v 
)
private

Compute unit normal vector for a CAD surface at a specified position.

Parameters
[out]normSurface normal unit vector [3]
[in]uParametric coordinate 1
[in]vParametric coordinate 2

◆ cad_surf_reflect()

subroutine cad_surf_reflect ( class(cad_surf), intent(in)  self,
class(cad_surf), intent(out)  copy,
real(r8), intent(in)  tol,
integer(i4), intent(in)  k 
)
private

Reflect a surface object across a given plane.

Parameters
[in]selfSource surface to copy
[out]copyReflected copy of the source surface
[in]tolMinimum distance from plane
[in]kCoordinate index for the reflection plane

◆ cad_vertex_eval()

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

Map parametric possition of a vertex to physical coordinates.

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

◆ cad_vertex_find()

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

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

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

◆ cad_vertex_reflect()

subroutine cad_vertex_reflect ( class(cad_vertex), intent(in)  self,
class(cad_vertex), intent(out)  copy,
real(r8), intent(in)  tol,
integer(i4), intent(in)  k 
)
private

Reflect a vertex object across a given plane.

Parameters
[in]selfSource object to copy
[out]copyReflected copy of the source vertex
[in]tolMinimum distance from plane
[in]kCoordinate index for the reflection plane

Variable Documentation

◆ active_curve

class(cad_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_surf

class(cad_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.

◆ cad_ngrid

integer(i4), parameter cad_ngrid = 20

Number of grid points to use for object meshes.