10 tfn = RMF._get_temporary_file_path(
"alternatives.rmf3")
14 f.add_frame(
"frame", RMF.FRAME)
17 rh = f.get_root_node()
19 pf = RMF.ParticleFactory(f)
20 gpf = RMF.GaussianParticleFactory(f)
21 rff = RMF.ReferenceFrameFactory(f)
24 def frange(x, y, jump):
30 def create_hierarchy(radius):
31 root = f.add_node(str(radius), RMF.REPRESENTATION)
32 for i
in frange(0., 8, radius):
33 for j
in frange(0., 8, radius):
34 for k
in frange(0., 8, radius):
40 str(i) +
"-" + str(j) +
"-" + str(k),
43 d.set_static_radius(radius)
44 d.set_frame_coordinates(center)
45 d.set_static_mass(radius ** 3)
49 def create_gmm(radius=1.):
50 root = f.add_node(
"gmm" + str(radius), RMF.REPRESENTATION)
51 for i
in frange(0., 8, radius):
52 for j
in frange(0., 8, radius):
59 str(i) +
"-" + str(j),
62 d.set_variances(
RMF.Vector3(radius / 2, radius / 2, 4))
63 d.set_static_mass(radius ** 3)
66 rf.set_translation(center)
69 n = create_hierarchy(4)
72 af = RMF.AlternativesFactory(f)
74 da.add_alternative(create_hierarchy(1), RMF.PARTICLE)
75 da.add_alternative(create_hierarchy(2), RMF.PARTICLE)
76 da.add_alternative(create_hierarchy(4), RMF.PARTICLE)
77 da.add_alternative(create_gmm(), RMF.GAUSSIAN_PARTICLE)
81 print(
"particles", RMF.get_resolutions(n, RMF.PARTICLE))
82 print(
"gaussian particles", RMF.get_resolutions(n, RMF.GAUSSIAN_PARTICLE))
void show_hierarchy(NodeConstHandle root)
FileHandle create_rmf_file(std::string path)
Create an RMF from a file system path.