pw:: Domain

Domain type

Derives From

pw::Object pw::Entity pw::GridEntity

Summary
Domain type
This action returns a list of domains adjacent to the given domains.
This action returns a list of domains that use the given connectors.
This action sets the user specified sort order of domains.
This action deletes this domain.
This action initializes the interior points of this domain.
This action gets the dimensions of this domain.
This action gets the position of a domain grid point.
This action sets the position of a domain interior grid point.
This action checks to see if an index corresponds to a point in the interior of the domain.
This action returns the indices that are directly connected to the specified index.
This action gets a position in the defining space of the domain.
This action gets a position of the domain in model space.
This action gets the number of cells in this domain.
This action gets the indices of the given cell.
This action gets the number of edges in this domain.
This action gets the edge at the given index.
This action adds an edge to the domain.
This action removes the last edge added to this domain.
This action gets the default projection direction for this domain.
This action creates a periodic copy of this domain.
This action gets the domain that shares a periodic link with this domain.
This action breaks the periodic link that this domain has with another domain.
This action checks to see if the domain has a valid edge definition.
This action checks to see if the domain is database constrained.
This action gets the interior state of this domain.
This action gets all database entities the grid entity is using.

StaticActions

getAdjacentDomains

pw::Domain getAdjacentDomains ?-maximumAngle angle? ?-all? ?-visibleOnly? domains

This action returns a list of domains adjacent to the given domains.

Parameters

-maximumAngle angleThis optional parameter is a float maximum bend angle for considering entities as adjacent with the range [0, 180].  The default is 180.
-allThis optional flag is a notification to continue looking for adjacent domains as new ones are added.
-visibleOnlyThis flag, if present, restricts the results to only visible domains.
-nopolesExcludes any domains that contain pole connectors.
domainsThis parameter is a list of pw::Domain objects to be used as the seed.

Returns

This action returns a list of adjacent pw::Domain objects.

Information

If the -all flag is specified, the process is repeated until no more adjacent domains are found.

The return list will not include any domains specified in the argument list.

Example

This example shows how to get all adjacent domains to the given domain and any other domains that are found and then find their total cell count.  $dom(1) is referencing an existing domain.

Code

set doms [pw::Domain getAdjacentDomains -all $dom(1)]
set count [$dom(1) getCellCount]
foreach d $doms {
set count [expr {[$d getCellCount] + $count}]
}
puts "[expr {[llength $doms] + 1}] domains have $count cells."

Output

22 domains have 10978 cells.

getDomainsFromConnectors

pw::Domain getDomainsFromConnectors connectors

This action returns a list of domains that use the given connectors.

Parameters

connectorsThis parameter is a list of pw::Connector objects.

Returns

This action returns a list of pw::Domain objects.

Example

This example shows how to get the domains used by a list of given connectors and join as many of them as possible (for unstructured).  $con(1) and $con(2) are referencing existing connectors.

Code

set doms \
[pw::Domain getDomainsFromConnectors [list $con(1) $con(2)]]
pw::DomainUnstructured join -reject rjDoms $doms
puts "[expr {[llength $doms]-[llength $rjDoms]}] domains of the \
[llength $doms] found were joined."

Output

3 domains of the 3 found were joined.

setSortOrder

pw::Domain setSortOrder domains

This action sets the user specified sort order of domains.

Parameters

domainsThis parameter is a list of pw::Domain objects and the order they should appear in for sorting.

Returns

This action returns nothing.

Information

Any domains that are not in the given list, or that are created after calling this command will be placed after these entities in the sort order by the pw::Entity.sort action.

See Also

pw::Entity.sort, pw::Block.setSortOrder

Example

This example shows how to set the sort order of several domains.  If the pw::Entity.sort command is called later after more domains are created, these domains will be sorted first and then the newer placed after them.  $dom(1), $dom(2) and $dom(3) are referencing existing domains.

Code

pw::Domain setSortOrder [list $dom(2) $dom(3) $dom(1)]

Instance Actions

delete

$dom delete ?-force? ?-connectors?

This action deletes this domain.

Parameters

-forceThis optional flag is the notification that the entity will be deleted as well as higher level entities that depend on this entity.
-connectorsThis optional flag is the notification that the connectors of this domain will also be deleted if this is the only domain they are in.

Returns

This action returns nothing.

See Also

pw::Entity.delete

Example

This example shows how to delete a domain, as well as the blocks it is apart of.  $dom(1) is referencing an existing domain.

Code

$dom(1) delete -force

initialize

$dom initialize

This action initializes the interior points of this domain.

Parameters

This action has no parameters.

Returns

This action returns nothing.

Example

This example shows how to initialize a domain.  $dom(1) is referencing an existing domain.

Code

$dom(1) initialize

getDimensions

$dom getDimensions

This action gets the dimensions of this domain.

Parameters

This action has no parameters.

Returns

This action returns the domain dimensions as a two element integer list.  Unstructured domains have a second dimension of 1.

Example

This example shows how to get the dimension of an unstructured domain.  This will return the number of points in the unstructured domain as the first element.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) getDimensions]

Output

262 1

getPoint

$dom getPoint ?-constrained constrainedVar? index

This action gets the position of a domain grid point.

Parameters

indexThis parameter is the integer linear index of the grid point to get with the range [1, number of points].
-constrained constrainedVarThis optional parameter is the string name of a variable.  If the grid point is database constrained, this variable is set to true.  If not constrained, it is set to false.

Returns

This action returns a point giving the grid point position (may be in the form “u v dbentity”).

Example

This example shows how to get position of a domain grid point.  The first output is from a domain that is not database constrained; the second is from a domain that is database constrained.  $dom(1) is referencing an existing domain.

Code

puts [pw::Application getDescription [$dom(1) getPoint 35]]

Output

(26.2092,-10.3035,11.6549)
Outer-Surf-3 (1,0.571429)

setPoint

$dom setPoint index point

This action sets the position of a domain interior grid point.

Parameters

indexThis parameter is the integer linear index of the target grid point to set with the range [1, number of points].  The index must be for an interior grid point.
pointThis parameter is the new point value of the grid point.

Returns

This action returns nothing.

Example

This example shows how to set an interior grid point on a domain; it checks to see if it is an interior grid point first.  $dom(1) is referencing an existing domain.

Code

if [$dom(1) isInteriorIndex 35] {
$dom(1) setPoint 35 "26 -5 13"
}

isInteriorIndex

$dom isInteriorIndex index

This action checks to see if an index corresponds to a point in the interior of the domain.

Parameters

indexThis parameter is the integer linear index of the grid point to check with the range [1, number of points]

Returns

This action returns true if the index is an interior point.

Example

This example shows how to check to see if an index is an interior point.  In this case, it is not.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) isInteriorIndex 35]

Output

0

getAdjacentIndices

$dom getAdjacentIndices ?-linear? < index | ij_index >

This action returns the indices that are directly connected to the specified index.

Parameters

-linearIf this option is specified, the results will be a list of integer linear indices regardless of the input form.
indexThis parameter is the integer linear index of the grid point with the range [1, number of points].
ij_indexThis parameter is the ij index of the point to get.

Returns

This action returns a list of indices representing the adjacent coordinates.  The form of each index will be the same as the input form.  If index is used or -linear is specified, the result will be a list of integer linear indices.  If ij_index is used and -linear is not specified, the result will be a list of ij indices.

Example

This example shows how to get the adjacent indices on an unstructured domain.  The ij_index for an unstructured domain has a second index of 1.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) getAdjacentIndices {150 1}]

Output

{151 1} {152 1} {182 1} {184 1} {198 1}

getPosition

$dom getPosition ?-grid? value

This action gets a position in the defining space of the domain.

Parameters

-gridThis optional flag is the notification to get the position at a grid point.  The value is an integer linear index with the range [1, number of points].  This is the default.
valueThis parameter is the value to get the position.

Returns

This action returns a point giving the position on the domain (may be in the form “u v dbentity”).

Example

This example shows how to get the position of a grid point in a domain.  $dom(1) is referencing an existing domain.

Code

puts [pw::Application getDescription \
[$dom(1) getPosition -grid 100]]

Output

Outer-Surf-3 (0.393111,0.0775636)

getXYZ

$dom getXYZ ?-grid? value

This action gets a position of the domain in model space.

Parameters

-gridThis optional parameter is the notification to get the position at a grid point.  The value is an integer index with the range [1, number of points].  This is the default.
valueThis parameter is the value to get the position.

Returns

This action returns an XYZ vector.

Example

This example shows how to get the XYZ vector of a grid point in a domain.  $dom(1) references an existing domain.

Code

puts [$dom(1) getXYZ -grid 100]]

Output

0 7.86223 1.55127

getCellCount

