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

#ifndef CONNECT_H
#define CONNECT_H

#include "general.h"

#include "kvector.h"
#include "slist.h"
#include "alloc.h"

class PATCH;
class MESH;
class Element;
class Interface;

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

class NeighbourNode 
{ 
  public:
    
    int 	   neighbour; 
    NeighbourNode* next; 
    
    void reset() { neighbour = 0; }

    void print() { cout << "\n neighb: " << neighbour; }
    Bool equal(NeighbourNode* n2) { return neighbour == n2->neighbour; }
};
//-------------------------------------------------------------------------


class ConnectionPattern
{
  protected:

    Vector<SList<NeighbourNode>*>  connVec;
    Allocator<NeighbourNode>       allocator;

    SList<NeighbourNode>* 	   sListVec;

  public:

    ConnectionPattern(MESH& mesh, const Element& element, 
		      const Interface& interface, int noOfNodes);

    ConnectionPattern(int lowNode, int highNode);

    virtual ~ConnectionPattern();

    int size() const;
    int l() const;
    int h() const;
    int bandwidth() const;
    int noOfElements(int row) const;
    NeighbourNode* first(int row) const;

  protected:

    void  setConnectionVector();
    virtual void print();
    virtual void print(Vector<int>& keep);

  private:

    void insert(Vector<int>& node);
};
//-------------------------------------------------------------------------


#endif
