fips_md/parser/
particle.rs1use super::FipsType;
4
5#[derive(Clone,Eq,PartialEq,Debug)]
6pub struct Particle {
8 pub name: String,
10 pub members: Vec<ParticleMember>
12}
13
14#[derive(Clone,Eq,PartialEq,Debug)]
15pub struct ParticleMember {
16 pub name: String,
17 pub mutable: bool,
18 pub typ: FipsType,
19 pub is_position: bool
20}
21
22mod tests {
23 #[allow(unused_imports)] use super::super::*;
25
26 #[test]
27 fn pointlike_commented() {
28 let string = r#"particle PointLike {
29 // Position is special and cannot be redefined, but aliased (array specifier is not allowed,
30 // as position is always NDIM dimensional)
31 x : mut position,
32 v : mut [f64; NDIM], // NDIM is dimensionality of problem
33 F : mut [f64; NDIM], // Quantities bound to interaction calculations later also need to be declared
34 mass: f64 // Constants have to be defined in Rust code (can be either per-particle or
35 // per-type)
36 }"#;
37 fips_parser::particle(string).expect("Cannot parse string");
38 }
39
40 #[test]
41 fn pointlike() {
42 let string = r#"particle PointLike {
43 x : mut position,
44 v : mut [f64; NDIM],
45 F : mut [f64; NDIM],
46 mass: f64
47 }"#;
48 fips_parser::particle(string).expect("Cannot parse string");
49 }
50
51 #[ignore]
52 #[test]
53 fn extends() {
54 let string = "particle Orientable extends PointLike {}";
55 fips_parser::particle(string).expect("Cannot parse string");
56 }
57}