pw:: Solver

The solver mode type

Derives From

pw::Object pw::Mode

Summary
The solver mode type
This action runs the solver.
This action resumes running the solver.
This action returns the number of steps completed by the last call to run or resume.
This action returns the list of entities completed by the last call to run or resume.
This action returns the list of entities failed by the last call to run or resume.

Instance Actions

run

$solver run ?-entities ents? ?method? ?steps?

This action runs the solver.

Parameters

-entities entsThis optional parameter is a subset of the entities in the solver mode to run the solver on.  If this parameter is not given the solver will be run on all the entities of the solver mode.
methodThis optional parameter is the method to run: Initialize | Refine | Decimate | Release | Smooth | Restart | PushAttributes | BoundaryAdaptation.  Not all methods may be valid for the current mode.
stepsThis optional parameter is the integer number of steps to run; The default is 1.  The solver will run until steps is reached, a stop is requested by the user, or some other stop condition is encountered.  This parameter is only valid for the pw.ExtrusionSolver or for the Smooth method of the <pw.UnstructureSolver> for blocks.

Returns

This action returns nothing.

Information

This command supports progress updates.  Unlike most commands that support progress updates, if the user aborts this command, instead of reverting to the previous state the entities being solved will be left as is.

Example

Code

proc putsBlkStats { solverBlks } {
foreach blk $solverBlks {
puts " [$blk getName]:"
set max [getExamineMetricMax $blk BlockMaximumAngle]
puts " Max included angle: $max"
set max [getExamineMetricMax $blk BlockVolumeRatio]
puts " Max volume ratio : $max"
}
}

# Given: $solver is an UnstructuredSolver mode

set steps 50
set solverBlks [$solver getEntities]

puts "Original block stats:"
putsBlkStats $solverBlks

puts ""
puts "Setting solver attributes:"
set colxn [pw::Collection create]
$colxn set $solverBlks
foreach {attr val} {WCNSmoothConvergenceCostThreshold 0.8
WCNSmoothCostAngleThreshold 170
WCNSmoothRelaxationFactor 0.1} {
puts " $attr = $val"
$colxn do setUnstructuredSolverAttribute $attr $val
}
$colxn delete
unset colxn

puts ""
puts "run all for ${steps}..."
$solver run Smooth $steps
putsBlkStats $solverBlks

set blk0 [lindex $solverBlks 0]
$blk0 setUnstructuredSolverAttribute WCNSmoothCostAngleThreshold 130
puts ""
puts "Setting WCNSmoothCostAngleThreshold 130 for [$blk0 getName]"

puts ""
puts "run [$blk0 getName] for ${steps}..."
$solver run -entities $blk0 Smooth $steps
putsBlkStats $solverBlks

Output

Original block stats:
UnsIsoBlk-1:
Max included angle: 164.0576313943714
Max volume ratio : 3.8617996452146452
UnsTRexBlk-1:
Max included angle: 177.40447357096951
Max volume ratio : 14.042823061362142

Setting solver attributes:
WCNSmoothConvergenceCostThreshold = 0.8
WCNSmoothCostAngleThreshold = 170
WCNSmoothRelaxationFactor = 0.1

run all for 50...
UnsIsoBlk-1:
Max included angle: 164.0576313943714
Max volume ratio : 3.8617996452146452
UnsTRexBlk-1:
Max included angle: 172.90386524033556
Max volume ratio : 14.042823061362142

Setting WCNSmoothCostAngleThreshold 130 for UnsIsoBlk-1

run UnsIsoBlk-1 for 50...
UnsIsoBlk-1:
Max included angle: 147.95440366197928
Max volume ratio : 5.084085202065618
UnsTRexBlk-1:
Max included angle: 172.90386524033556
Max volume ratio : 14.042823061362142

resume

$solver resume

This action resumes running the solver.  It does nothing if the solver has not been run yet, or if the previous run has completed.

Parameters

This action has no parameters.

Returns

This action returns nothing.

Information

This command supports progress updates.  Unlike most commands that support progress updates, if the user aborts this command, instead of reverting to the previous state the entities being solved will be left as is.

getCompletedSteps

$solver getCompletedSteps

This action returns the number of steps completed by the last call to run or resume.

Parameters

This action has no parameters.

Returns

This action returns the integer number of steps completed.

Information

The number of completed steps will only be valid when the previous solver run used the steps parameter.

When steps are run on structured blocks, the value returned is for all blocks processed.

When steps are run on unstructured or iso voxel blocks, the value returned is only for the last block processed.

getCompletedEntities

$solver getCompletedEntities

This action returns the list of entities completed by the last call to run or resume.

Parameters

This action has no parameters.

Returns

This action returns a list of pw::Entity objects that have been completed.

Information

The list of completed entities will only be populated if the previous solver run used the method parameter.

getFailedEntities

$solver getFailedEntities

This action returns the list of entities failed by the last call to run or resume.

Parameters

This action has no parameters.

Returns

This action returns a list of pw::Entity objects that failed.

Information

The list of failed entities will only be populated if the previous solver run used the method parameter.

$solver run ?-entities ents? ?method? ?steps?
This action runs the solver.
$solver resume
This action resumes running the solver.
$solver getCompletedSteps
This action returns the number of steps completed by the last call to run or resume.
$solver getCompletedEntities
This action returns the list of entities completed by the last call to run or resume.
$solver getFailedEntities
This action returns the list of entities failed by the last call to run or resume.
Base type for all glyph types
The mode base type
An integer is a whole number.
The extrusion solver mode type
Entity type