org.jcae.mesh.xmldata
Class MeshExporter

java.lang.Object
  extended by org.jcae.mesh.xmldata.MeshExporter
Direct Known Subclasses:
MeshExporter.MESH, MeshExporter.POLY, MeshExporter.STL, MeshExporter.UNV, MeshExporter.VTK

public abstract class MeshExporter
extends java.lang.Object

Extract groups from the full mesh and write them to a UNV file. It renumber elements so there ids are from 1 to n. Although it uses the NIO it may not be performant as efficient as a full dump of the mesh to UNV.

Author:
Jerome Robert

Nested Class Summary
static class MeshExporter.FormatD25_16
           
static class MeshExporter.FormatI10
           
static class MeshExporter.MESH
           
static class MeshExporter.POLY
           
static class MeshExporter.STL
           
static class MeshExporter.UNV
           
static class MeshExporter.VTK
          Convert an Amibe mesh to a VTK file.
 
Field Summary
protected  int[][] groups
           
protected  java.lang.String[] names
           
 
Constructor Summary
protected MeshExporter(java.io.File directory, int[] groupIds)
           
protected MeshExporter(java.lang.String directory)
          Convert all groups to UNV
 
Method Summary
static void clean(java.nio.MappedByteBuffer buffer)
          Workaround for Bug ID4724038.
protected  java.io.File getNodeFile()
           
protected  java.io.File getNormalFile()
           
protected  java.io.File getTriaFile()
           
static void main(java.lang.String[] args)
          A main method for debugging
 void write(java.io.PrintStream out)
           
 void write(java.lang.String fileName)
           
protected  void writeFinish(java.io.PrintStream out)
           
protected  void writeGroups(java.io.PrintStream out, TIntIntHashMap amibeTriaToUNVTria)
           
protected  void writeInit(java.io.PrintStream out)
           
protected abstract  void writeNodes(java.io.PrintStream out, int[] nodesID, TIntIntHashMap amibeToUNV)
           
protected  void writeNormals(java.io.PrintStream out, int[] triangles, TIntIntHashMap amibeNodeToUNVNode, TIntIntHashMap amibeTriaToUNVTria)
           
static void writeSingleGroupUNV(java.io.PrintStream out, java.lang.String name, int first, int count)
           
static void writeSingleNodeUNV(java.io.PrintStream out, int count, double x, double y, double z)
           
static void writeSingleTriangleUNV(java.io.PrintStream out, int count, int n0, int n1, int n2)
           
protected abstract  void writeTriangles(java.io.PrintStream out, int[] triangles, TIntIntHashMap amibeNodeToUNVNode, TIntIntHashMap amibeTriaToUNVTria)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

groups

protected int[][] groups

names

protected java.lang.String[] names
Constructor Detail

MeshExporter

protected MeshExporter(java.io.File directory,
                       int[] groupIds)
Parameters:
directory - The directory which contains 3d files
groupIds - The list of ids of groups to convert

MeshExporter

protected MeshExporter(java.lang.String directory)
Convert all groups to UNV

Parameters:
directory - The directory which contains 3d files
Method Detail

main

public static void main(java.lang.String[] args)
A main method for debugging

Parameters:
args -

clean

public static void clean(java.nio.MappedByteBuffer buffer)
Workaround for Bug ID4724038. see http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4724038


getNodeFile

protected java.io.File getNodeFile()

getTriaFile

protected java.io.File getTriaFile()

getNormalFile

protected java.io.File getNormalFile()

write

public void write(java.io.PrintStream out)
           throws javax.xml.parsers.ParserConfigurationException,
                  org.xml.sax.SAXException,
                  java.io.IOException
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

write

public void write(java.lang.String fileName)
Parameters:
fileName - The UNV filename. If the name ends with ".gz" it will be zlib compressed.
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

writeNodes

protected abstract void writeNodes(java.io.PrintStream out,
                                   int[] nodesID,
                                   TIntIntHashMap amibeToUNV)
                            throws java.io.IOException
Throws:
java.io.IOException

writeTriangles

protected abstract void writeTriangles(java.io.PrintStream out,
                                       int[] triangles,
                                       TIntIntHashMap amibeNodeToUNVNode,
                                       TIntIntHashMap amibeTriaToUNVTria)
                                throws java.io.IOException
Throws:
java.io.IOException

writeInit

protected void writeInit(java.io.PrintStream out)
                  throws java.io.IOException
Throws:
java.io.IOException

writeFinish

protected void writeFinish(java.io.PrintStream out)
                    throws java.io.IOException
Throws:
java.io.IOException

writeNormals

protected void writeNormals(java.io.PrintStream out,
                            int[] triangles,
                            TIntIntHashMap amibeNodeToUNVNode,
                            TIntIntHashMap amibeTriaToUNVTria)
                     throws java.io.IOException
Throws:
java.io.IOException

writeGroups

protected void writeGroups(java.io.PrintStream out,
                           TIntIntHashMap amibeTriaToUNVTria)
                    throws java.io.IOException
Throws:
java.io.IOException

writeSingleNodeUNV

public static void writeSingleNodeUNV(java.io.PrintStream out,
                                      int count,
                                      double x,
                                      double y,
                                      double z)

writeSingleTriangleUNV

public static void writeSingleTriangleUNV(java.io.PrintStream out,
                                          int count,
                                          int n0,
                                          int n1,
                                          int n2)

writeSingleGroupUNV

public static void writeSingleGroupUNV(java.io.PrintStream out,
                                       java.lang.String name,
                                       int first,
                                       int count)