Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

CreateCustomModel Class Reference

Last update: 16.07.2025

This class creates a custom model definable in python. It is able to register an instance derived of CreateCustomModelInterface. This registered instance may then be accessed just like any other model. It may also be serialized and de-serialized. More...

Public Member Functions

virtual string __str__ ()
 Output function used in python context. Use this function to print instances of this class in python. More...
 
virtual addProperty (PropertyBase p)
 Properties that help the ScalarMOP scheduling the Models to be built The properties class needs to be implemented for the specific model type.
 
ModelBasecompute (::data_handler::DataHandlerBase datahandler, TrainingPlanBase training_plan, quality_measure::QualityMeasureBase quality_measure, CancelBase *cancel=nullptr) override
 Builds the model from the given samples and returns the model. More...
 
 CreateCustomModel ()
 Creates an default initialized instance of this class.
 
 CreateCustomModel (CreateCustomModel)
 Copies an instance of this class.
 
virtual bool equals (CreateModelBase other) override
 Checking if the given configurations are equal this this instance. More...
 
virtual PropertyList getProperties ()
 Returns the properties stored by this user.
 
bool hasRegisteredCreateModel ()
 Returns true iff this instance has a Python object connected to it via the registerCreateModel function. More...
 
virtual bool isValid (::data_handler::DataHandlerBase datahandler, TrainingPlanBase training_plan) override
 Destroys an instance of this class. More...
 
virtual loadJson (JsonValue root) override
 Function to load the Serializables data from a JsonValue. More...
 
CreateCustomModel operator= (CreateCustomModel)
 Copies an instance of this class.
 
virtual JsonValue saveJson () override
 Function to save the Serializables data as a JsonValue. More...
 
virtual transferProperties (PropertyList property_list)
 Convenience function to transfer a complete PropertyList into the model. More...
 

Public Attributes

apply SWIGTYPE * DISOWN
 
string id
 
string node_name
 
string working_dir
 

Detailed Description

This class creates a custom model definable in python. It is able to register an instance derived of CreateCustomModelInterface. This registered instance may then be accessed just like any other model. It may also be serialized and de-serialized.

Member Function Documentation

◆ __str__()

virtual string __str__ ( )
virtual

Output function used in python context. Use this function to print instances of this class in python.

Returns
string containing the object

Reimplemented from CreateModelBase.

◆ compute()

ModelBase* compute ( ::data_handler::DataHandlerBase  datahandler,
TrainingPlanBase  training_plan,
quality_measure::QualityMeasureBase  quality_measure,
CancelBase cancel = nullptr 
)
overridevirtual

Builds the model from the given samples and returns the model.

Parameters
datahandlerThe datahandler that contains the samples
training_planThe training plan that specifies how the model will be trained
quality_measureThe quality measure that allows to compute a models approximation quality
cancelA cancellation object to cancel the training
Returns
The trained model iff not cancelled

Implements CreateModelBase.

◆ equals()

virtual bool equals ( CreateModelBase  other)
overridevirtual

Checking if the given configurations are equal this this instance.

Parameters
otherThe other Config
Returns
true iff the same type and the same config entries

Implements CreateModelBase.

◆ hasRegisteredCreateModel()

bool hasRegisteredCreateModel ( )

Returns true iff this instance has a Python object connected to it via the registerCreateModel function.

Returns
true/false

◆ isValid()

virtual bool isValid ( ::data_handler::DataHandlerBase  datahandler,
TrainingPlanBase  training_plan 
)
overridevirtual

Destroys an instance of this class.

This function checks if the model can validly be trained from the given samples

Parameters
datahandlerThe samples the model shall be trained with.
training_planThe training_plan
Returns
True iff th emodel can be trained with the configuration data, the properties and samples

Implements CreateModelBase.

◆ loadJson()

virtual loadJson ( JsonValue  root)
overridevirtual

Function to load the Serializables data from a JsonValue.

Parameters
rootThe data of the serializable as JsonValue

◆ saveJson()

virtual JsonValue saveJson ( )
overridevirtual

Function to save the Serializables data as a JsonValue.

Returns
The data of the serializable as JsonValue

◆ transferProperties()

virtual transferProperties ( PropertyList  property_list)
virtualinherited

Convenience function to transfer a complete PropertyList into the model.

Parameters
property_listThe properties to transfer into this model

Member Data Documentation

◆ DISOWN

apply SWIGTYPE * DISOWN
Initial value:
registerCreateModel(CreateCustomModelInterface *create_model)

Connect with Ansys