1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-23 02:38:51 -05:00

compunt materials update

This commit is contained in:
hrocho 2017-12-12 17:18:26 +01:00
parent 16dd46f0a9
commit 58d151c09c
4 changed files with 59 additions and 52 deletions

View File

@ -7,31 +7,35 @@ namespace catima{
if(id>0 && id<ELEMENT_DENSITY_MAXZ){ if(id>0 && id<ELEMENT_DENSITY_MAXZ){
return Material(0,id,element_density(id),0.0); return Material(0,id,element_density(id),0.0);
} }
switch(id){ return get_compound(static_cast<material>(id));
case material::PLASTIC : return Material({{0,1,10},{0,6,9}},1.032); }
case material::AIR : return Material({{0,7,0.7810}, {0,8,0.2095},{0,18,0.0095}},0.0012);
case material::CH2 : return Material({{0,6,1}, {0,1,2}},0.94); Material get_compound(material m){
case material::LH2 : return Material({{0,1,1}},0.0708); switch(m){
case material::LD2 : return Material({{2.014,1,1}},0.162); case material::Plastics: return Material({{0,1,10},{0,6,9}},1.032);
case material::WATER : return Material({{0,1,2},{0,8,1}},1.0); case material::Air: return Material({{0,7,0.781},{0,8,0.2095},{0,18,0.0095}},0.0012);
case material::DIAMOND: return Material(0,6,3.52,0.0); case material::CH2: return Material({{0,6,1},{0,1,2}},0.94);
case material::GLASS : return Material({{0,14,1},{0,8,2}},2.4 ); case material::LH2: return Material({{0,1,1}},0.0708);
case material::ALMG3: return Material(0,13,2.67,0.0); case material::LD2: return Material({{2.01355,1,1}},0.162);
case material::ARCO2_30: return Material({{0,18,7},{0,8,6},{0,6,3}}, 0.00171); case material::Water: return Material({{0,1,2},{0,8,1}},1);
case material::CF4 : return Material({{0,6,1},{0,9,4}}, 0.00372 ); case material::Diamond: return Material({{0,6,1}},3.52);
case material::ISOBUTANE:return Material({{0,6,4}, {0,1,10}},0.00251); case material::Glass: return Material({{0,14,1},{0,8,2}},2.4);
case material::KAPTON : return Material({{0,1,10}, {0,6,22},{0,7,2},{0,8,5}},1.42); case material::ALMG3: return Material({{0,13,1}},2.67);
case material::MYLAR : return Material({{0,6,5}, {0,1,4},{0,8,2}},1.38); case material::ArCO2_30: return Material({{0,18,7},{0,8,6},{0,6,3}},0.00171);
case material::NAF : return Material({{0,11,1}, {0,9,1}},2.56); case material::CF4: return Material({{0,6,1},{0,9,4}},0.00372);
case material::P10: return Material({{0,18,9},{0,6,1},{0,1,4}}, 0.00166); case material::Isobutane: return Material({{0,6,4},{0,1,10}},0.00251);
case material::POLYOLEFIN: return Material({{0,1,16},{0,6,10}}, 0.9); case material::Kapton: return Material({{0,1,10},{0,6,22},{0,7,2},{0,8,5}},1.42);
case material::CMO2: return Material({{0,96,1},{0,8,2}}, 12.0); case material::Mylar: return Material({{0,6,5},{0,1,4},{0,8,2}},1.38);
case material::SUPRASIL : return Material({{0,14,1},{0,8,2}},2.2 ); case material::NaF: return Material({{0,11,1},{0,9,1}},2.56);
case material::HAVAR : return Material({{0,27,42},{0,24,40},{0,28,13},{0,26,19},{0,74,1}},8.3); case material::P10: return Material({{0,18,9},{0,6,1},{0,1,4}},0.00166);
case material::STEEL : return Material({{0,26,74},{0,24,18},{0,28,8}},8.0); case material::PolyOlefin: return Material({{0,8,10},{0,1,16}},0.9);
case material::CmO2: return Material({{0,96,1},{0,8,2}},12);
case material::Suprasil: return Material({{0,14,1},{0,8,2}},2.2);
case material::HAVAR: return Material({{0,27,42},{0,24,20},{0,28,13},{0,74,3},{0,42,2},{0,26,20}},8.3);
case material::Steel: return Material({{0,26,74},{0,24,18},{0,28,8}},8);
default:break; default:break;
} }
return Material(); return Material();
} }
} } // namespace catima

View File

@ -4,33 +4,36 @@
namespace catima{ namespace catima{
//namespace material{ enum class material{
enum material{ Plastics = 201,
PLASTIC = 201, Air = 202,
AIR = 202, CH2 = 203,
CH2, LH2 = 204,
LH2, LD2 = 205,
LD2, Water = 206,
WATER, Diamond = 207,
DIAMOND, Glass = 208,
GLASS, ALMG3 = 209,
ALMG3, ArCO2_30 = 210,
ARCO2_30, CF4 = 211,
CF4, Isobutane = 212,
ISOBUTANE, Kapton = 213,
KAPTON, Mylar = 214,
MYLAR, NaF = 215,
NAF, P10 = 216,
P10, PolyOlefin = 217,
POLYOLEFIN, CmO2 = 218,
CMO2, Suprasil = 219,
SUPRASIL, HAVAR = 220,
HAVAR, Steel = 221
STEEL = 221 };
Material get_compound(material m);
Material get_material(int id);
inline Material get_material(material m){
return get_compound(m);
}; };
//}
Material get_material(int);
} }
#endif #endif

View File

@ -330,7 +330,7 @@ const lest::test specification[] =
}, },
CASE("default material calculations"){ CASE("default material calculations"){
catima::Projectile p{12,6,6,350}; catima::Projectile p{12,6,6,350};
auto air = catima::get_material(catima::material::AIR); auto air = catima::get_material(catima::material::Air);
air.thickness(0.500); air.thickness(0.500);
auto res = catima::calculate(p(350),air); auto res = catima::calculate(p(350),air);
EXPECT(res.Eout == approx(345.6).epsilon(1e-2)); EXPECT(res.Eout == approx(345.6).epsilon(1e-2));

View File

@ -70,7 +70,7 @@ const lest::test specification[] =
EXPECT(m.density() == 2.0); EXPECT(m.density() == 2.0);
EXPECT(m.M() == 12.0107); EXPECT(m.M() == 12.0107);
m = catima::get_material(catima::material::WATER); m = catima::get_material(catima::material::Water);
EXPECT(m.get_element(0).first.A == 1.00794); EXPECT(m.get_element(0).first.A == 1.00794);
EXPECT(m.get_element(0).first.Z == 1); EXPECT(m.get_element(0).first.Z == 1);
EXPECT(m.get_element(1).first.A == 15.9994); EXPECT(m.get_element(1).first.A == 15.9994);