OpenVSP API Documentation 3.51.3
Loading...
Searching...
No Matches
FEA Mesh Functions

The following group of API functions supports all functionality of the FEA Mesh Tool. Structures, FEA Parts, materials, and properties can be defined and manipulated. Mesh and output file settings can be adjusted, and an FEA mesh can be generated. Click here to return to the main page. More...

Functions

int vsp::AddFeaStruct (const std::string &geom_id, bool init_skin=true, int surfindex=0)
int vsp::GetFeaMeshStructIndex ()
void vsp::DeleteFeaStruct (const std::string &geom_id, int fea_struct_ind)
std::string vsp::GetFeaStructID (const std::string &geom_id, int fea_struct_ind)
int vsp::GetFeaStructIndex (const std::string &struct_id)
std::string vsp::GetFeaStructParentGeomID (const std::string &struct_id)
std::string vsp::GetFeaStructName (const std::string &geom_id, int fea_struct_ind)
void vsp::SetFeaStructName (const std::string &geom_id, int fea_struct_ind, const std::string &name)
std::vector< std::string > vsp::GetFeaStructIDVec ()
void vsp::SetFeaPartName (const std::string &part_id, const std::string &name)
std::string vsp::AddFeaPart (const std::string &geom_id, int fea_struct_ind, int type)
void vsp::DeleteFeaPart (const std::string &geom_id, int fea_struct_ind, const std::string &part_id)
void vsp::ReorderFeaPart (const std::string &geom_id, int fea_struct_ind, const std::string &part_id, int reorder_type)
void vsp::IndividualizeFeaPart (const std::string &geom_id, int fea_struct_ind, const std::string &part_id)
std::string vsp::GetFeaPartID (const std::string &fea_struct_id, int fea_part_index)
std::string vsp::GetFeaPartName (const std::string &part_id)
int vsp::GetFeaPartType (const std::string &part_id)
std::vector< std::string > vsp::GetFeaPartIDVec (const std::string &fea_struct_id)
std::vector< std::string > vsp::GetFeaSubSurfIDVec (const std::string &fea_struct_id)
void vsp::SetFeaPartPerpendicularSparID (const std::string &part_id, const std::string &perpendicular_spar_id)
std::string vsp::GetFeaPartPerpendicularSparID (const std::string &part_id)
void vsp::SetFeaSubSurfName (const std::string &subsurf_id, const std::string &name)
std::string vsp::GetFeaSubSurfName (const std::string &subsurf_id)
std::string vsp::AddFeaSubSurf (const std::string &geom_id, int fea_struct_ind, int type)
void vsp::DeleteFeaSubSurf (const std::string &geom_id, int fea_struct_ind, const std::string &ss_id)
int vsp::GetFeaSubSurfIndex (const std::string &ss_id)
int vsp::GetFeaPolySparNumPt (const std::string &pspar_id)
std::string vsp::AddFeaPolySparPt (const std::string &pspar_id)
std::string vsp::InsertFeaPolySparPt (const std::string &pspar_id, int index)
void vsp::DelFeaPolySparPt (const std::string &pspar_id, int index)
void vsp::DelAllFeaPolySparPt (const std::string &pspar_id)
int vsp::MoveFeaPolySparPt (const std::string &pspar_id, int index, int reorder_type)
void vsp::SetFeaPolySparPtName (const std::string &pspar_id, int index, const std::string &name)
std::string vsp::GetFeaPolySparPtName (const std::string &pspar_id, int index)
std::string vsp::GetFeaPolySparPtID (const std::string &pspar_id, int index)
std::vector< std::string > vsp::GetAllFeaPolySparPtIDVec (const std::string &pspar_id)
void vsp::AddFeaTrimPart (const std::string &trim_id, const std::string &part_id)
void vsp::DeleteFeaTrimPart (const std::string &trim_id, int index)
std::vector< std::string > vsp::GetFeaTrimPartIDVec (const std::string &trim_id)
void vsp::DeleteFeaAssembly (const std::string &assembly_id)
int vsp::NumFeaAssemblies ()
std::vector< std::string > vsp::GetFeaAssemblyIDVec ()
std::string vsp::GetFeaAssemblyName (const std::string &assembly_id)
void vsp::SetFeaAssemblyName (const std::string &assembly_id, const std::string &name)
void vsp::AddFeaStructureToAssembly (const std::string &assembly_id, const std::string &struct_id)
void vsp::DeleteFeaStructureFromAssembly (const std::string &assembly_id, const std::string &struct_id)
std::vector< std::string > vsp::GetFeaAssemblyStructureIDVec (const std::string &assembly_id)
void vsp::AddFeaAssemblyConnection (const std::string &assembly_id, const std::string &start_fix_pt_id, const std::string &start_struct_id, int start_index, const std::string &end_fix_pt_id, const std::string &end_struct_id, int end_index)
void vsp::DeleteFeaAssemblyConnection (const std::string &assembly_id, int connection_index)
int vsp::NumFeaAssemblyConnections (const std::string &assembly_id)
std::string vsp::GetFeaAssemblyFileName (const std::string &assembly_id, int file_type)
void vsp::SetFeaAssemblyFileName (const std::string &assembly_id, int file_type, const std::string &file_name)
int vsp::NumFeaParts (const std::string &fea_struct_id)
int vsp::NumFeaSubSurfs (const std::string &fea_struct_id)
std::string vsp::AddFeaBC (const std::string &fea_struct_id, int type=-1)
void vsp::DelFeaBC (const std::string &fea_struct_id, const std::string &bc_id)
std::vector< std::string > vsp::GetFeaBCIDVec (const std::string &fea_struct_id)
int vsp::NumFeaBCs (const std::string &fea_struct_id)
std::string vsp::AddFeaLayer (const std::string &material_id)
void vsp::DeleteFeaLayer (const std::string &material_id, const std::string &layer_id)
void vsp::ReorderFeaLayer (const std::string &material_id, const std::string &layer_id, int reorder_type)
int vsp::NumFeaLayers (const std::string &material_id)
std::vector< std::string > vsp::GetFeaLayerIDVec (const std::string &material_id)
void vsp::DeleteFeaMaterial (const std::string &id)
std::vector< std::string > vsp::GetFeaPropertyIDVec ()
void vsp::DeleteFeaProperty (const std::string &id)
double vsp::GetFeaMeshVal (const std::string &geom_id, int fea_struct_ind, int type)
std::string vsp::GetFeaMeshFileName (const std::string &geom_id, int fea_struct_ind, int file_type)
void vsp::ComputeFeaMesh (const std::string &geom_id, int fea_struct_ind, int file_type)
void vsp::ComputeFeaMesh (const std::string &struct_id, int file_type)

Detailed Description

Function Documentation

◆ AddFeaAssemblyConnection()

void vsp::AddFeaAssemblyConnection ( const std::string & assembly_id,
const std::string & start_fix_pt_id,
const std::string & start_struct_id,
int start_index,
const std::string & end_fix_pt_id,
const std::string & end_struct_id,
int end_index )
extern

Connect two FEA Fixed Points, each belonging to a Structure in the assembly, so the Structures are tied together where they meet.

string pod_id = AddGeom( "POD" );
int struct_ind_1 = AddFeaStruct( pod_id );
int struct_ind_2 = AddFeaStruct( pod_id );
string struct_id_1 = GetFeaStructID( pod_id, struct_ind_1 );
string struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 );
//==== Each Structure needs a Fixed Point to connect ====//
string fix_pt_1 = AddFeaPart( pod_id, struct_ind_1, FEA_FIX_POINT );
string fix_pt_2 = AddFeaPart( pod_id, struct_ind_2, FEA_FIX_POINT );
string assembly_id = AddFeaAssembly();
AddFeaStructureToAssembly( assembly_id, struct_id_1 );
AddFeaStructureToAssembly( assembly_id, struct_id_2 );
if ( NumFeaAssemblyConnections( assembly_id ) != 0 )
{
Print( "ERROR: a new assembly already holds connections" );
__failure++;
}
AddFeaAssemblyConnection( assembly_id, fix_pt_1, struct_id_1, 0, fix_pt_2, struct_id_2, 0 );
if ( NumFeaAssemblyConnections( assembly_id ) != 1 )
{
Print( "ERROR: AddFeaAssemblyConnection did not add a connection" );
__failure++;
}
DeleteFeaAssemblyConnection( assembly_id, 0 );
if ( NumFeaAssemblyConnections( assembly_id ) != 0 )
{
Print( "ERROR: DeleteFeaAssemblyConnection did not remove the connection" );
__failure++;
}
// An index past the end has to be rejected.
DeleteFeaAssemblyConnection( assembly_id, 0 );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DeleteFeaAssemblyConnection accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
@ FEA_FIX_POINT
Definition APIDefines.h:701
void AddFeaStructureToAssembly(const std::string &assembly_id, const std::string &struct_id)
int NumFeaAssemblyConnections(const std::string &assembly_id)
void DeleteFeaAssemblyConnection(const std::string &assembly_id, int connection_index)
std::string AddFeaPart(const std::string &geom_id, int fea_struct_ind, int type)
int AddFeaStruct(const std::string &geom_id, bool init_skin=true, int surfindex=0)
void AddFeaAssemblyConnection(const std::string &assembly_id, const std::string &start_fix_pt_id, const std::string &start_struct_id, int start_index, const std::string &end_fix_pt_id, const std::string &end_struct_id, int end_index)
std::string GetFeaStructID(const std::string &geom_id, int fea_struct_ind)
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
See also
AddFeaAssembly, DeleteFeaAssemblyConnection, NumFeaAssemblyConnections
Parameters
[in]assembly_idstring FEA Assembly ID
[in]start_fix_pt_idstring FEA Fixed Point ID at the start of the connection
[in]start_struct_idstring FEA Structure ID the start Fixed Point belongs to
[in]start_indexint Surface index of the start Fixed Point
[in]end_fix_pt_idstring FEA Fixed Point ID at the end of the connection
[in]end_struct_idstring FEA Structure ID the end Fixed Point belongs to
[in]end_indexint Surface index of the end Fixed Point

◆ AddFeaBC()

std::string vsp::AddFeaBC ( const std::string & fea_struct_id,
int type = -1 )
extern

