OpenVSP API Documentation  3.38.0
Functions
Sub-Surface Functions

Functions related to Sub-Surfaces are defined in this group. Click here to return to the main page. More...

Functions

std::string vsp::AddSubSurf (const std::string &geom_id, int type, int surfindex=0)
 
std::string vsp::GetSubSurf (const std::string &geom_id, int index)
 
std::vector< std::string > vsp::GetSubSurf (const std::string &geom_id, const std::string &name)
 
void vsp::DeleteSubSurf (const std::string &geom_id, const std::string &sub_id)
 
void vsp::DeleteSubSurf (const std::string &sub_id)
 
void vsp::SetSubSurfName (const std::string &geom_id, const std::string &sub_id, const std::string &name)
 
void vsp::SetSubSurfName (const std::string &sub_id, const std::string &name)
 
std::string vsp::GetSubSurfName (const std::string &geom_id, const std::string &sub_id)
 
std::string vsp::GetSubSurfName (const std::string &sub_id)
 
int vsp::GetSubSurfIndex (const std::string &sub_id)
 
std::vector< std::string > vsp::GetSubSurfIDVec (const std::string &geom_id)
 
std::vector< std::string > vsp::GetAllSubSurfIDs ()
 
int vsp::GetNumSubSurf (const std::string &geom_id)
 
int vsp::GetSubSurfType (const std::string &sub_id)
 
std::vector< std::string > vsp::GetSubSurfParmIDs (const std::string &sub_id)
 

Detailed Description

Function Documentation

◆ AddSubSurf()

std::string vsp::AddSubSurf ( const std::string &  geom_id,
int  type,
int  surfindex = 0 
)

Add a sub-surface to the specified Geom

string wid = AddGeom( "WING", "" ); // Add Wing
// Note: Parm Group for SubSurfaces in the form: "SS_" + type + "_" + count (initialized at 1)
string ss_line_id = AddSubSurf( wid, SS_LINE ); // Add Sub Surface Line
SetParmVal( wid, "Const_Line_Value", "SubSurface_1", 0.4 ); // Change Location
@ SS_LINE
Definition: APIDefines.h:1139
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
double SetParmVal(const std::string &parm_id, double val)
std::string AddSubSurf(const std::string &geom_id, int type, int surfindex=0)
See also
SUBSURF_TYPE
Parameters
[in]geom_idstring Geom ID
[in]typeSub-surface type enum (i.e. SS_RECTANGLE)
[in]surfindexMain surface index (default: 0)
Returns
Sub-surface ID

◆ DeleteSubSurf() [1/2]

void vsp::DeleteSubSurf ( const std::string &  geom_id,
const std::string &  sub_id 
)

Delete the specified sub-surface

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_line_id = AddSubSurf( wid, SS_LINE ); // Add Sub Surface Line
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
Print("Delete SS_Line\n");
DeleteSubSurf( wid, ss_line_id );
int num_ss = GetNumSubSurf( wid );
string num_str = string("Number of SubSurfaces: ") + formatInt( num_ss, '' ) + string("\n");
Print( num_str );
@ SS_RECTANGLE
Definition: APIDefines.h:1140
int GetNumSubSurf(const std::string &geom_id)
void DeleteSubSurf(const std::string &geom_id, const std::string &sub_id)
Parameters
[in]geom_idstring Geom ID
[in]sub_idstring Sub-surface ID

◆ DeleteSubSurf() [2/2]

void vsp::DeleteSubSurf ( const std::string &  sub_id)

Delete the specified sub-surface

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_line_id = AddSubSurf( wid, SS_LINE ); // Add Sub Surface Line
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
Print("Delete SS_Line\n");
DeleteSubSurf( ss_line_id );
int num_ss = GetNumSubSurf( wid );
string num_str = string("Number of SubSurfaces: ") + formatInt( num_ss, '' ) + string("\n");
Print( num_str );
Parameters
[in]sub_idstring Sub-surface ID

◆ GetAllSubSurfIDs()

std::vector<std::string> vsp::GetAllSubSurfIDs ( )

Get a vector of all sub-surface IDs for the entire model

Returns
Array of sub-surface IDs

◆ GetNumSubSurf()

int vsp::GetNumSubSurf ( const std::string &  geom_id)

Get the number of sub-surfaces for the specified Geom

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_line_id = AddSubSurf( wid, SS_LINE ); // Add Sub Surface Line
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
int num_ss = GetNumSubSurf( wid );
string num_str = string("Number of SubSurfaces: ") + num_ss + string("\n");
Print( num_str );
Parameters
[in]geom_idstring Geom ID
Returns
int Number of Sub-surfaces

◆ GetSubSurf() [1/2]

std::vector<std::string> vsp::GetSubSurf ( const std::string &  geom_id,
const std::string &  name 
)

Get the ID of the specified sub-surface

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_rec_1 = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle #1
string ss_rec_2 = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle #2
Print( ss_rec_2, false );
Print( " = ", false );
Print( GetSubSurf( wid, 1 ) );
std::string GetSubSurf(const std::string &geom_id, int index)
Parameters
[in]geom_idstring Geom ID
[in]namestring Sub surface name
Returns
vector<string> Vector of sub-surface ID

◆ GetSubSurf() [2/2]

std::string vsp::GetSubSurf ( const std::string &  geom_id,
int  index 
)

Get the ID of the specified sub-surface

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_rec_1 = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle #1
string ss_rec_2 = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle #2
Print( ss_rec_2, false );
Print( " = ", false );
Print( GetSubSurf( wid, 1 ) );
Parameters
[in]geom_idstring Geom ID
[in]indexSub-surface index
Returns
Sub-surface ID

