Package ptolemy.domains.pthales.lib
Class PthalesIOPort
- java.lang.Object
-
- ptolemy.domains.pthales.lib.PthalesIOPort
-
public class PthalesIOPort extends java.lang.Object
A PthalesIOPort is an element of ArrayOL in Ptolemy. It contains functions needed to use multidimensional arrays.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Remi Barrere
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BASE
The name of the base parameter.static java.lang.Integer
ONE
Fixed variable (for compatibility ?).static java.lang.String
PATTERN
The name of the pattern parameter.static java.lang.String
TILING
The name of the tiling parameter.
-
Constructor Summary
Constructors Constructor Description PthalesIOPort()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getArraySize(IOPort port)
Compute total array size.static java.util.LinkedHashMap<java.lang.String,java.lang.Integer>
getArraySizes(IOPort port)
Compute array sizes (for each dimension).static java.util.LinkedHashMap<java.lang.String,java.lang.Integer>
getArraySizes(IOPort port, java.lang.Integer[] repetitions)
Compute array sizes (for each dimension).static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]>
getBase(IOPort port)
Return the base of this port.static int
getDataProducedSize(IOPort port)
Computes data size produced for each iteration .static java.lang.Integer[]
getDataProducedSizes(IOPort port)
Computes data sizes (for each dimension) produced for each iteration.static java.lang.String[]
getDimensions(IOPort port)
Return dimension names, in order of production.static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]>
getExternalTiling(IOPort port, int nb)
Returns tiling of external loops iterations.static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]>
getInternalPattern(IOPort port)
Compute pattern for external iteration.static int
getNbTokenPerData(IOPort port)
Return the number of tokens that are logically treated as a single token.static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]>
getPattern(IOPort port)
Return the pattern of this port.static int
getPatternNbAddress(IOPort port)
Compute number of address needed for each iteration.static java.lang.Integer[]
getPatternNbAddresses(IOPort port)
Compute number of address by dimension needed for each iteration.static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]>
getTiling(IOPort port)
Returns the tiling of this port.static void
initialize(IOPort port)
Reset the variable part of this type to the specified type.static void
modifyPattern(IOPort port, java.lang.String[] dims, int[] dimSizes)
Modify th pattern of the specified port with dimensions (after propagate).static void
modifyPattern(IOPort port, java.lang.String dim, int dimSize)
Modify the pattern of the specified port with one dimension (for propagate).static void
propagateHeader(IOPort portIn, java.lang.String[] dims, int[] sizes, int headersize, java.util.LinkedHashMap<java.lang.String,java.lang.Integer> arraySizes)
Propagate the header through application relations to update information.static void
propagateIterations(IOPort portIn, java.util.LinkedHashMap<java.lang.String,java.lang.Integer> sizes)
Update actor iterations according to pattern and tiling information.static void
setDataType(IOPort port)
Check if data type is a structure.
-
-
-
Field Detail
-
BASE
public static java.lang.String BASE
The name of the base parameter.
-
ONE
public static java.lang.Integer ONE
Fixed variable (for compatibility ?).
-
PATTERN
public static java.lang.String PATTERN
The name of the pattern parameter.
-
TILING
public static java.lang.String TILING
The name of the tiling parameter.
-
-
Method Detail
-
getArraySize
public static int getArraySize(IOPort port)
Compute total array size.- Parameters:
port
- associated port- Returns:
- array size
-
getArraySizes
public static java.util.LinkedHashMap<java.lang.String,java.lang.Integer> getArraySizes(IOPort port)
Compute array sizes (for each dimension).- Parameters:
port
- associated port- Returns:
- array sizes
-
getArraySizes
public static java.util.LinkedHashMap<java.lang.String,java.lang.Integer> getArraySizes(IOPort port, java.lang.Integer[] repetitions)
Compute array sizes (for each dimension).- Parameters:
port
- associated portrepetitions
- The repetitions values.- Returns:
- array sizes
-
getBase
public static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]> getBase(IOPort port)
Return the base of this port.- Parameters:
port
- associated port- Returns:
- base
-
getDataProducedSize
public static int getDataProducedSize(IOPort port)
Computes data size produced for each iteration .- Parameters:
port
- associated port- Returns:
- data size
-
getDataProducedSizes
public static java.lang.Integer[] getDataProducedSizes(IOPort port)
Computes data sizes (for each dimension) produced for each iteration.- Parameters:
port
- associated port- Returns:
- data sizes
-
getDimensions
public static java.lang.String[] getDimensions(IOPort port)
Return dimension names, in order of production.- Parameters:
port
- associated port- Returns:
- dimension names
-
getExternalTiling
public static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]> getExternalTiling(IOPort port, int nb)
Returns tiling of external loops iterations.- Parameters:
port
- associated portnb
- the number of used tilings (external ones)- Returns:
- tiling map
-
getInternalPattern
public static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]> getInternalPattern(IOPort port)
Compute pattern for external iteration.- Parameters:
port
- associated port- Returns:
- a hashmap of patterns for each dimension
-
getNbTokenPerData
public static int getNbTokenPerData(IOPort port)
Return the number of tokens that are logically treated as a single token. By default, that number is 1, but if the port has an attribute named "dataType" whose expression value begins with "Cpl" then that number is 2. FIXME: This is a hack. Why not use a token array with two tokens?- Parameters:
port
- associated port- Returns:
- the number of token needed to store the values
-
getPattern
public static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]> getPattern(IOPort port)
Return the pattern of this port.- Parameters:
port
- associated port- Returns:
- pattern
-
getPatternNbAddress
public static int getPatternNbAddress(IOPort port)
Compute number of address needed for each iteration.- Parameters:
port
- associated port- Returns:
- number of address
-
getPatternNbAddresses
public static java.lang.Integer[] getPatternNbAddresses(IOPort port)
Compute number of address by dimension needed for each iteration.- Parameters:
port
- associated port- Returns:
- address array
-
getTiling
public static java.util.LinkedHashMap<java.lang.String,java.lang.Integer[]> getTiling(IOPort port)
Returns the tiling of this port.- Parameters:
port
- associated port- Returns:
- tiling
-
initialize
public static void initialize(IOPort port) throws IllegalActionException, NameDuplicationException
Reset the variable part of this type to the specified type.- Parameters:
port
- associated port- Throws:
IllegalActionException
- If the type is not settable, or the argument is not a Type.NameDuplicationException
- If the container already has an actor with this name.
-
modifyPattern
public static void modifyPattern(IOPort port, java.lang.String dim, int dimSize)
Modify the pattern of the specified port with one dimension (for propagate).- Parameters:
port
- associated portdim
- dimension namedimSize
- dimension size
-
modifyPattern
public static void modifyPattern(IOPort port, java.lang.String[] dims, int[] dimSizes)
Modify th pattern of the specified port with dimensions (after propagate).- Parameters:
port
- associated portdims
- dimension namesdimSizes
- dimension sizes
-
propagateHeader
public static void propagateHeader(IOPort portIn, java.lang.String[] dims, int[] sizes, int headersize, java.util.LinkedHashMap<java.lang.String,java.lang.Integer> arraySizes)
Propagate the header through application relations to update information.- Parameters:
portIn
- port used in input for propagesdims
- dimension namessizes
- dimension sizesheadersize
- added header sizearraySizes
- sizes used to compute iterations
-
propagateIterations
public static void propagateIterations(IOPort portIn, java.util.LinkedHashMap<java.lang.String,java.lang.Integer> sizes)
Update actor iterations according to pattern and tiling information.- Parameters:
portIn
- port used in input for propagessizes
- sizes used to compute iterations
-
setDataType
public static void setDataType(IOPort port)
Check if data type is a structure. If yes, gives the number of tokens needed to store all the data By default, the return value is 1- Parameters:
port
- associated port
-
-