home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / UIFlow 1.0.1 / UIFlow Source / CFDFront / Globals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-21  |  8.0 KB  |  252 lines  |  [TEXT/MPS ]

  1. #pragma segment Main
  2. /* the basics */
  3. #include    <Types.h>
  4. #include    <Resources.h>
  5. #include    <Quickdraw.h>
  6. #include    <Windows.h>
  7. #include    <OSUtils.h>
  8.  
  9. /* extras */
  10. #include    <Dialogs.h>
  11. #include     <Packages.h>
  12. #include    <ToolUtils.h>
  13. #include     <Memory.h>
  14. #include    <Fonts.h>
  15. #include    <Events.h>
  16. #include    <OSEvents.h>
  17. #include    <Menus.h>
  18. #include    <Desk.h>
  19. #include    <TextEdit.h>
  20. #include    <Scrap.h>
  21. #include     <Palettes.h>
  22. #include     <Controls.h>
  23. #include     <Math.h>
  24. #include    <Errors.h>
  25. #include     <stdlib.h>
  26. #include     <Files.h>
  27. #include     <StdIO.h>
  28. #include     <FCntl.h>
  29. #include    <CursorCtl.h>
  30. #include    <PrintTraps.h>
  31. #include    <Strings.h>
  32. #include    <String.h>
  33.  
  34. // UUtilities.cp
  35.  
  36. #ifndef __UMacApp__
  37. #include <UMacApp.h>
  38. #endif __UMacApp__
  39.  
  40. #ifndef __UMacAppUtilities__
  41. #include <UMacAppUtilities.h>
  42. #endif __UMacAppUtilities__
  43.  
  44. #ifndef __UDialog__
  45. #include <UDialog.h>
  46. #endif __UDialog__
  47.  
  48. #ifndef __UGridView__
  49. #include <UGridView.h>
  50. #endif __UGridView__
  51.  
  52. #ifndef __UTEView__
  53. #include <UTEView.h>
  54. #endif __UTEView__
  55.  
  56. //--------------------------------------------------------------------------------------------------
  57. //    Menu Command Numbers
  58. //--------------------------------------------------------------------------------------------------
  59. //    Options Menu elements
  60. const CmdNumber    cExport            =    2000;
  61.  
  62. const CmdNumber    cOptPrint            =    2001;
  63. const CmdNumber    cOptRelax            =    2002;
  64. const CmdNumber    cOptSolution        =    2003;
  65. const CmdNumber    cOptFlow            =    2004;
  66.  
  67. const CmdNumber    cRApp                =    2009;
  68. const CmdNumber    cRemote            =    2005;
  69. const CmdNumber    cLocal                =    2006;
  70.     
  71. //    Grid Menu Elements
  72. const CmdNumber    cGridOn            =    2007;
  73. const CmdNumber cGridFine            =    2008;
  74.  
  75. const short    cFirst                        = cExport;                                                    // first menu item
  76. const short    cLast                        = cRApp;                                                        // last menu item
  77. //--------------------------------------------------------------------------------------------------
  78. // this is the application definition.
  79. //--------------------------------------------------------------------------------------------------
  80. const OSType kSignature                 = 'SPFW';                                                        // Application signature
  81. const OSType kFileType                 = 'UTXT';                                                        // File-type code used for document files 
  82.                                                                                                                         // created by this application
  83. //    OPTIONS MENU - resource id numbers
  84. const short    kCFDFrontWindowId     = 1000;
  85. const short     kOptDimension            =    1001;                                                        // Dialog Box ID Number.
  86. const short    kOptPrint                    =    1002;                                                        // Dialog Box ID Number.
  87. const short    kOptSolution                =    1005;                                                        // Dialog Box ID Number.
  88. const short    kWarnMe                    =    1006;                                                        // Warning Dialog ID Number
  89. const short    kOptFlow                    =    1009;                                                        // Dialog Box ID Number.
  90. const short    kOptRadius                =    1010;                                                        // Dialog Box ID Number.
  91. const short    kOptTurbulence            =    1011;                                                        // Dialog Box ID Number.
  92. const short     kOptDiffusion            =    1013;                                                        // Dialog Box ID Number.
  93. const short    kOptPremix                =     1014;                                                        // Dialog Box ID Number.
  94. const short    kOptRelax                    =     1015;                                                        // Dialog Box ID Number.
  95. const short    kOptPressure            =     1016;                                                        // Dialog Box ID Number.
  96. const short    kWarnDelete                =    1017;                                                        // Dialog Box ID Number.
  97.  
  98. //    COMMAND NUMBERS
  99. const short     cMakeBaffle                =    2003;                                                        // make a baffle
  100. const short     cMakeObstacle            =    2002;                                                        // make an obstacle
  101. const short     cDragPointCommand     =    2001;                                                        // drag a boundry point
  102. const short     cNewSegCommand     =    2000;                                                        // create a new boundry segment
  103. const short     cNewSecCommand     =    2004;                                                        // create a new boundry segment
  104. const short    cDeleteSegCommand    =    2005;
  105. const short    cDeleteSecCommand    =    2006;
  106. const short    cDeleteBaffle            =    2007;
  107. const short    cDeleteObstacle        =    2008;
  108.  
  109. const short     cMaxSize                     = 350;                                                            // max geometry dimension
  110. const short     cGeomViewBorder     = 13;                                                            // offset from top & left
  111. const int         cNumRlxFacts             = 7;        
  112. const int         cNumTurbConst         = 13;
  113. const int         gPensize_H                 = 3;                                                                // horizontal pen size
  114. const int         gPensize_V                 = 3;                                                                // vertical pen size
  115. const int         gGridsize_H                 = 1;                                                                // horizontal pen size
  116. const int         gGridsize_V                 = 1;                                                                // vertical pen size
  117. const short     cMousePlay                 = 5;                                                                // play on either side of a point
  118.  
  119. /* the point data structure. */
  120.  
  121. const int cNumProfiles                     = 11;
  122. const int cMaxProfVals                 = 10;
  123. const int cNumFuelProps                 = 5;
  124. const int cElemSize                         = sizeof(Handle);
  125.  
  126. const IDType        kOK                        = 'OKOK';                                                        // Ok Button
  127. const IDType        kCancel                    = 'CNCL';                                                        // Cancel Button
  128. const IDType     cXCoord                 = 'XCor';                                                        // X Coordinate Field
  129. const IDType     cYCoord                 = 'YCor';                                                        // Y Coordinate Field
  130. CursHandle         PointCursor;
  131. CursHandle        MagCursorUp;
  132. CursHandle        MagCursorDn;
  133.  
  134. int                    qdbug                    = 0;                                                                // debug window flag
  135. TWindow             *dbWindow;
  136.  
  137. //this record contains the initial condition for each boundry
  138. typedef struct WallRecord
  139.     {
  140.     float u;
  141.     float v;
  142.     float w;
  143.     float kenergy;
  144.     float dissip;
  145.     float mixfrac;
  146.     float concfrac;
  147.     float fuelfrac;
  148.     float temp;
  149.     float density;
  150.     float visc;
  151.     } WallRecord;
  152.     
  153. enum e1
  154.     {
  155.     Wall = 1,
  156.     InFlow,
  157.     Symm,
  158.     OutFlow,
  159.     Grid,
  160.     NumSegmentTypes
  161.     } SegmentType;
  162.  
  163. //     DrawColors. used by segment class to draw the boundries.  
  164.  
  165. RGBColor DrawColors[NumSegmentTypes] = {
  166.     {0,0,0},
  167.     {2304, 9984, 45056},
  168.     {65280, 7680, 12032},
  169.     {0x7f00, 65280, 0x7f00},
  170.     {0xfff0, 0xfff0, 0},
  171.     {0,0,0},
  172.     };
  173.                 
  174. RGBColor SegmentCenter = {0xffff,0xffff,0x3333};                                            // Black - Segment Point Color
  175. RGBColor SegmentPoint =     {0xcccc,0x0,0xffff};                                                // Cyan - Segment Point Color
  176. RGBColor StartPoint =     {0x0,0xffff,0x0};                                                        // Green - Segment Point Color
  177. RGBColor GridPoint = {0xeeee,0x0,0x0};                                                            // Red - Grid Point Color
  178. RGBColor GridLineColor = {0,0,0};                                                                    // Black - Grid Line Color
  179. RGBColor FineGridColor = {0xffff,0x0000,0xffff};                                            // magenta - Fine Grid Line Color
  180. RGBColor ObstacleColor = {0x6666,0xcccc,0xffff};                                            // Sky Blue - Obstacle Fill
  181. RGBColor BaffleColor = {0x9999,0x6666,0x0000};                                            // Brown - Baffle Fill
  182. RGBColor WhiteColor = {0xffff, 0xffff, 0xffff};
  183. RGBColor BlackColor = {0, 0, 0};
  184.  
  185. PixPatHandle SegmentPat[NumSegmentTypes];                                                    // Pix Pattern for the Segments
  186. PixPatHandle SegmentCenterPat;                                                                        // Pix Pattern for the Segment Point
  187. PixPatHandle SegmentPointPat;                                                                            // Pix Pattern for the Segment Point
  188. PixPatHandle StartPointPat;
  189. PixPatHandle PointFramePat;                                                                            // Pix Pattern for the select frame
  190. PixPatHandle GridPointPat;                                                                                // Pix Pattern for grid point
  191. PixPatHandle GridLinePat;                                                                                    // Pix Pattern for grid line
  192. PixPatHandle FineGridPat;                                                                                    // Pix Pattern for grid line
  193. PixPatHandle ObstaclePat;                                                                                // Pix Pattern for obstacle fill
  194. PixPatHandle BafflePat;                                                                                    // Pix Pattern for baffle fill
  195.  
  196. short pat[NumSegmentTypes]={1,23,3,26};                                                        // the drawing patterns for lines. 
  197. Pattern SegPatterns[NumSegmentTypes];
  198.  
  199. extended c1, c2, c3, c4, c5, c6, c7, c8;
  200.  
  201. enum e2
  202.     {
  203.     cDragTool = 0,
  204.     cSegmentTool,
  205.     cGridTool,
  206.     cBaffle,
  207.     cObstacle,
  208.     cData,
  209.     cFineGrid,
  210.     cMagnify
  211.     } ToolType;
  212.     
  213. enum e3    
  214.     {
  215.     cNotOnBoundry = 0,
  216.     cTop,
  217.     cRight,
  218.     cBottom,
  219.     cLeft    
  220.     } BoundrySide;
  221.  
  222. enum e4                                                                                                            // bit order for determining the
  223.     {                                                                                                                    // status of the requested dialog box
  224.     cPrintDialog = 1,                                                                                            
  225.     cFlowDialog,
  226.     cSolutionDialog,
  227.     cRelaxDialog
  228.     } ModelessDialogStatus;
  229.     
  230. struct gridRC
  231.     {                                                                                                                    // row / column for grid cell
  232.     short row;
  233.     short col;
  234.     };
  235.  
  236. struct realPt        
  237.     {                                                                                                                    // used in conversion view to real
  238.     float x;
  239.     float y;
  240.     };
  241.     
  242. struct slopeStruct    {                                                                                        // equation:  Y = mX + b
  243.     Point        first;                                                                                            // left most point
  244.     Point        second;                                                                                            // right most point
  245.     extended     m;                                                                                                // slope
  246.     extended    b;                                                                                                    // y intercept
  247.     Boolean        horizontal;
  248.     Boolean        vertical;
  249.     };
  250.     
  251. typedef struct slopeStruct lineSlope;
  252.