> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ComputeSingleObjectPerSample< TYPE > Class Template Reference

Part of [Toolbox](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__toolbox)

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

## Public Types

| Type | Name |
| - | - |
| typedef boost::function\< DataObject::ptr\_type([Structure](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_structure) [database](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__data#gaebcac3a2836ec9fdf2e47bd812994b6b), [DataObjectVector](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_vector.md) samples)> | [TAlgorithmFunction](#ac597f6cab052d215247719908ce3cb0b) defines a function object |

## Public Member Functions

| Type | Name |
| - | - |
| | [check](#a47c34ec1e578c2ce27cf1c5fcd0d1704) ([Structure](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_structure) [database](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__data#gaebcac3a2836ec9fdf2e47bd812994b6b)) 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. |
| | [compute](#a919d852c00f29d479c628f0dc1a8387c) ([Structure](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_structure) [database](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__data#gaebcac3a2836ec9fdf2e47bd812994b6b), [DataObjectVector](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_vector.md) [data](#aff21fffab499ea652443206d66e1a9bb), string new\_quantity\_ident, string [new\_design\_ident](#aef951e72e1c034e5e2c484edf1b7f5a8)) performs the action for a single set of samples |
| | [compute](#ab08e112d95fe611e7eb25491c354d115) ([Structure](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_structure) [database](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__data#gaebcac3a2836ec9fdf2e47bd812994b6b)) performs the action using the defined settings. |
| | [ComputeSingleObjectPerSample](#a7ed83008f56cc0edc727330e09b9310f) ([TAlgorithmFunction](#ac597f6cab052d215247719908ce3cb0b) 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. |
| | [ComputeSingleObjectPerSample](#af70f30a17b8ec5eb50c819decb93d5ae) ([DataObjectContainer](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_container.md) the\_data, [TAlgorithmFunction](#ac597f6cab052d215247719908ce3cb0b) function, string op\_ident, string default\_design\_ident, number min\_num\_samples) constructor which sets suitable defaults for all members |

## Public Attributes

| Type | Name |
| - | - |
| [DataObjectContainer](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_container.md) | [data](#aff21fffab499ea652443206d66e1a9bb) the data set to be analyzed |
|  string | [new\_design\_ident](#aef951e72e1c034e5e2c484edf1b7f5a8) the design ident of the new object |
| [DataObjectContainer::string\_vector\_type](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_container.md#ac293ea0e5c280f69a497ea20f20c60b9) | [new\_quantity\_idents](#a30b1bcf63b9bdc707fea30bd96d70447) the new idents for each quantity. The dimension and index space must fit the one of *quantity\_idents* |
|  bool | [overwrite\_existing](#ade25e60bd85c8b4abd4f5b416cae0eb9) 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](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_container.md#ac293ea0e5c280f69a497ea20f20c60b9) | [quantity\_idents](#aced57c746ae1d69d2fd56872fa1768bf) 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**

| Name | Description |
| - | - |
| TYPE | the field data type |

## Member Typedef Documentation

### TAlgorithmFunction

```cpp theme={null}
typedef boost::function<DataObject::ptr_type( Structure database , DataObjectVector samples)> TAlgorithmFunction
```

defines a function object

**Parameters**

| Name | Description |
| - | - |
| database | the database where the data refer to |
| samples | the vector of samples to which the function is applied to. |

**Returns**

the result of the operation

## Constructor & Destructor Documentation

### ComputeSingleObjectPerSample() \[1/2]

```cpp theme={null}
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**

| Name | Description |
| - | - |
| function | defines the function to be executed |
| op\_ident | the ident of the operation (for messages) |
| min\_num\_samples | sets m\_min\_num\_samples |

### ComputeSingleObjectPerSample() \[2/2]

```cpp theme={null}
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**

| Name | Description |
| - | - |
| the\_data | the 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. |
| function | defines the function to be executed |
| op\_ident | the ident of the operation (for messages) |
| default\_design\_ident | the default design ident of the output objects. |
| min\_num\_samples | sets m\_min\_num\_samples |

## Member Function Documentation

### check()

```cpp theme={null}
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**

| Name | Description |
| - | - |
| database | the SoS structure |

### compute() \[1/2]

```cpp theme={null}
compute(
    Structure database,
    DataObjectVector data,
    string new_quantity_ident,
    string new_design_ident
)
```

performs the action for a single set of samples

**Parameters**

| Name | Description |
| - | - |
| database | the output object is to be inserted in this object |
| data | a vector of samples |
| new\_quantity\_ident | the quantity ident of the new object |
| new\_design\_ident | the design ident of the new object The output object is inactive. |

### compute() \[2/2]

```cpp theme={null}
compute(Structure database)
```

performs the action using the defined settings.

**Parameters**

| Name | Description |
| - | - |
| database | the output object where new objects are added to |
