Skip to main content

ZOS-API interface 2024 R2 SP02

ZOSAPI.Tools.Optimization.IHammerOptimization Interface Reference

Last update: 17.07.2025

Interfaces and methods for running a Hammer Optimization. This interface can be accessed via the IOpticalSystemTools interface. More...

Inheritance diagram for ZOSAPI.Tools.Optimization.IHammerOptimization:

Public Member Functions

bool EstimateHPCTime ()
 
- Public Member Functions inherited from ZOSAPI.Tools.ISystemTool
bool Run ()
 Start the tool. Note that for synchronous tools (see IsAsynchronous), this call will block until completion. If it is asynchronous it will start running but return immediately.
 
bool RunAndWaitForCompletion ()
 Sames as calling Run followed by WaitForCompletion.
 
bool WaitForCompletion ()
 Waits for the asynchronous tool to complete.
 
bool Cancel ()
 Cancels the currently running asynchronous tool.
 
bool Close ()
 Closes this tool and frees up and associated resources.
 
RunStatus WaitWithTimeout (double timeOutSeconds)
 Waits for the currently running tool to complete, with a specified time out value. Note that if the timeout is exceeded this method will return, however the tool will continue to run. Also note that this method will not start the tool running if it is not already.
 
RunStatus RunAndWaitWithTimeout (double timeOutSeconds)
 Starts the tool running, and waits for it to complete with the specified timeout value. Note that if the timeout is exceeded this method will return, however the tool will continue to run.
 

Properties

OptimizationAlgorithm Algorithm [get, set]
 
int NumberOfCores [get, set]
 
int MaxCores [get]
 
bool AutomaticOptimization [get, set]
 
int Targets [get]
 
int Variables [get]
 
double InitialMeritFunction [get]
 
double CurrentMeritFunction [get]
 
long Systems [get]
 
bool IsHPCEnabled [get]
 
double HPCEstimatedTimeS [get]
 
double HPCRemainingTimeS [get]
 
double HPCTimeToStartS [get]
 
int HPCQueuePosition [get]
 
HPCRunState HPCState [get]
 
bool HPCHasTimeEstimate [get]
 
double TargetRunTimeM [get, set]
 
- Properties inherited from ZOSAPI.Tools.ISystemTool
int Progress [get]
 Gets the progress of the current tool, if supported.
 
string Status [get]
 Gets the status of the current tool, if supporoted.
 
bool IsRunning [get]
 Gets a value indicating whether the tool is currently running asynchronously.
 
bool CanCancel [get]
 Gets a value indicating whether the tool can be cancelled.
 
bool IsAsynchronous [get]
 Gets a value indicating whether the tool runs asynchronously (i.e. on a thread).
 
bool IsFiniteDuration [get]
 Gets a value indicating whether this tool will complete on its own.
 
bool IsValid [get]
 Gets a value indicating whether the input settings are valid.
 
bool Succeeded [get]
 Gets a value indicating whether the tool execution succeeded.
 
string ErrorMessage [get]
 If Succeeded is false, get the error messages; otherwise, null.
 

Detailed Description

Interfaces and methods for running a Hammer Optimization. This interface can be accessed via the IOpticalSystemTools interface.

Usage (see Example 03 for a full sample)

C#

// Hammer for 10 seconds
Console.WriteLine("Running Hammer for 10 seconds");
IHammerOptimization HammerOpt = TheSystem.Tools.OpenHammerOptimization();
HammerOpt.RunAndWaitWithTimeout(10); // 10s of Hammer
HammerOpt.Cancel();
HammerOpt.WaitForCompletion();
HammerOpt.Close();
bool Close()
Closes this tool and frees up and associated resources.
bool Cancel()
Cancels the currently running asynchronous tool.
bool WaitForCompletion()
Waits for the asynchronous tool to complete.
RunStatus RunAndWaitWithTimeout(double timeOutSeconds)
Starts the tool running, and waits for it to complete with the specified timeout value....
Interfaces and methods for running a Hammer Optimization. This interface can be accessed via the IOpt...
Definition: Optimization.cs:170

C++

// Hammer for 10 seconds
IHammerOptimizationPtr HammerOpt = TheSystem->Tools->OpenHammerOptimization();
baseTool = HammerOpt;
baseTool->RunAndWaitWithTimeout(10);
baseTool->Cancel();
baseTool->WaitForCompletion();
baseTool->Close();

Matlab

% Hammer for 10 seconds
HammerOpt = TheSystem.Tools.OpenHammerOptimization();
HammerOpt.RunAndWaitWithTimeout(10);
HammerOpt.Cancel();
HammerOpt.WaitForCompletion();
HammerOpt.Close();

Python

# Hammer for 10 seconds
# need to 'import time' at the top of the file to use the pause function
print('Running Hammer Optimization')
HammerOpt = TheSystem.Tools.OpenHammerOptimization()
HammerOpt.RunAndWaitWithTimeout(10)
HammerOpt.Cancel()
HammerOpt.WaitForCompletion()
HammerOpt.Close()
Examples
CSharpStandalone_03_open_file_and_optimise.cs, and CSharpStandalone_15_Seq_Optimization.cs.

Member Function Documentation

◆ EstimateHPCTime()

bool ZOSAPI.Tools.Optimization.IHammerOptimization.EstimateHPCTime ( )

Property Documentation

◆ Algorithm

OptimizationAlgorithm ZOSAPI.Tools.Optimization.IHammerOptimization.Algorithm
getset

◆ AutomaticOptimization

bool ZOSAPI.Tools.Optimization.IHammerOptimization.AutomaticOptimization
getset

◆ CurrentMeritFunction

double ZOSAPI.Tools.Optimization.IHammerOptimization.CurrentMeritFunction
get

◆ HPCEstimatedTimeS

double ZOSAPI.Tools.Optimization.IHammerOptimization.HPCEstimatedTimeS
get

◆ HPCHasTimeEstimate

bool ZOSAPI.Tools.Optimization.IHammerOptimization.HPCHasTimeEstimate
get

◆ HPCQueuePosition

int ZOSAPI.Tools.Optimization.IHammerOptimization.HPCQueuePosition
get

◆ HPCRemainingTimeS

double ZOSAPI.Tools.Optimization.IHammerOptimization.HPCRemainingTimeS
get

◆ HPCState

HPCRunState ZOSAPI.Tools.Optimization.IHammerOptimization.HPCState
get

◆ HPCTimeToStartS

double ZOSAPI.Tools.Optimization.IHammerOptimization.HPCTimeToStartS
get

◆ InitialMeritFunction

double ZOSAPI.Tools.Optimization.IHammerOptimization.InitialMeritFunction
get

◆ IsHPCEnabled

bool ZOSAPI.Tools.Optimization.IHammerOptimization.IsHPCEnabled
get

◆ MaxCores

int ZOSAPI.Tools.Optimization.IHammerOptimization.MaxCores
get

◆ NumberOfCores

int ZOSAPI.Tools.Optimization.IHammerOptimization.NumberOfCores
getset

◆ Systems

long ZOSAPI.Tools.Optimization.IHammerOptimization.Systems
get

◆ TargetRunTimeM

double ZOSAPI.Tools.Optimization.IHammerOptimization.TargetRunTimeM
getset

◆ Targets

int ZOSAPI.Tools.Optimization.IHammerOptimization.Targets
get

◆ Variables

int ZOSAPI.Tools.Optimization.IHammerOptimization.Variables
get

Connect with Ansys