// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ==  http://www.amdis-fem.org                                              ==
// ==                                                                        ==
// ============================================================================
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.



/** \file CoarseningManager1d.h */

#ifndef AMDIS_COARSENINGMANAGER_1D_H
#define AMDIS_COARSENINGMANAGER_1D_H

#include "CoarseningManager.h"

namespace AMDiS {

  /** \ingroup Adaption 
   * \brief
   * Implements a CoarseningManager for 1-dimensional meshes.
   */
  class CoarseningManager1d : public CoarseningManager
  {
  public:
    /// Calls base class constructor and checks dimension of mesh. 
    CoarseningManager1d() 
      : CoarseningManager() 
    {}

    /// destructor
    virtual ~CoarseningManager1d() {}

    /** \brief
     * Overloads CoarseningManager::coarsenMesh. In 1d a simple recursive
     * coarsening algorithm is implemented which doesn't need coarsenFunction.
     */
    Flag coarsenMesh(Mesh *aMesh);

  protected:
    /// Not needed in this sub class
    void coarsenFunction(ElInfo *) 
    {
      FUNCNAME("CoarseningManager1d::coarsenFunction");
      ERROR_EXIT("not used for dim = 1");
    }
  
    /// Needed instead of coarsenFunction in 1d.
    int coarsenRecursive(Line *parent);
  
  };

}

#endif // AMDIS_COARSENINGMANAGER_1D_H