OpenVSP API Documentation 3.52.0
Loading...
Searching...
No Matches
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::SetBEMPropID (const std::string &prop_id)
void vsp::ChangeBORXSecShape (const std::string &bor_id, int type)
int vsp::GetBORXSecShape (const std::string &bor_id)
std::vector< vec3dvsp::ReadBORFileXSec (const std::string &bor_id, const std::string &file_name)
std::vector< vec3dvsp::GetBORXSecPnts (const std::string &bor_id)
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 std::string & bor_id,
int type )
extern

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" ); __failure++; }
void Print(const std::string &data, bool new_line=true)
void ChangeBORXSecShape(const std::string &bor_id, int type)
int GetBORXSecShape(const std::string &bor_id)
@ XS_ROUNDED_RECTANGLE
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)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeBORXSecPnt()

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

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 );
// The section is a closed curve, so the ends meet.
if ( dist( ComputeBORXSecPnt( bor_id, 0.0 ), ComputeBORXSecPnt( bor_id, 1.0 ) ) > 1e-6 )
{
Print( "ERROR: the BOR section does not close" );
__failure++;
}
// The section lies in a plane of constant Z.
if ( !closeTo( pnt.z(), ComputeBORXSecPnt( bor_id, 0.0 ).z(), 1e-9 ) )
{
Print( "ERROR: the BOR section is not planar" );
__failure++;
}
// Walking the curve has to move, not sit still.
if ( dist( pnt, ComputeBORXSecPnt( bor_id, u_fract + 0.25 ) ) < 1e-9 )
{
Print( "ERROR: ComputeBORXSecPnt does not advance along the curve" );
__failure++;
}
vec3d ComputeBORXSecPnt(const std::string &bor_id, double fract)
double z() const
Definition Vec3d.h:595
Definition Vec3d.h:238
double dist(const vec3d &a, const vec3d &b)
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]fractdouble Curve parameter value (range: 0 - 1)
Returns
vec3d Coordinate point on curve
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeBORXSecTan()

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

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 );
// A tangent is a direction, so it has to have some length.
if ( tan.mag() < 1e-9 )
{
Print( "ERROR: ComputeBORXSecTan 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 fd = ComputeBORXSecPnt( bor_id, u_fract + du ) - ComputeBORXSecPnt( bor_id, u_fract );
if ( fd.mag() < 1e-12 )
{
Print( "ERROR: the BOR section does not advance" );
__failure++;
}
else if ( dot( fd, tan ) / ( fd.mag() * tan.mag() ) < 0.999 )
{
Print( "ERROR: ComputeBORXSecTan does not follow the curve" );
__failure++;
}
vec3d ComputeBORXSecTan(const std::string &bor_id, double fract)
double mag() const
double dot(const vec3d &a, const vec3d &b)
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]fractdouble Curve parameter value (range: 0 - 1)
Returns
vec3d Tangent vector on curve
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DemoteBORCSTLower()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
int deg = GetBORLowerCSTDegree( bid );
if ( GetBORLowerCSTDegree( bid ) != deg - 1 ) { Print( "ERROR: DemoteBORCSTLower" ); __failure++; }
void DemoteBORCSTLower(const std::string &bor_id)
void PromoteBORCSTLower(const std::string &bor_id)
int GetBORLowerCSTDegree(const std::string &bor_id)
@ XS_CST_AIRFOIL
void Update(bool update_managers=true)
See also
GetLowerCSTDegree
Parameters
[in]bor_idstring Body of revolution Geom ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DemoteBORCSTUpper()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
int deg = GetBORUpperCSTDegree( bid );
if ( GetBORUpperCSTDegree( bid ) != deg - 1 ) { Print( "ERROR: DemoteBORCSTUpper" ); __failure++; }
void PromoteBORCSTUpper(const std::string &bor_id)
int GetBORUpperCSTDegree(const std::string &bor_id)
void DemoteBORCSTUpper(const std::string &bor_id)
See also
GetUpperCSTDegree
Parameters
[in]bor_idstring Body of revolution Geom ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FitBORAfCST()

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

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.

string bid = AddGeom( "BODYOFREVOLUTION", "" );
FitBORAfCST( bid, 5 );
void FitBORAfCST(const std::string &bor_id, int deg)
@ XS_FOUR_SERIES
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]degint CST degree
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBORAirfoilLowerPnts()

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

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 );
if ( low_array.length() == 0 )
{
Print( "ERROR: GetBORAirfoilLowerPnts returned nothing" );
__failure++;
}
void ReadBORFileAirfoil(const std::string &bor_id, const std::string &file_name)
std::vector< vec3d > GetBORAirfoilLowerPnts(const std::string &bor_id)
@ XS_FILE_AIRFOIL
See also
SetAirfoilPnts
Parameters
[in]bor_idstring Body of revolution Geom 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:

◆ GetBORAirfoilUpperPnts()

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

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 );
if ( up_array.length() == 0 )
{
Print( "ERROR: GetBORAirfoilUpperPnts returned nothing" );
__failure++;
}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBORLowerCSTCoefs()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
array < double > @coefs = GetBORLowerCSTCoefs( bid );
if ( coefs.size() == 0 ) { Print( "ERROR: GetBORLowerCSTCoefs" ); __failure++; }
std::vector< double > GetBORLowerCSTCoefs(const std::string &bor_id)
See also
SetLowerCST
Parameters
[in]bor_idstring Body of revolution Geom 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:

◆ GetBORLowerCSTDegree()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
if ( GetBORLowerCSTDegree( bid ) < 1 ) { Print( "ERROR: GetBORLowerCSTDegree" ); __failure++; }
See also
SetLowerCST
Parameters
[in]bor_idstring Body of revolution Geom 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:

◆ GetBORUpperCSTCoefs()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
array < double > @coefs = GetBORUpperCSTCoefs( bid );
if ( coefs.size() == 0 ) { Print( "ERROR: GetBORUpperCSTCoefs" ); __failure++; }
std::vector< double > GetBORUpperCSTCoefs(const std::string &bor_id)
See also
SetUpperCST
Parameters
[in]bor_idstring Body of revolution Geom 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:

◆ GetBORUpperCSTDegree()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
if ( GetBORUpperCSTDegree( bid ) < 1 ) { Print( "ERROR: GetBORUpperCSTDegree" ); __failure++; }
See also
SetUpperCST
Parameters
[in]bor_idstring Body of revolution Geom 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:

◆ GetBORXSecPnts()

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

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" );
vec3d before = ComputeBORXSecPnt( bor_id, 0.0 );
if ( vec_array.size() == 0 )
{
Print( "ERROR: ReadBORFileXSec returned no points" );
__failure++;
}
else
{
vec_array[1] = vec_array[1] * 2.0;
vec_array[3] = vec_array[3] * 2.0;
SetBORXSecPnts( bor_id, vec_array );
Update();
vec3d after = ComputeBORXSecPnt( bor_id, 0.0 );
// Points 1 and 3 are the top and bottom of the diamond read from file,
// so doubling them doubles the height of the section while leaving its
// width alone. The section is normalized to the body diameter by its
// height, so the section grows half as wide as it was.
if ( !closeTo( after.x(), 0.5 * before.x(), 1e-6 ) )
{
Print( "ERROR: SetBORXSecPnts did not reshape the section" );
__failure++;
}
}
void SetBORXSecPnts(const std::string &bor_id, std::vector< vec3d > &pnt_vec)
std::vector< vec3d > ReadBORFileXSec(const std::string &bor_id, const std::string &file_name)
@ XS_FILE_FUSE
double x() const
Definition Vec3d.h:531
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]pnt_vecvector<vec3d> Vector of XSec coordinate points

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

// Add Body of Recolution
string bor_id = AddGeom( "BODYOFREVOLUTION", "" );
array< vec3d > @vec_array = ReadBORFileXSec( bor_id, "TestXSec.fxs" );
// The points that were read are the points the section is carrying.
array< vec3d > @check_array = GetBORXSecPnts( bor_id );
if ( check_array.size() == 0 )
{
Print( "ERROR: GetBORXSecPnts returned nothing" );
__failure++;
}
else
{
// The stored points are normalized, so they fit in the unit box, and the
// curve closes on itself.
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: GetBORXSecPnts returned a point outside the unit box" );
__failure++;
}
}
if ( dist( check_array[0], check_array[check_array.size() - 1] ) > 1e-8 )
{
Print( "ERROR: GetBORXSecPnts returned an open curve" );
__failure++;
}
}
std::vector< vec3d > GetBORXSecPnts(const std::string &bor_id)
See also
SetBORXSecPnts, ReadBORFileXSec
Parameters
[in]bor_idstring Body of revolution Geom 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:

◆ GetBORXSecShape()

int vsp::GetBORXSecShape ( const std::string & bor_id)
extern

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" ); __failure++; }
Parameters
[in]bor_idstring Body of revolution Geom ID
Returns
int XSec type enum (i.e. XS_ROUNDED_RECTANGLE)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PromoteBORCSTLower()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
int deg = GetBORLowerCSTDegree( bid );
if ( GetBORLowerCSTDegree( bid ) != deg + 1 ) { Print( "ERROR: PromoteBORCSTLower" ); __failure++; }
See also
GetLowerCSTDegree
Parameters
[in]bor_idstring Body of revolution Geom ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PromoteBORCSTUpper()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
int deg = GetBORUpperCSTDegree( bid );
if ( GetBORUpperCSTDegree( bid ) != deg + 1 ) { Print( "ERROR: PromoteBORCSTUpper" ); __failure++; }
See also
GetUpperCSTDegree
Parameters
[in]bor_idstring Body of revolution Geom ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadBORFileAirfoil()

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

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" );
array< vec3d > @up_array = GetBORAirfoilUpperPnts( bor_id );
array< vec3d > @low_array = GetBORAirfoilLowerPnts( bor_id );
if ( up_array.size() == 0 || up_array.size() != low_array.size() )
{
Print( "ERROR: ReadBORFileAirfoil did not read matching surfaces" );
__failure++;
}
else
{
// The points run from the leading edge to the trailing edge on a unit
// chord, and a NACA 0012 is symmetric top to bottom.
if ( !closeTo( up_array[0].x(), 0.0, 1e-6 ) ||
!closeTo( up_array[up_array.size() - 1].x(), 1.0, 1e-6 ) )
{
Print( "ERROR: ReadBORFileAirfoil did not normalize the chord" );
__failure++;
}
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: ReadBORFileAirfoil 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: ReadBORFileAirfoil did not read a twelve percent section" );
__failure++;
}
}
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]file_namestring Airfoil XSec file name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadBORFileXSec()

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

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" );
// The file holds a closed curve, and the section it produced is the one the
// body is now built on.
if ( vec_array.size() < 3 )
{
Print( "ERROR: ReadBORFileXSec returned too few points" );
__failure++;
}
else if ( dist( vec_array[0], vec_array[vec_array.size() - 1] ) > 1e-8 )
{
Print( "ERROR: ReadBORFileXSec returned an open curve" );
__failure++;
}
if ( GetBORXSecShape( bor_id ) != XS_FILE_FUSE )
{
Print( "ERROR: ReadBORFileXSec changed the section type" );
__failure++;
}
// The section curve closes on itself.
if ( dist( ComputeBORXSecPnt( bor_id, 0.0 ), ComputeBORXSecPnt( bor_id, 1.0 ) ) > 1e-6 )
{
Print( "ERROR: the BOR section does not close" );
__failure++;
}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBEMPropID()

void vsp::SetBEMPropID ( const std::string & prop_id)
extern

Set the propeller to write when a BEM file is exported. Without this the first propeller found is used.

string prop_id = AddGeom( "PROP" );
SetBEMPropID( prop_id );
if ( GetBEMPropID() != prop_id ) { Print( "ERROR: SetBEMPropID" ); __failure++; }
void SetBEMPropID(const std::string &prop_id)
std::string GetBEMPropID()
See also
GetBEMPropID, ExportFile
Parameters
[in]prop_idstring Propeller Geom ID to write
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBORAirfoilLowerPnts()

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

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 );
// The halved lower surface has to come back halved, and the upper surface
// has to be left alone.
array< vec3d > @check_array = GetBORAirfoilLowerPnts( bor_id );
array< vec3d > @up_array = GetBORAirfoilUpperPnts( bor_id );
if ( check_array.size() != low_array.size() )
{
Print( "ERROR: SetBORAirfoilLowerPnts point count" );
__failure++;
}
else
{
double max_up = 0.0;
double min_low = 0.0;
for ( int i = 0; i < int( low_array.size() ); i++ )
{
if ( dist( check_array[i], low_array[i] ) > 1e-6 )
{
Print( "ERROR: SetBORAirfoilLowerPnts did not store point " + i );
__failure++;
}
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: SetBORAirfoilLowerPnts did not leave the upper surface alone" );
__failure++;
}
}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBORAirfoilPnts()

void vsp::SetBORAirfoilPnts ( const std::string & bor_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 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 );
array< vec3d > @check_up = GetBORAirfoilUpperPnts( bor_id );
array< vec3d > @check_low = GetBORAirfoilLowerPnts( bor_id );
if ( check_up.size() != up_array.size() || check_low.size() != low_array.size() )
{
Print( "ERROR: SetBORAirfoilPnts point count" );
__failure++;
}
else
{
double max_up = 0.0;
double min_low = 0.0;
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: SetBORAirfoilPnts did not store point " + i );
__failure++;
}
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(); }
}
// The section started symmetric; doubling the top and halving the
// bottom leaves the top four times as deep as the bottom.
if ( !closeTo( max_up, -4.0 * min_low, 1e-6 ) )
{
Print( "ERROR: SetBORAirfoilPnts did not scale the two surfaces apart" );
__failure++;
}
}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBORAirfoilUpperPnts()

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

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 );
// The doubled upper surface has to come back doubled, and the lower surface
// has to be left alone.
array< vec3d > @check_array = GetBORAirfoilUpperPnts( bor_id );
array< vec3d > @low_array = GetBORAirfoilLowerPnts( bor_id );
if ( check_array.size() != up_array.size() )
{
Print( "ERROR: SetBORAirfoilUpperPnts point count" );
__failure++;
}
else
{
double max_up = 0.0;
double min_low = 0.0;
for ( int i = 0; i < int( up_array.size() ); i++ )
{
if ( dist( check_array[i], up_array[i] ) > 1e-6 )
{
Print( "ERROR: SetBORAirfoilUpperPnts did not store point " + i );
__failure++;
}
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: SetBORAirfoilUpperPnts did not leave the lower surface alone" );
__failure++;
}
}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBORLowerCST()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
array < double > coefs = GetBORLowerCSTCoefs( bid );
SetBORLowerCST( bid, GetBORLowerCSTDegree( bid ), coefs );
void SetBORLowerCST(const std::string &bor_id, int deg, const std::vector< double > &coefs)
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBORUpperCST()

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

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

string bid = AddGeom( "BODYOFREVOLUTION", "" );
array < double > coefs = GetBORUpperCSTCoefs( bid );
SetBORUpperCST( bid, GetBORUpperCSTDegree( bid ), coefs );
void SetBORUpperCST(const std::string &bor_id, int deg, const std::vector< double > &coefs)
See also
GetUpperCSTDegree, GetUpperCSTCoefs
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]degint CST degree of upper airfoil surface
[in]coefsvector<double> Array of CST coefficients for the upper airfoil surface
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBORXSecPnts()

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

Set the points of a body of revolution's file XSec. The BOR's XSec must be of type XS_FILE_FUSE.

string bid = AddGeom( "BODYOFREVOLUTION", "" );
// Take the section's own points and hand back a squashed copy of them.
array < vec3d > pnt_vec = GetBORXSecPnts( bid );
for ( int i = 0 ; i < int( pnt_vec.size() ) ; i++ )
{
pnt_vec[i].set_y( 0.5 * pnt_vec[i].y() );
}
SetBORXSecPnts( bid, pnt_vec );
if ( GetBORXSecPnts( bid ).size() != pnt_vec.size() ) { Print( "ERROR: SetBORXSecPnts" ); __failure++; }
See also
GetBORXSecPnts, ChangeBORXSecShape
Parameters
[in]bor_idstring Body of revolution Geom ID
[in]pnt_vecvector<vec3d> Points defining the section
Here is the call graph for this function:
Here is the caller graph for this function: