%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\chapter{C++ Source for Wake-Vortex Program}\label{ch:appendixServer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\section{Sample Server Input File}\label{ch:vortexinp}
\subsection{vortex.inp}
\begin{scriptsize}
\begin{verbatim}
! freestream velocity (m/sec),  B.L. thickness (m)
     -10.0   10.0  0.0                     30.0               
! ground temperature (in Celsius)
      5.0
! nwings   nwakemax (no. of a/c & max no. of segments in tip vortices)
      3        2200
!   Wing center (x,y,z) (m) wingspan (m)   file        area (m^2) weight (kg)
    200.0   44.8  250.0      29.6   "trajectory1.inp"      10.0  100000.0
   -500.0    0.0   50.0      59.6   "trajectory2.inp"      10.0  76000.0
    569.8  -40.0  250.0     139.6   "trajectory3.inp"      10.0  5800.0
\end{verbatim}
\end{scriptsize}

\subsection{trajectory1.inp}
\begin{scriptsize}
\begin{verbatim}
#dt (sec)       u       v       w       (m/s)
1               250     0       0
5               transition
5               50      30      34
4               transition
1               200     10      -5
4               transition
0               190     1       10      # Final velocity (lasts forever)
\end{verbatim}
\end{scriptsize}

\section{Sample Airport Input File}\label{ch:airportinp}
\subsection{San-Francisco Airport (SFO.inp)}
\begin{scriptsize}
\begin{verbatim}
/ SFO.apt
/ The San Francisco International airport
/ Slashes denote comments. The file must be written in blocks of
/ comments, information, comments, information, comments...
/ Blank lines can be inserted anywhere.
/ Each file specifies an airport.
/ There can be only one control tower, but any number of runways or
/ terminals.
/ The positive Y direction is considered North. Positive X is East.
/ Units should be in meters, pounds, and degrees.

/ Airport extents information
/ Format: negative x, negative y, positive x, positive y
-10000
-10000
10000
10000

/ Airport center
/ Format: x, y
0 0

/ Control tower information
/ Format: center x, center y, x radius, y radius, height
0 0
10 10
55

/ Runway information
/ Format: handle, directional type, threshold weight,
/ starting x, starting y, ending x, ending y, width/2,
/ (anchor x, anchor y)
/ anchor x = starting x or ending x
/ anchor y = starting y or ending y
/ The anchor point specifies the start of each runway. This
/ only matters in one-directional runways, so you only need
/ to specify anchor points on one-directional runways.
28L
TWOWAY
710000
-549 915
2250 -701
31

28R
TWOWAY
710000
-726 1200
2409 -610
31

19L
TWOWAY
710000
91 -732
1449 1619
31

19R
TWOWAY
710000
61 -366
1128 1483
31

/ Terminal information
/ Format: center x, center y, x radius, y radius, height, z rotation
244 976
92 122
20
60

/ Water information
/ Format: number of coordinate pairs in the polyline, x coordinate,
/ y coordinate, x coordinate, y coordinate, x coordinate... (a list of
/ coordinates specifying the polyline representing the coast). Polylines
/ must be closed. If there is no coast, you must put a '0' (for 0
/ coordinate pairs). Put the coordinates in counterclockwise order.
26
-1000 50000
-1000 5000
-500 4000
-400 3600
-1050 3250
-1050 2600
-950 2400
-500 2300
0 2400
950 1800
1000 1900
1300 1700
1450 1900
1650 1650
900 450
2700 -600
2400 -900
675 0
200 -800
1900 -1700
2200 -1900
4000 -1900
4100 -2100
50000 -2100
50000 50000
-1000 50000

4
0 -50000
-50000 50000
-50000 -50000
0 -50000
/ End of airport information
\end{verbatim}
\end{scriptsize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

\section{Simulation Code (Server-side)}
\label{ch:vortexServer.cc}
\begin{scriptsize}
\begin{verbatim}
//**************************************************************************
#include <mpi++.h>      // For MPI:: functions
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include "wakevortex.h"
#include "dataservermpi.h"
#include "alloc.h"
#include "main.h"
//**************************************************************************
double ComputeWakeVortexParallel(Vortex *V, int iter);
void ComputeDistanceFromAirport(int i, Vortex *V);
void SendWing(Vortex *V, int wingID, int target);
void RecvWing(Vortex *V, int wingID, int source);
int computeDelay();
void UpdateVortex(Vortex *V);
//**************************************************************************
#define VORTEX_INP_FILE "vortex.inp"
Vortex *vort = NULL;              // For wake-vortex calculations
int delay = 1000; // delay in millisecond
int run_flag = 0;
int time_per_iter = 20;      // in millisecond
double global_dt = 0.0;
int global_nwakemax = 1000;
int numCPUs = 1, myRank = 0;
int exit_flag = 0;
double time_elapsed = 0.0;
double timer_start = 0.0;
int isLagging = 0;
int kn = 5;
int iv_flag = 1;
double max_tracking_distance = 1000.0;
double simtime = 0.0;
int global_iter = 0;
double airport_center[3] = {0.0,0.0,0.0};
//**************************************************************************
void Update_dt(Vortex *V)
      { V->dt = global_dt; }
void Update_kn(Vortex *V)
      { V->kn = kn; }
void Update_ivflag(Vortex *V)
      { V->inducedvelocity_flag = iv_flag; }
void Update_maxdist(Vortex *V)
      { V->max_tracking_distance = max_tracking_distance; }
//**************************************************************************
REGISTER_DATA_BLOCK()      // Register Global Data
{
REGISTER_VARIABLE("run_flag", "rw", run_flag);
REGISTER_VARIABLE("numCPUs", "ro", numCPUs);
REGISTER_VARIABLE("dt", "rw", global_dt);
REGISTER_VARIABLE("iter", "ro", global_iter);
REGISTER_VARIABLE("kneighbors", "rw", kn);
REGISTER_VARIABLE("iv_flag", "rw", iv_flag);
REGISTER_VARIABLE("delay", "rw", delay);
REGISTER_VARIABLE("time_per_iter", "ro", time_per_iter);
REGISTER_VARIABLE("isLagging", "ro", isLagging);
REGISTER_VARIABLE("simtime", "ro", simtime);
REGISTER_VARIABLE("realtime", "ro", time_elapsed);
REGISTER_VARIABLE("exit_flag", "rw", exit_flag);
REGISTER_VARIABLE("maxdist", "rw", max_tracking_distance);
REGISTER_VARIABLE("airportx", "rw", airport_center[0]);
REGISTER_VARIABLE("airporty", "rw", airport_center[1]);
REGISTER_VARIABLE("airportz", "rw", airport_center[2]);
REGISTER_VARIABLE("nwakemax", "rw", global_nwakemax);
REGISTER_STRUCTURE("vortex", "rw", *vort);
}
//**************************************************************************
#define MASTER (myRank == 0)
//**************************************************************************
int main(int argc, char *argv[])
{
MPI::Init(argc, argv);
numCPUs = MPI::COMM_WORLD.Get_size();
myRank = MPI::COMM_WORLD.Get_rank();

if (MASTER)
      {
       cout << "MPI Version with " << numCPUs << " processor(s)." << endl << flush;
      }

char hostname[200];
gethostname(hostname,200);
cout << "This is processor " << myRank+1 << " of " << numCPUs << " [" << 
      hostname << "]" << endl << flush;

DataServerMPI *S = new DataServerMPI;
int port = 4096;

while (S->Start(port) != CSL_SUCCESS) // Start DataServerMPI
      mySleep(1000*1000);      // Sleep for 1 sec

while (!S->Update<int>(&run_flag)) // Main loop for each set of calculations
      {
       if (S->Update<int>(!S->isRunning()))
            break;      // Exit because DataServerMPI is dead!

       while (!S->Update<int>(&run_flag) && !S->Update<int>(&exit_flag))
            mySleep(1000);      // Wait loop (Sleep for 1 ms)

       if (S->Update<int>(&exit_flag))
            break;      // Exit

       vort = new Vortex;
       myprintf("CPU %d: Allocating vortex\n", myRank+1);

       S->RegisterCallback("vortex", (void(*)(void*)) UpdateVortex, vort);
       S->RegisterCallback("dt", (void(*)(void*)) Update_dt, vort);
       S->RegisterCallback("kneighbors", (void(*)(void*)) Update_kn, vort);
       S->RegisterCallback("iv_flag", (void(*)(void*)) Update_ivflag, vort);
       S->RegisterCallback("maxdist", (void(*)(void*)) Update_maxdist, vort);

       S->Wait("vortex");
            if (MASTER)
                  vort->ReadInputFile(VORTEX_INP_FILE, global_nwakemax);
            UpdateVortex(vort);
       S->Post("vortex");


       while (IS_ZERO(S->Update<double>(&global_dt)))
            mySleep(1000);      // Sleep for 1 ms

       if (MASTER)
            myprintf("MPI: Starting iterations:\n");

       time_elapsed = 0.0;
       timer_start = myTimer()/1000.0;
       // Calculation loop
       for (int i = 0; i >= 0 && S->Update<int>(&run_flag); i++)
            {
             int time1 = myTimer();
             simtime = vort->curtime;
             global_iter = vort->iter;
             S->Synchronize();       // Synchronize DataServer data

             S->Wait("vortex");
                  ComputeWakeVortexParallel(vort, i+1);
             S->Post("vortex");

             mySleep(10*1000); // Sleep for DataServer Thread
             time_per_iter = myTimer() - time1;
             delay = computeDelay();
             mySleep(delay*1000); // Sleep to keep RT nature
            }

       // Client has exited
       global_dt = 0.0;
       S->Wait("vortex");
            delete vort;
            vort = NULL;
       S->Post("vortex");
       myprintf("CPU %d: Cleaning vortex\n", myRank+1);
      }

MPI::Finalize();
delete S;      // Clean-up DataServerMPI
}
/****************************************************************************/
double ComputeWakeVortexParallel(Vortex *V, int iter)
{
double time;
int i;
int wingList[100];      // max number of aircrafts per node

// VWING_DELETE or VWING_STOP_TRACKING
int result = 0;
if (MASTER)
      result = V->CheckForOutOfRangeAircraft(airport_center, VWING_STOP_TRACKING);
BroadcastToSlaves(&result);
if (result)
      {
       for (i = 0; i < V->nwings; i++)
            {
             BroadcastToSlaves(&V->wing[i].ToBeDeleted);
             BroadcastToSlaves(&V->wing[i].OutOfRange);
            }
       BroadcastToSlaves(&V->nToBeDeleted);
       BroadcastToSlaves(&V->ntotal);
       if (MASTER)
            myprintf("Aircraft %d goes out of range!\n", result);
      }

static int flag1, flag2;
if (V->iter == 0) flag1 = flag2 = 1;

if (flag1 && V->curtime > 5.0)
      {
       flag1 = 0;
       V->AddRandomWing("trajectory3.inp", 0.0, 0.0, 300.0);
      }
if (flag2 && V->curtime > 10.0)
      {
       flag2 = 0;
       V->AddRandomWing("trajectory2.inp", 100.0, -30.0, 0.0);
      }

int count = 0;
for (i = V->Begin(); i < V->nwings; i = V->NextWing(i))
      {
       if (i%numCPUs == myRank)
            {
             wingList[count] = i;
             ++count;
            }
      }
MPI::COMM_WORLD.Barrier();

++V->iter;

// All the slaves compute the vortex-wake and send the data to the master
for (i = 0; i < count; i++)      // For every a/c assigned to each CPU/node
      {
       int wingID = wingList[i];

       V->ComputeWake(wingID);      // Main Vortex-Wake Computation

       if (!MASTER)      // Slaves send computed data to Master
            {
             SendWing(V, wingID, 0);
            }
      }

if (MASTER)      // Master collects computed data from slaves
for (i = V->Begin(); i < V->nwings; i = V->NextWing(i))
      {
       int source = i%numCPUs;
       if (source != 0)      // If source is not the MASTER
            {
             RecvWing(V, i, source);
            }
      }
MPI::COMM_WORLD.Barrier();

V->curtime += V->dt;

time_elapsed = myTimer()/1000.0-timer_start;
char plusminus = '+';
double dt = V->curtime - time_elapsed;
if (dt < 0.0) plusminus = '-';

if (MASTER)
      myprintf("MPI: Iter = %d, Sim Time = %.2f s, Clock Time = %.2f s "
      "(%c%.2fs)\n", iter, V->curtime, time_elapsed, plusminus, fabs(dt));

if (dt < -vort->dt)
      isLagging = 1;
else
      isLagging = 0;

return (V->iter*V->dt);
}
/****************************************************************************/
// Compute sleep delay required to maintain RT nature 
// if computation is faster than needed
int computeDelay()      // in ms
{
double realtime = myTimer()/1000.0-timer_start;
double extra_dt_required = (realtime - vort->curtime)/vort->dt;
int temp = (int) (1000*vort->dt - (1.3+extra_dt_required)*time_per_iter);
int sleepdelay = temp > 0 ? temp : 0;

return sleepdelay;
}
/****************************************************************************/
// Update Vortex structure among all procs if modified by client
void UpdateVortex(Vortex *V)
{
unsigned char *data;
int size;

if (MASTER)
      {
       cout << "Updating Vortex Structure!" << endl << flush;
       packStruct(V, &data, &size);
      }
BroadcastToSlaves(&size);

if (!MASTER)
      ALLOC1D(&data, size); 

BroadcastToSlaves(data, size);

if (!MASTER)
      unpackStruct(V, data, size);

FREE1D(&data, size);
}
//***************************************************************************
// Pack and send specified wing data from master proc to the specified proc
void SendWing(Vortex *V, int wingID, int target)
{
unsigned char *data;
int totsize;

V->wing[wingID].packWing(&data, &totsize);
int tag = wingID*10;
MPI::COMM_WORLD.Send(&wingID, 1, MPI::INTEGER, target, tag);
++tag;
MPI::COMM_WORLD.Send(&totsize, 1, MPI::INTEGER, target, tag);
++tag;
MPI::COMM_WORLD.Send(data, totsize, MPI::BYTE, target, tag);
delete data;
}
//***************************************************************************
// Master proc receives and unpacks specified wing data from specified proc
void RecvWing(Vortex *V, int wingID, int source)
{
int tag = wingID*10;
int totsize;
int dupwingID = wingID;

MPI::COMM_WORLD.Recv(&dupwingID, 1, MPI::INTEGER, source, tag);
assert(wingID == dupwingID);
++tag;
MPI::COMM_WORLD.Recv(&totsize, 1, MPI::INTEGER, source, tag);
++tag;
unsigned char *data = new unsigned char[totsize];
MPI::COMM_WORLD.Recv(data, totsize, MPI::BYTE, source, tag);
V->wing[wingID].unpackWing(data, totsize);
delete data;
}
//***************************************************************************
\end{verbatim}
\end{scriptsize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\section{Header file for wake-vortex library (vortex.h)}
\label{ch:vortex.h}
\begin{scriptsize}
\begin{verbatim}
//***************************************************************************
#ifndef WAKEVORTEX_H
#define WAKEVORTEX_H
//***************************************************************************
#include <vector>
#include <iostream>
#include "alloc.h"
#include "wing.h"
#include "airplane.h"
#include "packvortex.h"
using namespace std;
//***************************************************************************
enum { VWING_STOP_TRACKING = 0, VWING_DELETE };
//***************************************************************************
class Vortex
{
private:
 friend ostream &operator << (ostream &Out, Vortex &V);
 void movewings(int wingID);
 void shiftwake(int wingID);
 void movewakes(int wingID);
 void wakevel(int wingID);
 void agewake(int wingID);
 void findUVW(double u0, double v0, double w0, double delta, 
   double upmag, double x, double y, double z, double *uu, 
   double *vv, double *ww);
 inline void inducedvel(Wing *wing, int i, int j, double *vx, 
      double *vy, double *vz, int sign);
 inline void inducedvel(Wing *wing, int i1, int j1, int i2, 
      int j2, double *vx, double *vy, double *vz, int sign, int sign2);
 void inducedvel(double x1, double y1, double z1, double x2, 
      double y2, double z2, double x, double y, double z, 
      double *velx, double *vely, double *velz, double gamma, 
      double eps);
 void Initialize();

public:
 //! Total number of aircraft (wings) in the structure
 int nwings;
 //! Total number of aircraft (wings) in the structure 
 //! including wings that are not being tracked
 int ntotal;
 //! Number of aircraft marked for deletion
 int nToBeDeleted;
 //! Number of aircraft that contain useful vortex data
 //! but are not actively being tracked
 int nOutOfRange;
 //! Maximum number of vortex-elements to be tracked per aircraft
 int nwakemax;
 //! Current atmospheric temperature (in Celsius)
 double temperature;
 //! Current time-step for simulation (in seconds)
 double dt;
 //! Current atmospheric wind velocity in x-direction (in m/s)
 double u0;
 //! Current atmospheric wind velocity in y-direction (in m/s)
 double v0;
 //! Current atmospheric wind velocity in z-direction (in m/s)
 double w0;
 //! Height of atmospheric boundary layer above the ground (in meters)
 double delta;
 //! Atmospheric fluctuation levels (%)
 double upmag;
 //! Time required for vortex-strength gamma to decay by 50% (in seconds)
 double gtime;
 //! Vortex strength threshold below which it is considered harmless
 double glimit;
 //! Maximum tracking distance for aircraft from the 
 //! center of the airport (in Kilometers)
 double max_tracking_distance;
 //! Flag specifying where induced velocity calculation is to be performed
 int inducedvelocity_flag;
 //! Current number of iterations since the simulation started
 int iter;
 //! Number of neighboring vortex elements to be used for induced
 //! velocity calculation over every vortex element
 int kn;
 //! Current number of vortex elements being tracked (<= nwakemax)
 int nvort;
 //! Current time of the simulation since the start (in seconds)
 double curtime;
 //! Vector containing data for individual aircraft (wing)
 vector<Wing> wing;

 //! Constructor (with space for n aircraft being allocated)
 Vortex(int n = 0);
 //! Destructor
 ~Vortex();
 //! Mark all aircraft in the vector for deletion
 void MarkAllDeleted();
 //! Free all memory (called by destructor)
 void CleanUp();

 //! Index of the next aircraft in the vector which is i
 //! not marked for deletion (but may be out-of-range)
 inline int NextWing(int i);
 //! Index of the next aircraft in the vector within airport-range 
 //! which is not marked for deletion
 inline int NextInRange(int i);
 //! Index of the first active aircraft in the vector
 inline int Begin(void);
 //! Index of the next aircraft in the vector which is marked for deletion
 inline int NextToBeDeleted();
 //! Assignment overloading to copy a vortex structure
 Vortex &operator= (const Vortex &);
 //! Add new aircraft to the vector and
 //! allocate memory for it only if "allocate_flag" is true
 int AddWing(bool allocate_flag = true);
 //! Add new aircraft to the vector without allocating memory
 int AddWingWithoutAllocation();
 //! Allocate memory for "n" aircraft from the current number of aircraft
 void ReAlloc(int n);
 //! Allocate memory for the "i"th aircraft in the vector
 void Allocate(int i);
 //! Compress vector by removing all aircraft that are marked deleted
 void Compress();
 //! Free memory for "i"th aircraft in the vector and mark it for deletion
 void deleteWing(int i);
 //! Undo the effect of the "deleteWing(i)"
 void undeleteWing(int i);
 //! Stop tracking aircraft "i" (mark it out-of-range)
 void stopTrackingWing(int i);
 //! Check for out-of-range aircraft
 int CheckForOutOfRangeAircraft(double airport_center[3], int option);
 //! Read intial inputs for the simulation from "inpfile"
 void ReadInputFile(char *inpfile, int nwake_max);
 //! Read intial inputs for the simulation from "inpfile"
 //! Compute the wake-vortex for all aircraft for the next iteration
 double ComputeWake();
 //! Compute the wake-vortex for the specified aircraft for the 
 //! next iteration
 int ComputeWake(int wingID);
 //! Write TECPLOT output for the specified iteration
 void WriteTecplotFile(int iter);
 //! Add a new aircraft at location (x0,y0,z0) with trajectory information
 //! from file "trajfile" and specified wing-span, area and weight
 int AddNewWing(char *trajfile, char *name, char *type, 
      double x0, double y0, double z0, double span, 
      double area, double weight);
 //! Add a randomly selection aircraft from database at location (x0,y0,z0)
 int AddRandomWing(char *trajfile, double x0, double y0, double z0);
 //! Copy data from the current vortex structure to "dest"
 int Copy(Vortex *dest);
};
//***************************************************************************
#endif // WAKEVORTEX_H
/***************************************************************************/
\end{verbatim}
\end{scriptsize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\section{Header file for wake-vortex library (wing.h)}
\label{ch:wing.h}
\begin{scriptsize}
\begin{verbatim}
//***************************************************************************
#ifndef _WING_H
#define _WING_H
//***************************************************************************
#include <vector>
#include <iostream>
#include "alloc.h"
using namespace std;
//***************************************************************************
typedef struct
{
 //! Maximum time specified in trajectory file
 double time_max;
 //! Local tracking element
 int firsttime;
 //! Is the aircraft trajectory in transition from one velocity to
 //! another?
 int isTransition;
 //! Elapsed time since the trajectory has been executed
 double t1;
 //! Time period for specified velocity (uu2, vv2, ww2)
 double dt1;
 //! Initial trajectory velocity (uu1, vv1, ww1)
 double uu1;
 double vv1;
 double ww1;
 double uu2;
 double vv2;
 double ww2;
} Trajectory;

class Wing
{
private:
 friend ostream &operator << (ostream &Out, Wing &V);
 void getWingTrajectoryUVW(double t, double *u, double *v, double *w);
 void GetWingCoordinates(double u, double v, double w,
        double x_mid, double y_mid, double z_mid, double span,
        double *x1, double *y1, double *z1,
        double *x2, double *y2, double *z2);
 double getDensity(double temperature);

public:
 //! vortex-strength (gamma) at wing-tip
 double gwing;
 //! size of vortex core (meters)
 double ewing;
 //! Initial location of wing-tips (meters)
 double xwing_i[2][3];
 //! Initial velocity of wing-tips (i.e., aircraft) (m/s)
 double vwing_i[2][3];
 //! Identification label for aircraft
 char   Name[30];
 //! Type of aircraft (e.g., Boeing 777, Airbus 320, etc.)
 char   AircraftType[30];
 //! Name of file containing trajectory information
 char   trajectoryname[100];
 //! core size (meters) of array of tip vortices
 double *ewake;
 //! File-pointer for trajector file "trajectoryname"
 FILE   *trajectory;

 // Out
 //! Current location of wing-tips (meters)
 double xwing[2][3];
 //! Current velocity of wing-tips (i.e., aircraft) (m/s)
 double vwing[2][3];
 //! Vortex strength (gamma) of each segment of tip vortices
 double *gwake;
 //! Age of each segment of tip vortices (seconds)
 double *twake;
 //! Coordinates of points along tip vortices (meters)
 double (*xwake)[2][3];
 //! Velocity of points along tip vortices (m/s)
 double (*vwake)[2][3];

 //! Time elapsed since vortex-elements for aircraft being tracked (sec)
 double timeElapsed;
 //! Number of iterations
 int iter;
 //! Wing-span (meters)
 double span;
 //! Weight of aircraft (kg)
 double weight;
 //! Area of wing (meters^2)
 double area;
 //! Out-of-range flag
 int OutOfRange;
 //! Deletion flag
 int ToBeDeleted;
 //! Current number of vortex elements being tracked (<= nwakemax)
 int nvort;
 //! ID for the aircraft
 int ID;
 //! Distance from the center of the airport (Kilometers)
 double DistFromAirport;

 //! Trajectory associated with the aircraft
 Trajectory traj;

 //! Constructor
 Wing();
 //! Destructor
 ~Wing();
 //! Initialization routine (resets variables)
 void Initialize();
 //! Assignment operator overloading for copying 
 Wing &operator= (const Wing &);
 //! Read trajectory info for time "t" and return velocity (u,v,w)
 void readTrajectory(double t, double *u, double *v, double *w);
 //! Setup the aircraft at location (x0,y0,z0) with supplied parameters
 void Setup(char *inpfile, char *name, char *type, double x0, 
      double y0, double z0, double wingspan, double wingarea, 
      double wingweight, double temperature, int nwakemax);
 //! Allocate space for vortex-elements (max elements: nwakemax)
 void Allocate(int nwakemax);
 //! Free space allocated for vortex-elements
 void DeAllocate(int nwakemax);
 //! Pack wing for efficient communication from one processor to another
 int packWing(unsigned char **dataptr, int *totsize);
 //! Unpack pack after communication completed
 int unpackWing(unsigned char *data, int totsize);
 //! Vortex strength (gamma) for current element at wing-tip
 double getGwing(double temperature);
 //! Current speed of the aircraft
 inline double Speed();
 //! Current height of the aircraft above the ground
 inline double Height();
};
//***************************************************************************
#endif // _WING_H
/***************************************************************************/
\end{verbatim}
\end{scriptsize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
