Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utilities/rc_cmp/util.h
Go to the documentation of this file.
1 #ifndef _UTIL_H_
2 #define _UTIL_H_
3 
4 #include <cstdio>
5 #include <cstdlib>
6 #include <iostream>
7 #include <ostream>
8 #include <fstream>
9 #include <string>
10 #include <time.h>
11 #include <sstream>
12 #include <math.h>
13 #include <vector>
14 
15 #include "datatypedef.h"
16 
17 using std::string;
18 using std::ofstream;
19 using std::ifstream;
20 
21 
22 
28 string itoa(int n);
29 
35 std::vector<string> readQuoteExpression(string rStack, string rNeedle);
36 
37 //Read expressions of the form
38 //y = 100, test, this
39 std::vector<string> readCommaExpression(string rStack, string rNeedle);
40 
41 //Returns true if char is non-numeric
42 bool check_non_numeric_char(char test_char);
43 
44 //Returns true if char is non-numeric (except period)
45 bool check_non_numeric_char_per(char test_char);
46 
47 //Returns true if any char in the string is non-numeric
48 bool check_non_numeric_str(string test_str);
49 
50 //Returns true if any char in the string is non-numeric, except period char
51 bool check_non_numeric_str_per(string test_str);
52 
53 bool check_delimiters(char *delimit, int num, char test);
54 
55 //Checks to see if all values are true
56 bool check_bool_arr(bool test[], int size);
57 
58 //Distance formula
59 long double dist(long double *coord1, long double *coord2, int size);
60 
61 //Triangle Test
62 //Check if point is inside a triangle
63 bool pnt_in_tri(pnt test, pnt p1, pnt p2, pnt p3);
64 
65 //Side check
66 //Helper function for triangle test
67 bool side_check(pnt test, pnt p1, pnt p2, pnt check);
68 
69 //Cross product
70 pnt cross_product(pnt vec1, pnt vec2);
71 
72 //Dot product
73 long double dot_product(pnt vec1, pnt vec2);
74 
75 //Return's nan without compiler warning
76 long double nan();
77 
78 //String tokenize
79 std::vector<string> str_tokenize(string full, string delimiters);
80 
81 //Compare integer vectors
82 //Ignore element order
83 bool same_elements(std::vector<int> vector_1, std::vector<int> vector_2);
84 
85 
86 
87 /*
88  * Bitmap class
89  * Used to keep track of set values
90  *
91  */
92 
93 class bitmap {
94 
95  public:
96 
97  bitmap();
98 
99  ~bitmap();
100 
101  bitmap(const bitmap &b);
102 
103  bitmap & operator = (const bitmap &b);
104 
105  void set_size(int n);
106 
107  int get_size();
108 
109  void set_value(int n);
110 
111  void unset_value(int n);
112 
113  bool check_value(int n);
114 
115  private:
116 
117  //Map Data
118  int *map;
119 
120  bool map_set;
121 
122  //Size
123  int size;
124 
125 };
126 
127 #endif
bool check_non_numeric_char_per(char test_char)
long double nan()
NT p1
bool check_bool_arr(bool test[], int size)
std::vector< string > readCommaExpression(string rStack, string rNeedle)
Point object that represents a single point.
Definition: datatypedef.h:68
string itoa(int n)
Convert an int to a string.
void set_value(int n)
bool check_value(int n)
VectorS3< FT > cross_product(const VectorS3< FT > &v, const VectorS3< FT > &w)
void unset_value(int n)
bool check_non_numeric_char(char test_char)
void test(void)
Definition: flotsam.C:99
bool check_non_numeric_str_per(string test_str)
void set_size(int n)
const NT & n
bitmap & operator=(const bitmap &b)
std::vector< string > readQuoteExpression(string rStack, string rNeedle)
Read expressions of the form x = &quot;test&quot; &quot;100&quot; &quot;another test&quot;.
bool pnt_in_tri(pnt test, pnt p1, pnt p2, pnt p3)
long double dist(long double *coord1, long double *coord2, int size)
bool same_elements(std::vector< int > vector_1, std::vector< int > vector_2)
long double dot_product(pnt vec1, pnt vec2)
bool side_check(pnt test, pnt p1, pnt p2, pnt check)
std::vector< string > str_tokenize(string full, string delimiters)
bool check_non_numeric_str(string test_str)
bool check_delimiters(char *delimit, int num, char test)