Go to Overview over all GrAL packages.
Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

src/Cartesian2D/cartesian-grid2d.C

Go to the documentation of this file.
00001 
00002 // $LICENSE
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),  // S
00009                                            index_type(1,0),   // E
00010                                            index_type(0,1),   // N
00011                                            index_type(-1,0) };// W 
00012 
00013 /*  side_offset == outer normal:
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),  // SW
00030                                              index_type(1,0),  // SE
00031                                              index_type(1,1),  // NE
00032                                              index_type(0,1) };// NW
00033 
00034 /*  corner_offset
00035 
00036                          _
00037     ^ NW                 /| NE
00038     |                   / 
00039     +------------------+
00040     |                  |
00041     |                  |
00042     |                  |
00043     |                  |  
00044     |                  |
00045     | SW               |
00046     +------------------+  --> SE
00047               |
00048               +
00049 */
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 index_type RegGrid2D::direction_[4]  = { index_type(1,0), // S
00058                                          index_type(0,1), // E
00059                                          index_type(1,0), // N
00060                                          index_type(0,1)};// W
00061 
00062 /*  direction of sides:
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),  // S 
00078                                              index_type(1,0),  // E 
00079                                              index_type(0,1),  // N 
00080                                              index_type(0,0) };// W 
00081 
00082 index_type  RegGrid2D::side_vertex_2_[4] = { index_type(1,0),  // S 
00083                                              index_type(1,1),  // E 
00084                                              index_type(1,1),  // N 
00085                                              index_type(0,1) };// W 
00086 
00087 /*  coordinates of start (VX1) and end (VX2) vertices of sides
00088    
00089       VN1                VN2
00090   VW2  +------------------+  VE2
00091        |                  |
00092        |                  |
00093        |                  |
00094        |                  |
00095        |                  |
00096        |                  |
00097   VW1  +------------------+  VE1
00098       VS1                VS2
00099 */
00100 
00101 
00102 
00103 /*
00104 int  RegGrid2D::offset_dir[3][3] = 
00105                         { {Cell::SW,Cell::W,           Cell::NW},
00106                           {Cell::S, Cell::invalid_side,Cell::N },
00107                           {Cell::SE,Cell::E,           Cell::NE}};
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 

Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 16:08:10 2002 for GrAL Cartesian2D by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000