Compare commits
No commits in common. "e2fe40c460ef711d44cfb4697242481014a826f4" and "1756a7a916300cd12472f094d4263e4d1dc3c943" have entirely different histories.
e2fe40c460
...
1756a7a916
3
field.py
3
field.py
|
|
@ -273,8 +273,7 @@ class Field3d:
|
|||
mesh.dimensions = self.dim(axis=None)
|
||||
mesh.origin = self.origin
|
||||
mesh.spacing = self.spacing
|
||||
# order needs to be F no matter how array is stored in memory
|
||||
mesh.point_arrays['data'] = self.data.ravel(order='F')
|
||||
mesh.point_arrays['data'] = self.data.flatten(order='F')
|
||||
return mesh
|
||||
|
||||
def vtk_contour(self,val):
|
||||
|
|
|
|||
18
particle.py
18
particle.py
|
|
@ -76,7 +76,7 @@ class Particles:
|
|||
attr = {}
|
||||
for key in self.attr:
|
||||
attr[key] = self.attr[key].copy()
|
||||
return Particles(self.num,self.time,attr,self.period)
|
||||
return Particles(self.num,self.time,attr,period)
|
||||
def add_attribute(self,key,val):
|
||||
import numpy
|
||||
if isinstance(val,(tuple,list,numpy.ndarray)):
|
||||
|
|
@ -125,22 +125,6 @@ class Particles:
|
|||
key = ('x','y','z')[axis]
|
||||
self.attr[key] %= self.period[axis]
|
||||
return
|
||||
def to_vtk(self,deep=False):
|
||||
import pyvista as pv
|
||||
import numpy as np
|
||||
position = np.vstack([self.attr[key] for key in ('x','y','z')]).transpose()
|
||||
mesh = pv.PolyData(position,deep=deep)
|
||||
for key in self.attr:
|
||||
mesh[key] = self.attr[key]
|
||||
return mesh
|
||||
|
||||
def glyph(self,theta_resolution=10,phi_resolution=10,deep=False):
|
||||
import pyvista as pv
|
||||
assert self.has_attribute('r'), "Attribute 'r' required."
|
||||
geom = pv.Sphere(radius=1,theta_resolution=theta_resolution,
|
||||
phi_resolution=phi_resolution)
|
||||
return self.to_vtk(deep=deep).glyph(scale='r',factor=1,geom=geom)
|
||||
|
||||
class Trajectories:
|
||||
def __init__(self,part,unraveled=False,copy_particles=False):
|
||||
import numpy
|
||||
|
|
|
|||
Loading…
Reference in New Issue