1 /*
2     Copyright (c) 2005-2021 Intel Corporation
3 
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7 
8         http://www.apache.org/licenses/LICENSE-2.0
9 
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15 */
16 
17 //
18 // pover_global.h
19 //
20 #ifndef TBB_examples_polygon_overlay_pover_global_H
21 #define TBB_examples_polygon_overlay_pover_global_H
22 
23 #ifdef _MAIN_C_
24 #define DEFINE  // nothing
25 #define STATIC  static
26 #define INIT(n) = n
27 #else // not in main file
28 #define DEFINE  extern
29 #define STATIC  // nothing
30 #define INIT(n) // nothing
31 #endif // _MAIN_C_
32 
33 #include <iostream>
34 #include <fstream>
35 
36 #ifdef _WINDOWS
37 #include <windows.h>
38 #endif
39 
40 // this Polygon class only supports rectangles
41 DEFINE int gDrawXOffset INIT(0); // used for drawing polygons
42 DEFINE int gDrawYOffset INIT(0);
43 DEFINE int gPolyXBoxSize INIT(0); // number of pixels orresponding to one "square" (x)
44 DEFINE int gPolyYBoxSize INIT(0); // number of pixels orresponding to one "square" (y)
45 DEFINE bool gDoDraw INIT(false); // render the boxes
46 
47 #define THREADS_UNSET 0
48 DEFINE int gThreadsLow INIT(THREADS_UNSET);
49 DEFINE int gThreadsHigh INIT(THREADS_UNSET);
50 
51 DEFINE std::ofstream gCsvFile;
52 DEFINE double gSerialTime;
53 DEFINE char *gCsvFilename INIT(nullptr);
54 
55 #define BORDER_SIZE 10 // number of pixels between maps
56 
57 // The map size and the number of polygons depends on the version we are compiling.
58 // If DEBUG then it is small; else it is large.
59 
60 #ifdef _DEBUG
61 DEFINE int gNPolygons INIT(30); // default number of polygons in map
62 DEFINE int gMapXSize INIT(30);
63 DEFINE int gMapYSize INIT(30);
64 DEFINE int gGrainSize INIT(5);
65 #else
66 DEFINE int gNPolygons INIT(50000); // default number of polygons in map
67 DEFINE int gMapXSize INIT(1000);
68 DEFINE int gMapYSize INIT(1000);
69 DEFINE int gGrainSize INIT(20);
70 #endif
71 DEFINE int gMyRandomSeed INIT(2453185);
72 
73 DEFINE bool gIsGraphicalVersion INIT(false);
74 
75 typedef enum { NORTH_SIDE, EAST_SIDE, SOUTH_SIDE, WEST_SIDE } allSides;
76 
77 #if _DEBUG
78 #define PRINT_DEBUG(x) (std::cout << x << "\n")
79 #else
80 #define PRINT_DEBUG(x)
81 #endif
82 
83 #endif // TBB_examples_polygon_overlay_pover_global_H
84