cc.redberry.core.context
Class NameManager
- java.lang.Object
-
- cc.redberry.core.context.NameManager
-
public final class NameManager extends java.lang.ObjectObject of this class represents a namespace of simple tensor and tensor fields in Redberry. It is responsible for generation of unique name descriptors (NameDescriptor) and integer identifiers for simple tensors and fields from raw data. These identifiers are the same for tensors with the same mathematical nature. They are generated randomly in order to obtain the uniform distribution through Redberry session. Each session of Redberry holds only one instance of this class, it can be obtained throughCC.getNameManager().- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringDEFAULT_VAR_SYMBOL_PREFIX
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description NameDescriptorgenerateNewSymbolDescriptor()Returns a descriptor for symbol which was not already parsed.java.lang.StringgetKroneckerName()Returns string representation of Kronecker delta namejava.lang.StringgetMetricName()Returns string representation of metric tensor nameNameDescriptorgetNameDescriptor(int nameId)Returns the name descriptor of the specified unique identifier of simple tensor.org.apache.commons.math3.random.RandomGeneratorgetRandomGenerator()longgetSeed()Returns the seed of the random generator used in name manager.booleanisKroneckerOrMetric(int name)Returnstrueif specified identifier is identifier of metric or Kronecker tensorNameDescriptormapNameDescriptor(java.lang.String sname, StructureOfIndices... structureOfIndices)This method returns the existing name descriptor of simple tensor from the raw data if it contains in the namespace or constructs and puts to namespace new instance of name descriptor otherwise.voidsetKroneckerName(java.lang.String name)Sets the default Kronecker tensor name.voidsetMetricName(java.lang.String name)Sets the default metric tensor name.intsize()
-
-
-
Field Detail
-
DEFAULT_VAR_SYMBOL_PREFIX
public static final java.lang.String DEFAULT_VAR_SYMBOL_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
isKroneckerOrMetric
public boolean isKroneckerOrMetric(int name)
Returnstrueif specified identifier is identifier of metric or Kronecker tensor- Parameters:
name- unique simple tensor identifier- Returns:
trueif specified identifier is identifier of metric or Kronecker tensor
-
getKroneckerName
public java.lang.String getKroneckerName()
Returns string representation of Kronecker delta name- Returns:
- string representation of Kronecker delta name
-
getMetricName
public java.lang.String getMetricName()
Returns string representation of metric tensor name- Returns:
- string representation of metric tensor name
-
setKroneckerName
public void setKroneckerName(java.lang.String name)
Sets the default Kronecker tensor name. After this step, Kronecker tensor will be printed with the specified string name.- Parameters:
name- string representation of Kronecker tensor name
-
setMetricName
public void setMetricName(java.lang.String name)
Sets the default metric tensor name. After this step, metric tensor will be printed with the specified string name.- Parameters:
name- string representation of metric tensor name
-
mapNameDescriptor
public NameDescriptor mapNameDescriptor(java.lang.String sname, StructureOfIndices... structureOfIndices)
This method returns the existing name descriptor of simple tensor from the raw data if it contains in the namespace or constructs and puts to namespace new instance of name descriptor otherwise.- Parameters:
sname- string name of tensorstructureOfIndices- structure of tensor indices (first element in array) and structure of indices of arguments (in case of tensor field)- Returns:
- name descriptor corresponding to the specified information of tensor
-
getNameDescriptor
public NameDescriptor getNameDescriptor(int nameId)
Returns the name descriptor of the specified unique identifier of simple tensor.- Parameters:
nameId- unique identifier of simple tensor- Returns:
- name descriptor of the specified unique identifier of simple tensor
-
generateNewSymbolDescriptor
public NameDescriptor generateNewSymbolDescriptor()
Returns a descriptor for symbol which was not already parsed.- Returns:
- a descriptor for symbol which was not already parsed
-
size
public int size()
-
getSeed
public long getSeed()
Returns the seed of the random generator used in name manager.- Returns:
- seed of the random generator
-
getRandomGenerator
public org.apache.commons.math3.random.RandomGenerator getRandomGenerator()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG