00001 #ifndef CELLBLOCK_H 00002 #define CELLBLOCK_H 00003 00004 #include "SundanceDefs.h" 00005 00006 #include "TSFSmartPtr.h" 00007 #include "Cell.h" 00008 #include "TSFArray.h" 00009 00010 00011 00012 namespace Sundance 00013 { 00014 00015 using namespace TSF; 00016 using std::string; 00017 00018 using std::ostream; 00019 00020 class Mesh; 00021 00022 00023 /** \ingroup LowLevelGeometry 00024 * A CellBlock is a list of cells all having a common type and common label. 00025 */ 00026 00027 class CellBlock 00028 { 00029 public: 00030 CellBlock() : label_(), cells_(), type_() {;} 00031 /** construct giving the common label */ 00032 CellBlock(const string& label, const CellTopologyCode& type, const Cell& first) : 00033 label_(label), cells_(1, first), type_(type) {;} 00034 00035 CellTopologyCode type() const {return type_;} 00036 00037 void addCell(const Cell& cell) {cells_.append(cell);} 00038 00039 const TSFArray<Cell>& cells() const {return cells_;} 00040 00041 const string& label() const {return label_;} 00042 00043 int nCells() const {return cells_.length();} 00044 private: 00045 string label_; 00046 00047 TSFArray<Cell> cells_; 00048 00049 CellTopologyCode type_; 00050 }; 00051 00052 00053 00054 00055 } 00056 00057 namespace TSF 00058 { 00059 inline string toString(const Sundance::CellBlock& cells) 00060 { 00061 return "CellBlock(type=" + cells.type().toString() + ")"; 00062 } 00063 } 00064 00065 #endif 00066 00067