Class GTCGeomReader

  • All Implemented Interfaces:
    GeomReader, java.lang.Comparable

    public class GTCGeomReader
    extends AbstractGeomReader
    A GeomReader for reading geometry from a GridTool restart file. GridTool is a NASA developed grid/geometry program that is a part of the NASA TetrUSS CFD system. More information can be found here: http://geolab.larc.nasa.gov/GridTool/

    Modified by: Joseph A. Huwaldt

    Version:
    February 17, 2025
    Author:
    Joseph A. Huwaldt, Date: December 26, 2013
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String EXTENSION  
    • Constructor Summary

      Constructors 
      Constructor Description
      GTCGeomReader()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int canReadData​(java.io.File inputFile)
      Method that determines if this reader can read geometry from the specified input file.
      boolean canWriteData()
      Returns true.
      java.lang.String getExtension()
      Returns the preferred file extension (not including the ".") for files of this GeomReader's type.
      boolean isUnitAware()
      This method always returns false as GTC restart files do not encode the units that are being used.
      GeometryList read​(java.io.File inputFile)
      Reads in a GridTool restart file from the specified input file and returns a GeometryList object that contains the geometry from the file.
      java.lang.String toString()
      Returns a string representation of the object.
      void write​(java.io.File outputFile, GeometryList geometry)
      Writes out a geometry file for the geometry contained in the supplied GeometryList object.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • toString

        public java.lang.String toString()
        Returns a string representation of the object. This will return a brief description of the format read by this reader.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A brief description of the format read by this reader.
      • getExtension

        public java.lang.String getExtension()
        Returns the preferred file extension (not including the ".") for files of this GeomReader's type.
        Returns:
        The preferred file extension for files of this readers type.
      • isUnitAware

        public boolean isUnitAware()
        This method always returns false as GTC restart files do not encode the units that are being used. You must call setFileUnits to set the units being used before reading from a file of this format, otherwise default system units will be assumed.
        Returns:
        this implementation always returns false
        See Also:
        AbstractGeomReader.setFileUnits(javax.measure.unit.Unit)
      • canReadData

        public int canReadData​(java.io.File inputFile)
                        throws java.io.IOException
        Method that determines if this reader can read geometry from the specified input file.
        Specified by:
        canReadData in interface GeomReader
        Overrides:
        canReadData in class AbstractGeomReader
        Parameters:
        inputFile - The input file containing the geometry to be read in. May not be null.
        Returns:
        GeomReader.NO if the file format is not recognized by this reader. GeomReader.YES if the file format is definitely recognized by this reader. GeomReader.MAYBE if the file format might be readable by this reader, but that can't easily be determined without actually reading the file.
        Throws:
        java.io.IOException - If there is a problem reading from the specified file.
      • read

        public GeometryList read​(java.io.File inputFile)
                          throws java.io.IOException

        Reads in a GridTool restart file from the specified input file and returns a GeometryList object that contains the geometry from the file. The output list contains 4 sub-lists: SURFACES, CURVES, PATCHES and SOURCES. Empty lists are included if any of these entities is not included in the file.

        The top-level list has the following data stored in the user data using the following keys:
        • GTC_Version -- The GTC version code. Must be ≥ 1.4 to be read by this reader.
        • GTC_Tol -- The gobal geometry tolerance used.
        • GTC_Name -- The GTC model name.
        Each sub-list is defined as follows:
        SURFACES
        All the NURBS surfaces and NURBS curves in the geometry. Each surface & curve has stored in its user data the minimum and maximum parameter ranges for the original geometry using the GTC_U0, GTC_U1, GTC_V0, and GTC_V1 keys. All NURBS surfaces & curves in GeomSS have parameter ranges from 0 to 1, but other geometry systems allow different parameter ranges. In addition, the IGES type code for the geometry is stored with the GTC_Type key and the family name is stored with the GTC_Family key.
        CURVES
        This list contains PointString objects (which are lists of points) for each "curve". Each point stored in each point string is either free (in X,Y,Z) or subranged onto a NURBS surface or curve.
        PATCHES
        Each patch in the PATCHES list contains two lists, one containing either nothing or the NURBS surface associated with the patch and one containing a list of edge curves (PointStrings) for the patch. Each patch has user data stored with it using the following keys:
        • GTC_Type -- The patch type code
        • GTC_BCType -- The boundary condition type code
        • GTC_Family -- The family name
        • GTC_ValidPatch -- A patch validity flag
        • GTC_D3MNumber -- The d3m number for the patch
        • GTC_EdgeSideIndexes -- A list of side indexes for each edge (which side does each edge belong to)
        • GTC_EdgeReversedFlags -- A list of flags indicating if each edge is reversed or not.
        SOURCES
        The sources for the "background grid" are stored in this list as PointString objects. Each PointString has two points for the ends of the source (though the 2nd one is sometimes not required, it is always there). As with curves, the points can either be in free space (X,Y,Z) or subranged onto a NURBS curve or surface. The global source list has the following user data keys associated with it:
        • GTC_Delta1, GTC_Rate1, & GTC_Rate2 -- Global boundary layer growth parameters.
        • GTC_NLayers -- The number of layers in the boundary layer grid
        • GTC_NIterations -- The number of refinement iterations for the boundary layer grid.
        • GTC_Stretching -- Global flags indicating if there is cell stretching in this grid
        • GTC_ViscousLayers -- Global flag indicating if viscous layers should be grown or not.
        Each source in the SOURCES list has the following user data keys associated with it:
        • GTC_SourceType -- The type code for the source.
        • GTC_Family -- The family name
        • GTC_StretchingDir -- The stretching direction code.
        • GTC_an, GTC_bn, and GTC_Alpha -- Source strength parameters
        Finally, each point in each source has the following keys stored in it's user data:
        • GTC_s, GTC_S -- Source strength information
        • GTC_ro, GTC_ri -- Outer and inner radii for volume sources if required by the source type.
        • GTC_Delta1, GTC_Rate1, GTC_Rate2 -- Values to override the global boundary layer grown parameters.

        WARNING: This file format is not unit aware. You must set the units to be used by calling "setFileUnits()" before calling this method!

        Specified by:
        read in interface GeomReader
        Overrides:
        read in class AbstractGeomReader
        Parameters:
        inputFile - The input file containing the geometry to be read in. May not be null.
        Returns:
        A GeometryList object containing the geometry read in from the file. If the file has no geometry in it, then this list will have no components in it (will have a size() of zero).
        Throws:
        java.io.IOException - If there is a problem reading the specified file.
        See Also:
        AbstractGeomReader.setFileUnits(javax.measure.unit.Unit)
      • write

        public void write​(java.io.File outputFile,
                          GeometryList geometry)
                   throws java.io.IOException
        Writes out a geometry file for the geometry contained in the supplied GeometryList object. If the input geometry is not 3D, it will be forced to be 3D (by padding if there are too few or by truncating additional dimensions).

        WARNING: This format is not unit aware. The geometry will be written out in whatever its current units are! Make sure to convert to the desired units for the file before calling this method.

        Specified by:
        write in interface GeomReader
        Overrides:
        write in class AbstractGeomReader
        Parameters:
        outputFile - The output File to which the geometry is to be written. May not be null.
        geometry - The GeometryList object containing the geometry to be written out. May not be null.
        Throws:
        java.io.IOException - If there is a problem writing to the specified file.