-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgetElemInd.py
48 lines (35 loc) · 1006 Bytes
/
getElemInd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 14 14:19:45 2023
@author: chandela
"""
#USE THIS ONE - ayushi
def getElemInd(f, numElements, elemCent, dr):
import numpy as np
import datetime
import multiprocessing
from functools import partial
from dictionary import thisdict
import sys
# f is the counter for the nonlocal volume
elemInd = np.empty((numElements,2))
elemInd[:] = np.nan
counter = 0
x0 = elemCent[f,1]
y0 = elemCent[f,2]
z0 = elemCent[f,3]
for e in range(numElements):
xP = elemCent[e,1]
yP = elemCent[e,2]
zP = elemCent[e,3]
x1 = abs(xP - x0);
y1 = abs(yP - y0);
z1 = abs(zP - z0);
r = np.sqrt(x1**2. + y1**2. +z1**2.);
if r <= dr:
elemInd[counter,0] = elemCent[e,0]
elemInd[counter,1] = r
counter = counter + 1
elemInd = elemInd[~np.isnan(elemInd)]
#elemInd = elemInd.astype(np.int64)
return elemInd