|
@@ -128,12 +128,112 @@ namespace Lemma {
|
128
|
128
|
|
129
|
129
|
}
|
130
|
130
|
|
131
|
|
- void KernelV0::CalculateK0 ( const char* tx, const char* rx ) {
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+ void KernelV0::IntegrateOnOctreeGrid( const Real& tolerance) {
|
|
136
|
+
|
|
137
|
+ Vector3r Size;
|
|
138
|
+ Vector3r Origin;
|
|
139
|
+ Vector3r step;
|
|
140
|
+ Vector3r cpos;
|
|
141
|
+
|
|
142
|
+ int level;
|
|
143
|
+ int maxlevel;
|
|
144
|
+ int index;
|
|
145
|
+ int counter;
|
|
146
|
+
|
|
147
|
+ Real cvol;
|
|
148
|
+ Real tvol;
|
|
149
|
+ Real tol;
|
|
150
|
+ Complex KernelSum;
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+ Real KernelSum = 0.;
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+ EvaluateKids( 1e9 );
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+ }
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+ void KernelV0::EvaluateKids(const Complex& kval) {
|
|
170
|
+
|
|
171
|
+ assert("Evaluate Kids pre" && Cursor->CurrentIsLeaf());
|
|
172
|
+ vtkHyperOctreeCursor *tcurse = Cursor->Clone();
|
|
173
|
+ Real p[3];
|
|
174
|
+ Octree->SubdivideLeaf(Cursor);
|
|
175
|
+ tcurse->ToSameNode(Cursor);
|
|
176
|
+ std::cout << "\rPredivide Leaf count: " << Octree->GetNumberOfLeaves();
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+ for (int child=0; child<8; ++child) {
|
|
180
|
+ Cursor->ToChild(child);
|
|
181
|
+ assert(Cursor->CurrentIsLeaf());
|
|
182
|
+
|
|
183
|
+ GetPosition(p);
|
|
184
|
+ cpos << p[0], p[1], p[2];
|
|
185
|
+ step = ((Size).array() / std::pow(2.,Cursor->GetCurrentLevel()));
|
|
186
|
+ Cubes->SetLocation(child, cpos);
|
|
187
|
+ Cubes->SetLength(child, step);
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+ Cursor->ToSameNode(tcurse);
|
|
191
|
+ }
|
132
|
192
|
|
|
193
|
+
|
|
194
|
+ Cubes->ClearFields();
|
|
195
|
+ VectorXcr f = SenseKernel->ComputeSensitivity();
|
|
196
|
+ if ( std::abs(std::abs(kval) - std::abs(f.array().abs().sum())) <= tol ||
|
|
197
|
+ Cursor->GetCurrentLevel() >= maxlevel ) {
|
|
198
|
+
|
|
199
|
+ for (int child=0; child < 8; ++ child) {
|
|
200
|
+ Cursor->ToChild(child);
|
|
201
|
+ leafdata.push_back( std::abs(f(child)) / Cubes->GetVolume(child) );
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+ leafids.push_back(Cursor->GetLeafId());
|
|
205
|
+ KernelSum += f(child);
|
|
206
|
+ Cursor->ToParent();
|
|
207
|
+ }
|
|
208
|
+ return;
|
|
209
|
+ }
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+ for (int child=0; child < 8; ++ child) {
|
|
214
|
+
|
|
215
|
+ Cursor->ToChild(child);
|
|
216
|
+ EvaluateKids( f(child) );
|
|
217
|
+
|
|
218
|
+ Cursor->ToSameNode(tcurse);
|
|
219
|
+ }
|
|
220
|
+ tcurse->Delete();
|
|
221
|
+ }
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+ void OctreeGrid::GetPosition( Real* p ) {
|
|
228
|
+ Real ratio=1.0/(1<<(Cursor->GetCurrentLevel()));
|
|
229
|
+
|
|
230
|
+ p[0]=(Cursor->GetIndex(0)+.5)*ratio*Size[0]+Origin[0] ;
|
|
231
|
+ p[1]=(Cursor->GetIndex(1)+.5)*ratio*Size[1]+Origin[1] ;
|
|
232
|
+ p[2]=(Cursor->GetIndex(2)+.5)*ratio*Size[2]+Origin[2] ;
|
133
|
233
|
}
|
134
|
234
|
|
135
|
235
|
}
|
136
|
236
|
|
137
|
|
-
|
138
|
|
-
|
|
237
|
+
|
|
238
|
+
|
139
|
239
|
|