pw::Domain

A domain is a computationally two-dimensional grid entity, bounded by one or more pw::Edges.  A grid surface.

Derives From

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

Summary
pw::DomainA domain is a computationally two-dimensional grid entity, bounded by one or more pw::Edges.
StaticActions
getAdjacentDomainsThis action returns a list of domains adjacent to the given domains.
getDomainsFromConnectorsThis action returns a list of domains that use the given connectors.
setSortOrderThis action sets the user specified sort order of domains.
getIntersectingCellsThis action determines the set of intersecting cells among the provided domains.
Instance Actions
deleteThis action deletes this domain.
initializeThis action initializes the interior points of this domain.
getDimensionsThis action gets the dimensions of this domain.
getPointThis action gets the position of a domain grid point.
setPointThis action sets the position of a domain interior grid point.
isInteriorIndexThis action checks to see if an index corresponds to a point in the interior of the domain.
getAdjacentIndicesThis action returns the indices that are directly connected to the specified index.
getPositionThis action gets a position in the defining space of the domain.
getXYZThis action gets a position of the domain in model space.
getCellCountThis action gets the number of cells in this domain.
getCellThis action gets the indices of the given cell.
getCellsUsingIndexReturns the indices of the cells whose connectivity includes the specified index.
getCellAverageEdgeLengthThis action gets the average edge length of the given cell.
getCellCentroidThis action gets the centroid of the given cell.
getCellAreaThis action gets the area of the given cell.
getEdgeCountThis action gets the number of edges in this domain.
getEdgeThis action gets the edge at the given index.
getEdgesThis action gets the edges of the domain.
addEdgeThis action adds an edge to the domain.
removeLastEdgeThis action removes the last edge added to this domain.
getDefaultProjectDirectionThis action gets the default projection direction for this domain.
createPeriodicThis action creates a periodic copy of this domain.
getPeriodicThis action gets the domain that shares a periodic link with this domain.
breakPeriodicThis action breaks the periodic link that this domain has with another domain.
isValidThis action checks to see if the domain has a valid edge definition.
isConstrainedThis action checks to see if the domain is database constrained.
getInteriorStateThis action gets the interior state of this domain.
getDatabaseEntitiesThis 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 optional flag, if present, restricts the results to only visible domains.
-nopolesThis optional flag excludes any domains that contain pole connectors.
domainsThis required 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 required 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 required 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)]

getIntersectingCells

pw::Domain getIntersectingCells domains

This action determines the set of intersecting cells among the provided domains.

Parameters

domainsThis required parameter is a list of pw::Domain objects.  The order they are provided in will be the order that intersected cells are returned in.

Returns

This action returns a list of lists, where each list contains the cell indices for cells that intersect.  Lists are returned in the order the domains were provided in.

Example

This example looks for cell intersections across all domains.  If intersecting cells are detected, they are marked with a point that is placed at the centroid of the intersecting cell.

Code

set domains [pw::Grid getAll -type pw::Domain]
set cells [pw::Domain getIntersectingCells $domains]
for {set i 0} {$i < [llength $domains]} {incr i} {
  set domain [lindex $domains $i]
  set intersected [lindex $cells $i]
  foreach cell $intersected {
    set point [pw::Point create]
    $point setPoint [$domain getCellCentroid $cell]
  }
}

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 required 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 required 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 required 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 required parameter is the integer linear index of the grid point to check with the range [1, number of points].

Returns

This action returns boolean 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 linear index regardless of the input form.
indexThis optional parameter is the integer linear index of the grid point with the range [1, number of points].
ij_indexThis optional parameter is the ij index of the point to get.

Information

Either index or ij_index must be specified.

Returns

This action returns a list of integer 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 required parameter is the integer 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 required parameter is the integer 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 required parameter is the integer index of the cell to get in 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

getCellsUsingIndex

$dom getCellsUsingIndex ?-linear? index

Returns the indices of the cells whose connectivity includes the specified index.

Parameters

-linearIf this optional flag is specified, the results will be a list of integer linear indices regardless of the input form.  This option is the default and is ignored for pw::DomainUnstructured objects.  It is present here only to maintain consistency with the form of the command used for pw::DomainStructured objects.
indexThis required parameter is the integer linear index of the grid point with the range [1, number of points].

Returns

This action returns a list of cell entries using the specified point.  Each cell entry is a list of integer point indices comprising the cell.

getCellAverageEdgeLength

$dom getCellAverageEdgeLength index

This action gets the average edge length of the given cell.

Parameters

indexThis required parameter is the integer index of the target cell in the range [1, number of cells].

Returns

This action returns a float.

getCellCentroid

$dom getCellCentroid index

This action gets the centroid of the given cell.

Parameters

indexThis required parameter is the integer index of the target cell in the range [1, number of cells].

Returns

This action returns an XYZ vector.

getCellArea

$dom getCellArea index

This action gets the area of the given cell.

Parameters

indexThis required parameter is the integer index of the target cell in the range [1, number of cells].

Returns

This action returns a float.

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 required parameter is the integer index of the edge to get in 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

getEdges

$dom getEdges

This action gets the edges of the domain.

Parameters

This action has no parameters.

Returns

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

Example

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

Code

puts [[[$dom(1) getEdges 1] lindex 0] getConnectorCount]

Output

6

addEdge

$dom addEdge edge

This action adds an edge to the domain.

Parameters

edgeThis required 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 normalized 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

-translate vectorThis optional parameter indicates that the periodic copy will be offset by the amount specified by the vector vector parameter.  The length of vector must be greater than zero.
-rotate point normal angleThis optional parameter indicates that the periodic copy will be rotated from the original about the origin specified by the vector point parameter and around the axis specified by the vector normal parameter by float angle degrees.

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.

Information

One of either -translate or -rotate options must be specified with appropriate arguments.

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 optional 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
An edge is part of a domain boundary, consisting of oriented, node-connected pw::Connector objects.
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.
pw::Domain getIntersectingCells domains
This action determines the set of intersecting cells among the provided 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 getCellsUsingIndex ?-linear? index
Returns the indices of the cells whose connectivity includes the specified index.
$dom getCellAverageEdgeLength index
This action gets the average edge length of the given cell.
$dom getCellCentroid index
This action gets the centroid of the given cell.
$dom getCellArea index
This action gets the area 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 getEdges
This action gets the edges of the domain.
$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
Base type for all grid entities.
A float is a fractional number.
A domain is a computationally two-dimensional grid entity, bounded by one or more pw::Edges.
A connector is a computationally one-dimensional grid entity, defined in the parameter space of one or more end-connected curve segments.
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.
A boolean is represented as a 0 or 1, with 0 being false and 1 being true.
An index is a list of integer values.
A vector is a list of float values.
An unstructured domain is a watertight collection of edge-connected surface elements (triangle, quadrilateral, etc.)
A structured domain is a computationally orthogonal surface grid bounded by exactly four edges, any of which can be degenerate in the zero dimension (pole).
Base type for all database entities
Close