Add an FEA BC to a Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Add BC ====//
string bc_id = AddFeaBC( struct_id, FEA_BC_STRUCTURE );
if ( bc_id.length() == 0 || bc_id == "NONE" )
{
Print( "ERROR: AddFeaBC returned no id" );
__failure++;
}
@ FEA_BC_STRUCTURE
Definition APIDefines.h:602
std::string AddFeaBC(const std::string &fea_struct_id, int type=-1)
See also
FEA_BC_TYPE
Parameters
[in]fea_struct_idstring FEA Structure ID
[in]typeint FEA BC type enum ( i.e. FEA_BC_STRUCTURE )
Returns
string FEA BC ID

◆ AddFeaLayer()

std::string vsp::AddFeaLayer ( const std::string & material_id)
extern

Add an FEA Material the FEA Mesh material library. Materials are available across all Geoms and Structures.

//==== Create FeaMaterial ====//
string mat_id = AddFeaMaterial();
SetParmVal( FindParm( mat_id, "MassDensity", "FeaMaterial" ), 0.016 );
if ( mat_id.length() == 0 || mat_id == "NONE" )
{
Print( "ERROR: AddFeaMaterial returned no id" );
__failure++;
}
std::string FindParm(const std::string &parm_container_id, const std::string &parm_name, const std::string &group_name)
double SetParmVal(const std::string &parm_id, double val)
Returns
string FEA Material ID

Get the IDs of every FEA Material in the FEA Mesh material library, including the built in materials as well as any added through AddFeaMaterial.

//==== The library starts out holding the built in materials ====//
int num_builtin = GetFeaMaterialIDVec().size();
if ( num_builtin < 1 )
{
Print( "ERROR: the FEA material library is empty" );
__failure++;
}
//==== Create FeaMaterial ====//
string mat_id = AddFeaMaterial();
array < string > @mat_ids = GetFeaMaterialIDVec();
if ( int( mat_ids.size() ) != num_builtin + 1 )
{
Print( "ERROR: GetFeaMaterialIDVec did not follow AddFeaMaterial" );
__failure++;
}
// The new material has to be in the list.
bool found = false;
for ( int i = 0; i < int( mat_ids.size() ); i++ )
{
if ( mat_ids[i] == mat_id )
{
found = true;
}
}
if ( !found )
{
Print( "ERROR: the material that was added is not in the list" );
__failure++;
}
See also
AddFeaMaterial, DeleteFeaMaterial
Returns
vector<string> Array of FEA Material IDs

Add a layer to an FEA laminate material. Only a material of type FEA_LAMINATE carries layers.

//==== Create a laminate material ====//
string mat_id = AddFeaMaterial();
SetParmVal( FindParm( mat_id, "FeaMaterialType", "FeaMaterial" ), FEA_LAMINATE );
// Becoming a laminate gives the material a first layer, so count from there.
int num_before = NumFeaLayers( mat_id );
if ( num_before < 1 )
{
Print( "ERROR: a laminate starts with no layers" );
__failure++;
}
string layer_id = AddFeaLayer( mat_id );
if ( layer_id.length() == 0 || NumFeaLayers( mat_id ) != num_before + 1 )
{
Print( "ERROR: AddFeaLayer did not add a layer" );
__failure++;
}
array< string > @layer_ids = GetFeaLayerIDVec( mat_id );
if ( int( layer_ids.size() ) != num_before + 1 || layer_ids[num_before] != layer_id )
{
Print( "ERROR: the layer is not in the layer list" );
__failure++;
}
DeleteFeaLayer( mat_id, layer_id );
if ( NumFeaLayers( mat_id ) != num_before )
{
Print( "ERROR: DeleteFeaLayer did not remove the layer" );
__failure++;
}
// A material that is not a laminate has to be rejected.
string plain_id = AddFeaMaterial();
AddFeaLayer( plain_id );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: AddFeaLayer accepted a material that is not a laminate" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
@ FEA_LAMINATE
Definition APIDefines.h:658
void DeleteFeaLayer(const std::string &material_id, const std::string &layer_id)
int NumFeaLayers(const std::string &material_id)
std::vector< std::string > GetFeaLayerIDVec(const std::string &material_id)
std::string AddFeaLayer(const std::string &material_id)
void Update(bool update_managers=true)
See also
DeleteFeaLayer, NumFeaLayers, GetFeaLayerIDVec, AddFeaMaterial
Parameters
[in]material_idstring FEA Material ID of a laminate
Returns
string FEA Layer ID

◆ AddFeaPart()

std::string vsp::AddFeaPart ( const std::string & geom_id,
int fea_struct_ind,
int type )
extern

Add an FEA Part to a Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Add Bulkead ====//
string bulkhead_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
SetParmVal( FindParm( bulkhead_id, "IncludedElements", "FeaPart" ), FEA_SHELL_AND_BEAM );
SetParmVal( FindParm( bulkhead_id, "RelCenterLocation", "FeaPart" ), 0.15 );
if ( bulkhead_id.length() == 0 || bulkhead_id == "NONE" )
{
Print( "ERROR: AddFeaPart returned no id" );
__failure++;
}
@ FEA_SLICE
Definition APIDefines.h:698
@ FEA_SHELL_AND_BEAM
Definition APIDefines.h:689
See also
FEA_PART_TYPE
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]typeint FEA Part type enum (i.e. FEA_RIB)
Returns
string FEA Part ID

◆ AddFeaPolySparPt()

std::string vsp::AddFeaPolySparPt ( const std::string & pspar_id)
extern

Add a point to the end of an FEA Poly Spar and return its ID. The new point is appended after all existing points.

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
string pt_id = AddFeaPolySparPt( pspar_id );
if ( GetFeaPolySparNumPt( pspar_id ) != 3 )
{
Print( "Error: AddFeaPolySparPt" );
__failure++;
}
@ FEA_POLY_SPAR
Definition APIDefines.h:707
int GetFeaPolySparNumPt(const std::string &pspar_id)
std::string AddFeaPolySparPt(const std::string &pspar_id)
See also
InsertFeaPolySparPt, DelFeaPolySparPt, GetFeaPolySparNumPt
Parameters
[in]pspar_idstring FEA Poly Spar part ID
Returns
string ID of the newly added Poly Spar point

◆ AddFeaStruct()

int vsp::AddFeaStruct ( const std::string & geom_id,
bool init_skin = true,
int surfindex = 0 )
extern

Add an FEA Structure to a specified Geom

Warning
init_skin should ALWAYS be set to true.
//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
// The first structure on this Geom lands at index 0, and its ID has to lead
// back to that index.
if ( struct_ind != 0 || NumFeaStructures() != 1 )
{
Print( "ERROR: AddFeaStruct did not add a structure" );
__failure++;
}
string struct_id = GetFeaStructID( pod_id, struct_ind );
if ( struct_id.length() == 0 || GetFeaStructIndex( struct_id ) != struct_ind )
{
Print( "ERROR: AddFeaStruct did not give the structure a usable ID" );
__failure++;
}
// init_skin defaults to true, so the structure starts with an FEA Skin.
if ( NumFeaParts( struct_id ) != 1 )
{
Print( "ERROR: AddFeaStruct did not initialize the skin" );
__failure++;
}
int NumFeaParts(const std::string &fea_struct_id)
int GetFeaStructIndex(const std::string &struct_id)
Parameters
[in]geom_idstring Parent Geom ID
[in]init_skinbool Flag to initialize the FEA Structure by creating an FEA Skin from the parent Geom's OML at surfindex
[in]surfindexint Main surface index for the FEA Structure
Returns
int FEA Structure index

◆ AddFeaStructureToAssembly()

void vsp::AddFeaStructureToAssembly ( const std::string & assembly_id,
const std::string & struct_id )
extern

Add an FEA Structure to an FEA Assembly

string pod_id = AddGeom( "POD" );
int struct_ind_1 = AddFeaStruct( pod_id );
int struct_ind_2 = AddFeaStruct( pod_id );
string struct_id_1 = GetFeaStructID( pod_id, struct_ind_1 );
string struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 );
string assembly_id = AddFeaAssembly();
AddFeaStructureToAssembly( assembly_id, struct_id_1 );
AddFeaStructureToAssembly( assembly_id, struct_id_2 );
array< string > @struct_ids = GetFeaAssemblyStructureIDVec( assembly_id );
if ( struct_ids.size() != 2 || struct_ids[0] != struct_id_1 || struct_ids[1] != struct_id_2 )
{
Print( "ERROR: the assembly does not hold the Structures it was given" );
__failure++;
}
// A Structure that does not exist has to be rejected.
AddFeaStructureToAssembly( assembly_id, "NOSUCHSTRUCT" );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: AddFeaStructureToAssembly accepted a bad Structure ID" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
std::vector< std::string > GetFeaAssemblyStructureIDVec(const std::string &assembly_id)
See also
AddFeaAssembly, DeleteFeaStructureFromAssembly, GetFeaAssemblyStructureIDVec
Parameters
[in]assembly_idstring FEA Assembly ID
[in]struct_idstring FEA Structure ID

◆ AddFeaSubSurf()

std::string vsp::AddFeaSubSurf ( const std::string & geom_id,
int fea_struct_ind,
int type )
extern

Add an FEA SubSurface to a Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Add LineArray ====//
string line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY );
SetParmVal( FindParm( line_array_id, "ConstLineType", "SS_LineArray" ), 1 ); // Constant W
SetParmVal( FindParm( line_array_id, "Spacing", "SS_LineArray" ), 0.25 );
if ( line_array_id.length() == 0 || line_array_id == "NONE" )
{
Print( "ERROR: AddFeaSubSurf returned no id" );
__failure++;
}
@ SS_LINE_ARRAY
std::string AddFeaSubSurf(const std::string &geom_id, int fea_struct_ind, int type)
See also
SUBSURF_TYPE
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]typeint FEA SubSurface type enum (i.e. SS_ELLIPSE)
Returns
string FEA SubSurface ID

◆ AddFeaTrimPart()

void vsp::AddFeaTrimPart ( const std::string & trim_id,
const std::string & part_id )
extern

Get the total number of FEA Structures in the vehicle

//==== Add Pod Geometry ====//
string wing_id = AddGeom( "WING" );
//==== Add FeaStructure to Pod ====//
int struct_1 = AddFeaStruct( wing_id );
int struct_2 = AddFeaStruct( wing_id );
if ( NumFeaStructures() != 2 )
{
Print( "Error: NumFeaStructures" );
__failure++;
}
See also
GetFeaStructIDVec
Returns
int Total Number of FEA Structures

Add an FEA Assembly. An assembly gathers several FEA Structures and the connections between them so they can be meshed and written out as one model.

