00001 /* @HEADER@ */ 00002 // ************************************************************************ 00003 // 00004 // Sundance 00005 // Copyright (2005) Sandia Corporation 00006 // 00007 // Copyright (year first published) Sandia Corporation. Under the terms 00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 00009 // retains certain rights in this software. 00010 // 00011 // This library is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Lesser General Public License as 00013 // published by the Free Software Foundation; either version 2.1 of the 00014 // License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, but 00017 // WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 // Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public 00022 // License along with this library; if not, write to the Free Software 00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00024 // USA 00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 00026 // Sandia National Laboratories, Livermore, California, USA 00027 // 00028 // ************************************************************************ 00029 /* @HEADER@ */ 00030 00031 #ifndef SUNDANCE_CELLREORDERERIMPLEMBASE_H 00032 #define SUNDANCE_CELLREORDERERIMPLEMBASE_H 00033 00034 00035 #include "SundanceDefs.hpp" 00036 #include "SundanceNoncopyable.hpp" 00037 #include "SundanceObjectWithVerbosity.hpp" 00038 #include <typeinfo> 00039 00040 namespace Sundance 00041 { 00042 class MeshBase; 00043 00044 /** 00045 * Abstract interface for the low-level objects that 00046 * implement cell reordering. 00047 * 00048 * <h4> Adding a new reordering algorithm </h4> 00049 * 00050 * To add a new reordering algorithm, you should create a new 00051 * subclass of CellReordererImplemBase. The only method you will 00052 * need to implement is 00053 * \code 00054 * virtual int advance(int currentLID) const 00055 * \endcode 00056 * which should provide the maximal cell LID found after 00057 * the <tt>currentLID.</tt> 00058 * Depending on the algorithm , you may also want to override 00059 * the methods 00060 * \code 00061 * virtual int begin() const 00062 * virtual int end() const 00063 * \endcode 00064 * which return the index of the first cell to be processed, 00065 * and a past-the-end index. 00066 */ 00067 class CellReordererImplemBase 00068 : public ObjectWithClassVerbosity<CellReordererImplemBase> 00069 { 00070 public: 00071 /** Construct with a pointer to a mesh */ 00072 CellReordererImplemBase(const MeshBase* mesh); 00073 00074 /** virtual dtor */ 00075 virtual ~CellReordererImplemBase(){;} 00076 00077 /** return a descriptive std::string */ 00078 virtual std::string typeName() const {return typeid(*this).name();} 00079 00080 /** */ 00081 virtual int advance(int currentLID) const = 0 ; 00082 00083 /** */ 00084 virtual int begin() const {return 0;} 00085 00086 /** */ 00087 virtual int end() const ; 00088 protected: 00089 /** */ 00090 const MeshBase* mesh() const {return mesh_;} 00091 00092 private: 00093 /** Unmanaged pointer to a mesh. The mesh will contain a smart 00094 * pointer to this reorderer, so to avoid closed reference 00095 * graphs we store a raw pointer here.*/ 00096 const MeshBase* mesh_; 00097 00098 }; 00099 00100 } 00101 00102 00103 00104 #endif