00001
00002
00003
00004 #include "Gral/Grids/Cartesian2D/cartesian-grid2d.h"
00005
00006 typedef RegGrid2D::index_type index_type;
00007
00008 index_type RegGrid2D::side_offset_[4] = { index_type(0,-1),
00009 index_type(1,0),
00010 index_type(0,1),
00011 index_type(-1,0) };
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 index_type RegGrid2D::corner_offset_[4] = { index_type(0,0),
00030 index_type(1,0),
00031 index_type(1,1),
00032 index_type(0,1) };
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 index_type RegGrid2D::direction_[4] = { index_type(1,0),
00058 index_type(0,1),
00059 index_type(1,0),
00060 index_type(0,1)};
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 index_type RegGrid2D::side_vertex_1_[4] = { index_type(0,0),
00078 index_type(1,0),
00079 index_type(0,1),
00080 index_type(0,0) };
00081
00082 index_type RegGrid2D::side_vertex_2_[4] = { index_type(1,0),
00083 index_type(1,1),
00084 index_type(1,1),
00085 index_type(0,1) };
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 std::string RegGrid2D::side_name_[4] = { "S", "E", "N", "W"};
00111 std::string RegGrid2D::corner_name_[4] = { "SW", "SE", "NE", "NW"};
00112
00113 int RegGrid2D::invalid_side() { return (int)Cell::invalid_side;}
00114 int RegGrid2D::invalid_corner() { return (int)Cell::invalid_corner;}
00115
00116 int RegGrid2D::get_side(const std::string& nm)
00117 {
00118 if(nm == "S" || nm == "s" || nm == "South" || nm == "south")
00119 return (int)(Cell::S);
00120 else if(nm == "E" || nm == "e" || nm == "East" || nm == "east")
00121 return (int)(Cell::E);
00122 else if(nm == "N" || nm == "n" || nm == "North" || nm == "north")
00123 return (int)(Cell::N);
00124 else if(nm == "W" || nm == "w" || nm == "West" || nm == "west")
00125 return (int)(Cell::W);
00126 else
00127 return (int)(Cell::invalid_side);
00128 }
00129
00130
00131 int RegGrid2D::get_corner(const std::string& nm)
00132 {
00133 if(nm == "SE" || nm == "se" || nm == "South-East" || nm == "south-east" || nm == "SouthEast" || nm == "southeast")
00134 return (int)(Cell::SE);
00135 else if(nm == "NE" || nm == "ne" || nm == "North-East" || nm == "north-east" || nm == "NorthEast" || nm == "northeast")
00136 return (int)(Cell::NE);
00137 else if(nm == "NW" || nm == "nw" || nm == "North-West" || nm == "north-west" || nm == "NorthWest" || nm == "northwest")
00138 return (int)(Cell::NW);
00139 else if(nm == "SW" || nm == "sw" || nm == "South-West" || nm == "south-west" || nm == "SouthWest" || nm == "southwest")
00140 return (int)(Cell::SW);
00141 else
00142 return (int)(Cell::invalid_corner);
00143 }
00144