OpenVSP API Documentation 3.41.0
 
Loading...
Searching...
No Matches
Results Manager Functions

This group is for functions included in the Results Manager. The Results Manager stores analysis results and provides methods to get, print, and export them. Click here to return to the main page. More...

Functions

std::vector< std::string > vsp::GetAllResultsNames ()
 
std::vector< std::string > vsp::GetAllDataNames (const std::string &results_id)
 
int vsp::GetNumResults (const std::string &name)
 
std::string vsp::GetResultsName (const std::string &results_id)
 
std::string vsp::GetResultsSetDoc (const std::string &results_id)
 
std::string vsp::FindResultsID (const std::string &name, int index=0)
 
std::string vsp::FindLatestResultsID (const std::string &name)
 
int vsp::GetNumData (const std::string &results_id, const std::string &data_name)
 
int vsp::GetResultsType (const std::string &results_id, const std::string &data_name)
 
const std::vector< int > & vsp::GetIntResults (const std::string &id, const std::string &name, int index=0)
 
const std::vector< double > & vsp::GetDoubleResults (const std::string &id, const std::string &name, int index=0)
 
const std::vector< std::vector< double > > & vsp::GetDoubleMatResults (const std::string &id, const std::string &name, int index=0)
 
const std::vector< std::string > & vsp::GetStringResults (const std::string &id, const std::string &name, int index=0)
 
const std::vector< vec3d > & vsp::GetVec3dResults (const std::string &id, const std::string &name, int index=0)
 
std::string vsp::CreateGeomResults (const std::string &geom_id, const std::string &name)
 
void vsp::DeleteAllResults ()
 
void vsp::DeleteResult (const std::string &id)
 
void vsp::WriteResultsCSVFile (const std::string &id, const std::string &file_name)
 
void vsp::PrintResults (const std::string &results_id)
 
void vsp::PrintResultsDocs (const std::string &results_id)
 
void vsp::WriteTestResults ()
 

Detailed Description

Function Documentation

◆ CreateGeomResults()

std::string vsp::CreateGeomResults ( const std::string & geom_id,
const std::string & name )
extern

Create a new result for a Geom

//==== Test Comp Geom ====//
string gid1 = AddGeom( "POD", "" );
string mesh_id = ComputeCompGeom( 0, false, 0 );
//==== Test Comp Geom Mesh Results ====//
string mesh_geom_res_id = CreateGeomResults( mesh_id, "Comp_Mesh" );
array<int> @int_arr = GetIntResults( mesh_geom_res_id, "Num_Tris" );
if ( int_arr[0] < 4 ) { Print( "---> Error: API CreateGeomResults" ); }
std::string ComputeCompGeom(int set, bool half_mesh, int file_export_types)
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
const std::vector< int > & GetIntResults(const std::string &id, const std::string &name, int index=0)
std::string CreateGeomResults(const std::string &geom_id, const std::string &name)
Parameters
[in]geom_idstring Geom ID
[in]nameResult name
Returns
Result ID

◆ DeleteAllResults()

void vsp::DeleteAllResults ( )
extern

Delete all results

//==== Test Comp Geom ====//
string gid1 = AddGeom( "POD", "" );
string mesh_id = ComputeCompGeom( 0, false, 0 );
//==== Test Comp Geom Mesh Results ====//
string mesh_geom_res_id = CreateGeomResults( mesh_id, "Comp_Mesh" );
if ( GetNumResults( "Comp_Mesh" ) != 0 ) { Print( "---> Error: API DeleteAllResults" ); }
int GetNumResults(const std::string &name)
void DeleteAllResults()

◆ DeleteResult()

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

Delete a particular result

//==== Test Comp Geom ====//
string gid1 = AddGeom( "POD", "" );
string mesh_id = ComputeCompGeom( 0, false, 0 );
//==== Test Comp Geom Mesh Results ====//
string mesh_geom_res_id = CreateGeomResults( mesh_id, "Comp_Mesh" );
DeleteResult( mesh_geom_res_id );
if ( GetNumResults( "Comp_Mesh" ) != 0 ) { Print( "---> Error: API DeleteResult" ); }
void DeleteResult(const std::string &id)
Parameters
[in]idResult ID

◆ FindLatestResultsID()

std::string vsp::FindLatestResultsID ( const std::string & name)
extern

Find the latest results ID for particular result name

//==== Write Some Fake Test Results =====//
array< string > @results_array = GetAllResultsNames();
for ( int i = 0; i < int( results_array.size() ); i++ )
{
string resid = FindLatestResultsID( results_array[i] );
PrintResults( resid );
}
void PrintResults(const std::string &results_id)
std::vector< std::string > GetAllResultsNames()
std::string FindLatestResultsID(const std::string &name)
void WriteTestResults()
Parameters
[in]nameResult name
Returns
Result ID

