MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
types.cpp File Reference
#include <string>
#include <map>
+ Include dependency graph for types.cpp:

Go to the source code of this file.

Functions

char innerType (char typecode)
 
char shortFinfo (string finfoType)
 
char shortType (string name)
 

Function Documentation

char innerType ( char  typecode)

Definition at line 104 of file types.cpp.

Referenced by get_vec_lookupfield(), and to_py().

104  {
105  static map<char, char> innerTypeMap;
106  if (innerTypeMap.empty()){
107  innerTypeMap.insert(pair<char, char>('D', 'd')); // vector<double>
108  innerTypeMap.insert(pair<char, char>('v', 'i')); // vector<int>
109  innerTypeMap.insert(pair<char, char>('M', 'l')); // vector<long>
110  innerTypeMap.insert(pair<char, char>('X', 'x')); // vector<Id>
111  innerTypeMap.insert(pair<char, char>('Y', 'y')); // vector<ObjId>
112  innerTypeMap.insert(pair<char, char>('C', 'c')); // vector<char>
113  innerTypeMap.insert(pair<char, char>('w', 'h')); // vector<short>
114  innerTypeMap.insert(pair<char, char>('N', 'I')); // vector<unsigned int>
115  innerTypeMap.insert(pair<char, char>('P', 'k')); // vector<unsigned long>
116  innerTypeMap.insert(pair<char, char>('A', 'L')); // vector<long long>
117  innerTypeMap.insert(pair<char, char>('B', 'K')); // vector<unsigned long long>
118  innerTypeMap.insert(pair<char, char>('F', 'f')); // vector<float>
119  innerTypeMap.insert(pair<char, char>('S', 's')); // vector<string>
120  innerTypeMap.insert(pair<char, char>('T', 'N')); // vector<vector<unsigned>>
121  innerTypeMap.insert(pair<char, char>('Q', 'v')); // vector<vector<int>>
122  innerTypeMap.insert(pair<char, char>('R', 'D')); // vector<vector<double>>
123  }
124  map<char, char>::iterator iter = innerTypeMap.find(typecode);
125  if (iter == innerTypeMap.end()){
126  return 0;
127  }
128  return iter->second;
129 }

+ Here is the caller graph for this function:

char shortFinfo ( string  finfoType)

Definition at line 87 of file types.cpp.

88 {
89  static map<string, char> finfomap;
90  if (finfomap.empty()){
91  finfomap.insert(pair<string, char>("srcFinfo", 's'));
92  finfomap.insert(pair<string, char>("destFinfo", 'd'));
93  finfomap.insert(pair<string, char>("sharedFinfo", 'x'));
94  finfomap.insert(pair<string, char>("valueFinfo", 'v'));
95  finfomap.insert(pair<string, char>("lookupFinfo", 'l'));
96  }
97  map <string, char>::iterator iter = finfomap.find(finfoType);
98  if (iter == finfomap.end()){
99  return 0;
100  }
101  return iter->second;
102 }
char shortType ( string  name)

returns a single character code for a given string representation of data type. Mostly follows Python/C API's PyArg_ParseTuple convention.

Definition at line 41 of file types.cpp.

42 {
43  static map<string, char> typemap;
44  if (typemap.empty()){
45  typemap.insert(pair<string, char>("bool", 'b'));
46  typemap.insert(pair<string, char>("char", 'c'));
47  typemap.insert(pair<string, char>("int", 'i')); // python
48  typemap.insert(pair<string, char>("short", 'h')); // python
49  typemap.insert(pair<string, char>("unsigned short", 'H')); // python
50  typemap.insert(pair<string, char>("long", 'l')); // python
51  typemap.insert(pair<string, char>("long long", 'L')); // python
52  typemap.insert(pair<string, char>("unsigned int", 'I')); // python
53  typemap.insert(pair<string, char>("unsigned long", 'k')); // python
54  typemap.insert(pair<string, char>("unsigned long long", 'K')); // python
55  typemap.insert(pair<string, char>("float", 'f')); // python
56  typemap.insert(pair<string, char>("double", 'd')); // python
57  typemap.insert(pair<string, char>("string", 's')); // python
58  typemap.insert(pair<string, char>("Id", 'x')); // moose
59  typemap.insert(pair<string, char>("ObjId", 'y')); // moose
60  typemap.insert(pair<string, char>("DataId", 'z')); // moose
61  typemap.insert(pair<string, char>("vector<char>", 'C')); // moose
62  typemap.insert(pair<string, char>("vector<int>", 'v')); // moose
63  typemap.insert(pair<string, char>("vector<short>", 'w')); // moose
64  typemap.insert(pair<string, char>("vector<long>", 'M')); // moose
65  typemap.insert(pair<string, char>("vector<long long>", 'A')); // moose
66  typemap.insert(pair<string, char>("vector<unsigned long long>", 'B')); // moose
67  typemap.insert(pair<string, char>("vector<unsigned int>", 'N')); // moose
68  typemap.insert(pair<string, char>("vector<unsigned long>", 'P')); // moose
69  typemap.insert(pair<string, char>("vector<float>", 'F')); // moose
70  typemap.insert(pair<string, char>("vector<double>", 'D')); // moose
71  typemap.insert(pair<string, char>("vector<string>", 'S')); // moose
72  typemap.insert(pair<string, char>("vector<Id>", 'X')); // moose
73  typemap.insert(pair<string, char>("vector<ObjId>", 'Y')); // moose
74  typemap.insert(pair<string, char>("vector<DataId", 'Z')); //moose
75  typemap.insert(pair<string, char>("void", '_')); // moose
76  typemap.insert(pair<string, char>("vector< vector<unsigned int> >", 'T'));
77  typemap.insert(pair<string, char>("vector< vector<int> >", 'Q'));
78  typemap.insert(pair<string, char>("vector< vector<double> >", 'R'));
79  }
80  map<string, char>::iterator iter = typemap.find(name);
81  if (iter == typemap.end()){
82  return 0;
83  }
84  return iter->second;
85 }
static char name[]
Definition: mfield.cpp:401