$dom getCellCount

This action gets the number of cells in this domain.

Parameters

This action has no parameters.

Returns

This action returns the integer number of cells.

Example

This example shows how to get the number of cells in a domain.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) getCellCount]

Output

466

getCell

$dom getCell index

This action gets the indices of the given cell.

Parameters

indexThis parameter is the integer index of the cell to get with the range [1, number of cells].

Returns

This action returns a list of integer point indices.

Example

This example shows how to get the indices for a cell.  The first output is for unstructured and the second is for structured.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) getCell 55]

Output

78 135 136
56 57 87 86

getEdgeCount

$dom getEdgeCount

This action gets the number of edges in this domain.

Parameters

This action has no parameters.

Returns

This action returns the integer number of edges.

Example

This example shows how to get the number of edges in a domain.  In this case, the domain is structured.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) getEdgeCount]

Output

4

getEdge

$dom getEdge index

This action gets the edge at the given index.

Parameters

indexThis parameter is the integer index of the edge to get with the range [1, number of edges].

Returns

This action returns a pw::Edge object.

Example

This example shows how to get a edge and then find the connector count of that edge.  In this case, the domain is unstructured, so the single edge has multiple connectors.  $dom(1) is referencing an existing domain.

Code

puts [[$dom(1) getEdge 1] getConnectorCount]

Output

6

addEdge

$dom addEdge edge

This action adds an edge to the domain.

Parameters

edgeThis parameter is the pw::Edge to add.

Returns

This action returns nothing.

See Also

pw::Edge

Example

This example shows how to add edges to a structured domain.  $edge(1), $edge(2), $edge(3) and $edge(4) are referencing existing edges.

Code

set dom(1) [pw::DomainStructured create]
$dom(1) addEdge $edge(1)
$dom(1) addEdge $edge(2)
$dom(1) addEdge $edge(3)
$dom(1) addEdge $edge(4)

removeLastEdge

$dom removeLastEdge

This action removes the last edge added to this domain.

Parameters

This action has no parameters.

Returns

This action returns nothing.

Example

This example shows how to remove the last edge added to a structured domain and then add a different edge in its place.  $dom(1) and $edge(5) are referencing an existing domain and edge.

Code

$dom(1) removeLastEdge
$dom(1) addEdge $edge(5)

getDefaultProjectDirection

$dom getDefaultProjectDirection

This action gets the default projection direction for this domain.

Parameters

This action has no parameters.

Returns

This action returns a vector.

Example

This example shows how to get the default projection direction for the given domain.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) getDefaultProjectDirection]

Output

6.948464792806903e-17 0.0 1.0

createPeriodic

$dom createPeriodic < -translate vector | -rotate point normal angle >

This action creates a periodic copy of this domain.  This action will fail if the domain is already part of a periodic pair or if any of its connectors are part of a different periodic transformation.

Parameters

-translateThis flag indicates that the periodic copy will be offset by the amount specified by the vector parameter.
vectorThis parameter is a translation vector that is applied to the new domain.  The length must be greater than zero.
-rotateThis flag indicates that the periodic copy will be rotated from the original about the origin specified by the point parameter and around the axis specified by the normal parameter by angle degrees.
pointThis parameter is the point of the axis to rotate the new domain.
normalThis parameter is the normal of the axis to rotate the new domain.  The normal must be non-zero.
angleThis parameter is the number of degrees to rotate the new domain.  The angle must be non-zero and not a multiple of 360.

Returns

This action returns a new pw::Domain object.  Under certain circumstances (such as the transform resulting in conflicting mappings in the domain’s connectors), the copy will be created but the periodic link will be broken.  Call getPeriodic to verify the periodicity.

Example

This example shows how to create a periodic copy of a domain via translation and find the layer it is in.  $dom(1) is referencing an existing domain.

Code

set dom(2) [$dom(1) createPeriodic -translate "5 5 0"]
puts [$dom(2) getLayer]

Output

0

getPeriodic

$dom getPeriodic ?-transform matrixVar?

This action gets the domain that shares a periodic link with this domain.

Parameters

-transform matrixVarThis optional parameter is the string name of the variable that receives a transform matrix for the periodic domain.

Returns

This action returns a pw::Domain object if there is a periodic link, or an empty string if there is no periodic link.

Example

This example shows how to get the domain that has a periodic link with the given domain.  $dom(1) is referencing an existing domain.

Code

puts [[$dom(2) getPeriodic] getName]

