Nathan Collier avatar Nathan Collier committed 9639095

added sample plotting script (requires igakit)

Comments (0)

Files changed (1)


+This python script shows the usage of igakit
+( to post-process results
+obtained using the demo code:
+   ./demo/Poisson.c 
+When running the C-code with the -save option, two data files are
+generated. One contains the geometry and discretization information,
+the other is the solution vector.
+from import PetIGA,VTK
+from numpy import linspace
+# read in discretization info and potentially geometry
+nrb = PetIGA().read("PoissonGeometry.dat")
+# read in solution vector as a numpy array
+sol = PetIGA().read_vec("PoissonSolution.dat",nrb)
+# write a function to sample the nrbs object (100 points from beginning to end)
+uniform = lambda U: linspace(U[0], U[-1], 100)
+# write a binary VTK file
+VTK().write("PoissonVTK.vtk",       # output filename
+            nrb,                    # igakit NURBS object
+            fields=sol,             # sol is the numpy array to plot 
+            sampler=uniform,        # specify the function to sample points
+            scalars={'solution':0}) # adds a scalar plot to the VTK file
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.