Skip to content
Snippets Groups Projects

Added Test of formfactor calculation with hardcoded values

Merged Ludwig Jaeck requested to merge testing-particles into main
1 file
+ 80
84
Compare changes
  • Side-by-side
  • Inline
@@ -63,16 +63,16 @@ protected:
}
double V, R;
const C3 q0 = {0.23 + 0.51i, 0.11 - 0.78i, -0.33 + 0.66i};
const C3 q1 = {-0.52 - 0.87i, -0.68 - 0.12i, -0.69 - 0.6i};
const C3 q2 = {0.16 - 0.34i, -0.48 + 0.64i, -0.46 + 0.84i};
const C3 q3 = {-0.27 - 0.32i, 0.87 - 1.0i, 0.41 + 0.04i};
const C3 q4 = {0.31 + 0.99i, 0.36 - 0.93i, -0.43 - 0.89i};
const C3 q5 = {-0.60 + 0.55i, 0.79 + 0.0i, -0.37 - 0.98i};
const C3 q6 = {-0.20 + 0.58i, -0.89 - 0.36i, 0.27 - 0.78i};
const C3 q7 = {-0.18 + 0.54i, 0.47 + 0.37i, -0.06 - 0.82i};
const C3 q8 = {-0.56 + 0.95i, -0.94 + 0.08i, 0.12 - 0.48i};
const C3 q9 = {-0.51 - 0.11i, -0.16 - 0.36i, -0.42 + 0.10i};
const C3 q0 = {0.23, 0.11, -0.33};
const C3 q1 = {-0.52, -0.68, -0.69};
const C3 q2 = {0.16, -0.48, -0.46};
const C3 q3 = {-0.27, 0.87, 0.41};
const C3 q4 = {0.31, 0.36, -0.43};
const C3 q5 = {-0.60, 0.79, -0.37};
const C3 q6 = {-0.20, -0.89, 0.27};
const C3 q7 = {-0.18, 0.47, -0.06};
const C3 q8 = {-0.56, -0.94, 0.12};
const C3 q9 = {-0.51, -0.16, -0.42};
void test_ff_print(const IFormFactor* p, const C3 a, const C3 b, const C3 c,
std::complex<double> exp_a, std::complex<double> exp_b,
@@ -130,9 +130,9 @@ TEST_F(FormFactorBasicTest, Pyramid2)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q5, q3, q8, {113.73222497295654420668, -911.02559184641165757057},
{-4052.29709279379312647507, -9530.68730645397045009304},
{381.63372926345283531191, -139.96625941234515266842});
test_ff_print(&particle, q5, q3, q8, {-3.326507178430593, -4.221250124559902},
{-28.875234172319271, -14.799465747269439},
{-8.434962366982653, -1.380171136944693});
}
TEST_F(FormFactorBasicTest, Bar)
@@ -170,9 +170,9 @@ TEST_F(FormFactorBasicTest, Box)
EXPECT_NEAR(-length / 2, particle.bottomZ(new RotationY(90 * Units::deg)), 1e-12);
test_ff(&particle);
test_ff_print(&particle, q9, q7, q2, {22.53028699659849465320, -111.80912618701151473033},
{3133.33525497581695162808, -2689.35851717636160174152},
{65.89681857730694503061, 55.37842523824278373468});
test_ff_print(&particle, q9, q7, q2, {53.471450007876584, -93.217597445730974},
{119.400684160766147, -18.045648436947012},
{38.756783058601833, -86.601913488017942});
}
TEST_F(FormFactorBasicTest, CantellatedCube)
@@ -192,9 +192,9 @@ TEST_F(FormFactorBasicTest, CantellatedCube)
EXPECT_EQ(L, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q0, q5, q6, {373.56162728500720504599, -496.55287571444870309278},
{-8753.03946896974048286211, -27449.33353944530972512439},
{138687.46521380115882493556, 51672.11052785552601562813});
test_ff_print(&particle, q0, q5, q6, {-33.391098526973408, -420.703291952477457},
{10.070159899276099, 35.125317795931998},
{-20.124862756519551, -89.660726461058985});
}
TEST_F(FormFactorBasicTest, Cone)
@@ -218,9 +218,9 @@ TEST_F(FormFactorBasicTest, Cone)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q0, q8, q4, {824.14320328856774722226, -284.29201165271268791912},
{-479.85567440479951528687, 208.22345437751422991823},
{11695.74735988969769096002, -7350.81574555344650434563});
test_ff_print(&particle, q0, q8, q4, {154.836630212175464, -89.616777161335065},
{-7.158085433517508, 2.913985277509306},
{71.266836187605691, -75.316792284104494});
}
TEST_F(FormFactorBasicTest, Pyramid6)
@@ -241,9 +241,9 @@ TEST_F(FormFactorBasicTest, Pyramid6)
EXPECT_DOUBLE_EQ(volume, particle.volume());
test_ff(&particle);
test_ff_print(&particle, q9, q3, q5, {45.96104381871499811041, -98.35926252284809834237},
{-713.69397510873443479795, 24.92530750301204989228},
{259.50827767489931829914, -266.51295128386192345715});
test_ff_print(&particle, q9, q3, q5, {56.580851533712433, -49.055032503649102},
{-0.620299369844318, 17.442172408792921},
{-5.221867418516533, -12.118764972593246});
}
TEST_F(FormFactorBasicTest, CosineRippleBox)
@@ -265,10 +265,9 @@ TEST_F(FormFactorBasicTest, CosineRippleBox)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q2, q7, q3,
{-2415115827.10878086090087890625, -8744620013.08855247497558593750},
{78171399604461.03125000000000000000, 120661214881258.62500000000000000000},
{43711915290.40796661376953125000, 7360856414.79067802429199218750});
test_ff_print(&particle, q2, q7, q3, {2.983050737973751, -90.325884432736274},
{30.902915765072844, -6.396035046006810},
{-6.822717212205538, -1.551498996606969});
}
TEST_F(FormFactorBasicTest, Bipyramid4)
@@ -292,9 +291,9 @@ TEST_F(FormFactorBasicTest, Bipyramid4)
EXPECT_EQ(height * (1 + height_ratio), particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q0, q3, q7, {51.21276171547918210081, -179.63783095707665893315},
{-734.79007726345128048706, -1337.77270849645515227166},
{16681.90598943544318899512, -17218.75628952055558329448});
test_ff_print(&particle, q0, q3, q7, {71.667831484482932, -230.808201823553276},
{9.207591216136489, -11.771946031248554},
{153.865204621358430, -35.153360066115340});
}
TEST_F(FormFactorBasicTest, Cylinder)
@@ -331,9 +330,9 @@ TEST_F(FormFactorBasicTest, Cylinder)
3e-2); // TODO decrease epsilon after replacement of vertex-based approximation
test_ff(&particle);
test_ff_print(&particle, q8, q5, q1, {-119.82925501459840234020, 565.96438364363893924747},
{1569.92900731503232236719, -917.10467781481770543905},
{-705.10947572300426600123, 432.46561089987727655171});
test_ff_print(&particle, q8, q5, q1, {18.469449230629245, 5.713270157358191},
{17.176432808867649, -22.792734170623486},
{-4.645065790555677, -29.883784273353299});
}
TEST_F(FormFactorBasicTest, HorizontalCylinder)
@@ -385,9 +384,8 @@ TEST_F(FormFactorBasicTest, HorizontalCylinder)
test_ff(&particle_trunc);
test_ff_print(&particle_trunc, q5, q3, q8, {99.43914064938149977024, 8.09748585868891979089},
{-41.97245904919231662689, 123.70218084329459884430},
{11.19326999245075882072, 57.12981868433760013204});
test_ff_print(&particle_trunc, q5, q3, q8, {14.015342836573883, -6.888112822293706},
{14.242986207014122, 8.418849429673980}, {9.515192299073808, 1.605174270540351});
}
TEST_F(FormFactorBasicTest, Dodecahedron)
@@ -406,9 +404,9 @@ TEST_F(FormFactorBasicTest, Dodecahedron)
// height=2*inradius from web ressource
test_ff(&particle);
test_ff_print(&particle, q1, q9, q2, {-521.31586747225151157181, 2460.87793270028942060890},
{-5.36647729837552489585, -94.98125359547481139089},
{40.03637423181949372974, 0.64847347067418859012});
test_ff_print(&particle, q1, q9, q2, {-10.878977464020377, -12.054560796788392},
{17.159983916914797, -101.323984000413375},
{3.473237908867695, -101.684458467045090});
}
TEST_F(FormFactorBasicTest, EllipsoidalCylinder)
@@ -425,9 +423,9 @@ TEST_F(FormFactorBasicTest, EllipsoidalCylinder)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q3, q5, q7, {-634.36760829950640072639, -766.91790832525737187098},
{164.79306281176172888081, 309.31620121073774498655},
{905.23274161228084722097, -1426.11578327426195755834});
test_ff_print(&particle, q3, q5, q7, {-10.885311020650205, -11.665937196046933},
{-10.799240867203938, 9.860673803151998},
{80.174590178312371, -9.667398944888935});
}
TEST_F(FormFactorBasicTest, Sphere)
@@ -445,10 +443,9 @@ TEST_F(FormFactorBasicTest, Sphere)
EXPECT_EQ(2 * radius, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q7, q2, q9,
{131951.28331367860664613545, -117324.33863835362717509270},
{61.23320115522524531571, 4.76747251733432975129},
{-114.85501679840180599967, -73.19826697784199609487});
test_ff_print(&particle, q7, q2, q9, {244.485507285703591, -75.628229907665755},
{-78.931070547231570, -88.340730913140689},
{-61.244894114710341, -104.719370472590086});
}
TEST_F(FormFactorBasicTest, Spheroid)
@@ -467,9 +464,9 @@ TEST_F(FormFactorBasicTest, Spheroid)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q1, q4, q6, {-529.70916729419980129023, -17.29288455709227889656},
{774.70257988023763573437, -3927.19607692520776254241},
{561.29251460000409679196, 360.19321698540943543776});
test_ff_print(&particle, q1, q4, q6, {-4.602530455511736, -29.610135452483558},
{32.081363863555183, -59.315827480130920},
{29.477269660229449, 23.594341882593568});
}
TEST_F(FormFactorBasicTest, HemiEllipsoid)
@@ -504,9 +501,9 @@ TEST_F(FormFactorBasicTest, Icosahedron)
// height=2*inradius from web ressource
test_ff(&particle);
test_ff_print(&particle, q1, q8, q9, {21247.89089254805003292859, -91010.92631952898227609694},
{-34896.36593126626394223422, -18372.35087747224315535277},
{-142.84113719810784459696, -31.14240338962667919986});
test_ff_print(&particle, q1, q8, q9, {59.253013256524476, -33.045312405031297},
{-65.498197697297627, -48.242910954959228},
{-56.385591749217589, -73.996078291078817});
}
TEST_F(FormFactorBasicTest, PlatonicOctahedron)
@@ -524,9 +521,9 @@ TEST_F(FormFactorBasicTest, PlatonicOctahedron)
EXPECT_NEAR(edge * sqrt(2.), particle.topZ(&rot), 1e-4);
test_ff(&particle);
test_ff_print(&particle, q3, q2, q7, {-226.17957260218693704701, -119.84484099748553376230},
{4.65946872548738610931, -5.70821736302971860511},
{20875.37836014461936429143, -13284.80722193334440817125});
test_ff_print(&particle, q3, q2, q7, {-14.326152086303487, 29.017548785469330},
{-55.305324166329513, -64.855380598892353},
{111.736751011333311, -34.195429173985289});
}
TEST_F(FormFactorBasicTest, PlatonicTetrahedron)
@@ -544,9 +541,9 @@ TEST_F(FormFactorBasicTest, PlatonicTetrahedron)
EXPECT_NEAR(edge * sqrt(2. / 3.), particle.topZ(&rot), 1e-4);
test_ff(&particle);
test_ff_print(&particle, q1, q0, q4, {-52.21735152565816662218, -111.80095805222808280632},
{37.93679583230348839606, -10.57094850427090904077},
{277.54788954364300934685, -285.65312167074358740138});
test_ff_print(&particle, q1, q0, q4, {7.338200374299324, -18.083987657244137},
{32.356617373497095, -16.489570069327176},
{25.457763901100478, -17.975973097181353});
}
TEST_F(FormFactorBasicTest, Prism3)
@@ -566,9 +563,9 @@ TEST_F(FormFactorBasicTest, Prism3)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q0, q5, q3, {38.03133964087355423089, -17.50677549582685799123},
{232.68212481606261121669, -292.02165630787521877210},
{-10.70223051967638383530, 48.43848835717249556865});
test_ff_print(&particle, q0, q5, q3, {43.549331118825300, -33.846003647829569},
{14.780314930820900, -21.332048794901649},
{22.325921825843015, 18.106569746121767});
}
TEST_F(FormFactorBasicTest, Prism6)
@@ -588,9 +585,9 @@ TEST_F(FormFactorBasicTest, Prism6)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q0, q6, q4, {55.65440122501421882362, -26.30919983141808415894},
{418.52414393393553382339, 158.97923610213302936245},
{922.55962935443676542491, -2792.36399660250890519819});
test_ff_print(&particle, q0, q6, q4, {64.541920636979285, -50.091301690725452},
{30.516218708711495, 18.292325480907053},
{43.176189009775861, -50.151555255241675});
}
TEST_F(FormFactorBasicTest, Pyramid4)
@@ -615,9 +612,9 @@ TEST_F(FormFactorBasicTest, Pyramid4)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q6, q8, q0, {183.32845804595115168922, -189.38745052987471240158},
{78.25393007913500298400, -95.93290743332602232840},
{676.98468658255512764299, -315.54208900418217353945});
test_ff_print(&particle, q6, q8, q0, {-3.441841162284046, 8.991520427160811},
{4.963277061028782, 3.351425235955785},
{123.934890528173085, -57.248659449949685});
}
TEST_F(FormFactorBasicTest, SawtoothRippleBox)
@@ -641,9 +638,9 @@ TEST_F(FormFactorBasicTest, SawtoothRippleBox)
EXPECT_EQ(height, particle.topZ(&rot));
// test_ff( &particle ); WAITING: restore once radius returns the umkreis radius
test_ff_print(&particle, q9, q2, q6, {38163.10127577766979811713, -7124.23346269423382182140},
{5131256622.04423904418945312500, -18768244716.23467254638671875000},
{-168030372101256.78125000000000000000, -113995432855899.39062500000000000000});
test_ff_print(&particle, q9, q2, q6, {34.804843364383807, -22.650035449823580},
{-15.198443862633562, -71.676907701099211},
{-7.303609141120358, -5.907207608040455});
}
TEST_F(FormFactorBasicTest, TruncatedCube)
@@ -663,9 +660,9 @@ TEST_F(FormFactorBasicTest, TruncatedCube)
EXPECT_EQ(length, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q0, q1, q7, {4036.34096000730460218620, -8254.29426665088976733387},
{6181330.13038277998566627502, -25061543.73358109220862388611},
{-3519308.17620337754487991333, -149872754.26321995258331298828});
test_ff_print(&particle, q0, q1, q7, {-354.587043898980710, -278.961804308277806},
{3.203168895902472, 6.422974142279478},
{-130.107009837376836, 62.848850174170870});
}
TEST_F(FormFactorBasicTest, TruncatedSphere)
@@ -688,9 +685,8 @@ TEST_F(FormFactorBasicTest, TruncatedSphere)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q8, q5, q3, {-113.52951270410783024545, 176.11026891415627915194},
{115.72380533784435385769, 54.96257895085426525839},
{-291.63213731089740576863, 163.39552393153547882321});
test_ff_print(&particle, q8, q5, q3, {-2.581178686741104, 1.096481712394733},
{1.598578167217787, -5.876368926542401}, {7.334079342958564, 9.540086846266590});
}
TEST_F(FormFactorBasicTest, TruncatedSpheroid)
@@ -713,9 +709,9 @@ TEST_F(FormFactorBasicTest, TruncatedSpheroid)
EXPECT_EQ(height, particle.topZ(&rot));
test_ff(&particle);
test_ff_print(&particle, q0, q9, q5, {70.23710401423954863276, -29.39098027824532621821},
{36.34260385377476154645, -53.83035470684706069733},
{471.48369893460471757862, -577.10893931131590761652});
test_ff_print(&particle, q0, q9, q5, {69.033474560055168, -50.648848240714358},
{43.816907833926741, -48.128263322981383},
{18.861884199850003, -22.594798796005833});
}
TEST_F(FormFactorBasicTest, Pyramid3)
@@ -737,7 +733,7 @@ TEST_F(FormFactorBasicTest, Pyramid3)
EXPECT_DOUBLE_EQ(volume, particle.volume());
test_ff(&particle);
test_ff_print(&particle, q6, q8, q3, {-129.76385247778259213192, 29.35162705089371826261},
{44.59977388769945605418, -28.25234421344257640385},
{255.36584541296332417915, -228.92768504606635815435});
test_ff_print(&particle, q6, q8, q3, {12.744695481874178, -7.093565343710422},
{-5.320188956629416, -14.254410426450482},
{9.442516587003057, -7.290344882322833});
}
Loading