00001 #include <charm++.h> 00002 #include <cmath> 00003 #include <math.h> 00004 #include <iostream> 00005 #include <fstream> 00006 #include <string> 00007 #include <sstream> 00008 #include <map> 00009 #include <set> 00010 #include <vector> 00011 #include <utility> 00012 #include <limits> 00013 //#include <sys/time.h> 00014 #include <float.h> 00015 00016 //#include "ControlPoints.decl.h" 00017 #include "trace-controlPoints.h" 00018 #include "LBDatabase.h" 00019 #include "controlPoints.h" 00020 #include "pathHistory.h" 00021 #include "arrayRedistributor.h" 00022 00023 00030 #if CMK_WITH_CONTROLPOINT 00031 00032 00033 using namespace std; 00034 00035 00036 00038 int redistributor2D::top_data_idx(){ 00039 return (data_height * thisIndex.y) / y_chares; 00040 } 00041 00042 int redistributor2D::bottom_data_idx(){ 00043 return ((data_height * (thisIndex.y+1)) / y_chares) - 1; 00044 } 00045 00046 int redistributor2D::left_data_idx(){ 00047 return (data_width * thisIndex.x) / x_chares; 00048 } 00049 00050 int redistributor2D::right_data_idx(){ 00051 return ((data_width * (thisIndex.x+1)) / x_chares) - 1; 00052 } 00053 00054 int redistributor2D::top_neighbor(){ 00055 return (thisIndex.y + y_chares - 1) % y_chares; 00056 } 00057 00058 int redistributor2D::bottom_neighbor(){ 00059 return (thisIndex.y + 1) % y_chares; 00060 } 00061 00062 int redistributor2D::left_neighbor(){ 00063 return (thisIndex.x + x_chares - 1) % x_chares; 00064 } 00065 00066 int redistributor2D::right_neighbor(){ 00067 return (thisIndex.x + 1) % x_chares; 00068 } 00069 00070 00072 int redistributor2D::mywidth(){ 00073 if(thisElemActive) 00074 return right_data_idx() - left_data_idx() + 1; 00075 else 00076 return 0; 00077 } 00078 00079 00081 int redistributor2D::myheight(){ 00082 if(thisElemActive) 00083 return bottom_data_idx() - top_data_idx() + 1; 00084 else 00085 return 0; 00086 } 00087 00088 00089 00090 00091 00092 00095 #endif