;$Id: SDvision.pro, v 0.4.7.dev 2008/04/22 11:00:00 D.Pomarède, Y.Fidaali, R.Teyssier, F.Masset, E.Audit, A.S. Brun ; ; Copyright (c) 2005-2006-2007-2008, CEA/DSM/IRFU/SEDI/LILAS All rights reserved. ; Unauthorized reproduction prohibited. ; ;+ ; FILE: ; SDvision_XXX.pro ; ; CALLING SEQUENCE: ; SDvision_XXX ; ; PURPOSE: ; Visualization of astrophysical plasma simulations using IDL Objects Graphics ; ; MAJOR TOPICS: ; Visualization, Widgets, Objects Graphics, Volume rendering, Isosurfaces ; 2D, 3D, Scalar, Vector, Particles, Cartesian grids, AMR Data ; ; CATEGORY: ; Scientific Visualization ; ; REFERENCES: ; 1) http://irfu.cea.fr/Projets/COAST/visu.htm ; 2) "Interactive visualization of astrophysical plasma simulations with SDvision", D. Pomarède, Y. Fidaali, ; E. Audit, A.S. Brun, F. Masset, R. Teyssier, Proceedings of the IGPP/DAPNIA International Conference on ; Numerical Modeling of Space Plasma Flows, ASTRONUM2007, Paris, France, June 11-15, 2007, ed. N.V. Pogorelov, ; E. Audit, G.P. Zank, Astronomical Society of the Pacific Conference Series, ; vol. 386 (2008) 327, ISBN: 978-1-58381-333-1 ; 3) "Visualization of astrophysical simulations using IDL Object Graphics", D. Pomarède, et al., ; Proceedings of the Computer Graphics, Imaging and Visualization Conference, CGIV07, Bangkok, Thailand, August 13-16, 2007, ; p. 471, IEEE Computer Society, ISBN 0-7695-2928-3 ; 4) "Visualization of large astrophysical simulations datasets", D. Pomarède, E. Audit, R. Teyssier, B. Thooris, ; Proceedings of the Conference on Computational Physics 2006, CCP2006, Gyeongju, Republic of Korea, ; aug.29-sept.1 2006, Computer Physics Communications, 177 (2007) 263, doi:10.1016/j.cpc.2007.02.065 ; ; INTERNAL FUNCTIONS and PROCEDURES: ; pro SDvision - Main procedure ; pro SDvis_Event - Event handler ; pro SDvis_Cleanup - Cleanup ; pro ObjectControlEvent - Data Object Control event handler ; pro ObjectControlWidget - Data Object Control widget builder ; pro LaunchObjectControlWidget - Launch and update of Data Object Control Widget ; pro GeometryObjectControlEvent - Geometry Object Control event handler ; pro SceneObjectControlEvent - Scene Object Control event handler ; pro SceneObjectControlWidget - Scene Object Control widget builder ; pro DefineVueWidget - View Properties widget builder ; fun calculScaleValue - Scale function ; fun calculScaleValueInverse - Scale function ; pro DefineBoundariesWidget - Boundaries widget builder ; pro DefineAmrConfigurationWidget - AMR widget builder ; pro DefineMpegWidget - MPEG widget builder ; pro DefineMovieWidget - Time sequence widget builder ; pro DefineImageSequenceWidget - Image sequence widget builder ; pro CreateSaveViewWidget - save jpeg/gif/eps widget builder ; pro PropertyEvent - Object property sheet event handler ; pro CleanupEvent - Handler for property sheet widget cleaner ; pro ExSinglePropSheet - property sheet widget builder ; pro ProbeObject - Object probe and property sheet launcher ; pro UpgradeQuality - Dynamic upgrade of rendering quality ; pro DegradeQuality - Dynamic downgrade of rendering quality ; pro DefineAshScalarEvent - Ash Scalar Field Widget event handler ; pro DefineAshVectorEvent - Ash Vector Field Widget event handler ; pro DefineAshScalarWidget - Ash Scalar Field Widget builder ; pro DefineAshVectorWidget - Ash Vector Field Widget builder ; pro TaskFarmingControlEvent - Task Farming Widget Event handler ; pro TaskFarmingControlWidget - Task Farming Widget builder ; pro TaskDLInit - Task Farming Initialization ; pro TaskDLFarming - Task Farming dispatch ; pro TaskDLGather - Task Farming results gathering ; pro TaskDLMonitor - Task Farming results monitoring ; pro MemoryManagementControlEvent - Memory Management Widget Event handler ; fun Normalize - Coordinate normalization ; pro ColorAndOpacityTablesEvent - Color and Opacity Widget Event handler ; pro ColorAndOpacityTablesWidget - Color and Opacity Widget builder ; fun meshijk - returns a regular 3D Cartesian array from a 3D AMR data set ; fun makeArrowHeadSymbol - construction of arrow heads for vector fields hedgehog display ; fun countPolys - counting number of polygons in vector fields hedgehog display ; pro WidgetSizeEditEvent - Main Widget size editor Event handler ; pro threeDViewSizeEditEvent - Main 3D view size editor Event handler ; pro DataReductionEvent - Data Reduction Widget Event handler ; pro HideSceneText - Hide text in the scene ; ... ; fun seedPick - Seed pick for streamlines ; fun DrawTheVolume - Update display of 3D Data objects : isosurface, volume, particles, streamlines ; pro SaveImageSequence - Save sequence of output image ; ... ........ ; ; EXTERNAL FUNCTIONS, PROCEDURES, and FILES: ; optional : getinputparam.pro - read Jupiter parameter files ; optional : box2cpu - read Ramses amr and extract cpu ids ; ; REQUIREMENTS: ; mandatory : IDL6.2 and beyond for full functionalities www.ittvis.com/idl ; optional : FastDL package for task farming www.txcorp.com ; optional : MPEG-enabled licence for movie making ; ; NAMED STRUCTURES: ; sState ; ; COMMON BLOCS: ; none ; ; MODIFICATION HISTORY: ; 2005/09/30 - v.0.0.0 first version based on examples/demo/d_widgets ; read Heracles binary files using rs, rdat ; load density, pressure, energy 3D scalar fields ; display of surface and image for a slice ; rotation, translate, scale, and perspective capabilities ; implementation of IDLgrImage, IdlgrSurface, IDLitData classes ; 2005/10/06 - v.0.0.1 to 0.0.3 test of slicer interface ; 2005/10/10 - v.0.0.4 to 0.0.7 introduction of volume rendering through PROJECT_VOL ; implementation of oView3D for volume rendering ; 2005/10/13 - v.0.0.8 to 0.0.A test of iVolume, create base for each viewing options ; 2005/10/14 - v.0.0.B to 0.0.E axis display, first test of IDLgrVolume class ; organization of low-level bases ; 2005/10/17 - v.0.0.F to 0.0.I new options for PROJECT_VOL 3D rendering ; 2005/10/18 - v.0.0.J visualization of velocity x,y,z components ; 2005/10/20 - v.0.0.K to 0.0.M volume rendering through VOXEL_PROJ ; test of HDF5 browser ; 2005/10/21 - v.0.0.N to 0.0.O VOXEL_PROJ options ; 2005/10/24 - v.0.0.P to 0.0.Q Data versus View tab bases ; 2005/10/25 - v.0.0.R to 0.0.S Data reduction ; 2005/10/27 - v.0.0.T improvement of loading base ; 2005/11/03 - v.0.0.U to 0.0.V introduction of h5rs, h5rdat ; 2005/11/04 - v.0.0.W profile plot, implementation of IDLgrPlot class ; 2005/11/07 - v.0.0.X to 0.0.Y development of h5rs, h5rdat ; 2005/11/10 - v.0.0.Z to 0.1.1 HDF5 interface developments ; 2005/11/14 - v.0.1.2 HDF5 interface ready with header file selection ; 2005/12/06 - v.0.1.N isosurface, implementation of IDLgrPolygon class ; 2006/01/18 - v.0.2.E hedgehog display using VECTOR_FIELD, and IDLgrPolygon/IDLgrSymbol classes ; 2006/01/30 - v.0.2.T read RAMSES AMR using rd_amr, rd_hydro, meshijk ; 2006/02/07 - v.0.2.X improvement of ramses interface ; 2006/02/27 - v.0.3.0 dark matter particles visualization using pp_part3d, oOrb ; 2006/03/03 - v.0.3.5 Main 3D view size editor ; 2006/03/23 - v.0.3.8 view properties widget ; 2006/04/26 - v.0.3.B streamlines display using PARTICLE_TRACE and IDLgrPolyline class ; 2006/06/08 - v.0.3.H ResetBases facility, test controls of objects ; 2006/06/09 - v.0.3.I Object controllers ; 2006/07/06 - v.0.3.Q ASH/BOB interface ; 2006/07/28 - v.0.3.T VRML output, Color and Opacity widget first implementation ; 2006/09/08 - v.0.3.U enhancements : Color and Opacity widget, volume options ; 2006/10/05 - v.0.3.X Jupiter level 0 interface ; 2006/11/16 - v.0.4.1 Task farming using FastDL/TaskDL, seed-pick streamlines ; 2006/11/24 - v.0.4.2 RGB/Opacity HVR-format lookup table ; 2006/11/29 - v.0.4.3 cleanup to generate IDL Virtual Machine application ; 2007/05/03 - v.0.4.4 most of editable fields without carriage return ; replace some editable fields by sliders and editable comboboxes ; Jupiter multiple grid image3D ; discard oData_varData3D & StoreDataForDisplay ; continuous seed-pick ; dynamic quality ; memory management & individual rebin ; object probes ; animations ; multiple isosurfaces of multiple variables ; movies first test ; widget size editor ; 2007/07/19 - v.0.4.5 enhancements in palette editor ; implementation of sub-volume for Ramses data (Y. Fidaali) ; AMR visualization, 3D and planar (Y. Fidaali) ; movies/time sequences : isosurface and volume implementations ; pivot point displacement ; AMR time sequence (Y. Fidaali) ; MPEG Control interface ; 2007/11/30 - v.0.4.6 new features in MPEG Control interface ; interactive control of time and spatial sequence (Y. Fidaali) ; control of time and spatial navigation by ascii datacard file (*.sds) : to be improved ; save sequence views in directory of jpg images ; correction in meshijk to account for exact subvolume boundaries ; spawning of box2cpu (R. Teyssier) ; displacement of rotation center using keyboard keys : Up/Down/Left/Right/PageUp/PageDown ; change properties of default, wide-angle and no-clipping views ; 2008/04/02 - v.0.4.7 new organization of Movie interface ; new interface for sequence of output images ; widgets for saving views to gif,jpg,eps ; clipping plane in volume ; navigation controls ; enhancements in sds control file ; read GRAFIC format ; test Glass Shader ; DOUBLE=1 in IDLgrView solves transparency defects (ITTVis Tech Support) ; ordering of particles to improve Dark Matter rendering ; Stereo mode ; New AMR Format ; DM point cloud optimization ; 2008/04/22 - v.0.4.7.dev ; optimization of particle rendering to handle very large dataset (>1e9) ; optimization of AMR reading and storing to skip higher levels ; fix x/y aspect ratio on 3D window resize ; bilinear interpolation available for 3D image slice ; some cleanup in sState ; error catching on endianess ; interface to Jacques/Enzo data ;- ; ; ; ;****************************************************************************** ; Object Control event handler ; ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, june 2006. ;- ; function SDVisionImportJaquesParticles @common_blocks.inc ndim = 3 if ptr_valid(parti.d[0]) ne 1 then begin print, 'pointer to particle data not valid!' print, 'Please, first select and plot data in the particle tab of Jaques' npart = 1 ; creat fake empty data part={ ndim:ndim $ ,npart:npart-1 $ ,id:lonarr(npart) $ ,xp:fltarr(ndim, npart)} return, part endif npart = N_elements((*parti.d[0])) ind = lindgen(npart) typeind = where(*parti.names eq 'particle_type') if parti.type gt 0 then begin th = histogram((*parti.d[typeind[0]])[ind]) print, N_elements(th), ' different types of particles found.' typeind = where(*parti.names eq 'particle_type') if typeind[0] gt -1 then begin nind = where((*parti.d[typeind[0]])[ind] eq parti.type, count) if count gt 0 then ind = ind[nind] else print, 'no matching particle types found: plotting all instead' endif endif npart = N_elements((*parti.d[0])[ind]) if parti.index gt 3 then begin part={ ndim:ndim $ ,npart:npart $ ,id:lonarr(npart) $ ,xp:fltarr(ndim, npart), $ mp:fltarr(npart)} names = (*parti.names) part.mp = fp(names[parti.index],ind) end else begin part={ ndim:ndim $ ,npart:npart $ ,id:lonarr(npart) $ ,xp:fltarr(ndim, npart)} endelse ; $ ; ,vp:fltarr(npart,ndim) $ ; ,mp:fltarr(npart) $ ; ,dp:fltarr(npart) $ ; ,ap:fltarr(npart) } initialize, c_center, [0.5,0.5,0.5] initialize, c_length, 1. ; for i=0,2 do part.xp[i,*] = ; (((*parti.d[i])[ind]-c_center[i]))/c_length -0.5 ; center around ; 0. 0. 0. for i=0,2 do part.xp[i,*] = (*parti.d[i])[ind] ; -0.5 ; center around 0. 0. 0. return, part end pro ObjectControlEvent, sState,uval,sEvent COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wTopBase, Get_UValue=sState sState.oSceneText[0]->SetProperty,HIDE=1 result=sState.oData_datanames->GetData(datanames) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_DataDimHDF->GetData(fourdim) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_DataFormat->GetData(DataFormat) WIDGET_CONTROL, sState.wLeftVueBase, SENSITIVE=1 iscalar=-1 for i=0,nvar-1 do begin if ( FillArraysHDF[i] eq 1 ) then begin if fourdim[i] eq 1 then begin iscalar=iscalar+1 UVAL_EXT='ISO_' if uVal EQ 'GENERATE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[0]=4 result=sState.oData_vue->SetData(iflag_vue) iflag_var= -(i+1) result=sState.oData_flag->SetData(iflag_var) sState.zTitleObj->SetProperty, STRINGS=datanames[i] sState.yTitlePlot->SetProperty, STRINGS=datanames[i] dum=ResetBases(sState) if WIDGET_INFO(sState.wObjectControlDisplayHDF[i,0],/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,0],SET_DROPLIST_SELECT=0,SENSITIVE=1 PolygonVarID=iscalar result=sState.oData_PolygonNTOT->GetData(PolygonNTOT) listiso=STRARR(PolygonNTOT[PolygonVarID]) for iiso = 0, PolygonNTOT[PolygonVarID]-1 do begin listiso[iiso]='iso '+strcompress(string(iiso),/remove_all) endfor WIDGET_CONTROL,sState.wSelectIso,SET_VALUE=listiso result=sState.oData_PolygonVarID->SetData(PolygonVarID) result=sState.oData_PolygonID->GetData(PolygonID) j=PolygonVarID k=PolygonID[PolygonVarID] l=MovieFrameCURRENT IF OBJ_VALID(sState.oPolygon[j,k,l]) EQ 0 THEN BEGIN sState.oPolygon[j,k,l]=OBJ_NEW('IDLgrPolygon',Color=[0,0,205], $ Shading=1,ALPHA_CHANNEL=1.,/REGISTER_PROPERTIES, $ NAME=datanames[i]+' iso 0', $ DESCRIPTION='isosurface object' $ ) ;;; TEST SHADER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; glassShader=0 if glassShader then begin print,'TEST SHADER' ;; Create the glass shader oShader = OBJ_NEW('IDLgrShader', VERTEX_PROGRAM_FILENAME='/mnt/local/home/pomarede/esimulations/shaders/Glass/Glass.vert', $ FRAGMENT_PROGRAM_FILENAME='/mnt/local/home/pomarede/esimulations/shaders/Glass/Glass.frag') READ_JPEG, '/mnt/local/home/pomarede/esimulations/shaders/Glass/House.jpg', EnvMap, TRUE=1 ;; Create environment map image oEnvMap = OBJ_NEW('IDLgrImage', EnvMap, LOCATION=[-3,-3],DIMENSIONS=[6,6],INTERPOLATE=1) oShader->SetUniformVariable, 'eyePos', [0.0, 0.0, 0.0, 1.0] ;; No displacement oShader->SetUniformVariable, 'displace', [0.0, 0.0, 0.0, 0.0] oShader->SetUniformVariable, 'etaValues', [1.1, 1.08, 1.06] oShader->SetUniformVariable, 'fresnelValues', [2.0, 2.0, 0.1] oShader->SetUniformVariable, 'environmentMap', oEnvMap sState.oPolygon[j,k,l]->SetProperty,SHADER=oShader, TEXTURE_INTERP=1,STYLE=2 endif ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; sState.oModelPolygon->Add,sState.oPolygon[j,k,l] ;,/ALIAS WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState ENDIF ELSE BEGIN sState.oPolygon[j,k,l]->SetProperty,HIDE=0 ENDELSE WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[3], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[0] , MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] level=0 result=sState.oData_HDFvar[i,level]->GetData(varData3D) result=sState.oData_ScalarLinLog->GetData(ScalarLinLog) IF ScalarLinLog EQ 1 THEN BEGIN WIDGET_CONTROL, sState.wIsoValues[0], SET_VALUE=min(alog10(varData3D)) WIDGET_CONTROL, sState.wIsoValues[1], SET_VALUE=max(alog10(varData3D)) ENDIF ELSE BEGIN WIDGET_CONTROL, sState.wIsoValues[0], SET_VALUE=min(varData3D) WIDGET_CONTROL, sState.wIsoValues[1], SET_VALUE=max(varData3D) ENDELSE dum=UpdateTheViews(sState,0) FillTheIsoPlot,sState RenormIsoPlot,sState endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+datanames[i] then begin WIDGET_CONTROL, sState.wTopBase, Get_UValue=sState PolygonVarID=iscalar result=sState.oData_PolygonID->GetData(PolygonID) j=PolygonVarID k=PolygonID[PolygonVarID] l=MovieFrameCURRENT IF OBJ_VALID(sState.oPolygon[j,k,l]) EQ 1 THEN $ sState.oPolygon[j,k,l]->SetProperty,HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+datanames[i] then begin PolygonVarID=iscalar result=sState.oData_PolygonVarID->SetData(PolygonVarID) result=sState.oData_PolygonNTOT->GetData(PolygonNTOT) listiso=STRARR(PolygonNTOT[PolygonVarID]) for iiso = 0, PolygonNTOT[PolygonVarID]-1 do begin listiso[iiso]='iso '+strcompress(string(iiso),/remove_all) endfor WIDGET_CONTROL,sState.wSelectIso,SET_VALUE=listiso result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[0]=4 result=sState.oData_vue->SetData(iflag_vue) iflag_var= -(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[3], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[0] , MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] level=0 result=sState.oData_HDFvar[i,level]->GetData(varData3D,/NO_COPY) result=sState.oData_ScalarLinLog->GetData(ScalarLinLog) memory=MEMORY(/CURRENT)/1000000 if memory ge 1000. then print,'computing min and max of 3D data...' IF ScalarLinLog EQ 1 THEN BEGIN WIDGET_CONTROL, sState.wIsoValues[0], SET_VALUE=min(alog10(varData3D)) WIDGET_CONTROL, sState.wIsoValues[1], SET_VALUE=max(alog10(varData3D)) ENDIF ELSE BEGIN WIDGET_CONTROL, sState.wIsoValues[0], SET_VALUE=min(varData3D) WIDGET_CONTROL, sState.wIsoValues[1], SET_VALUE=max(varData3D) ENDELSE if memory ge 1000. then print,'... done' result=sState.oData_HDFvar[i,level]->SetData(varData3D) if memory ge 1000. then print,'->SetData(varData3D)' FillTheIsoPlot,sState RenormIsoPlot,sState result=sState.oData_PolygonVarID->SetData(PolygonVarID) result=sState.oData_PolygonID->GetData(PolygonID) j=PolygonVarID k=PolygonID[PolygonVarID] l=MovieFrameCURRENT IF OBJ_VALID(sState.oPolygon[j,k,l]) EQ 0 THEN BEGIN sState.oPolygon[j,k,l]=OBJ_NEW('IDLgrPolygon',Color=[0,0,205], $ Shading=1,ALPHA_CHANNEL=1.,/REGISTER_PROPERTIES, $ NAME=datanames[i]+' iso 0', $ DESCRIPTION='isosurface object' $ ) sState.oModelPolygon->Add,sState.oPolygon[j,k,l] ;,/ALIAS WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState ENDIF SDvis_Draw, sState endif UVAL_EXT='VOL_' if uVal EQ 'GENERATE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[0]=5 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) sState.zTitleObj->SetProperty, STRINGS=datanames[i] sState.yTitlePlot->SetProperty, STRINGS=datanames[i] dum=ResetBases(sState) if WIDGET_INFO(sState.wObjectControlDisplayHDF[i,1],/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,1],SET_DROPLIST_SELECT=0,SENSITIVE=1 WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[6], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[3] , MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] l=MovieFrameCURRENT composite_function=1 IF DataFormat eq 4 THEN BEGIN composite_function=0 ;;; ASH ENDIF result=sState.oData_oVolume->GetData(oVolume) IF OBJ_VALID(oVolume[l]) EQ 0 THEN BEGIN oPaletteImage = Obj_New('IDLgrPalette') oPaletteImage->LoadCT, 1 oPaletteImage->GetProperty, Red=r, Blue=b, Green=g vColors = BYTARR(256,3,/NOZERO) vColors[*,0]=r vColors[*,1]=g vColors[*,2]=b ;print,'l=',l,' create oVolume[l]' result=sState.oData_GridSize->GetData(GridSize) print, 'seeting volume and range!!!!!!!!!!!!!!!!!!!!!!!' oVolume[l]=OBJ_NEW('IDLgrVolume',HIDE=1,ALPHA_CHANNEL=1.,ZERO_OPACITY_SKIP=1,/ZBUFFER, $ RGB_TABLE0=vColors,HINTS=2,COMPOSITE_FUNCTION=composite_function,/NO_COPY,$ CLIP_PLANES=[0,0,1.,-20000.], $ RENDER_STEP=[1,1,1],/REGISTER_PROPERTIES,DESCRIPTION='volume object' $ ) sState.oModelVolume->Add,oVolume[l] result=sState.oData_oVolume->SetData(oVolume) WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState ENDIF IF DataFormat eq 4 THEN BEGIN LoadPredefinedLUT,sState WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState ENDIF oVolume[l]->SetProperty,HIDE=0 dum=UpdateTheViews(sState,1) endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+datanames[i] then begin result=sState.oData_oVolume->GetData(oVolume) l=MovieFrameCURRENT IF OBJ_VALID(oVolume[l]) EQ 1 THEN $ oVolume[l]->SetProperty,HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[0]=5 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[6], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[3] , MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] composite_function=1 IF DataFormat eq 4 THEN BEGIN composite_function=0 ;;; ASH ENDIF result=sState.oData_oVolume->GetData(oVolume) IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 0 THEN BEGIN oPaletteImage = Obj_New('IDLgrPalette') oPaletteImage->LoadCT, 1 oPaletteImage->GetProperty, Red=r, Blue=b, Green=g vColors = BYTARR(256,3,/NOZERO) vColors[*,0]=r vColors[*,1]=g vColors[*,2]=b ;print,'MovieFrameCURRENTMovieFrameCURRENT=',MovieFrameCURRENT,' create oVolume[l]' oVolume[MovieFrameCURRENT]=OBJ_NEW('IDLgrVolume',HIDE=1,ALPHA_CHANNEL=1.,ZERO_OPACITY_SKIP=1,/ZBUFFER, $ RGB_TABLE0=vColors,HINTS=2,COMPOSITE_FUNCTION=composite_function,/NO_COPY,$ CLIP_PLANES=[0,0,1.,-20000.], $ RENDER_STEP=[1,1,1],/REGISTER_PROPERTIES,DESCRIPTION='volume object') sState.oModelVolume->Add,oVolume[MovieFrameCURRENT] WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState result=sState.oData_oVolume->SetData(oVolume) ENDIF ;;;result=sState.oData_oVolume->SetData(oVolume) SDvis_Draw, sState endif UVAL_EXT='IMA3D_' if uVal EQ 'GENERATE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[0]=6 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) sState.zTitleObj->SetProperty, STRINGS=datanames[i] sState.yTitlePlot->SetProperty, STRINGS=datanames[i] dum=ResetBases(sState) WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,2],SET_DROPLIST_SELECT=0,SENSITIVE=1 for im=0,n_elements(sState.oImage3D)-1 do sState.oImage3D[im]->SetProperty,HIDE=0 WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[10], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,2],SET_DROPLIST_SELECT=0 dum=UpdateTheViews(sState,0) endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+datanames[i] then begin for im=0,n_elements(sState.oImage3D)-1 do $ sState.oImage3D[im]->SetProperty,HIDE=WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[0]=6 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[10], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] SDvis_Draw, sState endif UVAL_EXT='IMA_' if uVal EQ 'GENERATE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[0]=1 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) sState.zTitleObj->SetProperty, STRINGS=datanames[i] sState.yTitlePlot->SetProperty, STRINGS=datanames[i] dum=ResetBases(sState) WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,3],SET_DROPLIST_SELECT=0,SENSITIVE=1 for im=0,n_elements(sState.oImage)-1 do sState.oImage[im]->SetProperty,HIDE=0 WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[0], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[0], MAP=1 WIDGET_CONTROL, sState.wDraw2, SENSITIVE=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,3],SET_DROPLIST_SELECT=0 dum=UpdateTheViews(sState,0) endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+datanames[i] then begin for im=0,n_elements(sState.oImage)-1 do $ sState.oImage[im]->SetProperty,HIDE=WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[0]=1 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[0], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[0], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] SDvis_Draw, sState endif endif else if fourdim[i] eq 3 or fourdim[i] eq 2 then begin UVAL_EXT='VEC3D_' if uVal EQ 'GENERATE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[1]=1 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) WIDGET_CONTROL, sState.wVectorFieldName,SET_VALUE=datanames[i] dum=ResetBases(sState) WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,0],SET_DROPLIST_SELECT=0,SENSITIVE=1 sState.oVectorField->SetProperty,HIDE=0 ;WIDGET_CONTROL, sState.wPickViewBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[1] , MAP=1 WIDGET_CONTROL, sState.wSelectionbase[4] , MAP=1 WIDGET_CONTROL, sState.wSliceVecVs3DVec , MAP=1 WIDGET_CONTROL, sState.wVectorFieldBase[0], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,0],SET_DROPLIST_SELECT=0 dum=UpdateTheViews(sState,0) endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+datanames[i] then begin sState.oVectorField->SetProperty,HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[1]=1 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) ;WIDGET_CONTROL, sState.wPickViewBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[1] , MAP=1 WIDGET_CONTROL, sState.wSelectionbase[4] , MAP=1 WIDGET_CONTROL, sState.wSliceVecVs3DVec , MAP=1 WIDGET_CONTROL, sState.wVectorFieldBase[0], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] SDvis_Draw, sState endif UVAL_EXT='STR3D_' if uVal EQ 'GENERATE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[1]=2 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) WIDGET_CONTROL, sState.wVectorFieldName,SET_VALUE=datanames[i] dum=ResetBases(sState) WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,1],SET_DROPLIST_SELECT=0,SENSITIVE=1 sState.oStreamlines->SetProperty,HIDE=0 ;WIDGET_CONTROL, sState.wPickViewBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[1] , MAP=1 WIDGET_CONTROL, sState.wSelectionbase[4] , MAP=1 WIDGET_CONTROL, sState.wSliceVecVs3DVec , MAP=1 WIDGET_CONTROL, sState.wVectorFieldBase[1], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,1],SET_DROPLIST_SELECT=0 dum=UpdateTheViews(sState,0) endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+datanames[i] then begin sState.oStreamlines->SetProperty,HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[1]=2 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) ;WIDGET_CONTROL, sState.wPickViewBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[1] , MAP=1 WIDGET_CONTROL, sState.wSelectionbase[4] , MAP=1 WIDGET_CONTROL, sState.wSliceVecVs3DVec , MAP=1 WIDGET_CONTROL, sState.wVectorFieldBase[1], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] SDvis_Draw, sState endif UVAL_EXT='VEC2D_' if uVal EQ 'GENERATE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[1]=3 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) WIDGET_CONTROL, sState.wVectorFieldName,SET_VALUE=datanames[i] dum=ResetBases(sState) WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,2],SET_DROPLIST_SELECT=0,SENSITIVE=1 sState.oVectorField2D->SetProperty,HIDE=0 WIDGET_CONTROL, sState.wDrawBase3DsubLower[1] , MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionbase[4] , MAP=1 WIDGET_CONTROL, sState.wSliceVecVs3DVec , MAP=0 WIDGET_CONTROL, sState.w3DVec2DSlicePlaneBase, SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldBase[0], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,2],SET_DROPLIST_SELECT=0 dum=UpdateTheViews(sState,0) endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+datanames[i] then begin sState.oVectorField2D->SetProperty,HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[1]=3 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) WIDGET_CONTROL, sState.wDrawBase3DsubLower[1] , MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionbase[4] , MAP=1 WIDGET_CONTROL, sState.wSliceVecVs3DVec , MAP=0 WIDGET_CONTROL, sState.w3DVec2DSlicePlaneBase, SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldBase[0], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] SDvis_Draw, sState endif UVAL_EXT='STR2D_' if uVal EQ 'GENERATE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[1]=4 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) WIDGET_CONTROL, sState.wVectorFieldName,SET_VALUE=datanames[i] dum=ResetBases(sState) WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,3],SET_DROPLIST_SELECT=0,SENSITIVE=1 sState.oStreamlines2D->SetProperty,HIDE=0 ;WIDGET_CONTROL, sState.wPickViewBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[1] , MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionbase[4] , MAP=1 WIDGET_CONTROL, sState.wSliceVecVs3DVec , MAP=0 WIDGET_CONTROL, sState.w3DVec2DSlicePlaneBase, SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldBase[1], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,3],SET_DROPLIST_SELECT=0 dum=UpdateTheViews(sState,0) endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+datanames[i] then begin sState.oStreamlines2D->SetProperty,HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[1]=4 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) ;WIDGET_CONTROL, sState.wPickViewBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[1] , MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionbase[4] , MAP=1 WIDGET_CONTROL, sState.wSliceVecVs3DVec , MAP=0 WIDGET_CONTROL, sState.w3DVec2DSlicePlaneBase, SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldBase[1], MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] SDvis_Draw, sState endif endif else if fourdim[i] eq 0 then begin UVAL_EXT='PART_' if uVal EQ 'GENERATE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[2]=1 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,0],SET_DROPLIST_SELECT=0,SENSITIVE=1 sState.oParticles[0]->SetProperty,HIDE=0 sState.oParticles[1]->SetProperty,HIDE=0 ;WIDGET_CONTROL, sState.wPickViewBase[2], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionBase[5], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[2] , MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] WIDGET_CONTROL, sState.wObjectControlDisplayHDF[i,0],SET_DROPLIST_SELECT=0,SENSITIVE=1 dum=UpdateTheViews(sState,0) endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+datanames[i] then begin sState.oParticles[0]->SetProperty,HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.oParticles[1]->SetProperty,HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+datanames[i] then begin result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 iflag_vue[2]=1 result=sState.oData_vue->SetData(iflag_vue) iflag_var=-(i+1) result=sState.oData_flag->SetData(iflag_var) dum=ResetBases(sState) ;WIDGET_CONTROL, sState.wPickViewBase[2], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionBase[5], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[2] , MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+datanames[i] SDvis_Draw, sState endif endif ; fourdim[i]... endif ; FillArraysHDF[i] eq 1 endfor ; i=0,nvar-1 ; result=sState.oData_datanames->GetData(datanames) ; size_datanames=size(datanames,/DIMENSIONS) ; nvar=fix(size_datanames[0]) ; if nvar eq 0 then nvar=1 droplist_select=intarr(nvar,4) sensitive=intarr(nvar,4) droplist_select[*,*]=1 sensitive[*,*]=0 ; IF WIDGET_INFO(sState.wObjectControlBase, /VALID_ID) EQ 1 THEN BEGIN for i=0,nvar-1 do begin for j=0,3 do begin if WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/VALID_ID) EQ 1 then begin droplist_select[i,j]=WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/DROPLIST_SELECT ) sensitive[i,j]=WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/SENSITIVE ) endif endfor endfor result=sState.oData_droplist_select->SetData(droplist_select) result=sState.oData_sensitive->SetData(sensitive) ;print,'ObjectControlWidget set droplist_select=',droplist_select ;print,'ObjectControlWidget set sensitive=',sensitive ; ENDIF end ;****************************************************************************** ;------------------------------------------------------------------------- ;****************************************************************************** ; Object control widget builder ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, june 2006. ; pro ObjectControlWidget, $ GridDim, $ datanames, $ FillArraysHDF, $ fourdim, $ ;hide_oVolume, $ ;hide_oImage3D, $ wObjectControlBase, $ wObjectControlDisplayHDF, $ droplist_select, $ sensitive ;print,'in ObjectControlWidget' nz=GridDim(2)*1L size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) ;print,'nvar=',nvar ;print,'size_datanames=',size_datanames ;print,'datanames=',datanames nvarmax=20 ;nvarmax = 0 ;if nvar ne 0 then nvarmax=nvar+5 ; reserved for custom vars wObjectControlDisplayHDF=LONARR(nvarmax,4) ; max 3 objects : iso,vol,ima3d if nvar gt 0 then begin ;print,'in ObjectControlWidget droplist_select=',droplist_select ;print,'in ObjectControlWidget sensitive=',sensitive wObjectControlBaseHDF=LONARR(nvar) wObjectControlLabelHDF=LONARR(nvar) wObjectControlGenerateHDF=LONARR(nvar) ;wObjectControlDisplayHDF=LONARR(nvar) wObjectControlConfigureHDF=LONARR(nvar) endif ;else begin ;wObjectControlConfigureHDF=LONARR(nvar) ; end wLabel3D = WIDGET_LABEL(wObjectControlBase,/ALIGN_CENTER, $ VALUE='********************** 3D SPACE ***********************') for i=0,nvar-1 do begin ;print,'i,nvar,FillArraysHDF[i],fourdim[i],datanames[i]=',i,nvar,FillArraysHDF[i],fourdim[i],datanames[i] if ( FillArraysHDF[i] eq 1 ) then begin if fourdim[i] eq 1 and nz gt 1 then begin wObjectControlBaseHDF[i] = WIDGET_BASE(wObjectControlBase,/ROW) UVAL_EXT='ISO_' VAL_EXT=' isosurface ' wObjectControlGenerateHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlDisplayHDF[i,0] = WIDGET_DROPLIST(wObjectControlBaseHDF[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+datanames[i]) WIDGET_CONTROL,wObjectControlDisplayHDF[i,0], SET_DROPLIST_SELECT=droplist_select[i,0], $ SENSITIVE=sensitive[i,0] wObjectControlConfigureHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlLabelHDF[i] = WIDGET_LABEL(wObjectControlBaseHDF[i],VALUE=VAL_EXT+datanames[i],/ALIGN_RIGHT) wObjectControlBaseHDF[i] = WIDGET_BASE(wObjectControlBase,/ROW) UVAL_EXT='VOL_' VAL_EXT=' volume ' wObjectControlGenerateHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlDisplayHDF[i,1] = WIDGET_DROPLIST(wObjectControlBaseHDF[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+datanames[i],SENSITIVE=0) ;if hide_oVolume eq 1 then WIDGET_CONTROL,wObjectControlDisplayHDF[i,1], SET_DROPLIST_SELECT=1 WIDGET_CONTROL,wObjectControlDisplayHDF[i,1], SET_DROPLIST_SELECT=droplist_select[i,1], $ SENSITIVE=sensitive[i,1] wObjectControlConfigureHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlLabelHDF[i] = WIDGET_LABEL(wObjectControlBaseHDF[i],VALUE=VAL_EXT+datanames[i],/ALIGN_RIGHT) wObjectControlBaseHDF[i] = WIDGET_BASE(wObjectControlBase,/ROW) UVAL_EXT='IMA3D_' VAL_EXT=' image ' wObjectControlGenerateHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlDisplayHDF[i,2] = WIDGET_DROPLIST(wObjectControlBaseHDF[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+datanames[i]) ;if hide_oImage3D eq 1 then WIDGET_CONTROL,wObjectControlDisplayHDF[i,2], SET_DROPLIST_SELECT=1 WIDGET_CONTROL,wObjectControlDisplayHDF[i,2], SET_DROPLIST_SELECT=droplist_select[i,2], $ SENSITIVE=sensitive[i,2] wObjectControlConfigureHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlLabelHDF[i] = WIDGET_LABEL(wObjectControlBaseHDF[i],VALUE=VAL_EXT+datanames[i],/ALIGN_RIGHT) endif else if fourdim[i] eq 3 and nz gt 1 then begin wObjectControlBaseHDF[i] = WIDGET_BASE(wObjectControlBase,/ROW) UVAL_EXT='VEC3D_' VAL_EXT=' vectors ' wObjectControlGenerateHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlDisplayHDF[i,0] = WIDGET_DROPLIST(wObjectControlBaseHDF[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+datanames[i]) ;WIDGET_CONTROL,wObjectControlDisplayHDF[i,0], SET_DROPLIST_SELECT=1 WIDGET_CONTROL,wObjectControlDisplayHDF[i,0], SET_DROPLIST_SELECT=droplist_select[i,0], $ SENSITIVE=sensitive[i,0] wObjectControlConfigureHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlLabelHDF[i] = WIDGET_LABEL(wObjectControlBaseHDF[i],VALUE=VAL_EXT+datanames[i],/ALIGN_RIGHT) wObjectControlBaseHDF[i] = WIDGET_BASE(wObjectControlBase,/ROW) UVAL_EXT='STR3D_' VAL_EXT=' streamlines ' wObjectControlGenerateHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlDisplayHDF[i,1] = WIDGET_DROPLIST(wObjectControlBaseHDF[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+datanames[i]) ;WIDGET_CONTROL,wObjectControlDisplayHDF[i,1], SET_DROPLIST_SELECT=1 WIDGET_CONTROL,wObjectControlDisplayHDF[i,1], SET_DROPLIST_SELECT=droplist_select[i,1], $ SENSITIVE=sensitive[i,1] wObjectControlConfigureHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlLabelHDF[i] = WIDGET_LABEL(wObjectControlBaseHDF[i],VALUE=VAL_EXT+datanames[i],/ALIGN_RIGHT) endif else if fourdim[i] eq 0 then begin wObjectControlBaseHDF[i] = WIDGET_BASE(wObjectControlBase,/ROW) UVAL_EXT='PART_' VAL_EXT=' particles ' wObjectControlGenerateHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlDisplayHDF[i,0] = WIDGET_DROPLIST(wObjectControlBaseHDF[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+datanames[i]) WIDGET_CONTROL,wObjectControlDisplayHDF[i,0], SET_DROPLIST_SELECT=droplist_select[i,0], $ SENSITIVE=sensitive[i,0] wObjectControlConfigureHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlLabelHDF[i] = WIDGET_LABEL(wObjectControlBaseHDF[i],VALUE=VAL_EXT+datanames[i],/ALIGN_RIGHT) endif endif endfor wLabel2D = WIDGET_LABEL(wObjectControlBase,/ALIGN_CENTER, $ VALUE='********************** 2D SLICE ***********************') for i=0,nvar-1 do begin if ( FillArraysHDF[i] eq 1 ) then begin if fourdim[i] eq 1 then begin wObjectControlBaseHDF[i] = WIDGET_BASE(wObjectControlBase,/ROW) UVAL_EXT='IMA_' VAL_EXT=' image ' wObjectControlGenerateHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlDisplayHDF[i,3] = WIDGET_DROPLIST(wObjectControlBaseHDF[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+datanames[i]) ;WIDGET_CONTROL,wObjectControlDisplayHDF[i,3], SET_DROPLIST_SELECT=1 WIDGET_CONTROL,wObjectControlDisplayHDF[i,3], SET_DROPLIST_SELECT=droplist_select[i,3], $ SENSITIVE=sensitive[i,3] wObjectControlConfigureHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlLabelHDF[i] = WIDGET_LABEL(wObjectControlBaseHDF[i],VALUE=VAL_EXT+datanames[i],/ALIGN_RIGHT) endif else if fourdim[i] eq 3 or fourdim[i] eq 2 then begin wObjectControlBaseHDF[i] = WIDGET_BASE(wObjectControlBase,/ROW) UVAL_EXT='VEC2D_' VAL_EXT=' vectors ' wObjectControlGenerateHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlDisplayHDF[i,2] = WIDGET_DROPLIST(wObjectControlBaseHDF[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+datanames[i]) ;WIDGET_CONTROL,wObjectControlDisplayHDF[i,2], SET_DROPLIST_SELECT=1 WIDGET_CONTROL,wObjectControlDisplayHDF[i,2], SET_DROPLIST_SELECT=droplist_select[i,2], $ SENSITIVE=sensitive[i,2] wObjectControlConfigureHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlLabelHDF[i] = WIDGET_LABEL(wObjectControlBaseHDF[i],VALUE=VAL_EXT+datanames[i],/ALIGN_RIGHT) wObjectControlBaseHDF[i] = WIDGET_BASE(wObjectControlBase,/ROW) UVAL_EXT='STR2D_' VAL_EXT=' streamlines ' wObjectControlGenerateHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlDisplayHDF[i,3] = WIDGET_DROPLIST(wObjectControlBaseHDF[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+datanames[i]) ;WIDGET_CONTROL,wObjectControlDisplayHDF[i,3], SET_DROPLIST_SELECT=1 WIDGET_CONTROL,wObjectControlDisplayHDF[i,3], SET_DROPLIST_SELECT=droplist_select[i,3], $ SENSITIVE=sensitive[i,3] wObjectControlConfigureHDF[i] = WIDGET_BUTTON(wObjectControlBaseHDF[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+datanames[i],/ALIGN_CENTER) wObjectControlLabelHDF[i] = WIDGET_LABEL(wObjectControlBaseHDF[i],VALUE=VAL_EXT+datanames[i],/ALIGN_RIGHT) endif endif endfor end ; ;****************************************************************************** ; Launch and update of Object Control Widget ; ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, march 2007. ; march 28, 2008 adding GROUP_LEADER ;- ; pro LaunchObjectControlWidget,sEvent,sState result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) test_valid=0 result=sState.oData_datanames->GetData(datanames) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) ;print,'nvar=',nvar ;help,sState.wObjectControlDisplayHDF for i=0,nvar-1 do begin for j=0,3 do begin ;print,i,j if WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/VALID_ID) EQ 1 then test_valid=1 endfor endfor ;print,'test_valid=',test_valid IF WIDGET_INFO(sState.wObjectControlBase, /VALID_ID) EQ 1 AND test_valid EQ 1 THEN BEGIN droplist_select=intarr(nvar,4) sensitive=intarr(nvar,4) for i=0,nvar-1 do begin for j=0,3 do begin if WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/VALID_ID) EQ 1 then begin droplist_select[i,j]=WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/DROPLIST_SELECT ) sensitive[i,j]=WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/SENSITIVE ) endif endfor endfor ;print,'droplist_select=',droplist_select ;print,'sensitive=',sensitive WIDGET_CONTROL, sState.wObjectControlBase, /DESTROY sState.wObjectControlBase = WIDGET_BASE(TITLE='Data Objects control', $ GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=1, YPAD=1, SPACE=1) result=sState.oData_GridDim->GetData(GridDim) result=sState.oData_datanames->GetData(datanames) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_DataDimHDF->GetData(fourdim) ObjectControlWidget, $ GridDim, $ datanames, $ FillArraysHDF, $ fourdim, $ ;hide_oVolume, $ ;hide_oImage3D, $ sState.wObjectControlBase, $ wObjectControlDisplayHDF, $ droplist_select, $ sensitive sState.wObjectControlDisplayHDF=wObjectControlDisplayHDF WIDGET_CONTROL,sState.wObjectControlBase, SET_UVALUE=sState WIDGET_CONTROL,sState.wObjectControlBase , /REALIZE XMANAGER,'SDvis_Event',sState.wObjectControlBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="ObjectControl_Cleanup", $ /JUST_REG ENDIF end ;****************************************************************************** ;****************************************************************************** ; Geometry Object Control event handler ; ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, june 2006. ; May, 2007: AMR event added by Yncia Fidaali ;- pro GeometryObjectControlEvent,sState,uval,sEvent COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wTopBase, Get_UValue=sState result=sState.oData_vue->GetData(iflag_vue) result= sState.oData_geometryControlInfo->GetData(geometryControlInfo) result=sState.oData_DataFormat->GetData(DataFormat) UVAL_EXT='BOUNDS_' if uVal EQ 'GEO_GENERATE_'+UVAL_EXT then begin sState.xaxis3Dbounds1->SetProperty, HIDE=0 sState.xaxis3Dbounds2->SetProperty, HIDE=0 sState.xaxis3Dbounds3->SetProperty, HIDE=0 sState.xaxis3Dbounds4->SetProperty, HIDE=0 sState.yaxis3Dbounds1->SetProperty, HIDE=0 sState.yaxis3Dbounds2->SetProperty, HIDE=0 sState.yaxis3Dbounds3->SetProperty, HIDE=0 sState.yaxis3Dbounds4->SetProperty, HIDE=0 sState.zaxis3Dbounds1->SetProperty, HIDE=0 sState.zaxis3Dbounds2->SetProperty, HIDE=0 sState.zaxis3Dbounds3->SetProperty, HIDE=0 sState.zaxis3Dbounds4->SetProperty, HIDE=0 iflag_vue[*]=0 & iflag_vue[3]=1 & result=sState.oData_vue->SetData(iflag_vue) map=WIDGET_INFO(sState.wSelectionDrawingBase[1], /MAP) if map eq 0 then begin dum=ResetBases(sState) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 endif WIDGET_CONTROL, sState.wObjectControlDisplayBounds,SENSITIVE=1 WIDGET_CONTROL, sState.wObjectControlConfigureBounds,SENSITIVE=1 WIDGET_CONTROL, sState.wLeftVueBase, SENSITIVE=1 WIDGET_CONTROL, sState.wSelectionBase[9], MAP=1 dum=UpdateTheViews(sState,1) endif else if uVal EQ 'GEO_DISPLAY_'+UVAL_EXT then begin sState.xaxis3Dbounds1->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.xaxis3Dbounds2->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.xaxis3Dbounds3->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.xaxis3Dbounds4->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.yaxis3Dbounds1->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.yaxis3Dbounds2->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.yaxis3Dbounds3->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.yaxis3Dbounds4->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.zaxis3Dbounds1->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.zaxis3Dbounds2->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.zaxis3Dbounds3->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.zaxis3Dbounds4->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) geometryControlInfo[0] = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'GEO_CONFIGURE_'+UVAL_EXT then begin iflag_vue[*]=0 & iflag_vue[3]=1 & result=sState.oData_vue->SetData(iflag_vue) dum=ResetBases(sState) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionBase[9], MAP=1 dum=UpdateTheViews(sState,1) endif UVAL_EXT='AXIS_' if uVal EQ 'GEO_GENERATE_'+UVAL_EXT then begin sState.oView3D->GetProperty, ZCLIP=zclip zclip[1]=-1. sState.oView3D->SetProperty, ZCLIP=zclip print,'override current value of far-clipping plane' sState.xaxis3D->SetProperty, HIDE=0 sState.yaxis3D->SetProperty, HIDE=0 sState.zaxis3D->SetProperty, HIDE=0 sState.xaxis1->SetProperty, HIDE=0 sState.yaxis1->SetProperty, HIDE=0 sState.zaxis1->SetProperty, HIDE=0 iflag_vue[*]=0 & iflag_vue[3]=2 & result=sState.oData_vue->SetData(iflag_vue) dum=ResetBases(sState) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionBase[8], MAP=1 WIDGET_CONTROL, sState.wLeftVueBase, SENSITIVE=1 WIDGET_CONTROL, sState.wObjectControlDisplayAxis,SENSITIVE=1 WIDGET_CONTROL, sState.wObjectControlConfigureAxis,SENSITIVE=1 dum=UpdateTheViews(sState,1) endif else if uVal EQ 'GEO_DISPLAY_'+UVAL_EXT then begin sState.xaxis3D->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.yaxis3D->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.zaxis3D->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.xaxis1->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.yaxis1->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.zaxis1->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) geometryControlInfo[1] = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'GEO_CONFIGURE_'+UVAL_EXT then begin iflag_vue[*]=0 & iflag_vue[3]=2 & result=sState.oData_vue->SetData(iflag_vue) dum=ResetBases(sState) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionBase[8], MAP=1 WIDGET_CONTROL, sState.wLeftVueBase, SENSITIVE=1 dum=UpdateTheViews(sState,1) endif UVAL_EXT='DOMAINS_' if uVal EQ 'GEO_GENERATE_'+UVAL_EXT then begin iflag_vue[*]=0 & iflag_vue[3]=3 & result=sState.oData_vue->SetData(iflag_vue) dum=ResetBases(sState) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 if DataFormat eq 5 then WIDGET_CONTROL, sState.wSelectionBase[7], MAP=1 WIDGET_CONTROL, sState.wLeftVueBase, SENSITIVE=1 WIDGET_CONTROL, sState.wObjectControlDisplayDomains,SENSITIVE=1 WIDGET_CONTROL, sState.wObjectControlConfigureDomains,SENSITIVE=1 dum=UpdateTheViews(sState,1) endif else if uVal EQ 'GEO_DISPLAY_'+UVAL_EXT then begin hide=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) if hide eq 0 then begin iflag_vue[*]=0 & iflag_vue[3]=3 & result=sState.oData_vue->SetData(iflag_vue) dum=UpdateTheViews(sState,1) endif else if hide eq 1 then begin ;print,'sState.GeoStructure.JupiterDomainsModel->Remove,/ALL' sState.GeoStructure.JupiterDomainsModel->Remove,/ALL DomainsCounter=0 result=sState.GeoStructure.oData_DomainsCounter->SetData(DomainsCounter) SDvis_Draw, sState endif geometryControlInfo[2] = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) endif else if uVal EQ 'GEO_CONFIGURE_'+UVAL_EXT then begin dum=ResetBases(sState) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 if DataFormat eq 5 then WIDGET_CONTROL, sState.wSelectionBase[7], MAP=1 WIDGET_CONTROL, sState.wLeftVueBase, SENSITIVE=1 iflag_vue[*]=0 & iflag_vue[3]=3 & result=sState.oData_vue->SetData(iflag_vue) hide=WIDGET_INFO(sState.wObjectControlDisplayDomains,/DROPLIST_SELECT) if hide eq 0 then dum=UpdateTheViews(sState,1) endif UVAL_EXT='AMR_' result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) if uVal EQ 'GEO_GENERATE_'+UVAL_EXT then begin dum=ResetBases(sState) iflag_vue[*]=0 & iflag_vue[3]=4 & result=sState.oData_vue->SetData(iflag_vue) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wSelectionBase[7], MAP=1 WIDGET_CONTROL, sState.wLeftVueBase, SENSITIVE=1 WIDGET_CONTROL, sState.wObjectControlDisplayDomains,SENSITIVE=1 WIDGET_CONTROL, sState.wObjectControlConfigureDomains,SENSITIVE=1 dum=UpdateTheViews(sState,1) result = sState.oData_RamsesAmrLevelsArrays->GetData(RamsesAmrLevelsArrays) result = sState.oData_RamsesAmrLevelsColors->GetData(RamsesAmrLevelsColors) result = sState.oData_RamsesAmrLevelsAlpha->GetData(RamsesAmrLevelsAlpha) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result = sState.oData_wAmrConfigurationBase->GetData(wAmrConfigurationBase) result = sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) result=sState.oData_AMRoctreeGrid->GetData(grid) for i=0, grid.nlevelmax do RamsesAmrLevelsFlags[i] = 0 IF (WIDGET_INFO(wAmrConfigurationBase, /VALID_ID)) EQ 0 THEN BEGIN wAmrConfigurationBase = WIDGET_BASE(TITLE='AMR Configuration',/ROW, XPAD=15, YPAD=10, SPACE=1) ;AMRMeshIJKboundaries=fltarr([6]) wRamsesAMRConfigBoundariesBase=LONARR(6) result = sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) result = sState.oData_AMRscaleValue->GetData(AMRscaleValue) result = sState.oData_wRamsesAmrLevelsAlpha->GetData(wRamsesAmrLevelsAlpha) result = sState.oData_wRamsesPlanesSelected->GetData(wRamsesPlanesSelected) result = sState.oData_wRamsesAmrLevelsArrays->GetData(wRamsesAmrLevelsArrays) result = sState.oData_wRamsesAMRConfigTranslate->GetData(wRamsesAMRConfigTranslate) result = sState.oData_colorAMRBoundarieValue->GetData(colorValue) result = sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) DefineAmrConfigurationWidget, $ wAmrConfigurationBase, $ RamsesAmrLevelsArrays, $ RamsesAmrLevelsAlpha, $ wRamsesAmrLevelsArrays, $ wRamsesAmrLevelsAlpha, $ RamsesAmrLevelsColors, $ wRamsesXAMRBoundariesBase, $ wRamsesYAMRBoundariesBase, $ wRamsesZAMRBoundariesBase, $ wRamsesAMRConfigBoundariesBase, $ AMRMeshIJKboundaries, $ subAxisAMRBoundaries, $ AMRTranslateBoundaries, $ wRamsesAMRConfigTranslate, $ wRamsesAMRConfigScaleSlider, $ wRamsesAMRConfigScaleValue, $ AMRscaleValue, $ wRamsesPlanesSelected, $ planesSelected, $ grid.nlevelmax, $ colorValue result = sState.oData_wRamsesPlanesSelected->SetData(wRamsesPlanesSelected) result = sState.oData_wRamsesAmrLevelsAlpha->SetData(wRamsesAmrLevelsAlpha) result = sState.oData_wRamsesAmrLevelsArrays->SetData(wRamsesAmrLevelsArrays) result = sState.oData_amrTranslateBoundaries->SetData(AMRTranslateBoundaries) result = sState.oData_colorAMRBoundarieValue->SetData(colorValue) result = sState.oData_wRamsesAMRConfigTranslate->SetData(wRamsesAMRConfigTranslate) result = sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) result = sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) result = sState.oData_wRamsesXAMRBoundariesBase->SetData(wRamsesXAMRBoundariesBase) result = sState.oData_wRamsesYAMRBoundariesBase->SetData(wRamsesYAMRBoundariesBase) result = sState.oData_wRamsesZAMRBoundariesBase->SetData(wRamsesZAMRBoundariesBase) result = sState.oData_subAxisAMRBoundaries->SetData(subAxisAMRBoundaries) result = sState.oData_AMRscaleValue->SetData(AMRscaleValue) ENDIF result = sState.oData_AMRoctreeGrid->GetData(grid) result = sState.oData_Polylines->GetData(polylines) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) Model3D = oAmrModel3D[0] Model2D = oAmrModel2D[0] value = where(planesSelected ne 0, count) if count eq 0 then is3DModelDrawn = 1 else is3DModelDrawn = 0 drawTheAmrGeometry, grid, Model3D, Model2D, $ RamsesAmrLevelsArrays, AMRMeshIJKboundaries, $ polylines,0, polylinesPlanes, $ RamsesAmrLevelsColors, RamsesAmrLevelsAlpha, RamsesAmrLevelsFlags, $ is3DModelDrawn, planesSelected result = sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result = sState.oData_RamsesAmrLevelsFlags->SetData(RamsesAmrLevelsFlags) result = sState.oData_Polylines->SetData(polylines) result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) WIDGET_CONTROL, sState.wObjectControlDisplayAMR,SENSITIVE=1 WIDGET_CONTROL, sState.wObjectControlConfigureAMR,SENSITIVE=1 sState.drawWindowID3D->Draw, sState.oView3D WIDGET_CONTROL, wAmrConfigurationBase, SET_UVALUE=sState WIDGET_CONTROL,wAmrConfigurationBase , /REALIZE XMANAGER,'SDvis_Event',wAmrConfigurationBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="AmrConfiguration_Cleanup",/JUST_REG result = sState.oData_wAmrConfigurationBase->SetData(wAmrConfigurationBase) endif else if uVal EQ 'GEO_DISPLAY_'+UVAL_EXT then begin if is3DModelDrawn eq 1 then $ oAmrModel3D[0]->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) $ else $ oAmrModel2D[0]->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) geometryControlInfo[3] = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.drawWindowID3D->Draw, sState.oView3D endif else if uVal EQ 'GEO_CONFIGURE_'+UVAL_EXT then begin result = sState.oData_wAmrConfigurationBase->GetData(wAmrConfigurationBase) result = sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 IF (WIDGET_INFO(wAmrConfigurationBase, /VALID_ID)) EQ 0 THEN BEGIN wAmrConfigurationBase = WIDGET_BASE(TITLE='AMR Configuration',/ROW, XPAD=15, YPAD=10, SPACE=1) result = sState.oData_RamsesAmrLevelsArrays->GetData(RamsesAmrLevelsArrays) result = sState.oData_RamsesAmrLevelsColors->GetData(RamsesAmrLevelsColors) result = sState.oData_RamsesAmrLevelsAlpha->GetData(RamsesAmrLevelsAlpha) ;AMRMeshIJKboundaries=fltarr([6]) wRamsesAMRConfigBoundariesBase=LONARR(6) result = sState.oData_AMRoctreeGrid->GetData(grid) result = sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) result = sState.oData_AMRscaleValue->GetData(AMRscaleValue) result = sState.oData_wRamsesAmrLevelsAlpha->GetData(wRamsesAmrLevelsAlpha) result = sState.oData_wRamsesPlanesSelected->GetData(wRamsesPlanesSelected) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_wRamsesAmrLevelsArrays->GetData(wRamsesAmrLevelsArrays) result = sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) result = sState.oData_colorAMRBoundarieValue->GetData(colorValue) result = sState.oData_wRamsesAMRConfigTranslate->GetData(wRamsesAMRConfigTranslate) result = sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) DefineAmrConfigurationWidget, $ wAmrConfigurationBase, $ RamsesAmrLevelsArrays, $ RamsesAmrLevelsAlpha, $ wRamsesAmrLevelsArrays, $ wRamsesAmrLevelsAlpha, $ RamsesAmrLevelsColors, $ wRamsesXAMRBoundariesBase, $ wRamsesYAMRBoundariesBase, $ wRamsesZAMRBoundariesBase, $ wRamsesAMRConfigBoundariesBase, $ AMRMeshIJKboundaries, $ subAxisAMRBoundaries, $ AMRTranslateBoundaries, $ wRamsesAMRConfigTranslate, $ wRamsesAMRConfigScaleSlider, $ wRamsesAMRConfigScaleValue, $ AMRscaleValue, $ wRamsesPlanesSelected, $ planesSelected, $ grid.nlevelmax, $ colorValue result = sState.oData_wRamsesAmrLevelsArrays->SetData(wRamsesAmrLevelsArrays) result = sState.oData_wRamsesAmrLevelsAlpha->SetData(wRamsesAmrLevelsAlpha) result = sState.oData_wRamsesPlanesSelected->SetData(wRamsesPlanesSelected) result = sState.oData_amrTranslateBoundaries->SetData(AMRTranslateBoundaries) result = sState.oData_colorAMRBoundarieValue->SetData(colorValue) result = sState.oData_wRamsesAMRConfigTranslate->SetData(wRamsesAMRConfigTranslate) result = sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) result = sState.oData_wRamsesXAMRBoundariesBase->SetData(wRamsesXAMRBoundariesBase) result = sState.oData_wRamsesYAMRBoundariesBase->SetData(wRamsesYAMRBoundariesBase) result = sState.oData_wRamsesZAMRBoundariesBase->SetData(wRamsesZAMRBoundariesBase) result = sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) result = sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result = sState.oData_subAxisAMRBoundaries->SetData(subAxisAMRBoundaries) result = sState.oData_AMRscaleValue->SetData(AMRscaleValue) ENDIF result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->SetData(is3DModelDrawn) WIDGET_CONTROL, wAmrConfigurationBase, SET_UVALUE=sState WIDGET_CONTROL,wAmrConfigurationBase , /REALIZE XMANAGER,'SDvis_Event',wAmrConfigurationBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="AmrConfiguration_Cleanup",/JUST_REG result = sState.oData_wAmrConfigurationBase->SetData(wAmrConfigurationBase) endif result = sState.oData_geometryControlInfo->SetData(geometryControlInfo) end ;****************************************************************************** ; Geometry Object control widget builder ; ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, june 2006. ; May, 2007: AMR section added by Yncia Fidaali ;- pro GeometryObjectControlWidget, $ wGeometryObjectControlBase, $ nxg, $ DataFormat, $ wObjectControlDisplayBounds, $ wObjectControlConfigureBounds , $ wObjectControlDisplayAxis , $ wObjectControlConfigureAxis , $ wObjectControlDisplayDomains , $ wObjectControlConfigureDomains, $ wObjectControlGenerateAMR, $ wObjectControlDisplayAMR, $ wObjectControlConfigureAMR, $ geometryControlInfo wLabel = WIDGET_LABEL(wGeometryObjectControlBase,/ALIGN_CENTER, $ VALUE='***************** AXIS AND BOUNDARIES *****************') wObjectControlBaseBounds = WIDGET_BASE(wGeometryObjectControlBase,/ROW) UVAL_EXT='BOUNDS_' VAL_EXT=' volume boundaries ' wObjectControlGenerateBounds = WIDGET_BUTTON(wObjectControlBaseBounds,VALUE='generate', $ UVALUE='GEO_GENERATE_'+UVAL_EXT,/ALIGN_CENTER) wObjectControlDisplayBounds = WIDGET_DROPLIST(wObjectControlBaseBounds,$ VALUE=['show','hide'], UVALUE='GEO_DISPLAY_'+UVAL_EXT, SENSITIVE=1) WIDGET_CONTROL, wObjectControlDisplayBounds, SET_DROPLIST_SELECT=geometryControlInfo[0] wObjectControlConfigureBounds = WIDGET_BUTTON(wObjectControlBaseBounds,VALUE='configure', $ UVALUE='GEO_CONFIGURE_'+UVAL_EXT,/ALIGN_CENTER, SENSITIVE=1) wObjectControlLabelBounds = WIDGET_LABEL(wObjectControlBaseBounds,VALUE=VAL_EXT,/ALIGN_RIGHT) ;if nxg gt 0 then begin wObjectControlBaseAxis = WIDGET_BASE(wGeometryObjectControlBase,/ROW) UVAL_EXT='AXIS_' VAL_EXT=' axis system ' wObjectControlGenerateAxis = WIDGET_BUTTON(wObjectControlBaseAxis,VALUE='generate', $ UVALUE='GEO_GENERATE_'+UVAL_EXT,/ALIGN_CENTER) wObjectControlDisplayAxis = WIDGET_DROPLIST(wObjectControlBaseAxis,$ VALUE=['show','hide'], UVALUE='GEO_DISPLAY_'+UVAL_EXT, SENSITIVE=1) WIDGET_CONTROL, wObjectControlDisplayAxis, SET_DROPLIST_SELECT=geometryControlInfo[1] wObjectControlConfigureAxis = WIDGET_BUTTON(wObjectControlBaseAxis,VALUE='configure', $ UVALUE='GEO_CONFIGURE_'+UVAL_EXT,/ALIGN_CENTER, SENSITIVE=1) wObjectControlLabelAxis = WIDGET_LABEL(wObjectControlBaseAxis,VALUE=VAL_EXT,/ALIGN_RIGHT) wObjectControlBaseDomains = WIDGET_BASE(wGeometryObjectControlBase,/ROW) sensitive=0 if DataFormat eq 2 then sensitive=1 ; HDF if DataFormat eq 5 then sensitive=1 ; Jupiter UVAL_EXT='DOMAINS_' VAL_EXT=' domain decomposition ' wObjectControlGenerateDomains = WIDGET_BUTTON(wObjectControlBaseDomains,VALUE='generate', $ UVALUE='GEO_GENERATE_'+UVAL_EXT,/ALIGN_CENTER, SENSITIVE=sensitive) wObjectControlDisplayDomains = WIDGET_DROPLIST(wObjectControlBaseDomains,$ VALUE=['show','hide'], UVALUE='GEO_DISPLAY_'+UVAL_EXT, SENSITIVE=0) WIDGET_CONTROL, wObjectControlDisplayDomains, SET_DROPLIST_SELECT=geometryControlInfo[2] wObjectControlConfigureDomains = WIDGET_BUTTON(wObjectControlBaseDomains,VALUE='configure', $ UVALUE='GEO_CONFIGURE_'+UVAL_EXT,/ALIGN_CENTER, SENSITIVE=0) wObjectControlLabelDomains = WIDGET_LABEL(wObjectControlBaseDomains,VALUE=VAL_EXT,/ALIGN_RIGHT) wObjectControlBaseAMR = WIDGET_BASE(wGeometryObjectControlBase,/ROW) UVAL_EXT='AMR_' VAL_EXT=' amr ' sensitive=0 if DataFormat eq 3 then sensitive=1 ; RAMSES wObjectControlGenerateAMR = WIDGET_BUTTON(wObjectControlBaseAMR,VALUE='generate', $ UVALUE='GEO_GENERATE_'+UVAL_EXT,/ALIGN_CENTER, SENSITIVE=sensitive) wObjectControlDisplayAMR = WIDGET_DROPLIST(wObjectControlBaseAMR,$ VALUE=['show','hide'], UVALUE='GEO_DISPLAY_'+UVAL_EXT, SENSITIVE=sensitive) WIDGET_CONTROL, wObjectControlDisplayAMR, SET_DROPLIST_SELECT=geometryControlInfo[3] wObjectControlConfigureAMR = WIDGET_BUTTON(wObjectControlBaseAMR,VALUE='configure', $ UVALUE='GEO_CONFIGURE_'+UVAL_EXT,/ALIGN_CENTER, SENSITIVE=sensitive) wObjectControlLabelAMR = WIDGET_LABEL(wObjectControlBaseAMR,VALUE=VAL_EXT,/ALIGN_RIGHT) ; sControl={sState:sState, $ ; wObjectControlDisplayBounds:wObjectControlDisplayBounds , $ ; wObjectControlConfigureBounds:wObjectControlConfigureBounds , $ ; wObjectControlDisplayAxis:wObjectControlDisplayAxis , $ ; wObjectControlConfigureAxis:wObjectControlConfigureAxis , $ ; wObjectControlDisplayDomains:wObjectControlDisplayDomains , $ ; wObjectControlConfigureDomains:wObjectControlConfigureDomains, $ ; wObjectControlDisplayAMR:wObjectControlDisplayAMR, $ ; wObjectControlConfigureAMR:wObjectControlConfigureAMR} ;endif else begin ; sControl={sState:sState, $ ; wObjectControlDisplayBounds:wObjectControlDisplayBounds , $ ; wObjectControlConfigureBounds:wObjectControlConfigureBounds } ;endelse end ;****************************************************************************** ;****************************************************************************** ; Scene Control event handler ; ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, june 2006. ;- ; pro SceneObjectControlEvent, sEvent COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sEvent.id, GET_UVALUE=uVal WIDGET_CONTROL, sEvent.top, GET_UVALUE=hState sControl = *hState sState=sControl.sState UVAL_LIGHT=sControl.UVAL_LIGHT nvar=sControl.nvar for i=0,nvar-1 do begin UVAL_EXT='LIGHT_' if uVal EQ 'GENERATE_'+UVAL_EXT+UVAL_LIGHT[i] then begin sState.oLightPolygon[i]->SetProperty, HIDE=0 SDvis_Draw, sState endif else if uVal EQ 'DISPLAY_'+UVAL_EXT+UVAL_LIGHT[i] then begin sState.oLightPolygon[i]->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT+UVAL_LIGHT[i] then begin endif endfor UVAL_EXT='PIVOT_' if uVal EQ 'GENERATE_'+UVAL_EXT then begin ;help,sState.sScene,/struct sState.sScene.oPivot->SetProperty, HIDE=0 sState.sScene.oPivotRotation->SetProperty, HIDE=0 SDvis_Draw, sState endif else if uVal EQ 'DISPLAY_'+UVAL_EXT then begin sState.sScene.oPivot->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) sState.sScene.oPivotRotation->SetProperty, HIDE=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) SDvis_Draw, sState endif else if uVal EQ 'CONFIGURE_'+UVAL_EXT then begin endif end ;****************************************************************************** ;****************************************************************************** ; Scene Object control widget builder ; ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, june 2006. ;- ; pro SceneObjectControlWidget, sEvent, sState ;help,sEvent.top title='Scene Objects control' wSceneObjectControlBase = WIDGET_BASE(TITLE=title, $ GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=1, YPAD=1, SPACE=1) wLabel = WIDGET_LABEL(wSceneObjectControlBase,/ALIGN_CENTER, $ VALUE='***************** SCENE ILLUMINATION ******************') nvar=8 ;; 4 lights VAL=STRARR([nvar]) VAL[0]='ambient light' VAL[1]='frontal light' VAL[2]='right light' VAL[3]='bottom light' VAL[4]='back light' VAL[5]='left light' VAL[6]='top light' VAL[7]='center divergent' UVAL_LIGHT=STRARR([nvar]) UVAL_LIGHT[0]='AMBIENT' UVAL_LIGHT[1]='FRONTAL' UVAL_LIGHT[2]='RIGHT' UVAL_LIGHT[3]='BOTTOM' UVAL_LIGHT[4]='BACK' UVAL_LIGHT[5]='LEFT' UVAL_LIGHT[6]='TOP' UVAL_LIGHT[7]='CENTER' wObjectControlBaseLight=LONARR(nvar) wObjectControlGenerateLight=LONARR(nvar) wObjectControlDisplayLight=LONARR(nvar) wObjectControlConfigureLight=LONARR(nvar) wObjectControlLabelLight=LONARR(nvar) for i=0,nvar-1 do begin if i ne 4 then begin wObjectControlBaseLight[i] = WIDGET_BASE(wSceneObjectControlBase,/ROW) UVAL_EXT='LIGHT_' wObjectControlGenerateLight[i] = WIDGET_BUTTON(wObjectControlBaseLight[i],VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT+UVAL_LIGHT[i],/ALIGN_CENTER,SENSITIVE=1) wObjectControlDisplayLight[i] = WIDGET_DROPLIST(wObjectControlBaseLight[i],$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT+UVAL_LIGHT[i]) wObjectControlConfigureLight[i] = WIDGET_BUTTON(wObjectControlBaseLight[i],VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT+UVAL_LIGHT[i],/ALIGN_CENTER,SENSITIVE=1) wObjectControlLabelLight[i] = WIDGET_LABEL(wObjectControlBaseLight[i],VALUE=VAL[i],/ALIGN_RIGHT) sState.oLightPolygon[i]->GetProperty, HIDE=hide WIDGET_CONTROL,wObjectControlDisplayLight[i],SET_DROPLIST_SELECT=hide endif endfor wLabel = WIDGET_LABEL(wSceneObjectControlBase,/ALIGN_CENTER, $ VALUE='********************* LANDMARKS ***********************') wObjectControlBasePivot = WIDGET_BASE(wSceneObjectControlBase,/ROW) UVAL_EXT='PIVOT_' wObjectControlGeneratePivot = WIDGET_BUTTON(wObjectControlBasePivot,VALUE='generate', $ UVALUE='GENERATE_'+UVAL_EXT,/ALIGN_CENTER,SENSITIVE=1) wObjectControlDisplayPivot = WIDGET_DROPLIST(wObjectControlBasePivot,$ VALUE=['show','hide'], UVALUE='DISPLAY_'+UVAL_EXT) wObjectControlConfigurePivot = WIDGET_BUTTON(wObjectControlBasePivot,VALUE='configure', $ UVALUE='CONFIGURE_'+UVAL_EXT,/ALIGN_CENTER,SENSITIVE=1) wObjectControlLabelPivot = WIDGET_LABEL(wObjectControlBasePivot,VALUE='pivot points',/ALIGN_RIGHT) sControl={sState:sState,UVAL_LIGHT:UVAL_LIGHT,nvar:nvar} WIDGET_CONTROL, sEvent.top, Set_UValue=sState hState = PTR_NEW(sControl, /NO_COPY) WIDGET_CONTROL, wSceneObjectControlBase, SET_UVALUE=hState WIDGET_CONTROL, wSceneObjectControlBase, /REALIZE XMANAGER,'SDvis_Event',wSceneObjectControlBase,EVENT_HANDLER='SceneObjectControlEvent',/JUST_REG end ; ; ;****************************************************************************** ; View Properties widget builder ; ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, march 2006. ;- ; PRO DefineVueWidget,eye, xyzrot, $ wDefineVueBase, $ wDefineVueEyeBase, $ wDefineVueNearBase, $ wDefineVueFarBase, $ wDefineVueZBright, $ wDefineVueZDim, $ ;wDefineVueLabel, $ wXSlider, $ wYSlider, $ wZSlider wDefineVueEyeBase = CW_FIELD(wDefineVueBase,/FLOATING,XSIZE=8, $ TITLE='Distance from the eyepoint to the viewplane (Z=0) ',$ UVALUE='VIEWEYE',VALUE=eye(0),/RETURN_EVENTS) wDefineVueNearBase = CW_FIELD(wDefineVueBase,/FLOATING,XSIZE=8, $ TITLE='Near clipping plane ',$ UVALUE='VIEWNEAR',VALUE=eye(1),/RETURN_EVENTS) wDefineVueFarBase = CW_FIELD(wDefineVueBase,/FLOATING,XSIZE=8, $ TITLE='Far clipping plane ',$ UVALUE='VIEWFAR',VALUE=eye(2),/RETURN_EVENTS) wDefineVueWide =WIDGET_BUTTON (wDefineVueBase,$ UVALUE='VIEWWIDE',VALUE=' Preset Wide Angle ') wDefineVueNoClip =WIDGET_BUTTON (wDefineVueBase,$ UVALUE='VIEWNOCLIP',VALUE=' No Clipping ') wDefineVueReset =WIDGET_BUTTON (wDefineVueBase,$ UVALUE='VIEWRESET',VALUE=' Reset Initial Values ') wDefineVueIDLdefault =WIDGET_BUTTON (wDefineVueBase,$ UVALUE='VIEWIDLDEF',VALUE=' Default IDL Values ') wDefineVueLabel0=WIDGET_LABEL(wDefineVueBase, $ VALUE=' ') wDefineVueLabel1=WIDGET_LABEL(wDefineVueBase, $ VALUE='Depth Cueing ') wDefineVueLabel2=WIDGET_LABEL(wDefineVueBase, $ VALUE='Zbright < Zdim : rendering darken with depth ') wDefineVueLabel2=WIDGET_LABEL(wDefineVueBase, $ VALUE='Zbright > Zdim : rendering brightens with depth ') wDefineVueZbright = CW_FIELD(wDefineVueBase,/FLOATING,XSIZE=8, $ TITLE='Zbright ',$ UVALUE='VIEWZBRIGHT',VALUE=eye(3),/ALL_EVENTS) wDefineVueZdim = CW_FIELD(wDefineVueBase,/FLOATING,XSIZE=8, $ TITLE='Zdim ',$ UVALUE='VIEWZDIM',VALUE=eye(4),/ALL_EVENTS) wDefineVueStrongHaze =WIDGET_BUTTON (wDefineVueBase,$ UVALUE='VIEWSTRONGHAZE',VALUE=' Preset deep Haze effect ') wDefineVueWeakHaze =WIDGET_BUTTON (wDefineVueBase,$ UVALUE='VIEWWEAKHAZE',VALUE=' Preset slight Haze effect ') ;wDefineVueLabel=WIDGET_LABEL(wDefineVueBase, VALUE='test') ;print,'valid wDefineVueEyeBase=',WIDGET_INFO(wDefineVueEyeBase, /VALID_ID) ;wSliderBase = WIDGET_BASE(wDefineVueBase, /BASE_ALIGN_CENTER, $ ; YPAD=8, XPAD=11,/FRAME, /COLUMN,SPACE=1) ; Initial rotation values, also used below when ; initializing model ;xRot = -60 ;yRot = 20 ;zRot = 0 ;print,'DefineVueWidget xyzrot=',xyzrot wSliderLabel = WIDGET_LABEL(wDefineVueBase, $ VALUE='Rotation', /ALIGN_CENTER) wXSlider = WIDGET_SLIDER(wDefineVueBase, $ UVALUE='SLIDER', VALUE=xyzrot[0], MINIMUM=-180, MAXIMUM=180,/DRAG) wSliderXLabel = WIDGET_LABEL(wDefineVueBase, $ VALUE='X Axis', /ALIGN_CENTER) wYSlider = WIDGET_SLIDER(wDefineVueBase, $ UVALUE='SLIDER', VALUE=xyzrot[1], MINIMUM=-180, MAXIMUM=180,/DRAG) wSliderYLabel = WIDGET_LABEL(wDefineVueBase, $ VALUE='Y Axis', /ALIGN_CENTER) wZSlider = WIDGET_SLIDER(wDefineVueBase, $ UVALUE='SLIDER', VALUE=xyzrot[2], MINIMUM=-180, MAXIMUM=180,/DRAG) wSliderZLabel = WIDGET_LABEL(wDefineVueBase, $ VALUE='Z Axis', /ALIGN_CENTER) END ;****************************************************************************** ; Scale function ; ; MODIFICATION HISTORY: ; Written by: Yncia Fidaali, may 2007. ;- ; ; function calculScaleValue, value if value lt 1 then return, value if value eq 2 then return, 1 return, 1/(2-value) end ;****************************************************************************** ; Scale function ; ; MODIFICATION HISTORY: ; Written by: Yncia Fidaali, may 2007. ;- ; ; function calculScaleValueInverse, value if value lt 1 then return, value if value eq 0 then return, 1 return, 2 - 1/value end ;****************************************************************************** ; Boundaries Widget builder ; ; MODIFICATION HISTORY: ; Written by: Yncia Fidaali, may 2007. ;- ; PRO DefineBoundariesWidget, $ wBoundariesBase, $ wRamsesXBoundariesBase, $ wRamsesYBoundariesBase, $ wRamsesZBoundariesBase, $ wRamsesConfigBoundariesBase, $ MeshIJKboundaries, $ oModelObjects3D, $ subAxisBoundaries, $ TranslateBoundaries, $ wRamsesConfigTranslate, $ wRamsesConfigScaleSlider, $ wRamsesConfigScaleValue, $ scaleValue, $ color wScaleBase = WIDGET_BASE(wBoundariesBase, /COLUMN) wSliderBoundariesLabel = WIDGET_LABEL(wScaleBase, $ VALUE='Coordinates', /ALIGN_CENTER) wRamsesXBoundariesBase = WIDGET_BASE(wScaleBase, /ROW) wSliderBoundariesXLabel = WIDGET_LABEL(wScaleBase, $ VALUE='X Axis', /ALIGN_CENTER) wRamsesConfigBoundariesBase[0] = CW_FSLIDER(wRamsesXBoundariesBase, $ UVALUE='MESHIJKXMIN', VALUE=MeshIJKboundaries[0], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigBoundariesBase[1] = CW_FSLIDER(wRamsesXBoundariesBase, $ UVALUE='MESHIJKXMAX', VALUE=MeshIJKboundaries[1], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigTranslate[0] = CW_BGROUP(wRamsesXBoundariesBase, 'Translate', $ UVALUE='TRANSLATEX', SET_VALUE=TranslateBoundaries[0], /NONEXCLUSIVE) wRamsesYBoundariesBase = WIDGET_BASE(wScaleBase, /ROW) wSliderBoundariesYLabel = WIDGET_LABEL(wScaleBase, $ VALUE='Y Axis', /ALIGN_CENTER) wRamsesConfigBoundariesBase[2] = CW_FSLIDER(wRamsesYBoundariesBase, $ UVALUE='MESHIJKYMIN', VALUE=MeshIJKboundaries[2], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigBoundariesBase[3] = CW_FSLIDER(wRamsesYBoundariesBase, $ UVALUE='MESHIJKYMAX', VALUE=MeshIJKboundaries[3], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigTranslate[1] = CW_BGROUP(wRamsesYBoundariesBase, 'Translate', $ UVALUE='TRANSLATEY', SET_VALUE=TranslateBoundaries[1], /NONEXCLUSIVE) wRamsesZBoundariesBase = WIDGET_BASE(wScaleBase, /ROW) wSliderBoundariesZLabel = WIDGET_LABEL(wScaleBase, $ VALUE='Z Axis', /ALIGN_CENTER) wRamsesConfigBoundariesBase[4] = CW_FSLIDER(wRamsesZBoundariesBase, $ UVALUE='MESHIJKZMIN', VALUE=MeshIJKboundaries[4], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigBoundariesBase[5] = CW_FSLIDER(wRamsesZBoundariesBase, $ UVALUE='MESHIJKZMAX', VALUE=MeshIJKboundaries[5], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigTranslate[2] = CW_BGROUP(wRamsesZBoundariesBase, 'Translate', $ UVALUE='TRANSLATEZ', SET_VALUE=TranslateBoundaries[1], /NONEXCLUSIVE) wRamsesConfigScaleBase = WIDGET_BASE(wScaleBase, /ROW) wRamsesConfigScaleSlider = CW_FSLIDER( wRamsesConfigScaleBase, UVALUE='SCALE_BOUNDARIES', $ MINIMUM=0, MAXIMUM=2L, VALUE=scaleValue, /DRAG) value=calculScaleValue(scaleValue) wRamsesConfigScaleValue = CW_FIELD(wRamsesConfigScaleBase, TITLE=" Scale ", /FLOATING, $ UVALUE='CHANGE_SCALE_BOUNDARIES', VALUE=value,/RETURN_EVENTS) wRamsesSetBundariesCubic = WIDGET_BUTTON(wScaleBase, UVALUE='PUT_BOUNDARIES_AS_A_CUBIC', $ VALUE=" Make a cube ") wRamsesConfigColorBase = WIDGET_BASE(wScaleBase, /ROW) wColorLabel = WIDGET_LABEL(wRamsesConfigColorBase, VALUE='Color') wChooseColor = WIDGET_DROPLIST(wRamsesConfigColorBase,TAB_MODE=1,VALUE=[ $ 'white' , $ 'red' , $ 'green' , $ 'blue' , $ 'orange' , $ 'pink' , $ 'purple' , $ 'light blue', $ 'yellow' , $ 'black'], UVALUE='CHOOSE_BOUNDARIE_COLOR' ) WIDGET_CONTROL, wChooseColor, SET_DROPLIST_SELECT=color DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries END ;****************************************************************************** ; Define widget for the configuration of AMR ; ; MODIFICATION HISTORY: ; Written by: Yncia Fidaali, june 2007. ; PRO DefineAmrConfigurationWidget, $ wAmrConfigurationBase, $ RamsesAmrLevelsArrays, $ RamsesAmrLevelsAlpha, $ wRamsesAmrLevelsArrays, $ wRamsesAmrLevelsAlpha, $ colors, $ wRamsesXBoundariesBase, $ wRamsesYBoundariesBase, $ wRamsesZBoundariesBase, $ wRamsesConfigBoundariesBase, $ MeshIJKboundaries, $ subAxisBoundaries, $ TranslateBoundaries, $ wRamsesConfigTranslate, $ wRamsesConfigScaleSlider, $ wRamsesConfigScaleValue, $ scaleValue, $ wRamsesPlanesSelected, $ planesSelected, $ nlevelmax, $ color subAxisBoundaries[0]->SetProperty, hide=0 subAxisBoundaries[1]->SetProperty, hide=0 subAxisBoundaries[2]->SetProperty, hide=0 subAxisBoundaries[3]->SetProperty, hide=0 subAxisBoundaries[4]->SetProperty, hide=0 subAxisBoundaries[5]->SetProperty, hide=0 subAxisBoundaries[6]->SetProperty, hide=0 subAxisBoundaries[7]->SetProperty, hide=0 subAxisBoundaries[8]->SetProperty, hide=0 subAxisBoundaries[9]->SetProperty, hide=0 subAxisBoundaries[10]->SetProperty, hide=0 subAxisBoundaries[11]->SetProperty, hide=0 wAMRBaseOptions = WIDGET_BASE(wAmrConfigurationBase, /BASE_ALIGN_CENTER, $ XPAD=3, YPAD=5, /FRAME, /COLUMN) wAMRLabel1 = WIDGET_LABEL(wAMRBaseOptions, VALUE='Levels') wAMRBaseOptionsLevels = lonarr(nlevelmax) wRamsesAmrLevelsArrays = lonarr(nlevelmax) wColorsAmrLevels = lonarr(nlevelmax) wRamsesAmrLevelsAlpha = lonarr(nlevelmax) for i=0, nlevelmax-1 do begin wAMRBaseOptionsLevels[i] = WIDGET_BASE(wAMRBaseOptions, /BASE_ALIGN_CENTER, $ /FRAME, COLUMN=3) wRamsesAmrLevelsArrays[i] = CW_BGROUP(wAMRBaseOptionsLevels[i], String(i+1), $ UVALUE='AMR_ARRAYS_'+String(i), SET_VALUE=RamsesAmrLevelsArrays[i], /NONEXCLUSIVE) wColorsAmrLevels[i] = WIDGET_DROPLIST(wAMRBaseOptionsLevels[i],TAB_MODE=1,VALUE=[ $ 'white' , $ 'red' , $ 'green' , $ 'blue' , $ 'orange' , $ 'pink' , $ 'purple' , $ 'light blue', $ 'yellow' , $ 'black'], UVALUE='CHOOSE_COLOR_'+String(i) ) WIDGET_CONTROL, wColorsAmrLevels[i], SET_DROPLIST_SELECT=colors[i] wRamsesAmrLevelsAlpha[i] = WIDGET_SLIDER(wAMRBaseOptionsLevels[i],UVALUE='CHOOSE_ALPHA_'+String(i),$ VALUE=RamsesAmrLevelsAlpha[i],MINIMUM=0.,MAXIMUM=100.) endfor wAMRBaseOptionsCubic = WIDGET_BASE(wAmrConfigurationBase, /COLUMN, /FRAME) wScaleBase = WIDGET_BASE(wAMRBaseOptionsCubic, /COLUMN) wLabelsBase = WIDGET_BASE(wAMRBaseOptionsCubic) wSliderBoundariesLabel = WIDGET_LABEL(wScaleBase, VALUE='Coordonnates', /ALIGN_CENTER) wRamsesXBoundariesBase = WIDGET_BASE(wScaleBase, /ROW) wSliderBoundariesXLabel = WIDGET_LABEL(wScaleBase, VALUE='X Axis', /ALIGN_CENTER) wRamsesConfigBoundariesBase[0] = CW_FSLIDER(wRamsesXBoundariesBase, $ UVALUE='AMRMESHIJKXMIN', VALUE=MeshIJKboundaries[0], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigBoundariesBase[1] = CW_FSLIDER(wRamsesXBoundariesBase, $ UVALUE='AMRMESHIJKXMAX', VALUE=MeshIJKboundaries[1], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigTranslate[0] = CW_BGROUP(wRamsesXBoundariesBase, 'Translate on', $ UVALUE='AMRTRANSLATEX', SET_VALUE=TranslateBoundaries[0], /NONEXCLUSIVE) wRamsesYBoundariesBase = WIDGET_BASE(wScaleBase, /ROW) wSliderBoundariesYLabel = WIDGET_LABEL(wScaleBase, $ VALUE='Y Axis', /ALIGN_CENTER) wRamsesConfigBoundariesBase[2] = CW_FSLIDER(wRamsesYBoundariesBase, $ UVALUE='AMRMESHIJKYMIN', VALUE=MeshIJKboundaries[2], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigBoundariesBase[3] = CW_FSLIDER(wRamsesYBoundariesBase, $ UVALUE='AMRMESHIJKYMAX', VALUE=MeshIJKboundaries[3], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigTranslate[1] = CW_BGROUP(wRamsesYBoundariesBase, 'Translate on', $ UVALUE='AMRTRANSLATEY', SET_VALUE=TranslateBoundaries[1], /NONEXCLUSIVE) wRamsesZBoundariesBase = WIDGET_BASE(wScaleBase, /ROW) wSliderBoundariesZLabel = WIDGET_LABEL(wScaleBase, $ VALUE='Z Axis', /ALIGN_CENTER) wRamsesConfigBoundariesBase[4] = CW_FSLIDER(wRamsesZBoundariesBase, $ UVALUE='AMRMESHIJKZMIN', VALUE=MeshIJKboundaries[4], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigBoundariesBase[5] = CW_FSLIDER(wRamsesZBoundariesBase, $ UVALUE='AMRMESHIJKZMAX', VALUE=MeshIJKboundaries[5], MINIMUM=0L, MAXIMUM=1L,/DRAG, /EDIT) wRamsesConfigTranslate[2] = CW_BGROUP(wRamsesZBoundariesBase, 'Translate on', $ UVALUE='AMRTRANSLATEZ', SET_VALUE=TranslateBoundaries[1], /NONEXCLUSIVE) wRamsesConfigScaleBase = WIDGET_BASE(wScaleBase, /ROW) wRamsesConfigScaleSlider = CW_FSLIDER( wRamsesConfigScaleBase, UVALUE='AMR_SCALE_BOUNDARIES', $ MINIMUM=0, MAXIMUM=2L, VALUE=scaleValue, /DRAG) value=calculScaleValue(scaleValue) wRamsesConfigScaleValue = CW_FIELD(wRamsesConfigScaleBase, TITLE=" Scale ", /FLOATING, $ UVALUE='AMR_CHANGE_SCALE_BOUNDARIES', VALUE=value,/RETURN_EVENTS) wRamsesSetBundariesCubic = WIDGET_BUTTON(wScaleBase, UVALUE='AMR_PUT_BOUNDARIES_AS_A_CUBIC', $ VALUE=" Make a cubic ") DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries wRamsesPlanesBase = WIDGET_BASE(wAMRBaseOptionsCubic, /COLUMN) wRamsesPlanesBox = lonarr(3) wRamsesPlanesBox[0] = WIDGET_BASE(wRamsesPlanesBase, /ROW) wRamsesPlanesBox[1] = WIDGET_BASE(wRamsesPlanesBase, /ROW) wRamsesPlanesBox[2] = WIDGET_BASE(wRamsesPlanesBase, /ROW) wRamsesPlanesSelected = lonarr(6) wRamsesPlanesSelected[0] = CW_BGROUP(wRamsesPlanesBox[0], 'xy direct', UVALUE='PLANESXYD', SET_VALUE=planesSelected[0], $ /NONEXCLUSIVE) wRamsesPlanesSelected[1] = CW_BGROUP(wRamsesPlanesBox[0], 'xy opposite', UVALUE='PLANESXYO', SET_VALUE=planesSelected[1], $ /NONEXCLUSIVE) wRamsesPlanesSelected[2] = CW_BGROUP(wRamsesPlanesBox[1], 'yz direct', UVALUE='PLANESYZD', SET_VALUE=planesSelected[2], $ /NONEXCLUSIVE) wRamsesPlanesSelected[3] = CW_BGROUP(wRamsesPlanesBox[1], 'yz opposite', UVALUE='PLANESYZO', SET_VALUE=planesSelected[3], $ /NONEXCLUSIVE) wRamsesPlanesSelected[4] = CW_BGROUP(wRamsesPlanesBox[2], 'xz direct', UVALUE='PLANESXZD', SET_VALUE=planesSelected[4], $ /NONEXCLUSIVE) wRamsesPlanesSelected[5] = CW_BGROUP(wRamsesPlanesBox[2], 'xz opposite', UVALUE='PLANESXZO', SET_VALUE=planesSelected[5], $ /NONEXCLUSIVE) wRamsesConfigColorBase = WIDGET_BASE(wAMRBaseOptionsCubic, /ROW) wColorLabel = WIDGET_LABEL(wRamsesConfigColorBase, VALUE='Color') wChooseColor = WIDGET_DROPLIST(wRamsesConfigColorBase,TAB_MODE=1,VALUE=[ $ 'white' , $ 'red' , $ 'green' , $ 'blue' , $ 'orange' , $ 'pink' , $ 'purple' , $ 'light blue', $ 'yellow' , $ 'black'], UVALUE='CHOOSE_AMR_BOUNDARIE_COLOR' ) WIDGET_CONTROL, wChooseColor, SET_DROPLIST_SELECT=color END ; ;****************************************************************************** ; MPEG Widget builder ; ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, july 2007. ;- ; PRO DefineMpegWidget,$ wDefineMpegBase, $ mpegWidgets, $ mpegParameters, $ mpegSensitive format=mpegParameters[0] quality=mpegParameters[1] bitrate=mpegParameters[2] framerate=mpegParameters[3] motion_vec_length=mpegParameters[4] iframe_gap=mpegParameters[5] interlaced=mpegParameters[6] ;;; mpeg widgets ID ; ; 0 : Format MPEG1/MPEG2 ; 1 : Quality ; 2 : Bitrate ; 3 : frame rate ; 4 : Motion vectors length ; 5 : I Frame gap ; 6 : Interlacing ; 7 : preset ; ; 10 : create ; 11 : start ; 12 : pause ; 13 : resume ; 14 : save wMpegTopLevelBase = WIDGET_BASE(wDefineMpegBase,/COLUMN) wMpegSuperiorBase = WIDGET_BASE(wMpegTopLevelBase,/ROW) wMpegTopLeftBase = WIDGET_BASE(wMpegSuperiorBase,/COLUMN) wMpegBase = WIDGET_BASE(wMpegTopLeftBase,/ROW) mpegWidgets[10] = WIDGET_BUTTON(wMpegBase, VALUE=' Create Mpeg object ',$ UVALUE='MPEG-CREATE',/DYNAMIC_RESIZE, SENSITIVE=mpegSensitive[10] ) wMpegBase = WIDGET_BASE(wMpegTopLeftBase,/ROW) mpegWidgets[11] = WIDGET_BUTTON(wMpegBase, VALUE=' Start storing views in the Mpeg object ',$ UVALUE='MPEG-START', SENSITIVE=mpegSensitive[11]) wMpegBase = WIDGET_BASE(wMpegTopLeftBase,/ROW) mpegWidgets[12] = WIDGET_BUTTON(wMpegBase, VALUE=' Pause storing views in the Mpeg object ',$ UVALUE='MPEG-PAUSE', SENSITIVE=mpegSensitive[12]) wMpegBase = WIDGET_BASE(wMpegTopLeftBase,/ROW) mpegWidgets[13] = WIDGET_BUTTON(wMpegBase, VALUE=' Resume storing views in the Mpeg object',$ UVALUE='MPEG-RESUME', SENSITIVE=mpegSensitive[13]) wMpegBase = WIDGET_BASE(wMpegTopLeftBase,/ROW) mpegWidgets[14] = WIDGET_BUTTON(wMpegBase, VALUE=' Save Mpeg object in Mpeg file ',$ UVALUE='MPEG-SAVE', SENSITIVE=mpegSensitive[14]) wMpegTopRightBase = WIDGET_BASE(wMpegSuperiorBase,/COLUMN,/FRAME) wLabel = WIDGET_LABEL(wMpegTopRightBase,VALUE='When creating MPEG files, you must be aware of the capabilities of the MPEG', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopRightBase,VALUE='decoder you will be using to view it. Some decoders only support a limited', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopRightBase,VALUE='set of sampling and bitrate parameters to normalize computational complexity,', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopRightBase,VALUE='buffer size, and memory bandwidth.', /ALIGN_LEFT) wMpegTopBase = WIDGET_BASE(wMpegTopLevelBase,/COLUMN) wMpegBase = WIDGET_BASE(wMpegTopBase,/ROW) mpegWidgets[0] = WIDGET_DROPLIST(wMpegBase, SENSITIVE=mpegSensitive[0], $ VALUE=['MPEG1','MPEG2'], $ UVALUE='MPEG-FORMAT', TITLE='format :') WIDGET_CONTROL, mpegWidgets[0], SET_DROPLIST_SELECT=format mpegWidgets[3] = WIDGET_DROPLIST(wMpegBase, SENSITIVE=mpegSensitive[3], $ VALUE=['23.976 frames/sec: NTSC encapsulated film rate', $ '24 frames/sec: Standard international film rate', $ '25 frames/sec: PAL video frame rate', $ '29.97 frames/sec: NTSC video frame rate', $ '30 frames/sec: NTSC drop frame video frame rate (the default)', $ '50 frames/sec: Double frame rate/progressive PAL', $ '59.94 frames/sec: Double frame rate NTSC ', $ '60 frames/sec: Double frame rate NTSC drop frame video'],$ UVALUE='MPEG-FRAMERATE', TITLE=' frame rate :') WIDGET_CONTROL, mpegWidgets[3], SET_DROPLIST_SELECT=framerate-1 wMpegQualityBase = WIDGET_BASE(wMpegTopBase,/COLUMN,/FRAME) wLabel = WIDGET_LABEL(wMpegQualityBase, /ALIGN_LEFT, $ VALUE='Quality is determined by the bitrate, the Montion vector length, and the I Frame gap') wLabel = WIDGET_LABEL(wMpegQualityBase, /ALIGN_LEFT, $ VALUE='use the controls below to act simultaneously on the 3 parameters') wMpegBase = WIDGET_BASE(wMpegQualityBase,/ROW) mpegWidgets[7] = WIDGET_DROPLIST(wMpegBase, SENSITIVE=mpegSensitive[7], $ VALUE=['default parameters', $ 'Low quality',$ 'Medium quality',$ 'High quality',$ 'Max quality'],$ UVALUE='MPEG-PRESET', TITLE='Predefined quality settings :') wMpegBase3 = WIDGET_BASE(wMpegQualityBase,/ROW) wLabel = WIDGET_LABEL(wMpegBase3,VALUE='quality :') mpegWidgets[1] = WIDGET_SLIDER( wMpegBase3, SENSITIVE=mpegSensitive[1], $ UVALUE='MPEG-QUALITY', $ VALUE=quality, $ MINIMUM=1., MAXIMUM=100.,/DRAG);,SENSITIVE=0) wLabel = WIDGET_LABEL(wMpegBase3, $ VALUE=' specifies the quality at which the MPEG stream is to be stored') wLabel = WIDGET_LABEL(wMpegQualityBase, /ALIGN_LEFT, $ VALUE='Higher quality values result in lower rates of time compression and less motion prediction which provide higher') wLabel = WIDGET_LABEL(wMpegQualityBase, /ALIGN_LEFT, $ VALUE='quality MPEGs but with substantially larger file size. Lower quality factors may result in longer MPEG generation times.') wMpegBase2 = WIDGET_BASE(wMpegTopBase,/ROW) mpegWidgets[2] = CW_FIELD(wMpegBase2,/FLOAT,/ALL_EVENTS,$ XSIZE=20,TITLE='bitrate :',$ UVALUE='MPEG-BITRATE', VALUE=bitrate ) wLabel = WIDGET_LABEL(wMpegBase2, $ VALUE='MPEG movie bit rate. Higher bit rates will create higher quality MPEGs but will increase file size.') wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' Set this property to 0.0 (the default setting) to indicate that IDL should compute', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' the BITRATE value based upon the value you have specified for the QUALITY property', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' MPEG 1 range = 0.1 to 104857200.0', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' MPEG 2 range = 0.1 to 429496729200.0 ', /ALIGN_LEFT) wMpegBase6 = WIDGET_BASE(wMpegTopBase,/ROW) mpegWidgets[4] = WIDGET_DROPLIST(wMpegBase6, SENSITIVE=mpegSensitive[4], $ VALUE=['default', $ 'Small', $ 'Medium', $ 'Large'],$ UVALUE='MPEG-MOTIONVECTLENGTH', TITLE='Motion vectors length :') WIDGET_CONTROL, mpegWidgets[4], SET_DROPLIST_SELECT=motion_vec_length wLabel = WIDGET_LABEL(wMpegBase6, $ VALUE='specifies the length of the motion vectors to be used to generate predictive frames.') wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' the default setting indicates that IDL should compute the Motion vectors length', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' based upon the value specified for the QUALITY property', /ALIGN_LEFT) wMpegBase7 = WIDGET_BASE(wMpegTopBase,/ROW) mpegWidgets[5] = CW_FIELD(wMpegBase7,/INTEGER,/ALL_EVENTS, $ XSIZE=5,TITLE='I Frame gap :',$ UVALUE='MPEG-IFRAME_GAP', VALUE=iframe_gap ) wLabel = WIDGET_LABEL(wMpegBase7, $ VALUE='a positive integer value that specifies the number of frames between I frames to be created in the MPEG file.') wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' I frames are full-quality image frames that may have a number of predicted or interpolated frames between them', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' Set this property to 0 (the default setting) to indicate that IDL should compute the IFRAME_GAP value', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' value based upon the value specified for the QUALITY property', /ALIGN_LEFT) wMpegBase = WIDGET_BASE(wMpegTopBase,/ROW) mpegWidgets[6] = WIDGET_DROPLIST(wMpegBase, SENSITIVE=mpegSensitive[6], $ VALUE=['non-interlaced (default)', $ 'Interlaced'],$ UVALUE='MPEG-INTERLACED', TITLE='') WIDGET_CONTROL, mpegWidgets[6], SET_DROPLIST_SELECT=interlaced wLabel = WIDGET_LABEL(wMpegBase, $ VALUE='When interlacing is set, the video data is written to the file by writing the odd-numbered scan lines') wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' first, followed by the even-numbered scan lines. This format is used to provide smoother screen refreshing', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' on slower display devices. You may need to generate an interlaced file if the intended playback device', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' requires interlaced video data. Most modern MPEG playback devices can handle non-interlaced', /ALIGN_LEFT) wLabel = WIDGET_LABEL(wMpegTopBase, $ VALUE=' (progressive scan) video.', /ALIGN_LEFT) END ;****************************************************************************** ; Time sequence control widget ; ; MODIFICATION HISTORY: ; D. Pomarède 2007 ; Y. Fidaali july 2007 : save time and spatial landmarks ; D. Pomarède january 2008 : reorganization in three sections ; 1) time and space sequence interactively defined ; 2) stream of objects ; 3) seuence control through external sds file ; ; PRO DefineMovieWidget,$ wDefineMovieBase, $ wDefineMovieStart, $ wDefineMovieEnd, $ wDefineMovieStep, $ wSequenceObjectsFileName, $ wSequenceFileName, $ wSequenceFileName2, $ wAnimateRate, $ wAnimateAdvance, $ wAnimateStepF, $ wAnimateStepB, $ wPlay_sequence_and_save, $ saveOutputNumber, $ saveNumberSteps, $ cptVue, $ wMovieWidgetConfig, $ wNumberVueLabel wDefineMovieSubBase = WIDGET_BASE(wDefineMovieBase, COLUMN=2) wTabDefineMovieBase = WIDGET_TAB(wDefineMovieSubBase, uvalue='MOVIETAB') ;;;;;;;; Time and Space Sequence ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; wTimeSpaceSequenceBase = WIDGET_BASE(wTabDefineMovieBase, TITLE=' TIME AND SPACE SEQUENCE ', /BASE_ALIGN_LEFT, $ XPAD=5, YPAD=5, /FRAME, /COLUMN, UVALUE='MOVIETAB') wMovieWidgetConfig=lonarr(2) wDefineMovieLabel = WIDGET_LABEL(wTimeSpaceSequenceBase, $ VALUE='Define a time and space sequence by saving successive view points :', /ALIGN_LEFT) wDefineMovieParametersBase = WIDGET_BASE(wTimeSpaceSequenceBase,/COLUMN) wDefineBoxBase = WIDGET_BASE(wDefineMovieParametersBase, /ROW) if cptVue eq 0 then output = 1 else output = saveOutputNumber[cptVue-1] combo_table=['170','1','8','10','144'] wMovieWidgetLabel0 = WIDGET_LABEL(wDefineBoxBase, VALUE='Output ') wMovieWidgetConfig[0] = WIDGET_COMBOBOX(wDefineBoxBase,/EDITABLE, $ UVALUE='OUTPUT', VALUE=combo_table ) if cptVue eq 0 then output = 1 else output = saveNumberSteps[cptVue-1] combo_table=['1','2','3','4','5','6','8','9','10',$ '20','30','40','50','100','150','200','300','400','500','700','1000'] wMovieWidgetLabel1 = WIDGET_LABEL(wDefineBoxBase, VALUE=' Number of steps ') wMovieWidgetConfig[1] = WIDGET_COMBOBOX(wDefineBoxBase,/EDITABLE, $ UVALUE='NUMBER_STEPS', VALUE=combo_table ) wSaveButton = WIDGET_BUTTON(wDefineMovieParametersBase, UVALUE='SAVE_VUE', VALUE='SAVE CURRENT VIEW',SCR_XSIZE=100 ) wCancelButton = WIDGET_BUTTON(wDefineMovieParametersBase, UVALUE='CANCEL', VALUE='CANCEL THE LAST SAVED VIEW') wDefineNumberVueBase = WIDGET_BASE(wDefineMovieParametersBase, /ROW) wDefineNumberVueLabel = WIDGET_LABEL(wDefineNumberVueBase, VALUE='Number of views saved : ') wNumberVueLabel = WIDGET_LABEL(wDefineNumberVueBase, VALUE=string(cptVue)) wPlaySequence = WIDGET_BUTTON (wDefineMovieParametersBase,$ UVALUE='PLAY_SEQUENCE',VALUE='PLAY SEQUENCE') playsavesequence=make_array([1]) & playsavesequence[*]=0 wPlay_sequence_and_save = CW_BGROUP (wDefineMovieParametersBase,UVALUE='SAVE_SEQUENCE', /NONEXCLUSIVE, COLUMN=1,$ ['SAVE IN SEQUENCE FILE'] , SET_VALUE=playsavesequence) wRePlaySequenceBase = WIDGET_BASE(wDefineMovieParametersBase, /ROW) wSequenceBrowseFile = WIDGET_BUTTON(wRePlaySequenceBase, VALUE=' Browse ',$ UVALUE='BROWSESEQUENCEFILE') Sequence_filename='SDvision.sds' wSequenceFileName = CW_FIELD(wRePlaySequenceBase,/STRING,XSIZE=50,$ UVALUE='SEQUENCEFILENAME',TITLE='',VALUE=Sequence_filename,/ALL_EVENTS) ;;;;;;;; Stream of objects ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; wObjectStreamBase = WIDGET_BASE(wTabDefineMovieBase, TITLE=' OBJECTS STREAM ', /BASE_ALIGN_LEFT, $ XPAD=5, YPAD=5, /FRAME, /COLUMN, UVALUE='MOVIETAB') wDefineMovieLabel = WIDGET_LABEL(wObjectStreamBase, $ VALUE='Define a sequence of objects :', /ALIGN_LEFT) wDefineMovieStart = CW_FIELD(wObjectStreamBase,/LONG,/RETURN_EVENTS, $ XSIZE=7,TITLE='Sequence start ',$ UVALUE='SEQUENCESTARTSTEP', VALUE=0 ) wDefineMovieEnd = CW_FIELD(wObjectStreamBase,/LONG,/RETURN_EVENTS, $ XSIZE=7,TITLE='Sequence end ',$ UVALUE='SEQUENCEENDSTEP', VALUE=0 ) wDefineMovieStep = CW_FIELD(wObjectStreamBase,/LONG,/RETURN_EVENTS, $ XSIZE=7,TITLE='Sequence step ',$ UVALUE='SEQUENCEENDSTEP', VALUE=0 ) wStartMovie_dataPreparation = WIDGET_BUTTON (wObjectStreamBase,$ UVALUE='START_OBJECTS-STREAM_PREPARATION',VALUE='START DATA PREPARATION') wDefineMovieLabel = WIDGET_LABEL(wObjectStreamBase, $ VALUE='Save/restore sequence objects :', /ALIGN_LEFT) wSequenceObjectsBase = WIDGET_BASE(wObjectStreamBase,/ROW) wSequenceObjectsBrowse = WIDGET_BUTTON(wSequenceObjectsBase, VALUE=' Browse ',$ UVALUE='BROWSESEQUENCEOBJECTS') SequenceObjects_filename='SDvision_objectsSequence.sav' wSequenceObjectsFileName = CW_FIELD(wSequenceObjectsBase,/STRING,XSIZE=28,$ UVALUE='NAMESEQUENCEOBJECTS',TITLE='',$ VALUE=SequenceObjects_filename,/ALL_EVENTS) wSequenceObjectsSave = WIDGET_BUTTON(wSequenceObjectsBase, VALUE=' Save ',$ UVALUE='SAVESEQUENCEOBJECTS') wSequenceObjectsRestore = WIDGET_BUTTON(wSequenceObjectsBase, VALUE=' Restore ',$ UVALUE='RESTORESEQUENCEOBJECTS') ; Set up widgets for animation controls. wPanelRow1 = WIDGET_BASE(wObjectStreamBase, /ROW) ; Configure playback control buttons. wButtonBox = WIDGET_BASE(wPanelRow1, /ROW) wAnimateStepB = WIDGET_BUTTON(wButtonBox, VALUE=FILEPATH("stepback.bmp", $ SUBDIR=['resource', 'bitmaps']), /BITMAP, $ TOOLTIP="Step back", UVALUE="ANIMATE_STEPB") wAnimateStop = WIDGET_BUTTON(wButtonBox, VALUE=FILEPATH("stop.bmp", $ SUBDIR=['resource', 'bitmaps']), /BITMAP, $ TOOLTIP="Stop", UVALUE="ANIMATE_STOP") wAnimatePlay = WIDGET_BUTTON(wButtonBox, VALUE=FILEPATH("shift_right.bmp", $ SUBDIR=['resource', 'bitmaps']), /BITMAP, $ TOOLTIP="Play Looping", UVALUE="ANIMATE_PLAY") wAnimatePlayOnce = WIDGET_BUTTON(wButtonBox, VALUE=FILEPATH("arrowsm_right.bmp", $ ;"spinright.bmp", $ SUBDIR=['resource', 'bitmaps']), /BITMAP, $ TOOLTIP="Play Once", UVALUE="ANIMATE_PLAY_ONCE") wAnimateStepF = WIDGET_BUTTON(wButtonBox, VALUE=FILEPATH("step.bmp", $ SUBDIR=['resource', 'bitmaps']), /BITMAP, $ TOOLTIP="Step forward", UVALUE="ANIMATE_STEPF") ; Set up widgets for animation controls. wPanelRow2 = WIDGET_BASE(wObjectStreamBase, /ROW) ; Configure slider widgets for rate and increment. wRateBox = WIDGET_BASE(wPanelRow2, /ROW) wLabel = WIDGET_LABEL(wRateBox, VALUE="Rate (fps): ") wAnimateRate = WIDGET_SLIDER(wRateBox, MINIMUM=1, MAXIMUM=200, $ UVALUE="ANIMATE_RATE") wLabel = WIDGET_LABEL(wRateBox, VALUE=" Frame Advance: ") wAnimateAdvance = WIDGET_SLIDER(wRateBox, MINIMUM=-5, MAXIMUM=5, VALUE=1, $ UVALUE="ANIMATE_ADVANCE") ;;;;;;;; Control sequence ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; wControlSequenceBase = WIDGET_BASE(wTabDefineMovieBase, TITLE=' CONTROL SEQUENCE ', /BASE_ALIGN_LEFT, $ XPAD=5, YPAD=5, /FRAME, /COLUMN, UVALUE='MOVIETAB') wRePlaySequence = WIDGET_BUTTON (wControlSequenceBase,$ UVALUE='REPLAY_SEQUENCE',VALUE=' RESTORE AND REPLAY SEQUENCE FROM FILE ') wRePlaySequenceBase2 = WIDGET_BASE(wControlSequenceBase, /ROW) wSequenceBrowseFile2 = WIDGET_BUTTON(wRePlaySequenceBase2, VALUE=' Browse ',$ UVALUE='BROWSESEQUENCEFILE2') wSequenceFileName2 = CW_FIELD(wRePlaySequenceBase2,/STRING,XSIZE=50,$ UVALUE='SEQUENCEFILENAME2',TITLE='',VALUE=Sequence_filename,/ALL_EVENTS) END ;****************************************************************************** ; Image sequence control widget ; ; MODIFICATION HISTORY: ; D. Pomarède january 2007 ; D. Pomarède march 2007 : stereo output ; ; PRO DefineImageSequenceWidget,$ wImageSequenceBase, $ imagesequenceWidgets, $ counterImage wImageSequenceTopLevelBase = WIDGET_BASE(wImageSequenceBase,/COLUMN) wImageBase = WIDGET_BASE(wImageSequenceTopLevelBase, /ROW) saveimagesequence=make_array([1]) & saveimagesequence[*]=0 imagesequenceWidgets[0] = CW_BGROUP (wImageBase,UVALUE='SAVEIMAGESEQUENCE', /NONEXCLUSIVE, COLUMN=2,$ ['SAVE SEQUENCE OF IMAGES'] , SET_VALUE=saveimagesequence) imagesequenceWidgets[1] = WIDGET_DROPLIST(wImageBase, $ VALUE=['jpg', 'gif'],UVALUE='IMAGE-FORMAT', TITLE=' Format :') imagesequenceWidgets[10] = WIDGET_DROPLIST(wImageBase, $ VALUE=['mono', 'stereo'],UVALUE='IMAGE-MODE', TITLE=' Mode :') wLabel = WIDGET_LABEL(wImageSequenceTopLevelBase, $ VALUE=' Define a directory for storing images :', /ALIGN_LEFT) wImageDirectoryBase = WIDGET_BASE(wImageSequenceTopLevelBase, /ROW) imagesequenceWidgets[2] = WIDGET_BUTTON(wImageDirectoryBase, VALUE=' Browse ',$ UVALUE='BROWSEIMAGEDIRECTORY') image_directory='./images' imagesequenceWidgets[3] = CW_FIELD(wImageDirectoryBase,/STRING,XSIZE=50,$ UVALUE='NAMEIMAGEDIRECTORY',TITLE='',VALUE=image_directory,/ALL_EVENTS) imagesequenceWidgets[4] = WIDGET_BUTTON(wImageDirectoryBase, VALUE=' Create ',$ UVALUE='CREATEIMAGEDIRECTORY') imagesequenceWidgets[11] = WIDGET_BASE(wImageSequenceTopLevelBase, /COLUMN,MAP=0) wLabel = WIDGET_LABEL(imagesequenceWidgets[11], $ VALUE=' Stereo mode - define a directory for storing images from right eye :', /ALIGN_LEFT) wStereoImageDirectoryBase = WIDGET_BASE(imagesequenceWidgets[11], /ROW) imagesequenceWidgets[7] = WIDGET_BUTTON(wStereoImageDirectoryBase, VALUE=' Browse ',$ UVALUE='BROWSESTEREOIMAGEDIRECTORY') image_directory='./imagesRight' imagesequenceWidgets[8] = CW_FIELD(wStereoImageDirectoryBase,/STRING,XSIZE=50,$ UVALUE='NAMESTEREOIMAGEDIRECTORY',TITLE='',VALUE=image_directory) imagesequenceWidgets[9] = WIDGET_BUTTON(wStereoImageDirectoryBase, VALUE=' Create ',$ UVALUE='CREATESTEREOIMAGEDIRECTORY') wImageCounterBase = WIDGET_BASE(wImageSequenceTopLevelBase, /ROW) imagesequenceWidgets[5] = CW_FIELD(wImageCounterBase, VALUE=counterImage,/INTEGER,FRAME=1,$ UVALUE='IMAGECOUNTER',XSIZE=5,TITLE='counter',/ALL_EVENTS) imagesequenceWidgets[6] = WIDGET_BUTTON(wImageCounterBase, VALUE=' Reset ',$ UVALUE='RESETIMAGECOUNTER') END ;****************************************************************************** ; save jpeg/gif/eps widget ; ; MODIFICATION HISTORY: ; D. Pomarède january 2007 ; ; PRO CreateSaveViewWidget,$ wSaveViewBase, $ saveviewWidgets, $ SaveFormat if SaveFormat eq 'eps' then i=0 if SaveFormat eq 'jpg' then i=1 if SaveFormat eq 'gif' then i=2 SaveViewsFileName='SDvision.'+SaveFormat wSaveViewsBaseSelect = WIDGET_BASE(wSaveViewBase,/ROW) saveviewWidgets = CW_FIELD(wSaveViewsBaseSelect,/STRING,XSIZE=22,TITLE='',$ UVALUE='SAVEVIEWSFILENAME',VALUE=SaveViewsFileName,/RETURN_EVENTS) wSaveViewsBase2 = WIDGET_BASE(wSaveViewBase,/ROW) if SaveFormat eq 'eps' then event='SAVEVIEWSBROWSEEPS' if SaveFormat eq 'jpg' then event='SAVEVIEWSBROWSEJPG' if SaveFormat eq 'gif' then event='SAVEVIEWSBROWSEGIF' wSaveViewsBrowse = WIDGET_BUTTON(wSaveViewsBase2, VALUE=' BROWSE ',$ UVALUE=event) if SaveFormat eq 'eps' then event='SAVEVIEWSEPS' if SaveFormat eq 'jpg' then event='SAVEVIEWSJPG' if SaveFormat eq 'gif' then event='SAVEVIEWSGIF' wSaveViews = WIDGET_BUTTON(wSaveViewsBase2,VALUE=' SAVE ',$ UVALUE=event,/ALIGN_CENTER) wSaveViewsBaseFinal = WIDGET_BASE(wSaveViewBase,/ROW) wQuit = WIDGET_BUTTON(wSaveViewsBaseFinal,VALUE=' CLOSE ',$ UVALUE='CLOSESAVEVIEWS',/ALIGN_RIGHT) END ; ;******************************************************************************************************** ; ExSinglePropSheet ; ; Creates a base with a property sheet. Only the ; default properties are visible. The property sheet's ; event handler sets values and reveals selection ; changes. ; Handler for selection or value modification events. ; ; MODIFICATION HISTORY: ; extracted from IDL examples 2007 ; PRO PropertyEvent, event WIDGET_CONTROL, event.top, GET_UVALUE=sState IF (event.type EQ 0) THEN BEGIN ; Value changed. ; Get the value of the property identified by ; event.identifier. value = WIDGET_INFO(event.ID, COMPONENT = event.component, PROPERTY_VALUE = event.identifier) ; Set the component's property value. event.component->SetPropertyByIdentifier, event.identifier, value PRINT, 'Changed: ', event.identifier, ': ', value SDvis_Draw, sState ENDIF ELSE BEGIN ; Selection changed. ; Return information about single or multiple property ; selections. vNumSelected = WIDGET_INFO(event.ID, /PROPERTYSHEET_NSELECTED) vSelected = WIDGET_INFO(event.ID, /PROPERTYSHEET_SELECTED) PRINT, 'Number properties selected: ' + STRING(vNumSelected) PRINT, 'Selected properties: ' PRINT, vSelected ENDELSE END ; Handler for top-level base kill event. ; ; MODIFICATION HISTORY: ; extracted from IDL examples 2007 ; PRO CleanupEvent, baseID ;WIDGET_CONTROL, baseID, GET_UVALUE = oComp ;OBJ_DESTROY, oComp END ; property sheet widget builder ; ; MODIFICATION HISTORY: ; extracted from IDL examples 2007 ; PRO ExSinglePropSheet , sState, sEvent , ProbedObject , title ; Create a base and property sheet. base = WIDGET_BASE(/TLB_SIZE_EVENT, TITLE = title, KILL_NOTIFY = 'CleanupEvent') prop = WIDGET_PROPERTYSHEET(base, VALUE = ProbedObject, $ EVENT_PRO = 'PropertyEvent', UNAME = 'PropSheet', $ YSIZE=30, /MULTIPLE_PROPERTIES) ; Activate the widgets. WIDGET_CONTROL, sEvent.top, Set_UValue=sState WIDGET_CONTROL, base, SET_UVALUE = sState, /REALIZE XMANAGER, 'ExSinglePropSheet', base, /JUST_REG END ; ; Object probe and property sheet launcher ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, 2007. ; PRO ProbeObject , sState, sEvent , Location pickedObject=sState.drawWindowID3D->Select(sState.oView3D,Location) print,'ProbeObject :',pickedObject help,pickedObject if OBJ_VALID(pickedObject[0]) then ExSinglePropSheet,sState,sEvent,pickedObject[0],'Object property sheet' END ; ;******************************************************************************************************** ; Dynamic upgrade of rendering quality ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, march 2007. ; pro UpgradeQuality, sState result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) sState.drawWindowID3D->SetProperty, QUALITY=2 if obj_valid(sState.oWindowStereoEyes[0]) then sState.oWindowStereoEyes[0]->SetProperty, QUALITY=2 if obj_valid(sState.oWindowStereoEyes[1]) then sState.oWindowStereoEyes[1]->SetProperty, QUALITY=2 IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->GetProperty,RENDER_STEP=render_step render_step(0:2)=1 oVolume[MovieFrameCURRENT]->SetProperty,RENDER_STEP=render_step ENDIF end ; ;******************************************************************************************************** ; Dynamic downgrade of rendering quality ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, march 2007. ; pro DegradeQuality, sState result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) sState.drawWindowID3D->SetProperty, QUALITY=1 if obj_valid(sState.oWindowStereoEyes[0]) then sState.oWindowStereoEyes[0]->SetProperty, QUALITY=1 if obj_valid(sState.oWindowStereoEyes[1]) then sState.oWindowStereoEyes[1]->SetProperty, QUALITY=1 IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->GetProperty,RENDER_STEP=render_step render_step(0:2)=3 oVolume[MovieFrameCURRENT]->SetProperty,RENDER_STEP=render_step ENDIF SDvis_Draw, sState end ; ;****************************************************************************** ; Ash Scalar Field Widget event handler ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, july 2006. ; pro DefineAshScalarEvent, sEvent COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sEvent.id, GET_UVALUE=uVal WIDGET_CONTROL, sEvent.top, GET_UVALUE=hState sAshScalar = *hState sState=sAshScalar.sState filter=['*'] ; Take the following action based on the corresponding event. ; case uVal of "BROWSEASHSCALAR": begin WIDGET_CONTROL, sAshScalar.wAshScalarFileName, GET_VALUE=file_name new_file_name = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=filter,FILE=file_name,TITLE='Select Ash BOB files', $ GET_PATH=path) print,'path=',path result=sState.oData_AshFilePath->SetData(path) WIDGET_CONTROL, sAshScalar.wAshScalarFileName, SET_VALUE=new_file_name end "FILENAMEASHSCALAR": begin WIDGET_CONTROL, sAshScalar.wAshScalarFileName, GET_VALUE=file_name print,'file_name=',file_name end "VARIABLENAMEASHSCALAR": begin WIDGET_CONTROL, sAshScalar.wAshScalarVariableName, GET_VALUE=var_name print,'var_name=',var_name end "CLOSEASHSCALAR": begin ; Restore the info structure before destroying event.top ; WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY ; Destroy widget hierarchy. ; WIDGET_CONTROL, sEvent.top, /DESTROY RETURN end "VALIDATEASHSCALAR": begin WIDGET_CONTROL, sAshScalar.wAshScalarVariableName, GET_VALUE=var_name WIDGET_CONTROL, sAshScalar.wAshScalarFileName, GET_VALUE=file_name result=sState.oData_datanames->GetData(datanames_stored) result=sState.oData_DataDimHDF->GetData(fourdim_stored) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF_stored) result=sState.oData_AshFileName->GetData(AshFileName_stored) dimension_datanames_stored=size(datanames_stored,/DIMENSIONS) ; dimension_datanames_stored=size(AshFileName_stored,/DIMENSIONS) ;print,'dimension_datanames_stored=',dimension_datanames_stored nvar=dimension_datanames_stored+1 datanames=STRARR([nvar]) AshFileName=STRARR([nvar,3]) fourdim=INTARR([nvar]) FillArraysHDF=INTARR([nvar]) datanames[nvar-1]=var_name AshFileName[nvar-1,0]=file_name AshFileName[nvar-1,1]='dum' AshFileName[nvar-1,2]='dum' FillArraysHDF[nvar-1]=0 fourdim[nvar-1]=1 if dimension_datanames_stored gt 0 then begin datanames[0:nvar-2]=datanames_stored[0:nvar-2] ;help,AshFileName ;help,AshFileName_stored AshFileName[0:nvar-2,0]=AshFileName_stored[0:nvar-2,0] AshFileName[0:nvar-2,1]=AshFileName_stored[0:nvar-2,1] AshFileName[0:nvar-2,2]=AshFileName_stored[0:nvar-2,2] FillArraysHDF[0:nvar-2]=FillArraysHDF_stored[0:nvar-2] fourdim[0:nvar-2]=fourdim_stored[0:nvar-2] endif ;print,'datanames=',datanames result=sState.oData_datanames->SetData(datanames) result=sState.oData_AshFileName->SetData(AshFileName) result=sState.oData_DataDimHDF->SetData(fourdim) result=sState.oData_FillArraysHDF->SetData(FillArraysHDF) WIDGET_CONTROL, sState.wLoadButton, SENSITIVE=1 result = sState.oData_wMovieWidgetConfig->GetData(wMovieWidgetConfig) ;;; update of the movie control interface ; result=sState.oData_AshFilePath->GetData(path) print,'path=',path len=strlen(path) filename=AshFileName[0,0] step=strmid(filename,len) print,'step=',step begstep=strmid(step,0,7) print,'begstep=',begstep WIDGET_CONTROL, wMovieWidgetConfig[0],COMBOBOX_ADDITEM=begstep nbentries=WIDGET_INFO(wMovieWidgetConfig[0],/COMBOBOX_NUMBER) print,'nbentries=',nbentries WIDGET_CONTROL, wMovieWidgetConfig[0],SET_COMBOBOX_SELECT=nbentries-1 WIDGET_CONTROL, wMovieWidgetConfig[1],SET_COMBOBOX_SELECT=14 end ELSE : begin PRINT, 'Case Statement in DefineAshScalarEvent found no matches' end endcase end ; ;****************************************************************************** ; Ash Vector Field Widget event handler ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, july 2006. ; pro DefineAshVectorEvent, sEvent COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sEvent.id, GET_UVALUE=uVal WIDGET_CONTROL, sEvent.top, GET_UVALUE=hState sAshVector = *hState sState=sAshVector.sState filter=['*'] ; Take the following action based on the corresponding event. ; case uVal of "BROWSEASHVECTOR_R": begin WIDGET_CONTROL, sAshVector.wAshVectorFileName_r, GET_VALUE=file_name new_file_name = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=filter,FILE=file_name,TITLE='Select Ash BOB file') WIDGET_CONTROL, sAshVector.wAshVectorFileName_r, SET_VALUE=new_file_name end "FILENAMEASHVECTOR_R": begin WIDGET_CONTROL, sAshVector.wAshVectorFileName_r, GET_VALUE=file_name print,'file_name r=',file_name end "BROWSEASHVECTOR_THETA": begin WIDGET_CONTROL, sAshVector.wAshVectorFileName_theta, GET_VALUE=file_name new_file_name = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=filter,FILE=file_name,TITLE='Select Ash BOB file') WIDGET_CONTROL, sAshVector.wAshVectorFileName_theta, SET_VALUE=new_file_name end "FILENAMEASHVECTOR_THETA": begin WIDGET_CONTROL, sAshVector.wAshVectorFileName_theta, GET_VALUE=file_name print,'file_name theta=',file_name end "BROWSEASHVECTOR_PHI": begin WIDGET_CONTROL, sAshVector.wAshVectorFileName_phi, GET_VALUE=file_name new_file_name = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=filter,FILE=file_name,TITLE='Select Ash BOB file') WIDGET_CONTROL, sAshVector.wAshVectorFileName_phi, SET_VALUE=new_file_name end "FILENAMEASHVECTOR_PHI": begin WIDGET_CONTROL, sAshVector.wAshVectorFileName_phi, GET_VALUE=file_name print,'file_name phi=',file_name end "VARIABLENAMEASHVECTOR": begin WIDGET_CONTROL, sAshVector.wAshVectorVariableName, GET_VALUE=var_name print,'var_name=',var_name end "CLOSEASHVECTOR": begin ; Restore the info structure before destroying event.top ; WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY ; Destroy widget hierarchy. ; WIDGET_CONTROL, sEvent.top, /DESTROY RETURN end "VALIDATEASHVECTOR": begin WIDGET_CONTROL, sAshVector.wAshVectorVariableName, GET_VALUE=var_name WIDGET_CONTROL, sAshVector.wAshVectorFileName_r, GET_VALUE=file_name_r WIDGET_CONTROL, sAshVector.wAshVectorFileName_theta, GET_VALUE=file_name_theta WIDGET_CONTROL, sAshVector.wAshVectorFileName_phi, GET_VALUE=file_name_phi result=sState.oData_datanames->GetData(datanames_stored) result=sState.oData_DataDimHDF->GetData(fourdim_stored) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF_stored) result=sState.oData_AshFileName->GetData(AshFileName_stored) dimension_datanames_stored=size(datanames_stored,/DIMENSIONS) ;print,'dimension_datanames_stored=',dimension_datanames_stored nvar=dimension_datanames_stored+1 datanames=STRARR([nvar]) fourdim=INTARR([nvar]) FillArraysHDF=INTARR([nvar]) AshFileName=STRARR([nvar,3]) datanames[nvar-1]=var_name AshFileName[nvar-1,0]=file_name_r AshFileName[nvar-1,1]=file_name_theta AshFileName[nvar-1,2]=file_name_phi FillArraysHDF[nvar-1]=0 fourdim[nvar-1]=3 if dimension_datanames_stored gt 0 then begin datanames[0:nvar-2]=datanames_stored[0:nvar-2] AshFileName[0:nvar-2,0]=AshFileName_stored[0:nvar-2,0] AshFileName[0:nvar-2,1]=AshFileName_stored[0:nvar-2,1] AshFileName[0:nvar-2,2]=AshFileName_stored[0:nvar-2,2] FillArraysHDF[0:nvar-2]=FillArraysHDF_stored[0:nvar-2] fourdim[0:nvar-2]=fourdim_stored[0:nvar-2] endif ;print,'datanames=',datanames result=sState.oData_datanames->SetData(datanames) result=sState.oData_AshFileName->SetData(AshFileName) result=sState.oData_DataDimHDF->SetData(fourdim) ;print,'SetData(fourdim)=',fourdim result=sState.oData_FillArraysHDF->SetData(FillArraysHDF) WIDGET_CONTROL, sState.wLoadButton, SENSITIVE=1 end ELSE : begin PRINT, 'Case Statement in DefineAshVectorEvent found no matches' end endcase end ; ;****************************************************************************** ; Ash Scalar Field Widget builder ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, july 2006. ; pro DefineAshScalarWidget, sEvent, sState AshBoBsize=WIDGET_INFO( sState.wAshConfig[0], /COMBOBOX_GETTEXT) result=sState.oData_GridDim->GetData(GridDim) GridDim(*)=AshBoBsize result=sState.oData_GridDim->SetData(GridDim) title='ASH BoB scalar' wAshScalarBase = WIDGET_BASE(TITLE=title, GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=5, YPAD=5, SPACE=1) wLabelTop = WIDGET_LABEL(wAshScalarBase,/ALIGN_CENTER, $ VALUE='Define ASH BoB file') wAshScalarSelect = WIDGET_BASE(wAshScalarBase,/ROW) wAshScalarBrowse = WIDGET_BUTTON(wAshScalarSelect, VALUE='Browse',$ UVALUE='BROWSEASHSCALAR') AshScalarFileName= './0180001_Vr';'./0243501_Bphi' ; './0180001_Vr' wAshScalarFileName = CW_FIELD(wAshScalarSelect,/STRING,XSIZE=50,TITLE='',$ UVALUE='FILENAMEASHSCALAR',$ VALUE=AshScalarFileName,/ALL_EVENTS) wAshScalarName = WIDGET_BASE(wAshScalarBase,/ROW) AshScalarVariableName='Vr' ; 'Bphi' ; 'Vr' wAshScalarVariableName = CW_FIELD(wAshScalarName,/STRING,XSIZE=10,$ TITLE='Name of variable :',$ UVALUE='VARIABLENAMEASHSCALAR',$ VALUE=AshScalarVariableName,/ALL_EVENTS) wAshScalarFinal = WIDGET_BASE(wAshScalarBase,/ROW) wValidate = WIDGET_BUTTON(wAshScalarFinal,VALUE=' VALIDATE ',$ UVALUE='VALIDATEASHSCALAR',/ALIGN_CENTER) wQuit = WIDGET_BUTTON(wAshScalarFinal,VALUE=' CLOSE ',$ UVALUE='CLOSEASHSCALAR',/ALIGN_RIGHT) test=1 sAshScalar={sState:sState,wAshScalarFileName:wAshScalarFileName, $ wAshScalarVariableName:wAshScalarVariableName } WIDGET_CONTROL, sEvent.top, Set_UValue=sState hState = PTR_NEW(sAshScalar, /NO_COPY) WIDGET_CONTROL, wAshScalarBase, SET_UVALUE=hState WIDGET_CONTROL, wAshScalarBase, /REALIZE XMANAGER,'SDvis_Event',wAshScalarBase,EVENT_HANDLER='DefineAshScalarEvent',/JUST_REG end ; ;****************************************************************************** ; Ash Vector Field Widget builder ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, july 2006. ; pro DefineAshVectorWidget, sEvent, sState AshBoBsize=WIDGET_INFO( sState.wAshConfig[0], /COMBOBOX_GETTEXT) result=sState.oData_GridDim->GetData(GridDim) GridDim(*)=AshBoBsize result=sState.oData_GridDim->SetData(GridDim) title='ASH BoB vector field' wAshVectorBase = WIDGET_BASE(TITLE=title, GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=5, YPAD=5, SPACE=1) wLabelTop = WIDGET_LABEL(wAshVectorBase,/ALIGN_CENTER, $ VALUE='Define ASH BoB files') file='./0243501' ;'./0280001' wAshVectorSelect_r = WIDGET_BASE(wAshVectorBase,/ROW) wAshVectorLabel_r = WIDGET_LABEL(wAshVectorSelect_r,/ALIGN_CENTER, $ VALUE='r component ') wAshVectorBrowse_r = WIDGET_BUTTON(wAshVectorSelect_r, VALUE='Browse',$ UVALUE='BROWSEASHVECTOR_R') AshVectorFileName_r= file+'_Br' wAshVectorFileName_r = CW_FIELD(wAshVectorSelect_r,/STRING,XSIZE=50,TITLE='',$ UVALUE='FILENAMEASHVECTOR_R',$ VALUE=AshVectorFileName_r,/ALL_EVENTS) wAshVectorSelect_theta = WIDGET_BASE(wAshVectorBase,/ROW) wAshVectorLabel_theta = WIDGET_LABEL(wAshVectorSelect_theta,/ALIGN_CENTER, $ VALUE='theta component ') wAshVectorBrowse_theta = WIDGET_BUTTON(wAshVectorSelect_theta, VALUE='Browse',$ UVALUE='BROWSEASHVECTOR_THETA') AshVectorFileName_theta=file+'_Btheta' wAshVectorFileName_theta = CW_FIELD(wAshVectorSelect_theta,/STRING,XSIZE=50,TITLE='',$ UVALUE='FILENAMEASHVECTOR_THETA',$ VALUE=AshVectorFileName_theta,/ALL_EVENTS) wAshVectorSelect_phi = WIDGET_BASE(wAshVectorBase,/ROW) wAshVectorLabel_phi = WIDGET_LABEL(wAshVectorSelect_phi,/ALIGN_CENTER, $ VALUE='phi component ') wAshVectorBrowse_phi = WIDGET_BUTTON(wAshVectorSelect_phi, VALUE='Browse',$ UVALUE='BROWSEASHVECTOR_PHI') AshVectorFileName_phi=file+'_Bphi' wAshVectorFileName_phi = CW_FIELD(wAshVectorSelect_phi,/STRING,XSIZE=50,TITLE='',$ UVALUE='FILENAMEASHVECTOR_PHI',$ VALUE=AshVectorFileName_phi,/ALL_EVENTS) wAshVectorName = WIDGET_BASE(wAshVectorBase,/ROW) AshVectorVariableName='B' wAshVectorVariableName = CW_FIELD(wAshVectorName,/STRING,XSIZE=10,$ TITLE='Name of variable :',$ UVALUE='VARIABLENAMEASHVECTOR',$ VALUE=AshVectorVariableName,/ALL_EVENTS) wAshVectorFinal = WIDGET_BASE(wAshVectorBase,/ROW) wValidate = WIDGET_BUTTON(wAshVectorFinal,VALUE=' VALIDATE ',$ UVALUE='VALIDATEASHVECTOR',/ALIGN_CENTER) wQuit = WIDGET_BUTTON(wAshVectorFinal,VALUE=' CLOSE ',$ UVALUE='CLOSEASHVECTOR',/ALIGN_RIGHT) sAshVector={sState:sState,wAshVectorFileName_r:wAshVectorFileName_r, $ wAshVectorFileName_theta:wAshVectorFileName_theta, $ wAshVectorFileName_phi:wAshVectorFileName_phi, $ wAshVectorVariableName:wAshVectorVariableName } WIDGET_CONTROL, sEvent.top, Set_UValue=sState hState = PTR_NEW(sAshVector, /NO_COPY) WIDGET_CONTROL, wAshVectorBase, SET_UVALUE=hState WIDGET_CONTROL, wAshVectorBase, /REALIZE XMANAGER,'SDvis_Event',wAshVectorBase,EVENT_HANDLER='DefineAshVectorEvent',/JUST_REG end ;****************************************************************************** ;****************************************************************************** ;************************* TASKDL SECTION **************************** ;******************** *********************** ;***** requirement : FastDL package for task farming (www.txcorp.com) ***** ;******************** *********************** ;********************************* *************************************** ;****************************************************************************** ; ; Task Farming Widget Event handler ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, november 2006. ; pro TaskFarmingControlEvent, sEvent COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sEvent.id, GET_UVALUE=uVal WIDGET_CONTROL, sEvent.top, GET_UVALUE=hState sTaskFarming = *hState sState=sTaskFarming.sState ; Take the following action based on the corresponding event. ; case uVal of "TASKFARMINGARRAYS": begin WIDGET_CONTROL, sTaskFarming.wTFtaskarrays, GET_VALUE=index if index[1] eq 1 then begin print,'task farming of ASH vector field conversion not implemented yet' index[1] = 0 WIDGET_CONTROL, sTaskFarming.wTFtaskarrays, SET_VALUE=index endif result=sState.oData_taskFarmingarrays->SetData(index) end "TFSERVER": begin WIDGET_CONTROL, sTaskFarming.wTFserver, GET_VALUE=server result=sState.oData_taskFarmingServer->SetData(server) end "TFWORKER": begin WIDGET_CONTROL, sTaskFarming.wTFworker, GET_VALUE=worker result=sState.oData_taskFarmingWorker->SetData(worker) end "TFNWORKERS": begin WIDGET_CONTROL, sTaskFarming.wTFnworkers, GET_VALUE=nworkers result=sState.oData_taskFarmingNworkers->SetData(nworkers) end else : begin PRINT, 'Case Statement in TaskFarmingControlEvent found no matches' end endcase end ; ;****************************************************************************** ; ; Task Farming Widget builder ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, november 2006. ; pro TaskFarmingControlWidget, sEvent, sState result=sState.oData_taskFarmingarrays->GetData(taskFarmingarrays) result=sState.oData_taskFarmingServer->GetData(taskFarmingServer) result=sState.oData_taskFarmingWorker->GetData(taskFarmingWorker) result=sState.oData_taskFarmingNworkers->GetData(taskFarmingNworkers) title='Task Farming Setup' wTaskFarmingSetupBase=WIDGET_BASE(TITLE=title, GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=5, YPAD=5, SPACE=1) wTFserver = CW_FIELD(wTaskFarmingSetupBase,/STRING,XSIZE=20,$ TITLE='server host ',$ UVALUE='TFSERVER',VALUE=taskFarmingServer,/ALL_EVENTS) wTFworker = CW_FIELD(wTaskFarmingSetupBase,/STRING,XSIZE=20,$ TITLE='worker host ',$ UVALUE='TFWORKER',VALUE=taskFarmingWorker,/ALL_EVENTS) wTFnworkers = CW_FIELD(wTaskFarmingSetupBase,/INTEGER,XSIZE=4,$ TITLE='number of workers ',$ UVALUE='TFNWORKERS',VALUE=taskFarmingNworkers,/ALL_EVENTS) wTFlabel1 = WIDGET_LABEL(wTaskFarmingSetupBase, VALUE=' ') wTFlabel2 = WIDGET_LABEL(wTaskFarmingSetupBase, $ VALUE=' -------------------------------------------------------- ') wTFlabel3 = WIDGET_LABEL(wTaskFarmingSetupBase, VALUE=' ') wTFlabel4 = WIDGET_LABEL(wTaskFarmingSetupBase, VALUE='select tasks suitable for farming') wTFtaskarrays = CW_BGROUP(wTaskFarmingSetupBase, [$ 'RAMSES amr data structures projection in cartesian grids (meshijk)', $ 'ASH vector field conversion (r,theta,phi) to (x,y,z)' $ ], UVALUE='TASKFARMINGARRAYS', /NONEXCLUSIVE, SET_VALUE=taskFarmingarrays) wTFlabel5 = WIDGET_LABEL(wTaskFarmingSetupBase, VALUE=' ') sTaskFarming={sState:sState,wTFtaskarrays:wTFtaskarrays, $ wTFserver:wTFserver,wTFworker:wTFworker,wTFnworkers:wTFnworkers} WIDGET_CONTROL, sEvent.top, Set_UValue=sState hState = PTR_NEW(sTaskFarming, /NO_COPY) WIDGET_CONTROL, wTaskFarmingSetupBase, SET_UVALUE=hState WIDGET_CONTROL, wTaskFarmingSetupBase, /REALIZE XMANAGER,'SDvis_Event',wTaskFarmingSetupBase,EVENT_HANDLER='TaskFarmingControlEvent',/JUST_REG end ; ;****************************************************************************** ; ; Task Farming Initialization ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, november 2006. ; PRO TaskDLInit, sState, oFarm result=sState.oData_taskFarmingServer->GetData(taskFarmingServer) result=sState.oData_taskFarmingWorker->GetData(taskFarmingWorker) result=sState.oData_taskFarmingNworkers->GetData(taskFarmingNworkers) server_host = taskFarmingServer server_port = 10000 * RANDOMU(SYSTIME(/SECONDS)) + 20000 worker_host = taskFarmingWorker ; possibly an array n_workers = taskFarmingNworkers oFarm = OBJ_NEW('taskdl') print,'opening task farming session, server host=',server_host oFarm->open_session, host = server_host, port = server_port print,'... done' n_hosts = N_ELEMENTS(worker_host) queue_list=intarr(n_workers) FOR iworker = 0, n_workers - 1 DO BEGIN ihost = iworker mod n_hosts oFarm->spawn_worker,host=worker_host[ihost],/full ,queueid=queueid ;, /tunnel print,'spawning worker host=',worker_host[ihost],' in queueid=',queueid ENDFOR END ; ;****************************************************************************** ; ; Task Farming dispatch ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, november 2006. ; PRO TaskDLFarming, oFarm, type, SimuStepOutput outfile='taskdl-data-out'+strcompress(string(type),/remove_all)+'.sav' command1="restore,'taskdl-util.sav'" command2="restore,'taskdl-data.sav'" command3="rd_amr,a,nout="+strcompress(string(SimuStepOutput),/remove_all)+",err=err,swap=Endian" command4="rd_hydro,h,nout=170,err=err,swap=Endian" command_in=command1+" & "+command2+" & "+command3+" & "+command4 command5="vol=meshijk(a,h,lmin=lmin,lmax=lmax,type=" $ +strcompress(string(type),/remove_all)+",xr=xr,yr=yr,zr=zr)" command6="save,vol,filename='"+outfile+"'" task= command_in+" & "+command5+" & "+command6 print,'add task:',task oFarm->add_task, task END ; ;****************************************************************************** ; ; Task Farming results gathering ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, november 2006. ; PRO TaskDLGather, oFarm, type, vol print,'gathering result for data ',type outfile='taskdl-data-out'+strcompress(string(type),/remove_all)+'.sav' restore,outfile spawn,'rm '+outfile END ;****************************************************************************** ; ; Task Farming results monitoring ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, november 2006. ; PRO TaskDLMonitor, oFarm get_queue_list=oFarm->get_queues() ;help,get_queue_list ;print,'in TaskDLMonitor get_queue_list=',get_queue_list ;print,'in TaskDLMonitor nqueue,queue_list=',nqueue,queue_list s=size(get_queue_list,/DIMENSIONS) ;print,'size=',s[0] for i=0,s[0]-1 do begin if i ne 0 then print,'waiting green light from queue ',i delay=0.1 if i eq 0 then delay=1 semaphore=0 while semaphore eq 0 do begin wait,delay oFarm->list_queue, get_queue_list[i], TASKS=tasks n=strlen(tasks) ;print,'i,get_queue_list[i]=',i,get_queue_list[i] ;print,'tasks->',tasks,'<-' task=STRPOS(tasks,'') finished=STRPOS(tasks,'finished') ;print,'task=',task ;print,'finished=',finished if task eq -1 and finished eq -1 then semaphore =1 if task ne -1 and finished ne -1 then semaphore =1 ;print,'semaphore=',semaphore endwhile if i ne 0 then print,'...ok' endfor END ; ;****************************************************************************** ;****************************************************************************** ;****************************************************************************** ;****************************************************************************** ; ; ;****************************************************************************** ; ; Memory Management Widget Event handler ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, april 2007. ; february 2008: AMR discard added ; pro MemoryManagementControlEvent, sEvent COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sEvent.id, GET_UVALUE=uVal WIDGET_CONTROL, sEvent.top, GET_UVALUE=hState sMemoryManagement = *hState sState=sMemoryManagement.sState ; Take the following action based on the corresponding event. ; case uVal of "MEMORYMANAGEMENTOPTIONS": begin WIDGET_CONTROL, sMemoryManagement.wMemoryManagementOptions, GET_VALUE=index result=sState.oData_MemoryManagement->SetData(index) end "MEMORYCURRENT": begin print,'Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' end "DISCARDAMR": begin print,'Dynamic memory currently used =',MEMORY(/CURRENT)/1000000.,' Megabytes' result=sState.oData_AMRoctreeGrid->SetData(0.) print,'Dynamic memory used after discarding the AMR=',MEMORY(/CURRENT)/1000000.,' Megabytes' result=sState.oData_AMRoctreeHydro->SetData(0.) print,'Dynamic memory used after discarding the Hydro structure=',MEMORY(/CURRENT)/1000000.,' Megabytes' end else : begin PRINT, 'Case Statement in MemoryManagementControlEvent found no matches' end endcase end ; ;****************************************************************************** ; ; Coordinate normalization ; ; MODIFICATION HISTORY: ; Included september 2005 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; FUNCTION Normalize from simple_surface.pro ;;;; ;;;; http://www.dfanning.com ;;;; FUNCTION Normalize, range, Position=position ; This is a utility routine to calculate the scaling vector ; required to position a vector of specified range at a ; specific position given in normalized coordinates. The ; scaling vector is given as a two-element array like this: ; ; scalingVector = [translationFactor, scalingFactor] ; ; The scaling vector should be used with the [XYZ]COORD_CONV ; keywords of a graphics object or model. For example, if you ; wanted to scale an X axis into the data range of -0.5 to 0.5, ; you might type something like this: ; ; xAxis->GetProperty, Range=xRange ; xScale = Normalize(xRange, Position=[-0.5, 0.5]) ; xAxis, XCoord_Conv=xScale On_Error, 1 IF N_Params() EQ 0 THEN Message, 'Please pass range vector as argument.' ;IF (N_Elements(position) EQ 0) THEN position = [0.0, 1.0] ELSE $ ; position=Float(position) ;range = Float(range) scale = [((position[0]*range[1])-(position[1]*range[0])) / $ (range[1]-range[0]), (position[1]-position[0])/(range[1]-range[0])] RETURN, scale END ; ;****************************************************************************** ; ; Color and Opacity Widget Event handler ; ; MODIFICATION HISTORY: ; september 2006 : Written by Daniel Pomarède ; november 2006 : HVR-format ; july 2007 : slider assembly ; pro ColorAndOpacityTablesEvent, sState,uval,sEvent COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wTopBase, Get_UValue=sState ;print, 'ColorAndOpacityTablesEvent uval=',uval result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_vColors->GetData(vColors) result=sState.oData_VolumeOpacity->GetData(Opac) result=sState.oData_oVolume->GetData(oVolume) if strcmp(uval,'COTSLIDER',9) then begin itable=WIDGET_INFO(sState.wCOTsliderList,/DROPLIST_SELECT ) ngroup = WIDGET_INFO( sState.wCOTsliderGroup, /COMBOBOX_GETTEXT) print,'itable=',itable islider=fix(strmid(uval,9)) print,'islider=',islider WIDGET_CONTROL, sEvent.id, GET_VALUE=icolor print,'icolor=',icolor WIDGET_CONTROL, sState.wCOTsliderChannel, SET_VALUE = islider WIDGET_CONTROL, sState.wCOTsliderValue, SET_VALUE = icolor imin=islider-ngroup+1 imax=islider+ngroup-1 print,'imin,imax=',imin,imax if imin lt 0 then imin=0 if imax gt 255 then imax=255 ;for i=islider-ngroup/2+1,islider+ngroup-1 do begin for i=imin,imax do begin if i ne islider then WIDGET_CONTROL, sState.wCOTslider[i],SET_VALUE=icolor endfor help,sEvent,/struct if itable le 2 then begin result=sState.oData_vColors->GetData(vColors) vColors[imin:imax,itable]=icolor sState.oPlotCOT[itable]->SetProperty, Datay=vColors[*,itable] result=sState.oData_vColors->SetData(vColors) result=sState.oData_vColors_orig->SetData(vColors) sState.oPaletteImage->SetProperty,RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2] oPaletteImage = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) sState.oCB->SetProperty,Palette=oPaletteImage IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN $ oVolume[MovieFrameCURRENT]->SetProperty,RGB_TABLE0=vColors endif else begin result=sState.oData_VolumeOpacity->GetData(Opac) ;Opac[islider]=icolor Opac[imin:imax]=icolor sState.oPlotCOT[itable]->SetProperty, Datay=Opac result=sState.oData_VolumeOpacity->SetData(Opac) IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN $ oVolume[MovieFrameCURRENT]->SetProperty,OPACITY_TABLE0=Opac endelse ;for islider= 0, 255 do begin ;if strcmp(uval,'COTSLIDER',9) ;endfor ;return SDvis_Draw, sState ;return endif lock = 0 vbot = 0 gamma=1. vtop = 100 use_values=0 ;print,'event==',uVal ; Take the following action based on the corresponding event. ; case uVal of "COTDRAWCB": begin oPalette = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) sState.oCB->SetProperty,Palette=oPalette end "COTPRESETPALLETES": begin listValue = WIDGET_INFO(sEvent.id,/LIST_SELECT) loadct, listValue names = 0 LOADCT, GET_NAMES = names ;Get table names WIDGET_CONTROL, sState.wPaletteName, SET_VALUE='current='+names[listValue] result=sState.oData_vColors->GetData(vColors) oPalette = Obj_New('IDLgrPalette') oPalette->LoadCT,listValue oPalette->GetProperty,RED_VALUES=r,GREEN_VALUES=g,BLUE_VALUES=b vColors[*,0]=r & vColors[*,1]=g & vColors[*,2]=b for i=0,2 do begin sState.oPlotCOT[i]->SetProperty, Datay=vColors[*,i] endfor sState.oPaletteImage->SetProperty,RED_VALUES=r,GREEN_VALUES=g,BLUE_VALUES=b sState.oPaletteImage->LoadCT,listValue sState.oCB->SetProperty,Palette=oPalette IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->SetProperty,RGB_TABLE0=vColors ENDIF result=sState.oData_vColors->SetData(vColors) result=sState.oData_vColors_orig->SetData(vColors) SDvis_Draw, sState end "COTPERSOPALETTES": begin listValue = WIDGET_INFO(sEvent.id,/LIST_SELECT) result=sState.oData_vColors->GetData(vColors) case listvalue of 0: begin print,'perso palette 1' WIDGET_CONTROL, sState.wPaletteName, SET_VALUE='current= Palette Perso 1' vColors[*,*]=0 nramp=128 iramp=indgen(nramp) ; red irampn=255.*(iramp/float(nramp)) vColors[255-nramp+1:255,0]=irampn ; green vColors[*,1]=0 ; blue irampn=255.*(1.-iramp/float(nramp)) vColors[0:nramp-1,2]=irampn end 1: begin print,'perso palette 2' WIDGET_CONTROL, sState.wPaletteName, SET_VALUE='current= Palette Perso 2' vColors[*,*]=0 nramp=256 iramp=indgen(nramp) ; red irampn=255.*(iramp/float(nramp)) vColors[255-nramp+1:255,0]=irampn ; green vColors[*,1]=vColors[*,0] ; blue irampn=255.*(1.-iramp/float(nramp)) vColors[0:nramp-1,2]=irampn end else : begin PRINT, 'perso palette found no matches' end endcase for i=0,2 do begin sState.oPlotCOT[i]->SetProperty, Datay=vColors[*,i] endfor sState.oPaletteImage->SetProperty,RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2] oPalette = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) sState.oCB->SetProperty,Palette=oPalette IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->SetProperty,RGB_TABLE0=vColors ENDIF result=sState.oData_vColors->SetData(vColors) result=sState.oData_vColors_orig->SetData(vColors) SDvis_Draw, sState end "COTOPACITYLIST": begin result=sState.oData_VolumeOpacity->GetData(CurrentOpac) listValue = WIDGET_INFO(sEvent.id,/LIST_SELECT) nramp=256 iramp=indgen(nramp) NewOpac=bytarr(256) case listvalue of 0: begin NewOpac=iramp end 1: begin NewOpac=255-iramp end 2: begin NewOpac[*]=128 end 3: begin for i=0,255 do begin NewOpac[i]=255*(1.-fix(i)/128.)^2 endfor end 4: begin for i=0,255 do begin NewOpac[i]=40+215*(1.-fix(i)/128.)^2 endfor print,'test',min(NewOpac),max(NewOpac) end 5: begin for i=0,255 do begin NewOpac[i]=80+175*(1.-fix(i)/128.)^2 endfor print,'test',min(NewOpac),max(NewOpac) end 6: begin for i=0,255 do begin NewOpac[i]=120+135*(1.-fix(i)/128.)^2 endfor print,'test',min(NewOpac),max(NewOpac) end 7: begin for i=0,255 do begin NewOpac[i]=255*(ABS(1.-fix(i)/128.))^0.5 endfor end 8: begin for i=0,255 do begin NewOpac[i]=255*(ABS(1.-fix(i)/128.))^5 endfor end 9: begin nramp=127 iramp=indgen(nramp) NewOpac[0:nramp-1]=255*(1.-iramp/float(nramp)) NewOpac[nramp+1:255-nramp]=0. NewOpac[255-nramp+1:255]=255*(iramp/float(nramp)) end 10: begin nramp=124 iramp=indgen(nramp) NewOpac[0:nramp-1]=255*(1.-iramp/float(nramp)) NewOpac[nramp+1:255-nramp]=0. NewOpac[255-nramp+1:255]=255*(iramp/float(nramp)) end 11: begin nramp=119 iramp=indgen(nramp) NewOpac[0:nramp-1]=255*(1.-iramp/float(nramp)) NewOpac[nramp+1:255-nramp]=0. NewOpac[255-nramp+1:255]=255*(iramp/float(nramp)) end 12: begin nramp=115 iramp=indgen(nramp) NewOpac[0:nramp-1]=255*(1.-iramp/float(nramp)) NewOpac[nramp+1:255-nramp]=0. NewOpac[255-nramp+1:255]=255*(iramp/float(nramp)) end 13: begin nramp=100 iramp=indgen(nramp) NewOpac[0:nramp-1]=255*(1.-iramp/float(nramp)) NewOpac[nramp+1:255-nramp]=0. NewOpac[255-nramp+1:255]=255*(iramp/float(nramp)) end 14: begin ; up 1 NewOpac=255*(iramp/255.)^2 end 15: begin ; up 2 NewOpac=255*(iramp/255.)^3 end 16: begin ; up 3 NewOpac=255*(iramp/255.)^4 end else : begin PRINT, 'perso palette found no matches' end endcase result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_VolumeOpacity->SetData(NewOpac) IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN $ oVolume[MovieFrameCURRENT]->SetProperty,OPACITY_TABLE0=NewOpac sState.oPlotCOT[3]->SetProperty, Datay=NewOpac SDvis_Draw, sState end "COTZEROOPACITYMIN": begin WIDGET_CONTROL, sState.wZeroOpacityMin, GET_VALUE = ZeroOpacityMin WIDGET_CONTROL, sState.wZeroOpacityMax, GET_VALUE = ZeroOpacityMax result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) if ZeroOpacityMin le ZeroOpacityMax then begin result=sState.oData_VolumeOpacity->GetData(Opac) Opac[ZeroOpacityMin:ZeroOpacityMax]=0 sState.oPlotCOT[3]->SetProperty, Datay=Opac result=sState.oData_VolumeOpacity->SetData(Opac) IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN $ oVolume[MovieFrameCURRENT]->SetProperty,OPACITY_TABLE0=Opac SDvis_Draw, sState endif end "COTZEROOPACITYMAX": begin WIDGET_CONTROL, sState.wZeroOpacityMin, GET_VALUE = ZeroOpacityMin WIDGET_CONTROL, sState.wZeroOpacityMax, GET_VALUE = ZeroOpacityMax result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) if ZeroOpacityMin le ZeroOpacityMax then begin result=sState.oData_VolumeOpacity->GetData(Opac) Opac[ZeroOpacityMin:ZeroOpacityMax]=0 sState.oPlotCOT[3]->SetProperty, Datay=Opac result=sState.oData_VolumeOpacity->SetData(Opac) IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN $ oVolume[MovieFrameCURRENT]->SetProperty,OPACITY_TABLE0=Opac SDvis_Draw, sState endif end "COTTOP": begin GOTO, set_palette end "COTBOTTOM": BEGIN set_palette: result=sState.oData_vColors_orig->GetData(vColors_orig) result=sState.oData_vColors->GetData(vColors) WIDGET_CONTROL, sState.wPalettesbot, GET_value = vbot WIDGET_CONTROL, sState.wPalettestop, GET_VALUE = vtop ncolors=256 if use_values then nc = 256 else nc = ncolors s = (nc-1)/100. x0 = vbot * s x1 = vtop * s ;print,'x0,x1=',x0,x1 if x0 ne x1 then s = (nc-1.0)/(x1 - x0) else s = 1.0 int = -s * x0 if gamma eq 1.0 then s = round(findgen(nc) * s + int > 0.0) $ else s = ((findgen(nc) * (s/nc) + (int/nc) > 0.0) ^ gamma) * nc cbot=0 s = s + cbot vColors[cbot,0]=vColors_orig[s,0] vColors[cbot,1]=vColors_orig[s,1] vColors[cbot,2]=vColors_orig[s,2] oPalette = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) result=sState.oData_vColors->SetData(vColors) for i=0,2 do begin sState.oPlotCOT[i]->SetProperty, Datay=vColors[*,i] endfor sState.oPaletteImage->SetProperty,RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2] IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->SetProperty,RGB_TABLE0=vColors ENDIF oPalette = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) sState.oCB->SetProperty,Palette=oPalette SDvis_Draw, sState ENDCASE "COTGAMMA": BEGIN WIDGET_CONTROL, sState.wPalettes_gamma, GET_VALUE = gamma gamma = 10^((gamma/50.) - 1) WIDGET_CONTROL, sState.wPalettes_gamma_label,SET_VALUE=STRING(gamma, format='(f6.3)') goto, set_palette ENDCASE "COTBROWSEHVRLUT": BEGIN WIDGET_CONTROL, sState.wHVRlutFileName, GET_VALUE=file_name new_file_name = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=['*'],FILE=file_name,TITLE='Select HVR-format Lookup Table file') WIDGET_CONTROL, sState.wHVRlutFileName, SET_VALUE=new_file_name ENDCASE "COTFILENAMEHVRLUT": BEGIN WIDGET_CONTROL, sState.wHVRlutFileName, GET_VALUE=file_name print,'file_name=',file_name ENDCASE "COTLOADHVRLUT": BEGIN WIDGET_CONTROL, sState.wHVRlutFileName, GET_VALUE=file_name print,'file_name=',file_name char='' NrgbNots=0 NalphaNots=0 a=0 b=0 c=0 d=0 openr,1,file_name, ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', file_name ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif readf,1,char,NrgbNots,char,NalphaNots,format='(a10,i4,a16,i4)' IndRedGrnBlu=intarr(4,NrgbNots+1) for i=0,NrgbNots do begin readf,1,char,a,b,c,d,format='(a12,i9,i8,i6,i6)' IndRedGrnBlu[0,i]=a IndRedGrnBlu[1,i]=b IndRedGrnBlu[2,i]=c IndRedGrnBlu[3,i]=d endfor IndAlpha=intarr(2,NalphaNots+1) for i=0,NalphaNots do begin readf,1,char,a,b,format='(a12,i13,i8)' IndAlpha[0,i]=a IndAlpha[1,i]=b endfor close,1 print,'NrgbNots=',NrgbNots print,'NalphaNots=',NalphaNots print,'IndRedGrnBlu=',IndRedGrnBlu print,'IndAlpha=',IndAlpha NewOpac=bytarr(256) for i=0,NalphaNots-1 do begin index_inf=IndAlpha[0,i] index_sup=IndAlpha[0,i+1] nramp=index_sup-index_inf print,'nramp=',nramp iramp=intarr(nramp) for j=0,nramp-1 do begin iramp[j]=IndAlpha[1,i]+j*(IndAlpha[1,i+1]-IndAlpha[1,i])/nramp endfor NewOpac[index_inf:index_sup-1]=iramp print,'i,index_inf,index_sup=',i,index_inf,index_sup endfor IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->SetProperty,OPACITY_TABLE0=NewOpac ENDIF sState.oPlotCOT[3]->SetProperty, Datay=NewOpac result=sState.oData_VolumeOpacity->SetData(NewOpac) result=sState.oData_vColors->GetData(vColors) for k=0,2 do begin for i=0,NrgbNots-1 do begin index_inf=IndRedGrnBlu[0,i] index_sup=IndRedGrnBlu[0,i+1] nramp=index_sup-index_inf print,'nramp=',nramp iramp=intarr(nramp) for j=0,nramp-1 do begin iramp[j]=IndRedGrnBlu[1+k,i]+j*(IndRedGrnBlu[1+k,i+1]-IndRedGrnBlu[1+k,i])/nramp endfor vColors[index_inf:index_sup-1,k]=iramp print,'i,index_inf,index_sup=',i,index_inf,index_sup endfor sState.oPlotCOT[k]->SetProperty, Datay=vColors[*,k] endfor sState.oPaletteImage->SetProperty,RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2] oPalette = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) sState.oCB->SetProperty,Palette=oPalette IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->SetProperty,RGB_TABLE0=vColors ENDIF result=sState.oData_vColors->SetData(vColors) result=sState.oData_vColors_orig->SetData(vColors) SDvis_Draw, sState ENDCASE "COTBROWSESDVISLUT": BEGIN WIDGET_CONTROL, sState.wSDvislutFileName, GET_VALUE=file_name new_file_name = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=['*'],FILE=file_name,TITLE='Select SDvision-format Lookup Table file') WIDGET_CONTROL, sState.wSDvislutFileName, SET_VALUE=new_file_name ENDCASE "COTFILENAMESDVISLUT": BEGIN WIDGET_CONTROL, sState.wSDvislutFileName, GET_VALUE=file_name print,'file_name=',file_name ENDCASE "COTSAVESDVISLUT": BEGIN WIDGET_CONTROL, sState.wSDvislutFileName, GET_VALUE=file_name print,'save color/opacity lookup tables in file ',file_name openw,1,file_name, ERROR=err printf,1,'RED' for i=0,255 do begin printf,1,i,vColors[i,0] endfor printf,1,'GREEN' for i=0,255 do begin printf,1,i,vColors[i,1] endfor printf,1,'BLUE' for i=0,255 do begin printf,1,i,vColors[i,2] endfor printf,1,'OPACITY' for i=0,255 do begin printf,1,i,Opac[i] endfor close,1 ENDCASE "COTLOADSDVISLUT": BEGIN WIDGET_CONTROL, sState.wSDvislutFileName, GET_VALUE=file_name print,'load color/opacity lookup tables from file ',file_name openr,1,file_name, ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', file_name ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif dum='dum' CATCH,Error_status if Error_status ne 0 then begin print,'Catching error : Error_status=',Error_status print,'problem in opening LUT file, check the format...' close,1 return endif readf,1,dum for i=0,255 do begin readf,1,a,b vColors[i,0]=b endfor readf,1,dum for i=0,255 do begin readf,1,a,b vColors[i,1]=b endfor readf,1,dum for i=0,255 do begin readf,1,a,b vColors[i,2]=b endfor readf,1,dum for i=0,255 do begin readf,1,a,b Opac[i]=b endfor close,1 result=sState.oData_vColors->SetData(vColors) result=sState.oData_VolumeOpacity->SetData(Opac) sState.oPlotCOT[0]->SetProperty, Datay=vColors[*,0] sState.oPlotCOT[1]->SetProperty, Datay=vColors[*,1] sState.oPlotCOT[2]->SetProperty, Datay=vColors[*,2] sState.oPlotCOT[3]->SetProperty, Datay=Opac sState.oPaletteImage->SetProperty,RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2] oPalette = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) sState.oCB->SetProperty,Palette=oPalette IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->SetProperty,RGB_TABLE0=vColors ENDIF SDvis_Draw, sState ENDCASE "COTDRAWCOT0": BEGIN sState.oPlotCOT[0]->SetProperty, Datay=vColors[*,0] ; Button press. ; if (sEvent.type eq 0) then begin WIDGET_CONTROL, sState.wCOTsliderList,SET_DROPLIST_SELECT=0 for islider= 0, 255 do begin WIDGET_CONTROL, sState.wCOTslider[islider],SET_VALUE=vColors[islider,0] endfor endif ENDCASE "COTDRAWCOT1": BEGIN sState.oPlotCOT[1]->SetProperty, Datay=vColors[*,1] ; Button press. ; if (sEvent.type eq 0) then begin WIDGET_CONTROL, sState.wCOTsliderList,SET_DROPLIST_SELECT=1 for islider= 0, 255 do begin WIDGET_CONTROL, sState.wCOTslider[islider],SET_VALUE=vColors[islider,1] endfor endif ENDCASE "COTDRAWCOT2": BEGIN sState.oPlotCOT[2]->SetProperty, Datay=vColors[*,2] ; Button press. ; if (sEvent.type eq 0) then begin WIDGET_CONTROL, sState.wCOTsliderList,SET_DROPLIST_SELECT=2 for islider= 0, 255 do begin WIDGET_CONTROL, sState.wCOTslider[islider],SET_VALUE=vColors[islider,2] endfor endif ENDCASE "COTDRAWCOT3": BEGIN sState.oPlotCOT[3]->SetProperty, Datay=Opac ; Button press. ; if (sEvent.type eq 0) then begin WIDGET_CONTROL, sState.wCOTsliderList,SET_DROPLIST_SELECT=3 for islider= 0, 255 do begin WIDGET_CONTROL, sState.wCOTslider[islider],SET_VALUE=Opac[islider,0] endfor endif ENDCASE "COT_SLIDERCOTLIST": BEGIN ilist = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) if ilist le 2 then begin result=sState.oData_vColors->GetData(vColors) for islider= 0, 255 do begin WIDGET_CONTROL, sState.wCOTslider[islider],SET_VALUE=vColors[islider,ilist] endfor endif else begin result=sState.oData_VolumeOpacity->GetData(Opac) for islider= 0, 255 do begin WIDGET_CONTROL, sState.wCOTslider[islider],SET_VALUE=Opac[islider,0] endfor endelse ENDCASE "COT_SLIDERGROUPLIST": BEGIN ngroup = WIDGET_INFO( sState.wCOTsliderGroup, /COMBOBOX_GETTEXT) print,'ngroup=',ngroup ENDCASE "COT_SLIDERCHANNEL": BEGIN WIDGET_CONTROL, sState.wCOTsliderChannel, GET_VALUE = channel WIDGET_CONTROL, sState.wCOTsliderValue, GET_VALUE = value print,'channel=',channel print,'value=',value ilist=WIDGET_INFO(sState.wCOTsliderList,/DROPLIST_SELECT ) if ilist le 2 then begin vColors[channel,ilist]=value result=sState.oData_vColors->SetData(vColors) sState.oPlotCOT[ilist]->SetProperty, Datay=vColors[*,ilist] endif else begin Opac[channel]=value result=sState.oData_VolumeOpacity->SetData(Opac) sState.oPlotCOT[3]->SetProperty, Datay=Opac endelse sState.oPaletteImage->SetProperty,RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2] oPalette = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) sState.oCB->SetProperty,Palette=oPalette IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->SetProperty,RGB_TABLE0=vColors ENDIF SDvis_Draw, sState ENDCASE "COT_SLIDERVALUE": BEGIN WIDGET_CONTROL, sState.wCOTsliderChannel, GET_VALUE = channel WIDGET_CONTROL, sState.wCOTsliderValue, GET_VALUE = value print,'channel=',channel print,'value=',value ilist=WIDGET_INFO(sState.wCOTsliderList,/DROPLIST_SELECT ) if ilist le 2 then begin vColors[channel,ilist]=value result=sState.oData_vColors->SetData(vColors) sState.oPlotCOT[ilist]->SetProperty, Datay=vColors[*,ilist] endif else begin Opac[channel]=value result=sState.oData_VolumeOpacity->SetData(Opac) sState.oPlotCOT[3]->SetProperty, Datay=Opac endelse sState.oPaletteImage->SetProperty,RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2] oPalette = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) sState.oCB->SetProperty,Palette=oPalette IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->SetProperty,RGB_TABLE0=vColors ENDIF SDvis_Draw, sState ENDCASE "COTDRAWDATA": begin IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 1 THEN BEGIN oVolume[MovieFrameCURRENT]->GetProperty, DATA0=data help,data,output=test_valid valid_data=1-strcmp(test_valid,'DATA UNDEFINED = ') ;print,'valid_data=',valid_data if valid_data then begin ;print,'min(data)=',min(data) ;print,'max(data)=',max(data) nbins=256 hist=HISTOGRAM(data,NBINS=nbins) minh=0.;-5.;MIN(data) maxh=255.;260.;MAX(data) bins=(FINDGEN(N_ELEMENTS(hist)))*(maxh-minh)/(nbins-1)+minh ;help,bins ;print,'min(bins)=',min(bins) ;print,'max(bins)=',max(bins) sState.oPlotVolumeData->SetProperty, Datax=bins, Datay=alog10(hist) sState.oPlotVolumeData->GetProperty, XRange=xrange, YRange=yrange ;print,'sState.oPlotVolumeData xrange=',xrange if yrange[0] eq yrange[1] then begin print,'yrange=',yrange yrange[0]=yrange[0]*0.9 yrange[1]=yrange[1]*1.1 if yrange[0] eq 0 then begin yrange[0]=-1. yrange[1]= 1. endif endif xrange[0]=-5. xrange[1]=260. sState.xAxisVolumeDataT->SetProperty, Range=xrange sState.xAxisVolumeDataB->SetProperty, Range=xrange sState.yAxisVolumeDataL->SetProperty, Range=yrange sState.yAxisVolumeDataR->SetProperty, Range=yrange sState.xaxisVolumeDataT->GetProperty, Ticktext=xAxisTextT sState.xaxisVolumeDataB->GetProperty, Ticktext=xAxisTextB sState.yaxisVolumeDataL->GetProperty, Ticktext=yAxisTextL sState.yaxisVolumeDataR->GetProperty, Ticktext=yAxisTextR xAxisTextT->SetProperty, Recompute_Dimensions=2 xAxisTextB->SetProperty, Recompute_Dimensions=2 yAxisTextL->SetProperty, HIDE=1 yAxisTextR->SetProperty, HIDE=1 sState.xAxisVolumeDataT->GetProperty, CRange=xrange sState.xAxisVolumeDataB->GetProperty, CRange=xrange sState.yAxisVolumeDataL->GetProperty, CRange=yrange sState.yAxisVolumeDataR->GetProperty, CRange=yrange Device, GET_SCREEN_SIZE = screenSize if screensize[0] ge 2000 then begin y1=-0.76 y2= 0.9 endif else begin y1=-0.68 y2= 0.87 endelse xs = Normalize(xrange, Position=[-0.7,0.9]) ys = Normalize(yrange, Position=[y1,y2]) sState.xAxisVolumeDataT->SetProperty, Location=[9999.0, y2, -0.5], XCoord_Conv=xs sState.xAxisVolumeDataB->SetProperty, Location=[9999.0, y1, -0.5], XCoord_Conv=xs sState.yAxisVolumeDataL->SetProperty, Location=[-0.7, 9999.0, -0.5], YCoord_Conv=ys sState.yAxisVolumeDataR->SetProperty, Location=[ 0.9, 9999.0, -0.5], YCoord_Conv=ys sState.oPlotVolumeData->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys sState.xAxisVolumeDataT->SetProperty, HIDE= 0 sState.xAxisVolumeDataB->SetProperty, HIDE= 0 sState.yAxisVolumeDataL->SetProperty, HIDE= 0 sState.yAxisVolumeDataR->SetProperty, HIDE= 0 endif ;; of valid_data ENDIF ELSE BEGIN sState.xAxisVolumeDataT->SetProperty, HIDE=1 sState.xAxisVolumeDataB->SetProperty, HIDE=1 sState.yAxisVolumeDataL->SetProperty, HIDE=1 sState.yAxisVolumeDataR->SetProperty, HIDE=1 ENDELSE end ELSE : begin if strcmp(uval,'COTSLIDER',9) eq 0 then PRINT, 'Case Statement in ColorAndOpacityTablesEvent found no matches' end endcase itable=WIDGET_INFO(sState.wCOTsliderList,/DROPLIST_SELECT ) if itable le 2 then begin result=sState.oData_vColors->GetData(vColors) for islider= 0, 255 do begin WIDGET_CONTROL, sState.wCOTslider[islider],SET_VALUE=vColors[islider,itable] endfor endif else if itable eq 3 then begin result=sState.oData_VolumeOpacity->GetData(Opac) for islider= 0, 255 do begin WIDGET_CONTROL, sState.wCOTslider[islider],SET_VALUE=Opac[islider,0] endfor end result=sState.oData_oVolume->SetData(oVolume) WIDGET_CONTROL, sState.wDrawCOT[0], GET_VALUE=drawWindowIDRTable drawWindowIDRTable->Draw, sState.oViewCOT[0] WIDGET_CONTROL, sState.wDrawCOT[1], GET_VALUE=drawWindowIDGTable drawWindowIDGTable->Draw, sState.oViewCOT[1] WIDGET_CONTROL, sState.wDrawCOT[2], GET_VALUE=drawWindowIDBTable drawWindowIDBTable->Draw, sState.oViewCOT[2] WIDGET_CONTROL, sState.wDrawCOT[3], GET_VALUE=drawWindowIDOTable drawWindowIDOTable->Draw, sState.oViewCOT[3] WIDGET_CONTROL, sState.wDrawColorBar, GET_VALUE=drawWindowCB drawWindowCB->Draw, sState.oViewCB WIDGET_CONTROL, sState.wDrawData, GET_VALUE=drawWindowData drawWindowData->Draw, sState.oViewVolumeData end ; ;****************************************************************************** ; ; Color and Opacity Widget builder ; ; MODIFICATION HISTORY: ; september 2006 : Written by Daniel Pomarède ; november 2006 : HVR-format ; july 2007 : slider assembly ; pro ColorAndOpacityTablesWidget, $ MovieFrameCURRENT, $ vColors, $ Opac, $ wCOTBase, $ wDrawCOT, $ oViewCOT, $ oPlotCOT, $ wPaletteName, $ wPalettesbot, $ wPalettestop, $ wPalettes_gamma_label, $ wPalettes_gamma, $ oViewCB, $ oCB, $ wDrawColorBar, $ wZeroOpacityMin, $ wZeroOpacityMax, $ wHVRlutFileName, $ wSDvislutFileName, $ wCOTsliderList, $ wCOTsliderGroup, $ wCOTslider, $ wCOTsliderChannel, $ wCOTsliderValue, $ wDrawData, $ oViewVolumeData, $ oPlotVolumeData, $ xAxisVolumeDataB, $ xAxisVolumeDataT, $ yAxisVolumeDataL, $ yAxisVolumeDataR Device, GET_SCREEN_SIZE = screenSize if screensize[0] ge 2000 then begin ytext=-0.3 ytextopacity=-0.3 fontsize=12. aTitlefontsize=16. y1=-0.76 y2= 0.9 endif else begin ytext=-0.35 ytextopacity=-0.35 fontsize=8. aTitlefontsize=8. y1=-0.68 y2= 0.87 endelse xAxisFont=OBJ_NEW("IDLgrFont", SIZE=fontsize,THICK=1.) aTitleFont=OBJ_NEW("IDLgrFont", SIZE=aTitlefontsize,THICK=1.) ;print,'screensize=',screensize ydim = screenSize[1] * 0.12 xdim= ydim * 3.3 wCOTSupBase = WIDGET_BASE(wCOTBase,/ROW, XPAD=5, YPAD=3, SPACE=1) wCOTPlotBase = WIDGET_BASE(wCOTSupBase, /COLUMN, XPAD=5, YPAD=1, SPACE=5) wCOTBaseColorTable = WIDGET_BASE(wCOTPlotBase, /COLUMN, SPACE=5) xdimCB = 100 ydimCB = ydim*2 wDrawData = WIDGET_DRAW(wCOTBaseColorTable, $ XSIZE=xdim, YSIZE=ydim, /BUTTON_EVENTS, $ /EXPOSE_EVENTS, UVALUE='COTDRAWDATA', $ RETAIN=0, $ GRAPHICS_LEVEL=2) oViewVolumeData = OBJ_NEW('IDLgrView', COLOR=[255,255,255]) oModelVolumeData = OBJ_NEW('IDLgrModel') oPlotVolumeData = OBJ_NEW('IDLgrPlot', LINESTYLE=0,/HISTOGRAM ) xAxisVolumeDataB = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=0.1, $ Minor=4, Exact=1, thick=1.) xAxisVolumeDataT = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=-0.1, $ Minor=4, Exact=1, thick=1.,/NOTEXT) yAxisVolumeDataL = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=0.03, $ Minor=4, Exact=0, Extend=0) yAxisVolumeDataR = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=-0.03, $ Minor=4, Exact=0, Extend=0,/NOTEXT) oTextVolumeData = OBJ_NEW('IDLgrText','Data',Color=[0,0,0], Font=aTitleFont) oViewVolumeData->Add, oModelVolumeData oModelVolumeData->Add,xAxisVolumeDataT oModelVolumeData->Add,xAxisVolumeDataB oModelVolumeData->Add,yAxisVolumeDataL oModelVolumeData->Add,yAxisVolumeDataR oModelVolumeData->Add,oPlotVolumeData oModelVolumeData->Add,oTextVolumeData oTextVolumeData->SetProperty, Location=[-0.9,ytext],BASELINE=[0.,1.,0.],UPDIR=[-1.,0.,0.] wDrawColorBar = WIDGET_DRAW(wCOTBaseColorTable, $ XSIZE=xdim, YSIZE=xdimCB, /BUTTON_EVENTS, $ /EXPOSE_EVENTS, UVALUE='COTDRAWCB', $ RETAIN=0, $ GRAPHICS_LEVEL=2) n=4 wLabelCOT=LONARR(n) wDrawCOT=LONARR(n) oViewCOT=OBJARR(n) oModelCOT=OBJARR(n) oPlotCOT=OBJARR(n) oTextCOT=OBJARR(n) xAxisBCOT=OBJARR(n) xAxisTCOT=OBJARR(n) yAxisLCOT=OBJARR(n) yAxisRCOT=OBJARR(n) label=strarr(n) label=['Color R Table','Color G Table','Color B Table', 'Opacity Table'] oTextCOT[0]=OBJ_NEW('IDLgrText',' Red ',Color=[0,0,0]) oTextCOT[1]=OBJ_NEW('IDLgrText',' Green ',Color=[0,0,0]) oTextCOT[2]=OBJ_NEW('IDLgrText',' Blue ',Color=[0,0,0]) oTextCOT[3]=OBJ_NEW('IDLgrText','Opacity',Color=[0,0,0]) ind=indgen(255) for i=0, n-1 do begin wDrawCOT[i] = WIDGET_DRAW(wCOTPlotBase, $ XSIZE=xdim, YSIZE=ydim, /BUTTON_EVENTS, $ /EXPOSE_EVENTS, UVALUE='COTDRAWCOT'+strcompress(string(i),/remove_all), $ RETAIN=0, $ GRAPHICS_LEVEL=2) ; Create objects for the Color and Opacity Plots. ; oViewCOT[i] = OBJ_NEW('IDLgrView', COLOR=[255,255,255]) oModelCOT[i] = OBJ_NEW('IDLgrModel') oPlotCOT[i] = OBJ_NEW('IDLgrPlot', LINESTYLE=0,/HISTOGRAM ) ;oTextCOT[i] = OBJ_NEW('IDLgrText','Red',Color=[0,0,0]) xAxisBCOT[i] = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=0.1, $ Minor=4, Exact=1, thick=1.) xAxisTCOT[i] = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=-0.1, $ Minor=4, Exact=1, thick=1.,/NOTEXT) yAxisLCOT[i] = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=0.03, $ Minor=4, Exact=1, Extend=0) yAxisRCOT[i] = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=-0.03, $ Minor=4, Exact=1, Extend=0,/NOTEXT) xAxisBCOT[i]->GetProperty, Ticktext=AxisText & AxisText->SetProperty, Font=xAxisFont yAxisLCOT[i]->GetProperty, Ticktext=AxisText & AxisText->SetProperty, Font=xAxisFont xAxisVolumeDataB->GetProperty, Ticktext=AxisText & AxisText->SetProperty, Font=xAxisFont yAxisVolumeDataL->GetProperty, Ticktext=AxisText & AxisText->SetProperty, Font=xAxisFont oTextCOT[i]->SetProperty, Font=aTitleFont oViewCOT[i]->Add, oModelCOT[i] oModelCOT[i]->Add,xAxisTCOT[i] oModelCOT[i]->Add,xAxisBCOT[i] oModelCOT[i]->Add,yAxisLCOT[i] oModelCOT[i]->Add,yAxisRCOT[i] oModelCOT[i]->Add,oPlotCOT[i] oModelCOT[i]->Add,oTextCOT[i] if i lt 3 then oPlotCOT[i]->SetProperty, Datax=indgen, Datay=vColors[*,i] if i eq 3 then oPlotCOT[i]->SetProperty, Datax=indgen, Datay=Opac oPlotCOT[i]->GetProperty, XRange=xrange, YRange=yrange xrange(0)=-5 xrange(1)=260 yrange(0)=-20 yrange(1)=270 xAxisTCOT[i]->SetProperty, Range=xrange xAxisBCOT[i]->SetProperty, Range=xrange yAxisLCOT[i]->SetProperty, Range=yrange yAxisRCOT[i]->SetProperty, Range=yrange xAxisTCOT[i]->GetProperty, CRange=xrange xAxisBCOT[i]->GetProperty, CRange=xrange yAxisLCOT[i]->GetProperty, CRange=yrange yAxisRCOT[i]->GetProperty, CRange=yrange xs = Normalize(xrange, Position=[-0.7,0.9]) ys = Normalize(yrange, Position=[y1,y2]) xAxisTCOT[i]->SetProperty, Location=[9999.0,y2, -0.5], XCoord_Conv=xs xAxisBCOT[i]->SetProperty, Location=[9999.0,y1, -0.5], XCoord_Conv=xs yAxisLCOT[i]->SetProperty, Location=[-0.7, 9999.0, -0.5], YCoord_Conv=ys yAxisRCOT[i]->SetProperty, Location=[ 0.9, 9999.0, -0.5], YCoord_Conv=ys oPlotCOT[i]->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys ytextoff=ytext if i eq 3 then ytextoff=ytextopacity oTextCOT[i]->SetProperty, Location=[-0.9,ytextoff],BASELINE=[0.,1.,0.],UPDIR=[-1.,0.,0.] endfor ;print,'screensize=',screensize if screensize[0] ge 1900 then begin wCOTSlidersAssemblyBase = WIDGET_BASE(wCOTBase,/ROW,XPAD=5,YPAD=5,SPACE=1,/FRAME) xsize_slider=3 siz = 256 endif else begin scroll=0 x_scroll_size=1000 y_scroll_size=175;133 wCOTSlidersAssemblyBase = WIDGET_BASE(wCOTBase,/ROW,XPAD=5,YPAD=5,SPACE=1,/FRAME,$ SCROLL=scroll,X_SCROLL_SIZE=x_scroll_size,Y_SCROLL_SIZE=y_scroll_size) xsize_slider=5 siz = 128 endelse wCOTSlidersAssemblyBaseSub = WIDGET_BASE(wCOTSlidersAssemblyBase, /COLUMN, XPAD=5, YPAD=5, SPACE=1) slider_cotlist=strarr(4) & slider_cotlist=['red','green','blue','opacity'] slider_grouplist=strarr(12) & slider_grouplist=['1','2','3','4','5','10','15','20','30','50','100','256'] for i=0,9 do begin slider_grouplist(i)= strcompress(slider_grouplist(i),/remove_all) endfor wCOTsliderList=WIDGET_DROPLIST(wCOTSlidersAssemblyBaseSub,VALUE=slider_cotlist,UVALUE='COT_SLIDERCOTLIST') wCOTsliderGroupLabel = WIDGET_LABEL(wCOTSlidersAssemblyBaseSub, VALUE='group range:') wCOTsliderGroup=WIDGET_COMBOBOX(wCOTSlidersAssemblyBaseSub,VALUE=slider_grouplist,UVALUE='COT_SLIDERGROUPLIST',/EDITABLE) wCOTsliderChannel = CW_FIELD(wCOTSlidersAssemblyBaseSub,/STRING,XSIZE=3,TITLE='channel',$ UVALUE='COT_SLIDERCHANNEL',/RETURN_EVENTS) wCOTsliderValue = CW_FIELD(wCOTSlidersAssemblyBaseSub,/STRING,XSIZE=3,TITLE='value ',$ UVALUE='COT_SLIDERVALUE',/RETURN_EVENTS) wCOTslider=LONARR(256) for islider= 0, 255 do begin wCOTslider[islider] = WIDGET_SLIDER(wCOTSlidersAssemblyBase, TITLE = "cot", MINIMUM = 0, $ MAXIMUM = 255, VALUE = 0, /DRAG, ysize=siz,xsize=xsize_slider, /VERTICAL, $ UVALUE = "COTSLIDER"+strcompress(string(islider),/remove_all)) endfor names = 0 LOADCT, GET_NAMES = names ;Get table names wCOTItemsBase = WIDGET_BASE(wCOTSupBase, /COLUMN, XPAD=5, YPAD=5, SPACE=1) wCOTxloadctBase = WIDGET_BASE(wCOTItemsBase, /ROW, XPAD=5, YPAD=5, SPACE=1) wCOTxloadctBaseLeft = WIDGET_BASE(wCOTxloadctBase, /COLUMN, XPAD=5, YPAD=5, SPACE=1) wPaletteName = WIDGET_LABEL(wCOTxloadctBaseLeft, VALUE = 'current='+names[1]+' ', /SUNKEN_FRAME ) wPalettes = WIDGET_LIST(wCOTxloadctBaseLeft, VALUE = names, ysize = 14, UVALUE='COTPRESETPALLETES') siz = 256 ;Basic width of tool wPalettesbot = WIDGET_SLIDER(wCOTxloadctBaseLeft, TITLE = "Stretch Bottom", MINIMUM = 0, $ MAXIMUM = 100, VALUE = 0, /DRAG, UVALUE = "COTBOTTOM", xsize=siz) wPalettestop = WIDGET_SLIDER(wCOTxloadctBaseLeft, TITLE = "Stretch Top", MINIMUM = 0, $ MAXIMUM = 100, VALUE = 100, /DRAG, UVALUE = "COTTOP", xsize=siz) wPalettes_gamma_label = WIDGET_LABEL(wCOTxloadctBaseLeft, VALUE = STRING(1.0)) wPalettes_gamma = WIDGET_slider(wCOTxloadctBaseLeft, TITLE = "Gamma Correction", $ MINIMUM = 0, MAXIMUM = 100, VALUE = 50, UVALUE = "COTGAMMA", $ /SUPPRESS_VALUE, /DRAG, xsize=siz) wCOTxloadctBaseRight = WIDGET_BASE(wCOTxloadctBase, /COLUMN, XPAD=5, YPAD=5, SPACE=1) wCOTPersoBase = WIDGET_BASE(wCOTItemsBase, /COLUMN, XPAD=5, YPAD=5, SPACE=1) wPalettesPerso = WIDGET_LIST(wCOTPersoBase, VALUE = ['Palette perso 1 (blue to black to red)', $ 'Palette perso 2 (blue to yellow)'], $ ysize = 2, UVALUE='COTPERSOPALETTES') wOpacityLabel = WIDGET_LABEL(wCOTPersoBase, VALUE='Opacity tables') wOpacity = WIDGET_LIST(wCOTPersoBase, $ VALUE = ['linear ramp up','linear ramp down','flat', $ 'para1','para1+','para1++','para1+++','para2','para3', $ 'linear ramps 1','linear ramps 2','linear ramps 3','linear ramps 4','linear ramps 5', $ 'up 1','up 2','up 3'] , $ ysize = 3, UVALUE='COTOPACITYLIST') wZeroOpacityMin = WIDGET_SLIDER(wCOTPersoBase, TITLE = "Zero-Opacity Min", MINIMUM = 0, $ MAXIMUM = 255, VALUE = 0, /DRAG, UVALUE = "COTZEROOPACITYMIN", xsize=siz) wZeroOpacityMax = WIDGET_SLIDER(wCOTPersoBase, TITLE = "Zero-Opacity Max", MINIMUM = 0, $ MAXIMUM = 255, VALUE = 0, /DRAG, UVALUE = "COTZEROOPACITYMAX", xsize=siz) ;;; HVR LUT Load ; wHVRlutLabel1 = WIDGET_LABEL(wCOTItemsBase, VALUE=' Load HVR-format lookup table :',/ALIGN_LEFT) wHVRlutSelect = WIDGET_BASE(wCOTItemsBase,/ROW) wHVRlutBrowse = WIDGET_BUTTON(wHVRlutSelect, VALUE=' Browse ',UVALUE='COTBROWSEHVRLUT') HVRlutFileName= './RadialB1a.lut' wHVRlutFileName = CW_FIELD(wHVRlutSelect,/STRING,XSIZE=30,TITLE='',$ UVALUE='COTFILENAMEHVRLUT',$ VALUE=HVRlutFileName,/ALL_EVENTS) wHVRlutLoad = WIDGET_BUTTON(wHVRlutSelect, VALUE=' Load ',UVALUE='COTLOADHVRLUT') ;;; SDvision LUT Load ; wSDvislutLabel1 = WIDGET_LABEL(wCOTItemsBase, VALUE=' Save/Restore SDvision-format lookup table :',/ALIGN_LEFT) wSDvislutSelect = WIDGET_BASE(wCOTItemsBase,/ROW) wSDvislutBrowse = WIDGET_BUTTON(wSDvislutSelect, VALUE=' Browse ',UVALUE='COTBROWSESDVISLUT') SDvislutFileName= './SDvision-color-opacity.lut' wSDvislutFileName = CW_FIELD(wSDvislutSelect,/STRING,XSIZE=30,TITLE='',$ UVALUE='COTFILENAMESDVISLUT',$ VALUE=SDvislutFileName,/ALL_EVENTS) wSDvislutSave = WIDGET_BUTTON(wSDvislutSelect, VALUE=' Save ',UVALUE='COTSAVESDVISLUT') wSDvislutLoad = WIDGET_BUTTON(wSDvislutSelect, VALUE=' Load ',UVALUE='COTLOADSDVISLUT') oViewCB = OBJ_NEW('IDLgrView', COLOR=[190,190,190]) oModelCB = OBJ_NEW('IDLgrModel') oPaletteImage = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) oCB = Obj_New('IDLgrColorbar', Palette=oPaletteImage, $ SHOW_OUTLINE=0, /THREED, DIMENSIONS=[.15,.7], Color=[0,0,0]) oViewCB->Add,oModelCB oModelCB->Add,oCB oModelCB->Rotate, [0,0,1], -90. oCB->GetProperty, XRANGE=xrange, YRANGE=yrange xs = Normalize(xrange, Position=[-1.,1.]) ymin=-0.67 ymax=ymin+1.54 ys = Normalize(yrange, Position=[ymin,ymax]) oCB->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys end ; ;****************************************************************************** ; ; hide the bases prior to mapping ; ; MODIFICATION HISTORY: ; june 2006 : Written by Daniel Pomarède ; FUNCTION ResetBases, sState WIDGET_CONTROL, sState.wLogLinBase, MAP=0 WIDGET_CONTROL, sState.wSelectionBase[0], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[1], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[2], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[3], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[4], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[5], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[6], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[7], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[8], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[9], MAP=0 WIDGET_CONTROL, sState.wSelectionBase[10], MAP=0 WIDGET_CONTROL, sState.wDrawBase3DsubLower[0] , MAP=0 WIDGET_CONTROL, sState.wDrawBase3DsubLower[1] , MAP=0 WIDGET_CONTROL, sState.wDrawBase3DsubLower[2] , MAP=0 WIDGET_CONTROL, sState.wDrawBase3DsubLower[3] , MAP=0 WIDGET_CONTROL, sState.wDrawBase3DsubLower[4] , MAP=0 WIDGET_CONTROL, sState.wDrawBase3DsubLower[5] , MAP=0 WIDGET_CONTROL, sState.wDrawBase3DsubLower[6] , MAP=0 WIDGET_CONTROL, sState.wSelectionDrawingBase[0], MAP=0 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=0 WIDGET_CONTROL, sState.wVectorFieldBase[0], MAP=0 WIDGET_CONTROL, sState.wVectorFieldBase[1], MAP=0 dum=1 RETURN, dum END ; ;****************************************************************************** ; ; dummy procedure needed by Meshijk ; ; MODIFICATION HISTORY: ; january 2006 : Written by Daniel Pomarède ; PRO emissivity,variables, q END ; ;****************************************************************************** ;+ ; NAME: ; MESHIJK ; ; PURPOSE: ; This functions returns a regular 3D Cartesian array ; from a 3D AMR data set and for the chosen variable. The array ; size is computed automatically to contains all the desired ; region (XR, YR, ZR) at the desired resolution (LEVELMAX). ; ; CATEGORY: ; Data analysis. ; ; CALLING SEQUENCE: ; Cube = MESHIJK(Grid3d, Hydro3d, XR = xr, YR = yr, ZR = zr, ; TYPE=type, LMIN=lmin, LMAX=lmax) ; ; INPUTS ; Grid3d: structure containing the 3D AMR mesh. ; ; Hydro3d: structure containing the 3D hydro variables. ; ; OPTIONAL INPUTS: ; XR: if set, defines the map boundaries for the X ; axis. Default: the whole box. ; ; YR: same for the Y axis. ; ; ZR: same for the Z axis. ; ; TYPE: The variable to extract (1 for density, 2 for vx, ; etc...). For zero or a negative value, the routine extract an ; integer corresponding to the AMR level. Default: TYPE = 0 ; ; LMIN: The minimum resolution (coarser level). Default: 1. ; ; LMAX: The maximum resolution (finer level). Default: 1. ; ; OUTPUTS: ; Cube: a structure containing the 3D regular cartesian array of ; the extracted variable, the type of the extracted variable, ; the x, y and z range, and the array dimensions. ; ; COMMON BLOCKS: ; None. ; ; EXAMPLE: ; To extract an array in the center of the box and for the ; density, type: ; ; Cube = MESHIJK(Grid3d, Hydro3d, xr=[0.4,0.6], ; yr=[0.4,0.6], zr=[0.4,0.6], type=1, lmin=2, lmax=6) ; ; ; MODIFICATION HISTORY: ; Written by: Romain Teyssier, 01/01/2000. ; e-mail: Romain.Teyssier@cea.fr ; Fevrier, 2001: Comments and header added by Romain Teyssier. ; January, 2006: included in SDvision by Daniel Pomarède ; January, 2007: memory optimization in data handling ; September, 2007: adjust subvolume position ;- ;################################################### ;################################################### ;################################################### function meshijk, grid, hydro, type=type, xr=xr, yr=yr, zr=zr $ , lmin=lmin, lmax=lmax IF N_PARAMS() NE 2 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'meshijk' RETURN,0. ENDIF ;print,'in meshijk zr=',zr ncpu=grid.ncpu ndim=grid.ndim nlevelmax=grid.nlevelmax ngrid=grid.ngrid nvar=hydro.nvar ;help,hydro,/struct ;print,'hydro.nvar=',hydro.nvar if ndim ne 3 then begin print,'Mesh should have 3 dimensions' print,'but ndim=',ndim return,0. endif ; Set variable to extract if keyword_set(type) then type=string(type) ; Set up levels to consider if not keyword_set(lmin) then leveldown=1 else leveldown=lmin if not keyword_set(lmax) then levelup=1 else levelup=lmax if levelup lt 1 then levelup = 1 if leveldown lt 1 then leveldown = 1 if levelup gt nlevelmax then levelup = nlevelmax if leveldown gt nlevelmax then leveldown = nlevelmax ; Set up cube size if not keyword_set(xr) then xr=[0.,1.0] if not keyword_set(yr) then yr=[0.,1.0] if not keyword_set(zr) then zr=[0.,1.0] xmin=MAX([0.,xr(0)]) & xmax=MIN([1.0,xr(1)]) ymin=MAX([0.,yr(0)]) & ymax=MIN([1.0,yr(1)]) zmin=MAX([0.,zr(0)]) & zmax=MIN([1.0,zr(1)]) ; Set resolutions dxmax=0.5^leveldown dxmin=0.5^levelup scale2=dxmax/dxmin ;print,'dxmax,dxmin,scale2=',dxmax,dxmin,scale2 xmin=xmin/dxmax & xmax=xmax/dxmax ymin=ymin/dxmax & ymax=ymax/dxmax zmin=zmin/dxmax & zmax=zmax/dxmax imin=floor(xmin) & imax=ceil(xmax) jmin=floor(ymin) & jmax=ceil(ymax) kmin=floor(zmin) & kmax=ceil(zmax) nimx=(imax-imin)*scale2 nimy=(jmax-jmin)*scale2 nimz=(kmax-kmin)*scale2 ;print,'kmax,kmin=',kmax,kmin xmin=imin & xmax=imax ymin=jmin & ymax=jmax zmin=kmin & zmax=kmax xrnew=[imin*dxmax,imax*dxmax] yrnew=[jmin*dxmax,jmax*dxmax] zrnew=[kmin*dxmax,kmax*dxmax] print,nimx,nimy,nimz,format='("Computing array of size=",i5,"x",i5,"x",i5)' ;print,'test 1 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' save=FLTARR(nimx,nimy,nimz);,/NOZERO) ;print,'test 2 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' ;====================== ; Project AMR levels ;====================== for icpu=0,ncpu-1 do begin for ilevel=leveldown,levelup do begin dx=0.5d0^(ilevel)/dxmax nimx_loc=(imax-imin)/dx nimy_loc=(jmax-jmin)/dx nimz_loc=(kmax-kmin)/dx if ngrid(ilevel-1,icpu) ne 0 then $ print,(icpu+1),ilevel,ngrid(ilevel-1,icpu),format='("cpu=",i4," Level=",i2," ngrid=",i6)' if ngrid(ilevel-1,icpu) gt 0 then begin mesh=(*hydro.levelh[ilevel-1,icpu]) x=(*grid.level[ilevel-1,icpu]).xg(*,0)/dxmax y=(*grid.level[ilevel-1,icpu]).xg(*,1)/dxmax z=(*grid.level[ilevel-1,icpu]).xg(*,2)/dxmax ind=where( x+dx gt xmin and x-dx lt xmax and $ y+dx gt ymin and y-dx lt ymax and $ z+dx gt zmin and z-dx lt zmax, nok) if(nok gt 0) then begin x=(x(ind)-dx-imin)/dx y=(y(ind)-dx-jmin)/dx z=(z(ind)-dx-kmin)/dx subcube=fltarr(nimx_loc,nimy_loc,nimz_loc);,/NOZERO) ind_x=fix(x) ind_y=fix(y) ind_z=fix(z) for k=0,1 do begin for j=0,1 do begin for i=0,1 do begin ind_cell=i+2*j+4*k active=(*grid.level[ilevel-1,icpu]).son(ind,ind_cell) if not keyword_set(type) then begin q=ilevel+0.*mesh.u(ind,ind_cell,1) endif else if type eq 'userdef' then begin variables=mesh.u(ind,ind_cell,0:nvar-1) variables=reform(variables,n_elements(ind),nvar) emissivity,variables,q endif else if(type gt 0 and type le nvar)then begin q=mesh.u(ind,ind_cell,type-1) endif else if(type gt 0 and nvar eq 1)then begin q=mesh.u(ind,ind_cell,0) endif else begin q=ilevel+0.*mesh.u(ind,ind_cell,1) endelse if(ilevel lt levelup) then begin ind2=where(active eq 0, nok2) endif else begin ind2=where(active gt -1, nok2) endelse if (nok2 gt 0) then begin ind_xx=ind_x(ind2)+i ind_yy=ind_y(ind2)+j ind_zz=ind_z(ind2)+k for ii2=0L,n_elements(ind2)-1L do begin if( ind_xx(ii2) ge 0 and ind_xx(ii2) lt nimx_loc $ and ind_yy(ii2) ge 0 and ind_yy(ii2) lt nimy_loc $ and ind_zz(ii2) ge 0 and ind_zz(ii2) lt nimz_loc )then $ subcube(ind_xx(ii2),ind_yy(ii2),ind_zz(ii2))= $ subcube(ind_xx(ii2),ind_yy(ii2),ind_zz(ii2)) $ +q(ind2(ii2)) endfor endif endfor endfor endfor ;print,'test' ;help,save save=TEMPORARY(save)+REBIN(subcube,nimx,nimy,nimz,/sample) ;help,save endif endif endfor endfor ;print,'test 3 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' ; Free memory ;help,active ;help,q ;help,mesh ;help,mesh2 ;help,subcube ;help,x ;help,y ;help,z ;help,ind ;help,ind2 ;help,ind_x ;help,ind_xx ;help,ind_y ;help,ind_yy ;help,ind_z ;help,ind_zz ; Free memory active=0 q=0 mesh=0 subcube=0. x=0 y=0 z=0 ind=0 ind2=0 ind_x=0 ind_xx=0 ind_y=0 ind_yy=0 ind_z=0 ind_zz=0 ;print,'test 4 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' ;print,'end of meshijk' nx=fix(nimx) & ny=fix(nimy) & nz=fix(nimz) ;print,'nx,ny,nz=',nx,ny,nz ;print,'xr=',xr ;print,'yr=',yr ;print,'zr=',zr ;print,'xrnew=',xrnew ;print,'yrnew=',yrnew ;print,'zrnew=',zrnew xpos=xrnew(0)+dindgen(nx)*(xrnew(1)-xrnew(0))/(nx-1) ypos=yrnew(0)+dindgen(ny)*(yrnew(1)-yrnew(0))/(ny-1) zpos=zrnew(0)+dindgen(nz)*(zrnew(1)-zrnew(0))/(nz-1) ;help,xpos ;help,ypos ;help,zpos indx=where( xr(0) le xpos and xpos le xr(1) ) indy=where( yr(0) le ypos and ypos le yr(1) ) indz=where( zr(0) le zpos and zpos le zr(1) ) ;help,indx ;help,indy ;help,indz ;print,'indx=',indx nsx=size(indx,/N_ELEMENTS) nsy=size(indy,/N_ELEMENTS) nsz=size(indz,/N_ELEMENTS) ;print,'nsx,nsy,nsz=',nsx,nsy,nsz ;help,save volcube=extrac(save,indx[0],indy[0],indz[0],nsx,nsy,nsz) ;print,'test save=0' save=0 ;help,volcube ; Store in sructure if not keyword_set(type) then type=0 ;print,'test 5 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' cube={nx:nsx, ny:nsy, nz:nsz, xr:xrnew, yr:yrnew, zr:zrnew, $ type:type, data:TEMPORARY(volcube)} ;print,'test 6 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' return,cube end ; ;****************************************************************************** ; ; construction of arrow heads for vector fields hedgehog display ; ; MODIFICATION HISTORY: ; january 2006 : taken from IDL demo library ; function makeArrowHeadSymbol, SIZE=size revolutionType = 6 shape = [[-1,-0.5,0],[0,0,0]] nFacets = 16 rotVec = [1,0,0] MESH_OBJ, revolutionType, verts, conn, shape, $ P1=nFacets, P3=rotVec oPoly = OBJ_NEW('IDLgrPolygon', verts, POLY=conn) oSymbol = OBJ_NEW('IDLgrSymbol', oPoly, SIZE=size) return, oSymbol end ; ;****************************************************************************** ; ; counting number of polygons in vector fields hedgehog display ; ; MODIFICATION HISTORY: ; january 2006 : taken from IDL demo library ; function countPolys, inconn nElements = N_ELEMENTS(inconn) nPolys = 0 i=0 while (i lt nElements) do begin nVerts = inconn[i] if (nVerts eq 0) then continue if (nVerts eq -1) then break i = i + nVerts + 1 nPolys = nPolys + 1 endwhile return, nPolys end ; ;****************************************************************************** ; ; Main Widget size editor Event handler ; ; MODIFICATION HISTORY: ; may 2007 : written by Daniel Pomarède ; pro WidgetSizeEditEvent, event COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, event.id, GET_UVALUE=uVal WIDGET_CONTROL, event.top, GET_UVALUE=zState SizeEdits = *zState sState=SizeEdits.sState ; Take the following action based on the corresponding event. ; case uVal of "VIEWXSIZE": begin WIDGET_CONTROL, SizeEdits.wXSizeEditBase, GET_VALUE=xs WIDGET_CONTROL, sState.wTopBase, XSIZE=xs end "VIEWYSIZE": begin WIDGET_CONTROL, SizeEdits.wYSizeEditBase, GET_VALUE=ys WIDGET_CONTROL, sState.wTopBase, YSIZE=ys end "PRESETSIZE500Y": begin WIDGET_CONTROL, sState.wTopBase, YSIZE=500 end "PRESETSIZE600Y": begin WIDGET_CONTROL, sState.wTopBase, YSIZE=600 end "PRESETSIZE700Y": begin WIDGET_CONTROL, sState.wTopBase, YSIZE=700 end "PRESETSIZE800Y": begin WIDGET_CONTROL, sState.wTopBase, YSIZE=800 end "PRESETSIZE900Y": begin WIDGET_CONTROL, sState.wTopBase, YSIZE=900 end "PRESETSIZE1000Y": begin WIDGET_CONTROL, sState.wTopBase, YSIZE=1000 end "PRESETSIZE1100Y": begin WIDGET_CONTROL, sState.wTopBase, YSIZE=1100 end "PRESETSIZE1200Y": begin WIDGET_CONTROL, sState.wTopBase, YSIZE=1200 end ELSE : begin PRINT, 'Case Statement in SizeEditEvent found no matches' end endcase SDvis_Draw, sState end ; ;****************************************************************************** ; ; Main 3D view size editor Event handler ; ; MODIFICATION HISTORY: ; march 2006 : written by Daniel Pomarède ; 2006-7-8 : events added ; pro threeDViewSizeEditEvent, event COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, event.id, GET_UVALUE=uVal WIDGET_CONTROL, event.top, GET_UVALUE=zState SizeEdits = *zState sState=SizeEdits.sState result=sState.oData_xydim->GetData(xydim) result=sState.oData_ImageToggle->GetData(ImageToggle) ; Take the following action based on the corresponding event. ; case uVal of "VIEWXSIZE": begin WIDGET_CONTROL, SizeEdits.wXSizeEditBase, GET_VALUE=xs xydim[0]=xs end "VIEWYSIZE": begin WIDGET_CONTROL, SizeEdits.wYSizeEditBase, GET_VALUE=ys xydim[1]=ys end "RESETSIZE": begin Device, GET_SCREEN_SIZE = screenSize xdim = screenSize[0]*0.4 if ImageToggle[1] eq 1 then begin ydim = xdim endif else begin ydim = xdim * 0.75 end xydim[0]=xdim xydim[1]=ydim end "PRESETSIZE1920x1200": begin xydim[0]=1920 xydim[1]=1200 end "PRESETSIZE1600x1200": begin xydim[0]=1600 xydim[1]=1200 end "PRESETSIZE1280x1024": begin xydim[0]=1280 xydim[1]=1024 end "PRESETSIZE1280x960": begin xydim[0]=1280 xydim[1]=960 end "PRESETSIZE800x600": begin xydim[0]=800 xydim[1]=600 end "PRESETSIZE400x300": begin xydim[0]=400 xydim[1]=300 end "PRESETSIZE600x600": begin xydim[0]=600 xydim[1]=600 end "PRESETSIZE800x800": begin xydim[0]=800 xydim[1]=800 end "PRESETSIZE1000x1000": begin xydim[0]=1000 xydim[1]=1000 end "PRESETSIZE1200x1200": begin xydim[0]=1200 xydim[1]=1200 end "PRESETSIZE1600x1600": begin xydim[0]=1600 xydim[1]=1600 end "PRESETSIZE1400x1400": begin xydim[0]=1400 xydim[1]=1400 end "PRESETSIZE1730x910": begin xydim[0]=1730 xydim[1]=910 end "PRESETSIZE768x768": begin xydim[0]=768 xydim[1]=768 end "PRESETSIZE500x500": begin xydim[0]=500 xydim[1]=500 end "PRESETSIZE400x400": begin xydim[0]=400 xydim[1]=400 end "PRESETSIZE300x300": begin xydim[0]=300 xydim[1]=300 end "PRESETSIZE250x250": begin xydim[0]=250 xydim[1]=250 end ELSE : begin PRINT, 'Case Statement in SizeEditEvent found no matches' end endcase ;WIDGET_CONTROL, sState.wDraw1, GET_VALUE=drawWindowID1 if xydim[0] gt 0 and xydim[1] gt 0 then begin result=sState.oData_xydim->SetData(xydim) WIDGET_CONTROL, SizeEdits.wXSizeEditBase, SET_VALUE=xydim[0] WIDGET_CONTROL, SizeEdits.wYSizeEditBase, SET_VALUE=xydim[1] print,'xydim=',xydim WIDGET_CONTROL, sState.wDraw1 , XSIZE=xydim[0], YSIZE=xydim[1] WIDGET_CONTROL, sState.wDraw3D, XSIZE=xydim[0], YSIZE=xydim[1] sState.drawWindowID1->SetProperty,DIMENSIONS=xydim[0:1] scale_factor=1.*xydim[1]/xydim[0] ;print,'scale_factor=',scale_factor sState.oResizeableModel3D->Reset sState.oResizeableModel3D->Scale,scale_factor,1.,1. sState.oTrackL->Reset,[xydim[0]/2.0, xydim[1]/2.0], xydim[0]/2.0, MOUSE=1 sState.oTrackM->Reset,[xydim[0]/2.0, xydim[1]/2.0], xydim[0]/2.0, MOUSE=2 sState.oTrackR->Reset,[xydim[0]/2.0, xydim[1]/2.0], xydim[0]/2.0, MOUSE=4 SDvis_Draw, sState endif end ; ;****************************************************************************** ; ; Data Reduction Widget Event handler ; ; MODIFICATION HISTORY: ; : written by Daniel Pomarède ; pro DataReductionEvent, event COMPILE_OPT hidden, idl2 WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, event.id, GET_UVALUE=uVal WIDGET_CONTROL, event.top, GET_UVALUE=zState sRebinData = *zState sState=sRebinData.sState result=sState.oData_RebinData->GetData(RebinData) ; Take the following action based on the corresponding event. ; case uVal of 'REBINX' : begin ;WIDGET_CONTROL, sRebinData.wRebinField1, GET_VALUE=Rebinx Rebinx=WIDGET_INFO( sRebinData.wRebinField1, /COMBOBOX_GETTEXT) RebinData[0]=Rebinx result=sState.oData_RebinData->SetData(RebinData) print ,'RebinData=',RebinData end 'REBINY' : begin ;WIDGET_CONTROL, sRebinData.wRebinField2, GET_VALUE=Rebiny Rebiny=WIDGET_INFO( sRebinData.wRebinField2, /COMBOBOX_GETTEXT) RebinData[1]=Rebiny result=sState.oData_RebinData->SetData(RebinData) print ,'RebinData=',RebinData end 'REBINZ' : begin ;WIDGET_CONTROL, sRebinData.wRebinField3, GET_VALUE=Rebinz Rebinz=WIDGET_INFO( sRebinData.wRebinField3, /COMBOBOX_GETTEXT) RebinData[2]=Rebinz result=sState.oData_RebinData->SetData(RebinData) print ,'RebinData=',RebinData end 'REBINVAR' : begin id=WIDGET_INFO( sRebinData.wRebinVar, /DROPLIST_SELECT) print ,'id=',id WIDGET_CONTROL, sRebinData.wRebinVar,GET_VALUE=names print ,'names=',names end "REDUCEDATA": begin WIDGET_CONTROL, /HOURGLASS print ,'RebinData=',RebinData id=WIDGET_INFO( sRebinData.wRebinVar, /DROPLIST_SELECT) print ,'id=',id WIDGET_CONTROL, sRebinData.wRebinVar,GET_VALUE=names print ,'names=',names name=names[id] print ,'name=',name no_copy=1 surfacePosition=0 WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_VALUE=surfacePosition WIDGET_CONTROL, sState.wImage3DPlaneSlider, SET_VALUE=surfacePosition ixdata=0 result=sState.oData_Plotx->SetData(ixdata) DataReduction=1 result=sState.oData_DataReduction->SetData(DataReduction) result=sState.oData_datanames->GetData(datanames) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_DataDimHDF->GetData(fourdim) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) for i=0,nvar-1 do begin if ( FillArraysHDF[i] eq 1 and datanames[i] eq name ) then begin result=sState.oData_HDFvar[i,0]->GetData(HDFvar,NO_COPY=no_copy) if fourdim[i] eq 1 then begin HDFvar=CONGRID(HDFvar,RebinData[0],RebinData[1],RebinData[2]) print,'congrid ',datanames[i] endif else if fourdim[i] eq 3 then begin ;HDFvar=REBIN(HDFvar,RebinData[0],RebinData[1],RebinData[2],3) ;print,'rebin ',datanames[i] ; vx=ptr_new(HDFvar[*,*,*,0]) ; help,vx ; vxc=CONGRID(temporary(*vx),RebinData[0],RebinData[1],RebinData[2]) ; ; vy=ptr_new(HDFvar[*,*,*,1]) ; help,vy ; vyc=CONGRID(temporary(*vy),RebinData[0],RebinData[1],RebinData[2]) ; ; vz=ptr_new(HDFvar[*,*,*,2]) ; help,vz ; vzc=CONGRID(temporary(*vz),RebinData[0],RebinData[1],RebinData[2]) vxc=CONGRID(temporary(HDFvar[*,*,*,0]),RebinData[0],RebinData[1],RebinData[2]) vyc=CONGRID(temporary(HDFvar[*,*,*,1]),RebinData[0],RebinData[1],RebinData[2]) vzc=CONGRID(temporary(HDFvar[*,*,*,2]),RebinData[0],RebinData[1],RebinData[2]) HDFvar=fltarr(RebinData[0],RebinData[1],RebinData[2],3) HDFvar[*,*,*,0]=temporary(vxc) HDFvar[*,*,*,1]=temporary(vyc) HDFvar[*,*,*,2]=temporary(vzc) help,HDFvar print,'congrid ',datanames[i] endif else if fourdim[i] eq 0 then begin print,'no rebin for fourdim=0' endif ; fourdim[i]... result=sState.oData_HDFvar[i,0]->SetData(HDFvar,NO_COPY=no_copy) endif ; FillArraysHDF[i] eq 1 endfor ; i=0,nvar-1 ; result=sState.oData_GridDim->GetData(GridDim) ; GridDim[0:2]=RebinData[0:2] ; result=sState.oData_GridDim->SetData(GridDim) ; result=GridPrint(sState) result=sState.oData_xyzplane->GetData(xyzplane) if xyzplane eq 1 then begin WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_SLIDER_MAX=RebinData[2]-1 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_SLIDER_MAX=RebinData[1]-1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_SLIDER_MAX=RebinData[0]-1 end end ELSE : begin PRINT, 'Case Statement in DataReduction found no matches' end endcase end ;****************************************************************************** ; ; hide scene text ; ; MODIFICATION HISTORY: ; april 16, 2008 : written by Daniel Pomarède ; pro HideSceneText, sState sState.drawWindowID3D->GetProperty,RENDERER=renderer if renderer eq 0 then begin alpha=1. nsteps=200 for i=0,nsteps-1 do begin alpha=alpha-1./nsteps sState.oSceneText[0]->SetProperty,ALPHA_CHANNEL=alpha sState.oSceneText[1]->SetProperty,ALPHA_CHANNEL=alpha SDvis_Draw,sState endfor endif sState.oSceneText[0]->SetProperty,HIDE=1 sState.oSceneText[1]->SetProperty,HIDE=1 sState.oSceneText[0]->SetProperty,ALPHA_CHANNEL=1. sState.oSceneText[1]->SetProperty,ALPHA_CHANNEL=1. SDvis_Draw,sState WIDGET_CONTROL, sState.wTextControlOptions[0], GET_VALUE=index index[0]=0 WIDGET_CONTROL, sState.wTextControlOptions[0], SET_VALUE=index end ;------------------------------------------------------------------------- FUNCTION StoreData2DForDisplay, sState ;print,'StoreData2DForDisplay' result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) result=sState.oData_DataDimHDF->GetData(fourdim) level=0 no_copy=0 result=sState.oData_HDFvar[-iflag_var-1,level]->GetData(varData3D,NO_COPY=no_copy) if size(varData3D,/N_DIMENSIONS) eq 0 then begin print,'3D data has been discarded' print,'please proceed to reload' return,level endif ;help,varData3D dimvar=size(varData3D,/N_DIMENSIONS) sizevar=size(varData3D,/DIMENSIONS) ;print,'size(varData3D)=',size(varData3D) ;print,'sizevar=',sizevar ;print,'dimvar=',dimvar result=sState.oData_GridDim->GetData(GridDim) result=sState.oData_DataFormat->GetData(DataFormat) rebinexpansion=fltarr(3) if dimvar ge 3 then begin rebinexpansion=(1.*(GridDim[0:2]-1))/(sizevar[0:2]-1) endif else if dimvar eq 2 then begin rebinexpansion[0:1]=(1.*(GridDim[0:1]-1))/(sizevar[0:1]-1) rebinexpansion[2]=1. endif else begin print,'unexpected dimension in StoreData2DForDisplay' RETURN, level endelse IF ( DataFormat EQ 5 ) THEN rebinexpansion[*]=1. ;print,'rebinexpansion=',rebinexpansion result=sState.oData_xyzplane->GetData(xyzplane) IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER MultiGrid result=sState.oData_MultiGridPosition->GetData(MultiGridPosition) result=sState.oData_MultiGridSize->GetData(MultiGridSize) if xyzplane eq 1 then begin multigrid_size=sState.GeoStructure.nzg endif else if xyzplane eq 2 then begin multigrid_size=sState.GeoStructure.nyg endif else if xyzplane eq 3 then begin multigrid_size=sState.GeoStructure.nxg end ENDIF if iflag_vue[1] GE 3 and fourdim[-iflag_var-1] eq 3 then begin ;;; vector field result=sState.oData_xpos2DSlicePosition->GetData(xpos2DSlicePosition) surfacePosition=xpos2DSlicePosition[0] IF ( DataFormat EQ 5 ) THEN surfacePosition=1.*surfacePosition*(MultiGridSize(level,3-xyzplane)-1)/(multigrid_size-1) if xyzplane eq 1 then begin surfacePosition= surfacePosition/rebinexpansion[2] varData2D=reform(varData3D(*,*,surfacePosition,0:1)) endif else if xyzplane eq 2 then begin surfacePosition= surfacePosition/rebinexpansion[1] varData2D=reform(varData3D(*,surfacePosition,*,0:2:2)) endif else if xyzplane eq 3 then begin surfacePosition= surfacePosition/rebinexpansion[0] varData2D=reform(varData3D(surfacePosition,*,*,1:2)) end endif else if fourdim[-iflag_var-1] eq 2 then begin ;;; vector field 2D varData2D=varData3D endif else begin ;;; scalar field surfacePosition=-1 IF iflag_vue[0] EQ 1 THEN WIDGET_CONTROL, sState.wSurfacePlaneSlider, GET_VALUE=surfacePosition IF iflag_vue[0] EQ 6 THEN WIDGET_CONTROL, sState.wImage3DPlaneSlider, GET_VALUE=surfacePosition ;print,'surfacePosition=',surfacePosition IF ( DataFormat EQ 5 ) THEN surfacePosition=1.*surfacePosition*(MultiGridSize(level,3-xyzplane)-1)/(multigrid_size-1) ;print,' -->',surfacePosition IF xyzplane EQ 1 THEN BEGIN surfacePosition= surfacePosition/rebinexpansion[2] ;print,'surfacePosition=',surfacePosition varData2D=reform(varData3D(*,*,surfacePosition)) sState.xTitleObj->SetProperty, STRINGS='x' sState.yTitleObj->SetProperty, STRINGS='y' ENDIF ELSE IF xyzplane EQ 2 THEN BEGIN surfacePosition= surfacePosition/rebinexpansion[1] ;print,'surfacePosition=',surfacePosition varData2D=reform(varData3D(*,surfacePosition,*)) sState.xTitleObj->SetProperty, STRINGS='x' sState.yTitleObj->SetProperty, STRINGS='z' ENDIF ELSE IF xyzplane EQ 3 THEN BEGIN surfacePosition= surfacePosition/rebinexpansion[0] ;print,'surfacePosition=',surfacePosition varData2D=reform(varData3D(surfacePosition,*,*)) sState.xTitleObj->SetProperty, STRINGS='y' sState.yTitleObj->SetProperty, STRINGS='z' END endelse result=sState.oData_varData2D->SetData(varData2D) RETURN, level END ;------------------------------------------------------------------------- ;;FUNCTION StoreDataForDisplay, sState ; iflag_var = 1 radiative energy er ; 2 density r ; 3 pressure p ; 4 velocity ux ; 5 velocity uy ; 6 velocity uz ; 7 radiative flux frx ; 8 radiative flux fry ; 9 radiative flux frz ; 10 internal energy e ; 11 velocity u (vector) ; 12 metals m ; 13 custom variable customVar (scalar) ; 14 custom variable customVar (vector) ; 15 particles ; 16 mesh geometry ; ; -1 HDFvar0 ; -2 HDFvar1 ;------------------------------------------------------------------------- FUNCTION GridPrint, sState,valid_amrgrid result=sState.oData_GridDim->GetData(GridDim) ncells=0L nx=GridDim(0)*1L ny=GridDim(1)*1L nz=GridDim(2)*1L nsx = STRING(nx, FORMAT='(i6)') nsx = STRTRIM(nsx,2) nsy = STRING(ny, FORMAT='(i6)') nsy = STRTRIM(nsy,2) nsz = STRING(nz, FORMAT='(i6)') nsz = STRTRIM(nsz,2) ncells=nx*ny*nz nscells = STRING(ncells, FORMAT='(i18)') nscells = STRTRIM(nscells,2) gridstring='grid ' + nsx + 'x' + nsy + 'x' + nsz ncellsstring='# cells=' + nscells result=sState.oData_DataFormat->GetData(DataFormat) IF DataFormat EQ 5 THEN BEGIN ;;; JUPITER WIDGET_CONTROL, sState.wLoadText[1], SET_VALUE='formal resolution :' WIDGET_CONTROL, sState.wLoadText[2], SET_VALUE=gridstring WIDGET_CONTROL, sState.wLoadText[3], SET_VALUE=ncellsstring ENDIF ELSE IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES IF valid_amrgrid eq 1 THEN BEGIN WIDGET_CONTROL, sState.wLoadText[1], SET_VALUE='projected into' WIDGET_CONTROL, sState.wLoadText[2], SET_VALUE=gridstring WIDGET_CONTROL, sState.wLoadText[3], SET_VALUE=ncellsstring ENDIF ENDIF ELSE BEGIN WIDGET_CONTROL, sState.wLoadText[1], SET_VALUE=gridstring WIDGET_CONTROL, sState.wLoadText[2], SET_VALUE=ncellsstring END dum=1 ;rebinstring1='nx='+nsx+' rebin to' ;WIDGET_CONTROL, sState.wRebinText1, SET_VALUE=rebinstring1 ;result=sState.oData_RebinData->GetData(RebinData) ;RebinData(0:2)=GridDim(0:2) ;RebinData(0:2)=150 ;result=sState.oData_RebinData->SetData(RebinData) ;WIDGET_CONTROL, sState.wRebinField1, SET_VALUE=RebinData[0] ;WIDGET_CONTROL, sState.wRebinField2, SET_VALUE=RebinData[1] ;WIDGET_CONTROL, sState.wRebinField3, SET_VALUE=RebinData[2] result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(0:2,2)=GridDim(0:2)-1 result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) WIDGET_CONTROL, sState.wVectorFieldConfig[0,2], SET_VALUE=GridDim[0]-1 WIDGET_CONTROL, sState.wVectorFieldConfig[1,2], SET_VALUE=GridDim[1]-1 WIDGET_CONTROL, sState.wVectorFieldConfig[2,2], SET_VALUE=GridDim[2]-1 if nz eq 1 then begin WIDGET_CONTROL, sState.wSelectSurfacePlane, SENSITIVE=0 WIDGET_CONTROL, sState.wSurfacePlaneSlider, SENSITIVE=0 ENDIF ELSE BEGIN WIDGET_CONTROL, sState.wSelectSurfacePlane, SENSITIVE=1 WIDGET_CONTROL, sState.wSurfacePlaneSlider, SENSITIVE=1 result=sState.oData_FillArrays->GetData(FillArrays) end ; update slider ; result=sState.oData_xyzplane->GetData(xyzplane) if xyzplane eq 1 then begin WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_SLIDER_MAX=GridDim(2)-1 WIDGET_CONTROL, sState.wImage3DPlaneSlider, SET_SLIDER_MAX=GridDim(2)-1 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_SLIDER_MAX=GridDim(1)-1 WIDGET_CONTROL, sState.wImage3DPlaneSlider, SET_SLIDER_MAX=GridDim(1)-1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_SLIDER_MAX=GridDim(0)-1 WIDGET_CONTROL, sState.wImage3DPlaneSlider, SET_SLIDER_MAX=GridDim(0)-1 end ; update slider ; result=sState.oData_xyzplane->GetData(xyzplane) if xyzplane eq 1 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(2)-1 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(1)-1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(0)-1 end sState.GeoStructure.nxg=GridDim(0) sState.GeoStructure.nyg=GridDim(1) sState.GeoStructure.nzg=GridDim(2) ;print ,' exit GridPrint sState.GeoStructure.nxg=',sState.GeoStructure.nxg RETURN, dum END ;------------------------------------------------------------------------- FUNCTION SetBoundariesColor, sState, color dum=1 ;print ,'SetBoundariesColor color=',color case color of 'white' : begin sState.xaxis3Dbounds1->SetProperty , COLOR=[255,255,255] sState.xaxis3Dbounds2->SetProperty , COLOR=[255,255,255] sState.xaxis3Dbounds3->SetProperty , COLOR=[255,255,255] sState.xaxis3Dbounds4->SetProperty , COLOR=[255,255,255] sState.yaxis3Dbounds1->SetProperty , COLOR=[255,255,255] sState.yaxis3Dbounds2->SetProperty , COLOR=[255,255,255] sState.yaxis3Dbounds3->SetProperty , COLOR=[255,255,255] sState.yaxis3Dbounds4->SetProperty , COLOR=[255,255,255] sState.zaxis3Dbounds1->SetProperty , COLOR=[255,255,255] sState.zaxis3Dbounds2->SetProperty , COLOR=[255,255,255] sState.zaxis3Dbounds3->SetProperty , COLOR=[255,255,255] sState.zaxis3Dbounds4->SetProperty , COLOR=[255,255,255] end 'black' : begin sState.xaxis3Dbounds1->SetProperty , COLOR=[0,0,0] sState.xaxis3Dbounds2->SetProperty , COLOR=[0,0,0] sState.xaxis3Dbounds3->SetProperty , COLOR=[0,0,0] sState.xaxis3Dbounds4->SetProperty , COLOR=[0,0,0] sState.yaxis3Dbounds1->SetProperty , COLOR=[0,0,0] sState.yaxis3Dbounds2->SetProperty , COLOR=[0,0,0] sState.yaxis3Dbounds3->SetProperty , COLOR=[0,0,0] sState.yaxis3Dbounds4->SetProperty , COLOR=[0,0,0] sState.zaxis3Dbounds1->SetProperty , COLOR=[0,0,0] sState.zaxis3Dbounds2->SetProperty , COLOR=[0,0,0] sState.zaxis3Dbounds3->SetProperty , COLOR=[0,0,0] sState.zaxis3Dbounds4->SetProperty , COLOR=[0,0,0] end 'blue' : begin sState.xaxis3Dbounds1->SetProperty , COLOR=[0,0,255] sState.xaxis3Dbounds2->SetProperty , COLOR=[0,0,255] sState.xaxis3Dbounds3->SetProperty , COLOR=[0,0,255] sState.xaxis3Dbounds4->SetProperty , COLOR=[0,0,255] sState.yaxis3Dbounds1->SetProperty , COLOR=[0,0,255] sState.yaxis3Dbounds2->SetProperty , COLOR=[0,0,255] sState.yaxis3Dbounds3->SetProperty , COLOR=[0,0,255] sState.yaxis3Dbounds4->SetProperty , COLOR=[0,0,255] sState.zaxis3Dbounds1->SetProperty , COLOR=[0,0,255] sState.zaxis3Dbounds2->SetProperty , COLOR=[0,0,255] sState.zaxis3Dbounds3->SetProperty , COLOR=[0,0,255] sState.zaxis3Dbounds4->SetProperty , COLOR=[0,0,255] end 'red' : begin sState.xaxis3Dbounds1->SetProperty , COLOR=[255,0,0] sState.xaxis3Dbounds2->SetProperty , COLOR=[255,0,0] sState.xaxis3Dbounds3->SetProperty , COLOR=[255,0,0] sState.xaxis3Dbounds4->SetProperty , COLOR=[255,0,0] sState.yaxis3Dbounds1->SetProperty , COLOR=[255,0,0] sState.yaxis3Dbounds2->SetProperty , COLOR=[255,0,0] sState.yaxis3Dbounds3->SetProperty , COLOR=[255,0,0] sState.yaxis3Dbounds4->SetProperty , COLOR=[255,0,0] sState.zaxis3Dbounds1->SetProperty , COLOR=[255,0,0] sState.zaxis3Dbounds2->SetProperty , COLOR=[255,0,0] sState.zaxis3Dbounds3->SetProperty , COLOR=[255,0,0] sState.zaxis3Dbounds4->SetProperty , COLOR=[255,0,0] end endcase RETURN, dum END ;------------------------------------------------------------------------- FUNCTION ReadHeader, sState dum=1 result=sState.oData_FileId->GetData(FileId) ;name = 'myjob000.h5' ;print,'FileId=',FileId openr,1,FileId, ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', FileId ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir ;SDvis_Draw, sState ;WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY return, dum endif close,1 file_header_id=H5F_OPEN(FileId) print,'read HDF5 header file ',FileId dataset_compound = H5D_OPEN(file_header_id,'Compound') Compound=H5D_READ(dataset_compound) dataset_para_int = H5D_OPEN(file_header_id,'para_int') para_int=H5D_READ(dataset_para_int) nxg=para_int(0) nyg=para_int(1) nzg=para_int(2) ndim=para_int(3) nx= para_int(4) ny= para_int(5) nz= para_int(6) nfx= para_int(7) k = para_int(14) result=sState.oData_GridDim->GetData(GridDim) GridDim(0)=nxg GridDim(1)=nyg GridDim(2)=nzg GridDim(3)=ndim GridDim(4)=nx GridDim(5)=ny GridDim(6)=nz GridDim(7)=nfx result=sState.oData_GridDim->SetData(GridDim) result=sState.oData_JobName->SetData(Compound.name_of_job) result=sState.oData_nbuf->SetData(Compound.nbuf) dataset_datanames = H5D_OPEN(file_header_id,'datanames') datanames=H5D_READ(dataset_datanames) dataset_dataunits = H5D_OPEN(file_header_id,'dataunits') dataunits=H5D_READ(dataset_dataunits) ;dataset_datadim = H5D_OPEN(file_header_id,'datadim') ;datadim=H5D_READ(dataset_datadim) dataset_fourdim = H5D_OPEN(file_header_id,'fourdim') fourdim=H5D_READ(dataset_fourdim) nvar=Compound.ndata ; bulshit detector ; nvar_nofake=0 for i=0,nvar-1 do begin if dataunits[i] ne 'fake' then nvar_nofake=nvar_nofake+1 endfor ;print,'nvar_nofake=',nvar_nofake nvar=nvar_nofake datanames=datanames[0:nvar-1] WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='HDF5 header read' result=GridPrint(sState,0) ProcessorId=Compound.nproc result=sState.oData_ProcessorId->SetData(ProcessorId) SimuStepOutput=Compound.noutput SimuStepReprise=Compound.nrepr result=sState.oData_SimuStepOutput->SetData(SimuStepOutput) result=sState.oData_SimuStepReprise->SetData(SimuStepReprise) WIDGET_CONTROL, sState.wProcessorIdFieldHDF, SET_VALUE=ProcessorId result=sState.oData_OutputReprise->GetData(OutputReprise) if OutputReprise eq 0 then begin WIDGET_CONTROL, sState.wStepFieldHDF, SET_VALUE=SimuStepOutput ;print ,'Output=',SimuStepOutput endif else if OutputReprise eq 1 then begin WIDGET_CONTROL, sState.wStepFieldHDF, SET_VALUE=SimuStepReprise ;print ,'Reprise=',SimuStepReprise end result=sState.oData_OptionsArray->GetData(OptionsArray) ; option ray OptionsArray[0]=para_int(15) ; option dif OptionsArray[1]=para_int(16) result=sState.oData_OptionsArray->SetData(OptionsArray) dataset_para_real = H5D_OPEN(file_header_id,'para_real') para_real=H5D_READ(dataset_para_real) result=sState.oData_ParametersArray->SetData(para_real) dataset_x_glob = H5D_OPEN(file_header_id,'x_glob') dataset_y_glob = H5D_OPEN(file_header_id,'y_glob') dataset_z_glob = H5D_OPEN(file_header_id,'z_glob') x_glob=H5D_READ(dataset_x_glob) y_glob=H5D_READ(dataset_y_glob) z_glob=H5D_READ(dataset_z_glob) print,' ' print,'Compound.name_of_job=',Compound.name_of_job print,'Compound.comments =',Compound.comments print,'Compound.nproc =',Compound.nproc print,'Compound.noutput =',Compound.noutput print,'Compound.noutputd =',Compound.noutputd print,'Compound.nrepr =',Compound.nrepr print,'Compound.nreprd =',Compound.nreprd print,'Compound.ndata =',Compound.ndata print,'Compound.nbuf =',Compound.nbuf print,'datanames =',datanames[0:nvar-1] ;print,'datadim =',datadim print,'dataunits =',dataunits[0:nvar-1] print,'fourdim =',fourdim[0:nvar-1] print,'para_int(0)=nxg =',nxg print,'para_int(1)=nyg =',nyg print,'para_int(2)=nzg =',nzg print,'para_int(3)=ndim =',ndim print,'para_int(7)=nfx =',nfx print,'para_int(14)=k =',para_int(14) print,'para_int(15)=/ray =',para_int(15) print,'para_int(16)=/dif =',para_int(16) print,'para_int(17)=/deto =',para_int(17) print,'para_real(0)=temps =',para_real(0) print,'para_real(1)=dt =',para_real(1) print,'para_real(2)=dtold =',para_real(2) print,'para_real(3)=gamma =',para_real(3) print,'para_real(4)=mu =',para_real(4) print,'x_glob(0:nxg) =[',x_glob(0),' :',x_glob(nxg),']' print,'y_glob(0:nyg) =[',y_glob(0),' :',y_glob(nyg),']' print,'z_glob(0:nzg) =[',z_glob(0),' :',z_glob(nzg),']' version_format_hdf5=0 if Compound.comments eq 'test mis 50^3 pour HDF' then version_format_hdf5=-1 if Compound.comments eq 'test mis 200^3 pour HDF' then version_format_hdf5=-1 print,'version_format_hdf5=',version_format_hdf5 result=sState.oData_version_format_hdf5->SetData(version_format_hdf5) ; WIDGET_CONTROL, sState.wOptionsArray, SET_VALUE=OptionsArray WIDGET_CONTROL, sState.wOptionsArray, SENSITIVE=0 WIDGET_CONTROL, sState.wLoadButton, SENSITIVE=1 result=sState.oData_datanames->GetData(datanames_stored) ;print,'datanames_stored=',datanames_stored ;print,'datanames =',datanames size_datanames=size(datanames,/DIMENSIONS) s=fix(size_datanames[0]) ;print,'s=',s if s ne 0 then begin if datanames_stored[0] ne datanames[0] then begin result=sState.oData_datanames->SetData(datanames) result=sState.oData_DataDimHDF->SetData(fourdim) FillArraysHDF=make_array([nvar]) result=sState.oData_FillArraysHDF->SetData(FillArraysHDF) sState.wFillArraysHDF = CW_BGROUP(sState.wPickLoadBase[2], datanames $ , UVALUE='FILLARRAYS', /NONEXCLUSIVE);, SET_VALUE=FillArrays) ;wPickVarObjButton_hdfvar = LONARR(nvar) for i=0,nvar-1 do begin ;sState.wPickVarObjButton_hdfvar[i] = WIDGET_BUTTON(sState.wVarButton, $ ;VALUE='Display '+datanames[i], UVALUE='PICKVAR_'+datanames[i], SENSITIVE=0) sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) endfor endif endif sState.GeoStructure.nxg=nxg sState.GeoStructure.nyg=nyg sState.GeoStructure.nzg=nzg RETURN, dum END ;------------------------------------------------------------------------- FUNCTION ReadJupiterDescriptor, sState dum=1 WIDGET_CONTROL, sState.wLoadButton, SENSITIVE=1 result=sState.oData_GridDim->GetData(GridDim) result=sState.oData_SimuStepOutput->GetData(SimuStepOutput) readstruct,dir=dir,nb=SimuStepOutput,sGeo,sGrid ;print,'sGrid:' & help,sGrid,/struct ;print,'sGeo.in:' & help,sGeo.in,/struct datanames=sGrid.varname size_datanames=size(datanames,/DIMENSIONS) s=fix(size_datanames[0]) ;print,'s=',s fourdim=intarr(s) datanames_new=datanames nvar=s for i=0,s-1 do begin if datanames[i] eq 'velocity' then begin fourdim[i]=3 datanames_new=strarr(s+3) datanames_new[0:s-1]=datanames datanames_new[s]='velocity0' datanames_new[s+1]='velocity1' datanames_new[s+2]='velocity2' fourdim_new=strarr(s+3) fourdim_new[0:s-1]=fourdim fourdim_new[s:s+2]=1 nvar=nvar+3 endif else begin fourdim[i]=1 end endfor ;print,'datanames_new=',datanames_new ;print,'fourdim_new=',fourdim_new result=sState.oData_datanames->GetData(datanames_stored) ngrid=sGrid.ngrid print,'ReadJupiterDescriptor ngrid=',ngrid if s ne 0 and datanames_stored[0] ne datanames_new[0] then begin FillArraysHDF=make_array([nvar]) result=sState.oData_FillArraysHDF->SetData(FillArraysHDF) result=sState.oData_datanames->SetData(datanames_new) result=sState.oData_DataDimHDF->SetData(fourdim_new) sState.wFillArraysHDF = CW_BGROUP(sState.wPickLoadBase[4], datanames_new $ , UVALUE='FILLARRAYS', /NONEXCLUSIVE) for level=0,ngrid-1 do begin for i=0,nvar-1 do begin sState.oData_HDFvar[i,level]=OBJ_NEW('IDLitData', $ datanames_new[i]+strcompress(string(level),/remove_all) ) endfor endfor endif for k=0,ngrid-1 do begin level=ngrid-k-1 if level eq 0 then begin xmin=sGrid.NCORNER_MIN[k,0] xmax=sGrid.NCORNER_MAX[k,0] ymin=sGrid.NCORNER_MIN[k,1] ymax=sGrid.NCORNER_MAX[k,1] zmin=sGrid.NCORNER_MIN[k,2] zmax=sGrid.NCORNER_MAX[k,2] ;print,'xmin,xmax=',xmin,xmax ;print,'ymin,ymax=',ymin,ymax ;print,'zmin,zmax=',zmin,zmax endif endfor for level=0,ngrid-1 do begin d_off=8-level*2 sState.oImage3D[level]->SetProperty,DEPTH_OFFSET=d_off sState.oImage[level]->SetProperty,DEPTH_OFFSET=d_off ;print,'oImage3D level ',level,' d_off=',d_off endfor ; ok for level 0 GridDim(0)=sGeo.in.SIZE2 GridDim(1)=sGeo.in.SIZE1 GridDim(2)=sGeo.in.SIZE3 sState.GeoStructure.nxg=sGeo.in.SIZE2 sState.GeoStructure.nyg=sGeo.in.SIZE1 sState.GeoStructure.nzg=sGeo.in.SIZE3 sState.GeoStructure.xmin=sGeo.in.RANGE2LOW sState.GeoStructure.xmax=sGeo.in.RANGE2HIGH sState.GeoStructure.ymin=sGeo.in.RANGE1LOW sState.GeoStructure.ymax=sGeo.in.RANGE1HIGH sState.GeoStructure.zmin=sGeo.in.RANGE3LOW sState.GeoStructure.zmax=sGeo.in.RANGE3HIGH ; ok for Multi Grid GridDim(0)=ymax-ymin GridDim(1)=xmax-xmin GridDim(2)=zmax-zmin sState.GeoStructure.nxg=ymax-ymin sState.GeoStructure.nyg=xmax-xmin sState.GeoStructure.nzg=zmax-zmin sState.GeoStructure.xmin=ymin sState.GeoStructure.xmax=ymax sState.GeoStructure.ymin=xmin sState.GeoStructure.ymax=xmax sState.GeoStructure.zmin=zmin sState.GeoStructure.zmax=zmax sState.oView3D->SetProperty, COLOR=[255,255,255] sState.oVectorField->SetProperty , COLOR=[0,0,0] sState.oStreamlines->SetProperty , COLOR=[0,0,0] sState.xaxis3Dbounds1->SetProperty , COLOR=[0,0,0] sState.xaxis3Dbounds2->SetProperty , COLOR=[0,0,0] sState.xaxis3Dbounds3->SetProperty , COLOR=[0,0,0] sState.xaxis3Dbounds4->SetProperty , COLOR=[0,0,0] sState.yaxis3Dbounds1->SetProperty , COLOR=[0,0,0] sState.yaxis3Dbounds2->SetProperty , COLOR=[0,0,0] sState.yaxis3Dbounds3->SetProperty , COLOR=[0,0,0] sState.yaxis3Dbounds4->SetProperty , COLOR=[0,0,0] sState.zaxis3Dbounds1->SetProperty , COLOR=[0,0,0] sState.zaxis3Dbounds2->SetProperty , COLOR=[0,0,0] sState.zaxis3Dbounds3->SetProperty , COLOR=[0,0,0] sState.zaxis3Dbounds4->SetProperty , COLOR=[0,0,0] sState.xTitleObj3D->SetProperty, STRINGS=' Radius' sState.yTitleObj3D->SetProperty, STRINGS=' Phi' sState.zTitleObj3D->SetProperty, STRINGS=' Theta' result=sState.oData_GridDim->SetData(GridDim) RETURN, dum END ;------------------------------------------------------------------------- PRO LoadPredefinedLUT, sState print,'Load Predefined LUT' ; (RadialB1a.lut) NrgbNots=10 NalphaNots=10 IndRedGrnBlu=intarr(4,NrgbNots+1) i=0 IndRedGrnBlu[0,i]=0 & IndRedGrnBlu[1,i]=0 & IndRedGrnBlu[2,i]=0 & IndRedGrnBlu[3,i]=0 i=1 IndRedGrnBlu[0,i]=4 & IndRedGrnBlu[1,i]=185 & IndRedGrnBlu[2,i]=255 & IndRedGrnBlu[3,i]=255 i=2 IndRedGrnBlu[0,i]=108 & IndRedGrnBlu[1,i]=79 & IndRedGrnBlu[2,i]=255 & IndRedGrnBlu[3,i]=255 i=3 IndRedGrnBlu[0,i]=121 & IndRedGrnBlu[1,i]=51 & IndRedGrnBlu[2,i]=51 & IndRedGrnBlu[3,i]=255 i=4 IndRedGrnBlu[0,i]=126 & IndRedGrnBlu[1,i]=0 & IndRedGrnBlu[2,i]=0 & IndRedGrnBlu[3,i]=0 i=5 IndRedGrnBlu[0,i]=129 & IndRedGrnBlu[1,i]=0 & IndRedGrnBlu[2,i]=0 & IndRedGrnBlu[3,i]=0 i=6 IndRedGrnBlu[0,i]=135 & IndRedGrnBlu[1,i]=255 & IndRedGrnBlu[2,i]=51 & IndRedGrnBlu[3,i]=51 i=7 IndRedGrnBlu[0,i]=144 & IndRedGrnBlu[1,i]=255 & IndRedGrnBlu[2,i]=255 & IndRedGrnBlu[3,i]=0 i=8 IndRedGrnBlu[0,i]=165 & IndRedGrnBlu[1,i]=255 & IndRedGrnBlu[2,i]=255 & IndRedGrnBlu[3,i]=128 i=9 IndRedGrnBlu[0,i]=251 & IndRedGrnBlu[1,i]=255 & IndRedGrnBlu[2,i]=255 & IndRedGrnBlu[3,i]=255 i=10 IndRedGrnBlu[0,i]=255 & IndRedGrnBlu[1,i]=0 & IndRedGrnBlu[2,i]=0 & IndRedGrnBlu[3,i]=0 IndAlpha=intarr(2,NalphaNots+1) i=0 IndAlpha[0,i]=0 & IndAlpha[1,i]=254 i=1 IndAlpha[0,i]=68 & IndAlpha[1,i]=254 i=2 IndAlpha[0,i]=88 & IndAlpha[1,i]=2 i=3 IndAlpha[0,i]=98 & IndAlpha[1,i]=0 i=4 IndAlpha[0,i]=111 & IndAlpha[1,i]=254 i=5 IndAlpha[0,i]=127 & IndAlpha[1,i]=0 i=6 IndAlpha[0,i]=129 & IndAlpha[1,i]=0 i=7 IndAlpha[0,i]=140 & IndAlpha[1,i]=246 i=8 IndAlpha[0,i]=154 & IndAlpha[1,i]=2 i=9 IndAlpha[0,i]=171 & IndAlpha[1,i]=252 i=10 IndAlpha[0,i]=255 & IndAlpha[1,i]=254 ;print,'NrgbNots=',NrgbNots ;print,'NalphaNots=',NalphaNots ;print,'IndRedGrnBlu=',IndRedGrnBlu ;print,'IndAlpha=',IndAlpha NewOpac=bytarr(256) for i=0,NalphaNots-1 do begin index_inf=IndAlpha[0,i] index_sup=IndAlpha[0,i+1] nramp=index_sup-index_inf ;print,'nramp=',nramp iramp=intarr(nramp) for j=0,nramp-1 do begin iramp[j]=IndAlpha[1,i]+j*(IndAlpha[1,i+1]-IndAlpha[1,i])/nramp endfor NewOpac[index_inf:index_sup-1]=iramp ;print,'i,index_inf,index_sup=',i,index_inf,index_sup endfor result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty,OPACITY_TABLE0=NewOpac result=sState.oData_VolumeOpacity->SetData(NewOpac) ;sCOT.oPlotCOT[3]->SetProperty, Datay=NewOpac vColors=intarr(256,3) for k=0,2 do begin for i=0,NrgbNots-1 do begin index_inf=IndRedGrnBlu[0,i] index_sup=IndRedGrnBlu[0,i+1] nramp=index_sup-index_inf iramp=intarr(nramp) for j=0,nramp-1 do begin iramp[j]=IndRedGrnBlu[1+k,i]+j*(IndRedGrnBlu[1+k,i+1]-IndRedGrnBlu[1+k,i])/nramp endfor vColors[index_inf:index_sup-1,k]=iramp endfor endfor oVolume[MovieFrameCURRENT]->SetProperty,RGB_TABLE0=vColors sState.oPaletteImage->SetProperty,RED_VALUES=vColors[*,0] sState.oPaletteImage->SetProperty,GREEN_VALUES=vColors[*,1] sState.oPaletteImage->SetProperty,BLUE_VALUES=vColors[*,2] result=sState.oData_vColors->SetData(vColors) END ;------------------------------------------------------------------------- FUNCTION LoadData, sState DataReduction=0 result=sState.oData_DataReduction->SetData(DataReduction) result=sState.oData_GridDim->GetData(GridDim) result=sState.oData_MemoryManagement->GetData(MemoryManagement) result=sState.oData_ProcessorId->GetData(ProcessorId) result=sState.oData_OutputReprise->GetData(OutputReprise) if OutputReprise eq 0 then begin result=sState.oData_SimuStepOutput->GetData(SimuStep) endif else if OutputReprise eq 1 then begin result=sState.oData_SimuStepReprise->GetData(SimuStep) end result=sState.oData_OptionsArray->GetData(OptionsArray) if ( OptionsArray[0] eq 1 ) then print ,'load with option ray' if ( OptionsArray[1] eq 1 ) then print ,'load with option dif' result=sState.oData_DataFormat->GetData(DataFormat) dum=1 valid_amrgrid=0 result=sState.oData_FillArrays->GetData(FillArrays) result=sState.oData_RamsesFillArrays->GetData(RamsesFillArrays) FillDensity = 0 FillPressure = 0 FillVelocity = 0 ReadParticles = 0 IF DataFormat EQ 1 OR DataFormat EQ 3 THEN BEGIN ;;; HERACLES OR RAMSES BINARY FillDensity = (FillArrays[0] eq 1 AND DataFormat le 2) OR $ (RamsesFillArrays[0] eq 1 AND DataFormat eq 3) FillPressure = (FillArrays[2] eq 1 AND DataFormat le 2) OR $ (RamsesFillArrays[5] eq 1 AND DataFormat eq 3) FillVelocity = (FillArrays[3] eq 1 AND DataFormat le 2) OR $ (RamsesFillArrays[1] eq 1 AND DataFormat eq 3) ENDIF IF DataFormat EQ 1 THEN BEGIN ;;; HERACLES BINARY print ,'load with ProcessorId=',fix(ProcessorId) print ,'load with Output=',fix(SimuStep) rs,sState,fix(ProcessorId),fix(SimuStep),t,x,n,r,p,u,f,er,fr,ed,E,OptionsArray,err if err ne 0 then return, dum WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='bin. data loaded' ENDIF ELSE IF ( DataFormat EQ 2 ) THEN BEGIN ;;; HERACLES HDF print ,'load with ProcessorId=',fix(ProcessorId) print ,'load with Output=',fix(SimuStep) result=sState.oData_DataDir->GetData(DataDir) CD, DataDir print,'cd DataDir=',DataDir ;h5rs,sState,fix(ProcessorId),fix(SimuStep),t,x,n,r,p,u,f,er,fr,ed,OptionsArray h5rs,sState,fix(ProcessorId),fix(SimuStep) result=sState.oData_InitialDir->GetData(InitialDir) CD, InitialDir print,'cd InitialDir=',InitialDir WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='HDF5 data loaded' ENDIF ELSE IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES BINARY result=sState.oData_taskFarmingarrays->GetData(taskFarmingarrays) taskdl=taskFarmingarrays[0] ReadAmr = RamsesFillArrays[9] EQ 1 WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='AMR data loaded' ReadHydro = RamsesFillArrays[0] EQ 1 OR RamsesFillArrays[1] EQ 1 OR $ RamsesFillArrays[2] EQ 1 OR RamsesFillArrays[3] EQ 1 OR $ RamsesFillArrays[4] EQ 1 OR RamsesFillArrays[5] EQ 1 OR $ RamsesFillArrays[6] EQ 1 ;print,'ReadHydro=',ReadHydro ReadParticlesVELDEN = RamsesFillArrays[8] EQ 1 ReadParticles = RamsesFillArrays[7] EQ 1 OR ReadParticlesVELDEN result=sState.oData_SimuStepOutput->GetData(SimuStepOutput) result=sState.oData_AMRoctreeCurrent->GetData(AMRoctreeCurrent) result=sState.oData_Endian->GetData(Endian) result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) ;print,'Load Output SimuStepOutput=',SimuStepOutput ;print,' AMRoctreeCurrent=',AMRoctreeCurrent WIDGET_CONTROL, sState.wRamsesCpuBox, GET_VALUE=indexCpuBox cpubox_update=0 if indexCpuBox[0] eq 1 then begin box2cpu,SimuStepOutput,MeshIJKboundaries,cpubox,Endian result=sState.oData_AMRoctreeCpuBoxCurrent->GetData(AMRoctreeCpuBoxCurrent) if array_equal(AMRoctreeCpuBoxCurrent,cpubox) eq 0 then begin cpubox_update=1 result=sState.oData_AMRoctreeCpuBoxCurrent->SetData(cpubox) endif endif varhydro_update=0 IF ReadHydro THEN BEGIN result=sState.oData_AMRoctreeVarHydro->GetData(AMRoctreeVarHydroCurrent) ivar=1 ; AMRoctreeVarHydroCurrent[0] nvar=6 ; AMRoctreeVarHydroCurrent[1] ;help, RamsesFillArrays & print,RamsesFillArrays if array_equal(RamsesFillArrays,[1,0,0,0,0,0,0,0,0,1]) then begin print,'rd_hydro density only' ivar=1 nvar=1 endif else if array_equal(RamsesFillArrays,[0,0,0,0,0,1,0,0,0,1]) then begin print,'rd_hydro pressure only' ivar=5 nvar=1 endif else if array_equal(RamsesFillArrays,[0,0,0,0,0,0,1,0,0,1]) then begin print,'rd_hydro metals only' ivar=6 nvar=1 endif if ivar ne AMRoctreeVarHydroCurrent[0] or nvar ne AMRoctreeVarHydroCurrent[1] then begin ;print,'varhydro_update !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' varhydro_update=1 AMRoctreeVarHydro=AMRoctreeVarHydroCurrent AMRoctreeVarHydro[0]=ivar & AMRoctreeVarHydro[1]=nvar result=sState.oData_AMRoctreeVarHydro->SetData(AMRoctreeVarHydro) endif ENDIF result=sState.oData_AmrLevels->GetData(AmrLevels) lmin=AmrLevels[0] lmax=AmrLevels[1] amrhydroLevelmax_update=0 result=sState.oData_AMRoctreeAmrHydroLmaxRead->GetData(AMRoctreeAmrHydroLmaxRead) if lmax gt AMRoctreeAmrHydroLmaxRead then begin ;print,'amrhydroLevelmax update needed !' amrhydroLevelmax_update=1 endif ; the reading of the amr is launched if hydro is needed and: ; * the output number has been changed ; * or the cpubox list has been changed (the boundaries of the subvolume were modified) ; * or higher amr/hydro levels are needed by meshijk RDAmr = ReadAmr and (SimuStepOutput ne AMRoctreeCurrent[0] or cpubox_update eq 1 or amrhydroLevelmax_update eq 1) RDHydro = ReadHydro and (SimuStepOutput ne AMRoctreeCurrent[1] or cpubox_update eq 1 or amrhydroLevelmax_update eq 1 or varhydro_update eq 1) RDParticles = ReadParticles and (SimuStepOutput ne AMRoctreeCurrent[2] or cpubox_update eq 1) RDParticlesVELDEN = ReadParticlesVELDEN and (SimuStepOutput ne AMRoctreeCurrent[3] or cpubox_update eq 1) amrformat = WIDGET_INFO( sState.wRamsesConfig[3], /DROPLIST_SELECT) if taskdl eq 0 then begin IF RDAmr THEN BEGIN if amrformat eq 0 then begin limit_lmax=MemoryManagement[3] rd_amr,a,nout=SimuStepOutput,err=err,swap=Endian,cpubox=cpubox,lmaxmeshijk=lmax,limit_lmax=limit_lmax endif else begin rd_amr2008,a,nout=SimuStepOutput,swap=Endian ;,cpubox=cpubox,lmaxmeshijk=lmax err=0 endelse if err eq 0 then result=sState.oData_AMRoctreeGrid->SetData(a) ;print,'rd_amr err=',err if err ne 0 then begin print,'rd_amr err=',err print,' ' print,' ---> error in loading data' return, dum endif AMRoctreeAmrHydroLmaxRead=lmax result=sState.oData_AMRoctreeAmrHydroLmaxRead->SetData(AMRoctreeAmrHydroLmaxRead) ENDIF IF RDHydro THEN BEGIN if amrformat eq 0 then begin rd_hydro,h,nout=SimuStepOutput,err=err,swap=Endian,cpubox=cpubox,lmaxmeshijk=lmax,ivar=ivar,nvar=nvar endif else begin rd_hydro2008,h,nout=SimuStepOutput,swap=Endian,ivar=ivar;,nvar=nvar,cpubox=cpubox,lmaxmeshijk=lmax err=0 endelse ;print,'rd_hydro err=',err if err eq 0 then result=sState.oData_AMRoctreeHydro->SetData(h) if err ne 0 then begin print,'rd_hydro err=',err print,' ' print,' ---> error in loading data' return, dum endif ENDIF IF RDParticles or ReadParticlesVELDEN THEN BEGIN IF ReadParticlesVELDEN THEN BEGIN if amrformat eq 0 then begin rd_part,part,nout=SimuStepOutput,err=err,swap=Endian,/velocity,/den,cpubox=cpubox endif else begin rd_part2008,part,nout=SimuStepOutput,swap=Endian,/velocity,/den;,cpubox=cpubox err=0 endelse ENDIF ELSE BEGIN if amrformat eq 0 then begin rd_part,part,nout=SimuStepOutput,err=err,swap=Endian,cpubox=cpubox ;print,'rd_part completed' ;print,'Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' endif else begin rd_part2008,part,nout=SimuStepOutput,swap=Endian;,cpubox=cpubox err=0 endelse ENDELSE if err eq 0 then result=sState.oData_AMRoctreePart->SetData(part,no_copy=1) ;print,'part handling completed' ;print,'Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' if err ne 0 then begin print,'rd_part err=',err print,' ' print,' ---> error in loading data' return, dum endif ENDIF if RDAmr then AMRoctreeCurrent[0]=SimuStepOutput if RDHydro then AMRoctreeCurrent[1]=SimuStepOutput if RDParticles then AMRoctreeCurrent[2]=SimuStepOutput if RDParticlesVELDEN then AMRoctreeCurrent[3]=SimuStepOutput result=sState.oData_AMRoctreeCurrent->SetData(AMRoctreeCurrent) IF RDAmr EQ 0 THEN result=sState.oData_AMRoctreeGrid->GetData(a) IF ReadHydro EQ 1 and RDHydro EQ 0 THEN result=sState.oData_AMRoctreeHydro->GetData(h) IF ReadParticles EQ 1 and RDParticles EQ 0 THEN result=sState.oData_AMRoctreePart->GetData(part) IF ReadParticlesVELDEN EQ 1 and RDParticlesVELDEN EQ 0 THEN result=sState.oData_AMRoctreePart->GetData(part) endif if ReadParticlesVELDEN eq 0 then begin sample=100 result=sState.oData_ParticlesSampling->SetData(sample) WIDGET_CONTROL,sState.wParticlesConfigBase,MAP=0 endif else begin WIDGET_CONTROL,sState.wParticlesConfigBase,MAP=1 endelse ;result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) xr=fltarr([2]) yr=fltarr([2]) zr=fltarr([2]) xr[0]=MeshIJKboundaries[0] xr[1]=MeshIJKboundaries[1] yr[0]=MeshIJKboundaries[2] yr[1]=MeshIJKboundaries[3] zr[0]=MeshIJKboundaries[4] zr[1]=MeshIJKboundaries[5] ;print,'Meshijk boundaries =',xr,yr,zr if taskdl then begin TaskDLInit,sState,oFarm save,'RD_AMR','GETCARNUM','DEL_AMR','TRIM','MESHIJK',$ 'RD_HYDRO','DEL_HYDRO',filename='taskdl-util.sav',/routines save,lmin,lmax,xr,yr,zr,filename='taskdl-data.sav' ;;; ??? à verifier result=sState.oData_AMRoctreeGrid->SetData(a) endif result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) ;print,'Get MeshIJKStatus=',MeshIJKStatus ; Density ; ;print,'FillDensity=',FillDensity ;print,'MeshIJKStatus[0]=',MeshIJKStatus[0] if FillDensity and MeshIJKStatus[0] eq 2 then begin type=1 if taskdl then begin TaskDLFarming,oFarm,type,SimuStepOutput endif else begin print,'projecting density amr data structure in cartesian grid' ;print,'in meshijk xr=',xr,' yr=',yr,' zr=',zr i=0 if obj_valid(sState.oData_HDFvar[i,0]) then begin r=0 result=sState.oData_HDFvar[i,0]->SetData(r,/NO_COPY) print,'flush data object for variable: density' endif vol=meshijk(a,h,lmin=lmin,lmax=lmax,type=type,xr=xr,yr=yr,zr=zr) MeshIJKStatus[0]=1 ;print,'out meshijk xr=',vol.xr,' yr=',vol.yr,' zr=',vol.zr r=vol.DATA endelse endif ; Pressure ; if FillPressure and MeshIJKStatus[5] eq 2 then begin type=5 if taskdl then begin TaskDLFarming,oFarm,type,SimuStepOutput endif else begin print,'projecting pressure amr data structure in cartesian grid' vol=meshijk(a,h,lmin=lmin,lmax=lmax,type=type,xr=xr,yr=yr,zr=zr) MeshIJKStatus[5]=1 p=vol.DATA endelse endif ; metals ; if ( RamsesFillArrays[6] eq 1 and MeshIJKStatus[6] eq 2 ) then begin type=6 if taskdl then begin TaskDLFarming,oFarm,type,SimuStepOutput endif else begin print,'projecting metals amr data structure in cartesian grid' vol=meshijk(a,h,lmin=lmin,lmax=lmax,type=type,xr=xr,yr=yr,zr=zr) MeshIJKStatus[6]=1 m=vol.DATA endelse endif ; velocity ; if (FillVelocity or RamsesFillArrays[2] eq 1) and $ (MeshIJKStatus[1] eq 2 or MeshIJKStatus[2] eq 2) then begin type=2 if taskdl then begin TaskDLFarming,oFarm,type,SimuStepOutput endif else begin print,'projecting ux amr data structure in cartesian grid' vol=meshijk(a,h,lmin=lmin,lmax=lmax,type=type,xr=xr,yr=yr,zr=zr) ;MeshIJKStatus[1]=1 MeshIJKStatus[2]=1 ux=vol.DATA endelse endif if (FillVelocity or RamsesFillArrays[3] eq 1) and $ (MeshIJKStatus[1] eq 2 or MeshIJKStatus[3] eq 2) then begin type=3 if taskdl then begin TaskDLFarming,oFarm,type,SimuStepOutput endif else begin print,'projecting uy amr data structure in cartesian grid' vol=meshijk(a,h,lmin=lmin,lmax=lmax,type=type,xr=xr,yr=yr,zr=zr) ;MeshIJKStatus[1]=1 MeshIJKStatus[3]=1 uy=vol.DATA endelse endif if (FillVelocity or RamsesFillArrays[4] eq 1) and $ (MeshIJKStatus[1] eq 2 or MeshIJKStatus[4] eq 2) then begin type=4 if taskdl then begin TaskDLFarming,oFarm,type,SimuStepOutput endif else begin print,'projecting uz amr data structure in cartesian grid' vol=meshijk(a,h,lmin=lmin,lmax=lmax,type=type,xr=xr,yr=yr,zr=zr) ;MeshIJKStatus[1]=1 MeshIJKStatus[4]=1 uz=vol.DATA endelse endif if FillVelocity and MeshIJKStatus[1] eq 2 then MeshIJKStatus[1]=1 ;if RamsesFillArrays[2] eq 1 and MeshIJKStatus[2] eq 2 then MeshIJKStatus[2]=1 if taskdl then TaskDLMonitor,oFarm ; gather TaskDL tasks and close session ; if taskdl then begin if FillDensity then begin TaskDLGather,oFarm,1,vol r=vol.DATA endif if FillPressure then begin TaskDLGather,oFarm,5,vol p=vol.DATA endif if RamsesFillArrays[6] eq 1 then begin TaskDLGather,oFarm,6,vol m=vol.DATA endif if FillVelocity or RamsesFillArrays[2] eq 1 then begin TaskDLGather,oFarm,2,vol ux=vol.DATA endif if FillVelocity or RamsesFillArrays[3] eq 1 then begin TaskDLGather,oFarm,3,vol uy=vol.DATA endif if FillVelocity or RamsesFillArrays[4] eq 1 then begin TaskDLGather,oFarm,4,vol uz=vol.DATA endif oFarm->close_session print,'close task farming session' spawn,'rm taskdl-util.sav taskdl-data.sav' endif help,vol,output=test_valid valid_amrgrid=1-strcmp(test_valid,'VOL UNDEFINED = ') ;print,'test_valid=',test_valid ;print,'valid=',valid if valid_amrgrid eq 1 then begin GridDim(0)=vol.NX GridDim(1)=vol.NY GridDim(2)=vol.NZ if FillVelocity then begin ;ndim=2^AmrLevels[1] ;u=fltarr(ndim,ndim,ndim,3) u=fltarr(vol.NX,vol.NY,vol.NZ,3) help,ux,output=test_valid valid_ux=1-strcmp(test_valid,'UX UNDEFINED = ') help,uy,output=test_valid valid_uy=1-strcmp(test_valid,'UY UNDEFINED = ') help,uz,output=test_valid valid_uz=1-strcmp(test_valid,'UZ UNDEFINED = ') if valid_ux eq 0 and MeshIJKStatus[1] eq 1 then begin result=sState.oData_HDFvar[3,0]->GetData(u) ux=u[*,*,*,0] valid_ux=1 endif if valid_uy eq 0 and MeshIJKStatus[1] eq 1 then begin result=sState.oData_HDFvar[3,0]->GetData(u) uy=u[*,*,*,1] valid_uy=1 endif if valid_uz eq 0 and MeshIJKStatus[1] eq 1 then begin result=sState.oData_HDFvar[3,0]->GetData(u) uz=u[*,*,*,2] valid_uz=1 endif if valid_ux and valid_uy and valid_uz then begin u(*,*,*,0)=ux u(*,*,*,1)=uy u(*,*,*,2)=uz endif else begin print, 'problem in loading velocity' end endif endif else begin GridDim[0:2]=2^AmrLevels[1] ;print,'sizes of Cartesian grids not defined' ;print,'assume cube of size 2^AmrLevel' endelse ;print,'TEST GridDim=',GridDim result=sState.oData_GridDim->SetData(GridDim) ;print, 'Set MeshIJKStatus=',MeshIJKStatus result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) ENDIF ELSE IF ( DataFormat EQ 4 ) THEN BEGIN ;;; ASH BoB ;WIDGET_CONTROL, sState.wAshConfig[0], GET_VALUE=AshBoBsize AshBoBsize=WIDGET_INFO( sState.wAshConfig[0], /COMBOBOX_GETTEXT) result=sState.oData_datanames->GetData(datanames) result=sState.oData_AshFileName->GetData(AshFileName) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_DataDimHDF->GetData(fourdim) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) AshBoBsizeMaxReso=AshBoBsize for i=0,nvar-1 do begin a=bytarr(AshBoBsize,AshBoBsize,AshBoBsize) ;print,'LoadData :: i,nvar=',i,nvar ;print,' AshFileName[i,*]=',AshFileName[i,*] sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData') AshBoBsize=AshBoBsizeMaxReso offset=0. if fourdim[i] eq 1 then begin openu,3,AshFileName[i,0], ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', AshFileName[i,0] ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return, dum endif readu,3,a close,3 ;print,'min(a),max(a)=',min(a),max(a) print,'Load Ash BoB file ',AshFileName[i,0],' in variable ',datanames[i] ;help,a if AshBoBsize gt 1500 then begin AshBoBsize=AshBoBsizeMaxReso/2 b=congrid(float(a),AshBoBsize,AshBoBsize,AshBoBsize) help,b result=sState.oData_HDFvar[i,0]->SetData( b - offset ) endif else begin ;a=a-offset ;result=sState.oData_HDFvar[i,0]->SetData( float(a) - offset ) ;print,'a(51,184,99)=',a(51,184,99) ab=float(a)-offset ;print,'ab(51,184,99)=',ab(51,184,99) result=sState.oData_HDFvar[i,0]->SetData( ab ) endelse endif offset=127. if fourdim[i] eq 3 then begin if AshBoBsize gt 1500 then AshBoBsize=AshBoBsizeMaxReso/2 v=fltarr(AshBoBsize,AshBoBsize,AshBoBsize,3) ; initialization (x,y,z) ; print,' initialization (x,y,z) system ... ' x=fltarr(AshBoBsize,AshBoBsize,AshBoBsize) y=fltarr(AshBoBsize,AshBoBsize,AshBoBsize) z=fltarr(AshBoBsize,AshBoBsize,AshBoBsize) xi=indgen(AshBoBsize,/float) c=(float(AshBoBsize)-1.)/2. ;print,'c=',c xi = xi - c for i1=0,AshBoBsize-1 do begin for i2=0,AshBoBsize-1 do begin x(0:AshBoBsize-1,i1,i2)=xi(0:AshBoBsize-1) y(i1,0:AshBoBsize-1,i2)=xi(0:AshBoBsize-1) z(i1,i2,0:AshBoBsize-1)=xi(0:AshBoBsize-1) endfor endfor ;;theta= atan(sqrt((x-c)*(x-c) + (y-c)*(y-c))/(z-c)) ;;phi = atan((y-c)/(x-c)) theta= atan(sqrt((x)*(x) + (y)*(y)),z) phi = atan(y,x) ;print,'theta95=',theta(100:110,10:20,95) ;print,'theta105=',theta(100:110,10:20,105) ;xyz=fltarr(3,AshBoBsize,AshBoBsize,AshBoBsize) ;xyz(0,*,*,*)=x ;xyz(1,*,*,*)=y ;xyz(2,*,*,*)=z ;sphere_coord=CV_COORD(FROM_RECT=xyz,/TO_SPHERE) ;theta=sphere_coord(1,*) ;phi=sphere_coord(0,*) xp=ptr_new(x, /no_copy) yp=ptr_new(y, /no_copy) zp=ptr_new(z, /no_copy) ptr_free,xp ptr_free,yp ptr_free,zp openu,3,AshFileName[i,0], ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', AshFileName[i,0] ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return, dum endif readu,3,a close,3 print,'Load Ash BoB file ',AshFileName[i,0],' in vector variable ',datanames[i],'r' ;v(*,*,*,0)=float(congrid(a,AshBoBsize,AshBoBsize,AshBoBsize)) - offset v(*,*,*,0)=float(a) - offset ;v(*,*,*,0)=0. ;print,'WARNING - R component not forced to zero' openu,4,AshFileName[i,1], ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', AshFileName[i,0] ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return, dum endif readu,4,a close,4 print,'Load Ash BoB file ',AshFileName[i,1],' in vector variable ',datanames[i],'theta' ;v(*,*,*,1)=float(congrid(a,AshBoBsize,AshBoBsize,AshBoBsize)) - offset v(*,*,*,1)=float(a) - offset ;v(*,*,*,1)=0. ; print,'WARNING - Theta component not forced to zero' openu,5,AshFileName[i,2], ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', AshFileName[i,0] ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return, dum endif readu,5,a close,5 print,'Load Ash BoB file ',AshFileName[i,2],' in vector variable ',datanames[i],'phi' ;v(*,*,*,2)=float(congrid(a,AshBoBsize,AshBoBsize,AshBoBsize)) - offset v(*,*,*,2)=float(a) - offset ap=ptr_new(a, /no_copy) ptr_free,ap ;v(*,*,*,*)=0. ;;test phi ;v(90:110,10:20,95:105,2)=-100. ;v(90:110,180:190,95:105,2)=-100. ;v(10:20,90:110,95:105,2)=-100. ;v(180:190,90:110,95:105,2)=-100. ;;test theta ;v(90:110,10:20,95:105,0)=-100. ;v(90:110,180:190,95:105,0)=-100. ;v(10:20,90:110,95:105,0)=-100. ;v(180:190,90:110,95:105,0)=-100. ; conversion (x,y,z) / (r,theta,phi) ; print,' convert to (x,y,z) system ... ' w=fltarr(AshBoBsize,AshBoBsize,AshBoBsize,3) w(*,*,*,0) = v(*,*,*,0)*sin(theta)*cos(phi) + $ v(*,*,*,1)*cos(theta)*cos(phi) - $ v(*,*,*,2)*sin(phi) w(*,*,*,1) = v(*,*,*,0)*sin(theta)*sin(phi) + $ v(*,*,*,1)*cos(theta)*sin(phi) + $ v(*,*,*,2)*cos(phi) w(*,*,*,2) = v(*,*,*,0)*cos(theta) - v(*,*,*,1)*sin(theta) ;print,'v(180:190,90:110,95:105,2)=',v(180:190,90:110,95:105,2) ;print,'w(180:190,90:110,95:105,0)=',w(180:190,90:110,95:105,0) print,' ... done' result=sState.oData_HDFvar[i,0]->SetData(w) endif result=sState.oData_RebinData->GetData(RebinData) RebinData[*]=AshBoBsize result=sState.oData_RebinData->SetData(RebinData) result=sState.oData_GridDim->SetData(RebinData) ;result=GridPrint(sState) FillArraysHDF[i]=1 ;sState.wPickVarObjButton_hdfvar[i] = WIDGET_BUTTON(sState.wVarButton, $ ;VALUE='Display '+datanames[i], UVALUE='PICKVAR_'+datanames[i], SENSITIVE=1) endfor result=sState.oData_FillArraysHDF->SetData(FillArraysHDF) ;LoadPredefinedLUT,sState WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='ASH data loaded' ENDIF ELSE IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='multi-grid loaded' ;WIDGET_CONTROL,sState.wVolumeOptions[13],SET_VALUE= $ ; 'Volume is drawn at level 0' ;WIDGET_CONTROL,sState.wVolumeOptions[14],SET_VALUE= $ ; 'of the multiple grid' result=sState.oData_SimuStepOutput->GetData(SimuStepOutput) readstruct,dir=dir,nb=SimuStepOutput,sGeo,sGrid ;print,'LoadData nb=',SimuStepOutput ;print,'LoadData sGeo.in.SIZE1=',sGeo.in.SIZE1 ;help,sGrid,/struct ;help,sGrid.PCORNER_MIN ;print,'sGrid.cgridnumber=',sGrid.cgridnumber ;print,'sGrid.PCORNER_MIN=',sGrid.PCORNER_MIN[*,0] ;print,'sGrid.PCORNER_MAX=',sGrid.PCORNER_MAX[*,0] ;help,sGeo,/struct ;help,sGeo.in,/struct ;print,'sGrid.NCORNER_MIN=',sGrid.NCORNER_MIN ;print,'sGrid.NCORNER_MAX=',sGrid.NCORNER_MAX ;print,'sGrid.GNCORNER_MIN=',sGrid.GNCORNER_MIN ;print,'sGrid.GNCORNER_MAX=',sGrid.GNCORNER_MAX ;print,'sGrid.ICPUFACE(*,0,0)=',sGrid.ICPUFACE(*,0,0) ;print,'sGrid.ICPUFACE(*,0,1)=',sGrid.ICPUFACE(*,0,1) ngrid=sGrid.ngrid ;print,'LoadData ngrid=',ngrid MultiGridSize=intarr(ngrid,3) MultiGridPosition=intarr(ngrid,3,2) print,'sGrid.NX=',sGrid.NX print,'sGrid.NY=',sGrid.NY print,'sGrid.NZ=',sGrid.NZ for k=0,ngrid-1 do begin level=ngrid-k-1 desclist,level=level,nb=SimuStepOutput,list=list print,'------------------------------------------------------------------------------------------' print,'LoadData level ',level print,'grid list=',list print,'nx,ny,nz=',sGrid.nx(k),sGrid.ny(k),sGrid.nz(k) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_datanames->GetData(datanames) result=sState.oData_DataDimHDF->GetData(fourdim) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) for j=0,nvar-1 do begin if FillArraysHDF[j] eq 1 then begin ;varJupiter=dblarr(sGeo.in.SIZE1,sGeo.in.SIZE2,sGeo.in.SIZE3) ;w=fltarr(sGeo.in.SIZE1,sGeo.in.SIZE2,sGeo.in.SIZE3,3) nx=sGrid.nx(k) ny=sGrid.ny(k) nz=sGrid.nz(k) varJupiter=fltarr(nx,ny,nz, /nozero) w=fltarr(nx,ny,nz,3, /nozero) ;if (list[0] NE -1) and k eq 4 then begin if (list[0] NE -1) then begin ncpugrids = (size(list))(1) for i=0, ncpugrids-1 do begin print,'Load Jupiter ',datanames[j],' field, level',level,' cgrid #',sGrid.cgridnumber(list(i)) if datanames[j] eq 'velocity' then begin ;print,'test velo' read_field,field=vx,$ cpugrid=list(i),/quiet,radix='velocity',size=s,component=0 read_field,field=vy,$ cpugrid=list(i),/quiet,radix='velocity',size=s,component=1 read_field,field=vz,$ cpugrid=list(i),/quiet,radix='velocity',size=s,component=2 ;help,vx,vy,vz endif else if datanames[j] eq 'velocity0' then begin ;print,'test velo component 0' read_field,field=f,edge1=x,edge2=y,edge3=z,size=s,$ cpugrid=list(i),/quiet,/velocity,component=0 ;help,f endif else if datanames[j] eq 'velocity1' then begin ;print,'test velo component 1' read_field,field=f,edge1=x,edge2=y,edge3=z,size=s,$ cpugrid=list(i),/quiet,/velocity,component=1 ;help,f endif else if datanames[j] eq 'velocity2' then begin ;print,'test velo component 2' read_field,field=f,edge1=x,edge2=y,edge3=z,size=s,$ cpugrid=list(i),/quiet,/velocity,component=2 ;help,f endif else begin ;print,'call read_field with list(i)=',list(i) read_field,field=f,edge1=x,edge2=y,edge3=z,size=s,$ cpugrid=list(i),/quiet,radix=datanames[j],component=0,$ bounds=bounds ;,mesh=mesh ;help,f ;print,'i,min(f),max(f)=',i,min(f),max(f) endelse ;print,'x=',x ;print,'i,list(i),bounds=',i,list(i),bounds ;print,' size=',s ;print,'sGrid.CGRIDNUMBER[list(i)]=',sGrid.CGRIDNUMBER[list(i)] ;print,'PCORNER_MIN[list(i),0],sGrid.PCORNER_MAX[list(i),0]=',sGrid.PCORNER_MIN[list(i),0],sGrid.PCORNER_MAX[list(i),0] ;print,'PCORNER_MIN[list(i),1],sGrid.PCORNER_MAX[list(i),1]=',sGrid.PCORNER_MIN[list(i),1],sGrid.PCORNER_MAX[list(i),1] ;print,'PCORNER_MIN[list(i),2],sGrid.PCORNER_MAX[list(i),2]=',sGrid.PCORNER_MIN[list(i),2],sGrid.PCORNER_MAX[list(i),2] igrid=sGrid.cgridnumber(list(i)) ixmin=sGrid.PCORNER_MIN[igrid,0] iymin=sGrid.PCORNER_MIN[igrid,1] izmin=sGrid.PCORNER_MIN[igrid,2] ixmax=sGrid.PCORNER_MAX[igrid,0] -1 iymax=sGrid.PCORNER_MAX[igrid,1] -1 izmax=sGrid.PCORNER_MAX[igrid,2] -1 ;if i mod 4 eq 0 then $ ;print,'i,list(i),igrid,s(0),pcorner_min[igrid,0],pcorner_max[igrid,0]=', $ ; i,list(i),igrid,s(0),sGrid.PCORNER_MIN[igrid,0],sGrid.PCORNER_MAX[igrid,0] ;print,' s(1),pmin,pmax=',i,s(1),sGrid.PCORNER_MIN[list(i),1],sGrid.PCORNER_MAX[list(i),1] ;print,' s(2),pmin,pmax=',i,s(2),sGrid.PCORNER_MIN[list(i),2],sGrid.PCORNER_MAX[list(i),2] ;print,' s=',s ;if i mod 4 eq 0 then $ ;print,' ixmin,ixmax=',ixmin,ixmax ;print,' iymin,iymax=',iymin,iymax ;print,' izmin,izmax=',izmin,izmax if datanames[j] ne 'velocity' then begin varJupiter(ixmin:ixmax,iymin:iymax,izmin:izmax) = f ;varJupiter(ixmax-1:ixmax,iymin:iymax,izmin:izmax) = 0 endif else begin w(ixmin:ixmax,iymin:iymax,izmin:izmax,0) = vy w(ixmin:ixmax,iymin:iymax,izmin:izmax,1) = vx w(ixmin:ixmax,iymin:iymax,izmin:izmax,2) = vz endelse endfor ; i=0, ncpugrids-1 ; if level eq 0 then begin ; ixholemin=sGrid.NCORNER_MIN[k-1,0]/32 ; ixholemax=sGrid.NCORNER_MAX[k-1,0]/32 -1 ; iyholemin=sGrid.NCORNER_MIN[k-1,1]/32 ; iyholemax=sGrid.NCORNER_MAX[k-1,1]/32 -1 ; izholemin=sGrid.NCORNER_MIN[k-1,2]/32 ; izholemax=sGrid.NCORNER_MAX[k-1,2]/32 -1 ; print,'k=',k ; print,'sGrid.NCORNER_MAX[k-1,*]=',sGrid.NCORNER_MAX[k-1,*] ; print,'sGrid.NCORNER_MIN[k-1,*]=',sGrid.NCORNER_MIN[k-1,*] ; print,'ixholemin,ixholemax=',ixholemin,ixholemax ; print,'iyholemin,iyholemax=',iyholemin,iyholemax ; print,'izholemin,izholemax=',izholemin,izholemax ; print,'sGrid.NCORNER_MAX[k-1,*]/32=',sGrid.NCORNER_MAX[k-1,*]/32. ; print,'sGrid.NCORNER_MIN[k-1,*]/32=',sGrid.NCORNER_MIN[k-1,*]/32. ; endif if level lt ngrid-1 then begin ;help, MultiGridPosition[level,*,0] ;help,sGrid.NCORNER_MIN[k-1,*] MultiGridPosition[level,0,0]=sGrid.NCORNER_MIN[k-1,1] MultiGridPosition[level,0,1]=sGrid.NCORNER_MAX[k-1,1] MultiGridPosition[level,1,0]=sGrid.NCORNER_MIN[k-1,0] MultiGridPosition[level,1,1]=sGrid.NCORNER_MAX[k-1,0] MultiGridPosition[level,2,0]=sGrid.NCORNER_MIN[k-1,2] MultiGridPosition[level,2,1]=sGrid.NCORNER_MAX[k-1,2] ;result=sState.oData_MultiGridPosition->SetData(MultiGridPosition) endif MultiGridSize[level,0]=sGrid.NY[k] MultiGridSize[level,1]=sGrid.NX[k] MultiGridSize[level,2]=sGrid.NZ[k] if datanames[j] ne 'velocity' then begin varJupiterT=transpose(varJupiter,[1,0,2]) print,'sState.oData_HDFvar[j,k]',j,k help,varJupiterT if level eq 0 then begin ;;;;;varJupiterT(iyholemin:iyholemax,ixholemin:ixholemax,izholemin:izholemax)=0. varJupiterMG=fltarr(nx,ny,nz, /nozero) index=where( varJupiterT ne 0. ) varJupiterMG=varJupiterT(index) result=sState.oData_HDFvar[j,level]->SetData(varJupiterT) endif else begin result=sState.oData_HDFvar[j,level]->SetData(varJupiterT) endelse ;print,' min(varJupiterT),max(varJupiterT)=',min(varJupiterT),max(varJupiterT) endif else begin wT=transpose(w,[1,0,2,3]) result=sState.oData_HDFvar[j,level]->SetData(wT) endelse endif ; (list[0] NE -1) endif ; FillArraysHDF[j] eq 1 endfor ; j=0,nvar-1 endfor ; k=0,ngrid-1 result=sState.oData_MultiGridPosition->SetData(MultiGridPosition) result=sState.oData_MultiGridSize->SetData(MultiGridSize) ; level=0 ; print,'level ',level ; result=sState.oData_HDFvar[0,level]->GetData(HDFvar0) ; help,HDFvar0 ; ; level=1 ; print,'level ',level ; result=sState.oData_HDFvar[0,level]->GetData(HDFvar1) ; help,HDFvar1 ; ; level=2 ; print,'level ',level ; result=sState.oData_HDFvar[0,level]->GetData(HDFvar2) ; help,HDFvar2 ; ; level=3 ; print,'level ',level ; result=sState.oData_HDFvar[0,level]->GetData(HDFvar3) ; help,HDFvar3 ; ; level=4 ; print,'level ',level ; result=sState.oData_HDFvar[0,level]->GetData(HDFvar4) ; help,HDFvar4 ENDIF ELSE IF ( DataFormat EQ 6 ) THEN BEGIN ;;; GRAFIC WIDGET_CONTROL, sState.wGraficConfig[0], GET_VALUE=GraficFileName if file_test(GraficFileName) then begin result=sState.oData_Endian->GetData(Endian) print,'Endian=',Endian n1=0L n2=n1 n3=n1 dxini=0.0 xoff1=0.0 xoff2=xoff1 xoff3=xoff1 astart=0.0 omega_m=0.0 omega_l=0.0 h0=0.0 print,'reading file ',GraficFileName openr, 1,GraficFileName,/f77_unf,swap_endian=Endian CATCH,Error_status if Error_status ne 0 then begin print,'Catching error : Error_status=',Error_status print,'cannot read graphic file, check the endianess...' close,1 return,dum endif readu,1,n1,n2,n3,dxini,xoff1,xoff2,xoff3,astart,omega_m,omega_l,h0 print,'n1,n2,n3,dxini=',n1,n2,n3,dxini print,'xoff1,xoff2,xoff3=',xoff1,xoff2,xoff3 print,'astart,omega_m,omega_l,h0=',astart,omega_m,omega_l,h0 din_plane=fltarr(n1,n2) d=fltarr(n1,n2,n3) for i3=0,n3-1 do begin if keyword_set(verbose) then print,i3 readu,1,din_plane d(*,*,i3)=din_plane endfor close,1 ;help,d GridDim(0)=n1 GridDim(1)=n2 GridDim(2)=n3 result=sState.oData_GridDim->SetData(GridDim) result=sState.oData_datanames->GetData(datanames) result=sState.oData_DataDimHDF->GetData(fourdim) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) i=0 for itest=0,14 do begin if FillArraysHDF[itest] eq 1 then i=itest+1 endfor ;print,'i=',i datanames[i]='IC_'+strcompress(string(i),/remove_all) fourdim[i]=1 FillArraysHDF[i]=1 if obj_valid(sState.oData_HDFvar[i,0]) eq 0 then begin sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) endif result=sState.oData_HDFvar[i,0]->SetData(d,/NO_COPY) size=sState.oData_HDFvar[i,0]->GetSize() print,'load '+datanames[i],', size=',size,' bytes' result=sState.oData_datanames->SetData(datanames) result=sState.oData_DataDimHDF->SetData(fourdim) result=sState.oData_FillArraysHDF->SetData(FillArraysHDF) WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='IC data loaded' endif else begin print,'Grafic file with name ',GraficFileName,' does not exist' endelse END IF ( DataFormat EQ 1 OR DataFormat EQ 3 ) THEN BEGIN ;print,'MemoryManagement=',MemoryManagement ;result=sState.oData_datanames->GetData(datanames_stored) ;help,datanames if MemoryManagement[1] eq 1 then begin nvar=15 datanames=STRARR([nvar]) fourdim=INTARR([nvar]) FillArraysHDF=INTARR([nvar]) FillArraysHDF(*)=0 endif else begin result=sState.oData_datanames->GetData(datanames) result=sState.oData_DataDimHDF->GetData(fourdim) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) ;help,datanames ;help,fourdim ;help,FillArraysHDF end i=-1 i=i+1 if FillDensity then begin help,r,output=test_valid valid_r=1-strcmp(test_valid,'R UNDEFINED = ') if valid_r eq 1 then begin datanames[i]='density' fourdim[i]=1 FillArraysHDF[i]=1 if obj_valid(sState.oData_HDFvar[i,0]) eq 0 then begin sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) endif result=sState.oData_HDFvar[i,0]->SetData(r,/NO_COPY) size=sState.oData_HDFvar[i,0]->GetSize() print,'load '+datanames[i],', size=',size,' bytes' endif endif i=i+1 if FillArrays[1] then begin datanames[i]='radiative energy' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(er,/NO_COPY) print,'load '+datanames[i] endif i=i+1 if FillPressure then begin help,p,output=test_valid valid_p=1-strcmp(test_valid,'P UNDEFINED = ') ;print,'valid_p=',valid_p if valid_p eq 1 then begin datanames[i]='pressure' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(p,/NO_COPY) print,'load '+datanames[i] endif endif i=i+1 if FillVelocity then begin help,u,output=test_valid valid_u=1-strcmp(test_valid,'U UNDEFINED = ') if valid_u eq 1 then begin datanames[i]='velocity' fourdim[i]=3 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(u,/NO_COPY) print,'load '+datanames[i] endif endif i=i+1 if FillArrays[4] then begin datanames[i]='radiative flux frx' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(fr*1e-9,/NO_COPY) print,'load '+datanames[i] endif i=i+1 if FillArrays[4] then begin datanames[i]='radiative flux fry' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(fr*1e-9,/NO_COPY) print,'load '+datanames[i] endif i=i+1 if FillArrays[4] then begin datanames[i]='radiative flux frz' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(fr*1e-9,/NO_COPY) print,'load '+datanames[i] endif i=i+1 if FillArrays[5] then begin datanames[i]='internal energy' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(e,/NO_COPY) print,'load '+datanames[i] endif i=i+1 if RamsesFillArrays[2] then begin help,ux,output=test_valid valid_ux=1-strcmp(test_valid,'UX UNDEFINED = ') if valid_ux eq 0 and MeshIJKStatus[1] eq 1 then begin result=sState.oData_HDFvar[3,0]->GetData(u) ux=u[*,*,*,0] valid_ux=1 endif if valid_ux eq 1 then begin datanames[i]='velocity x' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(ux,/NO_COPY) print,'load '+datanames[i] endif endif i=i+1 if RamsesFillArrays[3] then begin help,uy,output=test_valid valid_uy=1-strcmp(test_valid,'UY UNDEFINED = ') if valid_uy eq 0 and MeshIJKStatus[1] eq 1 then begin result=sState.oData_HDFvar[3,0]->GetData(u) uy=u[*,*,*,1] valid_uy=1 endif if valid_uy eq 1 then begin datanames[i]='velocity y' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(uy,/NO_COPY) print,'load '+datanames[i] endif endif i=i+1 if RamsesFillArrays[4] then begin help,uz,output=test_valid valid_uz=1-strcmp(test_valid,'UZ UNDEFINED = ') if valid_uz eq 0 and MeshIJKStatus[1] eq 1 then begin result=sState.oData_HDFvar[3,0]->GetData(u) uz=u[*,*,*,2] valid_uz=1 endif if valid_uz eq 1 then begin datanames[i]='velocity z' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(uz,/NO_COPY) print,'load '+datanames[i] endif endif i=i+1 if RamsesFillArrays[6] then begin help,m,output=test_valid valid_m=1-strcmp(test_valid,'M UNDEFINED = ') if valid_m eq 1 then begin datanames[i]='metals' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) result=sState.oData_HDFvar[i,0]->SetData(m,/NO_COPY) print,'load '+datanames[i] endif endif if ReadParticles then begin test_particleGrid=0 if test_particleGrid eq 1 then begin i=i+1 datanames[i]='DM' fourdim[i]=1 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) n=128;512 dm=fltarr(n,n,n) ; data field cdm=intarr(n,n,n) ; counter ;cdm[*]=1. help,part,/struct np=part.npart help,np print,'np=',np ReadParticlesVELDEN = RamsesFillArrays[8] EQ 1 if ReadParticlesVELDEN then begin for ipart=0L,np-1L do begin ix=fix(part.xp(ipart,0)*n) iy=fix(part.xp(ipart,1)*n) iz=fix(part.xp(ipart,2)*n) dm[ix,iy,iz]=part.dp(ipart) cdm[ix,iy,iz]=cdm[ix,iy,iz]+1 if ipart lt 10 then begin print,'--------------------------------' print,ipart print,part.xp(ipart,0),part.xp(ipart,1),part.xp(ipart,2) print,ix,iy,iz print,dm[ix,iy,iz],cdm[ix,iy,iz] endif endfor print,'min(dm)=',min(dm) print,'max(dm)=',max(dm) print,'min(cdm)=',min(cdm) print,'max(cdm)=',max(cdm) index=where(cdm gt 0) dm(index)=dm(index)/cdm(index) ;dm=dm/cdm endif else begin for ipart=0L,np-1L do begin ix=fix(part.xp(ipart,0)*n) iy=fix(part.xp(ipart,1)*n) iz=fix(part.xp(ipart,2)*n) dm[ix,iy,iz]=dm[ix,iy,iz]+1 if ipart lt 10 then begin print,'--------------------------------' print,ipart print,ix,iy,iz print,dm[ix,iy,iz] endif endfor print,'min(dm)=',min(dm) print,'max(dm)=',max(dm) endelse help,dm ;dm=dm+1. if min(dm) le 0. then dm=dm+max(dm)/1.e6 ;dm(where(dm eq 0))=1. ;dm(where(dm eq 0))=max(dm)/256. print,'min(dm)=',min(dm) print,'max(dm)=',max(dm) result=sState.oData_HDFvar[i,0]->SetData(dm,/NO_COPY) print,'load '+datanames[i] endif i=i+1 datanames[i]='dark matter' fourdim[i]=0 FillArraysHDF[i]=1 sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) ;result=sState.oData_HDFvar[i,0]->SetData(part,/NO_COPY) print,'load '+datanames[i] endif result=sState.oData_datanames->SetData(datanames) result=sState.oData_DataDimHDF->SetData(fourdim) result=sState.oData_FillArraysHDF->SetData(FillArraysHDF) ENDIF IF DataFormat EQ 1 OR DataFormat GE 3 THEN BEGIN dum=GridPrint(sState,valid_amrgrid) ENDIF if DataFormat eq 10 then begin ; read particles from jaques widget_control, sState.wJaquesFillArrays, get_value=fa if fa eq 1 then begin ; reading grid data from jaques ? WIDGET_CONTROL, /HOURGLASS ; CATCH,Error_status ; if Error_status ne 0 then begin ; print,'Catching error : Error_status=',Error_status ; print,'Attempt to call undefined procedure/function: CONSTRUCT_CUBE' ; WIDGET_CONTROL, sEvent.top,SET_UVALUE=sState,/NO_COPY ; return ; endif construct_cube, customVar, field_name, cube_center=cube_center, cube_length=cube_length, cube_dimensions=sState.Jaques_cube_dim help,customVar ;plot,customVar s=size(customVar) print,'size s=',s result=sState.oData_GridDim->GetData(GridDim) GridDim(0)=s(1) GridDim(1)=s(2) if s(0) ge 3 then begin GridDim(2)=s(3) endif else if s(0) eq 2 then begin GridDim(2)=1 end result=sState.oData_GridDim->SetData(GridDim) result=sState.oData_GridSize->GetData(GridSize) print, gridsize GridSize[[0,1]] = cube_center[0] + 0.5*cube_length*[-1., 1] GridSize[[2,3]] = cube_center[1] + 0.5*cube_length*[-1., 1] GridSize[[4,5]] = cube_center[2] + 0.5*cube_length*[-1., 1] print, gridsize ;breaki result=sState.oData_GridSize->SetData(GridSize) result=sState.oData_DataFormat->GetData(DataFormat) IF ( DataFormat EQ 3 ) THEN BEGIN ;;; WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='AMR data loaded' dum=GridPrint(sState,1) ENDIF ELSE BEGIN dum=GridPrint(sState,0) ENDELSE result=sState.oData_datanames->GetData(datanames) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_DataDimHDF->GetData(fourdim) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) nvar=nvar+1 newdatanames=strarr([nvar]) if nvar ne 1 then newdatanames(0:nvar-2)=datanames(0:nvar-2) newdatanames(nvar-1)=field_name result=sState.oData_datanames->SetData(newdatanames) newfourdim=make_array([nvar]) if nvar ne 1 then newfourdim(0:nvar-2)=fourdim(0:nvar-2) if s(0) eq 3 then begin newfourdim(nvar-1)=1 endif else if s(0) eq 2 then begin newfourdim(nvar-1)=1 endif else if s(0) eq 4 then begin newfourdim(nvar-1)=3 end result=sState.oData_DataDimHDF->SetData(newfourdim) sState.oData_HDFvar[nvar-1,0]=OBJ_NEW('IDLitData',newdatanames(nvar-1)) result=sState.oData_HDFvar[nvar-1,0]->SetData(customVar,/NO_COPY) newFillArraysHDF=make_array([nvar]) if nvar ne 1 then newFillArraysHDF(0:nvar-2)=FillArraysHDF(0:nvar-2) newFillArraysHDF(nvar-1)=1 result=sState.oData_FillArraysHDF->SetData(newFillArraysHDF) print, 'press F1 : to see option how to visualize these data.' endif else begin result=sState.oData_SimuStepOutput->GetData(SimuStepOutput) print, result part= SDVisionImportJaquesParticles() if part.npart eq 0 then begin print, 'particle import from jaques failed' return, 0 endif result=sState.oData_AMRoctreeCurrent->GetData(AMRoctreeCurrent) result=sState.oData_datanames->GetData(datanames) result=sState.oData_DataDimHDF->GetData(fourdim) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) if part.npart gt 0 then begin print, 'Loaded', part.npart, ' particles from Jaques' i = 8 fourdim[i]=0 FillArraysHDF[i]=1 datanames[i]='jaques particles' sState.oData_HDFvar[i,0]=OBJ_NEW('IDLitData',datanames[i]) RamsesFillArrays[8] = 1 AMRoctreeCurrent[2]=SimuStepOutput result=sState.oData_AMRoctreeCurrent->SetData(AMRoctreeCurrent) result=sState.oData_AMRoctreePart->SetData(part,no_copy=1) result=sState.oData_datanames->SetData(datanames) result=sState.oData_DataDimHDF->SetData(fourdim) result=sState.oData_FillArraysHDF->SetData(FillArraysHDF) WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='jaques particles loaded' sample=20 result=sState.oData_ParticlesSampling->SetData(sample) WIDGET_CONTROL,sState.wParticlesConfigBase,MAP=1 endif endelse endif ixdata=0 result=sState.oData_Plotx->SetData(ixdata) ;IF ( DataFormat EQ 3 ) THEN BEGIN ;del_amr,a ;del_hydro,h ;ENDIF ;WIDGET_CONTROL, sState.wReduceButton, SENSITIVE=1 ;WIDGET_CONTROL, sState.wDraw1, SENSITIVE=1 ;print,'exit LoadData' RETURN, dum END ;------------------------------------------------------------------------- FUNCTION ExportData, sState ;result=sState.oData_DataFormat->GetData(DataFormat) ;if DataFormat eq 1 or DataFormat eq 3 then begin ; result=sState.oData_FillArrays->GetData(FillArrays) ; result=sState.oData_RamsesFillArrays->GetData(RamsesFillArrays) ; result=sState.oData_DataFormat->GetData(DataFormat) ; FillDensity = (FillArrays[0] eq 1 AND DataFormat le 2) OR $ ; (RamsesFillArrays[0] eq 1 AND DataFormat eq 3) ; FillPressure = (FillArrays[2] eq 1 AND DataFormat le 2) OR $ ; (RamsesFillArrays[2] eq 1 AND DataFormat eq 3) ; FillVelocity = (FillArrays[3] eq 1 AND DataFormat le 2) OR $ ; (RamsesFillArrays[1] eq 1 AND DataFormat eq 3) ; Density ; ; if ( FillDensity ) then begin ; print ,' export density r' ; result=sState.oData_r->GetData(r) ; (scope_varfetch('r', /enter, level=1)) = r ; endif ; Radiative Energy ; ; if ( FillArrays[1] eq 1 ) then begin ; print ,' export radiative energy er' ; result=sState.oData_er->GetData(er) ; (scope_varfetch('er', /enter, level=1)) = er ; endif ; Pressure ; ; if ( FillPressure ) then begin ; print ,' export pressure p' ; result=sState.oData_p->GetData(p) ; (scope_varfetch('p', /enter, level=1)) = p ; endif ; velocity ; ; if ( FillVelocity ) then begin ; print ,' export velocity u' ; result=sState.oData_u->GetData(u) ; (scope_varfetch('u', /enter, level=1)) = u ; endif ; Radiative flux ; ;if ( FillArrays[4] eq 1 ) then begin ; print ,' export radiative flux fr' ; result=sState.oData_fr->GetData(fr) ; (scope_varfetch('fr', /enter, level=1)) = fr ;endif ; endif ;else if DataFormat eq 2 then begin result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_datanames->GetData(datanames) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) for i=0,nvar-1 do begin if ( FillArraysHDF[i] eq 1 ) then begin print ,' export variable ',datanames[i] result=sState.oData_HDFvar[i,0]->GetData(HDFvar) (scope_varfetch(datanames[i], /enter, level=1)) = HDFvar endif endfor ;end dum=1 RETURN, dum END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; FUNCTION XImage_Aspect from simple_surface.pro ;;;; ;;;; http://www.dfanning.com ;;;; FUNCTION XImage_Aspect, aspectRatio, MARGIN=margin, WindowAspect=wAspectRatio ; This function calculates the correct aspect ratios for printing. ON_ERROR, 2 ; Check for aspect ratio parameter and possibilities. IF N_PARAMS() EQ 0 THEN aspectRatio = 1.0 IF aspectRatio EQ 0 THEN BEGIN MESSAGE, 'Aspect Ratio of 0. Changing to 1...', /Informational aspectRatio = 1.0 ENDIF s = SIZE(aspectRatio) IF s(s(0)+1) NE 4 THEN $ MESSAGE, 'Aspect Ratio is not a FLOAT. Take care...', /Informational ; Check for margins. IF N_ELEMENTS(margin) EQ 0 THEN margin = 0.15 ; Error checking. IF margin LT 0 OR margin GE 0.5 THEN $ MESSAGE, 'The MARGIN keyword value must be between 0.0 and 0.5.' ; Calculate the aspect ratio of the current window. IF N_Elements(wAspectRatio) EQ 0 THEN wAspectRatio = FLOAT(!D.Y_VSIZE) / !D.X_VSIZE ; Calculate normalized positions in window. IF (aspectRatio LE wAspectRatio) THEN BEGIN xstart = margin ystart = 0.5 - (0.5 - margin) * (aspectRatio / wAspectRatio) xend = 1.0 - margin yend = 0.5 + (0.5 - margin) * (aspectRatio / wAspectRatio) ENDIF ELSE BEGIN xstart = 0.5 - (0.5 - margin) * (wAspectRatio / aspectRatio) ystart = margin xend = 0.5 + (0.5 - margin) * (wAspectRatio / aspectRatio) yend = 1.0 - margin ENDELSE position = [xstart, ystart, xend, yend] RETURN, position END ; ;****************************************************************************** ; ; Seed pick for streamlines ; ; MODIFICATION HISTORY: ; november 2006 : written by Daniel Pomarède ; 27 march 2008 : correction RAMSES boundaries ; FUNCTION seedPick, sEvent, sState ;print, 'press sEvent.x=', sEvent.x ;print, 'press sEvent.y=', sEvent.y Location=make_array(2) Location[0]=sEvent.x Location[1]=sEvent.y result=sState.drawWindowID3D->PickData(sState.oView3D,sState.oModelObjects3D,Location,XYZLocation) IF result EQ 1 THEN BEGIN result=sState.oData_DataFormat->GetData(DataFormat) ;print,'PickData ',XYZLocation xrange=make_array([2]) & yrange=make_array([2]) & zrange=make_array([2]) IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) limitx1=MeshIJKboundaries[0]-0.5 limitx2=MeshIJKboundaries[1]-0.5 limity1=MeshIJKboundaries[2]-0.5 limity2=MeshIJKboundaries[3]-0.5 limitz1=MeshIJKboundaries[4]-0.5 limitz2=MeshIJKboundaries[5]-0.5 ENDIF ELSE BEGIN limitx1=-0.5 limitx2= 0.5 limity1=-0.5 limity2= 0.5 limitz1=-0.5 limitz2= 0.5 ENDELSE xrange[0]=0. xrange[1]=sState.GeoStructure.nxg -1. yrange[0]=0. yrange[1]=sState.GeoStructure.nyg -1. zrange[0]=0. zrange[1]=sState.GeoStructure.nzg -1. xs = Normalize(xrange, Position=[limitx1,limitx2]) ys = Normalize(yrange, Position=[limity1,limity2]) zs = Normalize(zrange, Position=[limitz1,limitz2]) scale= 0.6 & xs=xs*scale & ys=ys*scale & zs=zs*scale XYZLocation(0)=(XYZLocation(0)-xs(0))/xs(1) XYZLocation(1)=(XYZLocation(1)-ys(0))/ys(1) XYZLocation(2)=(XYZLocation(2)-ys(0))/zs(1) ;;print,'Pick Data ',XYZLocation result=sState.oData_SeedPickUp->GetData(SeedPickUp) size_seeds=size(SeedPickUp) if size_seeds[0] eq 0 then begin nseed=0 endif else if size_seeds[0] eq 1 then begin nseed=1 endif else if size_seeds[0] ge 2 then begin nseed=fix(size_seeds[2]) end WIDGET_CONTROL, sState.wSeedPickOptions[2], GET_VALUE=index if index[0] eq 0 or nseed eq 0 then begin nseed=nseed+1 endif newSeedPickUp=fltarr([3,nseed]) if nseed ne 1 then newSeedPickUp(*,0:nseed-2)=seedPickUp(*,0:nseed-2) newSeedPickUp(*,nseed-1)=XYZLocation ;-1. ;;print,'Seed list=',newSeedPickUp result=sState.oData_SeedPickUp->SetData(newSeedPickUp) WIDGET_CONTROL,sState.wSeedPick[0],SET_VALUE=XYZLocation[0];-1. WIDGET_CONTROL,sState.wSeedPick[1],SET_VALUE=XYZLocation[1];-1. WIDGET_CONTROL,sState.wSeedPick[2],SET_VALUE=XYZLocation[2];-1. dum=UpdateTheViews(sState,1) ENDIF dum=1 RETURN, dum END ;------------------------------------------------------------------------- FUNCTION DrawTheSurface, sState ;print,'DrawTheSurface' dum=1 result=sState.oData_varData2D->GetData(varData2D) if size(varData2D,/N_DIMENSIONS) eq 0 then begin print,'3D data has been discarded' print,'please proceed to reload' return,dum endif ; help,varData2D ; surface,varData2D s=size(varData2D) xrange=make_array([2]) yrange=make_array([2]) xrange[0]=1 xrange[1]=s(1) yrange[0]=1 yrange[1]=s(2) ;xrange[0]=0 ;xrange[1]=s(1)-1 ;yrange[0]=0 ;yrange[1]=s(2)-1 ;;;;result=sState.oData_GridDim->GetData(GridDim) ;;;nx=GridDim(0)*1L nx=s(1) expand=1. if nx gt 600 then begin print,'size of surface object =',nx,' is too large -> reduce data' nrebin=500 print,'using CONGRID, nrebin=',nrebin varData2D=CONGRID(varData2D,nrebin,nrebin) expand=(1.*nx)/nrebin endif result=sState.oData_ScalarLinLog->GetData(SurfaceLog) IF SurfaceLog EQ 0 THEN BEGIN varData2DLinLog=varData2D ENDIF ELSE IF SurfaceLog EQ 1 THEN BEGIN if min(varData2D) le 0 then begin print,'DrawTheSurface: in log mode, min of data=',min(varData2D) print,'-> revert to lin mode' varData2DLinLog=varData2D ;WIDGET_CONTROL, sState.wSelectSurface, GET_VALUE=index ;index[1]=0 ;WIDGET_CONTROL, sState.wSelectSurface, SET_VALUE=index WIDGET_CONTROL, sState.wScalarLinLog, SET_VALUE=['linear','log10'] SurfaceLog=0 result=sState.oData_ScalarLinLog->SetData(SurfaceLog) endif else begin varData2DLinLog=alog10(varData2D) endelse END ;print,'min varData2DLinLog=',min(varData2DLinLog) ;print,'max varData2DLinLog=',max(varData2DLinLog) ;surface, varData2DLinLog ;;;;;; SURFACE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; sState.oTextureImage->SetProperty, DATA=bytscl(varData2DLinLog) sState.oSimpleSurface->SetProperty, DATAZ=varData2DLinLog ;sState.oSimpleSurface->GetProperty, XRange=xrange, YRange=yrange, ZRange=zrange sState.oSimpleSurface->GetProperty, ZRange=zrange ;print,'xrange=',xrange ;print,'yrange=',yrange ;print,'zrange=',zrange if ( (zrange[1] - zrange[0]) le 0.0000001 ) then begin zrange[0]=0. zrange[1]=1. end sState.xaxis1->SetProperty, Range=xrange sState.yaxis1->SetProperty, Range=yrange sState.zaxis1->SetProperty, Range=zrange sState.xaxis1->GetProperty, Ticktext=xAxisText sState.yaxis1->GetProperty, Ticktext=yAxisText sState.zaxis1->GetProperty, Ticktext=zAxisText xAxisText->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 yAxisText->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 zAxisText->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.xTitleObj->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.yTitleObj->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.zTitleObj->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.xaxis1->GetProperty, CRange=xrange sState.yaxis1->GetProperty, CRange=yrange sState.zaxis1->GetProperty, CRange=zrange xs = Normalize(xrange, Position=[-0.5,0.5]) ys = Normalize(yrange, Position=[-0.5,0.5]) zs = Normalize(zrange, Position=[-0.5,0.5]) ;print,'xs=',xs ;print,'ys=',ys ;print,'zs=',zs sState.xaxis1->SetProperty, Location=[9999.0, -0.5, -0.5], XCoord_Conv=xs sState.yaxis1->SetProperty, Location=[-0.5, 9999.0, -0.5], YCoord_Conv=ys sState.zaxis1->SetProperty, Location=[-0.5, 0.5, 9999.0], ZCoord_Conv=zs xs(1)=expand*xs(1) ys(1)=expand*ys(1) sState.oSimpleSurface->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs ;sState.oLight1->SetProperty, Location=[0., 0., zrange(1)], XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs ;sState.oLight1->GetProperty, Location=location ; print,'zrange=',zrange ; print,'location=',location ;dum=1 RETURN, dum END ;------------------------------------------------------------------------- FUNCTION DrawTheMultiGridImage, sState dum=1 result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_MultiGridPosition->GetData(MultiGridPosition) ;help,MultiGridPosition & print,MultiGridPosition result=sState.oData_MultiGridSize->GetData(MultiGridSize) ;help,MultiGridSize & print,MultiGridSize s=size(MultiGridSize) ;print,'s=',s ngrid=s(1) result=sState.oData_xyzplane->GetData(xyzplane) WIDGET_CONTROL, sState.wImage3DPlaneSlider, GET_VALUE=surfacePosition result=sState.oData_flag->GetData(iflag_var) xrange =make_array([2]) & yrange =make_array([2]) & zrange =make_array([2]) if xyzplane eq 1 then begin multigrid_size=sState.GeoStructure.nzg endif else if xyzplane eq 2 then begin multigrid_size=sState.GeoStructure.nyg endif else if xyzplane eq 3 then begin multigrid_size=sState.GeoStructure.nxg end result=sState.oData_ScalarLinLog->GetData(SurfaceLog) ;;; image data scaling ; imagemin=1e8 imagemax=-1e8 test=fltarr(2) ; for level=0,ngrid-1 do begin result=sState.oData_HDFvar[-iflag_var-1,level]->GetData(varData3D) surfacePosition_renorm=1.*surfacePosition*(MultiGridSize(level,3-xyzplane)-1)/(multigrid_size-1) surfacePosition_level= surfacePosition_renorm if level ge 1 then begin if surfacePosition lt MultiGridPosition(level-1,3-xyzplane,0) then CONTINUE if surfacePosition ge MultiGridPosition(level-1,3-xyzplane,1) then CONTINUE surfacePosition_level= MultiGridSize(level,3-xyzplane) * $ 1.*(surfacePosition-MultiGridPosition(level-1,3-xyzplane,0))/ $ (MultiGridPosition(level-1,3-xyzplane,1)-MultiGridPosition(level-1,3-xyzplane,0)) endif if xyzplane eq 1 then begin varData2D=reform(varData3D(*,*,surfacePosition_level)) endif else if xyzplane eq 2 then begin varData2D=reform(varData3D(*,surfacePosition_level,*)) endif else if xyzplane eq 3 then begin varData2D=reform(varData3D(surfacePosition_level,*,*)) end IF SurfaceLog EQ 1 THEN BEGIN if min(varData2D) le 0 then begin print,'DrawTheImage: in log mode, min of data=',min(varData2D) print,'-> revert to lin mode' SurfaceLog=0 result=sState.oData_ScalarLinLog->SetData(SurfaceLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = SurfaceLog endif else begin varData2D=alog10(varData2D) endelse ENDIF ;print,'level,min,max=',level,min(varData2D),max(varData2D) test[0]=imagemin test[1]=min(varData2D) imagemin=min(test) test[0]=imagemax test[1]=max(varData2D) imagemax=max(test) endfor scalemin=min(imagemin) scalemax=min(imagemax) ;print,'scalemin,scalemax=',scalemin,scalemax for level=0,ngrid-1 do begin ;print,'DrawTheMultiGridImage => level = ',level result=sState.oData_HDFvar[-iflag_var-1,level]->GetData(varData3D) ;help,varData3D surfacePosition_renorm=1.*surfacePosition*(MultiGridSize(level,3-xyzplane)-1)/(multigrid_size-1) surfacePosition_level= surfacePosition_renorm if level ge 1 then begin ;print,'test z limits ',MultiGridPosition(level-1,3-xyzplane,0),MultiGridPosition(level-1,3-xyzplane,1) sState.oImage3D[level]->SetProperty, HIDE=1 sState.oImage[level]->SetProperty, HIDE=1 if surfacePosition lt MultiGridPosition(level-1,3-xyzplane,0) then CONTINUE if surfacePosition ge MultiGridPosition(level-1,3-xyzplane,1) then CONTINUE ;print,'passed' sState.oImage3D[level]->SetProperty, HIDE=0 sState.oImage[level]->SetProperty, HIDE=0 surfacePosition_level= MultiGridSize(level,3-xyzplane) * $ 1.*(surfacePosition-MultiGridPosition(level-1,3-xyzplane,0))/ $ (MultiGridPosition(level-1,3-xyzplane,1)-MultiGridPosition(level-1,3-xyzplane,0)) endif ;print,'surfacePosition=',surfacePosition ;print,'surfacePosition_renorm=',surfacePosition_renorm ;print,'surfacePosition_level=',surfacePosition_level if xyzplane eq 1 then begin varData2D=reform(varData3D(*,*,surfacePosition_level)) endif else if xyzplane eq 2 then begin varData2D=reform(varData3D(*,surfacePosition_level,*)) endif else if xyzplane eq 3 then begin varData2D=reform(varData3D(surfacePosition_level,*,*)) end IF SurfaceLog EQ 1 THEN BEGIN if min(varData2D) le 0 then begin print,'DrawTheImage: in log mode, min of data=',min(varData2D) print,'-> revert to lin mode' SurfaceLog=0 result=sState.oData_ScalarLinLog->SetData(SurfaceLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = SurfaceLog endif else begin varData2D=alog10(varData2D) endelse ENDIF ;print,'level,min,max=',level,min(varData2D),max(varData2D) ;imagePtr = Ptr_New(varData2D) ;Imagedata=BytScl(*imagePtr) Imagedata=BytScl(varData2D,MIN=scalemin,MAX=scalemax) sState.oImage3D[level]->SetProperty, Data=Imagedata sState.oImage[level]->SetProperty, Data=Imagedata s=size(Imagedata,/DIMENSIONS) ;print,'ImageData s=',s scale=0.6 if iflag_vue[0] EQ 1 then scale=1. xstart=0. ystart=0. zstart=0. if level ge 1 then begin if xyzplane eq 1 then begin xstart= xstart-1.*MultiGridPosition(level-1,0,0)*MultiGridSize(level,0)/sState.GeoStructure.nxg ystart= ystart-1.*MultiGridPosition(level-1,1,0)*MultiGridSize(level,1)/sState.GeoStructure.nyg ;print,'MultiGridPosition(level-1,0,0)=',MultiGridPosition(level-1,0,0) ;print,'sState.GeoStructure.nxg=',sState.GeoStructure.nxg ;print,'MultiGridSize(level,0)=',MultiGridSize(level,0) ;print,'xstart,ystart,zstart=',xstart,ystart,zstart cx=1.*(MultiGridPosition(level-1,0,1)-MultiGridPosition(level-1,0,0))/sState.GeoStructure.nxg cy=1.*(MultiGridPosition(level-1,1,1)-MultiGridPosition(level-1,1,0))/sState.GeoStructure.nyg endif else if xyzplane eq 2 then begin xstart= xstart-1.*MultiGridPosition(level-1,0,0)*MultiGridSize(level,0)/sState.GeoStructure.nxg zstart= zstart-1.*MultiGridPosition(level-1,2,0)*MultiGridSize(level,2)/sState.GeoStructure.nzg cx=1.*(MultiGridPosition(level-1,0,1)-MultiGridPosition(level-1,0,0))/sState.GeoStructure.nxg cy=1.*(MultiGridPosition(level-1,2,1)-MultiGridPosition(level-1,2,0))/sState.GeoStructure.nzg endif else if xyzplane eq 3 then begin ystart= ystart-1.*MultiGridPosition(level-1,1,0)*MultiGridSize(level,1)/sState.GeoStructure.nyg zstart= zstart-1.*MultiGridPosition(level-1,2,0)*MultiGridSize(level,2)/sState.GeoStructure.nzg cx=1.*(MultiGridPosition(level-1,1,1)-MultiGridPosition(level-1,1,0))/sState.GeoStructure.nyg cy=1.*(MultiGridPosition(level-1,2,1)-MultiGridPosition(level-1,2,0))/sState.GeoStructure.nzg end endif xrange[0]=xstart xrange[1]=MultiGridSize(level,0)+xstart yrange[0]=ystart yrange[1]=MultiGridSize(level,1)+ystart zrange[0]=zstart zrange[1]=MultiGridSize(level,2)+zstart xs = Normalize(xrange, Position=[-0.5,0.5]) ys = Normalize(yrange, Position=[-0.5,0.5]) zs = Normalize(zrange, Position=[-0.5,0.5]) xs=xs*scale & ys=ys*scale & zs=zs*scale xrange1=xrange & yrange1=yrange & zrange1=zrange xrange1[0]=1. & yrange1[0]=1. & zrange1[0]=1 xs1 = Normalize(xrange1, Position=[-0.5,0.5]) ys1 = Normalize(yrange1, Position=[-0.5,0.5]) zs1 = Normalize(zrange1, Position=[-0.5,0.5]) xs1=xs1*scale & ys1=ys1*scale & zs1=zs1*scale if level ge 1 then begin if xyzplane eq 1 then begin xs[1]=xs[1]*cx ys[1]=ys[1]*cy endif else if xyzplane eq 2 then begin xs[1]=xs[1]*cx zs[1]=zs[1]*cy endif else if xyzplane eq 3 then begin ys[1]=ys[1]*cx zs[1]=zs[1]*cy end endif if xyzplane eq 1 then begin sState.oModelImage3D->Reset sState.oImage3D[level]->SetProperty, LOCATION=[0.,0.,surfacePosition_renorm+1] sState.oImage3D[level]->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs1 sState.oImage[level]->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys endif else if xyzplane eq 2 then begin sState.oModelImage3D->Reset sState.oModelImage3D->Rotate, [1,0,0], 90 sState.oImage3D[level]->SetProperty, LOCATION=[0.,0.,yrange1(1)-surfacePosition_renorm] sState.oImage3D[level]->SetProperty, XCoord_Conv=xs, YCoord_Conv=zs, ZCoord_Conv=ys1 sState.oImage[level]->SetProperty, XCoord_Conv=xs, YCoord_Conv=zs endif else if xyzplane eq 3 then begin sState.oModelImage3D->Reset sState.oModelImage3D->Rotate, [0,1,0], 90 sState.oModelImage3D->Rotate, [1,0,0], 90 sState.oImage3D[level]->SetProperty, LOCATION=[0.,0.,surfacePosition_renorm+1] sState.oImage3D[level]->SetProperty, XCoord_Conv=ys, YCoord_Conv=zs, ZCoord_Conv=xs1 sState.oImage[level]->SetProperty, XCoord_Conv=ys, YCoord_Conv=zs end endfor RETURN, dum END ;------------------------------------------------------------------------- FUNCTION DrawTheImage, sState dum=1 result=sState.oData_DataFormat->GetData(DataFormat) result=sState.oData_vue->GetData(iflag_vue) ;IF ( DataFormat EQ 5 AND iflag_vue[0] NE 1 ) THEN BEGIN ;;; JUPITER 3D Image IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER 3D and 2D Image dum=DrawTheMultiGridImage(sState) RETURN, dum ENDIF ;Imagedata=BytScl(*imagePtr) result=sState.oData_varData2D->GetData(varData2D) if size(varData2D,/N_DIMENSIONS) eq 0 then begin print,'3D data has been discarded' print,'please proceed to reload' return,dum endif ;help,varData2D ;save,varData2D,FILENAME='imageData.sav' result=sState.oData_ScalarLinLog->GetData(SurfaceLog) IF SurfaceLog EQ 0 THEN BEGIN varData2DLinLog=varData2D ENDIF ELSE IF SurfaceLog EQ 1 THEN BEGIN if min(varData2D) le 0 then begin print,'DrawTheImage: in log mode, min of data=',min(varData2D) print,'-> revert to lin mode' varData2DLinLog=varData2D SurfaceLog=0 result=sState.oData_ScalarLinLog->SetData(SurfaceLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = SurfaceLog endif else begin varData2DLinLog=alog10(varData2D) endelse END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; IMAGE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; if iflag_vue[0] EQ 1 then begin ;;; Image in the 2D space ;Imagedata=BytScl(*imagePtr) sState.oImage[0]->SetProperty, Data=BytScl(varData2DLinLog);;;Imagedata s = SIZE(varData2DLinLog) xsize = s(1) ysize = s(2) sState.oImage[0]->SetProperty, Dimensions=[xsize,ysize] sState.oImage[0]->GetProperty, XRANGE=xri, YRANGE=yri, ZRANGE=zri endif else if iflag_vue[0] EQ 6 then begin ;;; Image in the 3D space sizevar=size(varData2D,/DIMENSIONS) result=sState.oData_GridDim->GetData(GridDim) sState.oImage3D[0]->SetProperty, Data=BytScl(varData2DLinLog) result=sState.oData_xyzplane->GetData(xyzplane) WIDGET_CONTROL, sState.wImage3DPlaneSlider, GET_VALUE=surfacePosition xrange=make_array([2]) & yrange=make_array([2]) & zrange=make_array([2]) scale=0.6 IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) limitx1=MeshIJKboundaries[0]-0.5 limitx2=MeshIJKboundaries[1]-0.5 limity1=MeshIJKboundaries[2]-0.5 limity2=MeshIJKboundaries[3]-0.5 limitz1=MeshIJKboundaries[4]-0.5 limitz2=MeshIJKboundaries[5]-0.5 result=sState.oData_AmrLevels->GetData(AmrLevels) zmax=2^AmrLevels[1] zref=make_array([2]) & zref[0]=1. & zref[1]=zmax zref = Normalize(zref, Position=[-0.5,0.5])*scale ENDIF ELSE BEGIN limitx1=-0.5 limitx2= 0.5 limity1=-0.5 limity2= 0.5 limitz1=-0.5 limitz2= 0.5 ENDELSE s=size(Imagedata,/DIMENSIONS) ;print,'ImageData s=',s xrange[0]=0. xrange[1]=sState.GeoStructure.nxg yrange[0]=0. yrange[1]=sState.GeoStructure.nyg zrange[0]=0. zrange[1]=sState.GeoStructure.nzg xs = Normalize(xrange, Position=[limitx1,limitx2]) ys = Normalize(yrange, Position=[limity1,limity2]) zs = Normalize(zrange, Position=[limitz1,limitz2]) xs=xs*scale & ys=ys*scale & zs=zs*scale xrange1=xrange & yrange1=yrange & zrange1=zrange xrange1[0]=1. & yrange1[0]=1. & zrange1[0]=1 xs1 = Normalize(xrange1, Position=[limitx1,limitx2]) ys1 = Normalize(yrange1, Position=[limity1,limity2]) zs1 = Normalize(zrange1, Position=[limitz1,limitz2]) xs1=xs1*scale & ys1=ys1*scale & zs1=zs1*scale if xyzplane eq 1 then begin rebinexpansion_x=(1.*(GridDim[0]))/(sizevar[0]) rebinexpansion_y=(1.*(GridDim[1]))/(sizevar[1]) xs(1)=rebinexpansion_x*xs(1) ys(1)=rebinexpansion_y*ys(1) sState.oModelImage3D->Reset sState.oImage3D[0]->SetProperty, LOCATION=[0.,0.,surfacePosition+1.] sState.oImage3D[0]->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs1 endif else if xyzplane eq 2 then begin rebinexpansion_x=(1.*(GridDim[0]))/(sizevar[0]) rebinexpansion_z=(1.*(GridDim[2]))/(sizevar[1]) xs(1)=rebinexpansion_x*xs(1) zs(1)=rebinexpansion_z*zs(1) sState.oModelImage3D->Reset sState.oModelImage3D->Rotate, [1,0,0], 90 IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES sState.oImage3D[0]->SetProperty, LOCATION=[0.,0.,((1.-MeshIJKboundaries[2])*zmax) -surfacePosition] sState.oImage3D[0]->SetProperty, XCoord_Conv=xs, YCoord_Conv=zs, ZCoord_Conv=zref ENDIF ELSE BEGIN sState.oImage3D[0]->SetProperty, LOCATION=[0.,0.,yrange1(1)-surfacePosition] sState.oImage3D[0]->SetProperty, XCoord_Conv=xs, YCoord_Conv=zs, ZCoord_Conv=ys1 ENDELSE endif else if xyzplane eq 3 then begin rebinexpansion_y=(1.*(GridDim[1]))/(sizevar[0]) rebinexpansion_z=(1.*(GridDim[2]))/(sizevar[1]) ys(1)=rebinexpansion_y*ys(1) zs(1)=rebinexpansion_z*zs(1) sState.oModelImage3D->Reset sState.oModelImage3D->Rotate, [0,1,0], 90 sState.oModelImage3D->Rotate, [1,0,0], 90 sState.oImage3D[0]->SetProperty, LOCATION=[0.,0.,surfacePosition+1] sState.oImage3D[0]->SetProperty, XCoord_Conv=ys, YCoord_Conv=zs, ZCoord_Conv=xs1 end RETURN, dum end sState.xAxisImage->SetProperty, Range=xri sState.yAxisImage->SetProperty, Range=yri sState.xaxisImage->GetProperty, Ticktext=xAxisText sState.yaxisImage->GetProperty, Ticktext=yAxisText xAxisText->SetProperty,Font=helvetica10pt,Recompute_Dimensions=2 yAxisText->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.xTitleImage->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.yTitleImage->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.xAxisImage->GetProperty, CRange=xrange sState.yAxisImage->GetProperty, CRange=yrange xs = Normalize(xrange, Position=[-0.5,0.5]) ys = Normalize(yrange, Position=[-0.5,0.5]) sState.xAxisImage->SetProperty, Location=[9999.0, -0.5, -0.5], XCoord_Conv=xs sState.yAxisImage->SetProperty, Location=[-0.5, 9999.0, -0.5], YCoord_Conv=ys sState.oImage[0]->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; COLOR BAR ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; sState.oColorBar->GetProperty, XRANGE=xrange, YRANGE=yrange, ZRANGE=zrange xs = Normalize(xrange, Position=[ 0.35,0.47]) ys = Normalize(yrange, Position=[-0.4,0.4]) sState.oColorBar->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys range1=min(varData2DLinLog) range2=max(varData2DLinLog) if ( (range2-range1) le 0.0000001 ) then begin range1=0. range2=1. end sState.oColorBarAxis->SetProperty, Range=[range1,range2] sState.oColorBarAxis->GetProperty, CRange=yrange ys = Normalize(yrange, Position=[-0.4,0.4]) sState.oColorBarAxis->SetProperty, Location=[0.35, 9999.0, -0.5], YCoord_Conv=ys sState.oColorBarAxis->GetProperty, Ticktext=yAxisText yAxisText->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 RETURN, dum END ;------------------------------------------------------------------------- FUNCTION DrawThePlot, sState ;print,'DrawThePlot' dum=1 result=sState.oData_varData2D->GetData(varData2D) if size(varData2D,/N_DIMENSIONS) eq 0 then begin print,'3D data has been discarded' print,'please proceed to reload' return,dum endif ;; IF result EQ 0 THEN RETURN, dum result=sState.oData_ScalarLinLog->GetData(SurfaceLog) IF SurfaceLog EQ 0 THEN BEGIN varData2DLinLog=varData2D ENDIF ELSE IF SurfaceLog EQ 1 THEN BEGIN if min(varData2D) le 0 then begin print,'DrawThePlot: in log mode, min of data=',min(varData2D) print,'-> revert to lin mode' varData2DLinLog=varData2D ;WIDGET_CONTROL, sState.wSelectSurface, GET_VALUE=index ;index[1]=0 ;WIDGET_CONTROL, sState.wSelectSurface, SET_VALUE=index SurfaceLog=0 result=sState.oData_ScalarLinLog->SetData(SurfaceLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = SurfaceLog endif else begin varData2DLinLog=alog10(varData2D) endelse END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; PLOT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; result=sState.oData_ImageProfile->GetData(ImageProfile) result=sState.oData_Plotx->GetData(ixdata) if ImageProfile EQ 0 then begin sState.oPlot->SetProperty, Datay=varData2DLinLog(ixdata,*) endif else begin sState.oPlot->SetProperty, Datay=varData2DLinLog(*,ixdata) endelse sState.oPlot->GetProperty, XRange=xrange, YRange=yrange if ( (yrange[1] - yrange[0]) le 0.0000001 ) then begin yrange[0]=0. yrange[1]=1. end sState.xAxisPlot->SetProperty, Range=xrange sState.yAxisPlot->SetProperty, Range=yrange sState.xaxisPlot->GetProperty, Ticktext=xAxisText sState.yaxisPlot->GetProperty, Ticktext=yAxisText xAxisText->SetProperty, Font=sState.helvetica12ptFontObject, Recompute_Dimensions=2 if ( (yrange[1] - yrange[0]) le 0.001 ) then begin yAxisText->SetProperty, Font=sState.helvetica5ptFontObject, Recompute_Dimensions=2 endif else begin yAxisText->SetProperty, Font=sState.helvetica12ptFontObject, Recompute_Dimensions=2 end sState.xTitlePlot->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.yTitlePlot->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.xAxisPlot->GetProperty, CRange=xrange sState.yAxisPlot->GetProperty, CRange=yrange xs = Normalize(xrange, Position=[-0.5,0.5]) ys = Normalize(yrange, Position=[-0.5,0.5]) sState.xAxisPlot->SetProperty, Location=[9999.0, -0.5, -0.5], XCoord_Conv=xs sState.yAxisPlot->SetProperty, Location=[-0.5, 9999.0, -0.5], YCoord_Conv=ys sState.oPlot->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys sState.xaxisPlot->SetProperty, HIDE=0 sState.yaxisPlot->SetProperty, HIDE=0 RETURN, dum END ;------------------------------------------------------------------------- ;************************************************************************************************ ;************************************************************************************************ ;************************************************************************************************ ;+ ; NAME : ; FILLTHEISOPLOT ; ; PURPOSE : ; prepare the data associated to the isosurface histogram ; ; AUTHORSHIP : ; written by D. Pomarède ; ; MODIFICATION HISTORY : ; 2005-2006 : initially developped under the DrawTheIsoPlot function ; january 2008 : extraction of normalization part to the RenormIsoPlot procedure ; ; INPUTS : ; sState : main memory structure of SDvivion ; PRO FillTheIsoPlot, sState ;print,'FillTheIsoPlot' dum=1 result=sState.oData_flag->GetData(iflag_var) level=0 no_copy=1 result=sState.oData_HDFvar[-iflag_var-1,level]->GetData(varData3D,NO_COPY=no_copy) if size(varData3D,/N_DIMENSIONS) eq 0 then begin print,'3D data has been discarded' print,'please proceed to reload' return endif result=sState.oData_ScalarLinLog->GetData(ScalarLinLog) IF ScalarLinLog EQ 1 THEN BEGIN if min(varData3D) le 0 then begin print,'FillTheIsoPlot: in log mode, min of data=',min(varData3D) print,'-> no display !!!' result=sState.oData_HDFvar[-iflag_var-1,level]->SetData(varData3D) return endif END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; PLOT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; nbins=150 ;print,'min(varData3D)=',min(varData3D) ;print,'max(varData3D)=',max(varData3D) ;print,'->HISTOGRAM' IF ScalarLinLog EQ 0 THEN BEGIN hist=HISTOGRAM(varData3D,NBINS=nbins) minh=MIN(varData3D) maxh=MAX(varData3D) bins=(FINDGEN(N_ELEMENTS(hist)))*(maxh-minh)/(nbins-1)+minh endif else begin hist=HISTOGRAM(alog10(varData3D),NBINS=nbins) minh=MIN(alog10(varData3D)) maxh=MAX(alog10(varData3D)) bins=(FINDGEN(N_ELEMENTS(hist)))*(maxh-minh)/(nbins-1)+minh end result=sState.oData_HistoLog->GetData(HistoLog) IF HistoLog EQ 0 THEN BEGIN sState.oIsoPlot->SetProperty, Datax=bins, Datay=hist ENDIF ELSE IF HistoLog EQ 1 THEN BEGIN sState.oIsoPlot->SetProperty, Datax=bins, Datay=alog10(hist) END result=sState.oData_HDFvar[-iflag_var-1,level]->SetData(varData3D) RETURN END ;------------------------------------------------------------------------- ;************************************************************************************************ ;************************************************************************************************ ;************************************************************************************************ ;+ ; NAME : ; RENORMISOPLOT ; ; PURPOSE : ; normalization of objects associated to the isosurface histogram ; ; AUTHORSHIP : ; written by D. Pomarède ; ; MODIFICATION HISTORY : ; january 2008 : extraction from the DrawTheIsoPlot function ; ; INPUTS : ; sState : main memory structure of SDvivion ; PRO RenormIsoPlot,sState ;print,'RenormIsoPlot' sState.oIsoPlot->GetProperty, XRange=xrange, YRange=yrange if xrange[0] eq xrange[1] then begin print,'xrange=',xrange xrange[0]=xrange[0]*0.9 xrange[1]=xrange[1]*1.1 if xrange[0] eq 0 then begin xrange[0]=-1. xrange[1]= 1. endif endif if yrange[0] eq yrange[1] then begin print,'yrange=',yrange yrange[0]=yrange[0]*0.9 yrange[1]=yrange[1]*1.1 if yrange[0] eq 0 then begin yrange[0]=-1. yrange[1]= 1. endif endif sState.xAxisIsoPlotT->SetProperty, Range=xrange sState.xAxisIsoPlotB->SetProperty, Range=xrange sState.yAxisIsoPlotL->SetProperty, Range=yrange sState.yAxisIsoPlotR->SetProperty, Range=yrange sState.xaxisIsoPlotT->GetProperty, Ticktext=xAxisTextT sState.xaxisIsoPlotB->GetProperty, Ticktext=xAxisTextB sState.yaxisIsoPlotL->GetProperty, Ticktext=yAxisTextL sState.yaxisIsoPlotR->GetProperty, Ticktext=yAxisTextR xAxisTextT->SetProperty, Font=sState.helvetica10ptFontObject, Recompute_Dimensions=2 xAxisTextB->SetProperty, Font=sState.helvetica10ptFontObject, Recompute_Dimensions=2 yAxisTextL->SetProperty, HIDE=1 yAxisTextR->SetProperty, HIDE=1 xAxisTextB->GetProperty, LOCATIONS=locations ;sizeloc=SIZE(locations) ;NVAL=sizeloc(2) sState.xTitleIsoPlot->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.xAxisIsoPlotT->GetProperty, CRange=xrange sState.xAxisIsoPlotB->GetProperty, CRange=xrange sState.yAxisIsoPlotL->GetProperty, CRange=yrange sState.yAxisIsoPlotR->GetProperty, CRange=yrange xs = Normalize(xrange, Position=[-0.5,0.5]) ys = Normalize(yrange, Position=[-0.5,0.5]) sState.xAxisIsoPlotT->SetProperty, Location=[9999.0, 0.5, -0.5], XCoord_Conv=xs sState.xAxisIsoPlotB->SetProperty, Location=[9999.0, -0.5, -0.5], XCoord_Conv=xs sState.yAxisIsoPlotL->SetProperty, Location=[-0.5, 9999.0, -0.5], YCoord_Conv=ys sState.yAxisIsoPlotR->SetProperty, Location=[ 0.5, 9999.0, -0.5], YCoord_Conv=ys sState.oIsoPlot->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys sState.oPolyLineIsoPlot->GetProperty, DATA=Polyline sState.xAxisIsoPlotB->GetProperty, XRANGE=xri result=sState.oData_IsoPlot->GetData(IsoPlot) result=sState.oData_PolygonVarID->GetData(PolygonVarID) result=sState.oData_PolygonID->GetData(PolygonID) xdata=IsoPlot[PolygonID[PolygonVarID]] Polyline[0,*]=-0.5+(xdata-xri[0])/(xri[1]-xri[0]) if Polyline[0,0] lt -0.5 then Polyline[0,*]=-0.5 if Polyline[0,0] gt 0.5 then Polyline[0,*]= 0.5 sState.oPolyLineIsoPlot->SetProperty, DATA=Polyline END ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- FUNCTION DrawTheDarkMatterdensity, sState ;print,'DrawTheDarkMatterdensity' dum=1 ;result=sState.oData_varData3D->GetData(varData3D) result=sState.oData_flag->GetData(iflag_var) level=0 no_copy=1 ;result=sState.oData_HDFvar[-iflag_var-1,level]->GetData(varData3D,NO_COPY=no_copy) result=sState.oData_AMRoctreePart->GetData(varData3D,NO_COPY=no_copy) ;help,varData3D IF result EQ 0 THEN RETURN, dum result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) index_array=where( varData3D.xp(0,*) ge MeshIJKboundaries[0] and varData3D.xp(0,*) le MeshIJKboundaries[1] and $ varData3D.xp(1,*) ge MeshIJKboundaries[2] and varData3D.xp(1,*) le MeshIJKboundaries[3] and $ varData3D.xp(2,*) ge MeshIJKboundaries[4] and varData3D.xp(2,*) le MeshIJKboundaries[5] , count ) if count le 0 then begin print,'in DrawTheDarkMatterdensity number of particle in volume = 0' print,'update skipped' ;result=sState.oData_HDFvar[-iflag_var-1,level]->SetData(TEMPORARY(varData3D)) result=sState.oData_AMRoctreePart->SetData(varData3D) return,dum endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; PLOT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; nbins=150 ;print,'min(varData3D)=',min(varData3D) ;print,'max(varData3D)=',max(varData3D) dv=WIDGET_INFO(sState.wParticlesDensVel,/DROPLIST_SELECT ) linlogx=WIDGET_INFO(sState.wParticlesLinLogX,/DROPLIST_SELECT ) linlogy=WIDGET_INFO(sState.wParticlesLinLogY,/DROPLIST_SELECT ) if dv eq 1 then begin v=varData3D.vp ;data=( v(*,0)^2 + v(*,1)^2 + v(*,2)^2 )^0.5 data=( v(index_array,0)^2 + v(index_array,1)^2 + v(index_array,2)^2 )^0.5 endif else if dv eq 0 then begin data=varData3D.dp(index_array) end if linlogx eq 0 then data=alog10(data) ;help,data hist=HISTOGRAM(data,NBINS=nbins) bins=(FINDGEN(N_ELEMENTS(hist)))*(MAX(data)-MIN(data))/(nbins-1)+MIN(data) isoHisto=HISTOGRAM(data,NBINS=nbins,/BINSIZE,OMAX=omax,OMIN=omin) ;result=sState.oData_HistoLog->GetData(HistoLog) HistoLog=1-linlogy IF HistoLog EQ 0 THEN BEGIN sState.oDMDensityPlot->SetProperty, Datax=bins, Datay=hist ENDIF ELSE IF HistoLog EQ 1 THEN BEGIN sState.oDMDensityPlot->SetProperty, Datax=bins, Datay=alog10(hist) END sState.oDMDensityPlot->GetProperty, XRange=xrange, YRange=yrange sState.xAxisDMDensityPlotT->SetProperty, Range=xrange sState.xAxisDMDensityPlotB->SetProperty, Range=xrange sState.yAxisDMDensityPlotL->SetProperty, Range=yrange sState.yAxisDMDensityPlotR->SetProperty, Range=yrange sState.xaxisDMDensityPlotT->GetProperty, Ticktext=xAxisTextT sState.xaxisDMDensityPlotB->GetProperty, Ticktext=xAxisTextB sState.yaxisDMDensityPlotL->GetProperty, Ticktext=yAxisTextL sState.yaxisDMDensityPlotR->GetProperty, Ticktext=yAxisTextR xAxisTextT->SetProperty, Font=sState.helvetica10ptFontObject, Recompute_Dimensions=2 xAxisTextB->SetProperty, Font=sState.helvetica10ptFontObject, Recompute_Dimensions=2 yAxisTextL->SetProperty, HIDE=1 yAxisTextR->SetProperty, HIDE=1 xAxisTextB->GetProperty, LOCATIONS=locations ;sizeloc=SIZE(locations) ;NVAL=sizeloc(2) ;sState.xTitleDMDensityPlot->SetProperty, Font=helvetica2pt, Recompute_Dimensions=2 xAxisTextB->GetProperty, CHAR_DIMENSIONS=chardim ;print,'chardim=',chardim chardim=chardim/2. xAxisTextB->SetProperty, CHAR_DIMENSIONS=chardim sState.xaxisDMDensityPlotB->SetProperty, Ticktext=xAxisTextB sState.xAxisDMDensityPlotT->GetProperty, CRange=xrange sState.xAxisDMDensityPlotB->GetProperty, CRange=xrange sState.yAxisDMDensityPlotL->GetProperty, CRange=yrange sState.yAxisDMDensityPlotR->GetProperty, CRange=yrange xs = Normalize(xrange, Position=[-0.5,0.5]) ys = Normalize(yrange, Position=[-0.5,0.5]) sState.xAxisDMDensityPlotT->SetProperty, Location=[9999.0, 0.5, -0.5], XCoord_Conv=xs sState.xAxisDMDensityPlotB->SetProperty, Location=[9999.0, -0.5, -0.5], XCoord_Conv=xs sState.yAxisDMDensityPlotL->SetProperty, Location=[-0.5, 9999.0, -0.5], YCoord_Conv=ys sState.yAxisDMDensityPlotR->SetProperty, Location=[ 0.5, 9999.0, -0.5], YCoord_Conv=ys sState.oDMDensityPlot->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys sState.xAxisDMDensityPlotB->GetProperty, XRANGE=xri result=sState.oData_DMDensityPlot->GetData(xdata) sState.oPolyLineDMDensityPlot[0]->GetProperty, DATA=Polyline Polyline[0,*]=-0.5+(xdata[0]-xri[0])/(xri[1]-xri[0]) if Polyline[0,0] lt -0.5 then Polyline[0,*]=-0.5 if Polyline[0,0] gt 0.5 then Polyline[0,*]= 0.5 sState.oPolyLineDMDensityPlot[0]->SetProperty, DATA=Polyline sState.oPolyLineDMDensityPlot[1]->GetProperty, DATA=Polyline Polyline[0,*]=-0.5+(xdata[1]-xri[0])/(xri[1]-xri[0]) if Polyline[0,0] lt -0.5 then Polyline[0,*]=-0.5 if Polyline[0,0] gt 0.5 then Polyline[0,*]= 0.5 sState.oPolyLineDMDensityPlot[1]->SetProperty, DATA=Polyline result=sState.oData_AMRoctreePart->SetData(varData3D,NO_COPY=no_copy) RETURN, dum END ;------------------------------------------------------------------------- FUNCTION DrawThe2DVectorField, sState ;print,'DrawThe2DVectorField' dum=1 result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_varData2D->GetData(varData2D) ;help, varData2D result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) result=sState.oData_xyzplane->GetData(xyzplane) result=sState.oData_GridDim->GetData(GridDim) sizevar=size(varData2D,/DIMENSIONS) ; slice xy at z fixed if xyzplane eq 1 then begin rebinexpansion_x=(1.*(GridDim[0]))/(sizevar[0]) rebinexpansion_y=(1.*(GridDim[1]))/(sizevar[1]) rangex=VectorFieldConfig(0,2)-VectorFieldConfig(0,1) + 1. if VectorFieldConfig(0,0) eq 1 then begin stepx=0 endif else begin stepx=1.*rangex/(VectorFieldConfig(0,0)-1)/rebinexpansion_x endelse nvertx=VectorFieldConfig(0,0) iminx=VectorFieldConfig(0,1) imaxx=GridDim(0)-1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rangey=VectorFieldConfig(1,2)-VectorFieldConfig(1,1) + 1. if VectorFieldConfig(1,0) eq 1 then begin stepy=0 endif else begin stepy=1.*rangey/(VectorFieldConfig(1,0)-1)/rebinexpansion_y endelse nverty=VectorFieldConfig(1,0) iminy=VectorFieldConfig(1,1) imaxy=GridDim(1)-1 ; slice xz at y fixed endif else if xyzplane eq 2 then begin rebinexpansion_x=(1.*(GridDim[0]))/(sizevar[0]) rebinexpansion_z=(1.*(GridDim[2]))/(sizevar[1]) rangex=VectorFieldConfig(0,2)-VectorFieldConfig(0,1) + 1. if VectorFieldConfig(0,0) eq 1 then begin stepx=0 endif else begin stepx=1.*rangex/(VectorFieldConfig(0,0)-1)/rebinexpansion_x endelse nvertx=VectorFieldConfig(0,0) iminx=VectorFieldConfig(0,1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rangey=VectorFieldConfig(2,2)-VectorFieldConfig(2,1) + 1. ;print,'VectorFieldConfig(2,2),VectorFieldConfig(2,1)=',VectorFieldConfig(2,2),VectorFieldConfig(2,1) ;print,'test=',VectorFieldConfig(2,2)-VectorFieldConfig(2,1) + 1. if VectorFieldConfig(2,0) eq 1 then begin stepy=0 endif else begin stepy=1.*rangey/(VectorFieldConfig(2,0)-1)/rebinexpansion_z endelse nverty=VectorFieldConfig(2,0) iminy=VectorFieldConfig(2,1) ; slice yz at x fixed endif else if xyzplane eq 3 then begin rebinexpansion_y=(1.*(GridDim[1]))/(sizevar[0]) rebinexpansion_z=(1.*(GridDim[2]))/(sizevar[1]) rangex=VectorFieldConfig(1,2)-VectorFieldConfig(1,1) + 1. if VectorFieldConfig(1,0) eq 1 then begin stepx=0 endif else begin stepx=1.*rangex/(VectorFieldConfig(1,0)-1)/rebinexpansion_y endelse nvertx=VectorFieldConfig(1,0) iminx=VectorFieldConfig(1,1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rangey=VectorFieldConfig(2,2)-VectorFieldConfig(2,1) + 1. if VectorFieldConfig(2,0) eq 1 then begin stepy=0 endif else begin stepy=1.*rangey/(VectorFieldConfig(2,0)-1)/rebinexpansion_z endelse nverty=VectorFieldConfig(2,0) iminy=VectorFieldConfig(2,1) end nvertices=nvertx*nverty xypos=make_array(2,nvertices) count=0 ;help,varData2D result=sState.oData_DataFormat->GetData(DataFormat) IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER nxg=sState.GeoStructure.nxg nyg=sState.GeoStructure.nyg nzg=sState.GeoStructure.nzg result=sState.oData_MultiGridSize->GetData(MultiGridSize) level=0 if xyzplane eq 1 then begin cx=1.*MultiGridSize(level,0)/nxg cy=1.*MultiGridSize(level,1)/nyg endif else if xyzplane eq 2 then begin cx=1.*MultiGridSize(level,0)/nxg cy=1.*MultiGridSize(level,2)/nzg endif else if xyzplane eq 3 then begin cx=1.*MultiGridSize(level,1)/nyg cy=1.*MultiGridSize(level,2)/nzg end ENDIF ;print,'nvertx,iminx,stepx,rangex=',nvertx,iminx,stepx,rangex ;print,'nverty,iminy,stepy,rangey=',nverty,iminy,stepy,rangey for i=0,nvertx-1 do begin for j=0,nverty-1 do begin ix=fix(iminx+i*stepx) ;- 1 iy=fix(iminy+j*stepy) ;- 1 if i eq nvertx-1 then ix=ix - 1 if j eq nverty-1 then iy=iy - 1 ;print,i,j,ix,iy IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER ix=ix*cx iy=iy*cy ENDIF if varData2D[ix,iy,0] ne 0. or varData2D[ix,iy,1] ne 0. then begin xypos(0,count)=ix xypos(1,count)=iy count=count+1 endif endfor endfor ;IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER ; xypos(0,*)=xypos(0,*)*cx ; xypos(1,*)=xypos(1,*)*cy ;ENDIF xrange=make_array([2]) yrange=make_array([2]) s = SIZE(varData2D) xrange[0]=1 xrange[1]=s(1) yrange[0]=1 yrange[1]=s(2) sState.xAxisImage->SetProperty, Range=xrange sState.yAxisImage->SetProperty, Range=yrange xs = Normalize(xrange, Position=[-0.5,0.5]) ys = Normalize(yrange, Position=[-0.5,0.5]) sState.xAxisImage->SetProperty, XCoord_Conv=xs sState.yAxisImage->SetProperty, YCoord_Conv=ys result=sState.oData_VectorFieldScale->GetData(VectorFieldScale) IF iflag_vue[1] EQ 3 THEN BEGIN ;help,varData2D ;v=transpose(varData2D,[2,0,1]) ;help,v ;v1=v(0,*,*) ;v2=v(1,*,*) ;print,'min,max v1=',min(v1),max(v1) ;print,'min,max v2=',min(v2),max(v2) ;print,'min(varData2D)=',min(varData2D) ;print,'max(varData2D)=',max(varData2D) ;index=where(v ne 0.,count) ;help,xypos ;print,'count=',count if count gt 0 then begin sState.oVectorField2D->SetProperty,HIDE=0 xypos_nozero=xypos(*,0:count-1) ;help,xypos_nozero ;IF max(varData2D) GT min(varData2D) THEN BEGIN ;print,xypos(0,*) VECTOR_FIELD,transpose(varData2D,[2,0,1]), $ outverts,outconn,vertices=xypos_nozero,scale=VectorFieldScale ; VECTOR_FIELD,vv, $ ; outverts,outconn,vertices=xypos,scale=VectorFieldScale maxDim = MAX(outverts[0,*]) > MAX(outverts[1,*]) result=sState.oData_GridDim->GetData(GridDim) nx=GridDim(0)*1L size=nx/100. IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER result=sState.oData_MultiGridSize->GetData(MultiGridSize) level=0 ;SymDim(0)=SymDim(0)*1.*MultiGridSize(level,0)/nxg ;SymDim(1)=SymDim(1)*1.*MultiGridSize(level,1)/nyg ;SymDim(2)=SymDim(2)*1.*MultiGridSize(level,2)/nzg size=size*1.*MultiGridSize(level,0)/nxg ENDIF ;print,'size=',size ;help,outverts ;print,outverts ;help,outconn ;print,outconn oSymbol = OBJ_NEW('IDLgrSymbol',Data=8, size=size) nPolys = countPolys(outconn) lblPolys = LINDGEN(nPolys) oLblSymbols = REPLICATE(oSymbol, nPolys) lblOffsets = REPLICATE(1.0, nPolys) sState.oVectorField2D->SetProperty,LABEL_OBJECTS=oLblSymbols, $ LABEL_POLYLINES=lblPolys, $ LABEL_OFFSETS=lblOffsets, $ /LABEL_USE_VERTEX_COLOR, $ /LABEL_NOGAPS, $ POLYLINES=outconn, $ Data=outverts sState.oVectorField2D->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys ENDIF ELSE BEGIN ;datadum=intarr([2,2]) ;datadum(*,*)=0 ;sState.oVectorField2D->SetProperty,data=datadum sState.oVectorField2D->SetProperty,HIDE=1 END ENDIF IF iflag_vue[1] EQ 4 THEN BEGIN ;print,'PARTICLE_TRACE' maxIterations=100 stepSize=.5 ;help,varData2D tvar=transpose(varData2D*VectorFieldScale,[2,0,1]) ;help,tvar ;help,xypos PARTICLE_TRACE,tvar,xypos,outverts2,outconn2, $ MAX_ITERATIONS=maxIterations, MAX_STEPSIZE=stepSize, $ INTEGRATION=0,ANISOTROPY=[1,1] ;help, outverts2 ;help, outconn2 if (outconn2[0] eq -1l) then MESSAGE, 'No particle trace.' sState.oStreamlines2D->SetProperty, $ ;LABEL_OBJECTS=oLblSymbols, $ ;LABEL_POLYLINES=lblPolys, $ ;LABEL_OFFSETS=lblOffsets, $ ; /LABEL_USE_VERTEX_COLOR, $ ; /LABEL_NOGAPS, $ POLYLINES=outconn2, $ Data=outverts2 sState.oStreamlines2D->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys ENDIF RETURN, dum END ;------------------------------------------------------------------------- FUNCTION DrawTheGeometry, sState ;print,'in DrawTheGeometry' dum=1 result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_DataFormat->GetData(DataFormat) ;print,'iflag_vue=',iflag_vue ;print,'DataFormat=',DataFormat if iflag_vue[3] EQ 3 and DataFormat eq 5 then begin getdesc,grid=g,sState,cpu=indgen(1000) ;,/FORCE ;getdesc,grid=g,sState,/ALL ;,/FORCE return,dum endif ; iflag_vue[3] EQ 3 xrange=make_array([2]) yrange=make_array([2]) zrange=make_array([2]) eps=0.;0.95 ;WIDGET_CONTROL, sState.wBoundariesOptions[2], GET_VALUE=eps WIDGET_CONTROL, sState.wAxisOptions[3], GET_VALUE=units WIDGET_CONTROL, sState.wAxisOptions[1], GET_VALUE=span ;print,'units=',units ;print,'span=',span ;print,'eps=',eps nxg=sState.GeoStructure.nxg nyg=sState.GeoStructure.nyg nzg=sState.GeoStructure.nzg nmax=max([nxg,nyg,nzg]) nproc=sState.GeoStructure.nproc ;print,'DrawTheGeometry nxg,nyg,nzg,nproc=',nxg,nyg,nzg,nproc if units eq 0 then begin xrange[0]=0. -eps yrange[0]=0. -eps zrange[0]=0. -eps if span eq 0 then begin xrange[1]=nxg-1. +eps yrange[1]=nyg-1. +eps zrange[1]=nzg-1. +eps endif else if span eq 1 then begin xrange[1]=nmax-1 +eps yrange[1]=nmax-1 +eps zrange[1]=nmax-1 +eps end endif else if units eq 1 then begin print,'xmin,xmax=',sState.GeoStructure.xmin,sState.GeoStructure.xmax print,'ymin,ymax=',sState.GeoStructure.ymin,sState.GeoStructure.ymax print,'zmin,zmax=',sState.GeoStructure.zmin,sState.GeoStructure.zmax if span eq 0 then begin xrange[0]=sState.GeoStructure.xmin -eps yrange[0]=sState.GeoStructure.ymin -eps zrange[0]=sState.GeoStructure.zmin -eps xrange[1]=sState.GeoStructure.xmax +eps yrange[1]=sState.GeoStructure.ymax +eps zrange[1]=sState.GeoStructure.zmax +eps endif else if span eq 1 then begin if nmax eq nxg then begin xrange[0]=sState.GeoStructure.xmin -eps yrange[0]=sState.GeoStructure.xmin -eps zrange[0]=sState.GeoStructure.xmin -eps xrange[1]=sState.GeoStructure.xmax +eps yrange[1]=sState.GeoStructure.xmax +eps zrange[1]=sState.GeoStructure.xmax +eps endif else if nmax eq nyg then begin xrange[0]=sState.GeoStructure.ymin -eps yrange[0]=sState.GeoStructure.ymin -eps zrange[0]=sState.GeoStructure.ymin -eps xrange[1]=sState.GeoStructure.ymax +eps yrange[1]=sState.GeoStructure.ymax +eps zrange[1]=sState.GeoStructure.ymax +eps endif else if nmax eq nzg then begin xrange[0]=sState.GeoStructure.zmin -eps yrange[0]=sState.GeoStructure.zmin -eps zrange[0]=sState.GeoStructure.zmin -eps xrange[1]=sState.GeoStructure.zmax +eps yrange[1]=sState.GeoStructure.zmax +eps zrange[1]=sState.GeoStructure.zmax +eps end end end sState.xaxis3D->SetProperty, Range=xrange sState.yaxis3D->SetProperty, Range=yrange sState.zaxis3D->SetProperty, Range=zrange sState.xaxis3D->GetProperty, Ticktext=xAxisText sState.yaxis3D->GetProperty, Ticktext=yAxisText sState.zaxis3D->GetProperty, Ticktext=zAxisText xAxisText->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 yAxisText->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 zAxisText->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.xTitleObj3D->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.yTitleObj3D->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.zTitleObj3D->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2 sState.xaxis3D->GetProperty, CRange=xrange sState.yaxis3D->GetProperty, CRange=yrange sState.zaxis3D->GetProperty, CRange=zrange xs = Normalize(xrange, Position=[-0.5,0.5]) ys = Normalize(yrange, Position=[-0.5,0.5]) zs = Normalize(zrange, Position=[-0.5,0.5]) scale= 0.6 xs=xs*scale ys=ys*scale zs=zs*scale WIDGET_CONTROL, sState.wAxisOptions[2], GET_VALUE=index if index eq 0 then begin sState.xaxis3D->SetProperty, Location=[0.,0.,0.], XCoord_Conv=xs sState.yaxis3D->SetProperty, Location=[0.,0.,0.], YCoord_Conv=ys sState.zaxis3D->SetProperty, Location=[0.,0.,0.], ZCoord_Conv=zs endif else if index eq 1 then begin sState.xaxis3D->SetProperty, Location=[0.,-0.5*scale,-0.5*scale], XCoord_Conv=xs sState.yaxis3D->SetProperty, Location=[-0.5*scale,0.,-0.5*scale], YCoord_Conv=ys sState.zaxis3D->SetProperty, Location=[-0.5*scale,-0.5*scale,0.], ZCoord_Conv=zs end if iflag_vue[3] EQ 1 then begin limit1=0.5*scale limit2=0.5*scale xrange=[0.,1.] yrange=[0.,1.] zrange=[0.,1.] xs = Normalize(xrange, Position=[-0.5,0.5])*scale ys = Normalize(yrange, Position=[-0.5,0.5])*scale zs = Normalize(zrange, Position=[-0.5,0.5])*scale sState.xaxis3Dbounds1->SetProperty, Range=xrange sState.xaxis3Dbounds2->SetProperty, Range=xrange sState.xaxis3Dbounds3->SetProperty, Range=xrange sState.xaxis3Dbounds4->SetProperty, Range=xrange sState.xaxis3Dbounds1->SetProperty, Location=[0.,-limit1,-limit1], XCoord_Conv=xs sState.xaxis3Dbounds2->SetProperty, Location=[0.,-limit1, limit2], XCoord_Conv=xs sState.xaxis3Dbounds3->SetProperty, Location=[0., limit2,-limit1], XCoord_Conv=xs sState.xaxis3Dbounds4->SetProperty, Location=[0., limit2, limit2], XCoord_Conv=xs sState.yaxis3Dbounds1->SetProperty, Range=yrange sState.yaxis3Dbounds2->SetProperty, Range=yrange sState.yaxis3Dbounds3->SetProperty, Range=yrange sState.yaxis3Dbounds4->SetProperty, Range=yrange sState.yaxis3Dbounds1->SetProperty, Location=[-limit1,0.,-limit1], YCoord_Conv=ys sState.yaxis3Dbounds2->SetProperty, Location=[-limit1,0., limit2], YCoord_Conv=ys sState.yaxis3Dbounds3->SetProperty, Location=[ limit2,0.,-limit1], YCoord_Conv=ys sState.yaxis3Dbounds4->SetProperty, Location=[ limit2,0., limit2], YCoord_Conv=ys sState.zaxis3Dbounds1->SetProperty, Range=zrange sState.zaxis3Dbounds2->SetProperty, Range=zrange sState.zaxis3Dbounds3->SetProperty, Range=zrange sState.zaxis3Dbounds4->SetProperty, Range=zrange sState.zaxis3Dbounds1->SetProperty, Location=[-limit1,-limit1,0.], ZCoord_Conv=zs sState.zaxis3Dbounds2->SetProperty, Location=[-limit1, limit2,0.], ZCoord_Conv=zs sState.zaxis3Dbounds3->SetProperty, Location=[ limit2,-limit1,0.], ZCoord_Conv=zs sState.zaxis3Dbounds4->SetProperty, Location=[ limit2, limit2,0.], ZCoord_Conv=zs endif ; iflag_vue[3] EQ 1 if iflag_vue[3] EQ 3 then begin nproc=sState.GeoStructure.nproc xse=sState.GeoStructure.xse yse=sState.GeoStructure.yse zse=sState.GeoStructure.zse if nproc gt 0 then begin Polyline=make_array([3],[2]) for idomain=0,nproc-1 do begin iaxis=0 Polyline[0,0:1]=xse[0:1,idomain] for ibounds=0,1 do begin for jbounds=0,1 do begin ijbounds=ibounds+2*jbounds Polyline[1,0:1]=yse[ibounds,idomain] Polyline[2,0:1]=zse[jbounds,idomain] sState.GeoStructure.domains([iaxis],[ijbounds],[idomain])= $ Obj_New("IDLgrPolyline", Polyline , Color=[200,0,0]) ;sState.oModelObjects3D->Add, sState.GeoStructure.domains([iaxis],[ijbounds],[idomain]) sState.GeoStructure.JupiterDomainsModel->Add, sState.GeoStructure.domains([iaxis],[ijbounds],[idomain]) sState.GeoStructure.domains[[iaxis],[ijbounds],[idomain]]->SetProperty, XCoord_Conv=xs,YCoord_Conv=ys,ZCoord_Conv=zs endfor endfor iaxis=1 Polyline[1,0:1]=yse[0:1,idomain] for ibounds=0,1 do begin for jbounds=0,1 do begin ijbounds=ibounds+2*jbounds Polyline[0,0:1]=xse[ibounds,idomain] Polyline[2,0:1]=zse[jbounds,idomain] sState.GeoStructure.domains([iaxis],[ijbounds],[idomain])= $ Obj_New("IDLgrPolyline", Polyline , Color=[200,0,0]) ;sState.oModelObjects3D->Add, sState.GeoStructure.domains([iaxis],[ijbounds],[idomain]) sState.GeoStructure.JupiterDomainsModel->Add, sState.GeoStructure.domains([iaxis],[ijbounds],[idomain]) sState.GeoStructure.domains[[iaxis],[ijbounds],[idomain]]->SetProperty, $ XCoord_Conv=xs,YCoord_Conv=ys,ZCoord_Conv=zs endfor endfor iaxis=2 Polyline[2,0:1]=zse[0:1,idomain] for ibounds=0,1 do begin for jbounds=0,1 do begin ijbounds=ibounds+2*jbounds Polyline[0,0:1]=xse[ibounds,idomain] Polyline[1,0:1]=yse[jbounds,idomain] sState.GeoStructure.domains([iaxis],[ijbounds],[idomain])= $ Obj_New("IDLgrPolyline", Polyline , Color=[200,0,0]) ;sState.oRotationModel3D->Add, sState.GeoStructure.domains([iaxis],[ijbounds],[idomain]) sState.GeoStructure.JupiterDomainsModel->Add, sState.GeoStructure.domains[[iaxis],[ijbounds],[idomain]] sState.GeoStructure.domains[[iaxis],[ijbounds],[idomain]]->SetProperty, $ XCoord_Conv=xs,YCoord_Conv=ys,ZCoord_Conv=zs endfor endfor endfor endif endif ; iflag_vue[3] EQ 3 if iflag_vue[3] EQ 4 then begin endif RETURN, dum END ;------------------------------------------------------------------------- ; ; Author Y. Fidaali ; PRO DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries scale = 0.6 limite=0.5*scale xrange = [MeshIJKboundaries[0],MeshIJKboundaries[1]] yrange = [MeshIJKboundaries[2],MeshIJKboundaries[3]] zrange = [MeshIJKboundaries[4],MeshIJKboundaries[5]] xs = Normalize(xrange, Position=[MeshIJKboundaries[0]-0.5,MeshIJKboundaries[1]-0.5])*scale ys = Normalize(yrange, Position=[MeshIJKboundaries[2]-0.5,MeshIJKboundaries[3]-0.5])*scale zs = Normalize(zrange, Position=[MeshIJKboundaries[4]-0.5,MeshIJKboundaries[5]-0.5])*scale LocationValues=fltarr([6]) LocationValues[0] = MeshIJKboundaries[0]*scale LocationValues[1] = MeshIJKboundaries[1]*scale LocationValues[2] = MeshIJKboundaries[2]*scale LocationValues[3] = MeshIJKboundaries[3]*scale LocationValues[4] = MeshIJKboundaries[4]*scale LocationValues[5] = MeshIJKboundaries[5]*scale subAxisBoundaries[0]->setProperty, Range = xrange subAxisBoundaries[1]->setProperty, Range = xrange subAxisBoundaries[2]->setProperty, Range = xrange subAxisBoundaries[3]->setProperty, Range = xrange subAxisBoundaries[0]->setProperty, Location=[LocationValues[0], $ LocationValues[2] - limite, $ LocationValues[4] - limite], XCoord_Conv=xs subAxisBoundaries[1]->setProperty, Location=[LocationValues[0] , $ LocationValues[2] - limite, $ LocationValues[5] - limite], XCoord_Conv=xs subAxisBoundaries[2]->setProperty, Location=[LocationValues[0], $ LocationValues[3] - limite, $ LocationValues[4] - limite], XCoord_Conv=xs subAxisBoundaries[3]->setProperty, Location=[LocationValues[0], $ LocationValues[3] - limite, $ LocationValues[5] - limite], XCoord_Conv=xs subAxisBoundaries[4]->setProperty, Range = yrange subAxisBoundaries[5]->setProperty, Range = yrange subAxisBoundaries[6]->setProperty, Range = yrange subAxisBoundaries[7]->setProperty, Range = yrange subAxisBoundaries[4]->setProperty, Location=[LocationValues[0] - limite, $ LocationValues[2], $ LocationValues[4] - limite], YCoord_Conv=ys subAxisBoundaries[5]->setProperty, Location=[LocationValues[0] - limite, $ LocationValues[2], $ LocationValues[5] - limite], YCoord_Conv=ys subAxisBoundaries[6]->setProperty, Location=[LocationValues[1] - limite, $ LocationValues[2], $ LocationValues[4] - limite], YCoord_Conv=ys subAxisBoundaries[7]->setProperty, Location=[LocationValues[1] - limite, $ LocationValues[2], $ LocationValues[5] - limite], YCoord_Conv=ys subAxisBoundaries[8]->setProperty, Range = zrange subAxisBoundaries[9]->setProperty, Range = zrange subAxisBoundaries[10]->setProperty, Range = zrange subAxisBoundaries[11]->setProperty, Range = zrange subAxisBoundaries[8]->setProperty, Location=[LocationValues[0] - limite, $ LocationValues[2] - limite, $ LocationValues[4]], ZCoord_Conv=zs subAxisBoundaries[9]->setProperty, Location=[LocationValues[1] - limite, $ LocationValues[2] - limite, $ LocationValues[4]], ZCoord_Conv=zs subAxisBoundaries[10]->setProperty, Location=[LocationValues[0] - limite, $ LocationValues[3] - limite, $ LocationValues[4]], ZCoord_Conv=zs subAxisBoundaries[11]->setProperty, Location=[LocationValues[1] - limite, $ LocationValues[3] - limite, $ LocationValues[4]], ZCoord_Conv=zs END ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- function chooseColor, level color = intarr(3) color[0] = 255 color[1] = 255 color[2] = 255 case level of 0 : begin color[0] = 255 color[1] = 255 color[2] = 255 end 1 : begin color[0] = 255 color[1] = 0 color[2] = 0 end 2 : begin color[0] = 0 color[1] = 255 color[2] = 0 end 3 : begin color[0] = 0 color[1] = 0 color[2] = 255 end 4 : begin color[0] = 255 color[1] = 128 color[2] = 0 end 5 : begin color[0] = 255 color[1] = 128 color[2] = 128 end 6 : begin color[0] = 128 color[1] = 0 color[2] = 255 end 7 : begin color[0] = 0 color[1] = 255 color[2] = 255 end 8 : begin color[0] = 255 color[1] = 255 color[2] = 0 end 9 : begin color[0] = 0 color[1] = 0 color[2] = 0 end endcase return, color end ;****************************************************************************** ; Display the AMR Geometry ; ; MODIFICATION HISTORY: ; Written by: Yncia Fidaali, june 2007 ;- PRO drawTheAmrGeometry, grid, oAmrModel3D, oAmrModel2D, AmrLevels, MeshIJKboundaries, $ polylines, ind_poly, polylinesPlanes, colors, alpha, RamsesAmrLevelsFlags, is3DModelDrawn, planesSelected ;print, "is3DModelDrawn = ",is3DModelDrawn ncpu=grid.ncpu scale = 0.6 limite = 0.5*scale hide3D = 0 color=intarr(3) nlevelmax = grid.nlevelmax ;if( nlevelmax gt 14 ) then nlevelmax = 14 for ilevel=nlevelmax, 1, -1 do begin ;if the level has been drawn, only hide the visualization if (AmrLevels[ilevel-1] eq 0) then begin if( RamsesAmrLevelsFlags[ilevel-1] eq 1 ) then begin polylines[ind_poly,ilevel-1]->SetProperty, HIDE=1 for flag = 1, 6 do polylinesPlanes[ind_poly,flag-1, ilevel-1]->SetProperty, HIDE=1 RamsesAmrLevelsFlags[ilevel-1] = 2 endif continue endif ; if the level is already visible, do nothing if (RamsesAmrLevelsFlags[ilevel-1] eq 1) then continue ; if the level has been calculated but is hide, show the visualization if (RamsesAmrLevelsFlags[ilevel-1] eq 2) then begin polylines[ind_poly,ilevel-1]->SetProperty, HIDE=0 for flag = 1, 6 do begin hide2D = 1-planesSelected[flag-1] polylinesPlanes[ind_poly,flag-1, ilevel-1]->SetProperty, HIDE=hide2D endfor RamsesAmrLevelsFlags[ilevel-1] = 1 continue endif print, 'ilevel = ', ilevel if grid.ngrid(ilevel-1,0) eq -1 then begin print,'AMR has not been loaded for level ',ilevel endif for flag = 0, 6 do begin polyline = lonarr(1) X1 = fltarr(1) Y1 = fltarr(1) Z1 = fltarr(1) nElementsVect = 0L nElementsPoly = 0L color = chooseColor(colors[ilevel-1]) ;Mesh size at current level dx=0.5d0^(ilevel-1) for icpu=0,ncpu-1 do begin if(grid.ngrid(ilevel-1,icpu) gt 0)then begin x=(*grid.level[ilevel-1,icpu]).xg(*,0) y=(*grid.level[ilevel-1,icpu]).xg(*,1) z=(*grid.level[ilevel-1,icpu]).xg(*,2) case flag of 0 : begin ind=where(x-dx/2. ge MeshIJKboundaries[0] and x+dx/2. le MeshIJKboundaries[1] and $ y-dx/2. ge MeshIJKboundaries[2] and y+dx/2. le MeshIJKboundaries[3] and $ z-dx/2. ge MeshIJKboundaries[4] and z+dx/2. le MeshIJKboundaries[5], nplot) end 1 : begin ind=where(x-dx/2. ge MeshIJKboundaries[0] and x+dx/2. le MeshIJKboundaries[1] and $ y-dx/2. ge MeshIJKboundaries[2] and y+dx/2. le MeshIJKboundaries[3] and $ z-dx/2. le MeshIJKboundaries[4] and z+dx/2. ge MeshIJKboundaries[4], nplot) end 2 : begin ind=where(x-dx/2. ge MeshIJKboundaries[0] and x+dx/2. le MeshIJKboundaries[1] and $ y-dx/2. ge MeshIJKboundaries[2] and y+dx/2. le MeshIJKboundaries[3] and $ z-dx/2. le MeshIJKboundaries[5] and z+dx/2. ge MeshIJKboundaries[5], nplot) end 3 : begin ind=where(x-dx/2. le MeshIJKboundaries[0] and x+dx/2. ge MeshIJKboundaries[0] and $ y-dx/2. ge MeshIJKboundaries[2] and y+dx/2. le MeshIJKboundaries[3] and $ z-dx/2. ge MeshIJKboundaries[4] and z+dx/2. le MeshIJKboundaries[5], nplot) end 4 : begin ind=where(x-dx/2. le MeshIJKboundaries[1] and x+dx/2. ge MeshIJKboundaries[1] and $ y-dx/2. ge MeshIJKboundaries[2] and y+dx/2. le MeshIJKboundaries[3] and $ z-dx/2. ge MeshIJKboundaries[4] and z+dx/2. le MeshIJKboundaries[5], nplot) end 5 : begin ind=where(x-dx/2. ge MeshIJKboundaries[0] and x+dx/2. le MeshIJKboundaries[1] and $ y-dx/2. le MeshIJKboundaries[2] and y+dx/2. ge MeshIJKboundaries[2] and $ z-dx/2. ge MeshIJKboundaries[4] and z+dx/2. le MeshIJKboundaries[5], nplot) end 6 : begin ind=where(x-dx/2. ge MeshIJKboundaries[0] and x+dx/2. le MeshIJKboundaries[1] and $ y-dx/2. le MeshIJKboundaries[3] and y+dx/2. ge MeshIJKboundaries[3] and $ z-dx/2. ge MeshIJKboundaries[4] and z+dx/2. le MeshIJKboundaries[5], nplot) end endcase if nplot gt 0 then begin xf=dblarr(8,grid.ngrid(ilevel-1,icpu)) yf=dblarr(8,grid.ngrid(ilevel-1,icpu)) zf=dblarr(8,grid.ngrid(ilevel-1,icpu)) for i=0,1 do begin for j=0,1 do begin for k=0,1 do begin ind1=i+2*j+4*k xf(ind1,ind)=(x(ind)+(i-0.5)*dx)*scale yf(ind1,ind)=(y(ind)+(j-0.5)*dx)*scale zf(ind1,ind)=(z(ind)+(k-0.5)*dx)*scale endfor endfor endfor edges = 8 if flag eq 0 then points = 24 else points = 6 X1 = [X1, fltarr(edges*(nplot+1))] Y1 = [Y1, fltarr(edges*(nplot+1))] Z1 = [Z1, fltarr(edges*(nplot+1))] polyline = [polyline, fltarr(points*(nplot+1))] for j=0L, nplot-1 do begin i = ind[j] if flag eq 3 then begin X1[nElementsVect+j*edges+0] = MeshIJKboundaries[0]*scale-limite X1[nElementsVect+j*edges+1] = MeshIJKboundaries[0]*scale-limite X1[nElementsVect+j*edges+2] = MeshIJKboundaries[0]*scale-limite X1[nElementsVect+j*edges+3] = MeshIJKboundaries[0]*scale-limite X1[nElementsVect+j*edges+4] = MeshIJKboundaries[0]*scale-limite X1[nElementsVect+j*edges+5] = MeshIJKboundaries[0]*scale-limite X1[nElementsVect+j*edges+6] = MeshIJKboundaries[0]*scale-limite X1[nElementsVect+j*edges+7] = MeshIJKboundaries[0]*scale-limite endif else if flag eq 4 then begin X1[nElementsVect+j*edges+0] = MeshIJKboundaries[1]*scale-limite X1[nElementsVect+j*edges+1] = MeshIJKboundaries[1]*scale-limite X1[nElementsVect+j*edges+2] = MeshIJKboundaries[1]*scale-limite X1[nElementsVect+j*edges+3] = MeshIJKboundaries[1]*scale-limite X1[nElementsVect+j*edges+4] = MeshIJKboundaries[1]*scale-limite X1[nElementsVect+j*edges+5] = MeshIJKboundaries[1]*scale-limite X1[nElementsVect+j*edges+6] = MeshIJKboundaries[1]*scale-limite X1[nElementsVect+j*edges+7] = MeshIJKboundaries[1]*scale-limite endif else begin X1[nElementsVect+j*edges+0] = xf(0, i)-limite X1[nElementsVect+j*edges+1] = xf(1, i)-limite X1[nElementsVect+j*edges+2] = xf(2, i)-limite X1[nElementsVect+j*edges+3] = xf(3, i)-limite X1[nElementsVect+j*edges+4] = xf(4, i)-limite X1[nElementsVect+j*edges+5] = xf(5, i)-limite X1[nElementsVect+j*edges+6] = xf(6, i)-limite X1[nElementsVect+j*edges+7] = xf(7, i)-limite endelse if flag eq 5 then begin Y1[nElementsVect+j*edges+0] = MeshIJKboundaries[2]*scale-limite Y1[nElementsVect+j*edges+1] = MeshIJKboundaries[2]*scale-limite Y1[nElementsVect+j*edges+2] = MeshIJKboundaries[2]*scale-limite Y1[nElementsVect+j*edges+3] = MeshIJKboundaries[2]*scale-limite Y1[nElementsVect+j*edges+4] = MeshIJKboundaries[2]*scale-limite Y1[nElementsVect+j*edges+5] = MeshIJKboundaries[2]*scale-limite Y1[nElementsVect+j*edges+6] = MeshIJKboundaries[2]*scale-limite Y1[nElementsVect+j*edges+7] = MeshIJKboundaries[2]*scale-limite endif else if flag eq 6 then begin Y1[nElementsVect+j*edges+0] = MeshIJKboundaries[3]*scale-limite Y1[nElementsVect+j*edges+1] = MeshIJKboundaries[3]*scale-limite Y1[nElementsVect+j*edges+2] = MeshIJKboundaries[3]*scale-limite Y1[nElementsVect+j*edges+3] = MeshIJKboundaries[3]*scale-limite Y1[nElementsVect+j*edges+4] = MeshIJKboundaries[3]*scale-limite Y1[nElementsVect+j*edges+5] = MeshIJKboundaries[3]*scale-limite Y1[nElementsVect+j*edges+6] = MeshIJKboundaries[3]*scale-limite Y1[nElementsVect+j*edges+7] = MeshIJKboundaries[3]*scale-limite endif else begin Y1[nElementsVect+j*edges+0] = yf(0, i)-limite Y1[nElementsVect+j*edges+1] = yf(1, i)-limite Y1[nElementsVect+j*edges+2] = yf(2, i)-limite Y1[nElementsVect+j*edges+3] = yf(3, i)-limite Y1[nElementsVect+j*edges+4] = yf(4, i)-limite Y1[nElementsVect+j*edges+5] = yf(5, i)-limite Y1[nElementsVect+j*edges+6] = yf(6, i)-limite Y1[nElementsVect+j*edges+7] = yf(7, i)-limite endelse if flag eq 1 then begin Z1[nElementsVect+j*edges+0] = MeshIJKboundaries[4]*scale-limite Z1[nElementsVect+j*edges+1] = MeshIJKboundaries[4]*scale-limite Z1[nElementsVect+j*edges+2] = MeshIJKboundaries[4]*scale-limite Z1[nElementsVect+j*edges+3] = MeshIJKboundaries[4]*scale-limite Z1[nElementsVect+j*edges+4] = MeshIJKboundaries[4]*scale-limite Z1[nElementsVect+j*edges+5] = MeshIJKboundaries[4]*scale-limite Z1[nElementsVect+j*edges+6] = MeshIJKboundaries[4]*scale-limite Z1[nElementsVect+j*edges+7] = MeshIJKboundaries[4]*scale-limite endif else if flag eq 2 then begin Z1[nElementsVect+j*edges+0] = MeshIJKboundaries[5]*scale-limite Z1[nElementsVect+j*edges+1] = MeshIJKboundaries[5]*scale-limite Z1[nElementsVect+j*edges+2] = MeshIJKboundaries[5]*scale-limite Z1[nElementsVect+j*edges+3] = MeshIJKboundaries[5]*scale-limite Z1[nElementsVect+j*edges+4] = MeshIJKboundaries[5]*scale-limite Z1[nElementsVect+j*edges+5] = MeshIJKboundaries[5]*scale-limite Z1[nElementsVect+j*edges+6] = MeshIJKboundaries[5]*scale-limite Z1[nElementsVect+j*edges+7] = MeshIJKboundaries[5]*scale-limite endif else begin Z1[nElementsVect+j*edges+0] = zf(0, i)-limite Z1[nElementsVect+j*edges+1] = zf(1, i)-limite Z1[nElementsVect+j*edges+2] = zf(2, i)-limite Z1[nElementsVect+j*edges+3] = zf(3, i)-limite Z1[nElementsVect+j*edges+4] = zf(4, i)-limite Z1[nElementsVect+j*edges+5] = zf(5, i)-limite Z1[nElementsVect+j*edges+6] = zf(6, i)-limite Z1[nElementsVect+j*edges+7] = zf(7, i)-limite endelse polyline[nElementsPoly+j*points+0] = 5 if flag le 2 then begin polyline[nElementsPoly+j*points+1] = 0+j*edges+nElementsVect polyline[nElementsPoly+j*points+2] = 1+j*edges+nElementsVect polyline[nElementsPoly+j*points+3] = 3+j*edges+nElementsVect polyline[nElementsPoly+j*points+4] = 2+j*edges+nElementsVect polyline[nElementsPoly+j*points+5] = 0+j*edges+nElementsVect endif else if flag eq 3 OR flag eq 4 then begin polyline[nElementsPoly+j*points+1] = 0+j*edges+nElementsVect polyline[nElementsPoly+j*points+2] = 2+j*edges+nElementsVect polyline[nElementsPoly+j*points+3] = 6+j*edges+nElementsVect polyline[nElementsPoly+j*points+4] = 4+j*edges+nElementsVect polyline[nElementsPoly+j*points+5] = 0+j*edges+nElementsVect endif else begin polyline[nElementsPoly+j*points+1] = 0+j*edges+nElementsVect polyline[nElementsPoly+j*points+2] = 1+j*edges+nElementsVect polyline[nElementsPoly+j*points+3] = 5+j*edges+nElementsVect polyline[nElementsPoly+j*points+4] = 4+j*edges+nElementsVect polyline[nElementsPoly+j*points+5] = 0+j*edges+nElementsVect endelse if flag eq 0 then begin polyline[nElementsPoly+j*points+6] = 2 polyline[nElementsPoly+j*points+7] = 0+j*edges+nElementsVect polyline[nElementsPoly+j*points+8] = 4+j*edges+nElementsVect polyline[nElementsPoly+j*points+9] = 2 polyline[nElementsPoly+j*points+10] = 1+j*edges+nElementsVect polyline[nElementsPoly+j*points+11] = 5+j*edges+nElementsVect polyline[nElementsPoly+j*points+12] = 2 polyline[nElementsPoly+j*points+13] = 3+j*edges+nElementsVect polyline[nElementsPoly+j*points+14] = 7+j*edges+nElementsVect polyline[nElementsPoly+j*points+15] = 2 polyline[nElementsPoly+j*points+16] = 2+j*edges+nElementsVect polyline[nElementsPoly+j*points+17] = 6+j*edges+nElementsVect polyline[nElementsPoly+j*points+18] = 5 polyline[nElementsPoly+j*points+19] = 4+j*edges+nElementsVect polyline[nElementsPoly+j*points+20] = 5+j*edges+nElementsVect polyline[nElementsPoly+j*points+21] = 7+j*edges+nElementsVect polyline[nElementsPoly+j*points+22] = 6+j*edges+nElementsVect polyline[nElementsPoly+j*points+23] = 4+j*edges+nElementsVect endif endfor nElementsVect = nElementsVect+edges*(nplot+1) nElementsPoly = nElementsPoly+points*(nplot+1) endif endif endfor if flag eq 0 then begin OBJ_DESTROY, polylines[ind_poly,ilevel-1] polylines[ind_poly,ilevel-1] = OBJ_NEW('IDLgrPolyline',X1,Y1,Z1,POLYLINE=polyline,color=color, hide=0) polylines[ind_poly,ilevel-1]->SetProperty, ALPHA_CHANNEL=alpha[ilevel-1]/100. oAmrModel3D->Add, polylines[ind_poly,ilevel-1] oAmrModel3D->SetProperty, hide=1-is3DModelDrawn endif else begin OBJ_DESTROY, polylinesPlanes[ind_poly,flag-1, ilevel-1] hide2D = 1-planesSelected[flag-1] polylinesPlanes[ind_poly,flag-1, ilevel-1] = OBJ_NEW('IDLgrPolyline',X1,Y1,Z1,POLYLINE=polyline,color=color, hide=hide2D) polylinesPlanes[ind_poly,flag-1, ilevel-1]->SetProperty, ALPHA_CHANNEL=alpha[ilevel-1]/100. oAmrModel2D->Add, polylinesPlanes[ind_poly,flag-1, ilevel-1] endelse endfor RamsesAmrLevelsFlags[ilevel-1] = 1 endfor X1 = 0 Y1 = 0 Z1 = 0 polyline = 0 END ; ;****************************************************************************** ; ; Update display of 3D objects : isosurface, volume, particles, streamlines ; ; MODIFICATION HISTORY: ; 2005-2006-2007-2008 : written by Daniel Pomarède ; 27 march 2008 : cleaning ; FUNCTION DrawTheVolume, sState ;print,'DrawTheVolume' debug=0;1 ;print,'Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' dum=1 result=sState.oData_flag->GetData(iflag_var) result=sState.oData_DataDimHDF->GetData(fourdim) bVectorField = fourdim[-iflag_var-1] eq 3 bParticles = fourdim[-iflag_var-1] eq 0 level=0 result=sState.oData_MemoryManagement->GetData(MemoryManagement) no_copy=MemoryManagement[0] if bParticles then begin result=sState.oData_AMRoctreePart->GetData(varData3D,NO_COPY=1) endif else begin result=sState.oData_HDFvar[-iflag_var-1,level]->GetData(varData3D,NO_COPY=1) endelse result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) ;print,'size(varData3D)=',size(varData3D,/N_DIMENSIONS) if size(varData3D,/N_DIMENSIONS) eq 0 then begin print,'3D data has been discarded' print,'please proceed to reload' return,dum endif sizevar=size(varData3D,/DIMENSIONS) result=sState.oData_GridDim->GetData(GridDim) result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) result=sState.oData_DataFormat->GetData(DataFormat) xrange=make_array([2]) yrange=make_array([2]) zrange=make_array([2]) IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) limitx1=MeshIJKboundaries[0]-0.5 limitx2=MeshIJKboundaries[1]-0.5 limity1=MeshIJKboundaries[2]-0.5 limity2=MeshIJKboundaries[3]-0.5 limitz1=MeshIJKboundaries[4]-0.5 limitz2=MeshIJKboundaries[5]-0.5 xrange[0]=MeshIJKboundaries[0];xyzmin xrange[1]=MeshIJKboundaries[1];xyzmax yrange[0]=MeshIJKboundaries[2];xyzmin yrange[1]=MeshIJKboundaries[3];xyzmax zrange[0]=MeshIJKboundaries[4];xyzmin zrange[1]=MeshIJKboundaries[5];xyzmax ENDIF ELSE BEGIN limitx1=-0.5 limitx2= 0.5 limity1=-0.5 limity2= 0.5 limitz1=-0.5 limitz2= 0.5 xrange[0]=-0.5;xyzmin xrange[1]= 0.5;xyzmax yrange[0]=-0.5;xyzmin yrange[1]= 0.5;xyzmax zrange[0]=-0.5;xyzmin zrange[1]= 0.5;xyzmax ENDELSE IF (DATAFormat eq 10) then begin result=sState.oData_GridSize->GetData(GridSize) xrange = GridSize[0:1] yrange = GridSize[2:3] zrange = GridSize[4:5] endif print, dataformat, gridsize, '!!!!!!!!!!!!!!!!!' scale= 0.6 if bParticles then begin s=intarr(3) xyzmin=0 xyzmax=1 s(*)=xyzmax xs = Normalize(xrange, Position=[limitx1,limitx2])*scale ys = Normalize(yrange, Position=[limity1,limity2])*scale zs = Normalize(zrange, Position=[limitz1,limitz2])*scale endif else begin eps=0.;0.95 WIDGET_CONTROL, sState.wBoundariesOptions[2], GET_VALUE=eps WIDGET_CONTROL, sState.wAxisOptions[3], GET_VALUE=units WIDGET_CONTROL, sState.wAxisOptions[1], GET_VALUE=span nxg=sState.GeoStructure.nxg nyg=sState.GeoStructure.nyg nzg=sState.GeoStructure.nzg nmax=max([nxg,nyg,nzg]) if span eq 0 then begin xrange[0]=0. -eps yrange[0]=0. -eps zrange[0]=0. -eps xrange[1]=nxg-1. +eps yrange[1]=nyg-1. +eps zrange[1]=nzg-1. +eps IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER result=sState.oData_MultiGridSize->GetData(MultiGridSize) level=0 xrange[1]=MultiGridSize(level,0)-1. yrange[1]=MultiGridSize(level,1)-1. zrange[1]=MultiGridSize(level,2)-1. ENDIF IF iflag_vue[0] EQ 5 AND bVectorField EQ 0 AND bParticles EQ 0 THEN BEGIN ;; this is needed for volume projection to avoid overfull boxes xrange[1]=xrange[1]+1. yrange[1]=yrange[1]+1. zrange[1]=zrange[1]+1. ENDIF xs = Normalize(xrange, Position=[limitx1,limitx2])*scale ys = Normalize(yrange, Position=[limity1,limity2])*scale zs = Normalize(zrange, Position=[limitz1,limitz2])*scale endif else if span eq 1 then begin xs=make_array([2]) ys=make_array([2]) zs=make_array([2]) start=-0.5*scale range= 1.0*scale if nxg eq nmax then begin D=(sState.GeoStructure.xmax-sState.GeoStructure.xmin) xs[0]= start xs[1]= range/(nxg-1) ys[0]= start + range*(sState.GeoStructure.ymin-sState.GeoStructure.xmin)/D ys[1]=(range/(nyg-1))*(sState.GeoStructure.ymax-sState.GeoStructure.ymin)/D zs[0]= start + range*(sState.GeoStructure.zmin-sState.GeoStructure.xmin)/D zs[1]=(range/(nzg-1))*(sState.GeoStructure.zmax-sState.GeoStructure.zmin)/D endif else if nyg eq nmax then begin ;; validated D=(sState.GeoStructure.ymax-sState.GeoStructure.ymin) xs[0]= start + range*(sState.GeoStructure.xmin-sState.GeoStructure.ymin)/D xs[1]=(range/(nxg-1))*(sState.GeoStructure.xmax-sState.GeoStructure.xmin)/D ys[0]= start ys[1]= range/(nyg-1) zs[0]= start + range*(sState.GeoStructure.zmin-sState.GeoStructure.ymin)/D zs[1]=(range/(nzg-1))*(sState.GeoStructure.zmax-sState.GeoStructure.zmin)/D endif else if nzg eq nmax then begin D=(sState.GeoStructure.zmax-sState.GeoStructure.zmin) xs[0]= start + range*(sState.GeoStructure.xmin-sState.GeoStructure.ymin)/D xs[1]=(range/(nxg-1))*(sState.GeoStructure.xmax-sState.GeoStructure.xmin)/D ys[0]= start + range*(sState.GeoStructure.ymin-sState.GeoStructure.zmin)/D ys[1]=(range/(nyg-1))*(sState.GeoStructure.ymax-sState.GeoStructure.ymin)/D zs[0]= start zs[1]= range/(nzg-1) end end endelse IF bParticles EQ 0 THEN BEGIN IF iflag_vue[0] EQ 5 AND bVectorField EQ 0 AND bParticles EQ 0 THEN BEGIN ;; special case for volume projection to avoid overfull boxes rebinexpansion=(1.*(GridDim[0:2]))/(sizevar[0:2]) ENDIF ELSE BEGIN rebinexpansion=(1.*(GridDim[0:2]-1))/(sizevar[0:2]-1) ENDELSE IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER rebinexpansion[*]=1. ENDIF ;print,'rebinexpansion=',rebinexpansion xs(1)=rebinexpansion[0]*xs(1) ys(1)=rebinexpansion[1]*ys(1) zs(1)=rebinexpansion[2]*zs(1) ENDIF result=sState.oData_ScalarLinLog->GetData(ScalarLinLog) IF bVectorField EQ 0 and bParticles EQ 0 THEN BEGIN IF ScalarLinLog EQ 1 THEN BEGIN if min(varData3D) le 0 then begin print,'DrawTheVolume: in log mode, min of data=',min(varData3D) print,'-> revert to lin mode' ScalarLinLog=0 result=sState.oData_ScalarLinLog->SetData(ScalarLinLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = ScalarLinLog endif END ENDIF ;;; Isosurface ; IF iflag_vue[0] EQ 4 AND bVectorField EQ 0 AND bParticles EQ 0 THEN BEGIN result=sState.oData_IsoPlot->GetData(IsoPlot) result=sState.oData_PolygonVarID->GetData(PolygonVarID) result=sState.oData_PolygonID->GetData(PolygonID) IF OBJ_VALID(sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]) EQ 0 $ THEN GOTO,SKIPUPDATE nrebin=220 nrebinx=nxg nrebiny=nyg nrebinz=nzg expandx=1. & expandy=1. & expandz=1. isoval=IsoPlot[PolygonID[PolygonVarID]] ;IsoPlot=-23.7 ;print,'isosurface forced IsoPlot=',IsoPlot IF ScalarLinLog EQ 1 THEN BEGIN SHADE_VOLUME,alog10(varData3D),isoval,vertices,polygons,/VERBOSE ENDIF ELSE BEGIN SHADE_VOLUME,varData3D,isoval,vertices,polygons,/VERBOSE ENDELSE rebinFlag=0 RESHADEVOLUME: dum=2 if rebinFlag eq 1 then begin IF ScalarLinLog EQ 1 THEN BEGIN SHADE_VOLUME,alog10(varData3Dtemp),isoval,vertices,polygons,/VERBOSE ENDIF ELSE BEGIN SHADE_VOLUME,varData3Dtemp,isoval,vertices,polygons,/VERBOSE ENDELSE endif svert=size(vertices) ;print,svert if svert(2) eq 0 then begin vertices=fltarr(3,3) polygons=-1L endif result=sState.oData_nmaxPolygons->GetData(nmaxPolygons) ;print,'SHADE_VOLUME svert=',svert ;print,'SHADE_VOLUME nmaxPolygons=',nmaxPolygons if svert(2) ge nmaxPolygons then begin method=WIDGET_INFO(sState.wIsosurfaceOptions[3],/DROPLIST_SELECT) ;method=1 print,'method=',method if method eq 0 then begin print,'# of polygons=',svert(2),' is too large -> rerun SHADE_VOLUME' nrebin=nrebin-20 nrebinx=nrebinx*0.8 nrebiny=nrebiny*0.8 nrebinz=nrebinz*0.8 print,'with rebin data using CONGRID, nrebinx,nrebiny,nrebinz=',nrebinx,nrebiny,nrebinz ;varData3Dtemp=CONGRID(varData3D,nrebin,nrebin,nrebin) varData3Dtemp=CONGRID(varData3D,nrebinx,nrebiny,nrebinz) s=size(varData3D) if nrebin gt 0 then begin expandx=(1.*(s(1)-1))/(nrebinx-1) expandy=(1.*(s(2)-1))/(nrebiny-1) expandz=(1.*(s(3)-1))/(nrebinz-1) rebinFlag=1 GOTO, RESHADEVOLUME endif endif if method eq 1 then begin percent_vertices=100.*nmaxPolygons/svert(2) print,'percent_vertices=',percent_vertices nb_triangles=MESH_DECIMATE(vertices,polygons,decimated_polygons,VERTICES=decimated_vertices,PERCENT_VERTICES=percent_vertices) help,decimated_polygons help,decimated_vertices polygons=decimated_polygons vertices=decimated_vertices endif endif xs(1)=expandx*xs(1) ys(1)=expandy*ys(1) zs(1)=expandz*zs(1) sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty,$ Data=vertices,$ Polygons=polygons sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, $ XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs END ;;; Volume Projection ; IF iflag_vue[0] EQ 5 AND bVectorField EQ 0 AND bParticles EQ 0 THEN BEGIN result=sState.oData_oVolume->GetData(oVolume) IF OBJ_VALID(oVolume[MovieFrameCURRENT]) EQ 0 THEN GOTO,SKIPUPDATE if no_copy eq 1 then begin ; data are byte-scaled if DataFormat ne 4 then BEGIN IF ScalarLinLog EQ 1 THEN begin oVolume[MovieFrameCURRENT]->SetProperty,DATA0=bytscl(alog10(TEMPORARY(varData3D))) ENDIF ELSE BEGIN oVolume[MovieFrameCURRENT]->SetProperty,DATA0=bytscl(TEMPORARY(varData3D)) ENDELSE ; ASH-bob already byte-scaled ENDIF ELSE BEGIN IF ScalarLinLog EQ 1 THEN begin oVolume[MovieFrameCURRENT]->SetProperty,DATA0=alog10(TEMPORARY(varData3D)) ENDIF ELSE BEGIN oVolume[MovieFrameCURRENT]->SetProperty,DATA0=TEMPORARY(varData3D) ENDELSE ENDELSE endif else begin ; data are byte-scaled if DataFormat ne 4 then BEGIN IF ScalarLinLog EQ 1 THEN begin oVolume[MovieFrameCURRENT]->SetProperty,DATA0=bytscl(alog10(varData3D)) ENDIF ELSE BEGIN oVolume[MovieFrameCURRENT]->SetProperty,DATA0=bytscl(varData3D) ENDELSE ; ASH-bob already byte-scaled ENDIF ELSE BEGIN IF ScalarLinLog EQ 1 THEN begin oVolume[MovieFrameCURRENT]->SetProperty,DATA0=alog10(varData3D) ENDIF ELSE BEGIN oVolume[MovieFrameCURRENT]->SetProperty,DATA0=varData3D ;print,'min(varData3D)=',min(varData3D) ;print,'max(varData3D)=',max(varData3D) ENDELSE ENDELSE endelse oVolume[MovieFrameCURRENT]->SetProperty,XCoord_Conv=xs,YCoord_Conv=ys,ZCoord_Conv=zs IF ( DataFormat NE 5 ) THEN BEGIN ;;; NOT JUPITER ;if rebinexpansion[0] ne 1. or rebinexpansion[1] ne 1. or rebinexpansion[2] ne 1. then begin ;oVolume->GetProperty,DATA0=dum,/NO_COPY ;help,dum dum=0 bounds=fltarr(6) bounds[0]=0 bounds[1]=0 bounds[2]=0 bounds[3]=sizevar[0]-1 bounds[4]=sizevar[1]-1 bounds[5]=sizevar[2]-1 oVolume[MovieFrameCURRENT]->SetProperty,bounds=bounds ;print,'test bounds ', bounds ;endif ENDIF ;result=sState.oData_oVolume->SetData(oVolume) END IF bParticles EQ 0 THEN BEGIN IF ( DataFormat NE 5 ) THEN BEGIN ;;; NOT JUPITER rebinexpansion_x=(1.*(GridDim[0]-1.))/(sizevar[0]-1.) rebinexpansion_y=(1.*(GridDim[1]-1.))/(sizevar[1]-1.) rebinexpansion_z=(1.*(GridDim[2]-1.))/(sizevar[2]-1.) ENDIF ELSE BEGIN rebinexpansion_x=1. rebinexpansion_y=1. rebinexpansion_z=1. END ENDIF ;;; Vector Field : Hedgehog and Streamlines display ; IF iflag_vue[1] GE 1 AND bVectorField EQ 1 THEN BEGIN SliceVecVs3DVec=WIDGET_INFO(sState.wSliceVecVs3DVec,/DROPLIST_SELECT ) result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) IF SliceVecVs3DVec EQ 0 THEN BEGIN rangex=VectorFieldConfig(0,2)-VectorFieldConfig(0,1) if VectorFieldConfig(0,0) eq 1 then begin stepx=0 endif else begin stepx=1.*rangex/(VectorFieldConfig(0,0)-1.)/rebinexpansion_x endelse nvertx=VectorFieldConfig(0,0)*1L iminx=VectorFieldConfig(0,1)/rebinexpansion_x ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rangey=VectorFieldConfig(1,2)-VectorFieldConfig(1,1) if VectorFieldConfig(1,0) eq 1 then begin stepy=0 endif else begin stepy=1.*rangey/(VectorFieldConfig(1,0)-1.)/rebinexpansion_y endelse nverty=VectorFieldConfig(1,0)*1L iminy=VectorFieldConfig(1,1)/rebinexpansion_y ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rangez=VectorFieldConfig(2,2)-VectorFieldConfig(2,1) if VectorFieldConfig(2,0) eq 1 then begin stepz=0 endif else begin stepz=1.*rangez/(VectorFieldConfig(2,0)-1.)/rebinexpansion_z endelse nvertz=VectorFieldConfig(2,0)*1L iminz=VectorFieldConfig(2,1)/rebinexpansion_z nvertices=nvertx*nverty*nvertz ;print,'nvertices=',nvertices if nvertices le 0 then begin print,'in DrawTheVolume, nvertices=',nvertices print,'EXIT' result=sState.oData_HDFvar[-iflag_var-1,level]->SetData(TEMPORARY(varData3D)) RETURN, dum endif ;print,' stepx=',stepx,' nvertx=',nvertx,' iminx=',iminx xypos=make_array(3,nvertices) count=0L for i=0,nvertx-1 do begin for j=0,nverty-1 do begin for k=0,nvertz-1 do begin xypos(0,count)=iminx+i*stepx xypos(1,count)=iminy+j*stepy xypos(2,count)=iminz+k*stepz ;if i le 1 and j le 1 and k le 1 then print,'xypos =',xypos ;if i eq nvertx-1 then xypos(0,count)=xypos(0,count) - 1 ;if j eq nverty-1 then xypos(1,count)=xypos(1,count) - 1 ;if k eq nvertz-1 then xypos(1,count)=xypos(1,count) - 1 ;if xypos(0,count) ge imaxx then xypos(0,count)=imaxx ;if xypos(1,count) ge imaxy then xypos(1,count)=imaxy ;if xypos(2,count) ge imaxz then xypos(1,count)=imaxz count=count+1L ;if count gt (nvertices-1) then print,'in DRAWTHEVOLUME count=',count endfor endfor endfor ENDIF ELSE IF SliceVecVs3DVec EQ 1 THEN BEGIN result=sState.oData_xyzplane->GetData(xyzplane) result=sState.oData_xpos2DSlicePosition->GetData(xpos2DSlicePosition) slicePosition=xpos2DSlicePosition[0] ; slice xy at z fixed ;rebinexpansion_x=(1.*(GridDim[0]-1.))/(sizevar[0]-1.) ;rebinexpansion_y=(1.*(GridDim[1]-1.))/(sizevar[1]-1.) ;rebinexpansion_z=(1.*(GridDim[2]-1.))/(sizevar[1]-1.) if xyzplane eq 1 then begin rangex=VectorFieldConfig(0,2)-VectorFieldConfig(0,1) ; + 1. if VectorFieldConfig(0,0) eq 1 then begin stepx=0 endif else begin stepx=1.*rangex/(VectorFieldConfig(0,0)-1)/rebinexpansion_x endelse nvertx=VectorFieldConfig(0,0) iminx=VectorFieldConfig(0,1)/rebinexpansion_x ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rangey=VectorFieldConfig(1,2)-VectorFieldConfig(1,1) ;+ 1. if VectorFieldConfig(1,0) eq 1 then begin stepy=0 endif else begin stepy=1.*rangey/(VectorFieldConfig(1,0)-1)/rebinexpansion_y endelse nverty=VectorFieldConfig(1,0) iminy=VectorFieldConfig(1,1)/rebinexpansion_y ; slice xz at y fixed endif else if xyzplane eq 2 then begin rangex=VectorFieldConfig(0,2)-VectorFieldConfig(0,1) ;+ 1. if VectorFieldConfig(0,0) eq 1 then begin stepx=0 endif else begin stepx=1.*rangex/(VectorFieldConfig(0,0)-1)/rebinexpansion_x endelse nvertx=VectorFieldConfig(0,0) iminx=VectorFieldConfig(0,1)/rebinexpansion_x ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rangey=VectorFieldConfig(2,2)-VectorFieldConfig(2,1) ; + 1. if VectorFieldConfig(2,0) eq 1 then begin stepy=0 endif else begin stepy=1.*rangey/(VectorFieldConfig(2,0)-1)/rebinexpansion_z endelse nverty=VectorFieldConfig(2,0) iminy=VectorFieldConfig(2,1)/rebinexpansion_z ; slice yz at x fixed endif else if xyzplane eq 3 then begin rangex=VectorFieldConfig(1,2)-VectorFieldConfig(1,1) ; + 1. if VectorFieldConfig(1,0) eq 1 then begin stepx=0 endif else begin stepx=1.*rangex/(VectorFieldConfig(1,0)-1)/rebinexpansion_y endelse nvertx=VectorFieldConfig(1,0) iminx=VectorFieldConfig(1,1)/rebinexpansion_y ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rangey=VectorFieldConfig(2,2)-VectorFieldConfig(2,1) ; + 1. if VectorFieldConfig(2,0) eq 1 then begin stepy=0 endif else begin stepy=1.*rangey/(VectorFieldConfig(2,0)-1)/rebinexpansion_z endelse nverty=VectorFieldConfig(2,0) iminy=VectorFieldConfig(2,1)/rebinexpansion_z end ;print,'rangex=',rangex,' stepx=',stepx,' nvertx=',nvertx,' iminx=',iminx ;print,'rangey=',rangey,' stepy=',stepy,' nverty=',nverty,' iminy=',iminy nvertices=nvertx*nverty ;print,'nvertices=',nvertices xypos=make_array(3,nvertices) count=0 for i=0,nvertx-1 do begin for j=0,nverty-1 do begin if xyzplane eq 1 then begin xypos(0,count)=iminx+i*stepx xypos(1,count)=iminy+j*stepy xypos(2,count)=slicePosition/rebinexpansion_z endif else if xyzplane eq 2 then begin xypos(0,count)=iminx+i*stepx xypos(1,count)=slicePosition/rebinexpansion_y xypos(2,count)=iminy+j*stepy endif else if xyzplane eq 3 then begin xypos(0,count)=slicePosition/rebinexpansion_x xypos(1,count)=iminx+i*stepx xypos(2,count)=iminy+j*stepy end ;if i eq nvertx-1 then xypos(0,count)=xypos(0,count) - 1 ;if j eq nverty-1 then xypos(1,count)=xypos(1,count) - 1 ;print,i,j,xypos(0,count),xypos(1,count) count=count+1 endfor endfor ;print,'xypos=',xypos ;help, varData3D ;print,'outverts=',outverts ;print,'outconn=',outconn ENDIF ELSE IF SliceVecVs3DVec EQ 2 THEN BEGIN ; pick vertices ;nvertices=1 ;xypos=make_array(3,nvertices) ;count=0 ;WIDGET_CONTROL,sState.wSeedPick[0],GET_VALUE=x ;WIDGET_CONTROL,sState.wSeedPick[1],GET_VALUE=y ;WIDGET_CONTROL,sState.wSeedPick[2],GET_VALUE=z ;xypos(0,count)=x ;xypos(1,count)=y ;xypos(2,count)=z result=sState.oData_SeedPickUp->GetData(xypos) ;help,xypos s=size(xypos) if s[0] eq 0 then begin result=sState.oData_HDFvar[-iflag_var-1,level]->SetData(TEMPORARY(varData3D)) return,dum endif ; nvertices=s[0] ; xypos=make_array(3,nvertices) ; count=0 ; for ; WIDGET_CONTROL,sState.wSeedPick[0],GET_VALUE=x ; WIDGET_CONTROL,sState.wSeedPick[1],GET_VALUE=y ; WIDGET_CONTROL,sState.wSeedPick[2],GET_VALUE=z ; xypos(0,count)=x ; xypos(1,count)=y ; xypos(2,count)=z ; endfor ; endif xypos(0,*)=xypos(0,*)/rebinexpansion_x xypos(1,*)=xypos(1,*)/rebinexpansion_y xypos(2,*)=xypos(2,*)/rebinexpansion_z END result=sState.oData_VectorFieldScale->GetData(VectorFieldScale) IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER result=sState.oData_MultiGridSize->GetData(MultiGridSize) level=0 xypos(0,*)=xypos(0,*)*1.*(MultiGridSize(level,0)-1.)/(nxg-1.) xypos(1,*)=xypos(1,*)*1.*(MultiGridSize(level,1)-1.)/(nyg-1.) xypos(2,*)=xypos(2,*)*1.*(MultiGridSize(level,2)-1.)/(nzg-1.) ;print,xypos(0,*) ENDIF IF iflag_vue[1] EQ 1 THEN BEGIN ;print,'VECTOR_FIELD 3D' ;help,varData3D sdata=size(varData3D) ;print,'size varData3D=',sdata if sdata(1) gt 1300 then begin print,'# of mesh=',sdata(1),' is too large -> rebin before run VECTOR_FIELD' if sdata(1) lt 600 then nrebin=sdata(1)/2 if sdata(1) ge 600 and sdata(1) lt 1200 then nrebin=sdata(1)/4 if sdata(1) ge 1200 and sdata(1) lt 2000 then nrebin=sdata(1)/8 print,'with rebin data using REBIN, nrebin=',nrebin varData3D=REBIN(varData3D,nrebin,nrebin,nrebin,3) expand=(1.*sdata(1))/nrebin endif VECTOR_FIELD,transpose(varData3D,[3,0,1,2]), $ outverts,outconn,vertices=xypos,scale=VectorFieldScale maxDim = MAX(outverts[0,*]) > MAX(outverts[1,*]) > MAX(outverts[2,*]) ;print,'MAX(outverts[0,*])=',MAX(outverts[0,*]) ;print,'MAX(outverts[1,*])=',MAX(outverts[1,*]) ;print,'MAX(outverts[2,*])=',MAX(outverts[2,*]) ;print,'maxDim=',maxDim ;print,'GridDim=',GridDim SymDim=GridDim(0:2)*0.01 IF ( DataFormat EQ 5 ) THEN BEGIN ;;; JUPITER result=sState.oData_MultiGridSize->GetData(MultiGridSize) level=0 SymDim(0)=SymDim(0)*1.*MultiGridSize(level,0)/nxg SymDim(1)=SymDim(1)*1.*MultiGridSize(level,1)/nyg SymDim(2)=SymDim(2)*1.*MultiGridSize(level,2)/nzg ENDIF if SymDim(0) ne SymDim(1) then begin SymDim(0)=SymDim(0)*5. SymDim(1)=SymDim(1)/2. SymDim(2)=SymDim(2)*2. endif oSymbol = makeArrowHeadSymbol(SIZE=SymDim) nPolys = countPolys(outconn) lblPolys = LINDGEN(nPolys) oLblSymbols = REPLICATE(oSymbol, nPolys) lblOffsets = REPLICATE(1.0, nPolys) ;help,outverts,outconn sState.oVectorField->SetProperty,LABEL_OBJECTS=oLblSymbols, $ LABEL_POLYLINES=lblPolys, $ LABEL_OFFSETS=lblOffsets, $ /LABEL_USE_VERTEX_COLOR, $ /LABEL_NOGAPS, $ POLYLINES=outconn, $ Data=outverts sState.oVectorField->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs END ; Particle traces ; IF iflag_vue[1] EQ 2 THEN BEGIN ;print,'PARTICLE_TRACE' ;WIDGET_CONTROL,sState.wStreamlinesOptions[1],GET_VALUE=maxIterations ;maxIterations=WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) result=sState.oData_StreamlinesMaxIter->GetData(maxIterations) WIDGET_CONTROL,sState.wStreamlinesOptions[2],GET_VALUE=maxStepSize integration=WIDGET_INFO(sState.wStreamlinesOptions[3],/DROPLIST_SELECT ) WIDGET_CONTROL, sState.wStreamlinesOptions[4], GET_VALUE=uniform outconn2=lonarr([1]) & outconn2[0] = -1l ;print,'PARTICLE_TRACE uniform=',uniform ;help,varData3D PARTICLE_TRACE,transpose(varData3D*VectorFieldScale,[3,0,1,2]),xypos,outverts2,outconn2, $ MAX_ITERATIONS=maxIterations, MAX_STEPSIZE=maxStepSize, $ INTEGRATION=integration,ANISOTROPY=[1,1,1], SEED_NORMAL=[0, 0, 1], $ UNIFORM=uniform if (outconn2[0] eq -1l) then print, 'No particle trace.' sState.oStreamlines->SetProperty,POLYLINES=outconn2,Data=outverts2 sState.oStreamlines->SetProperty, XCoord_Conv=xs sState.oStreamlines->SetProperty, YCoord_Conv=ys sState.oStreamlines->SetProperty, ZCoord_Conv=zs END END ;;; Particle cloud ; IF iflag_vue[2] EQ 1 AND bParticles EQ 1 THEN BEGIN discard_particles=MemoryManagement[2] print,'discard_particles=',discard_particles ;help,varData3D,/struct ;print,'Step 1 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' IF (DATAFormat eq 10) then begin result=sState.oData_GridSize->GetData(GridSize) if max(gridsize eq 0.) then gridsize=[0,1,0,1,0,1] xrange = GridSize[0:1] yrange = GridSize[2:3] zrange = GridSize[4:5] ; xs = [xrange[0], xrange[1]-xrange[0]] ; ys = [yrange[0], yrange[1]-yrange[0]] ; zs = [zrange[0], zrange[1]-zrange[0]] endif print, dataformat, gridsize, '!!!!!!!!!!!!!!!!!' if (dataformat ne 3) then begin meshijkboundaries = fltarr(6) MeshIJKboundaries[0:1] = xrange[*] MeshIJKboundaries[2:3] = yrange[*] MeshIJKboundaries[4:5] = zrange[*] endif fullvolFlag = MeshIJKboundaries[0] eq 0. and MeshIJKboundaries[1] eq 1. and $ MeshIJKboundaries[2] eq 0. and MeshIJKboundaries[3] eq 1. and $ MeshIJKboundaries[4] eq 0. and MeshIJKboundaries[5] eq 1. if fullvolFlag then begin count=varData3D.npart ;index_array=lindgen(count) endif else begin index_array=where( varData3D.xp(0,*) ge MeshIJKboundaries[0] and varData3D.xp(0,*) le MeshIJKboundaries[1] and $ varData3D.xp(1,*) ge MeshIJKboundaries[2] and varData3D.xp(1,*) le MeshIJKboundaries[3] and $ varData3D.xp(2,*) ge MeshIJKboundaries[4] and varData3D.xp(2,*) le MeshIJKboundaries[5] , count ) print,'number of particles in the sub-volume=',count print, meshijkboundaries for i=0,2 do print, min(vardata3d.xp[i,*]), max(vardata3d.xp[i,*]) endelse if count le 0 then begin print,'number of particles in volume = 0' print,'update skipped' ;result=sState.oData_HDFvar[-iflag_var-1,level]->SetData(TEMPORARY(varData3D)) result=sState.oData_AMRoctreePart->SetData(varData3D,NO_COPY=1) return,dum endif ;print,'Step 2 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' result=sState.oData_ParticlesSampling->GetData(sample) result=sState.oData_DMDensityPlot->GetData(xdata) result=sState.oData_RamsesFillArrays->GetData(RamsesFillArrays) ReadParticlesVELDEN = RamsesFillArrays[8] EQ 1 dv=WIDGET_INFO(sState.wParticlesDensVel,/DROPLIST_SELECT ) linlogx=WIDGET_INFO(sState.wParticlesLinLogX,/DROPLIST_SELECT ) if ReadParticlesVELDEN then begin if fullvolFlag then index_array=lindgen(count) subdata_xp=varData3D.xp(*,index_array) if dv eq 1 then begin v=varData3D.vp data=( v(index_array,0)^2 + v(index_array,1)^2 + v(index_array,2)^2 )^0.5 endif else if dv eq 0 then begin data=varData3D.dp(index_array) end ;print,'linlogx=',linlogx if linlogx eq 0 then data=alog10(data) count_vol=count condition_data_index=where(data ge xdata[0] and data le xdata[1] ,count) print,'# of particles in the sample=',count,' (',100.*count/count_vol,'%)' if count gt 0 then begin particlesVertex=subdata_xp(*,condition_data_index) particlesVertex=particlesVertex(*,0:count-1:sample) data_reduced=data(condition_data_index) data_reduced=data_reduced(0:count-1:sample) ;indexSorted=reverse(sort(data_reduced)) indexSorted=sort(data_reduced) ; <-- good data_reduced=data_reduced(indexSorted) particlesVertex=particlesVertex(*,indexSorted) endif sState.oParticles[0]->SetProperty, DATA=particlesVertex ;TEMPORARY(particlesVertex) endif else begin if fullvolFlag then begin print,'Step 3a Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' help,varData3D,/struct if sample eq 1 then begin plimit=700000000L; 1000000L if count le plimit then begin sState.oParticles[0]->SetProperty, DATA=varData3D.xp endif else begin print,'particle object max limit reached =» switch to secondary object' sState.oParticles[0]->SetProperty, DATA=varData3D.xp[*,0:plimit-1] print,'Step 3b Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' sState.oParticles[1]->SetProperty, DATA=varData3D.xp[*,plimit:count-1] endelse endif else begin sState.oParticles[0]->SetProperty, DATA=varData3D.xp[*,0:count-1:sample] endelse print,'Step 3c Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' if discard_particles then varData3D=0 print,'Step 3d Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' endif else begin help,index_array subdata_xp=varData3D.xp(*,index_array) help,subdata_xp index_array=0 sz = size(subdata_xp(0,*)) print,'sz=',sz nPolys = sz(2) & print,'nPolys=',nPolys pmax=nPolys-1 print,'pmax,sample=',pmax,sample particlesVertex=subdata_xp(*,0:pmax:sample) help,particlesVertex sState.oParticles[0]->SetProperty, DATA=particlesVertex ;TEMPORARY(particlesVertex) endelse end print,'Step 4 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' if ReadParticlesVELDEN then begin ctid=WIDGET_INFO(sState.wParticlesColorTable,/DROPLIST_SELECT ) ;print,'color section, ctid=',ctid if ctid gt 0 then begin ;help,t s=size(particlesVertex) ;print,'s=',s nc=s[2]*1L ;print,'nc=',nc dmax=max(data_reduced) dmin=min(data_reduced) ;print,'dmin,dmax=',dmin,dmax vc=make_array(4,nc) colorlist=intarr(nc) ;colorlist=fix(255*(data_reduced[*]-dmin)/(dmax-dmin)) colorlist=bytscl(data_reduced,min=dmin,max=dmax) ;help,colorlist ;print,'min,max (colorlist)=',min(colorlist),max(colorlist) ;plot,colorlist WIDGET_CONTROL, sState.wParticlesOptions[0], GET_VALUE=ParticlesAlpha if ctid eq 1 then begin result=sState.oData_vColors->GetData(vColors) result=sState.oData_VolumeOpacity->GetData(Opac) for i=0L,nc-1L do begin vc[0,i]=vColors[colorlist[i],0] vc[1,i]=vColors[colorlist[i],1] vc[2,i]=vColors[colorlist[i],2] vc[3,i]= Opac[colorlist[i]] endfor endif else if ctid eq 2 then begin vc[0,*]=colorlist(*) vc[1,*]=colorlist(*) vc[2,*]=255 vc[3,*]=255*ParticlesAlpha/100. endif else if ctid eq 3 then begin vc[0,*]=255-colorlist(*) vc[1,*]=255-colorlist(*) vc[2,*]=255 vc[3,*]=255*ParticlesAlpha/100. endif else if ctid eq 4 then begin vc[0,*]=255 vc[1,*]=colorlist(*) vc[2,*]=colorlist(*) vc[3,*]=255*ParticlesAlpha/100. endif else if ctid eq 5 then begin vc[0,*]=255 vc[1,*]=255-colorlist(*) vc[2,*]=255-colorlist(*) vc[3,*]=255*ParticlesAlpha/100. endif else if ctid eq 6 then begin vc[0,*]=colorlist(*) vc[1,*]=colorlist(*) vc[2,*]=colorlist(*) vc[3,*]=255*ParticlesAlpha/100. endif else if ctid eq 7 then begin vc[0,*]=255-colorlist(*) vc[1,*]=255-colorlist(*) vc[2,*]=255-colorlist(*) vc[3,*]=255*ParticlesAlpha/100. end ; ctid ; print,'alpha min,max=',min(vc[3,*]),max(vc[3,*]) sState.oParticles[0]->SetProperty,VERT_COLORS=vc ;sState.oParticles->SetProperty,VERT_COLORS=colorlist ;print,'--->>> plots !!' ;plots,particlesVertex(0,*),particlesVertex(1,*),particlesVertex(2,*), $ ; /t3d,color=colorlist,psym=3 endif ; ctid gt 0 endif ;ReadParticlesVELDEN sState.oParticles[0]->SetProperty, XCoord_Conv=xs,YCoord_Conv=ys,ZCoord_Conv=zs sState.oParticles[1]->SetProperty, XCoord_Conv=xs,YCoord_Conv=ys,ZCoord_Conv=zs END SKIPUPDATE: ;;; possibly, discard the 3D table ; ;print,'part test 5 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' if no_copy eq 1 then varData3D=0 if bParticles then begin result=sState.oData_AMRoctreePart->SetData(TEMPORARY(varData3D)) endif else begin result=sState.oData_HDFvar[-iflag_var-1,level]->SetData(TEMPORARY(varData3D)) endelse ;print,'part test 6 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' if debug then print,'exit DrawTheVolume' RETURN, dum END ;------------------------------------------------------------------------- FUNCTION UpdateTheViews, sState, Draw ;print,'UpdateTheViews' ;print,'Draw=',Draw result=sState.oData_GridDim->GetData(GridDim) nz=GridDim(2)*1L ;print,'UpdateTheViews GridDim=',GridDim ;print,'UpdateTheViews sState.GeoStructure.nxg=',sState.GeoStructure.nxg dum=1 result=sState.oData_vue->GetData(iflag_vue) if iflag_vue[3] NE 0 and nz ne 1 then begin dum=DrawTheGeometry(sState) if Draw eq 1 then SDvis_Draw, sState return,dum endif result=sState.oData_flag->GetData(iflag_var) if iflag_var EQ 0 then return,dum result=sState.oData_DataFormat->GetData(DataFormat) result=sState.oData_datanames->GetData(datanames) result=sState.oData_DataDimHDF->GetData(fourdim) result=sState.oData_RamsesFillArrays->GetData(RamsesFillArrays) ReadParticlesVELDEN = RamsesFillArrays[8] EQ 1 bVectorField3D = fourdim[-iflag_var-1] eq 3 and nz gt 1 bVectorField2D = (fourdim[-iflag_var-1] eq 2 and nz eq 1) or ( iflag_vue[1] GE 3 and bVectorField3D) bParticles = fourdim[-iflag_var-1] eq 0 bGeometry = iflag_var eq 16 if result eq 0 then begin print,'result=',result print,'select a quantity to be displayed (density,...)' return,dum endif ; iflag_vue[0] ; Vue Type 1 : Surface+Image+Plot ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; if iflag_vue[0] EQ 1 AND ~bVectorField3D AND ~bParticles AND ~bGeometry AND ~bVectorField2D then begin dum=StoreData2DForDisplay(sState) dum=DrawTheSurface(sState) dum=DrawTheImage(sState) dum=DrawThePlot(sState) end if bVectorField2D then begin dum=StoreData2DForDisplay(sState) dum=DrawThe2DVectorField(sState) end ;;; iflag_vue[0] -> Scalar Field ; Vue Type 2 : Project Volume (obsolete) ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Vue Type 3 : Voxel Project (obsolete) ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Vue Type 4 : Isosurface Polygons ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Vue Type 5 : Volume Object ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Vue Type 6 : Image 3D ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;;; iflag_vue[1] -> Vector Field ; Vue Type 1 : Vector field ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Vue Type 2 : Particle traces ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;;; iflag_vue[2] -> Particle Cloud ; Vue Type 1 : Particles ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;;; iflag_vue[3] -> Geometry ; Vue Type 1 : Bounds ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Vue Type 2 : Axis ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Vue Type 3 : Domains ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; if bVectorField3D then begin if iflag_vue[1] EQ 1 OR iflag_vue[1] EQ 2 then dum=DrawTheVolume(sState) endif else if bParticles then begin if iflag_vue[2] EQ 1 then begin dum=DrawTheVolume(sState) if ReadParticlesVELDEN then dum=DrawTheDarkMatterdensity(sState) endif endif else if bGeometry then begin if iflag_vue[3] EQ 1 then dum=DrawTheVolume(sState) endif else begin if iflag_vue[0] GE 2 then dum=DrawTheVolume(sState) ;if iflag_vue[0] EQ 4 then dum=DrawTheIsoPlot(sState) if iflag_vue[0] EQ 6 then begin dum=StoreData2DForDisplay(sState) dum=DrawTheImage(sState) endif endelse if Draw eq 1 then begin ;print,'call SDvis_Draw from UpdateTheViews' SDvis_Draw, sState endif ;print,'exit UpdateTheViews' RETURN, dum END ;****************************************************************************** ;;--------------------------------------------------------------------------------------- ; Create custom timer behavior object. ; Initialize class. FUNCTION timer_observer::init self.inc = 1 RETURN, 1 END ; Obligatory cleanup. PRO timer_observer::cleanup END ; OnTimer handles notifications that a timer even has occurred ; in the window. Updates currentImage with the increment amount. ; The nImages variable is based on the number of image frames. ; The ACTIVE_POSITION defines the zero-based index number of the ; model container item to be drawn PRO timer_observer::OnTimer, oWin nImages = self.oImages->Count() self.currentImage += self.inc print,'self.PlayOnce=',self.PlayOnce,' self.currentImage=',self.currentImage IF self.currentImage GE nImages AND self.PlayOnce EQ 1 THEN BEGIN print,'stop' oWin->SetEventMask, TIMER_EVENTS=0 self.currentImage = 0 ;self.oImages->SetProperty, ACTIVE_POSITION=0 RETURN ENDIF IF self.currentImage GE nImages THEN self.currentImage = 0 IF self.currentImage LT 0 THEN self.currentImage = nImages-1 self.oImages->SetProperty, ACTIVE_POSITION=self.currentImage ;print,'self.currentImage=',self.currentImage ; IF self.currentImage GE nImages THEN BEGIN ; print,'stop' ; oWin->SetEventMask, TIMER_EVENTS=0 ; RETURN ; ENDIF ; Draw the model containing proper frame in the window. oWin->Draw ;print,'timer_observer draw' ;print,'mpeg valid=',OBJ_VALID(self.oMpeg) IF OBJ_VALID(self.oMpeg) EQ 1 THEN BEGIN snapshot=oWin->Read() self.oMpeg->Put, snapshot print,'self.oMpeg->Put, snapshot' ENDIF END ; Object SetProperty method. OIMAGES is the animation model contents PRO timer_observer::SetProperty, $ CURRENT_IMAGE = currentImage, $ INCREMENT = inc, $ OIMAGES = oImages, $ OMPEG = oMpeg, $ PLAYONCE = PlayOnce ;print,'timer_observer::SetProperty' ;help,oMpeg ;print,'N_ELEMENTS(oMpeg)=',N_ELEMENTS(oMpeg) IF N_ELEMENTS(currentImage) GT 0 THEN $ self.currentImage = currentImage IF N_ELEMENTS(inc) GT 0 THEN $ self.inc = inc IF N_ELEMENTS(oImages) GT 0 THEN $ self.oImages = oImages IF N_ELEMENTS(oMpeg) GT 0 THEN $ self.oMpeg = oMpeg IF N_ELEMENTS(PlayOnce) GT 0 THEN $ self.PlayOnce = PlayOnce END ; Object GetProperty method. PRO timer_observer::GetProperty, $ CURRENT_IMAGE = currentImage, $ INCREMENT = inc, $ OIMAGES = oImages, $ OMPEG = oMpeg IF ARG_PRESENT(currentImage) THEN $ currentImage = self.currentImage IF ARG_PRESENT(inc) THEN $ inc = self.inc IF ARG_PRESENT(oMpeg) THEN $ oMpeg = self.oMpeg IF ARG_PRESENT(PlayOnce) THEN $ PlayOnce = self.PlayOnce END ; Define timer_observer instance data. PRO timer_observer__define struct = { timer_observer, $ currentImage: 0L, $ inc: 0L, $ oImages: OBJ_NEW(), $ wFrameIndicator: 0L, $ timerImages: 0L, $ oMpeg: OBJ_NEW(), $ PlayOnce: 0L $ } end ;------------------------------------------------------------------------- ; ----------------------------------------------------------------------------- ; ; Purpose: Function returns the 3 angles of a space three 1-2-3 ; given a 3 x 3 cosine direction matrix ; else -1 on failure. ; ; Definition : Given 2 sets of dextral orthogonal unit vectors ; (a1, a2, a3) and (b1, b2, b3), the cosine direction matrix ; C (3 x 3) is defined as the dot product of: ; ; C(i,j) = ai . bi where i = 1,2,3 ; ; A column vector X (3 x 1) becomes X' (3 x 1) ; after the rotation as defined as : ; ; X' = C X ; ; The space three 1-2-3 means that the x rotation is first, ; followed by the y rotation, then the z. ; function angle3123, $ cosMat ; IN: cosine direction matrix (3 x 3) ; Verify the input parameters ; if (N_PARAMS() ne 1) then begin PRINT,'Error in angle3123: 1 parameters must be passed.' RETURN, -1 endif sizec = size(cosMat) if (sizec[0] ne 2) then begin PRINT,'Error, the input matrix must be of dimension 2' RETURN, -1 endif if ((sizec[1] ne 3) or (sizec[2] ne 3)) then begin PRINT,'Error, the input matrix must be 3 by 3' RETURN, -1 endif ; Compute the 3 angles (in degrees) ; cosMat = TRANSPOSE(cosMat) angle = FLTARR(3) angle[1] = -cosMat[2,0] angle[1] = ASIN(angle[1]) c2 = COS(angle[1]) if (ABS(c2) lt 1.0e-6) then begin angle[0] = ATAN(-cosMat[1,2], cosMat[1,1]) angle[2] = 0.0 endif else begin angle[0] = ATAN( cosMat[2,1], cosMat[2,2]) angle[2] = ATAN( cosMat[1,0], cosMat[0,0]) endelse angle = angle * (180.0/!DPI) RETURN, angle end ; of angle3123 ; ----------------------------------------------------------------------------- ; ; Purpose: Function returns the cosine direction matrix (3 x 3) ; given the space three 1-2-3 rotation angles(i.e. rotation around ; x axis, followed by Y axis, then z axis), ; else -1 on failure. ; ; Definition : Given 2 sets of dextral orthogonal unit vectors ; (a1, a2, a3) and (b1, b2, b3), the cosine direction matrix ; C (3 x 3) is defined as the dot product of: ; ; C(i,j) = ai . bi where i = 1,2,3 ; ; A column vector X (3 x 1) becomes X' (3 x 1) ; after the rotation as defined as : ; ; X' = C X ; function space3123, $ theta, $ ; IN: angle of rotation around the x axis(in degrees) phi, $ ; IN: angle of rotation around the y axis(in degrees) gamma ; IN: angle of rotation around the z axis(in degrees) ; Verify the input parameters. ; if (N_PARAMS() ne 3) then begin PRINT,'Error in space3123: 3 parameters must be passed.' RETURN, -1 endif cosMat = FLTARR(3, 3) ; Transform the angle in radians. ; rTheta = theta * !DPI / 180.0 rPhi = Phi * !DPI / 180.0 rGamma = Gamma * !DPI / 180.0 cos1 = COS(rTheta) cos2 = COS(rPhi) cos3 = COS(rGamma) sin1 = SIN(rTheta) sin2 = SIN(rPhi) sin3 = SIN(rGamma) ; Compute the cosine direction matrix. ; cosMat[0,0] = cos2*cos3 cosMat[1,0] = cos2*sin3 cosMat[2,0] = -sin2 cosMat[0,1] = (sin1*sin2*cos3) - (cos1*sin3) cosMat[1,1] = (sin1*sin2*sin3) + (cos1*cos3) cosMat[2,1] = sin1*cos2 cosMat[0,2] = (cos1*sin2*cos3) + (sin1*sin3) cosMat[1,2] = (cos1*sin2*sin3) - (sin1*cos3) cosMat[2,2] = cos1*cos2 RETURN, cosMat end ; of space3123 ; ----------------------------------------------------------------------------- ; ; Purpose: Draw view. Some platforms throw math errors that are ; beyond our control. Supress the printing of those errors. ; pro SDvis_Draw, sState ; print,'SDvis_Draw Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' ;print,'enter SDvis_Draw' ; Flush and print any accumulated math errors ; void = check_math(/print) ; Silently accumulate any subsequent math errors, unless we are debugging. ; orig_except = !except !except = ([0, 2])[keyword_set(sState.debug)] ; Draw. ; result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) result=sState.oData_DataFormat->GetData(DataFormat) bVectorField2D=0 bVectorField = 0 bParticles=0 result=sState.oData_datanames->GetData(datanames) result=sState.oData_DataDimHDF->GetData(fourdim) s=size(datanames) if iflag_var lt 0 then begin bVectorField = fourdim[-iflag_var-1] eq 3 bVectorField2D = fourdim[-iflag_var-1] eq 2 or ( iflag_vue[1] GE 3 and bVectorField) bParticles = fourdim[-iflag_var-1] eq 0 endif result=sState.oData_ImageToggle->GetData(ImageToggle) if iflag_vue[1] GE 3 and bVectorField2D then begin sState.drawWindowID3D->SetProperty,GRAPHICS_TREE=sState.oView2 endif else begin sState.drawWindowID3D->SetProperty,GRAPHICS_TREE=sState.oView3D end if ( iflag_vue[0] EQ 1 AND ~bVectorField AND ~bParticles AND ~bVectorField2D ) then begin if ImageToggle(0) eq 0 then begin sState.drawWindowID1->Draw, sState.oView1 sState.drawWindowID2->Draw, sState.oView2 endif else begin sState.drawWindowID1->Draw, sState.oView2 sState.drawWindowID2->Draw, sState.oView1 end sState.drawWindowID3->Draw, sState.oView3 endif else if iflag_vue[1] GE 3 and bVectorField2D then begin if ImageToggle(0) eq 0 then begin sState.drawWindowID1->Draw, sState.oView1 sState.drawWindowID2->Draw, sState.oView2 endif else begin sState.drawWindowID1->Draw, sState.oView2 sState.drawWindowID2->Draw, sState.oView1 end sState.drawWindowID3D->Draw, sState.oView2 endif else if ( iflag_vue[0] EQ 2 OR iflag_vue[0] EQ 3 OR iflag_vue[0] EQ 5 OR iflag_vue[0] EQ 6) $ AND bVectorField EQ 0 AND bParticles EQ 0 then begin sState.drawWindowID3D->Draw, sState.oView3D endif else if ( iflag_vue[1] EQ 1 OR iflag_vue[1] EQ 2 ) AND bVectorField EQ 1 AND bParticles EQ 0 then begin sState.drawWindowID3D->Draw, sState.oView3D endif else if ( iflag_vue[2] EQ 1) AND bParticles EQ 1 then begin sState.drawWindowID3D->Draw, sState.oView3D sState.drawWindowIDDMDensityPlot->Draw, sState.oViewDMDensityPlot endif else if ( iflag_vue[0] EQ 4 ) AND bVectorField EQ 0 AND bParticles EQ 0 then begin sState.drawWindowID3D->Draw, sState.oView3D sState.drawWindowIDIsoPlot->Draw, sState.oViewIsoPlot endif else if ( iflag_vue[3] NE 0 ) then begin ;;; Geometry sState.drawWindowID3D->Draw, sState.oView3D end ;print,'SDvis_Draw 2 Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' ;;; stereo if obj_valid(sState.oWindowStereoEyes[0]) then sState.oWindowStereoEyes[0]->Draw, sState.oView3D if obj_valid(sState.oWindowStereoEyes[1]) then begin result=sState.oData_wStereoOptions->GetData(wStereoOptions) WIDGET_CONTROL,wStereoOptions[2],GET_VALUE=alphaStereo sState.oStereoModel3D->Rotate, [0,1,0],-alphaStereo sState.oWindowStereoEyes[1]->Draw, sState.oView3D sState.oStereoModel3D->Rotate, [0,1,0], alphaStereo endif result=sState.oData_mpegFlag->GetData(mpegFlag) if mpegFlag eq 1 then begin result=sState.oData_Mpeg->GetData(oMpeg) if obj_valid(oMpeg) then begin snapshot=sState.drawWindowID3D->Read() oMpeg->Put, snapshot print,'put snapshot in mpeg' endif endif result = sState.oData_saveImage->GetData(saveImage) if saveImage[0] and saveImage[1] then SaveImageSequence, sState ; Silently (unless we are debugging) flush any accumulated math errors. ; void = check_math(PRINT=keyword_set(sState.debug)) ; Restore original math error behavior. ; !except = orig_except ;print,'exit SDvis_Draw' end ;****************************************************************************** ; Save sequence of output image ; ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, 11 march 2008. ;- ; pro SaveImageSequence, sState dir='images' ; directory for image in mono mode, from left eye in stereo mode dirR='imagesRight' ; directory for image from right eye in stereo mode format=0 ; format : jpeg or gif mode=0 ; mode : stereo or mono result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) if WIDGET_INFO(imagesequenceWidgets[3],/VALID_ID) then WIDGET_CONTROL,imagesequenceWidgets[3],GET_VALUE=dir if WIDGET_INFO(imagesequenceWidgets[8],/VALID_ID) then WIDGET_CONTROL,imagesequenceWidgets[8],GET_VALUE=dirR if WIDGET_INFO(imagesequenceWidgets[1],/VALID_ID) then format=WIDGET_INFO(imagesequenceWidgets[1],/DROPLIST_SELECT) if WIDGET_INFO(imagesequenceWidgets[10],/VALID_ID) then mode=WIDGET_INFO(imagesequenceWidgets[10],/DROPLIST_SELECT) print,'mode=',mode if file_test(dir,/DIRECTORY) eq 0 then begin print,'WARNING : directory ',dir,' does not exist' return endif if mode eq 1 and file_test(dirR,/DIRECTORY) eq 0 then begin print,'WARNING : right-eye directory ',dirR,' does not exist' return endif result = sState.oData_counterImage->GetData(counterImage) counterImage=counterImage+1 i=counterImage print,'save view ',i,' in image sequence directory' if ( i lt 10) then begin name='SDvision-imageSequence-0000'+strcompress(string(i),/remove_all) endif else if (i lt 100) then begin name='SDvision-imageSequence-000'+strcompress(string(i),/remove_all) endif else if (i lt 1000) then begin name='SDvision-imageSequence-00'+strcompress(string(i),/remove_all) endif else if (i lt 10000) then begin name='SDvision-imageSequence-0'+strcompress(string(i),/remove_all) endif else if (i lt 100000) then begin name='SDvision-imageSequence-'+strcompress(string(i),/remove_all) endif else begin print,'too much images !!!' endelse stereoFlag=0 if mode eq 1 and obj_valid(sState.oWindowStereoEyes[1]) then stereoFlag=1 sState.drawWindowID3D->GetProperty,IMAGE_DATA=snapshot if stereoFlag then sState.oWindowStereoEyes[1]->GetProperty,IMAGE_DATA=snapshotR if format eq 0 then begin ext='.jpg' filename=dir+'/'+name+ext WRITE_JPEG,filename,snapshot,TRUE=1,QUALITY=100 if stereoFlag then begin filename=dirR+'/'+name+ext WRITE_JPEG,filename,snapshotR,TRUE=1,QUALITY=100 endif endif else begin ext='.gif' filename=dir+'/'+name+ext image=COLOR_QUAN(snapshot,1,r,g,b,COLORS=256) WRITE_GIF,filename,image,r,g,b if stereoFlag then begin filename=dirR+'/'+name+ext image=COLOR_QUAN(snapshotR,1,r,g,b,COLORS=256) WRITE_GIF,filename,image,r,g,b endif endelse result = sState.oData_counterImage->SetData(counterImage) WIDGET_CONTROL,imagesequenceWidgets[5],SET_VALUE=counterImage end ; ; ----------------------------------------------------------------------------- pro create_mpeg, sState ;bitrate=104857200 ;WIDGET_CONTROL,sState.wMpegBitrate,GET_VALUE=bitrate ;bitrate= 70000000 result=sState.oData_mpegParameters->GetData(mpegParameters) format =mpegParameters[0] quality =mpegParameters[1] bitrate =mpegParameters[2] framerate =mpegParameters[3] motion_vec_length=mpegParameters[4] iframe_gap =mpegParameters[5] interlaced =mpegParameters[6] result=sState.oData_Mpeg->GetData(oMpeg) oMpeg = OBJ_NEW('IDLgrMpeg',FILENAME='SDvision.mpg', /STATISTICS, $ FORMAT=format, $ QUALITY=quality, $ BITRATE=bitrate, $ FRAME_RATE=framerate, $ MOTION_VEC_LENGTH=motion_vec_length, $ IFRAME_GAP=iframe_gap, $ INTERLACED=interlaced $ ) result=sState.oData_Mpeg->SetData(oMpeg) sState.oObserver->SetProperty, OMPEG=oMpeg oMpeg->GetProperty, $ FORMAT=format, $ QUALITY=quality, $ BITRATE=bitrate, $ FRAME_RATE=framerate, $ MOTION_VEC_LENGTH=motion_vec_length, $ IFRAME_GAP=iframe_gap, $ INTERLACED=interlaced if format eq 0 then print,'format=mpeg1' if format eq 1 then print,'format=mpeg2' print,'quality=',quality print,'bitrate=',bitrate print,'framerate=',framerate print,'motion_vec_length=',motion_vec_length print,'iframe_gap=',iframe_gap print,'interlaced=',interlaced result=sState.oData_mpegWidgets->GetData(mpegWidgets) WIDGET_CONTROL,mpegWidgets[1],SET_VALUE=quality,SENSITIVE=1 WIDGET_CONTROL,mpegWidgets[2],SET_VALUE=bitrate WIDGET_CONTROL,mpegWidgets[3],SET_DROPLIST_SELECT=framerate-1 WIDGET_CONTROL,mpegWidgets[4],SET_DROPLIST_SELECT=motion_vec_length WIDGET_CONTROL,mpegWidgets[5],SET_VALUE=iframe_gap WIDGET_CONTROL,mpegWidgets[6],SET_DROPLIST_SELECT=interlaced WIDGET_CONTROL,mpegWidgets[11],SENSITIVE=1 WIDGET_CONTROL,mpegWidgets[14],SENSITIVE=1 WIDGET_CONTROL,mpegWidgets[0],SENSITIVE=1 WIDGET_CONTROL,mpegWidgets[1],SENSITIVE=1 ;WIDGET_CONTROL,mpegWidgets[2],/EDIT WIDGET_CONTROL,mpegWidgets[3],SENSITIVE=1 WIDGET_CONTROL,mpegWidgets[4],SENSITIVE=1 WIDGET_CONTROL,mpegWidgets[6],SENSITIVE=1 WIDGET_CONTROL,mpegWidgets[7],SENSITIVE=1 result=sState.oData_mpegParameters->GetData(mpegParameters) mpegParameters[0]=format mpegParameters[1]=quality mpegParameters[2]=bitrate mpegParameters[3]=framerate mpegParameters[4]=motion_vec_length mpegParameters[5]=iframe_gap mpegParameters[6]=interlaced result=sState.oData_mpegParameters->SetData(mpegParameters) help,oMpeg end ; ; ----------------------------------------------------------------------------- pro ReplaySequence, sState sState.oSceneText[0]->GetProperty,HIDE=hide if hide eq 0 then HideSceneText, sState result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_DataFormat->GetData(DataFormat) u2=48 WIDGET_CONTROL, sState.wSequenceFileName2, GET_VALUE=filename if file_test(filename) eq 0 then begin print,'WARNING : Control sequence file ',filename,' does not exist' return endif print,'opening file ',filename openr,u2,filename text='' WHILE text NE 'END' DO BEGIN readf,u2,text ;& print,text if strcmp(text,'SDvision',8) then begin print,text endif else if strcmp(text,'version',6) then begin print,text cversion=strmid(text,15,1) print,'cversion=',cversion version=fix(cversion) print,'version=',version endif else if strcmp(text,'PROJECTION',10) then begin cprojection=strmid(text,12,1) print,'cprojection=',cprojection iprojection=fix(cprojection) print,'iprojection=',iprojection if iprojection eq 1 then begin WIDGET_CONTROL,sState.wViewOptions[0],SET_BUTTON=1 WIDGET_CONTROL,sState.wViewOptions[1],SET_BUTTON=0 endif else if iprojection eq 2 then begin WIDGET_CONTROL,sState.wViewOptions[0],SET_BUTTON=0 WIDGET_CONTROL,sState.wViewOptions[1],SET_BUTTON=1 endif else begin print,'unknown projection' end sState.oView3D->SetProperty,PROJECTION=iprojection endif else if strcmp(text,'EYE',3) then begin result=sState.oData_eye->GetData(eye) readf,u2,e0,e1,e2,e3,e4,FORMAT='(5(1x,f15.7))' eye[0]=e0 eye[1]=e1 eye[2]=e2 eye[3]=e3 eye[4]=e4 result=sState.oData_eye->SetData(eye) print,'eye=',eye sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] endif else if strcmp(text,'OUTPUT',6) then begin readf,u2,outrun SimuStepOutput=fix(outrun) print,'output # ',SimuStepOutput IF DataFormat eq 1 then begin ; HERACLES binary WIDGET_CONTROL, sState.wStepField, SET_VALUE=SimuStepOutput ENDIF ELSE IF DataFormat eq 2 THEN BEGIN WIDGET_CONTROL, sState.wStepField, SET_VALUE=SimuStepOutput ENDIF ELSE IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES WIDGET_CONTROL, sState.wRamsesConfig[0], SET_VALUE=SimuStepOutput ENDIF ELSE IF DataFormat EQ 4 THEN BEGIN ;;; ASH BoB result=sState.oData_AshFileName->GetData(AshFileName) result=sState.oData_AshFilePath->GetData(path) print,'path=',path len=strlen(path) filename=AshFileName[0,0] step=strmid(filename,len) print,'step=',step begstep=strmid(step,0,7) print,'begstep=',begstep endstep=strmid(step,7) print,'endstep=',endstep intstep=fix(begstep,type=7) print,'intstep=',intstep intStep = SimuStepOutput curstep=strcompress(string(fix(intStep)),/remove_all) if intStep lt 10 then curstep='000000'+curstep if intStep ge 10 and istep lt 100 then curstep='000000'+curstep if intStep ge 100 and istep lt 1000 then curstep='00000'+curstep if intStep ge 1000 and istep lt 10000 then curstep='0000'+curstep if intStep ge 10000 and istep lt 100000 then curstep='00'+curstep if intStep ge 100000 and istep lt 1000000 then curstep='0'+curstep if intStep gt 1000000 then print,'unforeseen case in MOVIE DATA PREPARATION' print,'curstep=',curstep fullcurstep=path+curstep+endstep print,'fullcurstep=',fullcurstep AshFileName[0,0]=fullcurstep result=sState.oData_AshFileName->SetData(AshFileName) ENDIF ELSE IF DataFormat eq 5 THEN BEGIN WIDGET_CONTROL, sState.wJupiterConfig[0], SET_VALUE=SimuStepOutput ENDIF result=sState.oData_SimuStepOutput->SetData(SimuStepOutput) result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) dum=LoadData(sState) if iflag_vue[0] EQ 4 OR iflag_vue[0] EQ 5 then begin print,'UpdateTheViews !' dum=UpdateTheViews(sState,1) endif endif else if strcmp(text,'FORMAT',6) then begin if strcmp(text,'FORMAT: HERACLES BINARY') then begin DataFormat=1 print,'Load Data Format HERACLES BINARY' WIDGET_CONTROL,sState.wPickFormatList,SET_DROPLIST_SELECT=1 endif else if strcmp(text,'FORMAT: HDF5') then begin DataFormat=2 print,'Load Data Format HDF5' WIDGET_CONTROL,sState.wPickFormatList,SET_DROPLIST_SELECT=0 endif else if strcmp(text,'FORMAT: RAMSES AMR') then begin DataFormat=3 print,'Load Data Format RAMSES AMR' WIDGET_CONTROL,sState.wPickFormatList,SET_DROPLIST_SELECT=2 endif else if strcmp(text,'FORMAT: ASH BOB') then begin DataFormat=4 print,'Load Data Format ASH BOB' WIDGET_CONTROL,sState.wPickFormatList,SET_DROPLIST_SELECT=3 endif else if strcmp(text,'FORMAT: JUPITER') then begin DataFormat=5 print,'Load Data Format JUPITER' WIDGET_CONTROL,sState.wPickFormatList,SET_DROPLIST_SELECT=4 endif else if strcmp(text,'FORMAT: JAQUES') then begin DataFormat=10 print,'Load Data Format Enzo via Jaques' WIDGET_CONTROL,sState.wPickFormatList,SET_DROPLIST_SELECT=6 end result=sState.oData_DataFormat->SetData(DataFormat) PickFormat,sState endif else if strcmp(text,'FIELD',5) then begin result=sState.oData_RamsesFillArrays->GetData(RamsesFillArrays) result=sState.oData_FillArrays->GetData(FillArrays) dum=" " field=' ' readf,u2,field print,'data field=',field if field eq ' density' then begin print,'test !!!' IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES AMR RamsesFillArrays[0]=1 ENDIF endif result=sState.oData_RamsesFillArrays->SetData(RamsesFillArrays) result=sState.oData_FillArrays->SetData(FillArrays) endif else if strcmp(text,'OBJECT',6) then begin dum=ResetBases(sState) if strcmp(text,'OBJECT: DATAVOLUME') then begin print,'Display volume projection' WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[6], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[3] , MAP=1 i=0 iflag_var= -(i+1) result=sState.oData_flag->SetData(iflag_var) iflag_vue[*]=0 & iflag_vue[0] = 5 & result=sState.oData_vue->SetData(iflag_vue) result=sState.oData_oVolume->GetData(oVolume) l=0 composite_function=1 IF OBJ_VALID(oVolume[l]) EQ 0 THEN BEGIN ;oPaletteImage = Obj_New('IDLgrPalette') ;oPaletteImage->LoadCT, 1 ;oPaletteImage->GetProperty, Red=r, Blue=b, Green=g ;vColors = BYTARR(256,3,/NOZERO) ;vColors[*,0]=r ;vColors[*,1]=g ;vColors[*,2]=b result=sState.oData_vColors->GetData(vColors) result=sState.oData_VolumeOpacity->GetData(Opac) print,'create oVolume[0]' oVolume[l]=OBJ_NEW('IDLgrVolume',HIDE=1,ALPHA_CHANNEL=1.,ZERO_OPACITY_SKIP=1,/ZBUFFER, $ RGB_TABLE0=vColors,OPACITY_TABLE0=Opac,HINTS=2,COMPOSITE_FUNCTION=composite_function,/NO_COPY,$ RENDER_STEP=[1,1,1],/REGISTER_PROPERTIES,CLIP_PLANES=[0,0,1.,-20000.],DESCRIPTION='volume object') sState.oModelVolume->Add,oVolume[l] result=sState.oData_oVolume->SetData(oVolume) WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState ;WIDGET_CONTROL, sEvent.top, Set_UValue=sState ENDIF IF DataFormat eq 4 THEN BEGIN LoadPredefinedLUT,sState ;WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState ;WIDGET_CONTROL, sEvent.top, Set_UValue=sState ENDIF oVolume[l]->SetProperty,HIDE=0 ;;;result=sState.oData_oVolume->SetData(oVolume) print,'call UpdateTheViews' dum=UpdateTheViews(sState,1) endif if strcmp(text,'OBJECT: ISOSURFACE') then begin print,'Display isosurface' WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[3], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[0] , MAP=1 i=0 iflag_var= -(i+1) result=sState.oData_flag->SetData(iflag_var) iflag_vue[*]=0 & iflag_vue[0] = 4 & result=sState.oData_vue->SetData(iflag_vue) endif if strcmp(text,'OBJECT: GEO BOUNDARIES') then begin print,'Display volume boundaries' sState.xaxis3Dbounds1->SetProperty, HIDE=0 sState.xaxis3Dbounds2->SetProperty, HIDE=0 sState.xaxis3Dbounds3->SetProperty, HIDE=0 sState.xaxis3Dbounds4->SetProperty, HIDE=0 sState.yaxis3Dbounds1->SetProperty, HIDE=0 sState.yaxis3Dbounds2->SetProperty, HIDE=0 sState.yaxis3Dbounds3->SetProperty, HIDE=0 sState.yaxis3Dbounds4->SetProperty, HIDE=0 sState.zaxis3Dbounds1->SetProperty, HIDE=0 sState.zaxis3Dbounds2->SetProperty, HIDE=0 sState.zaxis3Dbounds3->SetProperty, HIDE=0 sState.zaxis3Dbounds4->SetProperty, HIDE=0 iflag_vue[*]=0 & iflag_vue[3]=1 & result=sState.oData_vue->SetData(iflag_vue) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 ;WIDGET_CONTROL, sState.wObjectControlDisplayBounds,SENSITIVE=1 ;WIDGET_CONTROL, sState.wObjectControlConfigureBounds,SENSITIVE=1 WIDGET_CONTROL, sState.wLeftVueBase, SENSITIVE=1 WIDGET_CONTROL, sState.wSelectionBase[9], MAP=1 dum=UpdateTheViews(sState,1) endif endif else if strcmp(text,'STEP',4) then begin cstep=strmid(text,6,1) print,'cstep=',cstep nstep=fix(cstep) print,'nstep=',nstep dum='' & trans='' for istep=1,nstep do begin point_lun,-u2,pos readf,u2,dum print,'dum=',dum if strcmp(dum,' scaling ',13) then begin point_lun,u2,pos readf,u2,dum,stepScale,FORMAT='(a13,1(1x,f15.7))' print,'stepScale=',stepScale sState.oModel3D->GetProperty, TRANSFORM = transform transform[0,0] += stepScale transform[1,1] += stepScale transform[2,2] += stepScale sState.oModel3D->SetProperty, TRANSFORM = transform endif if strcmp(dum,' translation ',13) then begin point_lun,u2,pos readf,u2,trans,stepTransX,stepTransY, stepTransZ,FORMAT='(a13,3(1x,f15.7))' ;print,'translation stepTransX, stepTransY=',stepTransX, stepTransY sState.oModel3D->Translate, stepTransX, stepTransY, stepTransZ print,'translate oModel3D' endif if strcmp(dum,' translationR',13) then begin point_lun,u2,pos readf,u2,trans,stepTransXRot,stepTransYRot,stepTransZRot,FORMAT='(a13,3(1x,f15.7))' sState.oRotationModel3D->Translate, stepTransXRot, stepTransYRot, stepTransZRot print,'translate oRotationModel3D' endif if strcmp(dum,' pivotSet ',13) then begin point_lun,u2,pos readf,u2,trans,tx,ty,tz,FORMAT='(a13,3(1x,f15.7))' sState.oModel3D->Translate, -tx,-ty,-tz, /PREMULTIPLY sState.oRotationModel3D->Translate, tx,ty,tz print,'Set Pivot point' endif if strcmp(dum,' rotation ',13) then begin point_lun,u2,pos readf,u2,dum,nx,ny,nz,dPhi,FORMAT='(a13,4(1x,f15.7))' sState.oRotationModel3D->Rotate,[nx,ny,nz],dPhi , /PREMULTIPLY print,'rotation oRotationModel3D dPhi=',dPhi endif if strcmp(dum,' rotation2 ',13) then begin point_lun,u2,pos readf,u2,dum,nx,ny,nz,dPhi,FORMAT='(a13,4(1x,f15.7))' sState.oRotationModel3D->Rotate,[nx,ny,nz],dPhi print,'rotation2 oRotationModel3D dPhi=',dPhi endif endfor SDvis_Draw, sState endif else if strcmp(text,'MESHIJKBOUNDARIES') then begin result = sState.oData_MeshIJKBoundaries->GetData(MeshIJKBoundaries_current) result=sState.oData_AmrLevels->GetData(AmrLevels_current) MeshIJKBoundaries=fltarr(6) AmrLevels=intarr(4) readf,u2,l1,l2,MeshIJKBoundaries ;help,MeshIJKBoundaries_current print,'MeshIJKBoundaries=',MeshIJKBoundaries test=ARRAY_EQUAL(MeshIJKBoundaries_current,MeshIJKBoundaries) print,'test,l1,l2=',test,l1,l2 sState.oSceneText[2]->SetProperty,STRINGS='AMR Level '+strcompress(string(fix(l2)),/remove_all) ;if iflag_vue[0] EQ 4 OR iflag_vue[0] EQ 5 then begin if test eq 0 or AmrLevels[0] ne l1 or AmrLevels[1] ne l2 then begin result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) AmrLevels[0]=l1 AmrLevels[1]=l2 AmrLevels[2]=AmrLevels[0] AmrLevels[3]=AmrLevels[1] print,'read AmrLevels=',AmrLevels print,'read MeshIJKBoundaries=',MeshIJKBoundaries result = sState.oData_MeshIJKBoundaries->SetData(MeshIJKBoundaries) if WIDGET_INFO(sState.wRamsesConfigBoundariesBase[0],/VALID_ID) EQ 1 then begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], SET_VALUE=MeshIJKBoundaries[0] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], SET_VALUE=MeshIJKBoundaries[1] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], SET_VALUE=MeshIJKBoundaries[2] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], SET_VALUE=MeshIJKBoundaries[3] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], SET_VALUE=MeshIJKBoundaries[4] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], SET_VALUE=MeshIJKBoundaries[5] result=sState.oData_AmrLevels->SetData(AmrLevels) WIDGET_CONTROL, sState.wRamsesConfig[1], SET_COMBOBOX_SELECT=AmrLevels[0]-1 WIDGET_CONTROL, sState.wRamsesConfig[2], SET_COMBOBOX_SELECT=AmrLevels[1]-1 endif if iflag_vue[0] EQ 4 OR iflag_vue[0] EQ 5 then begin ;;; the case l2=0 occurs when loading saved variables defined in subvolumes ; if l2 ne 0 and version eq 1 then dum=LoadData(sState) if l2 ne 0 and version eq 2 then print,'no reload of data' print,'UpdateTheViews !' dum=UpdateTheViews(sState,1) endif endif else begin print,'no update needed' end ;endif endif else if strcmp(text,'***',3) then begin print,text endif else if strcmp(text,'RELOAD',6) then begin dum=LoadData(sState) dum=UpdateTheViews(sState,1) endif else if strcmp(text,'IDLPALETTE',10) then begin result=sState.oData_oVolume->GetData(oVolume) readf,u2,IDPALETTE print,'palette id# ',IDPALETTE loadct, IDPALETTE result=sState.oData_vColors->GetData(vColors) oPalette = Obj_New('IDLgrPalette') oPalette->LoadCT,IDPALETTE oPalette->GetProperty,RED_VALUES=r,GREEN_VALUES=g,BLUE_VALUES=b vColors[*,0]=r & vColors[*,1]=g & vColors[*,2]=b for i=0,2 do begin sState.oPlotCOT[i]->SetProperty, Datay=vColors[*,i] endfor sState.oPaletteImage->SetProperty,RED_VALUES=r,GREEN_VALUES=g,BLUE_VALUES=b sState.oPaletteImage->LoadCT,IDPALETTE sState.oCB->SetProperty,Palette=oPalette IF OBJ_VALID(oVolume[0]) EQ 1 THEN BEGIN oVolume[0]->SetProperty,RGB_TABLE0=vColors ENDIF result=sState.oData_vColors->SetData(vColors) result=sState.oData_vColors_orig->SetData(vColors) endif else if strcmp(text,'TEXT',4) then begin controlText=' ' readf,u2,controlText print,'controlText=',controlText,':::' controlTextAbridged=strcompress(controlText,/remove_all) print,'controlTextAbridged=',controlTextAbridged,':::' WIDGET_CONTROL, sState.wTextControlOptions[0], GET_VALUE=index if controlTextAbridged eq 'AMRLEVEL' then begin index[1]=1 sState.oSceneText[2]->SetProperty,HIDE=1-index[1] endif WIDGET_CONTROL, sState.wTextControlOptions[0], SET_VALUE=index endif else if strcmp(text,'WINDOWSIZE',10) then begin readf,u2,xdim,ydim print,'xdim,ydim=',xdim,ydim result=sState.oData_xydim->GetData(xydim) xydim[0]=xdim xydim[1]=ydim result=sState.oData_xydim->SetData(xydim) WIDGET_CONTROL, sState.wDraw3D, XSIZE=xydim[0], YSIZE=xydim[1] scale_factor=1.*xydim[1]/xydim[0] ;print,'scale_factor=',scale_factor sState.oResizeableModel3D->Reset sState.oResizeableModel3D->Scale,scale_factor,1.,1. sState.oTrackL->Reset,[xydim[0]/2.0, xydim[1]/2.0], xydim[0]/2.0, MOUSE=1 sState.oTrackM->Reset,[xydim[0]/2.0, xydim[1]/2.0], xydim[0]/2.0, MOUSE=2 sState.oTrackR->Reset,[xydim[0]/2.0, xydim[1]/2.0], xydim[0]/2.0, MOUSE=4 scaleText=[0.069,0.025,0.04] for i=0,2 do begin sState.oSceneText[i]->GetProperty,xcoord_conv=xcoord_conv xcoord_conv[1]=scaleText[i]*scale_factor sState.oSceneText[i]->SetProperty,xcoord_conv=xcoord_conv endfor SDvis_Draw, sState endif else if strcmp(text,'PALETTE-FILE',12) then begin pfile=' ' readf,u2,pfile print,'palette file=',pfile file_name=strcompress(pfile,/remove_all) print,'palette file=',file_name openr,1,file_name, ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', file_name ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif result=sState.oData_vColors->GetData(vColors) result=sState.oData_VolumeOpacity->GetData(Opac) result=sState.oData_oVolume->GetData(oVolume) dum='dum' readf,1,dum for i=0,255 do begin readf,1,a,b vColors[i,0]=b endfor readf,1,dum for i=0,255 do begin readf,1,a,b vColors[i,1]=b endfor readf,1,dum for i=0,255 do begin readf,1,a,b vColors[i,2]=b endfor readf,1,dum for i=0,255 do begin readf,1,a,b Opac[i]=b endfor close,1 result=sState.oData_vColors->SetData(vColors) result=sState.oData_VolumeOpacity->SetData(Opac) sState.oPlotCOT[0]->SetProperty, Datay=vColors[*,0] sState.oPlotCOT[1]->SetProperty, Datay=vColors[*,1] sState.oPlotCOT[2]->SetProperty, Datay=vColors[*,2] sState.oPlotCOT[3]->SetProperty, Datay=Opac sState.oPaletteImage->SetProperty,RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2] oPalette = Obj_New('IDLgrPalette',RED_VALUES=vColors[*,0],GREEN_VALUES=vColors[*,1],BLUE_VALUES=vColors[*,2]) sState.oCB->SetProperty,Palette=oPalette IF OBJ_VALID(oVolume[0]) EQ 1 THEN BEGIN oVolume[0]->SetProperty,RGB_TABLE0=vColors oVolume[0]->SetProperty,OPACITY_TABLE0=Opac ENDIF endif else if strcmp(text,'TRILINEAR',9) then begin IF OBJ_VALID(oVolume[0]) EQ 1 THEN $ oVolume[0]->SetProperty,INTERPOLATE=1 endif else if strcmp(text,'ALPHA-BLENDING',14) then begin IF OBJ_VALID(oVolume[0]) EQ 1 THEN $ oVolume[0]->SetProperty,COMPOSITE_FUNCTION=0 endif else if strcmp(text,'NEARESTNEIGHBOR',15) then begin IF OBJ_VALID(oVolume[0]) EQ 1 THEN $ oVolume[0]->SetProperty,INTERPOLATE=0 endif else if strcmp(text,'VOLUMEFADING',12) then begin IF OBJ_VALID(oVolume[0]) EQ 1 THEN $ oVolume[0]->GetProperty,DEPTH_CUE=depth_cue readf,u2,d0,d1,FORMAT='(2(1x,f15.7))' depth_cue[0]=d0 depth_cue[1]=d1 IF OBJ_VALID(oVolume[0]) EQ 1 THEN $ oVolume[0]->SetProperty,DEPTH_CUE=depth_cue endif else if strcmp(text,'SAVESEQUENCEOFF',15) then begin print,'PAUSE SAVING SEQUENCE' result = sState.oData_saveImage->GetData(saveImage) saveImage[1]=0 result = sState.oData_saveImage->SetData(saveImage) endif else if strcmp(text,'SAVESEQUENCEON',14) then begin print,'RESUME SAVING SEQUENCE' result = sState.oData_saveImage->GetData(saveImage) saveImage[1]=1 result = sState.oData_saveImage->SetData(saveImage) endif else if strcmp(text,'BIGENDIAN',9) then begin Endian=1 result=sState.oData_Endian->SetData(Endian) endif else if strcmp(text,'CPUBOX',6) then begin WIDGET_CONTROL, sState.wRamsesCpuBox, GET_VALUE=indexCpuBox indexCpuBox[0]=1 WIDGET_CONTROL, sState.wRamsesCpuBox, SET_VALUE=indexCpuBox print,'cpubox engaged' endif else if strcmp(text,'RESTORE') then begin print,'RESTORE: Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' rfile=' ' readf,u2,rfile print,'restore file=',rfile rfile_name=strcompress(rfile,/remove_all) print,'rfile_name=',rfile_name if file_test(rfile_name) eq 0 then begin print,'WARNING : restore file ',rfile_name,' does not exist' close,u2 return endif restore,rfile_name,restored_objects=var,description=description print,'RESTORE: Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' help,density help,description,output=test_valid valid_description=description ne '' print,'valid_description=',valid_description if valid_description eq 0 then begin print,'no descritpion for the restored variable' close,u2 return endif if description eq 'density' then var=temporary(density) s=size(var) print,'size s=',s result=sState.oData_GridDim->GetData(GridDim) GridDim(0)=s(1) GridDim(1)=s(2) if s(0) ge 3 then begin GridDim(2)=s(3) endif else if s(0) eq 2 then begin GridDim(2)=1 end result=sState.oData_GridDim->SetData(GridDim) result=sState.oData_DataFormat->GetData(DataFormat) IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES BINARY WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='AMR data loaded' dum=GridPrint(sState,1) ENDIF ELSE BEGIN dum=GridPrint(sState,0) ENDELSE result=sState.oData_datanames->GetData(datanames) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_DataDimHDF->GetData(fourdim) datanames=0 FillArraysHDF=0 fourdim=0 size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) nvar=nvar+1 newdatanames=strarr([nvar]) if nvar ne 1 then newdatanames(0:nvar-2)=datanames(0:nvar-2) newdatanames(nvar-1)=description result=sState.oData_datanames->SetData(newdatanames) newfourdim=make_array([nvar]) if nvar ne 1 then newfourdim(0:nvar-2)=fourdim(0:nvar-2) print,'s(0)=',s(0) if s(0) eq 3 then begin newfourdim(nvar-1)=1 endif else if s(0) eq 2 then begin newfourdim(nvar-1)=1 endif else if s(0) eq 4 then begin newfourdim(nvar-1)=3 end result=sState.oData_DataDimHDF->SetData(newfourdim) ;print,'newfourdim',newfourdim IF OBJ_VALID( sState.oData_HDFvar[nvar-1,0] ) EQ 0 THEN $ sState.oData_HDFvar[nvar-1,0]=OBJ_NEW('IDLitData',newdatanames(nvar-1)) result=sState.oData_HDFvar[nvar-1,0]->SetData(var,/NO_COPY) print,'RESTORE: Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' newFillArraysHDF=make_array([nvar]) if nvar ne 1 then newFillArraysHDF(0:nvar-2)=FillArraysHDF(0:nvar-2) newFillArraysHDF(nvar-1)=1 result=sState.oData_FillArraysHDF->SetData(newFillArraysHDF) endif else if strcmp(text,'SLICESCAN') then begin plane=' ' & imin=0 & imax=0 & istep=0 readf,u2,plane,imin,imax,istep,FORMAT='(1x,a2,3(1x,i7))' print,'plane,imin,imax,istep=',plane,imin,imax,istep for iscan=imin,imax,istep do begin WIDGET_CONTROL, sState.wImage3DPlaneSlider, SET_VALUE=iscan dum=UpdateTheViews(sState,1) endfor endif else if strcmp(text,'*',1) then begin print,'*' endif else if strcmp(text,'END') then begin print,'END READING SEQUENCE' endif else begin print,'unknown step in sequence' endelse ENDWHILE close,u2 print,'end reading sequence file' end ; ;************************************************************************************************ ;************************************************************************************************ ;************************************************************************************************ ;+ ; NAME : ; STARTMOVIE_PREPARATION ; ; PURPOSE : ; Movie preparation and playing ; ; MODIFICATION HISTORY : ; january-june 2007 : prepare/save/restore sequence of objects (D. Pomarède) ; july-august 2007 : save time and spatial points (Y. Fidaali) ; sept.-oct. 2007 : write and read ascii control file (D. Pomarède) ; january 2007 : remove streaming of objects (migrated to the start_Objects_Stream_preparation procedure) ; not used in reading of ascii control file ; ; INPUTS : ; sState : main memory structure of SDvivion ; save : handle sequence of objects ; sequence : 0 loop on either saved vues (cptVue >0) or on sequence of objects (cptVue=0) ; 1 write sequence to ascii control file ("*.sds") ; pro startMovie_preparation, sState, save, sequence debug=0 result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_DataFormat->GetData(DataFormat) result=sState.oData_RamsesFillArrays->GetData(RamsesFillArrays) result=sState.oData_FillArrays->GetData(FillArrays) result=sState.oData_SimuStepOutput->GetData(SimuStepOutput) ; sequence=1 -> write sequence to ascii control file ("*.sds") ; if sequence eq 1 then begin u1=47 ;filename='SDvision_sequence.dat' WIDGET_CONTROL, sState.wSequenceFileName, GET_VALUE=filename print,'opening file ',filename openw,u1,filename,error=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file=', filename return endif printf,u1,'SDvision sequence description' sequenceversion=1 printf,u1,'version:',sequenceversion sState.oView3D->GetProperty,PROJECTION=projection result=sState.oData_eye->GetData(eye) printf,u1,'EYE:' printf,u1,eye[0],eye[1],eye[2],eye[3],eye[4],FORMAT='(5(1x,f15.7))' if projection eq 1 then printf,u1,'PROJECTION: 1' if projection eq 2 then printf,u1,'PROJECTION: 2' if DataFormat eq 1 then printf,u1,'FORMAT: HERACLES BINARY' if DataFormat eq 2 then printf,u1,'FORMAT: HDF5' if DataFormat eq 3 then printf,u1,'FORMAT: RAMSES AMR' if DataFormat eq 4 then printf,u1,'FORMAT: ASH BOB' if DataFormat eq 5 then printf,u1,'FORMAT: JUPITER' if DataFormat eq 10 then printf,u1,'FORMAT: JAQUES' FillDensity = 0 FillPressure = 0 FillVelocity = 0 ReadParticles = 0 IF DataFormat EQ 1 OR DataFormat EQ 3 THEN BEGIN ;;; HERACLES OR RAMSES BINARY FillDensity = (FillArrays[0] eq 1 AND DataFormat le 2) OR $ (RamsesFillArrays[0] eq 1 AND DataFormat eq 3) FillPressure = (FillArrays[2] eq 1 AND DataFormat le 2) OR $ (RamsesFillArrays[5] eq 1 AND DataFormat eq 3) FillVelocity = (FillArrays[3] eq 1 AND DataFormat le 2) OR $ (RamsesFillArrays[1] eq 1 AND DataFormat eq 3) ENDIF IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES AMR if FillDensity then begin printf,u1,'FIELD:' printf,u1,' density' endif ENDIF endif WIDGET_CONTROL, sState.wDefineMovieStart, GET_VALUE=movieStart WIDGET_CONTROL, sState.wDefineMovieEnd, GET_VALUE=movieEnd WIDGET_CONTROL, sState.wDefineMovieStep, GET_VALUE=movieStep result=sState.oData_MovieFrameNMAX->GetData(MovieFrameNMAX) MovieFrameCURRENT=0 result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) result = sState.oData_saveScaleVue->GetData(saveScaleVue) result = sState.oData_saveTranslateVue->GetData(saveTranslateVue) result = sState.oData_saveTranslatePivotVue->GetData(saveTranslatePivotVue) result = sState.oData_saveTransform->GetData(saveTransform) result = sState.oData_saveTransformRot->GetData(saveTransformRot) result = sState.oData_saveLevelVue->GetData(saveLevelVue) result = sState.oData_saveOutputNumber->GetData(saveOutputNumber) result = sState.oData_saveNumberSteps->GetData(saveNumberSteps) result = sState.oData_saveMeshIJKBoundaries->GetData(saveMeshIJKBoundaries) result = sState.oData_cptVue->GetData(cptVue) result = sState.oData_saveLevels->GetData(saveLevels) if cptVue gt 1 then endLoop = cptVue-1 else endLoop = 1 MeshIJKNotRound = fltarr(6) lastOutput = 0 SimuStepOutput_current = SimuStepOutput result =sState.oData_AshFileName->GetData(AshFileName) AshFileName_current =AshFileName if debug then print,'cptVue,endLoop=',cptVue,endLoop for iLoop=1, endLoop do begin if debug then print,'iLoop,cptVue=',iLoop,cptVue if debug then print,' saveTranslatePivotVue[iLoop-1]=', saveTranslatePivotVue[iLoop-1] changeBoundaries = 0 if cptVue gt 0 then begin sState.oModel3D->Reset sState.oRotationModel3D->Reset transform=saveTransform[*,*,iLoop-1] sState.oModel3D->SetProperty, TRANSFORM=transform transformRot=saveTransformRot[*,*,iLoop-1] sState.oRotationModel3D->SetProperty, TRANSFORM=transformRot transformSca=saveTransform[*,*,iLoop-1] result = sState.oData_MeshIJKBoundaries->GetData(MeshIJKBoundaries) for i=0, 5 do MeshIJKBoundaries[i] = saveMeshIJKBoundaries[i,iLoop-1] result = sState.oData_MeshIJKBoundaries->SetData(MeshIJKBoundaries) result=sState.oData_AmrLevels->GetData(AmrLevels) if debug then print, AmrLevels[0], AmrLevels[1] if debug then print, saveLevels[0,iLoop-1], saveLevels[1,iLoop-1] if debug then print, AmrLevels[0] ne saveLevels[0,iLoop-1], AmrLevels[1] ne saveLevels[1,iLoop-1] if AmrLevels[0] ne saveLevels[0,iLoop-1] OR AmrLevels[1] ne saveLevels[1,iLoop-1] then begin AmrLevels[0] = saveLevels[0,iLoop-1] AmrLevels[1] = saveLevels[1,iLoop-1] AmrLevels[2] = saveLevels[0,iLoop-1] AmrLevels[3] = saveLevels[1,iLoop-1] changeBoundaries = 2 endif result=sState.oData_AmrLevels->SetData(AmrLevels) for i=0, 5 do MeshIJKNotRound[i] = MeshIJKBoundaries[i] endif firstMovieFrameCURRENT = MovieFrameCURRENT if cptVue gt 1 then begin n = saveNumberSteps[iLoop] start = 0 endStep = n step = 1 stepScale = (saveScaleVue[iLoop] - saveScaleVue[iLoop-1])/n stepTransX = (saveTransform[3,0,iLoop] - saveTransform[3,0,iLoop-1])/n stepTransY = (saveTransform[3,1,iLoop] - saveTransform[3,1,iLoop-1])/n stepTransZ = (saveTransform[3,2,iLoop] - saveTransform[3,2,iLoop-1])/n stepTransXRot = (saveTransformRot[3,0,iLoop] - saveTransformRot[3,0,iLoop-1])/n stepTransYRot = (saveTransformRot[3,1,iLoop] - saveTransformRot[3,1,iLoop-1])/n stepTransZRot = (saveTransformRot[3,2,iLoop] - saveTransformRot[3,2,iLoop-1])/n stepLevel = (saveLevelVue[*,iLoop] - saveLevelVue[*,iLoop-1])/n stepOutput = (saveOutputNumber[iLoop] - saveOutputNumber[iLoop-1])/n istep = saveOutputNumber[iLoop-1] startOutput = saveOutputNumber[iLoop-1] stepXmin = (saveMeshIJKBoundaries[0,iLoop] - saveMeshIJKBoundaries[0,iLoop-1])/n stepXmax = (saveMeshIJKBoundaries[1,iLoop] - saveMeshIJKBoundaries[1,iLoop-1])/n stepYmin = (saveMeshIJKBoundaries[2,iLoop] - saveMeshIJKBoundaries[2,iLoop-1])/n stepYmax = (saveMeshIJKBoundaries[3,iLoop] - saveMeshIJKBoundaries[3,iLoop-1])/n stepZmin = (saveMeshIJKBoundaries[4,iLoop] - saveMeshIJKBoundaries[4,iLoop-1])/n stepZmax = (saveMeshIJKBoundaries[5,iLoop] - saveMeshIJKBoundaries[5,iLoop-1])/n if debug then begin print, " stepLevel= ", stepLevel print, " stepScale= ", stepScale print, " stepTransX,stepTransY,stepTransZ= ", stepTransX,stepTransY,stepTransZ print, " stepTransXRot,stepTransYRot,stepTransZRot= ", stepTransXRot,stepTransYRot,stepTransZRot print, " stepXmin,stepXmax = ", stepXmin, stepXmax print, " stepYmin,stepYmax = ", stepYmin, stepYmax print, " stepZmin,stepZmax = ", stepZmin, stepzmax endif Mx = saveTransformRot[0:2,0:2,iLoop] # INVERT(saveTransformRot[0:2,0:2,iLoop-1]) traceMx=TRACE(Mx) nx=0 & ny=0 & nz=0 & dPhi=0. if debug then print, " TRACE(Mx)= ", TRACE(Mx) if abs(traceMx) le 3. then begin Phi=ACOS( (traceMx-1.)/2.) if Phi ne 0. then begin dPhi= ( Phi/n )* 180. / !DPI Maxis=(Mx-TRANSPOSE(MX))/(2.*SIN(Phi)) nx= Maxis(1,2) ny= Maxis(2,0) nz= Maxis(0,1) if debug then begin print,'norm Mx=',norm(Mx,LNORM=0),norm(Mx,LNORM=1),norm(Mx,LNORM=2) print,'unitarity Mx=',transpose(Mx)#Mx print,'determinant Mx=',DETERM(Mx) print,'trace Mx=',traceMx print,'Phi=',Phi* 180. / !DPI print,'Maxis=',Maxis print,'nx,ny,nz=',nx,ny,nz print,'dPhi=',dPhi endif endif endif else begin if debug then print,'Not good : TRACE(Mx)=',TRACE(Mx) end endif else begin start = movieStart endStep = movieEnd step = movieStep stepScale = 0 stepTransX = 0 stepTransY = 0 stepTransXRot = 0 stepTransYRot = 0 stepRotX = 0 stepRotY = 0 stepRotZ = 0 stepLevel = intarr(2) stepOutput = movieStep istep = fix(start) startOutput = istep stepXmin = 0 stepXmax = 0 stepYmin = 0 stepYmax = 0 stepZmin = 0 stepZmax = 0 dphi = 0 endelse if stepXmin ne 0 OR stepXmax ne 0 OR stepYmin ne 0 OR stepYmax ne 0 OR stepZmin ne 0 OR stepZmax ne 0 then $ changeBoundaries = 1 if debug then begin print, "start = ", start print, "endStep = ", endStep print, "step = ", step print, "stepScale = ", stepScale print, "stepTransX = ", stepTransX print, "stepTransY = ", stepTransY print, "stepRotX = ", stepRotX print, "stepRotY = ", stepRotY print, "stepRotZ = ", stepRotZ print, "stepLevel = ", stepLevel print, "stepOutput = ", stepOutput print, "istep = ", istep print, "begin jLoop : start,endStep,step= ", start,endStep,step endif FOR jLoop=start,endStep,step DO BEGIN if debug then print, " jLoop = ", jLoop if iloop eq 1 and jloop eq 1 and sequence eq 1 then begin if iflag_vue[3] eq 1 then printf,u1,'OBJECT: GEO ','BOUNDARIES' if iflag_vue[0] eq 4 then printf,u1,'OBJECT: DATA','ISOSURFACE' if iflag_vue[0] eq 5 then printf,u1,'OBJECT: DATA','VOLUME' endif SimuStepOutput=istep if debug then begin help,SimuStepOutput print,'istep=',istep print,'SimuStepOutput=',SimuStepOutput endif IF DataFormat eq 1 then begin ; HERACLES binary WIDGET_CONTROL, sState.wStepField, SET_VALUE=SimuStepOutput ENDIF ELSE IF DataFormat eq 2 THEN BEGIN ; HDF5 WIDGET_CONTROL, sState.wStepFieldHDF, SET_VALUE=SimuStepOutput ENDIF ELSE IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES WIDGET_CONTROL, sState.wRamsesConfig[0], SET_VALUE=SimuStepOutput ENDIF ELSE IF DataFormat EQ 4 THEN BEGIN ;;; ASH BoB result=sState.oData_AshFilePath->GetData(path) if debug then print,'path=',path len=strlen(path) filename=AshFileName[0,0] step=strmid(filename,len) begstep=strmid(step,0,7) endstep=strmid(step,7) intstep=fix(begstep,type=7) curstep=strcompress(string(fix(istep,type=3)),/remove_all) if istep lt 10 then curstep='000000'+curstep if istep ge 10 and istep lt 100 then curstep='000000'+curstep if istep ge 100 and istep lt 1000 then curstep='00000'+curstep if istep ge 1000 and istep lt 10000 then curstep='0000'+curstep if istep ge 10000 and istep lt 100000 then curstep='00'+curstep if istep ge 100000 and istep lt 1000000 then curstep='0'+curstep if istep gt 1000000 then print,'unforeseen case in MOVIE DATA PREPARATION' fullcurstep=path+curstep+endstep if debug then begin print,'step=',step print,'begstep=',begstep print,'endstep=',endstep print,'intstep=',intstep print,'istep=',istep print,'curstep=',curstep print,'fullcurstep=',fullcurstep endif AshFileName[0,0]=fullcurstep result=sState.oData_AshFileName->SetData(AshFileName) ENDIF ELSE IF DataFormat eq 5 THEN BEGIN WIDGET_CONTROL, sState.wJupiterConfig[0], SET_VALUE=SimuStepOutput ENDIF result=sState.oData_SimuStepOutput->SetData(SimuStepOutput) if debug then print,'Test istep=',istep if debug then print,'Test SimuStepOutput_current=',SimuStepOutput_current if iflag_vue[0] EQ 4 OR iflag_vue[0] EQ 5 then begin update=0 if DataFormat ne 4 and istep ne SimuStepOutput_current then update=1 if DataFormat eq 4 and AshFileName[0,0] ne AshFileName_current[0,0] then update=1 if update eq 1 then begin print,'LoadData' dum=LoadData(sState) if DataFormat ne 4 then SimuStepOutput_current=SimuStepOutput if DataFormat eq 4 then AshFileName_current=AshFileName if sequence eq 1 then begin printf,u1,'OUTPUT' printf,u1,SimuStepOutput,FORMAT='(" ",I10)' endif endif if changeBoundaries gt 0 then begin print,'LoadData' dum=LoadData(sState) if sequence eq 1 then begin printf,u1,'MESHIJKBOUNDARIES' printf,u1,AmrLevels(0:1),MeshIJKBoundaries,FORMAT='(" ",2(1x,I3),6(1x,f10.7))' endif endif endif if changeBoundaries eq 2 then changeBoundaries = 0 if iflag_vue[0] EQ 4 OR iflag_vue[0] EQ 5 then begin if update eq 1 OR changeBoundaries gt 0 then begin print,'call UpdateTheViews' dum=UpdateTheViews(sState,0) endif endif ;;; handling of AMR sequence (Yncia Fidaali) ; IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES result = sState.oData_RamsesAmrLevelsArrays->GetData(RamsesAmrLevelsArrays) result = sState.oData_RamsesAmrLevelsColors->GetData(RamsesAmrLevelsColors) result = sState.oData_RamsesAmrLevelsAlpha->GetData(RamsesAmrLevelsAlpha) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_wRamsesAmrLevelsArrays->GetData(wRamsesAmrLevelsArrays) result = sState.oData_AMRoctreeGrid->GetData(grid) result = sState.oData_AMRMeshIJKboundaries->GetData(MeshIJKboundaries) result = sState.oData_Polylines->GetData(polylines) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) result = sState.oData_AMRoctreeCurrent->GetData(AMRoctreeCurrent) if AMRoctreeCurrent[0] ne -1 then begin if MovieFrameCURRENT gt 0 then begin if is3DModelDrawn eq 1 then begin oAmrModel3D[MovieFrameCURRENT-1]->SetProperty,HIDE=1 sState.oMovieModel->Add,oAmrModel3D[MovieFrameCURRENT] endif else begin oAmrModel2D[MovieFrameCURRENT-1]->SetProperty,HIDE=1 sState.oMovieModel->Add,oAmrModel2D[MovieFrameCURRENT] endelse endif ;sState.oAmrModel3D[MovieFrameCURRENT]=OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) Model3D = oAmrModel3D[MovieFrameCURRENT] Model2D = oAmrModel2D[MovieFrameCURRENT] for i=0, grid.nlevelmax-1 do RamsesAmrLevelsFlags[i] = 0 if save eq 1 then ind_poly = MovieFrameCURRENT else ind_poly = 0 drawTheAmrGeometry, grid, Model3D, Model2D, $ RamsesAmrLevelsArrays, MeshIJKboundaries, $ polylines,ind_poly, polylinesPlanes, $ RamsesAmrLevelsColors, RamsesAmrLevelsAlpha, RamsesAmrLevelsFlags, $ is3DModelDrawn, planesSelected if is3DModelDrawn eq 1 then oAmrModel3D[MovieFrameCURRENT] = Model3D $ else oAmrModel2D[MovieFrameCURRENT] = Model2D result = sState.oData_RamsesAmrLevelsFlags->SetData(RamsesAmrLevelsFlags) if is3DModelDrawn eq 1 then begin result = sState.oData_Polylines->SetData(polylines) result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) endif else begin result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) endelse result = sState.oData_RamsesAmrLevelsArrays->SetData(RamsesAmrLevelsArrays) endif ENDIF if jLoop ne start then begin if debug then begin print,' TEST 2 (jLoop)' print,' jLoop :',jLoop,' stepScale=',stepScale,' dPhi=',dPhi,$ ' stepTrans=', stepTransX, stepTransY,' stepTransRot=', stepTransXRot, stepTransYRot print,' iLoop :',iLoop print,' -> saveTranslatePivotVue[iLoop-1]=',saveTranslatePivotVue[iLoop-1] print,' -> saveTranslatePivotVue[iLoop] =',saveTranslatePivotVue[iLoop] endif nstep=0 if stepscale ne 0. then begin nstep=nstep+1 sState.oModel3D->GetProperty, TRANSFORM = transform transform[0,0] += stepScale transform[1,1] += stepScale transform[2,2] += stepScale sState.oModel3D->SetProperty, TRANSFORM = transform if debug then print,' ===>>> Scale oModel3D !!!' endif if stepTransX ne 0. or stepTransY ne 0. or stepTransZ ne 0. then begin nstep=nstep+1 sState.oModel3D->Translate, stepTransX, stepTransY, stepTransZ if debug then print,' ===>>> Translate oModel3D !!!' endif if stepTransXRot ne 0. or stepTransYRot ne 0. or stepTransZRot ne 0. then begin nstep=nstep+1 if debug then print,' ===>>> Translate oRotationModel3D !!!' sState.oRotationModel3D->Translate, stepTransXRot, stepTransYRot, stepTransZRot endif if Phi ne 0. then begin nstep=nstep+1 sState.oRotationModel3D->Rotate,[nx,ny,nz],dPhi , /PREMULTIPLY if debug then print,' ===>>> Rotate oRotationModel3D !!!' endif if sequence eq 1 and nstep gt 0 then begin printf,u1,nstep, FORMAT='("STEP: ",i1)' if Phi ne 0. then begin printf,u1,nx,ny,nz,dPhi, FORMAT='(" rotation ",4(1x,f15.7))' endif if stepscale ne 0. then begin printf,u1,stepScale, FORMAT='(" scaling ",1(1x,f15.7))' endif if stepTransX ne 0. or stepTransY ne 0. then begin printf,u1,stepTransX, stepTransY, 0, FORMAT='(" translation ",3(1x,f15.7))' endif if stepTransXRot ne 0. or stepTransYRot ne 0. or stepTransZRot ne 0. then begin printf,u1,stepTransXRot, stepTransYRot, 0,FORMAT='(" translationR",3(1x,f15.7))' endif endif endif IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES result = sState.oData_MeshIJKBoundaries->GetData(MeshIJKBoundaries) MeshIJKNotRound[0] += stepXmin MeshIJKNotRound[1] += stepXmax MeshIJKNotRound[2] += stepYmin MeshIJKNotRound[3] += stepYmax MeshIJKNotRound[4] += stepZmin MeshIJKNotRound[5] += stepZmax for i=0,5 do begin MeshIJKBoundaries[i] = MeshIJKNotRound[i] MeshIJKBoundaries[i] *= 100 MeshIJKBoundaries[i] = float(ROUND(MeshIJKBoundaries[i]) ) MeshIJKBoundaries[i] /= 100 endfor result = sState.oData_MeshIJKBoundaries->SetData(MeshIJKBoundaries) result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) result=sState.oData_AmrLevels->GetData(AmrLevels) AmrLevels[2] = AmrLevels[2] + stepLevel[0] AmrLevels[3] = AmrLevels[3] + stepLevel[1] AmrLevels[0] = fix(AmrLevels[2]) AmrLevels[1] = fix(AmrLevels[3]) result=sState.oData_AmrLevels->SetData(AmrLevels) ENDIF if debug then print,'call SDvis_Draw from startMovie_preparation' SDvis_Draw, sState if save eq 1 then MovieFrameCURRENT=MovieFrameCURRENT+1 result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) lastOutput = fix(istep) istep = istep+stepOutput ENDFOR if save eq 1 then begin MovieFrameCURRENT=firstMovieFrameCURRENT result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) istep = startOutput FOR jLoop=start,endStep,step DO BEGIN istep = istep+stepOutput IF iflag_vue[0] EQ 4 THEN BEGIN if debug then print,'isosurface istep,MovieFrameCURRENT=',fix(istep),MovieFrameCURRENT sState.oPolygon[0,0,MovieFrameCURRENT]->GetProperty,Data=vertices sState.oPolygon[0,0,MovieFrameCURRENT]->SetProperty,HIDE=0 help,vertices ENDIF ELSE IF iflag_vue[0] EQ 5 THEN BEGIN oVolume[MovieFrameCURRENT]->SetProperty,HIDE=0 ENDIF IF DataFormat EQ 3 AND save eq 1 THEN begin if is3DModelDrawn eq 1 then oAmrModel3D[MovieFrameCURRENT]->SetProperty,HIDE=0 $ else oAmrModel2D[MovieFrameCURRENT]->SetProperty,HIDE=0 endif result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) MovieFrameCURRENT=MovieFrameCURRENT+1 result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) ENDFOR endif endfor IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES sState.oMovieModel->SetProperty, RENDER_METHOD=1 sState.oObserver->SetProperty, oIMAGES=sState.oMovieModel ENDIF if sequence eq 1 then begin printf,u1,'END' close,u1 endif end ; ----------------------------------------------------------------------------- ;************************************************************************************************ ;************************************************************************************************ ;************************************************************************************************ ;+ ; NAME : ; START_OBJECTS_STREAM_PREPARATION ; ; PURPOSE : ; preparation and playing of a stream of objects allowing for interactive navigation ; ; MODIFICATION HISTORY : ; january-june 2007 : prepare/save/restore sequence of objects (D. Pomarède) ; ; INPUTS : ; sState : main memory structure of SDvision ; pro start_Objects_Stream_preparation, sState, save print,'Objects stream preparation' WIDGET_CONTROL, sState.wDefineMovieStart, GET_VALUE=movieStart WIDGET_CONTROL, sState.wDefineMovieEnd, GET_VALUE=movieEnd WIDGET_CONTROL, sState.wDefineMovieStep, GET_VALUE=movieStep print,'MOVIE movieStart,movieEnd,movieStep=',movieStart,movieEnd,movieStep result=sState.oData_MovieFrameNMAX->GetData(MovieFrameNMAX) result=sState.oData_DataFormat->GetData(DataFormat) MovieFrameCURRENT=0 result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) result=sState.oData_vue->GetData(iflag_vue) ;IF DataFormat eq 3 THEN BEGIN ; nb_steps = (movieEnd - movieStart)/movieStep +1 ; result=sState.oData_Polylines->GetData(polylines) ; help, polylines ; result = CONGRID(polylines, FIX(nb_steps), 14) ; ENDIF FOR istep=movieStart,movieEnd,movieStep DO BEGIN IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES WIDGET_CONTROL, sState.wRamsesConfig[0], SET_VALUE=istep ENDIF ELSE IF DataFormat EQ 4 THEN BEGIN ;;; ASH BoB result=sState.oData_AshFileName->GetData(AshFileName) result=sState.oData_AshFilePath->GetData(path) print,'path=',path len=strlen(path) filename=AshFileName[0,0] step=strmid(filename,len) print,'step=',step begstep=strmid(step,0,7) print,'begstep=',begstep endstep=strmid(step,7) print,'endstep=',endstep intstep=fix(begstep,type=7) print,'intstep=',intstep curstep=strcompress(string(istep),/remove_all) if istep lt 10 then curstep='000000'+curstep if istep ge 10 and istep lt 100 then curstep='000000'+curstep if istep ge 100 and istep lt 1000 then curstep='00000'+curstep if istep ge 1000 and istep lt 10000 then curstep='0000'+curstep if istep ge 10000 and istep lt 100000 then curstep='00'+curstep if istep ge 100000 and istep lt 1000000 then curstep='0'+curstep if istep gt 1000000 then print,'unforeseen case in MOVIE DATA PREPARATION' print,'curstep=',curstep fullcurstep=path+curstep+endstep print,'fullcurstep=',fullcurstep AshFileName[0,0]=fullcurstep result=sState.oData_AshFileName->SetData(AshFileName) END result=sState.oData_SimuStepOutput->SetData(istep) IF iflag_vue[0] EQ 4 THEN BEGIN i=0 j=0 k=MovieFrameCURRENT IF k GE 1 THEN BEGIN IF OBJ_VALID(sState.oPolygon[i,j,k-1]) EQ 1 THEN $ sState.oPolygon[i,j,k-1]->SetProperty,HIDE=1 ENDIF IF OBJ_VALID(sState.oPolygon[i,j,k]) EQ 0 THEN BEGIN sState.oPolygon[i,j,k]=OBJ_NEW('IDLgrPolygon',Color=[0,0,205], $ Shading=1,ALPHA_CHANNEL=1.,/REGISTER_PROPERTIES) help, sState.oPolygon[i,j,k] sState.oModelPolygon->Add,sState.oPolygon[i,j,k] ;,/ALIAS ENDIF ENDIF IF iflag_vue[0] EQ 5 THEN BEGIN k=MovieFrameCURRENT IF k GE 1 THEN BEGIN IF OBJ_VALID(sState.oVolume[k-1]) EQ 1 THEN $ sState.oVolume[k-1]->SetProperty,HIDE=1 ENDIF IF OBJ_VALID(sState.oVolume[k]) EQ 0 THEN BEGIN composite_function=1 IF DataFormat eq 4 THEN BEGIN composite_function=0 ;;; ASH ENDIF sState.oVolume[0]->GetProperty,RGB_TABLE0=vColors,OPACITY_TABLE0=oColors,RENDER_STEP=render_step sState.oVolume[k]=OBJ_NEW('IDLgrVolume',HIDE=0,ALPHA_CHANNEL=1.,ZERO_OPACITY_SKIP=1,/ZBUFFER, $ RGB_TABLE0=vColors,OPACITY_TABLE0=oColors,HINTS=2,COMPOSITE_FUNCTION=composite_function,/NO_COPY,$ RENDER_STEP=render_step,/REGISTER_PROPERTIES,DESCRIPTION='volume object') sState.oModelVolume->Add,sState.oVolume[k] help, sState.oVolume[k] ENDIF ENDIF dum=LoadData(sState) if iflag_vue[0] EQ 4 OR iflag_vue[0] EQ 5 then dum=DrawTheVolume(sState) ;;; handling of AMR sequence (Yncia Fidaali) ; IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES result = sState.oData_RamsesAmrLevelsArrays->GetData(RamsesAmrLevelsArrays) result = sState.oData_RamsesAmrLevelsColors->GetData(RamsesAmrLevelsColors) result = sState.oData_RamsesAmrLevelsAlpha->GetData(RamsesAmrLevelsAlpha) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_wRamsesAmrLevelsArrays->GetData(wRamsesAmrLevelsArrays) result = sState.oData_Grid->GetData(grid) result = sState.oData_AMRMeshIJKboundaries->GetData(MeshIJKboundaries) result = sState.oData_Polylines->GetData(polylines) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) if MovieFrameCURRENT gt 0 then begin if is3DModelDrawn eq 1 then begin oAmrModel3D[MovieFrameCURRENT-1]->SetProperty,HIDE=1 sState.oMovieModel->Add,oAmrModel3D[MovieFrameCURRENT] endif else begin oAmrModel2D[MovieFrameCURRENT-1]->SetProperty,HIDE=1 sState.oMovieModel->Add,oAmrModel2D[MovieFrameCURRENT] end endif ;sState.oAmrModel3D[MovieFrameCURRENT]=OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) Model3D = oAmrModel3D[MovieFrameCURRENT] Model2D = oAmrModel2D[MovieFrameCURRENT] for i=0, grid.nlevelmax-1 do RamsesAmrLevelsFlags[i] = 0 if save eq 1 then ind_poly = MovieFrameCURRENT else ind_poly = 0 drawTheAmrGeometry, grid, Model3D, Model2D, $ RamsesAmrLevelsArrays, MeshIJKboundaries, $ polylines,ind_poly, polylinesPlanes, $ RamsesAmrLevelsColors, RamsesAmrLevelsAlpha, RamsesAmrLevelsFlags, $ is3DModelDrawn, planesSelected if is3DModelDrawn eq 1 then oAmrModel3D[MovieFrameCURRENT] = Model3D $ else oAmrModel2D[MovieFrameCURRENT] = Model2D result = sState.oData_RamsesAmrLevelsFlags->SetData(RamsesAmrLevelsFlags) if is3DModelDrawn eq 1 then begin result = sState.oData_Polylines->SetData(polylines) result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) endif else begin result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) endelse result = sState.oData_RamsesAmrLevelsArrays->SetData(RamsesAmrLevelsArrays) ENDIF SDvis_Draw, sState MovieFrameCURRENT=MovieFrameCURRENT+1 result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) ENDFOR MovieFrameCURRENT=0 result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) FOR istep=movieStart,movieEnd,movieStep DO BEGIN IF iflag_vue[0] EQ 4 THEN BEGIN print,'isosurface istep,MovieFrameCURRENT=',istep,MovieFrameCURRENT sState.oPolygon[0,0,MovieFrameCURRENT]->GetProperty,Data=vertices sState.oPolygon[0,0,MovieFrameCURRENT]->SetProperty,HIDE=0 help,vertices ENDIF ELSE IF iflag_vue[0] EQ 5 THEN BEGIN sState.oVolume[MovieFrameCURRENT]->SetProperty,HIDE=0 END IF DataFormat EQ 3 AND save eq 1 THEN begin if is3DModelDrawn eq 1 then oAmrModel3D[MovieFrameCURRENT]->SetProperty,HIDE=0 $ else oAmrModel2D[MovieFrameCURRENT]->SetProperty,HIDE=0 result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) endif MovieFrameCURRENT=MovieFrameCURRENT+1 result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) ENDFOR print,'prepare movie' IF iflag_vue[0] EQ 4 THEN BEGIN sState.oModelPolygon->SetProperty, RENDER_METHOD=1 sState.oObserver->SetProperty, oIMAGES=sState.oModelPolygon ENDIF ELSE IF iflag_vue[0] EQ 5 THEN BEGIN sState.oModelVolume->SetProperty, RENDER_METHOD=1 sState.oObserver->SetProperty, oIMAGES=sState.oModelVolume ENDIF ELSE BEGIN IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES sState.oMovieModel->SetProperty, RENDER_METHOD=1 sState.oObserver->SetProperty, oIMAGES=sState.oMovieModel ENDIF ENDELSE print,'... ok' end ; ----------------------------------------------------------------------------- ; pro save_mpeg, sState WIDGET_CONTROL, /HOURGLASS mpegFlag=0 result=sState.oData_mpegFlag->SetData(mpegFlag) result=sState.oData_Mpeg->GetData(oMpeg) print,'save Mpeg to file ...' oMpeg->Save print,' ... done' end ; ; ----------------------------------------------------------------------------- pro PickFormat, sState result=sState.oData_DataFormat->GetData(DataFormat) if DataFormat eq 1 OR DataFormat eq 3 then begin WIDGET_CONTROL, sState.wOptionsArray, SENSITIVE=1 WIDGET_CONTROL, sState.wHeaderFileBase, SENSITIVE=0 WIDGET_CONTROL, sState.wLoadButton, SENSITIVE=1 WIDGET_CONTROL, sState.wOutputReprise, SENSITIVE=0 endif else if DataFormat eq 2 then begin WIDGET_CONTROL, sState.wOptionsArray, SENSITIVE=0 WIDGET_CONTROL, sState.wHeaderFileBase, SENSITIVE=1 WIDGET_CONTROL, sState.wLoadButton, SENSITIVE=0 WIDGET_CONTROL, sState.wOutputReprise, SENSITIVE=1 endif else if DataFormat eq 6 then begin ;;; GRAFIC WIDGET_CONTROL, sState.wLoadButton, SENSITIVE=1 endif if DataFormat eq 1 then begin ; HERACLES binary VectorFieldScale=1.4e-5 result=sState.oData_VectorFieldScale->SetData(VectorFieldScale) WIDGET_CONTROL, sState.wVectorFieldScale, SET_VALUE=VectorFieldScale WIDGET_CONTROL, sState.wPickLoadBase[1], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[3], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[2], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[4], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[5], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[6], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[0], MAP=1 SimuStepOutput=3;6;25 result=sState.oData_SimuStepOutput->SetData(SimuStepOutput) WIDGET_CONTROL, sState.wStepField, SET_VALUE=SimuStepOutput ScalarLinLog=1 result=sState.oData_ScalarLinLog->SetData(ScalarLinLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = ScalarLinLog endif else if DataFormat eq 2 then begin VectorFieldScale=1.e18;1.4e-5 result=sState.oData_VectorFieldScale->SetData(VectorFieldScale) WIDGET_CONTROL, sState.wVectorFieldScale, SET_VALUE=VectorFieldScale WIDGET_CONTROL, sState.wPickLoadBase[0], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[1], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[3], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[4], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[5], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[6], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[2], MAP=1 ;SimuStepOutput=25 ;result=sState.oData_SimuStepOutput->SetData(SimuStepOutput) WIDGET_CONTROL, sState.wStepField, SET_VALUE=SimuStepOutput ScalarLinLog=1 result=sState.oData_ScalarLinLog->SetData(ScalarLinLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = ScalarLinLog endif else if DataFormat eq 3 then begin ;RAMSES VectorFieldScale=60. result=sState.oData_VectorFieldScale->SetData(VectorFieldScale) WIDGET_CONTROL, sState.wVectorFieldScale, SET_VALUE=VectorFieldScale WIDGET_CONTROL, sState.wPickLoadBase[0], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[2], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[3], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[4], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[5], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[6], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[1], MAP=1 SimuStepOutput=170; 1 ;170 ;print,'oData_SimuStepOutput->Set ',SimuStepOutput result=sState.oData_SimuStepOutput->SetData(SimuStepOutput) WIDGET_CONTROL, sState.wRamsesConfig[0], SET_VALUE=SimuStepOutput ScalarLinLog=1 result=sState.oData_ScalarLinLog->SetData(ScalarLinLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = ScalarLinLog endif else if DataFormat eq 4 then begin ;;; ASH bob VectorFieldScale=1. ; e-1 result=sState.oData_VectorFieldScale->SetData(VectorFieldScale) WIDGET_CONTROL, sState.wVectorFieldScale, SET_VALUE=VectorFieldScale WIDGET_CONTROL, sState.wPickLoadBase[0], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[1], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[2], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[4], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[5], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[6], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[3], MAP=1 WIDGET_CONTROL,sState.wVolumeOptions[2],SET_DROPLIST_SELECT=0 ;;;oVolume->SetProperty, COMPOSITE_FUNCTION=0 ScalarLinLog=0 result=sState.oData_ScalarLinLog->SetData(ScalarLinLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = ScalarLinLog endif else if DataFormat eq 5 then begin ;;; JUPITER VectorFieldScale=1. result=sState.oData_VectorFieldScale->SetData(VectorFieldScale) WIDGET_CONTROL, sState.wVectorFieldScale, SET_VALUE=VectorFieldScale WIDGET_CONTROL, sState.wPickLoadBase[0], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[1], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[2], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[3], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[5], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[6], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[4], MAP=1 SimuStepOutput=42 ; 80 ;print,'oData_SimuStepOutput->Set ',SimuStepOutput result=sState.oData_SimuStepOutput->SetData(SimuStepOutput) WIDGET_CONTROL, sState.wJupiterConfig[0], SET_VALUE=SimuStepOutput ScalarLinLog=1 result=sState.oData_ScalarLinLog->SetData(ScalarLinLog) WIDGET_CONTROL, sState.wScalarLinLog, SET_DROPLIST_SELECT = ScalarLinLog endif else if DataFormat eq 6 then begin ;;; GRAFIC WIDGET_CONTROL, sState.wPickLoadBase[0], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[1], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[2], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[3], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[4], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[6], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[5], MAP=1 endif else if DataFormat eq 10 then begin ;;; ENZO/JAQUES WIDGET_CONTROL, sState.wLoadButton, SENSITIVE=1 widget_control, sState.wPickFormatList, set_droplist_select=6 WIDGET_CONTROL, sState.wPickLoadBase[0], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[1], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[2], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[3], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[4], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[5], MAP=0 WIDGET_CONTROL, sState.wPickLoadBase[6], MAP=1 endif sequence=lonarr(3) IF DataFormat EQ 3 THEN BEGIN ;;; RAMSES sequence[0]=1 sequence[1]=30 sequence[2]=3 ENDIF ELSE IF DataFormat EQ 4 THEN BEGIN ;;; ASH BoB sequence[0]=0600150 sequence[1]=0603150 sequence[2]=1500 END WIDGET_CONTROL,sState.wDefineMovieStart,SET_VALUE=sequence[0] WIDGET_CONTROL,sState.wDefineMovieEnd, SET_VALUE=sequence[1] WIDGET_CONTROL,sState.wDefineMovieStep, SET_VALUE=sequence[2] IF DataFormat EQ 4 THEN BEGIN ;;; ASH BoB datanames=' ' result=sState.oData_datanames->SetData(datanames) ENDIF end ; ; ----------------------------------------------------------------------------- ; ; Purpose: Event handler ; ; MODIFICATION HISTORY: ; Written by: Daniel Pomarède, 2005. ; May, 2007: subvolume events added by Yncia Fidaali ; June, 2007: AMR events added by Yncia Fidaali ; April, 2008: Jacques interface event by Tom Abel ;- pro SDvis_Event, $ sEvent ; IN: event structure ;help, sEvent,/struct ;print, 'sEvent=',sEvent ; print, 'sEvent.top=', sEvent.top ; print, 'sEvent.id=', sEvent.id ; print, 'TAG_NAMES(sEvent, /STRUCTURE_NAME) = ', TAG_NAMES(sEvent, /STRUCTURE_NAME) ; Quit the application using the close box. ; if (TAG_NAMES(sEvent, /STRUCTURE_NAME) EQ $ 'WIDGET_KILL_REQUEST') then begin WIDGET_CONTROL, sEvent.top, /DESTROY RETURN endif IF (TAG_NAMES(sEvent, /STRUC) eq 'WIDGET_TIMER') THEN BEGIN print,'timer' WIDGET_CONTROL, sEvent.top, GET_UVALUE=sState WIDGET_CONTROL, sState.wTopBase, TIMER=.1 return ENDIF ; if (TAG_NAMES(sEvent, /STRUCTURE_NAME) EQ $ ; 'WIDGET_KBRD_FOCUS') then begin ; print,'keyboard event !' ; RETURN ; endif ;; if (TAG_NAMES(sEvent, /STRUCTURE_NAME) EQ 'WIDGET_BASE') then begin ;pad = 4 ; Estimate. ;xsize = sEvent.x - pad ;ysize = sEvent.y - pad ;print,'xsize,ysize=',xsize,ysize ;; RETURN ;; endif ; Get the info structure from top-level base. ; WIDGET_CONTROL, sEvent.top, GET_UVALUE=sState, /NO_COPY ;print,'Get the info structure from top-level base' ;help,sState.oPolygon[0,0] ; this is a patch : sState.GeoStructure is not updated correctly in DataReductionEvent ; ... to be understood ; result=sState.oData_DataReduction->GetData(DataReduction) if DataReduction eq 1 then begin result=sState.oData_GridDim->GetData(GridDim) sState.GeoStructure.nxg=GridDim[0] sState.GeoStructure.nyg=GridDim[1] sState.GeoStructure.nzg=GridDim[2] endif ; Determine which event. ; WIDGET_CONTROL, sEvent.id, GET_UVALUE=eventval ;print,'eventval=',eventval ; resize the widget ; ;print,'TAG_NAMES(sEvent, /STRUCTURE_NAME)=',TAG_NAMES(sEvent, /STRUCTURE_NAME) if (TAG_NAMES(sEvent, /STRUCTURE_NAME) EQ 'WIDGET_BASE') then begin Geometry=WIDGET_INFO(sState.wTopBase, /GEOMETRY) srcx=Geometry.SCR_XSIZE srcy=Geometry.SCR_YSIZE result=sState.oData_xydim->GetData(xydim) ;print,'Geometry srcx,srcy=',srcx,srcy xpad=xydim[2] ypad=xydim[3] ;print,'xpad,ypad=',xpad,ypad ;print,'sEvent.x,sEvent.y=',sEvent.x,sEvent.y ;pad = 0;4 ; Estimate. xsize = sEvent.x - xpad ysize = sEvent.y - ypad if ysize lt 10 then ysize=10 if xsize lt 10 then xsize=10 ;print,'xsize,ysize=',xsize,ysize xydim[0]=xsize xydim[1]=ysize result=sState.oData_xydim->SetData(xydim) ;WIDGET_CONTROL, .wXSizeEditBase, SET_VALUE=xydim[0] ;WIDGET_CONTROL, .wYSizeEditBase, SET_VALUE=xydim[1] ;WIDGET_CONTROL, sState.wDraw1 , XSIZE=xydim[0], YSIZE=xydim[1] WIDGET_CONTROL, sState.wDraw3D, XSIZE=xydim[0], YSIZE=xydim[1] scale_factor=1.*xydim[1]/xydim[0] ;print,'scale_factor=',scale_factor sState.oResizeableModel3D->Reset sState.oResizeableModel3D->Scale,scale_factor,1.,1. ;sState.drawWindowID1->SetProperty,DIMENSIONS=xydim[0:1] sState.oTrackL->Reset,[xydim[0]/2.0, xydim[1]/2.0], xydim[0]/2.0, MOUSE=1 sState.oTrackM->Reset,[xydim[0]/2.0, xydim[1]/2.0], xydim[0]/2.0, MOUSE=2 sState.oTrackR->Reset,[xydim[0]/2.0, xydim[1]/2.0], xydim[0]/2.0, MOUSE=4 scaleText=[0.069,0.025,0.04] for i=0,2 do begin sState.oSceneText[i]->GetProperty,xcoord_conv=xcoord_conv xcoord_conv[1]=scaleText[i]*scale_factor sState.oSceneText[i]->SetProperty,xcoord_conv=xcoord_conv endfor SDvis_Draw, sState Geometry=WIDGET_INFO(sState.wTopBase, /GEOMETRY) srcx=Geometry.SCR_XSIZE srcy=Geometry.SCR_YSIZE result=sState.oData_xydim->GetData(xydim) ;print,'New Geometry srcx,srcy=',srcx,srcy WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY RETURN endif ;help, sState ;print, 'eventval=',eventval iflag = 0 result=sState.oData_vue->GetData(iflag_vue) ;result=sState.oData_DataFormat->GetData(DataFormat) ;if DataFormat eq 2 then begin ; result=sState.oData_datanames->GetData(datanames) ; size_datanames=size(datanames,/DIMENSIONS) ; s=fix(size_datanames[0]) ; result=sState.oData_DataDimHDF->GetData(fourdim) ; result=sState.oData_GridDim->GetData(GridDim) ; nz=GridDim(2)*1L ; nvar=s ; for i=0,nvar-1 do begin ; if eventval EQ 'PICKVAR_'+datanames[i] then begin ; sState.zTitleObj->SetProperty, STRINGS=datanames[i] ; sState.yTitlePlot->SetProperty, STRINGS=datanames[i] ; ;print, 'case =',datanames[i] ; iflag_var= -(i+1) ; result=sState.oData_flag->SetData(iflag_var) ; if fourdim[i] eq 1 then begin ; dum=ShowScalarField(sState) ; sState.oImage->SetProperty,HIDE=0 ; WIDGET_CONTROL, sState.wDraw2, SENSITIVE=1 ; endif else if fourdim[i] eq 3 and nz eq 1 then begin ; print,'test' ; dum=Show2DVectorField(sState) ; sState.oVectorField2D->SetProperty,HIDE=0 ; sState.oStreamlines2D->SetProperty,HIDE=0 ; result=sState.oData_vue->GetData(iflag_vue) ; iflag_vue[1] = 3 ; result=sState.oData_vue->SetData(iflag_vue) ; endif else if fourdim[i] eq 0 then begin ; dum=ShowParticles(sState) ; sState.oParticles->SetProperty,HIDE=0 ; endif else begin ; dum=ShowVectorField(sState) ; sState.oVectorField->SetProperty,HIDE=0 ; sState.oStreamlines->SetProperty,HIDE=0 ; ;result=sState.oData_vue->GetData(iflag_vue) ; ;iflag_vue[1] = 1 ; ;result=sState.oData_vue->SetData(iflag_vue) ; endelse ; WIDGET_CONTROL, /HOURGLASS ; dum=UpdateTheViews(sState,1) ; GOTO, SKIPEVENT ; endif ; endfor ; ;endif ; DataFormat eq 2 ; Object control events ; if strcmp(eventval,'GENERATE_',9) or strcmp(eventval,'DISPLAY_',8) or strcmp(eventval,'CONFIGURE_',10) then begin WIDGET_CONTROL, /HOURGLASS ObjectControlEvent,sState,eventval,sEvent GOTO, SKIPEVENT endif ; Geometry Object control events ; if strcmp(eventval,'GEO_GENERATE_',13) or strcmp(eventval,'GEO_DISPLAY_',12) or strcmp(eventval,'GEO_CONFIGURE_',14) then begin WIDGET_CONTROL, /HOURGLASS GeometryObjectControlEvent,sState,eventval,sEvent GOTO, SKIPEVENT endif ; Color and Opacity tables events ; if strcmp(eventval,'COT',3) then begin ;print,'Color and Opacity tables event' WIDGET_CONTROL, /HOURGLASS ColorAndOpacityTablesEvent,sState,eventval,sEvent GOTO, SKIPEVENT endif for i=0, 22 do begin if strcmp(eventval, 'AMR_ARRAYS_'+String(i))then begin result = sState.oData_RamsesAmrLevelsArrays->GetData(RamsesAmrLevelsArrays) result = sState.oData_RamsesAmrLevelsColors->GetData(RamsesAmrLevelsColors) result = sState.oData_RamsesAmrLevelsAlpha->GetData(RamsesAmrLevelsAlpha) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_wRamsesAmrLevelsArrays->GetData(wRamsesAmrLevelsArrays) result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) WIDGET_CONTROL, wRamsesAmrLevelsArrays[i], GET_VALUE=index RamsesAmrLevelsArrays[i] = index result=sState.oData_AMRoctreeGrid->GetData(grid) result=sState.oData_AMRMeshIJKboundaries->GetData(MeshIJKboundaries) result=sState.oData_Polylines->GetData(polylines) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) Model3D = oAmrModel3D[0] Model2D = oAmrModel2D[0] drawTheAmrGeometry, grid, Model3D, Model2D, $ RamsesAmrLevelsArrays, MeshIJKboundaries, $ polylines,0, polylinesPlanes, $ RamsesAmrLevelsColors, RamsesAmrLevelsAlpha, RamsesAmrLevelsFlags, $ is3DModelDrawn, planesSelected oAmrModel3D[0] = Model3D oAmrModel2D[0] = Model2D result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) result = sState.oData_RamsesAmrLevelsFlags->SetData(RamsesAmrLevelsFlags) result = sState.oData_Polylines->SetData(polylines) result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsArrays->SetData(RamsesAmrLevelsArrays) sState.drawWindowID3D->Draw, sState.oView3D WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY return endif if strcmp(eventval, 'CHOOSE_ALPHA_'+String(i)) then begin WIDGET_CONTROL, /HOURGLASS result = sState.oData_wRamsesAmrLevelsAlpha->GetData(wRamsesAmrLevelsAlpha) result = sState.oData_Polylines->GetData(polylines) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsAlpha->GetData(alphaTab) WIDGET_CONTROL, wRamsesAmrLevelsAlpha[i], GET_VALUE=alpha alphaTab[i] = alpha polylines[0,i]->SetProperty, ALPHA_CHANNEL= alphaTab[i]/100. for j = 0, 5 do polylinesPlanes[0,j,i]->SetProperty, ALPHA_CHANNEL= alphaTab[i]/100. result = sState.oData_Polylines->SetData(polylines) result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsAlpha->SetData(alphaTab) sState.drawWindowID3D->Draw, sState.oView3D WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY return endif if strcmp(eventval, 'CHOOSE_COLOR_'+String(i)) then begin result = sState.oData_RamsesAmrLevelsColors->GetData(RamsesAmrLevelsColors) result=sState.oData_Polylines->GetData(polylines) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) RamsesAmrLevelsColors[i] = WIDGET_INFO(sEvent.id, /DROPLIST_SELECT) for j = 0, 5 do polylinesPlanes[0,j,i]->SetProperty, COLOR=chooseColor(RamsesAmrLevelsColors[i]) polylines[0,i]->SetProperty, COLOR=chooseColor(RamsesAmrLevelsColors[i]) result=sState.oData_Polylines->SetData(polylines) result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsColors->SetData(RamsesAmrLevelsColors) sState.drawWindowID3D->Draw, sState.oView3D WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY return endif endfor ; Take the following action based on the corresponding event. ; case eventval of 'DRAW': begin ;print,'DRAW sEvent.key=',sEvent.key result=sState.oData_wNavigationOptions->GetData(wNavigationOptions) Quality=WIDGET_INFO(sState.wQuality,/DROPLIST_SELECT) ;print,'draw quality=',Quality result=sState.oData_ImageToggle->GetData(ImageToggle) seedPickflag=WIDGET_INFO(sState.wSliceVecVs3DVec,/DROPLIST_SELECT ) EQ 2 AND $ WIDGET_INFO(sState.wSeedPickOptions[0],/DROPLIST_SELECT ) EQ 0 seedPickcontinuous=0 if seedPickflag then begin Location=make_array(2) Location[0]=sEvent.x & Location[1]=sEvent.y pickObject=sState.drawWindowID3D->PickData(sState.oView3D,sState.oRotationModel3D,Location,XYZLocation) WIDGET_CONTROL, sState.wSeedPickOptions[2], GET_VALUE=seedoptarray seedPickcontinuous=seedoptarray[0] eq 1 and pickObject eq 1 endif ;print, 'DRAW sEvent.type=', sEvent.type ; Expose. ; if (sEvent.type eq 4) then begin ;print, 'call SDvis_Draw Expose' SDvis_Draw, sState WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY RETURN endif result=sState.oData_DataFormat->GetData(DataFormat) qmat=make_array([4,4]) bHaveTransformL = sState.oTrackL->Update(sEvent, TRANSFORM=qmat ) if (bHaveTransformL NE 0) then begin ;print,'Left qmat=',qmat if iflag_vue[0] EQ 1 then begin sState.oRotationModel->GetProperty, TRANSFORM=t mt = t # qmat sState.oRotationModel->SetProperty,TRANSFORM=mt endif else begin if seedPickcontinuous eq 0 then begin sState.oRotationModel3D->GetProperty,TRANSFORM=t mt = t # qmat sState.oRotationModel3D->SetProperty,TRANSFORM=mt endif endelse endif ; Handle trackball update Middle Button (zoom) ; qmatM=make_array([4,4]) bHaveTransformM = sState.oTrackM->Update(sEvent, TRANSFORM=qmatM ) scaling=qmatM([1],[2]) ;qmatM([1],[0]) qscalex=1-scaling qscaley=1-scaling qscalez=1-scaling if (bHaveTransformM NE 0) then begin if iflag_vue[0] EQ 1 then begin sState.oScalingModel->Scale,qscalex,qscaley,qscalez , /PREMULTIPLY endif else begin mode=WIDGET_INFO(wNavigationOptions[9],/DROPLIST_SELECT) premultiply=WIDGET_INFO(wNavigationOptions[3],/DROPLIST_SELECT) if mode eq 0 then begin sState.oModel3D->Scale,qscalex,qscaley,qscalez,PREMULTIPLY=premultiply endif else begin qmovez=-scaling sState.oRotationModel3D->Translate,0.,0.,qmovez,PREMULTIPLY=premultiply end endelse endif ; Handle trackball update Right Button (translate) ; qmatR=make_array([4,4]) bHaveTransformR = sState.oTrackR->Update(sEvent, TRANSFORM=qmatR ) qmovex=qmatR([2],[0]) qmovey=qmatR([2],[1]) qmovez=0. if (bHaveTransformR NE 0) then begin if iflag_vue[0] EQ 1 then begin sState.oMovableModel->Translate,qmovex,qmovey,qmovez endif else begin WIDGET_CONTROL,wNavigationOptions[6],GET_VALUE=PivotControl if PivotControl[1] eq 0 then begin premultiply=WIDGET_INFO(wNavigationOptions[4],/DROPLIST_SELECT) sState.oModel3D->Translate,qmovex,qmovey,qmovez,PREMULTIPLY=premultiply endif else begin sState.oRotationModel3D->Translate,qmovex,qmovey,qmovez endelse endelse endif ;print,'sEvent.key=',sEvent.key ;help,sEvent,/struct ;;; Handle keyboard update (move forward/backward) ; if (sEvent.key EQ 9 OR sEvent.key EQ 10) and sEvent.PRESS then begin result=sState.oData_eye->GetData(eye) qmovex=0. qmovey=0. qmovez=0.05 * eye[0]/3. if (sEvent.key EQ 10) then qmovez=-qmovez sState.oRotationModel3D->Translate,qmovex,qmovey,qmovez SDvis_Draw, sState endif ;;; Handle keyboard update (move left/right) ; if (sEvent.key EQ 5 OR sEvent.key EQ 6) and sEvent.PRESS then begin result=sState.oData_eye->GetData(eye) qmovex=0.002 * (1.+eye[0])^0.1 qmovey=0. qmovez=0. if (sEvent.key EQ 6) then qmovex=-qmovex sState.oRotationModel3D->Translate,qmovex,qmovey,qmovez SDvis_Draw, sState endif ;;; Handle keyboard update (move up/down) ; if (sEvent.key EQ 7 OR sEvent.key EQ 8) and sEvent.PRESS then begin result=sState.oData_eye->GetData(eye) qmovex=0. qmovey=0.0008 * eye[0] qmovez=0. if (sEvent.key EQ 8) then qmovey=-qmovey sState.oRotationModel3D->Translate,qmovex,qmovey,qmovez SDvis_Draw, sState endif ; Button press. ; if (sEvent.type eq 0) then begin sState.btndown = 1B if iflag_vue[0] EQ 1 then begin if ImageToggle(0) eq 0 then begin if Quality eq 0 then sState.drawWindowID1->SetProperty, QUALITY=1 WIDGET_CONTROL, sState.wDraw1, /DRAW_MOTION endif else begin if Quality eq 0 then sState.drawWindowID2->SetProperty, QUALITY=1 WIDGET_CONTROL, sState.wDraw2, /DRAW_MOTION end endif else begin if Quality eq 0 then DegradeQuality, sState WIDGET_CONTROL, sState.wDraw3D, /DRAW_MOTION ;;; SEED PICK ; IF seedPickflag THEN dum=seedPick(sEvent, sState) ;;; OBJECT PROBE ; probeObjectsProperties=WIDGET_INFO(sState.wEditObjectProperty,/BUTTON_SET) if probeObjectsProperties eq 1 then begin Location=make_array(2) Location[0]=sEvent.x & Location[1]=sEvent.y ProbeObject,sState, sEvent , Location endif ;;; PIVOT CONTROL ; WIDGET_CONTROL,wNavigationOptions[6],GET_VALUE=PivotControl if PivotControl[0] then begin Location=make_array(2) Location[0]=sEvent.x & Location[1]=sEvent.y pickObject=sState.drawWindowID3D->PickData(sState.oView3D,sState.oModel3D,Location,XYZLocation) if pickObject then begin qmovex=-XYZLocation[0] qmovey=-XYZLocation[1] qmovez=-XYZLocation[2] print,'qmovex,qmovey,qmovez=',qmovex,qmovey,qmovez sState.oModel3D->Translate,-qmovex,-qmovey,-qmovez, /PREMULTIPLY sState.oRotationModel3D->Translate,qmovex,qmovey,qmovez endif endif endelse endif ; of Button press ; Button motion. ; if ((sEvent.type eq 2) and (sState.btndown eq 1B)) then begin if (bHaveTransformL) then begin ;print,'test2' ; SEED PICK ; IF seedPickcontinuous THEN BEGIN dum=seedPick(sEvent, sState) ENDIF ELSE BEGIN ; of SEED PICK ; Reset the x, y, z axis angle values. ; if iflag_vue[0] EQ 1 then begin sState.oRotationModel->GetProperty, TRANSFORM=transform endif else begin sState.oRotationModel3D->GetProperty, TRANSFORM=transform endelse tempMat = FLTARR(3,3) xyzAngles = FLTARR(3) tempMat[0:2, 0:2] = transform[0:2, 0:2] xyzAngles = Angle3123(tempMat) IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xyzAngles[0] IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=xyzAngles[1] IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=xyzAngles[2] result=sState.oData_xyzrot->SetData(xyzAngles) ;print, 'call SDvis_Draw bHaveTransformL' SDvis_Draw, sState END ; of SEED PICK endif if (bHaveTransformM) then begin ;print, 'call SDvis_Draw bHaveTransformM' SDvis_Draw, sState endif if (bHaveTransformR) then begin ;print, 'call SDvis_Draw bHaveTransformR' SDvis_Draw, sState endif endif ; of Button motion ; Button release. ; if (sEvent.type eq 1) then begin if (sState.btndown EQ 1b) then begin ;if iflag_vue[0] EQ 1 AND bVectorField EQ 0 AND bParticles EQ 0 then begin if iflag_vue[0] EQ 1 then begin if Quality eq 0 then sState.drawWindowID1->SetProperty, QUALITY=2 if Quality eq 0 then sState.drawWindowID2->SetProperty, QUALITY=2 if Quality eq 0 then sState.drawWindowID3->SetProperty, QUALITY=2 sState.btndown = 0B WIDGET_CONTROL, sState.wDraw1, DRAW_MOTION=0 endif else begin if Quality eq 0 then UpgradeQuality, sState sState.btndown = 0B WIDGET_CONTROL, sState.wDraw3D, DRAW_MOTION=0 endelse ;print, 'call SDvis_Draw release' SDvis_Draw, sState endif endif end ; of DRAW 'DRAW2': begin ;print, 'DRAW2' result=sState.oData_ImageToggle->GetData(ImageToggle) ; Expose. ; if (sEvent.type eq 4) then begin SDvis_Draw, sState WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY RETURN endif ; Button press. ; if (sEvent.type eq 0) then begin sState.btndown = 1B if ImageToggle(0) eq 0 then begin ;sState.drawWindowID2->SetProperty, QUALITY=2 WIDGET_CONTROL, sState.wDraw2, /DRAW_MOTION endif else begin ;sState.drawWindowID2->SetProperty, QUALITY=2 WIDGET_CONTROL, sState.wDraw1, /DRAW_MOTION end endif ; of Button press ; Button release. ; if (sEvent.type eq 1) then begin if (sState.btndown EQ 1b) then begin ;print, 'release sEvent.x=', sEvent.x ;print, 'release sEvent.y=', sEvent.y sState.btndown = 0B ;sState.drawWindowID2->SetProperty, QUALITY=2 if ImageToggle(0) eq 0 then begin WIDGET_CONTROL, sState.wDraw2, DRAW_MOTION=0 endif else begin WIDGET_CONTROL, sState.wDraw1, DRAW_MOTION=0 end endif endif if ImageToggle(0) eq 0 then begin WIDGET_CONTROL, sState.wDraw2, GET_VALUE=drawWindowID2 endif else begin WIDGET_CONTROL, sState.wDraw1, GET_VALUE=drawWindowID2 end drawWindowID2->GetProperty,DIMENSIONS=dim ystart=-0.5 ywidth= 1. xstart=-0.5 xwidth= 1. sState.oPolyLineImage1->GetProperty, DATA=Polyline Polyline[0,0]=xstart+sEvent.x * xwidth / dim[0] Polyline[1,0]=ystart Polyline[0,1]=xstart+sEvent.x * xwidth / dim[0] Polyline[1,1]=ystart+ywidth sState.oPolyLineImage1->SetProperty, DATA=Polyline sState.oPolyLineImage2->GetProperty, DATA=Polyline Polyline[0,0]=xstart Polyline[1,0]=ystart+sEvent.y * ywidth / dim[1] Polyline[0,1]=xstart+xwidth Polyline[1,1]=ystart+sEvent.y * ywidth / dim[1] sState.oPolyLineImage2->SetProperty, DATA=Polyline sState.oImage[0]->GetProperty, XRANGE=xri, YRANGE=yri ;print,'xri=',xri ;print,'yri=',yri ixdata=fix(xri[0]+sEvent.x * xri[1] / dim[0]) iydata=fix(yri[0]+sEvent.y * yri[1] / dim[1]) if ixdata lt xri[0] then ixdata=xri[0] if ixdata ge xri[1] then ixdata=xri[1] - 1 if iydata lt yri[0] then iydata=yri[0] if iydata ge yri[1] then iydata=yri[1] - 1 result=sState.oData_ImageProfile->GetData(ImageProfile) if ImageProfile EQ 0 then begin result=sState.oData_Plotx->SetData(ixdata) endif else begin result=sState.oData_Plotx->SetData(iydata) endelse dum=DrawThePlot(sState) result=sState.oData_varData2D->GetData(varData2D) if result ne 0 then begin z=varData2D(ixdata,iydata) WIDGET_CONTROL, sState.wDataImage, SET_VALUE=z WIDGET_CONTROL, sState.wxImage, SET_VALUE=ixdata WIDGET_CONTROL, sState.wyImage, SET_VALUE=iydata end if ImageToggle(0) eq 0 then begin sState.drawWindowID2->Draw, sState.oView2 endif else begin sState.drawWindowID1->Draw, sState.oView2 end sState.drawWindowID3->Draw, sState.oView3 end ; of DRAW2 'DRAW3': begin end ; of DRAW2 'DRAW3DPLOT': begin WIDGET_CONTROL, /HOURGLASS ; Expose. ; if (sEvent.type eq 4) then begin SDvis_Draw, sState WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY RETURN endif ; Button press. ; if (sEvent.type eq 0) then begin sState.btndown = 1B WIDGET_CONTROL, sState.wDrawIsoPlot, /DRAW_MOTION endif ; of Button press ; Button release. ; if (sEvent.type eq 1 ) then begin if (sState.btndown EQ 1b) then begin sState.btndown = 0B WIDGET_CONTROL, sState.wDrawIsoPlot, DRAW_MOTION=0 endif endif if (sState.btndown EQ 1b) then begin WIDGET_CONTROL, sState.wDrawIsoPlot, GET_VALUE=drawWindowIDIsoPlot drawWindowIDIsoPlot->GetProperty,DIMENSIONS=dim xstart=-0.55 xwidth= 1.1 sState.oPolyLineIsoPlot->GetProperty, DATA=Polyline Polyline[0,*]=xstart+sEvent.x * xwidth / dim[0] if Polyline[0,0] lt -0.5 then Polyline[0,*]=-0.5 if Polyline[0,0] gt 0.5 then Polyline[0,*]= 0.5 sState.oPolyLineIsoPlot->SetProperty, DATA=Polyline sState.xAxisIsoPlotB->GetProperty, XRANGE=xri xdata=xri[0]+(((sEvent.x/(dim[0]-1))-0.05)*1.1)*(xri[1]-xri[0]) if xdata lt xri[0] then xdata=xri[0] if xdata ge xri[1] then xdata=xri[1] ;print,'xdata=',xdata result=sState.oData_IsoPlot->GetData(IsoPlot) result=sState.oData_PolygonID->GetData(PolygonID) IsoPlot[PolygonID]=xdata result=sState.oData_IsoPlot->SetData(IsoPlot) dum=DrawTheVolume(sState) sState.drawWindowIDIsoPlot->Draw, sState.oViewIsoPlot iso=xdata WIDGET_CONTROL, sState.wIsoValues[2], SET_VALUE=iso WIDGET_CONTROL, sState.wIsoValues[0], GET_VALUE=min WIDGET_CONTROL, sState.wIsoValues[1], GET_VALUE=max percent=100*(iso-min)/(max-min) WIDGET_CONTROL, sState.wIsoValues[3], SET_VALUE=percent SDvis_Draw, sState endif end ; of DRAW3DPLOT 'DRAWDMDENSITYPLOT': begin ;help,sEvent,/struct WIDGET_CONTROL, /HOURGLASS ; Expose. ; if (sEvent.type eq 4) then begin SDvis_Draw, sState WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY RETURN endif ; Button press. ; if (sEvent.type eq 0) then begin sState.btndown = 1B WIDGET_CONTROL, sState.wDrawIsoPlot, /DRAW_MOTION endif ; of Button press ; Button release. ; if (sEvent.type eq 1 ) then begin if (sState.btndown EQ 1b) then begin sState.btndown = 0B WIDGET_CONTROL, sState.wDrawIsoPlot, DRAW_MOTION=0 endif endif if (sState.btndown EQ 0b ) then begin ;help,sEvent,/struct ;print,'-------------------------' iplot=0 ;print,'sEvent.release=',sEvent.release ;help,sEvent.release if sEvent.release eq 2b or sEvent.release eq 4b then iplot=1 ;print,'iplot=',iplot WIDGET_CONTROL, sState.wDrawDMDensityPlot, GET_VALUE=drawWindowIDDMDensityPlot drawWindowIDDMDensityPlot->GetProperty,DIMENSIONS=dim ;print,'dim=',dim xstart=-0.55 xwidth= 1.15 sState.oPolyLineDMDensityPlot[iplot]->GetProperty, DATA=Polyline ;print,'Polyline=',Polyline Polyline[0,*]=xstart+sEvent.x * xwidth / (dim[0]-1) ;print,'Polyline=',Polyline if Polyline[0,0] lt -0.5 then Polyline[0,*]=-0.5 if Polyline[0,0] gt 0.5 then Polyline[0,*]= 0.5 ;print,'Polyline=',Polyline sState.oPolyLineDMDensityPlot[iplot]->SetProperty, DATA=Polyline ;;; TEST ;;; sState.oPolyLineDMDensityPlot[0]->GetProperty, DATA=Polyline0 sState.oPolyLineDMDensityPlot[1]->GetProperty, DATA=Polyline1 if Polyline0[0,0] Gt Polyline1[0,0] then BEGIN sState.oPolyLineDMDensityPlot[0]->SetProperty, DATA=Polyline1 ENDIF ;;;; sState.xAxisDMDensityPlotB->GetProperty, XRANGE=xri ;print,'xri=',xri result=sState.oData_DMDensityPlot->GetData(xdata) ;print,'sEvent.x=',sEvent.x xdata[iplot]=xri[0]+(((sEvent.x/(dim[0]-1))-0.05)*1.15)*(xri[1]-xri[0]) if xdata[iplot] lt xri[0] then xdata[iplot]=xri[0] if xdata[iplot] ge xri[1] then xdata[iplot]=xri[1] if xdata[0] gt xdata[1] then xdata[0]=xdata[1] ;print,'xdata=',xdata result=sState.oData_DMDensityPlot->SetData(xdata) dum=DrawTheVolume(sState) sState.drawWindowIDDMDensityPlot->Draw, sState.oViewDMDensityPlot SDvis_Draw, sState endif end ; of DRAWDMDENSITYPLOT 'STYLELIST' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) case listValue of ; Shaded style. ; 0 : begin sState.oSimpleSurface->SetProperty, STYLE=2 end ; of 0 ; Wire style. ; 1 : begin sState.oSimpleSurface->SetProperty, STYLE=1 end ; of 1 ; Lego solid style. ; 2 : begin sState.oSimpleSurface->SetProperty, STYLE=6 end ; of 2 endcase ; of listValue SDvis_Draw, sState end ; of DROPLIST 'STYLELISTISO' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_PolygonID->GetData(PolygonID) result=sState.oData_PolygonVarID->GetData(PolygonVarID) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) ;print,'MovieFrameCURRENT=',MovieFrameCURRENT case listValue of ; Shaded style. ; 0 : begin sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, STYLE=2 end ; of 0 ; Points style. ; 1 : begin sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, STYLE=0 end ; of 1 ; Lines style. ; 2 : begin sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, STYLE=1 end ; of 2 endcase ; of listValue SDvis_Draw, sState end ; of STYLELISTISO ; Handle the list event, Choose between 4 color scenarios. ; 'COLORLIST' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO( sEvent.id, /LIST_SELECT) case listValue of ; Texture Map ; 0 : begin sState.oSimpleSurface->SetProperty, $ TEXTURE_MAP=sState.oTextureImage ; TEXTURE_MAP=sState.oImage sState.oSimpleSurface->SetProperty, COLOR=[230,230,230], $ BOTTOM=[64, 192, 128] SDvis_Draw, sState sState.textureFlag=1 end ; of 0 ; White. ; 1 : begin sState.oSimpleSurface->SetProperty, $ TEXTURE_MAP=OBJ_NEW() sState.oSimpleSurface->SetProperty, COLOR=[200,200,200] SDvis_Draw, sState sState.textureFlag=0 end ; of 1 ; Yellow. ; 2 : begin sState.oSimpleSurface->SetProperty, $ TEXTURE_MAP=OBJ_NEW() sState.oSimpleSurface->SetProperty, COLOR=[200,200,0] SDvis_Draw, sState sState.textureFlag=0 end ; of 2 ; Red. ; 3 : begin sState.oSimpleSurface->SetProperty, $ TEXTURE_MAP=OBJ_NEW() sState.oSimpleSurface->SetProperty, COLOR=[200,0,0] SDvis_Draw, sState sState.textureFlag=0 end ; of 3 endcase end ; of LIST ; Handle the list event for the isosurface, Choose between 4 color scenarios. ; 'COLORLISTISO' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/LIST_SELECT) result=sState.oData_PolygonID->GetData(PolygonID) result=sState.oData_PolygonVarID->GetData(PolygonVarID) result=sState.oData_MovieFrameNMAX->GetData(MovieFrameNMAX) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) case listValue of ; Blue ; 0 : begin sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, COLOR=[0,0,205] end ; of 0 ; White. ; 1 : begin sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, COLOR=[200,200,200] end ; of 1 ; Yellow. ; 2 : begin sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, COLOR=[200,200,0] end ; of 2 ; Red. ; 3 : begin sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, COLOR=[200,0,0] end ; of 3 ; Black ; 4 : begin sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, COLOR=[0,0,0] end ; of 4 ; Green ; 5 : begin sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty, COLOR=[0,200,0] end ; of 5 endcase SDvis_Draw, sState end ; of COLORLISTISO ; Handle the rotation. ; 'SLIDER' : begin WIDGET_CONTROL, /HOURGLASS IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, GET_VALUE=xDegree IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, GET_VALUE=yDegree IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, GET_VALUE=zDegree result=sState.oData_xyzrot->GetData(xyzrot) xyzrot[0]=xDegree xyzrot[1]=yDegree xyzrot[2]=zDegree result=sState.oData_xyzrot->SetData(xyzrot) matFinal = FLTARR(3,3) matFinal = space3123(xDegree, yDegree, zDegree) ;if iflag_vue[0] EQ 1 AND bVectorField EQ 0 AND bParticles EQ 0 then begin if iflag_vue[0] EQ 1 then begin sState.oRotationModel->GetProperty, TRANSFORM=t endif else begin sState.oRotationModel3D->GetProperty, TRANSFORM=t endelse tempMat = FLTARR(3,3) tempMat[0:2, 0:2] = TRANSPOSE(t[0:2, 0:2]) tempMat = TRANSPOSE(tempMat) rotMat = matFinal # tempMat ; Find the Euler parameters 'e4' of rotMat ; which is the rotation it takes to go from ; the original (t) to the final (matFinal). ; e4 = 0.5 * SQRT(1.0 + rotMat[0,0] + $ rotMat[1,1] + rotMat[2,2]) ; Find the unit vector of the single rotation axis ; and the angle of rotation. ; if (e4 eq 0) then begin if (rotMat[0,0] eq 1) then begin axisRot = [1, 0, 0] endif else if(rotMat[1,1] eq 1) then begin axisRot = [0, 1, 0] endif else begin axisRot = [0, 0, 1] endelse angleRot = 180.0 endif else begin e1 = (rotMat[2,1] - rotMat[1,2])/(4.0*e4) e2 = (rotMat[0,2] - rotMat[2,0])/(4.0*e4) e3 = (rotMat[1,0] - rotMat[0,1])/(4.0*e4) modulusE = SQRT(e1*e1 + e2*e2 +e3*e3) if(modulusE eq 0.0) then begin WIDGET_CONTROL, sEvent.top, $ SET_UVALUE=sState, /NO_COPY RETURN endif axisRot = FLTARR(3) axisRot[0] = e1/modulusE axisRot[1] = e2/modulusE axisRot[2] = e3/modulusE angleRot = (2.0 * ACOS(e4)) * 180 / !DPI endelse for i = 0, 2 do begin if(ABS(axisRot[i]) lt 1.0e-6) then axisRot[i]=1.0e-6 endfor ;if iflag_vue[0] EQ 1 AND bVectorField EQ 0 AND bParticles EQ 0 then begin if iflag_vue[0] EQ 1 then begin sState.oRotationModel->Rotate, axisRot, angleRot endif else begin sState.oRotationModel3D->Rotate, axisRot, angleRot endelse SDvis_Draw, sState ;dum=UpdateTheViews(sState,1) end ; of SLIDER 'TABDATA': begin end ; of TABDATA 'TABVUE': begin end ; of TABVUE 'TAB': begin WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY RETURN end ; of TAB "QUIT": begin result = sState.oData_wAmrConfigurationBase->GetData(wAmrConfigurationBase) IF (WIDGET_INFO(wAmrConfigurationBase, /VALID_ID)) EQ 1 then WIDGET_CONTROL, wAmrConfigurationBase, /DESTROY IF (WIDGET_INFO(sState.wBoundariesBase, /VALID_ID)) EQ 1 then WIDGET_CONTROL, sState.wBoundariesBase, /DESTROY ; Restore the info structure before destroying event.top ; WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY ; Destroy widget hierarchy. ; WIDGET_CONTROL, sEvent.top, /DESTROY RETURN end ; Handle the sub-volume for RAMSES data ; ; Author Y. Fidaali ; "BOUNDARIES":begin result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) subAxisBoundaries[0]->SetProperty, hide=0 subAxisBoundaries[1]->SetProperty, hide=0 subAxisBoundaries[2]->SetProperty, hide=0 subAxisBoundaries[3]->SetProperty, hide=0 subAxisBoundaries[4]->SetProperty, hide=0 subAxisBoundaries[5]->SetProperty, hide=0 subAxisBoundaries[6]->SetProperty, hide=0 subAxisBoundaries[7]->SetProperty, hide=0 subAxisBoundaries[8]->SetProperty, hide=0 subAxisBoundaries[9]->SetProperty, hide=0 subAxisBoundaries[10]->SetProperty, hide=0 subAxisBoundaries[11]->SetProperty, hide=0 result=sState.oData_subAxisBoundaries->SetData(subAxisBoundaries) sState.drawWindowID3D->Draw, sState.oView3D IF (WIDGET_INFO(sState.wBoundariesBase, /VALID_ID)) EQ 0 THEN BEGIN sState.wBoundariesBase = WIDGET_BASE(TITLE='Boundaries control', $;GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=1, YPAD=10, SPACE=1) MeshIJKboundaries=fltarr([6]) wRamsesConfigBoundariesBase=LONARR(6) result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) result = sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) result = sState.oData_scaleValue->GetData(scaleValue) result = sState.oData_colorBoundarieValue->GetData(color) DefineBoundariesWidget, $ sState.wBoundariesBase, $ wRamsesXBoundariesBase, $ wRamsesYBoundariesBase, $ wRamsesZBoundariesBase, $ wRamsesConfigBoundariesBase, $ MeshIJKboundaries, $ sState.oModelObjects3D, $ subAxisBoundaries, $ sState.TranslateBoundaries, $ sState.wRamsesConfigTranslate, $ sState.wRamsesConfigScaleSlider, $ sState.wRamsesConfigScaleValue, $ scaleValue, $ color sState.wRamsesXBoundariesBase=wRamsesXBoundariesBase sState.wRamsesYBoundariesBase=wRamsesYBoundariesBase sState.wRamsesZBoundariesBase=wRamsesZBoundariesBase sState.wRamsesConfigBoundariesBase=wRamsesConfigBoundariesBase result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) result=sState.oData_subAxisBoundaries->SetData(subAxisBoundaries) result = sState.oData_colorBoundarieValue->SetData(color) result = sState.oData_scaleValue->SetData(scaleValue) ;print,'valid wDefineVueEyeBase=',WIDGET_INFO(wDefineVueEyeBase, /VALID_ID) ;print,'valid sState.wDefineVueEyeBase=',WIDGET_INFO(sState.wDefineVueEyeBase, /VALID_ID) ENDIF WIDGET_CONTROL, sState.wBoundariesBase, SET_UVALUE=sState WIDGET_CONTROL,sState.wBoundariesBase , /REALIZE XMANAGER,'SDvis_Event',sState.wBoundariesBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="Boundaries_Cleanup",/JUST_REG end "LOADDATA": begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wRebinData, SENSITIVE=1 ;WIDGET_CONTROL, sState.wDefineVueLabel, SET_VALUE='OK' dum=LoadData(sState) LaunchObjectControlWidget, sEvent,sState result=sState.oData_DataFormat->GetData(DataFormat) print, result if DataFormat eq 3 then begin ;RAMSES IF WIDGET_INFO(sState.wObjectControlGenerateAMR, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wObjectControlGenerateAMR,SENSITIVE=1 endif end "BROWSEH5": begin print ,'HDF5 lib version', h5_get_libversion() result=sState.oData_FileId->GetData(FileId) openr,1,FileId, ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', FileId ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir ;SDvis_Draw, sState ;WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY ;return endif close,1 result=h5_browser(FileId) end "PICKISOMETRIC": begin sState.oView1->SetProperty,PROJECTION=1 sState.oView3D->SetProperty,PROJECTION=1 WIDGET_CONTROL,sState.wViewOptions[0],SET_BUTTON=1 WIDGET_CONTROL,sState.wViewOptions[1],SET_BUTTON=0 SDvis_Draw, sState end "PICKPERSPECTIVE": begin sState.oView1->SetProperty,PROJECTION=2 sState.oView3D->SetProperty,PROJECTION=2 WIDGET_CONTROL,sState.wViewOptions[0],SET_BUTTON=0 WIDGET_CONTROL,sState.wViewOptions[1],SET_BUTTON=1 SDvis_Draw, sState end ; "PICKOPENGL": begin ; ; WIDGET_CONTROL,sState.wDraw1,RENDERER=0 ; WIDGET_CONTROL,sState.wDraw2,RENDERER=0 ; WIDGET_CONTROL,sState.wDraw3,RENDERER=0 ; WIDGET_CONTROL,sState.wDraw3d,RENDERER=0 ; WIDGET_CONTROL,sState.wViewOptions[9],SET_BUTTON=1 ; WIDGET_CONTROL,sState.wViewOptions[9],SET_BUTTON=0 ; SDvis_Draw, sState ; ; end ; "PICKSOFTWARERENDERER": begin ; ; WIDGET_CONTROL,sState.wDraw1,RENDERER=1 ; WIDGET_CONTROL,sState.wDraw2,RENDERER=1 ; WIDGET_CONTROL,sState.wDraw3,RENDERER=1 ; WIDGET_CONTROL,sState.wDraw3d,RENDERER=1 ; WIDGET_CONTROL,sState.wViewOptions[8],SET_BUTTON=0 ; WIDGET_CONTROL,sState.wViewOptions[9],SET_BUTTON=1 ; SDvis_Draw, sState ; ; end "RESETVUE": begin sState.oRotationModel->Reset sState.oRotationModel3D->Reset sState.oScalingModel->Reset sState.oMovableModel->Reset sState.oModel3D->Reset sState.oModelObjects3D->Reset xRot = -60 yRot = 20 sState.oRotationModel->Rotate, [1,0,0], xRot sState.oRotationModel->Rotate, [0,1,0], yRot sState.oRotationModel3D->Rotate, [1,0,0], xRot sState.oRotationModel3D->Rotate, [0,1,0], yRot IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xRot IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=yRot IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=0 result=sState.oData_xyzrot->GetData(xyzrot) xyzrot[0]=xRot xyzrot[1]=yRot xyzrot[2]=0 result=sState.oData_xyzrot->SetData(xyzrot) ;result=sState.oData_vue->GetData(iflag_vue) ;if iflag_vue[0] GE 2 or iflag_vue[1] EQ 1 then dum=DrawTheVolume(sState) SDvis_Draw, sState end "XYVUE": begin sState.oRotationModel->Reset sState.oRotationModel3D->Reset sState.oScalingModel->Reset sState.oMovableModel->Reset sState.oModel3D->Reset sState.oModelObjects3D->Reset xRot = 0 yRot = 0 zRot = 0 sState.oRotationModel->Rotate, [1,0,0], xRot sState.oRotationModel->Rotate, [0,1,0], yRot sState.oRotationModel->Rotate, [0,0,1], zRot sState.oRotationModel3D->Rotate, [1,0,0], xRot sState.oRotationModel3D->Rotate, [0,1,0], yRot sState.oRotationModel3D->Rotate, [0,0,1], zRot IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xRot IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=yRot IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=0 result=sState.oData_xyzrot->GetData(xyzrot) xyzrot[0]=xRot xyzrot[1]=yRot xyzrot[2]=zrot result=sState.oData_xyzrot->SetData(xyzrot) ;result=sState.oData_vue->GetData(iflag_vue) ;if iflag_vue[0] GE 2 or iflag_vue[1] EQ 1 then dum=DrawTheVolume(sState) SDvis_Draw, sState end "XZVUE": begin sState.oRotationModel->Reset sState.oRotationModel3D->Reset sState.oScalingModel->Reset sState.oMovableModel->Reset sState.oModel3D->Reset sState.oModelObjects3D->Reset xRot = -90 yRot = 0 zRot = 0 sState.oRotationModel->Rotate, [1,0,0], xRot sState.oRotationModel->Rotate, [0,1,0], yRot sState.oRotationModel->Rotate, [0,0,1], zRot sState.oRotationModel3D->Rotate, [1,0,0], xRot sState.oRotationModel3D->Rotate, [0,1,0], yRot sState.oRotationModel3D->Rotate, [0,0,1], zRot IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xRot IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=yRot IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=zRot result=sState.oData_xyzrot->GetData(xyzrot) xyzrot[0]=xRot xyzrot[1]=yRot xyzrot[2]=zrot result=sState.oData_xyzrot->SetData(xyzrot) ;result=sState.oData_vue->GetData(iflag_vue) ;if iflag_vue[0] GE 2 or iflag_vue[1] EQ 1 then dum=DrawTheVolume(sState) SDvis_Draw, sState end "YZVUE": begin sState.oRotationModel->Reset sState.oRotationModel3D->Reset sState.oScalingModel->Reset sState.oMovableModel->Reset sState.oModel3D->Reset sState.oModelObjects3D->Reset xRot =-90 yRot =-90 zRot = 0 sState.oRotationModel->Rotate, [1,0,0], xRot sState.oRotationModel->Rotate, [0,1,0], yRot sState.oRotationModel->Rotate, [0,0,1], zRot sState.oRotationModel3D->Rotate, [1,0,0], xRot sState.oRotationModel3D->Rotate, [0,1,0], yRot sState.oRotationModel3D->Rotate, [0,0,1], zRot IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xRot IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=yRot IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=0 result=sState.oData_xyzrot->GetData(xyzrot) xyzrot[0]=xRot xyzrot[1]=yRot xyzrot[2]=zrot result=sState.oData_xyzrot->SetData(xyzrot) ;result=sState.oData_vue->GetData(iflag_vue) ;if iflag_vue[0] GE 2 or iflag_vue[1] EQ 1 then dum=DrawTheVolume(sState) SDvis_Draw, sState end ; Handle the surface plane position slider ; 'SURFACEPOS_SLIDER' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wSurfacePlaneSlider, GET_VALUE=surfacePosition result=sState.oData_datanames->GetData(datanames) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) sState.oImage[0]->GetProperty,HIDE=hide if hide eq 0 then begin ;print,'SURFACEPOS_SLIDER oImage' result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) sState.zTitleObj->GetProperty, STRINGS=string if string eq 'pressure' then iflag_var=4 if string eq 'density' then iflag_var=2 for i=0,nvar-1 do begin if datanames[i] eq string then iflag_var= -(i+1) endfor iflag_vue[0]=1 result=sState.oData_vue->SetData(iflag_vue) result=sState.oData_flag->SetData(iflag_var) dum=UpdateTheViews(sState,0) endif sState.oVectorField2D->GetProperty,HIDE=hide if hide eq 0 then begin ;print,'SURFACEPOS_SLIDER oVectorField2D' result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) iflag_var=11 WIDGET_CONTROL, sState.wVectorFieldName,GET_VALUE=string for i=0,nvar-1 do begin if datanames[i] eq string then iflag_var= -(i+1) endfor iflag_vue[1]=3 result=sState.oData_vue->SetData(iflag_vue) result=sState.oData_flag->SetData(iflag_var) dum=UpdateTheViews(sState,0) endif sState.oStreamlines2D->GetProperty,HIDE=hide if hide eq 0 then begin ;print,'SURFACEPOS_SLIDER sState.oStreamlines2D' result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) iflag_var=11 WIDGET_CONTROL, sState.wVectorFieldName,GET_VALUE=string for i=0,nvar-1 do begin if datanames[i] eq string then iflag_var= -(i+1) endfor iflag_vue[1]=4 result=sState.oData_vue->SetData(iflag_vue) result=sState.oData_flag->SetData(iflag_var) dum=UpdateTheViews(sState,0) endif SDvis_Draw, sState end ; of surface plane position slider ; Handle the image 3D plane position slider ; 'IMAGE3DPOS_SLIDER' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wImage3DPlaneSlider, GET_VALUE=surfacePosition result=sState.oData_datanames->GetData(datanames) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) sState.oImage3D[0]->GetProperty,HIDE=hide0 sState.oImage3D[1]->GetProperty,HIDE=hide1 if hide0 eq 0 or hide1 eq 0 then begin result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) sState.zTitleObj->GetProperty, STRINGS=string if string eq 'pressure' then iflag_var=4 if string eq 'density' then iflag_var=2 for i=0,nvar-1 do begin if datanames[i] eq string then iflag_var= -(i+1) endfor iflag_vue[0]=6 result=sState.oData_vue->SetData(iflag_vue) result=sState.oData_flag->SetData(iflag_var) dum=UpdateTheViews(sState,0) endif SDvis_Draw, sState end ; of image 3D plane position slider ; Handle the Surface plane selector ; 'SELECTSURFACEPLANE' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wSelectSurfacePlane, GET_VALUE=index xyzplane=index+1 slicePosition=0 WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_VALUE=slicePosition result=sState.oData_GridDim->GetData(GridDim) if xyzplane eq 1 then begin WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_SLIDER_MAX=GridDim(2)-1 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_SLIDER_MAX=GridDim(1)-1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_SLIDER_MAX=GridDim(0)-1 end ;if xyzplane eq 1 then begin ; WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(2) ;endif else if xyzplane eq 2 then begin ; WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(1) ;endif else if xyzplane eq 3 then begin ; WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(0) ;end result=sState.oData_xyzplane->SetData(xyzplane) result=sState.oData_datanames->GetData(datanames) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) sState.oImage[0]->GetProperty,HIDE=hide if hide eq 0 then begin result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) sState.zTitleObj->GetProperty, STRINGS=string if string eq 'pressure' then iflag_var=4 if string eq 'density' then iflag_var=2 for i=0,nvar-1 do begin if datanames[i] eq string then iflag_var= -(i+1) endfor iflag_vue[0]=1 result=sState.oData_vue->SetData(iflag_vue) result=sState.oData_flag->SetData(iflag_var) dum=UpdateTheViews(sState,0) endif sState.oVectorField2D->GetProperty,HIDE=hide if hide eq 0 then begin result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) iflag_var=11 WIDGET_CONTROL, sState.wVectorFieldName,GET_VALUE=string for i=0,nvar-1 do begin if datanames[i] eq string then iflag_var= -(i+1) endfor iflag_vue[1]=3 result=sState.oData_vue->SetData(iflag_vue) result=sState.oData_flag->SetData(iflag_var) dum=UpdateTheViews(sState,0) endif sState.oStreamlines2D->GetProperty,HIDE=hide if hide eq 0 then begin result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) iflag_var=11 WIDGET_CONTROL, sState.wVectorFieldName,GET_VALUE=string for i=0,nvar-1 do begin if datanames[i] eq string then iflag_var= -(i+1) endfor iflag_vue[1]=4 result=sState.oData_vue->SetData(iflag_vue) result=sState.oData_flag->SetData(iflag_var) dum=UpdateTheViews(sState,0) endif SDvis_Draw, sState if xyzplane eq 1 then begin WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=0 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=1 end end ; of SELECTSURFACEPLANE ; Handle the Image 3D plane selector ; 'SELECTIMAGE3DPLANE' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wSelectImage3DPlane, GET_VALUE=index xyzplane=index+1 slicePosition=0 WIDGET_CONTROL, sState.wImage3DPlaneSlider, SET_VALUE=slicePosition result=sState.oData_GridDim->GetData(GridDim) if xyzplane eq 1 then begin WIDGET_CONTROL, sState.wImage3DPlaneSlider, SET_SLIDER_MAX=GridDim(2)-1 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.wImage3DPlaneSlider, SET_SLIDER_MAX=GridDim(1)-1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.wImage3DPlaneSlider, SET_SLIDER_MAX=GridDim(0)-1 end if xyzplane eq 1 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(2)-1 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(1)-1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(0)-1 end result=sState.oData_xyzplane->SetData(xyzplane) result=sState.oData_datanames->GetData(datanames) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) sState.oImage3D[0]->GetProperty,HIDE=hide if hide eq 0 then begin result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) sState.zTitleObj->GetProperty, STRINGS=string if string eq 'pressure' then iflag_var=4 if string eq 'density' then iflag_var=2 for i=0,nvar-1 do begin if datanames[i] eq string then iflag_var= -(i+1) endfor iflag_vue[0]=6 result=sState.oData_vue->SetData(iflag_vue) result=sState.oData_flag->SetData(iflag_var) dum=UpdateTheViews(sState,0) endif SDvis_Draw, sState if xyzplane eq 1 then begin WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=0 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=1 end end ; of SELECTIMAGE3DPLANE ; Handle the lin/log option selector for the project/voxel/... volume ; 'SCALARLINLOG' : begin WIDGET_CONTROL, /HOURGLASS result=sState.oData_ScalarLinLog->GetData(ScalarLinLog_current) ScalarLinLog=WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_ScalarLinLog->SetData(ScalarLinLog) ;print, 'ScalarLinLog=',ScalarLinLog WIDGET_CONTROL, sState.wIsoValues[0], GET_VALUE=minvar WIDGET_CONTROL, sState.wIsoValues[1], GET_VALUE=maxvar sState.oIsoPlot->GetProperty, Data=data help,data,output=test_valid help,data valid_data=1-strcmp(test_valid,'DATA UNDEFINED = ') IF valid_data and ScalarLinLog_current EQ 0 and ScalarLinLog EQ 1 THEN BEGIN WIDGET_CONTROL, sState.wIsoValues[0], SET_VALUE=alog10(minvar) WIDGET_CONTROL, sState.wIsoValues[1], SET_VALUE=alog10(maxvar) data[0,*]=alog10(data[0,*]) sState.oIsoPlot->SetProperty, Datax=data[0,*] ENDIF ELSE IF valid_data and ScalarLinLog_current EQ 1 and ScalarLinLog EQ 0 THEN BEGIN WIDGET_CONTROL, sState.wIsoValues[0], SET_VALUE=10^minvar WIDGET_CONTROL, sState.wIsoValues[1], SET_VALUE=10^maxvar data[0,*]=10^data[0,*] sState.oIsoPlot->SetProperty, Datax=data[0,*] END if valid_data eq 0 then $ FillTheIsoPlot,sState RenormIsoPlot,sState dum=UpdateTheViews(sState,1) end ; of SCALARLINLOG ; Handle the quality setting ; 'QUALITY' : begin WIDGET_CONTROL, /HOURGLASS Quality= 3 - WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) if Quality le 2 then begin ;print, 'Quality=',Quality sState.drawWindowID1->SetProperty, QUALITY=Quality sState.drawWindowID2->SetProperty, QUALITY=Quality sState.drawWindowID3->SetProperty, QUALITY=Quality sState.drawWindowID3D->SetProperty, QUALITY=Quality if obj_valid(sState.oWindowStereoEyes[0]) then sState.oWindowStereoEyes[0]->SetProperty, QUALITY=Quality if obj_valid(sState.oWindowStereoEyes[1]) then sState.oWindowStereoEyes[1]->SetProperty, QUALITY=Quality ;if Quality eq 0 then WIDGET_CONTROL, sState.wVolumeOptions[0], SENSITIVE=1 ;if Quality gt 0 then WIDGET_CONTROL, sState.wVolumeOptions[0], SENSITIVE=0 ;WIDGET_CONTROL, sState.wVolumeOptions[0], SENSITIVE=(Quality eq 0) endif else if Quality eq 3 then begin sState.drawWindowID1->SetProperty, QUALITY=2 sState.drawWindowID2->SetProperty, QUALITY=2 sState.drawWindowID3->SetProperty, QUALITY=2 sState.drawWindowID3D->SetProperty, QUALITY=2 if obj_valid(sState.oWindowStereoEyes[0]) then sState.oWindowStereoEyes[0]->SetProperty, QUALITY=2 if obj_valid(sState.oWindowStereoEyes[1]) then sState.oWindowStereoEyes[1]->SetProperty, QUALITY=2 print, 'Dynamic Quality' end SDvis_Draw, sState end ; ; Handle the voxel step slider ; ;'VOXELSTEP_SLIDER' : begin ; WIDGET_CONTROL, /HOURGLASS ; WIDGET_CONTROL, sState.wVoxelStepSlider, GET_VALUE=VoxelStep ; result=sState.oData_VoxelStep->SetData(VoxelStep) ; dum=UpdateTheViews(sState,1) ;end ; of voxel step slider ; Handle the voxel step slider ; ;'VOXELSAMPLING_SLIDER' : begin ; WIDGET_CONTROL, /HOURGLASS ; WIDGET_CONTROL, sState.wVoxelSamplingSlider, GET_VALUE=VoxelSampling ; result=sState.oData_VoxelSampling->SetData(VoxelSampling) ; dum=UpdateTheViews(sState,1) ;end ; of voxel sampling slider ; Handle the voxel intensity method ; ;'VOXELINTENSITY' : begin ; WIDGET_CONTROL, /HOURGLASS ; WIDGET_CONTROL, sState.wVoxelIntensity, GET_VALUE=VoxelIntensity ; result=sState.oData_VoxelIntensity->SetData(VoxelIntensity) ; ;print,'VoxelIntensity=',VoxelIntensity ; dum=UpdateTheViews(sState,1) ;end ; of voxel intensity ; Handle the ProcessorId Field Widget ; 'PROCESSORID' : begin WIDGET_CONTROL, /HOURGLASS result=sState.oData_DataFormat->GetData(DataFormat) if DataFormat eq 1 then begin ; Heracles bin WIDGET_CONTROL, sState.wProcessorIdField, GET_VALUE=ProcessorId result=sState.oData_ProcessorId->SetData(ProcessorId) endif else if DataFormat eq 2 then begin ; hdf WIDGET_CONTROL, sState.wProcessorIdFieldHDF, GET_VALUE=ProcessorId result=sState.oData_ProcessorId->SetData(ProcessorId) endif ;print ,'ProcessorId=',ProcessorId end ; of ProcessorId Field Widget ; Handle the Step Field Widget ; 'STEP' : begin result=sState.oData_DataFormat->GetData(DataFormat) WIDGET_CONTROL, /HOURGLASS if DataFormat eq 2 then begin ; hdf WIDGET_CONTROL, sState.wStepFieldHDF, GET_VALUE=SimuStep result=sState.oData_OutputReprise->GetData(OutputReprise) if OutputReprise eq 0 then begin result=sState.oData_SimuStepOutput->SetData(SimuStep) ;print ,'Output=',SimuStep endif else if OutputReprise eq 1 then begin result=sState.oData_SimuStepReprise->SetData(SimuStep) ;print ,'Reprise=',SimuStep end endif else if DataFormat eq 1 then begin ; heracles bin WIDGET_CONTROL, sState.wStepField, GET_VALUE=SimuStep result=sState.oData_SimuStepOutput->SetData(SimuStep) endif else if DataFormat eq 3 then begin ; ramses bin WIDGET_CONTROL, sState.wRamsesConfig[0], GET_VALUE=SimuStep result=sState.oData_SimuStepOutput->GetData(SimuStepCurrent) if SimuStepCurrent ne SimuStep then begin result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) endif result=sState.oData_SimuStepOutput->SetData(SimuStep) endif else if DataFormat eq 5 then begin ; jupiter WIDGET_CONTROL, sState.wJupiterConfig[0], GET_VALUE=SimuStep result=sState.oData_SimuStepOutput->SetData(SimuStep) endif print ,'SimuStep=',SimuStep end ; of ProcessorId Field Widget ; Handle the fill arrays selector ; 'FILLARRAYS' : begin WIDGET_CONTROL, /HOURGLASS result=sState.oData_DataFormat->GetData(DataFormat) IF DataFormat EQ 3 THEN BEGIN ; RAMSES BIN WIDGET_CONTROL, sState.wRamsesFillArrays, GET_VALUE=index ;;; Force reading of AMR Mesh in cas of hydro ;print,'index=',index if index[0] eq 1 then index[9]=1 if index[1] eq 1 then index[9]=1 if index[2] eq 1 then index[9]=1 if index[3] eq 1 then index[9]=1 if index[4] eq 1 then index[9]=1 if index[5] eq 1 then index[9]=1 if index[6] eq 1 then index[9]=1 WIDGET_CONTROL, sState.wRamsesFillArrays, SET_VALUE=index result=sState.oData_RamsesFillArrays->SetData(index) i=sEvent.value result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) if (index[i] eq 1) and MeshIJKStatus[i] eq 0 then MeshIJKStatus[i]=2 result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) ENDIF ELSE IF DataFormat EQ 1 THEN BEGIN ; HERACLES BIN WIDGET_CONTROL, sState.wFillArrays, GET_VALUE=index result=sState.oData_FillArrays->SetData(index) ENDIF ELSE IF DataFormat EQ 2 OR DataFormat EQ 5 THEN BEGIN ; HDF5 or JUPITER WIDGET_CONTROL, sState.wFillArraysHDF, GET_VALUE=index result=sState.oData_FillArraysHDF->SetData(index) END end ; of FILLARRAYS ; Handle the cpubox option ; 'CPUBOX' : begin WIDGET_CONTROL, sState.wRamsesCpuBox, GET_VALUE=index if index[0] eq 0 then print,'cpubox disengaged' if index[0] eq 1 then print,'cpubox engaged' end ; of CPUBOX ; Handle the options array selector ; 'OPTIONSARRAY' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wOptionsArray, GET_VALUE=index result=sState.oData_OptionsArray->SetData(index) end ; of FILLARRAYS ; Handle the Data Format list ; 'PICKFORMATLIST' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) case listValue of ; Heracles binary ; 1 : begin ;print ,'pick binary' DataFormat=1 end ; hdf5 ; 0: begin ;print ,'pick hdf5' DataFormat=2 end ; ramses amr 2 : begin ;print ,'pick amr' DataFormat=3 end ; ASH BoB 3 : begin ;print ,'pick ASH BoB' DataFormat=4 end ; JUPITER 4 : begin ;print ,'pick JUPITER' DataFormat=5 end ; GRAFIC 5 : begin ;print ,'pick Grafic' DataFormat=6 end 6 : begin print ,'pick Enzo via Jaques' DataFormat=10 end else: dataformat = 0 end ; of listValue result=sState.oData_DataFormat->SetData(DataFormat) PickFormat,sState end ; of PICKFORMATLIST ; Handle the File Id Field ; 'FILEID' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wFileIdField, GET_VALUE=FileId result=sState.oData_FileId->SetData(FileId) end ; of FILEID ; Handle the Read Header button ; 'READHEADER' : begin dum=ReadHeader(sState) end ; of READHEADER ; Handle the Read Jupiter Selector button ; 'READJUPITERDESCRIPTOR' : begin dum=ReadJupiterDescriptor(sState) end ; of READJUPITERDESCRIPTOR ; Handle the Browse Header button ; 'BROWSEHEADER' : begin Browsedirectories, sEvent, sState end ; of BROWSEHEADER ; Handle the Browse Binary ; 'BROWSEBIN' : begin BrowseBindirectories, sEvent, sState end ; of BROWSEHEADER ; Handle the Export data ; 'EXPORTDATA' : begin dum=ExportData(sState) print,'new variables may be created' print,'once created, click on "Load Custom Variable"' end ; of EXPORTDATA ; Handle the definition of custom variables ; 'DEFINECUSTOM1' : begin ;dum=DefineCustom(sState) ;dum=ExportData(sState) ;result=sState.oData_varData3D->GetData(varData3D) ;print,'export varData3D' ;(scope_varfetch('varData3D', /enter, level=1)) = varData3D scopeVar = SCOPE_VARNAME(level=1, Count=count) ;help,scopeVar print,'There are ',count,' variables currently defined in the MAIN session :',scopeVar custom=' ' read,custom,PROMPT='Enter the one you want to load :' valid_var=0 for ivar=0,count-1 do begin if strcmp(custom,scopeVar[ivar], /FOLD_CASE) then valid_var=1 endfor ;print,'valid_var ',valid_var print,'...Loading ',custom help,custom ;s=strlen(custom);size(custom) ;print,'s=',s ;if s eq 0 then begin if valid_var eq 0 then begin print,'no currently defined variable entered' endif else begin customVar=scope_varfetch(custom, /enter, level=1) help,customVar ;plot,customVar s=size(customVar) print,'size s=',s result=sState.oData_GridDim->GetData(GridDim) GridDim(0)=s(1) GridDim(1)=s(2) if s(0) ge 3 then begin GridDim(2)=s(3) endif else if s(0) eq 2 then begin GridDim(2)=1 end result=sState.oData_GridDim->SetData(GridDim) result=sState.oData_DataFormat->GetData(DataFormat) IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES BINARY WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='AMR data loaded' dum=GridPrint(sState,1) ENDIF ELSE BEGIN dum=GridPrint(sState,0) ENDELSE result=sState.oData_datanames->GetData(datanames) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_DataDimHDF->GetData(fourdim) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) nvar=nvar+1 newdatanames=strarr([nvar]) if nvar ne 1 then newdatanames(0:nvar-2)=datanames(0:nvar-2) newdatanames(nvar-1)=custom result=sState.oData_datanames->SetData(newdatanames) newfourdim=make_array([nvar]) if nvar ne 1 then newfourdim(0:nvar-2)=fourdim(0:nvar-2) if s(0) eq 3 then begin newfourdim(nvar-1)=1 endif else if s(0) eq 2 then begin newfourdim(nvar-1)=1 endif else if s(0) eq 4 then begin newfourdim(nvar-1)=3 end result=sState.oData_DataDimHDF->SetData(newfourdim) sState.oData_HDFvar[nvar-1,0]=OBJ_NEW('IDLitData',newdatanames(nvar-1)) result=sState.oData_HDFvar[nvar-1,0]->SetData(customVar,/NO_COPY) newFillArraysHDF=make_array([nvar]) if nvar ne 1 then newFillArraysHDF(0:nvar-2)=FillArraysHDF(0:nvar-2) newFillArraysHDF(nvar-1)=1 result=sState.oData_FillArraysHDF->SetData(newFillArraysHDF) LaunchObjectControlWidget,sEvent,sState endelse end ; of DEFINECUSTOM1 ; Handle the loading of Jacques/Enzo variables (Tom Abel) ; 'JaquesCUBE_DIM': begin WIDGET_CONTROL, sEvent.id, GET_VALUE = cds print, cds sState.Jaques_cube_dim = cds end 'DEFINEJAQUESCUSTOM' : begin WIDGET_CONTROL, /HOURGLASS ; CATCH,Error_status ; if Error_status ne 0 then begin ; print,'Catching error : Error_status=',Error_status ; print,'Attempt to call undefined procedure/function: CONSTRUCT_CUBE' ; WIDGET_CONTROL, sEvent.top,SET_UVALUE=sState,/NO_COPY ; return ; endif construct_cube, customVar, field_name, cube_center=cube_center, cube_length=cube_length, cube_dimensions=sState.Jaques_cube_dim help,customVar ;plot,customVar s=size(customVar) print,'size s=',s result=sState.oData_GridDim->GetData(GridDim) GridDim(0)=s(1) GridDim(1)=s(2) if s(0) ge 3 then begin GridDim(2)=s(3) endif else if s(0) eq 2 then begin GridDim(2)=1 end result=sState.oData_GridDim->SetData(GridDim) result=sState.oData_GridSize->GetData(GridSize) ; GridSize[0:1] = cube_center[0] + 0.5*cube_length*[-1., 1] ; GridSize[2:3] = cube_center[1] + 0.5*cube_length*[-1., 1] ; GridSize[4:5] = cube_center[2] + 0.5*cube_length*[-1., 1] GridSize[0:1] = cube_center[0] + 0.5*[-1., 1] GridSize[2:3] = cube_center[1] + 0.5*[-1., 1] GridSize[4:5] = cube_center[2] + 0.5*[-1., 1] result=sState.oData_GridSize->SetData(GridSize) result=sState.oData_DataFormat->GetData(DataFormat) IF ( DataFormat EQ 3 ) THEN BEGIN ;;; RAMSES BINARY WIDGET_CONTROL, sState.wLoadText[0], SET_VALUE='AMR data loaded' dum=GridPrint(sState,1) ENDIF ELSE BEGIN dum=GridPrint(sState,0) ENDELSE result=sState.oData_datanames->GetData(datanames) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_DataDimHDF->GetData(fourdim) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) nvar=nvar+1 newdatanames=strarr([nvar]) if nvar ne 1 then newdatanames(0:nvar-2)=datanames(0:nvar-2) newdatanames(nvar-1)=field_name result=sState.oData_datanames->SetData(newdatanames) newfourdim=make_array([nvar]) if nvar ne 1 then newfourdim(0:nvar-2)=fourdim(0:nvar-2) if s(0) eq 3 then begin newfourdim(nvar-1)=1 endif else if s(0) eq 2 then begin newfourdim(nvar-1)=1 endif else if s(0) eq 4 then begin newfourdim(nvar-1)=3 end result=sState.oData_DataDimHDF->SetData(newfourdim) sState.oData_HDFvar[nvar-1,0]=OBJ_NEW('IDLitData',newdatanames(nvar-1)) result=sState.oData_HDFvar[nvar-1,0]->SetData(customVar,/NO_COPY) newFillArraysHDF=make_array([nvar]) if nvar ne 1 then newFillArraysHDF(0:nvar-2)=FillArraysHDF(0:nvar-2) newFillArraysHDF(nvar-1)=1 result=sState.oData_FillArraysHDF->SetData(newFillArraysHDF) LaunchObjectControlWidget,sEvent,sState end ; of DEFINEJAQUESCUSTOM ; Handle the reprise/output drop list ; 'OUTREPLIST' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) result=sState.oData_OutputReprise->SetData(listValue) if listValue eq 0 then begin WIDGET_CONTROL, sState.wStepFieldLabelHDF, SET_VALUE='Output # ' ;print,'test Output' result=sState.oData_SimuStepOutput->GetData(SimuStepOutput) WIDGET_CONTROL, sState.wStepField, SET_VALUE=SimuStepOutput endif else if listValue eq 1 then begin WIDGET_CONTROL, sState.wStepFieldLabelHDF, SET_VALUE='Reprise #' ;print,'test Reprise' result=sState.oData_SimuStepReprise->GetData(SimuStepReprise) WIDGET_CONTROL, sState.wStepField, SET_VALUE=SimuStepReprise end SDvis_Draw, sState end ; of OUTREPLIST ; Handle image profile selector ; 'IMAGEOPTIONS' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) ;result=sState.oData_ImageProfile->GetData(ImageProfile) if listValue EQ 0 then begin sState.oPolyLineImage1->SetProperty,LINESTYLE=0 sState.oPolyLineImage2->SetProperty,LINESTYLE=2 sState.xTitlePlot->SetProperty, STRINGS='y' result=sState.oData_ImageProfile->SetData(listValue) endif else if listValue EQ 1 then begin sState.oPolyLineImage1->SetProperty,LINESTYLE=2 sState.oPolyLineImage2->SetProperty,LINESTYLE=0 sState.xTitlePlot->SetProperty, STRINGS='x' result=sState.oData_ImageProfile->SetData(listValue) endif else if listValue EQ 2 then begin sState.oColorBar->GetProperty, HIDE=hide WIDGET_CONTROL, sState.wImageOptions, GET_VALUE=imageoptions ;print,'imageoptions=',imageoptions if hide eq 1 then begin sState.oColorBar->SetProperty, HIDE=0 sState.oColorBarAxis->SetProperty, HIDE=0 imageoptions(2)='hide Color Bar' WIDGET_CONTROL, sState.wImageOptions, SET_VALUE=imageoptions endif else begin sState.oColorBar->SetProperty, HIDE=1 sState.oColorBarAxis->SetProperty, HIDE=1 imageoptions(2)='display Color Bar' WIDGET_CONTROL, sState.wImageOptions, SET_VALUE=imageoptions end end SDvis_Draw, sState end ; of image profile selector ; Handle image toggle selector ; 'IMAGETOGGLE' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) result=sState.oData_ImageToggle->GetData(ImageToggle) ;print,'ImageToggle=',ImageToggle if listValue EQ 0 then begin if ImageToggle(0) eq 0 then begin ImageToggle(0) = 1 WIDGET_CONTROL, sState.wDraw1, SET_UVALUE='DRAW2' WIDGET_CONTROL, sState.wDraw2, SET_UVALUE='DRAW' endif else begin ImageToggle(0) = 0 WIDGET_CONTROL, sState.wDraw1, SET_UVALUE='DRAW' WIDGET_CONTROL, sState.wDraw2, SET_UVALUE='DRAW2' end endif else if listValue EQ 1 then begin ; Get the screen size. ; Device, GET_SCREEN_SIZE = screenSize if ImageToggle(1) eq 0 then begin ImageToggle(1) = 1 xdim = screenSize[0]*0.4 ydim = xdim WIDGET_CONTROL, sState.wDraw2, MAP=0 WIDGET_CONTROL, sState.wDraw3, MAP=0 WIDGET_CONTROL, sState.wDraw2, YSIZE=1 WIDGET_CONTROL, sState.wDraw3, YSIZE=1 endif else begin ImageToggle(1) = 0 xdim = screenSize[0]*0.4 ydim = xdim * 0.75 WIDGET_CONTROL, sState.wDraw2, MAP=1 WIDGET_CONTROL, sState.wDraw3, MAP=1 WIDGET_CONTROL, sState.wDraw2, YSIZE=ydim/2. WIDGET_CONTROL, sState.wDraw3, YSIZE=ydim/2. end WIDGET_CONTROL, sState.wDraw1,DRAW_XSIZE=xdim,DRAW_YSIZE=ydim result=sState.oData_xydim->GetData(xydim) xydim[0]=xdim xydim[1]=ydim result=sState.oData_xydim->SetData(xydim) end result=sState.oData_ImageToggle->SetData(ImageToggle) SDvis_Draw, sState end ; of image toggle selector ; Handle histo option selector ; 'HISTOGRAMOPTIONS' : begin WIDGET_CONTROL, /HOURGLASS result=sState.oData_HistoLog->GetData(HistoLog_current) HistoLog = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) result=sState.oData_HistoLog->SetData(HistoLog) sState.oIsoPlot->GetProperty, Data=data if HistoLog_current eq 0 and HistoLog eq 1 then begin data[1,*]=alog10(data[1,*]) sState.oIsoPlot->SetProperty, Datay=data[1,*] endif else if HistoLog_current eq 1 and HistoLog eq 0 then begin data[1,*]=10^data[1,*] sState.oIsoPlot->SetProperty, Datay=data[1,*] end RenormIsoPlot,sState SDvis_Draw, sState end ; of image profile selector 'SAVEVIEWS-POSTSCRIPT-WIDGET' : begin IF (WIDGET_INFO(sState.wSaveViewBaseEps, /VALID_ID)) EQ 0 THEN BEGIN sState.wSaveViewBaseEps = WIDGET_BASE(TITLE='Save view to postscript',/COLUMN,XPAD=1,YPAD=5,SPACE=1) result=sState.oData_saveviewWidgetsEps->GetData(saveviewWidgetsEps) CreateSaveViewWidget,sState.wSaveViewBaseEps,saveviewWidgetsEps,'eps' result=sState.oData_saveviewWidgetsEps->SetData(saveviewWidgetsEps) ENDIF WIDGET_CONTROL, sState.wSaveViewBaseEps,SET_UVALUE=sState WIDGET_CONTROL, sState.wSaveViewBaseEps,/REALIZE XMANAGER,'SDvis_Event',sState.wSaveViewBaseEps,EVENT_HANDLER='SDvis_Event', $ CLEANUP="SaveViewWidgetEps_Cleanup",/JUST_REG end 'SAVEVIEWS-JPEG-WIDGET' : begin IF (WIDGET_INFO(sState.wSaveViewBaseJpg, /VALID_ID)) EQ 0 THEN BEGIN sState.wSaveViewBaseJpg = WIDGET_BASE(TITLE='Save view to jpeg',/COLUMN,XPAD=1,YPAD=5,SPACE=1) result=sState.oData_saveviewWidgetsJpg->GetData(saveviewWidgetsJpg) CreateSaveViewWidget,sState.wSaveViewBaseJpg,saveviewWidgetsJpg,'jpg' result=sState.oData_saveviewWidgetsJpg->SetData(saveviewWidgetsJpg) ENDIF WIDGET_CONTROL, sState.wSaveViewBaseJpg,SET_UVALUE=sState WIDGET_CONTROL, sState.wSaveViewBaseJpg,/REALIZE XMANAGER,'SDvis_Event',sState.wSaveViewBaseJpg,EVENT_HANDLER='SDvis_Event', $ CLEANUP="SaveViewWidgetJpg_Cleanup",/JUST_REG end 'SAVEVIEWS-GIF-WIDGET' : begin IF (WIDGET_INFO(sState.wSaveViewBaseGif, /VALID_ID)) EQ 0 THEN BEGIN sState.wSaveViewBaseGif = WIDGET_BASE(TITLE='Save view to gif',/COLUMN,XPAD=1,YPAD=5,SPACE=1) result=sState.oData_saveviewWidgetsGif->GetData(saveviewWidgetsGif) CreateSaveViewWidget,sState.wSaveViewBaseGif,saveviewWidgetsGif,'gif' result=sState.oData_saveviewWidgetsGif->SetData(saveviewWidgetsGif) ENDIF WIDGET_CONTROL, sState.wSaveViewBaseGif,SET_UVALUE=sState WIDGET_CONTROL, sState.wSaveViewBaseGif,/REALIZE XMANAGER,'SDvis_Event',sState.wSaveViewBaseGif,EVENT_HANDLER='SDvis_Event', $ CLEANUP="SaveViewWidgetGif_Cleanup",/JUST_REG end 'SAVEVIEWSEPS' : begin result=sState.oData_saveviewWidgetsEps->GetData(saveviewWidgetsEps) SaveViewsFileName='SDvision.eps' IF (WIDGET_INFO(sState.wSaveViewBaseEps, /VALID_ID)) EQ 1 THEN $ WIDGET_CONTROL,saveviewWidgetsEps, GET_VALUE=SaveViewsFileName result=sState.oData_vue->GetData(iflag_vue) if iflag_vue[0] EQ 1 then begin WIDGET_CONTROL, sState.wDraw1, GET_VALUE=drawWindowID1 drawWindowID1->GetProperty,DIMENSIONS=dimensions sState.oClipboard->SetProperty,DIMENSIONS=dimensions sState.oClipboard->Draw, sState.oView1, FILENAME='SDvision_view1.eps' print,'write file SDvision_view1.eps in current directory WIDGET_CONTROL, sState.wDraw2, GET_VALUE=drawWindowID2 drawWindowID2->GetProperty,DIMENSIONS=dimensions sState.oClipboard->SetProperty,DIMENSIONS=dimensions sState.oClipboard->Draw, sState.oView2, FILENAME='SDvision_view2.eps' print,'write file SDvision_view2.eps in current directory WIDGET_CONTROL, sState.wDraw3, GET_VALUE=drawWindowID3 drawWindowID3->GetProperty,DIMENSIONS=dimensions sState.oClipboard->SetProperty,DIMENSIONS=dimensions sState.oClipboard->Draw, sState.oView3, FILENAME='SDvision_view3.eps' print,'write file SDvision_view3.eps in current directory endif else begin WIDGET_CONTROL, sState.wDraw3D, GET_VALUE=drawWindowID3D drawWindowID3D->GetProperty,DIMENSIONS=dimensions sState.oClipboard->SetProperty,DIMENSIONS=dimensions sState.oClipboard->Draw, sState.oView3D, FILENAME=SaveViewsFileName[0] ;,VECTOR=1, POSTSCRIPT = 1 print,'write file ',SaveViewsFileName endelse end 'SAVEVIEWSJPG' : begin result=sState.oData_saveviewWidgetsJpg->GetData(saveviewWidgetsJpg) SaveViewsFileName='SDvision.jpg' IF (WIDGET_INFO(sState.wSaveViewBaseJpg, /VALID_ID)) EQ 1 THEN $ WIDGET_CONTROL,saveviewWidgetsJpg, GET_VALUE=SaveViewsFileName result=sState.oData_vue->GetData(iflag_vue) if iflag_vue[0] EQ 1 then begin WIDGET_CONTROL, sState.wDraw1, GET_VALUE=drawWindowID1 drawWindowID1->GetProperty,IMAGE_DATA=snapshot WRITE_JPEG, 'SDvision_view1.jpg',snapshot,TRUE=1,QUALITY=100 print,'write file SDvision_view1.jpg in current directory' WIDGET_CONTROL, sState.wDraw2, GET_VALUE=drawWindowID2 drawWindowID2->GetProperty,IMAGE_DATA=snapshot WRITE_JPEG, 'SDvision_view2.jpg',snapshot,TRUE=1,QUALITY=100 print,'write file SDvision_view2.jpg in current directory' WIDGET_CONTROL, sState.wDraw3, GET_VALUE=drawWindowID3 drawWindowID3->GetProperty,IMAGE_DATA=snapshot WRITE_JPEG, 'SDvision_view3.jpg',snapshot,TRUE=1,QUALITY=100 print,'write file SDvision_view3.jpg in current directory' endif else begin WIDGET_CONTROL, sState.wDraw3D, GET_VALUE=drawWindowID3D drawWindowID3D->GetProperty,IMAGE_DATA=snapshot WRITE_JPEG, SaveViewsFileName,snapshot,TRUE=1,QUALITY=100 print,'write file ',SaveViewsFileName endelse end 'SAVEVIEWSGIF' : begin result=sState.oData_saveviewWidgetsGif->GetData(saveviewWidgetsGif) SaveViewsFileName='SDvision.gif' IF (WIDGET_INFO(sState.wSaveViewBaseGif, /VALID_ID)) EQ 1 THEN $ WIDGET_CONTROL,saveviewWidgetsGif, GET_VALUE=SaveViewsFileName result=sState.oData_vue->GetData(iflag_vue) if iflag_vue[0] EQ 1 then begin WIDGET_CONTROL, sState.wDraw1, GET_VALUE=drawWindowID1 drawWindowID1->GetProperty,IMAGE_DATA=snapshot image=COLOR_QUAN(snapshot,1,r,g,b,COLORS=256) WRITE_GIF,'SDvision_view1.gif',image,r,g,b print,'write file SDvision_view1.gif in current directory' WIDGET_CONTROL, sState.wDraw2, GET_VALUE=drawWindowID2 drawWindowID2->GetProperty,IMAGE_DATA=snapshot image=COLOR_QUAN(snapshot,1,r,g,b,COLORS=256) WRITE_GIF,'SDvision_view2.gif',image,r,g,b print,'write file SDvision_view2.gif in current directory' WIDGET_CONTROL, sState.wDraw3, GET_VALUE=drawWindowID3 drawWindowID3->GetProperty,IMAGE_DATA=snapshot image=COLOR_QUAN(snapshot,1,r,g,b,COLORS=256) WRITE_GIF,'SDvision_view3.gif',image,r,g,b print,'write file SDvision_view3.gif in current directory' endif else begin WIDGET_CONTROL, sState.wDraw3D, GET_VALUE=drawWindowID3D drawWindowID3D->GetProperty,IMAGE_DATA=snapshot image=COLOR_QUAN(snapshot,1,r,g,b,COLORS=256) WRITE_GIF,SaveViewsFileName,image,r,g,b print,'write file ',SaveViewsFileName endelse end 'SAVEVIEWSBROWSEEPS' : begin result=sState.oData_saveviewWidgetsEps->GetData(saveviewWidgetsEps) IF (WIDGET_INFO(sState.wSaveViewBaseEps, /VALID_ID)) EQ 1 THEN $ WIDGET_CONTROL,saveviewWidgetsEps, GET_VALUE=SaveViewsFileName SaveViewsFileName = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=['*.eps'],FILE=SaveViewsFileName,TITLE='Select eps file to write') IF (WIDGET_INFO(sState.wSaveViewBaseEps, /VALID_ID)) EQ 1 THEN $ WIDGET_CONTROL,saveviewWidgetsEps, SET_VALUE=SaveViewsFileName end 'SAVEVIEWSBROWSEJPG' : begin result=sState.oData_saveviewWidgetsJpg->GetData(saveviewWidgetsJpg) IF (WIDGET_INFO(sState.wSaveViewBaseJpg, /VALID_ID)) EQ 1 THEN $ WIDGET_CONTROL,saveviewWidgetsJpg, GET_VALUE=SaveViewsFileName SaveViewsFileName = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=['*.jpg'],FILE=SaveViewsFileName,TITLE='Select jpg file to write') IF (WIDGET_INFO(sState.wSaveViewBaseJpg, /VALID_ID)) EQ 1 THEN $ WIDGET_CONTROL,saveviewWidgetsJpg, SET_VALUE=SaveViewsFileName end 'SAVEVIEWSBROWSEGIF' : begin result=sState.oData_saveviewWidgetsGif->GetData(saveviewWidgetsGif) IF (WIDGET_INFO(sState.wSaveViewBaseGif, /VALID_ID)) EQ 1 THEN $ WIDGET_CONTROL,saveviewWidgetsGif, GET_VALUE=SaveViewsFileName SaveViewsFileName = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=['*.gif'],FILE=SaveViewsFileName,TITLE='Select gif file to write') IF (WIDGET_INFO(sState.wSaveViewBaseGif, /VALID_ID)) EQ 1 THEN $ WIDGET_CONTROL,saveviewWidgetsGif, SET_VALUE=SaveViewsFileName end "SAVEVIEWSFILENAME": begin end "CLOSESAVEVIEWS": begin ; Restore the info structure before destroying event.top ; WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY ; Destroy widget hierarchy. ; WIDGET_CONTROL, sEvent.top, /DESTROY RETURN end ; anim ; 'ANIMSTART-ALIGN-360Z' : begin WIDGET_CONTROL, /HOURGLASS sState.oRotationModel->Reset sState.oRotationModel3D->Reset sState.oScalingModel->Reset sState.oMovableModel->Reset xRot = -60 yRot = 0 zRot = 0 sState.oRotationModel->Rotate, [1,0,0], xRot sState.oRotationModel->Rotate, [0,1,0], yRot sState.oRotationModel->Rotate, [0,0,1], zRot sState.oRotationModel3D->Rotate, [1,0,0], xRot sState.oRotationModel3D->Rotate, [0,1,0], yRot sState.oRotationModel3D->Rotate, [0,0,1], zRot IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xRot IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=yRot IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=0 axisRot = FLTARR(3) axisRot[0] = 0 axisRot[1] = 0 axisRot[2] = -1 angleRot = 1. for i = 0, 359 do begin sState.oRotationModel->Rotate, axisRot, angleRot , /PREMULTIPLY sState.oRotationModel3D->Rotate, axisRot, angleRot , /PREMULTIPLY SDvis_Draw, sState sState.oRotationModel3D->GetProperty, TRANSFORM=transform tempMat = FLTARR(3,3) xyzAngles = FLTARR(3) tempMat[0:2, 0:2] = transform[0:2, 0:2] xyzAngles = Angle3123(tempMat) IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xyzAngles[0] IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=xyzAngles[1] IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=xyzAngles[2] endfor result=sState.oData_xyzrot->SetData(xyzAngles) end ; anim ; anim ; 'ANIMSTART-360Z' : begin axisRot = FLTARR(3) axisRot[0] = 0 axisRot[1] = 0 axisRot[2] = -1 angleRot = 1. for i = 0, 359 do begin sState.oRotationModel->Rotate, axisRot, angleRot , /PREMULTIPLY sState.oRotationModel3D->Rotate, axisRot, angleRot , /PREMULTIPLY SDvis_Draw, sState sState.oRotationModel3D->GetProperty, TRANSFORM=transform tempMat = FLTARR(3,3) xyzAngles = FLTARR(3) tempMat[0:2, 0:2] = transform[0:2, 0:2] xyzAngles = Angle3123(tempMat) IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xyzAngles[0] IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=xyzAngles[1] IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=xyzAngles[2] endfor result=sState.oData_xyzrot->SetData(xyzAngles) end ; anim ; anim ; 'ANIMSTART-360Z-CLOSEUP' : begin axisRot = FLTARR(3) axisRot[0] = 0 axisRot[1] = 0 axisRot[2] = -1 angleRot = 1. nstep=360 sc=1.+0.5/nstep for i = 0, nstep-1 do begin sState.oRotationModel3D->Rotate, axisRot, angleRot , /PREMULTIPLY sState.oModel3D->Scale, sc,sc,sc SDvis_Draw, sState sState.oRotationModel3D->GetProperty, TRANSFORM=transform tempMat = FLTARR(3,3) xyzAngles = FLTARR(3) tempMat[0:2, 0:2] = transform[0:2, 0:2] xyzAngles = Angle3123(tempMat) IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xyzAngles[0] IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=xyzAngles[1] IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=xyzAngles[2] endfor result=sState.oData_xyzrot->SetData(xyzAngles) end ; anim ; anim ; 'ANIMSTART-70Z-CLOSEUP' : begin axisRot = FLTARR(3) axisRot[0] = 0 axisRot[1] = 0 axisRot[2] = -1 angleRot = 1.*70./360. nstep=360 sc=1.+0.5/nstep for i = 0, nstep-1 do begin sState.oRotationModel3D->Rotate, axisRot, angleRot , /PREMULTIPLY sState.oModel3D->Scale, sc,sc,sc SDvis_Draw, sState sState.oRotationModel3D->GetProperty, TRANSFORM=transform tempMat = FLTARR(3,3) xyzAngles = FLTARR(3) tempMat[0:2, 0:2] = transform[0:2, 0:2] xyzAngles = Angle3123(tempMat) IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xyzAngles[0] IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=xyzAngles[1] IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=xyzAngles[2] endfor result=sState.oData_xyzrot->SetData(xyzAngles) end ; anim ; anim ; 'ANIMSTART-360Z-MOVEAWAY' : begin axisRot = FLTARR(3) axisRot[0] = 0 axisRot[1] = 0 axisRot[2] = -1 angleRot = 1. nstep=360 sc=1.-0.5/nstep for i = 0, nstep-1 do begin sState.oRotationModel3D->Rotate, axisRot, angleRot , /PREMULTIPLY sState.oModel3D->Scale, sc,sc,sc SDvis_Draw, sState sState.oRotationModel3D->GetProperty, TRANSFORM=transform tempMat = FLTARR(3,3) xyzAngles = FLTARR(3) tempMat[0:2, 0:2] = transform[0:2, 0:2] xyzAngles = Angle3123(tempMat) IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xyzAngles[0] IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=xyzAngles[1] IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=xyzAngles[2] endfor result=sState.oData_xyzrot->SetData(xyzAngles) end ; anim ; anim ; 'ANIMSTART-CLOSEUP-500' : begin nstep=500 sc=1.+0.5/nstep for i = 0, nstep-1 do begin ;sState.oRotationModel->Scale, sc,sc,sc sState.oModel3D->Scale, sc,sc,sc SDvis_Draw, sState endfor end ; anim ; anim ; 'ANIMSTART-CLOSEUP-10' : begin nstep=10 sc=1.+0.5/nstep for i = 0, nstep-1 do begin ;sState.oRotationModel->Scale, sc,sc,sc sState.oModel3D->Scale, sc,sc,sc SDvis_Draw, sState endfor end ; anim ; anim ; 'ANIMSTART-MOVEAWAY-500' : begin nstep=500 sc=1.-0.5/nstep for i = 0, nstep-1 do begin sState.oModel3D->Scale, sc,sc,sc SDvis_Draw, sState endfor end ; anim ; anim ; 'ANIMSTART-MOVEAWAY-10' : begin nstep=10 sc=1.-0.5/nstep for i = 0, nstep-1 do begin sState.oModel3D->Scale, sc,sc,sc SDvis_Draw, sState endfor end ; anim ; mpeg ; 'MPEG-CREATE' : begin create_mpeg, sState end ; mpeg ; mpeg ; 'MPEG-START' : begin mpegFlag=1 result=sState.oData_mpegFlag->SetData(mpegFlag) result=sState.oData_mpegWidgets->GetData(mpegWidgets) WIDGET_CONTROL,mpegWidgets[10],SENSITIVE=0 WIDGET_CONTROL,mpegWidgets[12],SENSITIVE=1 end ; mpeg ; mpeg ; 'MPEG-PAUSE' : begin mpegFlag=0 result=sState.oData_mpegFlag->SetData(mpegFlag) result=sState.oData_mpegWidgets->GetData(mpegWidgets) WIDGET_CONTROL,mpegWidgets[13],SENSITIVE=1 end ; mpeg ; mpeg ; 'MPEG-RESUME' : begin mpegFlag=1 result=sState.oData_mpegFlag->SetData(mpegFlag) end ; mpeg ; mpeg ; 'MPEG-SAVE' : begin save_mpeg, sState result=sState.oData_mpegWidgets->GetData(mpegWidgets) WIDGET_CONTROL,mpegWidgets[10],SENSITIVE=1 WIDGET_CONTROL,mpegWidgets[11],SENSITIVE=0 WIDGET_CONTROL,mpegWidgets[12],SENSITIVE=0 WIDGET_CONTROL,mpegWidgets[13],SENSITIVE=0 WIDGET_CONTROL,mpegWidgets[14],SENSITIVE=0 end ; mpeg ; mpeg ; 'MPEG-FORMAT' : begin format=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT ) result=sState.oData_mpegParameters->GetData(mpegParameters) mpegParameters[0]=format result=sState.oData_mpegParameters->SetData(mpegParameters) if format eq 1 then begin print,'viewport size less or equal than 576 is recommended' print,'greater value can cause crash when saving the mpeg :' print,' [Internal MPEG Error: Horizontal size is greater than permitted in specified Level]' endif result=sState.oData_Mpeg->GetData(oMpeg) if obj_valid(oMpeg) then begin oMpeg->SetProperty,FORMAT=format endif end ; mpeg ; mpeg ; 'MPEG-QUALITY' : begin WIDGET_CONTROL, sEvent.id, GET_VALUE=quality print,'quality=',quality result=sState.oData_Mpeg->GetData(oMpeg) result=sState.oData_mpegParameters->GetData(mpegParameters) if obj_valid(oMpeg) then begin oMpeg->SetProperty,QUALITY=quality oMpeg->GetProperty, $ BITRATE=bitrate, $ MOTION_VEC_LENGTH=motion_vec_length, $ IFRAME_GAP=iframe_gap print,'bitrate changed to :',bitrate print,'motion vectors length changed to :',motion_vec_length print,'iframe_gap changed to :',iframe_gap result=sState.oData_mpegWidgets->GetData(mpegWidgets) WIDGET_CONTROL,mpegWidgets[2],SET_VALUE=bitrate mpegParameters[2]=bitrate WIDGET_CONTROL,mpegWidgets[4],SET_DROPLIST_SELECT=motion_vec_length mpegParameters[4]=motion_vec_length WIDGET_CONTROL,mpegWidgets[5],SET_VALUE=iframe_gap mpegParameters[5]=iframe_gap endif mpegParameters[1]=quality result=sState.oData_mpegParameters->SetData(mpegParameters) end ; mpeg ; mpeg ; 'MPEG-PRESET' : begin preset=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT ) result=sState.oData_mpegWidgets->GetData(mpegWidgets) result=sState.oData_mpegSensitive->GetData(mpegSensitive) result=sState.oData_mpegParameters->GetData(mpegParameters) format=mpegParameters[0] bitratemax=104857200. if format eq 1 then bitratemax=429496729200. if preset eq 0 then begin ; default motion_vec_length=0 bitrate=0 iframe_gap=0 WIDGET_CONTROL,mpegWidgets[1],SENSITIVE=1 mpegSensitive[1]=1 endif else if preset eq 1 then begin ; low quality motion_vec_length=3 bitrate=bitratemax/10. iframe_gap=10 WIDGET_CONTROL,mpegWidgets[1],SENSITIVE=0 mpegSensitive[1]=0 endif else if preset eq 2 then begin ; middle quality motion_vec_length=2 bitrate=bitratemax/5. iframe_gap=3 WIDGET_CONTROL,mpegWidgets[1],SENSITIVE=0 mpegSensitive[1]=0 endif else if preset eq 3 then begin ; high quality motion_vec_length=1 bitrate=bitratemax/2. iframe_gap=1 WIDGET_CONTROL,mpegWidgets[1],SENSITIVE=0 mpegSensitive[1]=0 endif else if preset eq 4 then begin ; max quality motion_vec_length=1 bitrate=bitratemax iframe_gap=1 WIDGET_CONTROL,mpegWidgets[1],SENSITIVE=0 mpegSensitive[1]=0 end result=sState.oData_Mpeg->GetData(oMpeg) if obj_valid(oMpeg) then begin oMpeg->SetProperty,$ BITRATE=bitrate, $ MOTION_VEC_LENGTH=motion_vec_length, $ IFRAME_GAP=iframe_gap print,'bitrate changed to :',bitrate print,'motion vectors length changed to :',motion_vec_length print,'iframe_gap changed to :',iframe_gap WIDGET_CONTROL,mpegWidgets[2],SET_VALUE=bitrate WIDGET_CONTROL,mpegWidgets[4],SET_DROPLIST_SELECT=motion_vec_length WIDGET_CONTROL,mpegWidgets[5],SET_VALUE=iframe_gap mpegParameters[2]=bitrate mpegParameters[4]=motion_vec_length mpegParameters[5]=iframe_gap endif result=sState.oData_mpegParameters->SetData(mpegParameters) result=sState.oData_mpegSensitive->SetData(mpegSensitive) end ; mpeg ; mpeg ; 'MPEG-BITRATE' : begin WIDGET_CONTROL, sEvent.id, GET_VALUE=bitrate print,'bitrate=',bitrate result=sState.oData_Mpeg->GetData(oMpeg) if obj_valid(oMpeg) then begin oMpeg->SetProperty,BITRATE=bitrate endif result=sState.oData_mpegParameters->GetData(mpegParameters) mpegParameters[2]=bitrate result=sState.oData_mpegParameters->SetData(mpegParameters) end ; mpeg ; mpeg ; 'MPEG-FRAMERATE' : begin framerate=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT ) framerate=framerate+1 print,'framerate id#=',framerate result=sState.oData_Mpeg->GetData(oMpeg) if obj_valid(oMpeg) then begin oMpeg->SetProperty,FRAME_RATE=framerate endif result=sState.oData_mpegParameters->GetData(mpegParameters) mpegParameters[3]=framerate result=sState.oData_mpegParameters->SetData(mpegParameters) end ; mpeg ; mpeg ; 'MPEG-MOTIONVECTLENGTH' : begin motion_vec_length=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT ) print,'Motion vec length =',motion_vec_length result=sState.oData_Mpeg->GetData(oMpeg) if obj_valid(oMpeg) then begin oMpeg->SetProperty,MOTION_VEC_LENGTH=motion_vec_length endif result=sState.oData_mpegParameters->GetData(mpegParameters) mpegParameters[4]=motion_vec_length result=sState.oData_mpegParameters->SetData(mpegParameters) end ; mpeg ; mpeg ; 'MPEG-IFRAME_GAP' : begin WIDGET_CONTROL, sEvent.id, GET_VALUE=iframe_gap print,'iframe_gap=',iframe_gap result=sState.oData_Mpeg->GetData(oMpeg) if obj_valid(oMpeg) then begin oMpeg->SetProperty,IFRAME_GAP=iframe_gap endif result=sState.oData_mpegParameters->GetData(mpegParameters) mpegParameters[5]=iframe_gap result=sState.oData_mpegParameters->SetData(mpegParameters) end ; mpeg ; mpeg ; 'MPEG-INTERLACED' : begin interlaced=WIDGET_INFO( sEvent.id, /DROPLIST_SELECT ) print,'interlaced =',interlaced result=sState.oData_Mpeg->GetData(oMpeg) if obj_valid(oMpeg) then begin oMpeg->SetProperty,INTERLACED=interlaced endif result=sState.oData_mpegParameters->GetData(mpegParameters) mpegParameters[6]=interlaced result=sState.oData_mpegParameters->SetData(mpegParameters) end ; mpeg ; mpeg ; 'MJPEG2000' : begin WIDGET_CONTROL, /HOURGLASS sState.oRotationModel->Reset sState.oRotationModel3D->Reset sState.oScalingModel->Reset sState.oMovableModel->Reset xRot = -60 yRot = 0 zRot = 0 sState.oRotationModel->Rotate, [1,0,0], xRot sState.oRotationModel->Rotate, [0,1,0], yRot sState.oRotationModel->Rotate, [0,0,1], zRot sState.oRotationModel3D->Rotate, [1,0,0], xRot sState.oRotationModel3D->Rotate, [0,1,0], yRot sState.oRotationModel3D->Rotate, [0,0,1], zRot IF WIDGET_INFO(sState.wXSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wXSlider, SET_VALUE=xRot IF WIDGET_INFO(sState.wYSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wYSlider, SET_VALUE=yRot IF WIDGET_INFO(sState.wZSlider, /VALID_ID) EQ 1 THEN $ WIDGET_CONTROL, sState.wZSlider, SET_VALUE=0 ;oMpeg = OBJ_NEW('IDLgrMpeg',FILENAME='view1.mpg',FORMAT=0,QUALITY=100) oMjpeg2000 = OBJ_NEW('IDLffMJPEG2000','SDvision.mj2', $ /WRITE, /REVERSIBLE,N_LAYERS=10 ) result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_flag->GetData(iflag_var) bVectorField= iflag_var eq 11 or iflag_var eq 14 axisRot = FLTARR(3) ;axisRot[0] = 1 ;axisRot[1] = -1 ;axisRot[2] = 1 axisRot[0] = 0 axisRot[1] = 0 axisRot[2] = -1 WIDGET_CONTROL, sState.wDraw3D, GET_VALUE=drawWindowID3D ;for i = 0, 359 do begin for i = 0, 50 do begin ;for i = 0, 4 do begin angleRot = 1. ;print,'i=',i if iflag_vue[0] EQ 1 AND bVectorField EQ 0 then begin sState.oRotationModel->Rotate, axisRot, angleRot , /PREMULTIPLY endif else begin sState.oRotationModel3D->Rotate, axisRot, angleRot , /PREMULTIPLY endelse SDvis_Draw, sState ;WIDGET_CONTROL, sState.wYSlider, SET_VALUE=angleRot ;drawWindowID1->GetProperty,IMAGE_DATA=snapshot ;snapshot=drawWindowID3D->Read() drawWindowID3D->GetProperty,IMAGE_DATA=snapshot ;snapshot->GetProperty,DIMENSIONS=dimensions ;print,' snapshot dimensions=',dimensions ;help, snapshot result=oMjpeg2000->SetData(snapshot) ;oMpeg->Put, sState.oImage3D endfor ;oMpeg->Save OBJ_DESTROY,oMjpeg2000 end ; mpeg ; vrml ; 'VRMLSAVE' : begin WIDGET_CONTROL, /HOURGLASS result=sState.oData_vue->SetData(iflag_vue) if iflag_vue[0] eq 1 then begin sState.drawWindowID1->GetProperty,DIMENSIONS=dim ViewID=sState.oView1 endif else begin sState.drawWindowID3D->GetProperty,DIMENSIONS=dim ViewID=sState.oView3D end quality=2 print,'vrml quality=',quality oVrml = OBJ_NEW('IDLgrVRML',FILENAME='SDvision.wrl', $ DIMENSIONS=dim, $ GRAPHICS_TREE=ViewID,$ QUALITY=quality $ ) oVrml->GetProperty,RESOLUTION=resolution ;print,'vrml resolution=',resolution ;resolution=100.*resolution ;print,'vrml resolution=',resolution oVrml->SetProperty,RESOLUTION=resolution oVrml->Draw end ; vrml ; background ; 'BLACKBACKGROUND' : begin sState.oView1->SetProperty, COLOR=[0,0,0] sState.oView3D->SetProperty, COLOR=[0,0,0] sState.oVectorField->SetProperty , COLOR=[255,255,255] sState.oStreamlines->SetProperty , COLOR=[255,255,255] dum=SetBoundariesColor(sState,'white') SDvis_Draw, sState end ; background ; background ; 'WHITEBACKGROUND' : begin sState.oView1->SetProperty, COLOR=[255,255,255] sState.oView3D->SetProperty, COLOR=[255,255,255] sState.oVectorField->SetProperty , COLOR=[0,0,0] sState.oStreamlines->SetProperty , COLOR=[0,0,0] dum=SetBoundariesColor(sState,'black') SDvis_Draw, sState end ; background ; blueground ; 'BLUEBACKGROUND' : begin sState.oView1->SetProperty, COLOR=[0,150,205] sState.oView3D->SetProperty, COLOR=[0,150,205] sState.oVectorField->SetProperty, COLOR=[0,0,0] sState.oStreamlines->SetProperty, COLOR=[0,0,0] dum=SetBoundariesColor(sState,'black') SDvis_Draw, sState end ; background 'VIEW3DVEC' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_xyzplane->GetData(xyzplane) dum=fltarr(2) dum(*)=-1000000. sState.oStreamlines->SetProperty,POLYLINES=0,Data=dum if listValue eq 1 and xyzplane eq 1 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneBase, SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[1], MAP=0 WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[0], MAP=1 endif else if listValue eq 1 and xyzplane eq 2 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneBase, SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[1], MAP=0 WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[0], MAP=1 endif else if listValue eq 1 and xyzplane eq 3 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneBase, SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[1], MAP=0 WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[0], MAP=1 endif else if listValue eq 0 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneBase, SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[1], MAP=0 WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[0], MAP=1 endif else if listValue eq 2 then begin WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[0], MAP=0 WIDGET_CONTROL, sState.wVectorFieldSeedConfigBase[1], MAP=1 SDvis_Draw, sState end if listValue ne 2 then dum=UpdateTheViews(sState,1) end ; of VIEW3DVEC ; Handle the 2D-slice plane position slider ; 'TWODSLICE3DVEC_SLIDER' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, GET_VALUE=slicePosition ;print,'slicePosition=',slicePosition result=sState.oData_xpos2DSlicePosition->GetData(xpos2DSlicePosition) xpos2DSlicePosition[0]=slicePosition result=sState.oData_xpos2DSlicePosition->SetData(xpos2DSlicePosition) WIDGET_CONTROL, sState.wSurfacePlaneSlider, SET_VALUE=slicePosition dum=UpdateTheViews(sState,1) end ; of 2D-slice plane position slider ; Handle the Surface plane selector ; 'SELECT2DSLICE3DVECPLANE' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wSelect2DSlicePlane, GET_VALUE=index xyzplane=index+1 result=sState.oData_xyzplane->SetData(xyzplane) if xyzplane eq 1 then begin WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=0 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[0], SENSITIVE=0 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[1], SENSITIVE=1 WIDGET_CONTROL, sState.wVectorFieldConfigSubBase[2], SENSITIVE=1 end ; update slider ; result=sState.oData_GridDim->GetData(GridDim) if xyzplane eq 1 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(2)-1 endif else if xyzplane eq 2 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(1)-1 endif else if xyzplane eq 3 then begin WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_SLIDER_MAX=GridDim(0)-1 end slicePosition=0 result=sState.oData_xpos2DSlicePosition->GetData(xpos2DSlicePosition) xpos2DSlicePosition[0]=slicePosition result=sState.oData_xpos2DSlicePosition->SetData(xpos2DSlicePosition) WIDGET_CONTROL, sState.w3DVec2DSlicePlaneSlider, SET_VALUE=slicePosition dum=UpdateTheViews(sState,1) end ; of SELECT2DSLICE3DVECPLANE ; Handle the Isosurface Transparency slider ; 'ISOSURFACETRANSPARENCY' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wIsoSurfaceTransparency, GET_VALUE=IsoSurfaceTransparency ;print,'IsoSurfaceTransparency=',IsoSurfaceTransparency if IsoSurfaceTransparency eq 100 then begin print,'set property double=0 in oView3D' sState.oView3D->SetProperty,DOUBLE=0 endif else begin ;print,'set property double=1 in oView3D' sState.oView3D->SetProperty,DOUBLE=1 endelse result=sState.oData_MovieFrameNMAX->GetData(MovieFrameNMAX) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_PolygonID->GetData(PolygonID) result=sState.oData_PolygonVarID->GetData(PolygonVarID) sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty,ALPHA_CHANNEL=IsoSurfaceTransparency/100. SDvis_Draw, sState end ; of Isosurface Transparency slider ; Handle the Isosurface Shininess slider ; 'ISOSURFACESHININESS' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wIsoSurfaceShininess, GET_VALUE=IsoSurfaceShininess ;print,'IsoSurfaceShininess=',IsoSurfaceShininess result=sState.oData_MovieFrameNMAX->GetData(MovieFrameNMAX) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_PolygonID->GetData(PolygonID) result=sState.oData_PolygonVarID->GetData(PolygonVarID) sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty,SHININESS=IsoSurfaceShininess SDvis_Draw, sState end ; of Isosurface Transparency slider ; Handle the Vector Field Grid Configuration ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 'FCONFXVER' : begin ;print,'FCONFXVER' WIDGET_CONTROL, sState.wVectorFieldConfig[0,0], GET_VALUE=val ;print ,'val=',val result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(0,0)=val result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) end 'FCONFYVER' : begin ;print,'FCONFYVER' WIDGET_CONTROL, sState.wVectorFieldConfig[1,0], GET_VALUE=val ;print ,'val=',val result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(1,0)=val result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) end 'FCONFZVER' : begin ;print,'FCONFZVER' WIDGET_CONTROL, sState.wVectorFieldConfig[2,0], GET_VALUE=val ;print ,'val=',val result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(2,0)=val result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 'FCONFXMIN' : begin ;print,'FCONFXMIN' WIDGET_CONTROL, sState.wVectorFieldConfig[0,1], GET_VALUE=val ;print ,'val=',val result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(0,1)=val result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) end 'FCONFYMIN' : begin ;print,'FCONFYMIN' WIDGET_CONTROL, sState.wVectorFieldConfig[1,1], GET_VALUE=val ;print ,'val=',val result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(1,1)=val result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) end 'FCONFZMIN' : begin ;print,'FCONFZMIN' WIDGET_CONTROL, sState.wVectorFieldConfig[2,1], GET_VALUE=val ;print ,'val=',val result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(2,1)=val result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 'FCONFXMAX' : begin ;print,'FCONFXMAX' WIDGET_CONTROL, sState.wVectorFieldConfig[0,2], GET_VALUE=val ;print ,'val=',val result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(0,2)=val result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) end 'FCONFYMAX' : begin ;print,'FCONFYMAX' WIDGET_CONTROL, sState.wVectorFieldConfig[1,2], GET_VALUE=val ;print ,'val=',val result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(1,2)=val result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) end 'FCONFZMAX' : begin ;print,'FCONFZMAX' WIDGET_CONTROL, sState.wVectorFieldConfig[2,2], GET_VALUE=val ;print ,'val=',val result=sState.oData_VectorFieldConfig->GetData(VectorFieldConfig) VectorFieldConfig(2,2)=val result=sState.oData_VectorFieldConfig->SetData(VectorFieldConfig) end ; end of Vector Field Grid Configuration 'UPDATETHEVIEW' : begin WIDGET_CONTROL, /HOURGLASS dum=UpdateTheViews(sState,1) end ; Handle the Vector Field Scale ; 'VECTORFIELDSCALE' : begin ;print,'VECTORFIELDSCALE' WIDGET_CONTROL, sState.wVectorFieldScale, GET_VALUE=VectorFieldScale ;print ,'VectorFieldScale=',VectorFieldScale result=sState.oData_VectorFieldScale->SetData(VectorFieldScale) end ; Handle the volume zbright & zdim factors ; 'VOLUME-ZDEPTH_CUE' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wVolumeOptions[4], GET_VALUE=zbright WIDGET_CONTROL, sState.wVolumeOptions[5], GET_VALUE=zdim depth_cue=fltarr(2) depth_cue[0]=zbright depth_cue[1]=zdim print ,'depth_cue',depth_cue result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty,DEPTH_CUE=depth_cue SDvis_Draw, sState end ; Handle the volume render step factor ; 'VOLUME-RENDER_STEP' : begin WIDGET_CONTROL, /HOURGLASS step=WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) ;print,'step=',step ;help, step if step le 0 then begin result=DIALOG_MESSAGE('Please select a render step ge 1') endif else if step gt 0 then begin result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->GetProperty,RENDER_STEP=render_step render_step(0:2)=step oVolume[MovieFrameCURRENT]->SetProperty,RENDER_STEP=render_step endif SDvis_Draw, sState end ; Handle the particle sampling ; 'PARTICLES-SAMPLING' : begin WIDGET_CONTROL, /HOURGLASS samplingString=WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) ;help,samplingString sampling=samplingString*1L ;help,sampling ;print,'sampling=',sampling ;help, step if sampling le 0L then begin result=DIALOG_MESSAGE('Please select a sampling ge 1') endif else if sampling gt 0 then begin result=sState.oData_ParticlesSampling->SetData(sampling) dum=UpdateTheViews(sState,1) endif end ; Handle the iso nmaxpolygons ; 'MAXPOLYISO' : begin WIDGET_CONTROL, /HOURGLASS nmaxPolygons=WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) ;print,'nmaxPolygons=',nmaxPolygons ;help,nmaxPolygons fnmaxPolygons=fix(nmaxPolygons,TYPE=3) ;print,'fnmaxPolygons=',fnmaxPolygons ;help,fnmaxPolygons ;if fnmaxPolygons le 0 then print,'test toto' if fnmaxPolygons le 0 then begin result=DIALOG_MESSAGE('Please select nmax polygons ge 1') SDvis_Draw, sState endif else if fnmaxPolygons gt 0 then begin result=sState.oData_nmaxPolygons->SetData(fnmaxPolygons) dum=UpdateTheViews(sState,1) endif end ; Handle the iso polygon simplification ; 'SIMPLIFICATIONISO' : begin WIDGET_CONTROL, /HOURGLASS end ; Handle the volume color and opacity tables ; 'VOLUME-COLOR-OPACITY' : begin ;ColorAndOpacityTablesWidget, sEvent, sState IF (WIDGET_INFO(sState.wCOTBase, /VALID_ID)) EQ 0 THEN BEGIN sState.wCOTBase = WIDGET_BASE(TITLE='Colors and Opacity Tables', $;GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=1, YPAD=3, SPACE=1) result=sState.oData_VolumeOpacity->GetData(Opac) result=sState.oData_vColors->GetData(vColors) result=sState.oData_vColors_orig->SetData(vColors) ColorAndOpacityTablesWidget, $ MovieFrameCURRENT, $ vColors, $ Opac, $ sState.wCOTBase, $ wDrawCOT, $ oViewCOT, $ oPlotCOT, $ wPaletteName, $ wPalettesbot, $ wPalettestop, $ wPalettes_gamma_label, $ wPalettes_gamma, $ oViewCB, $ oCB, $ wDrawColorBar, $ wZeroOpacityMin, $ wZeroOpacityMax, $ wHVRlutFileName, $ wSDvislutFileName, $ wCOTsliderList, $ wCOTsliderGroup, $ wCOTslider, $ wCOTsliderChannel, $ wCOTsliderValue, $ wDrawData, $ oViewVolumeData, $ oPlotVolumeData, $ xAxisVolumeDataB, $ xAxisVolumeDataT, $ yAxisVolumeDataL, $ yAxisVolumeDataR sState.wDrawCOT=wDrawCOT sState.oViewCOT=oViewCOT sState.oPlotCOT=oPlotCOT sState.wPaletteName=wPaletteName sState.wPalettesbot=wPalettesbot sState.wPalettestop=wPalettestop sState.wPalettes_gamma_label=wPalettes_gamma_label sState.wPalettes_gamma=wPalettes_gamma sState.oViewCB=oViewCB sState.oCB=oCB sState.wDrawColorBar=wDrawColorBar sState.wZeroOpacityMin=wZeroOpacityMin sState.wZeroOpacityMax=wZeroOpacityMax sState.wHVRlutFileName=wHVRlutFileName sState.wSDvislutFileName=wSDvislutFileName sState.wCOTsliderList=wCOTsliderList sState.wCOTsliderGroup=wCOTsliderGroup sState.wCOTslider=wCOTslider sState.wCOTsliderChannel=wCOTsliderChannel sState.wCOTsliderValue=wCOTsliderValue sState.wDrawData=wDrawData sState.oViewVolumeData=oViewVolumeData sState.oPlotVolumeData=oPlotVolumeData sState.xAxisVolumeDataB=xAxisVolumeDataB sState.xAxisVolumeDataT=xAxisVolumeDataT sState.yAxisVolumeDataL=yAxisVolumeDataL sState.yAxisVolumeDataR=yAxisVolumeDataR ENDIF WIDGET_CONTROL, sState.wCOTBase, SET_UVALUE=sState WIDGET_CONTROL, sState.wCOTBase, /REALIZE XMANAGER,'SDvis_Event',sState.wCOTBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="COTWidget_Cleanup",/JUST_REG end ; Handle the Image alpha factor ; 'IMAGE-ALPHA' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sEvent.id, GET_VALUE=ImageAlpha ;print ,'ImageAlpha=',ImageAlpha for i=0,n_elements(sState.oImage)-1 do $ sState.oImage[i]->SetProperty,ALPHA_CHANNEL=ImageAlpha/100. sState.oSimpleSurface->SetProperty,ALPHA_CHANNEL=ImageAlpha/100. SDvis_Draw, sState end ; Handle the Image3D alpha factor ; 'IMAGE3D-ALPHA' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sEvent.id, GET_VALUE=ImageAlpha ;print ,'ImageAlpha=',ImageAlpha for i=0,n_elements(sState.oImage3D)-1 do $ sState.oImage3D[i]->SetProperty,ALPHA_CHANNEL=ImageAlpha/100. SDvis_Draw, sState end ; Handle the Image3D interpolation method ; 'IMAGE3D-INTERPOLATION' : begin WIDGET_CONTROL, /HOURGLASS interpolate=WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) ;print ,'ImageAlpha=',ImageAlpha for i=0,n_elements(sState.oImage3D)-1 do $ sState.oImage3D[i]->SetProperty,INTERPOLATE=interpolate SDvis_Draw, sState end ; Handle the volume alpha factor ; 'VOLUME-ALPHA' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wVolumeOptions[0], GET_VALUE=VolumeAlpha result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty,ALPHA_CHANNEL=VolumeAlpha/100. result=sState.oData_VolumeOpacity->GetData(Opac) NewOpac=Opac*VolumeAlpha/100. oVolume[MovieFrameCURRENT]->SetProperty,OPACITY_TABLE0=NewOpac SDvis_Draw, sState end ; Handle the vectors alpha factor ; 'VECTORS-ALPHA' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wVectorsOptions[0], GET_VALUE=VectorsAlpha ;print ,'VectorsAlpha=',VectorsAlpha sState.oVectorField2D->SetProperty,ALPHA_CHANNEL=VectorsAlpha sState.oVectorField->SetProperty,ALPHA_CHANNEL=VectorsAlpha SDvis_Draw, sState end ; Handle the streamlines alpha factor ; 'STREAMLINES-ALPHA' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wStreamlinesOptions[0], GET_VALUE=StreamlinesAlpha ;print ,'StreamlinesAlpha=',StreamlinesAlpha sState.oStreamlines->SetProperty,ALPHA_CHANNEL=StreamlinesAlpha/100. sState.oStreamlines2D->SetProperty,ALPHA_CHANNEL=StreamlinesAlpha/100. SDvis_Draw, sState end ; Handle the boundaries alpha factor ; 'BOUNDARIES-ALPHA' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wBoundariesOptions[3], GET_VALUE=BoundariesAlpha BoundariesAlpha=BoundariesAlpha/100. sState.xaxis3Dbounds1->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.xaxis3Dbounds2->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.xaxis3Dbounds3->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.xaxis3Dbounds4->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.yaxis3Dbounds1->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.yaxis3Dbounds2->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.yaxis3Dbounds3->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.yaxis3Dbounds4->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.zaxis3Dbounds1->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.zaxis3Dbounds2->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.zaxis3Dbounds3->SetProperty, ALPHA_CHANNEL=BoundariesAlpha sState.zaxis3Dbounds4->SetProperty, ALPHA_CHANNEL=BoundariesAlpha SDvis_Draw, sState end ; Handle the streamlines update ; 'STREAMLINES-UPDATE' : begin WIDGET_CONTROL, /HOURGLASS dum=UpdateTheViews(sState,1) end ; Handle the streamlines max iter ; 'STREAMLINES-UPDATE-MAXITER' : begin WIDGET_CONTROL, /HOURGLASS Maxiterations=WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) result=sState.oData_StreamlinesMaxIter->SetData(Maxiterations) dum=UpdateTheViews(sState,1) end ; Handle the streamlines uniform feature ; 'STREAMLINES-UNIFORM' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wStreamlinesOptions[4], GET_VALUE=index ;print,'uniform=',index ;Maxiterations=WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) ;result=sState.oData_StreamlinesMaxIter->SetData(Maxiterations) dum=UpdateTheViews(sState,1) end ; Handle the streamlines online help ; 'STREAMLINES-HELP' : begin WIDGET_CONTROL, /HOURGLASS result=DIALOG_MESSAGE(['alpha modifies the transparency of the streamlines.' ,$ 'Streamlines are computed using the PARTICLE_TRACE method.' ,$ 'Do you want to read the PARTICLE_TRACE documentation ?'],$ /QUESTION, TITLE='SDvision Online Documentation : streamlines' ) print,result if result eq 'Yes' then ONLINE_HELP, 'PARTICLE_TRACE' end ; Handle the volume online help ; 'VOLUME-HELP' : begin WIDGET_CONTROL, /HOURGLASS result=DIALOG_MESSAGE( [$ 'Volume rendering is obtained through the use of the IDLgrVolume class' ,$ 'Do you want to read the IDLgrVolume documentation ?'],$ /QUESTION, TITLE='SDvision Online Documentation : volume rendering' ) print,result if result eq 'Yes' then ONLINE_HELP, 'IDLGRVOLUME' end ; Handle the streamlines on/off seedpick ; 'SEEDPICK-ONOFF' : begin WIDGET_CONTROL, /HOURGLASS seedpick=WIDGET_INFO(sState.wSeedPickOptions[0],/DROPLIST_SELECT ) if seedpick eq 0 then print,'streamlines seed-pick on' if seedpick eq 1 then print,'streamlines seed-pick off' end ; Handle the streamlines on/off reset ; 'SEEDPICK-RESET' : begin WIDGET_CONTROL, /HOURGLASS SeedPickUp=0 result=sState.oData_SeedPickUp->SetData(SeedPickUp) dum=fltarr(2) dum(*)=-1000000. sState.oStreamlines->SetProperty,POLYLINES=0,Data=dum sState.oVectorField->SetProperty,POLYLINES=0,Data=dum,$ ;LABEL_OBJECTS=0, $ LABEL_POLYLINES=0, $ ;LABEL_OFFSETS=0, $ SYMBOL=0 ;dum=UpdateTheViews(sState,1) SDvis_Draw, sState end ; Handle the Particles alpha factor ; 'PARTICLES-ALPHA' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wParticlesOptions[0], GET_VALUE=ParticlesAlpha ;print ,'test ParticlesAlpha=',ParticlesAlpha sState.oParticles[0]->SetProperty,ALPHA_CHANNEL=ParticlesAlpha/100. sState.oParticles[1]->SetProperty,ALPHA_CHANNEL=ParticlesAlpha/100. sState.oSymbolOrb->SetProperty,ALPHA_CHANNEL=ParticlesAlpha/100. sState.oOrb->SetProperty,ALPHA_CHANNEL=ParticlesAlpha/100. sState.oSymbolDot->SetProperty,ALPHA_CHANNEL=ParticlesAlpha/100. ctid=WIDGET_INFO(sState.wParticlesColorTable,/DROPLIST_SELECT ) if ctid gt 0 then begin sState.oParticles[0]->GetProperty,VERT_COLORS=vc if N_elements(vc) ge 3 then begin vc[3,*]=255*ParticlesAlpha/100. sState.oParticles[0]->SetProperty,VERT_COLORS=vc sState.oParticles[1]->GetProperty,VERT_COLORS=vc vc[3,*]=255*ParticlesAlpha/100. sState.oParticles[1]->SetProperty,VERT_COLORS=vc endif endif SDvis_Draw, sState end ; Handle the Particles size ; 'PARTICLES-SIZE' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wParticlesOptions[2], GET_VALUE=ParticlesSize print ,'ParticlesSize=',ParticlesSize sState.oSymbolDot->SetProperty,SIZE=ParticlesSize sState.oOrb->SetProperty,radius=ParticlesSize SDvis_Draw, sState end ; Handle the AMR Level Min ; 'AMRLEVELMIN' : begin RamsesLevelMin = WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) result=sState.oData_AmrLevels->GetData(AmrLevels) if AmrLevels[0] ne RamsesLevelMin then begin result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) AmrLevels[0]=RamsesLevelMin AmrLevels[2]=RamsesLevelMin result=sState.oData_AmrLevels->SetData(AmrLevels) endif end ; Handle the AMR Level Max ; 'AMRLEVELMAX' : begin RamsesLevelMax = WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) result=sState.oData_AmrLevels->GetData(AmrLevels) if AmrLevels[1] ne RamsesLevelMax then begin result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) AmrLevels[1]=RamsesLevelMax AmrLevels[3]=RamsesLevelMax result=sState.oData_AmrLevels->SetData(AmrLevels) endif end ; Handle the MESHIJK X MIN ; 'MESHIJKXMIN' : begin result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) if sState.TranslateBoundaries[0] eq 0 then begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], GET_VALUE=value WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], GET_VALUE=valueMax if value ge valueMax then begin $ WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], SET_VALUE=valueMax-0.0001 WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], GET_VALUE=value endif ;print ,'MESHIJK X MIN=',value MeshIJKboundaries[0]=value result=sState.oData_scaleValue->SetData(1) if WIDGET_INFO(sState.wRamsesConfigScaleSlider,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=1 if WIDGET_INFO(sState.wRamsesConfigScaleValue,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=1 endif $ else begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], GET_VALUE=valueMin valueMax = valueMin + sState.DiffMinMaxMemories[0] if(valueMax gt 1) then begin valueMax = 1 valueMin = 1 - sState.DiffMinMaxMemories[0] endif WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], SET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], SET_VALUE=valueMax MeshIJKboundaries[0]=valueMin MeshIJKboundaries[1]=valueMax endelse result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK X MAX ; 'MESHIJKXMAX' : begin result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) if sState.TranslateBoundaries[0] eq 0 then begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], GET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], GET_VALUE=value if valueMin ge value then begin $ WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], SET_VALUE=valueMin+0.01 WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], GET_VALUE=value endif ;print ,'MESHIJK X MAX=',value MeshIJKboundaries[1]=value result=sState.oData_scaleValue->SetData(1) if WIDGET_INFO(sState.wRamsesConfigScaleSlider,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=1 if WIDGET_INFO(sState.wRamsesConfigScaleValue,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=1 endif $ else begin ;WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], GET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], GET_VALUE=valueMax valueMin = valueMax - sState.DiffMinMaxMemories[0] if(valueMin lt 0) then begin valueMin = 0. valueMax = valueMin + sState.DiffMinMaxMemories[0] endif WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], SET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], SET_VALUE=valueMax MeshIJKboundaries[0]=valueMin MeshIJKboundaries[1]=valueMax endelse result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK Y MIN ; 'MESHIJKYMIN' : begin result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) if sState.TranslateBoundaries[1] eq 0 then begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], GET_VALUE=value WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], GET_VALUE=valueMax if value ge valueMax then begin $ WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], SET_VALUE=valueMax-0.01 WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], GET_VALUE=value endif ;print ,'MESHIJK X MIN=',value MeshIJKboundaries[2]=value result=sState.oData_scaleValue->SetData(1) if WIDGET_INFO(sState.wRamsesConfigScaleSlider,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=1 if WIDGET_INFO(sState.wRamsesConfigScaleValue,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=1 endif $ else begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], GET_VALUE=valueMin valueMax = valueMin + sState.DiffMinMaxMemories[1] if(valueMax gt 1) then begin valueMax = 1 valueMin = 1 - sState.DiffMinMaxMemories[1] endif WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], SET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], SET_VALUE=valueMax MeshIJKboundaries[2]=valueMin MeshIJKboundaries[3]=valueMax endelse result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK Y MAX ; 'MESHIJKYMAX' : begin result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) if sState.TranslateBoundaries[1] eq 0 then begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], GET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], GET_VALUE=value if valueMin ge value then begin $ WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], SET_VALUE=valueMin+0.01 WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], GET_VALUE=value endif ;print ,'MESHIJK Y MAX=',value MeshIJKboundaries[3]=value result=sState.oData_scaleValue->SetData(1) if WIDGET_INFO(sState.wRamsesConfigScaleSlider,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=1 if WIDGET_INFO(sState.wRamsesConfigScaleValue,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=1 endif $ else begin ;WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], GET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], GET_VALUE=valueMax valueMin = valueMax - sState.DiffMinMaxMemories[1] if(valueMin lt 0) then begin valueMin = 0. valueMax = valueMin + sState.DiffMinMaxMemories[1] endif WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], SET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], SET_VALUE=valueMax MeshIJKboundaries[2]=valueMin MeshIJKboundaries[3]=valueMax endelse result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK Z MIN ; 'MESHIJKZMIN' : begin result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) if sState.TranslateBoundaries[2] eq 0 then begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], GET_VALUE=value WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], GET_VALUE=valueMax if value ge valueMax then begin $ WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], SET_VALUE=valueMax-0.01 WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], GET_VALUE=value endif ;print ,'MESHIJK Z MIN=',value MeshIJKboundaries[4]=value result=sState.oData_scaleValue->SetData(1) if WIDGET_INFO(sState.wRamsesConfigScaleSlider,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=1 if WIDGET_INFO(sState.wRamsesConfigScaleValue,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=1 endif $ else begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], GET_VALUE=valueMin valueMax = valueMin + sState.DiffMinMaxMemories[2] if(valueMax gt 1) then begin valueMax = 1 valueMin = 1 - sState.DiffMinMaxMemories[2] endif WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], SET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], SET_VALUE=valueMax MeshIJKboundaries[4]=valueMin MeshIJKboundaries[5]=valueMax endelse result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK Z MAX ; 'MESHIJKZMAX' : begin result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) if sState.TranslateBoundaries[2] eq 0 then begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], GET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], GET_VALUE=value if valueMin ge value then begin $ WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], SET_VALUE=valueMin+0.01 WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], GET_VALUE=value endif ;print ,'MESHIJK Z MAX=',value MeshIJKboundaries[5]=value result=sState.oData_scaleValue->SetData(1) if WIDGET_INFO(sState.wRamsesConfigScaleSlider,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=1 if WIDGET_INFO(sState.wRamsesConfigScaleValue,/VALID_ID) EQ 1 then $ WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=1 endif $ else begin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], GET_VALUE=valueMax valueMin = valueMax - sState.DiffMinMaxMemories[2] if(valueMin lt 0) then begin valueMin = 0. valueMax = valueMin + sState.DiffMinMaxMemories[2] endif WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], SET_VALUE=valueMin WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], SET_VALUE=valueMax MeshIJKboundaries[4]=valueMin MeshIJKboundaries[5]=valueMax endelse result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) sState.drawWindowID3D->Draw, sState.oView3D end 'TRANSLATEX' : begin WIDGET_CONTROL, sState.wRamsesConfigTranslate[0], GET_VALUE=on sState.TranslateBoundaries[0] = on result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) sState.DiffMinMaxMemories[0] = MeshIJKboundaries[1] - MeshIJKboundaries[0] end 'TRANSLATEY' : begin WIDGET_CONTROL, sState.wRamsesConfigTranslate[1], GET_VALUE=on sState.TranslateBoundaries[1] = on result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) sState.DiffMinMaxMemories[1] = MeshIJKboundaries[3] - MeshIJKboundaries[2] end 'TRANSLATEZ' : begin WIDGET_CONTROL, sState.wRamsesConfigTranslate[2], GET_VALUE=on sState.TranslateBoundaries[2] = on result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) sState.DiffMinMaxMemories[2] = MeshIJKboundaries[5] - MeshIJKboundaries[4] end 'SCALE_BOUNDARIES' : begin result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) result=sState.oData_scaleValue->GetData(oldValue) WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, GET_VALUE=value if value eq 0 OR value eq 2 then begin WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=oldValue WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=calculScaleValue(oldValue) break endif old_distance_x = MeshIJKboundaries[1] - MeshIJKboundaries[0] old_distance_y = MeshIJKboundaries[3] - MeshIJKboundaries[2] old_distance_z = MeshIJKboundaries[5] - MeshIJKboundaries[4] new_distance_x = value/oldValue * old_distance_x new_distance_y = value/oldValue * old_distance_y new_distance_z = value/oldValue * old_distance_z dx = new_distance_x / 2 - old_distance_x / 2 dy = new_distance_y / 2 - old_distance_y / 2 dz = new_distance_z / 2 - old_distance_z / 2 new_x_min = MeshIJKboundaries[0] - dx new_x_max = MeshIJKboundaries[1] + dx new_y_min = MeshIJKboundaries[2] - dy new_y_max = MeshIJKboundaries[3] + dy new_z_min = MeshIJKboundaries[4] - dz new_z_max = MeshIJKboundaries[5] + dz eps = 0.001 if ( new_x_min lt 0-eps OR new_x_max gt 1+eps $ OR new_y_min lt 0-eps OR new_y_max gt 1+eps $ OR new_z_min lt 0-eps OR new_z_max gt 1+eps ) then begin WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=oldValue WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=calculScaleValue(oldValue) break endif MeshIJKboundaries[0] = new_x_min MeshIJKboundaries[1] = new_x_max MeshIJKboundaries[2] = new_y_min MeshIJKboundaries[3] = new_y_max MeshIJKboundaries[4] = new_z_min MeshIJKboundaries[5] = new_z_max WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], SET_VALUE=MeshIJKboundaries[0] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], SET_VALUE=MeshIJKboundaries[1] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], SET_VALUE=MeshIJKboundaries[2] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], SET_VALUE=MeshIJKboundaries[3] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], SET_VALUE=MeshIJKboundaries[4] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], SET_VALUE=MeshIJKboundaries[5] result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) sState.DiffMinMaxMemories[0] = MeshIJKboundaries[1] - MeshIJKboundaries[0] sState.DiffMinMaxMemories[1] = MeshIJKboundaries[3] - MeshIJKboundaries[2] sState.DiffMinMaxMemories[2] = MeshIJKboundaries[5] - MeshIJKboundaries[4] result=sState.oData_scaleValue->SetData(value) WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=calculScaleValue(value) result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) sState.drawWindowID3D->Draw, sState.oView3D end 'CHANGE_SCALE_BOUNDARIES' : begin result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) result=sState.oData_scaleValue->GetData(oldValue) WIDGET_CONTROL, sState.wRamsesConfigScaleValue, GET_VALUE=value if value eq 0 OR value eq 2 then begin WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=oldValue WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=calculScaleValue(oldValue) break endif old_distance_x = MeshIJKboundaries[1] - MeshIJKboundaries[0] old_distance_y = MeshIJKboundaries[3] - MeshIJKboundaries[2] old_distance_z = MeshIJKboundaries[5] - MeshIJKboundaries[4] new_distance_x = value/oldValue * old_distance_x new_distance_y = value/oldValue * old_distance_y new_distance_z = value/oldValue * old_distance_z dx = new_distance_x / 2 - old_distance_x / 2 dy = new_distance_y / 2 - old_distance_y / 2 dz = new_distance_z / 2 - old_distance_z / 2 new_x_min = MeshIJKboundaries[0] - dx new_x_max = MeshIJKboundaries[1] + dx new_y_min = MeshIJKboundaries[2] - dy new_y_max = MeshIJKboundaries[3] + dy new_z_min = MeshIJKboundaries[4] - dz new_z_max = MeshIJKboundaries[5] + dz eps = 0.001 if ( new_x_min lt 0-eps OR new_x_max gt 1+eps $ OR new_y_min lt 0-eps OR new_y_max gt 1+eps $ OR new_z_min lt 0-eps OR new_z_max gt 1+eps ) then begin WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=oldValue WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=calculScaleValue(oldValue) break endif MeshIJKboundaries[0] = new_x_min MeshIJKboundaries[1] = new_x_max MeshIJKboundaries[2] = new_y_min MeshIJKboundaries[3] = new_y_max MeshIJKboundaries[4] = new_z_min MeshIJKboundaries[5] = new_z_max WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], SET_VALUE=MeshIJKboundaries[0] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], SET_VALUE=MeshIJKboundaries[1] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], SET_VALUE=MeshIJKboundaries[2] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], SET_VALUE=MeshIJKboundaries[3] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], SET_VALUE=MeshIJKboundaries[4] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], SET_VALUE=MeshIJKboundaries[5] result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) sState.DiffMinMaxMemories[0] = MeshIJKboundaries[1] - MeshIJKboundaries[0] sState.DiffMinMaxMemories[1] = MeshIJKboundaries[3] - MeshIJKboundaries[2] sState.DiffMinMaxMemories[2] = MeshIJKboundaries[5] - MeshIJKboundaries[4] scaleValue = calculScaleValueInverse(value) result=sState.oData_scaleValue->SetData(scaleValue) WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=scaleValue result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) sState.drawWindowID3D->Draw, sState.oView3D end 'PUT_BOUNDARIES_AS_A_CUBIC' : begin result=sState.oData_MeshIJKboundaries->GetData(MeshIJKboundaries) distance_x = MeshIJKboundaries[1] - MeshIJKboundaries[0] distance_y = MeshIJKboundaries[3] - MeshIJKboundaries[2] distance_z = MeshIJKboundaries[5] - MeshIJKboundaries[4] if (distance_x ge distance_y AND distance_x ge distance_z) then edge_distance = distance_x $ else if (distance_y ge distance_z) then edge_distance = distance_y $ else edge_distance = distance_z dx = edge_distance / 2 - distance_x / 2 dy = edge_distance / 2 - distance_y / 2 dz = edge_distance / 2 - distance_z / 2 new_x_min = MeshIJKboundaries[0] - dx new_x_max = MeshIJKboundaries[1] + dx new_y_min = MeshIJKboundaries[2] - dy new_y_max = MeshIJKboundaries[3] + dy new_z_min = MeshIJKboundaries[4] - dz new_z_max = MeshIJKboundaries[5] + dz print, new_x_min, new_x_max print, new_y_min, new_y_max print, new_z_min, new_z_max eps = 0.001 if ( new_x_min lt 0-eps ) then begin diff = 0 - new_x_min print, "diff = ", diff MeshIJKboundaries[0] = new_x_min + diff MeshIJKboundaries[1] = new_x_max + diff endif $ else if ( new_x_max gt 1+eps ) then begin diff = new_x_max - 1 print, "diff = ", diff MeshIJKboundaries[1] = new_x_max - diff MeshIJKboundaries[0] = new_x_min - diff endif $ else begin MeshIJKboundaries[0] = new_x_min MeshIJKboundaries[1] = new_x_max endelse if ( new_y_min lt 0-eps ) then begin diff = 0 - new_y_min print, "diff = ", diff MeshIJKboundaries[2] = new_y_min + diff MeshIJKboundaries[3] = new_y_max + diff endif $ else if ( new_y_max gt 1+eps ) then begin diff = new_y_max - 1 print, "diff = ", diff MeshIJKboundaries[3] = new_y_max - diff MeshIJKboundaries[2] = new_y_min - diff endif $ else begin MeshIJKboundaries[2] = new_y_min MeshIJKboundaries[3] = new_y_max endelse if ( new_z_min lt 0-eps ) then begin diff = 0 - new_z_min print, "diff = ", diff MeshIJKboundaries[4] = new_z_min + diff MeshIJKboundaries[5] = new_z_max + diff endif $ else if ( new_z_max gt 1+eps ) then begin diff = new_z_max - 1 print, "diff = ", diff MeshIJKboundaries[5] = new_z_max - diff MeshIJKboundaries[4] = new_z_min - diff endif $ else begin MeshIJKboundaries[4] = new_z_min MeshIJKboundaries[5] = new_z_max endelse WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[0], SET_VALUE=MeshIJKboundaries[0] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[1], SET_VALUE=MeshIJKboundaries[1] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[2], SET_VALUE=MeshIJKboundaries[2] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[3], SET_VALUE=MeshIJKboundaries[3] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[4], SET_VALUE=MeshIJKboundaries[4] WIDGET_CONTROL, sState.wRamsesConfigBoundariesBase[5], SET_VALUE=MeshIJKboundaries[5] result=sState.oData_MeshIJKboundaries->SetData(MeshIJKboundaries) sState.DiffMinMaxMemories[0] = MeshIJKboundaries[1] - MeshIJKboundaries[0] sState.DiffMinMaxMemories[1] = MeshIJKboundaries[3] - MeshIJKboundaries[2] sState.DiffMinMaxMemories[2] = MeshIJKboundaries[5] - MeshIJKboundaries[4] result=sState.oData_scaleValue->SetData(1) WIDGET_CONTROL, sState.wRamsesConfigScaleSlider, SET_VALUE=1 WIDGET_CONTROL, sState.wRamsesConfigScaleValue, SET_VALUE=1 result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries result=sState.oData_MeshIJKStatus->GetData(MeshIJKStatus) for i=0,8 do begin if MeshIJKStatus[i] eq 1 then MeshIJKStatus[i] = 2 endfor result=sState.oData_MeshIJKStatus->SetData(MeshIJKStatus) sState.drawWindowID3D->Draw, sState.oView3D end 'CHOOSE_BOUNDARIE_COLOR' : begin colorValue = WIDGET_INFO(sEvent.id, /DROPLIST_SELECT) result = sState.oData_colorBoundarieValue->SetData(colorValue) color = chooseColor(colorValue) print, color result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) subAxisBoundaries[0]->setProperty, COLOR = color subAxisBoundaries[1]->setProperty, COLOR = color subAxisBoundaries[2]->setProperty, COLOR = color subAxisBoundaries[3]->setProperty, COLOR = color subAxisBoundaries[4]->setProperty, COLOR = color subAxisBoundaries[5]->setProperty, COLOR = color subAxisBoundaries[6]->setProperty, COLOR = color subAxisBoundaries[7]->setProperty, COLOR = color subAxisBoundaries[8]->setProperty, COLOR = color subAxisBoundaries[9]->setProperty, COLOR = color subAxisBoundaries[10]->setProperty, COLOR = color subAxisBoundaries[11]->setProperty, COLOR = color result=sState.oData_subAxisBoundaries->SetData(subAxisBoundaries) sState.drawWindowID3D->Draw, sState.oView3D end ;;;;;;;;;;;;;;;;;; ; Define event for the amr widget ; Handle the MESHIJK X MIN ; 'AMRMESHIJKXMIN' : begin result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->GetData(wRamsesAMRConfigBoundariesBase) if AMRTranslateBoundaries[0] eq 0 then begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], GET_VALUE=value WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], GET_VALUE=valueMax if value ge valueMax then begin $ WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], SET_VALUE=valueMax-0.0001 WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], GET_VALUE=value endif ;print ,'MESHIJK X MIN=',value AMRMeshIJKboundaries[0]=value result=sState.oData_AMRscaleValue->SetData(1) result = sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=1 WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=1 result = sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) endif $ else begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], GET_VALUE=valueMin result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) valueMax = valueMin + AMRDiffMinMaxMemories[0] if(valueMax gt 1) then begin valueMax = 1 valueMin = 1 - AMRDiffMinMaxMemories[0] endif WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], SET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], SET_VALUE=valueMax AMRMeshIJKboundaries[0]=valueMin AMRMeshIJKboundaries[1]=valueMax endelse result=sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) DrawTheBoundariesGeometry, AMRMeshIJKboundaries, subAxisAMRBoundaries result=sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK X MAX ; 'AMRMESHIJKXMAX' : begin result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->GetData(wRamsesAMRConfigBoundariesBase) if AMRTranslateBoundaries[0] eq 0 then begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], GET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], GET_VALUE=value if valueMin ge value then begin $ WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], SET_VALUE=valueMin+0.01 WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], GET_VALUE=value endif ;print ,'MESHIJK X MAX=',value AMRMeshIJKboundaries[1]=value result=sState.oData_AMRscaleValue->SetData(1) result = sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=1 WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=1 result = sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) endif $ else begin ;WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], GET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], GET_VALUE=valueMax result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) valueMin = valueMax - AMRDiffMinMaxMemories[0] if(valueMin lt 0) then begin valueMin = 0. valueMax = valueMin + AMRDiffMinMaxMemories[0] endif WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], SET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], SET_VALUE=valueMax AMRMeshIJKboundaries[0]=valueMin AMRMeshIJKboundaries[1]=valueMax endelse result=sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) DrawTheBoundariesGeometry, AMRMeshIJKboundaries, subAxisAMRBoundaries result=sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK Y MIN ; 'AMRMESHIJKYMIN' : begin result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->GetData(wRamsesAMRConfigBoundariesBase) if AMRTranslateBoundaries[1] eq 0 then begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], GET_VALUE=value WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], GET_VALUE=valueMax if value ge valueMax then begin $ WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], SET_VALUE=valueMax-0.01 WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], GET_VALUE=value endif ;print ,'MESHIJK X MIN=',value AMRMeshIJKboundaries[2]=value result=sState.oData_AMRscaleValue->SetData(1) result = sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=1 WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=1 result = sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) endif $ else begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], GET_VALUE=valueMin result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) valueMax = valueMin + AMRDiffMinMaxMemories[1] if(valueMax gt 1) then begin valueMax = 1 valueMin = 1 - AMRDiffMinMaxMemories[1] endif WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], SET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], SET_VALUE=valueMax AMRMeshIJKboundaries[2]=valueMin AMRMeshIJKboundaries[3]=valueMax endelse result=sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) DrawTheBoundariesGeometry, AMRMeshIJKboundaries, subAxisAMRBoundaries result=sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK Y MAX ; 'AMRMESHIJKYMAX' : begin result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->GetData(wRamsesAMRConfigBoundariesBase) if AMRTranslateBoundaries[1] eq 0 then begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], GET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], GET_VALUE=value if valueMin ge value then begin $ WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], SET_VALUE=valueMin+0.01 WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], GET_VALUE=value endif ;print ,'MESHIJK Y MAX=',value AMRMeshIJKboundaries[3]=value result=sState.oData_AMRscaleValue->SetData(1) result = sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=1 WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=1 result = sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result = sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) endif $ else begin ;WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], GET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], GET_VALUE=valueMax result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) valueMin = valueMax - AMRDiffMinMaxMemories[1] if(valueMin lt 0) then begin valueMin = 0. valueMax = valueMin + AMRDiffMinMaxMemories[1] endif WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], SET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], SET_VALUE=valueMax AMRMeshIJKboundaries[2]=valueMin AMRMeshIJKboundaries[3]=valueMax endelse result=sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) DrawTheBoundariesGeometry, AMRMeshIJKboundaries, subAxisAMRBoundaries result=sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK Z MIN ; 'AMRMESHIJKZMIN' : begin result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->GetData(wRamsesAMRConfigBoundariesBase) if AMRTranslateBoundaries[2] eq 0 then begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], GET_VALUE=value WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], GET_VALUE=valueMax if value ge valueMax then begin $ WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], SET_VALUE=valueMax-0.01 WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], GET_VALUE=value endif ;print ,'MESHIJK Z MIN=',value AMRMeshIJKboundaries[4]=value result=sState.oData_AMRscaleValue->SetData(1) result=sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=1 WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=1 result=sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) endif $ else begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], GET_VALUE=valueMin result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) valueMax = valueMin + AMRDiffMinMaxMemories[2] if(valueMax gt 1) then begin valueMax = 1 valueMin = 1 - AMRDiffMinMaxMemories[2] endif WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], SET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], SET_VALUE=valueMax AMRMeshIJKboundaries[4]=valueMin AMRMeshIJKboundaries[5]=valueMax endelse result=sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) DrawTheBoundariesGeometry, AMRMeshIJKboundaries, subAxisAMRBoundaries result=sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) sState.drawWindowID3D->Draw, sState.oView3D end ; Handle the MESHIJK Z MAX ; 'AMRMESHIJKZMAX' : begin result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->GetData(wRamsesAMRConfigBoundariesBase) if AMRTranslateBoundaries[2] eq 0 then begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], GET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], GET_VALUE=value if valueMin ge value then begin $ WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], SET_VALUE=valueMin+0.01 WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], GET_VALUE=value endif ;print ,'MESHIJK Z MAX=',value AMRMeshIJKboundaries[5]=value result=sState.oData_AMRscaleValue->SetData(1) result=sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=1 WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=1 result=sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) endif $ else begin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], GET_VALUE=valueMax result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) valueMin = valueMax - AMRDiffMinMaxMemories[2] if(valueMin lt 0) then begin valueMin = 0. valueMax = valueMin + AMRDiffMinMaxMemories[2] endif WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], SET_VALUE=valueMin WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], SET_VALUE=valueMax AMRMeshIJKboundaries[4]=valueMin AMRMeshIJKboundaries[5]=valueMax endelse result=sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) DrawTheBoundariesGeometry, AMRMeshIJKboundaries, subAxisAMRBoundaries result=sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result=sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) sState.drawWindowID3D->Draw, sState.oView3D end 'AMRTRANSLATEX' : begin result = sState.oData_wRamsesAMRConfigTranslate->GetData(wRamsesAMRConfigTranslate) WIDGET_CONTROL, wRamsesAMRConfigTranslate[0], GET_VALUE=on result=sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) AMRTranslateBoundaries[0] = on result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) AMRDiffMinMaxMemories[0] = AMRMeshIJKboundaries[1] - AMRMeshIJKboundaries[0] result=sState.oData_AMRDiffMinMaxMemories->SetData(AMRDiffMinMaxMemories) result=sState.oData_amrTranslateBoundaries->SetData(AMRTranslateBoundaries) result = sState.oData_wRamsesAMRConfigTranslate->SetData(wRamsesAMRConfigTranslate) end 'AMRTRANSLATEY' : begin result = sState.oData_wRamsesAMRConfigTranslate->GetData(wRamsesAMRConfigTranslate) WIDGET_CONTROL, wRamsesAMRConfigTranslate[1], GET_VALUE=on result=sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) AMRTranslateBoundaries[1] = on result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) AMRDiffMinMaxMemories[1] = AMRMeshIJKboundaries[3] - AMRMeshIJKboundaries[2] result=sState.oData_AMRDiffMinMaxMemories->SetData(AMRDiffMinMaxMemories) result=sState.oData_amrTranslateBoundaries->SetData(AMRTranslateBoundaries) result = sState.oData_wRamsesAMRConfigTranslate->SetData(wRamsesAMRConfigTranslate) end 'AMRTRANSLATEZ' : begin result = sState.oData_wRamsesAMRConfigTranslate->GetData(wRamsesAMRConfigTranslate) WIDGET_CONTROL, wRamsesAMRConfigTranslate[2], GET_VALUE=on result=sState.oData_amrTranslateBoundaries->GetData(AMRTranslateBoundaries) AMRTranslateBoundaries[2] = on result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) AMRDiffMinMaxMemories[2] = AMRMeshIJKboundaries[5] - AMRMeshIJKboundaries[4] result=sState.oData_AMRDiffMinMaxMemories->SetData(AMRDiffMinMaxMemories) result=sState.oData_amrTranslateBoundaries->SetData(AMRTranslateBoundaries) result = sState.oData_wRamsesAMRConfigTranslate->SetData(wRamsesAMRConfigTranslate) end 'AMR_SCALE_BOUNDARIES' : begin result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_AMRscaleValue->GetData(oldValue) result=sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, GET_VALUE=value if value eq 0 OR value eq 2 then begin WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=oldValue WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=calculScaleValue(oldValue) result=sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) break endif old_distance_x = AMRMeshIJKboundaries[1] - AMRMeshIJKboundaries[0] old_distance_y = AMRMeshIJKboundaries[3] - AMRMeshIJKboundaries[2] old_distance_z = AMRMeshIJKboundaries[5] - AMRMeshIJKboundaries[4] new_distance_x = value/oldValue * old_distance_x new_distance_y = value/oldValue * old_distance_y new_distance_z = value/oldValue * old_distance_z dx = new_distance_x / 2 - old_distance_x / 2 dy = new_distance_y / 2 - old_distance_y / 2 dz = new_distance_z / 2 - old_distance_z / 2 new_x_min = AMRMeshIJKboundaries[0] - dx new_x_max = AMRMeshIJKboundaries[1] + dx new_y_min = AMRMeshIJKboundaries[2] - dy new_y_max = AMRMeshIJKboundaries[3] + dy new_z_min = AMRMeshIJKboundaries[4] - dz new_z_max = AMRMeshIJKboundaries[5] + dz eps = 0.001 if ( new_x_min lt 0-eps OR new_x_max gt 1+eps $ OR new_y_min lt 0-eps OR new_y_max gt 1+eps $ OR new_z_min lt 0-eps OR new_z_max gt 1+eps ) then begin WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=oldValue WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=calculScaleValue(oldValue) result=sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) break endif AMRMeshIJKboundaries[0] = new_x_min AMRMeshIJKboundaries[1] = new_x_max AMRMeshIJKboundaries[2] = new_y_min AMRMeshIJKboundaries[3] = new_y_max AMRMeshIJKboundaries[4] = new_z_min AMRMeshIJKboundaries[5] = new_z_max result=sState.oData_wRamsesAMRConfigBoundariesBase->GetData(wRamsesAMRConfigBoundariesBase) WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], SET_VALUE=AMRMeshIJKboundaries[0] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], SET_VALUE=AMRMeshIJKboundaries[1] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], SET_VALUE=AMRMeshIJKboundaries[2] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], SET_VALUE=AMRMeshIJKboundaries[3] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], SET_VALUE=AMRMeshIJKboundaries[4] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], SET_VALUE=AMRMeshIJKboundaries[5] result=sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) result=sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) result=sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) AMRDiffMinMaxMemories[0] = AMRMeshIJKboundaries[1] - AMRMeshIJKboundaries[0] AMRDiffMinMaxMemories[1] = AMRMeshIJKboundaries[3] - AMRMeshIJKboundaries[2] AMRDiffMinMaxMemories[2] = AMRMeshIJKboundaries[5] - AMRMeshIJKboundaries[4] result=sState.oData_AMRDiffMinMaxMemories->SetData(AMRDiffMinMaxMemories) result=sState.oData_AMRscaleValue->SetData(value) WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=calculScaleValue(value) result=sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) result=sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) DrawTheBoundariesGeometry, AMRMeshIJKboundaries, subAxisAMRBoundaries sState.drawWindowID3D->Draw, sState.oView3D end 'AMR_CHANGE_SCALE_BOUNDARIES' : begin result=sState.oData_AMRMeshIJKboundaries->GetData(AMRMeshIJKboundaries) result=sState.oData_AMRscaleValue->GetData(oldValue) result=sState.oData_wRamsesAMRConfigScaleSlider->GetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->GetData(wRamsesAMRConfigScaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleValue, GET_VALUE=value if value eq 0 OR value eq 2 then begin WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=oldValue WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=calculScaleValue(oldValue) result=sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) break endif old_distance_x = AMRMeshIJKboundaries[1] - AMRMeshIJKboundaries[0] old_distance_y = AMRMeshIJKboundaries[3] - AMRMeshIJKboundaries[2] old_distance_z = AMRMeshIJKboundaries[5] - AMRMeshIJKboundaries[4] new_distance_x = value/oldValue * old_distance_x new_distance_y = value/oldValue * old_distance_y new_distance_z = value/oldValue * old_distance_z dx = new_distance_x / 2 - old_distance_x / 2 dy = new_distance_y / 2 - old_distance_y / 2 dz = new_distance_z / 2 - old_distance_z / 2 new_x_min = AMRMeshIJKboundaries[0] - dx new_x_max = AMRMeshIJKboundaries[1] + dx new_y_min = AMRMeshIJKboundaries[2] - dy new_y_max = AMRMeshIJKboundaries[3] + dy new_z_min = AMRMeshIJKboundaries[4] - dz new_z_max = AMRMeshIJKboundaries[5] + dz eps = 0.001 if ( new_x_min lt 0-eps OR new_x_max gt 1+eps $ OR new_y_min lt 0-eps OR new_y_max gt 1+eps $ OR new_z_min lt 0-eps OR new_z_max gt 1+eps ) then begin WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=oldValue WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=calculScaleValue(oldValue) result=sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) break endif AMRMeshIJKboundaries[0] = new_x_min AMRMeshIJKboundaries[1] = new_x_max AMRMeshIJKboundaries[2] = new_y_min AMRMeshIJKboundaries[3] = new_y_max AMRMeshIJKboundaries[4] = new_z_min AMRMeshIJKboundaries[5] = new_z_max result=sState.oData_wRamsesAMRConfigBoundariesBase->GetData(wRamsesAMRConfigBoundariesBase) WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], SET_VALUE=AMRMeshIJKboundaries[0] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], SET_VALUE=AMRMeshIJKboundaries[1] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], SET_VALUE=AMRMeshIJKboundaries[2] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], SET_VALUE=AMRMeshIJKboundaries[3] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], SET_VALUE=AMRMeshIJKboundaries[4] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], SET_VALUE=AMRMeshIJKboundaries[5] result=sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) result=sState.oData_AMRMeshIJKboundaries->SetData(AMRMeshIJKboundaries) result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) AMRDiffMinMaxMemories[0] = AMRMeshIJKboundaries[1] - AMRMeshIJKboundaries[0] AMRDiffMinMaxMemories[1] = AMRMeshIJKboundaries[3] - AMRMeshIJKboundaries[2] AMRDiffMinMaxMemories[2] = AMRMeshIJKboundaries[5] - AMRMeshIJKboundaries[4] result=sState.oData_AMRDiffMinMaxMemories->SetData(AMRDiffMinMaxMemories) scaleValue = calculScaleValueInverse(value) result=sState.oData_AMRscaleValue->SetData(scaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=scaleValue result=sState.oData_wRamsesAMRConfigScaleSlider->SetData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->SetData(wRamsesAMRConfigScaleValue) result=sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) DrawTheBoundariesGeometry, AMRMeshIJKboundaries, subAxisAMRBoundaries sState.drawWindowID3D->Draw, sState.oView3D end 'AMR_PUT_BOUNDARIES_AS_A_CUBIC' : begin result=sState.oData_AMRMeshIJKboundaries->GetData(MeshIJKboundaries) distance_x = MeshIJKboundaries[1] - MeshIJKboundaries[0] distance_y = MeshIJKboundaries[3] - MeshIJKboundaries[2] distance_z = MeshIJKboundaries[5] - MeshIJKboundaries[4] if (distance_x ge distance_y AND distance_x ge distance_z) then edge_distance = distance_x $ else if (distance_y ge distance_z) then edge_distance = distance_y $ else edge_distance = distance_z dx = edge_distance / 2 - distance_x / 2 dy = edge_distance / 2 - distance_y / 2 dz = edge_distance / 2 - distance_z / 2 new_x_min = MeshIJKboundaries[0] - dx new_x_max = MeshIJKboundaries[1] + dx new_y_min = MeshIJKboundaries[2] - dy new_y_max = MeshIJKboundaries[3] + dy new_z_min = MeshIJKboundaries[4] - dz new_z_max = MeshIJKboundaries[5] + dz eps = 0.001 if ( new_x_min lt 0-eps ) then begin diff = 0 - new_x_min MeshIJKboundaries[0] = new_x_min + diff MeshIJKboundaries[1] = new_x_max + diff endif $ else if ( new_x_max gt 1+eps ) then begin diff = new_x_max - 1 MeshIJKboundaries[1] = new_x_max - diff MeshIJKboundaries[0] = new_x_min - diff endif $ else begin MeshIJKboundaries[0] = new_x_min MeshIJKboundaries[1] = new_x_max endelse if ( new_y_min lt 0-eps ) then begin diff = 0 - new_y_min MeshIJKboundaries[2] = new_y_min + diff MeshIJKboundaries[3] = new_y_max + diff endif $ else if ( new_y_max gt 1+eps ) then begin diff = new_y_max - 1 MeshIJKboundaries[3] = new_y_max - diff MeshIJKboundaries[2] = new_y_min - diff endif $ else begin MeshIJKboundaries[2] = new_y_min MeshIJKboundaries[3] = new_y_max endelse if ( new_z_min lt 0-eps ) then begin diff = 0 - new_z_min MeshIJKboundaries[4] = new_z_min + diff MeshIJKboundaries[5] = new_z_max + diff endif $ else if ( new_z_max gt 1+eps ) then begin diff = new_z_max - 1 MeshIJKboundaries[5] = new_z_max - diff MeshIJKboundaries[4] = new_z_min - diff endif $ else begin MeshIJKboundaries[4] = new_z_min MeshIJKboundaries[5] = new_z_max endelse result=sState.oData_wRamsesAMRConfigBoundariesBase->GetData(wRamsesAMRConfigBoundariesBase) WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[0], SET_VALUE=MeshIJKboundaries[0] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[1], SET_VALUE=MeshIJKboundaries[1] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[2], SET_VALUE=MeshIJKboundaries[2] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[3], SET_VALUE=MeshIJKboundaries[3] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[4], SET_VALUE=MeshIJKboundaries[4] WIDGET_CONTROL, wRamsesAMRConfigBoundariesBase[5], SET_VALUE=MeshIJKboundaries[5] result=sState.oData_wRamsesAMRConfigBoundariesBase->SetData(wRamsesAMRConfigBoundariesBase) result=sState.oData_AMRMeshIJKboundaries->SetData(MeshIJKboundaries) result=sState.oData_AMRDiffMinMaxMemories->GetData(AMRDiffMinMaxMemories) AMRDiffMinMaxMemories[0] = MeshIJKboundaries[1] - MeshIJKboundaries[0] AMRDiffMinMaxMemories[1] = MeshIJKboundaries[3] - MeshIJKboundaries[2] AMRDiffMinMaxMemories[2] = MeshIJKboundaries[5] - MeshIJKboundaries[4] result=sState.oData_AMRDiffMinMaxMemories->SetData(AMRDiffMinMaxMemories) result=sState.oData_AMRscaleValue->SetData(1) result=sState.oData_wRamsesAMRConfigScaleSlider->getData(wRamsesAMRConfigScaleSlider) result=sState.oData_wRamsesAMRConfigScaleValue->getData(wRamsesAMRConfigScaleValue) WIDGET_CONTROL, wRamsesAMRConfigScaleSlider, SET_VALUE=1 WIDGET_CONTROL, wRamsesAMRConfigScaleValue, SET_VALUE=1 result=sState.oData_subAxisAMRBoundaries->GetData(subAxisBoundaries) DrawTheBoundariesGeometry, MeshIJKboundaries, subAxisBoundaries sState.drawWindowID3D->Draw, sState.oView3D end 'CHOOSE_AMR_BOUNDARIE_COLOR' : begin colorValue = WIDGET_INFO(sEvent.id, /DROPLIST_SELECT) result = sState.oData_colorAMRBoundarieValue->SetData(colorValue) color = chooseColor(colorValue) print, color result=sState.oData_subAxisAMRBoundaries->GetData(subAxisBoundaries) subAxisBoundaries[0]->setProperty, COLOR = color subAxisBoundaries[1]->setProperty, COLOR = color subAxisBoundaries[2]->setProperty, COLOR = color subAxisBoundaries[3]->setProperty, COLOR = color subAxisBoundaries[4]->setProperty, COLOR = color subAxisBoundaries[5]->setProperty, COLOR = color subAxisBoundaries[6]->setProperty, COLOR = color subAxisBoundaries[7]->setProperty, COLOR = color subAxisBoundaries[8]->setProperty, COLOR = color subAxisBoundaries[9]->setProperty, COLOR = color subAxisBoundaries[10]->setProperty, COLOR = color subAxisBoundaries[11]->setProperty, COLOR = color result=sState.oData_subAxisAMRBoundaries->SetData(subAxisBoundaries) sState.drawWindowID3D->Draw, sState.oView3D end 'PLANESXYD' : begin result = sState.oData_wRamsesPlanesSelected->GetData(wRamsesPlanesSelected) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) WIDGET_CONTROL, wRamsesPlanesSelected[0], GET_VALUE=plane value = where(planesSelected ne 0, count) if(count eq 0 AND plane eq 1) then begin print, "hide the amr 3D and show the amr 2D" oAmrModel3D[0]->SetProperty, hide=1 oAmrModel2D[0]->SetProperty, hide=0 is3DModelDrawn = 0 endif planesSelected[0] = plane value = where(planesSelected ne 0, count) if(count eq 0) then begin print, "hide the amr 2D and show the amr 3D" oAmrModel3D[0]->SetProperty, hide=0 oAmrModel2D[0]->SetProperty, hide=1 is3DModelDrawn = 1 endif result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result = sState.oData_AMRoctreeGrid->GetData(grid) for i = 0, grid.nlevelmax do if (RamsesAmrLevelsFlags[i] eq 1) then polylinesPlanes[0,0,i]->SetProperty, hide = 1 - plane result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_planesSelected->SetData(planesSelected) result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->SetData(is3DModelDrawn) sState.drawWindowID3D->Draw, sState.oView3D print, "xy direct" end 'PLANESXYO' : begin result = sState.oData_wRamsesPlanesSelected->GetData(wRamsesPlanesSelected) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) WIDGET_CONTROL, wRamsesPlanesSelected[1], GET_VALUE=plane value = where(planesSelected ne 0, count) if(count eq 0 AND plane eq 1) then begin oAmrModel3D[0]->SetProperty, hide=1 oAmrModel2D[0]->SetProperty, hide=0 is3DModelDrawn = 0 endif planesSelected[1] = plane value = where(planesSelected ne 0, count) if(count eq 0) then begin oAmrModel3D[0]->SetProperty, hide=0 oAmrModel2D[0]->SetProperty, hide=1 is3DModelDrawn = 1 endif result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result=sState.oData_AMRoctreeGrid->GetData(grid) for i = 0, grid.nlevelmax do if (RamsesAmrLevelsFlags[i] eq 1) then polylinesPlanes[0,1,i]->SetProperty, hide = 1 - plane result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_planesSelected->SetData(planesSelected) result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->SetData(is3DModelDrawn) sState.drawWindowID3D->Draw, sState.oView3D print, "xy opposite" end 'PLANESYZD' : begin result = sState.oData_wRamsesPlanesSelected->GetData(wRamsesPlanesSelected) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) WIDGET_CONTROL, wRamsesPlanesSelected[2], GET_VALUE=plane value = where(planesSelected ne 0, count) if(count eq 0 AND plane eq 1) then begin oAmrModel3D[0]->SetProperty, hide=1 oAmrModel2D[0]->SetProperty, hide=0 is3DModelDrawn = 0 endif planesSelected[2] = plane value = where(planesSelected ne 0, count) if(count eq 0) then begin oAmrModel3D[0]->SetProperty, hide=0 oAmrModel2D[0]->SetProperty, hide=1 is3DModelDrawn = 1 endif result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result=sState.oData_AMRoctreeGrid->GetData(grid) for i = 0, grid.nlevelmax do if (RamsesAmrLevelsFlags[i] eq 1) then polylinesPlanes[0,2,i]->SetProperty, hide = 1 - plane result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_planesSelected->SetData(planesSelected) result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->SetData(is3DModelDrawn) sState.drawWindowID3D->Draw, sState.oView3D print, "yz direct" end 'PLANESYZO' : begin result = sState.oData_wRamsesPlanesSelected->GetData(wRamsesPlanesSelected) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) WIDGET_CONTROL, wRamsesPlanesSelected[3], GET_VALUE=plane value = where(planesSelected ne 0, count) if(count eq 0 AND plane eq 1) then begin sState.oAmrModel3D[0]->SetProperty, hide=1 sState.oAmrModel2D[0]->SetProperty, hide=0 sState.is3DModelDrawn = 0 endif planesSelected[3] = plane value = where(planesSelected ne 0, count) if(count eq 0) then begin sState.oAmrModel3D[0]->SetProperty, hide=0 sState.oAmrModel2D[0]->SetProperty, hide=1 sState.is3DModelDrawn = 1 endif result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result=sState.oData_AMRoctreeGrid->GetData(grid) for i = 0, grid.nlevelmax do if (RamsesAmrLevelsFlags[i] eq 1) then polylinesPlanes[0,3,i]->SetProperty, hide = 1 - plane result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_planesSelected->SetData(planesSelected) result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->SetData(is3DModelDrawn) sState.drawWindowID3D->Draw, sState.oView3D print, "yz opposite" end 'PLANESXZD' : begin result = sState.oData_wRamsesPlanesSelected->GetData(wRamsesPlanesSelected) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) WIDGET_CONTROL, wRamsesPlanesSelected[4], GET_VALUE=plane value = where(planesSelected ne 0, count) if(count eq 0 AND plane eq 1) then begin oAmrModel3D[0]->SetProperty, hide=1 oAmrModel2D[0]->SetProperty, hide=0 is3DModelDrawn = 0 endif planesSelected[4] = plane value = where(planesSelected ne 0, count) if(count eq 0) then begin oAmrModel3D[0]->SetProperty, hide=0 oAmrModel2D[0]->SetProperty, hide=1 is3DModelDrawn = 1 endif result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result=sState.oData_AMRoctreeGrid->GetData(grid) for i = 0, grid.nlevelmax do if (RamsesAmrLevelsFlags[i] eq 1) then polylinesPlanes[0,4,i]->SetProperty, hide = 1 - plane result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_planesSelected->SetData(planesSelected) result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->SetData(is3DModelDrawn) sState.drawWindowID3D->Draw, sState.oView3D print, "xz direct" end 'PLANESXZO' : begin result = sState.oData_wRamsesPlanesSelected->GetData(wRamsesPlanesSelected) result = sState.oData_planesSelected->GetData(planesSelected) result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_oAmrModel3D->GetData(oAmrModel3D) result = sState.oData_oAmrModel2D->GetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) WIDGET_CONTROL, wRamsesPlanesSelected[5], GET_VALUE=plane value = where(planesSelected ne 0, count) if(count eq 0 AND plane eq 1) then begin oAmrModel3D[0]->SetProperty, hide=1 oAmrModel2D[0]->SetProperty, hide=0 is3DModelDrawn = 0 endif planesSelected[5] = plane value = where(planesSelected ne 0, count) if(count eq 0) then begin oAmrModel3D[0]->SetProperty, hide=0 oAmrModel2D[0]->SetProperty, hide=1 is3DModelDrawn = 1 endif result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_RamsesAmrLevelsFlags->GetData(RamsesAmrLevelsFlags) result=sState.oData_AMRoctreeGrid->GetData(grid) for i = 0, grid.nlevelmax do if (RamsesAmrLevelsFlags[i] eq 1) then polylinesPlanes[0,5,i]->SetProperty, hide = 1 - plane result = sState.oData_PolylinesPlanes->SetData(polylinesPlanes) result = sState.oData_planesSelected->SetData(planesSelected) result = sState.oData_oAmrModel3D->SetData(oAmrModel3D) result = sState.oData_oAmrModel2D->SetData(oAmrModel2D) result = sState.oData_is3DModelDrawn->SetData(is3DModelDrawn) sState.drawWindowID3D->Draw, sState.oView3D print, "xz opposite" end ; Handle the Endianess ; ;'ENDIAN' : begin ; Endian = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) ; ;print ,'Endian=',Endian ; result=sState.oData_Endian->SetData(Endian) ;end ; Handle the Endianess ; "LITTLEENDIAN": begin Endian = 0 ;print ,'Endian=',Endian result=sState.oData_Endian->SetData(Endian) WIDGET_CONTROL,sState.wEndian[0],SET_BUTTON=1 WIDGET_CONTROL,sState.wEndian[1],SET_BUTTON=0 end ; Handle the Endianess ; "BIGENDIAN": begin Endian = 1 ;print ,'Endian=',Endian result=sState.oData_Endian->SetData(Endian) WIDGET_CONTROL,sState.wEndian[0],SET_BUTTON=0 WIDGET_CONTROL,sState.wEndian[1],SET_BUTTON=1 end ; Handle the Documentation ; 'ONLINEHELP' : begin ONLINE_HELP,BOOK="/local/home/pomarede/simulations/help/widg3D.adp",/FULL_PATH end ; Handle the Particles color ; 'PARTICLES-COLOR' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) case listValue of ; red. ; 0 : begin sState.oOrb->SetProperty, color=[255,0,0] sState.oSymbolDot->SetProperty, color=[255,0,0] end ; blue ; 1 : begin sState.oOrb->SetProperty, color=[0,0,255] sState.oSymbolDot->SetProperty, color=[0,0,255] end ; green ; 2 : begin sState.oOrb->SetProperty, color=[0,255,0] sState.oSymbolDot->SetProperty, color=[0,255,0] end ; white ; 3 : begin sState.oOrb->SetProperty, color=[255,255,255] sState.oSymbolDot->SetProperty, color=[255,255,255] end ; black ; 4 : begin sState.oOrb->SetProperty, color=[0,0,0] sState.oSymbolDot->SetProperty, color=[0,0,0] end endcase ; of listValue SDvis_Draw, sState end ; of PARTICLES-COLOR ; Handle the Particles marker ; 'PARTICLES-MARKER' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) case listValue of ; dot ; 0 : begin sState.oParticles[0]->SetProperty, SYMBOL=sState.oSymbolDot sState.oParticles[1]->SetProperty, SYMBOL=sState.oSymbolDot end ; orb ; 1 : begin sState.oParticles[0]->SetProperty, SYMBOL=sState.oSymbolOrb sState.oParticles[1]->SetProperty, SYMBOL=sState.oSymbolOrb end endcase ; of listValue SDvis_Draw, sState end ; of PARTICLES-COLOR ; Handle the Particles depth testing ; 'PARTICLES-DEPTH-TESTING' : begin WIDGET_CONTROL, /HOURGLASS depth_test_disable=1-WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) print,'depth_test_disable=',depth_test_disable sState.oParticles[0]->SetProperty,DEPTH_TEST_DISABLE=depth_test_disable sState.oParticles[1]->SetProperty,DEPTH_TEST_DISABLE=depth_test_disable SDvis_Draw, sState end ; of PARTICLES-DEPTH-TESTING ; Handle the Particles color table ; 'PARTICLES-CT' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) ;print,'PARTICLES-CT =',listValue if listValue eq 0 then begin sState.oParticles[0]->SetProperty,VERT_COLORS=0 sState.oParticles[1]->SetProperty,VERT_COLORS=0 SDvis_Draw, sState endif else begin dum=UpdateTheViews(sState,1) endelse end ; of PARTICLES-CT ; Handle the Particles density/velocity selection ; 'PARTICLES-DV' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) print,'PARTICLES-DV =',listValue dum=UpdateTheViews(sState,1) ;dum=DrawTheDarkMatterdensity(sState) ;SDvis_Draw, sState end ; of PARTICLES-DV ; Handle the Particles linlog x selection ; 'PARTICLES-LINLOGX' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) print,'PARTICLES-LINLOGX =',listValue dum=UpdateTheViews(sState,1) end ; ; Handle the Particles linlog y selection ; 'PARTICLES-LINLOGY' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) ;print,'PARTICLES-LINLOGY =',listValue dum=UpdateTheViews(sState,1) end ; ; Handle the Volume light ; 'VOLUME-LIGHTING' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty, LIGHTING_MODEL=listValue ;print,'LIGHTING_MODEL=',listValue SDvis_Draw, sState end ; ; Handle the Volume 1/2-sidedness ; 'VOLUME-TWO-SIDED' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty, TWO_SIDED=listValue ;print,'TWO_SIDED=',listValue SDvis_Draw, sState end ; ; Handle the Volume composite function ; 'VOLUME-COMPOSITE' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty, COMPOSITE_FUNCTION=listValue ;print,'COMPOSITE_FUNCTION=',listValue SDvis_Draw, sState end ; ; Handle the Volume Z Buffer ; 'VOLUME-ZBUFFER' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty, ZBUFFER=1-listValue ;print,'VOLUME ZBUFFER=',1-listValue SDvis_Draw, sState end ; ; Handle the Volume ZERO_OPACITY_SKIP ; 'VOLUME-OPSKIP' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty, ZERO_OPACITY_SKIP =1-listValue ;print,'VOLUME ZERO_OPACITY_SKIP=',1-listValue SDvis_Draw, sState end ; ; Handle the Volume acceleration hints ; 'VOLUME-HINTS' : begin WIDGET_CONTROL, /HOURGLASS hints = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty, HINTS=hints ;print,'VOLUME HINTS=',hints SDvis_Draw, sState end ; ; Handle the Volume interpolation method ; 'VOLUME-INTERPOLATE' : begin WIDGET_CONTROL, /HOURGLASS interpolation = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_oVolume->GetData(oVolume) oVolume[MovieFrameCURRENT]->SetProperty, INTERPOLATE=interpolation ;print,'VOLUME INTERPOLATE=',interpolation SDvis_Draw, sState end ; ; Handle the size ; 'WIDGETSIZEEDIT' : begin ;x=WIDGET_INFO(sState.wTopBase, /XSIZE) ;y=WIDGET_INFO(sState.wTopBase, /YSIZE) wSizeEditBase = WIDGET_BASE(TITLE='Widget Size', GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) wXSizeEditBase = CW_FIELD(wSizeEditBase,/INTEGER,XSIZE=4,TITLE='XSIZE',$ UVALUE='VIEWXSIZE',/RETURN_EVENTS) wYSizeEditBase = CW_FIELD(wSizeEditBase,/INTEGER,XSIZE=4,TITLE='YSIZE',$ UVALUE='VIEWYSIZE',/RETURN_EVENTS) ; wResetSizeEditBase =WIDGET_BUTTON (wSizeEditBase,$ ; UVALUE='RESETSIZE',VALUE=' RESET SIZE ') wPresetSize500Y=WIDGET_BUTTON(wSizeEditBase,UVALUE='PRESETSIZE500Y',VALUE='YSIZE 500') wPresetSize600Y=WIDGET_BUTTON(wSizeEditBase,UVALUE='PRESETSIZE600Y',VALUE='YSIZE 600') wPresetSize700Y=WIDGET_BUTTON(wSizeEditBase,UVALUE='PRESETSIZE700Y',VALUE='YSIZE 700') wPresetSize800Y=WIDGET_BUTTON(wSizeEditBase,UVALUE='PRESETSIZE800Y',VALUE='YSIZE 800') wPresetSize900Y=WIDGET_BUTTON(wSizeEditBase,UVALUE='PRESETSIZE900Y',VALUE='YSIZE 900') wPresetSize1000Y=WIDGET_BUTTON(wSizeEditBase,UVALUE='PRESETSIZE1000Y',VALUE='YSIZE 1000') wPresetSize1100Y=WIDGET_BUTTON(wSizeEditBase,UVALUE='PRESETSIZE1100Y',VALUE='YSIZE 1100') wPresetSize1200Y=WIDGET_BUTTON(wSizeEditBase,UVALUE='PRESETSIZE1200Y',VALUE='YSIZE 1200') sSizeEdit={sState:sState ,wXSizeEditBase:wXSizeEditBase,wYSizeEditBase:wYSizeEditBase} WIDGET_CONTROL, sEvent.top, Set_UValue=sState zState = PTR_NEW(sSizeEdit, /NO_COPY) WIDGET_CONTROL, wSizeEditBase, SET_UVALUE=zState WIDGET_CONTROL, wSizeEditBase, /REALIZE XMANAGER,'SDvis_Event',wSizeEditBase,EVENT_HANDLER='WidgetSizeEditEvent',/JUST_REG end ; ; Handle the size ; '3DVIEWSIZEEDIT' : begin result=sState.oData_xydim->GetData(xydim) wSizeEditBase = WIDGET_BASE(TITLE='3D View Size', GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) wXSizeEditBase = CW_FIELD(wSizeEditBase,/INTEGER,XSIZE=4,TITLE='X size',$ UVALUE='VIEWXSIZE',VALUE=xydim(0),/RETURN_EVENTS) wYSizeEditBase = CW_FIELD(wSizeEditBase,/INTEGER,XSIZE=4,TITLE='Y size',$ UVALUE='VIEWYSIZE',VALUE=xydim(1),/RETURN_EVENTS) wResetSizeEditBase =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='RESETSIZE',VALUE=' RESET SIZE ') wPresetSize1920x1200 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE1920x1200',VALUE='1920x1200') wPresetSize1600x1200 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE1600x1200',VALUE='1600x1200') wPresetSize1280x1024 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE1280x1024',VALUE='1280x1024') wPresetSize1280x960 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE1280x960',VALUE='1280x960') wPresetSize800x600 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE800x600',VALUE='800x600') wPresetSize400x300 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE400x300',VALUE='400x300') wPresetSize600x600 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE600x600',VALUE='600x600') wPresetSize800x800 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE800x800',VALUE='800x800') wPresetSize1000x1000 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE1000x1000',VALUE='1000x1000') wPresetSize1200x1200 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE1200x1200',VALUE='1200x1200') wPresetSize1730x910 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE1730x910',VALUE='1730x910') wPresetSize768x768 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE768x768',VALUE='768x768') wPresetSize1600x1600 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE1600x1600',VALUE='1600x1600') wPresetSize1400x1400 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE1400x1400',VALUE='1400x1400') wPresetSize500x500 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE500x500',VALUE='500x500') wPresetSize400x400 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE400x400',VALUE='400x400') wPresetSize300x300 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE300x300',VALUE='300x300') wPresetSize250x250 =WIDGET_BUTTON (wSizeEditBase,$ UVALUE='PRESETSIZE250x250',VALUE='250x250') sSizeEdit={sState:sState ,wXSizeEditBase:wXSizeEditBase,wYSizeEditBase:wYSizeEditBase} WIDGET_CONTROL, sEvent.top, Set_UValue=sState zState = PTR_NEW(sSizeEdit, /NO_COPY) WIDGET_CONTROL, wSizeEditBase, SET_UVALUE=zState WIDGET_CONTROL, wSizeEditBase, /REALIZE XMANAGER,'SDvis_Event',wSizeEditBase,EVENT_HANDLER='threeDViewSizeEditEvent',/JUST_REG end "VIEWEYE": begin result=sState.oData_eye->GetData(eye) WIDGET_CONTROL, sState.wDefineVueEyeBase, GET_VALUE=eyepos eye[0]=eyepos if eye[0] le 0. then begin print, 'Distance from the eyepoint to the viewplane must be greater than 0.' print, '...forcing to 3' eye[0]=3 endif result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] WIDGET_CONTROL, sState.wDefineVueEyeBase, SET_VALUE=eye[0] SDvis_Draw, sState end "VIEWNEAR": begin result=sState.oData_eye->GetData(eye) WIDGET_CONTROL, sState.wDefineVueNearBase, GET_VALUE=near eye[1]=near result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] SDvis_Draw, sState end "VIEWFAR": begin result=sState.oData_eye->GetData(eye) WIDGET_CONTROL, sState.wDefineVueFarBase, GET_VALUE=far eye[2]=far result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty,ZCLIP=eye[1:2] sState.oView1->SetProperty, ZCLIP=eye[1:2] SDvis_Draw, sState end "VIEWFARTEST": begin result=sState.oData_eye->GetData(eye) WIDGET_CONTROL, sState.wDefineVueFarBase, GET_VALUE=far eye[2]=far result=sState.oData_eye->SetData(eye) ystart=-0.75 ywidth= 1.35 xwidth=1.4 xstart=-0.8 viewRect = [xstart,ystart,xwidth,ywidth] sState.oView3D->SetProperty, VIEWPLANE_RECT=viewRect SDvis_Draw, sState print,'draw !' sState.oView3D->SetProperty,ZCLIP=eye[1:2] SDvis_Draw, sState print,'draw !' sState.oView3D->GetProperty,EYE=eye print,'eye=',eye sState.oView3D->GetProperty,ZCLIP=zclip print,'zclip=',zclip end "VIEWRESET": begin result=sState.oData_eye->GetData(eye) eye[0]=3. ; Distance from the eyepoint to the viewplane (Z=0) eye[1]=2.9 ;1.5 ; Near clipping plane eye[2]=-50. ; Far clipping plane eye[3]=0. ; Zbright eye[4]=0. ; Zdim result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] WIDGET_CONTROL, sState.wDefineVueEyeBase, SET_VALUE=eye[0] WIDGET_CONTROL, sState.wDefineVueNearBase, SET_VALUE=eye[1] WIDGET_CONTROL, sState.wDefineVueFarBase, SET_VALUE=eye[2] WIDGET_CONTROL, sState.wDefineVueZBright, SET_VALUE=eye[3] WIDGET_CONTROL, sState.wDefineVueZDim, SET_VALUE=eye[4] SDvis_Draw, sState end "VIEWIDLDEF": begin result=sState.oData_eye->GetData(eye) eye[0]=4. ; Distance from the eyepoint to the viewplane (Z=0) eye[1]=1. ; Near clipping plane eye[2]=-1. ; Far clipping plane eye[3]=0. ; Zbright eye[4]=0. ; Zdim result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] WIDGET_CONTROL, sState.wDefineVueEyeBase, SET_VALUE=eye[0] WIDGET_CONTROL, sState.wDefineVueNearBase, SET_VALUE=eye[1] WIDGET_CONTROL, sState.wDefineVueFarBase, SET_VALUE=eye[2] WIDGET_CONTROL, sState.wDefineVueZBright, SET_VALUE=eye[3] WIDGET_CONTROL, sState.wDefineVueZDim, SET_VALUE=eye[4] SDvis_Draw, sState end "VIEWWIDE": begin result=sState.oData_eye->GetData(eye) eye[0]=.6 ; Distance from the eyepoint to the viewplane (Z=0) eye[1]=.5 ; Near clipping plane eye[2]=-50.;15.;-100. ; Far clipping plane result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] WIDGET_CONTROL, sState.wDefineVueEyeBase, SET_VALUE=eye[0] WIDGET_CONTROL, sState.wDefineVueNearBase, SET_VALUE=eye[1] WIDGET_CONTROL, sState.wDefineVueFarBase, SET_VALUE=eye[2] SDvis_Draw, sState end "VIEWNOCLIP": begin result=sState.oData_eye->GetData(eye) eye[0]=100.1 ; Distance from the eyepoint to the viewplane (Z=0) eye[1]=100.0 ; Near clipping plane eye[2]=-100.0 ; Far clipping plane result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] WIDGET_CONTROL, sState.wDefineVueEyeBase, SET_VALUE=eye[0] WIDGET_CONTROL, sState.wDefineVueNearBase, SET_VALUE=eye[1] WIDGET_CONTROL, sState.wDefineVueFarBase, SET_VALUE=eye[2] SDvis_Draw, sState end "VIEWZBRIGHT": begin result=sState.oData_eye->GetData(eye) WIDGET_CONTROL, sState.wDefineVueZBright, GET_VALUE=bright eye[3]=bright result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] SDvis_Draw, sState end "VIEWZDIM": begin result=sState.oData_eye->GetData(eye) WIDGET_CONTROL, sState.wDefineVueZDim, GET_VALUE=dim eye[4]=dim result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] SDvis_Draw, sState end "VIEWSTRONGHAZE": begin result=sState.oData_eye->GetData(eye) eye[3]=-0.5 ; Zbright eye[4]=0. ; Zdim result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] WIDGET_CONTROL, sState.wDefineVueZBright, SET_VALUE=eye[3] WIDGET_CONTROL, sState.wDefineVueZDim, SET_VALUE=eye[4] SDvis_Draw, sState end "VIEWWEAKHAZE": begin result=sState.oData_eye->GetData(eye) eye[3]=-0.5 ; Zbright eye[4]=0.5 ; Zdim result=sState.oData_eye->SetData(eye) sState.oView3D->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] sState.oView1->SetProperty, EYE=eye[0], ZCLIP=eye[1:2], DEPTH_CUE=eye[3:4] WIDGET_CONTROL, sState.wDefineVueZBright, SET_VALUE=eye[3] WIDGET_CONTROL, sState.wDefineVueZDim, SET_VALUE=eye[4] SDvis_Draw, sState end ; Handle the vue definition ; 'DEFINEVUE' : begin ;help,sState.wDefineVueBase ;print,'valid=',WIDGET_INFO(sState.wDefineVueBase, /VALID_ID) IF (WIDGET_INFO(sState.wDefineVueBase, /VALID_ID)) EQ 0 THEN BEGIN sState.wDefineVueBase = WIDGET_BASE(TITLE='View properties', $;GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) result=sState.oData_eye->GetData(eye) result=sState.oData_xyzrot->GetData(xyzrot) print,'DEFINEVUE xyzrot=',xyzrot DefineVueWidget,eye,xyzrot,$ sState.wDefineVueBase, $ wDefineVueEyeBase, $ wDefineVueNearBase, $ wDefineVueFarBase, $ wDefineVueZBright, $ wDefineVueZDim, $ ;wDefineVueLabel, $ wXSlider, $ wYSlider, $ wZSlider sState.wDefineVueEyeBase=wDefineVueEyeBase sState.wDefineVueNearBase=wDefineVueNearBase sState.wDefineVueFarBase=wDefineVueFarBase sState.wDefineVueZBright=wDefineVueZBright sState.wDefineVueZDim=wDefineVueZDim ;sState.wDefineVueLabel=wDefineVueLabel sState.wXSlider=wXSlider sState.wYSlider=wYSlider sState.wZSlider=wZSlider ;print,'valid wDefineVueEyeBase=',WIDGET_INFO(wDefineVueEyeBase, /VALID_ID) ;print,'valid sState.wDefineVueEyeBase=',WIDGET_INFO(sState.wDefineVueEyeBase, /VALID_ID) ENDIF WIDGET_CONTROL, sState.wDefineVueBase, SET_UVALUE=sState WIDGET_CONTROL,sState.wDefineVueBase , /REALIZE XMANAGER,'SDvis_Event',sState.wDefineVueBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="Definevue_Cleanup",/JUST_REG end ; Handle the Movie definition ; 'MOVIEPROPERTIES' : begin IF (WIDGET_INFO(sState.wDefineMovieBase, /VALID_ID)) EQ 0 THEN BEGIN sState.wDefineMovieBase = WIDGET_BASE(TITLE='Movie control interface', $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) result = sState.oData_saveOutputNumber->GetData(saveOutputNumber) result = sState.oData_saveNumberSteps->GetData(saveNumberSteps) result = sState.oData_cptVue->GetData(cptVue) result = sState.oData_wMovieWidgetConfig->GetData(wMovieWidgetConfig) ;print,'cptVue=',cptVue DefineMovieWidget, $ sState.wDefineMovieBase, $ wDefineMovieStart, $ wDefineMovieEnd, $ wDefineMovieStep, $ wSequenceObjectsFileName, $ wSequenceFileName, $ wSequenceFileName2, $ wAnimateRate, $ wAnimateAdvance, $ wAnimateStepF, $ wAnimateStepB, $ wPlay_sequence_and_save, $ saveOutputNumber, $ saveNumberSteps, $ cptVue, $ wMovieWidgetConfig, $ wNumberVueLabel result = sState.oData_wNumberVueLabel->SetData(wNumberVueLabel) result = sState.oData_wMovieWidgetConfig->SetData(wMovieWidgetConfig) result = sState.oData_wNumberVueLabel->SetData(wNumberVueLabel) sState.wDefineMovieStart=wDefineMovieStart sState.wDefineMovieEnd=wDefineMovieEnd sState.wDefineMovieStep=wDefineMovieStep sState.wSequenceObjectsFileName=wSequenceObjectsFileName sState.wAnimateRate=wAnimateRate sState.wAnimateAdvance=wAnimateAdvance sState.wAnimateStepF=wAnimateStepF sState.wAnimateStepB=wAnimateStepB sState.wPlay_sequence_and_save=wPlay_sequence_and_save sState.wSequenceFileName=wSequenceFileName sState.wSequenceFileName2=wSequenceFileName2 ENDIF WIDGET_CONTROL, sState.wDefineMovieBase, SET_UVALUE=sState WIDGET_CONTROL,sState.wDefineMovieBase , /REALIZE XMANAGER,'SDvis_Event',sState.wDefineMovieBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="DefineMovie_Cleanup",/JUST_REG end ; Handle the Movie definition ; 'IMAGESEQUENCE' : begin IF (WIDGET_INFO(sState.wImageSequenceBase, /VALID_ID)) EQ 0 THEN BEGIN sState.wImageSequenceBase = WIDGET_BASE(TITLE='Sequence of output images', $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) result = sState.oData_counterImage->GetData(counterImage) DefineImageSequenceWidget, $ sState.wImageSequenceBase, $ imagesequenceWidgets, $ counterImage result=sState.oData_imagesequenceWidgets->SetData(imagesequenceWidgets) ENDIF WIDGET_CONTROL, sState.wImageSequenceBase,SET_UVALUE=sState WIDGET_CONTROL, sState.wImageSequenceBase,/REALIZE XMANAGER,'SDvis_Event',sState.wImageSequenceBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="DefineImageSequence_Cleanup",/JUST_REG end ; Handle the Mpeg definition ; 'MPEGPROPERTIES' : begin IF (WIDGET_INFO(sState.wDefineMpegBase, /VALID_ID)) EQ 0 THEN BEGIN sState.wDefineMpegBase = WIDGET_BASE(TITLE='MPEG control', $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) result=sState.oData_mpegParameters->GetData(mpegParameters) result=sState.oData_mpegSensitive->SetData(mpegSensitive) result=sState.oData_mpegWidgets->GetData(mpegWidgets) DefineMpegWidget, $ sState.wDefineMpegBase, $ mpegWidgets, $ mpegParameters, $ mpegSensitive result=sState.oData_mpegWidgets->SetData(mpegWidgets) ENDIF WIDGET_CONTROL, sState.wDefineMpegBase, SET_UVALUE=sState WIDGET_CONTROL, sState.wDefineMpegBase, /REALIZE XMANAGER,'SDvis_Event',sState.wDefineMpegBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="DefineMpeg_Cleanup",/JUST_REG end ; Handle the Movie startup procedure ; 'OUTPUT' : begin end 'NUMBER_STEPS' : begin end 'SAVE_VUE' : begin result = sState.oData_cptVue->GetData(cptVue) if cptVue lt 200 then cptVue++ result = sState.oData_cptVue->SetData(cptVue) result = sState.oData_wNumberVueLabel->GetData(wNumberVueLabel) WIDGET_CONTROL, wNumberVueLabel, SET_VALUE=string(cptVue) result = sState.oData_saveScaleVue->GetData(saveScaleVue) result = sState.oData_saveTranslateVue->GetData(saveTranslateVue) result = sState.oData_saveTranslatePivotVue->GetData(saveTranslatePivotVue) result = sState.oData_saveTransform->GetData(saveTransform) result = sState.oData_saveTransformRot->GetData(saveTransformRot) result = sState.oData_saveLevelVue->GetData(saveLevelVue) result = sState.oData_saveOutputNumber->GetData(saveOutputNumber) result = sState.oData_saveNumberSteps->GetData(saveNumberSteps) result = sState.oData_saveMeshIJKBoundaries->GetData(saveMeshIJKBoundaries) result = sState.oData_MeshIJKBoundaries->GetData(MeshIJKBoundaries) result = sState.oData_AmrLevels->GetData(AmrLevels) result = sState.oData_saveLevels->GetData(saveLevels) saveLevels[0,cptVue-1] = AmrLevels[0] saveLevels[1,cptVue-1] = AmrLevels[1] result = sState.oData_saveLevels->SetData(saveLevels) sState.oModel3D->GetProperty, TRANSFORM=transform sState.oRotationModel3D->GetProperty, TRANSFORM=transformRot ;saveScaleVue[cptVue-1] = transformSca[0,0] saveScaleVue[cptVue-1] = transform[0,0] result=sState.oData_wNavigationOptions->GetData(wNavigationOptions) WIDGET_CONTROL,wNavigationOptions[6],GET_VALUE=PivotControl if pivotControl[1] eq 0 then begin saveTranslatePivotVue[cptVue-1]=0 saveTranslateVue[0,cptVue-1] = transform[3,0] saveTranslateVue[1,cptVue-1] = transform[3,1] endif else begin saveTranslatePivotVue[cptVue-1]=1 saveTranslateVue[0,cptVue-1] = transformRot[3,0] saveTranslateVue[1,cptVue-1] = transformRot[3,1] endelse ;print,'cptVue-1=',cptVue-1 ;print,'save saveTranslatePivotVue[cptVue-1]=',saveTranslatePivotVue[cptVue-1] ;print,'save saveScaleVue[cptVue-1]=',saveScaleVue[cptVue-1] for i=0, 5 do saveMeshIJKBoundaries[i,cptVue-1] = MeshIJKBoundaries[i] saveTransform[*,*,cptVue-1] = transform saveTransformRot[*,*,cptVue-1] = transformRot result=sState.oData_AmrLevels->GetData(AmrLevels) LevelVueMin=AmrLevels[0] LevelVueMax=AmrLevels[1] saveLevelVue[0,cptVue-1] = LevelVueMin saveLevelVue[1,cptVue-1] = LevelVueMax ;print,'LevelVueMin,LevelVueMax=',LevelVueMin,LevelVueMax result = sState.oData_wMovieWidgetConfig->GetData(wMovieWidgetConfig) OutPut= WIDGET_INFO(wMovieWidgetConfig[0], /COMBOBOX_GETTEXT) NumberSteps=WIDGET_INFO(wMovieWidgetConfig[1], /COMBOBOX_GETTEXT) ;print,'NumberSteps=',NumberSteps saveOutputNumber[cptVue-1] = OutPut saveNumberSteps[cptVue-1] = NumberSteps result = sState.oData_saveScaleVue->SetData(saveScaleVue) result = sState.oData_saveTranslateVue->SetData(saveTranslateVue) result = sState.oData_saveTranslatePivotVue->SetData(saveTranslatePivotVue) result = sState.oData_saveTransform->SetData(saveTransform) result = sState.oData_saveTransformRot->SetData(saveTransformRot) result = sState.oData_saveLevelVue->SetData(saveLevelVue) result = sState.oData_saveOutputNumber->SetData(saveOutputNumber) result = sState.oData_saveNumberSteps->SetData(saveNumberSteps) result = sState.oData_saveMeshIJKBoundaries->SetData(saveMeshIJKBoundaries) end 'CANCEL' : begin result = sState.oData_cptVue->GetData(cptVue) if cptVue gt 0 then cptVue-- result = sState.oData_cptVue->SetData(cptVue) result = sState.oData_wNumberVueLabel->GetData(wNumberVueLabel) WIDGET_CONTROL, wNumberVueLabel, SET_VALUE=string(cptVue) end ; Handle the Movie startup procedure ; 'START_OBJECTS-STREAM_PREPARATION' : begin start_Objects_Stream_preparation, sState, 0 WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState end 'PLAY_SEQUENCE' : BEGIN WIDGET_CONTROL, sState.wPlay_sequence_and_save, GET_VALUE=index ;if index[1] eq 1 then begin ; create_mpeg, sState ; mpegFlag=1 ; result=sState.oData_mpegFlag->SetData(mpegFlag) ;endif startMovie_preparation, sState, 0, index[0] WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState ;if index[1] eq 1 then begin ; save_mpeg, sState ; mpegFlag=0 ; result=sState.oData_mpegFlag->SetData(mpegFlag) ;endif END 'REPLAY_SEQUENCE' : BEGIN WIDGET_CONTROL, sState.wPlay_sequence_and_save, GET_VALUE=index ; if index[1] eq 1 then begin ; create_mpeg, sState ; mpegFlag=1 ; result=sState.oData_mpegFlag->SetData(mpegFlag) ; endif ReplaySequence,sState WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState ; if index[1] eq 1 then begin ; save_mpeg, sState ; mpegFlag=0 ; result=sState.oData_mpegFlag->SetData(mpegFlag) ; endif END ; Handle the sequence filename browser ; 'BROWSESEQUENCEFILE' : begin filter=['*.sds'] WIDGET_CONTROL, sState.wSequenceFileName, GET_VALUE=file_name new_file_name = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=filter,FILE=file_name,TITLE='Select sequence file') WIDGET_CONTROL, sState.wSequenceFileName, SET_VALUE=new_file_name end ; Handle the sequence filename browser ; 'BROWSESEQUENCEFILE2' : begin filter=['*.sds'] WIDGET_CONTROL, sState.wSequenceFileName2, GET_VALUE=file_name new_file_name = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=filter,FILE=file_name,TITLE='Select sequence file') WIDGET_CONTROL, sState.wSequenceFileName2, SET_VALUE=new_file_name end ; Handle the sequence file name for writing ; 'SEQUENCEFILENAME' : begin WIDGET_CONTROL, sState.wSequenceFileName, GET_VALUE=file_name print,'sequence file name=',file_name end ; Handle the sequence file name for reading ; 'SEQUENCEFILENAME2' : begin WIDGET_CONTROL, sState.wSequenceFileName2, GET_VALUE=file_name print,'sequence file name=',file_name end 'SAVE_SEQUENCE' : BEGIN WIDGET_CONTROL, sState.wPlay_sequence_and_save, GET_VALUE=index if index[0] eq 1 then print,'sequence to save in editable sds text file' ;if index[1] eq 1 then print,'sequence to save in mpeg' END ; Handle the output of sequence of images ; 'SAVEIMAGESEQUENCE' : BEGIN result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) WIDGET_CONTROL, imagesequenceWidgets[0], GET_VALUE=index result = sState.oData_saveImage->GetData(saveImage) saveImage[0]=index[0] saveImage[1]=index[0] if index[0] eq 0 then print,'storing of image sequence is disengaged' if index[0] eq 1 then print,'storing of image sequence is engaged' result = sState.oData_saveImage->SetData(saveImage) END ; Handle the format to store sequence of images ; 'IMAGE-FORMAT' : BEGIN END ; Handle the mode to store sequence of images (mono/stereo) ; 'IMAGE-MODE' : BEGIN result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) index=WIDGET_INFO(imagesequenceWidgets[10],/DROPLIST_SELECT) WIDGET_CONTROL, imagesequenceWidgets[11], MAP=index print,index END ; Handle the browsing of directory to store sequence of images ; 'BROWSEIMAGEDIRECTORY' : BEGIN result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) if WIDGET_INFO(imagesequenceWidgets[3],/VALID_ID) EQ 1 then begin WIDGET_CONTROL, imagesequenceWidgets[3], GET_VALUE=image_directory new_image_directory = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ /DIRECTORY,GET_PATH=path,TITLE='Select directory') WIDGET_CONTROL, imagesequenceWidgets[3], SET_VALUE=path print,'select directory=',path endif END ; Handle the browsing of directory to store sequence of images (right eye) ; 'BROWSESTEREOIMAGEDIRECTORY' : BEGIN result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) if WIDGET_INFO(imagesequenceWidgets[8],/VALID_ID) EQ 1 then begin WIDGET_CONTROL, imagesequenceWidgets[8], GET_VALUE=image_directory new_image_directory = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ /DIRECTORY,GET_PATH=path,TITLE='Select directory') WIDGET_CONTROL, imagesequenceWidgets[8], SET_VALUE=path print,'select directory (right eye)=',path endif END ; Handle the naming of directory to store sequence of images ; 'NAMEIMAGEDIRECTORY' : BEGIN END ; Handle the naming of directory to store sequence of images (right eye) ; 'NAMESTEREOIMAGEDIRECTORY' : BEGIN END ; Handle the creation of directory to store sequence of images ; 'CREATEIMAGEDIRECTORY' : BEGIN result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) if WIDGET_INFO(imagesequenceWidgets[3],/VALID_ID) EQ 1 then begin WIDGET_CONTROL, imagesequenceWidgets[3], GET_VALUE=image_directory print,'create directory=',image_directory file_mkdir,image_directory endif END ; Handle the creation of directory to store sequence of images (right eye) ; 'CREATESTEREOIMAGEDIRECTORY' : BEGIN result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) if WIDGET_INFO(imagesequenceWidgets[8],/VALID_ID) EQ 1 then begin WIDGET_CONTROL, imagesequenceWidgets[8], GET_VALUE=image_directory print,'create directory (right eye)=',image_directory file_mkdir,image_directory endif END ; Handle the edition of the image counter ; 'IMAGECOUNTER' : BEGIN result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) if WIDGET_INFO(imagesequenceWidgets[5],/VALID_ID) EQ 1 then $ WIDGET_CONTROL,imagesequenceWidgets[5],GET_VALUE=counterImage print,'counterImage=',counterImage result=sState.oData_counterImage->SetData(counterImage) END ; Handle the reset of the image counter ; 'RESETIMAGECOUNTER' : BEGIN counterImage=0 result=sState.oData_counterImage->SetData(counterImage) result=sState.oData_imagesequenceWidgets->GetData(imagesequenceWidgets) if WIDGET_INFO(imagesequenceWidgets[5],/VALID_ID) EQ 1 then $ WIDGET_CONTROL,imagesequenceWidgets[5],SET_VALUE=counterImage END ; Handle tabbing of movie options ; 'MOVIETAB' : BEGIN END ; ; Handle the Movie startup procedure ; ; ; 'STARTMOVIE_ANIMATION' : begin ; ; print,' Movie startup ' ; WIDGET_CONTROL, sState.wDefineMovieStart, GET_VALUE=movieStart ; WIDGET_CONTROL, sState.wDefineMovieEnd, GET_VALUE=movieEnd ; WIDGET_CONTROL, sState.wDefineMovieStep, GET_VALUE=movieStep ; WIDGET_CONTROL, sState.wDefineMovieFrameInterval, GET_VALUE=FrameInterval ; MovieFrameCURRENT=0 ; result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) ; result=sState.oData_MovieFrameNMAX->GetData(MovieFrameNMAX) ; ; ; print,'movieStart,movieEnd,movieStep=',movieStart,movieEnd,movieStep ; FOR istep=movieStart,movieEnd,movieStep DO BEGIN ; ;print,'istep=',istep ; for k=0,MovieFrameNMAX-1 do begin ; IF OBJ_VALID(sState.oPolygon[0,0,k]) EQ 1 THEN BEGIN ; sState.oPolygon[0,0,k]->SetProperty,HIDE=1 ; ENDIF ; endfor ; ;print,'MovieFrameCURRENT=',MovieFrameCURRENT ; sState.oPolygon[0,0,MovieFrameCURRENT]->SetProperty,HIDE=0 ; ; WIDGET_CONTROL, sState.wRamsesConfig[0], SET_VALUE=istep ; MovieFrameCURRENT=MovieFrameCURRENT+1 ; result=sState.oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) ; SDvis_Draw, sState ; wait,FrameInterval ; ; ENDFOR ; ; end ; Handle the sequence objects file browser ; 'BROWSESEQUENCEOBJECTS' : begin filter=['*.sav'] WIDGET_CONTROL, sState.wSequenceObjectsFileName, GET_VALUE=file_name new_file_name = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILTER=filter,FILE=file_name,TITLE='Select sequence file') WIDGET_CONTROL, sState.wSequenceObjectsFileName, SET_VALUE=new_file_name end ; Handle the sequence objects file name ; 'NAMESEQUENCEOBJECTS' : begin WIDGET_CONTROL, sState.wSequenceObjectsFileName, GET_VALUE=file_name print,'sequence objects file name=',file_name end ; Handle the sequence objects save procedure ; 'SAVESEQUENCEOBJECTS' : begin WIDGET_CONTROL, sState.wSequenceObjectsFileName, GET_VALUE=file_name result=sState.oData_MovieFrameNMAX->GetData(MovieFrameNMAX) result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_DataFormat->GetData(DataFormat) result = sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) result=sState.oData_oVolume->GetData(oVolume) IF iflag_vue[0] EQ 4 THEN BEGIN oSequence=sState.oPolygon ENDIF ELSE IF iflag_vue[0] EQ 5 THEN BEGIN oSequence=oVolume ENDIF else oSequence = 0 IF DataFormat eq 3 then BEGIN if is3DModelDrawn eq 1 then result=sState.oData_Polylines->GetData(polylines) $ else result=sState.oData_PolylinesPlanes->GetData(polylines) ENDIF ELSE polylines = 0 version=1 result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_is3DModelDrawn->GetData(is3DModelDrawn) print,'save sequence objects in compressed save file :',file_name ;SAVE,version,iflag_vue,MovieFrameNMAX,oSequence,filename=file_name,/VERBOSE,/COMPRESS print, DataFormat SAVE,version,iflag_vue,MovieFrameNMAX,oSequence,DataFormat,polylines,is3DModelDrawn, $ MovieFrameCURRENT,filename=file_name,/VERBOSE;,/COMPRESS print,' ... done' end ; Handle the sequence objects restore procedure ; 'RESTORESEQUENCEOBJECTS' : begin WIDGET_CONTROL, sState.wSequenceObjectsFileName, GET_VALUE=file_name print,'sequence objects file name=',file_name version=0 result=sState.oData_vue->GetData(iflag_vue) result=sState.oData_DataFormat->GetData(DataFormat) result=sState.oData_Polylines->GetData(polylines) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) iflag_vue[*]=0 iflag_vue[0]=4 DataFormat = 0 print,'DataFormat = 0 !!!' RESTORE,file_name print,'iflag_vue=',iflag_vue ;sState.oPolygon=oSequence result=sState.oData_MovieFrameNMAX->SetData(MovieFrameNMAX) ;result=sState.oData_vue->GetData(iflag_vue) ;iflag_vue[*]=0 ;iflag_vue[0]=4 result=sState.oData_vue->SetData(iflag_vue) dum=ResetBases(sState) WIDGET_CONTROL, sState.wLogLinBase, MAP=1 WIDGET_CONTROL, sState.wSelectionBase[3], MAP=1 WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 ;WIDGET_CONTROL, sState.wDrawBase3DsubLower[0] , MAP=1 WIDGET_CONTROL, sState.wVarNameLabel, SET_VALUE='Data : '+'density' ; datanames[i] ; nsteps=0 ; FOR i=0,MovieFrameNMAX-1 DO BEGIN ; IF iflag_vue[0] EQ 4 THEN BEGIN ; IF OBJ_VALID(oSequence[0,0,i]) EQ 1 THEN nsteps=nsteps+1 ; ENDIF ELSE IF iflag_vue[0] EQ 5 THEN BEGIN ; IF OBJ_VALID(oSequence[i]) EQ 1 THEN nsteps=nsteps+1 ; END ; ENDFOR nsteps=MovieFrameCURRENT print, "MovieFrameCURRENT = ",MovieFrameCURRENT movieStart=1 movieEnd=nsteps ;8 movieStep=1 WIDGET_CONTROL, sState.wDefineMovieStart, SET_VALUE=movieStart WIDGET_CONTROL, sState.wDefineMovieEnd, SET_VALUE=movieEnd WIDGET_CONTROL, sState.wDefineMovieStep, SET_VALUE=movieStep IF iflag_vue[0] EQ 4 THEN BEGIN sState.oModelPolygon->SetProperty, RENDER_METHOD=1 sState.oObserver->SetProperty, oIMAGES=sState.oModelPolygon ENDIF ELSE IF iflag_vue[0] EQ 5 THEN BEGIN sState.oModelVolume->SetProperty, RENDER_METHOD=1 sState.oObserver->SetProperty, oIMAGES=sState.oModelVolume END if iflag_vue[0] EQ 4 OR iflag_vue[0] EQ 5 then begin oSequence[0,0]->GetProperty,NAME=name len=strlen(name) name0=strmid(name,0, len-1) FOR istep=movieStart,movieEnd,movieStep DO BEGIN j=0 k=0 l=istep-1 nameiso=name0+strcompress(string(k),/remove_all) IF iflag_vue[0] EQ 4 THEN BEGIN oSequence[j,k,l]->GetProperty,Data=data,Polygons=polygons, $ XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs sState.oPolygon[j,k,l]=OBJ_NEW('IDLgrPolygon',Color=[0,0,205], $ Shading=1,ALPHA_CHANNEL=1.,/REGISTER_PROPERTIES, $ Data=data,Polygons=polygons, $ NAME=nameiso , $ DESCRIPTION='isosurface object', $ XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs $ ) help, sState.oPolygon[j,k,l] sState.oModelPolygon->Add,sState.oPolygon[j,k,l] ;,/ALIAS WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState ENDIF ELSE IF iflag_vue[0] EQ 5 THEN BEGIN oPaletteImage = Obj_New('IDLgrPalette') oPaletteImage->LoadCT, 1 oPaletteImage->GetProperty, Red=r, Blue=b, Green=g vColors = BYTARR(256,3,/NOZERO) vColors[*,0]=r vColors[*,1]=g vColors[*,2]=b oSequence[l]->GetProperty,Data0=data,RGB_TABLE0=vColors,OPACITY_TABLE0=oColors,COMPOSITE_FUNCTION=composite_function, $ XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs,RENDER_STEP=render_step result=sState.oData_oVolume->GetData(oVolume) oVolume[l]=OBJ_NEW('IDLgrVolume',HIDE=0,ALPHA_CHANNEL=1.,ZERO_OPACITY_SKIP=1,/ZBUFFER, $ RGB_TABLE0=vColors,OPACITY_TABLE0=oColors,HINTS=2,COMPOSITE_FUNCTION=composite_function,/NO_COPY,$ RENDER_STEP=render_step,/REGISTER_PROPERTIES,DESCRIPTION='volume object', $ Data0=data,XCoord_Conv=xs, YCoord_Conv=ys, ZCoord_Conv=zs $ ) help, oVolume[l] result=sState.oData_oVolume->SetData(oVolume) sState.oModelVolume->Add,oVolume[l] WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState END ENDFOR endif IF DataFormat eq 3 then BEGIN sState.oMovieModel = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable, RENDER_METHOD=1) sState.oModelObjects3D->Add, sState.oMovieModel for istep = movieStart-1,movieEnd-1,movieStep DO BEGIN Model = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) for i = 22, 0, -1 do begin if is3DModelDrawn eq 1 then begin if OBJ_ISA(polylines[istep,i],"IDLgrPolyline") eq 1 then $ Model->ADD,polylines[istep,i], /ALIAS endif else begin for j = 0, 5 do begin if OBJ_ISA(polylines[istep,j,i],"IDLgrPolyline") eq 1 then $ Model->ADD,polylines[istep,j,i], /ALIAS endfor endelse endfor sState.oMovieModel->ADD, Model endfor sState.oObserver->SetProperty, oIMAGES=sState.oMovieModel if is3DModelDrawn eq 1 then begin result = sState.oData_oAmrModel3D->SetData(Model) result = sState.oData_Polylines->GetData(polylines) endif else begin result = sState.oData_PolylinesPlanes->GetData(polylinesPlanes) result = sState.oData_oAmrModel2D->SetData(Model) endelse result = sState.oData_is3DModelDrawn->SetData(is3DModelDrawn) ENDIF end ; Turn timer events on and off (TIMER_EVENTS), or ; increment the frame display. Call SetEventMask to notify window ; observers of timer events, or call the custom behavior object's OnTimer ; method to determine what frame to display and draw it to the window. 'ANIMATE_STOP': BEGIN ;WIDGET_CONTROL, sState.wTopBase, TIMER=0 sState.drawWindowID3D->SetEventMask, TIMER_EVENTS=0 sState.drawWindowID3D->Draw, sState.oView3D WIDGET_CONTROL, sState.wAnimateStepF, SENSITIVE=1 WIDGET_CONTROL, sState.wAnimateStepB, SENSITIVE=1 END 'ANIMATE_PLAY': BEGIN ;WIDGET_CONTROL, sState.wTopBase, TIMER=1 sState.oObserver->SetProperty, PLAYONCE=0 sState.drawWindowID3D->SetEventMask, TIMER_EVENTS=1 print,'test' WIDGET_CONTROL, sState.wAnimateStepF, SENSITIVE=0 WIDGET_CONTROL, sState.wAnimateStepB, SENSITIVE=0 END 'ANIMATE_PLAY_ONCE': BEGIN sState.oObserver->SetProperty, PLAYONCE=1 sState.drawWindowID3D->SetEventMask, TIMER_EVENTS=1 WIDGET_CONTROL, sState.wAnimateStepF, SENSITIVE=0 WIDGET_CONTROL, sState.wAnimateStepB, SENSITIVE=0 END 'ANIMATE_STEPF': BEGIN sState.oObserver->OnTimer, sState.drawWindowID3D END 'ANIMATE_STEPB': BEGIN sState.oObserver->GetProperty, INC=advance sState.oObserver->SetProperty, INC= -advance sState.oObserver->OnTimer, sState.drawWindowID3D sState.oObserver->SetProperty, INC=advance END 'ANIMATE_RATE': BEGIN interval = 1.0 / sEvent.value sState.drawWindowID3D->SetTimerInterval, interval END 'ANIMATE_ADVANCE': BEGIN advance = sEvent.value sState.oObserver->SetProperty, INC=advance END ; Handle the Data object control ; 'PICK_DATA_CONTROLLER' : begin WIDGET_CONTROL,sState.wTabBase,SET_TAB_CURRENT=1 sState.oSceneText[0]->GetProperty,HIDE=hide if hide eq 0 then HideSceneText, sState result=sState.oData_datanames->GetData(datanames) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) if nvar eq 0 then nvar=1 droplist_select=intarr(nvar,4) sensitive=intarr(nvar,4) droplist_select[*,*]=1 sensitive[*,*]=0 IF WIDGET_INFO(sState.wObjectControlBase, /VALID_ID) EQ 1 THEN BEGIN for i=0,nvar-1 do begin for j=0,3 do begin if WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/VALID_ID) EQ 1 then begin droplist_select[i,j]=WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/DROPLIST_SELECT ) sensitive[i,j]=WIDGET_INFO(sState.wObjectControlDisplayHDF[i,j],/SENSITIVE ) endif endfor endfor result=sState.oData_droplist_select->SetData(droplist_select) result=sState.oData_sensitive->SetData(sensitive) WIDGET_CONTROL, sState.wObjectControlBase, /DESTROY ENDIF IF WIDGET_INFO(sState.wObjectControlBase, /VALID_ID) EQ 0 THEN BEGIN result=sState.oData_droplist_select->GetData(droplist_select) result=sState.oData_sensitive->GetData(sensitive) sState.wObjectControlBase = WIDGET_BASE(TITLE='Data Objects control', $ GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=1, YPAD=1, SPACE=1) result=sState.oData_GridDim->GetData(GridDim) result=sState.oData_datanames->GetData(datanames) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_DataDimHDF->GetData(fourdim) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) ObjectControlWidget, $ GridDim, $ datanames, $ FillArraysHDF, $ fourdim, $ sState.wObjectControlBase, $ wObjectControlDisplayHDF, $ droplist_select, $ sensitive sState.wObjectControlDisplayHDF=wObjectControlDisplayHDF ENDIF WIDGET_CONTROL,sState.wObjectControlBase, SET_UVALUE=sState WIDGET_CONTROL,sState.wObjectControlBase , /REALIZE XMANAGER,'SDvis_Event',sState.wObjectControlBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="ObjectControl_Cleanup",/JUST_REG end ; Handle the Geometry object control ; 'PICK_GEOMETRY_CONTROLLER' : begin sState.oSceneText[0]->GetProperty,HIDE=hide if hide eq 0 then HideSceneText, sState WIDGET_CONTROL,sState.wTabBase,SET_TAB_CURRENT=1 nxg=sState.GeoStructure.nxg result=sState.oData_DataFormat->GetData(DataFormat) if DataFormat eq 3 then begin ;RAMSES IF WIDGET_INFO(sState.wObjectControlGenerateAMR, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wObjectControlGenerateAMR,SENSITIVE=1 endif ;;; destroy the widget and force the GROUP_LEADER ; IF WIDGET_INFO(sState.wGeometryObjectControlBase, /VALID_ID) EQ 1 THEN BEGIN ;print,'destroy' WIDGET_CONTROL, sState.wGeometryObjectControlBase, /DESTROY ENDIF IF WIDGET_INFO(sState.wGeometryObjectControlBase, /VALID_ID) EQ 0 THEN BEGIN sState.wGeometryObjectControlBase = WIDGET_BASE(TITLE='Geometry Objects control', $ GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=1, YPAD=1, SPACE=1) result= sState.oData_geometryControlInfo->GetData(geometryControlInfo) GeometryObjectControlWidget, $ sState.wGeometryObjectControlBase, $ nxg, $ DataFormat, $ wObjectControlDisplayBounds, $ wObjectControlConfigureBounds , $ wObjectControlDisplayAxis , $ wObjectControlConfigureAxis , $ wObjectControlDisplayDomains , $ wObjectControlConfigureDomains, $ wObjectControlGenerateAMR, $ wObjectControlDisplayAMR, $ wObjectControlConfigureAMR, $ geometryControlInfo sState.wObjectControlDisplayBounds=wObjectControlDisplayBounds sState.wObjectControlConfigureBounds=wObjectControlConfigureBounds sState.wObjectControlDisplayAxis=wObjectControlDisplayAxis sState.wObjectControlConfigureAxis=wObjectControlConfigureAxis sState.wObjectControlDisplayDomains=wObjectControlDisplayDomains sState.wObjectControlConfigureDomains=wObjectControlConfigureDomains sState.wObjectControlGenerateAMR=wObjectControlGenerateAMR sState.wObjectControlDisplayAMR=wObjectControlDisplayAMR sState.wObjectControlConfigureAMR=wObjectControlConfigureAMR ENDIF WIDGET_CONTROL,sState.wGeometryObjectControlBase, SET_UVALUE=sState WIDGET_CONTROL,sState.wGeometryObjectControlBase , /REALIZE XMANAGER,'SDvis_Event',sState.wGeometryObjectControlBase,EVENT_HANDLER='SDvis_Event', $ CLEANUP="GeometryObjectControl_Cleanup",/JUST_REG end ; Handle the Scene object control ; 'PICK_SCENE_CONTROLLER' : begin sState.oSceneText[0]->GetProperty,HIDE=hide if hide eq 0 then HideSceneText, sState WIDGET_CONTROL,sState.wTabBase,SET_TAB_CURRENT=1 SceneObjectControlWidget, sEvent, sState end ; Handle the text object control ; 'PICK_TEXT_CONTROLLER' : begin dum=ResetBases(sState) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[6] , MAP=1 end ; Handle the Navigation control ; 'NAVIGATION_CONTROL' : begin ;dum=ResetBases(sState) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[4] , MAP=1 end ; Handle the Stereo control ; 'STEREO_CONTROL' : begin sState.oSceneText[0]->GetProperty,HIDE=hide if hide eq 0 then HideSceneText, sState dum=ResetBases(sState) WIDGET_CONTROL, sState.wSelectionDrawingBase[1], MAP=1 WIDGET_CONTROL, sState.wDrawBase3DsubLower[5] , MAP=1 end ; Handle the Stereo ENGAGE Left ; 'STEREO-ENGAGE-LEFT' : begin result=sState.oData_xydim->GetData(xydim) sState.oWindowStereoEyes[0]=OBJ_NEW("IDLgrWindow",DIMENSIONS=xydim(0:1),TITLE='SDvision Left Eye') SDvis_Draw,sState end ; Handle the Stereo ENGAGE Right ; 'STEREO-ENGAGE-RIGHT' : begin result=sState.oData_xydim->GetData(xydim) sState.oWindowStereoEyes[1]=OBJ_NEW("IDLgrWindow",DIMENSIONS=xydim(0:1),TITLE='SDvision Right Eye') SDvis_Draw,sState end ; Handle the Stereo angle ; 'STEREO-ANGLE' : begin result=sState.oData_wStereoOptions->GetData(wStereoOptions) WIDGET_CONTROL,wStereoOptions[2],GET_VALUE=alphaStereo WIDGET_CONTROL,wStereoOptions[4],GET_VALUE=eyesSeparation distanceStereo=eyesSeparation/tan(alphaStereo*!PI/180.) print,'distanceStereo=',distanceStereo WIDGET_CONTROL,wStereoOptions[3],SET_VALUE=distanceStereo ;print,'alphaStereo=',alphaStereo if obj_valid(sState.oWindowStereoEyes[1]) then begin sState.oStereoModel3D->Rotate, [0,1,0],-alphaStereo sState.oWindowStereoEyes[1]->Draw, sState.oView3D sState.oStereoModel3D->Rotate, [0,1,0],alphaStereo endif end ; Handle the Stereo distance to viewing plane ; 'STEREO-DISTANCE' : begin result=sState.oData_wStereoOptions->GetData(wStereoOptions) WIDGET_CONTROL,wStereoOptions[3],GET_VALUE=distanceStereo WIDGET_CONTROL,wStereoOptions[4],GET_VALUE=eyesSeparation alphaStereo=180/!PI*atan(eyesSeparation,distanceStereo) print,'alphaStereo(deg)=',alphaStereo WIDGET_CONTROL,wStereoOptions[2],SET_VALUE=alphaStereo ;print,'alphaStereo=',alphaStereo if obj_valid(sState.oWindowStereoEyes[1]) then begin sState.oStereoModel3D->Rotate, [0,1,0],-alphaStereo sState.oWindowStereoEyes[1]->Draw, sState.oView3D sState.oStereoModel3D->Rotate, [0,1,0],alphaStereo endif end ; Handle the widget property ; 'EDITOBJECTPROPERTY' : begin ;EditObjectProperty, sEvent, sState WIDGET_CONTROL,sState.wEditObjectProperty, $ SET_BUTTON=1-WIDGET_INFO(sState.wEditObjectProperty,/BUTTON_SET) ;ExSinglePropSheet, sState, sEvent end ; Handle the Task Farming control ; 'TASKFARMINGSETUP' : begin TaskFarmingControlWidget, sEvent, sState end ; Handle the Rebin Data control ; 'PICK_REBINDATA_CONTROLLER' : begin result=sState.oData_RebinData->GetData(RebinData) ;;;;;;;;;;;;;;;;;;;; DATA REDUCTION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; wDataReductionBase = WIDGET_BASE(TITLE='Rebin Data', GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) wDataReductionLabel = WIDGET_LABEL(wDataReductionBase, $ VALUE='Data Rebinning') ;wRebinField1 = CW_FIELD(wDataReductionBase, /INTEGER, TITLE='nx ', $ ; UVALUE='REBINX', VALUE=RebinData[0], XSIZE=4, /ALL_EVENTS) ;wRebinField2 = CW_FIELD(wDataReductionBase, /INTEGER, TITLE='ny ', $ ; UVALUE='REBINY', VALUE=RebinData[1], XSIZE=4, /ALL_EVENTS) ;wRebinField3 = CW_FIELD(wDataReductionBase, /INTEGER, TITLE='nz ', $ ; UVALUE='REBINZ', VALUE=RebinData[2], XSIZE=4, /ALL_EVENTS) combo_table=['20','50','100','200','300','400','500','600','700','800','900','1000'] wRebinField1 = WIDGET_COMBOBOX(wDataReductionBase, $ UVALUE='REBINX', VALUE=combo_table,/EDITABLE) wRebinField2 = WIDGET_COMBOBOX(wDataReductionBase, $ UVALUE='REBINY', VALUE=combo_table,/EDITABLE) wRebinField3 = WIDGET_COMBOBOX(wDataReductionBase, $ UVALUE='REBINZ', VALUE=combo_table,/EDITABLE) ;WIDGET_CONTROL,wRebinField1,SET_VALUE='20' result=sState.oData_datanames->GetData(datanames) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) nfill=0 for i=0,nvar-1 do begin if ( FillArraysHDF[i] eq 1 ) then nfill=nfill+1 endfor if nfill ne 0 then begin datanames_filled=strarr(nfill) ifill=0 for i=0,nvar-1 do begin if ( FillArraysHDF[i] eq 1 ) then begin datanames_filled[ifill]=datanames[i] ifill=ifill+1 endif endfor endif wRebinVar = WIDGET_DROPLIST(wDataReductionBase,$ VALUE=datanames_filled, UVALUE='REBINVAR') wReduceButton = WIDGET_BUTTON(wDataReductionBase, $ VALUE='REBIN DATA', UVALUE='REDUCEDATA', SENSITIVE=1) sRebinData={sState:sState,wRebinField1:wRebinField1,$ wRebinField2:wRebinField2,$ wRebinField3:wRebinField3,$ wRebinVar:wRebinVar} ;WIDGET_CONTROL, sEvent.top, Set_UValue=sState zState = PTR_NEW(sRebinData, /NO_COPY) WIDGET_CONTROL,wDataReductionBase , SET_UVALUE=zState WIDGET_CONTROL,wDataReductionBase , /REALIZE XMANAGER,'SDvis_Event',wDataReductionBase,EVENT_HANDLER='DataReductionEvent',/JUST_REG ;help,sState.GeoStructure,/struct ;print,'test sState.GeoStructure.nxg=',sState.GeoStructure.nxg ; Get the info structure from top-level base. ; ;WIDGET_CONTROL, sEvent.top, SET_UVALUE=sState, /NO_COPY end ; Handle the ASH BoB size ; 'ASHSIZE' : begin ;WIDGET_CONTROL, sState.wAshConfig[0], GET_VALUE=AshBoBsize AshBoBsize=WIDGET_INFO( sState.wAshConfig[0], /COMBOBOX_GETTEXT) print,'AshBoBsize=',AshBoBsize ;result=sState.oData_OutputReprise->GetData(OutputReprise) end ; Handle the ASH BoB scalar ; 'ASHSCALAR' : begin DefineAshScalarWidget, sEvent, sState ;WIDGET_CONTROL, sState.wAshConfig[0], GET_VALUE=AshBoBsize AshBoBsize=WIDGET_INFO( sState.wAshConfig[0], /COMBOBOX_GETTEXT) sState.GeoStructure.nxg=AshBoBsize sState.GeoStructure.nyg=AshBoBsize sState.GeoStructure.nzg=AshBoBsize ;print,'sState.GeoStructure.nxg=',sState.GeoStructure.nxg end ; Handle the ASH BoB vector ; 'ASHVECTOR' : begin DefineAshVectorWidget, sEvent, sState ;WIDGET_CONTROL, sState.wAshConfig[0], GET_VALUE=AshBoBsize AshBoBsize=WIDGET_INFO( sState.wAshConfig[0], /COMBOBOX_GETTEXT) sState.GeoStructure.nxg=AshBoBsize sState.GeoStructure.nyg=AshBoBsize sState.GeoStructure.nzg=AshBoBsize ;print,'sState.GeoStructure.nxg=',sState.GeoStructure.nxg end ; Handle the creation of additional isosurfaces ; 'NEWISO' : begin result=sState.oData_PolygonNTOT->GetData(PolygonNTOT) result=sState.oData_PolygonVarID->GetData(PolygonVarID) result=sState.oData_PolygonID->GetData(PolygonID) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) result=sState.oData_PolygonNMAX->GetData(PolygonNMAX) PolygonNTOT[PolygonVarID]=PolygonNTOT[PolygonVarID]+1 PolygonID[PolygonVarID]=PolygonID[PolygonVarID]+1 IF OBJ_VALID(sState.oPolygon[PolygonVarID,0,0]) EQ 0 THEN BEGIN print,'isosurface object not created yet' print,'click on generate in object controller' GOTO, SKIPEVENT ENDIF sState.oPolygon[PolygonVarID,0,0]->GetProperty,NAME=name len=strlen(name) ;print,'name=',name ;print,'len=',len name0=strmid(name,0, len-1) ;print,'name0=',name0 IF PolygonNTOT[PolygonVarID] LE PolygonNMAX THEN BEGIN result=sState.oData_PolygonNTOT->SetData(PolygonNTOT) listiso=STRARR(PolygonNTOT[PolygonVarID]) ;help,listiso for i = 0, PolygonNTOT[PolygonVarID]-1 do begin listiso[i]='iso '+strcompress(string(i),/remove_all) endfor WIDGET_CONTROL,sState.wSelectIso,SET_VALUE=listiso WIDGET_CONTROL,sState.wSelectIso,SET_DROPLIST_SELECT=PolygonNTOT[PolygonVarID]-1 j=PolygonVarID k=PolygonID[PolygonVarID] l=MovieFrameCURRENT nameiso=name0+strcompress(string(k),/remove_all) ;print,'create polygon PolygonVarID,PolygonID,MovieFrameCURRENT,nameiso=',j,k,l,nameiso sState.oPolygon[j,k,l]=OBJ_NEW('IDLgrPolygon',Color=[0,0,205], $ Shading=1,ALPHA_CHANNEL=1.,/REGISTER_PROPERTIES, $ NAME=nameiso , $ DESCRIPTION='isosurface object' $ ) ;help, sState.oPolygon[j,k] sState.oModelPolygon->Add,sState.oPolygon[j,k,l] ;,/ALIAS result=sState.oData_PolygonID->SetData(PolygonID) WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState WIDGET_CONTROL, sEvent.top, Set_UValue=sState ENDIF ELSE BEGIN print,'max number of isosurfaces=',PolygonNMAX,' !!!' END ;result=sState.oData_PolygonID->GetData(PolygonID) ;PolygonNMAX=PolygonNMAX+1 ; result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) ; result=sState.oData_PolygonNMAX->GetData(PolygonNMAX) ; WIDGET_CONTROL,sState.wSelectIso,GET_VALUE=oldlistiso ; s=size(oldlistiso) ; print,'s=',s ; niso_implemented=fix(s[1]) ; print,'niso_implemented=',niso_implemented ; niso_implemented=niso_implemented+1 ; IF niso_implemented LE PolygonNMAX THEN BEGIN ; newlistiso=STRARR([niso_implemented]) ; newlistiso(0:niso_implemented-2)=oldlistiso(0:niso_implemented-2) ; newlistiso(niso_implemented-1)='iso '+strcompress(string(niso_implemented-1),/remove_all) ; WIDGET_CONTROL,sState.wSelectIso,SET_VALUE=newlistiso ; WIDGET_CONTROL,sState.wSelectIso,SET_DROPLIST_SELECT=niso_implemented-1 ; PolygonID=niso_implemented-1 ; j=PolygonID ; k=MovieFrameCURRENT ; print,'add polygon PolygonID,MovieFrameCURRENT=',j,k ; sState.oPolygon[j,k]=OBJ_NEW('IDLgrPolygon',Color=[0,0,205], $ ; Shading=1,ALPHA_CHANNEL=1.,/REGISTER_PROPERTIES $ ; ;/DEPTH_WRITE_DISABLE $ ; ) ; sState.oModelPolygon->Add,sState.oPolygon[j,k] ;,/ALIAS ; result=sState.oData_PolygonID->SetData(PolygonID) ; WIDGET_CONTROL, sState.wTopBase, Set_UValue=sState ; WIDGET_CONTROL, sEvent.top, Set_UValue=sState ; ENDIF ELSE BEGIN ; print,'max number of isosurfaces=',PolygonNMAX,' !!!' ; END end ; Handle the selection of iso ; 'SELECTISO' : begin WIDGET_CONTROL, /HOURGLASS ID = WIDGET_INFO( sEvent.id, /DROPLIST_SELECT) ;print,'PolygonID=',ID result=sState.oData_PolygonID->GetData(PolygonID) result=sState.oData_PolygonVarID->GetData(PolygonVarID) PolygonID[PolygonVarID]=ID result=sState.oData_PolygonID->SetData(PolygonID) result=sState.oData_MovieFrameNMAX->GetData(MovieFrameNMAX) result=sState.oData_MovieFrameCURRENT->GetData(MovieFrameCURRENT) j=PolygonVarID k=PolygonID[PolygonVarID] l=MovieFrameCURRENT IF OBJ_VALID(sState.oPolygon[j,k,l]) EQ 0 THEN BEGIN print,'isosurface object not created yet' print,'click on generate in object controller' GOTO, SKIPEVENT ENDIF ;print,'select polygon PolygonVarID,PolygonID,MovieFrameCURRENT=',j,k,l sState.oPolygon[PolygonVarID,PolygonID[PolygonVarID],MovieFrameCURRENT]->SetProperty,HIDE=0 SDvis_Draw, sState end ; Handle the coordinate system selection ; 'COORDINATE-SYSTEM' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) ;getdesc,grid=g,sState,cpu=indgen(1000) ;,/FORCE ;SDvis_Draw, sState dum=UpdateTheViews(sState,1) end ; ; Handle the display of meshes ; 'DISPLAY-MESHES' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) ;getdesc,grid=g,sState,cpu=indgen(1000) ;,/FORCE ;SDvis_Draw, sState dum=UpdateTheViews(sState,1) end ; ; Handle the domains alpha factor ; 'DOMAINS-ALPHA' : begin WIDGET_CONTROL,sState.wDomainsOptions[2],GET_VALUE=alpha print ,'domains alpha factor=',alpha ;if alpha gt 1. then begin ; print,'alpha gt 1. not allowed => set alpha to 1.' ; alpha=1. ; WIDGET_CONTROL,sState.wDomainsOptions[2],SET_VALUE=alpha ;endif else if alpha lt 0. then begin ; print,'alpha lt 0. not allowed => set alpha to 0.' ; alpha=0. ; WIDGET_CONTROL,sState.wDomainsOptions[2],SET_VALUE=alpha ;end dum=UpdateTheViews(sState,1) end ; Handle the axis text ; 'AXIS-TEXT' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) sState.xaxis3D->SetProperty, NOTEXT=listValue sState.yaxis3D->SetProperty, NOTEXT=listValue sState.zaxis3D->SetProperty, NOTEXT=listValue SDvis_Draw, sState end ; Handle the list event, Choose between 4 color scenarios. ; 'AXISCOLORLIST' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO( sEvent.id, /LIST_SELECT) case listValue of ; Blue ; 0 : begin sState.xaxis3D->SetProperty, COLOR=[0,0,255] sState.yaxis3D->SetProperty, COLOR=[0,0,255] sState.zaxis3D->SetProperty, COLOR=[0,0,255] end ; of 1 ; Black ; 1 : begin sState.xaxis3D->SetProperty, COLOR=[0,0,0] sState.yaxis3D->SetProperty, COLOR=[0,0,0] sState.zaxis3D->SetProperty, COLOR=[0,0,0] end ; of 1 ; Red ; 2 : begin sState.xaxis3D->SetProperty, COLOR=[255,0,0] sState.yaxis3D->SetProperty, COLOR=[255,0,0] sState.zaxis3D->SetProperty, COLOR=[255,0,0] end ; of 1 ; White ; 3 : begin sState.xaxis3D->SetProperty, COLOR=[255,255,255] sState.yaxis3D->SetProperty, COLOR=[255,255,255] sState.zaxis3D->SetProperty, COLOR=[255,255,255] end ; of 1 endcase SDvis_Draw, sState end ; of AXISCOLORLIST ; Handle the list event, Choose between 4 color scenarios. ; 'BOUNDARIESCOLORLIST' : begin WIDGET_CONTROL, /HOURGLASS listValue = WIDGET_INFO( sEvent.id, /LIST_SELECT) case listvalue of 0 : begin & dum=SetBoundariesColor(sState,'blue') & end 1 : begin & dum=SetBoundariesColor(sState,'black') & end 2 : begin & dum=SetBoundariesColor(sState,'red') & end 3 : begin & dum=SetBoundariesColor(sState,'white') & end endcase SDvis_Draw, sState end ; of BOUNDARIESCOLORLIST ; Handle the BOUNDARIES THICKNESS ; 'BOUNDARIESTHICKNESS' : begin WIDGET_CONTROL, /HOURGLASS thickness = WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) if thickness lt 1 then begin result=DIALOG_MESSAGE('Please select a thickness ge 1') endif else if thickness gt 10 then begin result=DIALOG_MESSAGE('Please select a thickness le 10') endif else begin sState.xaxis3Dbounds1->SetProperty , THICK=thickness sState.xaxis3Dbounds2->SetProperty , THICK=thickness sState.xaxis3Dbounds3->SetProperty , THICK=thickness sState.xaxis3Dbounds4->SetProperty , THICK=thickness sState.yaxis3Dbounds1->SetProperty , THICK=thickness sState.yaxis3Dbounds2->SetProperty , THICK=thickness sState.yaxis3Dbounds3->SetProperty , THICK=thickness sState.yaxis3Dbounds4->SetProperty , THICK=thickness sState.zaxis3Dbounds1->SetProperty , THICK=thickness sState.zaxis3Dbounds2->SetProperty , THICK=thickness sState.zaxis3Dbounds3->SetProperty , THICK=thickness sState.zaxis3Dbounds4->SetProperty , THICK=thickness SDvis_Draw, sState endelse end ; of BOUNDARIESTHICKNESS ; Handle the BOUNDARIES THICKNESS ; 'DOMAINSTHICKNESS' : begin WIDGET_CONTROL, /HOURGLASS thickness = WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) if thickness lt 1 then begin result=DIALOG_MESSAGE('Please select a thickness ge 1') endif else if thickness gt 10 then begin result=DIALOG_MESSAGE('Please select a thickness le 10') endif else begin dum=UpdateTheViews(sState,1) endelse end ; of BOUNDARIESTHICKNESS ; Handle the BOUNDARIES OFFSET ; 'BOUNDARIES-OFFSET' : begin WIDGET_CONTROL, /HOURGLASS dum=UpdateTheViews(sState,1) end ; of BOUNDARIESTHICKNESS ; Handle the JUPITER FIELD ; ;'JUPITERFIELD' : begin ; ; WIDGET_CONTROL, /HOURGLASS ; ; print,'Jupiter field=',WIDGET_INFO( sEvent.id, /COMBOBOX_GETTEXT) ; ;end ; of JUPITERFIELD ; Handle the Axis span ; 'AXIS-SPAN' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wAxisOptions[1], GET_VALUE=index ;; recompute the axis dum=UpdateTheViews(sState,1) result=sState.oData_vue->GetData(iflag_vue) result=sState.GeoStructure.oData_DomainsCounter->GetData(DomainsCounter) if DomainsCounter ne 0 then begin iflag_vue[3]=3 result=sState.oData_vue->SetData(iflag_vue) ;; recompute the domains dum=UpdateTheViews(sState,1) endif result=sState.oData_PolygonNMAX->GetData(PolygonNMAX) if PolygonNMAX ne 0 then begin iflag_vue[*]=0 iflag_vue[0]=4 result=sState.oData_vue->SetData(iflag_vue) ;; recompute the domains dum=UpdateTheViews(sState,1) endif iflag_vue[3]=2 result=sState.oData_vue->SetData(iflag_vue) end ; of AXIS-SPAN ; Handle the Axis zero-ing ; 'AXIS-ZERO' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wAxisOptions[2], GET_VALUE=index dum=UpdateTheViews(sState,1) end ; of AXIS-ZERO ; Handle the Axis units ; 'AXIS-UNITS' : begin WIDGET_CONTROL, /HOURGLASS WIDGET_CONTROL, sState.wAxisOptions[3], GET_VALUE=index dum=UpdateTheViews(sState,1) end ; of AXIS-ZERO "SEEDOPTARRAY": begin WIDGET_CONTROL, sState.wSeedPickOptions[2], GET_VALUE=index if index[0] eq 1 then begin print,'continuous seed picking' endif end ;;; handle memory management facility ; "MEMORYMANAGEMENT": begin result=sState.oData_MemoryManagement->GetData(MemoryManagement) wMemoryManagementBase = WIDGET_BASE(TITLE='Memory Management', GROUP_LEADER=sEvent.top, $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) wMemoryManagementOptions = CW_BGROUP(wMemoryManagementBase, [$ 'discard 3D table from memory after loading into IdlGrVolume object', $ 'discard current list of variables when reloading data', $ 'discard Dark Matter particles before drawing', $ 'limit AMR loading to meshijk level max' $ ], UVALUE='MEMORYMANAGEMENTOPTIONS', /NONEXCLUSIVE, SET_VALUE=MemoryManagement) wAmrDiscard = WIDGET_BUTTON(wMemoryManagementBase, $ VALUE='Discard AMR mesh and Hydro stucture currently loaded', $ UVALUE='DISCARDAMR') wMemoryCurrent = WIDGET_BUTTON(wMemoryManagementBase, $ VALUE='Print amount of dynamic memory currently used by the IDL session', $ UVALUE='MEMORYCURRENT') sMemoryManagement={sState:sState,wMemoryManagementOptions:wMemoryManagementOptions} WIDGET_CONTROL, sEvent.top, Set_UValue=sState hState = PTR_NEW(sMemoryManagement, /NO_COPY) WIDGET_CONTROL, wMemoryManagementBase, SET_UVALUE=hState WIDGET_CONTROL, wMemoryManagementBase, /REALIZE XMANAGER,'SDvis_Event',wMemoryManagementBase,EVENT_HANDLER='MemoryManagementControlEvent',/JUST_REG end "ISOSET": begin WIDGET_CONTROL, sState.wIsoValues[0], GET_VALUE=min WIDGET_CONTROL, sState.wIsoValues[1], GET_VALUE=max WIDGET_CONTROL, sState.wIsoValues[2], GET_VALUE=iso percent=100*(iso-min)/(max-min) WIDGET_CONTROL, sState.wIsoValues[3], SET_VALUE=percent result=sState.oData_IsoPlot->GetData(IsoPlot) result=sState.oData_PolygonID->GetData(PolygonID) IsoPlot[PolygonID]=iso result=sState.oData_IsoPlot->SetData(IsoPlot) sState.oPolyLineIsoPlot->GetProperty, DATA=Polyline sState.xAxisIsoPlotB->GetProperty, XRANGE=xri Polyline[0,*]=-0.5+(iso-xri[0])/(xri[1]-xri[0]) if Polyline[0,0] lt -0.5 then Polyline[0,*]=-0.5 if Polyline[0,0] gt 0.5 then Polyline[0,*]= 0.5 sState.oPolyLineIsoPlot->SetProperty, DATA=Polyline dum=UpdateTheViews(sState,1) end "ISOPERCENT": begin WIDGET_CONTROL, sState.wIsoValues[3], GET_VALUE=percent WIDGET_CONTROL, sState.wIsoValues[0], GET_VALUE=min WIDGET_CONTROL, sState.wIsoValues[1], GET_VALUE=max iso=min+(max-min)*percent/100. WIDGET_CONTROL, sState.wIsoValues[2], SET_VALUE=iso result=sState.oData_IsoPlot->GetData(IsoPlot) result=sState.oData_PolygonID->GetData(PolygonID) IsoPlot[PolygonID]=iso result=sState.oData_IsoPlot->SetData(IsoPlot) sState.oPolyLineIsoPlot->GetProperty, DATA=Polyline sState.xAxisIsoPlotB->GetProperty, XRANGE=xri Polyline[0,*]=-0.5+(iso-xri[0])/(xri[1]-xri[0]) if Polyline[0,0] lt -0.5 then Polyline[0,*]=-0.5 if Polyline[0,0] gt 0.5 then Polyline[0,*]= 0.5 sState.oPolyLineIsoPlot->SetProperty, DATA=Polyline dum=UpdateTheViews(sState,1) end "VOLUME-CLIPD-SLIDER": begin WIDGET_CONTROL, sState.wVolumeOptions[13], GET_VALUE=a WIDGET_CONTROL, sState.wVolumeOptions[14], GET_VALUE=b WIDGET_CONTROL, sState.wVolumeOptions[15], GET_VALUE=c WIDGET_CONTROL, sState.wVolumeOptions[17], GET_VALUE=d WIDGET_CONTROL, sState.wVolumeOptions[16], SET_VALUE=d result=sState.oData_oVolume->GetData(oVolume) oVolume[0]->GetProperty,BOUNDS=bounds,CLIP_PLANE=clip_plane normu=sqrt(a^2+b^2+c^2) norm=sqrt((a*(bounds[3]+1))^2+(b*(bounds[4]+1))^2+(c*(bounds[5]+1))^2) clip_plane(0)=a/normu clip_plane(1)=b/normu clip_plane(2)=c/normu listValue = WIDGET_INFO(sState.wVolumeOptions[18],/DROPLIST_SELECT) clip_plane(3)=-d*norm if listValue ge 4 then clip_plane(3)=-clip_plane(3) print,'a,b,c,d=',a,b,c,d & print,'norm=',norm & print,'bounds=',bounds & print,'clip_plane=',clip_plane oVolume[0]->SetProperty,CLIP_PLANE=clip_plane SDvis_Draw,sState end "VOLUME-CLIPA": begin WIDGET_CONTROL, sState.wVolumeOptions[13], GET_VALUE=d result=sState.oData_oVolume->GetData(oVolume) oVolume[0]->GetProperty,BOUNDS=bounds,CLIP_PLANE=clip_plane clip_plane(0)=d print,'bounds=',bounds & print,'clip_plane=',clip_plane oVolume[0]->SetProperty,CLIP_PLANE=clip_plane SDvis_Draw,sState end "VOLUME-CLIPB": begin WIDGET_CONTROL, sState.wVolumeOptions[14], GET_VALUE=d result=sState.oData_oVolume->GetData(oVolume) oVolume[0]->GetProperty,BOUNDS=bounds,CLIP_PLANE=clip_plane clip_plane(1)=d print,'bounds=',bounds & print,'clip_plane=',clip_plane oVolume[0]->SetProperty,CLIP_PLANE=clip_plane SDvis_Draw,sState end "VOLUME-CLIPC": begin WIDGET_CONTROL, sState.wVolumeOptions[15], GET_VALUE=d result=sState.oData_oVolume->GetData(oVolume) oVolume[0]->GetProperty,BOUNDS=bounds,CLIP_PLANE=clip_plane clip_plane(2)=d print,'bounds=',bounds & print,'clip_plane=',clip_plane oVolume[0]->SetProperty,CLIP_PLANE=clip_plane SDvis_Draw,sState end "VOLUME-CLIPD": begin WIDGET_CONTROL, sState.wVolumeOptions[13], GET_VALUE=a WIDGET_CONTROL, sState.wVolumeOptions[14], GET_VALUE=b WIDGET_CONTROL, sState.wVolumeOptions[15], GET_VALUE=c WIDGET_CONTROL, sState.wVolumeOptions[16], GET_VALUE=d WIDGET_CONTROL, sState.wVolumeOptions[17], SET_VALUE=d result=sState.oData_oVolume->GetData(oVolume) oVolume[0]->GetProperty,BOUNDS=bounds,CLIP_PLANE=clip_plane normu=sqrt(a^2+b^2+c^2) norm=sqrt((a*(bounds[3]+1))^2+(b*(bounds[4]+1))^2+(c*(bounds[5]+1))^2) clip_plane(0)=a/normu clip_plane(1)=b/normu clip_plane(2)=c/normu clip_plane(3)=-d*norm print,'bounds=',bounds & print,'clip_plane=',clip_plane oVolume[0]->SetProperty,CLIP_PLANE=clip_plane SDvis_Draw,sState end "VOLUME-CLIPLIST": begin listValue = WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) case listValue of ; free ; 0 : begin WIDGET_CONTROL, sState.wVolumeOptions[13], SENSITIVE=1 WIDGET_CONTROL, sState.wVolumeOptions[14], SENSITIVE=1 WIDGET_CONTROL, sState.wVolumeOptions[15], SENSITIVE=1 end ; z wise ; 1 : begin a=0 & b=0 & c=1 & d=1 end ; x wise ; 2 : begin a=1 & b=0 & c=0 & d=1 end ; y wise ; 3 : begin a=0 & b=1 & c=0 & d=1 end ; -z wise ; 4 : begin a=0 & b=0 & c=-1 & d=0 end ; -x wise ; 5 : begin a=-1 & b=0 & c=0 & d=0 end ; -y wise ; 6 : begin a=0 & b=-1 & c=0 & d=0 end endcase ; of listValue if listvalue ne 0 then begin WIDGET_CONTROL, sState.wVolumeOptions[13], SENSITIVE=0 WIDGET_CONTROL, sState.wVolumeOptions[14], SENSITIVE=0 WIDGET_CONTROL, sState.wVolumeOptions[15], SENSITIVE=0 WIDGET_CONTROL, sState.wVolumeOptions[13], SET_VALUE=a WIDGET_CONTROL, sState.wVolumeOptions[14], SET_VALUE=b WIDGET_CONTROL, sState.wVolumeOptions[15], SET_VALUE=c WIDGET_CONTROL, sState.wVolumeOptions[16], SET_VALUE=d WIDGET_CONTROL, sState.wVolumeOptions[17], SET_VALUE=d result=sState.oData_oVolume->GetData(oVolume) oVolume[0]->GetProperty,BOUNDS=bounds,CLIP_PLANE=clip_plane norm=sqrt((a*(bounds[3]+1))^2+(b*(bounds[4]+1))^2+(c*(bounds[5]+1))^2) clip_plane(0)=a clip_plane(1)=b clip_plane(2)=c clip_plane(3)=-d*norm oVolume[0]->SetProperty,CLIP_PLANE=clip_plane SDvis_Draw,sState endif end "NAVIGATION_LEFT_SLIDER": begin result=sState.oData_wNavigationOptions->GetData(wNavigationOptions) WIDGET_CONTROL,wNavigationOptions[0],GET_VALUE=accfactor print,'accfactor=',accfactor if accfactor gt 0. then begin Device, GET_SCREEN_SIZE = screenSize ydim3D = screenSize[1]*0.64 xdim3D = ydim3D xcenter = xdim3D/2. ycenter = ydim3D/2. radius=xdim3D/sqrt(2.) radius=radius/accfactor sState.oTrackL->Reset, [xcenter,ycenter], radius, MOUSE=1 endif end "NAVIGATION_MIDDLE_SLIDER": begin result=sState.oData_wNavigationOptions->GetData(wNavigationOptions) WIDGET_CONTROL,wNavigationOptions[1],GET_VALUE=accfactor print,'accfactor=',accfactor if accfactor gt 0. then begin Device, GET_SCREEN_SIZE = screenSize ydim3D = screenSize[1]*0.64 xdim3D = ydim3D xcenter = xdim3D/2. ycenter = ydim3D/2. radius=xdim3D/sqrt(2.) radius=radius/accfactor sState.oTrackM->Reset, [xcenter,ycenter], radius, MOUSE=2 endif end "NAVIGATION_RIGHT_SLIDER": begin result=sState.oData_wNavigationOptions->GetData(wNavigationOptions) WIDGET_CONTROL,wNavigationOptions[2],GET_VALUE=accfactor print,'accfactor=',accfactor if accfactor gt 0. then begin Device, GET_SCREEN_SIZE = screenSize ydim3D = screenSize[1]*0.64 xdim3D = ydim3D xcenter = xdim3D/2. ycenter = ydim3D/2. radius=xdim3D/sqrt(2.) radius=radius/accfactor sState.oTrackR->Reset, [xcenter,ycenter], radius, MOUSE=4 endif end "NAVIGATION_MULTIPLY": begin end "NAVIGATION_MIDDLELIST": begin end "NAVIGATION_PIVOTSHOW": begin sState.oSceneText[0]->GetProperty,HIDE=hide if hide eq 0 then HideSceneText, sState pivotshow=WIDGET_INFO(sEvent.id,/DROPLIST_SELECT) if pivotshow eq 1 then begin print,'the pivot point is displayed in red, the center of the data reference frame is displayed in yellow' endif sState.sScene.oPivot->SetProperty, HIDE=1-pivotshow sState.sScene.oPivotRotation->SetProperty, HIDE=1-pivotshow result=sState.oData_vue->GetData(iflag_vue) iflag_vue[*]=0 & iflag_vue[3]=1 & result=sState.oData_vue->SetData(iflag_vue) dum=UpdateTheViews(sState,1) end "NAVIGATION_PIVOTCONTROL": begin result=sState.oData_wNavigationOptions->GetData(wNavigationOptions) WIDGET_CONTROL,wNavigationOptions[6],GET_VALUE=index element=sEvent.value index[1-element]=0 if element eq 0 and index[0]eq 1 then begin print,'click on any object on display to set the pivot point' endif if element eq 1 and index[1]eq 1 then begin print,'use the mouse with right button down to translate the pivot point in the XY plane' endif WIDGET_CONTROL,wNavigationOptions[6],SET_VALUE=index end "NAVIGATION_PIVOTRADIUS_SLIDER": begin result=sState.oData_wNavigationOptions->GetData(wNavigationOptions) WIDGET_CONTROL,wNavigationOptions[7],GET_VALUE=pivotRadius sState.sScene.oPivot->SetProperty,radius=pivotRadius*0.025 sState.sScene.oPivotRotation->SetProperty,radius=pivotRadius*0.025 SDvis_Draw,sState end "NAVIGATION_PIVOTTRANSPARENCY_SLIDER": begin result=sState.oData_wNavigationOptions->GetData(wNavigationOptions) WIDGET_CONTROL,wNavigationOptions[8],GET_VALUE=pivotTransparency sState.sScene.oPivot->SetProperty,ALPHA_CHANNEL=pivotTransparency sState.sScene.oPivotRotation->SetProperty,ALPHA_CHANNEL=pivotTransparency SDvis_Draw,sState end ; Handle the GRAFIC file name ; 'GRAFICFILENAME' : BEGIN WIDGET_CONTROL, sState.wGraficConfig[0], GET_VALUE=GraficFileName print,'GRAFIC file name=',GraficFileName END ; Handle the browsing of directory to select GRAFIC file ; 'GRAFICFILEBROWSE' : BEGIN GraficFileName = DIALOG_PICKFILE(DIALOG_PARENT=sEvent.top,$ FILE=GraficFileName,TITLE='Select Grafic file') WIDGET_CONTROL, sState.wGraficConfig[0], SET_VALUE=GraficFileName print,'GRAFIC file name=',GraficFileName END ; AMR Format ; 'RAMSESAMRFORMAT' : BEGIN amrformat = WIDGET_INFO( sState.wRamsesConfig[3], /DROPLIST_SELECT) if amrformat eq 0 then print,'using old AMR format (no knowledge of cells neighbors'' if amrformat eq 1 then print,'using new AMR format with cells neighbors' END ; Text control ; 'TEXTCONTROL' : BEGIN WIDGET_CONTROL, sState.wTextControlOptions[0], GET_VALUE=index print,'index=',index sState.oSceneText[0]->SetProperty,HIDE=1-index[0] sState.oSceneText[1]->SetProperty,HIDE=1-index[0] sState.oSceneText[2]->SetProperty,HIDE=1-index[1] SDvis_Draw,sState END ELSE : begin PRINT, 'Case Statement found no matches' end endcase ;widget_control, sState.wDraw3D, /input_focus ;print,'call SDvis_draw' ;SDvis_draw,sState ; print,'Restore the info structure' ; Restore the info structure ; SKIPEVENT: WIDGET_CONTROL, sEvent.top, Set_UValue=sState, /No_Copy end ; of SDvis_Event ; ----------------------------------------------------------------------------- ; ; Purpose: Cleanup procedure ; pro SDvis_Cleanup, $ wTopBase ; IN: top level base associated with the cleanup ;print,'entering SDvis_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wTopBase, GET_UVALUE=sState,/No_Copy ;result = sState.oData_wAmrConfigurationBase->GetData(wAmrConfigurationBase) ;IF (WIDGET_INFO(wAmrConfigurationBase, /VALID_ID)) EQ 1 then WIDGET_CONTROL, wAmrConfigurationBase, /DESTROY ;print,'test' ;IF (WIDGET_INFO(sState.wBoundariesBase, /VALID_ID)) EQ 1 then WIDGET_CONTROL, sState.wBoundariesBase, /DESTROY IF WIDGET_INFO(sState.wDefineVueBase, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wDefineVueBase, /DESTROY IF WIDGET_INFO(sState.wObjectControlBase, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wObjectControlBase, /DESTROY IF WIDGET_INFO(sState.wGeometryObjectControlBase, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wGeometryObjectControlBase, /DESTROY IF WIDGET_INFO(sState.wDefineMovieBase, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wDefineMovieBase, /DESTROY IF WIDGET_INFO(sState.wDefineVueBase, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wDefineVueBase, /DESTROY IF WIDGET_INFO(sState.wCOTBase, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wCOTBase, /DESTROY IF WIDGET_INFO(sState.wDefineMovieBase, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wDefineMovieBase, /DESTROY IF WIDGET_INFO(sState.wDefineMpegBase, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wDefineMpegBase, /DESTROY IF WIDGET_INFO(sState.wImageSequenceBase, /VALID_ID) EQ 1 THEN WIDGET_CONTROL, sState.wImageSequenceBase, /DESTROY ; Destroy the top objects ; OBJ_DESTROY, sState.oStaticModel OBJ_DESTROY, sState.oTextureImage OBJ_DESTROY, sState.oPalette1 ; Restore the previous color table. ; TVLCT, sState.colorTable DEVICE, DECOMPOSED=0, BYPASS_TRANSLATION=1 ; Map the group leader base if it exists. ; if (WIDGET_INFO(sState.groupBase, /VALID_ID)) then $ WIDGET_CONTROL, sState.groupBase, /MAP end ; of SDvis_Cleanup ; ----------------------------------------------------------------------------- ; ; Purpose: Cleanup procedure ; pro Definevue_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering Definevue_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wDefineVueBase, /DESTROY end ; ofDefinevue _Cleanup ; ----------------------------------------------------------------------------- ; ; Purpose: Cleanup procedure ; pro Boundaries_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering Definevue_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wBoundariesBase, /DESTROY result=sState.oData_subAxisBoundaries->GetData(subAxisBoundaries) subAxisBoundaries[0]->SetProperty, hide=1 subAxisBoundaries[1]->SetProperty, hide=1 subAxisBoundaries[2]->SetProperty, hide=1 subAxisBoundaries[3]->SetProperty, hide=1 subAxisBoundaries[4]->SetProperty, hide=1 subAxisBoundaries[5]->SetProperty, hide=1 subAxisBoundaries[6]->SetProperty, hide=1 subAxisBoundaries[7]->SetProperty, hide=1 subAxisBoundaries[8]->SetProperty, hide=1 subAxisBoundaries[9]->SetProperty, hide=1 subAxisBoundaries[10]->SetProperty, hide=1 subAxisBoundaries[11]->SetProperty, hide=1 result=sState.oData_subAxisBoundaries->SetData(subAxisBoundaries) sState.drawWindowID3D->Draw, sState.oView3D end ; ofDefinevue _Cleanup ; ----------------------------------------------------------------------------- ; ; Purpose: Cleanup procedure ; pro AmrConfiguration_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering AmrConfiguration_Cleanup' WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy result=sState.oData_subAxisAMRBoundaries->GetData(subAxisAMRBoundaries) for i=0,11 do begin if obj_valid(subAxisAMRBoundaries[i]) then subAxisAMRBoundaries[i]->SetProperty, hide=1 endfor result=sState.oData_subAxisAMRBoundaries->SetData(subAxisAMRBoundaries) sState.drawWindowID3D->Draw, sState.oView3D end ; AmrConfiguration_Cleanup ; ----------------------------------------------------------------------------- ; ; ; Purpose: Cleanup procedure ; pro DefineMovie_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering DefineMovie_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wDefineMovieBase, /DESTROY end ; ; ; Purpose: Cleanup procedure ; pro DefineImageSequence_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering DefineImageSequence_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wImageSequenceBase, /DESTROY end ; ----------------------------------------------------------------------------- ; ; ; Purpose: Cleanup procedure ; pro DefineMpeg_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering DefineMovie_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wDefineMpegBase, /DESTROY end ; ----------------------------------------------------------------------------- ; ; ; Purpose: Cleanup procedure ; pro SaveViewWidgetEps_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering DefineMovie_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wSaveViewBaseEps, /DESTROY end ; ; ; Purpose: Cleanup procedure ; pro SaveViewWidgetJpg_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering DefineMovie_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wSaveViewBaseJpg, /DESTROY end ; ; ; Purpose: Cleanup procedure ; pro SaveViewWidgetGif_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering DefineMovie_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wSaveViewBaseGif, /DESTROY end ; ----------------------------------------------------------------------------- ; ; ; Purpose: Cleanup procedure ; pro ObjectControl_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering ObjectControl_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy if (WIDGET_INFO(sState.wObjectControlBase, /VALID_ID)) then $ WIDGET_CONTROL, sState.wObjectControlBase, /DESTROY end ; of ObjectControl_Cleanup ; ----------------------------------------------------------------------------- ; ; ; Purpose: Cleanup procedure ; pro GeometryObjectControl_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering ObjectControl_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wGeometryObjectControlBase, /DESTROY end ; of GeometryObjectControl_Cleanup ; ----------------------------------------------------------------------------- ; ; ; Purpose: Cleanup procedure ; pro COTWidget_Cleanup, $ wBase ; IN: top level base associated with the cleanup ;print,'entering ObjectControl_Cleanup' ; Get the color table saved in the window's user value. ; WIDGET_CONTROL, wBase, GET_UVALUE=sState,/No_Copy WIDGET_CONTROL, sState.wCOTBase, /DESTROY end ; of ObjectControl_Cleanup ;------------------------------------------------------------------------------ ; ; Event for the colors chosen for the ARM Levels ; pro choose_color_event, sEvent WIDGET_CONTROL, sEvent.id, GET_VALUE=eventVal result=sState.oData_Polylines->GetData(polylines) end ; ----------------------------------------------------------------------------- ; ; PURPOSE : Main procedure of the SDvision program ; ; MODIFICATION HISTORY : ; Written by: Daniel Pomarède, 2005. ;- pro SDvision, $ GROUP=group, $ ; IN: (opt) group identifier RECORD_TO_FILENAME=record_to_filename, $ DEBUG=debug, $ ; IN: (opt) APPTLB = appTLB ; OUT: (opt) TLB of this application ;debug=1 ; Check the validity of the group identifier ; ngroup = N_ELEMENTS(group) if (ngroup NE 0) then begin check = WIDGET_INFO(group, /VALID_ID) if (check NE 1) then begin print,'Error, the group identifier is not valid' print, 'Return to the main application' RETURN endif groupBase = group endif else groupBase = 0L ; Get the screen size. ; Device, GET_SCREEN_SIZE = screenSize ;print,'screensize=',screensize ; Set up dimensions of the drawing (viewing) area. ; ; xdim = screenSize[0]*0.4 ; ydim = xdim * 0.75 ; xdim3D = xdim ; ydim3D = xdim * 1.;0.75 ydim3D = screenSize[1]*0.64 xdim3D = ydim3D xdim = xdim3D ydim = ydim3D * 0.75 ; xydim[0:1] size of main view window ; xydim[2:3] size of widget top base ; xydim=intarr(4) & xydim[0]=xdim3D & xydim[1]=ydim3D ; Make the system have a maximum of 256 colors ; numcolors = !d.N_COLORS if( (( !D.NAME EQ 'X') or (!D.NAME EQ 'MAC')) $ and (!d.N_COLORS GE 256L)) then $ DEVICE, PSEUDO_COLOR=8 DEVICE, DECOMPOSED=0, BYPASS_TRANSLATION=0 ; Get the current color table ; TVLCT, savedR, savedG, savedB, /GET ; Build color table from color vectors ; colorTable = [[savedR],[savedG],[savedB]] ; Define a main widget base. ; SDversion='0.4.7.dev' title='SDvision '+SDversion if (N_ELEMENTS(group) EQ 0) then begin wTopBase = WIDGET_BASE( $ TITLE=title, $ /COLUMN, $;/KBRD_FOCUS_EVENTS, $ /TLB_KILL_REQUEST_EVENTS, $ TLB_SIZE_EVENTS=1, $ ;TLB_FRAME_ATTR=1, $ MBAR=barBase) endif else begin wTopBase = WIDGET_BASE( $ TITLE=title, $ /COLUMN, $;/KBRD_FOCUS_EVENTS, $ /TLB_KILL_REQUEST_EVENTS, $ TLB_SIZE_EVENTS=1, $ GROUP_LEADER=group, $ ;TLB_FRAME_ATTR=1, $ MBAR=barBase) endelse ; Create the File button ; wFileButton = WIDGET_BUTTON(barBase, VALUE= 'File', /MENU, $ TOOLTIP='click here to save views and quit') wSaveViewsPostcript=WIDGET_BUTTON(wFileButton,VALUE='Save views to postscript', $ UVALUE='SAVEVIEWS-POSTSCRIPT-WIDGET') wSaveViewsJPEG=WIDGET_BUTTON(wFileButton,VALUE='Save views to jpeg',UVALUE='SAVEVIEWS-JPEG-WIDGET') wSaveViewsGIF=WIDGET_BUTTON(wFileButton,VALUE='Save views to gif',UVALUE='SAVEVIEWS-GIF-WIDGET') wQuitButton = WIDGET_BUTTON(wFileButton,VALUE='Quit',UVALUE='QUIT', ACCELERATOR='Ctrl+Q') ; Create the load data button ; wDataButton = WIDGET_BUTTON(barBase, VALUE= 'Data', /MENU, $ TOOLTIP='click here to access data-specific applications') wLoadDataButton3 = WIDGET_BUTTON(wDataButton, $ VALUE='Parse HDF5 Header File', UVALUE='BROWSEH5' ) wLoadDataButton4 = WIDGET_BUTTON(wDataButton, $ VALUE='Change directory', UVALUE='BROWSEBIN' ) wExportDataButton = WIDGET_BUTTON(wDataButton, $ VALUE='Export variables to command line', UVALUE='EXPORTDATA' ) wDefineCustomVariable = WIDGET_BUTTON(wDataButton, $ VALUE='Load Custom Variable', UVALUE='DEFINECUSTOM1' ) ; wDefineJaquesCustomVariable = WIDGET_BUTTON(wDataButton, $ ; VALUE='Load Jacques Variable',UVALUE='DEFINEJAQUESCUSTOM') wRebinData = WIDGET_BUTTON(wDataButton,VALUE='Rebin data',UVALUE='PICK_REBINDATA_CONTROLLER',SENSITIVE=0) wEndian=LONARR(2) wEndian[0] = WIDGET_BUTTON(wDataButton,VALUE='Little Endian',UVALUE='LITTLEENDIAN',CHECKED_MENU=1 ) WIDGET_CONTROL,wEndian[0],/SET_BUTTON wEndian[1] = WIDGET_BUTTON(wDataButton,VALUE='Big Endian',UVALUE='BIGENDIAN',CHECKED_MENU=1 ) ; Create the pick variables button (Object Graphics) ; wVarButton = WIDGET_BUTTON(barBase, VALUE= 'Object Graphics', /MENU, $ TOOLTIP='click here to manage the object to be displayed') wPickDataController = WIDGET_BUTTON(wVarButton, $ VALUE='Data Objects control', UVALUE='PICK_DATA_CONTROLLER', SENSITIVE=1,ACCELERATOR="F1") wPickGeometryController = WIDGET_BUTTON(wVarButton, $ VALUE='Geometry Objects control', UVALUE='PICK_GEOMETRY_CONTROLLER', SENSITIVE=1,ACCELERATOR="F2") wPickSceneController = WIDGET_BUTTON(wVarButton, $ VALUE='Scene Objects control', UVALUE='PICK_SCENE_CONTROLLER', SENSITIVE=1,ACCELERATOR="F3") wPickTextController = WIDGET_BUTTON(wVarButton, $ VALUE='Text Objects control', UVALUE='PICK_TEXT_CONTROLLER', SENSITIVE=1) wNavigationControl = WIDGET_BUTTON(wVarButton, $ VALUE='Navigation control', UVALUE='NAVIGATION_CONTROL', SENSITIVE=1,ACCELERATOR="F4") wEditObjectProperty = WIDGET_BUTTON(wVarButton, $ VALUE='Probe objects and edit properties', UVALUE='EDITOBJECTPROPERTY', CHECKED_MENU=1) ; Create the Performances button ; wPerformances = WIDGET_BUTTON(barBase, VALUE= 'Performances', /MENU, $ TOOLTIP='click here to manage performances') wMemoryManagementButton = WIDGET_BUTTON(wPerformances, VALUE= 'Memory management', $ SENSITIVE=1, UVALUE='MEMORYMANAGEMENT' ) wDynamicQualityButton = WIDGET_BUTTON(wPerformances, VALUE= 'Dynamic Quality Setup', $ SENSITIVE=1, UVALUE='DYNAMICQUALITYSETUP' ) ; Create the Task Farming button ; wTaskFarming = WIDGET_BUTTON(barBase, VALUE= 'Task Farming', /MENU, $ TOOLTIP='click here to engage farming of independent tasks') wTaskFarmingSetup = WIDGET_BUTTON(wTaskFarming, VALUE= 'Setup', $ SENSITIVE=1, UVALUE='TASKFARMINGSETUP' ) ; Create the stereo menu ; wStereo = WIDGET_BUTTON(barBase, VALUE= 'Stereo', /MENU, $ TOOLTIP='click here to activate the stereo mode') wStereoControl = WIDGET_BUTTON(wStereo, $ VALUE='Control', UVALUE='STEREO_CONTROL', SENSITIVE=1) ; Create the Background button ; wBackgroundButton = WIDGET_BUTTON(barBase, VALUE= 'Background', /MENU, $ TOOLTIP='click here to modify the background color') wBlackBackground = WIDGET_BUTTON(wBackgroundButton, $ VALUE='Black', UVALUE='BLACKBACKGROUND') wWhiteBackground = WIDGET_BUTTON(wBackgroundButton, $ VALUE='White', UVALUE='WHITEBACKGROUND') wBlueBackground = WIDGET_BUTTON(wBackgroundButton, $ VALUE='Emerald', UVALUE='BLUEBACKGROUND') ; Create the Vue button ; wVueButton = WIDGET_BUTTON(barBase, VALUE= 'View', /MENU, $ TOOLTIP='click here to modify the view') wViewOptions=LONARR(9) wViewOptions[0] = WIDGET_BUTTON(wVueButton, $ VALUE='Isometric', UVALUE='PICKISOMETRIC', CHECKED_MENU=1 ) ;WIDGET_CONTROL,wViewOptions[0],/SET_BUTTON wViewOptions[1] = WIDGET_BUTTON(wVueButton, $ VALUE='Perspective', UVALUE='PICKPERSPECTIVE', CHECKED_MENU=1 ) WIDGET_CONTROL,wViewOptions[1],/SET_BUTTON wViewOptions[2] = WIDGET_BUTTON(wVueButton,VALUE='Reset Viewing point',UVALUE='RESETVUE') wViewOptions[3] = WIDGET_BUTTON(wVueButton,VALUE='Define View properties',UVALUE='DEFINEVUE',ACCELERATOR="F5") wViewOptions[4] = WIDGET_BUTTON(wVueButton, VALUE='XY Projection', UVALUE='XYVUE') wViewOptions[5] = WIDGET_BUTTON(wVueButton, VALUE='YZ Projection', UVALUE='YZVUE') wViewOptions[6] = WIDGET_BUTTON(wVueButton, VALUE='XZ Projection', UVALUE='XZVUE') wViewOptions[7] = WIDGET_BUTTON(wVueButton, VALUE='3D View Size edit', UVALUE='3DVIEWSIZEEDIT') wViewOptions[8] = WIDGET_BUTTON(wVueButton, VALUE='Widget Size edit', UVALUE='WIDGETSIZEEDIT') ; wViewOptions[8] = WIDGET_BUTTON(wVueButton, $ ; VALUE='Platform native OpenGL Graphics renderer', UVALUE='PICKOPENGL', CHECKED_MENU=1 ) ; WIDGET_CONTROL,wViewOptions[8],/SET_BUTTON ; wViewOptions[9] = WIDGET_BUTTON(wVueButton, $ ; VALUE='IDL software renderer', UVALUE='PICKSOFTWARERENDERER', CHECKED_MENU=1 ) ; Create the Palette button ; wPaletteButton = WIDGET_BUTTON(barBase, VALUE= 'Palette', /MENU, $ TOOLTIP='click here to modify the color palette') wEditCOT = WIDGET_BUTTON(wPaletteButton, $ VALUE='Edit Color and Opacity Tables', UVALUE='VOLUME-COLOR-OPACITY') ; Create the Animation button ; wAnimationButton = WIDGET_BUTTON(barBase, VALUE= 'Animation', /MENU, $ TOOLTIP='click here to animate and generate mpeg files') wAnimationStart = WIDGET_BUTTON(wAnimationButton, $ VALUE='70 degree Z-rotation with closeup', UVALUE='ANIMSTART-70Z-CLOSEUP',ACCELERATOR="F7") wAnimationStart = WIDGET_BUTTON(wAnimationButton, $ VALUE='360 degree Z-rotation with closeup', UVALUE='ANIMSTART-360Z-CLOSEUP',ACCELERATOR="F8") wAnimationStart = WIDGET_BUTTON(wAnimationButton, $ VALUE='360 degree Z-rotation with move away', UVALUE='ANIMSTART-360Z-MOVEAWAY',ACCELERATOR="F9") wAnimationStart = WIDGET_BUTTON(wAnimationButton, $ VALUE='360 degree Z-rotation', UVALUE='ANIMSTART-360Z',ACCELERATOR="F10") wAnimationStart = WIDGET_BUTTON(wAnimationButton, $ VALUE='Align + 360 degree Z-rotation', UVALUE='ANIMSTART-ALIGN-360Z') wAnimationStart = WIDGET_BUTTON(wAnimationButton, $ VALUE='Closeup 500 steps', UVALUE='ANIMSTART-CLOSEUP-500',ACCELERATOR="F11") wAnimationStart = WIDGET_BUTTON(wAnimationButton, $ VALUE='Closeup 10 steps', UVALUE='ANIMSTART-CLOSEUP-10') wAnimationStart = WIDGET_BUTTON(wAnimationButton, $ VALUE='Move away 500 steps', UVALUE='ANIMSTART-MOVEAWAY-500',ACCELERATOR="F12") wAnimationStart = WIDGET_BUTTON(wAnimationButton, $ VALUE='Move away 10 steps', UVALUE='ANIMSTART-MOVEAWAY-10') ;wMpegStart = WIDGET_BUTTON(wAnimationButton, $ ; VALUE='Start Mpeg', UVALUE='MPEG-START') ;wMpegSave = WIDGET_BUTTON(wAnimationButton, $ ; VALUE='Save Mpeg', UVALUE='MPEG-SAVE') wMotionJpeg2000Start = WIDGET_BUTTON(wAnimationButton, $ VALUE='Motion JPEG2000', UVALUE='MJPEG2000',SENSITIVE=0) ; Create the VRML button ; wVRMLButton = WIDGET_BUTTON(barBase, VALUE= 'VRML', /MENU, $ TOOLTIP='click here to save the Objects Graphics hierarchy in vrml 2.0 file') wVRMLStart = WIDGET_BUTTON(wVRMLButton, $ VALUE='Save', UVALUE='VRMLSAVE') ; Create the Movie button ; wMovieButton = WIDGET_BUTTON(barBase, VALUE= 'Movie', /MENU, $ TOOLTIP='click here to define a time sequence') wMovieEdit = WIDGET_BUTTON(wMovieButton, $ VALUE='Movie properties', UVALUE='MOVIEPROPERTIES') wMpegEdit = WIDGET_BUTTON(wMovieButton, $ VALUE='Mpeg properties', UVALUE='MPEGPROPERTIES') wSequenceEdit = WIDGET_BUTTON(wMovieButton, $ VALUE='Sequence of output images', UVALUE='IMAGESEQUENCE') ; Create the help button ; wHelpButton = WIDGET_BUTTON(barBase, /HELP, $ VALUE='Documentation', /MENU, SENSITIVE=0) wAboutButton = WIDGET_BUTTON(wHelpButton, $ VALUE='Online Help', UVALUE='ONLINEHELP') ; Create the first child of the graphic base. ; wSubBase = WIDGET_BASE(wTopBase, COLUMN=2) wTabBase = WIDGET_TAB(wSubBase, uvalue='TAB') ; Create a left column base for selecting the data ; wLeftDataBase = WIDGET_BASE(wTabBase, TITLE=' READER ', /BASE_ALIGN_LEFT, $ XPAD=1, YPAD=5, /FRAME, /COLUMN, UVALUE='TABDATA') ;;;;;;;;;;;;;;;;;;;; DATA LOADING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; wDataLoadingBase = WIDGET_BASE(wLeftDataBase, /BASE_ALIGN_CENTER, $ XPAD=0, YPAD=4, /FRAME, /COLUMN) wDataFormatLabel = WIDGET_LABEL(wDataLoadingBase,VALUE='Data Format',/ALIGN_CENTER);, /DYNAMIC_RESIZE) DataFormat=10 sensitiveBinary=DataFormat EQ 1 sensitiveHdf5 =DataFormat EQ 2 sensitiveRamses=DataFormat EQ 3 sensitiveASH =DataFormat EQ 4 sensitiveJupi =DataFormat EQ 5 sensitiveGraf =DataFormat EQ 6 sensitiveJaques =DataFormat EQ 10 wPickFormatList = WIDGET_DROPLIST(wDataLoadingBase,TAB_MODE=1,VALUE=[ $ 'hdf5', 'Heracles bin','RAMSES amr','ASH bob','JUPITER','GRAFIC','enzo/jaques'], UVALUE='PICKFORMATLIST',/ALIGN_CENTER) ; Create a list base for the loading options : 0, Heracles binary ; 1, RAMSES AMR binary ; 2, HDF ; 3, ASH BoB ; 4, Jupiter ; 5, grafic ; 6, enzo via jaques wPickLoadBase = LONARR(7) wTempBase = WIDGET_BASE(wDataLoadingBase,/BASE_ALIGN_CENTER) ; Put the loading bases into the temporary (temp) ; base. This way, the selection bases overlaps each ; another. When the user select from wSelectButton, ; only one selection base is mapped. ; wPickLoadBase[0] = WIDGET_BASE(wTempBase,/COLUMN,MAP=sensitiveBinary,/BASE_ALIGN_CENTER,/ALIGN_CENTER) wPickLoadBase[1] = WIDGET_BASE(wTempBase,/COLUMN,MAP=sensitiveRamses,/BASE_ALIGN_CENTER,/ALIGN_CENTER) wPickLoadBase[2] = WIDGET_BASE(wTempBase,/COLUMN,MAP=sensitiveHdf5,/BASE_ALIGN_CENTER,XPAD=9) wPickLoadBase[3] = WIDGET_BASE(wTempBase,/COLUMN,MAP=sensitiveASH,/BASE_ALIGN_CENTER,/ALIGN_CENTER) wPickLoadBase[4] = WIDGET_BASE(wTempBase,/COLUMN,MAP=sensitiveJupi,/BASE_ALIGN_CENTER,/ALIGN_CENTER) wPickLoadBase[5] = WIDGET_BASE(wTempBase,/COLUMN,MAP=sensitiveGraf,/BASE_ALIGN_CENTER,/ALIGN_CENTER) wPickLoadBase[6] = WIDGET_BASE(wTempBase,/COLUMN,MAP=sensitiveJaques,/BASE_ALIGN_CENTER,/ALIGN_CENTER) ;;;;;;;;;;;;;;;;;;;; HERACLES/HDF LOADING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; wHeaderFileBase = WIDGET_BASE(wPickLoadBase[2], /BASE_ALIGN_CENTER, /ALIGN_CENTER, /COLUMN ,$ SENSITIVE=sensitiveHdf5) wDataLoadingLabel = WIDGET_LABEL(wHeaderFileBase,VALUE='Header file') FileId='./mis3Dhdf.h5' ;'./mis3Dhdf.h5' ;'./mhd-test.h5' ;'./ombreXX2.h5' wFileIdField = CW_FIELD(wHeaderFileBase, /STRING, TITLE='', $ UVALUE='FILEID', VALUE=FileId, XSIZE=14, /ALL_EVENTS) wHeaderFileSubBase1 = WIDGET_BASE(wHeaderFileBase, /ROW) wBrowseHeaderButton = WIDGET_BUTTON(wHeaderFileSubBase1, $ VALUE='Browse', UVALUE='BROWSEHEADER') wReadHeaderButton = WIDGET_BUTTON(wHeaderFileSubBase1, $ VALUE=' Read ', UVALUE='READHEADER') nmaxHDFvar=30 nmaxMultiGrid=10 wFillArraysHDF = LONARR(1) wPickVarObjButton_hdfvar = LONARR(nmaxHDFvar) oData_HDFvar = OBJARR(nmaxHDFvar,nmaxMultiGrid) ProcessorId= 256 ; 27 ;256 SimuStepOutput= 3 ; 25 ;5 SimuStepReprise=0 wProcessorIdBase = WIDGET_BASE(wPickLoadBase[0], /ROW) wProcessorIdLabel=WIDGET_LABEL(wProcessorIdBase,VALUE='Processor') wProcessorIdField = CW_FIELD(wProcessorIdBase, /INTEGER, TITLE='', $ UVALUE='PROCESSORID', VALUE=ProcessorId, XSIZE=3, /ALL_EVENTS) wStepFieldBase = WIDGET_BASE(wPickLoadBase[0], /ROW) wStepFieldLabel= WIDGET_LABEL(wStepFieldBase, VALUE='Output # ') wStepField = CW_FIELD(wStepFieldBase, /INTEGER, TITLE='', $ UVALUE='STEP', VALUE=SimuStepOutput, XSIZE=3, /ALL_EVENTS) wProcessorIdBaseHDF = WIDGET_BASE(wPickLoadBase[2], /ROW) wProcessorIdLabelHDF=WIDGET_LABEL(wProcessorIdBaseHDF,VALUE='Processor') wProcessorIdFieldHDF = CW_FIELD(wProcessorIdBaseHDF, /INTEGER, TITLE='', $ UVALUE='PROCESSORID', VALUE=ProcessorId, XSIZE=3, /ALL_EVENTS) wStepFieldBaseHDF = WIDGET_BASE(wPickLoadBase[2], /ROW) wStepFieldLabelHDF= WIDGET_LABEL(wStepFieldBaseHDF, VALUE='Output # ') wStepFieldHDF = CW_FIELD(wStepFieldBaseHDF, /INTEGER, TITLE='', $ UVALUE='STEP', VALUE=SimuStepOutput, XSIZE=3, /ALL_EVENTS) OutputReprise=0 wOutputReprise = WIDGET_DROPLIST(wPickLoadBase[2], $ UVALUE='OUTREPLIST', Value=['output', 'reprise']) wOptionsArrayLabel = WIDGET_LABEL(wPickLoadBase[0], VALUE='Options') OptionsArray=make_array([3]) OptionsArray[0]=0 OptionsArray[1]=0 OptionsArray[2]=0 wOptionsArray = CW_BGROUP(wPickLoadBase[0], ['ray ','dif ','.Bin '], $ UVALUE='OPTIONSARRAY', /NONEXCLUSIVE, SET_VALUE=OptionsArray) wFillArraysLabel = WIDGET_LABEL(wPickLoadBase[0], $ VALUE='Fill Arrays') FillArrays=make_array([6]) FillArrays[0:5]=0 FillArrays[0]=1 ;FillArrays[3]=1 ;FillArrays[2]=1 wFillArrays = CW_BGROUP(wPickLoadBase[0], [$ 'density', $ 'radiative energy', $ 'pressure', $ 'velocity', $ 'radiative flux', $ 'internal energy' $ ], UVALUE='FILLARRAYS', /NONEXCLUSIVE, SET_VALUE=FillArrays) ;;;;;;;;;;;;;;;;;;;; RAMSES AMR LOADING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Create a list base for the Ramses Configuration bases ; 0 -> Output # ; 1 -> Level Min ; 2 -> Level Max ; 3 -> AMR Format wRamsesConfig = LONARR(4) wRamsesConfig[3]= WIDGET_DROPLIST(wPickLoadBase[1],VALUE=[ $ 'format 2000','format 2008'], UVALUE='RAMSESAMRFORMAT',/ALIGN_CENTER) wRamsesOutputBase = WIDGET_BASE(wPickLoadBase[1], /ROW) wRamsesOutputLabel= WIDGET_LABEL(wRamsesOutputBase, VALUE='Output #') wRamsesConfig[0] = CW_FIELD(wRamsesOutputBase, /INTEGER, TITLE='', $ UVALUE='STEP', XSIZE=5, /ALL_EVENTS) Endian=0 ;wEndian = WIDGET_DROPLIST(wPickLoadBase[1], $ ; UVALUE='ENDIAN', Value=['Little Endian', 'Big Endian']) AmrLevels=fltarr([4]) AmrLevels[0]=7 AmrLevels[1]=7 AmrLevels[2]=7 ; used for increment AmrLevels[3]=7 ; used for increment level_table=['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20'] wRamsesLevelMinBase = WIDGET_BASE(wPickLoadBase[1], /ROW) wRamsesLevelMinLabel= WIDGET_LABEL(wRamsesLevelMinBase, VALUE='Level min') wRamsesConfig[1] = WIDGET_COMBOBOX(wRamsesLevelMinBase, $ VALUE=level_table, UVALUE='AMRLEVELMIN', /EDITABLE,XSIZE=60) WIDGET_CONTROL,wRamsesConfig[1],SET_COMBOBOX_SELECT=6 wRamsesLevelMaxBase = WIDGET_BASE(wPickLoadBase[1], /ROW) wRamsesLevelMaxLabel= WIDGET_LABEL(wRamsesLevelMaxBase, VALUE='Level max') wRamsesConfig[2] = WIDGET_COMBOBOX(wRamsesLevelMaxBase, $ VALUE=level_table, UVALUE='AMRLEVELMAX', /EDITABLE,XSIZE=60) WIDGET_CONTROL,wRamsesConfig[2],SET_COMBOBOX_SELECT=6 RamsesFillArrays=make_array([10]) RamsesFillArrays[0:3]=0 RamsesFillArrays[0]=1 RamsesFillArrays[9]=1 ;RamsesFillArrays[4]=1 wRamsesFillArrays = CW_BGROUP(wPickLoadBase[1], [$ 'density', $ 'velocity', $ 'velocity x', $ 'velocity y', $ 'velocity z', $ 'pressure', $ 'metals', $ 'Dark Matter', $ 'DM dens+vel', $ 'AMR Mesh' $ ], UVALUE='FILLARRAYS', /NONEXCLUSIVE, SET_VALUE=RamsesFillArrays) wRamsesBoundariesManagement = WIDGET_BUTTON(wPickLoadBase[1], VALUE=' Change boundaries ',$ UVALUE='BOUNDARIES') RamsesCpuBox=make_array([1]) & RamsesCpuBox=0 wRamsesCpuBox = CW_BGROUP(wPickLoadBase[1], [' cpubox '], $ UVALUE='CPUBOX', /NONEXCLUSIVE, SET_VALUE=RamsesCpuBox) ;;;;;;;;;;;;;;;;;;;; ASH BoB LOADING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Create a list base for the ASH Configuration bases ; 0 -> size of arrays ; 1 -> load scalar ; 2 -> load vector wAshConfig = LONARR(3) wAshBase = WIDGET_BASE(wPickLoadBase[3], /COLUMN, YPAD=15,XPAD=10,SPACE=10) ashsize_table=['200','300','400','500','600','700','1000'] wAshConfig[0] = WIDGET_COMBOBOX(wAshBase, $ VALUE=ashsize_table, UVALUE='ASHSIZE', /EDITABLE ) wAshLabel = WIDGET_LABEL(wAshBase, VALUE='Define BoB files:') wAshConfig[1] = WIDGET_BUTTON(wAshBase, $ VALUE=' scalar field ', UVALUE='ASHSCALAR', SENSITIVE=1 ) wAshConfig[2] = WIDGET_BUTTON(wAshBase, $ VALUE=' vector field ', UVALUE='ASHVECTOR', SENSITIVE=1 ) wAshFieldBase = WIDGET_BASE(wAshBase, /COLUMN, YPAD=15,XPAD=10,SPACE=1);,/FRAME) wAshFieldLabels= LONARR(10) for i=0,9 do begin ;wAshFieldLabels(i)= WIDGET_LABEL(wAshFieldBase,VALUE='label'+strcompress(i, /remove_all)) endfor ;;;;;;;;;;;;;;;;;;;; JUPITER LOADING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Create a list base for the Jupiter Configuration bases ; 0 -> Output # wJupiterConfig = LONARR(9) wJupiterOutputBase = WIDGET_BASE(wPickLoadBase[4], /ROW) wJupiterOutputLabel= WIDGET_LABEL(wJupiterOutputBase, VALUE='Output #') wJupiterConfig[0] = CW_FIELD(wJupiterOutputBase, /INTEGER, TITLE='', $ UVALUE='STEP', XSIZE=5, /ALL_EVENTS) wJupiterConfig[1]=WIDGET_BUTTON(wPickLoadBase[4], $ VALUE='READ DESCRIPTOR',UVALUE='READJUPITERDESCRIPTOR') wLoadButton = WIDGET_BUTTON(wDataLoadingBase, $ VALUE=' LOAD DATA ', UVALUE='LOADDATA', SENSITIVE=0 ) wLoadText=LONARR(4) wLoadText[0] = widget_label(wDataLoadingBase, VALUE=' no data loaded ') wLoadText[1] = widget_label(wDataLoadingBase, VALUE=' ') wLoadText[2] = widget_label(wDataLoadingBase, VALUE=' ') wLoadText[3] = widget_label(wDataLoadingBase, VALUE=' ') ;;;;;;;;;;;;;;;;;;;; GRAFIC LOADING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Create a list base for the Grafic Configuration bases ; 0 -> filename ; 1 -> browse filename wGraficConfig = LONARR(9) wGraficBase = WIDGET_BASE(wPickLoadBase[5]) wGraficSubBase = WIDGET_BASE(wGraficBase, /COLUMN, /BASE_ALIGN_CENTER, /ALIGN_CENTER) wGraficLabel = WIDGET_LABEL(wGraficSubBase, VALUE=' Select file:') GraficFileName='./ic_d' wGraficConfig[0] = CW_FIELD(wGraficSubBase,/STRING,XSIZE=10,$ UVALUE='GRAFICFILENAME',TITLE=' ',VALUE=GraficFileName,/ALL_EVENTS) wGraficConfig[1] = WIDGET_BUTTON(wGraficSubBase, VALUE=' Browse ',$ UVALUE='GRAFICFILEBROWSE') ;;;;;;;;;;;;;;;;;;;; ENZO/JAQUES LOADING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Create a list base for the Jaques Configuration bases ; 0 -> filename ; 1 -> browse filename wJaquesConfig = LONARR(9) wJaquesBase = WIDGET_BASE(wPickLoadBase[6]) wJaquesSubBase = WIDGET_BASE(wJaquesBase, /COLUMN, /BASE_ALIGN_CENTER, /ALIGN_CENTER) JaquesFillArrays = 1 wJaquesFillArrays = CW_BGROUP(wJaquesSubBase, [$ 'particles', $ 'Grid/Vector data'], $ UVALUE='JAQUES-OPTIONS', /EXCLUSIVE, SET_VALUE=JaquesFillArrays) cube_dim = 128 junk = CW_FIELD(wJaquesSubBase,VALUE=cube_dim, $ TITLE='Cube dimemsions:', $ COLUMN=1, $ INTEGER=1, $ RETURN_EVENTS=1, $ UVALUE='JaquesCUBE_DIM') ; Create a left column base for selecting the view. ; wLeftVueBase = WIDGET_BASE(wTabBase, TITLE=' VIEW ', /BASE_ALIGN_CENTER, $ XPAD=0, YPAD=5, /FRAME, /COLUMN, UVALUE='TABVUE',SENSITIVE=1) ; The Quality Base ; wQualityBase = WIDGET_BASE(wLeftVuebase, /BASE_ALIGN_CENTER, $ XPAD=7, YPAD=7, /FRAME, /COLUMN) wQualityLabel = WIDGET_LABEL(wQualityBase, VALUE='Rendering Quality') wQuality = WIDGET_DROPLIST(wQualityBase, $ VALUE=['DYNAMIC','high','medium','low'], UVALUE='QUALITY') ; The Log/Lin Volume Base ; wLogLinBase = WIDGET_BASE(wLeftVuebase, /BASE_ALIGN_CENTER, $ XPAD=18, YPAD=6, /FRAME, /COLUMN) wVarNameLabel = WIDGET_LABEL(wLogLinBase, VALUE=' Data ') wScalarLinLog = WIDGET_DROPLIST(wLogLinBase, $ VALUE=['linear','log10'], UVALUE='SCALARLINLOG') ;;; Create a base for each viewing options ; ; 0 surface ; 1 project volume (obsolete) ; 2 voxel project (obsolete) ; 3 isosurface ; 4 vector field ; 5 particle cloud ; 6 volume object ; 7 domains ; 8 axis system ; 9 boundaries ; 10 image 3D ; 11 amr ; nbase=11 wSelectionBase = LONARR(nbase) wTempBase = WIDGET_BASE(wLeftVuebase,XPAD=1) ; Put the selection bases into the temporary (temp) ; base. This way, the selection bases overlaps each ; another. When the user select from wSelectButton, ; only one selection base is mapped. ; for i=0, nbase-1 do begin wSelectionbase[i] = WIDGET_BASE(wTempBase, $ UVALUE=0L, /COLUMN, MAP=0, YPAD=15, /BASE_ALIGN_LEFT, /ALIGN_LEFT) endfor ; The Surface Plane Base ; wSurfacePlaneBase = WIDGET_BASE(wSelectionbase[0], /BASE_ALIGN_CENTER, /ALIGN_CENTER, $ XPAD=12, YPAD=3, /FRAME, /COLUMN) wSurfacePlaneLabel1 = WIDGET_LABEL(wSurfacePlaneBase, $ VALUE='Surface plane') wSelectSurfacePlane = CW_BGROUP(wSurfacePlaneBase, ['xy','xz','yz'], $ UVALUE='SELECTSURFACEPLANE', /NO_RELEASE, /EXCLUSIVE, SET_VALUE=0) wSurfacePlaneLabel2 = WIDGET_LABEL(wSurfacePlaneBase, VALUE='plane position') surfacePosition=0 wSurfacePlaneSlider = WIDGET_SLIDER(wSurfacePlaneBase , $ UVALUE='SURFACEPOS_SLIDER', $ VALUE=surfacePosition, MINIMUM=0., MAXIMUM=149.,/DRAG) wSurfaceBase = WIDGET_BASE(wSelectionbase[0], /BASE_ALIGN_CENTER, $ XPAD=7, YPAD=15, /FRAME, /COLUMN) wStatusLabel = WIDGET_LABEL(wSurfaceBase, VALUE='Surface Style') wStyleDroplist = WIDGET_DROPLIST(wSurfaceBase, $ VALUE=['Shaded', 'Wire', 'Lego Solid'], $ UVALUE='STYLELIST') wColorLabel = WIDGET_LABEL(wSurfaceBase, $ VALUE='Surface color') wColorList = WIDGET_LIST(wSurfaceBase, VALUE=['Texture Map', $ 'White', 'Yellow', 'Red'], YSIZE=3, UVALUE='COLORLIST') wImageOptions = WIDGET_BASE(wSelectionbase[0], /BASE_ALIGN_CENTER, $ XPAD=10, YPAD=3, /FRAME, /COLUMN) alphaImage=100. wImageAlpha = WIDGET_SLIDER(wImageOptions,UVALUE='IMAGE-ALPHA',$ TITLE='alpha', VALUE=alphaImage,/DRAG, MINIMUM=0., MAXIMUM=100.) SurfaceLog=0 ; The Project Volume Base ; ;w3DBase = WIDGET_BASE(wSelectionbase[1], /BASE_ALIGN_CENTER, $ ; XPAD=5, YPAD=3, /FRAME, /COLUMN) ;w3DStatusLabel1 = WIDGET_LABEL(w3DBase, VALUE='Project Volume') ;ProjectVolIntensity=0 ;wProjectVolIntensity = CW_BGROUP(w3DBase, ['max intensity','avr intensity'], $ ; UVALUE='PROJECTVOLINTENSITY', /EXCLUSIVE, SET_VALUE=ProjectVolIntensity) ;w3DStatusLabel3 = WIDGET_LABEL(w3DBase, $ ; VALUE='Resolution') ;ProjectVolResolution=50 ;wProjectVolResolutionSlider = WIDGET_SLIDER( w3DBase, $ ; UVALUE='PROJECTVOLRESOLUTION_SLIDER', $ ; VALUE=ProjectVolResolution, MINIMUM=1., MAXIMUM=200.) ;w3DStatusLabel4 = WIDGET_LABEL(w3DBase, VALUE='Nb of samples') ;ProjectVolSamples=100 ;wProjectVolSamplesSlider = WIDGET_SLIDER( w3DBase, $ ; UVALUE='PROJECTVOLSAMPLES_SLIDER', $ ; VALUE=ProjectVolSamples, MINIMUM=1., MAXIMUM=200.) ;w3DStatusLabel5 = WIDGET_LABEL(w3DBase, VALUE='Depth Queuing') ;ProjectVolDepthQueuing=100. ;wProjectVolDepthQueuingSlider = WIDGET_SLIDER( w3DBase, $ ; UVALUE='PROJECTVOLDEPTHQUEUING_SLIDER', $ ; VALUE=ProjectVolDepthQueuing, MINIMUM=0., MAXIMUM=100.) ;w3DStatusLabel6 = WIDGET_LABEL(w3DBase, VALUE='Opacity') ;ProjectVolOpacity=0 ;wProjectVolOpacitySlider = WIDGET_SLIDER( w3DBase, $ ; UVALUE='PROJECTVOLOPACITY_SLIDER', $ ; VALUE=ProjectVolOpacity, MINIMUM=0., MAXIMUM=100.) ScalarLinLog=1 WIDGET_CONTROL, wScalarLinLog, SET_DROPLIST_SELECT = ScalarLinLog ; The Voxel Project Base ; ;wVoxelBase = WIDGET_BASE(wSelectionbase[2], /BASE_ALIGN_CENTER, $ ; XPAD=5, YPAD=5, /FRAME, /COLUMN) ;wVoxelLabel1 = WIDGET_LABEL(wVoxelBase, VALUE='Voxel Project') ;VoxelIntensity=0 ;wVoxelIntensity = CW_BGROUP(wVoxelBase, ['max intensity','avr intensity'], $ ; UVALUE='VOXELINTENSITY', /EXCLUSIVE, SET_VALUE=VoxelIntensity) ;wVoxelLabel2 = WIDGET_LABEL(wVoxelBase, VALUE='Step size') ;VoxelStep=1 ;wVoxelStepSlider = WIDGET_SLIDER( wVoxelBase, $ ; UVALUE='VOXELSTEP_SLIDER', $ ; VALUE=VoxelStep, MINIMUM=1., MAXIMUM=100.) ;wVoxelLabel3 = WIDGET_LABEL(wVoxelBase, VALUE='Sampling size*10') ;VoxelSampling=10. ;wVoxelSamplingSlider = WIDGET_SLIDER( wVoxelBase, $ ; UVALUE='VOXELSAMPLING_SLIDER', $ ; VALUE=VoxelSampling, MINIMUM=1., MAXIMUM=100.) ; The Isosurface Selection Base ; wIsoSurfaceBaseStyle = WIDGET_BASE(wSelectionbase[3], /BASE_ALIGN_CENTER, $ XPAD=7, YPAD=15, /FRAME, /COLUMN) wIsosurfaceOptions=LONARR(4) wStatusLabelIso = WIDGET_LABEL(wIsoSurfaceBaseStyle, VALUE='Isosurface Style') wIsosurfaceOptions[0] = WIDGET_DROPLIST(wIsoSurfaceBaseStyle, $ VALUE=['Shaded', 'Points', 'Lines'], $ UVALUE='STYLELISTISO') wColorLabelIso = WIDGET_LABEL(wIsoSurfaceBaseStyle, VALUE='Isosurface color') wIsosurfaceOptions[1] = WIDGET_LIST(wIsoSurfaceBaseStyle, VALUE=[ $ 'Blue','White','Yellow','Red','Black','Green'], YSIZE=6, UVALUE='COLORLISTISO') wIsoSurfaceBasePolygon = WIDGET_BASE(wSelectionbase[3], /BASE_ALIGN_CENTER, $ XPAD=1, YPAD=1, /FRAME, /COLUMN) wLabel = WIDGET_LABEL(wIsoSurfaceBasePolygon, VALUE='Polygon') wLabel = WIDGET_LABEL(wIsoSurfaceBasePolygon, VALUE='simplification') wIsosurfaceOptions[3] = WIDGET_DROPLIST(wIsoSurfaceBasePolygon, VALUE=[ $ 'data rebin','mesh decim.'], UVALUE='SIMPLIFICATIONISO') nmaxpolygons_table=['400000','50000','100000','200000','1000000','2500000','5000000'] wnmaxpolygonsLabelIso = WIDGET_LABEL(wIsoSurfaceBasePolygon, VALUE='max # vertices') wIsosurfaceOptions[2] = WIDGET_COMBOBOX(wIsoSurfaceBasePolygon,UVALUE='MAXPOLYISO',$ VALUE=nmaxpolygons_table,/EDITABLE) ; The Isosurface Creation Base ; wIsoSurfaceBaseCreation = WIDGET_BASE(wSelectionbase[3], /BASE_ALIGN_CENTER, $ XPAD=7, YPAD=15, /FRAME, /COLUMN) wNewIsoButton = WIDGET_BUTTON(wIsoSurfaceBaseCreation, $ VALUE=' new isosurface ', UVALUE='NEWISO') wSelectIso = WIDGET_DROPLIST(wIsoSurfaceBaseCreation, $ VALUE=['iso 0'], UVALUE='SELECTISO', TITLE='') VectorFieldName=' UPDATE ' wVectorFieldNameBase=WIDGET_BASE(wSelectionbase[4],XOFFSET=0,YOFFSET=3,/FRAME, /BASE_ALIGN_CENTER) wVectorFieldName=WIDGET_LABEL(wVectorFieldNameBase,VALUE=VectorFieldName) ; The 3D Vector Field vs 2D slice Base ; w3DVecVSsliceBase = WIDGET_BASE(wSelectionbase[4], /BASE_ALIGN_CENTER, $ XPAD=0, YPAD=5, /FRAME, /COLUMN) SliceVecVs3DVec=0 wSliceVecVs3DVec = WIDGET_DROPLIST(w3DVecVSsliceBase, $ VALUE=['3D-rect grid', '2D slice','seed-pick'], $ UVALUE='VIEW3DVEC') nbase=2 wVectorFieldBase = LONARR(nbase) wTempBase = WIDGET_BASE(wSelectionbase[4],XPAD=1) for i=0, nbase-1 do begin wVectorFieldBase[i] = WIDGET_BASE(wTempBase, $ UVALUE=0L, /COLUMN, MAP=0, YPAD=0, XPAD=0, /BASE_ALIGN_LEFT, /ALIGN_LEFT) endfor wVectorsOptionsBase = WIDGET_BASE(wVectorFieldBase[0], /BASE_ALIGN_CENTER, $ XPAD=0, YPAD=1, /FRAME, /COLUMN) wVectorsOptionsLabel = WIDGET_LABEL(wVectorsOptionsBase, VALUE='vectors') wVectorsOptions=LONARR(2) alphaVectors=1. wVectorsOptions[0] = CW_FIELD(wVectorsOptionsBase,UVALUE='VECTORS-ALPHA',$ /FLOAT,XSIZE=8,TITLE='alpha', VALUE=alphaVectors,/ALL_EVENTS) wStreamlinesOptionsBase = WIDGET_BASE(wVectorFieldBase[1], /BASE_ALIGN_CENTER, $ XPAD=0, YPAD=1, /FRAME, /COLUMN) wStreamlinesOptionsLabel1 = WIDGET_LABEL(wStreamlinesOptionsBase, VALUE='streamlines') wStreamlinesOptions=LONARR(6) alphaStreamlines=1. wStreamlinesOptions[0] = WIDGET_SLIDER(wStreamlinesOptionsBase,UVALUE='STREAMLINES-ALPHA',$ TITLE='alpha', VALUE=alphaStreamlines*100., MINIMUM=0., MAXIMUM=100., /DRAG) MaxIterationsStreamlines=['1000','100','200','500','2000','5000','10000'] wStreamlinesOptionsLabel2 = WIDGET_LABEL(wStreamlinesOptionsBase, VALUE='max iteration') wStreamlinesOptions[1] = WIDGET_COMBOBOX(wStreamlinesOptionsBase,UVALUE='STREAMLINES-UPDATE-MAXITER',$ VALUE=MaxIterationsStreamlines,/EDITABLE) MaxStepSizeStreamlines=1. wStreamlinesOptions[2] = CW_FIELD(wStreamlinesOptionsBase,UVALUE='STREAMLINES-UPDATE',$ /FLOAT,XSIZE=4,TITLE='max step', VALUE=MaxStepSizeStreamlines,/ALL_EVENTS) wStreamlinesOptions[3] = WIDGET_DROPLIST(wStreamlinesOptionsBase,UVALUE='STREAMLINES-UPDATE', $ VALUE=['2nd Runge-K', '4th Runge-K']) wStreamlinesOptions[4] = CW_BGROUP(wStreamlinesOptionsBase,UVALUE='STREAMLINES-UNIFORM', $ ['Uniform'], /NONEXCLUSIVE, SET_VALUE=0) wStreamlinesOptions[5] = WIDGET_BUTTON(wStreamlinesOptionsBase,UVALUE='STREAMLINES-HELP', $ VALUE=' Documentation ') WIDGET_CONTROL,wVectorFieldBase[0], MAP=1 VectorFieldScale=1.e18 wVectorFieldScaleBase=WIDGET_BASE(wSelectionbase[4],XOFFSET=0,/COLUMN, /ALIGN_CENTER) wVectorFieldScaleLabel = WIDGET_LABEL(wVectorFieldScaleBase, VALUE='data scaling') wVectorFieldScale = CW_FIELD(wVectorFieldScaleBase, UVALUE='VECTORFIELDSCALE',TITLE='',$ /FLOAT,XSIZE=12,VALUE=VectorFieldScale,/ALL_EVENTS) wVectorFieldUpdate = WIDGET_BUTTON(wSelectionbase[4], XOFFSET=10,YOFFSET=0, $ VALUE=' UPDATE ', UVALUE='UPDATETHEVIEW') ; The Particle Cloud Selection option Base ; wParticleCloudBaseOptions = WIDGET_BASE(wSelectionbase[5], /BASE_ALIGN_CENTER, $ XPAD=6, YPAD=5, /FRAME, /COLUMN) wParticlesOptions=LONARR(6) alphaParticles=100. wParticlesOptions[0] = WIDGET_SLIDER(wParticleCloudBaseOptions,UVALUE='PARTICLES-ALPHA',$ TITLE='alpha', VALUE=alphaParticles,MINIMUM=0., MAXIMUM=100.) ParticlesSampling_table=['100','50','20','10','5','4','3','2','1'] ParticlesSampling=ParticlesSampling_table[0] wLabel = WIDGET_LABEL(wParticleCloudBaseOptions, VALUE='part. sampling') wParticlesOptions[1] = WIDGET_COMBOBOX(wParticleCloudBaseOptions,UVALUE='PARTICLES-SAMPLING',$ VALUE=ParticlesSampling_table,/EDITABLE) ParticlesSize=0.0015 wParticlesOptions[2] = CW_FIELD(wParticleCloudBaseOptions, UVALUE='PARTICLES-SIZE',$ /FLOAT,XSIZE=9,TITLE='size', VALUE=ParticlesSize,/RETURN_EVENTS) wParticlesOptions[3] = WIDGET_DROPLIST(wParticleCloudBaseOptions, $ VALUE=['red', 'blue', 'green', 'white','black'], $ UVALUE='PARTICLES-COLOR', TITLE='color') wParticlesOptions[4] = WIDGET_DROPLIST(wParticleCloudBaseOptions, $ VALUE=['dot', 'orb'], $ UVALUE='PARTICLES-MARKER', TITLE='marker ') wLabel = WIDGET_LABEL(wParticleCloudBaseOptions, VALUE='Depth testing : ') wParticlesOptions[5] = WIDGET_DROPLIST(wParticleCloudBaseOptions, $ VALUE=['disabled', 'enabled'], $ UVALUE='PARTICLES-DEPTH-TESTING', TITLE='') ; The Volume object Selection option Base ; wVolumeObjectBaseOptions = WIDGET_BASE(wSelectionbase[6], /BASE_ALIGN_CENTER, $ XPAD=0, YPAD=4, /FRAME, /COLUMN,SPACE=1) wVolumeOptions=LONARR(20) wVolumeOptions[2] = WIDGET_DROPLIST(wVolumeObjectBaseOptions, $ VALUE=['alpha-blend','Max Int. Pr.','alpha sum','average'], $ UVALUE='VOLUME-COMPOSITE', TITLE='') WIDGET_CONTROL,wVolumeOptions[2],SET_DROPLIST_SELECT=1 wVolumeOptions[3] = WIDGET_DROPLIST(wVolumeObjectBaseOptions, $ VALUE=['on','off'], $ UVALUE='VOLUME-ZBUFFER', TITLE='Zbuffer') zbrightVolume=0. wVolumeOptions[4] = CW_FIELD(wVolumeObjectBaseOptions,UVALUE='VOLUME-ZDEPTH_CUE',$ /FLOAT,XSIZE=8,TITLE='zbright', VALUE=zbrightVolume,/RETURN_EVENTS) zdimVolume=0. wVolumeOptions[5] = CW_FIELD(wVolumeObjectBaseOptions,UVALUE='VOLUME-ZDEPTH_CUE',$ /FLOAT,XSIZE=8,TITLE='zdim ', VALUE=zdimVolume,/RETURN_EVENTS) wVolumeOptions[6] = WIDGET_DROPLIST(wVolumeObjectBaseOptions, $ VALUE=['disabled','EDM ','multiCPU','combined'], $ UVALUE='VOLUME-HINTS', TITLE='acc') WIDGET_CONTROL,wVolumeOptions[6],SET_DROPLIST_SELECT=2 wVolumeOptions[7] = WIDGET_DROPLIST(wVolumeObjectBaseOptions, $ VALUE=['on','off'], $ UVALUE='VOLUME-OPSKIP', TITLE='0-skip') renderstep_table=['1','2','3','4','5','6','7','8','9','10'] wVolumeLabel1 = WIDGET_LABEL(wVolumeObjectBaseOptions, VALUE='render step') wVolumeOptions[8] = WIDGET_COMBOBOX(wVolumeObjectBaseOptions,UVALUE='VOLUME-RENDER_STEP',$ VALUE=renderstep_table,/EDITABLE) wVolumeOptions[9] = WIDGET_BUTTON(wVolumeObjectBaseOptions, $ VALUE=' color/opacity ', UVALUE='VOLUME-COLOR-OPACITY') wVolumeOptions[10] = WIDGET_DROPLIST(wVolumeObjectBaseOptions, $ VALUE=['nearest neig','Trilin intrp'], $ UVALUE='VOLUME-INTERPOLATE', TITLE='') wVolumeOptions[1] = WIDGET_DROPLIST(wVolumeObjectBaseOptions, $ VALUE=['off', 'on'], $ UVALUE='VOLUME-LIGHTING', TITLE='lighting') wVolumeOptions[11] = WIDGET_DROPLIST(wVolumeObjectBaseOptions, $ VALUE=['one-sided', 'two-sided'], $ UVALUE='VOLUME-TWO-SIDED', TITLE='') alphaVolume=1. wVolumeOptions[0] = WIDGET_SLIDER(wVolumeObjectBaseOptions, $ UVALUE='VOLUME-ALPHA', Title='alpha', /DRAG,$ VALUE=alphaVolume*100., MINIMUM=0., MAXIMUM=100.,SENSITIVE=1) wVolumeOptions[12] = WIDGET_BUTTON(wVolumeObjectBaseOptions,UVALUE='VOLUME-HELP', $ VALUE='Documentation') ; The Domain Decomposition Selection option Base ; wDomainsBaseOptions = WIDGET_BASE(wSelectionbase[7], /BASE_ALIGN_CENTER, $ XPAD=3, YPAD=5, /FRAME, /COLUMN) wDomainsOptions=LONARR(4) wDomainsLabel0 = WIDGET_LABEL(wDomainsBaseOptions, VALUE='Coordinate System') wDomainsOptions[0] = WIDGET_DROPLIST(wDomainsBaseOptions, $ VALUE=['cartesian', 'cylindrical','spherical'], $ UVALUE='COORDINATE-SYSTEM', TITLE='') wDomainsLabel1 = WIDGET_LABEL(wDomainsBaseOptions, VALUE='Meshes') wDomainsOptions[1] = WIDGET_DROPLIST(wDomainsBaseOptions, $ VALUE=['hide', 'display'], $ UVALUE='DISPLAY-MESHES', TITLE='') alphaDomains=1. wDomainsOptions[2] = WIDGET_SLIDER(wDomainsBaseOptions,UVALUE='DOMAINS-ALPHA',$ TITLE='alpha', VALUE=alphaDomains*100.,/DRAG, MINIMUM=0., MAXIMUM=100.) wDomainsLabel2 = WIDGET_LABEL(wDomainsBaseOptions, VALUE='thickness ') thickness_table=['1','2','3','4','5','6','7','8','9','10'] wDomainsOptions[3] = WIDGET_COMBOBOX(wDomainsBaseOptions, $ VALUE=thickness_table, UVALUE='DOMAINSTHICKNESS',/EDITABLE) ; The Axis System Selection option Base ; wAxisBaseOptions = WIDGET_BASE(wSelectionbase[8], /BASE_ALIGN_CENTER, $ XPAD=3, YPAD=5, /FRAME, /COLUMN) wAxisOptions=LONARR(5) wAxisLabel1 = WIDGET_LABEL(wAxisBaseOptions, VALUE='Axis color') wAxisOptions[0] = WIDGET_LIST(wAxisBaseOptions, VALUE=[ $ 'Blue', 'Black', 'Red', 'White'], YSIZE=4, UVALUE='AXISCOLORLIST') wAxisLabel2 = WIDGET_LABEL(wAxisBaseOptions, VALUE='Axis geometry') wAxisOptions[1] = CW_BGROUP(wAxisBaseOptions, ['full span ', 'normalized'], $ UVALUE='AXIS-SPAN', /NO_RELEASE, /EXCLUSIVE, SET_VALUE=0) wAxisOptions[2] = CW_BGROUP(wAxisBaseOptions, ['centered ', 'zero-ed '], $ UVALUE='AXIS-ZERO', /NO_RELEASE, /EXCLUSIVE, SET_VALUE=0) wAxisLabel3 = WIDGET_LABEL(wAxisBaseOptions, VALUE='Axis units') wAxisOptions[3] = CW_BGROUP(wAxisBaseOptions, ['meshes ', 'physical '], $ UVALUE='AXIS-UNITS', /NO_RELEASE, /EXCLUSIVE, SET_VALUE=0) wAxisOptions[4] = WIDGET_DROPLIST(wAxisBaseOptions, $ VALUE=['text', 'no text'], $ UVALUE='AXIS-TEXT', TITLE='') ; The AMR System Selection option Base ; ;;; initialization of widget to configure the amr drawn (Y. Fidaali) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; nlevelmax = 23 RamsesAmrLevelsColors=intarr(nlevelmax) RamsesAmrLevelsArrays=intarr(nlevelmax) RamsesAmrLevelsAlpha=intarr(nlevelmax) wAmrConfigurationBase = WIDGET_BASE(TITLE='AMR Configuration',/ROW, XPAD=15, YPAD=10, SPACE=1) RamsesAmrLevelsFlags = intarr(nlevelmax) ;<= 0 : not calculated, 1 : calculated and visible, 2: calculated and hide planesSelected = intarr(6) for i=0, nlevelmax-1 do begin RamsesAmrLevelsColors[i] = 0 RamsesAmrLevelsAlpha[i] = 100 RamsesAmrLevelsArrays[i] = 0 RamsesAmrLevelsFlags[i] = 0 if(i lt 6) then planesSelected[i] = 0 endfor AMRMeshIJKboundaries=fltarr(6) wRamsesAMRConfigBoundariesBase=LONARR(6) subAxisAMRBoundaries=OBJARR(12) wRamsesAMRConfigTranslate = LONARR(3) AMRTranslateBoundaries = intarr(3) AMRDiffMinMaxMemories = fltarr(3) AMRscaleValue = 1. AMRMeshIJKboundaries[0]=0. AMRMeshIJKboundaries[1]=1. AMRMeshIJKboundaries[2]=0. AMRMeshIJKboundaries[3]=1. AMRMeshIJKboundaries[4]=0. AMRMeshIJKboundaries[5]=1. alpha=1. color = chooseColor(2) subAxisAMRBoundaries[0] = Obj_New("IDLgrAxis",0,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[1] = Obj_New("IDLgrAxis",0,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[2] = Obj_New("IDLgrAxis",0,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[3] = Obj_New("IDLgrAxis",0,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[4] = Obj_New("IDLgrAxis",1,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[5] = Obj_New("IDLgrAxis",1,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[6] = Obj_New("IDLgrAxis",1,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[7] = Obj_New("IDLgrAxis",1,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[8] = Obj_New("IDLgrAxis",2,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[9] = Obj_New("IDLgrAxis",2,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[10] = Obj_New("IDLgrAxis",2,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisAMRBoundaries[11] = Obj_New("IDLgrAxis",2,Color=color,/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) AMRTranslateBoundaries[0] = 0 AMRTranslateBoundaries[1] = 0 AMRTranslateBoundaries[2] = 0 AMRDiffMinMaxMemories[0] = 0 AMRDiffMinMaxMemories[1] = 0 AMRDiffMinMaxMemories[2] = 0 colorBoundarie = 2 DefineAmrConfigurationWidget, $ wAmrConfigurationBase, $ RamsesAmrLevelsArrays, $ RamsesAmrLevelsAlpha, $ wRamsesAmrLevelsArrays, $ wRamsesAmrLevelsAlpha, $ RamsesAmrLevelsColors, $ wRamsesXAMRBoundariesBase, $ wRamsesYAMRBoundariesBase, $ wRamsesZAMRBoundariesBase, $ wRamsesAMRConfigBoundariesBase, $ AMRMeshIJKboundaries, $ subAxisAMRBoundaries, $ AMRTranslateBoundaries, $ wRamsesAMRConfigTranslate, $ wRamsesAMRConfigScaleSlider, $ wRamsesAMRConfigScaleValue, $ AMRscaleValue, $ wRamsesPlanesSelected, $ planesSelected, $ nlevelmax, $ colorBoundarie for i=0, 11 do subAxisAMRBoundaries[i]->SetProperty, hide=1 oData_AMRMeshIJKboundaries = OBJ_NEW('IDLitData',AMRMeshIJKboundaries,IDENTIFIER='AMRMeshIJKboundaries') oData_subAxisAMRBoundaries = OBJ_NEW('IDLitData', subAxisAMRBoundaries, IDENTIFIER='subAxisAMRBoundaries') oData_AMRscaleValue = OBJ_NEW('IDLitData', AMRscaleValue, IDENTIFIER='AMRscaleValue') oData_planesSelected = OBJ_NEW('IDLitData', planesSelected, IDENTIFIER='planesSelected') oData_amrTranslateBoundaries = OBJ_NEW('IDLitData', AMRTranslateBoundaries, IDENTIFIER='AMRTranslateBoundaries') oData_AMRDiffMinMaxMemories = OBJ_NEW('IDLitData', AMRDiffMinMaxMemories, IDENTIFIER='AMRDiffMinMaxMemories') oData_RamsesAmrLevelsColors = OBJ_NEW('IDLitData',RamsesAmrLevelsColors,IDENTIFIER='RamsesAmrLevelsColors') oData_RamsesAmrLevelsAlpha = OBJ_NEW('IDLitData',RamsesAmrLevelsAlpha,IDENTIFIER='RamsesAmrLevelsAlpha') oData_RamsesAmrLevelsArrays = OBJ_NEW('IDLitData',RamsesAmrLevelsArrays,IDENTIFIER='RamsesAmrLevelsArrays') oData_RamsesAmrLevelsFlags = OBJ_NEW('IDLitData',RamsesAmrLevelsFlags,IDENTIFIER='RamsesAmrLevelsFlags') oData_wAmrConfigurationBase = OBJ_NEW('IDLitData',wAmrConfigurationBase,IDENTIFIER='wAmrConfigurationBase') oData_wRamsesAmrLevelsAlpha = OBJ_NEW('IDLitData',wRamsesAmrLevelsAlpha,IDENTIFIER='wRamsesAmrLevelsAlpha') oData_wRamsesPlanesSelected = OBJ_NEW('IDLitData',wRamsesPlanesSelected,IDENTIFIER='wRamsesPlanesSelected') oData_wRamsesAmrLevelsArrays = OBJ_NEW('IDLitData',wRamsesAmrLevelsArrays,IDENTIFIER='wRamsesAmrLevelsArrays') oData_colorAMRBoundarieValue = OBJ_NEW('IDLitData',colorBoundarie,IDENTIFIER='colorBoundarie') oData_wRamsesAMRConfigTranslate = OBJ_NEW('IDLitData', wRamsesAMRConfigTranslate, IDENTIFIER='wRamsesAMRConfigTranslate') oData_wRamsesAMRConfigBoundariesBase = OBJ_NEW('IDLitData', wRamsesAMRConfigBoundariesBase, IDENTIFIER='wRamsesAMRConfigBoundariesBase') oData_wRamsesAMRConfigScaleSlider = OBJ_NEW('IDLitData', wRamsesAMRConfigScaleSlider, IDENTIFIER='wRamsesAMRConfigScaleSlider') oData_wRamsesAMRConfigScaleValue = OBJ_NEW('IDLitData', wRamsesAMRConfigScaleValue, IDENTIFIER='wRamsesAMRConfigScaleValue') oData_wRamsesXAMRBoundariesBase = OBJ_NEW('IDLitData', wRamsesXAMRBoundariesBase, IDENTIFIER='wRamsesXAMRBoundariesBase') oData_wRamsesYAMRBoundariesBase = OBJ_NEW('IDLitData', wRamsesYAMRBoundariesBase, IDENTIFIER='wRamsesYAMRBoundariesBase') oData_wRamsesZAMRBoundariesBase = OBJ_NEW('IDLitData', wRamsesZAMRBoundariesBase, IDENTIFIER='wRamsesZAMRBoundariesBase') WIDGET_CONTROL, wAmrConfigurationBase, /DESTROY result = oData_wAmrConfigurationBase->SetData(wAmrConfigurationBase) ; The Boundaries option Base ; wBoundariesBaseOptions = WIDGET_BASE(wSelectionbase[9], /BASE_ALIGN_CENTER, $ XPAD=3, YPAD=5, /FRAME, /COLUMN) wBoundariesOptions=LONARR(4) wBoundariesLabel0 = WIDGET_LABEL(wBoundariesBaseOptions, VALUE=' Boundaries ') wBoundariesLabel1 = WIDGET_LABEL(wBoundariesBaseOptions, VALUE='color ') wBoundariesOptions[0] = WIDGET_LIST(wBoundariesBaseOptions, VALUE=[ $ 'Blue', 'Black', 'Red', 'White'], YSIZE=4, UVALUE='BOUNDARIESCOLORLIST') wBoundariesLabel2 = WIDGET_LABEL(wBoundariesBaseOptions, VALUE='thickness ') thickness_table=['1','2','3','4','5','6','7','8','9','10'] wBoundariesOptions[1] = WIDGET_COMBOBOX(wBoundariesBaseOptions, $ VALUE=thickness_table, UVALUE='BOUNDARIESTHICKNESS',/EDITABLE) boundariesOffset=0. wBoundariesOptions[2] = CW_FIELD(wBoundariesBaseOptions, UVALUE='BOUNDARIES-OFFSET',$ /FLOAT,XSIZE=9,TITLE='offset', VALUE=boundariesOffset,/ALL_EVENTS) alphaBoundaries=1. wBoundariesOptions[3] = WIDGET_SLIDER(wBoundariesBaseOptions,UVALUE='BOUNDARIES-ALPHA',$ TITLE='alpha',VALUE=alphaBoundaries*100.,MINIMUM=0.,MAXIMUM=100.,/DRAG) ; The Image 3D Base ; wImage3DPlaneBase = WIDGET_BASE(wSelectionbase[10], /BASE_ALIGN_CENTER, /ALIGN_CENTER, $ XPAD=12, YPAD=3, /FRAME, /COLUMN) wLabel = WIDGET_LABEL(wImage3DPlaneBase, VALUE='Image plane') wSelectImage3DPlane = CW_BGROUP(wImage3DPlaneBase, ['xy','xz','yz'], $ UVALUE='SELECTIMAGE3DPLANE', /NO_RELEASE, /EXCLUSIVE, SET_VALUE=0) wLabel = WIDGET_LABEL(wImage3DPlaneBase, VALUE='plane position') surfacePosition=0 wImage3DPlaneSlider = WIDGET_SLIDER(wImage3DPlaneBase , $ UVALUE='IMAGE3DPOS_SLIDER', $ VALUE=surfacePosition, MINIMUM=0, MAXIMUM=149.,/DRAG) wImage3DOptions = WIDGET_BASE(wSelectionbase[10], /BASE_ALIGN_CENTER, $ XPAD=1, YPAD=3, /FRAME, /COLUMN) alphaImage=1. wImage3DAlpha = WIDGET_SLIDER(wImage3DOptions,UVALUE='IMAGE3D-ALPHA',$ TITLE='alpha',VALUE=alphaImage*100.,MINIMUM=0.,MAXIMUM=100.,/DRAG) wLabel = WIDGET_LABEL(wImage3DOptions, VALUE='interpolation :') wImage3DInterpolation = WIDGET_DROPLIST(wImage3DOptions, $ VALUE=['near. neighb.', 'bilinear'], $ UVALUE='IMAGE3D-INTERPOLATION', TITLE='') ; Map the Surface view (index 0) as default ; ;WIDGET_CONTROL, wSelectionBase[0], MAP=1 ;;;; THE DRAWING BASES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Create a base for the right column. ; wRightBase = WIDGET_BASE(wSubBase, /COLUMN ) ; Create a base for each drawing options ; nbase=2 wSelectionDrawingBase = LONARR(nbase) wTempDrawingBase = WIDGET_BASE(wRightBase) ; Put the selection bases into the temporary (temp) ; base. This way, the selection bases overlaps each ; another. When the user select from wSelectButton, ; only one selection base is mapped. ; for i=0, nbase-1 do begin wSelectionDrawingbase[i] = WIDGET_BASE(wTempDrawingBase, $ UVALUE=0L, /COLUMN, MAP=0, YPAD=0) endfor renderer=0 retain=0 if renderer eq 1 then print,'software renderer' if retain ne 0 then print,'backing store enabled' wDrawBase = WIDGET_BASE(wSelectionDrawingbase[0], /COLUMN, $ /FRAME, UVALUE=-1) wDrawBaseSub1 = WIDGET_BASE(wDrawBase, /ROW, $ /FRAME, UVALUE=-1) wDraw1 = WIDGET_DRAW(wDrawBaseSub1, $ XSIZE=xdim, YSIZE=ydim, /BUTTON_EVENTS, $ /EXPOSE_EVENTS, UVALUE='DRAW', $ RETAIN=retain, RENDERER=renderer, $ GRAPHICS_LEVEL=2,SENSITIVE=1) wDrawBaseSub2 = WIDGET_BASE(wDrawBase, /ROW, $ /FRAME, UVALUE=-1) wDraw2 = WIDGET_DRAW(wDrawBaseSub2, $ XSIZE=xdim/2.01, YSIZE=ydim/2., /BUTTON_EVENTS, $ /EXPOSE_EVENTS, UVALUE='DRAW2', $ RETAIN=retain, RENDERER=renderer, $ GRAPHICS_LEVEL=2,SENSITIVE=0) wDraw3 = WIDGET_DRAW(wDrawBaseSub2, $ XSIZE=xdim/2.01, YSIZE=ydim/2., /BUTTON_EVENTS, $ /EXPOSE_EVENTS, UVALUE='DRAW3', $ RETAIN=retain, RENDERER=renderer, $ GRAPHICS_LEVEL=2, XOFFSET=20) wPrint1Base = WIDGET_BASE(wSelectionDrawingbase[0], /ROW, $ /FRAME, YPAD=0, XPAD=0) wLabel = WIDGET_LABEL(wPrint1Base, VALUE='IMAGE ') wxImage = CW_FIELD(wPrint1Base,/INTEGER,TITLE='x =',XSIZE=5,/NOEDIT) wyImage = CW_FIELD(wPrint1Base,/INTEGER,TITLE='y =',XSIZE=5,/NOEDIT) wDataImage = CW_FIELD(wPrint1Base, /FLOATING, TITLE='data =', $ XSIZE=15, /NOEDIT) wImageOptions = WIDGET_DROPLIST(wPrint1Base, $ VALUE=['profile x fixed','profile y fixed','display Color Bar'], $ UVALUE='IMAGEOPTIONS') ImageToggle=intarr(2) ImageToggle(0)=0 ImageToggle(1)=0 wImageToggle = WIDGET_DROPLIST(wPrint1Base, $ VALUE=['toggle surface/image','toggle multi/square vue'], $ UVALUE='IMAGETOGGLE') ;wTableBase = WIDGET_BASE(wSelectionDrawingbase[0], /COLUMN, $ ; /FRAME, YPAD=0, XPAD=0, YSIZE=1) ; wLabel = WIDGET_LABEL(wTableBase,VALUE='processor ID \ step') ; wDataTable = WIDGET_TABLE(wTableBase, $ ; UVALUE='TABLE', $ ; COLUMN_WIDTHS=40 , $ ; COLUMN_LABELS=['0','1','2','3'] , $ ; ROW_LABELS=['1','2','3','4'], $ ; /EDITABLE, /ALL_EVENTS, $ ; XSIZE=4, YSIZE=4, $ ; X_SCROLL_SIZE=5, Y_SCROLL_SIZE=4 ) ; wDataTableText = widget_text(wTableBase,VALUE='') ; initially hide the table base ; WIDGET_CONTROL, wTableBase, MAP=0 wDrawBase3D = WIDGET_BASE(wSelectionDrawingbase[1], /COLUMN, $ UVALUE=12) wDrawBaseSub3D = WIDGET_BASE(wDrawBase3D, /ROW, $ /FRAME, UVALUE=4) wDraw3D = WIDGET_DRAW(wDrawBaseSub3D,CLASSNAME='IDLitWindow', $ XSIZE=xdim3D, YSIZE=ydim3D, /BUTTON_EVENTS, $ /EXPOSE_EVENTS, UVALUE='DRAW', KEYBOARD_EVENTS=2, $ RETAIN=retain, RENDERER=renderer , $ GRAPHICS_LEVEL=2) ; Create a base for each drawing options ; ; 0 isosurface ; 1 vectors/streamlines ; 2 particles ; 3 volume ; 4 navigation ; 5 stereo ; 6 text ; nbase=7 wDrawBase3DsubLower = LONARR(nbase) wTempDrawBase3D = WIDGET_BASE(wDrawBase3D) for i=0, nbase-1 do begin wDrawBase3DsubLower[i] = WIDGET_BASE(wTempDrawBase3D, $ UVALUE=5, /ROW, MAP=0, XSIZE=xdim3D*1.01, /FRAME, /ALIGN_LEFT) endfor ;;; Isosurface SubBase (Isoplot Base) ; wDrawIsoPlot = WIDGET_DRAW(wDrawBase3DsubLower[0], $ XSIZE=xdim3D*0.6, YSIZE=144, /BUTTON_EVENTS, $ /EXPOSE_EVENTS, UVALUE='DRAW3DPLOT', $ RETAIN=retain, RENDERER=renderer, $ GRAPHICS_LEVEL=2) wDrawBaseSubIsoPlot0 = WIDGET_BASE(wDrawBase3DsubLower[0], /COLUMN, $ /FRAME, UVALUE=5) wIsoValues = LONARR(4) ;wDrawBaseSubIsoPlot0row1 = WIDGET_BASE(wDrawBaseSubIsoPlot0, /ROW) wIsoValues[0] = CW_FIELD(wDrawBaseSubIsoPlot0,/FLOATING,XSIZE=11, $ TITLE='min ',UVALUE='ISOMIN',VALUE=0.,/NOEDIT) wIsoValues[1] = CW_FIELD(wDrawBaseSubIsoPlot0,/FLOATING,XSIZE=11, $ TITLE='max ',UVALUE='ISOMAX',VALUE=0.,/NOEDIT) wIsoValues[2] = CW_FIELD(wDrawBaseSubIsoPlot0,/FLOATING,XSIZE=11, $ TITLE='value set ',UVALUE='ISOSET',VALUE=0.,/RETURN_EVENT) wIsoValues[3] = CW_FIELD(wDrawBaseSubIsoPlot0,/FLOATING,XSIZE=11, $ TITLE='percent set',UVALUE='ISOPERCENT',VALUE=0.,/RETURN_EVENT) wDrawBaseSubIsoPlot = WIDGET_BASE(wDrawBase3DsubLower[0], $ ;/COLUMN, $ /FRAME, UVALUE=5) wHistogramOptions = WIDGET_DROPLIST(wDrawBaseSubIsoPlot, $ VALUE=['linear histo','log histo'], UVALUE='HISTOGRAMOPTIONS') IsoSurfaceTransparency=100. wIsoSurfaceTransparency = WIDGET_SLIDER(wDrawBaseSubIsoPlot, $ UVALUE='ISOSURFACETRANSPARENCY', Title='Transparency',XOFFSET=9, $ VALUE=IsoSurfaceTransparency, MINIMUM=0., MAXIMUM=100.,YOFFSET=35,/DRAG) IsoSurfaceShininess=25. wIsoSurfaceShininess = WIDGET_SLIDER(wDrawBaseSubIsoPlot, $ UVALUE='ISOSURFACESHININESS', Title='Shininess',XOFFSET=9, $ VALUE=IsoSurfaceShininess, MINIMUM=0., MAXIMUM=128.,YOFFSET=89,/DRAG) ;;; Vector Field SubBase ; nbase=2 wVectorFieldSeedConfigBase = LONARR(nbase) wTempBase = WIDGET_BASE(wDrawBase3DsubLower[1],XPAD=1) for i=0, nbase-1 do begin wVectorFieldSeedConfigBase[i] = WIDGET_BASE(wTempBase, $ UVALUE=0L, /COLUMN, MAP=0, YPAD=0, XPAD=0, /BASE_ALIGN_LEFT, /ALIGN_LEFT) endfor ; wVectorFieldSeedConfigBase[0] for the rectangular g2D & 3D seed grid ; wVectorFieldRectangularGridBase = WIDGET_BASE(wVectorFieldSeedConfigBase[0],/ROW) ; The 2D slice Plane Base ; w3DVec2DSlicePlaneBase = WIDGET_BASE(wVectorFieldRectangularGridBase, /BASE_ALIGN_CENTER, $ XPAD=4, YPAD=1, /FRAME, /COLUMN, SENSITIVE=0) ;w2DSlicePlaneLabel1 = WIDGET_LABEL(w3DVec2DSlicePlaneBase,VALUE='2D-Slice plane') xyzplane=1 wSelect2DSlicePlane = CW_BGROUP(w3DVec2DSlicePlaneBase, $ ['xy slice','xz slice','yz slice'], $ UVALUE='SELECT2DSLICE3DVECPLANE', /NO_RELEASE, /EXCLUSIVE, SET_VALUE=(xyzplane-1)) w3DVec2DSlicePlaneLabel2 = WIDGET_LABEL(w3DVec2DSlicePlaneBase, VALUE='plane position') xpos2DSlicePosition=make_array([3]) xpos2DSlicePosition[0]=0 ; initial slider pos xpos2DSlicePosition[1]=0 ; min xpos2DSlicePosition[2]=149 ; max w3DVec2DSlicePlaneSlider = WIDGET_SLIDER(w3DVec2DSlicePlaneBase,/DRAG , $ UVALUE='TWODSLICE3DVEC_SLIDER', $ VALUE=xpos2DSlicePosition[0], $ MINIMUM=xpos2DSlicePosition[1], $ MAXIMUM=xpos2DSlicePosition[2]) wVectorFieldConfigBase =WIDGET_BASE(wVectorFieldRectangularGridBase) wVectorFieldConfigLabel=WIDGET_LABEL(wVectorFieldConfigBase, $ VALUE=' Vector Field seed grid configuration') VectorFieldConfig=INTARR([3],[3]) VectorFieldConfig(*,0)=11 ; number of vertices VectorFieldConfig(*,1)=0 ; min VectorFieldConfig(*,2)=149 ; max ;;;;;;;;;;;;;;;;; first column -> x,y,z TxV1=STRARR([3]) TxV1=[' X',' Y',' Z'] TxV2=STRARR([3]) TxV2=['# vertices',' min',' max'] TxV3=STRARR([3],[3]) TxV3(0,0:2)=['FCONFXVER','FCONFXMIN','FCONFXMAX'] TxV3(1,0:2)=['FCONFYVER','FCONFYMIN','FCONFYMAX'] TxV3(2,0:2)=['FCONFZVER','FCONFZMIN','FCONFZMAX'] ; Create a base for each coordinate ; wVectorFieldConfigSubBase = LONARR(3) for i=0,2 do begin yf=20+i*40 ; y offset from top of base wVectorFieldConfigSubBase[i]=WIDGET_BASE(wVectorFieldConfigBase,YOFFSET=yf,/ROW) endfor ; Create a CW_FIELD for each configuration options ; wVectorFieldConfigLabel = LONARR(3) wVectorFieldConfig= LONARR(3,3) for i=0,2 do begin wVectorFieldConfigLabel[i]=WIDGET_LABEL(wVectorFieldConfigSubBase[i],VALUE=TxV1[i]) for j=0,2 do begin wVectorFieldConfig[i,j] = CW_FIELD(wVectorFieldConfigSubBase[i],/INTEGER,XSIZE=4,$ TITLE=TxV2[j],UVALUE=TxV3[i,j],VALUE=VectorFieldConfig(i,j),/ALL_EVENTS) endfor endfor ; The seed-pick Base ; wSeedPickBase = WIDGET_BASE(wVectorFieldSeedConfigBase[1], /BASE_ALIGN_CENTER, $ XPAD=4, YPAD=1, /FRAME, /COLUMN) wSeedPickBaseLabel = WIDGET_LABEL(wSeedPickBase,VALUE='Seed-pick') ;wSeedPickLabel = LONARR(3) wSeedPickDefBase=WIDGET_BASE(wSeedPickBase,/ROW) wSeedPick= LONARR(1,3) seedTitle=STRARR([3]) seedTitle=['x','y','z'] seedEvent=STRARR(1,[3]) ;seedEvent(0,0:2)=['SEEDX','SEEDY','SEEDZ'] ;seedEvent(0,0:2)=['SEEDX','SEEDY','SEEDZ'] seed=FLTARR([1],[3]) seed(*,0)=0. seed(*,1)=0. seed(*,2)=0. for i=0,0 do begin ;wVectorFieldConfigLabel[i]=WIDGET_LABEL(wVectorFieldConfigSubBase[i],VALUE=TxV1[i]) for j=0,2 do begin wSeedPick[i,j] = CW_FIELD(wSeedPickDefBase,/FLOAT,XSIZE=5,$ TITLE=seedTitle[j],UVALUE="UPDATETHEVIEW",VALUE=seed(i,j),/ALL_EVENTS) endfor endfor wSeedPickOptions=LONARR(3) wSeedPickOptionsBase=WIDGET_BASE(wSeedPickBase,/ROW, /ALIGN_LEFT) wSeedPickOptions[0] = WIDGET_DROPLIST(wSeedPickOptionsBase,UVALUE='SEEDPICK-ONOFF', $ VALUE=['ON','OFF']) wSeedPickOptions[1] = WIDGET_BUTTON(wSeedPickOptionsBase,UVALUE='SEEDPICK-RESET', $ VALUE=' RESET ') seedoptArray=make_array([1]) seedoptArray[0]=0 wSeedPickOptions[2] = CW_BGROUP(wSeedPickOptionsBase, ['continuous'], $ UVALUE='SEEDOPTARRAY', /NONEXCLUSIVE, SET_VALUE=seedoptArray) WIDGET_CONTROL,wVectorFieldSeedConfigBase[0], MAP=1 ;;; Particles SubBase ; wParticlesConfigBase =WIDGET_BASE(wDrawBase3DsubLower[2],/ROW,MAP=0) wParticlesConfigBaseLeft =WIDGET_BASE(wParticlesConfigBase,/COLUMN) wParticlesDensVel = WIDGET_DROPLIST(wParticlesConfigBaseLeft, $ VALUE=[' density distribution ', $ ' velocity distribution ' $ ], $ UVALUE='PARTICLES-DV', TITLE=' ') wParticlesConfigBaseLeftSub1 =WIDGET_BASE(wParticlesConfigBaseLeft,/ROW) wParticlesLinLogX = WIDGET_DROPLIST(wParticlesConfigBaseLeftSub1, $ VALUE=['log10 x', $ 'lin x ' $ ], $ UVALUE='PARTICLES-LINLOGX', TITLE=' ') wParticlesLinLogY = WIDGET_DROPLIST(wParticlesConfigBaseLeftSub1, $ VALUE=['log10 y', $ 'lin y ' $ ], $ UVALUE='PARTICLES-LINLOGY', TITLE=' ') WIDGET_CONTROL,wParticlesLinLogY,SET_DROPLIST_SELECT=1 wParticlesColorTable = WIDGET_DROPLIST(wParticlesConfigBaseLeft, $ VALUE=[' no color table ', $ ' current palette', $ ' blue to white ', $ ' white to blue ', $ ' red to white ', $ ' white to red ', $ ' black to white ', $ ' white to black ' $ ], $ UVALUE='PARTICLES-CT', TITLE=' ') wParticlesConfigBaseRight =WIDGET_BASE(wParticlesConfigBase,/COLUMN,MAP=1) ;;; Isosurface SubBase (Isoplot Base) ; wDrawDMDensityPlot = WIDGET_DRAW(wParticlesConfigBaseRight, $ XSIZE=xdim3D*0.6, YSIZE=144, /BUTTON_EVENTS, $ /EXPOSE_EVENTS, UVALUE='DRAWDMDENSITYPLOT', $ RETAIN=retain, RENDERER=renderer, $ GRAPHICS_LEVEL=2) ;;; Volume SubBase ; wVolumeConfigBase = WIDGET_BASE(wDrawBase3DsubLower[3],/COLUMN) clip_plane=[0,0,1.,1.] wVolumeClipBase = WIDGET_BASE(wVolumeConfigBase,/ROW) xsize=8 wLabel = WIDGET_LABEL(wVolumeClipBase,VALUE='cutting half-space:') wVolumeOptions[13] = CW_FIELD(wVolumeClipBase,/FLOATING,XSIZE=xsize, $ TITLE=' ',UVALUE='VOLUME-CLIPA',VALUE=clip_plane(0),/RETURN_EVENTS) wVolumeOptions[14] = CW_FIELD(wVolumeClipBase,/FLOATING,XSIZE=xsize, $ TITLE='X +',UVALUE='VOLUME-CLIPB',VALUE=clip_plane(1),/RETURN_EVENTS) wVolumeOptions[15] = CW_FIELD(wVolumeClipBase,/FLOATING,XSIZE=xsize, $ TITLE='Y +',UVALUE='VOLUME-CLIPC',VALUE=clip_plane(2),/RETURN_EVENTS) wVolumeOptions[16] = CW_FIELD(wVolumeClipBase,/FLOATING,XSIZE=xsize, $ TITLE='Z -',UVALUE='VOLUME-CLIPD',VALUE=clip_plane(3),/RETURN_EVENTS) wLabel = WIDGET_LABEL(wVolumeClipBase,VALUE='> 0') wVolumeOptions[17] = CW_FSLIDER(wVolumeClipBase, /SUPPRESS_VALUE, $ UVALUE='VOLUME-CLIPD-SLIDER', VALUE=clip_plane(3), MINIMUM=0., MAXIMUM=1.,/DRAG) wVolumeOptions[18]= WIDGET_DROPLIST(wVolumeClipBase, $ VALUE=[ $ ' free ', $ ' z wise ', $ ' x wise ', $ ' y wise ', $ ' -z wise', $ ' -x wise', $ ' -y wise' $ ], $ UVALUE='VOLUME-CLIPLIST', TITLE=' ') ;;; Navigation SubBase ; wNavigationConfigBase = WIDGET_BASE(wDrawBase3DsubLower[4],/COLUMN,SPACE=1,YPAD=0) ;;; Navigation options ; 0 -> rotation acceleration ; 1 -> scaling acceleration ; 2 -> translation acceleration ; 3 -> scaling postmultiply/premultiply ; 4 -> translation postmultiply/premultiply ; 5 -> pivot show/hide ; 6 -> pivot control ; 7 -> pivot radius ; 8 -> pivot transparency ; 9 -> middle button list : scaling/Z-translate ; wNavigationOptions=LONARR(10) wLabel = WIDGET_LABEL(wNavigationConfigBase, $ VALUE='Navigation controls using the mouse. Keyboard left/right/up/down/pageUp/pageDown keys are active') wLeftMouseBase = WIDGET_BASE(wNavigationConfigBase,/ROW) wLabel = WIDGET_LABEL(wLeftMouseBase, VALUE='Mouse left button : rotation speed') wNavigationOptions[0] = CW_FSLIDER(wLeftMouseBase,/DRAG , $ UVALUE='NAVIGATION_LEFT_SLIDER', $ VALUE=1., /SUPPRESS_VALUE, $ MINIMUM=0., MAXIMUM=1.) wMiddleMouseBase = WIDGET_BASE(wNavigationConfigBase,/ROW) wLabel = WIDGET_LABEL(wMiddleMouseBase,VALUE='Mouse middle button :') wNavigationOptions[9]=WIDGET_DROPLIST(wMiddleMouseBase,VALUE=['scaling','Z translation'],$ UVALUE='NAVIGATION_MIDDLELIST') wLabel = WIDGET_LABEL(wMiddleMouseBase,VALUE=' speed') wNavigationOptions[1] = CW_FSLIDER(wMiddleMouseBase,/DRAG , $ UVALUE='NAVIGATION_MIDDLE_SLIDER', $ VALUE=1., /SUPPRESS_VALUE, $ MINIMUM=0., MAXIMUM=1.) wLabel = WIDGET_LABEL(wMiddleMouseBase,VALUE=' ') wNavigationOptions[3]=WIDGET_DROPLIST(wMiddleMouseBase,VALUE=['post-multiply','pre-multiply'],$ UVALUE='NAVIGATION_MULTIPLY') wRightMouseBase = WIDGET_BASE(wNavigationConfigBase,/ROW) wLabel = WIDGET_LABEL(wRightMouseBase, VALUE='Mouse right button : XY translation speed') wNavigationOptions[2] = CW_FSLIDER(wRightMouseBase,/DRAG , $ UVALUE='NAVIGATION_RIGHT_SLIDER', $ VALUE=1., /SUPPRESS_VALUE, $ MINIMUM=0., MAXIMUM=1.) wLabel = WIDGET_LABEL(wRightMouseBase,VALUE=' ') wNavigationOptions[4]=WIDGET_DROPLIST(wRightMouseBase,VALUE=['post-multiply','pre-multiply'],$ UVALUE='NAVIGATION_MULTIPLY') wPivotBase = WIDGET_BASE(wNavigationConfigBase,/ROW) wLabel = WIDGET_LABEL(wPivotBase, VALUE='Pivot point :') wNavigationOptions[6]=CW_BGROUP(wPivotBase,['Click','XY translate'],COLUMN=2,$ UVALUE='NAVIGATION_PIVOTCONTROL',/NONEXCLUSIVE) wNavigationOptions[5]=WIDGET_DROPLIST(wPivotBase,VALUE=['hide','display'],UVALUE='NAVIGATION_PIVOTSHOW') wLabel = WIDGET_LABEL(wPivotBase, VALUE='radius') wNavigationOptions[7] = CW_FSLIDER(wPivotBase,/DRAG , $ UVALUE='NAVIGATION_PIVOTRADIUS_SLIDER', $ VALUE=1., /SUPPRESS_VALUE, $ MINIMUM=0., MAXIMUM=1.) wLabel = WIDGET_LABEL(wPivotBase, VALUE='transparency') wNavigationOptions[8] = CW_FSLIDER(wPivotBase,/DRAG , $ UVALUE='NAVIGATION_PIVOTTRANSPARENCY_SLIDER', $ VALUE=0.5, /SUPPRESS_VALUE, $ MINIMUM=0., MAXIMUM=1.) oData_wNavigationOptions = OBJ_NEW('IDLitData',wNavigationOptions, IDENTIFIER='wNavigationOptions') result=oData_wNavigationOptions->SetData(wNavigationOptions) ;;; Stereo SubBase ; wStereoConfigBase = WIDGET_BASE(wDrawBase3DsubLower[5],/COLUMN,SPACE=1,YPAD=0) ;;; Stereo options ; 0 -> engage left ; 1 -> engage right ; 2 -> stereo angle ; 3 -> distance to viewing plane ; 4 -> eyes separation ; wStereoOptions=LONARR(5) eyesSeparation=6.5 distanceStereo=45. alphaStereo=180/!PI*atan(eyesSeparation,distanceStereo) wLabel = WIDGET_LABEL(wStereoConfigBase, VALUE='Main 3D view is associated to the left eye') wStereoDisplayBase = WIDGET_BASE(wStereoConfigBase,/ROW) wStereoOptions[0] = WIDGET_BUTTON(wStereoDisplayBase,UVALUE='STEREO-ENGAGE-LEFT', $ VALUE=' DISPLAY LEFT EYE WINDOW ') wStereoOptions[1] = WIDGET_BUTTON(wStereoDisplayBase,UVALUE='STEREO-ENGAGE-RIGHT', $ VALUE=' DISPLAY RIGHT EYE WINDOW ') wStereoSettingsBase = WIDGET_BASE(wStereoConfigBase,/ROW) wStereoAngleBase = WIDGET_BASE(wStereoSettingsBase,/COLUMN) wLabel = WIDGET_LABEL(wStereoAngleBase, VALUE='stereo angle (deg) :',/ALIGN_LEFT) wStereoOptions[2] = CW_FSLIDER(wStereoAngleBase,UVALUE='STEREO-ANGLE', $, VALUE=alphaStereo, MINIMUM=-90L, MAXIMUM=90L,/DRAG, /EDIT,XSIZE=180) wStereoViewDistanceBase = WIDGET_BASE(wStereoSettingsBase,/COLUMN) wLabel = WIDGET_LABEL(wStereoViewDistanceBase, VALUE='distance to viewing plane (cm):',/ALIGN_LEFT) wStereoOptions[3] = CW_FSLIDER(wStereoViewDistanceBase,UVALUE='STEREO-DISTANCE', $ VALUE=distanceStereo, MINIMUM=0L, MAXIMUM=600L,/DRAG, /EDIT,XSIZE=200) wStereoEyesSeparationBase = WIDGET_BASE(wStereoSettingsBase,/COLUMN) wLabel = WIDGET_LABEL(wStereoEyesSeparationBase, VALUE='eyes separation (cm):',/ALIGN_LEFT) wStereoOptions[4] = CW_FIELD(wStereoEyesSeparationBase,/FLOATING,XSIZE=8, $ TITLE='',UVALUE='STEREO-SEPARATION',VALUE=eyesSeparation,/RETURN_EVENTS) oData_wStereoOptions = OBJ_NEW('IDLitData',wStereoOptions, IDENTIFIER='wStereoOptions') result=oData_wStereoOptions->SetData(wStereoOptions) ;;; Text control SubBase ; wTextControlConfigBase = WIDGET_BASE(wDrawBase3DsubLower[6],/COLUMN,SPACE=1,YPAD=0) ;;; Text control options ; 0 -> version, AMR level ; wTextControlOptions=LONARR(1) hide_version=1 wTextControlOptions[0] = CW_BGROUP(wTextControlConfigBase, [ $ 'version' ,$ 'AMR Level' $ ] , UVALUE='TEXTCONTROL',SET_VALUE=[1-hide_version,0],/NONEXCLUSIVE) ; Map the surface drawing (index 0) as default ; WIDGET_CONTROL, wDrawBase3DsubLower[4], MAP=1 ; Map the 3D drawing (index 1) as default ; WIDGET_CONTROL, wSelectionDrawingBase[1], MAP=1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Realize the widget hierarchy. ; WIDGET_CONTROL, wTopBase, /REALIZE ; Returns the top level base in the appTLB keyword. ; appTLB = wTopBase WIDGET_CONTROL, wTopBase, SENSITIVE=0 ; Determine the window value of plot window, wDraw1. ; WIDGET_CONTROL, wDraw1, GET_VALUE=drawWindowID1 WIDGET_CONTROL, wDraw2, GET_VALUE=drawWindowID2 WIDGET_CONTROL, wDraw3, GET_VALUE=drawWindowID3 WIDGET_CONTROL, wDraw3D, GET_VALUE=drawWindowID3D WIDGET_CONTROL, wDrawIsoPlot, GET_VALUE=drawWindowIDIsoPlot WIDGET_CONTROL, wDrawDMDensityPlot, GET_VALUE=drawWindowIDDMDensityPlot ;drawWindowID1->SetCurrentCursor,IMAGE=sState.cursor_image, MASK=sState.cursor_mask ; Set the view such that the surface is ; contained within a box defined by ; by radx and rady ( view normal coordinates). ; sqr3 = SQRT(3)/1.5 ; length of a diagonal in a cube radx = SQRT(2.0) ; viewport in normal coordinates rady = SQRT(2.0) ; Select the normal corrdinates of the ; orthogonal axes location within the volume. ; example: ; middle : axesX, axesY, axesZ = -0.5 ; lowest data values : axesX, axesY, axesZ = 0.0 ; highest data values : axesX, axesY, axesZ = -1.0 ; axesX = -0.5 axesY = -0.5 axesZ = -0.5 xMargin = (1.0-sqr3)/4.0 ;2.0 yMargin = (1.0-sqr3)/4.0 ;2.0 xv = ((xMargin)*radx + axesX) yv = ((yMargin)*rady + axesY) width = 1.0 - 2.0 * xMargin* radx height = 1.0 - 2.0 * yMargin * radY myview = [xv, yv, width, height] xMargin = 0. yMargin = 0. xv = ((xMargin)*radx + axesX) yv = ((yMargin)*rady + axesY) width = 1.0 - 2.0 * xMargin* radx height = 1.0 - 2.0 * yMargin * radY myview3D = [xv, yv, width, height] ;print,'myview3D=',myview3D eye=fltarr(5) ; View properties eye[0]=3. ; Distance from the eyepoint to the viewplane (Z=0) eye[1]=2.9;1.5 ; Near clipping plane eye[2]=-50.;-1.5 ; Far clipping plane eye[3]=0. ; Depth cueing Zbright eye[4]=0. ; Depth cueing Zdim ; Create view for the Surface. Upper large. Black background. ; oView1 = OBJ_NEW('idlgrview', PROJECTION=1, EYE=eye(0), DEPTH_CUE=eye(3:4), $ ZCLIP=eye(1:2), VIEWPLANE_RECT=myview, COLOR=[0,0,0]) ; Create view. Lower left. Charcoal background. ; oView2 = OBJ_NEW('IDLgrView', COLOR=[80,80,80]) WIDGET_CONTROL, wDraw2, GET_VALUE=drawWindowID2 drawWindowID2->GetProperty,DIMENSIONS=dim ystart=-0.75 ywidth= 1.35 xwidth=ywidth*dim[0]/dim[1] xstart=-xwidth/2. ystart=-0.5 ywidth= 1. xstart=-0.5 xwidth= 1. viewRect = [xstart,ystart,xwidth,ywidth] oView2->SetProperty, Viewplane_Rect=viewRect, Location=[0,0], Color=antiqueWhite ; Create view. Lower right. Charcoal background. ; oView3 = OBJ_NEW('IDLgrView', COLOR=[120,120,120]) WIDGET_CONTROL, wDraw3, GET_VALUE=drawWindowID3 drawWindowID3->GetProperty,DIMENSIONS=dim ystart=-0.75 ywidth= 1.35 xwidth=1.4 xstart=-0.8 viewRect = [xstart,ystart,xwidth,ywidth] oView3->SetProperty, Viewplane_Rect=viewRect, Location=[0,0], Color=antiqueWhite oPaletteImage = Obj_New('IDLgrPalette') oPaletteImage->LoadCT, 13 ; 3 oPaletteImage->GetProperty, Red=r, Blue=b, Green=g ; Create 3D view for the Project Volume/Voxel Project. Upper large. Black background. ; oView3D = OBJ_NEW('idlgrview', PROJECTION=2, EYE=eye(0), DEPTH_CUE=eye(3:4), $ ZCLIP=eye(1:2), VIEWPLANE_RECT=myview3D, COLOR=[0,0,0]);,TRANSPARENT=1);,DOUBLE=1) ; 3D vue ; depth_disable=0 oMasterModel3D = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) oResizeableModel3D = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) oStereoModel3D = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) oModel3D = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) oRotationModel3D = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) oModelObjects3D = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) oStaticModel3D = OBJ_NEW('IDLgrModel') oModel3D->Add, oStaticModel3D oModel3D->Add, oRotationModel3D oRotationModel3D->Add, oModelObjects3D oPivot=OBJ_NEW('orb',color=[255,0,0],radius=0.025,HIDE=1,ALPHA_CHANNEL=0.5,/REGISTER_PROPERTIES,select_target=1) oModel3D->Add, oPivot oPivotRotation=OBJ_NEW('orb',color=[0,255,0],radius=0.025,HIDE=1,ALPHA_CHANNEL=0.5,/REGISTER_PROPERTIES,select_target=1) oRotationModel3D->Add, oPivotRotation sScene={oPivot:oPivot,$ oPivotRotation:oPivotRotation} idl_version=!VERSION print,'idl_version=',idl_version release=idl_version.RELEASE print,'IDL release=',release ;;; Sequence ; MovieFrameCURRENT=0 ; max number MovieFrameNMAX=2000 ; max number ;oshaderbytscl=obj_new("IDLgrShaderBytscl") Image3DNMAX=10 oImage3D = Objarr(Image3DNMAX) oImage = Objarr(Image3DNMAX) for i=0,Image3DNMAX-1 do begin oImage3D[i] = Obj_New('IDLgrImage',Palette=oPaletteImage, Interleave=0,HIDE=1,$ BLEND_FUNCTION=[3,4],$ DEPTH_TEST_DISABLE=0,$ ;SHADER=oshaderbytscl, $ /REGISTER_PROPERTIES $ ) oImage[i] = Obj_New('IDLgrImage',Palette=oPaletteImage, Interleave=0,HIDE=1) endfor if release eq '6.1' or release eq '6.1.1' then begin print,'IDL release < 6.2' print,'Limitations in visualization of image in 3D space' endif else begin for i=0,Image3DNMAX-1 do oImage3D[i]->SetProperty,TRANSFORM_MODE=1 end ;oStaticModel3D->Add, oImage3D oModelImage3D = OBJ_NEW('IDLgrModel') for i=0,Image3DNMAX-1 do oModelImage3D->Add, oImage3D[i] oMasterModel3D->Add, oResizeableModel3D oResizeableModel3D->Add, oStereoModel3D oStereoModel3D->Add, oModel3D oView3D->Add, oMasterModel3D ; Create model for the Image. ; oModel1 = OBJ_NEW('IDLgrModel') ;oImage = Obj_New('IDLgrImage',Palette=oPaletteImage, Interleave=0,HIDE=1) ;oModel1->Add, oImage for i=0,Image3DNMAX-1 do oModel1->Add, oImage[i] oView2->Add, oModel1 xTitleImage = Obj_New('IDLgrText','x',Color=[0,0,0]) yTitleImage = Obj_New('IDLgrText','y',Color=[0,0,0]) xAxisImage = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=-0.06, $ Minor=4, Title=xTitleImage, Exact=1, HIDE=1) yAxisImage = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=-0.06, $ Minor=4, Title=yTitleImage, Exact=1, HIDE=1) oModel1->Add,xAxisImage oModel1->Add,yAxisImage oVectorField2D = OBJ_NEW('IDLgrPolyline', Color=[255,255,255], HIDE=1) oStreamlines2D = OBJ_NEW('IDLgrPolyline', Color=[255,255,255], HIDE=1) oModel1->Add, oVectorField2D oModel1->Add, oStreamlines2D Polyline=make_array([2],[2]) Polyline[[0,0]]=0 Polyline[[1,0]]=0 Polyline[[0,1]]=0 Polyline[[1,1]]=0 oPolyLineImage1 = Obj_New("IDLgrPolyline", Polyline , Color=[0,0,0]) oPolyLineImage2 = Obj_New("IDLgrPolyline", Polyline , Color=[0,0,0], LINESTYLE=2) oModel1->Add,oPolyLineImage1 oModel1->Add,oPolyLineImage2 oTitleBar = Obj_New('IDLgrText','density',Color=[0,0,0]) oColorBar = Obj_New('IDLgrColorbar', Palette=oPaletteImage, $ SHOW_OUTLINE=1, $ ;SHOW_AXIS=1 , $ ;Position=[0.45, 0.1, 0.55, 0.6], $ ;YRANGE=[2.,2.6], $ DIMENSIONS=[.15,.7], $ Title=oTitleBar, Color=[0,0,255], HIDE=1) oColorBarAxisTitle = Obj_New('IDLgrText','',Color=[0,0,0]) oColorBarAxis = Obj_New("IDLgrAxis", 1, Color=[0,0,255], Ticklen=-0.022, SubTicklen=0.8, $ Title=oColorBarAxisTitle, Minor=4, HIDE=1) oModel1->Add, oColorBarAxis oModel1->Add, oColorBar ; Create objects for the Plot. ; oModelPlot = OBJ_NEW('IDLgrModel') oPlot = OBJ_NEW('IDLgrPlot', LINESTYLE=0) oView3->Add, oModelPlot xTitlePlot = Obj_New('IDLgrText','y',Color=[0,0,0]) yTitlePlot = Obj_New('IDLgrText','density',Color=[0,0,0]) xAxisPlot = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=0.1, $ Minor=4, Title=xTitlePlot, Exact=Keyword_Set(exact)) yAxisPlot = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=0.1, $ Minor=4, Title=yTitlePlot, Exact=0, Extend=0) oModelPlot->Add,xAxisPlot oModelPlot->Add,yAxisPlot oModelPlot->Add,oPlot xaxisPlot->SetProperty, HIDE=1 yaxisPlot->SetProperty, HIDE=1 ; Create objects for the Plot histogramming the 3D data for isosurface selection. ; oViewIsoPlot = OBJ_NEW('IDLgrView', COLOR=[0,120,220]) oModelIsoPlot = OBJ_NEW('IDLgrModel') oIsoPlot = OBJ_NEW('IDLgrPlot', LINESTYLE=0,THICK=1) oViewIsoPlot->Add, oModelIsoPlot xTitleIsoPlot = Obj_New('IDLgrText','density',Color=[0,0,0]) xAxisIsoPlotB = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=0.1, $ Minor=4, Exact=Keyword_Set(exact),TEXTPOS=0) xAxisIsoPlotT = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=-0.1, $ Minor=4, Title=xTitleIsoPlot, Exact=Keyword_Set(exact),/NOTEXT) yAxisIsoPlotL = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=0.05, $ Minor=2, Exact=0, Extend=0,TEXTPOS=1) yAxisIsoPlotR = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=-0.05, $ Minor=2, Exact=0, Extend=0,TEXTPOS=0) oModelIsoPlot->Add,xAxisIsoPlotT oModelIsoPlot->Add,xAxisIsoPlotB oModelIsoPlot->Add,yAxisIsoPlotL oModelIsoPlot->Add,yAxisIsoPlotR oModelIsoPlot->Add,oIsoPlot ystart=-0.8 ywidth= 1.4 xstart=-0.55 xwidth= 1.1 viewRect = [xstart,ystart,xwidth,ywidth] oViewIsoPlot->SetProperty, Viewplane_Rect=viewRect, Location=[0,0], Color=antiqueWhite IsoPlot=4. Polyline[0,0]=IsoPlot Polyline[1,0]=-0.5 Polyline[0,1]=IsoPlot Polyline[1,1]=0.5 oPolyLineIsoPlot = Obj_New("IDLgrPolyline", Polyline , Color=[255,0,0]) oModelIsoPlot->Add,oPolyLineIsoPlot ; Create objects for the Plot histogramming the DM density ; oViewDMDensityPlot = OBJ_NEW('IDLgrView', COLOR=[0,120,220]) oModelDMDensityPlot = OBJ_NEW('IDLgrModel') oDMDensityPlot = OBJ_NEW('IDLgrPlot', LINESTYLE=0,THICK=1) oViewDMDensityPlot->Add, oModelDMDensityPlot xTitleDMDensityPlot = Obj_New('IDLgrText','density',Color=[0,0,0]) xAxisDMDensityPlotB = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=0.1, $ Minor=4, Exact=Keyword_Set(exact),TEXTPOS=0) xAxisDMDensityPlotT = Obj_New("IDLgrAxis", 0, Color=[0,0,0], Ticklen=-0.1, $ Minor=4, Title=xTitleDMDensityPlot, Exact=Keyword_Set(exact),/NOTEXT) yAxisDMDensityPlotL = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=0.05, $ Minor=2, Exact=0, Extend=0,TEXTPOS=1) yAxisDMDensityPlotR = Obj_New("IDLgrAxis", 1, Color=[0,0,0], Ticklen=-0.05, $ Minor=2, Exact=0, Extend=0,TEXTPOS=0) oModelDMDensityPlot->Add,xAxisDMDensityPlotT oModelDMDensityPlot->Add,xAxisDMDensityPlotB oModelDMDensityPlot->Add,yAxisDMDensityPlotL oModelDMDensityPlot->Add,yAxisDMDensityPlotR oModelDMDensityPlot->Add,oDMDensityPlot ystart=-0.8 ywidth= 1.4 xstart=-0.55 xwidth= 1.15 viewRect = [xstart,ystart,xwidth,ywidth] oViewDMDensityPlot->SetProperty, Viewplane_Rect=viewRect, Location=[0,0], Color=antiqueWhite DMDensityPlot=fltarr(2) DMDensityPlot[0]= 5. ; 0.9e7 DMDensityPlot[1]= 6. ;1.3e7 oPolyLineDMDensityPlot = OBJARR(2) Polyline[0,0]=DMDensityPlot[0] Polyline[1,0]=-0.5 Polyline[0,1]=DMDensityPlot[0] Polyline[1,1]=0.5 oPolyLineDMDensityPlot[0] = Obj_New("IDLgrPolyline", Polyline , Color=[255,0,0]) oModelDMDensityPlot->Add,oPolyLineDMDensityPlot[0] Polyline[0,0]=DMDensityPlot[1] Polyline[1,0]=-0.5 Polyline[0,1]=DMDensityPlot[1] Polyline[1,1]=0.5 oPolyLineDMDensityPlot[1] = Obj_New("IDLgrPolyline", Polyline , Color=[0,255,0]) oModelDMDensityPlot->Add,oPolyLineDMDensityPlot[1] helvetica1ptFontObject = Obj_New('IDLgrFont', 'Helvetica', Size=1) helvetica2ptFontObject = Obj_New('IDLgrFont', 'Helvetica', Size=2) helvetica5ptFontObject = Obj_New('IDLgrFont', 'Helvetica', Size=5) helvetica10ptFontObject = Obj_New('IDLgrFont', 'Helvetica', Size=10) helvetica12ptFontObject = Obj_New('IDLgrFont', 'Helvetica', Size=12) ; Create models for the Surface. ; oStaticModel = OBJ_NEW('idlgrmodel') oMovableModel = OBJ_NEW('idlgrmodel') oRotationModel = OBJ_NEW('idlgrmodel') oScalingModel = OBJ_NEW('idlgrmodel') oTranslationModel = OBJ_NEW('idlgrmodel') oStaticModel->Add, oMovableModel oMovableModel->Add, oRotationModel oRotationModel->Add, oScalingModel oScalingModel->Add, oTranslationModel ;otext1 = OBJ_NEW('idlgrtext', '0', LOCATION=[0.,0.,0.], COLOR=[200,255,255]) ;otext2 = OBJ_NEW('idlgrtext', 'L', LOCATION=[0., 0., 0.5], COLOR=[200,255,255]) ;oTranslationModel->Add, otext1 ;oTranslationModel->Add, otext2 sc = 0.7 oStaticModel->Scale, sc, sc, sc ; Create light. ; oLight0 = OBJ_NEW('idlgrLight', TYPE=0, INTENSITY=0.2) oLight1 = OBJ_NEW('idlgrLight', TYPE=2, INTENSITY=1., LOCATION=[0., 0., 2.], DIRECTION=[0.0, 0., -1.]) ;oLight1 = OBJ_NEW('idlgrLight', TYPE=1, INTENSITY=1., LOCATION=[0., 0., 0.5 ]) ;oLight2 = OBJ_NEW('idlgrLight', TYPE=1, INTENSITY=1., LOCATION=[0., 0., 1.], DIRECTION=[0.0, 0, -1.]) ;oLight3 = OBJ_NEW('idlgrLight', TYPE=3, INTENSITY=1., LOCATION=[0., 1000., 0.], DIRECTION=[0.0,-1, 0.]) ;oLight4 = OBJ_NEW('idlgrLight', TYPE=1, INTENSITY=1., LOCATION=[-1000.,-1000., 0.]) ;oLight5 = OBJ_NEW('idlgrLight', TYPE=1, INTENSITY=1., LOCATION=[ 1000.,-1000., 0.]) oStaticModel->Add, oLight0 ; ambient light -> needed to see something oStaticModel->Add, oLight1 ;oStaticModel->Add, oLight2 ;oStaticModel->Add, oLight3 ;oStaticModel->Add, oLight4 ;oStaticModel->Add, oLight5 ;oLight3D = OBJ_NEW('idlgrLight', TYPE=2, INTENSITY=1., LOCATION=[0.0, 0., 10.5], DIRECTION=[0.0, 0., -1.]) ; Compute coordinate conversion to normalize. ; z = indgen(150,150) sz = SIZE(z) maxx = sz[1] - 1 maxy = sz[2] - 1 maxz = MAX(z,min=minz) xs = [axesX,1.0/maxx] ys = [axesY,1.0/maxy] minz2 = minz - 1 maxz2 = maxz + 1 zs = [(-minz2/(maxz2-minz2))+axesZ, 1.0/(maxz2-minz2)] oPalette1 = OBJ_NEW('idlgrPalette') oPalette1->LOADCT, 25 ; Mac Style oTextureImage = OBJ_NEW('idlgrImage', BYTSCL(z), PALETTE=oPalette1) ; Create the surface. ; ; oSimpleSurface = OBJ_NEW('IDLgrSurface', data, $ ; TEXTURE_MAP=oTextureImage, $ ; STYLE=2, SHADING=1, $ ; /USE_TRIANGLES, $ ; ;COLOR=[60,60,255], $ ; ;BOTTOM=[64,192,128], $ ; COLOR=[230, 230, 230], BOTTOM=[64, 192, 128], $ ; XCOORD_CONV=xs, YCOORD_CONV=ys, ZCOORD_CONV=zs) oSimpleSurface = OBJ_NEW('IDLgrSurface') ;oSimpleSurface->SetProperty, TEXTURE_MAP=oTextureImage oSimpleSurface->SetProperty, STYLE=2 oSimpleSurface->SetProperty, SHADING=1 ;oSimpleSurface->SetProperty, /USE_TRIANGLES oSimpleSurface->SetProperty, COLOR=[200, 200, 0] ; Yellow oSimpleSurface->SetProperty, BOTTOM=[64, 192, 128] oSimpleSurface->SetProperty ;, SHININESS=128 oTranslationModel->Add, oSimpleSurface ; Place the model in the view. ; oView1->Add, oStaticModel alpha=1. dtd=0 ; axis depth test disable xaxis3Dbounds1 = Obj_New("IDLgrAxis",0,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) xaxis3Dbounds2 = Obj_New("IDLgrAxis",0,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) xaxis3Dbounds3 = Obj_New("IDLgrAxis",0,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) xaxis3Dbounds4 = Obj_New("IDLgrAxis",0,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) yaxis3Dbounds1 = Obj_New("IDLgrAxis",1,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) yaxis3Dbounds2 = Obj_New("IDLgrAxis",1,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) yaxis3Dbounds3 = Obj_New("IDLgrAxis",1,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) yaxis3Dbounds4 = Obj_New("IDLgrAxis",1,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) zaxis3Dbounds1 = Obj_New("IDLgrAxis",2,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) zaxis3Dbounds2 = Obj_New("IDLgrAxis",2,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) zaxis3Dbounds3 = Obj_New("IDLgrAxis",2,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) zaxis3Dbounds4 = Obj_New("IDLgrAxis",2,Color=[255,255,255],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha,DEPTH_TEST_DISABLE=dtd) oModelBounds = OBJ_NEW('IDLgrModel') oModelBounds->Add, xaxis3Dbounds1 oModelBounds->Add, xaxis3Dbounds2 oModelBounds->Add, xaxis3Dbounds3 oModelBounds->Add, xaxis3Dbounds4 oModelBounds->Add, yaxis3Dbounds1 oModelBounds->Add, yaxis3Dbounds2 oModelBounds->Add, yaxis3Dbounds3 oModelBounds->Add, yaxis3Dbounds4 oModelBounds->Add, zaxis3Dbounds1 oModelBounds->Add, zaxis3Dbounds2 oModelBounds->Add, zaxis3Dbounds3 oModelBounds->Add, zaxis3Dbounds4 oPaletteImage->LoadCT, 1 oPaletteImage->GetProperty, Red=r, Blue=b, Green=g vColors = BYTARR(256,3,/NOZERO) vColors[*,0]=r vColors[*,1]=g vColors[*,2]=b ;print, vColors oPaletteImage->LoadCT, 13 ; 3 ; Create a Volume Object ; oModelVolume = OBJ_NEW('IDLgrModel') ; oVolume=OBJ_NEW('IDLgrVolume',HIDE=1,ALPHA_CHANNEL=1.,ZERO_OPACITY_SKIP=1,/ZBUFFER, $ ; RGB_TABLE0=vColors,HINTS=0,COMPOSITE_FUNCTION=1,/NO_COPY,$ ; RENDER_STEP=[1,1,1],/REGISTER_PROPERTIES,DESCRIPTION='volume object') oData_oVolume = OBJ_NEW('IDLitData',oVolume,IDENTIFIER='oVolume') oVolume = OBJARR(MovieFrameNMAX) ; MovieFrame index for movie making result = oData_oVolume->SetData(oVolume) ; oModelVolume->Add,oVolume ;oModelObjects3D ->Add,oModelVolume is3DModelDrawn = 1 ; create a model for only for the movie oMovieModel = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) ;;;oModelObjects3D->Add, oMovieModel oAmrModel3D = OBJARR(MovieFrameNMAX) for i=0,MovieFrameNMAX-1 do begin oAmrModel3D[i] = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) endfor oMovieModel->Add, oAmrModel3D[0] oAmrModel2D = OBJARR(MovieFrameNMAX) for i=0,MovieFrameNMAX-1 do begin oAmrModel2D[i] = OBJ_NEW('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) endfor oMovieModel->Add, oAmrModel2D[0] polylines = OBJARR(MovieFrameNMAX,nlevelmax) for i=0, nlevelmax-1 do polylines[0,i] = OBJ_NEW('IDLgrPolyline', fltarr(1), fltarr(1), fltarr(1), hide=0) polylinesPlanes = OBJARR(MovieFrameNMAX,6,nlevelmax) for i = 0, 5 do for j=0, nlevelmax-1 do polylinesPlanes[0,i,j] = OBJ_NEW('IDLgrPolyline', fltarr(1), fltarr(1), fltarr(1), hide=0) oModelObjects3D->Add, subAxisAMRBoundaries[0] oModelObjects3D->Add, subAxisAMRBoundaries[1] oModelObjects3D->Add, subAxisAMRBoundaries[2] oModelObjects3D->Add, subAxisAMRBoundaries[3] oModelObjects3D->Add, subAxisAMRBoundaries[4] oModelObjects3D->Add, subAxisAMRBoundaries[5] oModelObjects3D->Add, subAxisAMRBoundaries[6] oModelObjects3D->Add, subAxisAMRBoundaries[7] oModelObjects3D->Add, subAxisAMRBoundaries[8] oModelObjects3D->Add, subAxisAMRBoundaries[9] oModelObjects3D->Add, subAxisAMRBoundaries[10] oModelObjects3D->Add, subAxisAMRBoundaries[11] oData_oAmrModel3D = OBJ_NEW('IDLitData',oAmrModel3D, IDENTIFIER='oAmrModel3D') oData_oAmrModel2D = OBJ_NEW('IDLitData',oAmrModel2D, IDENTIFIER='oAmrModel3D') oData_is3DModelDrawn = OBJ_NEW('IDLitData',is3DModelDrawn, IDENTIFIER='is3DModelDrawn') ; Add the trackball object for interactive change ; of the scene orientation ; xcenter = xdim3D/2. ycenter = ydim3D/2. radius = xdim3D/sqrt(2.) oTrackL = OBJ_NEW('Trackball', [xcenter,ycenter], radius, MOUSE=1) oTrackM = OBJ_NEW('Trackball', [xcenter,ycenter], radius, MOUSE=2) oTrackR = OBJ_NEW('Trackball', [xcenter,ycenter], radius, MOUSE=4) MoviePolylines = OBJARR(1) ; Create data objects ; ;oData_varData3D = OBJ_NEW('IDLitData',varData3D,IDENTIFIER='varData3D') oData_varData2D = OBJ_NEW('IDLitData',varData2D,IDENTIFIER='varData2D') oData_flag = OBJ_NEW('IDLitData',flag ,IDENTIFIER='flag') oData_vue = OBJ_NEW('IDLitData',vue,IDENTIFIER='vue') oData_xyzplane = OBJ_NEW('IDLitData',xyzplane,IDENTIFIER='xyzplane') oData_ScalarLinLog = OBJ_NEW('IDLitData',ScalarLinLog,IDENTIFIER='ScalarLinLog') ; oData_SurfaceLog = OBJ_NEW('IDLitData',SurfaceLog,IDENTIFIER='SurfaceLog') oData_ProcessorId = OBJ_NEW('IDLitData',ProcessorId,IDENTIFIER='ProcessorId') oData_FileId = OBJ_NEW('IDLitData',FileId,IDENTIFIER='FileId') oData_SimuStepOutput = OBJ_NEW('IDLitData',SimuStepOutput,IDENTIFIER='SimuStepOutput') oData_SimuStepReprise = OBJ_NEW('IDLitData',SimuStepReprise,IDENTIFIER='SimuStepReprise') oData_DataReduction = OBJ_NEW('IDLitData',DataReduction,IDENTIFIER='DataReduction') oData_RebinData = OBJ_NEW('IDLitData',RebinData,IDENTIFIER='RebinData') oData_FillArrays = OBJ_NEW('IDLitData',FillArrays,IDENTIFIER='FillArrays') oData_FillArraysHDF = OBJ_NEW('IDLitData',FillArraysHDF) oData_DataDimHDF = OBJ_NEW('IDLitData',DataDimHDF) oData_RamsesFillArrays = OBJ_NEW('IDLitData',RamsesFillArrays,IDENTIFIER='RamsesFillArrays') oData_GridDim = OBJ_NEW('IDLitData',GridDim,IDENTIFIER='GridDim') oData_GridSize = OBJ_NEW('IDLitData',GridSize,IDENTIFIER='GridSize') oData_DataFormat = OBJ_NEW('IDLitData',DataFormat,IDENTIFIER='DataFormat') oData_OptionsArray = OBJ_NEW('IDLitData',OptionsArray,IDENTIFIER='OptionsArray') oData_ParametersArray = OBJ_NEW('IDLitData',ParametersArray,IDENTIFIER='ParametersArray') oData_JobName = OBJ_NEW('IDLitData',JobName,IDENTIFIER='JobName') oData_nbuf = OBJ_NEW('IDLitData',nbuf,IDENTIFIER='nbuf') oData_OutputReprise = OBJ_NEW('IDLitData',OutputReprise,IDENTIFIER='OutputReprise') oData_InitialDir = OBJ_NEW('IDLitData',InitialDir,IDENTIFIER='InitialDir') oData_DataDir = OBJ_NEW('IDLitData',DataDir,IDENTIFIER='DataDir') oData_Plotx = OBJ_NEW('IDLitData',Plotx,IDENTIFIER='Plotx') oData_ImageProfile = OBJ_NEW('IDLitData',ImageProfile,IDENTIFIER='ImageProfile') oData_IsoPlot = OBJ_NEW('IDLitData',IsoPlot,IDENTIFIER='IsoPlot') oData_DMDensityPlot = OBJ_NEW('IDLitData',DMDensityPlot,IDENTIFIER='DMDensityPlot') oData_HistoLog = OBJ_NEW('IDLitData',HistoLog,IDENTIFIER='HistoLog') oData_SaveViewsSelect_eps = OBJ_NEW('IDLitData',SaveViewsSelect_eps,IDENTIFIER='SaveViewsSelect_eps') oData_SaveViewsSelect_jpeg = OBJ_NEW('IDLitData',SaveViewsSelect_jpeg,IDENTIFIER='SaveViewsSelect_jpeg') oData_SaveViewsSelect_gif = OBJ_NEW('IDLitData',SaveViewsSelect_gif,IDENTIFIER='SaveViewsSelect_gif') oData_SaveViewsFileId_eps = OBJ_NEW('IDLitData',SaveViewsFileId_eps,IDENTIFIER='SaveViewsFileId_eps') oData_SaveViewsFileId_jpeg = OBJ_NEW('IDLitData',SaveViewsFileId_jpeg,IDENTIFIER='SaveViewsFileId_jpeg') oData_SaveViewsFileId_gif = OBJ_NEW('IDLitData',SaveViewsFileId_gif,IDENTIFIER='SaveViewsFileId_gif') oData_xpos2DSlicePosition = OBJ_NEW('IDLitData',xpos2DSlicePosition,IDENTIFIER='xpos2DSlicePosition') oData_IsoSurfaceTransparency = OBJ_NEW('IDLitData',IsoSurfaceTransparency,IDENTIFIER='IsoSurfaceTransparency') oData_IsoSurfaceShininess = OBJ_NEW('IDLitData',IsoSurfaceShininess,IDENTIFIER='IsoSurfaceShininess') oData_VectorFieldConfig = OBJ_NEW('IDLitData',VectorFieldConfig,IDENTIFIER='VectorFieldConfig') oData_VectorFieldScale = OBJ_NEW('IDLitData',VectorFieldScale,IDENTIFIER='VectorFieldScale') oData_AmrLevels = OBJ_NEW('IDLitData',AmrLevels,IDENTIFIER='AmrLevels') ;oData_MeshIJKboundaries = OBJ_NEW('IDLitData',MeshIJKboundaries,IDENTIFIER='MeshIJKboundaries') oData_Endian = OBJ_NEW('IDLitData',Endian,IDENTIFIER='Endian') oData_ParticlesSampling = OBJ_NEW('IDLitData',ParticlesSampling,IDENTIFIER='ParticlesSampling') oData_ImageToggle = OBJ_NEW('IDLitData',ImageToggle,IDENTIFIER='ImageToggle') oData_xydim = OBJ_NEW('IDLitData',xydim,IDENTIFIER='xydim') oData_eye = OBJ_NEW('IDLitData',eye,IDENTIFIER='eye') oData_datanames = OBJ_NEW('IDLitData',datanames,IDENTIFIER='datanames') oData_AshFileName = OBJ_NEW('IDLitData',AshFileName,IDENTIFIER='AshFileName') oData_AshFilePath = OBJ_NEW('IDLitData',AshFilePath,IDENTIFIER='AshFilePath') oData_PolygonVarID = OBJ_NEW('IDLitData',PolygonVarID,IDENTIFIER='PolygonVarID') oData_PolygonID = OBJ_NEW('IDLitData',PolygonID,IDENTIFIER='PolygonID') oData_PolygonNMAX = OBJ_NEW('IDLitData',PolygonNMAX,IDENTIFIER='PolygonNMAX') oData_PolygonNTOT = OBJ_NEW('IDLitData',PolygonNTOT,IDENTIFIER='PolygonNTOT') oData_SeedPickup = OBJ_NEW('IDLitData',SeedPickup,IDENTIFIER='SeedPickup') oData_taskFarmingarrays = OBJ_NEW('IDLitData',taskFarmingarrays,IDENTIFIER='taskFarmingarrays') oData_taskFarmingServer = OBJ_NEW('IDLitData',Server,IDENTIFIER='Server') oData_taskFarmingWorker = OBJ_NEW('IDLitData',Worker,IDENTIFIER='Worker') oData_taskFarmingNworkers = OBJ_NEW('IDLitData',Nworkers,IDENTIFIER='Nworkers') oData_StreamlinesMaxIter = OBJ_NEW('IDLitData',StreamlinesMaxIter,IDENTIFIER='StreamlinesMaxIter') oData_MultiGridSize = OBJ_NEW('IDLitData',MultiGridSize,IDENTIFIER='MultiGridSize') oData_MultiGridPosition = OBJ_NEW('IDLitData',MultiGridPosition,IDENTIFIER='MultiGridPosition') oData_nmaxPolygons = OBJ_NEW('IDLitData',nmaxPolygons,IDENTIFIER='nmaxPolygons') oData_MemoryManagement = OBJ_NEW('IDLitData',MemoryManagement,IDENTIFIER='MemoryManagement') oData_VolumeOpacity = OBJ_NEW('IDLitData',VolumeOpacity,IDENTIFIER='VolumeOpacity') oData_vColors = OBJ_NEW('IDLitData',vColors,IDENTIFIER='vColors') oData_vColors_orig = OBJ_NEW('IDLitData',vColors_orig,IDENTIFIER='vColors_orig') oData_MovieFrameCURRENT = OBJ_NEW('IDLitData',MovieFrameCURRENT,IDENTIFIER='MovieFrameCURRENT') oData_MoviePolylines = OBJ_NEW('IDLitData',MoviePolylines,IDENTIFIER='MoviePolylines') oData_MovieFrameNMAX = OBJ_NEW('IDLitData',MovieFrameNMAX,IDENTIFIER='MovieFrameNMAX') oData_version_format_hdf5 = OBJ_NEW('IDLitData',version_format_hdf5,IDENTIFIER='version_format_hdf5') oData_droplist_select = OBJ_NEW('IDLitData',droplist_select,IDENTIFIER='droplist_select') oData_sensitive = OBJ_NEW('IDLitData',sensitive,IDENTIFIER='sensitive') oData_AMRoctreeGrid = OBJ_NEW('IDLitData',AMRoctreeGrid,IDENTIFIER='AMRoctreeGrid') oData_AMRoctreeHydro = OBJ_NEW('IDLitData',AMRoctreeHydro,IDENTIFIER='AMRoctreeHydro') oData_AMRoctreePart = OBJ_NEW('IDLitData',AMRoctreePart,IDENTIFIER='AMRoctreePart') oData_AMRoctreeCurrent = OBJ_NEW('IDLitData',AMRoctreeCurrent,IDENTIFIER='AMRoctreeCurrent') oData_AMRoctreeCpuBoxCurrent = OBJ_NEW('IDLitData',AMRoctreeCpuBoxCurrent,IDENTIFIER='AMRoctreeCpuBoxCurrent') oData_AMRoctreeVarHydro = OBJ_NEW('IDLitData',AMRoctreeVarHydro,IDENTIFIER='AMRoctreeVarHydro') oData_AMRoctreeAmrHydroLmaxRead= OBJ_NEW('IDLitData',AMRoctreeAmrHydroLmaxRead,IDENTIFIER='AMRoctreeAmrHydroLmaxRead') oData_Polylines = OBJ_NEW('IDLitData',polylines, IDENTIFIER='polylines') oData_PolylinesPlanes = OBJ_NEW('IDLitData',polylinesPlanes, IDENTIFIER='polylinesPlanes') oData_PolylinesPlanes = OBJ_NEW('IDLitData',polylinesPlanes, IDENTIFIER='polylinesPlanes') oData_xyzrot = OBJ_NEW('IDLitData',xyzrot, IDENTIFIER='xyzrot') oData_counterImage = OBJ_NEW('IDLitData',counterImage, IDENTIFIER='counterImage') oData_saveImage = OBJ_NEW('IDLitData',saveImage, IDENTIFIER='saveImage') counterImage=0 result = oData_counterImage->SetData(counterImage) ; 0 is Master, 1 is set by sds ontrol file (a priori on) saveImage=intarr(2) saveImage[0]=0 saveImage[1]=1 result = oData_saveImage->SetData(saveImage) result = oData_Polylines->SetData(polylines) result = oData_PolylinesPlanes->SetData(polylinesPlanes) AMRoctreeCurrent=intarr(4) ; 0 is amr ; 1 is hydro ; 2 is part ; 3 is part velocity and density AMRoctreeCurrent[*]=-1 result = oData_AMRoctreeCurrent->SetData(AMRoctreeCurrent) AMRoctreeCpuBoxCurrent=0 result = oData_AMRoctreeCpuBoxCurrent->SetData(AMRoctreeCpuBoxCurrent) AMRoctreeVarHydro=[1,1] result = oData_AMRoctreeVarHydro->SetData(AMRoctreeVarHydro) AMRoctreeAmrHydroLmaxRead = -1 result=oData_AMRoctreeAmrHydroLmaxRead->SetData(AMRoctreeAmrHydroLmaxRead) result=oData_MovieFrameCURRENT->SetData(MovieFrameCURRENT) result=oData_MovieFrameNMAX->SetData(MovieFrameNMAX) oVolumeDum=OBJ_NEW('IDLgrVolume',HIDE=1,ALPHA_CHANNEL=1.,ZERO_OPACITY_SKIP=1,/ZBUFFER, $ RGB_TABLE0=vColors,HINTS=2,COMPOSITE_FUNCTION=composite_function,/NO_COPY,$ RENDER_STEP=[1,1,1],/REGISTER_PROPERTIES,DESCRIPTION='volume object') oVolumeDum->GetProperty,OPACITY_TABLE0=Opac result=oData_VolumeOpacity->SetData(Opac) result=oData_vColors->SetData(vColors) result=oData_vColors_orig->SetData(vColors) taskFarmingarrays=[0,0] result=oData_taskFarmingarrays->SetData(taskFarmingarrays) result=oData_taskFarmingServer->SetData('localhost') result=oData_taskFarmingWorker->SetData('localhost') result=oData_taskFarmingNworkers->SetData(8) MemoryManagement=[0,0,0,0] result=oData_MemoryManagement->SetData(MemoryManagement) result=oData_StreamlinesMaxIter->SetData(MaxIterationsStreamlines[0]) result=oData_nmaxPolygons->SetData(400000) ; datanames=' ' ; FillArraysHDF=-1 ; fourdim=-1 nvar=15 datanames=STRARR([nvar]) fourdim=INTARR([nvar]) FillArraysHDF=INTARR([nvar]) FillArraysHDF(*)=0 result=oData_datanames->SetData(datanames) dumnames=' ' result=oData_AshFileName->SetData(dumnames) ashpath='./' result=oData_AshFilePath->SetData(ashpath) result=oData_DataDimHDF->SetData(fourdim) result=oData_FillArraysHDF->SetData(FillArraysHDF) Plotx=0 result=oData_Plotx->SetData(Plotx) ;v3D=make_array([2],[2],[2]) ;result=oData_varData3D->SetData(v3d) iflag_vue=make_array([4]) iflag_vue[0]=4 ; used for 3D scalar : 1, surface/image/plot ; 2, project volume (obsolete) ; 3, voxel project (obsolete) ; 4, isosurface/histogram ; 5, volume object ; 6, image 3D iflag_vue[1]=1 ; used for 3D vector : 1, arrows ; 2, streamlines iflag_vue[2]=0 ; used for Particles : 1, spheres iflag_vue[3]=0 ; used for Geometry : 1, bounds ; 2, axis ; 3, domains ; 4, amr result=oData_vue->SetData(iflag_vue) flag=0 result=oData_flag->SetData(flag) result=oData_xyzplane->SetData(xyzplane) ;;;;;;;;;;;;;;;;;;;; DATA REDUCTION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; DataReduction=0 RebinData=[20,20,20] ;result=oData_ProjectVolIntensity->SetData(ProjectVolIntensity) ;result=oData_ProjectVolResolution->SetData(ProjectVolResolution) ;result=oData_ProjectVolSamples->SetData(ProjectVolSamples) ;result=oData_ProjectVolDepthQueuing->SetData(ProjectVolDepthQueuing) ;result=oData_ProjectVolOpacity->SetData(ProjectVolOpacity) result=oData_ScalarLinLog->SetData(ScalarLinLog) ;result=oData_SurfaceAxis->SetData(SurfaceAxis) ;result=oData_SurfaceLog->SetData(SurfaceLog) result=oData_ProcessorId->SetData(ProcessorId) result=oData_SimuStepOutput->SetData(SimuStepOutput) result=oData_SimuStepReprise->SetData(SimuStepReprise) result=oData_DataReduction->SetData(DataReduction) result=oData_RebinData->SetData(RebinData) result=oData_FillArrays->SetData(FillArrays) result=oData_RamsesFillArrays->SetData(RamsesFillArrays) result=oData_DataFormat->SetData(DataFormat) result=oData_OptionsArray->SetData(OptionsArray) result=oData_FileId->SetData(FileId) result=oData_IsoSurfaceTransparency->SetData(IsoSurfaceTransparency) result=oData_IsoSurfaceShininess->SetData(IsoSurfaceShininess) result=oData_VectorFieldConfig->SetData(VectorFieldConfig) result=oData_VectorFieldScale->SetData(VectorFieldScale) result=oData_AmrLevels->SetData(AmrLevels) ;result=oData_MeshIJKboundaries->SetData(MeshIJKboundaries) result=oData_Endian->SetData(Endian) result=oData_ParticlesSampling->SetData(ParticlesSampling) ;result=oData_ParticlesSize->SetData(ParticlesSize) result=oData_ImageToggle->SetData(ImageToggle) result=oData_eye->SetData(eye) ;result=oData_VoxelStep->SetData(VoxelStep) ;result=oData_VoxelSampling->SetData(VoxelSampling) ;result=oData_VoxelIntensity->SetData(VoxelIntensity) GridDim=intarr(8) result=oData_GridDim->SetData(GridDim) GridSize=dblarr(6) GridSize[[1,3,5]] = 1. result=oData_GridSize->SetData(GridSize) JobName=' ' result=oData_JobName->SetData(JobName) result=oData_OutputReprise->SetData(OutputReprise) nbuf=0 result=oData_nbuf->SetData(nbuf) ImageProfile=0 result=oData_ImageProfile->SetData(ImageProfile) ; result=oData_IsoPlot->SetData(IsoPlot) result=oData_DMDensityPlot->SetData(DMDensityPlot) HistoLog=0 result=oData_HistoLog->SetData(HistoLog) SaveViewsSelect=intarr(7,3) ; there are 7 views defined for 3 formats SaveViewsSelect[*,*]=0 result=oData_SaveViewsSelect_eps->SetData(SaveViewsSelect) result=oData_SaveViewsSelect_jpeg->SetData(SaveViewsSelect) result=oData_SaveViewsSelect_gif->SetData(SaveViewsSelect) SaveViewsFileId=['ViewSurface', $ 'ViewImage', $ 'ViewProfilePlot', $ 'ViewProjectVolume', $ 'ViewVoxelProject', $ 'ViewIsosurface', $ 'ViewHistogram' ] SaveViewsFileId_eps=SaveViewsFileId+'.eps' result=oData_SaveViewsFileId_eps->SetData(SaveViewsFileId_eps) SaveViewsFileId_jpeg=SaveViewsFileId+'.jpeg' result=oData_SaveViewsFileId_jpeg->SetData(SaveViewsFileId_jpeg) SaveViewsFileId_gif=SaveViewsFileId+'.gif' result=oData_SaveViewsFileId_gif->SetData(SaveViewsFileId_gif) ;result=oData_threeDVecLog->SetData(threeDVecLog) result=oData_xpos2DSlicePosition->SetData(xpos2DSlicePosition) CD, '.', CURRENT=InitialDir result=oData_InitialDir->SetData(InitialDir) result=oData_DataDir->SetData(InitialDir) ;print,'InitialDir=',InitialDir xTitleObj = Obj_New('IDLgrText', 'x', COLOR=[200,255,255]) yTitleObj = Obj_New('IDLgrText', 'y', COLOR=[200,255,255]) zTitleObj = Obj_New('IDLgrText', 'z', COLOR=[200,255,255]) xaxis1 = Obj_New("IDLgrAxis", 0, Color=[0,0,255], Ticklen=0.1, $ Minor=4, Title=xtitleObj, Exact=Keyword_Set(exact)) yaxis1 = Obj_New("IDLgrAxis", 1, Color=[0,0,255], Ticklen=0.1, $ Minor=4, Title=ytitleObj, Exact=Keyword_Set(exact)) zaxis1 = Obj_New("IDLgrAxis", 2, Color=[0,0,255], Ticklen=0.1, $ Minor=4, Title=ztitleObj, Exact=Keyword_Set(exact)) oTranslationModel->Add, xaxis1 oTranslationModel->Add, yaxis1 oTranslationModel->Add, zaxis1 xaxis1->SetProperty, HIDE=1 yaxis1->SetProperty, HIDE=1 zaxis1->SetProperty, HIDE=1 xTitleObj3D = Obj_New('IDLgrText', ' x', $ COLOR=[200,255,255]) yTitleObj3D = Obj_New('IDLgrText', ' y', COLOR=[200,255,255]) zTitleObj3D = Obj_New('IDLgrText', ' z', COLOR=[200,255,255]) xaxis3D = Obj_New("IDLgrAxis", 0, Color=[0,0,255], Ticklen=0.1, $ Minor=4, Title=xtitleObj3D, Exact=1,HIDE=1,DEPTH_WRITE_DISABLE=1) yaxis3D = Obj_New("IDLgrAxis", 1, Color=[0,0,255], Ticklen=0.1, $ Minor=4, Title=ytitleObj3D, Exact=1,HIDE=1) zaxis3D = Obj_New("IDLgrAxis", 2, Color=[0,0,255], Ticklen=0.1, $ Minor=4, Title=ztitleObj3D, Exact=1,HIDE=1) oModelObjects3D->Add, xaxis3D oModelObjects3D->Add, yaxis3D oModelObjects3D->Add, zaxis3D ;;;;;;;;;;;oModelObjects3D->Add, oImage3D ;otext3 = OBJ_NEW('idlgrtext', '0', LOCATION=[0.,0.,0.], COLOR=[200,255,255]) ;otext4 = OBJ_NEW('idlgrtext', 'A', LOCATION=[0.5,0.,0.], COLOR=[200,255,255]) ;otext5 = OBJ_NEW('idlgrtext', 'B', LOCATION=[0.,0.5,0.], COLOR=[200,255,255]) ;otext6 = OBJ_NEW('idlgrtext', 'C', LOCATION=[0.5,0.5,0.], COLOR=[200,255,255]) ;otext7 = OBJ_NEW('idlgrtext', 'L', LOCATION=[0., 0., 0.5], COLOR=[200,255,255]) ;oModelObjects3D->Add, otext3 ;oModelObjects3D->Add, otext4 ;oModelObjects3D->Add, otext5 ;oModelObjects3D->Add, otext6 ;oModelObjects3D->Add, otext7 ;oModelObjects3D->Rotate, [1,0,0], xRot ;oModelObjects3D->Rotate, [0,1,0], yRot ; Create objects for the vector field Polygons ; oModelVectorField = OBJ_NEW('IDLgrModel') ;oVectorFieldPolygon = OBJ_NEW('IDLgrPolygon', Color=[0,0,205], Shading=1) ;oVectorFieldSymbol = OBJ_NEW('IDLgrSymbol', oVectorFieldPolygon) ;oVectorField = OBJ_NEW('IDLgrPolyline', Color=[0,0,205]) oVectorField = OBJ_NEW('IDLgrPolyline', Color=[255,255,255], HIDE=1) oStreamlines = OBJ_NEW('IDLgrPolyline', Color=[255,255,255], HIDE=1) ;oModelVectorField->Add,oVectorFieldPolygon oModelVectorField->Add,oVectorField oModelVectorField->Add,oStreamlines ;oModelObjects3D ->Add,oModelVectorField ; Create objects for the dark matter particles ; oOrb = OBJ_NEW('orb',color=[255,0,0],radius=ParticlesSize, $ ;shading=1, $ select_target=1 $ ) ;oSymbol = OBJ_NEW('IDLgrSymbol', oOrb) oSymbolDot = OBJ_NEW('IDLgrSymbol', DATA=3,SIZE=ParticlesSize,color=[255,0,0]) ;oSymbolDot2 = OBJ_NEW('IDLgrSymbol', DATA=3,SIZE=ParticlesSize,color=[0,0,255]) oSymbolOrb = OBJ_NEW('IDLgrSymbol', oOrb) oModelParticles = OBJ_NEW('IDLgrModel') oParticles=OBJARR(2) oParticles[0] = OBJ_NEW('IDLgrPolyline',Color=[255,255,255],LINESTYLE=6,SYMBOL=oSymbolDot,$ /REGISTER_PROPERTIES,DESCRIPTION='Dark Matter particle cloud') oParticles[1] = OBJ_NEW('IDLgrPolyline',Color=[255,255,255],LINESTYLE=6,SYMBOL=oSymbolDot,$ /REGISTER_PROPERTIES,DESCRIPTION='Dark Matter particle cloud 2') oParticles[0]->SetProperty,DEPTH_TEST_DISABLE=1 oParticles[1]->SetProperty,DEPTH_TEST_DISABLE=1 ;oParticles->RegisterProperty,'DEPTH_TEST_DISABLE',1 ;oParticles->RegisterProperty,'DEPTH_TEST_FUNCTION',1 oModelParticles->Add,oParticles[0] oModelParticles->Add,oParticles[1] ; Create objects for the Isosurface Polygons ; oModelPolygon = OBJ_NEW('IDLgrModel') PolygonVarID=0 ; current variable ID (rho,E,...) PolygonVarNMAX=10 ; max number PolygonID=INTARR(PolygonVarNMAX) PolygonID[PolygonVarID]=0 ; current iso ID (for multiple isosurface) PolygonNMAX=10 ; max number PolygonNTOT=INTARR(PolygonVarNMAX) ; total number PolygonNTOT[*]=1 oPolygon = OBJARR(PolygonVarNMAX,PolygonNMAX,MovieFrameNMAX) ; MovieFrame index for movie making ; for j=0,PolygonNMAX-1 do begin ; for k=0,MovieFrameNMAX-1 do begin ; oPolygon[j,k] = OBJ_NEW('IDLgrPolygon', Color=[0,0,205], Shading=1, ALPHA_CHANNEL=1.,/REGISTER_PROPERTIES $ ; ;/DEPTH_WRITE_DISABLE $ ; ) ; oModelPolygon->Add,oPolygon[j,k] ;,/ALIAS ; endfor ; endfor result=oData_PolygonVarID->SetData(PolygonVarID) result=oData_PolygonID->SetData(PolygonID) result=oData_PolygonNMAX->SetData(PolygonNMAX) result=oData_PolygonNTOT->SetData(PolygonNTOT) IsoPlot=fltarr(PolygonNMAX) result=oData_IsoPlot->SetData(IsoPlot) ;a=oPolygon[0,0:MovieFrameNMAX-1] ;; a=oPolygon(0,0:1) ;; SAVE,MovieFrameNMAX,a,filename='test0.sav' oLightPolygon =OBJARR([8]) oLightPolygon[0] = OBJ_NEW('idlgrLight',TYPE=0,INTENSITY=0.2) ; ambient oLightPolygon[1] = OBJ_NEW('IDLgrLight',TYPE=2,INTENSITY=1,LOCATION=[0, 0,10],DIRECTION=[ 0,0,-1]) ; front oLightPolygon[2] = OBJ_NEW('IDLgrLight',TYPE=2,INTENSITY=1,LOCATION=[10,0,0], DIRECTION=[-1,0, 0]) ; right oLightPolygon[3] = OBJ_NEW('IDLgrLight',TYPE=2,INTENSITY=1,LOCATION=[0,-10,0],DIRECTION=[ 0,1, 0]) ; bottom oLightPolygon[4] = OBJ_NEW('IDLgrLight',TYPE=2,INTENSITY=1,LOCATION=[0, 0,-10],DIRECTION=[ 0,0,1],HIDE=1) ; back oLightPolygon[5] = OBJ_NEW('IDLgrLight',TYPE=2,INTENSITY=1,LOCATION=[-10,0,0], DIRECTION=[1,0, 0],HIDE=1) ; left oLightPolygon[6] = OBJ_NEW('IDLgrLight',TYPE=2,INTENSITY=1,LOCATION=[0,10,0],DIRECTION=[ 0,-1, 0],HIDE=1) ; top oLightPolygon[7] = OBJ_NEW('IDLgrLight',TYPE=1,INTENSITY=1,LOCATION=[0,0,0],HIDE=1) ; positional centered oStaticModel3D->Add, oLightPolygon[0] oStaticModel3D->Add, oLightPolygon[1] oStaticModel3D->Add, oLightPolygon[2] oStaticModel3D->Add, oLightPolygon[3] oStaticModel3D->Add, oLightPolygon[4] oStaticModel3D->Add, oLightPolygon[5] oStaticModel3D->Add, oLightPolygon[6] oStaticModel3D->Add, oLightPolygon[7] ;oModelPolygon->Add, oImage3D ;oModelPolygon->Add,oPolygon[PolygonID] oModelObjects3D ->Add,oModelBounds oModelObjects3D ->Add,oModelVolume oModelObjects3D->Add, oMovieModel ;;AMR objects oModelObjects3D ->Add,oModelParticles oModelObjects3D ->Add,oModelVectorField oModelObjects3D ->Add,oModelPolygon oModelObjects3D ->Add,oModelImage3D ;oImage3D->GetProperty,DEPTH_TEST_DISABLE=depth_test_disable,$ ; DEPTH_TEST_FUNCTION =depth_test_function,$ ; DEPTH_WRITE_DISABLE=depth_write_disable ;print,'oImage3D ->',depth_test_disable,depth_test_function,depth_write_disable ; ;oPolygon[0]->GetProperty,DEPTH_TEST_DISABLE=depth_test_disable,$ ; DEPTH_TEST_FUNCTION =depth_test_function,$ ; DEPTH_WRITE_DISABLE=depth_write_disable ;print,'oPolygon[0] ->',depth_test_disable,depth_test_function,depth_write_disable ;oMpeg = 0 ;print,'MPEG facilities off' ; oMpeg = OBJ_NEW('IDLgrMpeg',FILENAME='SDvision.mpg', $ ; FORMAT=0, $ ; BITRATE=104857200, $ ; /STATISTICS) ;oMpeg = OBJARR(1) oData_Mpeg = OBJ_NEW('IDLitData',Mpeg,IDENTIFIER='Mpeg') oData_mpegFlag = OBJ_NEW('IDLitData',mpegFlag,IDENTIFIER='mpegFlag') mpegFlag=0 result=oData_mpegFlag->SetData(mpegFlag) ;oPrinter = OBJ_NEW('IDLgrPrinter') oClipboard = OBJ_NEW('IDLgrClipboard') Geometry=WIDGET_INFO(wTopBase, /GEOMETRY) ;help,Geometry,/struct xydim[2]= Geometry.SCR_XSIZE-xydim[0] xydim[3]= Geometry.SCR_YSIZE-xydim[1] result=oData_xydim->SetData(xydim) strArrayCursor = [ $ ' ### ', $ ' # ', $ ' # ', $ ' # ', $ ' # ', $ ' . ', $ '# . # ', $ '#####..$..##### ', $ '# . # ', $ ' . ', $ ' # ', $ ' # ', $ ' # ', $ ' # ', $ ' ### ', $ ' '] cursor_image = CREATE_CURSOR(strArrayCursor, HOTSPOT=hotspot, MASK=cursor_mask) REGISTER_CURSOR, 'translate', cursor_image, HOTSPOT=hotspot, MASK=cursor_mask ,/OVERWRITE ;;;;;;;; non-transformed text in the 3D Scene oSceneText = OBJARR(10) scaleText=[0.069,0.025,0.04] pos=[0.,0.03] oSceneText[0] = OBJ_NEW("IDLgrText",'SDvision',Color=[200,200,200],CHAR_DIMENSIONS=[1.,1.],ALIGNMENT=0.5,$ /REGISTER_PROPERTIES, HIDE=hide_version,$ xcoord_conv=[pos[0],scaleText[0]],ycoord_conv=[pos[1],scaleText[0]]) pos=[0.,-0.01] oSceneText[1] = OBJ_NEW("IDLgrText",'version '+SDversion,Color=[200,200,200],CHAR_DIMENSIONS=[1.,1.],ALIGNMENT=0.5,$ /REGISTER_PROPERTIES, HIDE=hide_version,$ xcoord_conv=[pos[0],scaleText[1]],ycoord_conv=[pos[1],scaleText[1]]) pos=[-0.485,0.45] oSceneText[2] = OBJ_NEW("IDLgrText",'AMR Level XX',Color=[255,255,255],CHAR_DIMENSIONS=[1.,1.],$ /REGISTER_PROPERTIES, HIDE=1,DEPTH_TEST_DISABLE=1,$ xcoord_conv=[pos[0],scaleText[2]],ycoord_conv=[pos[1],scaleText[2]]) scaleText=0.02 pos=[-0.5,0.1] oSceneText[3] = OBJ_NEW("IDLgrText",'AMR Level 2',Color=[200,200,200],CHAR_DIMENSIONS=[1.,1.],$ /REGISTER_PROPERTIES,$ xcoord_conv=[pos[0],scaleText],ycoord_conv=[pos[1],scaleText]) ;oResizeableModel3D->add,oSceneText[0] ;oResizeableModel3D->add,oSceneText[1] ;oResizeableModel3D->add,oSceneText[2] oMasterModel3D->add,oSceneText[0] oMasterModel3D->add,oSceneText[1] oMasterModel3D->add,oSceneText[2] ;;;;;;;; INITIALIZATION OF THE SUB-WIDGETS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; title='Colors and Opacity Tables' wCOTBase = WIDGET_BASE(TITLE=title, $ /COLUMN, XPAD=1, YPAD=3, SPACE=1) result=oData_VolumeOpacity->GetData(Opac) ;oPaletteImage = Obj_New('IDLgrPalette') oPaletteImage->LoadCT, 1 oPaletteImage->GetProperty, Red=r, Blue=b, Green=g vColors = BYTARR(256,3,/NOZERO) vColors[*,0]=r vColors[*,1]=g vColors[*,2]=b oPaletteImage->LoadCT, 13 ColorAndOpacityTablesWidget, $ MovieFrameCURRENT, $ vColors, $ Opac, $ wCOTBase, $ wDrawCOT, $ oViewCOT, $ oPlotCOT, $ wPaletteName, $ wPalettesbot, $ wPalettestop, $ wPalettes_gamma_label, $ wPalettes_gamma, $ oViewCB, $ oCB, $ wDrawColorBar, $ wZeroOpacityMin, $ wZeroOpacityMax, $ wHVRlutFileName, $ wSDvislutFileName, $ wCOTsliderList, $ wCOTsliderGroup, $ wCOTslider, $ wCOTsliderChannel, $ wCOTsliderValue, $ wDrawData, $ oViewVolumeData, $ oPlotVolumeData, $ xAxisVolumeDataB, $ xAxisVolumeDataT, $ yAxisVolumeDataL, $ yAxisVolumeDataR ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; wObjectControlBase = WIDGET_BASE(TITLE='Data Objects control', $ /COLUMN, XPAD=1, YPAD=1, SPACE=1) ObjectControlWidget, $ GridDim, $ datanames, $ FillArraysHDF, $ fourdim, $ wObjectControlBase, $ wObjectControlDisplayHDF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; wGeometryObjectControlBase = WIDGET_BASE(TITLE='Geometry Objects control', $ ;GROUP_LEADER=wTopBase,$ /COLUMN, XPAD=1, YPAD=1, SPACE=1) ;result= sState.oData_geometryControlInfo->GetData(geometryControlInfo) ; to know if the geometry object is hide or not ; 0 to bounds ; 1 to axis ; 2 to domains ; 3 to amr geometryControlInfo = intarr(4) geometryControlInfo[0] = 0 geometryControlInfo[1] = 0 geometryControlInfo[2] = 0 geometryControlInfo[3] = 0 nxg=0 GeometryObjectControlWidget, $ wGeometryObjectControlBase, $ nxg, $ DataFormat, $ wObjectControlDisplayBounds, $ wObjectControlConfigureBounds , $ wObjectControlDisplayAxis , $ wObjectControlConfigureAxis , $ wObjectControlDisplayDomains , $ wObjectControlConfigureDomains, $ wObjectControlGenerateAMR, $ wObjectControlDisplayAMR, $ wObjectControlConfigureAMR, $ geometryControlInfo oData_geometryControlInfo = OBJ_NEW('IDLitData',geometryControlInfo, IDENTIFIER='geometryControlInfo') ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; wDefineVueBase = WIDGET_BASE(TITLE='View properties', $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) xRot = -60 yRot = 20 zRot = 0 xyzrot=fltarr(3) & xyzrot[0]=xRot & xyzrot[1]=yRot & xyzrot[2]=zRot result=oData_xyzrot->SetData(xyzrot) DefineVueWidget,eye,xyzrot, $; xRot,yRot,zRot, $ wDefineVueBase, $ wDefineVueEyeBase, $ wDefineVueNearBase, $ wDefineVueFarBase, $ wDefineVueZBright, $ wDefineVueZDim, $ ;wDefineVueLabel, $ wXSlider, $ wYSlider, $ wZSlider WIDGET_CONTROL, wXSlider, SET_VALUE=xRot WIDGET_CONTROL, wYSlider, SET_VALUE=yRot WIDGET_CONTROL, wZSlider, SET_VALUE=zRot ; Rotate the original display. ; oRotationModel->Rotate, [1,0,0], xRot oRotationModel->Rotate, [0,1,0], yRot oRotationModel3D->Rotate, [1,0,0], xRot oRotationModel3D->Rotate, [0,1,0], yRot ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; wDefineMovieBase = WIDGET_BASE(TITLE='Movie control interface', $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) maxVue=200 saveScaleVue = fltarr(maxVue) saveTranslateVue = fltarr(2,maxVue) saveTranslatePivotVue = fltarr(maxVue) saveTransform = fltarr(4,4,maxVue) saveTransformRot = fltarr(4,4,maxVue) saveLevelVue = fltarr(2,maxVue) saveOutputNumber = fltarr(maxVue) saveNumberSteps = fltarr(maxVue) cptVue = 0 saveMeshIJKBoundaries = fltarr(6,maxVue) saveLevels = fltarr(2,maxVue) oData_saveScaleVue = OBJ_NEW('IDLitData',saveScaleVue, IDENTIFIER='saveScaleVue') oData_saveTranslateVue = OBJ_NEW('IDLitData',saveTranslateVue, IDENTIFIER='saveTranslateVue') oData_saveTranslatePivotVue = OBJ_NEW('IDLitData',saveTranslatePivotVue, IDENTIFIER='saveTranslatePivotVue') oData_saveTransform = OBJ_NEW('IDLitData',saveTransform, IDENTIFIER='saveTransform') oData_saveTransformRot = OBJ_NEW('IDLitData',saveTransformRot, IDENTIFIER='saveTransformRot') oData_saveLevelVue = OBJ_NEW('IDLitData',saveLevelVue, IDENTIFIER='saveLevelVue') oData_saveOutputNumber = OBJ_NEW('IDLitData',saveOutputNumber, IDENTIFIER='saveOutputNumber') oData_saveNumberSteps = OBJ_NEW('IDLitData',saveNumberSteps, IDENTIFIER='saveNumberSteps') oData_cptVue = OBJ_NEW('IDLitData',cptVue, IDENTIFIER='cptVue') oData_saveMeshIJKBoundaries = OBJ_NEW('IDLitData',saveMeshIJKBoundaries, IDENTIFIER='saveMeshIJKBoundaries') oData_saveLevels = OBJ_NEW('IDLitData',saveLevels, IDENTIFIER='saveLevels') DefineMovieWidget, $ wDefineMovieBase, $ wDefineMovieStart, $ wDefineMovieEnd, $ wDefineMovieStep, $ ;wDefineMovieFrameInterval, $ wSequenceObjectsFileName, $ wSequenceFileName, $ wSequenceFileName2, $ wAnimateRate, $ wAnimateAdvance, $ wAnimateStepF, $ wAnimateStepB, $ wPlay_sequence_and_save, $ saveOutputNumber, $ saveNumberSteps, $ cptVue, $ wMovieWidgetConfig, $ wNumberVueLabel oData_wMovieWidgetConfig= OBJ_NEW('IDLitData',wMovieWidgetConfig, IDENTIFIER='wMovieWidgetConfig') oData_wNumberVueLabel = OBJ_NEW('IDLitData',wNumberVueLabel, IDENTIFIER='wNumberVueLabel') result = oData_cptVue->SetData(cptVue) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; wImageSequenceBase = WIDGET_BASE(TITLE='Sequence of output images', $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) oData_imagesequenceWidgets = OBJ_NEW('IDLitData',imagesequenceWidgets, IDENTIFIER='imagesequenceWidgets') imagesequenceWidgets=lonarr(12) DefineImageSequenceWidget, $ wImageSequenceBase, $ imagesequenceWidgets, $ counterImage result=oData_imagesequenceWidgets->SetData(imagesequenceWidgets) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; wSaveViewBaseEps = WIDGET_BASE(TITLE='Save view to postscript',/COLUMN,XPAD=1,YPAD=5,SPACE=1) wSaveViewBaseJpg = WIDGET_BASE(TITLE='Save view to jpeg',/COLUMN,XPAD=1,YPAD=5,SPACE=1) wSaveViewBaseGif = WIDGET_BASE(TITLE='Save view to gif',/COLUMN,XPAD=1,YPAD=5,SPACE=1) oData_saveviewWidgetsEps = OBJ_NEW('IDLitData',saveviewWidgetsEps, IDENTIFIER='saveviewWidgetsEps') oData_saveviewWidgetsJpg = OBJ_NEW('IDLitData',saveviewWidgetsJpg, IDENTIFIER='saveviewWidgetsJpg') oData_saveviewWidgetsGif = OBJ_NEW('IDLitData',saveviewWidgetsGif, IDENTIFIER='saveviewWidgetsGif') CreateSaveViewWidget,wSaveViewBaseEps,saveviewWidgetsEps,'eps' CreateSaveViewWidget,wSaveViewBaseJpg,saveviewWidgetsJpg,'jpg' CreateSaveViewWidget,wSaveViewBaseGif,saveviewWidgetsGif,'gif' result=oData_saveviewWidgetsEps->SetData(saveviewWidgetsEps) result=oData_saveviewWidgetsJpg->SetData(saveviewWidgetsJpg) result=oData_saveviewWidgetsGif->SetData(saveviewWidgetsGif) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; wDefineMpegBase = WIDGET_BASE(TITLE='MPEG control', $ /COLUMN, XPAD=15, YPAD=10, SPACE=1) oData_mpegParameters = OBJ_NEW('IDLitData',mpegParameters, IDENTIFIER='mpegParameters') mpegParameters=fltarr(10) oData_mpegWidgets = OBJ_NEW('IDLitData',mpegWidgets, IDENTIFIER='mpegWidgets') mpegWidgets =lonarr(15) oData_mpegSensitive = OBJ_NEW('IDLitData',mpegSensitive, IDENTIFIER='mpegSensitive') mpegSensitive =intarr(15) format=0 quality=50 bitrate=0 ; 104857200 framerate=5 motion_vec_length=0 iframe_gap=0 interlaced=0 mpegParameters[0]=format mpegParameters[1]=quality mpegParameters[2]=bitrate mpegParameters[3]=framerate mpegParameters[4]=motion_vec_length mpegParameters[5]=iframe_gap mpegParameters[6]=interlaced mpegSensitive(*)=0 mpegSensitive[10]=1 DefineMpegWidget, $ wDefineMpegBase, $ mpegWidgets, $ mpegParameters, $ mpegSensitive result=oData_mpegParameters->SetData(mpegParameters) result=oData_mpegSensitive->SetData(mpegSensitive) result=oData_mpegWidgets->SetData(mpegWidgets) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; drawWindowID3D->SetProperty,GRAPHICS_TREE=oView3D oObserver = OBJ_NEW('timer_observer') oObserver->SetProperty, oIMAGES=oModelPolygon drawWindowID3D->AddWindowEventObserver, oObserver drawWindowID3D->SetTimerInterval, 0.1 WIDGET_CONTROL, wAnimateRate, SET_VALUE=10 WIDGET_CONTROL, wAnimateAdvance, SET_VALUE=1 oObserver->SetProperty, INC=1 ;WIDGET_CONTROL, wTopBase, TIMER=1 ;;; initialization of sub-volume objects (Y. Fidaali) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; wBoundariesBase = WIDGET_BASE(TITLE='Boundaries control', $ /COLUMN, XPAD=1, YPAD=10, SPACE=1) MeshIJKboundaries=fltarr(6) wRamsesConfigBoundariesBase=LONARR(6) subAxisBoundaries=OBJARR(12) wRamsesConfigTranslate = LONARR(3) TranslateBoundaries = intarr(3) DiffMinMaxMemories = fltarr(3) scaleValue = 1. MeshIJKboundaries[0]=0. MeshIJKboundaries[1]=1. MeshIJKboundaries[2]=0. MeshIJKboundaries[3]=1. MeshIJKboundaries[4]=0. MeshIJKboundaries[5]=1. alpha=1. subAxisBoundaries[0] = Obj_New("IDLgrAxis",0,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[1] = Obj_New("IDLgrAxis",0,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[2] = Obj_New("IDLgrAxis",0,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[3] = Obj_New("IDLgrAxis",0,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[4] = Obj_New("IDLgrAxis",1,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[5] = Obj_New("IDLgrAxis",1,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[6] = Obj_New("IDLgrAxis",1,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[7] = Obj_New("IDLgrAxis",1,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[8] = Obj_New("IDLgrAxis",2,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[9] = Obj_New("IDLgrAxis",2,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[10] = Obj_New("IDLgrAxis",2,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) subAxisBoundaries[11] = Obj_New("IDLgrAxis",2,Color=[255,0,0],/NOTEXT,TICKLEN=0,HIDE=1,EXACT=1,ALPHA_CHANNEL=alpha) TranslateBoundaries[0] = 0 TranslateBoundaries[1] = 0 TranslateBoundaries[2] = 0 DiffMinMaxMemories[0] = 0 DiffMinMaxMemories[1] = 0 DiffMinMaxMemories[2] = 0 colorBoundarie = 1 DefineBoundariesWidget, $ wBoundariesBase, $ wRamsesXBoundariesBase, $ wRamsesYBoundariesBase, $ wRamsesZBoundariesBase, $ wRamsesConfigBoundariesBase, $ MeshIJKboundaries, $ oModelObjects3D, $ subAxisBoundaries, $ TranslateBoundaries, $ wRamsesConfigTranslate, $ wRamsesConfigScaleSlider, $ wRamsesConfigScaleValue, $ scaleValue, $ colorBoundarie oData_MeshIJKboundaries = OBJ_NEW('IDLitData',MeshIJKboundaries,IDENTIFIER='MeshIJKboundaries') MeshIJKStatus=intarr(10) MeshIJKStatus[*]=0 ; 0 => NOT DONE , 1 => DONE , 2 => TO DO MeshIJKStatus[0]=2 oData_MeshIJKStatus = OBJ_NEW('IDLitData',MeshIJKStatus,IDENTIFIER='MeshIJKStatus') oData_subAxisBoundaries = OBJ_NEW('IDLitData', subAxisBoundaries, IDENTIFIER='subAxisBoundaries') oData_scaleValue = OBJ_NEW('IDLitData', scaleValue, IDENTIFIER='scaleValue') oData_colorBoundarieValue = OBJ_NEW('IDLitData', colorBoundarie, IDENTIFIER='colorBoundarie') oModelObjects3D->Add, subAxisBoundaries[0] oModelObjects3D->Add, subAxisBoundaries[1] oModelObjects3D->Add, subAxisBoundaries[2] oModelObjects3D->Add, subAxisBoundaries[3] oModelObjects3D->Add, subAxisBoundaries[4] oModelObjects3D->Add, subAxisBoundaries[5] oModelObjects3D->Add, subAxisBoundaries[6] oModelObjects3D->Add, subAxisBoundaries[7] oModelObjects3D->Add, subAxisBoundaries[8] oModelObjects3D->Add, subAxisBoundaries[9] oModelObjects3D->Add, subAxisBoundaries[10] oModelObjects3D->Add, subAxisBoundaries[11] oWindowStereoEyes=OBJARR(2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; nxg=0 nyg=0 nzg=0 nproc=12 nprocmax=4096 xse=intarr(2,nprocmax) yse=intarr(2,nprocmax) zse=intarr(2,nprocmax) domains=OBJARR(3,4,nprocmax) DomainsCounter=0 oData_DomainsCounter = OBJ_NEW('IDLitData',DomainsCounter,IDENTIFIER='oDomainsData') result=oData_DomainsCounter->SetData(DomainsCounter) DomainsMaxNumber=1000 DomainsObject=objarr(DomainsMaxNumber) JupiterDomainsModel=obj_new('IDLgrModel',DEPTH_TEST_DISABLE=depth_disable,DEPTH_WRITE_DISABLE=depth_disable) oModelObjects3D->Add, JupiterDomainsModel xmin=0. & xmax=1. & ymin=0. & ymax=1. & zmin=0. & zmax=1. GeoStructure={ nxg:nxg , $ nyg:nyg , $ nzg:nzg , $ nproc:nproc , $ nprocmax:nprocmax , $ xse:xse , yse:yse , zse:zse , $ domains:domains , $ JupiterDomainsModel:JupiterDomainsModel , $ oData_DomainsCounter:oData_DomainsCounter , $ xmin:xmin,xmax:xmax,ymin:ymin,ymax:ymax,zmin:zmin,zmax:zmax $ } ; Create the info structure ; sState={ $ GeoStructure:GeoStructure, $ BtnDown: 0, $ ; mouse button down flag oTrackL: oTrackL, $ ; Trackball object oTrackM: oTrackM, $ ; Trackball object oTrackR: oTrackR, $ ; Trackball object cursor_image:cursor_image, $ ; cursor cursor_mask:cursor_mask, $ ; cursor DrawWindowID1: drawWindowID1, $ ; Window ID1 DrawWindowID2: drawWindowID2, $ ; Window ID2 DrawWindowID3: drawWindowID3, $ ; Window ID3 DrawWindowID3D: drawWindowID3D, $ ; Window ID3 DrawWindowIDIsoPlot:drawWindowIDIsoPlot, $; Window ID3 DrawWindowIDDMDensityPlot:drawWindowIDDMDensityPlot, $; Window ID3 WDraw1: wDraw1, $ ; Widget draw ID WDraw2: wDraw2, $ ; Widget draw ID WDraw3: wDraw3, $ ; Widget draw ID WDraw3D: wDraw3D, $ ; Widget draw ID WDrawIsoPlot: wDrawIsoPlot, $ ; Widget draw ID WDrawDMDensityPlot: wDrawDMDensityPlot, $ ; Widget draw ID oView1:oView1, $ ; View object oView2:oView2, $ ; View object oView3:oView3, $ ; View object oView3D:oView3D, $ ; View object oViewIsoPlot:oViewIsoPlot, $ ; View object oViewDMDensityPlot:oViewDMDensityPlot, $ ; View object oData_varData2D:oData_varData2D, $ ; Data oData_flag:oData_flag, $ ; Data oData_vue:oData_vue, $ ; Data oData_ScalarLinLog:oData_ScalarLinLog,$ ; Data oData_xyzplane:oData_xyzplane, $ ; Data oData_ProcessorId:oData_ProcessorId, $ ; Data oData_FileId:oData_FileId, $ ; Data oData_DataFormat:oData_DataFormat, $ ; Data oData_SimuStepOutput:oData_SimuStepOutput, $ ; Data oData_SimuStepReprise:oData_SimuStepReprise, $; Data oData_DataReduction:oData_DataReduction, $ ; Data oData_RebinData:oData_RebinData, $ ; Data oData_FillArrays:oData_FillArrays, $ ; Data oData_FillArraysHDF:oData_FillArraysHDF, $ ; Data oData_DataDimHDF:oData_DataDimHDF, $ ; Data oData_RamsesFillArrays:oData_RamsesFillArrays,$;Data oData_GridDim:oData_GridDim, $ ; Data oData_GridSize:oData_GridSize, $ ; Data oData_JobName:oData_JobName, $ ; Data oData_nbuf:oData_nbuf, $ ; Data oData_OutputReprise:oData_OutputReprise, $ ; Data oData_InitialDir:oData_InitialDir, $ ; Data oData_DataDir:oData_DataDir, $ ; Data oData_OptionsArray:oData_OptionsArray, $ ; Data oData_Plotx:oData_Plotx, $ ; Data oData_ImageProfile:oData_ImageProfile, $ ; Data oData_IsoPlot:oData_IsoPlot, $ ; Data oData_DMDensityPlot:oData_DMDensityPlot, $ ; Data oData_HistoLog:oData_HistoLog, $ ; Data oData_ParametersArray:oData_ParametersArray, $; Data oData_SaveViewsSelect_eps:oData_SaveViewsSelect_eps, $ ; Data oData_SaveViewsSelect_jpeg:oData_SaveViewsSelect_jpeg, $ ; Data oData_SaveViewsSelect_gif:oData_SaveViewsSelect_gif, $ ; Data oData_SaveViewsFileId_eps:oData_SaveViewsFileId_eps, $ ; Data oData_SaveViewsFileId_jpeg:oData_SaveViewsFileId_jpeg, $ ; Data oData_SaveViewsFileId_gif:oData_SaveViewsFileId_gif, $ ; Data oData_xpos2DSlicePosition:oData_xpos2DSlicePosition, $ ; Data oData_IsoSurfaceTransparency:oData_IsoSurfaceTransparency, $ ; Data oData_IsoSurfaceShininess:oData_IsoSurfaceShininess, $ ; Data oData_VectorFieldConfig:oData_VectorFieldConfig, $ ; Data oData_VectorFieldScale:oData_VectorFieldScale, $ ; Data oData_ParticlesSampling:oData_ParticlesSampling, $ ; Data oData_AmrLevels:oData_AmrLevels, $ ; Data oData_AMRMeshIJKboundaries:oData_AMRMeshIJKboundaries, $ ; Data oData_MeshIJKboundaries:oData_MeshIJKboundaries, $ ; Data oData_MeshIJKStatus:oData_MeshIJKStatus, $ ; Data oData_Endian:oData_Endian, $ ; Data oData_ImageToggle:oData_ImageToggle, $ ; Data oData_xydim:oData_xydim, $ ; Data oData_eye:oData_eye, $ ; Data oData_datanames:oData_datanames, $ ; Data oData_AshFileName:oData_AshFileName, $ ; Data oData_AshFilePath:oData_AshFilePath, $ ; Data oData_HDFvar:oData_HDFvar, $ ; Data oData_PolygonVarID:oData_PolygonVarID, $ ; Data oData_PolygonID:oData_PolygonID, $ ; Data oData_PolygonNMAX:oData_PolygonNMAX, $ ; Data oData_PolygonNTOT:oData_PolygonNTOT, $ ; Data oData_MovieFrameNMAX:oData_MovieFrameNMAX, $ ; Data oData_MovieFrameCURRENT:oData_MovieFrameCURRENT, $ ; Data oData_SeedPickUp:oData_SeedPickUp, $ ; Data oData_taskFarmingarrays:oData_taskFarmingarrays, $ ; Data oData_taskFarmingServer:oData_taskFarmingServer, $ ; Data oData_taskFarmingWorker:oData_taskFarmingWorker, $ ; Data oData_taskFarmingNworkers:oData_taskFarmingNworkers, $ ; Data oData_StreamlinesMaxIter:oData_StreamlinesMaxIter, $ ; Data oData_MemoryManagement:oData_MemoryManagement, $ ; Data oData_MultiGridSize:oData_MultiGridSize, $ ; Data oData_MultiGridPosition:oData_MultiGridPosition, $ ; Data oData_nmaxPolygons:oData_nmaxPolygons, $ ; Data oData_mpegFlag:oData_mpegFlag, $ ; Data oData_mpegParameters:oData_mpegParameters, $ ; Data oData_mpegWidgets:oData_mpegWidgets, $ ; Data oData_mpegSensitive:oData_mpegSensitive, $ ; Data oData_VolumeOpacity:oData_VolumeOpacity, $ ; Data oData_vColors:oData_vColors, $ ; Data oData_vColors_orig:oData_vColors_orig, $ ; Data oData_version_format_hdf5:oData_version_format_hdf5, $ ; Data oData_droplist_select:oData_droplist_select, $ ; Data oData_sensitive:oData_sensitive, $ ; Data oData_AMRoctreeGrid:oData_AMRoctreeGrid, $ ; Data oData_AMRoctreeHydro:oData_AMRoctreeHydro, $ ; Data oData_AMRoctreePart:oData_AMRoctreePart, $ ; Data oData_AMRoctreeCurrent:oData_AMRoctreeCurrent, $ ; Data oData_AMRoctreeCpuBoxCurrent:oData_AMRoctreeCpuBoxCurrent, $ ; Data oData_AMRoctreeVarHydro:oData_AMRoctreeVarHydro, $ ; Data oData_AMRoctreeAmrHydroLmaxRead:oData_AMRoctreeAmrHydroLmaxRead, $; Data oData_Polylines:oData_Polylines, $ ; Data oData_PolylinesPlanes:oData_PolylinesPlanes, $ ; Data oData_scaleValue:oData_scaleValue, $ ; Data oData_AMRscaleValue:oData_AMRscaleValue, $ ; Data oData_planesSelected:oData_planesSelected, $ ; Data oData_geometryControlInfo:oData_geometryControlInfo, $ ; Data oData_xyzrot:oData_xyzrot, $ ; Data oData_oAmrModel3D:oData_oAmrModel3D, $ ; Model oData_oAmrModel2D:oData_oAmrModel2D, $ ; Model oMovieModel:oMovieModel, $ oData_is3DModelDrawn:oData_is3DModelDrawn, $ oModelParticles:oModelParticles, $ ; Model oModelImage3D:oModelImage3D, $ ; Model oModel1:oModel1, $ ; Model oResizeableModel3D:oResizeableModel3D, $ ; Model oStereoModel3D:oStereoModel3D, $ ; Model oModel3D:oModel3D, $ ; Model oStaticModel3D:oStaticModel3D, $ ; Model oRotationModel3D:oRotationModel3D, $ ; Model oModelObjects3D:oModelObjects3D, $ ; Model sScene:sScene, $ ; structure oImage:oImage, $ ; Image xAxisImage:xAxisImage, $ ; Axis yAxisImage:yAxisImage, $ ; Axis xTitleImage:xTitleImage, $ ; Text yTitleImage:yTitleImage, $ ; Text oImage3D:oImage3D, $ ; Image oPlot:oPlot, $ ; Plot oIsoPlot:oIsoPlot, $ ; Plot oDMDensityPlot:oDMDensityPlot, $ ; Plot xAxisPlot:xAxisPlot, $ ; Axis yAxisPlot:yAxisPlot, $ ; Axis xTitlePlot:xTitlePlot, $ ; Text yTitlePlot:yTitlePlot, $ ; Text xAxisIsoPlotT:xAxisIsoPlotT, $ ; Axis xAxisIsoPlotB:xAxisIsoPlotB, $ ; Axis yAxisIsoPlotL:yAxisIsoPlotL, $ ; Axis yAxisIsoPlotR:yAxisIsoPlotR, $ ; Axis xTitleIsoPlot:xTitleIsoPlot, $ ; Text xAxisDMDensityPlotT:xAxisDMDensityPlotT, $ ; Axis xAxisDMDensityPlotB:xAxisDMDensityPlotB, $ ; Axis yAxisDMDensityPlotL:yAxisDMDensityPlotL, $ ; Axis yAxisDMDensityPlotR:yAxisDMDensityPlotR, $ ; Axis xTitleDMDensityPlot:xTitleDMDensityPlot, $ ; Text ;yTitleIsoPlot:yTitleIsoPlot, $ ; Text oPalette1: oPalette1, $ ; Palette for surface ;oPalette2: oPalette2, $ ; Palette for the 3D oPaletteImage: oPaletteImage, $ ; Palette for image OStaticModel: oStaticModel, $ ; Model object ORotationModel: oRotationModel, $ ; Model object OScalingModel: oScalingModel, $ ; Model object OMovableModel: oMovableModel, $ ; Model object oModelPolygon:oModelPolygon , $ ; Model object oModelVolume:oModelVolume , $ ; Model object OSimpleSurface: oSimpleSurface, $ ; Surface object WXSlider: wXSlider, $ ; Widget sliders ID WYSlider: wYSlider, $ ; Widget sliders ID WZSlider: wZSlider, $ ; Widget sliders ID OTextureImage: oTextureImage, $ ; Texture image object textureFlag: 1, $ ; Texture mapping flag colorTable: colorTable, $ ; color table to restore debug: keyword_set(debug), $ ; debug flag wTabBase:wTabBase , $ ; Base wLeftVueBase:wLeftVueBase , $ ; Base wTopBase:wTopBase , $ ; Base wDrawBaseSub2:wDrawBaseSub2 , $ ; Base wSurfacePlaneSlider:wSurfacePlaneSlider, $ ; Base wImage3DPlaneSlider:wImage3DPlaneSlider, $ ; Base wSelectSurfacePlane:wSelectSurfacePlane, $ ; Base wSelectImage3DPlane:wSelectImage3DPlane, $ ; Base wFillArrays:wFillArrays, $ ; Base wRamsesFillArrays:wRamsesFillArrays, $ ; Base wJaquesFillArrays:wJaquesFillArrays, $ ; Base wRamsesCpuBox:wRamsesCpuBox, $ ; Base wOutputReprise:wOutputReprise, $ ; Base wOptionsArray:wOptionsArray, $ ; Base wSelectionBase:wSelectionBase, $ ; Base wSelectionDrawingBase:wSelectionDrawingBase, $ ; Base wProcessorIdField:wProcessorIdField, $ ; Base wProcessorIdFieldHDF:wProcessorIdFieldHDF, $ ; Base wStepField:wStepField, $ ; Base wStepFieldHDF:wStepFieldHDF, $ ; Base wLogLinBase:wLogLinBase, $ ; Base wFileIdField:wFileIdField, $ ; Base wHeaderFileBase:wHeaderFileBase, $ ; Base wLoadButton:wLoadButton, $ ; Base wxImage:wxImage, $ ; Base wyImage:wyImage, $ ; Base wDataImage:wDataImage, $ ; Base wImageOptions:wImageOptions, $ ; Base wImageToggle:wImageToggle, $ ; Base wStepFieldLabel:wStepFieldLabel, $ ; Base wStepFieldLabelHDF:wStepFieldLabelHDF, $ ; Base wDrawBase3DsubLower:wDrawBase3DsubLower, $ ; Base wRebinData:wRebinData, $ ; Base w3DVec2DSlicePlaneSlider:w3DVec2DSlicePlaneSlider, $ ; Base wSelect2DSlicePlane:wSelect2DSlicePlane, $ ; Base wIsoSurfaceTransparency:wIsoSurfaceTransparency, $ ; Base wIsoSurfaceShininess:wIsoSurfaceShininess, $ ; Base wVectorFieldConfig:wVectorFieldConfig, $ ; Base wVectorFieldScale:wVectorFieldScale, $ ; Base wVectorFieldConfigSubBase:wVectorFieldConfigSubBase, $ ; Base w3DVec2DSlicePlaneBase:w3DVec2DSlicePlaneBase, $ ; Base wPickLoadBase:wPickLoadBase, $ ; Base wRamsesConfig:wRamsesConfig, $ ; Base wRamsesConfigBoundariesBase:wRamsesConfigBoundariesBase, $ ; Base oData_wRamsesAMRConfigBoundariesBase:oData_wRamsesAMRConfigBoundariesBase, $; Base oData_wRamsesAmrLevelsAlpha:oData_wRamsesAmrLevelsAlpha, $ ; Base oData_wRamsesPlanesSelected:oData_wRamsesPlanesSelected, $ ; Base oData_wAmrConfigurationBase:oData_wAmrConfigurationBase, $ ; Data for base wJupiterConfig:wJupiterConfig, $ ; Base wParticlesOptions:wParticlesOptions, $ ; Base wParticlesColorTable:wParticlesColorTable, $ ; Base wVolumeOptions:wVolumeOptions, $ ; Base wDomainsOptions:wDomainsOptions, $ ; Base wAxisOptions:wAxisOptions, $ ; Base wBoundariesOptions:wBoundariesOptions, $ ; Base wIsosurfaceOptions:wIsosurfaceOptions, $ ; Base wVectorsOptions:wVectorsOptions, $ ; Base wStreamlinesOptions:wStreamlinesOptions, $ ; Base wEndian:wEndian, $ ; Base wVarButton:wVarButton, $ ; Base wFillArraysHDF:wFillArraysHDF, $ ; Base wPickVarObjButton_hdfvar:wPickVarObjButton_hdfvar, $ ; Base wVectorFieldName:wVectorFieldName, $ ; Base wAshConfig:wAshConfig, $ ; Base wSelectIso:wSelectIso, $ ; Base wScalarLinLog:wScalarLinLog, $ ; Base wParticlesConfigBase:wParticlesConfigBase, $ ; Base wParticlesDensVel:wParticlesDensVel, $ ; Base wParticlesLinLogX:wParticlesLinLogX, $ ; Base wParticlesLinLogY:wParticlesLinLogY, $ ; Base wSliceVecVs3DVec:wSliceVecVs3DVec, $ ; Base wVectorFieldBase:wVectorFieldBase, $ ; Base wVectorFieldSeedConfigBase:wVectorFieldSeedConfigBase, $ ; Base wSeedPick:wSeedPick, $ ; Base wSeedPickOptions:wSeedPickOptions, $ ; Base ; wDrawBaseSubIsoPlot2Label:wDrawBaseSubIsoPlot2Label, $ ; Base wIsoValues:wIsoValues, $ ; Base wQuality:wQuality, $ ; Base wDefineVueBase:wDefineVueBase, $ ; Base wDefineVueEyeBase:wDefineVueEyeBase, $ ; Base wDefineVueNearBase:wDefineVueNearBase, $ ; Base wDefineVueFarBase:wDefineVueFarBase, $ ; Base wDefineVueZBright:wDefineVueZBright, $ ; Base wDefineVueZDim:wDefineVueZDim, $ ; Base ;wDefineVueLabel:wDefineVueLabel, $ ; Base wDefineMpegBase:wDefineMpegBase, $ ; Base ;wMpegBitrate:wMpegBitrate, $ ; Base ;wMpegQuality:wMpegQuality, $ ; Base wDefineMovieBase:wDefineMovieBase, $ ; Base wDefineMovieStart:wDefineMovieStart, $ ; Base wDefineMovieEnd:wDefineMovieEnd, $ ; Base wDefineMovieStep:wDefineMovieStep, $ ; Base ;wDefineMovieFrameInterval:wDefineMovieFrameInterval, $ ; Base wSequenceObjectsFileName:wSequenceObjectsFileName, $ ; Base wSequenceFileName:wSequenceFileName, $ ; Base wSequenceFileName2:wSequenceFileName2, $ ; Base wImageSequenceBase:wImageSequenceBase, $ ; Base wObjectControlBase:wObjectControlBase, $ ; Base wObjectControlDisplayHDF:wObjectControlDisplayHDF, $ ; Base wGeometryObjectControlBase:wGeometryObjectControlBase, $ ; Base wObjectControlDisplayBounds:wObjectControlDisplayBounds , $ wObjectControlConfigureBounds:wObjectControlConfigureBounds , $ wObjectControlDisplayAxis:wObjectControlDisplayAxis , $ wObjectControlConfigureAxis:wObjectControlConfigureAxis , $ wObjectControlDisplayDomains:wObjectControlDisplayDomains , $ wObjectControlConfigureDomains:wObjectControlConfigureDomains, $ wObjectControlGenerateAMR:wObjectControlGenerateAMR, $ wObjectControlDisplayAMR:wObjectControlDisplayAMR, $ wObjectControlConfigureAMR:wObjectControlConfigureAMR, $ wCOTBase:wCOTBase, $ ; Base wDrawCOT:wDrawCOT, $ oViewCOT:oViewCOT, $ oPlotCOT:oPlotCOT, $ wPaletteName:wPaletteName, $ wPalettesbot:wPalettesbot , $ wPalettestop:wPalettestop , $ wPalettes_gamma_label:wPalettes_gamma_label , $ wPalettes_gamma:wPalettes_gamma, $ oViewCB:oViewCB, $ oCB:oCB, $ wDrawColorBar:wDrawColorBar, $ wZeroOpacityMin:wZeroOpacityMin, $ wZeroOpacityMax:wZeroOpacityMax, $ wHVRlutFileName:wHVRlutFileName, $ wSDvislutFileName:wSDvislutFileName, $ wCOTsliderList:wCOTsliderList, $ wCOTsliderGroup:wCOTsliderGroup, $ wCOTslider:wCOTslider, $ wCOTsliderChannel:wCOTsliderChannel, $ wCOTsliderValue:wCOTsliderValue, $ wDrawData:wDrawData, $ oViewVolumeData:oViewVolumeData, $ oPlotVolumeData:oPlotVolumeData, $ xAxisVolumeDataB:xAxisVolumeDataB, $ xAxisVolumeDataT:xAxisVolumeDataT, $ yAxisVolumeDataL:yAxisVolumeDataL, $ yAxisVolumeDataR:yAxisVolumeDataR, $ groupBase: groupBase , $ ; Base of Group Leader wViewOptions:wViewOptions, $ ; buttons wEditObjectProperty:wEditObjectProperty, $ ; buttons wAshFieldLabels:wAshFieldLabels , $ ; text oObserver:oObserver , $ ; wAnimateRate:wAnimateRate , $ ; wAnimateAdvance:wAnimateAdvance , $ ; wAnimateStepF:wAnimateStepF , $ ; wAnimateStepB:wAnimateStepB , $ ; wLoadText: wLoadText , $ ; text oLight0: oLight0 , $ ; Light oLight1: oLight1 , $ ; Light oLightPolygon:oLightPolygon , $ ; Light xaxis1:xaxis1 , $ ; axis yaxis1:yaxis1 , $ ; axis zaxis1:zaxis1 , $ ; axis xTitleObj:xTitleObj , $ ; axis yTitleObj:yTitleObj , $ ; axis zTitleObj:zTitleObj , $ ; axis xaxis3D:xaxis3D , $ ; axis yaxis3D:yaxis3D , $ ; axis zaxis3D:zaxis3D , $ ; axis xaxis3Dbounds1:xaxis3Dbounds1 , $ ; axis xaxis3Dbounds2:xaxis3Dbounds2 , $ ; axis xaxis3Dbounds3:xaxis3Dbounds3 , $ ; axis xaxis3Dbounds4:xaxis3Dbounds4 , $ ; axis yaxis3Dbounds1:yaxis3Dbounds1 , $ ; axis yaxis3Dbounds2:yaxis3Dbounds2 , $ ; axis yaxis3Dbounds3:yaxis3Dbounds3 , $ ; axis yaxis3Dbounds4:yaxis3Dbounds4 , $ ; axis zaxis3Dbounds1:zaxis3Dbounds1 , $ ; axis zaxis3Dbounds2:zaxis3Dbounds2 , $ ; axis zaxis3Dbounds3:zaxis3Dbounds3 , $ ; axis zaxis3Dbounds4:zaxis3Dbounds4 , $ ; axis oData_subAxisBoundaries:oData_subAxisBoundaries , $ ; axis oData_subAxisAMRBoundaries:oData_subAxisAMRBoundaries , $ ; axis oData_colorAMRBoundarieValue:oData_colorAMRBoundarieValue, $ xTitleObj3D:xTitleObj3D , $ ; axis yTitleObj3D:yTitleObj3D , $ ; axis zTitleObj3D:zTitleObj3D , $ ; axis oPolyLineImage1:oPolyLineImage1 , $ ; polyline oPolyLineImage2:oPolyLineImage2 , $ ; polyline oPolyLineIsoPlot:oPolyLineIsoPlot , $ ; polyline oPolyLineDMDensityPlot:oPolyLineDMDensityPlot , $ ; polyline helvetica5ptFontObject:helvetica5ptFontObject , $ ; font helvetica10ptFontObject:helvetica10ptFontObject , $ ; font helvetica12ptFontObject:helvetica12ptFontObject , $ ; font oColorBar:oColorBar , $ ; color bar oColorBarAxis:oColorBarAxis , $ ; axis oColorBarAxisTitle:oColorBarAxisTitle , $ ; text oPolygon:oPolygon, $ ; polygons oData_oVolume:oData_oVolume, $ ; volume oVectorField:oVectorField, $ ; polyline oVectorField2D:oVectorField2D, $ ; polyline oStreamlines:oStreamlines, $ ; polyline oStreamlines2D:oStreamlines2D, $ ; polyline oParticles:oParticles, $ ; polyline oSymbolDot:oSymbolDot, $ ; symbol oSymbolOrb:oSymbolOrb, $ ; symbol oOrb:oOrb, $ ; orb oClipboard:oClipboard, $ ; clipboard ; oMpeg:oMpeg, $ ; mpeg oData_Mpeg:oData_Mpeg, $ ; mpeg wVarNameLabel:wVarNameLabel, $ ; label wBoundariesBase:wBoundariesBase, $ oData_wRamsesXAMRBoundariesBase:oData_wRamsesXAMRBoundariesBase, $ oData_wRamsesYAMRBoundariesBase:oData_wRamsesYAMRBoundariesBase, $ oData_wRamsesZAMRBoundariesBase:oData_wRamsesZAMRBoundariesBase, $ wRamsesXBoundariesBase:wRamsesXBoundariesBase, $ wRamsesYBoundariesBase:wRamsesYBoundariesBase, $ wRamsesZBoundariesBase:wRamsesZBoundariesBase, $ TranslateBoundaries:TranslateBoundaries, $ oData_amrTranslateBoundaries:oData_amrTranslateBoundaries, $ DiffMinMaxMemories:DiffMinMaxMemories, $ oData_AMRDiffMinMaxMemories:oData_AMRDiffMinMaxMemories, $ wRamsesConfigTranslate:wRamsesConfigTranslate, $ oData_wRamsesAMRConfigTranslate:oData_wRamsesAMRConfigTranslate, $ wRamsesConfigScaleSlider:wRamsesConfigScaleSlider, $ oData_wRamsesAMRConfigScaleSlider:oData_wRamsesAMRConfigScaleSlider, $ wRamsesConfigScaleValue:wRamsesConfigScaleValue, $ oData_wRamsesAMRConfigScaleValue:oData_wRamsesAMRConfigScaleValue, $ oData_RamsesAmrLevelsColors:oData_RamsesAmrLevelsColors, $ oData_RamsesAmrLevelsArrays:oData_RamsesAmrLevelsArrays, $ oData_wRamsesAmrLevelsArrays:oData_wRamsesAmrLevelsArrays, $ oData_RamsesAmrLevelsAlpha:oData_RamsesAmrLevelsAlpha, $ oData_RamsesAmrLevelsFlags:oData_RamsesAmrLevelsFlags, $ wRamsesAmrLevelsArrays:wRamsesAmrLevelsArrays, $ oData_colorBoundarieValue:oData_colorBoundarieValue, $ oData_MoviePolylines:oData_MoviePolylines, $ oData_saveScaleVue:oData_saveScaleVue, $ oData_saveTranslateVue:oData_saveTranslateVue, $ oData_saveTranslatePivotVue:oData_saveTranslatePivotVue, $ oData_saveTransform:oData_saveTransform, $ oData_saveTransformRot:oData_saveTransformRot, $ oData_saveMeshIJKBoundaries:oData_saveMeshIJKBoundaries, $ oData_saveLevels:oData_saveLevels, $ oData_saveLevelVue:oData_saveLevelVue, $ oData_saveOutputNumber:oData_saveOutputNumber, $ oData_saveNumberSteps:oData_saveNumberSteps, $ oData_cptVue:oData_cptVue, $ oData_wMovieWidgetConfig:oData_wMovieWidgetConfig, $ oData_wNumberVueLabel:oData_wNumberVueLabel, $ wPlay_sequence_and_save:wPlay_sequence_and_save, $ oData_imagesequenceWidgets:oData_imagesequenceWidgets, $ oData_counterImage:oData_counterImage, $ oData_saveImage:oData_saveImage, $ wSaveViewBaseEps:wSaveViewBaseEps, $ wSaveViewBaseJpg:wSaveViewBaseJpg, $ wSaveViewBaseGif:wSaveViewBaseGif, $ oData_saveviewWidgetsEps:oData_saveviewWidgetsEps, $ oData_saveviewWidgetsJpg:oData_saveviewWidgetsJpg, $ oData_saveviewWidgetsGif:oData_saveviewWidgetsGif, $ wPickFormatList:wPickFormatList, $ oData_wNavigationOptions:oData_wNavigationOptions, $ oData_wStereoOptions:oData_wStereoOptions, $ oWindowStereoEyes:oWindowStereoEyes, $ wGraficConfig:wGraficConfig, $ wJaquesConfig:wJaquesConfig, $ oSceneText:oSceneText, $ wTextControlOptions:wTextControlOptions, $ Jaques_cube_dim:256 $ } SDvis_Draw, sState PickFormat, sState ; Register the info structure in the user value of the top-level base ; WIDGET_CONTROL, wTopBase, SET_UVALUE=sState, /NO_COPY WIDGET_CONTROL, wTopBase, SENSITIVE=1 WIDGET_CONTROL, wTopBase, /UPDATE ; Map the top level base. ; WIDGET_CONTROL, wTopBase, MAP=1 ;ss = get_screen_size() ;print,'screen size=',ss ;Geometry=WIDGET_INFO(wTopBase, /GEOMETRY) ;help,Geometry,/structure XMANAGER, "SDvision", wTopBase, $ /NO_BLOCK, $ EVENT_HANDLER="SDvis_Event", CLEANUP="SDvis_Cleanup" end ; main procedure ;------------------------------------------------------------------------- FUNCTION Debuff, varbuff,ndim,nx,ny,nz,nfx, nvectdim, nbuf ;print,'Debuff !' ;help, varbuff ;print,'nbuf=',nbuf if nvectdim eq 0 then begin if ndim eq 1 then begin var=varbuff(nbuf:nx-1+nbuf) endif else if ndim eq 2 then begin var=varbuff(nbuf:nx-1+nbuf,nbuf:ny-1+nbuf) endif else if ndim eq 3 then begin var=varbuff(nbuf:nx-1+nbuf,nbuf:ny-1+nbuf,2:nz-1+nbuf) end endif else begin if ndim eq 1 then begin var=varbuff(nbuf:nx-1+nbuf,0:ndim-1) endif else if ndim eq 2 then begin var=varbuff(nbuf:nx-1+nbuf,nbuf:ny-1+nbuf,0,0:ndim-1) endif else if ndim eq 3 then begin var=varbuff(nbuf:nx-1+nbuf,nbuf:ny-1+nbuf,nbuf:nz-1+nbuf,0:ndim-1) end endelse if nfx ne 1 then begin ; stop, 'nfx ne 1 not treated in Debuff -> STOP !!!' endif RETURN, var END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; code from rdat.pro (E. Audit) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; pro rdat,sState,file,temps,rg,pg,ug,fg,erg,frg,edg,Eg,OptionsArray,verbose=verbose ;print ,'in rdat' ;print ,'OptionsArray=',OptionsArray openr,1,file,/f77_unformatted, ERROR=err if err ne 0 then begin PRINT, 'error in opening data file' PRINT, 'file ', file ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif ndim=1L nx =1L & ny =1L & nz =1L nxg =1L & nyg=1L & nzg =1L nfx =1L xs =1l & ys = 1L & zs = 1L xe =1l & ye = 1L & ze = 1L readu,1,nxg,nyg,nzg xg=dblarr(1,nxg+1) & yg=dblarr(1,nyg+1) & zg=dblarr(1,nzg+1) readu,1, xg,yg,zg readu,1,ndim,nx,ny,nz,nfx readu,1,xs,ys,zs,xe,ye,ze if (keyword_set(verbose) ) then begin print,'ndim=',ndim print,'nx =',nx print,'ny =',ny print,'nz =',nz print,'nfx =',nfx print,'xs,xe = ',xs,xe print,'ys,ye = ',ys,ye print,'zs,ze = ',zs,ze endif x = dblarr(nx+1) y = dblarr(ny+1) z = dblarr(nz+1) readu,1,x,y,z shift_gr= dblarr(ndim) nshift_gr= lonarr(ndim) readu,1, shift_gr readu,1,nshift_gr k = 1L readu,1,k temps = 1D0 & dt = 1D0 & dtold = 1D0 readu,1,temps, dt, dtold gamma = 1D0 & mu = 1D0 readu,1,gamma,mu if (keyword_set(verbose) ) then begin print, 'Iteration =',k print,'Temps, dt,dtold = ',temps, dt, dtold print, 'gamma = ',gamma print, 'mu = ',mu print, 'nfx = ',nfx endif result=sState.oData_FillArrays->GetData(FillArrays) result=sState.oData_OptionsArray->GetData(OptionsArray) binext='.bin' if OptionsArray[2] eq 1 then nbuf=2 if OptionsArray[2] eq 1 then begin rho = dblarr(nx+2*nbuf,ny+2*nbuf,nz+2*nbuf,/NOZERO) endif else begin rho = dblarr(nx,ny,nz,/NOZERO) end readu,1,rho if ( FillArrays[1] eq 0 and FillArrays[2] eq 0 and FillArrays[3] eq 0 $ and FillArrays[4] eq 0 and FillArrays[5] eq 0 ) then begin close,1 if ( FillArrays[0] eq 1 ) then begin if OptionsArray[2] eq 1 then begin rg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1)=Debuff(temporary(rho),ndim,nx,ny,nz,nfx,0, nbuf ) endif else begin rg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1)=temporary(rho) end endif return endif if OptionsArray[2] eq 1 then begin rhou = dblarr(nx+2*nbuf,ny+2*nbuf,nz+2*nbuf,ndim,/NOZERO) endif else begin rhou = dblarr(nx,ny,nz,ndim,/NOZERO) end readu,1,rhou if OptionsArray[2] eq 1 then begin E = dblarr(nx+2*nbuf,ny+2*nbuf,nz+2*nbuf,/NOZERO) endif else begin E = dblarr(nx,ny,nz,/NOZERO) end readu,1,E ;plot, E ;surface, E if OptionsArray[2] eq 0 then begin fx = dblarr(nx,ny,nz,nfx,/NOZERO) readu,1,fx endif ; ray ; if ( OptionsArray[0] eq 1 ) then begin er = dblarr(nx,ny,nz,/NOZERO) fr = dblarr(nx,ny,nz,ndim,/NOZERO) readu,1,er readu,1,fr print, 'reading er ' endif ; dif ; if ( OptionsArray[1] eq 1 ) then begin ed = dblarr(nx,ny,nz,/NOZERO) readu,1,ed endif close,1 if ( FillArrays[0] eq 1 ) then begin if OptionsArray[2] eq 1 then begin rg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1)=Debuff(rho,ndim,nx,ny,nz,nfx,0, nbuf ) endif else begin rg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1)=rho end endif if ( FillArrays[2] eq 1 or FillArrays[3] eq 1) then begin if OptionsArray[2] eq 1 then begin u = dblarr(nx+2*nbuf,ny+2*nbuf,nz+2*nbuf,ndim,/NOZERO) For idim=0,ndim-1 do begin u(0:nx-1+2*nbuf,0:ny-1+2*nbuf,0:nz-1+2*nbuf,idim) = $ rhou(0:nx-1+2*nbuf,0:ny-1+2*nbuf,0:nz-1+2*nbuf,idim)/rho(0:nx-1+2*nbuf,0:ny-1+2*nbuf,0:nz-1+2*nbuf) endfor endif else begin u = dblarr(nx,ny,nz,ndim,/NOZERO) For idim=0,ndim-1 do begin u(0:nx-1,0:ny-1,0:nz-1,idim) = rhou(0:nx-1,0:ny-1,0:nz-1,idim)/rho(0:nx-1,0:ny-1,0:nz-1) endfor end if ( FillArrays[3] eq 1) then begin if ( FillArrays[2] eq 0) then begin if OptionsArray[2] eq 1 then begin ug(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:ndim-1)=Debuff(temporary(u),ndim,nx,ny,nz,nfx,1,nbuf) endif else begin ug(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:ndim-1)=temporary(u) end endif else begin if OptionsArray[2] eq 1 then begin ug(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:ndim-1)=Debuff(u,ndim,nx,ny,nz,nfx,1,nbuf) endif else begin ug(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:ndim-1)=u end end endif if ( FillArrays[2] eq 1) then begin p = dblarr(nx,ny,nz ,/NOZERO ) u2 = dblarr(nx,ny,nz ,/NOZERO ) For idim=0,ndim-1 do begin u2(0:nx-1,0:ny-1,0:nz-1) = u2(0:nx-1,0:ny-1,0:nz-1) + u(0:nx-1,0:ny-1,0:nz-1,idim)^2 Endfor p = (gamma-1.)*(E - 0.5*rho*u2) pg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1 )=temporary(p) endif ;;; to be implemented ;;; fg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:nfx-1 )=fx endif ; ray ; if ( OptionsArray[0] eq 1 ) then begin if ( FillArrays[1] eq 1 ) then begin erg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1 )=temporary(er) print, 'filling erg' endif if ( FillArrays[4] eq 1 ) then begin frg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:ndim-1)=temporary(fr ) endif print, 'filling frg' endif ; dif ; if ( OptionsArray[1] eq 1 ) then begin edg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1 )=temporary(ed) endif ; internal energy ; if ( FillArrays[5] eq 1 ) then begin Eg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1)=temporary(E) endif end ;+ ; ;rs,n,it,temps,xx,nn,rg,pg,ug,fg,erg,frg,edg,ray=ray,dif=dif,dir=dir ; ;- pro rs,sState,n,it,temps,xx,nn,rg,pg,ug,fg,erg,frg,edg,Eg,OptionsArray,err,dir=dir IF N_PARAMS() EQ 0 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'rdat' RETURN ENDIF if (it lt 10) then begin out = '_0'+strcompress(string(it),/remove_all) endif else begin out = '_'+strcompress(string(it),/remove_all) endelse result=sState.oData_OptionsArray->GetData(OptionsArray) binext='.bin' if OptionsArray[2] eq 1 then binext='.Bin' name = 'liste-001'+out+binext if (keyword_set(dir) ) then name = dir+'/'+name openr,1,name,/f77_unformatted, ERROR=err if err ne 0 then begin PRINT, 'error in opening data file' PRINT, 'file ', name ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif nxg =1L & nyg=1L & nzg =1L ndim=1L nx =1L & ny =1L & nz =1L nfx = 1L xg = dblarr(3) x1 = 1D0 x2 = 1D0 x3 = 1D0 readu,1,nxg,nyg,nzg xg=dblarr(1,nxg+1) & yg=dblarr(1,nyg+1) & zg=dblarr(1,nzg+1) print,'nxg, xg =',nxg, xg(0) print,'nyg, yg =',nyg, xg(1) print,'nzg, zg =',nzg, xg(2) result=sState.oData_GridDim->GetData(GridDim) GridDim(0)=nxg GridDim(1)=nyg GridDim(2)=nzg result=sState.oData_GridDim->SetData(GridDim) result=sState.oData_GridSize->GetData(GridSize) GridSize(0)=xg(0) GridSize(1)=xg(1) GridSize(2)=xg(2) readu,1, xg,yg,zg readu,1,ndim,nx,ny,nz,nfx close,1 GridSize(3)=xg(nxg) GridSize(4)=yg(nyg) GridSize(5)=zg(nzg) result=sState.oData_GridSize->SetData(GridSize) print,'nxg, xg =',nxg, xg(nxg) print,'nyg, yg =',nyg, yg(nyg) print,'nzg, zg =',nzg, zg(nzg) print,'nfx =',nfx nmax = max([nxg,nyg,nzg]) xx = dblarr(3,nmax+1) xx(0,0:nxg) = xg xx(1,0:nyg) = yg xx(2,0:nzg) = zg nn = lonarr(3) nn(0) = nxg nn(1) = nyg nn(2) = nzg ; rg = dblarr(nxg,nyg,nzg ) ; pg = dblarr(nxg,nyg,nzg ) ; ug = dblarr(nxg,nyg,nzg,ndim) ; fg = dblarr(nxg,nyg,nzg,nfx ) ; erg = dblarr(nxg,nyg,nzg ) ; frg = dblarr(nxg,nyg,nzg,ndim) ; edg = dblarr(nxg,nyg,nzg ) result=sState.oData_FillArrays->GetData(FillArrays) if ( FillArrays[0] eq 1 ) then begin print, 'create rg table' rg = fltarr(nxg,nyg,nzg ,/NOZERO ) print, ' ... done' endif if ( FillArrays[2] eq 1 ) then begin print, 'create pg table' pg = fltarr(nxg,nyg,nzg ,/NOZERO ) print, ' ... done' endif if ( FillArrays[3] eq 1 ) then begin print, 'create ug table' ug = fltarr(nxg,nyg,nzg,ndim,/NOZERO) print, ' ... done' endif ;;; to be implemented ;;; fg = dblarr(nxg,nyg,nzg,nfx ) if ( FillArrays[1] eq 1 OR FillArrays[4] eq 1 ) then begin print, 'create erg and frg tables' erg = fltarr(nxg,nyg,nzg ,/NOZERO ) frg = fltarr(nxg,nyg,nzg,ndim,/NOZERO) print, ' ... done' endif ;;; to be implemented ;;; edg = dblarr(nxg,nyg,nzg ) if ( FillArrays[5] eq 1 ) then begin print, 'create Eg table' Eg = fltarr(nxg,nyg,nzg,/NOZERO) print, ' ... done' endif result=sState.oData_OptionsArray->GetData(OptionsArray) binext='.bin' if OptionsArray[2] eq 1 then binext='.Bin' For i=1,n do begin if ( i lt 10) then begin name='liste-00'+strcompress(string(i),/remove_all)+out+binext endif else if (i lt 100) then begin name='liste-0'+strcompress(string(i),/remove_all)+out+binext endif else begin name='liste-'+strcompress(string(i),/remove_all)+out+binext endelse if (keyword_set(dir) ) then name = dir+'/'+name v = 0 if (i eq 1) then v = 1 text = 'Lecture du fichier : '+name slen=strlen(text) print,string(replicate(8b,slen(0))),f='($,A)' print,text,f='($,A)' print, ' ' rdat,sState,name,temps,rg,pg,ug,fg,erg,frg,edg,Eg,OptionsArray,verbose=v ; surface, Eg Endfor print,' ' end ; if(ndim eq 1) then begin ; nxmin = -1 & nxmax = nx+2 ; nymin = 1 & nymax = 1 ; nzmin = 1 & nzmax = 1 ; endif else if (ndim eq 2) then begin ; nxmin = -1 & nxmax = nx+2 ; nymin = -1 & nymax = ny+2 ; nzmin = 1 & nzmax = 1 ; endif else if (ndim eq 3) then begin ; nxmin = -1 & nxmax = nx+2 ; nymin = -1 & nymax = ny+2 ; nzmin = -1 & nzmax = nz+2 ; endif ; print,'nxmin,nxmax =',nxmin,nxmax ; print,'nymin,nymax =',nymin,nymax ; print,'nzmin,nzmax =',nzmin,nzmax ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ;pro h5rdat,sState,HDFvar,file,temps,rg,pg,ug,fg,erg,frg,edg,OptionsArray,verbose=verbose pro h5rdat,sState,HDFvar,file,iproc result=sState.oData_FillArrays->GetData(FillArrays) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) result=sState.oData_ParametersArray->GetData(ParametersArray) result=sState.oData_nbuf->GetData(nbuf) result=sState.oData_DataDimHDF->GetData(fourdim) openr,1,file, ERROR=err if err ne 0 then begin PRINT, ' ' PRINT, 'error in opening H5 file' PRINT, 'file ', file ,' not found ' CD,'.',CURRENT=Dir PRINT, '=> possible problems : wrong directory, try reprise/output files' print,' Current directory=',Dir return endif close,1 file_id=H5F_OPEN(file) ndim=1L nx =1L & ny =1L & nz =1L nxg =1L & nyg=1L & nzg =1L nfx =1L xs =1l & ys = 1L & zs = 1L xe =1l & ye = 1L & ze = 1L ;readu,1,nxg,nyg,nzg xg=dblarr(1,nxg+1) & yg=dblarr(1,nyg+1) & zg=dblarr(1,nzg+1) ;readu,1, xg,yg,zg ;readu,1,ndim,nx,ny,nz,nfx ;readu,1,xs,ys,zs,xe,ye,ze dataset_para_int = H5D_OPEN(file_id,'para_int') para_int=H5D_READ(dataset_para_int) nxg=para_int(0) nyg=para_int(1) nzg=para_int(2) ndim=para_int(3) nx=para_int(4) ny=para_int(5) nz=para_int(6) nfx=para_int(7) xs=para_int(8) ys=para_int(9) zs=para_int(10) xe=para_int(11) ye=para_int(12) ze=para_int(13) sState.GeoStructure.xse(0,iproc-1)=xs sState.GeoStructure.xse(1,iproc-1)=xe sState.GeoStructure.yse(0,iproc-1)=ys sState.GeoStructure.yse(1,iproc-1)=ye sState.GeoStructure.zse(0,iproc-1)=zs sState.GeoStructure.zse(1,iproc-1)=ze ;if iproc eq 1 then begin ; print,'h5rdat xs,xe,ys,ye,zs,ze=',xs,xe,ys,ye,zs,ze ;endif if (keyword_set(verbose) ) then begin print,' ' print,' ndim =',ndim print,' nx =',nx print,' ny =',ny print,' nz =',nz print,' nfx =',nfx print,' xs,xe = ',xs,xe print,' ys,ye = ',ys,ye print,' zs,ze = ',zs,ze endif x = dblarr(nx+1) y = dblarr(ny+1) z = dblarr(nz+1) ;readu,1,x,y,z shift_gr= dblarr(ndim) nshift_gr= lonarr(ndim) ;readu,1, shift_gr ;readu,1,nshift_gr k = para_int(14) ;readu,1,k temps = ParametersArray[0] dt = ParametersArray[1] dtold = ParametersArray[2] gamma = ParametersArray[3] mu = ParametersArray[4] if (keyword_set(verbose) ) then begin print,' Iteration =',k print,' Temps, dt,dtold = ',temps, dt, dtold print,' gamma = ',gamma print,' mu = ',mu endif ;E = dblarr(nx,ny,nz) ;rhou = dblarr(nx,ny,nz,ndim) ;fx = dblarr(nx,ny,nz,nfx) ;readu,1,rhou ;readu,1,E ;readu,1,fx ; rho is needed for density, pressure, velocity ; ;if ( FillArrays[0] eq 1 or FillArrays[2] eq 1 or FillArrays[3] eq 1) then begin ; dataset_rho = H5D_OPEN(file_id,'rho') ; rho=Debuff(H5D_READ(dataset_rho),ndim,nx,ny,nz,nfx,0, nbuf ) ;endif ; rhou is needed for pressure, velocity ; ;if ( FillArrays[2] eq 1 or FillArrays[3] eq 1) then begin ; dataset_rhou = H5D_OPEN(file_id,'rhou') ; rhou=Debuff(H5D_READ(dataset_rhou),ndim,nx,ny,nz,nfx,1, nbuf ) ;endif ; E is needed for pressure ; ;if ( FillArrays[2] eq 1 ) then begin ; dataset_E = H5D_OPEN(file_id,'E') ; E=Debuff(H5D_READ(dataset_E),ndim,nx,ny,nz,nfx,0, nbuf ) ;endif ; ray ; ;if ( OptionsArray[0] eq 1 ) then begin ; if ( FillArrays[1] eq 1) then begin ; dataset_er = H5D_OPEN(file_id,'er') ; er=Debuff(H5D_READ(dataset_er),ndim,nx,ny,nz,nfx,0, nbuf ) ;; endif ; if ( FillArrays[4] eq 1) then begin ; dataset_fr = H5D_OPEN(file_id,'fr') ; fr=Debuff(H5D_READ(dataset_fr),ndim,nx,ny,nz,nfx,1, nbuf ) ; endif ;endif ; dif ; ;if ( OptionsArray[1] eq 1 ) then begin ;ed = dblarr(nx,ny,nz) ;readu,1,ed ;endif result=sState.oData_datanames->GetData(datanames) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) for i=0,nvar-1 do begin if ( FillArraysHDF[i] eq 1 ) then begin dataset_HDFvar = H5D_OPEN(file_id,datanames[i]) if fourdim[i] eq 1 then begin HDFvar(i,xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0)=Debuff(H5D_READ(dataset_HDFvar),ndim,nx,ny,nz,nfx,0,nbuf) endif else if fourdim[i] eq 3 or fourdim[i] eq 2 then begin ;print,'test ndim=',ndim ;help, HDFvar ;a=HDFvar(i,xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:ndim-1) ;help,a ;b=Debuff(H5D_READ(dataset_HDFvar),ndim,nx,ny,nz,nfx,1,nbuf) ;help,b HDFvar(i,xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:ndim-1)=Debuff(H5D_READ(dataset_HDFvar),ndim,nx,ny,nz,nfx,1,nbuf) end endif endfor ;if ( FillArrays[0] eq 1 ) then begin ; rg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1)=rho ;endif ;if ( FillArrays[2] eq 1 or FillArrays[3] eq 1) then begin ; u = dblarr(nx,ny,nz,ndim) ; For idim=0,ndim-1 do begin ; u(0:nx-1,0:ny-1,0:nz-1,idim) = rhou(0:nx-1,0:ny-1,0:nz-1,idim)/rho(0:nx-1,0:ny-1,0:nz-1) ; endfor ; ug(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:ndim-1)=u ;endif ;if ( FillArrays[2] eq 1 ) then begin ; p = dblarr(nx,ny,nz ) ; u2 = dblarr(nx,ny,nz ) ; For idim=0,ndim-1 do begin ; u2(0:nx-1,0:ny-1,0:nz-1) = u2(0:nx-1,0:ny-1,0:nz-1) + u(0:nx-1,0:ny-1,0:nz-1,idim)^2 ; Endfor ; p = (gamma-1.)*(E - 0.5*rho*u2) ; pg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1 )=p ;endif ;fg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:nfx-1 )=fx ; ray ; ;if ( OptionsArray[0] eq 1 ) then begin ; if ( FillArrays[1] eq 1 ) then begin ; erg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1 )=er ; print, 'filling erg' ; endif ; if ( FillArrays[4] eq 1 ) then begin ; frg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1,0:ndim-1)=fr ; print, 'filling frg' ; endif ;endif ; dif ; ;if ( OptionsArray[1] eq 1 ) then begin ; ;edg(xs-1:xe-1,ys-1:ye-1,zs-1:ze-1 )=ed ;endif end ;+ ; ;rs,n,it,temps,xx,nn,rg,pg,ug,fg,erg,frg,edg,ray=ray,dif=dif,dir=dir ; ;- ;pro h5rs,sState,n,it,temps,xx,nn,rg,pg,ug,fg,erg,frg,edg,OptionsArray,dir=dir pro h5rs,sState,n,it sState.GeoStructure.nproc=n ;result=sState.oData_FillArrays->GetData(FillArrays) result=sState.oData_FillArraysHDF->GetData(FillArraysHDF) IF N_PARAMS() EQ 0 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'h5rdat' RETURN ENDIF result=sState.oData_version_format_hdf5->GetData(version_format_hdf5) if version_format_hdf5 eq -1 then begin if (it lt 10) then begin out = '_0'+strcompress(string(it),/remove_all) endif else begin out = '_'+strcompress(string(it),/remove_all) endelse endif else begin if (it lt 100 and it ge 10) then begin out = '_0'+strcompress(string(it),/remove_all) endif else if (it lt 10) then begin out = '_00'+strcompress(string(it),/remove_all) endif else begin out = '_'+strcompress(string(it),/remove_all) endelse endelse result=sState.oData_JobName->GetData(JobName) print,'JobName=',JobName nxg =1L & nyg=1L & nzg =1L ndim=1L nx =1L & ny =1L & nz =1L nfx = 1L xg = dblarr(3) x1 = 1D0 x2 = 1D0 x3 = 1D0 result=sState.oData_GridDim->GetData(GridDim) nxg=GridDim(0) nyg=GridDim(1) nzg=GridDim(2) print,'grid loaded from header info in memory' xg=dblarr(1,nxg+1) & yg=dblarr(1,nyg+1) & zg=dblarr(1,nzg+1) print,'nxg, xg =',nxg, xg(0) print,'nyg, yg =',nyg, xg(1) print,'nzg, zg =',nzg, xg(2) ;readu,1, xg,yg,zg ;readu,1,ndim,nx,ny,nz,nfx ;close,1 ndim=GridDim(3) ;nx= GridDim(4) ;ny= GridDim(5) ;nz= GridDim(6) nfx= GridDim(7) print,'nxg, xg =',nxg, xg(nxg) print,'nyg, yg =',nyg, yg(nyg) print,'nzg, zg =',nzg, zg(nzg) print,'nfx =',nfx nmax = max([nxg,nyg,nzg]) xx = dblarr(3,nmax+1) xx(0,0:nxg) = xg xx(1,0:nyg) = yg xx(2,0:nzg) = zg nn = lonarr(3) nn(0) = nxg nn(1) = nyg nn(2) = nzg result=sState.oData_datanames->GetData(datanames) result=sState.oData_DataDimHDF->GetData(fourdim) size_datanames=size(datanames,/DIMENSIONS) nvar=fix(size_datanames[0]) print, 'create HDFvar tables' HDFvar=fltarr(nvar,nxg,nyg,nzg,ndim) ;for i=0,nvar-1 do begin ; if ( FillArraysHDF[i] eq 1 ) then WIDGET_CONTROL,sState.wPickVarObjButton_hdfvar[i],SENSITIVE=1 ;endfor ;if ( FillArrays[0] eq 1 ) then begin ; print, 'create rg table' ; rg = dblarr(nxg,nyg,nzg ) ; print, ' ... done' ;endif ;if ( FillArrays[2] eq 1 ) then begin ; print, 'create pg table' ; pg = dblarr(nxg,nyg,nzg ) ; print, ' ... done' ;endif ;if ( FillArrays[2] eq 1 or FillArrays[3] eq 1 ) then begin ; print, 'create ug table' ; ug = dblarr(nxg,nyg,nzg,ndim) ; print, ' ... done' ;endif ;;; to be implemented ;;; fg = dblarr(nxg,nyg,nzg,nfx ) ;if ( FillArrays[1] eq 1 OR FillArrays[4] eq 1 ) then begin ; print, 'create erg and frg tables' ; erg = dblarr(nxg,nyg,nzg ) ; frg = dblarr(nxg,nyg,nzg,ndim) ; print, ' ... done' ;endif ;;; to be implemented ;;; edg = dblarr(nxg,nyg,nzg ) result=sState.oData_OutputReprise->GetData(OutputReprise) if OutputReprise eq 0 then begin JobName=JobName+'-o-' endif else if OutputReprise eq 1 then begin JobName=JobName+'-r-' end For i=1,n do begin if ( i lt 10) then begin name=JobName+'00'+strcompress(string(i),/remove_all)+out+'.h5' endif else if (i lt 100) then begin name=JobName+'0'+strcompress(string(i),/remove_all)+out+'.h5' endif else begin name=JobName+strcompress(string(i),/remove_all)+out+'.h5' endelse if (keyword_set(dir) ) then name = dir+'/'+name text = 'Lecture du fichier H5 : '+name print, ' ' slen=strlen(text) print,string(replicate(8b,slen(0))),f='($,A)' print,text,f='($,A)' ;h5rdat,sState,HDFvar,name,temps,rg,pg,ug,fg,erg,frg,edg,OptionsArray,verbose=v h5rdat,sState,HDFvar,name,i Endfor print, ' ' for i=0,nvar-1 do begin if ( FillArraysHDF[i] eq 1 ) then begin if fourdim[i] eq 1 then begin vartest=reform(HDFvar[i,*,*,*,0]) endif else begin ;test=HDFvar[i,*,*,*,*] ;surface,HDFvar[i,*,*,0,0] ; print,'min,max v1=',min(HDFvar[i,*,*,0,0]),max(HDFvar[i,*,*,0,0]) ; print,'min,max v2=',min(HDFvar[i,*,*,0,1]),max(HDFvar[i,*,*,0,1]) ;help,test vartest=reform(HDFvar[i,*,*,*,*]) endelse ;print, 'fill oData_HDFvar[',strcompress(string(i),/remove_all),'] for variable ', datanames[i] result=sState.oData_HDFvar[i,0]->SetData(vartest,/NO_COPY) ;print, ' ... done' size=sState.oData_HDFvar[i,0]->GetSize() print,'load '+datanames[i],' with size=',fix(size,TYPE=3),' bytes' endif endfor ;print,' ' end ;------------------------------------------------------------------------- ; Handle File/Open events. ; Allow user to select multiple HDF5 files, and parse them. ; pro Browsedirectories, event, sState compile_opt idl2, hidden wChild = WIDGET_INFO(event.top, /CHILD) WIDGET_CONTROL, wChild, GET_UVALUE=state ; Allow user to select files. files = DIALOG_PICKFILE(DIALOG_PARENT=event.top, $ FILTER=['*.h5'], $ GET_PATH=path, $ /MULTIPLE_FILES, $ /MUST_EXIST, $ TITLE='Select HDF5 file to open') ; User hit cancel. if (files[0] eq '') then $ return ; Change current working directory. Hope this makes people happy. ;;;CD, path, CURRENT=InitialDir CD, '.', CURRENT=InitialDir result=sState.oData_DataDir->SetData(path) ;print,'CurentDir =',InitialDir print,'Data will be read in DataDir=',path print ,'header file=',files result=sState.oData_FileId->SetData(files) WIDGET_CONTROL, sState.wFileIdField, SET_VALUE=files ;H5_BROWSER_ADDFILE, state.wTree, files end ;------------------------------------------------------------------------- ; ; ; pro BrowseBindirectories, event, sState compile_opt idl2, hidden wChild = WIDGET_INFO(event.top, /CHILD) WIDGET_CONTROL, wChild, GET_UVALUE=state ; Allow user to select files. files = DIALOG_PICKFILE(DIALOG_PARENT=event.top, $ /DIRECTORY, GET_PATH=path, $ TITLE='choose directory where to pick up binary files (files are not shown)') ; User hit cancel. if (files[0] eq '') then $ return CD, path print,'Binary Data will be searched in DataDir=',path result=sState.oData_DataDir->SetData(path) end ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- function getcarnum,nframes ndigitmx = floor( alog10( 99999 ) ) + 1 car = strarr(nframes) for i = 1, nframes do begin a = string(i) if (i gt 0) then $ ndigit = floor( alog10( float(i) ) ) + 1 $ else $ ndigit = 1 for j = 1, ndigitmx - ndigit do begin a = '0' + a endfor car[i-1] = strcompress(a, /remove_all) ; print,car(i-1) endfor return,car end ;+ ; NAME: ; DEL_AMR ; ; PURPOSE: ; This procedure destroys the mesh structure in a clean way. ; ; CATEGORY: ; Memory management. ; ; CALLING SEQUENCE: ; DEL_AMR, Grid ; ; OPTIONAL INPUTS: ; None. ; ; OUTPUTS: ; None. ; ; COMMON BLOCKS: ; None. ; ; EXAMPLE: ; To destroy properly the AMR structure and free the allocated ; memory, type: ; ; DEL_AMR, Grid ; ; MODIFICATION HISTORY: ; Written by: Romain Teyssier, 01/01/2000. ; e-mail: Romain.Teyssier@cea.fr ; Fevrier, 2001: Comments and header added by Romain Teyssier. ;- pro del_amr, grid, verbose=verbose IF N_PARAMS() NE 1 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'del_amr' RETURN ENDIF ; Free memory associated to grid if n_tags(grid) ne 0 then begin if keyword_set(verbose) then $ print,'Freeing memory for grid structure...' for icpu=0,grid.ncpu-1 do begin for i=0,grid.nlevelmax-1 do begin ptr_free,grid.level[i,icpu] endfor endfor grid=0 endif end ;################################################### ;################################################### ;################################################### FUNCTION TRIM, NUMBER, FORMAT, FLAG ;+ ; NAME: ; TRIM() ; PURPOSE: ; Converts numbers to strings, without trailing zeros. ; EXPLANATION: ; Converts numbers into a string representation, and trims off leading ; and/or trailing blanks. Differs from STRTRIM in that trailing zeros ; after the period are also trimmed off, unless NUMBER is already a ; string, or an explicit format is passed. ; CALLING SEQUENCE: ; Result = TRIM( NUMBER [, FORMAT ] [, FLAG ] ) ; INPUTS: ; NUMBER = Scalar variable or constant. May be of any ordinary type, ; including string. However, structures are not allowed. ; OPTIONAL INPUTS : ; FORMAT - Format specification for STRING function. Must be a string ; variable, start with the "(" character, end with the ")" ; character, and be a valid FORTRAN format specification. If ; NUMBER is complex, then FORMAT will be applied separately to ; the real and imaginary parts. ; ; FLAG - Flag passed to STRTRIM to control the type of trimming: ; ; FLAG = 0 Trim trailing blanks. ; FLAG = 1 Trim leading blanks. ; FLAG = 2 Trim both leading and trailing blanks. ; ; The default value is 2. If NUMBER is complex, then FORMAT ; will be applied separately to the real and imaginary parts. ; ; OUTPUTS: ; Function returns as a string variable representing the value NUMBER. ; RESTRICTIONS: ; NUMBER must not be an array. NUMBER must not be a structure. ; FORMAT must be a valid format specification, and must not be passed ; if NUMBER is of type string. ; FLAG must not be of string type, or an array. ; PROCEDURES USED: ; None ; REVISION HISTORY: ; Version 1, William Thompson, GSFC, 9 April 1993, ; Transferred from Solar Library, W. Landsman September 1997 ; Updated parentheses to V5.0, W. Landsman September 1997 ; Added check for undefined input D. Zarro December 1998 ;- ; ON_ERROR,2 ; ; Check for undefined input ; IF N_ELEMENTS(NUMBER) EQ 0 THEN BEGIN message,'Undefined input argument',/cont return,'' ENDIF ; ; Check the type of the variable NUMBER. ; S = SIZE(NUMBER) TYPE = S[S[0] + 1] ; ; If NUMBER is complex, then process the real and imaginary parts separately. ; IF TYPE EQ 6 THEN BEGIN RNUMBER = FLOAT(NUMBER) INUMBER = IMAGINARY(NUMBER) CASE N_PARAMS() OF 1: BEGIN RNUMBER = TRIM(RNUMBER) INUMBER = TRIM(INUMBER) END 2: BEGIN RNUMBER = TRIM(RNUMBER,FORMAT) INUMBER = TRIM(INUMBER,FORMAT) END 3: BEGIN RNUMBER = TRIM(RNUMBER,FORMAT,FLAG) INUMBER = TRIM(INUMBER,FORMAT,FLAG) END ENDCASE RETURN, '(' + RNUMBER + ',' + INUMBER + ')' ENDIF ; ; If only NUMBER was passed, then return the desired result. ; IF N_PARAMS(0) EQ 1 THEN BEGIN IF TYPE EQ 7 THEN BEGIN TRM = STRTRIM(NUMBER,2) GOTO,RETURN END ELSE BEGIN IF NUMBER EQ 0 THEN BEGIN TRM = '0' GOTO,RETURN END ELSE BEGIN TRM = STRTRIM( STRING(NUMBER), 2 ) GOTO,REMOVE ENDELSE ENDELSE ENDIF ; ; Check the type of the variable FORMAT. ; S = SIZE(FORMAT) TYPE_FORMAT = S[S[0] + 1] ; ; If only two parameters were passed, then decide whether FORMAT or FLAG was ; passed, and return the desired result. ; IF N_PARAMS(0) EQ 2 THEN BEGIN IF TYPE_FORMAT EQ 7 THEN BEGIN TRM = STRTRIM( STRING(NUMBER,FORMAT), 2 ) GOTO,RETURN END ELSE BEGIN FLAG = FORMAT IF TYPE EQ 7 THEN BEGIN TRM = STRTRIM( NUMBER, FLAG ) GOTO,RETURN END ELSE BEGIN IF NUMBER EQ 0 THEN BEGIN TRM = '0' GOTO,RETURN END ELSE BEGIN TRM = STRTRIM( STRING(NUMBER), FLAG ) GOTO,REMOVE ENDELSE ENDELSE ENDELSE ENDIF ; ; All parameters were passed. Act accordingly. ; TRM = STRTRIM( STRING(NUMBER,FORMAT), FLAG ) GOTO,RETURN ; ; Remove any trailing zeros. First, check to make sure that the string ; contains a period. ; REMOVE: TRM = STRUPCASE(TRM) IF STRPOS(TRM,'.') EQ -1 THEN GOTO,RETURN ; ; Find and remove any exponential. ; LEN = STRLEN(TRM) EXP_POS = STRPOS(TRM,'E') IF EXP_POS EQ -1 THEN EXP = '' ELSE BEGIN EXP = STRMID(TRM,EXP_POS,LEN) TRM = STRMID(TRM,0,EXP_POS) LEN = STRLEN(TRM) ENDELSE ; ; Keep removing trailing zeros until done. ; WHILE STRMID(TRM,LEN-1,1) EQ '0' DO BEGIN TRM = STRMID(TRM,0,LEN-1) LEN = LEN - 1 ENDWHILE ; ; If the last character is a period, remove it as well. ; IF STRMID(TRM,LEN-1,1) EQ '.' THEN BEGIN TRM = STRMID(TRM,0,LEN-1) LEN = LEN - 1 ENDIF ; ; Restore the exponential. ; TRM = TRM + EXP ; ; Return the trimmed string TRM. ; RETURN: RETURN,TRM END ;################################################### ;################################################### ;################################################### ;+ ; NAME: ; DEL_HYDRO ; ; PURPOSE: ; This procedure destroys the hydro structure in a clean way. ; ; CATEGORY: ; Memory management. ; ; CALLING SEQUENCE: ; DEL_HYDRO, Hydro ; ; OPTIONAL INPUTS: ; None. ; ; OUTPUTS: ; None. ; ; COMMON BLOCKS: ; None. ; ; EXAMPLE: ; To destroy properly the HYDRO structure and free the allocated ; memory, type: ; ; DEL_HYDRO, Hydro ; ; MODIFICATION HISTORY: ; Written by: Romain Teyssier, 01/01/2000. ; e-mail: Romain.Teyssier@cea.fr ; Fevrier, 2001: Comments and header added by Romain Teyssier. ;- pro del_hydro, hydro, verbose=verbose IF N_PARAMS() NE 1 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'del_hydro' RETURN ENDIF if n_tags(hydro) ne 0 then begin if keyword_set(verbose) then $ print,'Freeing memory for hydro structure...' for icpu=0,hydro.ncpu-1 do begin for i=0,hydro.nlevelmax-1 do begin ptr_free,hydro.levelh[i,icpu] endfor endfor hydro=0 endif end ;################################################### ;################################################### ;################################################### pro box2cpu,SimuStepOutput,MeshIJKboundaries,cpubox,Endian i=SimuStepOutput if i lt 10 then begin outname='output_0000'+strcompress(string(i),/remove_all) endif else if i lt 100 then begin outname='output_000'+strcompress(string(i),/remove_all) endif else if i lt 1000 then begin outname='output_00'+strcompress(string(i),/remove_all) endif else if i lt 10000 then begin outname='output_0'+strcompress(string(i),/remove_all) endif else if i lt 100000 then begin outname='output_'+strcompress(string(i),/remove_all) end limits= ' -xmi '+strcompress(string(MeshIJKboundaries[0]),/remove_all) $ +' -xma '+strcompress(string(MeshIJKboundaries[1]),/remove_all) $ +' -ymi '+strcompress(string(MeshIJKboundaries[2]),/remove_all) $ +' -yma '+strcompress(string(MeshIJKboundaries[3]),/remove_all) $ +' -zmi '+strcompress(string(MeshIJKboundaries[4]),/remove_all) $ +' -zma '+strcompress(string(MeshIJKboundaries[5]),/remove_all) exec='box2cpu' if Endian eq 1 then exec='box2cpuBigEndian' command=exec+' -inp '+outname+' -out cpu.dat'+limits print,'command=',command spawn, command u3=51 openr,u3,'cpu.dat',swap_endian=Endian ncpu=0 readf,u3,ncpu print,'ncpu=',ncpu cpubox=intarr(ncpu) for i=0,ncpu-1 do begin icpu=0 readf,u3,icpu cpubox[i]=icpu endfor close,u3 print,'cpubox=',cpubox end ;################################################### ;################################################### ;################################################### ;+ ; NAME: ; RD_AMR ; ; PURPOSE: ; This procedure reads the mesh structure from a RAMSES AMR file. ; ; CATEGORY: ; Input/Output. ; ; CALLING SEQUENCE: ; RD_AMR, Grid, FILE=file, SWAP=swap, NCPU=ncpu, ICPU=icpu, ; VERBOSE=verbose ; ; OPTIONAL INPUTS: ; FILE: if set, input the scalar string containing the name of ; the file to be read. Otherwise, a PICKFILE widget is ; launched. ; ; SWAP: if set, reverse the bit ordering (Little Endian versus ; Big Endian) ; ; ICPU: first cpu file to be read. Default: 1. ; ; NCPU: number of cpu files to read, starting from ; icpu. Default: all files from icpu to ncpu_max. ; ; OUTPUTS: ; Grid: store the AMR tree in structure Grid. ; ; COMMON BLOCKS: ; None. ; ; EXAMPLE: ; To read on a SGI architecture a RAMSES AMR file created on a ; COMPAQ Workstation, type: ; ; RD_AMR, Grid, file='amr_00001.out',/swap ; ; If the file was generated on the same IEEE system, just type: ; ; RD_AMR, Grid, file='amr_00001.out' ; ; MODIFICATION HISTORY: ; Written by: Romain Teyssier, 01/01/2000. ; e-mail: Romain.Teyssier@cea.fr ; Fevrier, 2001: Comments and header added by Romain Teyssier. ; November 2007: cpubox list of processors in the domain ; December 2007: bypass reading levels not required by meshijk ; April 2008: bypass storing levels not required by meshijk ;- pro rd_amr,grid,file=file,swap=swap,ncpu=ncpu,icpu=icpu,verbose=verbose,nout=nout,err=err,$ cpubox=cpubox,lmaxmeshijk=lmaxmeshijk,limit_lmax=limit_lmax ;verbose=1 IF N_PARAMS() NE 1 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'rd_amr' RETURN ENDIF if not keyword_set(icpu) then icpu=1 suffix=getcarnum(icpu) if not keyword_set(file) and not keyword_set(nout) then begin key='*amr*.out'+suffix(icpu-1) file=DIALOG_PICKFILE(/READ,filter=key) endif if keyword_set(nout) then begin suffnout=getcarnum(nout) file='output_'+suffnout(nout-1)+'/amr_'+suffnout(nout-1)+'.out' endif if not keyword_set(file) then return base_offset=strpos(file,'.out')+4 file_base=strmid(file,0,base_offset) ;print,'in rd_amr: test cpubox=',cpubox ;if keyword_set(cpubox) then begin ; print,'in rd_amr: cpubox=',cpubox ;endif ; Free memory associated to grid del_amr,grid ncpu_run=0L & ndim=0L & nx=0L & ny=0L & nz=0L nlevelmax=0L & ngridmax=0L & nstep=0L print,'Reading file ',trim(file_base) file=trim(file_base+suffix(icpu-1)) openr,1,file,/f77_unformatted,swap_endian=swap, ERROR=err if err ne 0 then begin PRINT, ' ' PRINT, 'error in opening Ramses AMR file' PRINT, 'file ', file ,' not found ' CD,'.',CURRENT=Dir PRINT, '=> possible problems : wrong directory or bad output number' print,' Current directory=',Dir return endif CATCH,Error_status if Error_status ne 0 then begin print,'Catching error : Error_status=',Error_status print,'problem in reading the amr, check the endianess...' err=1 close,1 return endif readu,1,ncpu_run readu,1,ndim readu,1,nx,ny,nz readu,1,nlevelmax readu,1,ngridmax readu,1,nstep readu,1,boxlen readu,1,t,aexp,hexp readu,1,omega_m,omega_l,omega_k,omega_b readu,1,unit_l,unit_d,unit_t close,1 print,'ncpu =',ncpu_run print,'ndim =',ndim print,'nlevelmax =',nlevelmax print,'ngridmax =',ngridmax print,'nstep =',nstep print,'boxlen =',boxlen print,'time =',t if(hexp gt 0.0)then begin ; detect cosmo run print,'aexp =',aexp print,'omega_m =',omega_m print,'omega_l =',omega_l print,'omega_k =',omega_k print,'omega_b =',omega_b print,'unit_l =',unit_l,' cm' print,'unit_d =',unit_d,' g/cc' print,'unit_t =',unit_t,' s' endif nlevelmax_read=nlevelmax if keyword_set(lmaxmeshijk) then nlevelmax_read=lmaxmeshijk*1L ;print,'rd_amr nlevelmax_read=',nlevelmax_read if not keyword_set(ncpu) then ncpu=ncpu_run-icpu+1 suffix=getcarnum(ncpu_run) ncell=2L^ndim ngrid=lonarr(nlevelmax,ncpu) level=PTRARR(nlevelmax,ncpu) ; Read AMR grids ngridtot=0L ;print,'icpu=',icpu for jcpu=0,ncpu-1 do begin if keyword_set(cpubox) then begin idcpu=(jcpu+icpu-1) + 1 ;print,'idcpu=',idcpu result=where(idcpu eq cpubox,count) ;print,'count=',count if count eq 0 then continue endif file=trim(file_base+suffix(jcpu+icpu-1)) if keyword_set(verbose) then print,'Reading file ',trim(file) print,'Reading file ',trim(file) openr,1,file,/f77_unformatted,swap_endian=swap, ERROR=err if err ne 0 then begin PRINT, ' ' PRINT, 'error in opening file' PRINT, 'file ', file ,' not found ' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif readu,1,ncpu_run readu,1,ndim readu,1,nx,ny,nz readu,1,nlevelmax readu,1,ngridmax readu,1,nstep readu,1,boxlen readu,1,t,aexp,hexp readu,1,omega_m,omega_l,omega_k,omega_b readu,1,unit_l,unit_d,unit_t nlevel=0L & ilevel=0L & ng=0L for i=0L,nlevelmax-1L do begin readu,1,ilevel readu,1,ng ngrid[i,jcpu]=ng if keyword_set(verbose) then print,i,ilevel,ngrid[i,jcpu] $ ,format='("i=",i2," Level ",i2," has ",i6," grids")' if(ngrid(i,jcpu) gt 0)then begin ngridtot=ngridtot+ngrid(i,jcpu) ;if keyword_set(verbose) then print,ilevel,ngrid(i,jcpu) $ ; ,format='("Level ",i2," has ",i6," grids")' nlevel=nlevel+1L ; Define level structure if i lt nlevelmax_read or limit_lmax eq 0 then mesh2={ilevel:ilevel,nc:ng,xg:fltarr(ng,ndim),son:lonarr(ng,ncell)} xx=fltarr(ngrid(i,jcpu)) for idim=0,ndim-1 do begin readu,1,xx if i lt nlevelmax_read or limit_lmax eq 0 then mesh2.xg(*,idim)=xx endfor xx=0. if i lt nlevelmax_read or limit_lmax eq 0 then pc=ptr_new(mesh2) if i lt nlevelmax_read or limit_lmax eq 0 then level(i,jcpu)=pc endif if i ge nlevelmax_read and limit_lmax eq 1 then ngrid(i,jcpu) = -1 endfor for i=0L,nlevelmax_read-1L do begin if(ngrid(i,jcpu) gt 0)then begin iig=lonarr(ngrid(i,jcpu)) readu,1,iig for icell=0,ncell-1 do begin readu,1,iig (*level[i,jcpu]).son(*,icell)=iig endfor iig=0 endif endfor close,1 endfor ngrid=ngrid[0:nlevelmax-1,0:ncpu-1] level=level[0:nlevelmax-1,0:ncpu-1] grid={ncpu:ncpu,ndim:ndim,time:t,aexp:aexp,nlevelmax:nlevelmax,boxlen:boxlen $ ,ngridtot:ngridtot,ngrid:ngrid,level:level,unit_l:unit_l,unit_d:unit_d,unit_t:unit_t} mesh2=0 if keyword_set(verbose) then begin print,'AMR Infos:' ngrid_total_per_level=lonarr(nlevelmax) ngrid_total_per_level(*)=0L ngrid_total=0L for i=0L,nlevelmax-1L do begin for jcpu=0L,ncpu-1 do begin ngrid_total_per_level[i]=ngrid_total_per_level[i]+ngrid[i,jcpu] endfor print,'Level ',i+1,' has ',ngrid_total_per_level[i],' grids in total' ngrid_total=ngrid_total+ngrid_total_per_level[i] endfor save,ngrid_total_per_level,filename='amrinfo.sav' print,'Total number of grids (octs) =',ngrid_total ncell_total=ngrid_total*8 print,'Total number of cells =',ncell_total ngrid_formal_per_direction=0. ngrid_formal_per_direction=2.^nlevelmax ngrid_formal=0. ngrid_formal=ngrid_formal_per_direction^3. filling_factor=1.*ngrid_total/ngrid_formal print,'# of formal grid per dimension=',ngrid_formal_per_direction print,'# of formal grid total=',ngrid_formal print,'filling factor=',filling_factor endif return bad_luck: print,'I/O Error, exiting...' close,1 mesh2=0 return end ;################################################### ;################################################### ;################################################### ;+ ; NAME: ; RD_AMR2008 ; ; PURPOSE: ; This procedure reads the mesh structure from a RAMSES AMR file. ; ; CATEGORY: ; Input/Output. ; ; CALLING SEQUENCE: ; RD_AMR, Grid, FILE=file, SWAP=swap, NCPU=ncpu, ICPU=icpu, ; VERBOSE=verbose ; ; OPTIONAL INPUTS: ; FILE: if set, input the scalar string containing the name of ; the file to be read. Otherwise, a PICKFILE widget is ; launched. ; ; SWAP: if set, reverse the bit ordering (Little Endian versus ; Big Endian) ; ; ICPU: first cpu file to be read. Default: 1. ; ; NCPU: number of cpu files to read, starting from ; icpu. Default: all files from icpu to ncpu_max. ; ; OUTPUTS: ; Grid: store the AMR tree in structure Grid. ; ; COMMON BLOCKS: ; None. ; ; EXAMPLE: ; To read on a SGI architecture a RAMSES AMR file created on a ; COMPAQ Workstation, type: ; ; RD_AMR, Grid, file='amr_00001.out',/swap ; ; If the file was generated on the same IEEE system, just type: ; ; RD_AMR, Grid, file='amr_00001.out' ; ; MODIFICATION HISTORY: ; Written by: Romain Teyssier, 01/01/2000. ; e-mail: Romain.Teyssier@cea.fr ; Fevrier, 2001: Comments and header added by Romain Teyssier. ; March, 2008: integration in SDVision ;- pro rd_amr2008, grid, file=file, swap=swap, icpu=icpu, verbose=verbose, nout=nout IF N_PARAMS() NE 1 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'rd_amr' RETURN ENDIF if not keyword_set(icpu) then icpu=0 if icpu eq 0 then jcpu=1 else jcpu=icpu suffix=getcarnum(jcpu) if not keyword_set(file) and not keyword_set(nout) then begin key='*amr*.out'+suffix(jcpu-1) file=DIALOG_PICKFILE(/READ,filter=key) endif if keyword_set(nout) then begin suffnout=getcarnum(nout) file='output_'+suffnout(nout-1)+'/amr_'+suffnout(nout-1)+'.out' endif if not keyword_set(file) then return base_offset=strpos(file,'.out')+4 file_base=strmid(file,0,base_offset) ; Free memory associated to grid del_amr,grid ; Initialize header variables ncpu_run=0L & ndim=0L & nx=0L & ny=0L & nz=0L nlevelmax=0L & ngridmax=0L & nboundary=0L & ngridactual=0L & nstep=0L noutput=0L & boxlen=0.0d0 & t=0.0d0 iout=0L & ifout=0L aexp=0.0d0 & hexp=0.0d0 & aexp_old=0.0d0 & epot_tot_int=0.0d0 epot_tot_old=0.0d0 const=0.0d0 & mass_tot_0=0.0d0 & rho_tot=0.0d0 omega_m=0.0d0 & omega_l=0.0d0 & omega_k=0.0d0 & omega_b=0.0d0 & h0=0.0d0 aexp_ini=0.0d0 & mass_sph=0.0d0 headf=0L & tailf=0L & numbf=0L & used_mem=0L & used_mem_tot=0L ; Read first file to get header print,'Reading file ',trim(file_base) file=trim(file_base+suffix(jcpu-1)) openr,1,file,/f77_unformatted,swap_endian=swap readu,1,ncpu_run readu,1,ndim readu,1,nx,ny,nz ncoarse=nx*ny*nz readu,1,nlevelmax readu,1,ngridmax readu,1,nboundary readu,1,ngridactual readu,1,boxlen readu,1,noutput,iout,ifout tout=dblarr(noutput) aout=dblarr(noutput) readu,1,tout readu,1,aout readu,1,t dtold=dblarr(nlevelmax) dtnew=dblarr(nlevelmax) readu,1,dtold readu,1,dtnew readu,1,nstep,nstep_coarse readu,1,const,mass_tot_0,rho_tot readu,1,omega_m,omega_l,omega_k,omega_b,h0,aexp_ini readu,1,aexp,hexp,aexp_old,epot_tot_int,epot_tot_old readu,1,mass_sph close,1 ; Write header to screen print,'ncpu =',ncpu_run print,'ndim =',ndim print,'nlevelmax =',nlevelmax print,'nstep =',nstep print,'boxlen =',boxlen print,'time =',t if(hexp gt 0.0)then begin ; detect cosmo run print,'aexp =',aexp print,'omega_m =',omega_m print,'omega_l =',omega_l print,'omega_k =',omega_k print,'fgas =',omega_b endif if nboundary eq 0 then begin print,"Periodic boundary conditions" endif ; Allocate arrays ncpu=ncpu_run icpumin=1L & icpumax=ncpu & listmax=ncpu if icpu gt 0 then begin icpumin=icpu & icpumax=icpu & listmax=ncpu+nboundary endif suffix=getcarnum(ncpu_run) ncell=2L^ndim ngrid=LONARR(nlevelmax,listmax) level=PTRARR(nlevelmax,listmax) headl=LONARR(ncpu,nlevelmax) taill=LONARR(ncpu,nlevelmax) numbl=LONARR(ncpu,nlevelmax) if(nboundary gt 0)then begin headb=LONARR(nboundary,nlevelmax) tailb=LONARR(nboundary,nlevelmax) numbb=LONARR(nboundary,nlevelmax) endif numbtot=LONARR(10,nlevelmax) bound_key=DBLARR(ncpu+1) son=LONARR(ncoarse) flag1=LONARR(ncoarse) cpu_map=LONARR(ncoarse) xbound=[0d0,0d0,0d0] ordering=' ' ; Read AMR grids ; Loop over cpu files ngridtot=0L list=0L for jcpu=icpumin,icpumax do begin file=trim(file_base+suffix(jcpu-1)) if keyword_set(verbose) then print,'Reading file ',trim(file) openr,1,file,/f77_unformatted,swap_endian=swap ; Read header readu,1,ncpu_run readu,1,ndim readu,1,nx,ny,nz readu,1,nlevelmax readu,1,ngridmax readu,1,nboundary readu,1,ngridactual readu,1,boxlen readu,1,noutput,iout,ifout readu,1,tout readu,1,aout readu,1,t readu,1,dtold readu,1,dtnew readu,1,nstep,nstep_coarse readu,1,const,mass_tot_0,rho_tot readu,1,omega_m,omega_l,omega_k,omega_b,h0,aexp_ini readu,1,aexp,hexp,aexp_old,epot_tot_int,epot_tot_old readu,1,mass_sph readu,1,headl readu,1,taill readu,1,numbl readu,1,numbot if nboundary gt 0 then begin readu,1,headb readu,1,tailb readu,1,numbb xbound=[double(nx/2),double(ny/2),double(nz/2)] endif readu,1,headf,tailf,numbf,used_mem,used_mem_tot readu,1,ordering if(strcompress(ordering) eq 'bisection ')then begin readu,1 readu,1 readu,1 readu,1 readu,1 endif else begin readu,1,bound_key endelse readu,1,son readu,1,flag1 readu,1,cpu_map ; Read fine levels nlevel=0L & ilevel=0L & ng=0L kcpumin=1L & kcpumax=nboundary+ncpu for ilevel=0L,nlevelmax-1L do begin for kcpu=kcpumin,kcpumax do begin if(kcpu le ncpu)then begin ng=numbl(kcpu-1,ilevel) endif else begin ng=numbb(kcpu-ncpu-1,ilevel) endelse if icpu eq 0 then begin if (kcpu eq jcpu) then ngrid(ilevel,kcpu-1)=ng endif else begin ngrid(ilevel,kcpu-1)=ng endelse if(ng gt 0)then begin ngridtot=ngridtot+ng if keyword_set(verbose) then begin print,ilevel+1,ng,kcpu $ ,format='("Level ",i2," has ",i6," grids in proc",i6)' endif nlevel=nlevel+1L mesh2={ilevel:ilevel,nc:ng,xg:dblarr(ng,ndim),son:lonarr(ng,ncell)} ii=lonarr(ng) ; Define level structure xx=dblarr(ng) readu,1,ii ; Read grid index readu,1,ii ; Read next index readu,1,ii ; Read prev index for idim=0,ndim-1 do begin readu,1,xx ; Read grid center mesh2.xg(*,idim)=xx-xbound(idim) endfor readu,1,ii ; Read father index for idim=0,2*ndim-1 do begin readu,1,ii ; Read nbor index endfor for idim=0,2^ndim-1 do begin readu,1,ii ; Read son index mesh2.son(*,idim)=ii endfor for idim=0,2^ndim-1 do begin readu,1,ii ; Read cpu map endfor for idim=0,2^ndim-1 do begin readu,1,ii ; Read refinement map endfor xx=0d0 if icpu eq 0 then begin if(kcpu eq jcpu)then begin pc=ptr_new(mesh2) level(ilevel,jcpu-1)=pc endif endif else begin pc=ptr_new(mesh2) level(ilevel,kcpu-1)=pc endelse list=list+1L endif endfor endfor close,1 endfor ngrid=ngrid[0:nlevelmax-1,0L:listmax-1L] level=level[0:nlevelmax-1,0L:listmax-1L] grid={ncpu:listmax,ndim:ndim,time:t,aexp:aexp,nlevelmax:nlevelmax,boxlen:boxlen $ ,ngridtot:ngridtot,ngrid:ngrid,level:level} help,grid,/struct mesh2=0 return bad_luck: print,'I/O Error, exiting...' close,1 mesh2=0 return end ;################################################### ;################################################### ;################################################### ;+ ; NAME: ; RD_HYDRO ; ; PURPOSE: ; This procedure reads particles from a RAMSES HYDRO file. ; ; CATEGORY: ; Input/Output. ; ; CALLING SEQUENCE: ; RD_HYDRO, Hydro, FILE=file, SWAP=swap, NVAR=nvar, NCPU=ncpu, ; ICPU=icpu, VERBOSE=verbose ; ; INPUTS: ; None. ; ; OPTIONAL INPUTS: ; FILE: if set, input the scalar string containing the name of ; the file to be read. Otherwise, a PICKFILE widget is ; launched. ; ; SWAP: if set, reverse the bit ordering (Little Endian versus ; Big Endian) ; ; IVAR: first hydro variable to be read. Default: 1. ; ; NVAR: if set, load in memory only NVAR variables. Default: ; all variables from ivar to nvar_max. ; ; ICPU: first cpu file to be read. Default: 1. ; ; NCPU: number of cpu files to read, starting from ; icpu. Default: all files from icpu to ncpu_max. ; ; OUTPUTS: ; Hydro: Store hydrodynamics variables in structure Hydro. ; ; COMMON BLOCKS: ; None. ; ; RESTRICTIONS: ; None. ; ; EXAMPLE: ; To read on a SGI architecture a RAMSES HYDRO file created on a ; COMPAQ Workstation, type: ; ; RD_HYDRO,h,file='hydro_00001.out',/swap ; ; If the file was generated on the same IEEE system, just type: ; ; RD_HYDRO,h,file='hydro_00001.out' ; ; MODIFICATION HISTORY: ; Written by: Romain Teyssier, 01/01/2000. ; e-mail: Romain.Teyssier@cea.fr ; Fevrier, 2001: Comments and header added by Romain Teyssier. ; November 2007: cpubox list of processors in the domain ; December 2007: bypass reading levels not required by meshijk ;- pro rd_hydro, hydro, file=file, swap=swap, ivar=ivar, nvar=nvar $ , icpu=icpu, ncpu=ncpu, verbose=verbose, nout=nout,err=err,cpubox=cpubox,lmaxmeshijk=lmaxmeshijk IF N_PARAMS() NE 1 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'rd_hydro' RETURN ENDIF if not keyword_set(icpu) then icpu=1 if not keyword_set(ivar) then ivar=1 suffix=getcarnum(icpu) if not keyword_set(file) and not keyword_set(nout) then begin key='*hydro*.out'+suffix(icpu-1) file=DIALOG_PICKFILE(/READ,filter=key) endif if keyword_set(nout) then begin suffnout=getcarnum(nout) file='output_'+suffnout(nout-1)+'/hydro_'+suffnout(nout-1)+'.out' endif if not keyword_set(file) then return base_offset=strpos(file,'.out')+4 file_base=strmid(file,0,base_offset) ;print,'in rd_hydro: test cpubox=',cpubox ; Freeing memory associated to hydro structure del_hydro,hydro ncpu_run=0L & ndim=0L & nlevelmax=0L & ng=0L & nvar_run=0L & ilevel=0L print,'Reading file ',trim(file_base) file=trim(file_base+suffix(icpu-1)) openr,1,file,/f77_unformatted,swap_endian=swap, ERROR=err if err ne 0 then begin PRINT, ' ' PRINT, 'error in opening Ramses Hydro file' PRINT, 'file ', file ,' not found ' CD,'.',CURRENT=Dir PRINT, '=> possible problems : wrong directory or bad output number' print,' Current directory=',Dir return endif readu,1,ncpu_run readu,1,nvar_run readu,1,ndim readu,1,nlevelmax readu,1,gamma close,1 print,'ncpu =',ncpu_run print,'ndim =',ndim print,'nlevelmax =',nlevelmax print,'nvar =',nvar_run print,'gamma =',gamma nlevelmax_read=nlevelmax if keyword_set(lmaxmeshijk) then nlevelmax_read=lmaxmeshijk*1L ;print,'rd_hydro nlevelmax_read=',nlevelmax_read if not keyword_set(ncpu) then ncpu=ncpu_run-icpu+1 if not keyword_set(nvar) then nvar=nvar_run-ivar+1 suffix=getcarnum(ncpu_run) ncell=2L^ndim levelh=PTRARR(nlevelmax,ncpu) ;Read levels for jcpu=0,ncpu-1 do begin if keyword_set(cpubox) then begin idcpu=(jcpu+icpu-1) + 1 ;print,'idcpu=',idcpu result=where(idcpu eq cpubox,count) ;print,'count=',count if count eq 0 then continue endif file=trim(file_base+suffix(jcpu+icpu-1)) if keyword_set(verbose) then print,'Reading file ',file print,'Reading file ',trim(file) openr,1,file,/f77_unformatted,swap_endian=swap, ERROR=err if err ne 0 then begin PRINT, ' ' PRINT, 'error in opening file' PRINT, 'file ', file ,' not found ' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif readu,1,cpu_run readu,1,nvar_run readu,1,ndim readu,1,nlevelmax readu,1,gamma nlevel=0L & ilevel=0L & ng=0L ;nlevelmax=7L for i=0L,nlevelmax_read-1L do begin readu,1,ilevel readu,1,ng if(ng gt 0L)then begin if keyword_set(verbose) then print,ilevel,ng $ ,format='("Level ",i2," has ",i6," grids")' nlevel=nlevel+1L mesh={ilevel:ilevel,nc:ng,u:fltarr(ng,ncell,nvar) } ;help,mesh,/struc ;help,mesh.u xx=fltarr(ng) for icell=0,ncell-1 do begin for jvar=0L,nvar_run-1L do begin readu,1,xx if jvar ge (ivar-1) and $ jvar lt (ivar+nvar-1) then begin mesh.u(*,icell,jvar-ivar+1)=xx endif endfor endfor pc=ptr_new(mesh) levelh(i,jcpu)=pc xx=0. endif endfor close,1 endfor ;levelh=levelh[0:nlevelmax-1,0:ncpu-1] hydro={ncpu:ncpu,gamma:gamma,ndim:ndim,nlevelmax:nlevelmax,nvar:nvar,levelh:levelh} help,hydro,/struct end ;+ ; NAME: ; RD_HYDRO ; ; PURPOSE: ; This procedure reads particles from a RAMSES HYDRO file. ; ; CATEGORY: ; Input/Output. ; ; CALLING SEQUENCE: ; RD_HYDRO, Hydro, FILE=file, SWAP=swap, NVAR=nvar, NCPU=ncpu, ; ICPU=icpu, VERBOSE=verbose ; ; INPUTS: ; None. ; ; OPTIONAL INPUTS: ; FILE: if set, input the scalar string containing the name of ; the file to be read. Otherwise, a PICKFILE widget is ; launched. ; ; SWAP: if set, reverse the bit ordering (Little Endian versus ; Big Endian) ; ; IVAR: first hydro variable to be read. Default: 1. ; ; NVAR: if set, load in memory only NVAR variables. Default: ; all variables from ivar to nvar_max. ; ; ICPU: first cpu file to be read. Default: 1. ; ; NCPU: number of cpu files to read, starting from ; icpu. Default: all files from icpu to ncpu_max. ; ; OUTPUTS: ; Hydro: Store hydrodynamics variables in structure Hydro. ; ; COMMON BLOCKS: ; None. ; ; RESTRICTIONS: ; None. ; ; EXAMPLE: ; To read on a SGI architecture a RAMSES HYDRO file created on a ; COMPAQ Workstation, type: ; ; RD_HYDRO,h,file='hydro_00001.out',/swap ; ; If the file was generated on the same IEEE system, just type: ; ; RD_HYDRO,h,file='hydro_00001.out' ; ; MODIFICATION HISTORY: ; Written by: Romain Teyssier, 01/01/2000. ; e-mail: Romain.Teyssier@cea.fr ; Fevrier, 2001: Comments and header added by Romain Teyssier. ;- pro rd_hydro2008, hydro, file=file, swap=swap, ivar=ivar, icpu=icpu, verbose=verbose, nout=nout IF N_PARAMS() NE 1 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'rd_hydro' RETURN ENDIF if not keyword_set(icpu) then icpu=0 if not keyword_set(ivar) then ivar=0 if icpu eq 0 then jcpu=1 else jcpu=icpu suffix=getcarnum(jcpu) if not keyword_set(file) and not keyword_set(nout) then begin key='*hydro*.out'+suffix(jcpu-1) file=DIALOG_PICKFILE(/READ,filter=key) endif if keyword_set(nout) then begin suffnout=getcarnum(nout) file='output_'+suffnout(nout-1)+'/hydro_'+suffnout(nout-1)+'.out' endif if not keyword_set(file) then return base_offset=strpos(file,'.out')+4 file_base=strmid(file,0,base_offset) ; Freeing memory associated to hydro structure del_hydro,hydro ; Initialize header variables ncpu_run=0L & ndim=0L & nlevelmax=0L & ng=0L & nvar_run=0L & ilevel=0L & nboundary=0L gamma=0d0 ; Read first file to get header print,'Reading file ',trim(file_base) file=trim(file_base+suffix(jcpu-1)) openr,1,file,/f77_unformatted,swap_endian=swap readu,1,ncpu_run readu,1,nvar_run readu,1,ndim readu,1,nlevelmax readu,1,nboundary readu,1,gamma close,1 ; Write header to screen print,'ncpu =',ncpu_run print,'ndim =',ndim print,'nlevelmax =',nlevelmax print,'nvar =',nvar_run print,'gamma =',gamma if nboundary eq 0 then begin print,"Periodic boundary conditions" endif ; Allocate arrays ncpu=ncpu_run & nvar=nvar_run icpumin=1L & icpumax=ncpu & listmax=ncpu & vartot=nvar if icpu gt 0 then begin icpumin=icpu & icpumax=icpu & listmax=ncpu+nboundary endif if ivar gt 0 then begin vartot=1 endif suffix=getcarnum(ncpu_run) ncell=2L^ndim levelh=PTRARR(nlevelmax,listmax) ; Loop over cpu files for jcpu=icpumin,icpumax do begin file=trim(file_base+suffix(jcpu-1)) if keyword_set(verbose) then print,'Reading file ',file openr,1,file,/f77_unformatted,swap_endian=swap ; Read header readu,1,cpu_run readu,1,nvar_run readu,1,ndim readu,1,nlevelmax readu,1,nboundary readu,1,gamma ; Read fine levels nlevel=0L & ilevel=0L & ng=0L kcpumin=1L & kcpumax=nboundary+ncpu for i=0L,nlevelmax-1L do begin for kcpu=kcpumin,kcpumax do begin readu,1,ilevel readu,1,ng if(ng gt 0L)then begin if keyword_set(verbose) then print,ilevel,ng $ ,format='("Level ",i2," has ",i6," grids")' nlevel=nlevel+1L mesh={ilevel:ilevel,nc:ng,u:dblarr(ng,ncell,vartot) } xx=dblarr(ng) for icell=0,ncell-1 do begin for jvar=1L,nvar_run do begin readu,1,xx if ivar eq 0 then begin mesh.u(*,icell,jvar-1)=xx endif else begin if jvar eq ivar then begin mesh.u(*,icell,0)=xx endif endelse endfor endfor if icpu eq 0 then begin if(kcpu eq jcpu)then begin pc=ptr_new(mesh) levelh(i,jcpu-1)=pc endif endif else begin pc=ptr_new(mesh) levelh(i,kcpu-1)=pc endelse xx=0. endif endfor endfor close,1 endfor ;levelh=levelh[0:nlevelmax-1,0:ncpu-1] hydro={ncpu:listmax,gamma:gamma,ndim:ndim,nlevelmax:nlevelmax,nvar:vartot,levelh:levelh} end ;################################################### ;################################################### ;################################################### ;################################################### ;################################################### ;################################################### ;+ ; NAME: ; RD_PART ; ; PURPOSE: ; This procedure reads particles from a RAMSES PART file. ; ; CATEGORY: ; Input/Output. ; ; CALLING SEQUENCE: ; RD_PART,Part, FILE=file, SWAP=swap, ICPU=icpu, NCPU=ncpu, ; DENSITY=density, TIME=time ; ; INPUTS: ; None. ; ; OPTIONAL INPUTS: ; FILE: if set, input the scalar string containing the name of ; the file to be read. Otherwise, a PICKFILE widget is ; launched. ; ; SWAP: if set, reverse the bit ordering (Little Endian versus ; BigEndian) ; ; ICPU: first cpu file to be read. Default: 1. ; ; NCPU: number of cpu files to read, starting from ; icpu. Default: all files from icpu to ncpu_max. ; ; DENSITY: if set, read a file containing the SPH density for ; each particle. Can also be set to the density file name. ; ; TIME: if set, read in FILE the birth eopch of each ; particle. Usefull for star formation runs. ; ; OUTPUTS: ; Part: structure containing particles positions, velocities, ; masses and levels. If DENSITY is set, it also contains SPH ; densities. If TIME is set, it also contains the birth epoch. ; ; COMMON BLOCKS: ; None. ; ; EXAMPLE: ; To read on a SGI architecture a RAMSES PART file created on a ; COMPAQ Workstation, type: ; ; RD_PART, part, file='part_00001.out',/swap ; ; If the file was generated on the same IEEE system, just type: ; ; RD_PART, part, file='part_00001.out' ; ; MODIFICATION HISTORY: ; Written by: Romain Teyssier, 01/01/2000. ; e-mail: Romain.Teyssier@cea.fr ; Fevrier, 2001: Comments and header added by Romain Teyssier. ;- pro rd_part, part, file=file, swap=swap, density=density, velocity=velocity $ ,ncpu=ncpu, icpu=icpu ,time=time, verbose=verbose, nout=nout,err=err,cpubox=cpubox IF N_PARAMS() NE 1 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'rd_part' RETURN ENDIF if not keyword_set(icpu) then icpu=1 suffix=getcarnum(icpu) if not keyword_set(file) and not keyword_set(nout) then begin key='*.out'+suffix(icpu-1) file=DIALOG_PICKFILE(/READ,filter=key) endif if keyword_set(nout) then begin suffnout=getcarnum(nout) file='output_'+suffnout(nout-1)+'/part_'+suffnout(nout-1)+'.out' endif if not keyword_set(file) then return base_offset=strpos(file,'.out')+4 file_base=strmid(file,0,base_offset) ; Free memory associated to particles part=0. ncpu_run=0L & ndim=0L print,'Reading file ',trim(file_base) file=trim(file_base+suffix(icpu-1)) openr,1,file,/f77_unformatted,swap_endian=swap, ERROR=err if err ne 0 then begin PRINT, ' ' PRINT, 'error in opening Ramses Particles file' PRINT, 'file ', file ,' not found ' CD,'.',CURRENT=Dir PRINT, '=> possible problems : wrong directory or bad output number' print,' Current directory=',Dir return endif CATCH,Error_status if Error_status ne 0 then begin print,'Catching error : Error_status=',Error_status print,'problem in reading the particles, check the endianess...' err=1 close,1 return endif readu,1,ncpu_run readu,1,ndim close,1 print,'ncpu =',ncpu_run print,'ndim =',ndim if not keyword_set(ncpu) then ncpu=ncpu_run-icpu+1 suffix=getcarnum(icpu+ncpu-1) npartp=0L & npart=0L ; Compute total number of particle for jcpu=0,ncpu-1 do begin if keyword_set(cpubox) then begin idcpu=(jcpu+icpu-1) + 1 ;print,'idcpu=',idcpu result=where(idcpu eq cpubox,count) ;print,'count=',count if count eq 0 then continue endif file=trim(file_base+suffix(jcpu+icpu-1)) if keyword_set(verbose) then print,'Reading file ',trim(file) print,'Reading file ',trim(file) openr,1,file,/f77_unformatted,swap_endian=swap, ERROR=err if err ne 0 then begin PRINT, ' ' PRINT, 'error in opening file' PRINT, 'file ', file ,' not found ' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif readu,1,ncpu_run readu,1,ndim readu,1,npartp ;print,'jcpu=',jcpu,' npartp=',npartp close,1 if keyword_set(verbose) then print,ndim,npartp $ ,format='("ndim=",I1," npart=",I8)' npart=npart+npartp endfor print,'# of particles =',npart ;npart=npart/10 ;print,'sampling npart=',npart npartID=1;npart npartMP=1;npart ;print,'Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' ; Allocate memory if not keyword_set(density) and not keyword_set(time) then begin if not keyword_set(velocity) then begin ;print,'cas 1' part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(ndim,npart) $ ,id:lonarr(npartID) $ ,mp:fltarr(npartMP)} endif else begin ;print,'cas 2' part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(ndim,npart) $ ,vp:fltarr(npart,ndim) $ ,id:lonarr(npartID) $ ,mp:fltarr(npartMP)} endelse endif else if not keyword_set(time) then begin if not keyword_set(velocity) then begin ;print,'cas 3' part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(ndim,npart) $ ,id:lonarr(npartID) $ ,mp:fltarr(npartMP) $ ,dp:fltarr(npart) } endif else begin ;print,'cas 4' part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(ndim,npart) $ ,vp:fltarr(npart,ndim) $ ,id:lonarr(npartID) $ ,mp:fltarr(npartMP) $ ,dp:fltarr(npart) } endelse endif else if not keyword_set(density) then begin if not keyword_set(velocity) then begin ;print,'cas 5' part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(ndim,npart) $ ,id:lonarr(npartID) $ ,mp:fltarr(npartMP) $ ,ap:fltarr(npart) } endif else begin ;print,'cas 6' part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(ndim,npart) $ ,vp:fltarr(npart,ndim) $ ,id:lonarr(npartID) $ ,mp:fltarr(npartMP) $ ,ap:fltarr(npart) } endelse endif else begin if not keyword_set(velocity) then begin ;print,'cas 7' part={ opti:opti $ ,ndim:ndim $ ,npart:npart $ ,xp:fltarr(ndim,npart) $ ,id:lonarr(npartID) $ ,mp:fltarr(npartMP) $ ,dp:fltarr(npart) $ ,ap:fltarr(npart) } endif else begin ;print,'cas 8' part={ opti:opti $ ,ndim:ndim $ ,npart:npart $ ,xp:fltarr(ndim,npart) $ ,vp:fltarr(npart,ndim) $ ,id:lonarr(npartID) $ ,mp:fltarr(npartMP) $ ,dp:fltarr(npart) $ ,ap:fltarr(npart) } endelse endelse ;help,part,/struct ;print,'Dynamic memory used =',MEMORY(/CURRENT)/1000000.,' Megabytes' iskip=0L for jcpu=0,ncpu-1 do begin if keyword_set(cpubox) then begin idcpu=(jcpu+icpu-1) + 1 ;print,'idcpu=',idcpu result=where(idcpu eq cpubox,count) ;print,'count=',count if count eq 0 then continue endif file=trim(file_base+suffix(jcpu+icpu-1)) openr,1,file,/f77_unformatted,swap_endian=swap print,'Reading file ',file readu,1,ncpu_run readu,1,ndim readu,1,npartp if(npartp gt 0)then begin xx=fltarr(npartp) i1=iskip & i2=iskip+npartp-1L readu,1,xx part.xp(0,i1:i2)=xx readu,1,xx part.xp(1,i1:i2)=xx readu,1,xx part.xp(2,i1:i2)=xx readu,1,xx if keyword_set(velocity) then part.vp(i1:i2,0)=xx readu,1,xx if keyword_set(velocity) then part.vp(i1:i2,1)=xx readu,1,xx if keyword_set(velocity) then part.vp(i1:i2,2)=xx readu,1,xx if npartMP gt 1 then part.mp(i1:i2)=xx xx=0. id=lonarr(npartp) readu,1,id if npartID gt 1 then part.id(i1:i2)=id id=0L xx=fltarr(npartp) if keyword_set(time) then begin readu,1,xx part.ap(i1:i2)=xx endif endif xx=0. close,1 iskip=iskip+npartp endfor if keyword_set(density) then begin if density eq 1 then begin file=DIALOG_PICKFILE(/READ,filter='*.dens') endif else begin file=density endelse ; openr,1,file,swap_endian=swap,/f77_unf openr,1,file, ERROR=err if err ne 0 then begin PRINT, ' ' PRINT, 'error in opening Ramses Particles density file' PRINT, 'file ', file ,' not found ' CD,'.',CURRENT=Dir PRINT, '=> possible problems : wrong directory or bad output number' print,' Current directory=',Dir return endif nflag=0L & ntot=0L & nparmi=0L & nparma=0L & nparbuffer=0L ; readu,1,ntot readf,1,ntot if not (ntot eq npart) then begin print,'file '+file+' not compatible' print,'ntot=',ntot close,1 return endif print,'# of particles in the density file =',ntot xx=fltarr(ntot) readf,1,xx ; readu,1,xx close,1 part.dp=xx xx=0. endif end ;+ ; NAME: ; RD_PART2008 ; ; PURPOSE: ; This procedure reads particles from a RAMSES PART file. ; ; CATEGORY: ; Input/Output. ; ; CALLING SEQUENCE: ; RD_PART,Part, FILE=file, SWAP=swap, ICPU=icpu, NCPU=ncpu, ; DENSITY=density, TIME=time ; ; INPUTS: ; None. ; ; OPTIONAL INPUTS: ; FILE: if set, input the scalar string containing the name of ; the file to be read. Otherwise, a PICKFILE widget is ; launched. ; ; SWAP: if set, reverse the bit ordering (Little Endian versus ; BigEndian) ; ; ICPU: first cpu file to be read. Default: 1. ; ; NCPU: number of cpu files to read, starting from ; icpu. Default: all files from icpu to ncpu_max. ; ; DENSITY: if set, read a file containing the SPH density for ; each particle. Can also be set to the density file name. ; ; TIME: if set, read in FILE the birth eopch of each ; particle. Usefull for star formation runs. ; ; OUTPUTS: ; Part: structure containing particles positions, velocities, ; masses and levels. If DENSITY is set, it also contains SPH ; densities. If TIME is set, it also contains the birth epoch. ; ; COMMON BLOCKS: ; None. ; ; EXAMPLE: ; To read on a SGI architecture a RAMSES PART file created on a ; COMPAQ Workstation, type: ; ; RD_PART, part, file='part_00001.out',/swap ; ; If the file was generated on the same IEEE system, just type: ; ; RD_PART, part, file='part_00001.out' ; ; MODIFICATION HISTORY: ; Written by: Romain Teyssier, 01/01/2000. ; e-mail: Romain.Teyssier@cea.fr ; Fevrier, 2001: Comments and header added by Romain Teyssier. ;- pro rd_part2008, part, file=file, swap=swap, density=density, velocity=velocity $ ,ncpu=ncpu, icpu=icpu ,time=time, verbose=verbose, nout=nout $ ,star=star IF N_PARAMS() NE 1 THEN BEGIN PRINT, 'Wrong number of arguments' DOC_LIBRARY,'rd_part' RETURN ENDIF if not keyword_set(icpu) then icpu=1 suffix=getcarnum(icpu) if not keyword_set(file) and not keyword_set(nout) then begin key='*.out'+suffix(icpu-1) file=DIALOG_PICKFILE(/READ,filter=key) endif if keyword_set(nout) then begin suffnout=getcarnum(nout) if keyword_set(star) then begin file='output_'+suffnout(nout-1)+'/star_'+suffnout(nout-1)+'.out' endif else begin file='output_'+suffnout(nout-1)+'/part_'+suffnout(nout-1)+'.out' endelse endif if not keyword_set(file) then return base_offset=strpos(file,'.out')+4 file_base=strmid(file,0,base_offset) ; Free memory associated to particles part=0. ncpu_run=0L & ndim=0L print,'Reading file ',trim(file_base) file=trim(file_base+suffix(icpu-1)) openr,1,file,/f77_unformatted,swap_endian=swap readu,1,ncpu_run readu,1,ndim close,1 print,'ncpu =',ncpu_run print,'ndim =',ndim if not keyword_set(ncpu) then ncpu=ncpu_run-icpu+1 suffix=getcarnum(icpu+ncpu-1) npartp=0L & npart=0L ; Compute total number of particle for jcpu=0,ncpu-1 do begin file=trim(file_base+suffix(jcpu+icpu-1)) if keyword_set(verbose) then print,'Reading file ',trim(file) openr,1,file,/f77_unformatted,swap_endian=swap readu,1,ncpu_run readu,1,ndim readu,1,npartp close,1 if keyword_set(verbose) then print,ndim,npartp $ ,format='("ndim=",I1," npart=",I8)' npart=npart+npartp endfor print,'npart =',npart ; Allocate memory if not keyword_set(density) and not keyword_set(time) then begin if not keyword_set(velocity) then begin part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(npart,ndim) $ ,id:lonarr(npart) $ ,mp:fltarr(npart)} endif else begin part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(npart,ndim) $ ,vp:fltarr(npart,ndim) $ ,id:lonarr(npart) $ ,mp:fltarr(npart)} endelse endif else if not keyword_set(time) then begin if not keyword_set(velocity) then begin part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(npart,ndim) $ ,id:lonarr(npart) $ ,mp:fltarr(npart) $ ,dp:fltarr(npart) } endif else begin part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(npart,ndim) $ ,vp:fltarr(npart,ndim) $ ,id:lonarr(npart) $ ,mp:fltarr(npart) $ ,dp:fltarr(npart) } endelse endif else if not keyword_set(density) then begin if not keyword_set(velocity) then begin part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(npart,ndim) $ ,id:lonarr(npart) $ ,mp:fltarr(npart) $ ,ap:fltarr(npart) } endif else begin part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(npart,ndim) $ ,vp:fltarr(npart,ndim) $ ,id:lonarr(npart) $ ,mp:fltarr(npart) $ ,ap:fltarr(npart) } endelse endif else begin if not keyword_set(velocity) then begin part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(npart,ndim) $ ,id:lonarr(npart) $ ,mp:fltarr(npart) $ ,dp:fltarr(npart) $ ,ap:fltarr(npart) } endif else begin part={ ndim:ndim $ ,npart:npart $ ,xp:fltarr(npart,ndim) $ ,vp:fltarr(npart,ndim) $ ,id:lonarr(npart) $ ,mp:fltarr(npart) $ ,dp:fltarr(npart) $ ,ap:fltarr(npart) } endelse endelse iskip=0L for jcpu=0,ncpu-1 do begin file=trim(file_base+suffix(jcpu+icpu-1)) openr,1,file,/f77_unformatted,swap_endian=swap readu,1,ncpu_run readu,1,ndim readu,1,npartp if(npartp gt 0)then begin xx=fltarr(npartp) i1=iskip & i2=iskip+npartp-1L readu,1,xx part.xp(i1:i2,0)=xx if (ndim gt 1)then begin readu,1,xx part.xp(i1:i2,1)=xx endif if (ndim gt 2)then begin readu,1,xx part.xp(i1:i2,2)=xx endif readu,1,xx if keyword_set(velocity) then part.vp(i1:i2,0)=xx if (ndim gt 1)then begin readu,1,xx if keyword_set(velocity) then part.vp(i1:i2,1)=xx endif if (ndim gt 2)then begin readu,1,xx if keyword_set(velocity) then part.vp(i1:i2,2)=xx endif readu,1,xx part.mp(i1:i2)=xx xx=0. id=lonarr(npartp) readu,1,id part.id(i1:i2)=id id=0L xx=fltarr(npartp) if keyword_set(time) then begin readu,1,xx part.ap(i1:i2)=xx endif endif xx=0. close,1 iskip=iskip+npartp endfor if keyword_set(density) then begin if density eq 1 then begin file=DIALOG_PICKFILE(/READ,filter='*.dis') endif else begin file=density endelse openr,1,file,swap_endian=swap,/f77_unf ; openr,1,file nflag=0L & ntot=0L & nparmi=0L & nparma=0L & nparbuffer=0L readu,1,nflag,ntot,nparmi,nparma,nparbuffer ; readf,1,ntot if not (ntot eq npart) then begin print,'file '+file+' not compatible' print,'ntot=',ntot close,1 return endif print,ntot nblocs=ntot/nparbuffer res = npart - nblocs*nparbuffer print,nblocs,nparbuffer for ibloc=0,nblocs-1 do begin nread=nparbuffer i1=ibloc*nparbuffer i2=i1+nread-1 print,ibloc,i1,i2,nread xx=dblarr(nread) readu,1,xx part.mp(i1:i2)=part.mp(i1:i2)/xx^3 endfor nread=res i1=nblocs*nparbuffer i2=i1+nread-1 xx=dblarr(nread) readu,1,xx part.mp(i1:i2)=part.mp(i1:i2)/xx^3 close,1 endif end ;################################################### ;################# JUPITER SECTION ################# ;######### ALL CODE FROM FREDERIC MASSET ########### ;################################################### pro getdesc, grid=grid,sState, nb=nb, levels=levels, dir=dir,$ cpus=cpus, force=force, all=all, add=add, _extra=e common HD_param, str_par ;+ ; NAME: ; GETDESC ; ; PURPOSE: ; Read information about mesh structure from a ; Descriptor[i].dat file, and construct an IDL graphics ; object, that can be visualized e.g. with XOBJVIEW. ; ; CATEGORY: ; IDL object creation routine. ; ; CALLING SEQUENCE: ; GETDESC, GRID=grid [, NB=nb] [, LEVELS=levels] ; [, DIR=directory] [, CPUS=cpus] [, /FORCE] [, /ALL] ; ; The GRID argument is mandatory. The set of mesh objects is returned ; in the grid variable. ; ; NB=nb: Read mesh information in 'Descriptor[nb].dat' ; file. Defaults to 0. ; ; LEVELS=levels: levels is a vector that is a list of levels to be ; displayed. If not specified, all levels are displayed. Allows to ; display non-contiguous levels: LEVELS=[0,2] displays only levels 0 ; and 2. In order to display levels from 0 to 2 one needs to give: ; LEVELS=[0,1,2]. ; ; DIR=directory: specifies the directory where to look for ; 'Descriptor[nb].dat'. Defaults to '.' ; ; /FORCE: if the variable given to the GRID keyword already contains ; an allocated object, force its destruction before building a ; mesh. This avoids memory leakage. If the /FORCE keyword is not ; specified while GRID already contains an object, the routine issues ; an error message and exits. ; ; /ADD: if the variable given to the GRID keyword already contains an ; allocated object, add the new one to the already existing one. It is ; an error to specify both /FORCE and /ADD. ; ; CPUS=cpus: specify whether to show how the grids are split between ; different cpus, and which CPUs are displayed. If 'cpus' is a scalar, ; then all CPUs are displayed (equivalent to /CPUS). If 'cpus' is a ; vector, then every CPU that belongs to the vector list is ; displayed. Beware that if you only want to see the CPU number 3, you ; need to typeset: CPUS=[3], rather than CPUS=3, since in this last ; case all CPUs would be displayed. If the CPUS keyword is not ; specified, than only the parent grids are displayed, and their ; splitting over the CPUs is not shown. ; ; /ALL: show everything, even CPUs or levels that do not belong to the ; lists explicitely provided by the LEVELS or CPUS keyword. If a mesh ; does not belong to these lists, it is displayed with a dotted line ; rather than a solid line. ; ; Example: show CPUs number 2 and 4 of mesh(es) at level 3. Everything ; else is shown in dotted lines: ; ; getdesc, grid=g, cpus=[2,4], lev=3, /all ; xobjview, g ; ;- if (NOT(ARG_PRESENT(GRID))) then begin doc_library, 'getdesc' return endif ;print,'test getdesc' ;help, grid, /object help, grid, /object, output=type type = [type] if (keyword_set(add) AND NOT((size(type))(1) GT 1)) then begin print, "Error: cannot add to anything." print, "Grid does not exist yet." return endif if ((size(type))(1) GT 1) then begin if keyword_set(force) then begin obj_destroy, grid endif else begin if (NOT(keyword_set(add))) then begin print, "Error: GRID is already an allocated object." print, "Use another variable or re-run with the /FORCE" print, "flag switched on to allow destruction prior" print, "to the mesh object build up." return endif endelse endif listcpu=indgen(4096) ;;help,cpus if NOT(n_elements(cpus) EQ 0) then listcpu=[cpus] mesh_color=[[0,0,0],[255,0,0],[0,255,0],[0,0,255],[255,255,0],[255,0,255],[0,255,255]] if (n_elements(levels) EQ 0) then levels=indgen(1000)-10 levels = [levels] ;if (NOT(keyword_set(ADD))) then grid = obj_new('IDLgrModel') if (NOT(keyword_set(ADD))) then begin ;print,'obj_destroy, sState.GeoStructure.JupiterGridModel' ;obj_destroy, sState.GeoStructure.JupiterGridModel ;sState.GeoStructure.JupiterGridModel = obj_new('IDLgrModel') ;grid = obj_new('IDLgrModel') ;sState.oModelObjects3D->Add, grid endif readstruct,dir=dir,nb=nb,sGeo ;print,'sGeo.in.RANGE1LOW=',sGeo.in.RANGE1LOW s=str_par.sgrid ngh = s.nghost ndim = s.ndim print,'***************** nb_cpu_grids=',s.nb_cpu_grids, '******************' result=sState.GeoStructure.oData_DomainsCounter->GetData(DomainsCounter) ;print,'DomainsCounter=',DomainsCounter if DomainsCounter ne 0 then begin ;print,'sState.GeoStructure.JupiterDomainsModel->Remove,/ALL' sState.GeoStructure.JupiterDomainsModel->Remove,/ALL endif DomainsCounter=s.nb_cpu_grids result=sState.GeoStructure.oData_DomainsCounter->SetData(DomainsCounter) coordtype=WIDGET_INFO(sState.wDomainsOptions[0],/DROPLIST_SELECT) boundary =1-WIDGET_INFO(sState.wDomainsOptions[1],/DROPLIST_SELECT) WIDGET_CONTROL,sState.wDomainsOptions[2],GET_VALUE=alpha alpha=alpha/100. thickness=WIDGET_INFO(sState.wDomainsOptions[3],/COMBOBOX_GETTEXT) ;print,'alpha=',alpha xrange=make_array([2]) yrange=make_array([2]) zrange=make_array([2]) eps=0.;0.95 WIDGET_CONTROL, sState.wAxisOptions[1], GET_VALUE=span if span eq 0 then begin xrange[0]=sGeo.in.RANGE2LOW xrange[1]=sGeo.in.RANGE2HIGH yrange[0]=sGeo.in.RANGE1LOW yrange[1]=sGeo.in.RANGE1HIGH zrange[0]=sGeo.in.RANGE3LOW zrange[1]=sGeo.in.RANGE3HIGH endif else if span eq 1 then begin nxg=sState.GeoStructure.nxg nyg=sState.GeoStructure.nyg nzg=sState.GeoStructure.nzg nmax=max([nxg,nyg,nzg]) if nmax eq nxg then begin xrange[0]=sGeo.in.RANGE2LOW xrange[1]=sGeo.in.RANGE2HIGH yrange[0]=sGeo.in.RANGE2LOW yrange[1]=sGeo.in.RANGE2HIGH zrange[0]=sGeo.in.RANGE2LOW zrange[1]=sGeo.in.RANGE2HIGH endif else if nmax eq nyg then begin xrange[0]=sGeo.in.RANGE1LOW xrange[1]=sGeo.in.RANGE1HIGH yrange[0]=sGeo.in.RANGE1LOW yrange[1]=sGeo.in.RANGE1HIGH zrange[0]=sGeo.in.RANGE1LOW zrange[1]=sGeo.in.RANGE1HIGH endif else if nmax eq nzg then begin xrange[0]=sGeo.in.RANGE3LOW xrange[1]=sGeo.in.RANGE3HIGH yrange[0]=sGeo.in.RANGE3LOW yrange[1]=sGeo.in.RANGE3HIGH zrange[0]=sGeo.in.RANGE3LOW zrange[1]=sGeo.in.RANGE3HIGH end end xs = Normalize(xrange, Position=[-0.5,0.5]) ys = Normalize(yrange, Position=[-0.5,0.5]) zs = Normalize(zrange, Position=[-0.5,0.5]) scale= 0.6 xs=xs*scale ys=ys*scale zs=zs*scale for i=0, s.nb_cpu_grids-1 do begin pedges = ptrarr(3) coordnb = s.coordnb for k=0,2 do pedges[k] = ptr_new(s.edges[s.parent[i],k,*]) pcorner_min = s.pcorner_min(i,*) pcorner_max = s.pcorner_max(i,*) level = s.level(s.parent(i)) if (([where(levels-level EQ 0)])(0) NE -1) then levpresent=1 if NOT(keyword_set(cpus)) then begin pcorner_min = [0,0,0] pcorner_max = [s.nx(s.parent(i)),$ s.ny(s.parent(i)),$ s.nz(s.parent(i))] endif present = 1 ;coordtype=str_par.sgrid.coordtype if keyword_set(cpus) then present=0 if (([where(listcpu-s.cpurank(i) EQ 0)])(0) NE -1) then present=1 if ((present*levpresent EQ 1) OR keyword_set(all)) then begin ;print,'pcorner_min=',pcorner_min ;print,'pcorner_max=',pcorner_max subgrid = obj_new('FMgrMesh',$ (*pedges[coordnb[0]])[ngh+pcorner_min[coordnb[0]]:$ ngh+pcorner_max[coordnb[0]]],$ (*pedges[coordnb[1]])[ngh+pcorner_min[coordnb[1]]:$ ngh+pcorner_max[coordnb[1]]],$ (*pedges[coordnb[2]])[ngh+pcorner_min[coordnb[2]]:$ ngh+pcorner_max[coordnb[2]]],$ meshtype=coordtype,linestyle=1-present*levpresent,boundary=boundary,$ color=mesh_color(*,min([level,(size(mesh_color))(2)-1])),$ XCoord_Conv=xs,YCoord_Conv=ys,ZCoord_Conv=zs, ALPHA_CHANNEL=alpha, $ THICK=thickness,_extra=e) sState.GeoStructure.JupiterDomainsModel ->Add, subgrid endif endfor close,1 return end ;****************************************************************************** ; pro readstruct, nb=nb, dir=dir,force=force,sGeo,sGrid common HD_param, str_par nbdef = 0 dirdef = '.' read_info_dir = 0 read_info_grid = 0 valid_dir=1 valid_grid=1 sd=0 ; Now before possibly applying default values we check whether ; they already exist in the STR_PAR structure, in which case they ; are "sticky" help,str_par,/struct,output=test ;We check that the 'directory' field exists in that structure if ((total(strpos(test,"DIRECTORY"))+(size(test))(1)) NE 0) then begin dirdef = str_par.directory endif else begin read_info_dir = 1 endelse ;We check that the 'noutput' field exists in that structure if ((total(strpos(test,"NOUTPUT"))+(size(test))(1)) NE 0) then begin nbdef = str_par.noutput endif else begin read_info_grid = 1 endelse ; If no fully valid directory information had been read previously, ; we try again if ((total(strpos(test,"VALIDDIR"))+(size(test))(1)) NE 0) then begin if (str_par.validdir EQ 0) then read_info_dir=1 endif if ((total(strpos(test,"VALIDGRID"))+(size(test))(1)) NE 0) then begin if (str_par.validgrid EQ 0) then read_info_grid=1 endif if ((total(strpos(test,"SGRID"))+(size(test))(1)) NE 0) then begin sg = str_par.sgrid endif if ((total(strpos(test,"SDIR"))+(size(test))(1)) NE 0) then begin sd = str_par.sdir endif lgr = -99999D0 if ((total(strpos(test,"LASTGRIDREAD"))+(size(test))(1)) NE 0) then begin lgr = str_par.lastgridread endif if (n_elements(nb) EQ 0) then nb=nbdef ;print, 'Read mesh information in Descriptor[',strcompress(string(nb),/remove_all),'].dat' if (n_elements(dir) EQ 0) then dir=dirdef if (nb NE nbdef) then read_info_grid = 1 if (dir NE dirdef) then read_info_dir = 1 if keyword_set(force) then read_info_dir = 1 if (read_info_dir) then read_info_grid = 1 ; Last, if the read_info_grid is still FALSE, we now determine the ; date at which the adequate "Descriptor[i].dat" file was last read, ; and we check whether the actual version is younger. Otherwise we force ; a new reading. if (read_info_grid EQ 0) then begin filename=strcompress("Descriptor"+string(nb)+".dat",/remove_all) file=filepath(filename,root_dir='.',subdir=str_par.sgrid.subdir) command="date -r "+file+" '+%a %b %d %H:%M:%S %Y'" spawn,command,res res=res(0) b=bin_date(res) ;b=bin_date() jdlw = julday(b(1),b(2),b(0),b(3),b(4),b(5)) if (jdlw GE lgr) then begin print,"Descriptor file is more recent than last read. Re-read forced." read_info_grid=1 endif endif ; ; ; We read the directory information (input parameters + endian swap flag) ; ; if (read_info_dir) then begin readstruct_dir, dir, sd, valid_dir str_par = {validdir:valid_dir,validgrid:valid_grid,directory:dir,$ noutput:nb,sgrid:0,lastgridread:lgr,sdir:sd} endif ;help,sd.in,/struct ;print,'sd.in.SIZE1=',sd.in.SIZE1 ;print,'sd.in.SIZE2=',sd.in.SIZE2 ;print,'sd.in.SIZE3=',sd.in.SIZE3 sGeo=sd ; ; We now read the grid structure ; if (read_info_grid) then begin readstruct_grid, dir, nb, sg, valid_grid if (valid_grid) then begin command="date '+%a %b %d %H:%M:%S %Y'" spawn,command,res res=res(0) b=bin_date(res) ;b=bin_date() lgr= julday(b(1),b(2),b(0),b(3),b(4),b(5)) endif endif sGrid=sg str_par = {validdir:valid_dir,validgrid:valid_grid,directory:dir,$ noutput:nb,sgrid:sg,lastgridread:lgr,sdir:sd} return end ;****************************************************************************** ; pro readstruct_dir, dir, sd, valid ; We read the directory 'dir' information ; Do we have an preformatted input file parameter ? print, "Reading directory wide information" input_par = '' valid=1 inp = filepath('IDL_params.dat',root_dir='.',subdir=dir) res=findfile(inp, count=c) if (c NE 0) then begin spawn,"cp "+inp+" _tempo_IDL_batch" print,'resolve_routine getinputparam' ; resolve_routine,'getinputparam' ; getinputparam, input_par endif else begin print, "Warning: no IDL_params.dat found in target directory" valid = 0 endelse ; We try to know whether we have to swap endians d=-2.3D0 ; if no test file exists we do not swap endians swap_endian=0 openr,1,filepath('testendian.dat',root_dir='.',subdir=dir), err=err if (err EQ 0) then begin readu,1,d close,1 endif else begin print, "Warning: no testendian.dat found in target directory" print, "Assuming no endian swap" valid = 0 endelse if (abs(d+2.3) GT 1d-6) then swap_endian=1 sd = {directory:dir,in:input_par,swap_endian:swap_endian} return end ;****************************************************************************** ; pro readstruct_grid, dir, nb, sg, valid common HD_param, str_par print, "Reading grid information" file=strcompress("Descriptor"+string(nb)+".dat",/remove_all) nbch = strcompress(string(nb),/remove_all) outd = strmid("output00000",0,11-strlen(nbch))+nbch subdir = dir+'/'+outd desc=filepath(file,root_dir='.',subdir=subdir) print,'readstruct_grid desc=',desc res = findfile(desc, count=c) valid=1 sg=0 maxlevel=0 if (c EQ 0) then begin print, "" print, "WARNING: no valid "+file+" found in target directory" print, "" valid = 0 endif else begin openr,1,desc, ERROR=err if err ne 0 then begin PRINT, 'error in opening file' PRINT, 'file ', desc ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif readf,1,date,noutput if (noutput NE nb) then print, "Warning : internal 'noutput' mismatch" readf,1,ndim,coordtype readf,1,ngrid,ncpu,ngh,nvar edges = dblarr(ngrid,3,2) nx = lonarr(ngrid) ny = lonarr(ngrid) nz = lonarr(ngrid) iface = lonarr(ngrid,3,2) ncorner_min = lonarr(ngrid,3) ncorner_max = lonarr(ngrid,3) gncorner_min = lonarr(ngrid,3) gncorner_max = lonarr(ngrid,3) varname=strarr(nvar) cpugsize = lonarr(ngrid*ncpu,3) cpunb = lonarr(ngrid) cpurank = lonarr(ngrid*ncpu) parent = lonarr(ngrid*ncpu) cgridlevel = lonarr(ngrid*ncpu) cgridnumber = lonarr(ngrid*ncpu) igrid = lonarr(ngrid) level = lonarr(ngrid) pcorner_min = lonarr(ngrid*ncpu,3) pcorner_max = lonarr(ngrid*ncpu,3) icpuface = lonarr(ngrid*ncpu,3,2) nb_cpu_grids=0 for i=0,nvar-1 do begin line='' readf,1,line varname(i)=line endfor for i=0, ngrid-1 do begin readf,1,iigrid,llevel,ncpu_grid readf,1,nnx,nny,nnz it= lonarr(3,2) readf,1,it nx(i) = nnx ny(i) = nny nz(i) = nnz iface(i,*,*)=it ex1 = ngh ex2 = ngh;*(ndim GT 1) ex3 = ngh;*(ndim EQ 3) edges_x = dblarr(nnx+ex1*2+1) edges_y = dblarr(nny+ex2*2+1) edges_z = dblarr(nnz+ex3*2+1) readf,1,edges_x,edges_y,edges_z size_to_achieve=max([nnx+ex1*2+1,nny+ex2*2+1,nnz+ex3*2+1]) actual_size = (size(edges))(3) if (size_to_achieve GT actual_size) then begin new_edges = dblarr(ngrid,3,size_to_achieve) new_edges(*,*,0:actual_size-1)=edges edges = new_edges endif edges(i,0,0:nnx+ex1*2) = edges_x edges(i,1,0:nny+ex2*2) = edges_y edges(i,2,0:nnz+ex3*2) = edges_z nc_min = lonarr(3) nc_max = lonarr(3) gnc_min = lonarr(3) gnc_max = lonarr(3) readf,1,nc_min, nc_max readf,1,gnc_min, gnc_max ncorner_min(i,*)=nc_min ncorner_max(i,*)=nc_max gncorner_min(i,*)=gnc_min gncorner_max(i,*)=gnc_max cpunb(i) = ncpu_grid igrid(i) = long(iigrid) level(i) = long(llevel) if (llevel GT maxlevel) then maxlevel = llevel for j=0, ncpu_grid-1 do begin readf,1,cnx,cny,cnz, cpunumber, cgnumber pc_min = lonarr(3) pc_max = lonarr(3) icgface = lonarr(3,2) readf,1,pc_min,pc_max readf,1,icgface icpuface(nb_cpu_grids,*,*)=icgface pcorner_min(nb_cpu_grids,*)=pc_min pcorner_max(nb_cpu_grids,*)=pc_max cpugsize(nb_cpu_grids,*)=[long(cnx),long(cny),long(cnz)] cpurank(nb_cpu_grids) = cpunumber cgridnumber(nb_cpu_grids) = cgnumber cgridlevel(nb_cpu_grids) = level(i) parent(nb_cpu_grids) = i nb_cpu_grids=nb_cpu_grids+1 endfor endfor close,1 coordname=[["X","Y","Z"],["Radius","Azimuth","Z"],["Radius","Azimuth","Co-latitude"]] ;help,str_par,/struct ;help,str_par.sdir,/struct ;help,str_par.sdir.in cpermut = str_par.sdir.in.coordpermut invcoordnb = lonarr(3) for i=0,2 do begin invcoordnb[i] = byte(strmid(cpermut,i,1))-byte('1') endfor coordnb=invcoordnb coordnb[0] = where(invcoordnb EQ 0) coordnb[1] = where(invcoordnb EQ 1) coordnb[2] = where(invcoordnb EQ 2) name=reform(coordname[invcoordnb,long(coordtype)]) sg = {noutput:nb,$ valid:valid, varname:varname,$ ndim:long(ndim),date:date,coordtype:long(coordtype),ngrid:long(ngrid),ncpu:long(ncpu),$ nvar:long(nvar),nghost:long(ngh),edges:edges,nx:nx,ny:ny,nz:nz,iface:iface,$ ncorner_min:ncorner_min,ncorner_max:ncorner_max,gncorner_min:gncorner_min,$ gncorner_max:gncorner_max,pcorner_min:pcorner_min,pcorner_max:pcorner_max,level:level,$ cpugsize:cpugsize,cpurank:cpurank,nb_cpu_grids:nb_cpu_grids,icpuface:icpuface,parent:parent,$ cgridlevel:cgridlevel,cgridnumber:cgridnumber,maxlevel:maxlevel,coordname:name,coordnb:coordnb,$ invcoordnb:invcoordnb,subdir:subdir} ;help,sg,/struct endelse return end ;****************************************************************************** ; ;forward_function getinputparam,dum ;@_tempo_IDL_batch ;return,input_par ;end ;****************************************************************************** ;pro getinputparam,input_par ;help, input_par ;@_tempo_IDL_batch ;help, input_par,/struct ;return ;end ;****************************************************************************** ;****************************************************************************** ;****************************************************************************** ; ; NAME: ; FMgrMesh ; ; PURPOSE: ; This object serves as a graphical representation of a mesh, ; which subclasses from the IDLgrModel class. The mesh can ; be either cartesian, cylindrical or spherical. ; ; CATEGORY: ; Object graphics. ; ; CALLING SEQUENCE: ; To initially create: ; oMesh = OBJ_NEW('FMgrMesh'[,xlim [,ylim [,zlim]]],$ ; meshtype = {0|1|2}, xstep=xstep, ystep=ystep,$ ; zstep=zstep, /boundary) ; ; To retrieve a property value: ; oMesh->GetProperty ; ; To set a property value: ; oMesh->SetProperty ; ; To print to the standard output stream the current properties of ; the mesh: ; oMesh->Print[, /full] ; ; To destroy: ; OBJ_DESTROY, oMesh ; ; KEYWORD PARAMETERS: ; FMGRMESH::INIT: ; ; XLIM, YLIM and ZLIM: coordinates of zones interfaces. They are ; floating arrays. If omitted they default respectively to ; [0.0,1.0] for xlim and ylim, and [0.0] for zlim. If we call ; nx, ny and nz the respective sizes of these arrays, the ; resulting mesh contains (nx-1)*(ny-1)*(nz-1) cells. If one or ; several variables of the set {nx, ny, nz} then the ; corresponding mesh is either a surface or a curved line. ; XSTEP, YSTEP and ZSTEP: each respectively 1st, 2nd or third ; coordinate isosurface is plotted every X,Y,ZSTEP cells, ; resulting in a less dense mesh (for visibility ; purpose). X,Y,ZSTEP does not need be a submultiple of ; nx,y,z. Even if they are not, the outer boundaries are plotted ; anyway. X,Y,ZLIM can be dynamically resized during the object ; lifetime (e.g. mesh->SetProperty, zlim = findgen(40)) ; MESHTYPE: 0 for cartesian (in which case x, y and zlim are ; self-explanatory), 1 for cartesian (in which case x is the ; radius, y is the azimuth, and z the height), any other value ; for spherical (in which case x is the radius, y the azimuth, ; and z is the latitude). ; BOUNDARY: set to non-zero value for the mesh to represent only ; its boundary edges and vertices. ; ; ; Example ; Create a horizontal 3x2 cartesian mesh, with boundaries only ; mesh = obj_new ('FMgrMesh', findgen(3)*.3, findgen(4)*.2, $ ; /boundary) ; Show inner zones ; mesh->SetProperty, b=0 ; Show every other y-interface ; mesh->SetProperty, ystep=2 ; Show every y-interface ; mesh->SetProperty, ystep=1 ; Replicate the mesh 5 times in z ; mesh->SetProperty, zlim=findgen(5)*.3 ; The mesh is now cylindrical: ; mesh->SetProperty, meshtype=1 ; Display mesh properties: ; mesh->Print, /full ; obj_destroy, mesh ;--------------------------------------------------------------------- function FMgrMesh::Init, xlim, ylim, zlim, Meshtype=meshtype,$ xstep = xstep, ystep = ystep, zstep = zstep,$ boundary = boundary, _EXTRA=e IF (self->IDLgrModel::Init(_EXTRA=e) NE 1) THEN RETURN, 0 if (n_elements (xlim) EQ 0) then xlim = [0.0,1.0] if (n_elements (ylim) EQ 0) then ylim = [0.0,1.0] if (n_elements (zlim) EQ 0) then zlim = 0.0 xlim = [xlim] ylim = [ylim] zlim = [zlim] nx = (size(xlim))(1) ny = (size(ylim))(1) nz = (size(zlim))(1) self.xlim = ptr_new(findgen(nx)) self.ylim = ptr_new(findgen(ny)) self.zlim = ptr_new(findgen(nz)) *self.xlim = xlim *self.ylim = ylim *self.zlim = zlim xst = 1 yst = 1 zst = 1 if (n_elements (xstep) NE 0) then xst = max([xstep,1]) if (n_elements (ystep) NE 0) then yst = max([ystep,1]) if (n_elements (zstep) NE 0) then zst = max([zstep,1]) self.xstep = xst self.ystep = yst self.zstep = zst bdr = 0 if (n_elements (boundary) NE 0) then begin if (boundary NE 0) then bdr = 1 endif M_T = 0 if (N_ELEMENTS(Meshtype) NE 0) then M_T = Meshtype self.Meshtype = M_T self.boundary = bdr self.oLine = OBJ_NEW('IDLgrPolyline', _EXTRA=e) self->Add, self.oLine self->MeshBuild return,1 END ;-------------------------------------------------------------------- PRO FMgrMesh::Cleanup obj_destroy, self.oLine PTR_FREE, self.xlim PTR_FREE, self.ylim PTR_FREE, self.zlim self->IDLgrModel::Cleanup return end ;-------------------------------------------------------------------- PRO FMgrMesh::SetProperty, XLIM=xlim, YLIM=ylim, ZLIM=zlim, $ XSTEP=xstep, YSTEP=ystep, ZSTEP=zstep,$ MESHTYPE=meshtype, Boundary=boundary, _EXTRA=e self->IDLgrModel::SetProperty, _EXTRA=e self.oLine->SetProperty, _EXTRA=e IF (N_ELEMENTS(xstep) NE 0) THEN $ self.xstep = max([xstep,1]) IF (N_ELEMENTS(ystep) NE 0) THEN $ self.ystep = max([ystep,1]) IF (N_ELEMENTS(zstep) NE 0) THEN $ self.zstep = max([zstep,1]) IF (N_ELEMENTS(meshtype) NE 0) THEN $ self.meshtype = meshtype IF (N_ELEMENTS(boundary) NE 0) THEN $ self.boundary = boundary IF (N_ELEMENTS(xlim) NE 0) THEN BEGIN xlim = [xlim] nx = (size(xlim))(1) PTR_FREE, self.xlim self.xlim = ptr_new(findgen(nx)) *self.xlim = xlim ENDIF IF (N_ELEMENTS(ylim) NE 0) THEN BEGIN ylim = [ylim] ny = (size(ylim))(1) PTR_FREE, self.ylim self.ylim = ptr_new(findgen(ny)) *self.ylim = ylim ENDIF IF (N_ELEMENTS(zlim) NE 0) THEN BEGIN zlim = [zlim] nz = (size(zlim))(1) PTR_FREE, self.zlim self.zlim = ptr_new(findgen(nz)) *self.zlim = zlim ENDIF self->MeshBuild RETURN END ;-------------------------------------------------------------------- PRO FMgrMesh::Print, full=full if (N_ELEMENTS(full) NE 0) then begin print, 'xlim = ', *self.xlim print, 'ylim = ', *self.ylim print, 'zlim = ', *self.zlim endif print, 'xstep = ', self.xstep print, 'ystep = ', self.ystep print, 'zstep = ', self.zstep if (self.boundary NE 0) then print, 'Boundaries only' case self.meshtype of 0: print, 'Cartesian mesh' 1: print, 'Cylindrical mesh' else: print, 'Spherical mesh' endcase return end ;-------------------------------------------------------------------- PRO FMgrMesh::GetProperty, XLIM=xlim, YLIM=ylim, ZLIM=zlim, $ XSTEP=xstep, YSTEP=ystep, ZSTEP=zstep,$ MESHTYPE=meshtype, Boundary=boundary, _REF_EXTRA=re self->IDLgrModel::GetProperty, _EXTRA=re self.oLine->GetProperty, _EXTRA=re xlim = *self.xlim ylim = *self.ylim zlim = *self.zlim xstep= self.xstep ystep= self.ystep zstep= self.zstep meshtype = self.meshtype boundary = self.boundary return END ;-------------------------------------------------------------------- PRO FMgrMesh::MeshBuild x = *self.xlim y = *self.ylim z = *self.zlim nx = (size(x))(1) ny = (size(y))(1) nz = (size(z))(1) ;print,'MeshBuild, nx,ny,nz,nx*ny*nz=',nx,ny,nz,nx*ny*nz xx = dblarr(nx*ny*nz) yy = xx zz = xx xst = self.xstep yst = self.ystep zst = self.zstep if (self.boundary NE 0) then begin xst = max([nx-1,1]) yst = max([ny-1,1]) zst = max([nz-1,1]) endif vertex = dblarr(3,nx*ny*nz) l = 0L M_T = self.MeshType ;for i=0, nx-1 do begin ; for j=0, ny-1 do begin ; for k = 0, nz-1 do begin ; case M_T of ; 0: begin ; xx(l) = x(i) ; yy(l) = y(j) ; zz(l) = z(k) ; end ; 1: begin ; xx(l) = x(i)*cos(y(j)) ; yy(l) = x(i)*sin(y(j)) ; zz(l) = z(k) ; end ; else: begin ; xx(l) = x(i)*cos(y(j))*sin(z(k)) ; yy(l) = x(i)*sin(y(j))*sin(z(k)) ; zz(l) = x(i)*cos(z(k)) ; end ; endcase ; l = l+1 ; endfor ; endfor ;endfor case M_T of 0: begin xx = reform(transpose(rebin(x,nx,ny*nz)),nx*ny*nz) yy = reform(rebin(reform(transpose(rebin(y,ny,nz)),ny*nz),ny*nz,nx),nx*ny*nz) zz = reform(rebin(z,nz,nx*ny),nx*ny*nz) end 1: begin xx = reform(transpose(rebin(reform(x##cos(y),nx*ny),nx*ny,nz)),nx*ny*nz) yy = reform(transpose(rebin(reform(x##sin(y),nx*ny),nx*ny,nz)),nx*ny*nz) zz = reform(rebin(z,nz,nx*ny),nx*ny*nz) end 2 : begin xx = reform(reform(x##cos(y),nx*ny)##sin(z),nx*ny*nz) yy = reform(reform(x##sin(y),nx*ny)##sin(z),nx*ny*nz) zz = reform(reform(x##(y*0.0+1.0),nx*ny)##cos(z),nx*ny*nz) end endcase i = -xst while (i LT nx-1) do begin i = i + xst if (i GE nx) then i = nx-1 j = -yst while (j LT ny-1) do begin j = j + yst if (j GE ny) then j = ny-1 if (n_elements (ndata) EQ 0) then $ ndata = [nz, lindgen(nz)+i*ny*nz+j*nz] $ else $ ndata = [ndata, nz, lindgen(nz)+i*ny*nz+j*nz] endwhile endwhile i = -xst while (i LT nx-1) do begin i = i + xst if (i GE nx) then i = nx-1 k = -zst while (k LT nz-1) do begin k = k + zst if (k GE nz) then k = nz-1 ndata = [ndata, ny, lindgen(ny)*nz+i*ny*nz+k] endwhile endwhile j = -yst while (j LT ny-1) do begin j = j + yst if (j GE ny) then j = ny-1 k = -zst while (k LT nz-1) do begin k = k + zst if (k GE nz) then k = nz-1 ndata = [ndata, nx, lindgen(nx)*nz*ny+j*nz+k] endwhile endwhile ndata = [ndata,-1] vertex(0,*) = xx vertex(1,*) = yy vertex(2,*) = zz self.oLine->SetProperty, data=vertex, polylines=ndata ;help,self.oLine ;help,vertex ;help,ndata ;print,'ndata=',ndata ;result=sState.GeoStructure.oDomainsData->SetData(DomainsData) xx = 0 yy = 0 zz = 0 return end ;-------------------------------------------------------------------- PRO FMgrMesh__define compile_opt idl2, hidden struct_hide, {FMgrMesh, inherits IDLgrModel, $ xlim: PTR_NEW(), ylim: PTR_NEW(), zlim: PTR_NEW(),$ MeshType:0L,$ xstep:1L, ystep:1L, zstep:1L, boundary:0L,$ oLine: OBJ_NEW()} end ;-------------------------------------------------------------------- ; pro desclist, level=level,nb=nb,list=list,verbose=verbose,dir=dir common HD_param, str_par ;+ ; NAME: ; DESCLIST ; ; PURPOSE: ; Returns the list (as a vector of integers) of cpu-grid ; numbers that exist for the given level list and output ; number (this latter needs to be a single number, not a ; vector). If no level number or level numbers list is ; supplied, all cpu-grids numbers corresponding to output ; number #nb (defaulting to 0) is supplied. If no cpu-grid is ; found the list contains only -1. ; ; CATEGORY: ; Input routine ; ; CALLING SEQUENCE: ; DESCLIST [,LEVEL=level] [,NB=nb] [,LIST=list] ; [,VERBOSE=verbose] [,DIR=dir] ; ; LEVEL=level: level is an integer or vector of ; integers which specifies the list of levels for which one wants ; the cpu-grids list. If this keyword is not supplied all the ; cpu-grids for the corresponding output number are looked up. ; ; NB=nb: Cpu-Grids at output number 'nb' are looked up. Default is ; 0. Useful is the run has been restarted with a different refinement ; hierarchy. ; ; LIST=list: upon return list is a vector of integers which contains ; the cpu-grids numbers found, or -1 if no cpu-grid belonging to ; the output 'nb' and the level list has been found. ; ; /VERBOSE: if this keyword is supplied the cpu-grids list is ; written to the standard output. ; ; DIR=dir: this string specifies the directory 'dir' where to ; look for cpu-grids. ;- MAXDESC = 4096 if ((n_elements(level) EQ 0) AND $ (n_elements(nb) EQ 0) AND $ (NOT Arg_Present(list)) AND $ (n_elements(verbose) EQ 0)) then begin doc_library, 'desclist' return endif if (NOT(keyword_set(nb))) then nb=0 if (n_elements(level) EQ 0) then level=indgen(100) scalarlevel=0 if (size(level))(0) EQ 0 then scalarlevel=1 level=[level] if (NOT(keyword_set(dir))) then dir='.' if (NOT(keyword_set(verbose))) then verbose=0 exist=lonarr(MAXDESC) readstruct,nb=nb,dir=dir lev = str_par.sgrid.level pgr = str_par.sgrid.parent cgn = str_par.sgrid.cgridnumber ncpugrid = str_par.sgrid.nb_cpu_grids list = [0] for i=0,ncpugrid-1 do begin levcg = lev(pgr(i)) if (([where(level-levcg EQ 0)])(0) NE -1) then list=[list,cgn(i)] endfor if scalarlevel then level=level[0] if (((size(list))(1)) EQ 1) then begin if Verbose then print,'No matching cpu-grid found' list = [-1] return endif list=list[1:*] if Verbose then print,'Cpu-grids that match output & level: ', list return end ;-------------------------------------------------------------------- ; pro read_field, nb=nb, radix=radix, component=component,$ cpugrid=cpugrid, dir=dir,$ field=field, center1=center1, center2=center2, center3=center3,$ edge1=edge1, edge2=edge2, edge3=edge3,$ quiet=quiet, bounds=bounds,$ level=level, size=size, velocity=velocity,mesh=mesh common HD_param, str_par ;+ ; NAME: ; READ_FIELD ; ; PURPOSE: ; Read a hydrodynamics field corresponding to a specific output ; number and a specific cpugrid number. The HD field can be ; any field, i.e. density or a velocity component, or any other ; additionnal field that can be specified by its suffix. It can ; also return the edges value of the mesh, or the center values ; (1D arrays taken as the arithmetic mean of successive edges), ; the size of the array, its level (refinement level), and ; the boundaries of the field. ; ; CATEGORY: ; Input routine ; ; CALLING SEQUENCE: ; READ_FIELD, CPUGRID=cpugrid [, RADIX=radix] [, COMPONENT=component] ; [, NB=nb] [, DIR=dir] [, FIELD=field] [, ; CENTER1=center1] [, CENTER2=center2] [, CENTER3=center3] ; [, EDGE1=edge1] [, EDGE2=edge2] [, EDGE3=edge3] [,/QUIET] ; [,BOUNDS=bounds] [, LEVEL=level] [,SIZE=size] ; [,/VELOCITY] ; ; CPUGRID=cpugrid: specifies the cpugrid number to be ; read. Mandatory argument. ; ; NB=nb: output #nb is read. Defaults to 0 or sticky value. ; ; RADIX: uses the default radix 'density'. Can be changed to ; 'velocity' to display a velocity component, or any other existing field. ; ; COMPONENT: when the 'velocity' radical is active, component defaults ; to 0. Can be changed to 1 or 2. ; ; DIR: the dir relative to the current working directory where to ; look for the arrays. Defaults to '.' (current working directory). ; ; FIELD=field: upon return the field variable contains the HD field. ; ; CENTER(1,2,3)=centeri: upon return the centeri variable contains ; the center value for the ith coordinate. If the HD field has size ; N1xN2xN3, then the center array has size Ni. ; ; EDGE(1,2,3)=edgei: upon return the edgei variable contains the edge ; value for the ith coordinate. If the HD field has size N1xN2xN3, ; the the edge array has size Ni+1. ; ; /QUIET: does not write anything to the standard output. ; ; BOUNDS=bounds: upon return the 'bounds' variable will be a 6-vector ; that will contain: ; [edge1_min,edge1_max,edge2_min,edge2_max,edge3_min,edge3_max] ; ; LEVEL=level: upon return the 'level' variable will be ; an integer that is the corresponding level (i.e. refinement ; level) of the cpugrid. ; ; SIZE=size: upon return contains an integer 3-vector that is the size ; of the HD field. ; ; /VELOCITY: equivalent to specify: RADIX='velocity' ;- if (n_elements(cpugrid) EQ 0) then begin doc_library, 'read_field' return endif if NOT(keyword_set (radix)) then radix='density' if keyword_set (velocity) then radix='velocity' if NOT(keyword_set (component)) then component=0 if keyword_set (quiet) then verbose = 0 else verbose = 1 read_desc, cpugrid=cpugrid, nb=nb, dir=dir, size=size, edge1=x,edge2=y,edge3=z,level=lev subdir = str_par.sgrid.subdir swap = str_par.sdir.swap_endian number = str_par.noutput nx = size[0] ny = size[1] nz = size[2] field=dblarr(nx,ny,nz) bounds = [x[0],y[0],z[0],x[nx],y[ny],z[nz]] edge1=x edge2=y edge3=z center1=.5*(x[0:nx-1]+x[1:nx]) center2=.5*(y[0:ny-1]+y[1:ny]) center3=.5*(z[0:nz-1]+z[1:nz]) if verbose then print, strcompress('Array size is '+string(nx)+' * '+string(ny)+' * '+string(nz)) if verbose then print, 'min/max zone center on coord. 1: ', x(0), x(nx) if verbose then print, 'min/max zone center on coord. 2: ', y(0), y(ny) if verbose then print, 'min/max zone center on coord. 3: ', z(0), z(nz) filename = 'gas'+radix+string(number)+'_'+string(cpugrid)+'_'+string(lev)+'.dat' filename = strcompress (filename, /remove_all) ;print,'in read_field -> filename=',filename if verbose then print, "Reading "+filename openr, 1, filepath (filename, ROOT_dir='.', SUBDIR=subdir), ERROR=err if err ne 0 then begin PRINT, 'error in opening file in read_field' PRINT, 'file ', filepath (filename, ROOT_dir='.', SUBDIR=subdir) ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif cp = component while (cp NE 0) do begin cp = cp-1 readu, 1, field endwhile readu, 1, field if swap then field=swap_endian(field) close, 1 if ((size(field))(0) EQ 1) then field=reform(field,(size(field))(1), 1, 1) if ((size(field))(0) EQ 2) then field=reform(field,(size(field))(1),(size(field))(2), 1) mesh={field:total(field,3),xgrid:x[0:nx],ygrid:y[0:ny]} return end ;-------------------------------------------------------------------- ; pro read_vel, nb=nb, descriptor=descriptor, path=path,$ center1=x, center2=y, center3=z,$ edge1=edgex, edge2=edgey, edge3=edgez,$ quiet=quiet, bounds=bounds,$ generation=generation, size=sz,$ vx=vx, vy=vy, vz=vz, vrad=vrad, vaxial=vaxial,$ vcolatitude=vcol, vazimuthal=vazim,field=field ;+ ; NAME: ; READ_VEL ; ; PURPOSE: ; ; Read a velocity field corresponding to a specific output ; number and a specific descriptor number. It can also return ; the edges value of the mesh, or the center values (1D arrays ; taken as the arithmetic mean of successive edges), the size of ; the array, its generation (refinement level), and the ; boundaries of the field. The velocity field is referred to by ; any of its component in an arbitrary geometry. For instance, ; it is possible to read the VZ component in a spherical ; coordinate system. ; ; CATEGORY: ; Input routine ; ; CALLING SEQUENCE: ; READ_VEL, NB=nb [, DESCRIPTOR=descriptor] [, PATH=path] [, ; CENTER1=center1] [, CENTER2=center2] [, CENTER3=center3] [, ; EDGE1=edge1] [, EDGE2=edge2] [, EDGE3=edge3] [,/QUIET] ; [,BOUNDS=bounds] [, GENERATION=generation] [,SIZE=size] ; [,VX=vx] [,VY=vy] [,VZ=vz] [,VRAD=vrad] [,VAXIAL=vaxial] ; [,VCOLATITUDE=vcol] [,VAZIMUTHAL=vazim] [,FIELD=field] ; ; NB=nb: output #nb is read. ; ; DESCRIPTOR=descriptor: specifies the descriptor number to be ; read. Defaults to 0 (Base mesh). ; ; PATH: the path relative to the current working directory where to ; look for the arrays. Defaults to '.' (current working directory). ; ; CENTER(1,2,3)=centeri: upon return the centeri variable contains ; the center value for the ith coordinate. If the HD field has size ; N1xN2xN3, then the center array has size Ni. ; ; EDGE(1,2,3)=edgei: upon return the edgei variable contains the edge ; value for the ith coordinate. If the HD field has size N1xN2xN3, ; the the edge array has size Ni+1. ; ; /QUIET: does not write anything to the standard output. ; ; BOUNDS=bounds: upon return the 'bounds' variable will be a 6-vector ; that will contain: ; [edge1_min,edge1_max,edge2_min,edge2_max,edge3_min,edge3_max] ; ; GENERATION=generation: upon return the 'generation' variable will be ; an integer that is the corresponding generation (i.e. refinement ; level) of the descriptor. ; ; SIZE=size: upon return contains an integer 3-vector that is the size ; of the HD field. ; ; VX=vx to VAZIMUTHAL=vazimuthal: upon return the corresponding ; variable contains a double precision 3D array that represents a ; component of the velocity field. The keyword name is unambiguous. ; See also the help of READ_DESC. ; ; FIELD=field: upon return, contains a N1xN2xN3x3 double precision ; array that contains the raw velocity file as written by the code. ;- if (n_elements(nb) EQ 0) then begin doc_library, 'read_vel' return endif number=nb if keyword_set (descriptor) then descriptor=descriptor else descriptor=0 if keyword_set (path) then path=path else path='.' if keyword_set (quiet) then verbose = 0 else verbose = 1 coordfile = filepath ('coord.dat', subdir=path, root_dir='.') print,'coordfile=',coordfile openr, 1, coordfile, ERROR = err if err ne 0 then begin PRINT, 'error in opening file in read_vel' PRINT, 'file ', coordfile ,' not found' CD,'.',CURRENT=Dir print,' Current directory=',Dir return endif readf, 1, coordtype close, 1 spawn,'grep -i coordpermut '+$ findfile(filepath('params.dat', ROOT_dir='.', SUBDIR=path)),$ /sh,res perm=strmid(res,strlen(res)-3) coordpermut=perm coord_perm=lonarr(3) coordinates_name = [['X', 'Y', 'Z'],$ ['Radius', 'Azimuth', 'Z'],$ ['Radius', 'Azimuth', 'Colatitude']] if verbose then begin case coordtype of 0: print, 'Cartesian geometry' 1: print, 'Cylindrical geometry' 2: print, 'Spherical geometry' endcase endif for i=0,2 do begin coord_perm(i) = long(strmid(perm,i,1))-1 if (verbose) then begin print, 'Coordinate number ', i+1, ' is '+coordinates_name(coord_perm(i), coordtype) endif endfor descfile = strcompress('fulldesc'+string(descriptor)+'_*.dat', /remove_all) strres = findfile (filepath(descfile, ROOT_dir='.', SUBDIR=path)) if ((size(strres))(0) EQ 0) then begin r = dialog_message(descfile+' does not exist in '+path, /error, title='Warning') return endif nb = (size(strres))(1) openr, 1, strres(0) q=lonarr(7) readu,1,q generation = q(0) sz=lonarr(3) sz(0)=q(1) sz(1)=q(2) sz(2)=q(3) nx = q(1) ny = q(2) nz = q(3) field=dblarr(nx,ny,nz,3) edges_x=dblarr(nx+5) edges_y=dblarr(ny+5) edges_z=dblarr(nz+5) readu,1,edges_x,edges_y,edges_z x=.5*(edges_x(2:nx+1)+edges_x(3:nx+2)) y=.5*(edges_y(2:ny+1)+edges_y(3:ny+2)) z=.5*(edges_z(2:nz+1)+edges_z(3:nz+2)) edgex = edges_x(2:nx+2) edgey = edges_y(2:ny+2) edgez = edges_z(2:nz+2) bounds = dblarr(6) bounds(0) = edges_x(2) bounds(1) = edges_x(nx+2) bounds(2) = edges_y(2) bounds(3) = edges_y(ny+2) bounds(4) = edges_z(2) bounds(5) = edges_z(nz+2) foo = dblarr(nx+4,ny+4,nz+4) center = dblarr(nx+4,ny+4,nz+4,3) readu,1,foo readu,1,foo readu,1,foo readu,1,foo center(*,*,*,0)=foo readu,1,foo readu,1,foo center(*,*,*,1)=foo readu,1,foo readu,1,foo center(*,*,*,2)=foo close,1 center=center(2:nx+1,2:ny+1,2:nz+1,*) if (verbose EQ 1) then print, strcompress('Array size is '+string(nx)+' * '+string(ny)+' * '+string(nz)) if (verbose EQ 1) then print, 'min/max zone center on coord. 1: ', x(0), x(nx-1) if (verbose EQ 1) then print, 'min/max zone center on coord. 2: ', y(0), y(ny-1) if (verbose EQ 1) then print, 'min/max zone center on coord. 3: ', z(0), z(nz-1) filename = 'gasvelocity'+string(number)+'_'+string(descriptor)+'_'+string(q(0))+'.dat' filename = strcompress (filename, /remove_all) openr, 1, filepath (filename, ROOT_dir='.', SUBDIR=path) readu, 1, field close, 1 case Coordtype of 0: begin vx=reform(field(*,*,*,q[4])) vy=reform(field(*,*,*,q[5])) vz=reform(field(*,*,*,q[6])) x=reform(center(*,*,*,q[4])) y=reform(center(*,*,*,q[5])) z=reform(center(*,*,*,q[6])) if Arg_Present(vrad) then vrad=(vx*x+vy*y+vz*z)/sqrt(x*x+y*y+z*z) if Arg_Present(vaxial) then vaxial=(vx*x+vy*y)/sqrt(x*x+y*y) if Arg_Present(vcol) then print,'vcol for cartesian : Not implemented yet !!!' if Arg_Present(vazim) then print,'vazim for cartesian : Not implemented yet !!!' end 1: begin vaxial=reform(field(*,*,*,q[4])) vazim=reform(field(*,*,*,q[5])) vz=reform(field(*,*,*,q[6])) axial_radius=reform(center(*,*,*,q[4])) azimuth=reform(center(*,*,*,q[5])) z=reform(center(*,*,*,q[6])) if Arg_Present (vrad) then print, 'vrad for cylindrical: Not implemented yet !!!' if Arg_Present (vx) then print, 'vx for cylindrical: Not implemented yet !!!' if Arg_Present (vy) then print, 'vy for cylindrical: Not implemented yet !!!' if Arg_Present (vcol) then print, 'vcol for cylindrical: Not implemented yet !!!' end 2: begin vrad=reform(field(*,*,*,q[4])) vazim=reform(field(*,*,*,q[5])) vcol=reform(field(*,*,*,q[6])) rad=reform(center(*,*,*,q[4])) azim=reform(center(*,*,*,q[5])) colat=reform(center(*,*,*,q[6])) if Arg_Present (vx) then vx=vrad*sin(colat)*cos(azim)+rad*vcol*cos(colat)*cos(azim)- $ rad*vazim*sin(colat)*sin(azim) if Arg_Present (vy) then vy=vrad*sin(colat)*sin(azim)+rad*vcol*cos(colat)*sin(azim)+ $ rad*vazim*sin(colat)*cos(azim) if Arg_Present (vz) then vz=vrad*cos(colat)-rad*vcol*sin(colat) if Arg_Present (vaxial) then print,'vaxial for spherical: Not implement yet !!!' end endcase return end ;-------------------------------------------------------------------- ; pro read_desc, nb=nb, cpugrid=cpugrid, dir=dir, verbose=verbose,$ volume=vol,$ inter1=i1,$ inter2=i2,$ inter3=i3,$ center1=c1,$ center2=c2,$ center3=c3,$ x=x,y=y,z=z,radius=radius,$ axial=axial,$ colatitude=colatitude,$ azimuth=azimuth,$ edge1=e1, edge2=e2, edge3=e3,$ lastlevel=lastlevel,$ coordtype=coordtype, coordpermut=coordpermut, level=level, size=size common HD_param, str_par ;+ ; NAME: ; READ_DESC ; ; PURPOSE: ; Read or reconstruct any field value in a cpugrid descriptor ; (such a zone volumes, interface surfaces, center position, ; presence of refined zones in a zone, etc.) and gives any ; combination (one can ask for instance for the 'x' value of the ; zones centers for a spherical mesh). ; ; CATEGORY: ; Input routine ; ; CALLING SEQUENCE: ; READ_DESC, CPUGRID=cpugrid [,NB=nb] [,DIR=dir] [,/VERBOSE] ; [,VOLUME=vol] [,INTER1=i1] [,INTER2=i2] [,INTER3=i3] ; [,CENTER1=c1] [,CENTER2=c2] [,CENTER3=c3] [,X=x] [,Y=y] [,Z=z] ; [,RADIUS=rad] [,AXIAL=ax] [,COLATITUDE=col] [,AZIMUTH=az] ; [,EDGE1=e1] [,EDGE2=e2] [,EDGE3=e3] [,LASTLEVEL=last] ; [,COORDTYPE=type] [,COORDPERMUT=permut] [,LEVEL=level] ; [,SIZE=size] [, FAST=fast] ; ; ; NB=nb: output number for which the cpugrid descriptor is to be ; read. Defaults to 0 or sticky value. ; ; CPUGRID=cpugrid: the cpugrid descriptor number 'cpugrid' to be ; read. This argument is mandatory. ; ; DIR=dir: looks for the cpugrid descriptor located at ; 'dir'. Default is '.' ; ; /VERBOSE: makes verbose standard output. ; ; VOLUME=vol: upon return 'vol' is a double precision 3D arrays that ; contains the zone volumes. Only the active part of the cpugrid ; descriptor is returned (the ghost zones are discarded). ; ; INTER1=i1: same as VOLUME but upon return the array contains the ; surface of the zone interfaces perpendicular to the first dimension ; ; INTER2=i2 or INTER3=i3: same as before but for 2nd and 3rd dimension ; respectively. ; ; CENTERi=ci: same as INTERi but contains the coordinate of the zone ; center instead of the surface of the zone interface. i refers to the ; dimension. ; ; X=x....AZIMUTH=az: upon return the corresponding variable contains a ; double precision 3D arrays that contains the desired coordinate of ; the zone center, regardless of the geometry (one can therefore ask ; for the 'X' field of the zones of a cylindrical mesh). The meaning ; of all these keywords is unambiguous. AXIAL_RADIUS is the distance ; to the 'z' axis. RADIUS is the distance to the origin. AXIAL_RADIUS ; is therefore the 'radius' coordinate in cylindrical geometry, while ; RADIUS is the 'radius' coordinate in spherical geometry. ; ; EDGE1=e1: upon return e1 is a double precision vector which contains ; the first coordinate of the zone interfaces perpendicular to the ; first dimension. If the cpugrid has size N1xN2xN3, e1 has size N1+1. ; ; EDGE2=e2 or EDGE3=e3: same as previously but for 2nd and 3rd ; coordinate respectively. ; ; LASTLEVEL=last: upon return the array 'last' is a 3D double ; precision floating point array in which each zone contains either ; 1.0 if it is not covered by a higher resolution mesh or 0.0 if it is ; covered by a higher resolution mesh. ; ; COORDTYPE=coordtype: upon return 'coordtype' is either 0 for a ; cartesian geometry, 1 for a cylindrical geometry or 2 for a ; spherical geometry. ; ; COORDPERMUT=coordpermut: upon return 'coordpermut' is a string that is ; a permutation of 123 which describes the ordering of ; coordinates. See code manual for details. ; ; LEVEL=level: upon return 'level' contains the level of ; the cpugrid. ; ; SIZE=size: upon return 'size' is an integer 3-vector that contains ; the size of the cpugrid (ghosts excluded) ;- if (n_elements(cpugrid) EQ 0) then begin doc_library, 'read_desc' return endif if (NOT(keyword_set(verbose))) then verbose=0 readstruct, nb=nb, dir=dir p=str_par.sdir.in g=str_par.sgrid coordinates_name = [['X', 'Y', 'Z'],$ ['Radius', 'Azimuth', 'Z'],$ ['Radius', 'Azimuth', 'Colatitude']] if verbose then begin print,p.coordtype+" geometry" endif if p.coordtype EQ "Cartesian" then coordtype=0 if p.coordtype EQ "Cylindrical" then coordtype=1 if p.coordtype EQ "Spherical" then coordtype=2 coord_perm = lonarr(3) coordpermut = p.coordpermut for i=0,2 do begin coord_perm(i) = long(strmid(coordpermut,i,1))-1 if (verbose) then begin print, strcompress('Coordinate number'+string(i+1)+ ' is '+coordinates_name(coord_perm(i), coordtype)) endif endfor index = 0 nbg = g.nb_cpu_grids while ((index LT nbg) AND (g.cgridnumber(index) NE cpugrid)) do index=index+1 pindex = g.parent(index) e1=reform(g.edges(pindex,0,*)) e2=reform(g.edges(pindex,1,*)) e3=reform(g.edges(pindex,2,*)) size=reform(g.cpugsize(index,*)) nx=size[0] ny=size[1] nz=size[2] ngh = g.nghost e1=e1(ngh+g.pcorner_min[index,0]:ngh+g.pcorner_max[index,0]) e2=e2(ngh+g.pcorner_min[index,1]:ngh+g.pcorner_max[index,1]) e3=e3(ngh+g.pcorner_min[index,2]:ngh+g.pcorner_max[index,2]) if verbose then print, strcompress("Size in cells:"+string(nx)+" *"+string(ny)+" *"+string(nz)) level=g.cgridlevel(index) if verbose then print, strcompress("Level is:"+string(level)) if verbose then begin print, strcompress(coordinates_name(coord_perm(0), coordtype)+" goes from"+string(min(e1))+" to"+string(max(e1))) print, strcompress(coordinates_name(coord_perm(1), coordtype)+" goes from"+string(min(e2))+" to"+string(max(e2))) print, strcompress(coordinates_name(coord_perm(2), coordtype)+" goes from"+string(min(e3))+" to"+string(max(e3))) endif return case Coordtype of 0: begin x=reform(center(q(4),*,*,*)) y=reform(center(q(5),*,*,*)) z=reform(center(q(6),*,*,*)) axial=sqrt(x*x+y*y) radius=sqrt(x*x+y*y+z*z) azimuth=atan(y,x) colatitude=atan(axial,z) end 1: begin axial=reform(center(q(4),*,*,*)) azimuth=reform(center(q(5),*,*,*)) z=reform(center(q(6),*,*,*)) x=axial*cos(azimuth) y=axial*sin(azimuth) radius=sqrt(axial*axial+z*z) colatitude=atan(axial,z) end 2: begin radius=reform(center(q(4),*,*,*)) azimuth=reform(center(q(5),*,*,*)) colatitude=reform(center(q(6),*,*,*)) axial=radius*sin(colatitude) z=radius*cos(colatitude) x=axial*cos(azimuth) y=axial*sin(azimuth) end endcase return end ;-------------------------------------------------------------------- ; ;################################################### ;################################################### ;################################################### pro SDvision_047dev SDvision end ;SDvision_047dev ;end