Output

dom-1

breakPeriodic

$dom breakPeriodic

This action breaks the periodic link that this domain has with another domain.  This action has no effect if the domain was not part of a periodic pair.

Parameters

This action has no parameters.

Returns

This action returns nothing.

Example

This example shows how to break a periodic link between domains.  $dom(1) is referencing an existing domain.

Code

$dom(1) breakPeriodic

isValid

$dom isValid

This action checks to see if the domain has a valid edge definition.

Parameters

This action has no parameters.

Returns

This action returns a boolean.

Example

This examples shows how to check to see if a domain has a valid edge distribution.  This returns invalid because the structured domain only has 3 edges added to it.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) isValid]

Output

0

isConstrained

$dom isConstrained

This action checks to see if the domain is database constrained.

Parameters

This action has no parameters.

Returns

This action returns a boolean.

Example

This example checks to see if the domain is database constrained.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) isConstrained]

Output

0

getInteriorState

$domain getInteriorState

This action gets the interior state of this domain.

Parameters

This action has no parameters.

Returns

This action returns a string interior state with options < Empty | Initialized | Refined >.

Example

This example shows how to get the state of a domain.  $dom(1) is referencing an existing domain.

Code

puts [$dom(1) getInteriorState]

Output

Initialized

getDatabaseEntities

$entity getDatabaseEntities

This action gets all database entities the grid entity is using.

Parameters

-solverIf this flag is specified, the command restricts the list of of database entities to those that are suitable for use in the grid solver.  This may be different from the list of entities explicitly specified via the solver attribute commands.

Returns

This action returns a list of pw::DatabaseEntity objects.

Example

This example shows how to get the number of database entities the given grid entity is using.  $dom(1) is referencing an existing domain.

Code

puts [llength [$dom(1) getDatabaseEntities]]

Output

2
pw::Domain getAdjacentDomains ?-maximumAngle angle? ?-all? ?-visibleOnly? domains
This action returns a list of domains adjacent to the given domains.
pw::Domain getDomainsFromConnectors connectors
This action returns a list of domains that use the given connectors.
pw::Domain setSortOrder domains
This action sets the user specified sort order of domains.
$dom delete ?-force? ?-connectors?
This action deletes this domain.
$dom initialize
This action initializes the interior points of this domain.
$dom getDimensions
This action gets the dimensions of this domain.
$dom getPoint ?-constrained constrainedVar? index
This action gets the position of a domain grid point.
$dom setPoint index point
This action sets the position of a domain interior grid point.
$dom isInteriorIndex index
This action checks to see if an index corresponds to a point in the interior of the domain.
$dom getAdjacentIndices ?-linear? < index | ij_index >
This action returns the indices that are directly connected to the specified index.
$dom getPosition ?-grid? value
This action gets a position in the defining space of the domain.
$dom getXYZ ?-grid? value
This action gets a position of the domain in model space.
$dom getCellCount
This action gets the number of cells in this domain.
$dom getCell index
This action gets the indices of the given cell.
$dom getEdgeCount
This action gets the number of edges in this domain.
$dom getEdge index
This action gets the edge at the given index.
$dom addEdge edge
This action adds an edge to the domain.
$dom removeLastEdge
This action removes the last edge added to this domain.
$dom getDefaultProjectDirection
This action gets the default projection direction for this domain.
$dom createPeriodic < -translate vector | -rotate point normal angle >
This action creates a periodic copy of this domain.
$dom getPeriodic ?-transform matrixVar?
This action gets the domain that shares a periodic link with this domain.
$dom breakPeriodic
This action breaks the periodic link that this domain has with another domain.
$dom isValid
This action checks to see if the domain has a valid edge definition.
$dom isConstrained
This action checks to see if the domain is database constrained.
$domain getInteriorState
This action gets the interior state of this domain.
$entity getDatabaseEntities
This action gets all database entities the grid entity is using.
Base type for all glyph types
Entity type
A float is a fractional number.
Domain type
Connector type
pw::Entity sort entities
This action sorts the given entities.
pw::Block setSortOrder blocks
This action sets the user specified sort order of blocks.
pw::Entity delete entities
This action deletes the given entities.
An integer is a whole number.
A string is an array of characters.
A point is a position either in model space or database parameter space.
An index is a list of integer values.
A vector is a list of float values.
Edge type
A boolean is represented as a 0 or 1, with 0 being false and 1 being true.
Base type for all database entities