string assembly_id = AddFeaAssembly();
if ( assembly_id.length() == 0 || NumFeaAssemblies() != 1 )
{
Print( "ERROR: AddFeaAssembly did not add an assembly" );
__failure++;
}
array< string > @assy_ids = GetFeaAssemblyIDVec();
if ( assy_ids.size() != 1 || assy_ids[0] != assembly_id )
{
Print( "ERROR: the assembly is not in the assembly list" );
__failure++;
}
// A new assembly is named and holds nothing yet.
if ( GetFeaAssemblyName( assembly_id ).length() == 0 )
{
Print( "ERROR: AddFeaAssembly did not name the assembly" );
__failure++;
}
if ( GetFeaAssemblyStructureIDVec( assembly_id ).size() != 0 )
{
Print( "ERROR: a new assembly already holds structures" );
__failure++;
}
std::string GetFeaAssemblyName(const std::string &assembly_id)
int NumFeaAssemblies()
std::vector< std::string > GetFeaAssemblyIDVec()
See also
DeleteFeaAssembly, AddFeaStructureToAssembly, ComputeFeaAssemblyMesh
Returns
string FEA Assembly ID

Add an FEA Part to the list a Trim part trims against. This is the Trim part's Add button.

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
int struct_ind = AddFeaStruct( pod_id );
//==== A Trim part and something for it to trim against ====//
string trim_id = AddFeaPart( pod_id, struct_ind, FEA_TRIM );
string slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
if ( GetFeaTrimPartIDVec( trim_id ).size() != 0 )
{
Print( "ERROR: a new Trim part already trims against something" );
__failure++;
}
AddFeaTrimPart( trim_id, slice_id );
array< string > @trim_parts = GetFeaTrimPartIDVec( trim_id );
if ( trim_parts.size() != 1 || trim_parts[0] != slice_id )
{
Print( "ERROR: AddFeaTrimPart did not add the part" );
__failure++;
}
DeleteFeaTrimPart( trim_id, 0 );
if ( GetFeaTrimPartIDVec( trim_id ).size() != 0 )
{
Print( "ERROR: DeleteFeaTrimPart did not remove the part" );
__failure++;
}
// An FEA Part that is not a Trim part has to be rejected.
AddFeaTrimPart( slice_id, slice_id );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: AddFeaTrimPart accepted a part that is not a Trim part" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
@ FEA_TRIM
Definition APIDefines.h:706
void DeleteFeaTrimPart(const std::string &trim_id, int index)
std::vector< std::string > GetFeaTrimPartIDVec(const std::string &trim_id)
void AddFeaTrimPart(const std::string &trim_id, const std::string &part_id)
See also
DeleteFeaTrimPart, GetFeaTrimPartIDVec
Parameters
[in]trim_idstring FEA Trim part ID
[in]part_idstring FEA Part ID to trim against

◆ ComputeFeaMesh() [1/2]

void vsp::ComputeFeaMesh ( const std::string & geom_id,
int fea_struct_ind,
int file_type )
extern

Compute an FEA Mesh for a Structure. Only a single output file can be generated with this function.

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Generate FEA Mesh and Export ====//
Print( string( "--> Generating FeaMesh " ) );
//==== Get Parent Geom ID and Index ====//
string parent_id = GetFeaStructParentGeomID( struct_id ); // same as pod_id
//==== Keep the mesh coarse so the example runs quickly ====//
SetFeaMeshVal( parent_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 );
SetFeaMeshFileName( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME, "FEAMeshTest_calculix.dat" );
ComputeFeaMesh( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME );
// Could also call ComputeFeaMesh ( struct_id, FEA_CALCULIX_FILE_NAME );
// FEA Mesh reports nothing through the Results Manager, so the output file
// is the evidence that it ran.
file __f;
if ( __f.open( "FEAMeshTest_calculix.dat", "r" ) < 0 )
{
Print( "ERROR: ComputeFeaMesh wrote no file" );
__failure++;
}
else
{
if ( __f.getSize() <= 0 )
{
Print( "ERROR: ComputeFeaMesh wrote an empty file" );
__failure++;
}
__f.close();
}
@ CFD_MAX_EDGE_LEN
Definition APIDefines.h:220
@ FEA_CALCULIX_FILE_NAME
Definition APIDefines.h:627
std::string GetFeaStructParentGeomID(const std::string &struct_id)
void ComputeFeaMesh(const std::string &geom_id, int fea_struct_ind, int file_type)
See also
SetFeaMeshFileName, FEA_EXPORT_TYPE
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]file_typeint FEA output file type enum (i.e. FEA_EXPORT_TYPE)

◆ ComputeFeaMesh() [2/2]

void vsp::ComputeFeaMesh ( const std::string & struct_id,
int file_type )
extern

Compute an FEA Mesh for a Structure. Only a single output file can be generated with this function.

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Generate FEA Mesh and Export ====//
Print( string( "--> Generating FeaMesh " ) );
//==== Get Parent Geom ID and Index ====//
string parent_id = GetFeaStructParentGeomID( struct_id ); // same as pod_id
//==== Keep the mesh coarse so the example runs quickly ====//
SetFeaMeshVal( parent_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 );
SetFeaMeshFileName( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME, "FEAMeshTest_calculix.dat" );
ComputeFeaMesh( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME );
// Could also call ComputeFeaMesh ( struct_id, FEA_CALCULIX_FILE_NAME );
// FEA Mesh reports nothing through the Results Manager, so the output file
// is the evidence that it ran.
file __f;
if ( __f.open( "FEAMeshTest_calculix.dat", "r" ) < 0 )
{
Print( "ERROR: ComputeFeaMesh wrote no file" );
__failure++;
}
else
{
if ( __f.getSize() <= 0 )
{
Print( "ERROR: ComputeFeaMesh wrote an empty file" );
__failure++;
}
__f.close();
}
See also
SetFeaMeshFileName, FEA_EXPORT_TYPE
Parameters
[in]struct_idstring FEA Structure index
[in]file_typeint FEA output file type enum (i.e. FEA_EXPORT_TYPE)

◆ DelAllFeaPolySparPt()

void vsp::DelAllFeaPolySparPt ( const std::string & pspar_id)
extern

Delete all points from an FEA Poly Spar.

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
AddFeaPolySparPt( pspar_id );
AddFeaPolySparPt( pspar_id );
DelAllFeaPolySparPt( pspar_id );
if ( GetFeaPolySparNumPt( pspar_id ) != 0 )
{
Print( "Error: DelAllFeaPolySparPt" );
__failure++;
}
void DelAllFeaPolySparPt(const std::string &pspar_id)
See also
DelFeaPolySparPt, AddFeaPolySparPt, GetFeaPolySparNumPt
Parameters
[in]pspar_idstring FEA Poly Spar part ID

◆ DeleteFeaAssembly()

void vsp::DeleteFeaAssembly ( const std::string & assembly_id)
extern

Delete an FEA Assembly. The Structures it gathered are left in the model.

string pod_id = AddGeom( "POD" );
int struct_ind = AddFeaStruct( pod_id );
string assembly_id = AddFeaAssembly();
AddFeaStructureToAssembly( assembly_id, GetFeaStructID( pod_id, struct_ind ) );
DeleteFeaAssembly( assembly_id );
if ( NumFeaAssemblies() != 0 )
{
Print( "ERROR: DeleteFeaAssembly did not remove the assembly" );
__failure++;
}
// The Structure it held survives.
if ( NumFeaStructures() != 1 )
{
Print( "ERROR: DeleteFeaAssembly removed the Structure it gathered" );
__failure++;
}
// An ID that is not an assembly has to be rejected.
DeleteFeaAssembly( "NOSUCHASSEMBLY" );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DeleteFeaAssembly accepted a bad ID" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void DeleteFeaAssembly(const std::string &assembly_id)
See also
AddFeaAssembly, GetFeaAssemblyIDVec
Parameters
[in]assembly_idstring FEA Assembly ID

◆ DeleteFeaAssemblyConnection()

void vsp::DeleteFeaAssemblyConnection ( const std::string & assembly_id,
int connection_index )
extern

Delete a connection from an FEA Assembly

See also
AddFeaAssemblyConnection, NumFeaAssemblyConnections
Parameters
[in]assembly_idstring FEA Assembly ID
[in]connection_indexint Connection index

◆ DeleteFeaLayer()

void vsp::DeleteFeaLayer ( const std::string & material_id,
const std::string & layer_id )
extern

Delete a layer from an FEA laminate material

See also
AddFeaLayer, GetFeaLayerIDVec
Parameters
[in]material_idstring FEA Material ID of a laminate
[in]layer_idstring FEA Layer ID

◆ DeleteFeaMaterial()

void vsp::DeleteFeaMaterial ( const std::string & id)
extern

Delete an FEA Material from the FEA Mesh material library. Only materials created with AddFeaMaterial can be deleted; the built in materials belong to the library.

//==== Create FeaMaterial ====//
string mat_id = AddFeaMaterial();
int num_before = GetFeaMaterialIDVec().size();
if ( int( GetFeaMaterialIDVec().size() ) != num_before - 1 )
{
Print( "ERROR: DeleteFeaMaterial did not remove the material" );
__failure++;
}
// An ID that is not a material has to be rejected.
DeleteFeaMaterial( "NOSUCHMATERIAL" );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DeleteFeaMaterial accepted a bad ID" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void DeleteFeaMaterial(const std::string &id)
See also
AddFeaMaterial, GetFeaMaterialIDVec
Parameters
[in]idstring FEA Material ID

◆ DeleteFeaPart()

void vsp::DeleteFeaPart ( const std::string & geom_id,
int fea_struct_ind,
const std::string & part_id )
extern

Delete an FEA Part from a Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Add Bulkead ====//
string bulkhead_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
//==== Add Fixed Point ====//
string fixed_id = AddFeaPart( pod_id, struct_ind, FEA_FIX_POINT );
string struct_id = GetFeaStructID( pod_id, struct_ind );
// The skin, the bulkhead and the fixed point.
int num_before = NumFeaParts( struct_id );
if ( num_before != 3 )
{
Print( "ERROR: the parts were not all added" );
__failure++;
}
//==== Delete Bulkead ====//
DeleteFeaPart( pod_id, struct_ind, bulkhead_id );
// Only the named part goes; the fixed point stays.
if ( NumFeaParts( struct_id ) != num_before - 1 )
{
Print( "ERROR: DeleteFeaPart did not remove the part" );
__failure++;
}
if ( GetFeaPartName( fixed_id ).length() == 0 )
{
Print( "ERROR: DeleteFeaPart removed the wrong part" );
__failure++;
}
void DeleteFeaPart(const std::string &geom_id, int fea_struct_ind, const std::string &part_id)
std::string GetFeaPartName(const std::string &part_id)
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]part_idstring FEA Part ID

◆ DeleteFeaProperty()

void vsp::DeleteFeaProperty ( const std::string & id)
extern

Delete an FEA Property from the FEA Mesh property library

//==== Create FeaProperty ====//
string prop_id = AddFeaProperty();
int num_before = GetFeaPropertyIDVec().size();
DeleteFeaProperty( prop_id );
if ( int( GetFeaPropertyIDVec().size() ) != num_before - 1 )
{
Print( "ERROR: DeleteFeaProperty did not remove the property" );
__failure++;
}
// An ID that is not a property has to be rejected.
DeleteFeaProperty( "NOSUCHPROPERTY" );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DeleteFeaProperty accepted a bad ID" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void DeleteFeaProperty(const std::string &id)
std::vector< std::string > GetFeaPropertyIDVec()
See also
AddFeaProperty, GetFeaPropertyIDVec
Parameters
[in]idstring FEA Property ID

◆ DeleteFeaStruct()

void vsp::DeleteFeaStruct ( const std::string & geom_id,
int fea_struct_ind )
extern

Delete an FEA Structure and all FEA Parts and FEA SubSurfaces associated with it

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind_1 = AddFeaStruct( pod_id );
int struct_ind_2 = AddFeaStruct( pod_id );
string struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 );
if ( NumFeaStructures() != 2 )
{
Print( "ERROR: the two structures were not both added" );
__failure++;
}
DeleteFeaStruct( pod_id, struct_ind_1 );
// Deleting the first structure leaves the second one, which slides down to
// take its index.
if ( NumFeaStructures() != 1 )
{
Print( "ERROR: DeleteFeaStruct did not remove the structure" );
__failure++;
}
if ( GetFeaStructID( pod_id, 0 ) != struct_id_2 )
{
Print( "ERROR: DeleteFeaStruct removed the wrong structure" );
__failure++;
}
void DeleteFeaStruct(const std::string &geom_id, int fea_struct_ind)
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index

◆ DeleteFeaStructureFromAssembly()

void vsp::DeleteFeaStructureFromAssembly ( const std::string & assembly_id,
const std::string & struct_id )
extern

Remove an FEA Structure from an FEA Assembly. The Structure itself is left in the model.

string pod_id = AddGeom( "POD" );
int struct_ind_1 = AddFeaStruct( pod_id );
int struct_ind_2 = AddFeaStruct( pod_id );
string struct_id_1 = GetFeaStructID( pod_id, struct_ind_1 );
string struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 );
string assembly_id = AddFeaAssembly();
AddFeaStructureToAssembly( assembly_id, struct_id_1 );
AddFeaStructureToAssembly( assembly_id, struct_id_2 );
DeleteFeaStructureFromAssembly( assembly_id, struct_id_1 );
// Only the named Structure leaves the assembly, and it survives in the model.
array< string > @struct_ids = GetFeaAssemblyStructureIDVec( assembly_id );
if ( struct_ids.size() != 1 || struct_ids[0] != struct_id_2 )
{
Print( "ERROR: DeleteFeaStructureFromAssembly removed the wrong Structure" );
__failure++;
}
if ( NumFeaStructures() != 2 )
{
Print( "ERROR: DeleteFeaStructureFromAssembly deleted the Structure itself" );
__failure++;
}
// A Structure the assembly does not hold has to be rejected.
DeleteFeaStructureFromAssembly( assembly_id, struct_id_1 );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DeleteFeaStructureFromAssembly accepted a Structure it does not hold" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void DeleteFeaStructureFromAssembly(const std::string &assembly_id, const std::string &struct_id)
See also
AddFeaStructureToAssembly, GetFeaAssemblyStructureIDVec
Parameters
[in]assembly_idstring FEA Assembly ID
[in]struct_idstring FEA Structure ID

◆ DeleteFeaSubSurf()

void vsp::DeleteFeaSubSurf ( const std::string & geom_id,
int fea_struct_ind,
const std::string & ss_id )
extern

Delete an FEA SubSurface from a Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Add LineArray ====//
string line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY );
//==== Add Rectangle ====//
string rect_id = AddFeaSubSurf( pod_id, struct_ind, SS_RECTANGLE );
string struct_id = GetFeaStructID( pod_id, struct_ind );
int num_before = NumFeaSubSurfs( struct_id );
//==== Delete LineArray ====//
DeleteFeaSubSurf( pod_id, struct_ind, line_array_id );
if ( NumFeaSubSurfs( struct_id ) != num_before - 1 )
{
Print( "ERROR: DeleteFeaSubSurf did not remove the sub-surface" );
__failure++;
}
@ SS_RECTANGLE
void DeleteFeaSubSurf(const std::string &geom_id, int fea_struct_ind, const std::string &ss_id)
int NumFeaSubSurfs(const std::string &fea_struct_id)
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]ss_idstring FEA SubSurface ID

◆ DeleteFeaTrimPart()

void vsp::DeleteFeaTrimPart ( const std::string & trim_id,
int index )
extern

Remove an entry from the list a Trim part trims against

See also
AddFeaTrimPart, GetFeaTrimPartIDVec
Parameters
[in]trim_idstring FEA Trim part ID
[in]indexint Trim entry index

◆ DelFeaBC()

void vsp::DelFeaBC ( const std::string & fea_struct_id,
const std::string & bc_id )
extern

Delete an FEA BC from a Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Add BC ====//
string bc_id = AddFeaBC( struct_id, FEA_BC_STRUCTURE );
if ( NumFeaBCs( struct_id ) != 1 )
{
Print( "ERROR: AddFeaBC did not add a boundary condition" );
__failure++;
}
DelFeaBC( struct_id, bc_id );
if ( NumFeaBCs( struct_id ) != 0 )
{
Print( "ERROR: DelFeaBC did not remove the boundary condition" );
__failure++;
}
if ( GetFeaBCIDVec( struct_id ).size() != 0 )
{
Print( "ERROR: DelFeaBC left the boundary condition in the ID list" );
__failure++;
}
void DelFeaBC(const std::string &fea_struct_id, const std::string &bc_id)
int NumFeaBCs(const std::string &fea_struct_id)
std::vector< std::string > GetFeaBCIDVec(const std::string &fea_struct_id)
See also
FEA_BC_TYPE
Parameters
[in]fea_struct_idstring FEA Structure ID
[in]bc_idint FEA BC ID

◆ DelFeaPolySparPt()

void vsp::DelFeaPolySparPt ( const std::string & pspar_id,
int index )
extern

Delete the point at the given index from an FEA Poly Spar.

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
AddFeaPolySparPt( pspar_id );
AddFeaPolySparPt( pspar_id );
// Delete the point at index 1 (leaving 3 points)
DelFeaPolySparPt( pspar_id, 2 );
if ( GetFeaPolySparNumPt( pspar_id ) != 3 )
{
Print( "Error: DelFeaPolySparPt" );
__failure++;
}
void DelFeaPolySparPt(const std::string &pspar_id, int index)
See also
DelAllFeaPolySparPt, AddFeaPolySparPt, GetFeaPolySparNumPt
Parameters
[in]pspar_idstring FEA Poly Spar part ID
[in]indexint Index of the point to delete

◆ GetAllFeaPolySparPtIDVec()

std::vector< std::string > vsp::GetAllFeaPolySparPtIDVec ( const std::string & pspar_id)
extern

Get a vector of IDs for all points in an FEA Poly Spar. Each ID is a ParmContainer ID that can be used with FindParm to access the point's parameters such as Eta, U01, U0N, and XoC.

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
AddFeaPolySparPt( pspar_id );
array < string > pt_ids = GetAllFeaPolySparPtIDVec( pspar_id );
if ( pt_ids.size() != 3 )
{
Print( "Error: GetAllFeaPolySparPtIDVec" );
__failure++;
}
// Set each point's spanwise eta location
SetParmVal( FindParm( pt_ids[0], "Eta", "FeaPolySparPoint" ), 0.1 );
SetParmVal( FindParm( pt_ids[1], "Eta", "FeaPolySparPoint" ), 0.5 );
SetParmVal( FindParm( pt_ids[2], "Eta", "FeaPolySparPoint" ), 0.9 );
std::vector< std::string > GetAllFeaPolySparPtIDVec(const std::string &pspar_id)
See also
GetFeaPolySparPtID, FindParm, SetParmVal
Parameters
[in]pspar_idstring FEA Poly Spar part ID
Returns
vector <string> Vector of Poly Spar point ParmContainer IDs

◆ GetFeaAssemblyFileName()

std::string vsp::GetFeaAssemblyFileName ( const std::string & assembly_id,
int file_type )
extern

Mesh and write out an FEA Assembly. Any Structure in the assembly that has not been meshed yet is meshed first.

string pod_id = AddGeom( "POD" );
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Keep the mesh coarse so the example runs quickly ====//
SetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 );
string assembly_id = AddFeaAssembly();
SetFeaAssemblyName( assembly_id, "ExampleAssembly" );
AddFeaStructureToAssembly( assembly_id, struct_id );
string out_name = GetFeaAssemblyFileName( assembly_id, FEA_CALCULIX_FILE_NAME );
ComputeFeaAssemblyMesh( assembly_id );
// The assembly writes the Calculix deck it named.
file __f;
if ( __f.open( out_name, "r" ) < 0 )
{
Print( "ERROR: ComputeFeaAssemblyMesh wrote no file" );
__failure++;
}
else
{
if ( __f.getSize() <= 0 )
{
Print( "ERROR: ComputeFeaAssemblyMesh wrote an empty file" );
__failure++;
}
__f.close();
}
void SetFeaAssemblyName(const std::string &assembly_id, const std::string &name)
std::string GetFeaAssemblyFileName(const std::string &assembly_id, int file_type)
See also
AddFeaAssembly, AddFeaStructureToAssembly
Parameters
[in]assembly_idstring FEA Assembly ID

Get the name of an FEA Assembly output file. The names are built from the assembly name when it is set, so this reports where ComputeFeaAssemblyMesh will write.

