OpenVSP API Documentation 3.55.0
Loading...
Searching...
No Matches
XSec and Airfoil Functions

This group of functions provides API control of cross-sections (XSecs). Airfoils are a type of XSec included in this group as well. API functions for Body of Revolution XSecs are included in the Specialized Geometry group. Click here to return to the main page. More...

Functions

void vsp::SetXSecAlias (const std::string &id, const std::string &alias)
std::string vsp::GetXSecAlias (const std::string &id)
void vsp::SetXSecCurveAlias (const std::string &id, const std::string &alias)
std::string vsp::GetXSecCurveAlias (const std::string &id)
void vsp::CutXSec (const std::string &geom_id, int index)
void vsp::CutXSecByID (const std::string &xsec_id)
void vsp::CopyXSec (const std::string &geom_id, int index)
void vsp::CopyXSecByID (const std::string &xsec_id)
void vsp::PasteXSec (const std::string &geom_id, int index)
void vsp::PasteXSecByID (const std::string &xsec_id)
void vsp::InsertXSec (const std::string &geom_id, int index, int type)
std::string vsp::InsertXSecByID (const std::string &xsec_id, int type)
std::string vsp::SplitWingXSecByID (const std::string &xsec_id)
std::vector< int > vsp::GetDriverGroupByID (const std::string &xsec_id)
void vsp::SetDriverGroup (const std::string &geom_id, int section_index, int driver_0, int driver_1=-1, int driver_2=-1)
void vsp::SetDriverGroupByID (const std::string &xsec_id, int driver_0, int driver_1=-1, int driver_2=-1)
void vsp::SetEngineInletFaceXSecID (const std::string &geom_id, const std::string &xsec_id)
std::string vsp::GetEngineInletFaceXSecID (const std::string &geom_id)
void vsp::SetEngineInletLipXSecID (const std::string &geom_id, const std::string &xsec_id)
std::string vsp::GetEngineInletLipXSecID (const std::string &geom_id)
void vsp::SetEngineOutletFaceXSecID (const std::string &geom_id, const std::string &xsec_id)
std::string vsp::GetEngineOutletFaceXSecID (const std::string &geom_id)
void vsp::SetEngineOutletLipXSecID (const std::string &geom_id, const std::string &xsec_id)
std::string vsp::GetEngineOutletLipXSecID (const std::string &geom_id)
void vsp::ChangeXSecShapeByID (const std::string &xsec_id, int type)
void vsp::FitCSTAirfoil (const std::string &xsec_surf_id, int xsec_index, int deg)
void vsp::FitCSTAirfoilByID (const std::string &xsec_id, int deg)
int vsp::GetXSecShape (const std::string &xsec_id)
double vsp::GetXSecWidth (const std::string &xsec_id)
double vsp::GetXSecHeight (const std::string &xsec_id)
void vsp::SetXSecWidthHeight (const std::string &xsec_id, double w, double h)
void vsp::SetXSecWidth (const std::string &xsec_id, double w)
void vsp::SetXSecHeight (const std::string &xsec_id, double h)
std::vector< std::string > vsp::GetXSecParmIDs (const std::string &xsec_id)
std::string vsp::GetXSecParm (const std::string &xsec_id, const std::string &name)
std::vector< vec3d > vsp::ReadFileXSec (const std::string &xsec_id, const std::string &file_name)
std::vector< vec3d > vsp::GetXSecPnts (const std::string &xsec_id)
void vsp::CopyXSecCurve (const std::string &geom_id, int index)
void vsp::CopyXSecCurveByID (const std::string &xsec_id)
void vsp::PasteXSecCurve (const std::string &geom_id, int index)
void vsp::PasteXSecCurveByID (const std::string &xsec_id)
void vsp::SetXSecPnts (const std::string &xsec_id, std::vector< vec3d > &pnt_vec)
vec3d vsp::ComputeXSecPnt (const std::string &xsec_id, double fract)
vec3d vsp::ComputeXSecTan (const std::string &xsec_id, double fract)
void vsp::ResetXSecSkinParms (const std::string &xsec_id)
int vsp::GetXSecContinuity (const std::string &xsec_id)
void vsp::SetXSecContinuity (const std::string &xsec_id, int cx)
int vsp::AddSkinSpine (const std::string &geom_id, double w01)
void vsp::DelSkinSpine (const std::string &geom_id, int index)
void vsp::DelSkinSpineByID (const std::string &spine_id)
void vsp::DelAllSkinSpines (const std::string &geom_id)
int vsp::GetNumSkinSpines (const std::string &geom_id)
std::string vsp::GetSkinSpineName (const std::string &geom_id, int index)
std::string vsp::GetSkinSpineNameByID (const std::string &spine_id)
void vsp::SetSkinSpineName (const std::string &geom_id, int index, const std::string &name)
void vsp::SetSkinSpineNameByID (const std::string &spine_id, const std::string &name)
std::string vsp::GetSkinSpineID (const std::string &xsec_id, int index)
std::vector< std::string > vsp::GetSkinSpineIDVec (const std::string &xsec_id)
std::string vsp::GetSkinSpineParm (const std::string &spine_id, const std::string &name)
std::vector< double > vsp::GetXSecTanAngles (const std::string &xsec_id, int side)
void vsp::SetXSecTanAngles (const std::string &xsec_id, int side, double top, double right, double bottom, double left)
std::vector< double > vsp::GetXSecTanSlews (const std::string &xsec_id, int side)
void vsp::SetXSecTanSlews (const std::string &xsec_id, int side, double top, double right, double bottom, double left)
std::vector< double > vsp::GetXSecTanStrengths (const std::string &xsec_id, int side)
void vsp::SetXSecTanStrengths (const std::string &xsec_id, int side, double top, double right, double bottom, double left)
std::vector< double > vsp::GetXSecCurvatures (const std::string &xsec_id, int side)
void vsp::SetXSecCurvatures (const std::string &xsec_id, int side, double top, double right, double bottom, double left)
void vsp::ReadFileAirfoil (const std::string &xsec_id, const std::string &file_name)
void vsp::SetAirfoilUpperPnts (const std::string &xsec_id, const std::vector< vec3d > &up_pnt_vec)
void vsp::SetAirfoilLowerPnts (const std::string &xsec_id, const std::vector< vec3d > &low_pnt_vec)
void vsp::SetAirfoilPnts (const std::string &xsec_id, const std::vector< vec3d > &up_pnt_vec, const std::vector< vec3d > &low_pnt_vec)
std::vector< vec3d > vsp::GetHersheyBarLiftDist (const int &npts, const double &alpha, const double &Vinf, const double &span, bool full_span_flag=false)
std::vector< vec3d > vsp::GetHersheyBarDragDist (const int &npts, const double &alpha, const double &Vinf, const double &span, bool full_span_flag=false)
std::vector< vec3d > vsp::GetVKTAirfoilPnts (const int &npts, const double &alpha, const double &epsilon, const double &kappa, const double &tau)
std::vector< double > vsp::GetVKTAirfoilCpDist (const double &alpha, const double &epsilon, const double &kappa, const double &tau, const std::vector< vec3d > &xyz_data)
std::vector< vec3d > vsp::GetEllipsoidSurfPnts (const vec3d &center, const vec3d &abc_rad, int u_npts=20, int w_npts=20)
std::vector< vec3d > vsp::GetFeatureLinePnts (const std::string &geom_id)
std::vector< double > vsp::GetEllipsoidCpDist (const std::vector< vec3d > &surf_pnt_vec, const vec3d &abc_rad, const vec3d &V_inf)
std::vector< vec3d > vsp::GetAirfoilUpperPnts (const std::string &xsec_id)
std::vector< vec3d > vsp::GetAirfoilLowerPnts (const std::string &xsec_id)
std::vector< double > vsp::GetUpperCSTCoefs (const std::string &xsec_id)
std::vector< double > vsp::GetLowerCSTCoefs (const std::string &xsec_id)
int vsp::GetUpperCSTDegree (const std::string &xsec_id)
int vsp::GetLowerCSTDegree (const std::string &xsec_id)
void vsp::SetUpperCST (const std::string &xsec_id, int deg, const std::vector< double > &coefs)
void vsp::SetLowerCST (const std::string &xsec_id, int deg, const std::vector< double > &coefs)
void vsp::PromoteCSTUpper (const std::string &xsec_id)
void vsp::PromoteCSTLower (const std::string &xsec_id)
void vsp::DemoteCSTUpper (const std::string &xsec_id)
void vsp::DemoteCSTLower (const std::string &xsec_id)
void vsp::FitAfCST (const std::string &xsec_surf_id, int xsec_index, int deg)
void vsp::FitAfCSTByID (const std::string &xsec_id, int deg)
void vsp::WriteBezierAirfoil (const std::string &file_name, const std::string &geom_id, const double &foilsurf_u)
void vsp::WriteSeligAirfoil (const std::string &file_name, const std::string &geom_id, const double &foilsurf_u)
std::vector< vec3d > vsp::GetAirfoilCoordinates (const std::string &geom_id, const double &foilsurf_u)
void vsp::CopyAirfoilByID (const std::string &xsec_id)
void vsp::PasteAirfoilByID (const std::string &xsec_id)
void vsp::ClearSkinningByID (const std::string &xsec_id)

Detailed Description

Function Documentation

◆ AddSkinSpine()

int vsp::AddSkinSpine ( const std::string & geom_id,
double w01 )
extern

Add a user defined skinning spine to a Fuselage or Stack. Skinning is otherwise controlled only at the four fixed stations – Right, Bottom, Left and Top, at W01 of 0, 0.25, 0.5 and 0.75. A spine adds another anywhere in between. It runs the length of the body, so it is added to every cross section at once; its values are then set per cross section.

Parameters
[in]geom_idstring Geom ID
string sid = AddGeom( "STACK", "" );
// Add a spine between the Right and Bottom stations
int ispine = AddSkinSpine( sid, 0.15 );
if ( GetNumSkinSpines( sid ) != 1 ) { Print( "---> Error: API AddSkinSpine " ); __failure++; }
void Print(const std::string &data, bool new_line=true)
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
int GetNumSkinSpines(const std::string &geom_id)
int AddSkinSpine(const std::string &geom_id, double w01)
Parameters
[in]w01double Position around the cross section, on a [0, 1] basis
Returns
int Index of the new spine
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChangeXSecShapeByID()

void vsp::ChangeXSecShapeByID ( const std::string & xsec_id,
int type )
extern

Change the shape of a cross-section, by XSec ID. The cross-section keeps its ID.

string gid = AddGeom( "FUSELAGE" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
if ( GetXSecShape( xsec_1 ) != XS_ELLIPSE )
{
Print( "ERROR: ChangeXSecShapeByID did not change the shape" );
__failure++;
}
@ XS_ELLIPSE
int GetXSecShape(const std::string &xsec_id)
void ChangeXSecShapeByID(const std::string &xsec_id, int type)
std::string GetXSecSurf(const std::string &geom_id, int index)
std::string GetXSec(const std::string &xsec_surf_id, int xsec_index)
See also
XSEC_CRV_TYPE, ChangeXSecShape
Parameters
[in]xsec_idstring XSec ID
[in]typeint XSec type enum (i.e. XS_ELLIPSE)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClearSkinningByID()

void vsp::ClearSkinningByID ( const std::string & xsec_id)
extern

Release the skinning controls of one cross-section, by XSec ID.

string sid = AddGeom( "STACK" );
string xsec = GetXSec( GetXSecSurf( sid, 0 ), 1 );
SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 15.0, -1.0e12, -1.0e12, -1.0e12 );
if ( abs( GetParmVal( GetXSecParm( xsec, "TopLAngleSet" ) ) ) > 1e-12 )
{
Print( "ERROR: ClearSkinningByID did not release the section" );
__failure++;
}
@ XSEC_BOTH_SIDES
double GetParmVal(const std::string &parm_id)
void Update(bool update_managers=true)
void ClearSkinningByID(const std::string &xsec_id)
std::string GetXSecParm(const std::string &xsec_id, const std::string &name)
void SetXSecTanAngles(const std::string &xsec_id, int side, double top, double right, double bottom, double left)
See also
ClearSkinning, ResetXSecSkinParms
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeXSecPnt()

vec3d vsp::ComputeXSecPnt ( const std::string & xsec_id,
double fract )
extern

Compute 3D coordinate for a point on an XSec curve given the parameter value (U) along the curve

//==== Add Geom ====//
string stack_id = AddGeom( "STACK" );
//==== Get The XSec Surf ====//
string xsec_surf = GetXSecSurf( stack_id, 0 );
string xsec = GetXSec( xsec_surf, 2 );
double u_fract = 0.25;
vec3d pnt = ComputeXSecPnt( xsec, u_fract );
// The section is a closed curve, so the ends meet.
if ( dist( ComputeXSecPnt( xsec, 0.0 ), ComputeXSecPnt( xsec, 1.0 ) ) > 1e-6 )
{
Print( "ERROR: the XSec curve does not close" );
__failure++;
}
// The point has to lie on the section, which is sized by its width and
// height about the section origin.
double w = GetXSecWidth( xsec );
double h = GetXSecHeight( xsec );
if ( abs( pnt.y() ) > 0.5 * w + 1e-6 || abs( pnt.z() ) > 0.5 * h + 1e-6 )
{
Print( "ERROR: ComputeXSecPnt returned a point off the section" );
__failure++;
}
double GetXSecWidth(const std::string &xsec_id)
vec3d ComputeXSecPnt(const std::string &xsec_id, double fract)
double GetXSecHeight(const std::string &xsec_id)
double y() const
Definition Vec3d.h:563
double z() const
Definition Vec3d.h:595
Definition Vec3d.h:238
double dist(const vec3d &a, const vec3d &b)
Parameters
[in]xsec_idstring XSec ID
[in]fractdouble Curve parameter value (range: 0 - 1)
Returns
vec3d 3D coordinate point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeXSecTan()

vec3d vsp::ComputeXSecTan ( const std::string & xsec_id,
double fract )
extern

Compute the tangent vector of a point on an XSec curve given the parameter value (U) along the curve

