Skip to main content

oSP3D Script API 2024 R1

ComputeSingleObjectPerSample< TYPE > Class Template Reference

Last update: 16.07.2025

a base class for algorithms that apply a simple algorithm to obtain a single object from a single set of samples. More...

Public Types

typedef boost::function< DataObject::ptr_type(Structure database, DataObjectVector samples)> TAlgorithmFunction
 defines a function object More...
 

Public Member Functions

 check (Structure database)
 checks the settings on plausibility It throws an exception if there is a problem with the settings. Important: It tries to find out all problems with these settings and then exits the routine. More...
 
 compute (Structure database, DataObjectVector data, string new_quantity_ident, string new_design_ident)
 performs the action for a single set of samples More...
 
 compute (Structure database)
 performs the action using the defined settings. More...
 
 ComputeSingleObjectPerSample (TAlgorithmFunction function, string op_ident, number min_num_samples)
 constructor which assumes an empty selection It is mainly used to initialized the object and to provide a functional "compute()" method. More...
 
 ComputeSingleObjectPerSample (DataObjectContainer the_data, TAlgorithmFunction function, string op_ident, string default_design_ident, number min_num_samples)
 constructor which sets suitable defaults for all members More...
 

Public Attributes

DataObjectContainer data
 the data set to be analyzed
 
string new_design_ident
 the design ident of the new object
 
DataObjectContainer::string_vector_type new_quantity_idents
 the new idents for each quantity. The dimension and index space must fit the one of quantity_idents
 
bool overwrite_existing
 is true if already existing output data objects will be replaced. In this case, also all depending objects of the already existing one will be deleted.
 
DataObjectContainer::string_vector_type quantity_idents
 the quantities to be analyzed. If a quantity ident does not exist in data, no error appears.
 

Detailed Description

template<dataobject_types TYPE>
class ComputeSingleObjectPerSample< TYPE >

a base class for algorithms that apply a simple algorithm to obtain a single object from a single set of samples.

Template Parameters
TYPEthe field data type

Member Typedef Documentation

◆ TAlgorithmFunction

typedef boost::function<DataObject::ptr_type( Structure database, DataObjectVector samples)> TAlgorithmFunction

defines a function object

Parameters
databasethe database where the data refer to
samplesthe vector of samples to which the function is applied to.
Returns
the result of the operation

Constructor & Destructor Documentation

◆ ComputeSingleObjectPerSample() [1/2]

ComputeSingleObjectPerSample ( TAlgorithmFunction  function,
string  op_ident,
number  min_num_samples 
)

constructor which assumes an empty selection It is mainly used to initialized the object and to provide a functional "compute()" method.

Parameters
functiondefines the function to be executed
op_identthe ident of the operation (for messages)
min_num_samplessets m_min_num_samples

◆ ComputeSingleObjectPerSample() [2/2]

ComputeSingleObjectPerSample ( DataObjectContainer  the_data,
TAlgorithmFunction  function,
string  op_ident,
string  default_design_ident,
number  min_num_samples 
)

constructor which sets suitable defaults for all members

Parameters
the_datathe subset of field data to be token as input. All quantity idents are extracted. Then for each quantity a new result object will be created with specified design ident.
functiondefines the function to be executed
op_identthe ident of the operation (for messages)
default_design_identthe default design ident of the output objects.
min_num_samplessets m_min_num_samples

Member Function Documentation

◆ check()

check ( Structure  database)

checks the settings on plausibility It throws an exception if there is a problem with the settings. Important: It tries to find out all problems with these settings and then exits the routine.

Parameters
databasethe SoS structure

◆ compute() [1/2]

compute ( Structure  database,
DataObjectVector  data,
string  new_quantity_ident,
string  new_design_ident 
)

performs the action for a single set of samples

Parameters
databasethe output object is to be inserted in this object
dataa vector of samples
new_quantity_identthe quantity ident of the new object
new_design_identthe design ident of the new object The output object is inactive.

◆ compute() [2/2]

compute ( Structure  database)

performs the action using the defined settings.

Parameters
databasethe output object where new objects are added to

Connect with Ansys