Overture  Version 25
ParentChildSiblingInfo.h
Go to the documentation of this file.
1 // created by Bobby Philip 05092001
2 #ifndef _PARENTCHILDSIBLINGINFO_H_
3 #define _PARENTCHILDSIBLINGINFO_H_
4 
5 #include <limits.h>
6 #include "GenericDataBase.h"
7 #include "ReferenceCounting.h"
8 #include "GenericDataBase.h"
9 #include "GridCollection.h"
10 
11 #ifndef OV_USE_OLD_STL_HEADERS
12 #include <list>
14 #else
15 #include <list.h>
16 #endif
17 
19 #include <BoxArray.H>
20 
21 // forward declarations
22 class ChildInfo;
23 class ParentInfo;
24 class SiblingInfo;
25 
27 {
28  private:
29 
31  list<ParentInfo*> ParentList;
32 
34  list<ChildInfo*> ChildList;
35 
37  list<SiblingInfo*> SiblingList;
38 
40  aString className;
41 
43  inline virtual ReferenceCounting& operator=( const ReferenceCounting &x )
44  { return operator=((ParentChildSiblingInfoData &) x);}
45 
46  inline virtual void reference( const ReferenceCounting &x )
47  { reference((ParentChildSiblingInfoData &) x); }
48 
49  inline virtual ReferenceCounting *virtualConstructor( const CopyType ct = DEEP ) const
50  { return new ParentChildSiblingInfoData(*this, ct); }
51 
52  public:
53 
56 
59  const CopyType ct = DEEP );
60 
63 
66 
68  inline virtual aString getClassName( void ) const { return className; }
69 
72  void reference( const ParentChildSiblingInfoData &x );
73 
75  virtual void breakReference(void);
76 
78  virtual void consistencyCheck( void ) const;
79 
81  virtual Integer get( const GenericDataBase & db, const aString &name );
82 
84  virtual Integer put( const GenericDataBase & db, const aString &name ) const;
85 
87  inline const list<ParentInfo* > &getParents (void) const { return ParentList; }
88 
90  inline const list<ChildInfo* > &getChildren(void) const { return ChildList; }
91 
93  inline const list<SiblingInfo*> &getSiblings(void) const { return SiblingList;}
94 
96  void addParent ( ParentInfo * );
97 
99  void addChild ( ChildInfo * );
100 
102  void addSibling( SiblingInfo *);
103 
105  friend ostream& operator<<(ostream& s, const ParentChildSiblingInfoData &pcsInfoData );
106 
107 };
108 
110 {
111  private:
112 
114  aString className;
115 
117  inline virtual ReferenceCounting& operator=( const ReferenceCounting &x )
118  { return operator=((ParentChildSiblingInfo &) x);}
119 
120  inline virtual void reference( const ReferenceCounting &x )
121  { reference((ParentChildSiblingInfo &) x); }
122 
123  inline virtual ReferenceCounting *virtualConstructor( const CopyType ct = DEEP ) const
124  { return new ParentChildSiblingInfo(*this, ct); }
125 
127  static bool gridsOverlap( const MappedGrid &, const MappedGrid &, const IntegerArray &refinementRatio, Box & );
128 
130  static bool isSibling( const MappedGrid &, const MappedGrid &, Box & );
131 
133  static bool isSibling( const Box &, const Box &, const IntegerArray &, const int, Box & );
134 
136  bool addIfPeriodicSibling( const MappedGrid &,
137  const MappedGrid &,
138  const MappedGrid &,
139  const IntegerArray &,
140  const int );
142  void addParent( const int,
143  const Box & );
144 
146  void addChild( const int,
147  const Box & );
149  void addSibling( const int siblingGridIndex,
150  const Box &ghostBox,
151  const Box &siblingBox );
152 
153 
154  public:
155  // public member data
156  typedef ParentChildSiblingInfoData RCData; // following conventions in Overture
158 
163  const CopyType ct = DEEP );
166 
168  ParentChildSiblingInfo &operator=( const ParentChildSiblingInfo &x );
169 
171  inline virtual aString getClassName( void ) const { return className; }
172 
174  void reference( const ParentChildSiblingInfo &x );
175 
177  void reference( ParentChildSiblingInfoData &x );
178 
180  virtual void breakReference( void );
181 
183  virtual void consistencyCheck( void ) const;
184 
186  virtual Integer get( const GenericDataBase & db, const aString &name );
187 
189  virtual Integer put( const GenericDataBase & db, const aString &name ) const;
190 
192  inline const list<ParentInfo*> &getParents (void) const { assert( rcData != NULL ); return rcData->getParents(); }
193 
195  inline const list<ChildInfo*> &getChildren(void) const { assert( rcData != NULL ); return rcData->getChildren();}
196 
198  inline const list<SiblingInfo*> &getSiblings(void) const { assert( rcData != NULL ); return rcData->getSiblings();}
199 
201  static void buildParentChildSiblingInfoObjects( const GridCollection &gc,
202  ListOfParentChildSiblingInfo &listOfPCSInfo );
203 
205  static bool isValidBoxForType( const Box &box, const IndexType &iType );
206 
208  static void getGhostRegionBoxes( const MappedGrid &, const Range &, const IndexType &, BoxList & ,
209  bool excludePhysicalBoundaries = false );
210 
212  int getParentBoxes( intSerialArray &, BoxList &, const IndexType &, const int );
213 
215  int getChildBoxes ( intSerialArray &, BoxList &, const IndexType &, const int );
216 
218  int getSiblingBoxes ( intSerialArray &, BoxList &, BoxList &, const IndexType &, const int );
219 
221  int getParentGhostBoxes ( intSerialArray &, BoxList &, const Range &, const GridCollection &, const int, const IndexType &, const bool = FALSE );
222 
224  int getSiblingGhostBoxes( intSerialArray &, BoxList &, BoxList &, const Range &, const GridCollection &, const int, const IndexType & );
225 
226  // writes a description of pcsInfo to output stream s
227  friend ostream& operator<<(ostream& s, const ParentChildSiblingInfo &pcsInfo );
228 };
229 
230 #endif //_PARENTCHILDSIBLINGINFO_H_