A domain is a computationally two-dimensional grid entity, bounded by one or more pw::Edges. A grid surface.
pw::Object pw::Entity pw::GridEntity
pw:: | A domain is a computationally two-dimensional grid entity, bounded by one or more pw::Edges. |
StaticActions | |
getAdjacentDomains | This action returns a list of domains adjacent to the given domains. |
getDomainsFromConnectors | This action returns a list of domains that use the given connectors. |
setSortOrder | This action sets the user specified sort order of domains. |
getIntersectingCells | This action determines the set of intersecting cells among the provided domains. |
Instance Actions | |
delete | This action deletes this domain. |
initialize | This action initializes the interior points of this domain. |
getDimensions | This action gets the dimensions of this domain. |
getPoint | This action gets the position of a domain grid point. |
setPoint | This action sets the position of a domain interior grid point. |
isInteriorIndex | This action checks to see if an index corresponds to a point in the interior of the domain. |
getAdjacentIndices | This action returns the indices that are directly connected to the specified index. |
getPosition | This action gets a position in the defining space of the domain. |
getXYZ | This action gets a position of the domain in model space. |
getCellCount | This action gets the number of cells in this domain. |
getCell | This action gets the indices of the given cell. |
getCellsUsingIndex | Returns the indices of the cells whose connectivity includes the specified index. |
getCellAverageEdgeLength | This action gets the average edge length of the given cell. |
getCellCentroid | This action gets the centroid of the given cell. |
getCellArea | This action gets the area of the given cell. |
getEdgeCount | This action gets the number of edges in this domain. |
getEdge | This action gets the edge at the given index. |
getEdges | This action gets the edges of the domain. |
addEdge | This action adds an edge to the domain. |
removeLastEdge | This action removes the last edge added to this domain. |
getDefaultProjectDirection | This action gets the default projection direction for this domain. |
createPeriodic | This action creates a periodic copy of this domain. |
getPeriodic | This action gets the domain that shares a periodic link with this domain. |
breakPeriodic | This action breaks the periodic link that this domain has with another domain. |
isValid | This action checks to see if the domain has a valid edge definition. |
isConstrained | This action checks to see if the domain is database constrained. |
getInteriorState | This action gets the interior state of this domain. |
getDatabaseEntities | This action gets all database entities the grid entity is using. |
pw::Domain getAdjacentDomains ?-maximumAngle angle? ?-all? ?-visibleOnly? domains
This action returns a list of domains adjacent to the given domains.
-maximumAngle angle | This optional parameter is a float maximum bend angle for considering entities as adjacent with the range [0, 180]. The default is 180. |
-all | This optional flag is a notification to continue looking for adjacent domains as new ones are added. |
-visibleOnly | This optional flag, if present, restricts the results to only visible domains. |
-nopoles | This optional flag excludes any domains that contain pole connectors. |
domains | This required parameter is a list of pw::Domain objects to be used as the seed. |
This action returns a list of adjacent pw::Domain objects.
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.
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.
pw::Domain getDomainsFromConnectors connectors
This action returns a list of domains that use the given connectors.
connectors | This required parameter is a list of pw::Connector objects. |
This action returns a list of pw::Domain objects.
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.
pw::Domain setSortOrder domains
This action sets the user specified sort order of domains.
domains | This required parameter is a list of pw::Domain objects and the order they should appear in for sorting. |
This action returns nothing.
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.
pw::Entity.sort, pw::Block.setSortOrder
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)]
pw::Domain getIntersectingCells domains
This action determines the set of intersecting cells among the provided domains.
domains | This 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. |
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.
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] } }
$dom delete ?-force? ?-connectors?
This action deletes this domain.
-force | This optional flag is the notification that the entity will be deleted as well as higher level entities that depend on this entity. |
-connectors | This optional flag is the notification that the connectors of this domain will also be deleted if this is the only domain they are in. |
This action returns nothing.
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
$dom getDimensions
This action gets the dimensions of this domain.
This action has no parameters.
This action returns the domain dimensions as a two element integer list. Unstructured domains have a second dimension of 1.
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
$dom getPoint ?-constrained constrainedVar? index
This action gets the position of a domain grid point.
index | This required parameter is the integer linear index of the grid point to get with the range [1, number of points]. |
-constrained constrainedVar | This 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. |
This action returns a point giving the grid point position (may be in the form “u v dbentity”).
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)
$dom setPoint index point
This action sets the position of a domain interior grid point.
index | This 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. |
point | This required parameter is the new point value of the grid point. |
This action returns nothing.
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" }
$dom isInteriorIndex index
This action checks to see if an index corresponds to a point in the interior of the domain.
index | This required parameter is the integer linear index of the grid point to check with the range [1, number of points]. |
This action returns boolean true if the index is an interior point.
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
$dom getAdjacentIndices ?-linear? < index | ij_index >
This action returns the indices that are directly connected to the specified index.
-linear | If this option is specified, the results will be a list of linear index regardless of the input form. |
index | This optional parameter is the integer linear index of the grid point with the range [1, number of points]. |
ij_index | This optional parameter is the ij index of the point to get. |
Either index or ij_index must be specified.
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.
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}
$dom getPosition ?-grid? value
This action gets a position in the defining space of the domain.
-grid | This 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. |
value | This required parameter is the integer value to get the position. |
This action returns a point giving the position on the domain (may be in the form “u v dbentity”).
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)
$dom getXYZ ?-grid? value
This action gets a position of the domain in model space.
-grid | This 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. |
value | This required parameter is the integer value to get the position. |
This action returns an XYZ vector.
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
$dom getCellCount
This action gets the number of cells in this domain.
This action has no parameters.
This action returns the integer number of cells.
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
$dom getCell index
This action gets the indices of the given cell.
index | This required parameter is the integer index of the cell to get in the range [1, number of cells]. |
This action returns a list of integer point indices.
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
$dom getCellsUsingIndex ?-linear? index
Returns the indices of the cells whose connectivity includes the specified index.
-linear | If 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. |
index | This required parameter is the integer linear index of the grid point with the range [1, number of points]. |
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.
$dom getEdgeCount
This action gets the number of edges in this domain.
This action has no parameters.
This action returns the integer number of edges.
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
$dom getEdge index
This action gets the edge at the given index.
index | This required parameter is the integer index of the edge to get in the range [1, number of edges]. |
This action returns a pw::Edge object.
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
$dom getEdges
This action gets the edges of the domain.
This action has no parameters.
This action returns a list of pw::Edge objects.
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
$dom addEdge edge
This action adds an edge to the domain.
edge | This required parameter is the pw::Edge to add. |
This action returns nothing.
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)
$dom removeLastEdge
This action removes the last edge added to this domain.
This action has no parameters.
This action returns nothing.
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)
$dom getDefaultProjectDirection
This action gets the default projection direction for this domain.
This action has no parameters.
This action returns a normalized vector.
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
$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.
-translate vector | This 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 angle | This 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. |
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.
One of either -translate or -rotate options must be specified with appropriate arguments.
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
$dom getPeriodic ?-transform matrixVar?
This action gets the domain that shares a periodic link with this domain.
-transform matrixVar | This optional parameter is the string name of the variable that receives a transform matrix for the periodic domain. |
This action returns a pw::Domain object if there is a periodic link, or an empty string if there is no periodic link.
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
$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.
This action has no parameters.
This action returns nothing.
This example shows how to break a periodic link between domains. $dom(1) is referencing an existing domain.
Code
$dom(1) breakPeriodic
$dom isValid
This action checks to see if the domain has a valid edge definition.
This action has no parameters.
This action returns a boolean.
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
$dom isConstrained
This action checks to see if the domain is database constrained.
This action has no parameters.
This action returns a boolean.
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
$domain getInteriorState
This action gets the interior state of this domain.
This action has no parameters.
This action returns a string interior state with options < Empty | Initialized | Refined >.
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
$entity getDatabaseEntities
This action gets all database entities the grid entity is using.
-solver | If 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. |
This action returns a list of pw::DatabaseEntity objects.
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
This action returns a list of domains adjacent to the given domains.
pw::Domain getAdjacentDomains ?-maximumAngle angle? ?-all? ?-visibleOnly? domains
This action returns a list of domains that use the given connectors.
pw::Domain getDomainsFromConnectors connectors
This action sets the user specified sort order of domains.
pw::Domain setSortOrder domains
This action determines the set of intersecting cells among the provided domains.
pw::Domain getIntersectingCells domains
This action deletes this domain.
$dom delete ?-force? ?-connectors?
This action initializes the interior points of this domain.
$dom initialize
This action gets the dimensions of this domain.
$dom getDimensions
This action gets the position of a domain grid point.
$dom getPoint ?-constrained constrainedVar? index
This action sets the position of a domain interior grid point.
$dom setPoint index point
This action checks to see if an index corresponds to a point in the interior of the domain.
$dom isInteriorIndex index
This action returns the indices that are directly connected to the specified index.
$dom getAdjacentIndices ?-linear? < index | ij_index >
This action gets a position in the defining space of the domain.
$dom getPosition ?-grid? value
This action gets a position of the domain in model space.
$dom getXYZ ?-grid? value
This action gets the number of cells in this domain.
$dom getCellCount
This action gets the indices of the given cell.
$dom getCell index
Returns the indices of the cells whose connectivity includes the specified index.
$dom getCellsUsingIndex ?-linear? index
This action gets the average edge length of the given cell.
$dom getCellAverageEdgeLength index
This action gets the centroid of the given cell.
$dom getCellCentroid index
This action gets the area of the given cell.
$dom getCellArea index
This action gets the number of edges in this domain.
$dom getEdgeCount
This action gets the edge at the given index.
$dom getEdge index
This action gets the edges of the domain.
$dom getEdges
This action adds an edge to the domain.
$dom addEdge edge
This action removes the last edge added to this domain.
$dom removeLastEdge
This action gets the default projection direction for this domain.
$dom getDefaultProjectDirection
This action creates a periodic copy of this domain.
$dom createPeriodic < -translate vector | -rotate point normal angle >
This action gets the domain that shares a periodic link with this domain.
$dom getPeriodic ?-transform matrixVar?
This action breaks the periodic link that this domain has with another domain.
$dom breakPeriodic
This action checks to see if the domain has a valid edge definition.
$dom isValid
This action checks to see if the domain is database constrained.
$dom isConstrained
This action gets the interior state of this domain.
$domain getInteriorState
This action gets all database entities the grid entity is using.
$entity getDatabaseEntities
This action sorts the given entities.
pw::Entity sort entities
This action sets the user specified sort order of blocks.
pw::Block setSortOrder blocks
This action deletes the given entities.
pw::Entity delete entities