csdl_llcsdl.itcl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # ----------------------------------------------------------*-Tcl-*-
  2. #
  3. # stackup.itcl
  4. #
  5. # These Incr Tcl classes define the layer stackup and structures
  6. # in a transmission line cross section.
  7. #
  8. # Bob Techentin
  9. # January 23, 2000
  10. #
  11. # Copyright 2000-2004 Mayo Foundation. All Rights Reserved.
  12. # $Id: csdl_llcsdl.itcl,v 1.3 2004/02/09 18:56:01 techenti Exp $
  13. #
  14. # --------------------------------------------------------------------
  15. package require Itcl
  16. package provide csdl 1.0.1
  17. # --------------------------------------------------------------------
  18. #
  19. # itcl::class Structure
  20. #
  21. # Abstract physical structure in a transmission line
  22. # cross section layer Stackup. These structures are
  23. # intimately tied to the layer Stackup, and automatically
  24. # add themselves to the Sackup's structureList when
  25. # they are constructed.
  26. #
  27. # Each structure also has a shape, and passes several
  28. # methods through to its shape.
  29. #
  30. # options
  31. #
  32. # -x -y
  33. # X and Y offset for the structure. In the context of
  34. # the layer stackup, this is offset from (0,0) of the
  35. # previous layer.
  36. #
  37. # -shape
  38. # Reference to the Shape of this structure.
  39. #
  40. # methods
  41. #
  42. # width, height
  43. # Compute the size of the structure.
  44. #
  45. # draw, annotate
  46. # Draw and annotate the structure on the canvas.
  47. #
  48. # --------------------------------------------------------------------
  49. itcl::class Structure {
  50. public variable x 0
  51. public variable y 0
  52. public variable shape
  53. public variable description
  54. method width {} {$shape width}
  55. method height {} {$shape height}
  56. method accept { visitor x y } {
  57. # Cleverly call a visitor based on our class name
  58. scan [info class] "::%s" myClass
  59. $visitor visit$myClass $this $x $y
  60. # Navigate to the structure(s)
  61. foreach obj $shape {
  62. $obj accept $visitor $x $y
  63. }
  64. }
  65. }
  66. itcl::class Dielectric {
  67. inherit Structure
  68. public variable permittivity 1.0
  69. public variable permeability 1.0
  70. public variable lossTangent 0.0
  71. constructor {args} {
  72. eval configure $args
  73. $shape configure -color green \
  74. -description "econst=$permittivity"
  75. }
  76. }
  77. itcl::class Conductor {
  78. inherit Structure
  79. public variable conductivity ""
  80. constructor {args} {
  81. eval configure $args
  82. $shape configure -color yellow \
  83. -description "cond=$conductivity"
  84. }
  85. }
  86. itcl::class Ground {
  87. inherit Structure
  88. constructor {args} {
  89. eval configure $args
  90. $shape configure -description "Ground" -color blue
  91. }
  92. }