FEDEM Model Database  R8.0
Source code of the FEDEM model database
Functions
Fedem Namespace Reference

FEDEM model database utilities. More...

Functions

FmTriad * createTriad (const FaVec3 &createPos, FmBase *onObject=NULL)
 Creates a triad. More...
 
void createRevJoint (const FaVec3 &createPos, const FaVec3 &zAxisDir)
 Creates a revolute joint object. More...
 
void createBallJoint (const FaVec3 &createPos)
 Creates a ball joint object. More...
 
void createRigidJoint (const FaVec3 &createPos)
 Creates a rigid joint object. More...
 
void createFreeJoint (const FaVec3 &posJnt, const FaVec3 &posDep, const FaVec3 *zAxisDir=NULL)
 Creates a free joint object. More...
 
void createJoint (int jType, const FaVec3 &firstPoint, const FaVec3 &lastPoint, const FaVec3 &yAxisDir)
 Creates a line joint object. More...
 
FmJointBase * createJoint (int jType, FmBase *first, FmBase *second, const FaVec3 *posJnt=NULL, FmBase *subAssembly=NULL)
 Creates a point joint connected to two triads. More...
 
FmJointBase * createJoint (int jType, FmBase *first, FmBase *last, const FaVec3 &yAxisDir, FmBase *slider=NULL, FmBase *subAssembly=NULL, char addBetweens=2)
 Creates a line joint between two triads. More...
 
FmCamJoint * createCamJoint (FmTriad *follower, FmBase *subAssembly=NULL)
 Creates a cam joint. More...
 
FmAxialSpring * createAxialSpring (FmTriad *first, FmTriad *second, FmBase *subAssembly=NULL)
 Creates an axial spring between two triads. More...
 
void createAxialSpring (const FaVec3 &firstPt, const FaVec3 &secondPt, FmBase *first, FmBase *second)
 Creates an axial spring between two points on two objects. More...
 
FmAxialDamper * createAxialDamper (FmTriad *first, FmTriad *second, FmBase *subAssembly=NULL)
 Creates an axial damper between two triads. More...
 
void createAxialDamper (const FaVec3 &firstPt, const FaVec3 &secondPt, FmBase *first, FmBase *second)
 Creates an axial damper between two points on two objects. More...
 
FmLoad * createLoad (int lType, const FaVec3 &createPos, FaVec3 globalDir, FmBase *onObject=NULL, FmBase *subAssembly=NULL)
 Creates an external load object. More...
 
void createSticker (FmBase *object, const FaVec3 &createPoint)
 Creates a sticker on an object. More...
 
void createSticker (const FaVec3 &createPoint, FmBase *onObject)
 Creates a sticker on an object. More...
 
void createGear (FmBase *first, FmBase *second)
 Creates a gear object. More...
 
void createRackPinion (FmBase *first, FmBase *second)
 Creates a rack & pinion object. More...
 
FmSensorBase * createSensor (FmIsMeasuredBase *object)
 Creates a simple sensor on an object. More...
 
FmSensorBase * createSensor (FmIsMeasuredBase *first, FmIsMeasuredBase *second, FmIsMeasuredBase *third=NULL, FmIsMeasuredBase *fourth=NULL)
 Creates a relative sensor between two or four objects. More...
 
void createTire (FmRevJoint *joint)
 Creates a tire object. More...
 
FmBeam * createBeam (FmTriad *tr1, FmTriad *tr2, FmBase *subAssembly=NULL)
 Creates a single beam element. More...
 
FmModelMemberBase * createBeams (const std::vector< FmTriad * > &triads, FmBase *subAssembly=NULL)
 Creates a beam string. More...
 
FmModelMemberBase * createPart (const std::vector< FmTriad * > &triads, FmBase *subAssembly=NULL)
 Creates a generic part. More...
 
FmModelMemberBase * createUserElm (const std::vector< FmTriad * > &triads, FmBase *subAssembly=NULL)
 Creates a user-defined element. More...
 
FmModelMemberBase * createUserElm (int elmType, const char *typeName, const std::vector< FmTriad * > &triads, size_t nelnod, FmBase *subAssembly=NULL)
 Creates user-defined elements. More...
 
bool createMooringLine (FmTriad *tr1, FmTriad *tr2, double Length, int nSegment, int elmType, FmBase *subAssembly=NULL)
 Creates a mooring line (macro object) between two triads. More...
 
FmSubAssembly * createSubAssembly (const std::vector< FmModelMemberBase * > &objs, FmBase *subAssembly=NULL)
 Creates sub-assembly containing the specified objects. More...
 
int loadTemplate (const std::string &newName, const std::string &defaultName="", bool writeLogFile=false)
 Reads a model file to be used as template for a new, empty model. More...
 
int loadModel (const std::string &name, const std::string &logName, char ignoreFileVersion=0)
 Reads a model file into a new model. More...
 
bool loadParts (bool forceLoad=false)
 Reads all part data files, unless they are already loaded. More...
 
bool validFileCheck (const std::string &filename, unsigned long int wantCS=0, std::string *missingFile=NULL, int *wrongCS=NULL)
 Helper to check whether a named fmx-file is valid or not. More...
 
int checkReducerFiles (const FmPart *part, bool needMassMatrix=false, char checkingWhich='A', bool preparingForBatch=false, unsigned long int wantCS=0)
 Checks the validity of the reduced matrix files of a part. More...
 
std::string createReducerInput (FmAnalysis *analysis, FmMechanism *mech, FmPart *part, const std::string &solverName, bool preparingForBatch=false, unsigned long int wantCS=0)
 Creates input files for the FE part reducer. More...
 
std::string createSolverInput (FmAnalysis *analysis, FmMechanism *mech, FmSimulationEvent *sev, const std::string &solverName, const std::vector< std::string > &plugins, std::vector< std::string > &rdbPath, bool preparingForBatch=false, bool keepOldRes=true)
 Creates input files for the dynamics solver. More...
 

Detailed Description

FEDEM model database utilities.

Function Documentation

◆ checkReducerFiles()

int Fedem::checkReducerFiles ( const FmPart *  part,
bool  needMassMatrix = false,
char  checkingWhich = 'A',
bool  preparingForBatch = false,
unsigned long int  wantCS = 0 
)

Checks the validity of the reduced matrix files of a part.

Parameters
[in]partThe FE part to check matrix files for
[in]needMassMatrixIf true, mass matrix files are needed
[in]checkingWhichFlag indicating which files to check for.
  • 'S': Files needed by the Dynamics Solver only.
  • 'R': Files needed by Stress Recovery only.
  • 'A': Check all files.
[in]preparingForBatchIf true, prepare for batch execution
[in]wantCSExpected checksum value (ignore if zero)
Returns
-1 : Some or all files are missing
0 : Some or all files are either missing or have checksum mismatch
1 : All files are present and with correct checksum
2 : All files are present, but with unknown checksum status
3 : All files are present, but some have incorrect checksum

◆ createAxialDamper() [1/2]

void Fedem::createAxialDamper ( const FaVec3 &  firstPt,
const FaVec3 &  secondPt,
FmBase *  first,
FmBase *  second 
)

Creates an axial damper between two points on two objects.

Parameters
[in]firstPtFirst point the damper is acting between
[in]secondPtSecond point the damper is acting between
[in]firstFirst object the damper is acting between
[in]secondSecond object the damper is acting between

◆ createAxialDamper() [2/2]

FmAxialDamper * Fedem::createAxialDamper ( FmTriad *  first,
FmTriad *  second,
FmBase *  subAssembly = NULL 
)

Creates an axial damper between two triads.

Parameters
[in]firstFirst triad the damper is acting between
[in]secondSecond triad the damper is acting between
[in]subAssemblyParent assembly of the damper

◆ createAxialSpring() [1/2]

void Fedem::createAxialSpring ( const FaVec3 &  firstPt,
const FaVec3 &  secondPt,
FmBase *  first,
FmBase *  second 
)

Creates an axial spring between two points on two objects.