◆ FindResultsID()

std::string vsp::FindResultsID ( const std::string & name,
int index = 0 )
extern

Find a results ID given its name and index

//==== Write Some Fake Test Results =====//
string res_id = FindResultsID( "Test_Results" );
if ( res_id.size() == 0 ) { Print( "---> Error: API FindResultsID" ); }
std::string FindResultsID(const std::string &name, int index=0)
Parameters
[in]nameResult name
[in]indexResult index
Returns
Result ID

◆ GetAllDataNames()

std::vector< std::string > vsp::GetAllDataNames ( const std::string & results_id)
extern

Get all data names for a particular result

//==== Write Some Fake Test Results =====//
string res_id = FindResultsID( "Test_Results" );
array< string > @data_names = GetAllDataNames( res_id );
if ( data_names.size() != 5 ) { Print( "---> Error: API GetAllDataNames" ); }
std::vector< std::string > GetAllDataNames(const std::string &results_id)
Parameters
[in]results_idResult ID
Returns
Array of result names

◆ GetAllResultsNames()

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

Get the name of all results in the Results Manager

//==== Write Some Fake Test Results =====//
array< string > @results_array = GetAllResultsNames();
for ( int i = 0; i < int( results_array.size() ); i++ )
{
string resid = FindLatestResultsID( results_array[i] );
PrintResults( resid );
}
Returns
Array of result names

◆ GetDoubleMatResults()

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

Get all matrix (vector<vector<double>>) values for a particular result, name, and index

Parameters
[in]idResult ID
[in]nameData name
[in]indexData index
Returns
2D array of data values

◆ GetDoubleResults()

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

Get all double values for a particular result, name, and index

//==== Add Pod Geom ====//
string pid = AddGeom( "POD", "" );
//==== Run CompGeom And View Results ====//
string mesh_id = ComputeCompGeom( SET_ALL, false, 0 ); // Half Mesh false and no file export
string comp_res_id = FindLatestResultsID( "Comp_Geom" ); // Find Results ID
array<double> @double_arr = GetDoubleResults( comp_res_id, "Wet_Area" ); // Extract Results
@ SET_ALL
const std::vector< double > & GetDoubleResults(const std::string &id, const std::string &name, int index=0)
Parameters
[in]idResult ID
[in]nameData name
[in]indexData index
Returns
Array of data values

◆ GetIntResults()

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

Get all integer values for a particular result, name, and index

//==== Write Some Fake Test Results =====//
string res_id = FindResultsID( "Test_Results" );
if ( GetNumData( res_id, "Test_Int" ) != 2 ) { Print( "---> Error: API GetNumData " ); }
array<int> @int_arr = GetIntResults( res_id, "Test_Int", 0 );
if ( int_arr[0] != 1 ) { Print( "---> Error: API GetIntResults" ); }
int_arr = GetIntResults( res_id, "Test_Int", 1 );
if ( int_arr[0] != 2 ) { Print( "---> Error: API GetIntResults" ); }
int GetNumData(const std::string &results_id, const std::string &data_name)
Parameters
[in]idResult ID
[in]nameData name
[in]indexData index
Returns
Array of data values

◆ GetNumData()

int vsp::GetNumData ( const std::string & results_id,
const std::string & data_name )
extern

Get the number of data values for a given result ID and data name

//==== Write Some Fake Test Results =====//
string res_id = FindResultsID( "Test_Results" );
if ( GetNumData( res_id, "Test_Int" ) != 2 ) { Print( "---> Error: API GetNumData " ); }
array<int> @int_arr = GetIntResults( res_id, "Test_Int", 0 );
if ( int_arr[0] != 1 ) { Print( "---> Error: API GetIntResults" ); }
int_arr = GetIntResults( res_id, "Test_Int", 1 );
if ( int_arr[0] != 2 ) { Print( "---> Error: API GetIntResults" ); }
Parameters
[in]results_idResult ID
[in]data_nameData name
Returns
Number of data values

◆ GetNumResults()

int vsp::GetNumResults ( const std::string & name)
extern

Get the number of results for a particular result name

//==== Write Some Fake Test Results =====//
if ( GetNumResults( "Test_Results" ) != 2 ) { Print( "---> Error: API GetNumResults" ); }
Parameters
[in]nameInput name
Returns
Number of results

◆ GetResultsName()

std::string vsp::GetResultsName ( const std::string & results_id)
extern

Get the name of a result given its ID

