OpenVSP API Documentation 3.51.3
Loading...
Searching...
No Matches
Analysis Manager Functions

This group is for functions included in the Analysis Manager. The Analysis Manager allows for OpenVSP analyses to be setup and run through the API without having to modify Parms directly. Examples are available for every available analysis type. The results of running an analysis can be accessed through the functions defined in the Results group. Click here to return to the main page. More...

Functions

int vsp::GetNumAnalysis ()
std::vector< std::string > vsp::ListAnalysis ()
std::vector< std::string > vsp::GetAnalysisInputNames (const std::string &analysis)
std::string vsp::GetAnalysisDoc (const std::string &analysis)
std::string vsp::GetAnalysisInputDoc (const std::string &analysis, const std::string &name)
std::string vsp::ExecAnalysis (const std::string &analysis)
int vsp::GetNumAnalysisInputData (const std::string &analysis, const std::string &name)
int vsp::GetAnalysisInputType (const std::string &analysis, const std::string &name)
const std::vector< int > & vsp::GetIntAnalysisInput (const std::string &analysis, const std::string &name, int index=0)
const std::vector< double > & vsp::GetDoubleAnalysisInput (const std::string &analysis, const std::string &name, int index=0)
const std::vector< std::string > & vsp::GetStringAnalysisInput (const std::string &analysis, const std::string &name, int index=0)
const std::vector< vec3d > & vsp::GetVec3dAnalysisInput (const std::string &analysis, const std::string &name, int index=0)
void vsp::SetAnalysisInputDefaults (const std::string &analysis)
void vsp::SetIntAnalysisInput (const std::string &analysis, const std::string &name, const std::vector< int > &indata, int index=0)
void vsp::SetDoubleAnalysisInput (const std::string &analysis, const std::string &name, const std::vector< double > &indata, int index=0)
void vsp::SetStringAnalysisInput (const std::string &analysis, const std::string &name, const std::vector< std::string > &indata, int index=0)
void vsp::SetVec3dAnalysisInput (const std::string &analysis, const std::string &name, const std::vector< vec3d > &indata, int index=0)
void vsp::PrintAnalysisInputs (const std::string &analysis_name)
void vsp::PrintAnalysisDocs (const std::string &analysis_name)
std::string vsp::AddGeometryAnalysis ()
void vsp::AddGeometryAnalysisAzEl (const std::string &geom_analysis_id, double azimuth, double elevation)
void vsp::DeleteGeometryAnalysisAzEl (const std::string &geom_analysis_id, int index)
void vsp::DeleteAllGeometryAnalysisAzEl (const std::string &geom_analysis_id)
int vsp::GetNumGeometryAnalysisAzEl (const std::string &geom_analysis_id)
std::string vsp::GetGeometryAnalysisAzimuthParm (const std::string &geom_analysis_id, int index)
std::string vsp::GetGeometryAnalysisElevationParm (const std::string &geom_analysis_id, int index)
void vsp::DeleteAllGeometryAnalyses ()
std::vector< std::string > vsp::GetAllGeometryAnalysesIDVec ()
void vsp::SetActiveGeometryAnalysis (const std::string &id)
std::string vsp::GetActiveGeometryAnalysis ()
std::string vsp::MakeMeshGeom (const std::string &ga_id)

Detailed Description

Function Documentation

◆ AddGeometryAnalysis()

std::string vsp::AddGeometryAnalysis ( )
extern

Add a new Geometry Analysis case to the Geometry Analysis Manager. The Geometry Analysis Manager allows users to configure and execute geometric analysis tasks typical of the aircraft design process, such as wetted area, projected area, mass properties, clearance, and visibility analyses.

//==== GeometryAnalysis: Add and configure a case ====//
string ga_id = AddGeometryAnalysis();
Print( "Added Geometry Analysis: ", false );
Print( ga_id );
if ( ga_id.length() == 0 || ga_id == "NONE" )
{
Print( "ERROR: AddGeometryAnalysis returned no id" );
__failure++;
}
std::string AddGeometryAnalysis()
See also
DeleteGeometryAnalysis, DeleteAllGeometryAnalyses, GetAllGeometryAnalysesIDVec
Returns
string ID of the newly created Geometry Analysis case

◆ AddGeometryAnalysisAzEl()

void vsp::AddGeometryAnalysisAzEl ( const std::string & geom_analysis_id,
double azimuth,
double elevation )
extern

Delete a specific Geometry Analysis case from the Geometry Analysis Manager.

//==== GeometryAnalysis: Delete a specific case ====//
string ga_id = AddGeometryAnalysis();
if ( GetAllGeometryAnalysesIDVec().size() != 1 )
{
Print( "ERROR: AddGeometryAnalysis did not add a case" );
__failure++;
}
DeleteGeometryAnalysis( ga_id );
if ( GetAllGeometryAnalysesIDVec().size() != 0 )
{
Print( "ERROR: DeleteGeometryAnalysis did not remove the case" );
__failure++;
}
std::vector< std::string > GetAllGeometryAnalysesIDVec()
See also
AddGeometryAnalysis, DeleteAllGeometryAnalyses, GetAllGeometryAnalysesIDVec
Parameters
[in]idstring ID of the Geometry Analysis case to delete

Add a discrete azimuth and elevation pair to a Geometry Analysis case. A visibility analysis with the discrete visibility flag set is evaluated at each pair that has been added.

string ga_id = AddGeometryAnalysis();
if ( GetNumGeometryAnalysisAzEl( ga_id ) != 0 )
{
Print( "ERROR: a new Geometry Analysis already carries az/el pairs" );
__failure++;
}
AddGeometryAnalysisAzEl( ga_id, 30.0, 15.0 );
if ( GetNumGeometryAnalysisAzEl( ga_id ) != 1 )
{
Print( "ERROR: AddGeometryAnalysisAzEl did not add a pair" );
__failure++;
}
// Each pair is a pair of Parms, so the values can be read and changed.
string az_id = GetGeometryAnalysisAzimuthParm( ga_id, 0 );
string el_id = GetGeometryAnalysisElevationParm( ga_id, 0 );
if ( !closeTo( GetParmVal( az_id ), 30.0, 1e-6 ) || !closeTo( GetParmVal( el_id ), 15.0, 1e-6 ) )
{
Print( "ERROR: the az/el pair does not hold the values it was given" );
__failure++;
}
// An ID that is not a Geometry Analysis has to be rejected.
AddGeometryAnalysisAzEl( "NOSUCHANALYSIS", 0.0, 0.0 );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: AddGeometryAnalysisAzEl accepted a bad ID" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
std::string GetGeometryAnalysisElevationParm(const std::string &geom_analysis_id, int index)
void AddGeometryAnalysisAzEl(const std::string &geom_analysis_id, double azimuth, double elevation)
std::string GetGeometryAnalysisAzimuthParm(const std::string &geom_analysis_id, int index)
int GetNumGeometryAnalysisAzEl(const std::string &geom_analysis_id)
double GetParmVal(const std::string &parm_id)
See also
AddGeometryAnalysis, DeleteGeometryAnalysisAzEl, GetNumGeometryAnalysisAzEl
Parameters
[in]geom_analysis_idstring Geometry Analysis case ID
[in]azimuthdouble Azimuth angle (degrees, -180 to 180)
[in]elevationdouble Elevation angle (degrees, -90 to 90)

◆ DeleteAllGeometryAnalyses()

void vsp::DeleteAllGeometryAnalyses ( )
extern

Delete all Geometry Analysis cases from the Geometry Analysis Manager.

//==== GeometryAnalysis: Delete all cases ====//
string ga_id_1 = AddGeometryAnalysis();
string ga_id_2 = AddGeometryAnalysis();
if ( ga_id_1 == ga_id_2 )
{
Print( "ERROR: AddGeometryAnalysis reused an ID" );
__failure++;
}
if ( GetAllGeometryAnalysesIDVec().size() != 2 )
{
Print( "ERROR: the two cases were not both added" );
__failure++;
}
array < string > @ga_ids = GetAllGeometryAnalysesIDVec();
Print( "Number of Geometry Analyses after delete: ", false );
Print( ga_ids.size() );
if ( ga_ids.size() != 0 )
{
Print( "ERROR: DeleteAllGeometryAnalyses left cases behind" );
__failure++;
}
void DeleteAllGeometryAnalyses()
See also
AddGeometryAnalysis, DeleteGeometryAnalysis, GetAllGeometryAnalysesIDVec

◆ DeleteAllGeometryAnalysisAzEl()

void vsp::DeleteAllGeometryAnalysisAzEl ( const std::string & geom_analysis_id)
extern

Delete every azimuth and elevation pair from a Geometry Analysis case

string ga_id = AddGeometryAnalysis();
AddGeometryAnalysisAzEl( ga_id, 30.0, 15.0 );
AddGeometryAnalysisAzEl( ga_id, 60.0, 45.0 );
if ( GetNumGeometryAnalysisAzEl( ga_id ) != 0 )
{
Print( "ERROR: DeleteAllGeometryAnalysisAzEl left pairs behind" );
__failure++;
}
// Clearing an empty case is not an error.
if ( GetNumTotalErrors() != 0 )
{
Print( "ERROR: DeleteAllGeometryAnalysisAzEl complained about an empty case" );
__failure++;
}
void DeleteAllGeometryAnalysisAzEl(const std::string &geom_analysis_id)
See also
AddGeometryAnalysisAzEl, DeleteGeometryAnalysisAzEl
Parameters
[in]geom_analysis_idstring Geometry Analysis case ID

◆ DeleteGeometryAnalysisAzEl()

void vsp::DeleteGeometryAnalysisAzEl ( const std::string & geom_analysis_id,
int index )
extern

Delete one azimuth and elevation pair from a Geometry Analysis case

string ga_id = AddGeometryAnalysis();
AddGeometryAnalysisAzEl( ga_id, 30.0, 15.0 );
AddGeometryAnalysisAzEl( ga_id, 60.0, 45.0 );
// Only the indexed pair goes, and the rest slide down.
if ( GetNumGeometryAnalysisAzEl( ga_id ) != 1 )
{
Print( "ERROR: DeleteGeometryAnalysisAzEl did not remove one pair" );
__failure++;
}
else
{
if ( !closeTo( GetParmVal( GetGeometryAnalysisAzimuthParm( ga_id, 0 ) ), 60.0, 1e-6 ) )
{
Print( "ERROR: DeleteGeometryAnalysisAzEl removed the wrong pair" );
__failure++;
}
}
// An index past the end has to be rejected.
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DeleteGeometryAnalysisAzEl accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void DeleteGeometryAnalysisAzEl(const std::string &geom_analysis_id, int index)
See also
AddGeometryAnalysisAzEl, DeleteAllGeometryAnalysisAzEl
Parameters
[in]geom_analysis_idstring Geometry Analysis case ID
[in]indexint Az/El pair index

◆ ExecAnalysis()

std::string vsp::ExecAnalysis ( const std::string & analysis)
extern

Execute an analysis through the Analysis Manager

string analysis_name = "VSPAEROComputeGeometry";
string res_id = ExecAnalysis( analysis_name );
if ( res_id.length() == 0 )
{
Print( "ERROR: ExecAnalysis returned no id" );
__failure++;
}
std::string ExecAnalysis(const std::string &analysis)
Parameters
[in]analysisstring Analysis name
Returns
string Result ID

◆ GetActiveGeometryAnalysis()

std::string vsp::GetActiveGeometryAnalysis ( )
extern

Get the ID of the active Geometry Analysis case.

string ga_id = AddGeometryAnalysis();
string active = GetActiveGeometryAnalysis();
if ( active.length() == 0 )
{
Print( "ERROR: GetActiveGeometryAnalysis returned nothing" );
__failure++;
}
std::string GetActiveGeometryAnalysis()
void SetActiveGeometryAnalysis(const std::string &id)
See also
SetActiveGeometryAnalysis
Returns
string Active Geometry Analysis case ID (empty string if none)

◆ GetAllGeometryAnalysesIDVec()

std::vector< std::string > vsp::GetAllGeometryAnalysesIDVec ( )
extern

Get a vector of all Geometry Analysis case IDs in the Geometry Analysis Manager.

//==== GeometryAnalysis: List all cases ====//
string ga_id_1 = AddGeometryAnalysis();
string ga_id_2 = AddGeometryAnalysis();
array < string > @ga_ids = GetAllGeometryAnalysesIDVec();
if ( ga_ids.length() == 0 )
{
Print( "ERROR: GetAllGeometryAnalysesIDVec returned nothing" );
__failure++;
}
for ( int i = 0; i < int( ga_ids.size() ); i++ )
{
Print( "Geometry Analysis ID: ", false );
Print( ga_ids[i] );
}
See also
AddGeometryAnalysis, DeleteGeometryAnalysis, DeleteAllGeometryAnalyses
Returns
vector<string> Array of all Geometry Analysis case IDs

◆ GetAnalysisDoc()

std::string vsp::GetAnalysisDoc ( const std::string & analysis)
extern

Get the analysis documentation string

string analysis_name = "VSPAEROComputeGeometry";
string doc = GetAnalysisDoc( analysis_name );
if ( doc.length() == 0 )
{
Print( "ERROR: GetAnalysisDoc returned nothing" );
__failure++;
}
std::string GetAnalysisDoc(const std::string &analysis)
Parameters
[in]analysisstring Analysis name
Returns
string Documentation string

◆ GetAnalysisInputDoc()

std::string vsp::GetAnalysisInputDoc ( const std::string & analysis,
const std::string & name )
extern

Get the documentation string for the particular analysis and input

Parameters
[in]analysisstring Analysis name
[in]namestring Input name
Returns
string Documentation string

◆ GetAnalysisInputNames()

std::vector< std::string > vsp::GetAnalysisInputNames ( const std::string & analysis)
extern

Get the name of every available input for a particular analysis

string analysis_name = "VSPAEROComputeGeometry";
array<string>@ in_names = GetAnalysisInputNames( analysis_name );
if ( in_names.length() == 0 )
{
Print( "ERROR: GetAnalysisInputNames returned nothing" );
__failure++;
}
Print("Analysis Inputs: ");
for ( int i = 0; i < int( in_names.size() ); i++)
{
Print( ( "\t" + in_names[i] + "\n" ) );
}
std::vector< std::string > GetAnalysisInputNames(const std::string &analysis)
Parameters
[in]analysisstring Analysis name
Returns
vector<string> Array of input names

◆ GetAnalysisInputType()

int vsp::GetAnalysisInputType ( const std::string & analysis,
const std::string & name )
extern

Get the data type for a particulat analysis type and input

string analysis = "VSPAEROComputeGeometry";
array < string > @ inp_array = GetAnalysisInputNames( analysis );
if ( inp_array.size() == 0 )
{
Print( "ERROR: GetAnalysisInputNames returned nothing" );
__failure++;
}
for ( int j = 0; j < int( inp_array.size() ); j++ )
{
int typ = GetAnalysisInputType( analysis, inp_array[j] );
// Every input the analysis lists has to report a real data type.
if ( typ == INVALID_TYPE )
{
Print( "ERROR: GetAnalysisInputType returned INVALID_TYPE for " + inp_array[j] );
__failure++;
}
}
// An input that does not exist has to report INVALID_TYPE.
if ( GetAnalysisInputType( analysis, "NoSuchInput" ) != INVALID_TYPE )
{
Print( "ERROR: GetAnalysisInputType accepted an unknown input" );
__failure++;
}
// That lookup failure was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
int GetAnalysisInputType(const std::string &analysis, const std::string &name)
@ INVALID_TYPE
See also
RES_DATA_TYPE
Parameters
[in]analysisstring Analysis name
[in]namestring Input name
Returns
int Data type enum (i.e. DOUBLE_DATA)

◆ GetDoubleAnalysisInput()

const std::vector< double > & vsp::GetDoubleAnalysisInput ( const std::string & analysis,
const std::string & name,
int index = 0 )
extern

Get the current double values for the particular analysis, input, and data index

array<double> vinfFCinput = GetDoubleAnalysisInput( "ParasiteDrag", "Vinf" );
if ( vinfFCinput.length() == 0 )
{
Print( "ERROR: GetDoubleAnalysisInput returned nothing" );
__failure++;
}
vinfFCinput[0] = 629;
SetDoubleAnalysisInput( "ParasiteDrag", "Vinf", vinfFCinput );
const std::vector< double > & GetDoubleAnalysisInput(const std::string &analysis, const std::string &name, int index=0)
void SetDoubleAnalysisInput(const std::string &analysis, const std::string &name, const std::vector< double > &indata, int index=0)
See also
RES_DATA_TYPE, SetDoubleAnalysisInput
Parameters
[in]analysisstring Analysis name
[in]namestring Input name
[in]indexint Data index
Returns
vector<double> Array of analysis input values

◆ GetGeometryAnalysisAzimuthParm()

std::string vsp::GetGeometryAnalysisAzimuthParm ( const std::string & geom_analysis_id,
int index )
extern

Get the Parm ID of the azimuth of one az/el pair, so its value can be read or changed

See also
AddGeometryAnalysisAzEl, GetGeometryAnalysisElevationParm
Parameters
[in]geom_analysis_idstring Geometry Analysis case ID
[in]indexint Az/El pair index
Returns
string Azimuth Parm ID

◆ GetGeometryAnalysisElevationParm()

std::string vsp::GetGeometryAnalysisElevationParm ( const std::string & geom_analysis_id,
int index )
extern

Get the Parm ID of the elevation of one az/el pair, so its value can be read or changed

See also
AddGeometryAnalysisAzEl, GetGeometryAnalysisAzimuthParm
Parameters
[in]geom_analysis_idstring Geometry Analysis case ID
[in]indexint Az/El pair index
Returns
string Elevation Parm ID

◆ GetIntAnalysisInput()

const std::vector< int > & vsp::GetIntAnalysisInput ( const std::string & analysis,
const std::string & name,
int index = 0 )
extern

Get the current integer values for the particular analysis, input, and data index

//==== Analysis: VSPAero Compute Geometry ====//
string analysis_name = "VSPAEROComputeGeometry";
// Set to panel method
array< int > thick_set = GetIntAnalysisInput( analysis_name, "GeomSet" );
if ( thick_set.length() == 0 )
{
Print( "ERROR: GetIntAnalysisInput returned nothing" );
__failure++;
}
array< int > thin_set = GetIntAnalysisInput( analysis_name, "ThinGeomSet" );
thick_set[0] = ( SET_TYPE::SET_NONE );
thin_set[0] = ( SET_TYPE::SET_ALL );
SetIntAnalysisInput( analysis_name, "GeomSet", thick_set, 0);
SetIntAnalysisInput( analysis_name, "ThinGeomSet", thin_set, 0);
const std::vector< int > & GetIntAnalysisInput(const std::string &analysis, const std::string &name, int index=0)
void SetIntAnalysisInput(const std::string &analysis, const std::string &name, const std::vector< int > &indata, int index=0)
@ SET_NONE
@ SET_ALL
See also
RES_DATA_TYPE, SetIntAnalysisInput
Parameters
[in]analysisstring Analysis name
[in]namestring Input name
[in]indexint Data index
Returns
vector<int> Array of analysis input values

◆ GetNumAnalysis()

int vsp::GetNumAnalysis ( )
extern

Get the number of analysis types available in the Analysis Manager

int nanalysis = GetNumAnalysis();
Print( "Number of registered analyses: " + nanalysis );
// The count has to match the list of names.
array< string > @analysis_array = ListAnalysis();
if ( nanalysis != int( analysis_array.size() ) )
{
Print( "ERROR: GetNumAnalysis disagrees with ListAnalysis" );
__failure++;
}
if ( nanalysis < 1 )
{
Print( "ERROR: no analyses registered" );
__failure++;
}
int GetNumAnalysis()
std::vector< std::string > ListAnalysis()
Returns
int Number of analyses

◆ GetNumAnalysisInputData()

int vsp::GetNumAnalysisInputData ( const std::string & analysis,
const std::string & name )
extern

Get the documentation string for the particular analysis and input

Parameters
[in]analysisstring Analysis name
[in]namestring Input name
Returns
int Documentation string

◆ GetNumGeometryAnalysisAzEl()

int vsp::GetNumGeometryAnalysisAzEl ( const std::string & geom_analysis_id)
extern

Get the number of azimuth and elevation pairs in a Geometry Analysis case

See also
AddGeometryAnalysisAzEl
Parameters
[in]geom_analysis_idstring Geometry Analysis case ID
Returns
int Number of az/el pairs

◆ GetStringAnalysisInput()

const std::vector< std::string > & vsp::GetStringAnalysisInput ( const std::string & analysis,
const std::string & name,
int index = 0 )
extern

Get the current string values for the particular analysis, input, and data index

array<string> fileNameInput = GetStringAnalysisInput( "ParasiteDrag", "FileName" );
if ( fileNameInput.length() == 0 )
{
Print( "ERROR: GetStringAnalysisInput returned nothing" );
__failure++;
}
fileNameInput[0] = "ParasiteDragExample";
SetStringAnalysisInput( "ParasiteDrag", "FileName", fileNameInput );
void SetStringAnalysisInput(const std::string &analysis, const std::string &name, const std::vector< std::string > &indata, int index=0)
const std::vector< std::string > & GetStringAnalysisInput(const std::string &analysis, const std::string &name, int index=0)
See also
RES_DATA_TYPE, SetStringAnalysisInput
Parameters
[in]analysisstring Analysis name
[in]namestring Input name
[in]indexint Data index
Returns
vector<string> Array of analysis input values

◆ GetVec3dAnalysisInput()

const std::vector< vec3d > & vsp::GetVec3dAnalysisInput ( const std::string & analysis,
const std::string & name,
int index = 0 )
extern

Get the current vec3d values for the particular analysis, input, and data index

// PlanarSlice
array<vec3d> norm = GetVec3dAnalysisInput( "PlanarSlice", "Norm" );
if ( norm.length() == 0 )
{
Print( "ERROR: GetVec3dAnalysisInput returned nothing" );
__failure++;
}
norm[0].set_xyz( 0.23, 0.6, 0.15 );
SetVec3dAnalysisInput( "PlanarSlice", "Norm", norm );
void SetVec3dAnalysisInput(const std::string &analysis, const std::string &name, const std::vector< vec3d > &indata, int index=0)
const std::vector< vec3d > & GetVec3dAnalysisInput(const std::string &analysis, const std::string &name, int index=0)
See also
RES_DATA_TYPE, SetVec3dAnalysisInput
Parameters
[in]analysisstring Analysis name
[in]namestring Input name
[in]indexint Data index
Returns
vector<vec3d> Array of analysis input values

◆ ListAnalysis()

std::vector< std::string > vsp::ListAnalysis ( )
extern

Get the name of every available analysis in the Analysis Manager

array< string > @analysis_array = ListAnalysis();
Print( "List of Available Analyses: " );
for ( int i = 0; i < int( analysis_array.size() ); i++ )
{
Print( " " + analysis_array[i] );
if ( analysis_array[i].length() == 0 )
{
Print( "ERROR: ListAnalysis returned an unnamed analysis" );
__failure++;
}
}
if ( int( analysis_array.size() ) != GetNumAnalysis() )
{
Print( "ERROR: ListAnalysis disagrees with GetNumAnalysis" );
__failure++;
}
// The analyses the rest of these examples lean on have to be there.
bool found = false;
for ( int i = 0; i < int( analysis_array.size() ); i++ )
{
if ( analysis_array[i] == "VSPAEROComputeGeometry" )
{
found = true;
}
}
if ( !found )
{
Print( "ERROR: VSPAEROComputeGeometry is not registered" );
__failure++;
}
Returns
vector<string> Array of analysis names

◆ MakeMeshGeom()

std::string vsp::MakeMeshGeom ( const std::string & ga_id)
extern

Create a MeshGeom from the results of the specified Geometry Analysis case and return the new Geom's ID. The case must have been evaluated first (run the "GeometryAnalysis" analysis for the case) so that its result meshes exist. The resulting MeshGeom is added to the model and made the active Geom.

