Skip to content

Commit 278d3e7

Browse files
committed
cherry pick chargeNA on charge
1 parent c89147e commit 278d3e7

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pyphare/pyphare/pharesee/hierarchy/fromfunc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def ions_charge_density_func2d(x, y, **kwargs):
7575

7676

7777
def hierarchy_from_func2d(func, hier, **kwargs):
78-
from pyphare.pharesee.hierarchy.hierarchy_utils import compute_hier_from
78+
assert hier.ndim == 2
7979

8080
def compute_(patch_datas, **kwargs):
8181
ref_name = next(iter(patch_datas.keys()))

tests/core/numerics/interpolator/test_main.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
535535
part.iCell[0] = 19; // AMR index
536536
part.delta[0] = 0.5;
537537
part.weight = 1.0;
538+
part.charge = 2.0;
538539
part.v[0] = +2.;
539540
part.v[1] = -1.;
540541
part.v[2] = +1.;
@@ -543,6 +544,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
543544
part.iCell[0] = 20; // AMR index
544545
part.delta[0] = 0.5;
545546
part.weight = 0.4;
547+
part.charge = 1.85;
546548
part.v[0] = +2.;
547549
part.v[1] = -1.;
548550
part.v[2] = +1.;
@@ -551,6 +553,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
551553
part.iCell[0] = 20; // AMR index
552554
part.delta[0] = 0.5;
553555
part.weight = 0.6;
556+
part.charge = 2.1;
554557
part.v[0] = +2.;
555558
part.v[1] = -1.;
556559
part.v[2] = +1.;
@@ -562,6 +565,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
562565
part.iCell[0] = 19; // AMR index
563566
part.delta[0] = 0.0;
564567
part.weight = 1.0;
568+
part.charge = 2.0;
565569
part.v[0] = +2.;
566570
part.v[1] = -1.;
567571
part.v[2] = +1.;
@@ -570,6 +574,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
570574
part.iCell[0] = 20; // AMR index
571575
part.delta[0] = 0.0;
572576
part.weight = 0.2;
577+
part.charge = 3.2;
573578
part.v[0] = +2.;
574579
part.v[1] = -1.;
575580
part.v[2] = +1.;
@@ -578,6 +583,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
578583
part.iCell[0] = 20; // AMR index
579584
part.delta[0] = 0.0;
580585
part.weight = 0.8;
586+
part.charge = 1.7;
581587
part.v[0] = +2.;
582588
part.v[1] = -1.;
583589
part.v[2] = +1.;
@@ -586,6 +592,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
586592
part.iCell[0] = 21; // AMR index
587593
part.delta[0] = 0.0;
588594
part.weight = 1.0;
595+
part.charge = 2.0;
589596
part.v[0] = +2.;
590597
part.v[1] = -1.;
591598
part.v[2] = +1.;
@@ -597,6 +604,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
597604
part.iCell[0] = 18; // AMR index
598605
part.delta[0] = 0.5;
599606
part.weight = 1.0;
607+
part.charge = 2.0;
600608
part.v[0] = +2.;
601609
part.v[1] = -1.;
602610
part.v[2] = +1.;
@@ -605,6 +613,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
605613
part.iCell[0] = 19; // AMR index
606614
part.delta[0] = 0.5;
607615
part.weight = 1.0;
616+
part.charge = 2.0;
608617
part.v[0] = +2.;
609618
part.v[1] = -1.;
610619
part.v[2] = +1.;
@@ -613,6 +622,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
613622
part.iCell[0] = 20; // AMR index
614623
part.delta[0] = 0.5;
615624
part.weight = 1.0;
625+
part.charge = 2.0;
616626
part.v[0] = +2.;
617627
part.v[1] = -1.;
618628
part.v[2] = +1.;
@@ -621,6 +631,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
621631
part.iCell[0] = 21; // AMR index
622632
part.delta[0] = 0.5;
623633
part.weight = 0.1;
634+
part.charge = 3.35;
624635
part.v[0] = +2.;
625636
part.v[1] = -1.;
626637
part.v[2] = +1.;
@@ -629,6 +640,7 @@ class ACollectionOfParticles_1d : public ::testing::Test
629640
part.iCell[0] = 21; // AMR index
630641
part.delta[0] = 0.5;
631642
part.weight = 0.9;
643+
part.charge = 1.85;
632644
part.v[0] = +2.;
633645
part.v[1] = -1.;
634646
part.v[2] = +1.;
@@ -652,6 +664,7 @@ TYPED_TEST_P(ACollectionOfParticles_1d, DepositCorrectlyTheirWeight_1d)
652664

653665
auto const& [vx, vy, vz] = this->v();
654666
EXPECT_DOUBLE_EQ(this->rho(idx), 1.0);
667+
EXPECT_DOUBLE_EQ(this->rho_c(idx), 2.0);
655668
EXPECT_DOUBLE_EQ(vx(idx), 2.0);
656669
EXPECT_DOUBLE_EQ(vy(idx), -1.0);
657670
EXPECT_DOUBLE_EQ(vz(idx), 1.0);

0 commit comments

Comments
 (0)