See also
SetFeaAssemblyFileName, ComputeFeaAssemblyMesh, FEA_EXPORT_TYPE
Parameters
[in]assembly_idstring FEA Assembly ID
[in]file_typeint FEA output file type enum (i.e. FEA_CALCULIX_FILE_NAME)
Returns
string Name of the output file

◆ GetFeaAssemblyIDVec()

std::vector< std::string > vsp::GetFeaAssemblyIDVec ( )
extern

Get the IDs of every FEA Assembly in the model

string first = AddFeaAssembly();
string second = AddFeaAssembly();
array< string > @assy_ids = GetFeaAssemblyIDVec();
// Assemblies come back in the order they were added.
if ( assy_ids.size() != 2 || assy_ids[0] != first || assy_ids[1] != second )
{
Print( "ERROR: GetFeaAssemblyIDVec did not report the assemblies in order" );
__failure++;
}
See also
AddFeaAssembly, NumFeaAssemblies
Returns
vector<string> Array of FEA Assembly IDs

◆ GetFeaAssemblyName()

std::string vsp::GetFeaAssemblyName ( const std::string & assembly_id)
extern

Get the name of an FEA Assembly

string assembly_id = AddFeaAssembly();
SetFeaAssemblyName( assembly_id, "ExampleAssembly" );
if ( GetFeaAssemblyName( assembly_id ) != "ExampleAssembly" )
{
Print( "ERROR: GetFeaAssemblyName did not report the name that was set" );
__failure++;
}
// An ID that is not an assembly has to be rejected.
GetFeaAssemblyName( "NOSUCHASSEMBLY" );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetFeaAssemblyName accepted a bad ID" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
See also
AddFeaAssembly, SetFeaAssemblyName
Parameters
[in]assembly_idstring FEA Assembly ID
Returns
string FEA Assembly name

◆ GetFeaAssemblyStructureIDVec()

std::vector< std::string > vsp::GetFeaAssemblyStructureIDVec ( const std::string & assembly_id)
extern

Get the IDs of the FEA Structures gathered by an FEA Assembly

See also
AddFeaStructureToAssembly, DeleteFeaStructureFromAssembly
Parameters
[in]assembly_idstring FEA Assembly ID
Returns
vector<string> Array of FEA Structure IDs

◆ GetFeaBCIDVec()

std::vector< std::string > vsp::GetFeaBCIDVec ( const std::string & fea_struct_id)
extern

Return a vector of FEA BC ID's for a structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Add BC ====//
string bc_id = AddFeaBC( struct_id, FEA_BC_STRUCTURE );
array < string > bc_id_vec = GetFeaBCIDVec( struct_id );
if ( bc_id_vec.length() == 0 )
{
Print( "ERROR: GetFeaBCIDVec returned nothing" );
__failure++;
}
Parameters
[in]fea_struct_idstring FEA Structure ID
Returns
vector<string> Array of FEA BC IDs

◆ GetFeaLayerIDVec()

std::vector< std::string > vsp::GetFeaLayerIDVec ( const std::string & material_id)
extern

Get the IDs of every layer in an FEA laminate material

See also
AddFeaLayer, DeleteFeaLayer
Parameters
[in]material_idstring FEA Material ID of a laminate
Returns
vector<string> Array of FEA Layer IDs

◆ GetFeaMeshFileName()

std::string vsp::GetFeaMeshFileName ( const std::string & geom_id,
int fea_struct_ind,
int file_type )
extern

Set the name of a particular FEA Mesh output file for a specified Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//=== Set Export File Name ===//
string export_name = "FEAMeshTest_calculix.dat";
//==== Get Parent Geom ID and Index ====//
string parent_id = GetFeaStructParentGeomID( struct_id ); // same as pod_id
if ( parent_id != pod_id )
{
Print( "ERROR: GetFeaStructParentGeomID did not report the parent Geom" );
__failure++;
}
SetFeaMeshFileName( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME, export_name );
// Keep the mesh coarse so the example runs quickly, then mesh to prove the
// name that was set is the name that gets written.
SetFeaMeshVal( parent_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 );
ComputeFeaMesh( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME );
file __f;
if ( __f.open( export_name, "r" ) < 0 )
{
Print( "ERROR: SetFeaMeshFileName did not name the output file" );
__failure++;
}
else
{
if ( __f.getSize() <= 0 )
{
Print( "ERROR: the FEA mesh output file is empty" );
__failure++;
}
__f.close();
}
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]file_typeint FEA output file type enum (i.e. FEA_EXPORT_TYPE)
[in]file_namestring Name for the output file

Get the name of a particular FEA Mesh output file for a specified Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string export_name = "FEAMeshTest_calculix.dat";
SetFeaMeshFileName( pod_id, struct_ind, FEA_CALCULIX_FILE_NAME, export_name );
if ( GetFeaMeshFileName( pod_id, struct_ind, FEA_CALCULIX_FILE_NAME ) != export_name )
{
Print( "ERROR: GetFeaMeshFileName did not report the name that was set" );
__failure++;
}
// Each output type carries its own name.
SetFeaMeshFileName( pod_id, struct_ind, FEA_NASTRAN_FILE_NAME, "FEAMeshTest_nastran.dat" );
if ( GetFeaMeshFileName( pod_id, struct_ind, FEA_CALCULIX_FILE_NAME ) != export_name )
{
Print( "ERROR: setting one output name disturbed another" );
__failure++;
}
@ FEA_NASTRAN_FILE_NAME
Definition APIDefines.h:625
std::string GetFeaMeshFileName(const std::string &geom_id, int fea_struct_ind, int file_type)
See also
FEA_EXPORT_TYPE, SetFeaMeshFileName
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]file_typeint FEA output file type enum (i.e. FEA_EXPORT_TYPE)
Returns
string Name of the output file

◆ GetFeaMeshStructIndex()

int vsp::GetFeaMeshStructIndex ( )
extern

Sets FeaMeshMgr m_FeaMeshStructIndex member using passed in index of a FeaStructure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
SetFeaMeshStructIndex( struct_ind );
if ( FindGeoms().size() != 1 ) { Print( "ERROR: SetFeaMeshStructIndex" ); __failure++; }
std::vector< std::string > FindGeoms()

Get the index of the FEA Structure the FEA Mesh Manager is currently pointed at

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
int struct_ind_2 = AddFeaStruct( pod_id );
SetFeaMeshStructIndex( struct_ind_2 );
if ( GetFeaMeshStructIndex() != struct_ind_2 )
{
Print( "ERROR: GetFeaMeshStructIndex did not report the Structure that was set" );
__failure++;
}
SetFeaMeshStructIndex( struct_ind );
if ( GetFeaMeshStructIndex() != struct_ind )
{
Print( "ERROR: GetFeaMeshStructIndex did not follow a second set" );
__failure++;
}
int GetFeaMeshStructIndex()
See also
SetFeaMeshStructIndex
Returns
int FEA Structure index

◆ GetFeaMeshVal()

double vsp::GetFeaMeshVal ( const std::string & geom_id,
int fea_struct_ind,
int type )
extern

Set the value of a particular FEA Mesh option for the specified Structure. Note, FEA Mesh makes use of enums initially created for CFD Mesh but not all CFD Mesh options are available for FEA Mesh.

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Adjust FeaMeshSettings ====//
SetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 );
SetFeaMeshVal( pod_id, struct_ind, CFD_MIN_EDGE_LEN, 0.2 );
// The options are backed by Parms on the Structure, in its grid density
// group, so the values that were set can be read back.
string struct_id = GetFeaStructID( pod_id, struct_ind );
if ( !closeTo( GetParmVal( FindParm( struct_id, "BaseLen", "FEAGridDensity" ) ), 0.75, 1e-12 ) )
{
Print( "ERROR: SetFeaMeshVal did not set CFD_MAX_EDGE_LEN" );
__failure++;
}
if ( !closeTo( GetParmVal( FindParm( struct_id, "MinLen", "FEAGridDensity" ) ), 0.2, 1e-12 ) )
{
Print( "ERROR: SetFeaMeshVal did not set CFD_MIN_EDGE_LEN" );
__failure++;
}
@ CFD_MIN_EDGE_LEN
Definition APIDefines.h:219
double GetParmVal(const std::string &parm_id)
See also
CFD_CONTROL_TYPE
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]typeint FEA Mesh option type enum (i.e. CFD_MAX_EDGE_LEN)
[in]valdouble Value the option is set to

Get the value of a specific FEA Mesh option for the specified Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
SetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 );
if ( !closeTo( GetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN ), 0.75, 1e-12 ) )
{
Print( "ERROR: GetFeaMeshVal did not report the value that was set" );
__failure++;
}
// Each Structure carries its own settings.
int struct_ind_2 = AddFeaStruct( pod_id );
SetFeaMeshVal( pod_id, struct_ind_2, CFD_MAX_EDGE_LEN, 0.25 );
if ( !closeTo( GetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN ), 0.75, 1e-12 ) )
{
Print( "ERROR: setting one Structure disturbed another" );
__failure++;
}
// A control type FEA Mesh does not use has to be rejected.
GetFeaMeshVal( pod_id, struct_ind, CFD_FAR_FIELD_FLAG );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetFeaMeshVal accepted a control type FEA Mesh does not use" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
@ CFD_FAR_FIELD_FLAG
Definition APIDefines.h:227
double GetFeaMeshVal(const std::string &geom_id, int fea_struct_ind, int type)
See also
CFD_CONTROL_TYPE, SetFeaMeshVal
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]typeint FEA Mesh option type enum (i.e. CFD_MAX_EDGE_LEN)
Returns
double Value of the option

◆ GetFeaPartID()

std::string vsp::GetFeaPartID ( const std::string & fea_struct_id,
int fea_part_index )
extern

Get the Parm ID of an FEA Part, identified from a FEA Structure Parm ID and FEA Part index.

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Add Bulkead ====//
string bulkhead_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
if ( bulkhead_id != GetFeaPartID( struct_id, 1 ) ) // These should be equivalent (index 0 is skin)
{
Print( "Error: GetFeaPartID" );
__failure++;
}
std::string GetFeaPartID(const std::string &fea_struct_id, int fea_part_index)
Parameters
[in]fea_struct_idstring FEA Structure ID
[in]fea_part_indexint FEA Part index
Returns
string FEA Part ID

◆ GetFeaPartIDVec()

std::vector< std::string > vsp::GetFeaPartIDVec ( const std::string & fea_struct_id)
extern

Get the IDs of all FEA Parts in the given FEA Structure

//==== Add Geometries ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Add FEA Parts ====//
string slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
string dome_id = AddFeaPart( pod_id, struct_ind, FEA_DOME );
array < string > part_id_vec = GetFeaPartIDVec( struct_id ); // Should include slice_id & dome_id
if ( part_id_vec.length() == 0 )
{
Print( "ERROR: GetFeaPartIDVec returned nothing" );
__failure++;
}
@ FEA_DOME
Definition APIDefines.h:702
std::vector< std::string > GetFeaPartIDVec(const std::string &fea_struct_id)
See also
NumFeaParts
Parameters
[in]fea_struct_idstring FEA Structure ID
Returns
vector<string> Array of FEA Part IDs

◆ GetFeaPartName()

std::string vsp::GetFeaPartName ( const std::string & part_id)
extern

Get the name of an FEA Part

//==== Add Fuselage Geometry ====//
string fuse_id = AddGeom( "FUSELAGE" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( fuse_id );
//==== Add Bulkead ====//
string bulkhead_id = AddFeaPart( fuse_id, struct_ind, FEA_SLICE );
string name = "example_name";
SetFeaPartName( bulkhead_id, name );
if ( name != GetFeaPartName( bulkhead_id ) ) // These should be equivalent
{
Print( "Error: GetFeaPartName" );
__failure++;
}
void SetFeaPartName(const std::string &part_id, const std::string &name)
See also
SetFeaPartName
Parameters
[in]part_idstring FEA Part ID
Returns
string FEA Part name

◆ GetFeaPartPerpendicularSparID()

std::string vsp::GetFeaPartPerpendicularSparID ( const std::string & part_id)
extern

Get the ID of the perpendicular spar for an FEA Rib or Rib Array. Note, the FEA Rib or Rib Array doesn't have to have "SPAR_NORMAL" set for the "PerpendicularEdgeType" Parm for this function to still return a value.

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
//==== Add FeaStructure to Wing ====//
int struct_ind = AddFeaStruct( wing_id );
//==== Add Rib ====//
string rib_id = AddFeaPart( wing_id, struct_ind, FEA_RIB );
//==== Add Spars ====//
string spar_id_1 = AddFeaPart( wing_id, struct_ind, FEA_SPAR );
string spar_id_2 = AddFeaPart( wing_id, struct_ind, FEA_SPAR );
SetParmVal( FindParm( spar_id_1, "RelCenterLocation", "FeaPart" ), 0.25 );
SetParmVal( FindParm( spar_id_2, "RelCenterLocation", "FeaPart" ), 0.75 );
//==== Set Perpendicular Edge type to SPAR ====//
SetParmVal( FindParm( rib_id, "PerpendicularEdgeType", "FeaRib" ), SPAR_NORMAL );
SetFeaPartPerpendicularSparID( rib_id, spar_id_2 );
if ( spar_id_2 != GetFeaPartPerpendicularSparID( rib_id ) )
{
Print( "Error: GetFeaPartPerpendicularSparID" );
__failure++;
}
@ SPAR_NORMAL
Definition APIDefines.h:718
@ FEA_RIB
Definition APIDefines.h:699
@ FEA_SPAR
Definition APIDefines.h:700
std::string GetFeaPartPerpendicularSparID(const std::string &part_id)
void SetFeaPartPerpendicularSparID(const std::string &part_id, const std::string &perpendicular_spar_id)
See also
FEA_RIB_NORMAL, SetFeaPartPerpendicularSparID
Parameters
[in]part_idstring FEA Part ID (Rib or Rib Array Type)
Returns
string Perpendicular FEA Spar ID

◆ GetFeaPartType()

int vsp::GetFeaPartType ( const std::string & part_id)
extern

Get the type of an FEA Part

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Add Slice ====//
string slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
if ( FEA_SLICE != GetFeaPartType( slice_id ) ) // These should be equivalent
{
Print( "Error: GetFeaPartType" );
__failure++;
}
int GetFeaPartType(const std::string &part_id)
See also
FEA_PART_TYPE
Parameters
[in]part_idstring FEA Part ID
Returns
int FEA Part type enum

◆ GetFeaPolySparNumPt()

int vsp::GetFeaPolySparNumPt ( const std::string & pspar_id)
extern

Get the number of points in an FEA Poly Spar. A newly created Poly Spar contains two points (the inboard and outboard endpoints).

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
// A new Poly Spar starts with 2 points
if ( GetFeaPolySparNumPt( pspar_id ) != 2 )
{
Print( "Error: GetFeaPolySparNumPt" );
__failure++;
}
See also
AddFeaPolySparPt, InsertFeaPolySparPt, DelFeaPolySparPt, DelAllFeaPolySparPt
Parameters
[in]pspar_idstring FEA Poly Spar part ID
Returns
int Number of points in the Poly Spar

◆ GetFeaPolySparPtID()

std::string vsp::GetFeaPolySparPtID ( const std::string & pspar_id,
int index )
extern

Get the ID of a point in an FEA Poly Spar. The returned ID is a ParmContainer ID that can be used with FindParm to access the point's parameters such as Eta, U01, U0N, and XoC.

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
string pt_id = GetFeaPolySparPtID( pspar_id, 0 );
if ( pt_id.length() == 0 )
{
Print( "ERROR: GetFeaPolySparPtID returned nothing" );
__failure++;
}
// Set the spanwise location of the inboard point to eta = 0.1
SetParmVal( FindParm( pt_id, "Eta", "FeaPolySparPoint" ), 0.1 );
string pt_id_1 = GetFeaPolySparPtID( pspar_id, 1 );
// Set the spanwise location of the outboard point to eta = 0.9
SetParmVal( FindParm( pt_id_1, "Eta", "FeaPolySparPoint" ), 0.9 );
std::string GetFeaPolySparPtID(const std::string &pspar_id, int index)
See also
GetAllFeaPolySparPtIDVec, FindParm, SetParmVal
Parameters
[in]pspar_idstring FEA Poly Spar part ID
[in]indexint Index of the point
Returns
string ID of the Poly Spar point ParmContainer

◆ GetFeaPolySparPtName()

std::string vsp::GetFeaPolySparPtName ( const std::string & pspar_id,
int index )
extern

Get the name of a point in an FEA Poly Spar.

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
SetFeaPolySparPtName( pspar_id, 0, "InboardPt" );
string name = GetFeaPolySparPtName( pspar_id, 0 );
if ( name.length() == 0 )
{
Print( "ERROR: GetFeaPolySparPtName returned nothing" );
__failure++;
}
Print( "Point 0 name: " + name );
std::string GetFeaPolySparPtName(const std::string &pspar_id, int index)
void SetFeaPolySparPtName(const std::string &pspar_id, int index, const std::string &name)
See also
SetFeaPolySparPtName
Parameters
[in]pspar_idstring FEA Poly Spar part ID
[in]indexint Index of the point
Returns
string Name of the point

◆ GetFeaPropertyIDVec()

std::vector< std::string > vsp::GetFeaPropertyIDVec ( )
extern

Add aa FEA Property the FEA Mesh property library. Properties are available across all Geoms and Structures. Currently only beam and shell properties are available. Note FEA_SHELL_AND_BEAM is not a valid property type.

//==== Create FeaProperty ====//
string prop_id = AddFeaProperty();
SetParmVal( FindParm( prop_id, "Thickness", "FeaProperty" ), 0.01 );
if ( prop_id.length() == 0 || prop_id == "NONE" )
{
Print( "ERROR: AddFeaProperty returned no id" );
__failure++;
}
See also
FEA_PART_ELEMENT_TYPE
Parameters
[in]property_typeint FEA Property type enum (i.e. FEA_SHELL).
Returns
string FEA Property ID

Get the IDs of every FEA Property in the FEA Mesh property library, including the built in properties as well as any added through AddFeaProperty.

//==== Properties are created as structures need them, so start from
//==== whatever the library already holds ====//
int num_before = GetFeaPropertyIDVec().size();
//==== Create FeaProperty ====//
string prop_id = AddFeaProperty();
array < string > @prop_ids = GetFeaPropertyIDVec();
if ( int( prop_ids.size() ) != num_before + 1 )
{
Print( "ERROR: GetFeaPropertyIDVec did not follow AddFeaProperty" );
__failure++;
}
// The new property has to be in the list.
bool found = false;
for ( int i = 0; i < int( prop_ids.size() ); i++ )
{
if ( prop_ids[i] == prop_id )
{
found = true;
}
}
if ( !found )
{
Print( "ERROR: the property that was added is not in the list" );
__failure++;
}
See also
AddFeaProperty, DeleteFeaProperty
Returns
vector<string> Array of FEA Property IDs

◆ GetFeaStructID()

std::string vsp::GetFeaStructID ( const std::string & geom_id,
int fea_struct_ind )
extern

Get the ID of an FEA Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
if ( struct_id.length() == 0 )
{
Print( "ERROR: GetFeaStructID returned nothing" );
__failure++;
}
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
Returns
string FEA Structure ID

◆ GetFeaStructIDVec()

std::vector< std::string > vsp::GetFeaStructIDVec ( )
extern

Get the IDs of all FEA Structures in the vehicle

//==== Add Geometries ====//
string pod_id = AddGeom( "POD" );
string wing_id = AddGeom( "WING" );
//==== Add FeaStructures ====//
int pod_struct_ind = AddFeaStruct( pod_id );
int wing_struct_ind = AddFeaStruct( wing_id );
array < string > struct_id_vec = GetFeaStructIDVec();
if ( struct_id_vec.length() == 0 )
{
Print( "ERROR: GetFeaStructIDVec returned nothing" );
__failure++;
}
std::vector< std::string > GetFeaStructIDVec()
See also
NumFeaStructures
Returns
vector<string> Array of FEA Structure IDs

◆ GetFeaStructIndex()

int vsp::GetFeaStructIndex ( const std::string & struct_id)
extern

Get the index of an FEA Structure in its Parent Geom's vector of Structures

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind_1 = AddFeaStruct( pod_id );
int struct_ind_2 = AddFeaStruct( pod_id );
string struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 );
DeleteFeaStruct( pod_id, struct_ind_1 );
int struct_ind_2_new = GetFeaStructIndex( struct_id_2 );
// The second structure slides down to fill the gap the first one left.
if ( struct_ind_2 != 1 || struct_ind_2_new != 0 )
{
Print( "ERROR: GetFeaStructIndex did not follow the delete" );
__failure++;
}
// The index has to lead back to the same structure.
if ( GetFeaStructID( pod_id, struct_ind_2_new ) != struct_id_2 )
{
Print( "ERROR: GetFeaStructIndex disagrees with GetFeaStructID" );
__failure++;
}
// An ID that is not a structure has to report -1.
if ( GetFeaStructIndex( "NOSUCHSTRUCT" ) != -1 )
{
Print( "ERROR: GetFeaStructIndex accepted a bad ID" );
__failure++;
}
// That lookup failure was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
Parameters
[in]struct_idstring FEA Structure ID
Returns
int FEA Structure index

◆ GetFeaStructName()

std::string vsp::GetFeaStructName ( const std::string & geom_id,
int fea_struct_ind )
extern

Get the name of an FEA Structure. The FEA Structure name functions as the the Parm Container name

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Get Structure Name ====//
string parm_container_name = GetFeaStructName( pod_id, struct_ind );
if ( parm_container_name.length() == 0 )
{
Print( "ERROR: GetFeaStructName returned nothing" );
__failure++;
}
string display_name = string("Current Structure Parm Container Name: ") + parm_container_name + string("\n");
Print( display_name );
std::string GetFeaStructName(const std::string &geom_id, int fea_struct_ind)
See also
FindContainer, SetFeaStructName
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
Returns
string Name for the FEA Structure

◆ GetFeaStructParentGeomID()

std::string vsp::GetFeaStructParentGeomID ( const std::string & struct_id)
extern

Get the Parent Geom ID for an FEA Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Get Parent Geom ID and Index ====//
string parent_id = GetFeaStructParentGeomID( struct_id );
if ( parent_id.length() == 0 )
{
Print( "ERROR: GetFeaStructParentGeomID returned nothing" );
__failure++;
}
Parameters
[in]struct_idstring FEA Structure ID
Returns
string Parent Geom ID

◆ GetFeaSubSurfIDVec()

std::vector< std::string > vsp::GetFeaSubSurfIDVec ( const std::string & fea_struct_id)
extern

Get the IDs of all FEA SubSurfaces in the given FEA Structure

//==== Add Geometries ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Add SubSurfaces ====//
string line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY );
string rectangle_id = AddFeaSubSurf( pod_id, struct_ind, SS_RECTANGLE );
array < string > part_id_vec = GetFeaSubSurfIDVec( struct_id ); // Should include line_array_id & rectangle_id
if ( part_id_vec.length() == 0 )
{
Print( "ERROR: GetFeaSubSurfIDVec returned nothing" );
__failure++;
}
std::vector< std::string > GetFeaSubSurfIDVec(const std::string &fea_struct_id)
See also
NumFeaSubSurfs
Parameters
[in]fea_struct_idstring FEA Structure ID
Returns
vector<string> Array of FEA Part IDs

◆ GetFeaSubSurfIndex()

int vsp::GetFeaSubSurfIndex ( const std::string & ss_id)
extern

Get the index of an FEA SubSurface give the SubSurface ID

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Add Slice ====//
string slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
//==== Add LineArray ====//
string line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY );
//==== Add Rectangle ====//
string rect_id = AddFeaSubSurf( pod_id, struct_ind, SS_RECTANGLE );
if ( 1 != GetFeaSubSurfIndex( rect_id ) ) // These should be equivalent
{
Print( "Error: GetFeaSubSurfIndex" );
__failure++;
}
int GetFeaSubSurfIndex(const std::string &ss_id)
Parameters
[in]ss_idstring FEA SubSurface ID
Returns
int FEA SubSurface Index

◆ GetFeaSubSurfName()

std::string vsp::GetFeaSubSurfName ( const std::string & subsurf_id)
extern

Set the name of an FEA SubSurface

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Add LineArray ====//
string line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY );
string name = "example_name";
SetFeaSubSurfName( line_array_id, name );
if ( name != GetFeaSubSurfName( line_array_id ) ) // These should be equivalent
{
Print( "Error: GetFeaSubSurfName" );
__failure++;
}
void SetFeaSubSurfName(const std::string &subsurf_id, const std::string &name)
std::string GetFeaSubSurfName(const std::string &subsurf_id)
Parameters
[in]subsurf_idstring FEA SubSurface ID
Returns
string FEA SubSurf name

◆ GetFeaTrimPartIDVec()

std::vector< std::string > vsp::GetFeaTrimPartIDVec ( const std::string & trim_id)
extern

Get the FEA Parts a Trim part trims against

See also
AddFeaTrimPart, DeleteFeaTrimPart
Parameters
[in]trim_idstring FEA Trim part ID
Returns
vector<string> Array of FEA Part IDs

◆ IndividualizeFeaPart()

void vsp::IndividualizeFeaPart ( const std::string & geom_id,
int fea_struct_ind,
const std::string & part_id )
extern

Replace an FEA array part with the individual parts it stands for, the way the Individualize buttons on the array panels do. A rib array, slice array or SSLine array is a compact way of laying down a regular set of parts; individualizing turns it into that set, so each one can then be edited on its own. The array part itself goes away.

string pod_id = AddGeom( "POD", "" );
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
string array_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE_ARRAY );
SetParmVal( FindParm( array_id, "SliceRelSpacing", "FeaSliceArray" ), 0.25 );
int num_before = NumFeaParts( struct_id );
IndividualizeFeaPart( pod_id, struct_ind, array_id );
// The array is replaced by the slices it stood for, so the part count goes up.
if ( NumFeaParts( struct_id ) <= num_before )
{
Print( "ERROR: IndividualizeFeaPart did not expand the array" );
__failure++;
}
@ FEA_SLICE_ARRAY
Definition APIDefines.h:704
void IndividualizeFeaPart(const std::string &geom_id, int fea_struct_ind, const std::string &part_id)
See also
AddFeaPart, AddFeaSubSurf, NumFeaParts
Parameters
[in]geom_idstring Geom ID
[in]fea_struct_indint FEA Structure index
[in]part_idstring FEA Part or FEA Sub-Surface ID of an array part

◆ InsertFeaPolySparPt()

std::string vsp::InsertFeaPolySparPt ( const std::string & pspar_id,
int index )
extern

Insert a point into an FEA Poly Spar before the given index and return its ID.

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
// Insert a new intermediate point between the two default endpoints
string pt_id = InsertFeaPolySparPt( pspar_id, 1 );
if ( GetFeaPolySparNumPt( pspar_id ) != 3 )
{
Print( "Error: InsertFeaPolySparPt" );
__failure++;
}
std::string InsertFeaPolySparPt(const std::string &pspar_id, int index)
See also
AddFeaPolySparPt, DelFeaPolySparPt, GetFeaPolySparNumPt
Parameters
[in]pspar_idstring FEA Poly Spar part ID
[in]indexint Index before which the new point is inserted
Returns
string ID of the newly inserted Poly Spar point

◆ MoveFeaPolySparPt()

int vsp::MoveFeaPolySparPt ( const std::string & pspar_id,
int index,
int reorder_type )
extern

Move a point within an FEA Poly Spar using a reorder type and return the new index of the moved point.

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
AddFeaPolySparPt( pspar_id );
// Move point at index 2 up one position
int new_index = MoveFeaPolySparPt( pspar_id, 2, REORDER_MOVE_UP );
if ( new_index != 1 )
{
Print( "Error: MoveFeaPolySparPt" );
__failure++;
}
@ REORDER_MOVE_UP
int MoveFeaPolySparPt(const std::string &pspar_id, int index, int reorder_type)
See also
REORDER_TYPE, AddFeaPolySparPt, GetFeaPolySparNumPt
Parameters
[in]pspar_idstring FEA Poly Spar part ID
[in]indexint Index of the point to move
[in]reorder_typeint Reorder type enum (i.e. REORDER_MOVE_UP, REORDER_MOVE_DOWN, REORDER_MOVE_TOP, REORDER_MOVE_BOTTOM)
Returns
int New index of the moved point

◆ NumFeaAssemblies()

int vsp::NumFeaAssemblies ( )
extern

Get the number of FEA Assemblies in the model

if ( NumFeaAssemblies() != 0 )
{
Print( "ERROR: a new model starts with FEA Assemblies" );
__failure++;
}
AddFeaAssembly();
AddFeaAssembly();
if ( NumFeaAssemblies() != 2 || NumFeaAssemblies() != int( GetFeaAssemblyIDVec().size() ) )
{
Print( "ERROR: NumFeaAssemblies disagrees with GetFeaAssemblyIDVec" );
__failure++;
}
See also
AddFeaAssembly, GetFeaAssemblyIDVec
Returns
int Number of FEA Assemblies

◆ NumFeaAssemblyConnections()

int vsp::NumFeaAssemblyConnections ( const std::string & assembly_id)
extern

Get the number of connections in an FEA Assembly

See also
AddFeaAssemblyConnection, DeleteFeaAssemblyConnection
Parameters
[in]assembly_idstring FEA Assembly ID
Returns
int Number of connections

◆ NumFeaBCs()

int vsp::NumFeaBCs ( const std::string & fea_struct_id)
extern

Return number of FEA BC's in a structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Add BC ====//
string bc_id = AddFeaBC( struct_id, FEA_BC_STRUCTURE );
int nbc = NumFeaBCs( struct_id );
// The count has to match the list of IDs, and follow another add.
if ( nbc != 1 || nbc != int( GetFeaBCIDVec( struct_id ).size() ) )
{
Print( "ERROR: NumFeaBCs disagrees with GetFeaBCIDVec" );
__failure++;
}
AddFeaBC( struct_id, FEA_BC_STRUCTURE );
if ( NumFeaBCs( struct_id ) != nbc + 1 )
{
Print( "ERROR: NumFeaBCs did not follow AddFeaBC" );
__failure++;
}
Parameters
[in]fea_struct_idstring FEA Structure ID
Returns
int Number of FEA BCs

◆ NumFeaLayers()

int vsp::NumFeaLayers ( const std::string & material_id)
extern

Get the number of layers in an FEA laminate material

See also
AddFeaLayer, GetFeaLayerIDVec
Parameters
[in]material_idstring FEA Material ID of a laminate
Returns
int Number of layers

◆ NumFeaParts()

int vsp::NumFeaParts ( const std::string & fea_struct_id)
extern

Get the number of FEA Parts for a particular FEA Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
//==== Add FEA Parts ====//
string slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
string dome_id = AddFeaPart( pod_id, struct_ind, FEA_DOME );
if ( NumFeaParts( struct_id ) != 3 ) // Includes FeaSkin
{
Print( "Error: NumFeaParts" );
__failure++;
}
See also
GetFeaPartIDVec
Parameters
[in]fea_struct_idstring FEA Structure ID
Returns
int Number of FEA Parts

◆ NumFeaSubSurfs()

int vsp::NumFeaSubSurfs ( const std::string & fea_struct_id)
extern

Get the number of FEA Subsurfaces for a particular FEA Structure

//==== Add Pod Geometry ====//
string wing_id = AddGeom( "WING" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( wing_id );
string struct_id = GetFeaStructID( wing_id, struct_ind );
//==== Add SubSurfaces ====//
string line_array_id = AddFeaSubSurf( wing_id, struct_ind, SS_LINE_ARRAY );
string rectangle_id = AddFeaSubSurf( wing_id, struct_ind, SS_RECTANGLE );
if ( NumFeaSubSurfs( struct_id ) != 2 )
{
Print( "Error: NumFeaSubSurfs" );
__failure++;
}
See also
GetFeaSubSurfIDVec
Parameters
[in]fea_struct_idstring FEA Structure ID
Returns
int Number of FEA SubSurfaces

◆ ReorderFeaLayer()

void vsp::ReorderFeaLayer ( const std::string & material_id,
const std::string & layer_id,
int reorder_type )
extern

Move a layer within an FEA laminate's stack, the way the move buttons on the material editor do. A laminate's properties come from its layers in stacking order, so moving a layer changes the material.

string mat_id = AddFeaMaterial();
SetParmVal( FindParm( mat_id, "FeaMaterialType", "FeaMaterial" ), FEA_LAMINATE );
string first = AddFeaLayer( mat_id );
string second = AddFeaLayer( mat_id );
array< string > @layer_ids = GetFeaLayerIDVec( mat_id );
int num_layers = layer_ids.size();
ReorderFeaLayer( mat_id, second, REORDER_MOVE_TOP );
array< string > @moved_ids = GetFeaLayerIDVec( mat_id );
if ( moved_ids.size() != num_layers || moved_ids[0] != second )
{
Print( "ERROR: ReorderFeaLayer did not move the layer" );
__failure++;
}
@ REORDER_MOVE_TOP
void ReorderFeaLayer(const std::string &material_id, const std::string &layer_id, int reorder_type)
See also
AddFeaLayer, DeleteFeaLayer, GetFeaLayerIDVec
Parameters
[in]material_idstring FEA Material ID of a laminate
[in]layer_idstring FEA Layer ID
[in]reorder_typeint Reorder type enum (see REORDER_TYPE)

◆ ReorderFeaPart()

void vsp::ReorderFeaPart ( const std::string & geom_id,
int fea_struct_ind,
const std::string & part_id,
int reorder_type )
extern

Move an FEA part within its structure's part list, the way the move buttons on the Structure tab do. Parts are meshed in list order, so where a part sits decides which of two intersecting parts is trimmed by the other.

string pod_id = AddGeom( "POD", "" );
int struct_ind = AddFeaStruct( pod_id );
string struct_id = GetFeaStructID( pod_id, struct_ind );
string bulkhead = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
string skin = GetFeaPartID( struct_id, 0 );
ReorderFeaPart( pod_id, struct_ind, bulkhead, REORDER_MOVE_TOP );
if ( GetFeaPartID( struct_id, 0 ) != bulkhead )
{
Print( "ERROR: ReorderFeaPart did not move the part" );
__failure++;
}
ReorderFeaPart( pod_id, struct_ind, bulkhead, REORDER_MOVE_BOTTOM );
if ( GetFeaPartID( struct_id, 0 ) != skin )
{
Print( "ERROR: ReorderFeaPart did not move the part back" );
__failure++;
}
@ REORDER_MOVE_BOTTOM
void ReorderFeaPart(const std::string &geom_id, int fea_struct_ind, const std::string &part_id, int reorder_type)
See also
AddFeaPart, DeleteFeaPart, GetFeaPartIDVec
Parameters
[in]geom_idstring Geom ID
[in]fea_struct_indint FEA Structure index
[in]part_idstring FEA Part ID
[in]reorder_typeint Reorder type enum (see REORDER_TYPE)

◆ SetFeaAssemblyFileName()

void vsp::SetFeaAssemblyFileName ( const std::string & assembly_id,
int file_type,
const std::string & file_name )
extern

Set the name of an FEA Assembly output file

string assembly_id = AddFeaAssembly();
SetFeaAssemblyFileName( assembly_id, FEA_CALCULIX_FILE_NAME, "ExampleAssembly.inp" );
if ( GetFeaAssemblyFileName( assembly_id, FEA_CALCULIX_FILE_NAME ) != "ExampleAssembly.inp" )
{
Print( "ERROR: SetFeaAssemblyFileName did not take" );
__failure++;
}
// Each output type carries its own name.
if ( GetFeaAssemblyFileName( assembly_id, FEA_NASTRAN_FILE_NAME ) == "ExampleAssembly.inp" )
{
Print( "ERROR: setting one output name disturbed another" );
__failure++;
}
void SetFeaAssemblyFileName(const std::string &assembly_id, int file_type, const std::string &file_name)
See also
GetFeaAssemblyFileName, ComputeFeaAssemblyMesh, FEA_EXPORT_TYPE
Parameters
[in]assembly_idstring FEA Assembly ID
[in]file_typeint FEA output file type enum (i.e. FEA_CALCULIX_FILE_NAME)
[in]file_namestring Name for the output file

◆ SetFeaAssemblyName()

void vsp::SetFeaAssemblyName ( const std::string & assembly_id,
const std::string & name )
extern

Set the name of an FEA Assembly. The assembly's export file names are rebuilt from the new name.

See also
AddFeaAssembly, GetFeaAssemblyName
Parameters
[in]assembly_idstring FEA Assembly ID
[in]namestring FEA Assembly name

◆ SetFeaPartName()

void vsp::SetFeaPartName ( const std::string & part_id,
const std::string & name )
extern

Set the name of an FEA Part

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Add Bulkead ====//
string bulkhead_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE );
SetFeaPartName( bulkhead_id, "Bulkhead" );
if ( GetFeaPartName( bulkhead_id ) != "Bulkhead" )
{
Print( "ERROR: SetFeaPartName did not take" );
__failure++;
}
See also
GetFeaPartName
Parameters
[in]part_idstring FEA Part ID
[in]namestring New name for the FEA Part

◆ SetFeaPartPerpendicularSparID()

void vsp::SetFeaPartPerpendicularSparID ( const std::string & part_id,
const std::string & perpendicular_spar_id )
extern

Set the ID of the perpendicular spar for an FEA Rib or Rib Array. Note, the FEA Rib or Rib Array should have "SPAR_NORMAL" set for the "PerpendicularEdgeType" Parm. If it is not, the ID will still be set, but the orientation of the Rib or Rib Array will not change.

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
//==== Add FeaStructure to Wing ====//
int struct_ind = AddFeaStruct( wing_id );
//==== Add Rib ====//
string rib_id = AddFeaPart( wing_id, struct_ind, FEA_RIB );
//==== Add Spars ====//
string spar_id_1 = AddFeaPart( wing_id, struct_ind, FEA_SPAR );
string spar_id_2 = AddFeaPart( wing_id, struct_ind, FEA_SPAR );
SetParmVal( FindParm( spar_id_1, "RelCenterLocation", "FeaPart" ), 0.25 );
SetParmVal( FindParm( spar_id_2, "RelCenterLocation", "FeaPart" ), 0.75 );
//==== Set Perpendicular Edge type to SPAR ====//
SetParmVal( FindParm( rib_id, "PerpendicularEdgeType", "FeaRib" ), SPAR_NORMAL );
SetFeaPartPerpendicularSparID( rib_id, spar_id_2 );
if ( spar_id_2 != GetFeaPartPerpendicularSparID( rib_id ) )
{
Print( "Error: SetFeaPartPerpendicularSparID" );
__failure++;
}
See also
FEA_RIB_NORMAL, GetFeaPartPerpendicularSparID
Parameters
[in]part_idstring FEA Part ID (Rib or Rib Array Type)
[in]perpendicular_spar_idstring FEA Spar ID

◆ SetFeaPolySparPtName()

void vsp::SetFeaPolySparPtName ( const std::string & pspar_id,
int index,
const std::string & name )
extern

Set the name of a point in an FEA Poly Spar.

string wing_id = AddGeom( "WING" );
int struct_ind = AddFeaStruct( wing_id );
string pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR );
SetFeaPolySparPtName( pspar_id, 0, "InboardPt" );
SetFeaPolySparPtName( pspar_id, 1, "OutboardPt" );
if ( GetFeaPolySparPtName( pspar_id, 0 ) != "InboardPt" )
{
Print( "Error: SetFeaPolySparPtName" );
__failure++;
}
See also
GetFeaPolySparPtName
Parameters
[in]pspar_idstring FEA Poly Spar part ID
[in]indexint Index of the point
[in]namestring New name for the point

◆ SetFeaStructName()

void vsp::SetFeaStructName ( const std::string & geom_id,
int fea_struct_ind,
const std::string & name )
extern

Set the name of an FEA Structure

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Change the Structure Name ====//
SetFeaStructName( pod_id, struct_ind, "Example_Struct" );
if ( GetFeaStructName( pod_id, struct_ind ) != "Example_Struct" )
{
Print( "ERROR: SetFeaStructName did not take" );
__failure++;
}
string parm_container_id = FindContainer( "Example_Struct", struct_ind );
string display_id = string("New Structure Parm Container ID: ") + parm_container_id + string("\n");
Print( display_id );
void SetFeaStructName(const std::string &geom_id, int fea_struct_ind, const std::string &name)
std::string FindContainer(const std::string &name, int index)
See also
GetFeaStructName
Parameters
[in]geom_idstring Parent Geom ID
[in]fea_struct_indint FEA Structure index
[in]namestring New name for the FEA Structure

◆ SetFeaSubSurfName()

void vsp::SetFeaSubSurfName ( const std::string & subsurf_id,
const std::string & name )
extern

Set the name of an FEA SubSurface

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Add LineArray ====//
string line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY );
SetFeaSubSurfName( line_array_id, "Stiffener_array" );
if ( GetFeaSubSurfName( line_array_id ) != "Stiffener_array" )
{
Print( "ERROR: SetFeaSubSurfName did not take" );
__failure++;
}
Parameters
[in]subsurf_idstring FEA SubSurface ID
[in]namestring New name for the FEA SubSurface