Created
February 27, 2014 08:12
-
-
Save capitalaslash/9246262 to your computer and use it in GitHub Desktop.
vtk grid from libmesh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vtkUnstructuredGrid.h> | |
#include <vtkUnstructuredGridWriter.h> | |
#include <libmesh/libmesh.h> | |
#include <libmesh/mesh.h> | |
#include <libmesh/mesh_generation.h> | |
#include <libmesh/vtk_io.h> | |
int main (int argc, char* argv[]) | |
{ | |
LibMeshInit init (argc, argv); | |
Mesh mesh (init.comm(), 2); | |
MeshTools::Generation::build_square (mesh, 10, 10, 0., 1., 0., 1., TRI3); | |
VTKIO io (mesh); | |
io._vtk_grid = vtkUnstructuredGrid::New(); | |
io.nodes_to_vtk(); | |
io.cells_to_vtk(); | |
vtkUnstructuredGrid *grid; | |
grid = io.get_vtk_grid(); | |
vtkUnstructuredGridWriter *writer = vtkUnstructuredGridWriter::New(); | |
writer->SetInput(grid); | |
writer->SetFileTypeToASCII(); | |
writer->SetFileName("test.vtk"); | |
writer->Write(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment