> ## 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.

# sysc::Variable Class Reference

Part of [C++ Interfaces for Participant Library](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs)

Provide a class for a System Coupling variable.

`#include <Variable.hpp>`

## Public Member Functions

| Type | Name |
| - | - |
| | [Variable](#a8c63f1c834c6dee8663b8917764af438) (const [VariableName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga500337cdc8405b3e819ca3623bb44266) \&name) Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class. |
| | [Variable](#a297f20a1e01064edb71c7ba7581ef585) (const [VariableName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga500337cdc8405b3e819ca3623bb44266) \&name, enum [TensorType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga8f85e1fca4e3c3d086644ea6fb4b8fb7) tensorType, bool isExtensive, enum [Location](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gaced2664a481a6250f46140266dd38c2a) location) Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class. |
| | [Variable](#a3146070b07403f263b1bed17cc129764) (const [VariableName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga500337cdc8405b3e819ca3623bb44266) \&name, enum [TensorType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga8f85e1fca4e3c3d086644ea6fb4b8fb7) tensorType, bool isExtensive, enum [Location](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gaced2664a481a6250f46140266dd38c2a) location, enum [DataType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga8c2b9557240fd9b2f908c98e3b1b27d3) dataType) Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class. |
| | [Variable](#a4597bf22a4bb216398210ee89160ccb4) (const [VariableName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga500337cdc8405b3e819ca3623bb44266) \&name, const [DisplayName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga708d69b0e949d6a42b6a0d7885eed90f) \&displayName, enum [TensorType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga8f85e1fca4e3c3d086644ea6fb4b8fb7) tensorType, bool isExtensive, enum [Location](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gaced2664a481a6250f46140266dd38c2a) location, enum [QuantityType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gab4cbdd3230a1cb38956f5b93f941f89b) quantityType) Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class. |
| | [Variable](#a38976d25f9a99d85c88154d8d30ed5a4) (const [VariableName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga500337cdc8405b3e819ca3623bb44266) \&name, const [DisplayName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga708d69b0e949d6a42b6a0d7885eed90f) \&displayName, enum [TensorType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga8f85e1fca4e3c3d086644ea6fb4b8fb7) tensorType, bool isExtensive, enum [Location](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gaced2664a481a6250f46140266dd38c2a) location, enum [QuantityType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gab4cbdd3230a1cb38956f5b93f941f89b) quantityType, enum [DataType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga8c2b9557240fd9b2f908c98e3b1b27d3) dataType) Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class. |
| | [Variable](#a3a0892d10b1044b7efa30988b251d32c) (const [VariableName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga500337cdc8405b3e819ca3623bb44266) \&name, enum [QuantityType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gab4cbdd3230a1cb38956f5b93f941f89b) quantityType, enum [Location](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gaced2664a481a6250f46140266dd38c2a) location=Node, const [DisplayName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga708d69b0e949d6a42b6a0d7885eed90f) \&displayName=[DisplayName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga708d69b0e949d6a42b6a0d7885eed90f)()) Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class. |
| const [VariableName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga500337cdc8405b3e819ca3623bb44266) & | [getName](#ab138ad8ce29f89d62b7b5c1a4c496e19) () const noexcept Get the variable's name. |
| enum [TensorType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga8f85e1fca4e3c3d086644ea6fb4b8fb7) | [getTensorType](#a3c019c1e2e4741e8ab87c8a8cd4f6d80) () const noexcept Get the variable's tensor type. |
| bool | [getIsExtensive](#a2ecc01f958aa92f721ab45546581bb26) () const noexcept The the is extensive boolean for this variable. |
| enum [QuantityType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gab4cbdd3230a1cb38956f5b93f941f89b) | [getQuantityType](#a2fc80063d66ac8c7ed567e2e6ed3e568) () const noexcept Get the variable's quantity type. |
| enum [Location](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#gaced2664a481a6250f46140266dd38c2a) | [getLocation](#a3655299cf3b151d9fc30b4f5a47ca8fb) () const noexcept Get the variable's location. |
| const [DisplayName](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga708d69b0e949d6a42b6a0d7885eed90f) & | [getDisplayName](#a37a842b3aa77535ddf81b3fb09c557e6) () const noexcept Get the variable's display name. |
| enum [DataType](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/group__SystemCouplingParticipantAPIs#ga8c2b9557240fd9b2f908c98e3b1b27d3) | [getDataType](#aa65c2a0ffe7c327972721faf2bffc5b7) () const noexcept Get the variable's data type. |
|  void | [addRealAttribute](#ab296b04988b750113600bcc4e302ae3c) (const [RealAttribute](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1RealAttribute.md) \&attribute) Add a real-valued attribute. |
|  void | [addIntegerAttribute](#ae6fed92c7d5f748b3e26898af932eb46) (const [IntegerAttribute](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1IntegerAttribute.md) \&attribute) Add an integer-valued attribute. |
|  std::size\_t | [getNumRealAttributes](#ae04462134077986b650ee9c6df9e5151) () const noexcept Returns the number of real-valued attributes. |
|  std::size\_t | [getNumIntegerAttributes](#a9a427e97dd6a88dae5e89ca7e640eba7) () const noexcept Returns the number of integer-valued attributes. |
|  const [RealAttribute](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1RealAttribute.md) & | [getRealAttribute](#adcebefb4b9e4c203ab09ee1114daad33) (std::size\_t index) const Return the real-valued attribute at the given index. |
|  const [IntegerAttribute](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1IntegerAttribute.md) & | [getIntegerAttribute](#a7cbb6bced0257ebb7da8d709dbd05a30) (std::size\_t index) const Return the integer-valued attribute at the given index. |

## Detailed Description

Provide a class for a System Coupling variable.

Definition at line [21](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/Variable_8hpp_source) of file [Variable.hpp](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/Variable_8hpp_source).

## Constructor & Destructor Documentation

### Variable() \[1/6]

```cpp theme={null}
sysc::Variable::Variable(const VariableName & name)
```

`explicit`

Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class.

**Parameters**

| Name | Description |
| - | - |
| name | Unique name for this variable. |

Display name will default to the same as name.

Tensor type will default to scalar.

Is extensive flag will default to false (to non-extensive).

Location will default to nodes.

Quantity type will default to unspecified.

DataType will default to real.

### Variable() \[2/6]

```cpp theme={null}
sysc::Variable::Variable(
    const VariableName & name,
    enum TensorType tensorType,
    bool isExtensive,
    enum Location location
)
```

Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class.

**Parameters**

| Name | Description |
| - | - |
| name | - Unique name for this variable. String length should not exceed SYSC\_STRING\_LENGTH. |
| tensorType | - variable tensor type. |
| isExtensive | - flag indicating if it's an extensive property. |
| location | - variable location (e.g element or node). |

Display name will default to the same as name.

Quantity type will default to unspecified.

DataType will default to real.

### Variable() \[3/6]

```cpp theme={null}
sysc::Variable::Variable(
    const VariableName & name,
    enum TensorType tensorType,
    bool isExtensive,
    enum Location location,
    enum DataType dataType
)
```

Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class.

**Parameters**

| Name | Description |
| - | - |
| name | - Unique name for this variable. String length should not exceed SYSC\_STRING\_LENGTH. |
| tensorType | - variable tensor type. |
| isExtensive | - flag indicating if it's an extensive property. |
| location | - variable location (e.g element or node). |
| dataType | - dataType |

Display name will default to the same as name.

Quantity type will default to unspecified.

### Variable() \[4/6]

```cpp theme={null}
sysc::Variable::Variable(
    const VariableName & name,
    const DisplayName & displayName,
    enum TensorType tensorType,
    bool isExtensive,
    enum Location location,
    enum QuantityType quantityType
)
```

Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class.

**Parameters**

| Name | Description |
| - | - |
| name | - Unique name for this variable. |
| displayName | - variable display name. |
| tensorType | - variable tensor type. |
| isExtensive | - flag indicating if it's an extensive property. |
| location | - variable location (e.g element or node). |
| quantityType | - Quantity type of this variable. |

DataType will default to real.

### Variable() \[5/6]

```cpp theme={null}
sysc::Variable::Variable(
    const VariableName & name,
    const DisplayName & displayName,
    enum TensorType tensorType,
    bool isExtensive,
    enum Location location,
    enum QuantityType quantityType,
    enum DataType dataType
)
```

Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class.

**Parameters**

| Name | Description |
| - | - |
| name | - Unique name for this variable. |
| displayName | - variable display name. |
| tensorType | - variable tensor type. |
| isExtensive | - flag indicating if it's an extensive property. |
| location | - variable location (e.g element or node). |
| quantityType | - Quantity type of this variable. |
| dataType | - Data type of this variable. |

### Variable() \[6/6]

```cpp theme={null}
sysc::Variable::Variable(
    const VariableName & name,
    enum QuantityType quantityType,
    enum Location location = Node,
    const DisplayName & displayName = DisplayName ()
)
```

Provide a constructor for the [Variable](https://developer.synopsys.com/docs/system-coupling/system-coupling-cpp-library/classsysc_1_1Variable.md) class.

**Parameters**

| Name | Description |
| - | - |
| name | - Unique name for this variable. |
| quantityType | - Quantity type of this variable. Supported quantity types are defined above in this header file. |
| location | - variable location (e.g element or node). This parameter is optional - the default value is node. |
| displayName | - variable display name. This parameter is optional - it will default to the same value as the variable's name. |

Note that provided quantity type will determine the value of the tensor type and is extensive parameters. The values will be inferred according to the following rules:

```cpp theme={null}
Quantity Type                     Tensor Type      Is Extensive
----------------------------------------------------------------
Force                             Vector           True
Incremental Displacement          Vector           False
Temperature                       Scalar           False
Heat Rate                         Scalar           True
Heat Transfer Coefficient         Scalar           False
Convection Reference Temperature  Scalar           False
```

For a more explicit control of tensor type and is extensive values, consider using another constructor.

DataType will default to real.

## Member Function Documentation

### getDataType()

```cpp theme={null}
enum DataType sysc::Variable::getDataType() const
```

`noexcept`

Get the variable's data type.

**Returns**

Return is the DataType enum.

### getDisplayName()

```cpp theme={null}
const DisplayName & sysc::Variable::getDisplayName() const
```

`noexcept`

Get the variable's display name.

**Returns**

Return is the display name of this variable (string).

### getIsExtensive()

```cpp theme={null}
bool sysc::Variable::getIsExtensive() const
```

`noexcept`

The the is extensive boolean for this variable.

**Returns**

Return is the boolean, true if variable is extensive, false otherwise.

### getLocation()

```cpp theme={null}
enum Location sysc::Variable::getLocation() const
```

`noexcept`

Get the variable's location.

**Returns**

Return is Location of this variable.

### getName()

```cpp theme={null}
const VariableName & sysc::Variable::getName() const
```

`noexcept`

Get the variable's name.

**Returns**

Return is the name of this variable (string).

### getQuantityType()

```cpp theme={null}
enum QuantityType sysc::Variable::getQuantityType() const
```

`noexcept`

Get the variable's quantity type.

**Returns**

Return is the QuantityType struct of this variable.

### getTensorType()

```cpp theme={null}
enum TensorType sysc::Variable::getTensorType() const
```

`noexcept`

Get the variable's tensor type.

**Returns**

Return is the TensorType enum.
