OpenVSP API Documentation 3.52.0
Loading...
Searching...
No Matches
General Computation Functions

The following group of API functions are available for general computations. In general, it is best practice to perform computations through the the Analysis group instead of calling these functions directly. Click here to return to the main page. More...

Functions

std::string vsp::ComputeMassProps (int set, int num_slices, int idir)
std::string vsp::ComputeCompGeom (int set, bool half_mesh, int file_export_types)
std::string vsp::ComputePlaneSlice (int set, int num_slices, const vec3d &norm, bool auto_bnd, double start_bnd=0, double end_bnd=0, bool measureduct=false)
void vsp::ComputeDegenGeom (int set, int file_export_types)
double vsp::IntegrateEllipsoidFlow (const vec3d &abc_rad, const int &abc_index)

Detailed Description

Function Documentation

◆ ComputeCompGeom()

std::string vsp::ComputeCompGeom ( int set,
bool half_mesh,
int file_export_types )
extern

Mesh, intersect, and trim components in the set. Alternatively can be run through the Analysis Manager with 'CompGeom'.

//==== Add Pod Geom ====//
string pid = AddGeom( "POD", "" );
//==== Run CompGeom And Get Results ====//
string mesh_id = ComputeCompGeom( SET_ALL, false, 0 ); // Half Mesh false and no file export
if ( mesh_id.length() == 0 )
{
Print( "ERROR: ComputeCompGeom returned no id" );
__failure++;
}
string comp_res_id = FindLatestResultsID( "Comp_Geom" ); // Find Results ID
array<double> @double_arr = GetDoubleResults( comp_res_id, "Wet_Area" ); // Extract Results
void Print(const std::string &data, bool new_line=true)
std::string ComputeCompGeom(int set, bool half_mesh, int file_export_types)
@ SET_ALL
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
std::string FindLatestResultsID(const std::string &name)
const std::vector< double > & GetDoubleResults(const std::string &id, const std::string &name, int index=0)
See also
SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis, COMPUTATION_FILE_TYPE
Parameters
[in]setint Set index (i.e. SET_ALL)
[in]half_meshbool Flag to ignore surfaces on the negative side of the XZ plane (e.g. symmetry)
[in]file_export_typesint CompGeom file type to export (supports XOR i.e. COMP_GEOM_CSV_TYPE & COMP_GEOM_TXT_TYPE )
Returns
string MeshGeom ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeDegenGeom()

void vsp::ComputeDegenGeom ( int set,
int file_export_types )
extern

Compute the degenerate geometry representation for the components in the set. Alternatively can be run through the Analysis Manager with 'DegenGeom' or 'VSPAERODegenGeom'.

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD" );
//==== Set File Name ====//
SetComputationFileName( DEGEN_GEOM_CSV_TYPE, "TestDegenScript.csv" );
//==== Run Degen Geom ====//
ComputeDegenGeom( SET_ALL, DEGEN_GEOM_CSV_TYPE );
// The degenerate representation is reported through the Results Manager as
// well as written to file. A Pod yields a surface, a plate and a stick.
if ( GetNumResults( "DegenGeom" ) != 1 )
{
Print( "ERROR: ComputeDegenGeom produced no DegenGeom result" );
__failure++;
}
if ( GetNumResults( "Degen_surf" ) < 1 || GetNumResults( "Degen_plate" ) < 1 || GetNumResults( "Degen_stick" ) < 1 )
{
Print( "ERROR: ComputeDegenGeom did not produce the component results" );
__failure++;
}
void SetComputationFileName(int file_type, const std::string &file_name)
void ComputeDegenGeom(int set, int file_export_types)
int GetNumResults(const std::string &name)
See also
SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis, COMPUTATION_FILE_TYPE
Parameters
[in]setint Set index (i.e. SET_ALL)
[in]file_export_typesint DegenGeom file type to export (supports XOR i.e DEGEN_GEOM_M_TYPE & DEGEN_GEOM_CSV_TYPE)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeMassProps()

std::string vsp::ComputeMassProps ( int set,
int num_slices,
int idir )
extern

Compute mass properties for the components in the set. Alternatively can be run through the Analysis Manager with 'MassProp'.

//==== Test Mass Props ====//
string pid = AddGeom( "POD", "" );
string mesh_id = ComputeMassProps( SET_ALL, 20, X_DIR );
string mass_res_id = FindLatestResultsID( "Mass_Properties" );
array<double> @double_arr = GetDoubleResults( mass_res_id, "Total_Mass" );
if ( double_arr.size() != 1 ) { Print( "---> Error: API ComputeMassProps" ); __failure++; }
std::string ComputeMassProps(int set, int num_slices, int idir)
@ X_DIR
Definition APIDefines.h:421
See also
SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis
Parameters
[in]setint Set index (i.e. SET_ALL)
[in]num_slicesint Number of slices
[in]idirint Direction of slicing for integration
Returns
string MeshGeom ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputePlaneSlice()

std::string vsp::ComputePlaneSlice ( int set,
int num_slices,
const vec3d & norm,
bool auto_bnd,
double start_bnd = 0,
double end_bnd = 0,
bool measureduct = false )
extern

Slice and mesh the components in the set. Alternatively can be run through the Analysis Manager with 'PlanarSlice'.

//==== Add Pod Geom ====//
string pid = AddGeom( "POD", "" );
//==== Test Plane Slice ====//
string slice_mesh_id = ComputePlaneSlice( 0, 6, vec3d( 0.0, 0.0, 1.0 ), true );
string pslice_results = FindLatestResultsID( "Slice" );
array<double> @double_arr = GetDoubleResults( pslice_results, "Slice_Area" );
if ( double_arr.size() != 6 ) { Print( "---> Error: API ComputePlaneSlice" ); __failure++; }
std::string ComputePlaneSlice(int set, int num_slices, const vec3d &norm, bool auto_bnd, double start_bnd=0, double end_bnd=0, bool measureduct=false)
Definition Vec3d.h:238
See also
SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis
Parameters
[in]setint Set index (i.e. SET_ALL)
[in]num_slicesint Number of slices
[in]normvec3d Normal axis for all slices
[in]auto_bndbool Flag to automatically set the start and end bound locations
[in]start_bnddouble Location of the first slice along the normal axis (default: 0.0)
[in]end_bnddouble Location of the last slice along the normal axis (default: 0.0)
[in]measureductbool Flag to measure negative area inside positive area (default: false)
Returns
string MeshGeom ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IntegrateEllipsoidFlow()

double vsp::IntegrateEllipsoidFlow ( const vec3d & abc_rad,
const int & abc_index )
extern

Integrate the analytic potential flow solution over an ellipsoid. Used to check a panel or surface solution against a case with a known answer.

double val = IntegrateEllipsoidFlow( vec3d( 1.0, 2.0, 3.0 ), 0 );
if ( val == 0.0 ) { Print( "ERROR: IntegrateEllipsoidFlow" ); __failure++; }
double IntegrateEllipsoidFlow(const vec3d &abc_rad, const int &abc_index)
See also
GetEllipsoidSurfPnts
Parameters
[in]abc_radvec3d Semi-axis lengths of the ellipsoid
[in]abc_indexint Index of the axis the flow is along, 0, 1 or 2
Returns
double Integrated value
Here is the call graph for this function:
Here is the caller graph for this function: