00001 #ifndef __CCA_BLOCK_H__ 00002 #define __CCA_BLOCK_H__ 00003 00004 #include <assert.h> 00005 00007 struct CCA_dimenMap { 00009 int gLow; 00011 int gHigh; 00013 int beginPad; 00015 int endPad; 00017 int gSize; 00019 int procBefore; 00021 int procAfter; 00022 }; 00023 00046 class CCA_BlockDescription { 00047 00048 private: 00049 int nDim; 00051 int stored; 00053 struct CCA_dimenMap *dim; 00054 int nFields; 00055 int capFields; 00057 int *fieldId; 00059 char **fieldName; 00060 int locked; 00061 int blockId; 00062 00063 public: 00064 CCA_BlockDescription() ; 00065 00066 ~CCA_BlockDescription() ; 00067 00068 void setDimensions(int n) ; 00069 00070 void setLayout(int dimension, int gLow, int gHigh, 00071 int beginPad, int endPad, int gSize, 00072 int blockBefore, int blockAfter, int blockId) ; 00073 00074 void getLayout(int dimension, int *gLow, int *gHigh, 00075 int *beginPad, int *endPad, int *gSize, 00076 int *blockBefore, int *blockAfter, int *blockId) ; 00077 00081 void addField(int fieldTag, char *fieldString) ; 00082 00086 int getFieldOffset(int fieldTag) ; 00087 00091 int getFieldNameOffset(char *name) ; 00092 00093 void fixDescription() ; 00094 00099 int getBlockId(); 00100 00101 const struct CCA_dimenMap *getDimensions(int& n) ; 00102 const char **getFieldNames(int &nf) ; 00103 const int *getFieldTags(int &nf) ; 00104 int getNFields() ; 00105 00109 int getIsStacked() ; 00110 00111 }; 00112 00114 class CCA_Block 00115 { 00116 public: 00117 virtual ~CCA_Block() {} 00118 virtual CCA_BlockDescription *getDescription()=0; 00119 virtual double *getData()=0; 00120 }; 00121 00123 class CCA_DoubleBlock : public virtual CCA_Block { 00124 private: 00125 double *master; 00126 double *data; 00127 double **stack; 00128 CCA_BlockDescription *bd_; 00129 int msize; 00130 00131 public: 00132 00133 CCA_DoubleBlock(CCA_BlockDescription *bd) ; 00134 00135 virtual ~CCA_DoubleBlock() ; 00136 00137 virtual CCA_BlockDescription *getDescription() ; 00138 00139 virtual double *getData() ; 00140 00141 }; 00142 00144 class CCA_SharedDoubleBlock : public virtual CCA_Block { 00145 private: 00146 double *master; 00147 double *data; 00148 double **stack; 00149 CCA_BlockDescription *bd_; 00150 int msize; 00151 00152 public: 00153 00154 CCA_SharedDoubleBlock(CCA_BlockDescription *bd, double *sharedData) ; 00155 00156 virtual ~CCA_SharedDoubleBlock() ; 00157 00158 virtual CCA_BlockDescription *getDescription() ; 00159 00160 virtual double *getData() ; 00161 00162 }; 00163 00164 #endif // __CCA_BLOCK_H__