1
/*
2
 *=============================================================================
3
 *  Parser to generate an airfoil profile from DATCOM input cards
4
 *
5
 *  Copyright (C) 2009  Ronald Jensen
6
 *  ron(at)jentronics.com
7
 *  http://www.jentronics.com
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 3 of the License, or
12
 *  (at your option) any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program; if not, write to the Free Software
21
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
 *=============================================================================
23
 */
24
25
#include <stdlib.h>
26
#include "datcom-parser.h"
27
28
29
int DatcomFoil(DATCOM_AIRFOIL *dfoil, struct AIRFOIL *foil)
30
{
31
        int i,j;
32
	size_t npts = 2 * dfoil->NPTS;
33
	foil->DATAX = malloc(npts*sizeof(double));
34
	foil->DATAY = malloc(npts*sizeof(double));
35
        foil->COUNT = npts;
36
        for(i=0, j=foil->COUNT-1;i < dfoil->NPTS;i++, j--)
37
        {
38
                foil->DATAX[i] = dfoil->XCORD[i];
39
                foil->DATAY[i] = dfoil->YUPPER[i];
40
                foil->DATAX[j] = dfoil->XCORD[i];
41
                foil->DATAY[j] = dfoil->YLOWER[i];
42
        }
43
	return(1);
44
}