Skip to content

Commit 4a4d427

Browse files
committed
Add wip on the conversion function for creating C++ particle objects
1 parent b447476 commit 4a4d427

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

fidimag/atomistic/lib/fmmlib/fmmlib.pyx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,21 @@ cdef vector[Particle] sim_to_particles(mesh, mu_s):
3030
Convert the positions of the lattice spins to C++ Particle objects
3131
for the building of the trees.
3232
"""
33-
pass
33+
ids = []
34+
for k in range(mesh.nz):
35+
for j in range(mesh.ny):
36+
for i in range(mesh.nx):
37+
id = k * mesh.nx * mesh.ny + j * mesh.nx + i
38+
// Check that the spin is not a 'ghost' spin
39+
if mus[id] != 0:
40+
ids.append(id)
41+
42+
3443

3544

3645

3746
def build_tree(mesh, mus):
3847
pass
39-
# particles =
40-
# cells = build_tree()
4148

4249

4350

0 commit comments

Comments
 (0)