Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

gpath.c File Reference

Functions defining the various types of curves used for specifying flow geometry. More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "geom.h"
#include "bezier.h"
#include "gpath.h"

Functions

GPathPolyLinegpath_init (struct GPathPolyLine *plp)
 Initializes data structure members and returns a pointer.
int gpath_add_element (struct GPathPolyLine *plp, int type, int np, struct point_3D p[], int direction)
 Adds a path element to a polyline.
double gpath_element_length (struct GPathElement *pe)
 Length of the GPathElement.
int gpath_write_all_elements_to_file (FILE *fp, struct GPathPolyLine *plp)
 Writes the all of the GPathElements of GPathPolyline to the specified file.
int gpath_write_element_to_file (FILE *fp, struct GPathElement *pe)
 Writes the GPathElement to the specified file.
int gpath_scan_from_string_and_add_element (char str[], struct GPathPolyLine *plp)
 Scans the GPathElement from a supplied string and appends it to the GPathPolyLine.
int gpath_append_polyline (struct GPathPolyLine *plp1, struct GPathPolyLine *plp2, int direction)
 Appends another path polyline to a first polyline.
point_3D * gpath_get_first_point_on_path (struct GPathPolyLine *plp)
 Returns a pointer to the first point on a path.
point_3D * gpath_get_last_point_on_path (struct GPathPolyLine *plp)
 Returns a pointer to the last point on a path.
int gpath_polyline_set_subrange (struct GPathPolyLine *plp, double t0, double t1)
 Set the parameter subrange for subsequent evaluations of position.
int gpath_polyline_eval (struct GPathPolyLine *plp, double t_in_subrange, struct point_3D *loc)
 Evaluate the position on the polyline at given parameter t.
int gpath_polyline_translate (struct GPathPolyLine *plp, double dx, double dy, double dz)
 Translate the polyline position by dx,dy,dz.
int coons_patch (struct GPathPolyLine *c1, struct GPathPolyLine *c2, struct GPathPolyLine *c3, struct GPathPolyLine *c4, double r, double s, struct point_3D *d)
 Compute a location on the Coons patch at parameter position (r,s).
int TFI_3D_no_array (struct GPathPolyLine *c0, struct GPathPolyLine *c1, struct GPathPolyLine *c2, struct GPathPolyLine *c3, struct GPathPolyLine *c4, struct GPathPolyLine *c5, struct GPathPolyLine *c6, struct GPathPolyLine *c7, struct GPathPolyLine *c8, struct GPathPolyLine *c9, struct GPathPolyLine *c10, struct GPathPolyLine *c11, double r, double s, double t, struct point_3D *d)
 Compute a location within the 3D volume at parameter position (r,s,t).
int TFI_3D (struct GPathPolyLine *c[], double r, double s, double t, struct point_3D *d)
 Compute a location within the 3D volume at parameter position (r,s,t).
int line_translate (struct point_3D B[], double dx, double dy, double dz)
 Translate the straight-line position by dx,dy,dz.
int line_eval (struct point_3D B[], double t, struct point_3D *loc)
 Evaluate the straight-line position with parameter t.
double line_length (struct point_3D B[])
 Returns an estimate of the length of a straight line.
int arc_translate (struct point_3D B[], double dx, double dy, double dz)
 Translate the arc position by dx,dy,dz.
int arc_eval_position_and_length (struct point_3D B[], double t, struct point_3D *loc, double *length)
 Evaluate the position on an arc for parameter t and the length of the original arc. (This function does the real work.).
int arc_eval (struct point_3D B[], double t, struct point_3D *loc)
 Evaluate the position on an arc for parameter t.
double arc_length (struct point_3D B[])
 Returns an estimate of the length of an arc.


Detailed Description

Functions defining the various types of curves used for specifying flow geometry.

Author:
PA Jacobs
Version:
1.0 : adapted from bezier.c and extended with straight lines and arcs

Function Documentation

int arc_eval struct point_3D  B[],
double  t,
struct point_3D *  loc
 

Evaluate the position on an arc for parameter t.

Returns 0 if everything was OK, -1 if there was a problem.

The real work is delegated to a helper function because there is so much common code between the arc_length calculation and the position calculation.

Parameters:
B : (pointer to) the array of 3 control points
t : position parameter, 0 <= t <= 1.0
loc : (pointer to) the computed location in 3D

int arc_eval_position_and_length struct point_3D  B[],
double  t,
struct point_3D *  loc,
double *  length
 

Evaluate the position on an arc for parameter t and the length of the original arc. (This function does the real work.).

Returns 0 if everything was OK, -1 if there was a problem.

Parameters:
B : (pointer to) the array of 3 control points
t : position parameter, 0 <= t <= 1.0
loc : (pointer to) the computed location in 3D
length : (pointer to) the computed arc length

double arc_length struct point_3D  B[]  ) 
 

Returns an estimate of the length of an arc.

The real work is delegated.

Parameters:
B : array of 3 control points

int arc_translate struct point_3D  B[],
double  dx,
double  dy,
double  dz
 

Translate the arc position by dx,dy,dz.

Returns 0 if everything was OK, -1 if there was a problem.

Parameters:
B : (pointer to) the array of 3 control points
dx,dy,dz 

int coons_patch struct GPathPolyLine c1,
struct GPathPolyLine c2,
struct GPathPolyLine c3,
struct GPathPolyLine c4,
double  r,
double  s,
struct point_3D *  d
 

Compute a location on the Coons patch at parameter position (r,s).

Returns 0 for a normal return, -1 otherwise.

Parameters:
c1,c2,c3,c4 : pointers to the bounding curves These are normalized GPathPolyLines. c1 and c2 are the South and North boundaries respectively. The parameter 0 <= r <= 1 traverses them West to East. c3 and c4 are the West and East boundaries respectively. Parameter 0 <= s <= 1 traverses them South to North.
r : West to East parameter, 0 <= r <= 1.
s : South to North parameter, 0 <= s <= 1.
d : pointer to the computed location in (x,y,z)-space

int gpath_add_element struct GPathPolyLine plp,
int  type,
int  np,
struct point_3D  p[],
int  direction
 

Adds a path element to a polyline.

Returns the new number of elements on success, -1 otherwise.

Presently, these polylines may consist of disjoint segments. Maybe we should test that the ends of adjacent segments are coincident; maybe we shouldn't.

Parameters:
plp : pointer to the polyline
type : type of element as listed in the gpath.h
np : number of control points in the new element.
p : the array of control points
direction : +1 add in points normal order; -1 add in reverse order

int gpath_append_polyline struct GPathPolyLine plp1,
struct GPathPolyLine plp2,
int  direction
 

Appends another path polyline to a first polyline.

Returns the new number of elements on success, -1 otherwise.

Parameters:
plp1 : first polyline to which the other is appended
plp2 : polyline to append to first (This one remains unchanged.)
direction : =1 appends the plp2 data in forward direction (of plp2) =-1 appends the plp2 in reverse direction (of plp2)

double gpath_element_length struct GPathElement pe  ) 
 

Length of the GPathElement.

Parameters:
pe : pointer to the GPathElement
Returns:
: the length of the element

struct GPathPolyLine* gpath_init struct GPathPolyLine plp  ) 
 

Initializes data structure members and returns a pointer.

Parameters:
plp : pointer to a GPathPolyline structure.
< the path is initially empty

< length should be always current

< default subrange is the whole path

< == 0 indicates that the path is open

int gpath_polyline_eval struct GPathPolyLine plp,
double  t_in_subrange,
struct point_3D *  loc
 

Evaluate the position on the polyline at given parameter t.

Returns 0 if everything was OK, -1 if there was a problem.

Parameters:
bp : (pointer to) the Bezier polyline data
t : position parameter, 0 <= t <= 1.0
loc : (pointer to) the computed location in 3D

int gpath_polyline_set_subrange struct GPathPolyLine plp,
double  t0,
double  t1
 

Set the parameter subrange for subsequent evaluations of position.

Parameters:
plp : pointer to the GPathPolyline structure
t0 : start of subrange
t1 : end of subrange
When a polyline is first created, the subrange defaults to 0.0, 1.0.

int gpath_polyline_translate struct GPathPolyLine plp,
double  dx,
double  dy,
double  dz
 

Translate the polyline position by dx,dy,dz.

Returns 0 if everything was OK, -1 if there was a problem.

Parameters:
plp : (pointer to) the polyline structure
dx,dy,dz 

int gpath_scan_from_string_and_add_element char  str[],
struct GPathPolyLine plp
 

Scans the GPathElement from a supplied string and appends it to the GPathPolyLine.

Returns 0 if successful, -1 otherwise.

int gpath_write_all_elements_to_file FILE *  fp,
struct GPathPolyLine plp
 

Writes the all of the GPathElements of GPathPolyline to the specified file.

Parameters:
fp : pointer to the open file if NULL, stdout will be used. Returns number of characters written if successful, -1 otherwise.

int gpath_write_element_to_file FILE *  fp,
struct GPathElement pe
 

Writes the GPathElement to the specified file.

Returns number of characters written if successful, -1 otherwise.

int line_eval struct point_3D  B[],
double  t,
struct point_3D *  loc
 

Evaluate the straight-line position with parameter t.

Returns 0 if everything was OK, -1 if there was a problem.

Parameters:
B : (pointer to) the array of 2 control points
t : position parameter, 0 <= t <= 1.0
loc : (pointer to) the computed location in 3D

double line_length struct point_3D  B[]  ) 
 

Returns an estimate of the length of a straight line.

Parameters:
B : array of 2 control points

int line_translate struct point_3D  B[],
double  dx,
double  dy,
double  dz
 

Translate the straight-line position by dx,dy,dz.

Returns 0 if everything was OK, -1 if there was a problem.

Parameters:
B : (pointer to) the array of 2 control points
dx,dy,dz 

int TFI_3D struct GPathPolyLine c[],
double  r,
double  s,
double  t,
struct point_3D *  d
 

Compute a location within the 3D volume at parameter position (r,s,t).

Returns 0 for a normal return, -1 otherwise.

Parameters:
c[] : array of pointers to the bounding curves These are normalized GPathPolyLines. See 3D CFD workbook page 27pp 2004.
r : West to East parameter, 0 <= r <= 1.
s : South to North parameter, 0 <= s <= 1.
t : Bottom to Top parameter, 0 <= t <= 1.
d : pointer to the computed location in (x,y,z)-space

int TFI_3D_no_array struct GPathPolyLine c0,
struct GPathPolyLine c1,
struct GPathPolyLine c2,
struct GPathPolyLine c3,
struct GPathPolyLine c4,
struct GPathPolyLine c5,
struct GPathPolyLine c6,
struct GPathPolyLine c7,
struct GPathPolyLine c8,
struct GPathPolyLine c9,
struct GPathPolyLine c10,
struct GPathPolyLine c11,
double  r,
double  s,
double  t,
struct point_3D *  d
 

Compute a location within the 3D volume at parameter position (r,s,t).

This function allows us to specify the edges individually but delegates the actual work to TFI_3D. The point of this function is to allow easy access from Python code.


Generated on Tue Oct 25 10:24:13 2005 for CFCFD by  doxygen 1.4.4