internal compiler error in g++ in egcs-1.1b

David B. Serafini dbs@colella.lbl.gov
Fri Jan 8 18:24:00 GMT 1999


`uname -a` returns:
   SunOS serafini 5.6 Generic_105182-09 i86pc i386 i86pc
`g++ --version` returns:
   egcs-2.91.57

`g++ -c bugFabArray.cpp` returns:
   bugFabArray.cpp: In method `void FabArray<float,FArrayBox>::copy<Real, FArrayBox>(class FArrayBox &, const class Box &, int, int, int) const':
   bugFabArray.cpp:1050:   instantiated from here
   bugFabArray.cpp:1064: Internal compiler error.
   bugFabArray.cpp:1064: Please submit a full bug report to `egcs-bugs@cygnus.com'.

`cat bugFabArray.cpp` returns:
/*
** This software is copyright (C) by the Lawrence Berkeley National
** Laboratory.  Permission is granted to reproduce this software for
** non-commercial purposes provided that this notice is left intact.
**
** It is acknowledged that the U.S. Government has rights to this
** software under Contract DE-AC03-765F00098 between the U.S.  Department
** of Energy and the University of California.
**
** This software is provided as a professional and academic contribution
** for joint exchange. Thus it is experimental, is provided ``as is'',
** with no warranties of any kind whatsoever, no support, no promise of
** updates, or printed documentation. By using this software, you
** acknowledge that the Lawrence Berkeley National Laboratory and Regents
** of the University of California shall have no liability with respect
** to the infringement of other copyrights by any part of this software.
**
** For further information about this software, contact:
**
**         Dr. John Bell
**         Bldg. 50D, Rm. 129,
**         Lawrence Berkeley National Laboratory
**         Berkeley, CA, 94720
**         jbbell@lbl.gov
*/
#ifndef BL_FARRAYBOX_H
#define BL_FARRAYBOX_H
#include <iostream>
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
#include <cstddef>
#include <set>
#include <vector>
using std::set;
using std::vector;
#define BL_SPACEDIM 2
#define SPACEDIM 2
#define NDEBUG
#define BL_ARCH_IEEE
#ifndef BL_BASEFAB_H
#define BL_BASEFAB_H
typedef float Real;
#ifndef BL_BOXARRAY_H
#define BL_BOXARRAY_H
#ifndef BL_POINTERS_H
#define BL_POINTERS_H
#ifndef BL_INTVECT_H
#define BL_INTVECT_H
#ifndef BL_ARRAY_H
#define BL_ARRAY_H
#ifndef BL_BOXLIB_H
#define BL_BOXLIB_H
#ifndef BL_SPACE_H
#define BL_SPACE_H
#if !defined(BL_LANG_FORT) || defined(BL_LANG_CC)
   const int SpaceDim = BL_SPACEDIM;
#endif
#if BL_SPACEDIM==1
#  define D_EXPR(a,b,c) ((void)((a),0))
#  define D_DECL(a,b,c) a
#  define D_TERM(a,b,c) a
#elif BL_SPACEDIM==2
#  define D_EXPR(a,b,c) ((void)((a),(b),0))
#  define D_DECL(a,b,c) a,b
#  define D_TERM(a,b,c) a b
#elif BL_SPACEDIM==3
#  define D_EXPR(a,b,c) ((void)((a),(b),(c),0))
#  define D_DECL(a,b,c) a,b,c
#  define D_TERM(a,b,c) a b c
#endif
#endif /*BL_SPACE_H*/
template <class T>
inline
T
Min (const T& a,
     const T& b)
{
    return a < b ? a : b;
}
template <class T>
inline
T
Max (const T& a,
     const T& b)
{
    return a > b ? a : b;
}
class BoxLib
{
protected:
    static const char* nullString;
public:
    static void Error (const char * msg = nullString);
    static void Warning (const char * msg = nullString);
    static void Abort (const char * msg = nullString);
    static void Assert (const char* EX,
                        const char* file,
                        int         line);
    static void OutOfMemory (const char* file,
                             int         line);
    static const char * const version;
};
#endif /*BL_BOXLIB_H*/
template <class T> class Array;
template <class T>
class Array
{
public:
    Array ();
    explicit Array (long len);
    Array (long     len,
           const T& initialvalue);
    Array (const T* vec,
           long     len);
    Array (const Array<T>& rhs);
    Array<T>& operator= (const Array<T>& rhs);
    ~Array ();
    void clear ();
    bool ready  () const;
    void reserve (long _truesize);
    void shrinkWrap ();
    void resize (long newlen);
    void resize (long     newlen,
                 const T& initialvalue);
    long length () const;
    long trueSize () const;
    T& operator[] (long K);
    const T& operator[] (long K) const;
    T& get (long i);
    const T& get (long i) const;
    T* dataPtr ();
    const T* dataPtr () const;
    void set (long     i,
              const T& elem);
    void swap (long i,
               long j);
    bool operator== (const Array<T>& rhs) const;
    bool operator!= (const Array<T>& rhs) const;
protected:
    long truesize;
    long nelem;
    T* vp;
private:
    Array<T>& operator= (int);
};

