OpenVSP API Documentation  3.38.0
Functions
BOR Functions

This group of API functions provides capabilities related to the body of revolution (BOR) geometry type in OpenVSP. Click here to return to the main page. More...

Functions

void vsp::ChangeBORXSecShape (const string &bor_id, int type)
 
int vsp::GetBORXSecShape (const string &bor_id)
 
std::vector< vec3dvsp::ReadBORFileXSec (const std::string &bor_id, const std::string &file_name)
 
void vsp::SetBORXSecPnts (const std::string &bor_id, std::vector< vec3d > &pnt_vec)
 
vec3d vsp::ComputeBORXSecPnt (const std::string &bor_id, double fract)
 
vec3d vsp::ComputeBORXSecTan (const std::string &bor_id, double fract)
 
void vsp::ReadBORFileAirfoil (const std::string &bor_id, const std::string &file_name)
 
void vsp::SetBORAirfoilUpperPnts (const std::string &bor_id, const std::vector< vec3d > &up_pnt_vec)
 
void vsp::SetBORAirfoilLowerPnts (const std::string &bor_id, const std::vector< vec3d > &low_pnt_vec)
 
void vsp::SetBORAirfoilPnts (const std::string &bor_id, const std::vector< vec3d > &up_pnt_vec, const std::vector< vec3d > &low_pnt_vec)
 
std::vector< vec3dvsp::GetBORAirfoilUpperPnts (const std::string &bor_id)
 
std::vector< vec3dvsp::GetBORAirfoilLowerPnts (const std::string &bor_id)
 
std::vector< double > vsp::GetBORUpperCSTCoefs (const std::string &bor_id)
 
std::vector< double > vsp::GetBORLowerCSTCoefs (const std::string &bor_id)
 
int vsp::GetBORUpperCSTDegree (const std::string &bor_id)
 
int vsp::GetBORLowerCSTDegree (const std::string &bor_id)
 
void vsp::SetBORUpperCST (const std::string &bor_id, int deg, const std::vector< double > &coefs)
 
void vsp::SetBORLowerCST (const std::string &bor_id, int deg, const std::vector< double > &coefs)
 
void vsp::PromoteBORCSTUpper (const std::string &bor_id)
 
void vsp::PromoteBORCSTLower (const std::string &bor_id)
 
void vsp::DemoteBORCSTUpper (const std::string &bor_id)
 
void vsp::DemoteBORCSTLower (const std::string &bor_id)
 
void vsp::FitBORAfCST (const std::string &bor_id, int deg)
 

Detailed Description

Function Documentation

◆ ChangeBORXSecShape()

void vsp::ChangeBORXSecShape ( const string &  bor_id,
int  type 
)

Set the XSec type for a BOR component

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
if ( GetBORXSecShape( bor_id ) != XS_ROUNDED_RECTANGLE ) { Print( "ERROR: ChangeBORXSecShape" ); }
void ChangeBORXSecShape(const string &bor_id, int type)
int GetBORXSecShape(const string &bor_id)
@ XS_ROUNDED_RECTANGLE
Definition: APIDefines.h:1383
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
See also
XSEC_CRV_TYPE
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]typeint XSec type enum (i.e. XS_ROUNDED_RECTANGLE)

◆ ComputeBORXSecPnt()

vec3d vsp::ComputeBORXSecPnt ( const std::string &  bor_id,
double  fract 
)

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

//==== Add Geom ====//
// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
double u_fract = 0.25;
vec3d pnt = ComputeBORXSecPnt( bor_id, u_fract );
Definition: Vec3d.h:235
vec3d ComputeBORXSecPnt(const std::string &bor_id, double fract)
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]fractdouble Curve parameter value (range: 0 - 1)
Returns
vec3d Coordinate point on curve

◆ ComputeBORXSecTan()

vec3d vsp::ComputeBORXSecTan ( const std::string &  bor_id,
double  fract 
)

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

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
double u_fract = 0.25;
vec3d tan = ComputeBORXSecTan( bor_id, u_fract );
vec3d ComputeBORXSecTan(const std::string &bor_id, double fract)
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]fractdouble Curve parameter value (range: 0 - 1)
Returns
vec3d Tangent vector on curve

◆ DemoteBORCSTLower()

void vsp::DemoteBORCSTLower ( const std::string &  bor_id)

Demote the CST for the lower airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL

See also
GetLowerCSTDegree
Parameters
[in]bor_idstring Body of revolution Geom ID

◆ DemoteBORCSTUpper()

void vsp::DemoteBORCSTUpper ( const std::string &  bor_id)

Demote the CST for the upper airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL

See also
GetUpperCSTDegree
Parameters
[in]bor_idstring Body of revolution Geom ID

◆ FitBORAfCST()

void vsp::FitBORAfCST ( const std::string &  bor_id,
int  deg 
)

Fit a CST airfoil for an existing airfoil of a BOR 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.

Parameters
[in]bor_idstring Body of revolution Geom ID
[in]degint CST degree

◆ GetBORAirfoilLowerPnts()

std::vector<vec3d> vsp::GetBORAirfoilLowerPnts ( const std::string &  bor_id)

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

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" );
array< vec3d > @low_array = GetBORAirfoilLowerPnts( bor_id );
void ReadBORFileAirfoil(const std::string &bor_id, const std::string &file_name)
std::vector< vec3d > GetBORAirfoilLowerPnts(const std::string &bor_id)
@ XS_FILE_AIRFOIL
Definition: APIDefines.h:1391
See also
SetAirfoilPnts
Parameters
[in]bor_idstring Body of revolution Geom ID
Returns
vector<vec3d> Vector of coordinate points for the lower airfoil surface

◆ GetBORAirfoilUpperPnts()

std::vector<vec3d> vsp::GetBORAirfoilUpperPnts ( const std::string &  bor_id)

Get the coordinate points for the upper surface of an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" );
array< vec3d > @up_array = GetBORAirfoilUpperPnts( bor_id );
std::vector< vec3d > GetBORAirfoilUpperPnts(const std::string &bor_id)
See also
SetAirfoilPnts
Parameters
[in]bor_idstring Body of revolution Geom ID
Returns
vector<vec3d> Vector of coordinate points for the upper airfoil surface

◆ GetBORLowerCSTCoefs()

std::vector<double> vsp::GetBORLowerCSTCoefs ( const std::string &  bor_id)

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

See also
SetLowerCST
Parameters
[in]bor_idstring Body of revolution Geom ID
Returns
vector<double> Vector of CST coefficients for the lower airfoil surface

◆ GetBORLowerCSTDegree()

int vsp::GetBORLowerCSTDegree ( const std::string &  bor_id)

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

See also
SetLowerCST
Parameters
[in]bor_idstring Body of revolution Geom ID
Returns
int CST Degree for lower airfoil surface

◆ GetBORUpperCSTCoefs()

std::vector<double> vsp::GetBORUpperCSTCoefs ( const std::string &  bor_id)

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

See also
SetUpperCST
Parameters
[in]bor_idBody of revolution Geom ID
Returns
vector<double> Vector of CST coefficients for the upper airfoil surface

◆ GetBORUpperCSTDegree()

int vsp::GetBORUpperCSTDegree ( const std::string &  bor_id)

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

See also
SetUpperCST
Parameters
[in]bor_idstring Body of revolution Geom ID
Returns
int CST Degree for upper airfoil surface

◆ GetBORXSecShape()

int vsp::GetBORXSecShape ( const string &  bor_id)

Get the XSec type for a BOR component

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
if ( GetBORXSecShape( bor_id ) != XS_ROUNDED_RECTANGLE ) { Print( "ERROR: GetBORXSecShape" ); }
Parameters
[in]bor_idstring Body of revolution Geom ID
Returns
int XSec type enum (i.e. XS_ROUNDED_RECTANGLE)

◆ PromoteBORCSTLower()

void vsp::PromoteBORCSTLower ( const std::string &  bor_id)

Promote the CST for the lower airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL

See also
GetLowerCSTDegree
Parameters
[in]bor_idstring Body of revolution Geom ID

◆ PromoteBORCSTUpper()

void vsp::PromoteBORCSTUpper ( const std::string &  bor_id)

Promote the CST for the upper airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL

See also
GetUpperCSTDegree
Parameters
[in]bor_idstring Body of revolution Geom ID

◆ ReadBORFileAirfoil()

void vsp::ReadBORFileAirfoil ( const std::string &  bor_id,
const std::string &  file_name 
)

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

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" );
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]file_namestring Airfoil XSec file name

◆ ReadBORFileXSec()

std::vector<vec3d> vsp::ReadBORFileXSec ( const std::string &  bor_id,
const std::string &  file_name 
)

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

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
array< vec3d > @vec_array = ReadBORFileXSec( bor_id, "TestXSec.fxs" );
std::vector< vec3d > ReadBORFileXSec(const std::string &bor_id, const std::string &file_name)
@ XS_FILE_FUSE
Definition: APIDefines.h:1385
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]file_namestring Fuselage XSec file name
Returns
vector<vec3d> Array of coordinate points read from the file and set to the XSec

◆ SetBORAirfoilLowerPnts()

void vsp::SetBORAirfoilLowerPnts ( const std::string &  bor_id,
const std::vector< vec3d > &  low_pnt_vec 
)

Set the lower points for an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL.

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" );
array< vec3d > @low_array = GetBORAirfoilLowerPnts( bor_id );
for ( int i = 0 ; i < int( low_array.size() ) ; i++ )
{
low_array[i].scale_y( 0.5 );
}
SetBORAirfoilLowerPnts( bor_id, low_array );
void SetBORAirfoilLowerPnts(const std::string &bor_id, const std::vector< vec3d > &low_pnt_vec)
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]low_pnt_vecvector<vec3d> Vector of points defining the lower surface of the airfoil

◆ SetBORAirfoilPnts()

void vsp::SetBORAirfoilPnts ( const std::string &  bor_id,
const std::vector< vec3d > &  up_pnt_vec,
const std::vector< vec3d > &  low_pnt_vec 
)

Set the upper and lower points for an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL.

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" );
array< vec3d > @up_array = GetBORAirfoilUpperPnts( bor_id );
array< vec3d > @low_array = GetBORAirfoilLowerPnts( bor_id );
for ( int i = 0 ; i < int( up_array.size() ) ; i++ )
{
up_array[i].scale_y( 2.0 );
low_array[i].scale_y( 0.5 );
}
SetBORAirfoilPnts( bor_id, up_array, low_array );
void SetBORAirfoilPnts(const std::string &bor_id, const std::vector< vec3d > &up_pnt_vec, const std::vector< vec3d > &low_pnt_vec)
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]up_pnt_vecvector<vec3d> Vector of points defining the upper surface of the airfoil
[in]low_pnt_vecvector<_>vec3d> Vector of points defining the lower surface of the airfoil

◆ SetBORAirfoilUpperPnts()

void vsp::SetBORAirfoilUpperPnts ( const std::string &  bor_id,
const std::vector< vec3d > &  up_pnt_vec 
)

Set the upper points for an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL.

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" );
array< vec3d > @up_array = GetBORAirfoilUpperPnts( bor_id );
for ( int i = 0 ; i < int( up_array.size() ) ; i++ )
{
up_array[i].scale_y( 2.0 );
}
SetBORAirfoilUpperPnts( bor_id, up_array );
void SetBORAirfoilUpperPnts(const std::string &bor_id, const std::vector< vec3d > &up_pnt_vec)
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]up_pnt_vecvector<vec3d> Vector of points defining the upper surface of the airfoil

◆ SetBORLowerCST()

void vsp::SetBORLowerCST ( const std::string &  bor_id,
int  deg,
const std::vector< double > &  coefs 
)

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

See also
GetLowerCSTDegree, GetLowerCSTCoefs
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]degint CST degree of lower airfoil surface
[in]coefsvector<double> Vector of CST coefficients for the lower airfoil surface

◆ SetBORUpperCST()

void vsp::SetBORUpperCST ( const std::string &  bor_id,
int  deg,
const std::vector< double > &  coefs 
)

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

See also
GetUpperCSTDegree, GetUpperCSTCoefs
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]degCST degree of upper airfoil surface
[in]coefsArray of CST coefficients for the upper airfoil surface

◆ SetBORXSecPnts()

void vsp::SetBORXSecPnts ( const std::string &  bor_id,
std::vector< vec3d > &  pnt_vec 
)

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

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
array< vec3d > @vec_array = ReadBORFileXSec( bor_id, "TestXSec.fxs" );
if ( vec_array.size() > 0 )
{
vec_array[1] = vec_array[1] * 2.0;
vec_array[3] = vec_array[3] * 2.0;
SetBORXSecPnts( bor_id, vec_array );
}
void SetBORXSecPnts(const std::string &bor_id, std::vector< vec3d > &pnt_vec)
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]pnt_vecvector<vec3d> Vector of XSec coordinate points