//==== Analysis: VSPAero Compute Geometry ====//
string analysis_name = "VSPAEROComputeGeometry";
// Set defaults
SetAnalysisInputDefaults( analysis_name );
string res_id = ( ExecAnalysis( analysis_name ) );
Print( "Results Name: ", false );
Print( GetResultsName( res_id ) );
std::string ExecAnalysis(const std::string &analysis)
void SetAnalysisInputDefaults(const std::string &analysis)
std::string GetResultsName(const std::string &results_id)
Parameters
[in]results_idResult ID
Returns
Result name

◆ GetResultsSetDoc()

std::string vsp::GetResultsSetDoc ( const std::string & results_id)
extern

Get the documentation string for a result given its ID

//==== Analysis: VSPAero Compute Geometry ====//
string analysis_name = "VSPAEROComputeGeometry";
// Set defaults
SetAnalysisInputDefaults( analysis_name );
string res_id = ( ExecAnalysis( analysis_name ) );
Print( "Results doc: ", false );
Print( GetResultsSetDoc( res_id ) );
std::string GetResultsSetDoc(const std::string &results_id)
Parameters
[in]results_idResult ID
Returns
Result documentation string

◆ GetResultsType()

int vsp::GetResultsType ( const std::string & results_id,
const std::string & data_name )
extern

Get the data type for a given result ID and data name

//==== Write Some Fake Test Results =====//
string res_id = FindResultsID( "Test_Results" );
array < string > @ res_array = GetAllDataNames( res_id );
for ( int j = 0; j < int( res_array.size() ); j++ )
{
int typ = GetResultsType( res_id, res_array[j] );
}
int GetResultsType(const std::string &results_id, const std::string &data_name)
See also
RES_DATA_TYPE
Parameters
[in]results_idResult ID
[in]data_nameData name
Returns
Data type enum (i.e. DOUBLE_DATA)

◆ GetStringResults()

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

Get all string values for a particular result, name, and index

//==== Write Some Fake Test Results =====//
string res_id = FindResultsID( "Test_Results" );
array<string> @str_arr = GetStringResults( res_id, "Test_String" );
if ( str_arr[0] != "This Is A Test" ) { Print( "---> Error: API GetStringResults" ); }
const std::vector< std::string > & GetStringResults(const std::string &id, const std::string &name, int index=0)
Parameters
[in]idResult ID
[in]nameData name
[in]indexData index
Returns
Array of data values

◆ GetVec3dResults()

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

Get all vec3d values for a particular result, name, and index

//==== Write Some Fake Test Results =====//
double tol = 0.00001;
string res_id = FindLatestResultsID( "Test_Results" );
array<vec3d> @vec3d_vec = GetVec3dResults( res_id, "Test_Vec3d" );
Print( "X: ", false );
Print( vec3d_vec[0].x(), false );
Print( "\tY: ", false );
Print( vec3d_vec[0].y(), false );
Print( "\tZ: ", false );
Print( vec3d_vec[0].z() );
const std::vector< vec3d > & GetVec3dResults(const std::string &id, const std::string &name, int index=0)
Parameters
[in]idResult ID
[in]nameData name
[in]indexData index
Returns
Array of data values

◆ PrintResults()

void vsp::PrintResults ( const std::string & results_id)
extern

Print a result's name value pairs to stdout

// Add Pod Geom
string pid = AddGeom( "POD" );
string analysis_name = "VSPAEROComputeGeometry";
string rid = ExecAnalysis( analysis_name );
// Get & Display Results
PrintResults( rid );
Parameters
[in]results_idstring Result ID

◆ PrintResultsDocs()

void vsp::PrintResultsDocs ( const std::string & results_id)
extern

Print a result's names and documentation to stdout

// Add Pod Geom
string pid = AddGeom( "POD" );
string analysis_name = "VSPAEROComputeGeometry";
string rid = ExecAnalysis( analysis_name );
// Get & Display Results Docs
PrintResultsDoc( rid );
Parameters
[in]results_idstring Result ID

◆ WriteResultsCSVFile()

void vsp::WriteResultsCSVFile ( const std::string & id,
const std::string & file_name )
extern

Export a result to CSV

// Add Pod Geom
string pid = AddGeom( "POD" );
string analysis_name = "VSPAEROComputeGeometry";
string rid = ExecAnalysis( analysis_name );
WriteResultsCSVFile( rid, "CompGeomRes.csv" );
void WriteResultsCSVFile(const std::string &id, const std::string &file_name)
Parameters
[in]idRsult ID
[in]file_nameCSV output file name

◆ WriteTestResults()

void vsp::WriteTestResults ( )
extern

Generate some example results for testing.

//==== Write Some Fake Test Results =====//
array< string > @results_array = GetAllResultsNames();
for ( int i = 0; i < int( results_array.size() ); i++ )
{
string resid = FindLatestResultsID( results_array[i] );
PrintResults( resid );
}