DEM Code for preprocessing, onprocessing and postprocessing