    

 ## On this page

  

 

 # Class ansys::dpf::Context

 Last update: 25.03.2026 

<a id="classansys-dpf-context"></a>

![](https://img.shields.io/badge/language-C%2B%2B-blue "C++")![](https://img.shields.io/badge/-public-brightgreen "public")

The class representing the DPF execution context. This is used to configure several aspects of DPF like:

- The XML configuration file to be loaded.
- The license context to be used.

**See also**: [dpf::LibraryHandle](classansys-dpf-libraryhandle.md#classansys-dpf-libraryhandle), [dpf::core::applyContext](classansys-dpf-core.md#classansys-dpf-core-1a5fbdf727da47ba6dd749ade51f1f2dcc)

## Inner classes

- [ansys::dpf::Context::internal](structansys-dpf-context-internal.md#structansys-dpf-context-internal)

## Members

- [Context](classansys-dpf-context.md#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)
- [defaultContext](classansys-dpf-context.md#classansys-dpf-context-1a05d1af3aea226b6cb8547d1d56c9c146)
- [EDpfLicenseContext](classansys-dpf-context.md#classansys-dpf-context-1a1149672f0fad6470e3533a15d358baef)
- [entryContext](classansys-dpf-context.md#classansys-dpf-context-1a30b9265329478de651ae53b753831bc4)
- [errorOnPluginLoad](classansys-dpf-context.md#classansys-dpf-context-1ab36cb19d02596f0c9e84670632a7567c)
- [getContext](classansys-dpf-context.md#classansys-dpf-context-1af4b49f2ed79e09c7d20d59895d52c139)
- [getLicenseContext](classansys-dpf-context.md#classansys-dpf-context-1a75bf6a9e641e9c9f24d61ef6364672c8)
- [getSetupFilePath](classansys-dpf-context.md#classansys-dpf-context-1a8e69df73d5d7695a12619e98bb4ef82b)
- [PluginLoadErrorMode](classansys-dpf-context.md#classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3)
- [premiumContext](classansys-dpf-context.md#classansys-dpf-context-1a8416bcd2b6a76249a97bf259851aa121)
- [standaloneContext](classansys-dpf-context.md#classansys-dpf-context-1a327ad3dde1ba5c314c34d5b2552156f9)
- [userDefinedContext](classansys-dpf-context.md#classansys-dpf-context-1af2efd2673fef4ce34b56f85dad9d5520)
- [withEntryLevelLicense](classansys-dpf-context.md#classansys-dpf-context-1a6848f3f755ec83e57544e688182d534d)
- [withErrorOnPluginLoad](classansys-dpf-context.md#classansys-dpf-context-1a5fe6bfb18b6d33dd88f16bb006bb0d8c)
- [withPremiumLicense](classansys-dpf-context.md#classansys-dpf-context-1a33a89b830c012a1563bf6534d5de7d48)

## Public types

<a id="classansys-dpf-context-1a1149672f0fad6470e3533a15d358baef"></a>

### Enumeration type EDpfLicenseContext

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
enum EDpfLicenseContext {
  eNone = 0,
  eEntryLevel = 1,
  ePremium = 2
}

```

Enum to select the license context.

<a id="classansys-dpf-context-1a1149672f0fad6470e3533a15d358baefabe988781e4e1de1c6a36fb698afbbe1f"></a>

#### Enumerator eNone

<a id="classansys-dpf-context-1a1149672f0fad6470e3533a15d358baefa3524bc6ef2b323544131910a168307e4"></a>

#### Enumerator eEntryLevel

<a id="classansys-dpf-context-1a1149672f0fad6470e3533a15d358baefaac9bc97d5be545de7d5d731807e6238b"></a>

#### Enumerator ePremium

<a id="classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3"></a>

### Enumeration type PluginLoadErrorMode

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
enum PluginLoadErrorMode {
  eSilent = 0,
  eReportFirst = 1,
  eReportAll = 2
}

```

Enum that determines the error reporting strategy during plugin loading.

<a id="classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3a1bca7792b0764f5436105430db6f5f91"></a>

#### Enumerator eSilent

<a id="classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3af61fe2506df3f2bd107cfb1d8b4fa566"></a>

#### Enumerator eReportFirst

<a id="classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3a826fa616dd3899272e97b80a5c73dabc"></a>

#### Enumerator eReportAll

## Friends

<a id="classansys-dpf-context-1a87c891c29622c0cbaa03d5ef05f0e4b6"></a>

### Friend internal

![](https://img.shields.io/badge/language-C%2B%2B-blue "C++")![](https://img.shields.io/badge/-public-brightgreen "public")

## Public functions

<a id="classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b"></a>

### Function Context

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
ansys::dpf::Context::Context(EDpfContext context=EDpfContext::eDefault, std::string const &setup_file_path="")

```

Defines the settings that will be used to load DPF. A DPF xml file is used to define those settings.

**Parameters**:

- [EDpfContext](namespaceansys-dpf.md#namespaceansys-dpf-1a02d1b14b4a34eeae292e89f8ee7cfe60) **context** = EDpfContext::eDefault : \[in\] Defines setup to use.
- std::string const &amp; **setup\_file\_path** = "" : \[in\] Optional path to a DPF xml file if using a custom defined location. If a file name is passed, instead of a path, it will search for it int the predefined location dpf/utilities.

**Return type**:

<a id="classansys-dpf-context-1af4b49f2ed79e09c7d20d59895d52c139"></a>

### Function getContext

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
EDpfContext ansys::dpf::Context::getContext() const

```

Get the DPF context enum value.

**Returns**:

[EDpfContext](namespaceansys-dpf.md#namespaceansys-dpf-1a02d1b14b4a34eeae292e89f8ee7cfe60)

**Return type**: [EDpfContext](namespaceansys-dpf.md#namespaceansys-dpf-1a02d1b14b4a34eeae292e89f8ee7cfe60)

<a id="classansys-dpf-context-1a8e69df73d5d7695a12619e98bb4ef82b"></a>

### Function getSetupFilePath

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
std::string const  & ansys::dpf::Context::getSetupFilePath() const

```

Get the path to the XML file used to configure DPF.

**Returns**:

std::string const&amp;

**Return type**: std::string const &amp;

<a id="classansys-dpf-context-1a75bf6a9e641e9c9f24d61ef6364672c8"></a>

### Function getLicenseContext

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
EDpfLicenseContext ansys::dpf::Context::getLicenseContext() const

```

Get the DPF license context enum value.

Use with DPF runtime R2025R1 or later.

**Returns**:

[EDpfLicenseContext](classansys-dpf-context.md#classansys-dpf-context-1a1149672f0fad6470e3533a15d358baef)

**Return type**: [EDpfLicenseContext](classansys-dpf-context.md#classansys-dpf-context-1a1149672f0fad6470e3533a15d358baef)

<a id="classansys-dpf-context-1ab36cb19d02596f0c9e84670632a7567c"></a>

### Function errorOnPluginLoad

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
PluginLoadErrorMode ansys::dpf::Context::errorOnPluginLoad() const

```

Get the error reporting mode for plugin loading.

Use with DPF runtime R2025R1 or later.

**Returns**:

[PluginLoadErrorMode](classansys-dpf-context.md#classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3)

**Return type**: [PluginLoadErrorMode](classansys-dpf-context.md#classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3)

<a id="classansys-dpf-context-1a5fe6bfb18b6d33dd88f16bb006bb0d8c"></a>

### Function withErrorOnPluginLoad

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
Context & ansys::dpf::Context::withErrorOnPluginLoad(PluginLoadErrorMode error_mode)

```

Sets the mode in which DPF report errors when plugins are loaded.

Use with DPF runtime R2025R1 or later.

**Parameters**:

- **error\_mode**: The strategy for error reporting.

**Returns**:

[Context](classansys-dpf-context.md#classansys-dpf-context)&amp;

**Parameters**:

- [PluginLoadErrorMode](classansys-dpf-context.md#classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3) **error\_mode**

**Return type**: [Context](classansys-dpf-context.md#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b) &amp;

<a id="classansys-dpf-context-1a33a89b830c012a1563bf6534d5de7d48"></a>

### Function withPremiumLicense

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
Context & ansys::dpf::Context::withPremiumLicense()

```

Sets the license context to Premium.

Use with DPF runtime R2025R1 or later.

**Returns**:

[Context](classansys-dpf-context.md#classansys-dpf-context)&amp;

**Return type**: [Context](classansys-dpf-context.md#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b) &amp;

<a id="classansys-dpf-context-1a6848f3f755ec83e57544e688182d534d"></a>

### Function withEntryLevelLicense

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
Context & ansys::dpf::Context::withEntryLevelLicense()

```

Sets the license context to Entry.

Use with DPF runtime R2025R1 or later.

**Returns**:

[Context](classansys-dpf-context.md#classansys-dpf-context)&amp;

**Return type**: [Context](classansys-dpf-context.md#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b) &amp;

## Public static functions

<a id="classansys-dpf-context-1a30b9265329478de651ae53b753831bc4"></a>

### Function entryContext

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-static-lightgrey "static")

```cpp
static Context ansys::dpf::Context::entryContext()

```

**Returns**:

Entry context instance that does not allow DPF to perform any license checkout, meaning that licensed DPF operators run will fail.

**Return type**: [Context](classansys-dpf-context.md#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)

<a id="classansys-dpf-context-1a8416bcd2b6a76249a97bf259851aa121"></a>

### Function premiumContext

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-static-lightgrey "static")

```cpp
static Context ansys::dpf::Context::premiumContext()

```

**Returns**:

Premium context instance that allows DPF to perform license checkouts, allowing licensed DPF operators to run.

**Return type**: [Context](classansys-dpf-context.md#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)

<a id="classansys-dpf-context-1a05d1af3aea226b6cb8547d1d56c9c146"></a>

### Function defaultContext

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-static-lightgrey "static")

```cpp
static Context ansys::dpf::Context::defaultContext()

```

Creates a default context.

Use with DPF runtime R2025R1 or later.

**Returns**:

[Context](classansys-dpf-context.md#classansys-dpf-context)

**Return type**: [Context](classansys-dpf-context.md#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)

<a id="classansys-dpf-context-1a327ad3dde1ba5c314c34d5b2552156f9"></a>

### Function standaloneContext

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-static-lightgrey "static")

```cpp
static Context ansys::dpf::Context::standaloneContext()

```

Creates a standalone context.

**Returns**:

[Context](classansys-dpf-context.md#classansys-dpf-context)

**Return type**: [Context](classansys-dpf-context.md#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)

<a id="classansys-dpf-context-1af2efd2673fef4ce34b56f85dad9d5520"></a>

### Function userDefinedContext

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-static-lightgrey "static")

```cpp
static Context ansys::dpf::Context::userDefinedContext(std::string const &setup_file="DpfCustomDefined.xml")

```

Creates a user-defined context.

Use with DPF runtime R2025R1 or later.

**Parameters**:

- **setup\_file**: The path to the DPF XML file with the user configuration. If a file name is provided as parameter, it will search in /utilities for it. The default XML file used is /utilities/DpfCustomDefined.xml, that the user can edit.

**Returns**:

[Context](classansys-dpf-context.md#classansys-dpf-context)

**Parameters**:

- std::string const &amp; **setup\_file** = "DpfCustomDefined.xml"

**Return type**: [Context](classansys-dpf-context.md#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)