#endif /*BL_ARRAY_H*/
class IntVect
{
public:
    IntVect ();
    IntVect (D_DECL(int i, int j, int k));
    explicit IntVect (const int* a);
    explicit IntVect (const Array<int>& a);
    IntVect (const IntVect& rhs);

};
typedef IntVect INTVECT;
#endif /*BL_INTVECT_H*/
#ifndef BL_ORIENTATION_H
#define BL_ORIENTATION_H
class OrientationIter;
class Orientation
{
public:
    friend class OrientationIter;
    enum Side { low = 0, high = 1 };
    Orientation ();
    Orientation (int  dir,
                 Side side);
    Orientation (const Orientation& rhs);
    Orientation& operator= (const Orientation& rhs);
    bool operator== (const Orientation& o) const;
    bool operator!= (const Orientation& o) const;
    bool operator<  (const Orientation& o) const;
    bool operator<= (const Orientation& o) const;
    bool operator>  (const Orientation& o) const;
    bool operator>= (const Orientation& o) const;
    operator int () const;
    Orientation flip () const;
    int coordDir () const;
    Side faceDir () const;
    bool isLow () const;
    bool isHigh () const;
    friend ostream& operator<< (ostream&           os,
                                const Orientation& o);
    friend istream& operator>> (istream&     os,
                                Orientation& o);
protected:
    Orientation (int val);
private:
    int val;
};
class OrientationIter
{
public:
    OrientationIter ();
    OrientationIter (const Orientation& _face);
    OrientationIter (const OrientationIter& it);
    OrientationIter& operator= (const OrientationIter& it);
    void rewind ();
    Orientation operator() () const;
    operator void* ();
    OrientationIter& operator-- ();
    OrientationIter& operator++ ();
    OrientationIter operator-- (int);
    OrientationIter operator++ (int);
    bool operator== (const OrientationIter& oi) const;
    bool operator!= (const OrientationIter& oi) const;
protected:
    int face;
    OrientationIter (int _face);
    bool ok () const;
};
#endif /*BL_ORIENTATION_H*/
template <class T>
class CpPtr
{
public:
    CpPtr ();
    explicit CpPtr (T* rhs);
    ~CpPtr ();
    CpPtr (const CpPtr<T>& rhs);
    CpPtr<T>& operator= (T* rhs);
    CpPtr<T>& operator= (const CpPtr<T>& rhs);
    T& operator* () const;
    bool isNull () const;
    T* release ();
    bool operator== (const CpPtr<T>& rhs) const;
    bool operator!= (const CpPtr<T>& rhs) const;
protected:
    T* ptr;
};
template<class T>
class CpClassPtr :
    public CpPtr<T>
{
public:
    CpClassPtr ();
    explicit CpClassPtr (T* rhs);
    CpClassPtr (const CpClassPtr<T>& rhs);
    CpClassPtr<T>& operator= (T* rhs);
    CpClassPtr<T>& operator= (const CpClassPtr<T>& rhs);
    T* operator-> () const;
};
template<class T>
class LnPtr
{
public:
    LnPtr ();
    explicit LnPtr (T* rhs);
    LnPtr<T>& operator= (const LnPtr<T>& rhs);
    LnPtr<T>& operator= (T* rhs)
    {
        if (unique())
            delete ptr;
        ptr = rhs;
        ucnt = UseCount();
        return *this;
    }
    ~LnPtr ();
    bool unique () const;
    int linkCount () const;
    T& operator* () const;
    bool isNull () const;
    bool operator== (const LnPtr<T>& rhs) const;
     bool operator!= (const LnPtr<T>& rhs) const;
protected:
    T*       ptr;
private:
};
template<class T>
class LnClassPtr
    : public LnPtr<T>
{
public:
    LnClassPtr ();
    explicit LnClassPtr (T* rhs);
    LnClassPtr<T>& operator= (const LnClassPtr<T>& rhs);
    LnClassPtr<T>& operator= (T* rhs);
    T* operator->() const;
};
#endif /*BL_POINTERS_H*/
#ifndef BL_BOXLIST_H
#define BL_BOXLIST_H
#ifndef BL_INDEXTYPE_H
#define BL_INDEXTYPE_H
class IndexType
{
public:
    enum CellIndex { CELL = 0, NODE = 1 };
    IndexType ();
    IndexType (const IndexType& rhs);
    explicit IndexType (const IntVect& iv);
    IndexType& operator= (const IndexType& rhs);
    IndexType (D_DECL(CellIndex i, CellIndex j, CellIndex k));
    void set (int dir);
    void unset (int dir);
    bool test (int dir) const;
    void setall ();
    void clear ();
    bool any () const;
    bool ok () const;
    void flip (int i);
    bool operator== (const IndexType& t) const;
    bool operator!= (const IndexType& t) const;
    bool cellCentered () const;
    bool nodeCentered () const;
    void setType (int       dir,
                  CellIndex t);
    CellIndex ixType (int dir) const;
    int operator[] (int dir) const;
    IntVect ixType () const;
    static IndexType TheCellType ();
    static IndexType TheNodeType ();
    friend ostream& operator<< (ostream&         os,
                                const IndexType& itype);
    friend istream& operator>> (istream&   is,
                                IndexType& itype);
private:
    static int mask (int k);
    unsigned int itype;
};
#endif /*BL_INDEXTYPE_H*/
#ifndef BL_BOX_H
#define BL_BOX_H
#ifdef NODEV
#undef NODEV
#endif
class Box
{
public:
    Box ();
    Box (const IntVect& small,
         const IntVect& big);
    Box (const IntVect& small,
         const int*     vec_len);
    Box (const IntVect& small,
         const IntVect& big,
         const IntVect& typ);
    Box (const IntVect&   small,
         const IntVect&   big,
         const IndexType& t);
    Box (const Box& b);
    Box& operator= (const Box& b);
    const IntVect& smallEnd () const;
    int smallEnd (int dir) const;
    const IntVect& bigEnd () const;
    int bigEnd (int dir) const;
    IndexType ixType () const;
    IntVect type () const;
    IndexType::CellIndex type (int dir) const;
    const IntVect& length () const;
    int length (int dir) const;
    const int* loVect () const;
    const int* hiVect () const;
    const int* getVect () const;
    int operator[] (const Orientation& face) const;
    bool isEmpty () const;
    bool ok () const;
    bool contains (const IntVect& p) const;
    bool contains (const Box& b) const;
    bool intersects (const Box& b) const;
    bool sameSize (const Box& b) const;
    bool sameType (const Box &b) const;
    bool operator== (const Box& b) const;
    bool operator!= (const Box& b) const;
    bool cellCentered () const;
    bool numPtsOK () const;
    long numPts () const;
    bool volumeOK () const;
    long volume () const;
    int longside (int& dir) const;
    int longside () const;
    int shortside (int& dir) const;
    int shortside () const;
    long index (const IntVect& v) const;
    Box& setSmall (const IntVect& sm);
    Box& setSmall (int dir,
                   int sm_index);
    Box& setBig (const IntVect& bg);
    Box& setBig (int dir,
                 int bg_index);
    Box& setRange (int dir,
                   int sm_index,
                   int n_cells = 1);
    Box& shift (int dir,
                int nzones);
    Box& shift (const IntVect& iv);
    Box& shiftHalf (int dir,
                    int num_halfs);
    Box& shiftHalf (const IntVect& iv);
    Box& convert (IndexType typ);
    Box& convert (const IntVect& typ);
    Box& convert (int                  dir,
                  IndexType::CellIndex typ);
    Box& surroundingNodes ();
    Box& surroundingNodes (int dir);
    Box& enclosedCells ();
    Box& enclosedCells (int dir);
    friend Box surroundingNodes (const Box& b,
                                 int        dir);
    friend Box surroundingNodes (const Box& b);
    friend Box enclosedCells (const Box& b,
                              int        dir);
    friend Box enclosedCells (const Box& b);
    friend Box bdryLo (const Box& b,
                       int        dir,
                       int        len=1);
    friend Box bdryHi (const Box& b,
                       int        dir,
                       int        len=1);
    friend Box bdryNode (const Box&         b,
                         const Orientation& face,
                         int                len=1);
    friend Box adjCellLo (const Box& b,
                          int        dir,
                          int        len=1);
    friend Box adjCellHi (const Box& b,
                          int        dir,
                          int        len=1);
    friend Box adjCell (const Box&         b,
                        const Orientation& face,
                        int                len=1);
    Box operator& (const Box&) const;
    Box& operator&= (const Box&);
    Box& minBox (const Box &);
    friend Box minBox (const Box& b1,
                       const Box& b2);
    Box& operator+= (const IntVect& v);
    Box  operator+  (const IntVect& v) const;
    Box& operator-= (const IntVect& v);
    Box  operator-  (const IntVect& v) const;
    Box chop (int dir,
              int chop_pnt);
    Box& grow (int i);
    Box& grow (int idir,
               int n_cell);
    Box& growLo (int idir,
                 int n_cell=1);
    Box& growHi (int idir,
                 int n_cell=1);
    Box& grow (const Orientation& face,
               int                n_cell=1);
    Box& refine (int refinement_ratio);
    friend Box refine (const Box& b,
                       int        refinement_ratio);
    Box& refine (const IntVect& refinement_ratio);
    friend Box refine (const Box&     b,
                       const IntVect& refinement_ratio);
    Box& coarsen (int refinement_ratio);
    friend Box coarsen (const Box& b,
                        int        refinement_ratio);
    Box& coarsen (const IntVect& refinement_ratio);
    friend Box coarsen (const Box&     b,
                        const IntVect& refinement_ratio);
    void next (IntVect &) const;
    void next (IntVect&   p,
               const int* shv) const;
    friend ostream& operator<< (ostream&   os,
                                const Box& bx);
    friend istream& operator>> (istream& os,
                                Box&     bx);
    void dumpOn (ostream& strm = cerr) const;
    static const Box& TheUnitBox ();
protected:
    bool numPtsOK (long& N) const;
    bool volumeOK (long& N) const;
    IntVect   smallend;
    IntVect   bigend;
    IntVect   len;
    IndexType btype;
private:
    void computeBoxLen ();
};
typedef Box BOX;
#endif /*BL_BOX_H*/
#ifndef BL_LIST_H
#define BL_LIST_H
template <class T> class ListLink;
template <class T> class ListIterator;
template <class T> class List;
template <class T>
class ListLink
{
private:
    friend class List<T>;
    friend class ListIterator<T>;
    ListLink (const T&     _val,
              ListLink<T>* _pre,
              ListLink<T>* _suc)
        :
        val(_val),
        pre(_pre),
        suc(_suc) {}
private:
    T            val;
    ListLink<T>* pre;
    ListLink<T>* suc;
};
template <class T>
class ListIterator
{
public:
    explicit ListIterator (const List<T>& aList);
    ListIterator (const ListIterator<T>& rhs);
    void rewind ();
    const T& operator() () const;
    const T& operator* () const;
    operator void* ();
    bool operator! () const;
    const T& value () const;
    ListIterator<T>& operator++ ();
    ListIterator<T>& operator-- ();
    ListIterator<T> operator-- (int);
    ListIterator<T> operator++ (int);
    bool operator== (const ListIterator<T>&) const;
    bool operator!= (const ListIterator<T>&) const;
protected:
    ListIterator (const List<T>& _list,
                  ListLink<T>*   _p);
    const List<T>& list;
    ListLink<T>* p;
private:
    friend class List<T>;
    ListIterator ();
    ListIterator<T>& operator= (const ListIterator<T>&);
};
template <class T>
class List
{
public:
    List ();
    List (const List<T>& rhs);
    List<T>& operator= (const List<T>& rhs);
    ~List();
    void prepend (const T& value);
    void append (const T& value);
    void add (const T& value);
    void join (const List<T>& src);
    void catenate (List<T>& src);
    void clear ();
    T& firstElement () const;
    T& lastElement () const;
    bool includes (const T& value) const;
    bool operator== (const List<T>& rhs) const;
    bool operator!= (const List<T>& rhs) const;
    bool isEmpty () const;
    bool isNotEmpty () const;
    int length () const;
    void removeFirst ();
    void removeLast ();
    const T& operator[] (const ListIterator<T>& li) const;
    T& operator[] (const ListIterator<T>& li);
    void remove (const T& value);
    void remove (const List<T>& lst);
    void remove (ListIterator<T>& lit);
    void replace (ListIterator<T>& li,
                         const T&         val);
    void addAfter (ListIterator<T>& lit,
                   const T&         val);
    void addBefore (ListIterator<T>& lit,
                    const T&         val);
    ListIterator<T> first () const;
    ListIterator<T> last () const;
protected:
    void remove (ListLink<T> *ln);
    ListLink<T>* addBefore (ListLink<T>* ln,
                            const T&     val);
    ListLink<T>* addAfter (ListLink<T>* ln,
                           const T&     val);
    ListLink<T>* head;
    ListLink<T>* tail;
    friend class ListIterator<T>;
};

