Skip to main content

DPF Cpp Client Library 2026 R1

Class ansys::dpf::Context

Last update: 25.03.2026

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, dpf::core::applyContext

Inner classes

Members

Public types

Enumeration type EDpfLicenseContext

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

Enum to select the license context.

Enumerator eNone

Enumerator eEntryLevel

Enumerator ePremium

Enumeration type PluginLoadErrorMode

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

Enum that determines the error reporting strategy during plugin loading.

Enumerator eSilent

Enumerator eReportFirst

Enumerator eReportAll

Friends

Friend internal

Public functions

Function Context

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 context = EDpfContext::eDefault : [in] Defines setup to use.
  • std::string const & 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:

Function getContext

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

Get the DPF context enum value.

Returns:

EDpfContext

Return type: EDpfContext

Function getSetupFilePath

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

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

Returns:

std::string const&

Return type: std::string const &

Function getLicenseContext

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

Get the DPF license context enum value.

Use with DPF runtime R2025R1 or later.

Returns:

EDpfLicenseContext

Return type: EDpfLicenseContext

Function errorOnPluginLoad

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

Get the error reporting mode for plugin loading.

Use with DPF runtime R2025R1 or later.

Returns:

PluginLoadErrorMode

Return type: PluginLoadErrorMode

Function withErrorOnPluginLoad

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&

Parameters:

Return type: Context &

Function withPremiumLicense

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

Sets the license context to Premium.

Use with DPF runtime R2025R1 or later.

Returns:

Context&

Return type: Context &

Function withEntryLevelLicense

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

Sets the license context to Entry.

Use with DPF runtime R2025R1 or later.

Returns:

Context&

Return type: Context &

Public static functions

Function entryContext

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

Function premiumContext

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

Function defaultContext

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

Creates a default context.

Use with DPF runtime R2025R1 or later.

Returns:

Context

Return type: Context

Function standaloneContext

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

Creates a standalone context.

Returns:

Context

Return type: Context

Function userDefinedContext

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

Parameters:

  • std::string const & setup_file = "DpfCustomDefined.xml"

Return type: Context

Connect with Ansys