    

 ## On this page

  

 

 # ansys::dpf::Context Class Reference

 Last update: 16.07.2025 

The class representing the DPF execution context. This is used to configure several aspects of DPF like: [More...](classansys_1_1dpf_1_1Context.xhtml#details)

`#include <dpf_api_base.h>`

## <a id="pub-types" name="pub-types"></a>Public Types

<a id="a1149672f0fad6470e3533a15d358baef" name="a1149672f0fad6470e3533a15d358baef"></a>enum class [EDpfLicenseContext](classansys_1_1dpf_1_1Context.xhtml#a1149672f0fad6470e3533a15d358baef) { **eNone** = 0 , **eEntryLevel** = 1 , **ePremium** = 2 } Enum to select the license context.   
 <a id="a89c9954b0806e1ffbefd5d413d44a8e3" name="a89c9954b0806e1ffbefd5d413d44a8e3"></a>enum class [PluginLoadErrorMode](classansys_1_1dpf_1_1Context.xhtml#a89c9954b0806e1ffbefd5d413d44a8e3) { **eSilent** = 0 , **eReportFirst** = 1 , **eReportAll** = 2 } Enum that determines the error reporting strategy during plugin loading.   
 ## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

 [Context](classansys_1_1dpf_1_1Context.xhtml#ae26354fe1dea7b2691e115275704278b) ([EDpfContext](namespaceansys_1_1dpf.xhtml#a02d1b14b4a34eeae292e89f8ee7cfe60) context=EDpfContext::eDefault, std::string const &amp;setup\_file\_path="") [EDpfContext](namespaceansys_1_1dpf.xhtml#a02d1b14b4a34eeae292e89f8ee7cfe60) [getContext](classansys_1_1dpf_1_1Context.xhtml#af4b49f2ed79e09c7d20d59895d52c139) () const Get the DPF context enum value. [More...](classansys_1_1dpf_1_1Context.xhtml#af4b49f2ed79e09c7d20d59895d52c139)  
 std::string const &amp; [getSetupFilePath](classansys_1_1dpf_1_1Context.xhtml#a8e69df73d5d7695a12619e98bb4ef82b) () const Get the path to the XML file used to configure DPF. [More...](classansys_1_1dpf_1_1Context.xhtml#a8e69df73d5d7695a12619e98bb4ef82b)  
 [EDpfLicenseContext](classansys_1_1dpf_1_1Context.xhtml#a1149672f0fad6470e3533a15d358baef) [getLicenseContext](classansys_1_1dpf_1_1Context.xhtml#a75bf6a9e641e9c9f24d61ef6364672c8) () const Get the DPF license context enum value. [More...](classansys_1_1dpf_1_1Context.xhtml#a75bf6a9e641e9c9f24d61ef6364672c8)  
 [PluginLoadErrorMode](classansys_1_1dpf_1_1Context.xhtml#a89c9954b0806e1ffbefd5d413d44a8e3) [errorOnPluginLoad](classansys_1_1dpf_1_1Context.xhtml#ab36cb19d02596f0c9e84670632a7567c) () const Get the error reporting mode for plugin loading. [More...](classansys_1_1dpf_1_1Context.xhtml#ab36cb19d02596f0c9e84670632a7567c)  
 [Context](classansys_1_1dpf_1_1Context.xhtml) &amp; [withErrorOnPluginLoad](classansys_1_1dpf_1_1Context.xhtml#a5fe6bfb18b6d33dd88f16bb006bb0d8c) ([PluginLoadErrorMode](classansys_1_1dpf_1_1Context.xhtml#a89c9954b0806e1ffbefd5d413d44a8e3) error\_mode) Sets the mode in which DPF report errors when plugins are loaded. [More...](classansys_1_1dpf_1_1Context.xhtml#a5fe6bfb18b6d33dd88f16bb006bb0d8c)  
 [Context](classansys_1_1dpf_1_1Context.xhtml) &amp; [withPremiumLicense](classansys_1_1dpf_1_1Context.xhtml#a33a89b830c012a1563bf6534d5de7d48) () Sets the license context to Premium. [More...](classansys_1_1dpf_1_1Context.xhtml#a33a89b830c012a1563bf6534d5de7d48)  
 [Context](classansys_1_1dpf_1_1Context.xhtml) &amp; [withEntryLevelLicense](classansys_1_1dpf_1_1Context.xhtml#a6848f3f755ec83e57544e688182d534d) () Sets the license context to Entry. [More...](classansys_1_1dpf_1_1Context.xhtml#a6848f3f755ec83e57544e688182d534d)  
 ## <a id="pub-static-methods" name="pub-static-methods"></a>Static Public Member Functions

static [Context](classansys_1_1dpf_1_1Context.xhtml) [entryContext](classansys_1_1dpf_1_1Context.xhtml#a30b9265329478de651ae53b753831bc4) () static [Context](classansys_1_1dpf_1_1Context.xhtml) [premiumContext](classansys_1_1dpf_1_1Context.xhtml#a8416bcd2b6a76249a97bf259851aa121) () static [Context](classansys_1_1dpf_1_1Context.xhtml) [defaultContext](classansys_1_1dpf_1_1Context.xhtml#a05d1af3aea226b6cb8547d1d56c9c146) () Creates a default context. [More...](classansys_1_1dpf_1_1Context.xhtml#a05d1af3aea226b6cb8547d1d56c9c146)  
 static [Context](classansys_1_1dpf_1_1Context.xhtml) [standaloneContext](classansys_1_1dpf_1_1Context.xhtml#a327ad3dde1ba5c314c34d5b2552156f9) () Creates a standalone context. [More...](classansys_1_1dpf_1_1Context.xhtml#a327ad3dde1ba5c314c34d5b2552156f9)  
 static [Context](classansys_1_1dpf_1_1Context.xhtml) [userDefinedContext](classansys_1_1dpf_1_1Context.xhtml#af2efd2673fef4ce34b56f85dad9d5520) (std::string const &amp;setup\_file="DpfCustomDefined.xml") Creates a user-defined context. [More...](classansys_1_1dpf_1_1Context.xhtml#af2efd2673fef4ce34b56f85dad9d5520)  
 <a id="details" name="details"></a>## Detailed Description

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_1_1dpf_1_1LibraryHandle.xhtml "Provides an access to use DPF HGP API. The instance of LibraryHandle is only needed once."), [dpf::core::applyContext](classansys_1_1dpf_1_1core.xhtml#a5fbdf727da47ba6dd749ade51f1f2dcc)

## Constructor &amp; Destructor Documentation

<a id="ae26354fe1dea7b2691e115275704278b" name="ae26354fe1dea7b2691e115275704278b"></a>## [◆ ](#ae26354fe1dea7b2691e115275704278b)Context()

 ansys::dpf::Context::Context  ( [EDpfContext](namespaceansys_1_1dpf.xhtml#a02d1b14b4a34eeae292e89f8ee7cfe60)  *context* = `EDpfContext::eDefault`,    std::string const &amp;  *setup\_file\_path* = `""`   ) 

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

Parameters \[in\]contextDefines setup to use. \[in\]setup\_file\_pathOptional 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. 



## Member Function Documentation

<a id="a05d1af3aea226b6cb8547d1d56c9c146" name="a05d1af3aea226b6cb8547d1d56c9c146"></a>## [◆ ](#a05d1af3aea226b6cb8547d1d56c9c146)defaultContext()

 static [Context](classansys_1_1dpf_1_1Context.xhtml) ansys::dpf::Context::defaultContext  ( )   static 

Creates a default context.

Use with DPF runtime R2025R1 or later.

Returns[Context](classansys_1_1dpf_1_1Context.xhtml "The class representing the DPF execution context. This is used to configure several aspects of DPF li...") 



<a id="a30b9265329478de651ae53b753831bc4" name="a30b9265329478de651ae53b753831bc4"></a>## [◆ ](#a30b9265329478de651ae53b753831bc4)entryContext()

 static [Context](classansys_1_1dpf_1_1Context.xhtml) ansys::dpf::Context::entryContext  ( )   static 

ReturnsEntry context instance that does not allow DPF to perform any license checkout, meaning that licensed DPF operators run will fail. See also[Using DPF Context](group__group__11.xhtml) 



<a id="ab36cb19d02596f0c9e84670632a7567c" name="ab36cb19d02596f0c9e84670632a7567c"></a>## [◆ ](#ab36cb19d02596f0c9e84670632a7567c)errorOnPluginLoad()

 [PluginLoadErrorMode](classansys_1_1dpf_1_1Context.xhtml#a89c9954b0806e1ffbefd5d413d44a8e3) ansys::dpf::Context::errorOnPluginLoad  ( )  const

Get the error reporting mode for plugin loading.

Use with DPF runtime R2025R1 or later.

ReturnsPluginLoadErrorMode 



<a id="af4b49f2ed79e09c7d20d59895d52c139" name="af4b49f2ed79e09c7d20d59895d52c139"></a>## [◆ ](#af4b49f2ed79e09c7d20d59895d52c139)getContext()

 [EDpfContext](namespaceansys_1_1dpf.xhtml#a02d1b14b4a34eeae292e89f8ee7cfe60) ansys::dpf::Context::getContext  ( )  const

Get the DPF context enum value.

ReturnsEDpfContext 



<a id="a75bf6a9e641e9c9f24d61ef6364672c8" name="a75bf6a9e641e9c9f24d61ef6364672c8"></a>## [◆ ](#a75bf6a9e641e9c9f24d61ef6364672c8)getLicenseContext()

 [EDpfLicenseContext](classansys_1_1dpf_1_1Context.xhtml#a1149672f0fad6470e3533a15d358baef) ansys::dpf::Context::getLicenseContext  ( )  const

Get the DPF license context enum value.

Use with DPF runtime R2025R1 or later.

ReturnsEDpfLicenseContext 



<a id="a8e69df73d5d7695a12619e98bb4ef82b" name="a8e69df73d5d7695a12619e98bb4ef82b"></a>## [◆ ](#a8e69df73d5d7695a12619e98bb4ef82b)getSetupFilePath()

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

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

Returnsstd::string const&amp; 



<a id="a8416bcd2b6a76249a97bf259851aa121" name="a8416bcd2b6a76249a97bf259851aa121"></a>## [◆ ](#a8416bcd2b6a76249a97bf259851aa121)premiumContext()

 static [Context](classansys_1_1dpf_1_1Context.xhtml) ansys::dpf::Context::premiumContext  ( )   static 

ReturnsPremium context instance that allows DPF to perform license checkouts, allowing licensed DPF operators to run. See also[Using DPF Context](group__group__11.xhtml) 



<a id="a327ad3dde1ba5c314c34d5b2552156f9" name="a327ad3dde1ba5c314c34d5b2552156f9"></a>## [◆ ](#a327ad3dde1ba5c314c34d5b2552156f9)standaloneContext()

 static [Context](classansys_1_1dpf_1_1Context.xhtml) ansys::dpf::Context::standaloneContext  ( )   static 

Creates a standalone context.

Returns[Context](classansys_1_1dpf_1_1Context.xhtml "The class representing the DPF execution context. This is used to configure several aspects of DPF li...") 



<a id="af2efd2673fef4ce34b56f85dad9d5520" name="af2efd2673fef4ce34b56f85dad9d5520"></a>## [◆ ](#af2efd2673fef4ce34b56f85dad9d5520)userDefinedContext()

 static [Context](classansys_1_1dpf_1_1Context.xhtml) ansys::dpf::Context::userDefinedContext  ( std::string const &amp;  *setup\_file* = `"DpfCustomDefined.xml"`)   static 

Creates a user-defined context.

Use with DPF runtime R2025R1 or later.

Parameters setup\_fileThe 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_1_1dpf_1_1Context.xhtml "The class representing the DPF execution context. This is used to configure several aspects of DPF li...") 



<a id="a6848f3f755ec83e57544e688182d534d" name="a6848f3f755ec83e57544e688182d534d"></a>## [◆ ](#a6848f3f755ec83e57544e688182d534d)withEntryLevelLicense()

 [Context](classansys_1_1dpf_1_1Context.xhtml) &amp; ansys::dpf::Context::withEntryLevelLicense  ( ) 

Sets the license context to Entry.

Use with DPF runtime R2025R1 or later.

Returns[Context](classansys_1_1dpf_1_1Context.xhtml "The class representing the DPF execution context. This is used to configure several aspects of DPF li...")&amp; 



<a id="a5fe6bfb18b6d33dd88f16bb006bb0d8c" name="a5fe6bfb18b6d33dd88f16bb006bb0d8c"></a>## [◆ ](#a5fe6bfb18b6d33dd88f16bb006bb0d8c)withErrorOnPluginLoad()

 [Context](classansys_1_1dpf_1_1Context.xhtml) &amp; ansys::dpf::Context::withErrorOnPluginLoad  ( [PluginLoadErrorMode](classansys_1_1dpf_1_1Context.xhtml#a89c9954b0806e1ffbefd5d413d44a8e3)  *error\_mode*) 

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

Use with DPF runtime R2025R1 or later.

Parameters error\_modeThe strategy for error reporting. Returns[Context](classansys_1_1dpf_1_1Context.xhtml "The class representing the DPF execution context. This is used to configure several aspects of DPF li...")&amp; 



<a id="a33a89b830c012a1563bf6534d5de7d48" name="a33a89b830c012a1563bf6534d5de7d48"></a>## [◆ ](#a33a89b830c012a1563bf6534d5de7d48)withPremiumLicense()

 [Context](classansys_1_1dpf_1_1Context.xhtml) &amp; ansys::dpf::Context::withPremiumLicense  ( ) 

Sets the license context to Premium.

Use with DPF runtime R2025R1 or later.

Returns[Context](classansys_1_1dpf_1_1Context.xhtml "The class representing the DPF execution context. This is used to configure several aspects of DPF li...")&amp;