//==== Add Geom ====//
string stack_id = AddGeom( "STACK" );
//==== Get The XSec Surf ====//
string xsec_surf = GetXSecSurf( stack_id, 0 );
string xsec = GetXSec( xsec_surf, 2 );
double u_fract = 0.25;
vec3d tan = ComputeXSecTan( xsec, u_fract );
// A tangent is a direction, so it has to have some length.
if ( tan.mag() < 1e-9 )
{
Print( "ERROR: ComputeXSecTan returned a degenerate tangent" );
__failure++;
}
// The tangent has to follow the curve, so stepping along the curve from the
// point has to line up with it.
double du = 1.0e-5;
vec3d p0 = ComputeXSecPnt( xsec, u_fract );
vec3d p1 = ComputeXSecPnt( xsec, u_fract + du );
vec3d fd = p1 - p0;
if ( fd.mag() < 1e-12 )
{
Print( "ERROR: the XSec curve does not advance" );
__failure++;
}
else
{
double align = dot( fd, tan ) / ( fd.mag() * tan.mag() );
if ( align < 0.999 )
{
Print( "ERROR: ComputeXSecTan does not follow the curve" );
__failure++;
}
}
vec3d ComputeXSecTan(const std::string &xsec_id, double fract)
double mag() const
double dot(const vec3d &a, const vec3d &b)
Parameters
[in]xsec_idstring XSec ID
[in]fractdouble Curve parameter value (range: 0 - 1)
Returns
vec3d Tangent vector
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyAirfoilByID()

void vsp::CopyAirfoilByID ( const std::string & xsec_id)
extern

Copy the airfoil of a wing section to the clipboard, by XSec ID.

