Class TinInstantiationUtility
- java.lang.Object
-
- org.tinfour.utils.TinInstantiationUtility
-
public class TinInstantiationUtility extends Object
Provides a utility for instantiating either the QuadEdge or virtual versions of the TIN class based on the amount of memory available
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_MEMORY_FRACTIONAn arbitrary setting telling how much of the maximum memory to commit for processing the TIN.static longMEMORY_FOR_STANDARDMeasured memory use by Hotspot JVM with a maximum memory setting smaller than 32 gigabytes, using object reference compression.static longMEMORY_FOR_VIRTUALMeasured memory use by Hotspot JVM with a maximum memory setting smaller than 32 gigabytes, using object reference compression.
-
Constructor Summary
Constructors Constructor Description TinInstantiationUtility(double memoryUseFraction, int nVertices)Constructs an instance bases on a specification for how much memory is available for use and the anticipated number of vertices that will be added to the TIN.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IIncrementalTinconstructInstance(double nominalPointSpacing)Uses the information about available memory use that was passed into the constructor to select a TIN class and construct and instance.IIncrementalTinconstructInstance(Class<?> tinClass, double nominalPointSpacing)Constructs an instance of the specified TIN class.Class<?>getTinClass()Get the class that was selected as most appropriate for the available memory and number of vertices.voidprintSummary(PrintStream ps)Prints a summary of the size computations and resulting IIncrementalTin class decision based on information supplied to the constructor.
-
-
-
Field Detail
-
DEFAULT_MEMORY_FRACTION
public static final double DEFAULT_MEMORY_FRACTION
An arbitrary setting telling how much of the maximum memory to commit for processing the TIN.- See Also:
- Constant Field Values
-
MEMORY_FOR_VIRTUAL
public static final long MEMORY_FOR_VIRTUAL
Measured memory use by Hotspot JVM with a maximum memory setting smaller than 32 gigabytes, using object reference compression.- See Also:
- Constant Field Values
-
MEMORY_FOR_STANDARD
public static final long MEMORY_FOR_STANDARD
Measured memory use by Hotspot JVM with a maximum memory setting smaller than 32 gigabytes, using object reference compression.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TinInstantiationUtility
public TinInstantiationUtility(double memoryUseFraction, int nVertices)Constructs an instance bases on a specification for how much memory is available for use and the anticipated number of vertices that will be added to the TIN.- Parameters:
memoryUseFraction- the fraction of the JVM total memory that is allowed for memory use, a value in the range 0 to 1.nVertices- the number of vertices to be used.
-
-
Method Detail
-
constructInstance
public IIncrementalTin constructInstance(Class<?> tinClass, double nominalPointSpacing)
Constructs an instance of the specified TIN class.The nominal point spacing should be a rough estimate of the average distance between vertices. This value is used for establishing decision thresholds such as "when are two vertices so close together that they should be treated as one?" and does not need to be especially accurate. As long as it is within an order of magnitude of the true value, the Tinfour algorithms should produce good results.
- Parameters:
tinClass- a valid class reference for an implementation of IIncrementalTinnominalPointSpacing- a rough estimate of the average distance between vertices.- Returns:
- a valid instance of the specified incremental TIN class.
-
constructInstance
public IIncrementalTin constructInstance(double nominalPointSpacing)
Uses the information about available memory use that was passed into the constructor to select a TIN class and construct and instance.The nominal point spacing should be a rough estimate of the average distance between vertices. This value is used for establishing decision thresholds such as "when are two vertices so close together that they should be treated as one?" and does not need to be especially accurate. As long as it is within an order of magnitude of the true value, the Tinfour algorithms should produce good results.
- Parameters:
nominalPointSpacing- a rough estimate of the average distance between vertices.- Returns:
- a valid instance of a class that implements IIncrementalTin.
-
printSummary
public void printSummary(PrintStream ps)
Prints a summary of the size computations and resulting IIncrementalTin class decision based on information supplied to the constructor.- Parameters:
ps- the print stream.
-
getTinClass
public Class<?> getTinClass()
Get the class that was selected as most appropriate for the available memory and number of vertices.- Returns:
- a valid class reference for an implementation of IIncrementalTin
-
-