Here I just copy my python code from my project:
from numpy.core.function_base import linspace
import numpy as np
from operator import mod
class contactPair:
itr = 0
rawData=[]
rawDataLabel=[]
uidi=0
uidj=0
Nc=0
cLoc=[0,0,0]
deltan=0
deltatAcc=0
Np=0
Fi=[0,0,0]
Fni=[0,0,0]
Fti=[0,0,0]
n=[0,0,0]
t=[0,0,0]
RVCP=[0,0,0]
def __init__(self,itr,label,cntinfo):
self.itr=itr
self.rawData=cntinfo
self.rawDataLabel=label
self.uidi=cntinfo[0]
self.uidj=cntinfo[1]
self.Nc=cntinfo[2]
self.deltan=cntinfo[6]
self.deltatAcc=cntinfo[7]
self.Np=cntinfo[8]
for k in range(3):
self.cLoc[k]=cntinfo[3+k]
self.Fi[k]=cntinfo[9+k]
self.Fni[k]=cntinfo[12+k]
self.Fti[k]=cntinfo[15+k]
self.n[k]=cntinfo[18+k]
self.t[k]=cntinfo[21+k]
self.RVCP[k]=cntinfo[24+k]
g=1
class par:
name = 0
itr = 0
uid = 0
rawData = []
rawDataLabel = []
mass = 0
pos = [0,0,0]
vel = [0,0,0]
acc = [0,0,0]
acc2 = [0,0,0]
hf =[0,0,0]
theta=[0,0,0]
omega=[0,0,0]
alpha=[0,0,0]
alpha2=[0,0,0]
dia=[0,0,0]
Nc=0
ppf=[0,0,0]
rotMat=[]
vol=0
density=0
mofi=[]
normalUnit=[]
angleToShearingPlane=0
def __init__(self,itr,label,parinfo):
#self.name=0
self.itr=itr
self.rawData=parinfo
self.rawDataLabel=label
self.name=parinfo[0]
self.mass=parinfo[2]
for k in range(3):
self.pos[k]= parinfo[3+k]
self.vel[k]= parinfo[6+k]
self.acc[k]= parinfo[9+k]
self.acc2[k]= parinfo[12+k]
self.hf[k]= parinfo[15+k]
self.theta[k]=parinfo[18+k]
self.omega[k]=parinfo[21+k]
self.alpha[k]=parinfo[24+k]
self.alpha2[k]=parinfo[27+k]
self.dia[k]= parinfo[33+k]
self.ppf[k]= parinfo[39+k]
self.uid = parinfo[36]
self.Nc = parinfo[37]
#ipDir1,ipDir2,ipDir3,mat=rotate(self.theta[0],self.theta[1],self.theta[2],1,0,0)
#self.rotMat=mat
#self.normalUnit=[ipDir1,ipDir2,ipDir3]
self.angleToShearingPlane=mod(self.theta[2]+2*np.pi,np.pi)
#self.angleToShearingPlane=mod(self.theta[1]+2*np.pi,np.pi)
t1=linspace(1,100,100)
c1=contactPair(1,[],t1)
p1=par(1,[],t1)
print(f"c1.cLoc: {c1.cLoc}")
print(f"p1.acc: {p1.acc}")
t2=linspace(101,200,100)
c2=contactPair(2,[],t2)
p2=par(1,[],t2)
print(f"c2.cLoc: {c2.cLoc}")
print(f"p2.acc: {p2.acc}")
print(f"c1.cLoc: {c1.cLoc}")
print(f"p1.acc: {p1.acc}")
and what I got from the python console is
c1.cLoc: [4.0, 5.0, 6.0]
p1.acc: [10.0, 11.0, 12.0]
c2.cLoc: [104.0, 105.0, 106.0]
p2.acc: [110.0, 111.0, 112.0]
c1.cLoc: [104.0, 105.0, 106.0]
p1.acc: [110.0, 111.0, 112.0]
What I did is
- defining two classes, i.e., contactPair and par.
- creating two new instances c1, p1 based on input t1.
- creating another two new instances c2, p2 based on input t2.
I don't know why the values of c1 and p1 are changed after creating c2 and p2.