Class ConcentrationBasedModule<DeltaFunctionType extends AbstractDeltaFunction>

    • Field Detail

      • supplier

        protected FieldSupplier supplier
        Frequently required fields.
    • Constructor Detail

      • ConcentrationBasedModule

        public ConcentrationBasedModule()
        Creates a new concentration based module.
    • Method Detail

      • addDeltaFunction

        protected void addDeltaFunction​(DeltaFunctionType deltaFunction)
        Adds a delta function to the module. Delta functions are applied according to UpdateScope and UpdateSpecificity.
        Parameters:
        deltaFunction - The delta function.
      • getApplicationCondition

        public Predicate<Updatable> getApplicationCondition()
        Returns the application condition for this module.The module is only evaluated if the updatable fulfills the given predicate.
        Returns:
        The application condition.
      • setApplicationCondition

        protected void setApplicationCondition​(Predicate<Updatable> applicationCondition)
        Sets the application condition for this module. The module is only evaluated if the updatable fulfills the given predicate.
        Parameters:
        applicationCondition - The application condition.
      • getSupplier

        public FieldSupplier getSupplier()
        Returns the field supplier.
        Returns:
        The field supplier.
      • getScope

        public UpdateScope getScope()
        Returns the scope of this module.
        Returns:
        The scope of this module.
      • getSpecificity

        public UpdateSpecificity getSpecificity()
        Returns the specificity of this module.
        Returns:
        The specificity of this module.
      • handleDelta

        public void handleDelta​(ConcentrationDeltaIdentifier deltaIdentifier,
                                ConcentrationDelta delta)
        Handles a delta based on the current state of the calculation.
        Parameters:
        deltaIdentifier - The unique identifier of the delta.
        delta - The delta itself.
      • deltaIsValid

        public boolean deltaIsValid​(ConcentrationDelta delta)
        Returns true if the delta is valid, i.e. it is not zero and nor below the numerical threshold.
        Parameters:
        delta - The delta to be evaluated.
        Returns:
        true if the delta is valid, i.e. it is not zero and nor below the numerical threshold.
      • determineLargestLocalError

        public NumericalError determineLargestLocalError()
        The local error is calculated and the largest local error of the current epoch resulting from the executing module is returned. The local error is calculated according to the midpoint method E = abs(1 - (fullDelta / halfDelta)). If the difference is large the error is large and vice versa.
        Returns:
        The calculated local error.
        Throws:
        NumericalInstabilityException - if any of the encountered errors is the result of an numerical instability.
      • inBetweenHalfSteps

        public void inBetweenHalfSteps()
      • getScaledFeature

        public double getScaledFeature​(Class<? extends bio.singa.features.model.AbstractScalableQuantitativeFeature<?>> featureClass)
        Overrides:
        getScaledFeature in class AbstractUpdateModule
      • getScaledFeature

        protected double getScaledFeature​(ChemicalEntity entity,
                                          Class<? extends bio.singa.features.model.AbstractScalableQuantitativeFeature<?>> featureClass)
        Returns the requested feature of the given chemical entities, scaled according to the current time step and spatial scaling.
        Parameters:
        entity - The chemical entity.
        featureClass - The requested feature.
        Returns:
        The scaled feature.
      • initialize

        public void initialize()
      • restrictApplication

        public void restrictApplication()
      • getRestrictedSubsection

        public CellSubsection getRestrictedSubsection()
      • setRestrictedSubsection

        public void setRestrictedSubsection​(CellSubsection restrictedSubsection)
      • onReset

        public void onReset()
      • onCompletion

        public void onCompletion()