00001 #if !defined (DISTRIBUTED_DATA_H) 00002 #define DISTRIBUTED_DATA_H 00003 00004 #include "petscvec.h" 00005 #include "petscmat.h" 00006 #include <string> 00007 00008 namespace ddata 00009 { 00011 class DistributedData{ 00012 00013 protected: 00014 int num_cores; 00015 int core_id; 00016 00017 public: 00018 DistributedData(); 00019 ~DistributedData(); 00020 }; 00021 00022 /***************************************************************/ 00024 class Vector:public DistributedData{ 00025 00026 private: 00027 int num_total_rows; 00028 int num_local_rows; 00029 int local_row_begin; 00030 int local_row_end; 00031 int num_ghosts; 00032 00033 public: 00034 Vec data; 00035 Vector(); 00036 Vector(int num_total_rows); 00037 Vector(int num_total_rows, int num_ghosts); 00038 ~Vector(); 00039 void set_size(int num_total_rows); 00040 void set_ghost_size(int num_total_rows, int num_ghosts); 00041 void print(std::string file_name) const; 00042 void view(void) const; 00043 int id(void) const {return core_id;} 00044 int size(void) const {return num_total_rows;} 00045 int lsize(void) const {return num_local_rows;} 00046 }; 00047 00048 00049 /***************************************************************/ 00051 class Matrix:public DistributedData{ 00052 private: 00053 int num_total_rows; 00054 int num_local_rows; 00055 int num_total_cols; 00056 int num_local_cols; 00057 00058 public: 00059 Mat data; 00060 Matrix(int num_total_rows, int num_total_cols); 00061 ~Matrix(); 00062 00063 }; 00064 } 00065 #endif