Carmen Code
 All Classes Files Functions Variables Macros Pages
TimeAverageGrid.h
Go to the documentation of this file.
1 /***************************************************************************
2  TimeAverageGrid.h - description
3  -------------------
4  begin : ven déc 3 2004
5  copyright : (C) 2004 by Olivier Roussel and Alexei Tsigulin
6  email : roussel@ict.uni-karlsruhe.de; lpsoft@mail.ru
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
25 {
26 /*
27 ______________________________________________________________________________________________
28 
29 PUBLIC METHODS
30 ______________________________________________________________________________________________
31 
32 */
33  public:
41  TimeAverageGrid(const int UserScaleNb, const int UserQuantityNb);
47  TimeAverageGrid(const int UserScaleNb);
53 
63  void updateValue(const int ElementNo, const int QuantityNo, const real UserValue);
75  void updateValue(const int i, const int j, const int k, const int QuantityNo, const real UserValue);
85  void updateValue(const int i, const int j, const int k, const Vector arg);
86 
92  inline void updateSample();
93 
101  inline real value(const int ElementNo, const int QuantityNo) const;
111  inline real value(const int i, const int j, const int k, const int QuantityNo) const;
112 
121  inline real density(const int i, const int j, const int k) const;
131  inline real velocity(const int i, const int j, const int k, const int AxisNo) const;
132  real stress(const int i, const int j, const int k, const int No) const;
133 
134 /*
135 ______________________________________________________________________________________________
136 
137 PRIVATE VARIABLES
138 ______________________________________________________________________________________________
139 
140 */
141  private:
142  int LocalQuantityNb;
143  int LocalScaleNb;
144  int ElementNb;
145  int SampleNb;
146  Vector *Q;
147 };
148 
149 /*
150 ______________________________________________________________________________________________
151 
152 INLINE FUNCTIONS
153 ______________________________________________________________________________________________
154 
155 Get density at the position i,j,k
156 ______________________________________________________________________________________________
157 
158 */
159 inline real TimeAverageGrid::density(const int i, const int j, const int k) const
160 {
161  return value(i,j,k,1);
162 }
163 
164 /*
165 ______________________________________________________________________________________________
166 
167 Update number of samples
168 ______________________________________________________________________________________________
169 
170 */
172 {
173  SampleNb++;
174 }
175 
176 /*
177 ______________________________________________________________________________________________
178 
179 Get velocity at the position i,j,k
180 ______________________________________________________________________________________________
181 
182 */
183 inline real TimeAverageGrid::velocity(const int i, const int j, const int k, const int AxisNo) const
184 {
185  return value(i,j,k,AxisNo+1)/value(i,j,k,1);
186 }
187 
188 /*
189 ______________________________________________________________________________________________
190 
191 Get value at the position ElementNo
192 ______________________________________________________________________________________________
193 
194 */
195 
196 inline real TimeAverageGrid::value(const int ElementNo, const int QuantityNo) const
197 {
198  return (Q+ElementNo)->value(QuantityNo);
199 }
200 
201 /*
202 ______________________________________________________________________________________________
203 
204 Get value at the position i,j,k
205 ______________________________________________________________________________________________
206 
207 */
208 inline real TimeAverageGrid::value(const int i, const int j, const int k, const int QuantityNo) const
209 {
210  return value(i + (1<<LocalScaleNb)*(j +(1<<LocalScaleNb)*k), QuantityNo);
211 }
212 
213 
void updateSample()
Update number of samples.
Definition: TimeAverageGrid.h:171
Standard class for every vector in Carmen.
Definition: Vector.h:29
void updateValue(const int ElementNo, const int QuantityNo, const real UserValue)
Update Values. For a given element.
Definition: TimeAverageGrid.cpp:107
real velocity(const int i, const int j, const int k, const int AxisNo) const
Get velocity at the position i,j,k.
Definition: TimeAverageGrid.h:183
real value(const int ElementNo, const int QuantityNo) const
Get value at the position ElementNo.
Definition: TimeAverageGrid.h:196
real stress(const int i, const int j, const int k, const int No) const
Definition: TimeAverageGrid.cpp:190
~TimeAverageGrid()
Destructor of TimeAverageGrid clas.
Definition: TimeAverageGrid.cpp:94
Time Average Grid.
Definition: TimeAverageGrid.h:24
real density(const int i, const int j, const int k) const
Get density at the position i,j,k.
Definition: TimeAverageGrid.h:159
#define real
Definition: PreProcessor.h:31
TimeAverageGrid(const int UserScaleNb, const int UserQuantityNb)
Constructor of TimeAverageGrid class. For a given variable number.
Definition: TimeAverageGrid.cpp:30