string gid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_0 = GetXSec( xsec_surf, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
CopyAirfoilByID( xsec_1 );
PasteAirfoilByID( xsec_0 );
if ( GetXSecShape( xsec_0 ) != XS_SIX_SERIES )
{
Print( "ERROR: CopyAirfoilByID did not copy the airfoil" );
__failure++;
}
@ XS_SIX_SERIES
void CopyAirfoilByID(const std::string &xsec_id)
void PasteAirfoilByID(const std::string &xsec_id)
See also
PasteAirfoil, CopyAirfoil
Parameters
[in]xsec_idstring Wing section XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyXSec()

void vsp::CopyXSec ( const std::string & geom_id,
int index )
extern

Copy a cross-section from the specified geometry and maintain it in memory

// Add Stack
string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
// Give XSec 1 a shape that XSec 3 does not have.
int num_start = GetNumXSec( xsec_surf );
// Copy XSec To Clipboard
CopyXSec( sid, 1 );
// Paste To XSec 3
PasteXSec( sid, 3 );
// Pasting replaces the target section, so the count is unchanged and XSec 3
// now carries the shape that was copied.
if ( GetNumXSec( xsec_surf ) != num_start )
{
Print( "ERROR: PasteXSec changed the number of sections" );
__failure++;
}
if ( GetXSecShape( GetXSec( xsec_surf, 3 ) ) != XS_ROUNDED_RECTANGLE )
{
Print( "ERROR: PasteXSec did not paste the copied section" );
__failure++;
}
// The section that was copied has to be left alone.
if ( GetXSecShape( GetXSec( xsec_surf, 1 ) ) != XS_ROUNDED_RECTANGLE )
{
Print( "ERROR: CopyXSec disturbed the section it copied" );
__failure++;
}
@ XS_ROUNDED_RECTANGLE
void PasteXSec(const std::string &geom_id, int index)
void CopyXSec(const std::string &geom_id, int index)
int GetNumXSec(const std::string &xsec_surf_id)
void ChangeXSecShape(const std::string &xsec_surf_id, int xsec_index, int type)
See also
PasteXSec, CopyXSecByID
Parameters
[in]geom_idstring Geom ID
[in]indexint XSec index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyXSecByID()

void vsp::CopyXSecByID ( const std::string & xsec_id)
extern

Copy a cross-section to the clipboard, by XSec ID.

string gid = AddGeom( "FUSELAGE" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
string xsec_2 = GetXSec( xsec_surf, 2 );
CopyXSecByID( xsec_1 );
PasteXSecByID( xsec_2 );
if ( GetXSecShape( xsec_2 ) != XS_ELLIPSE )
{
Print( "ERROR: CopyXSecByID did not copy the XSec" );
__failure++;
}
void CopyXSecByID(const std::string &xsec_id)
void PasteXSecByID(const std::string &xsec_id)
See also
PasteXSec, CutXSec, CopyXSec
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyXSecCurve()

void vsp::CopyXSecCurve ( const std::string & geom_id,
int index )
extern

Copy the XSecCurve of a cross section to the XSecCurve clipboard. This carries the section shape without the section's placement, and works on a body of revolution too, where the index is ignored because it holds only one curve.

// Add Stack
string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
CopyXSecCurve( sid, 1 );
PasteXSecCurve( sid, 3 );
// The shape travels to the pasted section.
if ( GetXSecShape( GetXSec( xsec_surf, 3 ) ) != XS_ROUNDED_RECTANGLE )
{
Print( "ERROR: the XSecCurve did not paste" );
__failure++;
}
// A Geom that carries no cross sections has to be rejected.
string pid = AddGeom( "POD" );
CopyXSecCurve( pid, 0 );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: CopyXSecCurve accepted a Geom with no cross sections" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void CopyXSecCurve(const std::string &geom_id, int index)
void PasteXSecCurve(const std::string &geom_id, int index)
See also
PasteXSecCurve, CopyXSec, CopyAirfoil, CopyXSecCurveByID
Parameters
[in]geom_idstring Geom ID
[in]indexint XSec index, ignored for a body of revolution
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyXSecCurveByID()

void vsp::CopyXSecCurveByID ( const std::string & xsec_id)
extern

Copy the XSecCurve of a cross-section to the clipboard, by XSec ID.

string gid = AddGeom( "FUSELAGE" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
string xsec_2 = GetXSec( xsec_surf, 2 );
if ( GetXSecShape( xsec_2 ) != XS_ELLIPSE )
{
Print( "ERROR: CopyXSecCurveByID did not copy the curve" );
__failure++;
}
void PasteXSecCurveByID(const std::string &xsec_id)
void CopyXSecCurveByID(const std::string &xsec_id)
See also
PasteXSecCurve, CopyXSecCurve
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CutXSec()

void vsp::CutXSec ( const std::string & geom_id,
int index )
extern

Cut a cross-section from the specified geometry and maintain it in memory. Refused on a Clone; change the Geom it copies.

string fid = AddGeom( "FUSELAGE", "" ); // Add Fuselage
//==== Insert, Cut, Paste Example ====//
string xsec_surf = GetXSecSurf( fid, 0 );
int num_start = GetNumXSec( xsec_surf );
InsertXSec( fid, 1, XS_ROUNDED_RECTANGLE ); // Insert A Cross-Section
if ( GetNumXSec( xsec_surf ) != num_start + 1 )
{
Print( "ERROR: InsertXSec did not add a section" );
__failure++;
}
if ( GetXSecShape( GetXSec( xsec_surf, 2 ) ) != XS_ROUNDED_RECTANGLE )
{
Print( "ERROR: InsertXSec did not insert after the given index" );
__failure++;
}
CopyXSec( fid, 2 ); // Copy Just Created XSec To Clipboard
PasteXSec( fid, 1 ); // Paste Clipboard
// Pasting replaces a section rather than adding one, and section 1 now
// carries the shape that was copied.
if ( GetNumXSec( xsec_surf ) != num_start + 1 )
{
Print( "ERROR: PasteXSec changed the number of sections" );
__failure++;
}
if ( GetXSecShape( GetXSec( xsec_surf, 1 ) ) != XS_ROUNDED_RECTANGLE )
{
Print( "ERROR: PasteXSec did not paste the copied section" );
__failure++;
}
CutXSec( fid, 2 ); // Cut Created XSec
if ( GetNumXSec( xsec_surf ) != num_start )
{
Print( "ERROR: CutXSec did not remove a section" );
__failure++;
}
void InsertXSec(const std::string &geom_id, int index, int type)
void CutXSec(const std::string &geom_id, int index)
See also
PasteXSec, CutXSecByID
Parameters
[in]geom_idstring Geom ID
[in]indexint XSec index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CutXSecByID()

void vsp::CutXSecByID ( const std::string & xsec_id)
extern

Cut a cross-section from its Geom, by XSec ID, and put it on the clipboard.

string gid = AddGeom( "FUSELAGE" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
int n = GetNumXSec( xsec_surf );
CutXSecByID( xsec_1 );
array< string > @ids = GetXSecIDVec( xsec_surf );
if ( GetNumXSec( xsec_surf ) != n - 1 || ids.find( xsec_1 ) >= 0 )
{
Print( "ERROR: CutXSecByID did not remove the XSec" );
__failure++;
}
void CutXSecByID(const std::string &xsec_id)
std::vector< std::string > GetXSecIDVec(const std::string &xsec_surf_id)
See also
CopyXSec, PasteXSec, CutXSec
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DelAllSkinSpines()

void vsp::DelAllSkinSpines ( const std::string & geom_id)
extern

Delete every user defined skinning spine from a Geom.

string sid = AddGeom( "STACK", "" );
AddSkinSpine( sid, 0.15 );
AddSkinSpine( sid, 0.35 );
if ( GetNumSkinSpines( sid ) != 0 ) { Print( "---> Error: API DelAllSkinSpines " ); __failure++; }
void DelAllSkinSpines(const std::string &geom_id)
Parameters
[in]geom_idstring Geom ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DelSkinSpine()

void vsp::DelSkinSpine ( const std::string & geom_id,
int index )
extern

Delete a user defined skinning spine from every cross section of a Geom.

See also
DelSkinSpineByID
Parameters
[in]geom_idstring Geom ID
string sid = AddGeom( "STACK", "" );
AddSkinSpine( sid, 0.15 );
DelSkinSpine( sid, 0 );
if ( GetNumSkinSpines( sid ) != 0 ) { Print( "---> Error: API DelSkinSpine " ); __failure++; }
void DelSkinSpine(const std::string &geom_id, int index)
Parameters
[in]indexint Spine index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DelSkinSpineByID()

void vsp::DelSkinSpineByID ( const std::string & spine_id)
extern

Delete a skin spine from every cross-section of its Geom, by the ID of the spine on any one of them.

string gid = AddGeom( "STACK" );
int spine_index = AddSkinSpine( gid, 0.15 );
string xsec = GetXSec( GetXSecSurf( gid, 0 ), 1 );
array< string > @spines = GetSkinSpineIDVec( xsec );
DelSkinSpineByID( spines[ spine_index ] );
if ( GetNumSkinSpines( gid ) != 0 )
{
Print( "ERROR: DelSkinSpineByID did not delete the spine" );
__failure++;
}
std::vector< std::string > GetSkinSpineIDVec(const std::string &xsec_id)
void DelSkinSpineByID(const std::string &spine_id)
See also
AddSkinSpine, GetSkinSpineIDVec, DelSkinSpine
Parameters
[in]spine_idstring Skin spine ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DemoteCSTLower()

void vsp::DemoteCSTLower ( const std::string & xsec_id)
extern

Demote the CST for the lower airfoil surface. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
int deg = GetLowerCSTDegree( xsec );
if ( GetLowerCSTDegree( xsec ) != deg - 1 ) { Print( "ERROR: DemoteCSTLower" ); __failure++; }
@ XS_CST_AIRFOIL
int GetLowerCSTDegree(const std::string &xsec_id)
void PromoteCSTLower(const std::string &xsec_id)
void DemoteCSTLower(const std::string &xsec_id)
See also
GetLowerCSTDegree
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DemoteCSTUpper()

void vsp::DemoteCSTUpper ( const std::string & xsec_id)
extern

Demote the CST for the upper airfoil surface. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
int deg = GetUpperCSTDegree( xsec );
if ( GetUpperCSTDegree( xsec ) != deg - 1 ) { Print( "ERROR: DemoteCSTUpper" ); __failure++; }
void DemoteCSTUpper(const std::string &xsec_id)
void PromoteCSTUpper(const std::string &xsec_id)
int GetUpperCSTDegree(const std::string &xsec_id)
See also
GetUpperCSTDegree
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FitAfCST()

void vsp::FitAfCST ( const std::string & xsec_surf_id,
int xsec_index,
int deg )
extern

Fit a CST airfoil for an existing airfoil of type XS_FOUR_SERIES, XS_SIX_SERIES, XS_FOUR_DIGIT_MOD, XS_FIVE_DIGIT, XS_FIVE_DIGIT_MOD, XS_ONE_SIX_SERIES, or XS_FILE_AIRFOIL.

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
FitAfCST( xsec_surf, 1, 5 );
void FitAfCST(const std::string &xsec_surf_id, int xsec_index, int deg)
See also
FitAfCSTByID
Parameters
[in]xsec_surf_idstring XsecSurf ID
[in]xsec_indexint XSec index
[in]degint CST degree
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FitAfCSTByID()

void vsp::FitAfCSTByID ( const std::string & xsec_id,
int deg )
extern

Convert an analytic or file airfoil cross-section to a CST airfoil fit to its shape, by XSec ID.

string gid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
FitAfCSTByID( xsec_1, 8 );
if ( GetXSecShape( xsec_1 ) != XS_CST_AIRFOIL )
{
Print( "ERROR: FitAfCSTByID did not convert the XSec" );
__failure++;
}
void FitAfCSTByID(const std::string &xsec_id, int deg)
See also
FitCSTAirfoil, FitAfCST
Parameters
[in]xsec_idstring XSec ID
[in]degint CST degree
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FitCSTAirfoil()

void vsp::FitCSTAirfoil ( const std::string & xsec_surf_id,
int xsec_index,
int deg )
extern

Convert an airfoil cross section to a CST airfoil fitted to the shape it already has, the way the Fit CST button on the airfoil panels does. A CST airfoil is described by coefficients rather than by a table or a series designation, which is what makes it useful for optimization; fitting is how an airfoil of any other type is brought into that form without changing shape.

string wing_id = AddGeom( "WING", "" );
string xsec_surf = GetXSecSurf( wing_id, 0 );
FitCSTAirfoil( xsec_surf, 1, 8 );
string xsec = GetXSec( xsec_surf, 1 );
if ( GetXSecShape( xsec ) != XS_CST_AIRFOIL )
{
Print( "ERROR: FitCSTAirfoil did not convert the XSec" );
__failure++;
}
// The fit is carried out at the degree that was asked for.
if ( GetUpperCSTDegree( xsec ) != 8 || GetLowerCSTDegree( xsec ) != 8 )
{
Print( "ERROR: FitCSTAirfoil did not fit at the requested degree" );
__failure++;
}
@ XS_FOUR_SERIES
void FitCSTAirfoil(const std::string &xsec_surf_id, int xsec_index, int deg)
See also
ChangeXSecShape, GetUpperCSTCoefs, PromoteCSTUpper, FitCSTAirfoilByID
Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]xsec_indexint XSec index
[in]degint Degree to fit the CST airfoil at
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FitCSTAirfoilByID()

void vsp::FitCSTAirfoilByID ( const std::string & xsec_id,
int deg )
extern

Convert an airfoil cross-section to a CST airfoil fit to its shape, by XSec ID.

string gid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
FitCSTAirfoilByID( xsec_1, 8 );
if ( GetXSecShape( xsec_1 ) != XS_CST_AIRFOIL )
{
Print( "ERROR: FitCSTAirfoilByID did not convert the XSec" );
__failure++;
}
void FitCSTAirfoilByID(const std::string &xsec_id, int deg)
See also
FitAfCST, FitCSTAirfoil
Parameters
[in]xsec_idstring XSec ID
[in]degint CST degree
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAirfoilCoordinates()

std::vector< vec3d > vsp::GetAirfoilCoordinates ( const std::string & geom_id,
const double & foilsurf_u )
extern

Get the untwisted unit-length 2D coordinate points for the specified airfoil

string wid = AddGeom( "WING" );
array < vec3d > @pnts = GetAirfoilCoordinates( wid, 0.5 );
if ( pnts.size() == 0 ) { Print( "ERROR: GetAirfoilCoordinates" ); __failure++; }
std::vector< vec3d > GetAirfoilCoordinates(const std::string &geom_id, const double &foilsurf_u)
See also
WriteSeligAirfoil
Parameters
[in]geom_idstring Geom ID
[in]foilsurf_udouble U location (range: 0 - 1) along the surface. The foil surface does not include root and tip caps (i.e. 2 section wing -> XSec0 @ u=0, XSec1 @ u=0.5, XSec2 @ u=1.0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAirfoilLowerPnts()

std::vector< vec3d > vsp::GetAirfoilLowerPnts ( const std::string & xsec_id)
extern

Get the coordinate points for the lower surface of an airfoil. The XSec must be of type XS_FILE_AIRFOIL

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" );
array< vec3d > @low_array = GetAirfoilLowerPnts( xsec );
if ( low_array.length() == 0 )
{
Print( "ERROR: GetAirfoilLowerPnts returned nothing" );
__failure++;
}
@ XS_FILE_AIRFOIL
std::vector< vec3d > GetAirfoilLowerPnts(const std::string &xsec_id)
void ReadFileAirfoil(const std::string &xsec_id, const std::string &file_name)
See also
SetAirfoilPnts
Parameters
[in]xsec_idstring XSec ID
Returns
vector<vec3d> Vector of coordinate points for the lower airfoil surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAirfoilUpperPnts()

std::vector< vec3d > vsp::GetAirfoilUpperPnts ( const std::string & xsec_id)
extern

Get the coordinate points for the upper surface of an airfoil. The XSec must be of type XS_FILE_AIRFOIL

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" );
array< vec3d > @up_array = GetAirfoilUpperPnts( xsec );
if ( up_array.length() == 0 )
{
Print( "ERROR: GetAirfoilUpperPnts returned nothing" );
__failure++;
}
std::vector< vec3d > GetAirfoilUpperPnts(const std::string &xsec_id)
See also
SetAirfoilPnts
Parameters
[in]xsec_idstring XSec ID
Returns
vector<vec3d> VectorArray of coordinate points for the upper airfoil surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDriverGroupByID()

std::vector< int > vsp::GetDriverGroupByID ( const std::string & xsec_id)
extern

Get the driver group of a wing section or XSecCurve, by XSec ID.

string gid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
array< int > @drivers = GetDriverGroupByID( xsec_1 );
if ( drivers.size() != 3 || drivers[0] != AR_WSECT_DRIVER || drivers[1] != ROOTC_WSECT_DRIVER || drivers[2] != TIPC_WSECT_DRIVER )
{
Print( "ERROR: GetDriverGroupByID did not return the drivers set" );
__failure++;
}
@ ROOTC_WSECT_DRIVER
@ TIPC_WSECT_DRIVER
@ AR_WSECT_DRIVER
std::vector< int > GetDriverGroupByID(const std::string &xsec_id)
void SetDriverGroupByID(const std::string &xsec_id, int driver_0, int driver_1=-1, int driver_2=-1)
See also
SetDriverGroupByID, WING_DRIVERS, XSEC_DRIVERS, GetDriverGroup
Parameters
[in]xsec_idstring XSec ID
Returns
array<int> Array of driver enums
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEllipsoidCpDist()

std::vector< double > vsp::GetEllipsoidCpDist ( const std::vector< vec3d > & surf_pnt_vec,
const vec3d & abc_rad,
const vec3d & V_inf )
extern

Generate Analytical Solution for Potential Flow for specified ellipsoid shape at input surface points for input velocity vector. Based on Munk, M. M., 'Remarks on the Pressure Distribution over the Surface of an Ellipsoid, Moving Translationally Through a Perfect Fluid,' NACA TN-196, June 1924. Function initially created to compare VSPAERO results to theory.

const double pi = 3.14159265358979323846;
const int npts = 101;
const vec3d abc_rad = vec3d(1.0, 2.0, 3.0);
const double alpha = 5; // deg
const double beta = 5; // deg
const double V_inf = 100.0;
array < vec3d > x_slice_pnt_vec(npts);
array<double> theta_vec(npts);
theta_vec[0] = 0;
for ( int i = 1; i < npts; i++ )
{
theta_vec[i] = theta_vec[i-1] + (2 * pi / ( npts - 1) );
}
for ( int i = 0; i < npts; i++ )
{
x_slice_pnt_vec[i] = vec3d( 0, abc_rad[1] * cos( theta_vec[i] ), abc_rad[2] *sin( theta_vec[i] ) );
}
vec3d V_vec = vec3d( ( V_inf * cos( Deg2Rad( alpha ) ) * cos( Deg2Rad( beta ) ) ), ( V_inf * sin( Deg2Rad( beta ) ) ), ( V_inf * sin( Deg2Rad( alpha ) ) * cos( Deg2Rad( beta ) ) ) );
array < double > cp_dist = GetEllipsoidCpDist( x_slice_pnt_vec, abc_rad, V_vec );
if ( cp_dist.length() == 0 )
{
Print( "ERROR: GetEllipsoidCpDist returned nothing" );
__failure++;
}
double Deg2Rad(double d)
std::vector< double > GetEllipsoidCpDist(const std::vector< vec3d > &surf_pnt_vec, const vec3d &abc_rad, const vec3d &V_inf)
See also
GetEllipsoidSurfPnts
Parameters
[in]surf_pnt_vecvector<vec3d> Vector of points on the ellipsoid surface to assess
[in]abc_radvec3d Radius along the A (X), B (Y), and C (Z) axes
[in]V_infvec3d 3D components of freestream velocity
Returns
vector<double> Vector of Cp results corresponding to each point in surf_pnt_arr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEllipsoidSurfPnts()

std::vector< vec3d > vsp::GetEllipsoidSurfPnts ( const vec3d & center,
const vec3d & abc_rad,
int u_npts = 20,
int w_npts = 20 )
extern

Generate the surface coordinate points for a ellipsoid at specified center of input radius along each axis. Based on the MATLAB function ellipsoid (https://in.mathworks.com/help/matlab/ref/ellipsoid.html).

array < vec3d > @pnts = GetEllipsoidSurfPnts( vec3d( 0.0, 0.0, 0.0 ), vec3d( 1.0, 2.0, 3.0 ), 10, 10 );
if ( pnts.size() == 0 ) { Print( "ERROR: GetEllipsoidSurfPnts" ); __failure++; }
std::vector< vec3d > GetEllipsoidSurfPnts(const vec3d &center, const vec3d &abc_rad, int u_npts=20, int w_npts=20)
See also
GetVKTAirfoilPnts
Parameters
[in]centervec3d 3D location of the ellipsoid center
[in]abc_radvec3d Radius along the A (X), B (Y), and C (Z) axes
[in]u_nptsint Number of points in the U direction
[in]w_nptsint Number of points in the W direction
Returns
vector<vec3d> Array of coordinates describing the ellipsoid surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEngineInletFaceXSecID()

std::string vsp::GetEngineInletFaceXSecID ( const std::string & geom_id)
extern

Get the cross-section an engine Geom models its inlet face at.

string sid = AddGeom( "STACK" );
string xsec_2 = GetXSec( GetXSecSurf( sid, 0 ), 2 );
SetEngineInletFaceXSecID( sid, xsec_2 );
if ( GetEngineInletFaceXSecID( sid ) != xsec_2 )
{
Print( "ERROR: GetEngineInletFaceXSecID did not return the XSec set" );
__failure++;
}
std::string GetEngineInletFaceXSecID(const std::string &geom_id)
void SetEngineInletFaceXSecID(const std::string &geom_id, const std::string &xsec_id)
See also
SetEngineInletFaceXSecID
Parameters
[in]geom_idstring Engine Geom ID
Returns
string XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEngineInletLipXSecID()

std::string vsp::GetEngineInletLipXSecID ( const std::string & geom_id)
extern

Get the cross-section an engine Geom models its inlet lip at.

string sid = AddGeom( "STACK" );
string xsec_2 = GetXSec( GetXSecSurf( sid, 0 ), 2 );
SetEngineInletLipXSecID( sid, xsec_2 );
if ( GetEngineInletLipXSecID( sid ) != xsec_2 )
{
Print( "ERROR: GetEngineInletLipXSecID did not return the XSec set" );
__failure++;
}
std::string GetEngineInletLipXSecID(const std::string &geom_id)
void SetEngineInletLipXSecID(const std::string &geom_id, const std::string &xsec_id)
See also
SetEngineInletLipXSecID
Parameters
[in]geom_idstring Engine Geom ID
Returns
string XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEngineOutletFaceXSecID()

std::string vsp::GetEngineOutletFaceXSecID ( const std::string & geom_id)
extern

Get the cross-section an engine Geom models its outlet face at.

string sid = AddGeom( "STACK" );
string xsec_2 = GetXSec( GetXSecSurf( sid, 0 ), 2 );
if ( GetEngineOutletFaceXSecID( sid ) != xsec_2 )
{
Print( "ERROR: GetEngineOutletFaceXSecID did not return the XSec set" );
__failure++;
}
void SetEngineOutletFaceXSecID(const std::string &geom_id, const std::string &xsec_id)
std::string GetEngineOutletFaceXSecID(const std::string &geom_id)
See also
SetEngineOutletFaceXSecID
Parameters
[in]geom_idstring Engine Geom ID
Returns
string XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEngineOutletLipXSecID()

std::string vsp::GetEngineOutletLipXSecID ( const std::string & geom_id)
extern

Get the cross-section an engine Geom models its outlet lip at.

string sid = AddGeom( "STACK" );
string xsec_2 = GetXSec( GetXSecSurf( sid, 0 ), 2 );
SetEngineOutletLipXSecID( sid, xsec_2 );
if ( GetEngineOutletLipXSecID( sid ) != xsec_2 )
{
Print( "ERROR: GetEngineOutletLipXSecID did not return the XSec set" );
__failure++;
}
void SetEngineOutletLipXSecID(const std::string &geom_id, const std::string &xsec_id)
std::string GetEngineOutletLipXSecID(const std::string &geom_id)
See also
SetEngineOutletLipXSecID
Parameters
[in]geom_idstring Engine Geom ID
Returns
string XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFeatureLinePnts()

std::vector< vec3d > vsp::GetFeatureLinePnts ( const std::string & geom_id)
extern

Get the points along the feature lines of a particular Geom

string pid = AddGeom( "POD" );
array < vec3d > @pnts = GetFeatureLinePnts( pid );
if ( pnts.size() == 0 ) { Print( "ERROR: GetFeatureLinePnts" ); __failure++; }
std::vector< vec3d > GetFeatureLinePnts(const std::string &geom_id)
Parameters
[in]geom_idstring Geom ID
Returns
vector<vec3d> Array of points along the Geom's feature lines
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHersheyBarDragDist()

std::vector< vec3d > vsp::GetHersheyBarDragDist ( const int & npts,
const double & alpha,
const double & Vinf,
const double & span,
bool full_span_flag = false )
extern

Get the theoretical drag (Cd) distribution for a Hershey Bar wing with unit chord length using Glauert's Method. This function was initially created to compare VSPAERO results to Lifting Line Theory. If full_span_flag is set to true symmetry is applied to the results.

// Compute theoretical lift and drag distributions using 100 points
double Vinf = 100;
double halfAR = 20;
double alpha_deg = 10;
int n_pts = 100;
array<vec3d> cl_dist_theo = GetHersheyBarLiftDist( int( n_pts ), Deg2Rad( alpha_deg ), Vinf, ( 2 * halfAR ), false );
array<vec3d> cd_dist_theo = GetHersheyBarDragDist( int( n_pts ), Deg2Rad( alpha_deg ), Vinf, ( 2 * halfAR ), false );
if ( cd_dist_theo.length() == 0 )
{
Print( "ERROR: GetHersheyBarDragDist returned nothing" );
__failure++;
}
std::vector< vec3d > GetHersheyBarDragDist(const int &npts, const double &alpha, const double &Vinf, const double &span, bool full_span_flag=false)
std::vector< vec3d > GetHersheyBarLiftDist(const int &npts, const double &alpha, const double &Vinf, const double &span, bool full_span_flag=false)
Parameters
[in]nptsint Number of points along the span to assess
[in]alphadouble Wing angle of attack (Radians)
[in]Vinfdouble Freestream velocity
[in]spandouble Hershey Bar full-span. Note, only half is used in the calculation
[in]full_span_flagbool Flag to apply symmetry to results (default: false)
Returns
vector<vec3d> Theoretical coefficient of drag distribution array (size = 2*npts if full_span_flag = true)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHersheyBarLiftDist()

std::vector< vec3d > vsp::GetHersheyBarLiftDist ( const int & npts,
const double & alpha,
const double & Vinf,
const double & span,
bool full_span_flag = false )
extern

Get the theoretical lift (Cl) distribution for a Hershey Bar wing with unit chord length using Glauert's Method. This function was initially created to compare VSPAERO results to Lifting Line Theory. If full_span_flag is set to true symmetry is applied to the results.

// Compute theoretical lift and drag distributions using 100 points
double Vinf = 100;
double halfAR = 20;
double alpha_deg = 10;
int n_pts = 100;
array<vec3d> cl_dist_theo = GetHersheyBarLiftDist( int( n_pts ), Deg2Rad( alpha_deg ), Vinf, ( 2 * halfAR ), false );
if ( cl_dist_theo.length() == 0 )
{
Print( "ERROR: GetHersheyBarLiftDist returned nothing" );
__failure++;
}
array<vec3d> cd_dist_theo = GetHersheyBarDragDist( int( n_pts ), Deg2Rad( alpha_deg ), Vinf, ( 2 * halfAR ), false );
Parameters
[in]nptsint Number of points along the span to assess
[in]alphadouble Wing angle of attack (Radians)
[in]Vinfdouble Freestream velocity
[in]spandouble Hershey Bar full-span. Note, only half is used in the calculation
[in]full_span_flagbool Flag to apply symmetry to results
Returns
vector<vec3d> Theoretical coefficient of lift distribution array (size = 2*npts if full_span_flag = true)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLowerCSTCoefs()

std::vector< double > vsp::GetLowerCSTCoefs ( const std::string & xsec_id)
extern

Get the CST coefficients for the lower surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
array < double > @coefs = GetLowerCSTCoefs( xsec );
if ( coefs.size() == 0 ) { Print( "ERROR: GetLowerCSTCoefs" ); __failure++; }
std::vector< double > GetLowerCSTCoefs(const std::string &xsec_id)
See also
SetLowerCST
Parameters
[in]xsec_idstring XSec ID
Returns
vector<double> Vector of CST coefficients for the lower airfoil surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLowerCSTDegree()

int vsp::GetLowerCSTDegree ( const std::string & xsec_id)
extern

Get the CST degree for the lower surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
if ( GetLowerCSTDegree( xsec ) < 1 ) { Print( "ERROR: GetLowerCSTDegree" ); __failure++; }
See also
SetLowerCST
Parameters
[in]xsec_idstring XSec ID
Returns
int CST Degree for lower airfoil surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNumSkinSpines()

int vsp::GetNumSkinSpines ( const std::string & geom_id)
extern

Get the number of user defined skinning spines on a Geom.

string sid = AddGeom( "STACK", "" );
AddSkinSpine( sid, 0.15 );
if ( GetNumSkinSpines( sid ) != 1 ) { Print( "---> Error: API GetNumSkinSpines " ); __failure++; }
Parameters
[in]geom_idstring Geom ID
Returns
int Number of spines
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSkinSpineID()

std::string vsp::GetSkinSpineID ( const std::string & xsec_id,
int index )
extern

Get the Parm container ID of one cross section's copy of a skinning spine. Position and symmetry are the same on every cross section; the skinning values are not.

Note that a spine's W and symmetry flags are properties of the whole spine, and are held by the first cross section. Setting them on any other cross section is undone by the next update; set them on cross section 0. The skinning values carry no such restriction.

Use GetSkinSpineParm to reach the spine's Parms. FindParm reaches them too, given the spine's own ID returned here and the group name "SkinSpine" – not the cross section's ID, since a spine's Parms are in a container of its own. GetSkinSpineParm does not ask the caller to know either of those.

Parameters
[in]xsec_idstring XSec ID
string sid = AddGeom( "STACK", "" );
AddSkinSpine( sid, 0.15 );
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
string spine = GetSkinSpineID( xsec, 0 );
string wid = GetSkinSpineParm( spine, "W01" );
if ( !ValidParm( wid ) ) { Print( "---> Error: API GetSkinSpineID " ); __failure++; }
bool ValidParm(const std::string &id)
std::string GetSkinSpineParm(const std::string &spine_id, const std::string &name)
std::string GetSkinSpineID(const std::string &xsec_id, int index)
Parameters
[in]indexint Spine index
Returns
string Spine Parm container ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSkinSpineIDVec()

std::vector< std::string > vsp::GetSkinSpineIDVec ( const std::string & xsec_id)
extern

Get the IDs of the skin spines of one cross-section, in the order of their indexes.

string gid = AddGeom( "STACK" );
AddSkinSpine( gid, 0.15 );
string xsec = GetXSec( GetXSecSurf( gid, 0 ), 1 );
array< string > @spines = GetSkinSpineIDVec( xsec );
if ( spines.size() != 1 || spines[0] != GetSkinSpineID( xsec, 0 ) )
{
Print( "ERROR: GetSkinSpineIDVec did not return the spine" );
__failure++;
}
See also
GetSkinSpineID, AddSkinSpine
Parameters
[in]xsec_idstring XSec ID
Returns
array<string> Array of skin spine IDs
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSkinSpineName()

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

Get the name of a skinning spine.

The name belongs to the whole spine rather than to one cross section: it is held by the first cross section and synced outwards, the same way the position and the symmetry flags are. It is also what the spine's Parms are grouped under, so it is how they are told apart in the Parm Link and Design Variable pickers.

string sid = AddGeom( "STACK", "" );
int ispine = AddSkinSpine( sid, 0.15 );
if ( GetSkinSpineName( sid, ispine ) == "" ) { Print( "ERROR: GetSkinSpineName" ); __failure++; }
std::string GetSkinSpineName(const std::string &geom_id, int index)
See also
SetSkinSpineName, AddSkinSpine, GetSkinSpineNameByID
Parameters
[in]geom_idstring Geom ID
[in]indexint Spine index
Returns
string Spine name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSkinSpineNameByID()

std::string vsp::GetSkinSpineNameByID ( const std::string & spine_id)
extern

Get the name of a skin spine, by the ID of the spine on any one cross-section.

string gid = AddGeom( "STACK" );
int spine_index = AddSkinSpine( gid, 0.15 );
string xsec = GetXSec( GetXSecSurf( gid, 0 ), 1 );
array< string > @spines = GetSkinSpineIDVec( xsec );
SetSkinSpineName( gid, spine_index, "Chine" );
if ( GetSkinSpineNameByID( spines[ spine_index ] ) != "Chine" )
{
Print( "ERROR: GetSkinSpineNameByID did not return the name set" );
__failure++;
}
void SetSkinSpineName(const std::string &geom_id, int index, const std::string &name)
std::string GetSkinSpineNameByID(const std::string &spine_id)
See also
SetSkinSpineName, GetSkinSpineName
Parameters
[in]spine_idstring Skin spine ID
Returns
string Spine name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSkinSpineParm()

std::string vsp::GetSkinSpineParm ( const std::string & spine_id,
const std::string & name )
extern

Get a Parm ID from a skinning spine by name. The counterpart of GetXSecParm: FindParm on the spine's own container would do the same job, but only if the caller knows the group is named "SkinSpine".

Parameters
[in]spine_idstring Spine Parm container ID, from GetSkinSpineID
string sid = AddGeom( "STACK", "" );
AddSkinSpine( sid, 0.15 );
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
string spine = GetSkinSpineID( xsec, 0 );
string aid = GetSkinSpineParm( spine, "LAngle" );
if ( !ValidParm( aid ) ) { Print( "---> Error: API GetSkinSpineParm " ); __failure++; }
SetParmVal( GetSkinSpineParm( spine, "LAngleSet" ), 1.0 );
SetParmVal( aid, 12.0 );
double SetParmVal(const std::string &parm_id, double val)
Parameters
[in]namestring Parm name
Returns
string Parm ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetUpperCSTCoefs()

std::vector< double > vsp::GetUpperCSTCoefs ( const std::string & xsec_id)
extern

Get the CST coefficients for the upper surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
array < double > @coefs = GetUpperCSTCoefs( xsec );
if ( coefs.size() == 0 ) { Print( "ERROR: GetUpperCSTCoefs" ); __failure++; }
std::vector< double > GetUpperCSTCoefs(const std::string &xsec_id)
See also
SetUpperCST
Parameters
[in]xsec_idstring XSec ID
Returns
vector<double> Vector of CST coefficients for the upper airfoil surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetUpperCSTDegree()

int vsp::GetUpperCSTDegree ( const std::string & xsec_id)
extern

Get the CST degree for the upper surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
if ( GetUpperCSTDegree( xsec ) < 1 ) { Print( "ERROR: GetUpperCSTDegree" ); __failure++; }
See also
SetUpperCST
Parameters
[in]xsec_idstring XSec ID
Returns
int CST Degree for upper airfoil surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVKTAirfoilCpDist()

std::vector< double > vsp::GetVKTAirfoilCpDist ( const double & alpha,
const double & epsilon,
const double & kappa,
const double & tau,
const std::vector< vec3d > & xyz_data )
extern

Get the pressure coefficient (Cp) along a Von Kármán-Trefftz airfoil of specified shape at specified points along the airfoil

const double pi = 3.14159265358979323846;
const int npts = 122;
const double alpha = 0.0;
const double epsilon = 0.1;
const double kappa = 0.1;
const double tau = 10;
array<vec3d> xyz_airfoil = GetVKTAirfoilPnts(npts, alpha, epsilon, kappa, tau*(pi/180) );
array<double> cp_dist = GetVKTAirfoilCpDist( alpha, epsilon, kappa, tau*(pi/180), xyz_airfoil );
if ( cp_dist.length() == 0 )
{
Print( "ERROR: GetVKTAirfoilCpDist returned nothing" );
__failure++;
}
std::vector< double > GetVKTAirfoilCpDist(const double &alpha, const double &epsilon, const double &kappa, const double &tau, const std::vector< vec3d > &xyz_data)
std::vector< vec3d > GetVKTAirfoilPnts(const int &npts, const double &alpha, const double &epsilon, const double &kappa, const double &tau)
See also
GetVKTAirfoilPnts
Parameters
[in]alphadouble Airfoil angle of attack (Radians)
[in]epsilondouble Airfoil thickness
[in]kappadouble Airfoil camber
[in]taudouble Airfoil trailing edge angle (Radians)
[in]xyz_datavector<vec3d> Vector of points on the airfoil to evaluate
Returns
vector<double> Vector of Cp values for each point in xydata
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVKTAirfoilPnts()

std::vector< vec3d > vsp::GetVKTAirfoilPnts ( const int & npts,
const double & alpha,
const double & epsilon,
const double & kappa,
const double & tau )
extern

Get the 2D coordinates an input number of points along a Von K�rm�n-Trefftz airfoil of specified shape

const double pi = 3.14159265358979323846;
const int npts = 122;
const double alpha = 0.0;
const double epsilon = 0.1;
const double kappa = 0.1;
const double tau = 10;
array<vec3d> xyz_airfoil = GetVKTAirfoilPnts(npts, alpha, epsilon, kappa, tau*(pi/180) );
if ( xyz_airfoil.length() == 0 )
{
Print( "ERROR: GetVKTAirfoilPnts returned nothing" );
__failure++;
}
array<double> cp_dist = GetVKTAirfoilCpDist( alpha, epsilon, kappa, tau*(pi/180), xyz_airfoil );
Parameters
[in]nptsint Number of points along the airfoil to return
[in]alphadouble Airfoil angle of attack (Radians)
[in]epsilondouble Airfoil thickness
[in]kappadouble Airfoil camber
[in]taudouble Airfoil trailing edge angle (Radians)
Returns
vector<vec3d> Array of points on the VKT airfoil (size = npts)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecAlias()

std::string vsp::GetXSecAlias ( const std::string & id)
extern

Get XSec Alias by ID

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
// Set Alias and verify alias match
string alias = "XSec_One_Alias";
SetXSecAlias( xsec_1, alias );
string get_alias = GetXSecAlias( xsec_1 );
if ( alias != get_alias )
{
Print("SetXSecAlias/GetXSecAlias error!");
__failure++;
}
std::string GetXSecAlias(const std::string &id)
void SetXSecAlias(const std::string &id, const std::string &alias)
Parameters
[in]idstring XSec ID
Returns
string Xsec alias
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecContinuity()

int vsp::GetXSecContinuity ( const std::string & xsec_id)
extern

Set C-type continuity enforcement for a particular XSec

string fid = AddGeom( "FUSELAGE", "" ); // Add Fuselage
string xsec_surf = GetXSecSurf( fid, 0 ); // Get First (and Only) XSec Surf
int num_xsecs = GetNumXSec( xsec_surf );
for ( int i = 0 ; i < num_xsecs ; i++ )
{
string xsec = GetXSec( xsec_surf, i );
SetXSecContinuity( xsec, 1 ); // Set Continuity At Cross Section
// The setter is shorthand for the section's continuity Parm.
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "ContinuityTop" ) ), 1.0, 1e-12 ) )
{
Print( "ERROR: SetXSecContinuity did not set section " + i );
__failure++;
}
SetXSecContinuity( xsec, 0 );
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "ContinuityTop" ) ), 0.0, 1e-12 ) )
{
Print( "ERROR: SetXSecContinuity did not clear section " + i );
__failure++;
}
SetXSecContinuity( xsec, 1 );
}
void SetXSecContinuity(const std::string &xsec_id, int cx)
Parameters
[in]xsec_idstring XSec ID
[in]cxint Continuity level (0, 1, or 2)

