Implementing Programmable Filter ParaView in PyVista #5866
-
First check
Commit to Help
Sample Code What is the problem, question, or error?Write a short description telling me what you are doing, what you expect to happen, and what is currently happening. I am trying to port some Fenics Legacy 2019 code (from now on old code) into Fenicsx. from ast import Expression
from pyclbr import Function
from fenics import *
from math import *
from mshr import *
from dolfin import *
#from scipy.integrate import dblquad
#from scipy.interpolate import griddata
#from ufl import Form, TestFunction, TrialFunction, inner, dx
import sympy as sym
import matplotlib.pyplot as plt
import numpy as np
import copy
import os
p1 = Point(0,0)
p2 = Point(np.pi,1)
nx = 64
ny = 64
mesh = RectangleMesh(p1,p2,nx,ny)
file = File('MeshTest.pvd')
file << mesh After saving the mesh file in This kind of approach is way more amendable than the Cartesian approach for the mathematical analysis of models in elasticity. from paraview import vtk
import math
R=1.0
H=math.pi
pdi = self.GetUnstructuredGridInput()
pdo = self.GetOutput()
newPoints = vtk.vtkPoints()
numPoints = pdi.GetNumberOfPoints()
for i in range(0,numPoints):
coord = pdi.GetPoint(i)
x, y, z = coord[:3]
s = R*cos(x)
t = H*y
z = -R*sin(x)+1.5
newPoints.InsertPoint(i, s, t, z)
pdo.SetPoints(newPoints)
print("Done!")` DescriptionI would like to implement this programmable filter directly in PyVista, without having to resort to ParaView. How would you recommend me to proceed? Many thanks in advance. System InformationN/A ScreenshotsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Take a look at #4914 (comment) for an example of how to generate a sphere similar to this. |
Beta Was this translation helpful? Give feedback.
Take a look at #4914 (comment) for an example of how to generate a sphere similar to this.