//==== Add a Geom for the case to work on ====//
string pod_id = AddGeom( "POD" );
string ga_id = AddGeometryAnalysis();
//==== Configure the case. Without a primary target the analysis has
//==== nothing to mesh and reports an empty primary mesh.
SetParmVal( FindParm( ga_id, "PrimaryType", "InterferenceCase" ), SET_TARGET );
SetParmVal( FindParm( ga_id, "PrimarySet", "InterferenceCase" ), SET_ALL );
SetParmVal( FindParm( ga_id, "SecondaryType", "InterferenceCase" ), SET_TARGET );
SetParmVal( FindParm( ga_id, "SecondarySet", "InterferenceCase" ), SET_ALL );
// Evaluate the case through the Analysis framework so that its result meshes exist.
SetAnalysisInputDefaults( "GeometryAnalysis" );
array<string> case_input = { ga_id };
SetStringAnalysisInput( "GeometryAnalysis", "CaseID", case_input );
ExecAnalysis( "GeometryAnalysis" );
// Turn the case's result meshes into a MeshGeom.
string mesh_id = MakeMeshGeom( ga_id );
if ( mesh_id.length() == 0 )
{
Print( "ERROR: MakeMeshGeom returned no id" );
__failure++;
}
std::string MakeMeshGeom(const std::string &ga_id)
void SetAnalysisInputDefaults(const std::string &analysis)
@ SET_TARGET
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
std::string FindParm(const std::string &parm_container_id, const std::string &parm_name, const std::string &group_name)
double SetParmVal(const std::string &parm_id, double val)
void Update(bool update_managers=true)
See also
AddGeometryAnalysis, SetActiveGeometryAnalysis
Parameters
[in]ga_idstring Geometry Analysis case ID
Returns
string Geom ID of the newly created MeshGeom

◆ PrintAnalysisDocs()

void vsp::PrintAnalysisDocs ( const std::string & analysis_name)
extern

Print to stdout all current input documentation for a specific analysis

//==== Analysis: VSPAero Compute Geometry ====//
string analysis_name = "VSPAEROComputeGeometry";
// list inputs, type, and documentation
PrintAnalysisDocs( analysis_name );
// The analysis itself has to carry documentation to print.
if ( GetAnalysisDoc( analysis_name ).length() == 0 )
{
Print( "ERROR: the analysis carries no documentation" );
__failure++;
}
// Printing an analysis that does not exist has to be rejected.
PrintAnalysisDocs( "NoSuchAnalysis" );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: PrintAnalysisDocs accepted an unknown analysis" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void PrintAnalysisDocs(const std::string &analysis_name)
Parameters
[in]analysis_namestring Name of analysis

◆ PrintAnalysisInputs()

void vsp::PrintAnalysisInputs ( const std::string & analysis_name)
extern

Print to stdout all current input values for a specific analysis

//==== Analysis: VSPAero Compute Geometry ====//
string analysis_name = "VSPAEROComputeGeometry";
// list inputs, type, and current values
PrintAnalysisInputs( analysis_name );
// There has to be something to list.
array< string > @inp_array = GetAnalysisInputNames( analysis_name );
if ( inp_array.size() == 0 )
{
Print( "ERROR: the analysis reports no inputs to print" );
__failure++;
}
// Printing an analysis that does not exist has to be rejected.
PrintAnalysisInputs( "NoSuchAnalysis" );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: PrintAnalysisInputs accepted an unknown analysis" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void PrintAnalysisInputs(const std::string &analysis_name)
Parameters
[in]analysis_namestring Name of analysis

◆ SetActiveGeometryAnalysis()

void vsp::SetActiveGeometryAnalysis ( const std::string & id)
extern

Set the active Geometry Analysis case. The active case is the one drawn in the Geometry Analysis GUI (and captured by ScreenGrab). Setting it does not require the GUI to be present.

string ga_id = AddGeometryAnalysis();
if ( GetActiveGeometryAnalysis() != ga_id )
{
Print( "ERROR: SetActiveGeometryAnalysis did not take" );
__failure++;
}
See also
GetActiveGeometryAnalysis, AddGeometryAnalysis
Parameters
[in]idstring Geometry Analysis case ID (empty string for none)

◆ SetAnalysisInputDefaults()

void vsp::SetAnalysisInputDefaults ( const std::string & analysis)
extern

Set all input values to their defaults for a specific analysis

//==== Analysis: VSPAero Compute Geometry ====//
string analysis_name = "VSPAEROComputeGeometry";
// Change an input away from its default...
array< int > geom_set = GetIntAnalysisInput( analysis_name, "GeomSet" );
array< int > new_set = geom_set;
new_set[0] = new_set[0] + 1;
SetIntAnalysisInput( analysis_name, "GeomSet", new_set );
array< int > check_set = GetIntAnalysisInput( analysis_name, "GeomSet" );
if ( check_set[0] != new_set[0] )
{
Print( "ERROR: SetIntAnalysisInput did not take" );
__failure++;
}
// ...and set defaults, which has to put it back.
SetAnalysisInputDefaults( analysis_name );
check_set = GetIntAnalysisInput( analysis_name, "GeomSet" );
if ( check_set[0] != geom_set[0] )
{
Print( "ERROR: SetAnalysisInputDefaults did not restore the default" );
__failure++;
}
Parameters
[in]analysisstring Analysis name