Get the C-type continuity enforcement for a particular XSec

string fid = AddGeom( "FUSELAGE", "" ); // Add Fuselage
string xsec_surf = GetXSecSurf( fid, 0 ); // Get First (and Only) XSec Surf
string xsec = GetXSec( xsec_surf, 1 );
SetXSecContinuity( xsec, 1 );
if ( GetXSecContinuity( xsec ) != 1 )
{
Print( "ERROR: GetXSecContinuity did not report the level that was set" );
__failure++;
}
SetXSecContinuity( xsec, 0 );
if ( GetXSecContinuity( xsec ) != 0 )
{
Print( "ERROR: GetXSecContinuity did not follow a second set" );
__failure++;
}
// The level is the section's continuity Parm, so the two have to agree.
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "ContinuityTop" ) ), GetXSecContinuity( xsec ), 1e-12 ) )
{
Print( "ERROR: the continuity level disagrees with its Parm" );
__failure++;
}
int GetXSecContinuity(const std::string &xsec_id)
See also
SetXSecContinuity
Parameters
[in]xsec_idstring XSec ID
Returns
int Continuity level (0, 1, or 2)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecCurvatures()

std::vector< double > vsp::GetXSecCurvatures ( const std::string & xsec_id,
int side )
extern

Set curvatures for the specified XSec

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Flatten ends
int num_xsecs = GetNumXSec( xsec_surf );
for ( int i = 0 ; i < num_xsecs ; i++ )
{
string xsec = GetXSec( xsec_surf, i );
SetXSecCurvatures( xsec, XSEC_BOTH_SIDES, 0.2 ); // Set Tangent Strengths At Cross Section
// The setter is shorthand for the skin Parms, so the value has to show
// up on both sides of the section.
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "TopLCurve" ) ), 0.2, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "TopRCurve" ) ), 0.2, 1e-6 ) )
{
Print( "ERROR: SetXSecCurvatures did not set the top of section " + i );
__failure++;
}
}
void SetXSecCurvatures(const std::string &xsec_id, int side, double top, double right, double bottom, double left)
See also
XSEC_SIDES_TYPE
Parameters
[in]xsec_idstring XSec ID
[in]sideint Side type enum (i.e. XSEC_BOTH_SIDES)
[in]topdouble Top curvature
[in]rightdouble Right curvature
[in]bottomdouble Bottom curvature
[in]leftdouble Left curvature

