00001 #ifndef MESHDATA_H 00002 #define MESHDATA_H 00003 00004 #include "SundanceDefs.h" 00005 00006 #include <string> 00007 #include "TSFArray.h" 00008 #include "Cell.h" 00009 #include "TSFRBTree.h" 00010 #include "Point.h" 00011 #include "TSFIntHashtable.h" 00012 #include "MPIComm.h" 00013 00014 00015 00016 namespace Sundance 00017 { 00018 00019 using namespace TSF; 00020 using std::string; 00021 00022 using std::ostream; 00023 00024 /** \ingroup LowLevelGeometry 00025 00026 MeshData contains the data tables defining a mesh. It lives 00027 inside a mesh, stored by ref-counted pointer, so you can make lots of 00028 copies of the mesh object which all refer back to the same 00029 data. MeshData has no public accessors. Classes Mesh and CellBase are friends and 00030 access the mesh data directly. 00031 00032 */ 00033 00034 00035 00036 class MeshData 00037 { 00038 public: 00039 /** */ 00040 MeshData(int spatialDim, const MPIComm& comm); 00041 MeshData(int spatialDim, int rank, int nProc); 00042 ~MeshData(){;} 00043 00044 void diagnostics() const ; 00045 00046 int lookupLabel(const string& label); 00047 int lookupTypeCode(const string& typeName) const ; 00048 00049 void textWrite(ostream& os) const ; 00050 00051 friend class Mesh; 00052 friend class CellBase; 00053 friend class ZeroCell; 00054 friend class MaximalCell; 00055 friend class IntermediateCell; 00056 friend class Cell; 00057 friend class BoundaryCellSet; 00058 private: 00059 MeshData(const MeshData& /*other*/){TSFError::raise("mesh data copy ctor");} 00060 00061 // multiprocessor information 00062 MPIComm comm_; 00063 int procID_; 00064 int numProcs_; 00065 00066 // mesh identification. 00067 // meshID_ is the ID number for this mesh. 00068 // topID_ is the ID number for the next mesh created. 00069 static int topID_; 00070 int meshID_; 00071 00072 // spatial dimension of this mesh. 00073 int spatialDim_; 00074 00075 TSFArray<int> localCellCount_; 00076 00077 // a flat array of every point in the local processor's submesh. 00078 TSFArray<Point> points_; 00079 // list of global indices 00080 TSFArray<int> pointGlobalIndex_; 00081 // list of which processor owns each point 00082 TSFArray<int> pointOwnerProcID_; 00083 // list of the processors that contact, but don't own, each point. 00084 TSFArray<TSFArray<int> > pointSharerProcID_; 00085 // map global point index to local point index 00086 TSFIntHashtable pointIndexMap_; 00087 00088 // pointToZeroCellMap lets us find a zero cell given a point index. 00089 // This will help us locate a cell's facets based given its node numbers. 00090 TSFArray<int> pointToZeroCellMap_; 00091 // table of cells, indexed by (dimension, index). 00092 TSFArray<TSFArray<Cell> > cells_; 00093 // map global cell index to local cell index 00094 TSFArray<TSFIntHashtable> cellIndexMap_; 00095 00096 // processor IDs for cells 00097 TSFArray<TSFArray<int> > ownerProcID_; 00098 00099 // faceting information for intermediate cells 00100 TSFArray<TSFArray<char> > myFacetIndex_; 00101 00102 // labeling 00103 TSFArray<string> labels_; 00104 TSFRBTree<string, short int> labelToIndexMap_; 00105 TSFArray<TSFArray<short int> > labelIndices_; 00106 00107 // identification of boudnary cells 00108 TSFArray<bool> isBoundary_; 00109 00110 // Auxiliary connectivity information, used for maximal cells only (which 00111 // is why we keep it here instead of in all cells). 00112 00113 // for each maximal cell, list the other maxiaml cells that share a node. 00114 // maximalNeighbors_[cellIndex][neighborIndex] 00115 TSFArray<TSFArray<int> > maximalNeighbors_; 00116 // for each maximal cell, list the number of nodes shared by the neighbors 00117 // neighborWeights_[cellIndex][neighborIndex] 00118 TSFArray<TSFArray<int> > neighborWeights_; 00119 00120 static string emptyLabel_; 00121 }; 00122 00123 } 00124 #endif 00125 00126 00127