Skip to main content

Common Fluids Format 2023 R2

ansys::Project::SimProject Class Reference

Last update: 16.07.2025

Main object for Simulation based projects. More...

#include "SimProject.hpp"

Inheritance diagram for ansys::Project::SimProject:
ansys::Project::Project

Public Member Functions

 SimProject ()
 Constructor - See Project::Project()
 
virtual ~SimProject ()
 Constructor - See Project::~Project()
 
Error importMesh (const URL &pURL, Iterator &pIter, std::string pName="")
 Import a mesh in a Mesh/ subfolder of the project. More...
 
Iterator getMesh (const std::string &pName) const
 Retrieve Mesh iterator from Mesh/ folder, by name.
 
std::vector< std::string > getMeshes () const
 Retrieve all mesh names from Mesh/ folder.
 
Error importGeometry (const URL &pURL, Iterator &pIter, std::string pName="")
 Import a CAD in a Geo/ subfolder of the project. More...
 
Iterator getGeometry (const std::string &pName) const
 Retrieve Geometry iterator from Geometry/ folder, by name.
 
std::vector< std::string > getGeometries () const
 Retrieve all geometry file names from Geometry/ folder.
 
Error importItem (const std::string &pCategory, const URL &pURL, Iterator &pIter, std::string pName="")
 Import a file of any type in the Type/ subfolder of the project. More...
 
Iterator getItem (const std::string &pCategory, const std::string &pName) const
 Retrieve Item iterator from Category/ folder, by name.
 
std::vector< std::string > getItems (const std::string &pCategory) const
 Retrieve all item names from from Category/ folder.
 
Iterator newSimulation (const std::string &pName, const std::string &pType)
 Create a new Simulation folder in the SimProject. More...
 
Iterator getSimulation (const std::string &pName) const
 Retrieve a Simulation in the SimProject, by name.
 
std::vector< std::string > getSimulations () const
 Retrieve the list of Simulation names in the SimProject.
 
Error removeSimulation (const std::string &pName, bool pFlagErase)
 Remove a named simulation from the project. More...
 
Iterator duplicateSimulation (const std::string &pOld, const std::string &pNew)
 Duplicate a simulation to a new name. More...
 
void setCurrentSimulation (Iterator pSim)
 Set the current simulation link - i.e. the 'default' simulation. More...
 
Iterator getCurrentSimulation () const
 Returns the current simulation link - if any.
 
virtual Error checkProject (CheckProjectInfo &pInfo) const
 Check the currently loaded project for validity. More...
 
virtual Error upgradeProject ()
 Upgrade project to current version. More...
 
virtual Error copyMetadata (const Iterator &pSource, Iterator &pTarget) const
 Copy metadata between two project items.
 
virtual Error getInheritedMetadata (const Iterator &pIter, MetadataConst &pMeta)
 Return the metadata for the current iterator and include relevant data from parent iterators. More...
 
- Public Member Functions inherited from ansys::Project::Project
 Project ()
 Constructor. More...
 
virtual ~Project ()
 Destructor - Will close the project and release the lock (if any).
 
bool isLoaded () const
 Indicates if a project is currrently opened (or newly created with success).
 
virtual bool isProject (const URL &pLocation)
 Check if a filename is a project file (fast read, not entirely checked)
 
virtual Error newProject (const URL &pLocation)
 Create a project at the specified URL. More...
 
virtual Error openProject (const URL &pLocation, bool pReadOnly=false)
 Open a project at the specified URL. More...
 
virtual Error openProjectFromString (const std::string &pData, const URL &pProjectLocation, bool pReadOnly=false)
 Open a project by reading its data from a string. More...
 
Error saveProject ()
 Save the currently opened project.
 
Error saveProjectToString (std::string &pString)
 Save the currently opened project to an XML string.
 
Error saveAsProject (const URL &pLocation, bool pFlagCopyFiles=false, bool pFlagCopyExternal=false)
 Save the project index file to a new location. More...
 
Error exportProject (const URL &pLocation, bool pFlagCopyExternal=true, bool pFlagEnforceStructure=false)
 Export the project to a new location (keeping current project opened and unchanged). More...
 
Error archiveProject (const URL &pTargetArchive) const
 Compress the project to an archive (keeping current project opened and unchanged) More...
 
Error archiveProject (const URL &pTargetArchive, const std::vector< std::string > &pListIgnore) const
 Compress the project to an archive (keeping current project opened and unchanged) More...
 
Error forkProject (Iterator &pIter, const URL &pNewProjectFilename, Project *&pProject)
 Split the project at the specified location to a subproject. More...
 
Error loadSubProject (Iterator &pIter)
 Load the specified subproject. More...
 
std::vector< IteratorgetSubProjects ()
 Return the list of subprojects stored in the project.
 
Error loadAllSubProjects ()
 Load all subprojects stored in the project.
 
Error join (Iterator pIter)
 Join the subproject back to the master project.
 
Error getProjectLockInfo (const URL &pLocation, std::string &pLockInfo)
 Indicates if the specified project is locked and retrieve the lock information. More...
 
Error eraseProjectLock (const URL &pLocation)
 Erase the project lock. More...
 
Iterator copyItemTo (Iterator pSource, Project &pTarget, Iterator pTargetFolder=Iterator(), bool pRecursive=false)
 Copy the Iterator item to the target project. More...
 
Error closeProject ()
 Close the project and release the lock. More...
 
const URLgetProjectLocation () const
 Get the URL of the project file with path.
 
URL getProjectFolder () const
 Get the URL of the project folder, if enabled by policy.
 
