From: <and...@us...> - 2013-12-05 00:12:59
|
Revision: 12810 http://sourceforge.net/p/plplot/code/12810 Author: andrewross Date: 2013-12-05 00:12:52 +0000 (Thu, 05 Dec 2013) Log Message: ----------- Partial update to the ocaml version of example 22. Still needs more work (and some changes to the ocaml bindings). Modified Paths: -------------- trunk/examples/ocaml/x22.ml Modified: trunk/examples/ocaml/x22.ml =================================================================== --- trunk/examples/ocaml/x22.ml 2013-12-04 19:04:27 UTC (rev 12809) +++ trunk/examples/ocaml/x22.ml 2013-12-05 00:12:52 UTC (rev 12810) @@ -82,7 +82,7 @@ (* * Vector plot of flow through a constricted pipe *) -let constriction () = +let constriction astyle = let nx = 20 in let ny = 20 in let dx = 1.0 in @@ -107,7 +107,7 @@ yg.(i).(j) <- y; let b = ymax /. 4.0 *. (3.0 -. cos (pi *. x /. xmax)) in if abs_float y < b then ( - let dbdx = ymax /. 4.0 *. sin (pi *. x /. xmax) *. y /. b in + let dbdx = ymax /. 4.0 *. sin (pi *. x /. xmax) *. pi /. xmax *. y /. b in u.(i).(j) <- q *. ymax /. b; v.(i).(j) <- dbdx *. u.(i).(j); ) @@ -119,10 +119,11 @@ done; plenv xmin xmax ymin ymax 0 0; - pllab "(x)" "(y)" "#frPLplot Example 22 - constriction"; + let title =Printf.sprintf "%s%d%s" "#frPLplot Example 22 - constriction (arrow style " astyle ")" in + pllab "(x)" "(y)" title; plcol0 2; plset_pltr (pltr2 xg yg); - plvect u v (-0.5); + plvect u v (-1.0); plcol0 1; () @@ -246,14 +247,18 @@ (* Set arrow style using arrow_x and arrow_y then plot using these arrows. *) plsvect arrow_x arrow_y fill; - constriction (); + constriction ( 1 ); (* Set arrow style using arrow2_x and arrow2_y then plot using these filled arrows. *) let fill = true in plsvect arrow2_x arrow2_y fill; - constriction (); + constriction ( 2 ); + (* Need to be able to pass NULL arguments to plsvect to reset arrow style to default + Currently this doesn't work *) + (* plsvect [||] [||] fill; *) + potential (); plend (); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |