! TITLE: min_e_dim_array.mac (MANAGEMENT) ! ! ! ! This sub-macro is used to retrieve the minimum value, within a selected ! set, of the dimension of a specified entity: ! ! ENTITY DIMENSION ! -------- ----------- ! ! line length ! area area ! volume volume ! ! These entity numbers and their dimension (characteristic) are stored in ! arrays of the user specified names, 'anam' and 'anam'c (c is for character- ! istic), respectively. (e.g., if anam='lnset', then the arrays created are ! 'lnset' and 'lnsetc') ! ! Input data necessary to run this macro: ! ! A selected set of specified entities ! ! entity = 'l' for line entities ! 'a' for area entities ! 'v' for volume entities ! ! anam = character name for array (must be 7 characters or less) ! ! typ = array type ! ! 'array' = normal (default) array ! 'table' = table array ! ! The output of this macro are: ! ! 1.) ecount = the number of entities in the array ! ! 2.) min_leng ! min_area ! min_vol = the minimum value of the specified ! entity characteristic (i.e., length, ! area or volume, respectively) ! ! 3.) min_lnum ! min_anum ! min_vnum = the entity number that has the minimum ! dimension ! ! 4.) min_indx = the index in the array of the minimum ! dimension ! ! 5.) The 2 arrays with the name as specified in 'anam' ! ! ! ! MIN_E_DIM_ARRAY, entity, anam, typ ! ! *get,prkey_,active,0,prkey /nopr entity=arg1 anam=arg2 typ=arg3 ! *if,entity,eq,'l',then ! assignment of entity variable, 'ev' ev='line' *elseif,entity,eq,'a',then ev='area' asum *elseif,entity,eq,'v',then ev='volu' vsum *else ev='z' ! If entity is not an 'l','a' or 'v', *endif ! then assign ev to a dummy variable 'z'. ! *if,ev,ne,'z',then ! If ev is assigned 'z', then abort ! *get,emax,ev,,num,max ! retrieve MIN and MAX entity numbers *get,emin,ev,,num,min ! *get,ecount,ev,,count ! number of specified entities in the ! ! selected entity set ! *dim,%anam%,typ,ecount ! Initialize entity array ! ! *do,ii,1,ecount,1 *if,ii,eq,1,then %anam%(ii,1)=emin *else jj=ii-1 *get,xx,ev,%anam%(jj,1),nxth %anam%(ii,1)=xx *endif *enddo ! ! ! *dim,%anam%c,typ,ecount ! Initialize entity characteristic array ! ! ! *do,ii,1,ecount,1 ! *if,entity,eq,'l',then *get,%anam%c(ii,1),line,%anam%(ii,1),leng *elseif,entity,eq,'a',then *get,%anam%c(ii,1),area,%anam%(ii,1),area *elseif,entity,eq,'v',then *get,%anam%c(ii,1),volu,%anam%(ii,1),volu *endif *enddo ! ! ! ! ! *do,ii,1,ecount,1 ! *if,ii,eq,1,then xx=%anam%c(ii,1) yy=%anam%(ii,1) *else *if,xx,lt,%anam%c(ii,1),then xx=xx yy=yy *else xx=%anam%c(ii,1) yy=%anam%(ii,1) *endif *endif *enddo ! ! ! ! ! *do,ii,1,ecount,1 *if,%anam%c(ii,1),eq,xx,then min_indx=ii *endif *enddo ! ! *if,entity,eq,'l',then min_leng=xx min_lnum=yy *elseif,entity,eq,'a',then min_area=xx min_anum=yy *elseif,entity,eq,'v',then min_vol=xx min_vnum=yy *endif *endif ! *set,xx, *set,yy, *set,ev, *set,entity, *set,emax, *set,emin, *set,anam, *set,typ, *if,prkey_,eq,1,then /go *endif