pro Fl_Finegrid, Flines_Str, Line, Factor, linear=linear, spl=spl, poly_order=poly_order ;+ ; Name: Fl_Finegrid ; Purpose: ; Re-define a field line on a finer grid ; Calling Sequence: ; ; Fl_Finegrid, Flines_Str, Line, Factor, linear=linear, spl=spl, poly_order=poly_order ; Inputs: ; Flines_Str Field line structure varibale with the following tags ; ; Nlines : # of field lines in the set ; Pos : an index array with (Nlines+1) elements ; Data : a 2-D array of 3 x pos(nlines) elements ; the 1st field line : from pos(0) to pos(1)-1 ; the 2nd filed line : from pos(1) to pos(2)-1 ; and so on. ; Line the index of the field line ; Factor the ratio of the number of new grids to that of the old ones ; Outputs: ; Flines_Str ; Keywords: ; Spl if set and not equal to 0, spline interpolations are used. ; This is the default. ; Linear if set and not equal to 0, linear interpolations are used. ; Poly_order if set to an integer greater than 0, ; polynomial fitting is used. ;- ; Extraction of the field line nlines = Flines_str.nlines pos=Flines_str.pos data = Flines_str.data i0 = pos(line) i1 = pos(line+1)-1 fline = data(*, i0:i1) npoint = i1-i0+1 index = findgen(npoint) ; New gridding New_npoint = (Npoint-1)*Factor+1 new_index = findgen(New_npoint)/Factor New_fline = fltarr(3, New_npoint) if keyword_set(linear) then for k=0, 2 do $ New_fline(k, *)=interpolate(reform(fline(k, *)), new_index) $ else if keyword_set(Poly_order) then for k=0, 2 do begin coeff = poly_fit(index, reform(fline(k, *)), poly_order) New_fline(k, *) = poly(new_index, coeff) endfor else for k=0, 2 do $ New_fline(k, *) = spline(index, reform(fline(k, *)), new_index) ; Reorganization of the field lines New_pos=pos for k=line+1, nlines do New_pos(k)=pos(k)+(new_npoint-npoint) New_data = fltarr(3, New_pos(nlines)) if line ge 1 then New_data(*, 0:New_pos(line)-1) = data(*,0:pos(line)-1) New_data(*, New_pos(line):New_pos(line+1)-1) = New_fline if line lt nlines-1 then New_data(*, New_pos(line+1):New_pos(nlines)-1)=$ data(*, pos(line+1):pos(nlines)-1) ; Redefine the field line structure Flines_Str ={Nlines:nlines, Pos:New_pos, Data:New_Data} end t=findgen(200) n1=50 t1=findgen(n1) Data = fltarr(3, 400+n1) Data(0,*) = [0.00*cos(2*!pi*t/200.), 0.05*cos(2*!pi*t1/n1),$ 0.15*cos(2*!pi*t/50.) ] Data(1,*) = [0.00*sin(2*!pi*t/200.), 0.05*sin(2*!pi*t1/n1), $ 0.15*sin(2*!pi*t/50)] Data(2,*) = [ t/200, t1/n1, t/200] Flines_Str = {nlines:3, pos:[0, 200, 200+n1, 400+n1], Data: Data} Fl_finegrid, flines_str, 1, 1, /spl Fl_Mesh, Flines_Str, Vertex_List, Polygon_List, radius=0.03, Nvert=21 t3d, /reset t3d, rotate=[0, 50.0, 0.] t3d, rotate=[0, 0, 50] t3d, translate=[0.3, 0.3, 0.3] Vertex_List = vert_t3d(Vertex_List) window, 0, xsize=600, ysize=600 create_view, winx=600, winy=600 set_shading, light=[-0.5, -0.5, 1.0], reject=0 a=polyshade(Vertex_List, Polygon_List, /data) a(where(a eq 0))=max(a) tvscl, a end