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

#ifndef ELEMENTS1_H
#define ELEMENTS1_H

#include "elementsA.h"

typedef Real (shapeFct1)(Real x);

//-------------------------------------------------------------------------

			// Linear Line:


class Line : public StdElement
{

  public:

    Line(Material* material);
    virtual ~Line() { }

    virtual int SpaceDim()     const { return 1; }

    virtual int NoOfPoints()   const { return 2; }
    virtual int NoOfNodes()    const { return 2; }

    virtual int NodesOnPoint() const { return 1; }
    virtual int NodesOnEdge()  const { return 0; }
    virtual int InnerNodes ()  const { return 0; }

    virtual int NoOfEdges() const { return 1; }
    virtual int NoOfFaces() const { return 2; }


    virtual Real SF(int node, const Vector<Real>& unitCoord) const 
    					{ return (*sf[node])(unitCoord[1]); }
    virtual Real dSF(int node, int deriv, const Vector<Real>& unitCoord) const 
    				   { return (*dsf[node][deriv])(unitCoord[1]); }


    virtual void assembleConstEllip(const PATCH& elem, Matrix<Real>& A, 
				    const Jacobian& Jac, 
				    const Matrix<Bool>* pattern) const
	    { assembleConstEllip1(elem, A, Jac, pattern); } 

     virtual void assembleConstConvec(const PATCH& elem, Matrix<Real>& A, 
				     const Jacobian& Jac, 
				     const Matrix<Bool>* pattern) const
	    { assembleConstConvec1(elem, A, Jac, pattern); }

    virtual Bool assembleNeumannBCs(const PATCH& elem, Vector<Real>& b, 
				    const Matrix<Bool>* pattern,
				    Real time=0.0) const
	    { return assembleNeumannBCs1(elem, b, pattern, time); }

    virtual Bool assembleCauchyBCs(const PATCH& elem, Matrix<Real>& A, 
				   Vector<Real>& b,const Matrix<Bool>* pattern, 
				   Real time=0.0) const
	    { return assembleCauchyBCs1(elem, A, b, pattern, time); }


  protected:

    Line() : StdElement() { }


    virtual void basicInit();
    virtual void compConstantMatrices();
	
    shapeFct1*  sf[1+3],
    	      *dsf[1+3][1+1];  // (*dsf[i][k])(...):  dsf (node i)/dx(k)
};
//-------------------------------------------------------------------------


		// -- quadratic hierarchical element:


class HQuadLine : public Line
{

  public:

    HQuadLine(Material* material);

    virtual int NoOfNodes()    const { return 3; }

    virtual int NodesOnPoint() const { return 1; }
    virtual int NodesOnEdge()  const { return 1; }
    virtual int InnerNodes ()  const { return 0; }

    virtual Real SF(int node, const Vector<Real>& unitCoord) const 
    					{ return (*HQsf[node])(unitCoord[1]); }
    virtual Real dSF(int node, int deriv, const Vector<Real>& unitCoord) const 
    				  { return (*dHQsf[node][deriv])(unitCoord[1]); }

  protected:

    HQuadLine(): Line() { }

    shapeFct1*  HQsf[1+3],
    	      *dHQsf[1+3][1+1];  // (*dsf[i][k])(...):  dsf (node i)/dx(k)

    virtual void basicInit();
    virtual void setPatterns();
};
//-------------------------------------------------------------------------


		// -- quadratic Lagrange element:


class LQuadLine : public HQuadLine
{

  public:

    LQuadLine(Material* material);

    virtual Real SF(int node, const Vector<Real>& unitCoord) const 
    					{ return (*LQsf[node])(unitCoord[1]); }
    virtual Real dSF(int node, int deriv, const Vector<Real>& unitCoord) const 
    				  { return (*dLQsf[node][deriv])(unitCoord[1]); }

  protected:

    LQuadLine(): HQuadLine() { }

    shapeFct1*  LQsf[1+3],
    	      *dLQsf[1+3][1+1];  // (*dsf[i][k])(...):  dsf (node i)/dx(k)

    virtual void basicInit();
};
//-------------------------------------------------------------------------



#endif


