|
@@ -337,7 +337,7 @@ namespace Lemma {
|
337
|
337
|
// Class: KernelV0
|
338
|
338
|
// Method: EvaluateKids
|
339
|
339
|
//--------------------------------------------------------------------------------------
|
340
|
|
- bool KernelV0::EvaluateKids( const Vector3r& size, const int& level, const Vector3r& cpos,
|
|
340
|
+ void KernelV0::EvaluateKids( const Vector3r& size, const int& level, const Vector3r& cpos,
|
341
|
341
|
const Complex& parentVal ) {
|
342
|
342
|
|
343
|
343
|
std::cout << "\r" << (int)(1e2*VOLSUM/(Size[0]*Size[1]*Size[2])) << "\t" << nleaves;
|
|
@@ -346,9 +346,7 @@ namespace Lemma {
|
346
|
346
|
// Next level step, interested in one level below
|
347
|
347
|
// bitshift requires one extra, faster than, and equivalent to std::pow(2, level+1)
|
348
|
348
|
Vector3r step = size.array() / (Real)(1 << (level+1) );
|
349
|
|
- Vector3r step2 = size.array() / (Real)(1 << (level+2) );
|
350
|
|
-
|
351
|
|
- Real vol = (step2(0)*step2(1)*step2(2)); // volume of each child
|
|
349
|
+ Real vol = (step(0)*step(1)*step(2)); // volume of each child
|
352
|
350
|
|
353
|
351
|
Vector3r pos = cpos - step/2.;
|
354
|
352
|
Eigen::Matrix<Real, 8, 3> posadd = (Eigen::Matrix<Real, 8, 3>() <<
|
|
@@ -403,17 +401,15 @@ namespace Lemma {
|
403
|
401
|
for (int ichild=0; ichild<8; ++ichild) {
|
404
|
402
|
Vector3r cp = pos; // Eigen complains about combining these
|
405
|
403
|
cp += posadd.row(ichild);
|
406
|
|
- bool isleaf = EvaluateKids( size, level+1, cp, kvals(ichild) );
|
407
|
|
- if (isleaf) { // Include result in final integral
|
408
|
|
- SUM += ksum;
|
409
|
|
- VOLSUM += 8.*vol;
|
410
|
|
- nleaves += 1;
|
411
|
|
- }
|
|
404
|
+ EvaluateKids( size, level+1, cp, kvals(ichild) );
|
412
|
405
|
}
|
413
|
|
- return false; // not leaf
|
|
406
|
+ return; // not leaf
|
414
|
407
|
}
|
415
|
408
|
// Save here instead?
|
416
|
|
- return true; // leaf
|
|
409
|
+ SUM += ksum;
|
|
410
|
+ VOLSUM += 8.*vol;
|
|
411
|
+ nleaves += 1;
|
|
412
|
+ return; // is leaf
|
417
|
413
|
}
|
418
|
414
|
|
419
|
415
|
#ifdef LEMMAUSEVTK
|
|
@@ -421,7 +417,7 @@ namespace Lemma {
|
421
|
417
|
// Class: KernelV0
|
422
|
418
|
// Method: EvaluateKids2 -- same as Evaluate Kids, but include VTK octree generation
|
423
|
419
|
//--------------------------------------------------------------------------------------
|
424
|
|
- bool KernelV0::EvaluateKids2( const Vector3r& size, const int& level, const Vector3r& cpos,
|
|
420
|
+ void KernelV0::EvaluateKids2( const Vector3r& size, const int& level, const Vector3r& cpos,
|
425
|
421
|
const Complex& parentVal, vtkHyperOctree* oct, vtkHyperOctreeCursor* curse) {
|
426
|
422
|
|
427
|
423
|
std::cout << "\r" << (int)(1e2*VOLSUM/(Size[0]*Size[1]*Size[2])) << "\t" << nleaves;
|
|
@@ -432,9 +428,6 @@ namespace Lemma {
|
432
|
428
|
Vector3r step = size.array() / (Real)(1 << (level+1) );
|
433
|
429
|
Real vol = (step(0)*step(1)*step(2)); // volume of each child
|
434
|
430
|
|
435
|
|
- Vector3r step2 = size.array() / (Real)(1 << (level+2) );
|
436
|
|
- Real vol2 = (step2(0)*step2(1)*step2(2)); // volume of each child
|
437
|
|
-
|
438
|
431
|
Vector3r pos = cpos - step/2.;
|
439
|
432
|
Eigen::Matrix<Real, 8, 3> posadd = (Eigen::Matrix<Real, 8, 3>() <<
|
440
|
433
|
0, 0, 0,
|
|
@@ -483,9 +476,8 @@ namespace Lemma {
|
483
|
476
|
|
484
|
477
|
Complex ksum = kvals.sum(); // Kernel sum
|
485
|
478
|
// Evaluate whether or not furthur splitting is needed
|
486
|
|
- if ( std::abs(ksum-parentVal) > tol ) { // || level < minLevel && level < maxLevel ) {
|
|
479
|
+ if ( std::abs(ksum - parentVal) > tol || level < minLevel && level < maxLevel ) {
|
487
|
480
|
//if ( std::abs(ksum.real()-parentVal.real())>tol || std::abs(ksum.imag()-parentVal.imag()) >tol ) {
|
488
|
|
- //if ( std::abs(ksum) > tol && level < maxLevel ) {
|
489
|
481
|
oct->SubdivideLeaf(curse);
|
490
|
482
|
for (int ichild=0; ichild<8; ++ichild) {
|
491
|
483
|
curse->ToChild(ichild);
|
|
@@ -502,26 +494,17 @@ namespace Lemma {
|
502
|
494
|
}
|
503
|
495
|
*/
|
504
|
496
|
/* End of position test */
|
505
|
|
- bool isleaf = EvaluateKids2( size, level+1, cp, kvals(ichild), oct, curse );
|
506
|
|
- /*
|
507
|
|
- if (isleaf) { // Include result in final integral
|
508
|
|
- LeafDict[curse->GetLeafId()] = ksum/(8.*vol); //kvals(ichild) / vol; // VTK
|
509
|
|
- LeafDictIdx[curse->GetLeafId()] = nleaves; // VTK
|
510
|
|
- SUM += ksum;
|
511
|
|
- VOLSUM += 8*vol;
|
512
|
|
- nleaves += 1;
|
513
|
|
- }
|
514
|
|
- */
|
|
497
|
+ EvaluateKids2( size, level+1, cp, kvals(ichild), oct, curse );
|
515
|
498
|
curse->ToParent();
|
516
|
499
|
}
|
517
|
|
- return false; // not leaf
|
|
500
|
+ return; // not a leaf
|
518
|
501
|
}
|
519
|
502
|
LeafDict[curse->GetLeafId()] = ksum/(8.*vol); //kvals(ichild) / vol; // VTK
|
520
|
503
|
LeafDictIdx[curse->GetLeafId()] = nleaves; // VTK
|
521
|
504
|
SUM += ksum;
|
522
|
505
|
VOLSUM += 8*vol;
|
523
|
506
|
nleaves += 1;
|
524
|
|
- return true; // leaf
|
|
507
|
+ return; // is a leaf
|
525
|
508
|
}
|
526
|
509
|
|
527
|
510
|
//--------------------------------------------------------------------------------------
|