Get the curvatures for one side of the specified XSec. The four values come back in the order the setter takes them: top, right, bottom and left. The two sides can hold different values, so XSEC_BOTH_SIDES is not accepted here.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
array< double > vals = GetXSecCurvatures( xsec, XSEC_LEFT_SIDE );
// Setting both sides at once sets all four positions of each.
if ( vals.size() != 4 )
{
Print( "ERROR: GetXSecCurvatures did not report four values" );
__failure++;
}
else
{
for ( int i = 0; i < 4; i++ )
{
if ( !closeTo( vals[i], 0.2, 1e-6 ) )
{
Print( "ERROR: GetXSecCurvatures did not report the value that was set" );
__failure++;
}
}
}
// Both sides were set, so they agree, and each matches its Parm.
array< double > right_vals = GetXSecCurvatures( xsec, XSEC_RIGHT_SIDE );
if ( right_vals.size() != 4 || !closeTo( right_vals[0], vals[0], 1e-9 ) )
{
Print( "ERROR: the two sides disagree after setting both" );
__failure++;
}
if ( !closeTo( vals[0], GetParmVal( GetXSecParm( xsec, "TopLCurve" ) ), 1e-9 ) )
{
Print( "ERROR: GetXSecCurvatures disagrees with its Parm" );
__failure++;
}
// XSEC_BOTH_SIDES names no single answer, so it has to be rejected.
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetXSecCurvatures accepted XSEC_BOTH_SIDES" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
@ XSEC_LEFT_SIDE
@ XSEC_RIGHT_SIDE
std::vector< double > GetXSecCurvatures(const std::string &xsec_id, int side)
See also
XSEC_SIDES_TYPE, SetXSecCurvatures
Parameters
[in]xsec_idstring XSec ID
[in]sideint Side type enum (XSEC_LEFT_SIDE or XSEC_RIGHT_SIDE)
Returns
vector<double> Top, right, bottom and left values for that side
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecCurveAlias()

std::string vsp::GetXSecCurveAlias ( const std::string & id)
extern

Get XSecCurve Alias by XSec ID

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
// Set Alias and verify alias match
string alias = "XSecCurve_One_Alias";
SetXSecCurveAlias( xsec_1, alias );
string get_alias = GetXSecCurveAlias( xsec_1 );
if ( alias != get_alias )
{
Print("SetXSecCurveAlias/GetXSecCurveAlias error!");
__failure++;
}
std::string GetXSecCurveAlias(const std::string &id)
void SetXSecCurveAlias(const std::string &id, const std::string &alias)
Parameters
[in]idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecHeight()

double vsp::GetXSecHeight ( const std::string & xsec_id)
extern

Get the height of an XSec. Note that POINT type XSecs have a width and height of 0, regardless of what width and height it is set to.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 2 ); // Get 2nd to last XSec
SetXSecWidthHeight( xsec, 3.0, 6.0 );
if ( abs( GetXSecHeight( xsec ) - 6.0 ) > 1e-6 ) { Print( "---> Error: API Get/Set Width " ); __failure++; }
void SetXSecWidthHeight(const std::string &xsec_id, double w, double h)
See also
SetXSecHeight
Parameters
[in]xsec_idstring XSec ID
Returns
double Xsec height
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecParm()

std::string vsp::GetXSecParm ( const std::string & xsec_id,
const std::string & name )
extern

Get a specific Parm ID from an Xsec

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
string wid = GetXSecParm( xsec, "RoundedRect_Width" );
if ( !ValidParm( wid ) ) { Print( "---> Error: API GetXSecParm " ); __failure++; }
Parameters
[in]xsec_idstring XSec ID
[in]namestring Parm name
Returns
string Parm ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecParmIDs()

std::vector< std::string > vsp::GetXSecParmIDs ( const std::string & xsec_id)
extern

Get all Parm IDs for specified XSec Parm Container

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
array< string > @parm_array = GetXSecParmIDs( xsec );
if ( parm_array.size() < 1 ) { Print( "---> Error: API GetXSecParmIDs " ); __failure++; }
std::vector< std::string > GetXSecParmIDs(const std::string &xsec_id)
Parameters
[in]xsec_idstring XSec ID
Returns
vector<string> Array of Parm IDs
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecPnts()

std::vector< vec3d > vsp::GetXSecPnts ( const std::string & xsec_id)
extern

Set the coordinate points for a specific XSec. The XSec must be of type XS_FILE_FUSE.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, 2, XS_FILE_FUSE );
string xsec = GetXSec( xsec_surf, 2 );
array< vec3d > @vec_array = ReadFileXSec( xsec, "TestXSec.fxs" );
if ( vec_array.size() == 0 )
{
Print( "ERROR: ReadFileXSec returned no points" );
__failure++;
}
else
{
vec_array[1] = vec_array[1] * 2.0;
vec_array[3] = vec_array[3] * 2.0;
// A file XSec takes its width and height from the extents of the
// points it was given, in X and Y respectively.
double wmin = vec_array[0].x(), wmax = vec_array[0].x();
double hmin = vec_array[0].y(), hmax = vec_array[0].y();
for ( int i = 1; i < int( vec_array.size() ); i++ )
{
if ( vec_array[i].x() < wmin ) { wmin = vec_array[i].x(); }
if ( vec_array[i].x() > wmax ) { wmax = vec_array[i].x(); }
if ( vec_array[i].y() < hmin ) { hmin = vec_array[i].y(); }
if ( vec_array[i].y() > hmax ) { hmax = vec_array[i].y(); }
}
SetXSecPnts( xsec, vec_array );
Update();
if ( !closeTo( GetXSecWidth( xsec ), wmax - wmin, 1e-6 ) )
{
Print( "ERROR: SetXSecPnts did not set the section width" );
__failure++;
}
if ( !closeTo( GetXSecHeight( xsec ), hmax - hmin, 1e-6 ) )
{
Print( "ERROR: SetXSecPnts did not set the section height" );
__failure++;
}
}
@ XS_FILE_FUSE
std::vector< vec3d > ReadFileXSec(const std::string &xsec_id, const std::string &file_name)
void SetXSecPnts(const std::string &xsec_id, std::vector< vec3d > &pnt_vec)
Parameters
[in]xsec_idstring XSec ID
[in]pnt_vecvector<vec3d> Vector of XSec coordinate points

Get the coordinate points for a specific XSec. The XSec must be of type XS_FILE_FUSE. The points are returned normalized to the section's width and height.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, 2, XS_FILE_FUSE );
string xsec = GetXSec( xsec_surf, 2 );
array< vec3d > @vec_array = ReadFileXSec( xsec, "TestXSec.fxs" );
// The points that were read are the points the section is carrying.
array< vec3d > @check_array = GetXSecPnts( xsec );
if ( check_array.size() == 0 )
{
Print( "ERROR: GetXSecPnts returned nothing" );
__failure++;
}
else
{
// The stored points are normalized, so they fit in the unit box.
for ( int i = 0; i < int( check_array.size() ); i++ )
{
if ( abs( check_array[i].x() ) > 0.5 + 1e-9 || abs( check_array[i].y() ) > 0.5 + 1e-9 )
{
Print( "ERROR: GetXSecPnts returned a point outside the unit box" );
__failure++;
}
}
// The curve closes on itself.
if ( dist( check_array[0], check_array[check_array.size() - 1] ) > 1e-8 )
{
Print( "ERROR: GetXSecPnts returned an open curve" );
__failure++;
}
}
// Setting points has to be what comes back.
SetXSecPnts( xsec, vec_array );
array< vec3d > @after_array = GetXSecPnts( xsec );
if ( after_array.size() != check_array.size() )
{
Print( "ERROR: GetXSecPnts did not follow SetXSecPnts" );
__failure++;
}
std::vector< vec3d > GetXSecPnts(const std::string &xsec_id)
See also
SetXSecPnts, ReadFileXSec
Parameters
[in]xsec_idstring XSec ID
Returns
vector<vec3d> Vector of XSec coordinate points
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecShape()

int vsp::GetXSecShape ( const std::string & xsec_id)
extern

Get the shape of an XSec

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE );
string xsec = GetXSec( xsec_surf, 1 );
if ( GetXSecShape( xsec ) != XS_EDIT_CURVE ) { Print( "ERROR: GetXSecShape" ); __failure++; }
@ XS_EDIT_CURVE
See also
XSEC_CRV_TYPE
Parameters
[in]xsec_idstring XSec ID
Returns
int XSec type enum (i.e. XS_ELLIPSE)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecTanAngles()

std::vector< double > vsp::GetXSecTanAngles ( const std::string & xsec_id,
int side )
extern

Set the tangent angles for the specified XSec

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
int num_xsecs = GetNumXSec( xsec_surf );
for ( int i = 0 ; i < num_xsecs ; i++ )
{
string xsec = GetXSec( xsec_surf, i );
SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 10.0 ); // Set Tangent Angles At Cross Section
// The setter is shorthand for the skin Parms, so the value has to show
// up on both sides of the section.
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "TopLAngle" ) ), 10.0, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "TopRAngle" ) ), 10.0, 1e-6 ) )
{
Print( "ERROR: SetXSecTanAngles did not set the top of section " + i );
__failure++;
}
}
See also
XSEC_SIDES_TYPE
Parameters
[in]xsec_idstring XSec ID
[in]sideint Side type enum (i.e. XSEC_BOTH_SIDES)
[in]topdouble Top angle (degrees)
[in]rightdouble Right angle (degrees)
[in]bottomdouble Bottom angle (degrees)
[in]leftdouble Left angle (degrees)

Get the tangent angles for one side of the specified XSec. The four values come back in the order the setter takes them: top, right, bottom and left. The two sides can hold different values, so XSEC_BOTH_SIDES is not accepted here.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
array< double > vals = GetXSecTanAngles( xsec, XSEC_LEFT_SIDE );
// Setting both sides at once sets all four positions of each.
if ( vals.size() != 4 )
{
Print( "ERROR: GetXSecTanAngles did not report four values" );
__failure++;
}
else
{
for ( int i = 0; i < 4; i++ )
{
if ( !closeTo( vals[i], 10.0, 1e-6 ) )
{
Print( "ERROR: GetXSecTanAngles did not report the value that was set" );
__failure++;
}
}
}
// Both sides were set, so they agree, and each matches its Parm.
array< double > right_vals = GetXSecTanAngles( xsec, XSEC_RIGHT_SIDE );
if ( right_vals.size() != 4 || !closeTo( right_vals[0], vals[0], 1e-9 ) )
{
Print( "ERROR: the two sides disagree after setting both" );
__failure++;
}
if ( !closeTo( vals[0], GetParmVal( GetXSecParm( xsec, "TopLAngle" ) ), 1e-9 ) )
{
Print( "ERROR: GetXSecTanAngles disagrees with its Parm" );
__failure++;
}
// XSEC_BOTH_SIDES names no single answer, so it has to be rejected.
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetXSecTanAngles accepted XSEC_BOTH_SIDES" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
std::vector< double > GetXSecTanAngles(const std::string &xsec_id, int side)
See also
XSEC_SIDES_TYPE, SetXSecTanAngles
Parameters
[in]xsec_idstring XSec ID
[in]sideint Side type enum (XSEC_LEFT_SIDE or XSEC_RIGHT_SIDE)
Returns
vector<double> Top, right, bottom and left values for that side
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecTanSlews()

std::vector< double > vsp::GetXSecTanSlews ( const std::string & xsec_id,
int side )
extern

Set the tangent slew angles for the specified XSec

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
int num_xsecs = GetNumXSec( xsec_surf );
for ( int i = 0 ; i < num_xsecs ; i++ )
{
string xsec = GetXSec( xsec_surf, i );
SetXSecTanSlews( xsec, XSEC_BOTH_SIDES, 5.0 ); // Set Tangent Slews At Cross Section
// The setter is shorthand for the skin Parms, so the value has to show
// up on both sides of the section.
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "TopLSlew" ) ), 5.0, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "TopRSlew" ) ), 5.0, 1e-6 ) )
{
Print( "ERROR: SetXSecTanSlews did not set the top of section " + i );
__failure++;
}
}
void SetXSecTanSlews(const std::string &xsec_id, int side, double top, double right, double bottom, double left)
See also
XSEC_SIDES_TYPE
Parameters
[in]xsec_idstring XSec ID
[in]sideint Side type enum (i.e. XSEC_BOTH_SIDES)
[in]topdouble Top angle (degrees)
[in]rightdouble Right angle (degrees)
[in]bottomdouble Bottom angle (degrees)
[in]leftdouble Left angle (degrees)

Get the tangent slew angles for one side of the specified XSec. The four values come back in the order the setter takes them: top, right, bottom and left. The two sides can hold different values, so XSEC_BOTH_SIDES is not accepted here.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
array< double > vals = GetXSecTanSlews( xsec, XSEC_LEFT_SIDE );
// Setting both sides at once sets all four positions of each.
if ( vals.size() != 4 )
{
Print( "ERROR: GetXSecTanSlews did not report four values" );
__failure++;
}
else
{
for ( int i = 0; i < 4; i++ )
{
if ( !closeTo( vals[i], 5.0, 1e-6 ) )
{
Print( "ERROR: GetXSecTanSlews did not report the value that was set" );
__failure++;
}
}
}
// Both sides were set, so they agree, and each matches its Parm.
array< double > right_vals = GetXSecTanSlews( xsec, XSEC_RIGHT_SIDE );
if ( right_vals.size() != 4 || !closeTo( right_vals[0], vals[0], 1e-9 ) )
{
Print( "ERROR: the two sides disagree after setting both" );
__failure++;
}
if ( !closeTo( vals[0], GetParmVal( GetXSecParm( xsec, "TopLSlew" ) ), 1e-9 ) )
{
Print( "ERROR: GetXSecTanSlews disagrees with its Parm" );
__failure++;
}
// XSEC_BOTH_SIDES names no single answer, so it has to be rejected.
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetXSecTanSlews accepted XSEC_BOTH_SIDES" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
std::vector< double > GetXSecTanSlews(const std::string &xsec_id, int side)
See also
XSEC_SIDES_TYPE, SetXSecTanSlews
Parameters
[in]xsec_idstring XSec ID
[in]sideint Side type enum (XSEC_LEFT_SIDE or XSEC_RIGHT_SIDE)
Returns
vector<double> Top, right, bottom and left values for that side
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecTanStrengths()

std::vector< double > vsp::GetXSecTanStrengths ( const std::string & xsec_id,
int side )
extern

Set the tangent strengths for the specified XSec

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Flatten ends
int num_xsecs = GetNumXSec( xsec_surf );
for ( int i = 0 ; i < num_xsecs ; i++ )
{
string xsec = GetXSec( xsec_surf, i );
SetXSecTanStrengths( xsec, XSEC_BOTH_SIDES, 0.8 ); // Set Tangent Strengths At Cross Section
// The setter is shorthand for the skin Parms, so the value has to show
// up on both sides of the section.
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "TopLStrength" ) ), 0.8, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "TopRStrength" ) ), 0.8, 1e-6 ) )
{
Print( "ERROR: SetXSecTanStrengths did not set the top of section " + i );
__failure++;
}
}
void SetXSecTanStrengths(const std::string &xsec_id, int side, double top, double right, double bottom, double left)
See also
XSEC_SIDES_TYPE
Parameters
[in]xsec_idstring XSec ID
[in]sideint Side type enum (i.e. XSEC_BOTH_SIDES)
[in]topdouble Top strength
[in]rightdouble Right strength
[in]bottomdouble Bottom strength
[in]leftdouble Left strength

Get the tangent strengths for one side of the specified XSec. The four values come back in the order the setter takes them: top, right, bottom and left. The two sides can hold different values, so XSEC_BOTH_SIDES is not accepted here.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
array< double > vals = GetXSecTanStrengths( xsec, XSEC_LEFT_SIDE );
// Setting both sides at once sets all four positions of each.
if ( vals.size() != 4 )
{
Print( "ERROR: GetXSecTanStrengths did not report four values" );
__failure++;
}
else
{
for ( int i = 0; i < 4; i++ )
{
if ( !closeTo( vals[i], 0.8, 1e-6 ) )
{
Print( "ERROR: GetXSecTanStrengths did not report the value that was set" );
__failure++;
}
}
}
// Both sides were set, so they agree, and each matches its Parm.
array< double > right_vals = GetXSecTanStrengths( xsec, XSEC_RIGHT_SIDE );
if ( right_vals.size() != 4 || !closeTo( right_vals[0], vals[0], 1e-9 ) )
{
Print( "ERROR: the two sides disagree after setting both" );
__failure++;
}
if ( !closeTo( vals[0], GetParmVal( GetXSecParm( xsec, "TopLStrength" ) ), 1e-9 ) )
{
Print( "ERROR: GetXSecTanStrengths disagrees with its Parm" );
__failure++;
}
// XSEC_BOTH_SIDES names no single answer, so it has to be rejected.
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetXSecTanStrengths accepted XSEC_BOTH_SIDES" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
std::vector< double > GetXSecTanStrengths(const std::string &xsec_id, int side)
See also
XSEC_SIDES_TYPE, SetXSecTanStrengths
Parameters
[in]xsec_idstring XSec ID
[in]sideint Side type enum (XSEC_LEFT_SIDE or XSEC_RIGHT_SIDE)
Returns
vector<double> Top, right, bottom and left values for that side
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecWidth()

double vsp::GetXSecWidth ( const std::string & xsec_id)
extern

Get the width of an XSec. Note that POINT type XSecs have a width and height of 0, regardless of what width and height it is set to.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 2 ); // Get 2nd to last XSec
SetXSecWidthHeight( xsec, 3.0, 6.0 );
if ( abs( GetXSecWidth( xsec ) - 3.0 ) > 1e-6 ) { Print( "---> Error: API Get/Set Width " ); __failure++; }
See also
SetXSecWidth
Parameters
[in]xsec_idstring XSec ID
Returns
double Xsec width
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InsertXSec()

void vsp::InsertXSec ( const std::string & geom_id,
int index,
int type )
extern

Insert a cross-section of particular type to the specified geometry after the given index. Refused on a Clone; change the Geom it copies.

string wing_id = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wing_id, 0 );
int num_start = GetNumXSec( xsec_surf );
//===== Add XSec ====//
InsertXSec( wing_id, 1, XS_SIX_SERIES );
// The new section lands after the given index.
if ( GetNumXSec( xsec_surf ) != num_start + 1 )
{
Print( "ERROR: InsertXSec did not add a section" );
__failure++;
}
if ( GetXSecShape( GetXSec( xsec_surf, 2 ) ) != XS_SIX_SERIES )
{
Print( "ERROR: InsertXSec did not insert the requested shape" );
__failure++;
}
See also
XSEC_CRV_TYPE, InsertXSecByID
Parameters
[in]geom_idstring Geom ID
[in]indexint XSec index
[in]typeint XSec type enum (i.e. XS_GENERAL_FUSE)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InsertXSecByID()

std::string vsp::InsertXSecByID ( const std::string & xsec_id,
int type )
extern

Insert a cross-section after the one with the given ID, and return the new cross-section's ID.

string gid = AddGeom( "FUSELAGE" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
string new_id = InsertXSecByID( xsec_1, XS_ELLIPSE );
if ( GetXSec( xsec_surf, 2 ) != new_id )
{
Print( "ERROR: InsertXSecByID did not put the XSec after xsec_1" );
__failure++;
}
std::string InsertXSecByID(const std::string &xsec_id, int type)
See also
XSEC_CRV_TYPE, InsertXSec
Parameters
[in]xsec_idstring ID of the XSec the new one follows
[in]typeint XSec type enum (i.e. XS_ELLIPSE)
Returns
string ID of the new XSec
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PasteAirfoilByID()

void vsp::PasteAirfoilByID ( const std::string & xsec_id)
extern

Paste the airfoil on the clipboard into a wing section, by XSec ID.

string gid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_0 = GetXSec( xsec_surf, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
CopyAirfoilByID( xsec_0 );
PasteAirfoilByID( xsec_1 );
if ( GetXSecShape( xsec_1 ) != XS_SIX_SERIES )
{
Print( "ERROR: PasteAirfoilByID did not paste the airfoil" );
__failure++;
}
See also
CopyAirfoil, PasteAirfoil
Parameters
[in]xsec_idstring Wing section XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PasteXSec()

void vsp::PasteXSec ( const std::string & geom_id,
int index )
extern

Paste the cross-section currently held in memory to the specified geometry. Refused on a Clone; change the Geom it copies.

// Add Stack
string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
// Give XSec 1 a shape that XSec 3 does not have.
int num_start = GetNumXSec( xsec_surf );
// Copy XSec To Clipboard
CopyXSec( sid, 1 );
// Paste To XSec 3
PasteXSec( sid, 3 );
// Pasting replaces the target section, so the count is unchanged and XSec 3
// now carries the shape that was copied.
if ( GetNumXSec( xsec_surf ) != num_start )
{
Print( "ERROR: PasteXSec changed the number of sections" );
__failure++;
}
if ( GetXSecShape( GetXSec( xsec_surf, 3 ) ) != XS_ROUNDED_RECTANGLE )
{
Print( "ERROR: PasteXSec did not paste the copied section" );
__failure++;
}
// The section that was copied has to be left alone.
if ( GetXSecShape( GetXSec( xsec_surf, 1 ) ) != XS_ROUNDED_RECTANGLE )
{
Print( "ERROR: CopyXSec disturbed the section it copied" );
__failure++;
}
See also
CutXSec, CopyXSec, PasteXSecByID
Parameters
[in]geom_idstring Geom ID
[in]indexint XSec index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PasteXSecByID()

void vsp::PasteXSecByID ( const std::string & xsec_id)
extern

Paste the cross-section on the clipboard over a cross-section, by XSec ID. The cross-section keeps its ID.

string gid = AddGeom( "FUSELAGE" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
string xsec_2 = GetXSec( xsec_surf, 2 );
CopyXSecByID( xsec_1 );
PasteXSecByID( xsec_2 );
if ( GetXSec( xsec_surf, 2 ) != xsec_2 || GetXSecShape( xsec_2 ) != XS_ELLIPSE )
{
Print( "ERROR: PasteXSecByID did not paste over the XSec" );
__failure++;
}
See also
CopyXSec, CutXSec, PasteXSec
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PasteXSecCurve()

void vsp::PasteXSecCurve ( const std::string & geom_id,
int index )
extern

Paste the XSecCurve clipboard onto a cross section

// A body of revolution holds one XSecCurve, so its index is ignored.
string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
CopyXSecCurve( sid, 1 );
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
PasteXSecCurve( bor_id, 0 );
{
Print( "ERROR: the XSecCurve did not paste onto the body of revolution" );
__failure++;
}
// An index past the end has to be rejected.
PasteXSecCurve( sid, 100 );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: PasteXSecCurve accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
int GetBORXSecShape(const std::string &bor_id)
See also
CopyXSecCurve, PasteXSec, PasteAirfoil, PasteXSecCurveByID
Parameters
[in]geom_idstring Geom ID
[in]indexint XSec index, ignored for a body of revolution
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PasteXSecCurveByID()

void vsp::PasteXSecCurveByID ( const std::string & xsec_id)
extern

Paste the XSecCurve on the clipboard into a cross-section, by XSec ID.

string gid = AddGeom( "FUSELAGE" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
string xsec_2 = GetXSec( xsec_surf, 2 );
if ( GetXSecShape( xsec_1 ) != XS_ELLIPSE )
{
Print( "ERROR: PasteXSecCurveByID did not paste the curve" );
__failure++;
}
See also
CopyXSecCurve, PasteXSecCurve
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PromoteCSTLower()

void vsp::PromoteCSTLower ( const std::string & xsec_id)
extern

Promote the CST for the lower airfoil surface. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
int deg = GetLowerCSTDegree( xsec );
if ( GetLowerCSTDegree( xsec ) != deg + 1 ) { Print( "ERROR: PromoteCSTLower" ); __failure++; }
See also
GetLowerCSTDegree
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PromoteCSTUpper()

void vsp::PromoteCSTUpper ( const std::string & xsec_id)
extern

Promote the CST for the upper airfoil surface. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
int deg = GetUpperCSTDegree( xsec );
if ( GetUpperCSTDegree( xsec ) != deg + 1 ) { Print( "ERROR: PromoteCSTUpper" ); __failure++; }
See also
GetUpperCSTDegree
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadFileAirfoil()

void vsp::ReadFileAirfoil ( const std::string & xsec_id,
const std::string & file_name )
extern

Read in XSec shape from airfoil file and set to the specified XSec. The XSec must be of type XS_FILE_AIRFOIL. Airfoil files may be in Lednicer or Selig format with \*.af or \*.dat extensions.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" );
array< vec3d > @up_array = GetAirfoilUpperPnts( xsec );
array< vec3d > @low_array = GetAirfoilLowerPnts( xsec );
if ( up_array.size() == 0 || up_array.size() != low_array.size() )
{
Print( "ERROR: ReadFileAirfoil did not read matching surfaces" );
__failure++;
}
else
{
// The points run from the leading edge to the trailing edge on a unit
// chord.
if ( !closeTo( up_array[0].x(), 0.0, 1e-6 ) ||
!closeTo( up_array[up_array.size() - 1].x(), 1.0, 1e-6 ) ||
!closeTo( low_array[0].x(), 0.0, 1e-6 ) )
{
Print( "ERROR: ReadFileAirfoil did not normalize the chord" );
__failure++;
}
// A NACA 0012 is symmetric, so the lower surface mirrors the upper, and
// the section is twelve percent thick.
double max_up = 0.0;
for ( int i = 0; i < int( up_array.size() ); i++ )
{
if ( !closeTo( low_array[i].y(), -up_array[i].y(), 1e-6 ) )
{
Print( "ERROR: ReadFileAirfoil did not read a symmetric section" );
__failure++;
}
if ( up_array[i].y() > max_up )
{
max_up = up_array[i].y();
}
}
if ( !closeTo( 2.0 * max_up, 0.12, 1e-3 ) )
{
Print( "ERROR: ReadFileAirfoil did not read a twelve percent section" );
__failure++;
}
}
Parameters
[in]xsec_idstring XSec ID
[in]file_namestring Airfoil XSec file name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadFileXSec()

std::vector< vec3d > vsp::ReadFileXSec ( const std::string & xsec_id,
const std::string & file_name )
extern

Read in XSec shape from fuselage (\*.fsx) file and set to the specified XSec. The XSec must be of type XS_FILE_FUSE.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, 2, XS_FILE_FUSE );
string xsec = GetXSec( xsec_surf, 2 );
array< vec3d > @vec_array = ReadFileXSec( xsec, "TestXSec.fxs" );
// The file holds a closed diamond, so the first and last points coincide
// and the section takes its size from their extents.
if ( vec_array.size() < 3 )
{
Print( "ERROR: ReadFileXSec returned too few points" );
__failure++;
}
else
{
if ( dist( vec_array[0], vec_array[vec_array.size() - 1] ) > 1e-8 )
{
Print( "ERROR: ReadFileXSec returned an open curve" );
__failure++;
}
// The shape is normalized on the way in and then scaled by the
// section's own width and height, so the curve has to fit inside them.
double w = GetXSecWidth( xsec );
double h = GetXSecHeight( xsec );
for ( int i = 0; i < 11; i++ )
{
vec3d p = ComputeXSecPnt( xsec, i * 0.1 );
if ( abs( p.y() ) > 0.5 * w + 1e-6 || abs( p.z() ) > 0.5 * h + 1e-6 )
{
Print( "ERROR: ReadFileXSec left the curve outside the section" );
__failure++;
}
}
}
Parameters
[in]xsec_idstring XSec ID
[in]file_namestring Fuselage XSec file name
Returns
vector<vec3d> Array of coordinate points read from the file and set to the XSec
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetXSecSkinParms()

void vsp::ResetXSecSkinParms ( const std::string & xsec_id)
extern

Reset all skinning Parms for a specified XSec. Set top, bottom, left, and right strengths, slew, angle, and curvature to 0. Set all symmetry and equality conditions to false.

string fid = AddGeom( "FUSELAGE", "" ); // Add Fuselage
string xsec_surf = GetXSecSurf( fid, 0 ); // Get First (and Only) XSec Surf
int num_xsecs = GetNumXSec( xsec_surf );
string xsec = GetXSec( xsec_surf, 1 );
SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 15.0 ); // Set Tangent Angles At Cross Section
SetXSecContinuity( xsec, 1 ); // Set Continuity At Cross Section
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "TopLAngle" ) ), 15.0, 1e-6 ) )
{
Print( "ERROR: the skin Parms were never set" );
__failure++;
}
// Resetting zeroes every skin value on all four sides and turns the
// symmetry flags back on. Continuity is left alone.
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "TopLAngle" ) ), 0.0, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "TopRAngle" ) ), 0.0, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "TopLSlew" ) ), 0.0, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "TopLStrength" ) ), 0.0, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "TopLCurve" ) ), 0.0, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "RightLAngle" ) ), 0.0, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "BottomLAngle" ) ), 0.0, 1e-6 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "LeftLAngle" ) ), 0.0, 1e-6 ) )
{
Print( "ERROR: ResetXSecSkinParms did not zero the skin Parms" );
__failure++;
}
if ( !closeTo( GetParmVal( GetXSecParm( xsec, "TBSym" ) ), 1.0, 1e-12 ) ||
!closeTo( GetParmVal( GetXSecParm( xsec, "RLSym" ) ), 1.0, 1e-12 ) )
{
Print( "ERROR: ResetXSecSkinParms did not restore the symmetry flags" );
__failure++;
}
void ResetXSecSkinParms(const std::string &xsec_id)
Parameters
[in]xsec_idstring XSec ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAirfoilLowerPnts()

void vsp::SetAirfoilLowerPnts ( const std::string & xsec_id,
const std::vector< vec3d > & low_pnt_vec )
extern

Set the lower points for an airfoil. The XSec must be of type XS_FILE_AIRFOIL.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" );
array< vec3d > @low_array = GetAirfoilLowerPnts( xsec );
for ( int i = 0 ; i < int( low_array.size() ) ; i++ )
{
low_array[i].scale_y( 0.5 );
}
SetAirfoilLowerPnts( xsec, low_array );
array< vec3d > @check_array = GetAirfoilLowerPnts( xsec );
if ( check_array.length() != low_array.length() )
{
Print( "ERROR: SetAirfoilLowerPnts point count" );
__failure++;
}
else
{
// The halved lower surface has to come back halved, and the upper
// surface has to be left alone.
for ( int i = 0; i < int( low_array.size() ); i++ )
{
if ( dist( check_array[i], low_array[i] ) > 1e-6 )
{
Print( "ERROR: SetAirfoilLowerPnts did not store point " + i );
__failure++;
}
}
array< vec3d > @up_array = GetAirfoilUpperPnts( xsec );
double max_up = 0.0;
double min_low = 0.0;
for ( int i = 0; i < int( check_array.size() ); i++ )
{
if ( up_array[i].y() > max_up ) { max_up = up_array[i].y(); }
if ( check_array[i].y() < min_low ) { min_low = check_array[i].y(); }
}
if ( !closeTo( 0.5 * max_up, -min_low, 1e-6 ) )
{
Print( "ERROR: SetAirfoilLowerPnts did not leave the upper surface alone" );
__failure++;
}
}
void SetAirfoilLowerPnts(const std::string &xsec_id, const std::vector< vec3d > &low_pnt_vec)
Parameters
[in]xsec_idstring XSec ID
[in]low_pnt_vecvector<vec3d> Array of points defining the lower surface of the airfoil
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAirfoilPnts()

void vsp::SetAirfoilPnts ( const std::string & xsec_id,
const std::vector< vec3d > & up_pnt_vec,
const std::vector< vec3d > & low_pnt_vec )
extern

Set the upper and lower points for an airfoil. The XSec must be of type XS_FILE_AIRFOIL.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" );
array< vec3d > @up_array = GetAirfoilUpperPnts( xsec );
array< vec3d > @low_array = GetAirfoilLowerPnts( xsec );
for ( int i = 0 ; i < int( up_array.size() ) ; i++ )
{
up_array[i].scale_y( 2.0 );
low_array[i].scale_y( 0.5 );
}
SetAirfoilPnts( xsec, up_array, low_array );
array< vec3d > @check_up = GetAirfoilUpperPnts( xsec );
array< vec3d > @check_low = GetAirfoilLowerPnts( xsec );
if ( check_up.length() != up_array.length() || check_low.length() != low_array.length() )
{
Print( "ERROR: SetAirfoilPnts point count" );
__failure++;
}
else
{
for ( int i = 0; i < int( up_array.size() ); i++ )
{
if ( dist( check_up[i], up_array[i] ) > 1e-6 || dist( check_low[i], low_array[i] ) > 1e-6 )
{
Print( "ERROR: SetAirfoilPnts did not store point " + i );
__failure++;
}
}
// The section started symmetric; doubling the top and halving the
// bottom leaves the top four times as deep as the bottom.
double max_up = 0.0;
double min_low = 0.0;
for ( int i = 0; i < int( check_up.size() ); i++ )
{
if ( check_up[i].y() > max_up ) { max_up = check_up[i].y(); }
if ( check_low[i].y() < min_low ) { min_low = check_low[i].y(); }
}
if ( !closeTo( max_up, -4.0 * min_low, 1e-6 ) )
{
Print( "ERROR: SetAirfoilPnts did not scale the two surfaces apart" );
__failure++;
}
}
void SetAirfoilPnts(const std::string &xsec_id, const std::vector< vec3d > &up_pnt_vec, const std::vector< vec3d > &low_pnt_vec)
Parameters
[in]xsec_idstring XSec ID
[in]up_pnt_vecvector<vec3d> Array of points defining the upper surface of the airfoil
[in]low_pnt_vecvector<vec3d> Array of points defining the lower surface of the airfoil
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAirfoilUpperPnts()

void vsp::SetAirfoilUpperPnts ( const std::string & xsec_id,
const std::vector< vec3d > & up_pnt_vec )
extern

Set the upper points for an airfoil. The XSec must be of type XS_FILE_AIRFOIL.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" );
array< vec3d > @up_array = GetAirfoilUpperPnts( xsec );
for ( int i = 0 ; i < int( up_array.size() ) ; i++ )
{
up_array[i].scale_y( 2.0 );
}
SetAirfoilUpperPnts( xsec, up_array );
array< vec3d > @check_array = GetAirfoilUpperPnts( xsec );
if ( check_array.length() != up_array.length() )
{
Print( "ERROR: SetAirfoilUpperPnts point count" );
__failure++;
}
else
{
// The doubled upper surface has to come back doubled, and the lower
// surface has to be left alone.
for ( int i = 0; i < int( up_array.size() ); i++ )
{
if ( dist( check_array[i], up_array[i] ) > 1e-6 )
{
Print( "ERROR: SetAirfoilUpperPnts did not store point " + i );
__failure++;
}
}
array< vec3d > @low_array = GetAirfoilLowerPnts( xsec );
double max_up = 0.0;
double min_low = 0.0;
for ( int i = 0; i < int( check_array.size() ); i++ )
{
if ( check_array[i].y() > max_up ) { max_up = check_array[i].y(); }
if ( low_array[i].y() < min_low ) { min_low = low_array[i].y(); }
}
if ( !closeTo( max_up, -2.0 * min_low, 1e-6 ) )
{
Print( "ERROR: SetAirfoilUpperPnts did not leave the lower surface alone" );
__failure++;
}
}
void SetAirfoilUpperPnts(const std::string &xsec_id, const std::vector< vec3d > &up_pnt_vec)
Parameters
[in]xsec_idstring XSec ID
[in]up_pnt_vecvector<vec3d> Array of points defining the upper surface of the airfoil
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetDriverGroup()

void vsp::SetDriverGroup ( const std::string & geom_id,
int section_index,
int driver_0,
int driver_1 = -1,
int driver_2 = -1 )
extern

Choose which quantities drive a wing section. A section is defined by three of its measures and the rest follow; this says which three.

string wid = AddGeom( "WING", "" );
@ SPAN_WSECT_DRIVER
void SetDriverGroup(const std::string &geom_id, int section_index, int driver_0, int driver_1=-1, int driver_2=-1)
See also
WING_DRIVERS, SetDriverGroupByID
Parameters
[in]geom_idstring Geom ID
[in]section_indexint Wing section index
[in]driver_0int Wing driver enum (i.e. SPAN_WSECT_DRIVER)
[in]driver_1int Second wing driver enum
[in]driver_2int Third wing driver enum
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetDriverGroupByID()

void vsp::SetDriverGroupByID ( const std::string & xsec_id,
int driver_0,
int driver_1 = -1,
int driver_2 = -1 )
extern

Set the driver group of a wing section or XSecCurve, by XSec ID.

string gid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
array< int > @drivers = GetDriverGroup( gid, 1 );
if ( drivers[0] != AR_WSECT_DRIVER || drivers[1] != ROOTC_WSECT_DRIVER || drivers[2] != TIPC_WSECT_DRIVER )
{
Print( "ERROR: SetDriverGroupByID did not set the drivers" );
__failure++;
}
std::vector< int > GetDriverGroup(const std::string &geom_id, int section_index)
See also
GetDriverGroupByID, WING_DRIVERS, XSEC_DRIVERS, SetDriverGroup
Parameters
[in]xsec_idstring XSec ID
[in]driver_0int First driver enum (i.e. SPAN_WSECT_DRIVER)
[in]driver_1int Second driver enum (i.e. ROOTC_WSECT_DRIVER)
[in]driver_2int Third driver enum (i.e. TIPC_WSECT_DRIVER)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetEngineInletFaceXSecID()

void vsp::SetEngineInletFaceXSecID ( const std::string & geom_id,
const std::string & xsec_id )
extern

Set the cross-section an engine Geom models its inlet face at, by XSec ID.

string sid = AddGeom( "STACK" );
string xsec_2 = GetXSec( GetXSecSurf( sid, 0 ), 2 );
SetEngineInletFaceXSecID( sid, xsec_2 );
if ( GetEngineInletFaceXSecID( sid ) != xsec_2 )
{
Print( "ERROR: SetEngineInletFaceXSecID did not set the XSec" );
__failure++;
}
See also
GetEngineInletFaceXSecID
Parameters
[in]geom_idstring Engine Geom ID (a stack, fuselage or other engine Geom)
[in]xsec_idstring XSec ID on that Geom
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetEngineInletLipXSecID()

void vsp::SetEngineInletLipXSecID ( const std::string & geom_id,
const std::string & xsec_id )
extern

Set the cross-section an engine Geom models its inlet lip at, by XSec ID.

string sid = AddGeom( "STACK" );
string xsec_2 = GetXSec( GetXSecSurf( sid, 0 ), 2 );
SetEngineInletLipXSecID( sid, xsec_2 );
if ( GetEngineInletLipXSecID( sid ) != xsec_2 )
{
Print( "ERROR: SetEngineInletLipXSecID did not set the XSec" );
__failure++;
}
See also
GetEngineInletLipXSecID
Parameters
[in]geom_idstring Engine Geom ID (a stack, fuselage or other engine Geom)
[in]xsec_idstring XSec ID on that Geom
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetEngineOutletFaceXSecID()

void vsp::SetEngineOutletFaceXSecID ( const std::string & geom_id,
const std::string & xsec_id )
extern

Set the cross-section an engine Geom models its outlet face at, by XSec ID.

string sid = AddGeom( "STACK" );
string xsec_2 = GetXSec( GetXSecSurf( sid, 0 ), 2 );
if ( GetEngineOutletFaceXSecID( sid ) != xsec_2 )
{
Print( "ERROR: SetEngineOutletFaceXSecID did not set the XSec" );
__failure++;
}
See also
GetEngineOutletFaceXSecID
Parameters
[in]geom_idstring Engine Geom ID (a stack, fuselage or other engine Geom)
[in]xsec_idstring XSec ID on that Geom
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetEngineOutletLipXSecID()

void vsp::SetEngineOutletLipXSecID ( const std::string & geom_id,
const std::string & xsec_id )
extern

Set the cross-section an engine Geom models its outlet lip at, by XSec ID.

string sid = AddGeom( "STACK" );
string xsec_2 = GetXSec( GetXSecSurf( sid, 0 ), 2 );
SetEngineOutletLipXSecID( sid, xsec_2 );
if ( GetEngineOutletLipXSecID( sid ) != xsec_2 )
{
Print( "ERROR: SetEngineOutletLipXSecID did not set the XSec" );
__failure++;
}
See also
GetEngineOutletLipXSecID
Parameters
[in]geom_idstring Engine Geom ID (a stack, fuselage or other engine Geom)
[in]xsec_idstring XSec ID on that Geom
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetLowerCST()

void vsp::SetLowerCST ( const std::string & xsec_id,
int deg,
const std::vector< double > & coefs )
extern

Set the CST degree and coefficients for the lower surface of an airfoil. The number of coefficients should be one more than the CST degree. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
array < double > coefs = GetLowerCSTCoefs( xsec );
SetLowerCST( xsec, GetLowerCSTDegree( xsec ), coefs );
void SetLowerCST(const std::string &xsec_id, int deg, const std::vector< double > &coefs)
See also
GetLowerCSTDegree, GetLowerCSTCoefs
Parameters
[in]xsec_idstring XSec ID
[in]degint CST degree of lower airfoil surface
[in]coefsvector<double> Vector of CST coefficients for the lower airfoil surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetSkinSpineName()

void vsp::SetSkinSpineName ( const std::string & geom_id,
int index,
const std::string & name )
extern

Set the name of a skinning spine. See GetSkinSpineName for what the name is used for.

string sid = AddGeom( "STACK", "" );
int ispine = AddSkinSpine( sid, 0.15 );
SetSkinSpineName( sid, ispine, "Chine" );
if ( GetSkinSpineName( sid, ispine ) != "Chine" ) { Print( "ERROR: SetSkinSpineName" ); __failure++; }
See also
GetSkinSpineName, SetSkinSpineNameByID
Parameters
[in]geom_idstring Geom ID
[in]indexint Spine index
[in]namestring Spine name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetSkinSpineNameByID()

void vsp::SetSkinSpineNameByID ( const std::string & spine_id,
const std::string & name )
extern

Set the name of a skin spine, by the ID of the spine on any one cross-section.

string gid = AddGeom( "STACK" );
int spine_index = AddSkinSpine( gid, 0.15 );
string xsec = GetXSec( GetXSecSurf( gid, 0 ), 1 );
array< string > @spines = GetSkinSpineIDVec( xsec );
SetSkinSpineNameByID( spines[ spine_index ], "Chine" );
if ( GetSkinSpineName( gid, spine_index ) != "Chine" )
{
Print( "ERROR: SetSkinSpineNameByID did not name the spine" );
__failure++;
}
void SetSkinSpineNameByID(const std::string &spine_id, const std::string &name)
See also
GetSkinSpineName, SetSkinSpineName
Parameters
[in]spine_idstring Skin spine ID
[in]namestring New name for the spine
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetUpperCST()

void vsp::SetUpperCST ( const std::string & xsec_id,
int deg,
const std::vector< double > & coefs )
extern

Set the CST degree and coefficients for the upper surface of an airfoil. The number of coefficients should be one more than the CST degree. The XSec must be of type XS_CST_AIRFOIL

string wid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( wid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
array < double > coefs = GetUpperCSTCoefs( xsec );
SetUpperCST( xsec, GetUpperCSTDegree( xsec ), coefs );
void SetUpperCST(const std::string &xsec_id, int deg, const std::vector< double > &coefs)
See also
GetUpperCSTDegree, GetUpperCSTCoefs
Parameters
[in]xsec_idstring XSec ID
[in]degint CST degree of upper airfoil surface
[in]coefsvector<double> Vector of CST coefficients for the upper airfoil surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecAlias()

void vsp::SetXSecAlias ( const std::string & id,
const std::string & alias )
extern

Set XSec Alias by ID

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
// Set Alias and verify alias match
string alias = "XSec_One_Alias";
SetXSecAlias( xsec_1, alias );
string get_alias = GetXSecAlias( xsec_1 );
if ( alias != get_alias )
{
Print("SetXSecAlias/GetXSecAlias error!");
__failure++;
}
Parameters
[in]idstring XSec ID
[in]aliasstring Xsec alias
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecContinuity()

void vsp::SetXSecContinuity ( const std::string & xsec_id,
int cx )
extern

Set how many derivatives are continuous across an XSec: 0 for position only, 1 to also match slope, 2 to also match curvature.

string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
SetXSecContinuity( xsec, 1 );
if ( GetXSecContinuity( xsec ) != 1 ) { Print( "ERROR: SetXSecContinuity" ); __failure++; }
See also
GetXSecContinuity
Parameters
[in]xsec_idstring XSec ID
[in]cxint Number of continuous derivatives, 0, 1 or 2
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecCurvatures()

void vsp::SetXSecCurvatures ( const std::string & xsec_id,
int side,
double top,
double right,
double bottom,
double left )
extern

Set the curvatures for one side of an XSec. The four values are given in the order top, right, bottom and left; a value of -1.0e12 leaves that position as it was. XSEC_BOTH_SIDES sets both sides at once.

string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
SetXSecCurvatures( xsec, XSEC_BOTH_SIDES, 5.0, 5.0, 5.0, 5.0 );
array< double > vals = GetXSecCurvatures( xsec, XSEC_LEFT_SIDE );
for ( int i = 0; i < int( vals.size() ); i++ )
{
if ( !closeTo( vals[i], 5.0, 1e-6 ) ) { Print( "ERROR: SetXSecCurvatures" ); __failure++; }
}
See also
GetXSecCurvatures, XSEC_SIDES_TYPE
Parameters
[in]xsec_idstring XSec ID
[in]sideint XSec side type enum (i.e. XSEC_BOTH_SIDES)
[in]topdouble Value at the top, or -1.0e12 to leave it
[in]rightdouble Value at the right, or -1.0e12 to leave it
[in]bottomdouble Value at the bottom, or -1.0e12 to leave it
[in]leftdouble Value at the left, or -1.0e12 to leave it
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecCurveAlias()

void vsp::SetXSecCurveAlias ( const std::string & id,
const std::string & alias )
extern

Set XSecCurve Alias by XSec ID

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
// Set Alias and verify alias match
string alias = "XSecCurve_One_Alias";
SetXSecCurveAlias( xsec_1, alias );
string get_alias = GetXSecCurveAlias( xsec_1 );
if ( alias != get_alias )
{
Print("SetXSecCurveAlias/GetXSecCurveAlias error!");
__failure++;
}
Parameters
[in]idstring XSec ID
[in]aliasstring XsecCurve alias
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecHeight()

void vsp::SetXSecHeight ( const std::string & xsec_id,
double h )
extern

Set the height of an XSec. Note that POINT type XSecs have a width and height of 0, regardless of what is input to SetXSecHeight.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Identify XSec 2
string xsec_2 = GetXSec( xsec_surf, 2 );
SetXSecHeight( xsec_2, 1.5 );
if ( !closeTo( GetXSecHeight( xsec_2 ), 1.5, 1e-9 ) )
{
Print( "ERROR: SetXSecHeight did not take" );
__failure++;
}
void SetXSecHeight(const std::string &xsec_id, double h)
See also
GetXSecHeight
Parameters
[in]xsec_idstring XSec ID
[in]hdouble Xsec height
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecPnts()

void vsp::SetXSecPnts ( const std::string & xsec_id,
std::vector< vec3d > & pnt_vec )
extern

Set the points of a file XSec. The XSec must be of type XS_FILE_FUSE; this is how a section read from a file is replaced from a script.

string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 1, XS_FILE_FUSE );
string xsec = GetXSec( xsec_surf, 1 );
// Take the section's own points and hand back a squashed copy of them. Building a set from
// nothing has to match what a file section expects, which is a closed curve in the section's
// own plane.
array < vec3d > pnt_vec = GetXSecPnts( xsec );
for ( int i = 0 ; i < int( pnt_vec.size() ) ; i++ )
{
pnt_vec[i].set_y( 0.5 * pnt_vec[i].y() );
}
SetXSecPnts( xsec, pnt_vec );
if ( GetXSecPnts( xsec ).size() != pnt_vec.size() ) { Print( "ERROR: SetXSecPnts" ); __failure++; }
See also
GetXSecPnts, ChangeXSecShape
Parameters
[in]xsec_idstring XSec ID, of type XS_FILE_FUSE
[in]pnt_vecvector<vec3d> Points defining the section: a closed curve in the XY plane, running from the right-hand point down through the bottom, round the side and over the top. Any other set is refused with VSP_INVALID_INPUT_VAL and the section is left as it was
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecTanAngles()

void vsp::SetXSecTanAngles ( const std::string & xsec_id,
int side,
double top,
double right,
double bottom,
double left )
extern

Set the tangent angles for one side of an XSec. The four values are given in the order top, right, bottom and left; a value of -1.0e12 leaves that position as it was. XSEC_BOTH_SIDES sets both sides at once.

string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 5.0, 5.0, 5.0, 5.0 );
array< double > vals = GetXSecTanAngles( xsec, XSEC_LEFT_SIDE );
for ( int i = 0; i < int( vals.size() ); i++ )
{
if ( !closeTo( vals[i], 5.0, 1e-6 ) ) { Print( "ERROR: SetXSecTanAngles" ); __failure++; }
}
See also
GetXSecTanAngles, XSEC_SIDES_TYPE
Parameters
[in]xsec_idstring XSec ID
[in]sideint XSec side type enum (i.e. XSEC_BOTH_SIDES)
[in]topdouble Value at the top, or -1.0e12 to leave it
[in]rightdouble Value at the right, or -1.0e12 to leave it
[in]bottomdouble Value at the bottom, or -1.0e12 to leave it
[in]leftdouble Value at the left, or -1.0e12 to leave it
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecTanSlews()

void vsp::SetXSecTanSlews ( const std::string & xsec_id,
int side,
double top,
double right,
double bottom,
double left )
extern

Set the tangent slews for one side of an XSec. The four values are given in the order top, right, bottom and left; a value of -1.0e12 leaves that position as it was. XSEC_BOTH_SIDES sets both sides at once.

string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
SetXSecTanSlews( xsec, XSEC_BOTH_SIDES, 5.0, 5.0, 5.0, 5.0 );
array< double > vals = GetXSecTanSlews( xsec, XSEC_LEFT_SIDE );
for ( int i = 0; i < int( vals.size() ); i++ )
{
if ( !closeTo( vals[i], 5.0, 1e-6 ) ) { Print( "ERROR: SetXSecTanSlews" ); __failure++; }
}
See also
GetXSecTanSlews, XSEC_SIDES_TYPE
Parameters
[in]xsec_idstring XSec ID
[in]sideint XSec side type enum (i.e. XSEC_BOTH_SIDES)
[in]topdouble Value at the top, or -1.0e12 to leave it
[in]rightdouble Value at the right, or -1.0e12 to leave it
[in]bottomdouble Value at the bottom, or -1.0e12 to leave it
[in]leftdouble Value at the left, or -1.0e12 to leave it
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecTanStrengths()

void vsp::SetXSecTanStrengths ( const std::string & xsec_id,
int side,
double top,
double right,
double bottom,
double left )
extern

Set the tangent strengths for one side of an XSec. The four values are given in the order top, right, bottom and left; a value of -1.0e12 leaves that position as it was. XSEC_BOTH_SIDES sets both sides at once.

string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
string xsec = GetXSec( xsec_surf, 1 );
SetXSecTanStrengths( xsec, XSEC_BOTH_SIDES, 5.0, 5.0, 5.0, 5.0 );
array< double > vals = GetXSecTanStrengths( xsec, XSEC_LEFT_SIDE );
for ( int i = 0; i < int( vals.size() ); i++ )
{
if ( !closeTo( vals[i], 5.0, 1e-6 ) ) { Print( "ERROR: SetXSecTanStrengths" ); __failure++; }
}
See also
GetXSecTanStrengths, XSEC_SIDES_TYPE
Parameters
[in]xsec_idstring XSec ID
[in]sideint XSec side type enum (i.e. XSEC_BOTH_SIDES)
[in]topdouble Value at the top, or -1.0e12 to leave it
[in]rightdouble Value at the right, or -1.0e12 to leave it
[in]bottomdouble Value at the bottom, or -1.0e12 to leave it
[in]leftdouble Value at the left, or -1.0e12 to leave it
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecWidth()

void vsp::SetXSecWidth ( const std::string & xsec_id,
double w )
extern

Set the width of an XSec. Note that POINT type XSecs have a width and height of 0, regardless of what is input to SetXSecWidth.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Identify XSec 2
string xsec_2 = GetXSec( xsec_surf, 2 );
SetXSecWidth( xsec_2, 1.5 );
if ( !closeTo( GetXSecWidth( xsec_2 ), 1.5, 1e-9 ) )
{
Print( "ERROR: SetXSecWidth did not take" );
__failure++;
}
void SetXSecWidth(const std::string &xsec_id, double w)
See also
GetXSecWidth
Parameters
[in]xsec_idstring XSec ID
[in]wdouble Xsec width
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecWidthHeight()

void vsp::SetXSecWidthHeight ( const std::string & xsec_id,
double w,
double h )
extern

Set the width and height of an XSec. Note, if the XSec is an EDIT_CURVE type and PreserveARFlag is true, the input width value will be ignored and instead set from on the input height and aspect ratio. Use SetXSecWidth and SetXSecHeight directly to avoid this.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Identify XSec 2
string xsec_2 = GetXSec( xsec_surf, 2 );
SetXSecWidthHeight( xsec_2, 1.5, 1.5 );
if ( !closeTo( GetXSecWidth( xsec_2 ), 1.5, 1e-6 ) ||
!closeTo( GetXSecHeight( xsec_2 ), 1.5, 1e-6 ) )
{
Print( "ERROR: SetXSecWidthHeight did not take" );
__failure++;
}
// The neighbouring sections have to be left alone.
string xsec_1 = GetXSec( xsec_surf, 1 );
if ( closeTo( GetXSecWidth( xsec_1 ), 1.5, 1e-6 ) &&
closeTo( GetXSecHeight( xsec_1 ), 1.5, 1e-6 ) )
{
Print( "ERROR: SetXSecWidthHeight reached a section it was not given" );
__failure++;
}
See also
SetXSecWidth, SetXSecHeight
Parameters
[in]xsec_idstring XSec ID
[in]wdouble Xsec width
[in]hdouble Xsec height
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SplitWingXSecByID()

std::string vsp::SplitWingXSecByID ( const std::string & xsec_id)
extern

Split a wing section in two, by XSec ID, and return the ID of the new outboard section.

string gid = AddGeom( "WING" );
string xsec_surf = GetXSecSurf( gid, 0 );
string xsec_1 = GetXSec( xsec_surf, 1 );
int n = GetNumXSec( xsec_surf );
string new_id = SplitWingXSecByID( xsec_1 );
if ( GetNumXSec( xsec_surf ) != n + 1 || GetXSec( xsec_surf, 2 ) != new_id )
{
Print( "ERROR: SplitWingXSecByID did not split the section" );
__failure++;
}
std::string SplitWingXSecByID(const std::string &xsec_id)
See also
InsertXSec, GetXSecIDVec, SplitWingXSec
Parameters
[in]xsec_idstring Wing section XSec ID
Returns
string ID of the new outboard section
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteBezierAirfoil()

void vsp::WriteBezierAirfoil ( const std::string & file_name,
const std::string & geom_id,
const double & foilsurf_u )
extern

Write out the untwisted unit-length 2D Bezier curve for the specified airfoil in custom\*.bz format. The output will describe the analytical shape of the airfoil. See BezierAirfoilExample.m and BezierCtrlToCoordPnts.m for examples of discretizing the Bezier curve and generating a Selig airfoil file.

//==== Add Wing Geometry and Set Parms ====//
string wing_id = AddGeom( "WING", "" );
const double u = 0.5; // export airfoil at mid span location
//==== Write Bezier Airfoil File ====//
WriteBezierAirfoil( "Example_Bezier.bz", wing_id, u );
// The call above should have produced a file with content in it.
file __f;
if ( __f.open( "Example_Bezier.bz", "r" ) < 0 )
{
Print( "ERROR: WriteBezierAirfoil wrote no file" );
__failure++;
}
else
{
if ( __f.getSize() <= 0 )
{
Print( "ERROR: WriteBezierAirfoil wrote an empty file" );
__failure++;
}
__f.close();
}
void WriteBezierAirfoil(const std::string &file_name, const std::string &geom_id, const double &foilsurf_u)
Parameters
[in]file_namestring Airfoil (\*.bz) output file name
[in]geom_idstring Geom ID
[in]foilsurf_udouble U location (range: 0 - 1) along the surface. The foil surface does not include root and tip caps (i.e. 2 section wing -> XSec0 @ u=0, XSec1 @ u=0.5, XSec2 @ u=1.0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteSeligAirfoil()

void vsp::WriteSeligAirfoil ( const std::string & file_name,
const std::string & geom_id,
const double & foilsurf_u )
extern

Write out the untwisted unit-length 2D coordinate points for the specified airfoil in Selig format. Coordinate points follow the on-screen wire frame W tessellation.

//==== Add Wing Geometry and Set Parms ====//
string wing_id = AddGeom( "WING", "" );
const double u = 0.5; // export airfoil at mid span location
//==== Write Selig Airfoil File ====//
WriteSeligAirfoil( "Example_Selig.dat", wing_id, u );
// The call above should have produced a file with content in it.
file __f;
if ( __f.open( "Example_Selig.dat", "r" ) < 0 )
{
Print( "ERROR: WriteSeligAirfoil wrote no file" );
__failure++;
}
else
{
if ( __f.getSize() <= 0 )
{
Print( "ERROR: WriteSeligAirfoil wrote an empty file" );
__failure++;
}
__f.close();
}
void WriteSeligAirfoil(const std::string &file_name, const std::string &geom_id, const double &foilsurf_u)
See also
GetAirfoilCoordinates
Parameters
[in]file_namestring Airfoil (\*.dat) output file name
[in]geom_idstring Geom ID
[in]foilsurf_udouble U location (range: 0 - 1) along the surface. The foil surface does not include root and tip caps (i.e. 2 section wing -> XSec0 @ u=0, XSec1 @ u=0.5, XSec2 @ u=1.0)
Here is the call graph for this function:
Here is the caller graph for this function: