!*************************************************************
!***Clear Analysis Results if Model Options or Data Changed***
!*************************************************************
	SUBROUTINE CLEARANALYSIS()
	USE WINTERACTER
	USE RESOURCE
	USE IONTOXMODEL_INTERFACEVARS
!***
!***Intent is for program analysis results to always reflect model option and data, 
!***so if this changes clear parameter grid and graph:
!*** 
	CALL WDialogClearField(IDF_MAIN_PARAMETERS_GRID)
	CALL WDialogClearField(IDF_MAIN_PREDLINE_GRID)
	CALL WDialogClearField(IDF_MAIN_OPTIMIZATION_GRID)
	CALL WDialogSelect(IDD_MAIN)
	ANALYSISDONE=.FALSE.
	CALL IGrSelect(3,IDF_MAIN_GRAPH_FRAME)
	CALL IGrAreaClear()
	RETURN
	END SUBROUTINE CLEARANALYSIS


!*****************************************************
!***Extract Data Set from Main Dialog Data Set Grid***
!*****************************************************
	SUBROUTINE GETDATA()
	USE WINTERACTER
	USE IONTOXMODEL_INTERFACEVARS
	USE IONTOXMODEL_MODELVARS
	USE RESOURCE
	REAL XGRID,YGRID
	INTEGER IROW,RESETERROR
	NDAT=0
	DO IROW=1,200  
		RESETERROR=InfoError(1)
		CALL WGridGetCellReal(IDF_MAIN_DATASET_GRID,1,IROW,XGRID)
		IF(InfoError(1).EQ.1010) CYCLE
		CALL WGridGetCellReal(IDF_MAIN_DATASET_GRID,2,IROW,YGRID)
		IF(InfoError(1).EQ.1010) CYCLE
		NDAT=NDAT+1
		XDAT(NDAT)=XGRID
		YDAT(NDAT)=YGRID
		TYPE "(I3,2F10.5,I3)",NDAT,XDAT(NDAT),YDAT(NDAT)
	END DO
	RETURN
	END