Parameters
[in]firstPtFirst point the spring is acting between
[in]secondPtSecond point the spring is acting between
[in]firstFirst object the spring is acting between
[in]secondSecond object the spring is acting between

◆ createAxialSpring() [2/2]

FmAxialSpring * Fedem::createAxialSpring ( FmTriad *  first,
FmTriad *  second,
FmBase *  subAssembly = NULL 
)

Creates an axial spring between two triads.

Parameters
[in]firstFirst triad the spring is acting between
[in]secondSecond triad the spring is acting between
[in]subAssemblyParent assembly of the spring

◆ createBallJoint()

void Fedem::createBallJoint ( const FaVec3 &  createPos)

Creates a ball joint object.

Parameters
[in]createPosGlobal joint position

◆ createBeam()

FmBeam * Fedem::createBeam ( FmTriad *  tr1,
FmTriad *  tr2,
FmBase *  subAssembly = NULL 
)

Creates a single beam element.

Parameters
[in]tr1First end triad
[in]tr2Second end triad
[in]subAssemblyParent assembly of the beam element

◆ createBeams()

FmModelMemberBase * Fedem::createBeams ( const std::vector< FmTriad * > &  triads,
FmBase *  subAssembly = NULL 
)

Creates a beam string.

Parameters
[in]triadsList of triads connected to the created beam elements
[in]subAssemblyParent assembly of the created beam elements

◆ createCamJoint()

FmCamJoint * Fedem::createCamJoint ( FmTriad *  follower,
FmBase *  subAssembly = NULL 
)

Creates a cam joint.

Parameters
[in]followerFollower triad
[in]subAssemblyParent assembly of the cam joint

◆ createFreeJoint()

void Fedem::createFreeJoint ( const FaVec3 &  posJnt,
const FaVec3 &  posDep,
const FaVec3 *  zAxisDir = NULL 
)

Creates a free joint object.

Parameters
[in]posJntGlobal position of joint and independent triad
[in]posDepGlobal position of dependent triad
[in]zAxisDirCommon Z-axis direction for the joint triads

◆ createGear()

void Fedem::createGear ( FmBase *  first,
FmBase *  second 
)

Creates a gear object.

Parameters
[in]firstInput joint
[in]secondOutput joint

◆ createJoint() [1/3]

void Fedem::createJoint ( int  jType,
const FaVec3 &  firstPoint,
const FaVec3 &  lastPoint,
const FaVec3 &  yAxisDir 
)

Creates a line joint object.

Parameters
[in]jTypeType of joint to create (class type ID)
[in]firstPointStart point of line
[in]lastPointEnd point of line
[in]yAxisDirY-axis direction for the independent triads

◆ createJoint() [2/3]

FmJointBase * Fedem::createJoint ( int  jType,
FmBase *  first,
FmBase *  last,
const FaVec3 &  yAxisDir,
FmBase *  slider = NULL,
FmBase *  subAssembly = NULL,
char  addBetweens = 2 
)

Creates a line joint between two triads.

Parameters
[in]jTypeType of joint to create (class type ID)
[in]firstStart triad of joint line
[in]lastEnd triad of joint line
[in]yAxisDirY-axis direction for the independent triads
[in]sliderDependent triad of the joint
[in]subAssemblyParent assembly of the joint
[in]addBetweensFlag for adding other triads found along the line
  • 0 : Never do it
  • 1 : Always do it
  • 2 : Ask user if we should do it or not

◆ createJoint() [3/3]

FmJointBase * Fedem::createJoint ( int  jType,
FmBase *  first,
FmBase *  second,
const FaVec3 *  posJnt = NULL,
FmBase *  subAssembly = NULL 
)

Creates a point joint connected to two triads.

Parameters
[in]jTypeType of joint to create (class type ID)
[in]firstThe independent triad or reference plane
[in]secondThe dependent triad
[in]posJntGlobal position of independent triad, if new
[in]subAssemblyParent assembly of the joint

◆ createLoad()

FmLoad * Fedem::createLoad ( int  lType,
const FaVec3 &  createPos,
FaVec3  globalDir,
FmBase *  onObject = NULL,
FmBase *  subAssembly = NULL 
)

