/* $Id: dirichlet.h,v 1.2 1996/10/04 15:06:28 roitzsch Exp $ */

#ifndef DIRICHLET_H
#define DIRICHLET_H

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

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


class DirichletBCs
{
  protected:

    Vector<short> Id;		// identifier for each node;
				//   	zero if node is not constrained
    Vector<float> Values;	// value for each node

  public:

    DirichletBCs ();
    virtual ~DirichletBCs() { }

    virtual Bool constant() const = 0;
    int noOfConstraints() const;
    void setValuesToZero();


    // -- 	fuctions for setting the BCs on the nodes:

    void extend(int noOfNodes);

    virtual Bool isDirichlet(Bool flag, int /*id*/, int /*comp*/, Real /*time*/) const 
    								{ return flag; }
    virtual void setBC(int node, int id, Vector<Real>& x, int comp, 
		       Real time) = 0;

    virtual void setValue(Real val, int node) { Values[node] = val; }


    // -- 	fuctions for retrieving the BCs on the nodes:


    virtual Bool isSet(int node) const { return int(Id[node]); }
    virtual Real value(int node) const { return Values[node]; }

    virtual Real initialValue(Vector<Real>& x, Real time, int comp=1) const;


  protected:

    void notImplemented() const;
};

#endif


syntax highlighted by Code2HTML, v. 0.9.1