27.12.2012 Views

Wave Propagation in Linear Media | re-examined

Wave Propagation in Linear Media | re-examined

Wave Propagation in Linear Media | re-examined

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ReSize[l_List,n_] := ReSize[l,{n,n}];<br />

L<strong>in</strong>k3DList[names_,outname_,path__:""] := Module[{dir,mergelist={}},<br />

dir = FileNames[names,path];<br />

If[Length[dir] < 2, Message[L<strong>in</strong>k3DList::fewlists],<br />

If[FileNames[outname,path] == {} ||<br />

InputStr<strong>in</strong>g["Output file exists! Overwrite (y/n)?"] == "y",<br />

Pr<strong>in</strong>t["Merg<strong>in</strong>g ",Length[dir]," lists"];<br />

mergelist = OrderGrid[Flatten[Map[Get,dir],2]];<br />

If[!Apply[SameQ,Map[Length,mergelist]],<br />

Message[L<strong>in</strong>k3DList::<strong>re</strong>ggrid]];<br />

If[path != "", SetDi<strong>re</strong>ctory[path]];<br />

Put[mergelist,outname];<br />

If[path != "", ResetDi<strong>re</strong>ctory[]]<br />

]];<br />

];<br />

Disp3DList[t_List, opts___] := ListSurfacePlot3D[t,opts,BoxRatios->{1,1,0.4},<br />

Axes->True];<br />

Disp3DContour[t_List, opts___] := If[!Apply[SameQ,Map[Length,t]],<br />

Message[Disp3DContour::<strong>re</strong>ggrid],<br />

ListContourPlot[Transpose[t]/.{x_,y_,z_}:>z,<br />

MeshRange->{{t[[1,1,1]],t[[Length[t],1,1]]},<br />

{t[[1,1,2]],t[[1,Length[t[[1]]],2]]}},opts]];<br />

Movie[list_List, opts___] := Module[{m<strong>in</strong>z,maxz,optlist},<br />

{m<strong>in</strong>z,maxz} = Apply[{M<strong>in</strong>[#],Max[#]}&,<br />

{Transpose[Flatten[list,1]][[3]]}];<br />

Map[ListPlot[#/.{x_,y_,z_}:>{x,z},<br />

opts,PlotJo<strong>in</strong>ed->True,PlotRange->{All,{m<strong>in</strong>z,maxz}}]&,<br />

Transpose[list]]<br />

];<br />

End[]<br />

SetAttributes[OrderGrid, ReadProtected]<br />

SetAttributes[ReSize, ReadProtected]<br />

SetAttributes[L<strong>in</strong>k3DList, ReadProtected]<br />

SetAttributes[Movie, ReadProtected]<br />

Protect[OrderGrid, ReSize, L<strong>in</strong>k3DList, Movie]<br />

EndPackage[]<br />

236<br />

A Mathematica packages

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!