Creates an external load object.

Parameters
[in]lTypeType of load (0=force, 1=torque)
[in]createPosLoad attack point
[in]globalDirLoad direction vector
[in]onObjectObject the load is acting on
[in]subAssemblyParent assembly of the load object

◆ createMooringLine()

bool Fedem::createMooringLine ( FmTriad *  tr1,
FmTriad *  tr2,
double  Length,
int  nSegments,
int  elmType,
FmBase *  subAssembly = NULL 
)

Creates a mooring line (macro object) between two triads.

Parameters
[in]tr1Start triad of mooring line
[in]tr2Stop triad of mooring line
[in]LengthTotal length of mooring line
[in]nSegmentsNumber of elements to divide the mooring line into
[in]elmTypeThe element type to use
[in]subAssemblyParent assembly of the mooring line

This function creates a catenary curve of the specified length between the two triads consisting of nSegment 2-noded elements of the specified type.

◆ createPart()

FmModelMemberBase * Fedem::createPart ( const std::vector< FmTriad * > &  triads,
FmBase *  subAssembly = NULL 
)

Creates a generic part.

Parameters
[in]triadsList of triads connected to the created part
[in]subAssemblyParent assembly of the created part

◆ createRackPinion()

void Fedem::createRackPinion ( FmBase *  first,
FmBase *  second 
)

Creates a rack & pinion object.

Parameters
[in]firstInput joint
[in]secondOutput joint

◆ createReducerInput()

std::string Fedem::createReducerInput ( FmAnalysis *  analysis,
FmMechanism *  mech,
FmPart *  part,
const std::string &  solverName,
bool  preparingForBatch = false,
unsigned long int  wantCS = 0 
)

Creates input files for the FE part reducer.

Parameters
[in]analysisThe analysis object of current model
[in]mechThe mechanism object of current model
[in]partThe FE part to create reduction input files for
[in]solverNameName of reduction solver (fedem_reducer)
[in]preparingForBatchIf true, prepare for batch execution
[in]wantCSExpected checksum value (ignore if zero)
Returns
Path to execution folder on success, error message on failure

◆ createRevJoint()

void Fedem::createRevJoint ( const FaVec3 &  createPos,
const FaVec3 &  zAxisDir 
)

Creates a revolute joint object.

Parameters
[in]createPosGlobal joint position
[in]zAxisDirThe axis of revolution

Both joint triads use zAxisDir as their z-axis and the "up" direction of the joint is in negative g-direction.

◆ createRigidJoint()

void Fedem::createRigidJoint ( const FaVec3 &  createPos)

Creates a rigid joint object.

Parameters
[in]createPosGlobal joint position

◆ createSensor() [1/2]

FmSensorBase * Fedem::createSensor ( FmIsMeasuredBase *  first,
FmIsMeasuredBase *  second,
FmIsMeasuredBase *  third = NULL,
FmIsMeasuredBase *  fourth = NULL 
)

Creates a relative sensor between two or four objects.

Parameters
[in]firstThe first object to measure between
[in]secondThe second object to measure between
[in]thirdThe third object to measure between
[in]fourthThe dourth object to measure between

◆ createSensor() [2/2]

FmSensorBase * Fedem::createSensor ( FmIsMeasuredBase *  object)

Creates a simple sensor on an object.

Parameters
[in]objectThe object to measure

◆ createSolverInput()

std::string Fedem::createSolverInput ( FmAnalysis *  analysis,
FmMechanism *  mech,
FmSimulationEvent *  sev,
const std::string &  solverName,
const std::vector< std::string > &  plugins,
std::vector< std::string > &  rdbPath,
bool  preparingForBatch = false,
bool  keepOldRes = true 
)

Creates input files for the dynamics solver.

Parameters
[in]analysisThe analysis object of current model
[in]mechThe mechanism object of current model
[in]sevThe simulation event (if any) to create input for
[in]solverNameName of the dynamics solver (fedem_solver)
[in]pluginsPaths to solver plugin libraries
[in]rdbPathList of absolute paths of RDB-folders to be used
[in]preparingForBatchIf true, prepare for batch execution
[in]keepOldResif true, any existing res-file is not overwritten
Returns
Input file basename on success, error message on failure

