Overture  Version 25
SparseRep.h
Go to the documentation of this file.
1 #ifndef SPARSE_REP_H
2 #define SPARSE_REP_H
3 
5 #include "MappedGridFunction.h"
6 
7 
8 // class used to save information about the sparse representation of coefficient MappedGridFunctions
9 
10 
11 // Notes:
12 // Equations are numbered 1,2,3,4,...
13 //
14 // For multi component equations such as
15 // \Delta u + f_1(u,v) = 0
16 // \Delta v + f_2(u,v) = 0
17 // The variables are numbered
18 // [ u_1, v_1, u_2, v_2, u_3, v_3, .... ]
19 // 1 2 3 4 5 6 ....
20 
21 
23 {
24  // protected:
25 public: // make public for now
26 
27  intMappedGridFunction equationNumber; // eqn number for each coefficient
28  intMappedGridFunction classify; // classify each point
29 
30  int equationOffset; // offset for equation number (when we are really dealing with multiple grids)
31  int numberOfComponents; // size of the system of equations
34 
35 public:
36  enum classifyTypes // any non-negative value indicates a used point. Negative values
37  { // are equations with zero for the rhs
40  ghost1=3,
41  ghost2=4,
42  ghost3=5,
43  ghost4=6,
48  };
49 
52  SparseRepForMGF(const SparseRepForMGF & rep); // copy constructor
53  SparseRepForMGF & operator=( const SparseRepForMGF & rep ); // deep copy
54  ReferenceCounting& operator=(const ReferenceCounting& x){ if (&x); return *this; }
55 
56  int updateToMatchGrid(MappedGrid & mg,
57  int stencilSize=9,
58  int numberOfGhostLines=1,
59  int numberOfComponents=1,
60  int offset=0);
61 
62  virtual void setParameters(int stencilSize=9,
63  int numberOfGhostLines=1,
64  int numberOfComponents=1,
65  int offset=0 );
66 
67  virtual int setCoefficientIndex(const int & m,
68  const int & na, const Index & I1a, const Index & I2a, const Index & I3a,
69  const int & nb, const Index & I1b, const Index & I2b, const Index & I3b);
70 
71  virtual int setCoefficientIndex(const int & m,
72  const int & na, const Index & I1a, const Index & I2a, const Index & I3a,
73  const int & equationNumber );
74 
75  // assign the classify at given points
76  virtual int setClassify(const classifyTypes & type,
77  const Index & I1, const Index & I2, const Index & I3, const Index & N=nullIndex);
78 
79  // fixup up the classify array to take into account the mask array and periodicity
80  virtual int fixUpClassify( realMappedGridFunction & coeff );
81 
82  virtual int indexToEquation( int n, int i1, int i2, int i3);
83 
84  virtual int equationToIndex( const int eqnNo, int & n, int & i1, int & i2, int & i3 );
85 
86  // return size of this object
87  virtual real sizeOf(FILE *file = NULL ) const;
88 
89 public:
90  static int debug;
91 };
92 
93 /* ------
94 
95 
96 // class used to save information about the sparse representation of coefficient GridCollectionFunctions
97 class SparseRepForGCF
98 {
99 protected:
100  intMappedGridFunction equationNumber;
101  inline int indexToEquation( int n, int i1, int i2, int i3, int grid);
102  int equationToIndex( const int eqnNo, int & n, int & i1, int & i2, int & i3, int & grid );
103 
104 public:
105  SparseRepForGCF();
106  ~SparseRepForGCF();
107 
108  int updateToMatchGrid(GridCollection & gc, int stencilSize=9, int numberOfComponents=1);
109  virtual int setCoefficientIndex(const Index & M,
110  const Index & Na, const Index & I1a, const Index & I2a, const Index & I3a, int grida,
111  const Index & Nb, const Index & I1b, const Index & I2b, const Index & I3b, int gridb);
112 
113 };
114 
115 
116 
117 int SparseRepForGCF::
118 indexToEquation( int n, int i1, int i2, int i3, int grid)
119 //=============================================================================
120 // Return the equation number for given indices
121 // n : component number ( n=0,1,..,numberOfComponents-1 )
122 // i1,i2,i3 : grid indices
123 // grid : component grid number (grid=0,1,2..,numberOfComponentGrids-1)
124 //
125 //=============================================================================
126 {
127  // return list[grid].indexToEquation(n,i1,i2,i3);
128 }
129 
130 ----- */
131 #endif