OpenVSP API Documentation 3.41.0
 
Loading...
Searching...
No Matches
General API Utility Functions

This group of functions is provided for general API utilities, such as printing to stdout, performing basic math functions, and identifying basic OpenVSP information. Click here to return to the main page. More...

Functions

void vsp::VSPCheckSetup ()
 
void vsp::VSPRenew ()
 
std::string vsp::GetVSPVersion ()
 
int vsp::GetVSPVersionMajor ()
 
int vsp::GetVSPVersionMinor ()
 
int vsp::GetVSPVersionChange ()
 
std::string vsp::GetVSPExePath ()
 
bool vsp::SetVSPAEROPath (const std::string &path)
 
std::string vsp::GetVSPAEROPath ()
 
bool vsp::CheckForVSPAERO (const std::string &path)
 

Detailed Description

Function Documentation

◆ CheckForVSPAERO()

bool vsp::CheckForVSPAERO ( const std::string & path)
extern

Check if all VSPAERO executables (Solver, Viewer, and Slicer) are in a given directory. Note that this function will return false if only one or two VSPAERO executables are found. An error message will indicate the executables that are missing. This may be acceptable, as only the Solver is needed in all cases. The Viewer and Slicer may not be needed.

string vspaero_path = "C:/Users/example_user/Documents/OpenVSP_3.4.5";
if ( CheckForVSPAERO( vspaero_path ) )
{
SetVSPAEROPath( vspaero_path );
}
bool CheckForVSPAERO(const std::string &path)
bool SetVSPAEROPath(const std::string &path)
See also
GetVSPExePath, GetVSPAEROPath, SetVSPAEROPath
Parameters
[in]pathAbsolute path to check for VSPAERO executables
Returns
Flag that indicates if all VSPAERO executables are found or not

◆ GetVSPAEROPath()

std::string vsp::GetVSPAEROPath ( )
extern

Get the path that OpenVSP will use to look for all VSPAERO executables (Solver, Slicer, and Viewer) when attempting to execute VSPAERO. If the VSPAERO executables are not in this location, they must either be copied there or the VSPAERO path must be set using SetVSPAEROPath.

{
Print( "VSPAERO is not where OpenVSP thinks it is. I should move the VSPAERO executable or call SetVSPAEROPath." );
}
std::string GetVSPAEROPath()
See also
GetVSPExePath, CheckForVSPAERO, SetVSPAEROPath
Returns
Path OpenVSP will look for VSPAERO

◆ GetVSPExePath()

std::string vsp::GetVSPExePath ( )
extern

Get the path to the OpenVSP executable. OpenVSP will assume that the VSPAERO, VSPSLICER, and VSPVIEWER are in the same directory unless instructed otherwise.

Print( "The current VSP executable path is: ", false );
Print( GetVSPExePath() );
std::string GetVSPExePath()
See also
SetVSPAEROPath, CheckForVSPAERO, GetVSPAEROPath
Returns
Path to the OpenVSP executable

◆ GetVSPVersion()

std::string vsp::GetVSPVersion ( )
extern

Get the version of the OpenVSP instance currently running

Print( "The current OpenVSP version is: ", false );
Print( GetVSPVersion() );
std::string GetVSPVersion()
Returns
OpenVSP version string (i.e. "OpenVSP 3.17.1")

◆ GetVSPVersionChange()

int vsp::GetVSPVersionChange ( )
extern

Get the change version of the OpenVSP instance currently running as an integer

Print( "The current OpenVSP version is: ", false );
int major = GetVSPVersionMajor();
int minor = GetVSPVersionMinor();
int change = GetVSPVersionChange();
Print( formatInt(major) + "." + formatInt(minor) + "." + formatInt(change) );
int GetVSPVersionChange()
int GetVSPVersionMinor()
int GetVSPVersionMajor()
Returns
OpenVSP change version number (i.e. Y in 3.X.Y)

◆ GetVSPVersionMajor()

int vsp::GetVSPVersionMajor ( )
extern

Get the major version of the OpenVSP instance currently running as an integer

Print( "The current OpenVSP version is: ", false );
int major = GetVSPVersionMajor();
int minor = GetVSPVersionMinor();
int change = GetVSPVersionChange();
Print( formatInt(major) + "." + formatInt(minor) + "." + formatInt(change) );
Returns
OpenVSP major version number (i.e. 3 in 3.X.Y)

◆ GetVSPVersionMinor()

int vsp::GetVSPVersionMinor ( )
extern

Get the minor version of the OpenVSP instance currently running as an integer

Print( "The current OpenVSP version is: ", false );
int major = GetVSPVersionMajor();
int minor = GetVSPVersionMinor();
int change = GetVSPVersionChange();
Print( formatInt(major) + "." + formatInt(minor) + "." + formatInt(change) );
Returns
OpenVSP minor version number (i.e. X in 3.X.Y)

◆ SetVSPAEROPath()

bool vsp::SetVSPAEROPath ( const std::string & path)
extern

Set the path to the VSPAERO executables (Solver, Viewer, and Slicer). By default, OpenVSP will assume that the VSPAERO executables are in the same directory as the VSP executable. However, this may need to be changed when using certain API languages like MATLAB and Python. For example, Python may treat the location of the Python executable as the VSP executable path, so either the VSPAERO executable needs to be moved to the same directory or this function can be called to tell Python where to look for VSPAERO.

{
string vspaero_path = "C:/Users/example_user/Documents/OpenVSP_3.4.5";
SetVSPAEROPath( vspaero_path );
}
See also
GetVSPExePath, CheckForVSPAERO, GetVSPAEROPath
Parameters
[in]pathAbsolute path to directory containing VSPAERO executable
Returns
Flag that indicates whether or not the path was set correctly

◆ VSPCheckSetup()

void vsp::VSPCheckSetup ( )
extern

Check if OpenVSP has been initialized successfully. If not, the OpenVSP instance will be exited. This call should be placed at the beginning of all API scripts.

// Continue to do things...
void VSPCheckSetup()

◆ VSPRenew()

void vsp::VSPRenew ( )
extern

Clear and reinitialize OpenVSP to all default settings

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
SetParmVal( pod_id, "Y_Rel_Location", "XForm", 2.0 );
if ( FindGeoms().size() != 0 ) { Print( "ERROR: VSPRenew" ); }
void VSPRenew()
std::vector< std::string > FindGeoms()
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
double SetParmVal(const std::string &parm_id, double val)