There are four sub-matrix classes, one for each concrete matrix class:
ComplexSubMatrix
, FixSubMatrix
, FloatSubMatrix
, and IntSubMatrix
, each of which inherits from the corresponding PtMatrix
class. A sub-matrix contains a reference to a "parent" matrix of the same type, and modifies its internal data pointers and matrix size parameters to reference a rectangular region of the parent's data. The constructors for the submatrix classes have arguments that specify the region of the parent matrix referenced by the sub-matrix.As for matrices, the description of sub-matrices uses the convention that
XXX
means Complex
, Fix
, Float
, or Int
, and xxx
means Complex
, Fix
, double
, or int
. The submatrix constructors are:
XXXSubMatrix()
XXXSubMatrix(int numRow, int numCol)
numRow
by numCol
; return a new submatrix with this matrix as its parent. Memory is allocated for the data storage but the entries are uninitialized.XXXSubMatrix(XXXSubMatrix& src, int sRow, int sCol, int nRow, int nCol)
sRow
, sCol
) and of size (nRow
, nCol
). The parent matrix is the same as the parent matrix of src
. The given dimensions must fit into the parent matrix, or an error will be flagged. Unlike the "sub-matrix" constructors in the regular matrix classes, this constructor does not copy matrix data.XXXSubMatrix(const XXXSubMatrix& src)
src
sub-matrix. The parent of the new matrix is the same as the parent of src
.entry()
and operator
[]
member functions to access the data, the sub-matrix classes need only to override these functions, and all matrix operations become available on sub-matrices.
xxx& entry(int i)
i
th entry of the sub-matrix when its data storage is considered to be a linear array.xxx* operator [] (int row)
$PTOLEMY/src/domains/mdsdf/kernel
and $PTOLEMY/src/domains/mdsdf/stars
.Unlike other domains, the MDSDF kernel does not transfer particles through FIFO buffers. Instead, each geodesic keeps a single copy of a "parent" matrix, that represents the "current" two-dimensional datablock. Each time a star fires, it obtains a sub-matrix that references this parent matrix with the
getOutput()
function of the MDSDF input port class. For example, a star might contain:
setMDSDFParams()
function of the port.To write data to the output matrix, the star gets a sub-matrix which references a region of the current output matrix and writes to it with a matrix operator. For example,
ptlang
type of submatrices is FLOAT_MATRIX
, INT_MATRIX
, and so on. (This is not documented in the User's Manual and is likely to change in a future release.) Each of these ptlang types is implemented by a sub-class of Particle: IntMatrixParticle
, FloatMatrixParticle
, FixMatrixParticle
and ComplexMatrixParticle
. These particle classes exist only for setting up the portholes and performing type-checking-they are never created or passed around during a simulation. Instead, sub-matrices are created and destroyed by the MDSDF kernel and stars as described above.
Message
type, described above. A library of stars that uses these image data types can be found in the image library of the DE domain.This set of classes is being replaced by the
PtMatrix
classes, and the SDF image classes now all use PtMatrix
. We give here a brief introduction to the image data types used in the DE domain, although new work should consider using PtMatrix
classes instead. Class definitions can be found in $PTOLEMY/src/domains/de/kernel
.The base class of all the image classes is called
BaseImage
. It has some generic methods and members for manipulating images. Most of the methods are redefined in the derived classes. The fragment
method partitions an image into many smaller images, which together represent the same picture as the original. The assemble
method combines many small images which make up a single picture into a single image that contains the picture. The fragment
method works recursively, so an image that has been produced by a previous fragment
call can be further fragmented. Assembly always produces a full-sized image from fragments, however small.Use of the
size
, fullSize
, and startPos
members varies within each subclass. Typically the size
variable holds the number of pixels that an object is storing. If an object is not produced by fragment()
, then (size == fullSize
). If the object is produced by a fragment()
call, size
may be less than or equal to fullSize
. An objects's fullSize
may be bigger or smaller than width*height
. It would be bigger, for example, in DCTImage
, where the amount of allocated storage must be rounded up to be a multiple of the blocksize. It would be smaller, for example, for an object that contains run-length coded video.The
frameId
variable is used during assembly. Fragments with the same frameId
's are assembled into the same image. So, it is important that different frames from the same source have different frameIds.The comparison functions {
==
, !=
, <
, >
, etc.} compare two objects' frameId
's. They can be used to resequence images or to sort image fragments.The copy constructor and
clone
methods have an optional integer argument. If a nonzero argument is provided, then all state values of the copied object are copied to the created object, but none of the image data is copied. If no argument or a zero argument is provided, then the image data is copied as well. Classes derived from BaseImage
should maintain this policy.The
GrayImage
class, derived from BaseImage
, is used to represent gray-scale images. The DCTImage
class is used to represent images or image fragments that have been encoded using the discrete-cosine transform. The MVImage
class is a bit more specialized; it stores a frame's worth of motion vectors.
pigi
and ptlang
. We recommend that users create their own types using the mechanism described in
"Defining New Data Types" on page 4-14. This approach has the disadvantage that all user-defined types are seen by pigi
and ptlang
as being of type "message." If this is not acceptable, then it is possible to create your own first-class types by sub-classing Particle and adding the new types to VEM. The following instructions briefly describes this process. We stress, however, that this method is not officially supported and that types created this way will probably have to be reworked in a future release of Ptolemy. You will need to use some other color-say fileColor
-as a sample to follow when modifying the various source files.
Particle
and Message
. Use the classes in $PTOLEMY/src/kernel/FileMessage.h/cc
and $PTOLEMY/src/kernel/FileParticle.{h,cc}
as examples. You will need to create a static instance of your Particle
and static Plasma
and PlasmaGate
instances to hold your particles, as demonstrated by FileParticle
.
$PTOLEMY/src/pigilib/mkTerm.c
. There are three switch statements where you will need to insert a new case.
$PTOLEMY/lib/colors/ptolemy
, edit bw.pat
and colors.pat
to add the new color. The color is in RBG format, with 1000 being full-scale.
installColors
program. It will ask you a series of mysterious and strangely beautiful questions. To start with, use the defaults, except for "Output display type", where you answer GENERIC-COLOR
. Run the same program again with the following output display types: GENERIC-BW
, Postscript-Color
, and Postscript-BW
.
pigi
is started with the -bw
option), repeat the above, but specify $PTOLEMY/lib/colors/ptolemy/bw.pat
as the pattern file, $PTOLEMY/lib/bw_patterns
as the directory in which to install, GENERIC-COLOR
as the display device, and answer YES
to the question about color output device.
pigilib
and restarting, create an icon for a star that has your new type as an input or output. The terminal should be of the new color.