! TITLE: a_cg.mac (CALCULATION) ! ! ! OBJECTIVE: ! ! This macro records the area numbers, area, volume numbers attached, volume ! of attached volumes and centroidal coordinates of each area in a selected ! set of areas. ! ! ! COMMAND SYNTAX: ! ! (1) ! A_CG, area_# ! ! ! ARGUMENTS: ! ! (1) area_# = area number ! ! a.) 0 (or blank) = the current selected set of areas. ! ! b.) N (where N > 0) = the area number N. ! ! c.) 'comp_name' = component group character name containing ! the areas. [ MUST BE IN SINGLE QUOTES ] ! ! ! DESCRIPTION: ! ! The selected/specified area(s) are stored in an array named: ACG_DATA. ! The array contains 9 pieces of data for each area: ! ! 1.) area number ! 2.) area ! 3.) 1st volume # the area is attached to (if applicable) ! 4.) volume of 1st volume # (if applicable) ! 5.) 2nd volume # the area is attached to (if applicable) ! 6.) volume of 2nd volume # (if applicable) ! 7.) X-coordinate of area centroid (relative to csys = 0) ! 8.) Y-coordinate of area centroid (relative to csys = 0) ! 9.) Z-coordinate of area centroid (relative to csys = 0) ! ! Each piece of data is stored in each column, with each row an area. The ! array, ACG_DATA, has the following format: ! ! COLUMNS ! ROW | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ! ------------------------------------------------------------------------------- ! 1 | A_#1 | A1 | V11 | Vol11 | V12 | Vol12 | Xc1 | Yc1 | Zc1 | ! 2 | A_#2 | A2 | V21 | Vol21 | V22 | Vol22 | Xc2 | Yc2 | Zc2 | ! 3 | A_#3 | A3 | V31 | Vol31 | V32 | Vol32 | Xc3 | Yc3 | Xc3 | ! . | . | . | . | . | . | . | . | . | . | ! . | . | . | . | . | . | . | . | . | . | ! N | A_#N | AN | VN1 | VolN1 | VN2 | VolN2 | XcN | YcN | ZcN | ! ! The number of areas (and therefore the number of rows in ACG_DATA) are ! output in the parameter: ! NUM_AS ! ! Each succesive run of this macro erases the array data from the previous ! run. If the data is to be retained from any run, the use of ARRY_TRANSFER ! may be used to replicate the data into a new array of a different name. ! ! ! *get,prkey_,active,0,prkey /nopr ! arnum__=arg1 ! configuration,0 ! *set,acg_data(1), ! ! Parameter type: 0=scalar, 1=array, 2=table, 3=character scalar, ! 4=character array, -1=undefined ! *get,argtyp_,parm,arnum__,type ! *if,argtyp_,eq,0,then *if,arnum__,eq,0,then arnum__='cmpaset_' cm,%arnum__%,area *elseif,arnum__,gt,0,then asel,s,area,,arnum__ arnum__='cmpaset_' cm,%arnum__%,area *endif *elseif,argtyp_,eq,3,then cmsel,s,%arnum__% *endif ! cmsel,s,%arnum__% ! entity_array,'a','acg_data','array',,,9 num_as=ecount ! csys,0 ! *do,xyzz_,1,num_as,1 asel,s,area,,acg_data(xyzz_,1) asum vsla,s,0 vsum *get,nvols__,volu,0,count ! *get,acg_data(xyzz_,2),area,acg_data(xyzz_,1),area ! *if,nvols__,eq,0,then acg_data(xyzz_,3)=0 acg_data(xyzz_,4)=0 acg_data(xyzz_,5)=0 acg_data(xyzz_,6)=0 *elseif,nvols__,eq,1,then get_max_entity acg_data(xyzz_,3)=vm *get,acg_data(xyzz_,4),volu,vm,volu acg_data(xyzz_,5)=0 acg_data(xyzz_,6)=0 *elseif,nvols__,eq,2,then get_max_entity get_min_entity acg_data(xyzz_,3)=v_min *get,acg_data(xyzz_,4),volu,v_min,volu acg_data(xyzz_,5)=vm *get,acg_data(xyzz_,6),volu,vm,volu *endif ! *get,acg_data(xyzz_,7),area,,cent,x *get,acg_data(xyzz_,8),area,,cent,y *get,acg_data(xyzz_,9),area,,cent,z *enddo ! configuration,1 ! cmdele,%arnum__% *set,arnum__, *set,ecount, *set,argtyp_, *set,parmtyp_, *set,xyzz_, *set,nvols__, ! *if,prkey_,eq,1,then /go *endif