Skip to main content

Common Fluids Format 2026 R1

ansys::Project::Simulation Class Reference

Last update: 24.03.2026

Subfolder of a Project, regrouping input files and Run subfolders. More...

#include "Simulation.hpp"

Inheritance diagram for ansys::Project::Simulation:
ansys::Project::SimBase

Public Member Functions

 Simulation (Iterator pIter)
 Constructor from Iterator.
More...
 
virtual ~Simulation ()
 
virtual Error isValid () const
 Returns error with message if invalid. More...
 
Iterator getData ()
 Return the current Data for the simulation. More...
 
Iterator getResult (const std::string &pDataType)
 Returns the latest result of the specified type, in the current Run. More...
 
Run newRun (std::string pName, Run::RunOutputType pType)
 Create a Run folder in the current Simulation. More...
 
Run newRunInFolder (std::string pName, Run::RunOutputType pType, Iterator pFolder)
 Create a Run folder in the current Simulation subfolder. More...
 
Iterator getRun (const std::string &pName) const
 Returns Iterator to the children Run with the given name. More...
 
std::vector< std::string > getRuns () const
 Returns list of children Run folders, as vector of their names (see: getRun() ) More...
 
Error removeRun (const std::string &pName, bool pFlagErase)
 Remove the specified run from the simulation. More...
 
RunGroup newRunGroup (std::string pName, Run::RunOutputType pType)
 Create a new RunGroup - a virtual group of separate runs, can be assigned a type. More...
 
RunGroup getRunGroup (const std::string &pName) const
 Return the RunGroup by this name, in the current Simulation. More...
 
std::vector< std::string > getRunGroups () const
 Return the list of RunGroups, by name, in this simulation. More...
 
Error removeRunGroup (const std::string &pName, bool pFlagEraseRuns)
 
void newLink (const std::string pKey, const Iterator &pIter)
 
Iterator getLink (const std::string pKey)
 
bool hasLink (const std::string pKey)
 
void setCurrentRun (Iterator pRun)
 Set the current Run in the simulation. More...
 
Iterator getCurrentRun () const
 Return the current Run in the simulation - see setCurrentRun() More...
 
- Public Member Functions inherited from ansys::Project::SimBase
bool ok () const
 
std::string getName () const
 Returns the object name in the project. More...
 
virtual Iterator getCase () const
 Returns the case file associated with this folder. More...
 
Iterator setCase (Iterator pCaseFile)
 Set the case file associated with this item. More...
 
void setMainDataType (const std::string &pDataType)
 Set the result type expected as default output for runs. More...
 
std::string getMainDataType () const
 Returns the result type expected as default output for runs (see: setMainDataType() ) More...
 
Iterator copyInput (Path pPath, bool pInInputFolder=false)
 Copy the specified project file into the current folder. More...
 
Iterator setInput (Path pPath)
 Register a files as Input/ to this folder. More...
 
std::vector< IteratorgetInputs (Error *pErrorPtr=0) const
 Return the list of registered inputs for this simulation. More...
 
Iterator getInputByType (const std::string &pType, std::string pSubtype="") const
 Search for a -single- input of the specified type (and optionally, subtype) More...
 
std::vector< IteratorgetInputsByType (const std::string &pType, std::string pSubtype="", Error *pErrorPtr=0) const
 Search for one or multiple input of the specified type (and optionally, subtype) More...
 
MetadatagetMeta ()
 Access the Iterator Metadata, equivalent to getIterator().getMeta() More...
 
const MetadatagetMeta () const
 Access the Iterator Metadata, equivalent to getIterator().getMeta() More...
 
virtual Iterator getIterator () const
 Access the Iterator for this item. More...
 
 operator Iterator () const
 

Static Public Member Functions

static bool isSimulation (const Iterator &pIter)
 

Protected Member Functions

std::vector< std::string > getListOfSubclass (const std::string &pSubclass) const
 Search child hierarchy for items of the specified subclass. More...
 
- Protected Member Functions inherited from ansys::Project::SimBase
 SimBase (Iterator pIter)
 
virtual ~SimBase ()
 
Error copyDatafileMeta (const Iterator &pInput, Iterator &pOutput)
 

Additional Inherited Members

- Protected Attributes inherited from ansys::Project::SimBase
Iterator aIter
 

Detailed Description

Subfolder of a Project, regrouping input files and Run subfolders.

Subclass of Iterator, can be constructed from an Iterator, the Simulation is ok() only if the provided iterator is of the appropriate subclass.

  Iterator it = prj.get("/Sim1/");
  Simulation sim(it);
    sim.ok()

In a Simulation, one or multiple Run are created, to store the simulation Results, organized in Output subfolders. The Simulation might have settings (Metadata) related to the solver settings, or common to all results in this folder hiearchy.

Constructor & Destructor Documentation

◆ Simulation()

ansys::Project::Simulation::Simulation ( Iterator  pIter)

Constructor from Iterator.

The input Iterator must be of subclass Simulation If the subclass is not Simulation, the Simulation object is invalid ( !ok() )

◆ ~Simulation()

virtual ansys::Project::Simulation::~Simulation ( )
inlinevirtual

Member Function Documentation

◆ getCurrentRun()

Iterator ansys::Project::Simulation::getCurrentRun ( ) const

Return the current Run in the simulation - see setCurrentRun()

◆ getData()

Iterator ansys::Project::Simulation::getData ( )

Return the current Data for the simulation.

The current data is the latest Result, of the main data type, for the current Run.

◆ getLink()

Iterator ansys::Project::Simulation::getLink ( const std::string  pKey)

◆ getListOfSubclass()

std::vector< std::string > ansys::Project::Simulation::getListOfSubclass ( const std::string &  pSubclass) const
protected

Search child hierarchy for items of the specified subclass.

◆ getResult()

Iterator ansys::Project::Simulation::getResult ( const std::string &  pDataType)

Returns the latest result of the specified type, in the current Run.

◆ getRun()

Iterator ansys::Project::Simulation::getRun ( const std::string &  pName) const

Returns Iterator to the children Run with the given name.

◆ getRunGroup()

RunGroup ansys::Project::Simulation::getRunGroup ( const std::string &  pName) const

Return the RunGroup by this name, in the current Simulation.

If the rungroup is in a subfolder the path to it is expected (same path type returned by getRunGroups() ) Simulation/RunGroup -> RunGroup Simulation/folder/RunGroup -> folder/RunGroup

◆ getRunGroups()

std::vector< std::string > ansys::Project::Simulation::getRunGroups ( ) const

Return the list of RunGroups, by name, in this simulation.

If the rungroup is in a subfolder the relative path to it is included Simulation/RunGroup -> RunGroup Simulation/folder/RunGroup -> folder/RunGroup

◆ getRuns()

std::vector< std::string > ansys::Project::Simulation::getRuns ( ) const

Returns list of children Run folders, as vector of their names (see: getRun() )

If the run is in a subfolder the relative path to it is included Simulation/Run -> Run Simulation/folder/Run -> folder/Run

◆ hasLink()

bool ansys::Project::Simulation::hasLink ( const std::string  pKey)

◆ isSimulation()

bool ansys::Project::Simulation::isSimulation ( const Iterator pIter)
static

◆ isValid()

Error ansys::Project::Simulation::isValid ( ) const
virtual

Returns error with message if invalid.

Implements ansys::Project::SimBase.

◆ newLink()

void ansys::Project::Simulation::newLink ( const std::string  pKey,
const Iterator pIter 
)

◆ newRun()

Run ansys::Project::Simulation::newRun ( std::string  pName,
Run::RunOutputType  pType 
)

Create a Run folder in the current Simulation.

The Run folder is physical or virtual, depending of the project ProjectStoragePolicy The new run is given a name, and a type.

Parameters
pName: Name of the new Run, must be unique in the simulation
pTypeType of the new run (Transient, Steady, etc.) see Run

◆ newRunGroup()

RunGroup ansys::Project::Simulation::newRunGroup ( std::string  pName,
Run::RunOutputType  pType 
)

Create a new RunGroup - a virtual group of separate runs, can be assigned a type.

From the type, the mandatory and automatic variable constraints will apply to the RunGroup->Run association, as it would normally for Run->Output.

A RunGroup permits to define multiple levels of run type, for example a parametric RunGroup would contain transient Runs. The design point parameters are then assigned at the Run level, while the varying time values at the Output level.

Parameters
pName: Name of the new RunGroup, must be unique in the simulation
pTypeType of the new group (Transient, Steady, etc.) see Run .

◆ newRunInFolder()

Run ansys::Project::Simulation::newRunInFolder ( std::string  pName,
Run::RunOutputType  pType,
Iterator  pFolder 
)

Create a Run folder in the current Simulation subfolder.

The Run folder is physical or virtual, depending of the project ProjectStoragePolicy The new run is given a name, and a type.

Parameters
pName: Name of the new Run, must be unique in the simulation
pTypeType of the new run (Transient, Steady, etc.) see Run

◆ removeRun()

Error ansys::Project::Simulation::removeRun ( const std::string &  pName,
bool  pFlagErase 
)

Remove the specified run from the simulation.

Parameters
pFlagEraseIf enabled, will erase the run folder and its data

◆ removeRunGroup()

Error ansys::Project::Simulation::removeRunGroup ( const std::string &  pName,
bool  pFlagEraseRuns 
)

◆ setCurrentRun()

void ansys::Project::Simulation::setCurrentRun ( Iterator  pRun)

Set the current Run in the simulation.

The current run is the 'default' run to use for post-processing, or to load the latest results. Its automatically set to the latest Run created

Parameters
pRunIterator to the existing run to mark as current

Connect with Ansys