// RealMesh2d.h
//
// J.Liu, R.Cali
// ColoState, Jan.-Jun. 2007


#ifndef RealMesh2d_H
#define RealMesh2d_H

#include "PtVec2d.h"
#include "GeoElt2d.h"


// Real mesh in 2-dim (unavoidable redundancy)

class RealMesh2d {
private: 
   int NumElts, NumNds, NumEdges;
   int BgnLblElt, BgnLblNd, BgnLblEdge;
   int *EltType;
   int **LblVrtx;
   PtVec2d *nd;
   int (*edge)[5];
public:
   RealMesh2d();  // Default constructor
   template<class T> RealMesh2d(const T &mesh) {;}
   RealMesh2d(char *filename);  // Constructor based on reading a data file
   ~RealMesh2d();
   int numElts() const {return NumElts;}
   int numNds() const {return NumNds;}
   int numEdges() const {return NumEdges;}
   int bgnLblElt() const {return BgnLblElt;}  // Usually 0 or 1
   int bgnLblNd() const {return BgnLblNd;}  // Usually 0 or 1
   int bgnLblEdge() const {return BgnLblEdge;}  // Usually 0 or 1
   int endLblElt() const {return BgnLblElt+NumElts-1;}
   int endLblNd() const {return BgnLblNd+NumNds-1;}
   int endLblEdge() const {return BgnLblEdge+NumEdges-1;}
   int* getEltInfo(int &eltType, int lblElt) const;
   PtVec2d node(int id) const {return nd[id-BgnLblNd];}
   void getEdgeInfo(int &edgeType, PtVec2d &P1, PtVec2d &P2, 
      int &ie1, int &ie2, int ie) const;
   double maxMeshSize() const;
   double minMeshSize() const;
   void saveMesh() const;  // Default filename "VeriMesh.dat"
};

#endif  // RealMesh2d_H