◆ GetSubSurfIDVec()

std::vector<std::string> vsp::GetSubSurfIDVec ( const std::string &  geom_id)

Get a vector of all sub-surface IDs for the specified geometry

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_line_id = AddSubSurf( wid, SS_LINE ); // Add Sub Surface Line
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
array<string> id_vec = GetSubSurfIDVec( wid );
string id_type_str = string( "SubSurface IDs and Type Indexes -> ");
for ( uint i = 0; i < uint(id_vec.length()); i++ )
{
id_type_str += id_vec[i];
id_type_str += string(": ");
id_type_str += GetSubSurfType(id_vec[i]);
id_type_str += string("\t");
}
id_type_str += string("\n");
Print( id_type_str );
std::vector< std::string > GetSubSurfIDVec(const std::string &geom_id)
int GetSubSurfType(const std::string &sub_id)
Parameters
[in]geom_idstring Geom ID
Returns
vector<int> Array of sub-surface IDs

◆ GetSubSurfIndex()

int vsp::GetSubSurfIndex ( const std::string &  sub_id)

Get the index of the specified sub-surface in its parent Geom's sub-surface vector

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_line_id = AddSubSurf( wid, SS_LINE ); // Add Sub Surface Line
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
int ind = GetSubSurfIndex( ss_rec_id );
string ind_str = string("Index of SS_Rectangle: ") + ind + string("\n");
Print( ind_str );
int GetSubSurfIndex(const std::string &sub_id)
Parameters
[in]sub_idstring Sub-surface ID
Returns
int Sub-surface index

◆ GetSubSurfName() [1/2]

std::string vsp::GetSubSurfName ( const std::string &  geom_id,
const std::string &  sub_id 
)

Get the name of the specified sub-surface

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
string rec_name = GetSubSurfName( wid, ss_rec_id );
string name_str = string("Current Name of SS_Rectangle: ") + rec_name + string("\n");
Print( name_str );
std::string GetSubSurfName(const std::string &geom_id, const std::string &sub_id)
Parameters
[in]geom_idstring Geom ID
[in]sub_idstring Sub-surface ID
Returns
Sub-surface name

◆ GetSubSurfName() [2/2]

std::string vsp::GetSubSurfName ( const std::string &  sub_id)

Get the name of the specified sub-surface

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
string rec_name = GetSubSurfName( wid, ss_rec_id );
string name_str = string("Current Name of SS_Rectangle: ") + rec_name + string("\n");
Print( name_str );
Parameters
[in]sub_idstring Sub-surface ID
Returns
string Sub-surface name

◆ GetSubSurfParmIDs()

std::vector<std::string> vsp::GetSubSurfParmIDs ( const std::string &  sub_id)

Get the vector of Parm IDs for specified sub-surface

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_line_id = AddSubSurf( wid, SS_LINE ); // Add Sub Surface Line
// Get and list all Parm info for SS_Line
array<string> parm_id_vec = GetSubSurfParmIDs( ss_line_id );
for ( uint i = 0; i < uint(parm_id_vec.length()); i++ )
{
string id_name_str = string("\tName: ") + GetParmName( parm_id_vec[i] ) + string(", Group: ") + GetParmDisplayGroupName( parm_id_vec[i] ) +
string(", ID: ") + parm_id_vec[i] + string("\n");
Print( id_name_str );
}
std::string GetParmName(const std::string &parm_id)
std::string GetParmDisplayGroupName(const std::string &parm_id)
std::vector< std::string > GetSubSurfParmIDs(const std::string &sub_id)
Parameters
[in]sub_idstring Sub-surface ID
Returns
vector<string> Vector of Parm IDs

◆ GetSubSurfType()

int vsp::GetSubSurfType ( const std::string &  sub_id)

Get the type for the specified sub-surface (i.e. SS_RECTANGLE)

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_line_id = AddSubSurf( wid, SS_LINE ); // Add Sub Surface Line
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
array<string> id_vec = GetSubSurfIDVec( wid );
string id_type_str = string( "SubSurface IDs and Type Indexes -> ");
for ( uint i = 0; i < uint(id_vec.length()); i++ )
{
id_type_str += id_vec[i];
id_type_str += string(": ");
id_type_str += GetSubSurfType(id_vec[i]);
id_type_str += string("\t");
}
id_type_str += string("\n");
Print( id_type_str );
See also
SUBSURF_TYPE
Parameters
[in]sub_idstring Sub-surface ID
Returns
int Sub-surface type enum (i.e. SS_RECTANGLE)

◆ SetSubSurfName() [1/2]

void vsp::SetSubSurfName ( const std::string &  geom_id,
const std::string &  sub_id,
const std::string &  name 
)

Set the name of the specified sub-surface

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
string new_name = string("New_SS_Rec_Name");
SetSubSurfName( wid, ss_rec_id, new_name );
void SetSubSurfName(const std::string &geom_id, const std::string &sub_id, const std::string &name)
Parameters
[in]geom_idstring Geom ID
[in]sub_idstring Sub-surface ID
[in]namestring Sub-surface name

◆ SetSubSurfName() [2/2]

void vsp::SetSubSurfName ( const std::string &  sub_id,
const std::string &  name 
)

Set the name of the specified sub-surface

string wid = AddGeom( "WING", "" ); // Add Wing
string ss_rec_id = AddSubSurf( wid, SS_RECTANGLE ); // Add Sub Surface Rectangle
string new_name = string("New_SS_Rec_Name");
SetSubSurfName( ss_rec_id, new_name );
Parameters
[in]sub_idstring Sub-surface ID
[in]namestring Sub-surface name