\file moc_unitproc.c * \ingroup imoc * \brief Basic Unit Processes. * * Basic unit processes implemented in C. * Each function computes the data for a new node based on information * from other nodes. * The functions are computationally intensive and access the internals of * the node data structure directly. * Thus, we believe that the implementation is faster and tidier than a pure * Tcl implementation -- at least we hope so.

Most of these functions involve some iteration.
The parameters for convergence check are:

max_iteration = 15

position_tolerance = 1.0e-5

` `

**
int InteriorNode( int node1, int node2, int node4 ) **

Purpose: Calculate an interior point from two initial points.

Input :

node1 : index of initial point along C- characteristic

node2 : index of initial point along C+ characteristic

node4 : index of solution point (may have a value of -1)

If -1 is specified as the index for node4, a new node will be
created for the solution point.

Output :

Returns the index of the solution point or a value of -1
if there has been a failure.

(Available from the Tcl interpreter.)

` `

**
int InsertNode( int node1, int node2, int node4, double alpha ) **

Purpose: Insert a node (node4) in between two initial
nodes (node1 and node2).

If node1 and node2 are adjacent nodes along a characteristic line,
node4 will be connected in between.

Input :

node1 : index of initial point 1

node2 : index of initial point 2

node4 : index of solution point (may have a value of -1)

If -1 is specified as the index for node4, a new node will be
created for the solution point.

alpha : fraction that node4 is like node2;
n4.value = alpha n2.value + (1-alpha) n1.value

Output :

Returns the index of the solution point or a value of -1
if there has been a failure.

(Available from the Tcl interpreter.)

` `

**
int CMinusWallNode( int iw, int node1, int node4 ) **

Purpose: Calculate a wall point from one initial (C-) point.

Input :

iw : Index of selected wall.

node1 : index of initial point along C- characteristic

node4 : index of solution point (may have a value of -1)

If -1 is specified as the index for node4, a new node will be
created for the solution point.

Output :

Returns the index of the solution point or a value of -1
if there has been a failure.

(Available from the Tcl interpreter.)

` `

**
int CPlusWallNode( int iw, int node2, int node4 ) **

Purpose: Calculate a wall point from one upstream (C+) point.

Input :

iw : index of the wall

node2 : index of initial point along C+ characteristic

node4 : index of solution point (may have a value of -1)

If -1 is specified as the index for node4, a new node will be
created for the solution point.

Output :

Returns the index of the solution point or a value of -1
if there has been a failure.

(Available from the Tcl interpreter.)

` `

**
int CPlusFreeBndyNode( int node0, int node2, int node4 ) **

Purpose: Calculate a free-boundary point from one point (node0)
already on the boundary and one point (node2)
on a C+ characteristic.

Input :

node0 : index of initial point along C0 streamline

node2 : index of initial point along C+ characteristic

node4 : index of solution point (may have a value of -1)

If -1 is specified as the index for node4, a new node will be
created for the solution point.

Output :

Returns the index of the solution point or a value of -1
if there has been a failure.

(Available from the Tcl interpreter.)

` `

**
int CMinusFreeBndyNode( int node0, int node1, int node4 ) **

Purpose: Calculate a free-boundary point from one point (node0)
already on the boundary and one point (node1)
on a C- characteristic.

Input :

node0 : index of initial point along C0 streamline

node1 : index of initial point along C- characteristic

node4 : index of solution point (may have a value of -1)

If -1 is specified as the index for node4, a new node will be
created for the solution point.

Output :

Returns the index of the solution point or a value of -1
if there has been a failure.

(Available from the Tcl interpreter.)

` `

**
int AddStreamNode( int node0, int node1, int node2, int node4,
int test_only ) **

Purpose: Calculate a new streamline node, extending the streamline
to the line joining nodeA and nodeB.

Input :

node0 : index of initial point on the streamline

node1 : index of first initial interpolation point

node2 : index of second initial interpolation point

node4 : index of solution point (may have a value of -1)

If -1 is specified as the index for node4, a new node will be
created for the solution point.

test_only : flag to indicate whether we want to test for intersection only
or if we actually want to add the node to the streamline

test_only == 0 : add the node

test_only == 1 : test for intersection only

Output :

if test_only == 0 :
returns the index of the solution point or a value of 0
if there has been a failure.

if test_only == 1 :
returns 1 if intersection occurred between nodes 1 and 2.
A value of 0 indicates that intersection did not occur
between nodes 1 and 2.

(Available from the Tcl interpreter.)

` `

**
int StepStreamNode( int node0, int node4, double dL ) **

Purpose: Calculate a new streamline node, extending the streamline
by length dL

Input :

node0 : index of initial point on the streamline

node4 : index of solution point (may have a value of -1)

dL : step-size along streamline;
A positive value will step downstream while a negative
value will step upstream.

If -1 is specified as the index for node4, a new node will be
created for the solution point.

Output :

Returns the index of the solution point or a value of -1
if there has been a failure. One possible failure is that
there are no nodes close enough to include in the interpolation phase.

(Available from the Tcl interpreter.)

` `

**
int InterpolateNode( double x_point, double y_point, double R, int node4 ) **

Purpose: Locate a new node at coordinates (x,y), interpolating
the node's properties from other near-by nodes.

Input :

x_point,
y_point : coordinates of the new node

R : radius-of-influence for the Shepard interpolation

node4 : index of solution point (may have a value of -1)

If -1 is specified as the index for node4, a new node will be
created for the solution point.

Output :

Returns the index of the solution point or a value of -1
if there has been a failure. One possible failure is that
there are no nodes close enough to include in the interpolation.

(Available from the Tcl interpreter.)

Extracted by