/* $Id: integ.h,v 1.1.1.1 1996/10/02 10:35:51 roitzsch Exp $ */

#ifndef INTEG_H
#define INTEG_H

#include "general.h"
#include "kvector.h"
#include "matrix.h"


class IntegData
{
  public:

    char*  formName;
    int noOfIPoints;
    int degree;
    int dim;

    Matrix<Real> point;		// location x,y,z of ips
    Vector<Real> weight;	

    IntegData(int degree0, int noOfIPoints0, int dim0); 
    virtual ~IntegData() { delete formName; }
};
//-------------------------------------------------------------------------


class GLIntegData1d : public IntegData
{
  public:
   GLIntegData1d(int degree0, int noOfIPoints0);
   virtual ~GLIntegData1d() {  }

   void GaussLegendreData(Vector<Real>& x, Vector<Real>&  w, int n);
};
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------


class IntegForm
{
  protected:
	IntegData* ID;

  public:
	IntegForm();
	~IntegForm() { delete ID; }

 	int  NoOfIPoints() const  { return ID->weight.h;}
	Real Weight(int ip) const { return ID->weight[ip];}
        void Coordinates(int ip, Vector<Real>& u);
        void Info();

  protected:
        void missingFormula(const int dim, const int degree) const;
	void readFormula(const char*  formName0, Bool completeMatch=True);
	void missingItem(const char* item, const char* formName0);
};
//-------------------------------------------------------------------------

class GaussForm : public IntegForm
{
  public:
	GaussForm(int spaceDim0, int degree0, const char* formName0=0);
	~GaussForm() { delete ID; }
};
//-------------------------------------------------------------------------

class LumpedForm : public IntegForm
{
  public:
	LumpedForm(int spaceDim0, int degree0, const char* formName0=0);
	~LumpedForm() { delete ID; }

};

#endif