#endif /*BL_LIST_H*/
class BoxArray;
class BoxListIterator;
class BoxList
{
    friend class BoxListIterator;
    friend class BoxDomain;
public:
    BoxList ();
    explicit BoxList (IndexType btyp);
    explicit BoxList (const BoxArray& ba);
    BoxList (const BoxList& _blst);
    BoxList& operator= (const BoxList& rhs);
    ~BoxList ();
    void append (const Box& bn);
    void add (const Box& bn);
    void prepend (const Box& bn);
    void join (const BoxList& blist);
    void addAfter (BoxListIterator& bli,
                   const Box&       bn);
    void addBefore (BoxListIterator& bli,
                    const Box&       bn);
    void clear ();
    int length () const;
    bool ok () const;
    bool operator== (const BoxList& rhs) const;
    bool operator!= (const BoxList& rhs) const;
    bool isEmpty () const;
    bool isNotEmpty () const;
    const Box& operator[] (const BoxListIterator& bli) const;
    Box& operator[] (const BoxListIterator& bli);
    bool isDisjoint () const;
    bool contains (const IntVect& v) const;
    bool contains (const Box& b) const;
    bool contains (const BoxList& bl) const;
    bool contains (const BoxArray& ba) const;
    BoxList& intersect (const Box& b);
    BoxList& remove (const Box& bx);
    BoxList& remove (BoxListIterator& bli);
    BoxList& complementIn (const Box&     b,
                           const BoxList& bl);
    BoxList& refine (int ratio);
    BoxList& refine (const IntVect& ratio);
    BoxList& coarsen (int ratio);
    BoxList& coarsen (const IntVect& ratio);
    BoxList& accrete  (int sz);
    BoxList& shift (int dir,
                    int nzones);
    BoxList& shiftHalf (int dir,
                        int num_halfs);
    BoxList& shiftHalf (const IntVect& iv);
    int simplify ();
    int minimize ();
    BoxList& maxSize (int chunk);
    Box minimalBox () const;
    IndexType ixType () const;
    BoxList& surroundingNodes ();
    BoxList& surroundingNodes (int dir);
    BoxList& enclosedCells ();
    BoxList& enclosedCells  (int dir);
    BoxList& convert (IndexType typ);
    friend ostream& operator<< (ostream&       os,
                                const BoxList& blist);
    friend BoxList intersect (const BoxList& bl,
                              const Box&     b);
    friend BoxList refine (const BoxList&  bl,
                           int             ratio);
    friend BoxList coarsen (const BoxList& bl,
                            int            ratio);
    friend BoxList accrete (const BoxList& bl,
                            int            sz);
    friend BoxList boxDiff (const Box& b1in,
                            const Box& b2);
    friend BoxList complementIn  (const Box&     b,
                                  const BoxList& bl);
protected:
    List<Box> lbox;
    List<Box>& listBox();
    const List<Box>& listBox() const;
private:
    IndexType btype;
};
class BoxListIterator
    :
    public ListIterator<Box>
{
public:
    BoxListIterator (const BoxList& bl)
        :
        ListIterator<Box>(bl.lbox) {}
};
#endif /*BL_BOXLIST_H*/
#ifndef BL_ARENA
#define BL_ARENA
class Arena
{
public:
    virtual void* alloc (size_t sz) = 0;
    virtual void free (void* pt) = 0;
    static size_t align (size_t sz);
protected:
    typedef void (*FP) ();
    union Word
    {
        void*  p;
        double d;
        long   l;
        FP     f;
    };
};
inline
size_t
Arena::align (size_t s)
{
    size_t x = s + sizeof(Word) - 1;
    x -= x%sizeof(Word);
    return x;
}
#endif /*BL_ARENA*/
class BoxArray
{
public:
    friend ostream& operator<< (ostream&        os,
                                const BoxArray& ba);
    BoxArray ();
    explicit BoxArray (size_t size);
    BoxArray (const Box* bxvec,
              int        nbox);
    explicit BoxArray (const BoxList& bl);
    BoxArray (const BoxArray& bs);
    explicit BoxArray (istream& is);
    BoxArray& operator= (const BoxArray& rhs);
    ~BoxArray ();
    void define (const BoxList& bl);
    void define (const BoxArray& bs);
    void define (istream& is);
    void clear ();
    void resize (int len);
    int length () const;
    bool ready () const;
    ostream& writeOn (ostream&) const;
    bool operator== (const BoxArray& rhs) const;
    bool operator!= (const BoxArray& rhs) const;
    BoxArray& maxSize (int block_size);
    BoxArray& refine (int refinement_ratio);
    BoxArray& refine (const IntVect& refinement_ratio);
    BoxArray& coarsen (int refinement_ratio);
    BoxArray& coarsen (const IntVect& refinement_ratio);
    BoxArray& grow (int n);
    BoxArray& grow (const IntVect& iv);
    BoxArray& grow (int idir,
                    int n_cell);
    BoxArray& surroundingNodes ();
    BoxArray& surroundingNodes (int dir);
    BoxArray& enclosedCells ();
    BoxArray& enclosedCells  (int dir);
    BoxArray& convert (IndexType typ);
    BoxArray& convert (Box (*fp)(const Box&));
    BoxArray& shift (int dir,
                     int nzones);
    BoxArray& shiftHalf (int dir,
                         int num_halfs);
    BoxArray& shiftHalf (const IntVect &iv);
    void set (int        i,
              const Box& ibox);
    const Box& operator[] (int index) const;
    const Box& get (int index) const;
    bool ok () const;
    bool isDisjoint () const;
    BoxList boxList () const;
    bool contains (const IntVect& v) const;
    bool contains (const Box& b) const;
    bool contains (const BoxArray& bl) const;
    Box minimalBox () const;
    friend BoxArray boxComplement (const Box& b1in,
                                   const Box& b2);
    friend BoxArray complementIn (const Box&      b,
                                  const BoxArray& ba);
    friend BoxArray intersect (const BoxArray& ba,
                               const Box&      b);
    void reserve (long _truesize);
protected:
    void rehash ();
    ostream& print (ostream& os) const;
    class Ref
    {
        friend class BoxArray;
        Ref ();
        Ref (size_t size);
        Ref (const Box* bxvec,
             int        nbox);
        Ref (const BoxList& bl);
        Ref (istream& is);
        Ref (const Ref& rhs);
        void define (const BoxList& bl);
        void define (const Array<Box>& ba, unsigned long hash);
        void define (istream& is);
        bool operator== (const Ref& rhs) const;
        bool operator!= (const Ref& rhs) const;
        Array<Box>    m_abox;
        unsigned long m_hash_sig;
    };
    void uniqify ();
    LnClassPtr<Ref> m_ref;
};
#endif /*BL_BOXARRAY_H*/
#ifndef BL_CARENA
#define BL_CARENA
class CArena
    :
    public Arena
{
public:
    CArena (size_t hunk_size = 0);
    virtual ~CArena ();
    virtual void* alloc (size_t nbytes);
    virtual void free (void* ap);
    void* calloc (size_t nmemb, size_t size);
    void* realloc (void* ptr, size_t size);
    enum { DefaultHunkSize = 1024*1024 };
protected:
    class Node
    {
    public:
        Node ()
            :
            m_block(0), m_size(0) {}
        Node (void* block, size_t size)
            :
            m_block(block), m_size(size) {}
        Node (const Node& rhs)
            :
            m_block(rhs.m_block), m_size(rhs.m_size) {}
        Node& operator= (const Node& rhs)
        {
            m_block = rhs.m_block;
            m_size  = rhs.m_size;
            return *this;
        }
        bool operator< (const Node& rhs) const
        {
            return m_block < rhs.m_block;
        }
        bool operator== (const Node& rhs) const
        {
            return m_block == rhs.m_block;
        }
        void* block () const { return m_block; }
        void block (void* blk) { m_block = blk; }
        size_t size () const { return m_size; }
        void size (size_t sz) { m_size = sz; }
    private:
        void* m_block;
        size_t m_size;
    };
    typedef set < Node > NL;
    vector<void*> m_alloc;
    NL m_freelist;
    NL m_busylist;
    size_t m_hunk;
private:
    CArena (const CArena& rhs);
    CArena& operator= (const CArena& rhs);
};
extern Arena* The_FAB_Arena;
#endif /*BL_CARENA*/
template <class T>
class BaseFab
{
public:
    BaseFab ();
    explicit BaseFab (const Box& bx,
                      int        n = 1);
    virtual ~BaseFab ();
};
#endif /*BL_BASEFAB_H*/
class FArrayBox
{
public:
    FArrayBox ();
    virtual ~FArrayBox ();
};
#endif /*BL_FARRAYBOX_H*/
#ifndef BL_FABARRAY_H
#define BL_FABARRAY_H
template <class T, class FAB>
class FabArray
{
public:
    FabArray ();
    virtual ~FabArray ();
    int length () const;
    void copy (const FabArray<T,FAB>& fa);
    void copy (const FabArray<T,FAB>& src,
               int                    src_comp,
               int                    dest_comp,
               int                    num_comp);
    void copy (FAB&       dest,
               const Box& subbox,
               int        src_comp,
               int        dest_comp,
               int        num_comp) const;
protected:
    mutable BoxArray    boxarray;   /* So FabSets can modify'm */
};
template <class T, class FAB>
inline
void
FabArray<T,FAB>::copy (const FabArray<T,FAB>& src)
{
    copy(src,0,0,0);
}
template <class T, class FAB>
void
FabArray<T,FAB>::copy (FAB&       dest,
                       const Box& subbox,
                       int        src_comp,
                       int        dest_comp,
                       int        num_comp) const
{
    int overlapLength = 0, overlapIndex = 0;
    BoxArray    overlapBA(overlapLength);
    Array<FAB> overlapData(overlapLength);
    int i = 0 ;
        overlapData.set(i, new FAB(overlapBA[i], num_comp));
        dest.copy(overlapData[i],
                  overlapBA[i],
                  0,
                  overlapBA[i],
                  dest_comp,
                  num_comp);
}
#endif /*BL_FABARRAY_H*/
class MultiFab
    :
    public FabArray<Real, FArrayBox>
{
  public:
    MultiFab ();
    virtual ~MultiFab();
};
    MultiFab* stateOld_ptr;
    MultiFab* stateNew_ptr;
void
initData()
{
    MultiFab& stateOld = *stateOld_ptr;
    MultiFab& stateNew = *stateNew_ptr;
    stateNew.copy(stateOld);
}



More information about the Gcc-bugs mailing list