//==== Read Fuse Cross Section File ====// void FuselageXSec::read_parms(xmlNodePtr node) { int i; xstype = xmlFindInt( node, "Type", xstype ); height = xmlFindDouble( node, "Height", height() ); width = xmlFindDouble( node, "Width", width() ); max_width_loc = xmlFindDouble( node, "Max_Width_Location", max_width_loc() ); corner_rad = xmlFindDouble( node, "Corner_Radius", corner_rad() ); top_tan_angle = xmlFindDouble( node, "Top_Tan_Angle", top_tan_angle()); bot_tan_angle = xmlFindDouble( node, "Bot_Tan_Angle", bot_tan_angle()); top_str = xmlFindDouble( node, "Top_Tan_Strength", top_str() ); upp_str = xmlFindDouble( node, "Upper_Tan_Strength", upp_str() ); low_str = xmlFindDouble( node, "Lower_Tan_Strength", low_str() ); bot_str = xmlFindDouble( node, "Bottom_Tan_Strength", bot_str() ); if ( xstype == FXS_FROM_FILE ) { xstype = FXS_GENERAL; // If this fails fall back on something... fileName = Stringc( xmlFindString( node, "File_Name", "File_Xsec" ) ); // fileName is a Stringc xmlNodePtr yn = xmlGetNode( node, "File_Y_Pnts", 0 ); xmlNodePtr zn = xmlGetNode( node, "File_Z_Pnts", 0 ); if ( yn && zn ) { int numy = xmlGetNumArray( yn, ',' ); int numz = xmlGetNumArray( zn, ',' ); if ( numy == numz ) { int num_pnts = numy; double* arry = (double*)malloc( num_pnts*sizeof(double) ); double* arrz = (double*)malloc( num_pnts*sizeof(double) ); xmlExtractDoubleArray( yn, ',', arry, num_pnts ); xmlExtractDoubleArray( zn, ',', arrz, num_pnts ); xstype = FXS_FROM_FILE; file_crv.init( num_pnts ); for ( i = 0 ; i < num_pnts ; i++ ) { file_crv.load_pnt( i, vec3d( 0.0, arry[i], arrz[i] )); } free( arry ); free( arrz ); file_crv.comp_tans(); vec3d top_tan = vec3d( 0.0, 1.0, 0.0 ); double tan_mag = file_crv.get_tan(0).mag(); file_crv.load_tan( 0, top_tan*tan_mag ); int last_id = file_crv.get_num_pnts() - 1; vec3d bot_tan = vec3d( 0.0, -1.0, 0.0 ); tan_mag = file_crv.get_tan( last_id ).mag(); file_crv.load_tan( last_id, bot_tan*tan_mag ); } } } else if ( xstype == FXS_EDIT_CRV ) { edit_crv.read( node ); } set_type(xstype); }
void Af::read(xmlNodePtr node) { int i; int temp_type = xmlFindInt( node, "Type", 0 ); inverted_flag = xmlFindInt( node, "Inverted_Flag", inverted_flag ); camber = xmlFindDouble( node, "Camber", camber() ); camber_loc = xmlFindDouble( node, "Camber_Loc", camber_loc() ); thickness = xmlFindDouble( node, "Thickness", thickness() ); thickness_loc = xmlFindDouble( node, "Thickness_Loc", thickness_loc() ); radius_le = xmlFindDouble( node, "Radius_Le", radius_le() ); radius_te = xmlFindDouble( node, "Radius_Te", radius_te() ); sixser = xmlFindInt( node, "Six_Series", sixser ); ideal_cl = xmlFindDouble( node, "Ideal_Cl", ideal_cl() ); a = xmlFindDouble( node, "A", a() ); slat_flag = xmlFindInt( node, "Slat_Flag", slat_flag ); slat_shear_flag = xmlFindInt( node, "Slat_Shear_Flag", slat_shear_flag ); slat_chord = xmlFindDouble( node, "Slat_Chord", slat_chord() ); slat_angle = xmlFindDouble( node, "Slat_Angle", slat_angle() ); flap_flag = xmlFindInt( node, "Flap_Flag", flap_flag ); flap_shear_flag = xmlFindInt( node, "Flap_Shear_Flag", flap_shear_flag ); flap_chord = xmlFindDouble( node, "Flap_Chord", flap_chord() ); flap_angle = xmlFindDouble( node, "Flap_Angle", flap_angle() ); if ( temp_type == AIRFOIL_FILE ) { vec3d pnt; name = xmlFindString( node, "Name", name ); orig_af_thickness = (float)xmlFindDouble( node, "Original_AF_Thickness", orig_af_thickness ); radius_le_correction_factor = (float)xmlFindDouble( node, "Radius_LE_Correction_Factor", radius_le_correction_factor ); radius_te_correction_factor = (float)xmlFindDouble( node, "Radius_TE_Correction_Factor", radius_te_correction_factor ); xmlNodePtr upp_node = xmlGetNode( node, "Upper_Pnts", 0 ); if ( upp_node ) { int num_arr = xmlGetNumArray( upp_node, ',' ); double* arr = (double*)malloc( num_arr*sizeof(double) ); xmlExtractDoubleArray( upp_node, ',', arr, num_arr ); int num_upper = num_arr/2; upper_curve.init(num_upper); for ( i = 0 ; i < num_arr ; i+=2) { pnt = vec3d(arr[i], 0.0, arr[i+1]); upper_curve.load_pnt( i/2, pnt ); } free(arr); } xmlNodePtr low_node = xmlGetNode( node, "Lower_Pnts", 0 ); if ( low_node ) { int num_arr = xmlGetNumArray( low_node, ',' ); double* arr = (double*)malloc( num_arr*sizeof(double) ); xmlExtractDoubleArray( low_node, ',', arr, num_arr ); int num_lower = num_arr/2; lower_curve.init(num_lower); for ( i = 0 ; i < num_arr ; i+=2) { pnt = vec3d(arr[i], 0.0, arr[i+1]); lower_curve.load_pnt( i/2, pnt ); } free(arr); } } set_type(temp_type); }