Skip to content

ExodusIIWriter

vtk-examples/Java/Parallel/ExodusIIWriter

Description

Example Program to Demonstrate the usage of vtkExodusIIWriter - a vtkWriter that writes it's vtkUnstructuredGrid input to an Exodus II file Exodus files contain much information that is not captured in a vtkUnstructuredGrid, such as time steps, information lines, node sets, and side sets.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

Code

ExodusIIWriter.java

import vtk.vtkNativeLibrary;
import vtk.vtkExodusIIWriter;
import vtk.vtkTimeSourceExample;

public class ExodusIIWriter 
{
// -----------------------------------------------------------------
// Load VTK library and print which library was not properly loaded
static 
{
  if (!vtkNativeLibrary.LoadAllNativeLibraries()) 
  {
    for (vtkNativeLibrary lib : vtkNativeLibrary.values()) 
    {
      if (!lib.IsLoaded()) 
      { 
        System.out.println(lib.GetLibraryName() + " not loaded");
      }
    }
  }
  vtkNativeLibrary.DisableOutputWindow(null);
}
// -----------------------------------------------------------------

public static void main(String args[]) 
{                   
  // Provide default values.
  String fileName = "Output.exii";
  for(int i = 0; i < args.length; ++i)
  {
    switch (i) 
    {
      case 0:
      fileName = args[i];
      break;

    }
  }
  vtkTimeSourceExample TimeSource = new vtkTimeSourceExample();
  vtkExodusIIWriter ExodusWriter = new vtkExodusIIWriter();
  ExodusWriter.SetFileName(fileName);
  ExodusWriter.SetInputConnection(TimeSource.GetOutputPort());
  ExodusWriter.WriteAllTimeStepsOn();
  ExodusWriter.Write();
 }        
}