ProjectStoragePolicygetStoragePolicy ()
 Return the StoragePolicy for the current project or to configure before newProject().
 
bool isLocalToProject (const URL &pURL) const
 Indicates if the specified absolute URL is inside the project folder.
 
bool isOwnedByProject (const URL &pURL) const
 If the specified URL is a file in the project folder, and registered, returns true.
 
Iterator getIteratorForURL (const URL &pURL) const
 If the specified URL is a file in the project folder, and registered, returns the Iterator.
 
URL getRelativePathToFile (const URL &pURL) const
 Future feature - Not available.
 
bool registerCallback (const std::string &pOwner, const std::string &pCallbackName, BaseCallback *pCallback)
 Register a function callback to a project event. More...
 
Error executeCallback (const std::string &pCallbackName, CallbackParams &pParams)
 Trigger any registered callback for this callback ID.
 
virtual Error copyRuntimeMetadata (const Iterator &pSource, Iterator &pTarget) const
 Copy all runtime metadata values from source to target iterator.
 
Iterator root () const
 Return the iterator to the project root folder.
 
Iterator get (const Path &pPath) const
 For a project Path, return the associated Iterator. More...
 
int getProjectId () const
 Return a project id, which will be the same as in the matching Iterator::getProjectId().
 

Protected Member Functions

virtual ProjectprojectObjectFactory () const
 Create a new object of the current effective project type.
 
- Protected Member Functions inherited from ansys::Project::Project
virtual Error copyProjectContent (Iterator pFolder, const URL &pSourceFolder, const URL &pTargetFolder, std::map< Iterator, URL > &pURLChanges, bool pCopyExternalFiles, bool pEnforceStructure)
 Internal function - Copy a folder iterator content files from a source directory to target. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ansys::Project::Project
static Error unarchiveProject (const URL &pArchive, const URL &pTargetFolder)
 Extract the project to an from an archive,. More...
 

Detailed Description

Main object for Simulation based projects.

The SimProject manages the .flprj index file, and (if enabled) the .cffdb folder. The project contains the global storage settings, and contains Simulation subfolders.

The project concept is detailed in Project API

Member Function Documentation

◆ checkProject()

Error ansys::Project::SimProject::checkProject ( CheckProjectInfo pInfo) const
virtual

Check the currently loaded project for validity.

Project::checkProject() will only check files and folders, while SimProject::checkProject() will check the Simulation and their files for consistency and project syntax compliance.

Parameters
pInfoCheckProjectInfo structure used to specify check project settings and return the results.

Reimplemented from ansys::Project::Project.

◆ duplicateSimulation()

Iterator ansys::Project::SimProject::duplicateSimulation ( const std::string &  pOld,
const std::string &  pNew 
)

Duplicate a simulation to a new name.

Metadata is copied Input files stored in the source simulation are copied over and linked to the new location. Input files referencing files outside of the simulation are kept as such.

Returns
Iterator of the newly created run

◆ getInheritedMetadata()

Error ansys::Project::SimProject::getInheritedMetadata ( const Iterator pIter,
MetadataConst pMeta 
)
virtual

Return the metadata for the current iterator and include relevant data from parent iterators.

In Project this only returns the metadata for the current iterator, unless the parent item is a Transparent item, the data is then also included. Used in some UI elements.

Reimplemented from ansys::Project::Project.

◆ importGeometry()

Error ansys::Project::SimProject::importGeometry ( const URL pURL,
Iterator pIter,
std::string  pName = "" 
)

Import a CAD in a Geo/ subfolder of the project.

Parameters
pURLFile location of the file to copy
pInfoReturned Iterator of the newly imported file
pNameName of the new project entry in Geo/
Returns
Error state

◆ importItem()

Error ansys::Project::SimProject::importItem ( const std::string &  pCategory,
const URL pURL,
Iterator pIter,
std::string  pName = "" 
)

Import a file of any type in the Type/ subfolder of the project.

Parameters
pCategoryFile type - will also be assigned as DataType of the file
pURLFile location of the file to copy
pInfoReturned Iterator of the newly imported file
pNameName of the new project entry in Type/
Returns
Error state

◆ importMesh()

Error ansys::Project::SimProject::importMesh ( const URL pURL,
Iterator pIter,
std::string  pName = "" 
)

Import a mesh in a Mesh/ subfolder of the project.

Parameters
pURLFile location of the file to copy
pInfoReturned Iterator of the newly imported file
pNameName of the new project entry in Mesh/
Returns
Error state

◆ newSimulation()

Iterator ansys::Project::SimProject::newSimulation ( const std::string &  pName,
const std::string &  pType 
)

Create a new Simulation folder in the SimProject.

Parameters
pNameName of the new simulation, must be unique
pTypeSolver type of the simulation (ex: ANSYS_FLUENT)

◆ removeSimulation()

Error ansys::Project::SimProject::removeSimulation ( const std::string &  pName,
bool  pFlagErase 
)

Remove a named simulation from the project.

Parameters
pNameName of the simulation
pFlagEraseEnable to erase all files and subfolders

◆ setCurrentSimulation()

void ansys::Project::SimProject::setCurrentSimulation ( Iterator  pSim)

Set the current simulation link - i.e. the 'default' simulation.

The current simulation link is set automatically to any newly created simulation, and can be changed afterwards.

◆ upgradeProject()

Error ansys::Project::SimProject::upgradeProject ( )
virtual

Upgrade project to current version.

See Project::upgradeProject() The SimProject version will upgrade the Simulation and related concepts to the latest project file format.

Reimplemented from ansys::Project::Project.

Connect with Ansys