Module simpa.core

Class SHCombiner

java.lang.Object
simpa.core.api.SHCombiner

public class SHCombiner extends Object
Singleton pattern class that combines the SHField with a map of scalings and can serialize and deserialize the SHField to a file.
  • Constructor Details

    • SHCombiner

      public SHCombiner()
  • Method Details

    • getUniqueInstance

      public static SHCombiner getUniqueInstance()
      Returns the instance of the SHCombiner and creates it if it doesn't exist yet.
      Returns:
      SHCombiner object.
    • serializeToFile

      public void serializeToFile(String serialObjectFilename, Map<String,Double> scalings) throws IOException
      Serializes the SHField to a file.
      Parameters:
      serialObjectFilename - Name of the output file.
      scalings - Map that contains a scaling factor for the fieldmap with the given name.
      Throws:
      IOException - When an IO error happens.
    • getEvaluator

      public PotentialProvider getEvaluator(Map<String,Double> scalings) throws IOException
      Gets an implementation of PotentialProvider using the given scalings. Using this method all field map will be kept in memory and an evaluator can be obtained quickly. THE DISADVANTAGE IS THAT THE MEMORY CONSUMPTION IS HIGH! If you don't have a lot of memory or the consecutive re-scaling of field maps is not necessary, then use the @see getEvaluatorWithoutCaching method.
      Parameters:
      scalings - Map that contains a scaling factor for the field map with the given name.
      Returns:
      an implementation of PotentialProvider for evaluating the field.
      Throws:
      IOException - When an IO error happens.
    • getEvaluatorWithoutCaching

      public PotentialProvider getEvaluatorWithoutCaching(Map<String,Double> scalings) throws IOException
      Gets an instance of PotentialProvider using the given scalings. The field maps will be added as they are read and will not kept in memory, only the currently read one and the sum. This leads to less memory requirement than the @see getEvaluator method.
      Parameters:
      scalings - Map that contains a scaling factor for the fieldmap with the given name.
      Returns:
      an implementation of PotentialProvider for evaluating the field.
      Throws:
      IOException - When an IO error happens.
    • getFieldMapWithoutCaching

      public FieldMap getFieldMapWithoutCaching(Map<String,Double> scalings) throws IOException
      Gets an instance of PotentialProvider using the given scalings. The field maps will be added as they are read and will not kept in memory, only the currently read one and the sum. This leads to less memory requirement than the @see getEvaluator method.
      Parameters:
      scalings - Map that contains a scaling factor for the fieldmap with the given name.
      Returns:
      A FieldMap instance.
      Throws:
      IOException - When an IO error happens.