OpenVSPAPI  3.20.0
Functions
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

int GetNumResults (const string &in name)
 
string GetResultsName (const string &in results_id)
 
string FindResultsID (const string &in name, int index=0)
 
string FindLatestResultsID (const string &in name)
 
int GetNumData (const string &in results_id, const string &in data_name)
 
int GetResultsType (const string &in results_id, const string &in data_name)
 
string[] GetAllResultsNames ()
 
string[] GetAllDataNames (const string &in results_id)
 
int[] GetIntResults (const string &in id, const string &in name, int index=0)
 
double[] GetDoubleResults (const string &in id, const string &in name, int index=0)
 
double[][] GetDoubleMatResults (const string &in id, const string &in name, int index=0)
 
string[] GetStringResults (const string &in id, const string &in name, int index=0)
 
vec3d[] GetVec3dResults (const string &in id, const string &in name, int index=0)
 
string CreateGeomResults (const string &in geom_id, const string &in name)
 
void DeleteAllResults ()
 
void DeleteResult (const string &in id)
 
void WriteResultsCSVFile (const string &in id, const string &in file_name)
 
void PrintResults (const string &in id)
 
void WriteTestResults ()
 

Detailed Description

Function Documentation

◆ CreateGeomResults()

string CreateGeomResults ( const string &in  geom_id,
const string &in  name 
)

Create a new result for a Geom

//==== Test Comp Geom ====//
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" );
int_arr = GetIntResults( mesh_geom_res_id, "Num_Tris" );
if ( int_arr[0] < 4 ) { Print( "---> Error: API CreateGeomResults" ); }
Parameters
[in]geom_idGeom ID
[in]nameResult name
Returns
Result ID

◆ DeleteAllResults()

void DeleteAllResults ( )

Delete all results

//==== Test Comp Geom ====//
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" ); }

◆ DeleteResult()

void DeleteResult ( const string &in  id)

Delete a particular result

//==== Test Comp Geom ====//
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" ); }
Parameters
[in]idResult ID

◆ FindLatestResultsID()

string FindLatestResultsID ( const string &in  name)

Find the latest results ID for particular result name

//==== Write Some Fake Test Results =====//
for ( int i = 0; i < int( results_array.size() ); i++ )
{
string resid = FindLatestResultsID( results_array[i] );
PrintResults( resid );
}
Parameters
[in]nameResult name
Returns
Result ID

◆ FindResultsID()

string FindResultsID ( const string &in  name,
int  index = 0 
)

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" ); }
Parameters
[in]nameResult name
[in]indexResult index
Returns
Result ID

◆ GetAllDataNames()

string [] GetAllDataNames ( const string &in  results_id)

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" ); }
Parameters
[in]results_idResult ID
Returns
Array of result names

◆ GetAllResultsNames()

string [] GetAllResultsNames ( )

Get the name of all results in the Results Manager

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

◆ GetDoubleMatResults()

double [][] GetDoubleMatResults ( const string &in  id,
const string &in  name,
int  index = 0 
)

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()

double [] GetDoubleResults ( const string &in  id,
const string &in  name,
int  index = 0 
)

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

//==== Add Pod Geom ====//
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
Parameters
[in]idResult ID
[in]nameData name
[in]indexData index
Returns
Array of data values

◆ GetIntResults()

int [] GetIntResults ( const string &in  id,
const string &in  name,
int  index = 0 
)

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" ); }
Parameters
[in]idResult ID
[in]nameData name
[in]indexData index
Returns
Array of data values

◆ GetNumData()

int GetNumData ( const string &in  results_id,
const string &in  data_name 
)

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 GetNumResults ( const string &in  name)

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()

string GetResultsName ( const string &in  results_id)

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 ) );
Parameters
[in]results_idResult ID
Returns
Result name

◆ GetResultsType()

int GetResultsType ( const string &in  results_id,
const string &in  data_name 
)

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( results, res_array[j] );
}
See also
RES_DATA_TYPE
Parameters
[in]results_idResult ID
[in]data_nameData name
Returns
Data type enum (i.e. DOUBLE_DATA)

◆ GetStringResults()

string [] GetStringResults ( const string &in  id,
const string &in  name,
int  index = 0 
)

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" ); }
Parameters
[in]idResult ID
[in]nameData name
[in]indexData index
Returns
Array of data values

◆ GetVec3dResults()

vec3d [] GetVec3dResults ( const string &in  id,
const string &in  name,
int  index = 0 
)

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

//==== Write Some Fake Test Results =====//
res_id = FindLatestResultsID( "Test_Results" );
array<vec3d> @vec3d_vec = GetVec3dResults( res_id, "Test_Vec3d" );
if ( !CloseVec3d( vec3d_vec[0], vec3d( 1.0, 2.0, 4.0 ), tol ) ) { Print( "---> Error: API GetVec3dResults" ); }
Parameters
[in]idResult ID
[in]nameData name
[in]indexData index
Returns
Array of data values

◆ PrintResults()

void PrintResults ( const string &in  id)

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]idResult ID

◆ WriteResultsCSVFile()

void WriteResultsCSVFile ( const string &in  id,
const string &in  file_name 
)

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" );
Parameters
[in]idRsult ID
[in]file_nameCSV output file name

◆ WriteTestResults()

void WriteTestResults ( )

Create two sets of test results, each conatining int, string, vec3d, double, and vector< double > data types.

//==== Write Some Fake Test Results =====//
if ( GetNumResults( "Test_Results" ) != 2 ) { Print( "---> Error: API GetNumResults" ); }
GetIntResults
int[] GetIntResults(const string &in id, const string &in name, int index=0)
GetVec3dResults
vec3d[] GetVec3dResults(const string &in id, const string &in name, int index=0)
GetAllDataNames
string[] GetAllDataNames(const string &in results_id)
FindResultsID
string FindResultsID(const string &in name, int index=0)
SET_ALL
Definition: openvsp_as.h:1840
GetResultsType
int GetResultsType(const string &in results_id, const string &in data_name)
DeleteResult
void DeleteResult(const string &in id)
ExecAnalysis
string ExecAnalysis(const string &in analysis)
PrintResults
void PrintResults(const string &in id)
GetDoubleResults
double[] GetDoubleResults(const string &in id, const string &in name, int index=0)
FindLatestResultsID
string FindLatestResultsID(const string &in name)
GetResultsName
string GetResultsName(const string &in results_id)
GetStringResults
string[] GetStringResults(const string &in id, const string &in name, int index=0)
GetAllResultsNames
string[] GetAllResultsNames()
vec3d
A class for representing 3D vectors.
Definition: openvsp_as.h:341
GetNumData
int GetNumData(const string &in results_id, const string &in data_name)
DeleteAllResults
void DeleteAllResults()
array
AngelScript ScriptExtension for representing the C++ std::vector.
Definition: openvsp_as.h:244
WriteTestResults
void WriteTestResults()
AddGeom
string AddGeom(const string &in type, const string &in parent=string())
ComputeCompGeom
string ComputeCompGeom(int set, bool half_mesh, int file_export_types)
Print
void Print(const string &in data, bool new_line=true)
SetAnalysisInputDefaults
void SetAnalysisInputDefaults(const string &in analysis)
WriteResultsCSVFile
void WriteResultsCSVFile(const string &in id, const string &in file_name)
GetNumResults
int GetNumResults(const string &in name)
CreateGeomResults
string CreateGeomResults(const string &in geom_id, const string &in name)