◆ SetDoubleAnalysisInput()

void vsp::SetDoubleAnalysisInput ( const std::string & analysis,
const std::string & name,
const std::vector< double > & indata,
int index = 0 )
extern

Set the value of a particular analysis input of double type

//==== Analysis: CpSlicer ====//
string analysis_name = "CpSlicer";
// Setup cuts
array < double > ycuts;
ycuts.push_back( 2.0 );
ycuts.push_back( 4.5 );
ycuts.push_back( 8.0 );
SetDoubleAnalysisInput( analysis_name, "YSlicePosVec", ycuts, 0 );
if ( GetDoubleAnalysisInput( analysis_name, "YSlicePosVec", 0 ) != ycuts )
{
Print( "ERROR: SetDoubleAnalysisInput did not take" );
__failure++;
}
See also
GetDoubleAnalysisInput
Parameters
[in]analysisstring Analysis name
[in]namestring Input name
[in]indatavector<double> Array of double values to set the input to
[in]indexint Data index

◆ SetIntAnalysisInput()

void vsp::SetIntAnalysisInput ( const std::string & analysis,
const std::string & name,
const std::vector< int > & indata,
int index = 0 )
extern

Set the value of a particular analysis input of integer type

//==== Analysis: VSPAero Compute Geometry ====//
string analysis_name = "VSPAEROComputeGeometry";
// Set to panel method
array< int > thick_set = GetIntAnalysisInput( analysis_name, "GeomSet" );
array< int > thin_set = GetIntAnalysisInput( analysis_name, "ThinGeomSet" );
thick_set[0] = ( SET_TYPE::SET_NONE );
thin_set[0] = ( SET_TYPE::SET_ALL );
SetIntAnalysisInput( analysis_name, "GeomSet", thick_set, 0);
if ( GetIntAnalysisInput( analysis_name, "GeomSet", 0 ) != thick_set )
{
Print( "ERROR: SetIntAnalysisInput did not take" );
__failure++;
}
SetIntAnalysisInput( analysis_name, "ThinGeomSet", thin_set, 0);
See also
GetIntAnalysisInput
Parameters
[in]analysisstring Analysis name
[in]namestring Input name
[in]indatavector<int> Array of integer values to set the input to
[in]indexint Data index

◆ SetStringAnalysisInput()

void vsp::SetStringAnalysisInput ( const std::string & analysis,
const std::string & name,
const std::vector< std::string > & indata,
int index = 0 )
extern

Set the value of a particular analysis input of string type

array<string> fileNameInput = GetStringAnalysisInput( "ParasiteDrag", "FileName" );
fileNameInput[0] = "ParasiteDragExample";
SetStringAnalysisInput( "ParasiteDrag", "FileName", fileNameInput );
if ( GetStringAnalysisInput( "ParasiteDrag", "FileName" ) != fileNameInput )
{
Print( "ERROR: SetStringAnalysisInput did not take" );
__failure++;
}
See also
GetStringAnalysisInput
Parameters
[in]analysisstring Analysis name
[in]namestring Input name
[in]indatavector<string> Array of string values to set the input to
[in]indexint Data index

◆ SetVec3dAnalysisInput()

void vsp::SetVec3dAnalysisInput ( const std::string & analysis,
const std::string & name,
const std::vector< vec3d > & indata,
int index = 0 )
extern

Set the value of a particular analysis input of vec3d type

// PlanarSlice
array<vec3d> norm = GetVec3dAnalysisInput( "PlanarSlice", "Norm" );
norm[0].set_xyz( 0.23, 0.6, 0.15 );
SetVec3dAnalysisInput( "PlanarSlice", "Norm", norm );
if ( GetVec3dAnalysisInput( "PlanarSlice", "Norm" ) != norm )
{
Print( "ERROR: SetVec3dAnalysisInput did not take" );
__failure++;
}
See also
GetVec3dAnalysisInput
Parameters
[in]analysisstring Analysis name
[in]namestring Input name
[in]indatavector<vec3d> Array of vec3d values to set the input to
[in]indexint Data index