public abstract class ConcentrationBasedModule<DeltaFunctionType extends AbstractDeltaFunction> extends Object implements UpdateModule
Updatables during a
simulation. Each module has a UpdateScope that regulates the dependence of this module to other parts of the
simulation. Further, the UpdateSpecificity defines how fine-grained the updates are calculated. New modules
should be created with the ModuleFactory.| Modifier and Type | Field and Description |
|---|---|
protected FieldSupplier |
supplier
Frequently required fields.
|
| Constructor and Description |
|---|
ConcentrationBasedModule()
Creates a new concentration based module.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDeltaFunction(DeltaFunctionType deltaFunction)
Adds a delta function to the module.
|
protected void |
addModuleToSimulation()
References the module and referenced entities to the referenced simulation.
|
protected void |
addReferencedEntities(Collection<? extends ChemicalEntity> chemicalEntities)
Adds multiple referenced chemical entities.
|
protected void |
addReferencedEntity(ChemicalEntity chemicalEntity)
Adds a referenced chemical entity.
|
void |
calculateUpdates() |
void |
checkFeatures() |
boolean |
deltaIsValid(ConcentrationDelta delta)
Returns true if the delta is valid, i.e.
|
LocalError |
determineLargestLocalError()
The local error is calculated and the largest local error of the current epoch resulting from the executing
module is returned.
|
Predicate<Updatable> |
getApplicationCondition()
Returns the application condition for this module.The module is only evaluated if the updatable fulfills the
given predicate.
|
double |
getDeltaCutoff()
Returns the cutoff where deltas are validated to be effectively zero.
|
double |
getErrorCutoff()
Returns the cutoff where numerical errors to be considered irretrievably unstable.
|
<FeatureType extends Feature> |
getFeature(Class<FeatureType> featureTypeClass)
Returns the requested feature.
|
Collection<Feature<?>> |
getFeatures()
Returns all features of this module (not its entities).
|
String |
getIdentifier()
Returns the identifier of this module.
|
Set<ChemicalEntity> |
getReferencedEntities()
Returns all chemical entities that might be accessed by this module.
|
Set<Class<? extends Feature>> |
getRequiredFeatures() |
protected <FeatureContentType extends javax.measure.Quantity<FeatureContentType>> |
getScaledFeature(ChemicalEntity entity,
Class<? extends ScalableFeature<FeatureContentType>> featureClass)
Returns the requested feature of the given chemical entities, scaled according to the current time step and
spatial scaling.
|
<FeatureContentType extends javax.measure.Quantity<FeatureContentType>> |
getScaledFeature(Class<? extends ScalableFeature<FeatureContentType>> featureClass) |
UpdateScope |
getScope()
Returns the scope of this module.
|
Simulation |
getSimulation()
Returns the referenced simulation.
|
UpdateSpecificity |
getSpecificity()
Returns the specificity of this module.
|
ModuleState |
getState() |
FieldSupplier |
getSupplier()
Returns the field supplier.
|
void |
handleDelta(ConcentrationDeltaIdentifier deltaIdentifier,
ConcentrationDelta delta)
Handles a delta based on the current state of the calculation.
|
void |
onCompletion() |
void |
onReset() |
void |
optimizeTimeStep() |
void |
resetState() |
void |
scaleScalableFeatures() |
protected void |
setApplicationCondition(Predicate<Updatable> applicationCondition)
Sets the application condition for this module.
|
void |
setDeltaCutoff(double deltaCutoff)
Sets the cutoff where deltas are validated to be effectively zero.
|
void |
setErrorCutoff(double errorCutoff)
Sets the cutoff where numerical errors to be considered irretrievably unstable.
|
void |
setFeature(Feature<?> feature)
Sets a feature.
|
void |
setIdentifier(String identifier)
Sets the identifier of this module.
|
void |
setSimulation(Simulation simulation)
References the simulation to this module.
|
String |
toString() |
protected FieldSupplier supplier
public ConcentrationBasedModule()
protected void addDeltaFunction(DeltaFunctionType deltaFunction)
UpdateScope and UpdateSpecificity.deltaFunction - The delta function.protected void setApplicationCondition(Predicate<Updatable> applicationCondition)
applicationCondition - The application condition.public Predicate<Updatable> getApplicationCondition()
public Set<ChemicalEntity> getReferencedEntities()
getReferencedEntities in interface UpdateModuleprotected void addReferencedEntity(ChemicalEntity chemicalEntity)
chemicalEntity - The chemical entity.protected void addReferencedEntities(Collection<? extends ChemicalEntity> chemicalEntities)
chemicalEntities - The chemical entities.public double getDeltaCutoff()
public void setDeltaCutoff(double deltaCutoff)
deltaCutoff - The delta cutoff.public double getErrorCutoff()
public void setErrorCutoff(double errorCutoff)
errorCutoff - The error cutoff.public Simulation getSimulation()
public void setSimulation(Simulation simulation)
simulation - The simulation.public String getIdentifier()
getIdentifier in interface UpdateModulepublic void setIdentifier(String identifier)
identifier - The identifier.public FieldSupplier getSupplier()
public UpdateScope getScope()
public UpdateSpecificity getSpecificity()
public ModuleState getState()
getState in interface UpdateModulepublic void handleDelta(ConcentrationDeltaIdentifier deltaIdentifier, ConcentrationDelta delta)
deltaIdentifier - The unique identifier of the delta.delta - The delta itself.public boolean deltaIsValid(ConcentrationDelta delta)
delta - The delta to be evaluated.public LocalError determineLargestLocalError()
NumericalInstabilityException - if any of the encountered errors is the result of an numerical
instability.public void calculateUpdates()
calculateUpdates in interface UpdateModulepublic void optimizeTimeStep()
optimizeTimeStep in interface UpdateModulepublic void resetState()
resetState in interface UpdateModuleprotected void addModuleToSimulation()
public void scaleScalableFeatures()
scaleScalableFeatures in interface UpdateModulepublic Set<Class<? extends Feature>> getRequiredFeatures()
getRequiredFeatures in interface UpdateModulepublic <FeatureContentType extends javax.measure.Quantity<FeatureContentType>> javax.measure.Quantity<FeatureContentType> getScaledFeature(Class<? extends ScalableFeature<FeatureContentType>> featureClass)
getScaledFeature in interface UpdateModuleprotected <FeatureContentType extends javax.measure.Quantity<FeatureContentType>> javax.measure.Quantity<FeatureContentType> getScaledFeature(ChemicalEntity entity, Class<? extends ScalableFeature<FeatureContentType>> featureClass)
FeatureContentType - The resulting content type.entity - The chemical entity.featureClass - The requested feature.public <FeatureType extends Feature> FeatureType getFeature(Class<FeatureType> featureTypeClass)
FeatureType - The resulting content type.featureTypeClass - The requested feature.public void setFeature(Feature<?> feature)
setFeature in interface UpdateModulefeature - The feature.public Collection<Feature<?>> getFeatures()
getFeatures in interface UpdateModulepublic void onReset()
onReset in interface UpdateModulepublic void onCompletion()
onCompletion in interface UpdateModulepublic void checkFeatures()
checkFeatures in interface UpdateModuleCopyright © 2019. All rights reserved.