◆ createSticker() [1/2]

void Fedem::createSticker ( const FaVec3 &  createPoint,
FmBase *  onObject 
)

Creates a sticker on an object.

Parameters
[in]createPointLocation of sticker
[in]onObjectObject to put the sticker on

◆ createSticker() [2/2]

void Fedem::createSticker ( FmBase *  object,
const FaVec3 &  createPoint 
)

Creates a sticker on an object.

Parameters
[in]objectObject to put the sticker on
[in]createPointLocation of sticker

◆ createSubAssembly()

FmSubAssembly * Fedem::createSubAssembly ( const std::vector< FmModelMemberBase * > &  objs,
FmBase *  subAssembly = NULL 
)

Creates sub-assembly containing the specified objects.

Parameters
[in]objsObjects to move to the new sub-assembly
[in]subAssemblyParent assembly of the new sub-assembly

◆ createTire()

void Fedem::createTire ( FmRevJoint *  joint)

Creates a tire object.

Parameters
[in]jointThe revolute joint representing the wheel bearing

◆ createTriad()

FmTriad * Fedem::createTriad ( const FaVec3 &  createPos,
FmBase *  onObject = NULL 
)

Creates a triad.

Parameters
[in]createPosGlobal position of the triad
[in]onObjectIf this is a Part, the triad is attached to it. If it is a sub-assembly, that sub-assembly is set as the triad's parent.

◆ createUserElm() [1/2]

FmModelMemberBase * Fedem::createUserElm ( const std::vector< FmTriad * > &  triads,
FmBase *  subAssembly = NULL 
)

Creates a user-defined element.

Parameters
[in]triadsList of triads connected to the created element
[in]subAssemblyParent assembly of the created element

◆ createUserElm() [2/2]

FmModelMemberBase * Fedem::createUserElm ( int  elmType,
const char *  typeName,
const std::vector< FmTriad * > &  triads,
size_t  nelnod,
FmBase *  subAssembly = NULL 
)

Creates user-defined elements.

Parameters
[in]elmTypeElement type ID
[in]typeNameElement type name
[in]triadsList of triads connected to the created element(s)
[in]nelnodNumber of element nodes for the created element(s)
[in]subAssemblyParent assembly of the created element(s)

If nelnod equals 1, a user-defined element is created for each of the given triads. If nelnod equals 2, a chain of nelnod-1 elements is created connecting the given triads. If nelnod is larger than 2 (and less than or equal to the size of triads), then one user-defined elements is created connected to the first nelnod triads.

◆ loadModel()

int Fedem::loadModel ( const std::string &  name,
const std::string &  logName,
char  ignoreFileVersion = 0 
)

Reads a model file into a new model.

Parameters
[in]nameThe name of the model file to read
[in]logNameName of the log-file for list view messages
[in]ignoreFileVersionIf > 0, ignore incompatible file versions

◆ loadParts()

bool Fedem::loadParts ( bool  forceLoad = false)

Reads all part data files, unless they are already loaded.

Parameters
[in]forceLoadIf true, force reload of all files

◆ loadTemplate()

int Fedem::loadTemplate ( const std::string &  newName,
const std::string &  defaultName = "",
bool  writeLogFile = false 
)

Reads a model file to be used as template for a new, empty model.

Parameters
[in]newNameThe name of the new model file
[in]defaultNameDefault name of the template model file. Used only if the FEDEM_TEMPLATE_FILE environment variable is not set.
[in]writeLogFileCopy messages to a temporary log file, if true

◆ validFileCheck()

bool Fedem::validFileCheck ( const std::string &  filename,
unsigned long int  wantCS = 0,
std::string *  missingFile = NULL,
int *  wrongCS = NULL 
)

Helper to check whether a named fmx-file is valid or not.

Parameters
[in]filenameAbsolute path to the fmx-file to check
[in]wantCSExpected checksum value (ignore if zero)
missingFileList of non-existing files (optional)
wrongCSCounts files with checksum mismatch (optional)