Overture  Version 25
MultigridCompositeGrid.h
Go to the documentation of this file.
1 /* -*-Mode: c++; -*- */
2 #ifndef MULTIGRID_COMPOSITE_GRID_H
3 #define MULTIGRID_COMPOSITE_GRID_H "MultigridCompositeGrid.h"
4 
5 //=======================================================================================
10 //======================================================================================
11 
12 #include "Overture.h"
13 
14 class MultigridCompositeGrid : public ReferenceCounting // derive the class from ReferenceCounting
15 {
16 
17 public:
18 
19 // default constructor
21 
22 // destructor
24 
25  // copy constructor
27  const CopyType copyType = DEEP );
28 
29 // assignment operator
31 
32 // Allocate space for the CompositeGrid
33 int allocate();
34 
36 const CompositeGrid & compositeGrid() const{ assert(rcData->pcg!=NULL); return *rcData->pcg; }
37 
39 const CompositeGrid & operator()() const { assert(rcData->pcg!=NULL); return *rcData->pcg; } //
40 
42 bool isGridUpToDate(){ return rcData->isUpToDate; }
43 
44 // Return true if the CompositeGrid has not be allocated yet:
45 bool isNull() const { return rcData->pcg==NULL; } //
46 
47 // Specify that the multigrid hierarchy is or is not update to date.
48 void setGridIsUpToDate( bool trueOrFalse =true );
49 
50 // Update the grid to match a new CompositeGrid.
51 void updateToMatchGrid( CompositeGrid & cg );
52 
53 // reference this object to another
54 void reference( const MultigridCompositeGrid & rcc );
55 
56 // break a reference
57 void breakReference();
58 
59 private:
60 
61 // used by constructors
62 void initialize();
63 
64 // These are used by list's of ReferenceCounting objects
65 virtual void reference( const ReferenceCounting & rcc )
67 virtual ReferenceCounting & operator=( const ReferenceCounting & rcc )
69 virtual ReferenceCounting* virtualConstructor( const CopyType ct = DEEP )
70  { return ::new MultigridCompositeGrid(*this,ct); }
71 
72 // protected:
73 public: // *wdh* 110518 do this for now to fix a problem with gcc 4.5.?
74 
75 // this class hold the reference counted data
77 {
78 public:
79 
80 CompositeGrid *pcg; // holds the multigrid hierarchy
81 bool isUpToDate; // set to true when the multigrid hierarchy is up to date.
82 
84 
86 
88 
89 private:
90 // These are used by list's of ReferenceCounting objects
91 virtual void reference( const ReferenceCounting & rcc )
92  { MultigridCompositeGridData::reference( (MultigridCompositeGridData&) rcc ); }
93 virtual ReferenceCounting & operator=( const ReferenceCounting & rcc )
95 virtual ReferenceCounting* virtualConstructor( const CopyType )
96  { return ::new MultigridCompositeGridData(); }
97 };
98 
99 
100 protected:
102 
103 
104 };
105 
106 #endif