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