FEDEM Solver  R8.0
Source code of the dynamics solver
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
FiRPC3File Class Reference

#include <FiRPC3File.H>

Inheritance diagram for FiRPC3File:
Inheritance graph
[legend]
Collaboration diagram for FiRPC3File:
Collaboration graph
[legend]

Classes

struct  chParams
 

Public Member Functions

 FiRPC3File (const char *devicename=NULL)
 
 FiRPC3File (const char *devicename, int endianFormat)
 
 FiRPC3File (const char *devicename, int endianFormat, int numberOfChannels)
 
virtual size_t getValueCount () const
 Returns the number of (x,y) pairs for this device. More...
 
virtual void getValueRange (double &min, double &max) const
 Calculates the function value range for this device. More...
 
virtual double getValue (double x, int channel=0, bool zeroAdjust=false, double vertShift=0.0, double scaleFac=1.0)
 Evaluates the function for a given x value. More...
 
virtual bool getValues (double x0, double x1, Doubles &x, Doubles &y, int channel=0, bool zeroAdjust=false, double shift=0.0, double scale=1.0)
 Evaluates the function at all points within specified interval. More...
 
virtual void getRawData (Doubles &x, Doubles &y, double minX, double maxX, int channel=0)
 Extracts all function data point values within specified interval. More...
 
virtual void getData (Doubles &x, Doubles &y, const std::string &channel, double minX=0.0, double maxX=-1.0)
 Extracts all function data point values within specified interval. More...
 
virtual void setValue (double, double)
 Assigns a function value for a single-channel function. More...
 
virtual bool setData (const Doubles &x, const Doubles &y)
 Adds a complete set of x,y-pair values for a new channel. More...
 
virtual bool getChannelList (Strings &list)
 Gets the list channel names for a multi-channel device. More...
 
virtual int isChannelPresentInFile (const std::string &channel)
 Checks if a nameed channel is present in the device. More...
 
virtual bool isChannelPresentInFile (int channel)
 Checks if an indexed channel is present in the device. More...
 
virtual void setDescription (const std::string &desc)
 Assigns a name to the (last) channel in the device. More...
 
virtual void setTimeSpan (double timeSpan)
 Sets the maximum time span for the device function. More...
 
virtual void setPrecision (int type)
 Sets the precision to be used when writing the device to file. More...
 
int getRepeats () const
 
void setRepeats (int rep)
 
int getAverages () const
 
void setAverages (int avg)
 
int getFramePoints () const
 
void setFramePoints (int frm)
 
int getGroupPoints () const
 
void setGroupPoints (int grp)
 
- Public Member Functions inherited from FiDeviceFunctionBase
virtual ~FiDeviceFunctionBase ()
 The destructor closes the device function file. More...
 
bool open (const char *devicename, FileStatus status=Read_Only)
 Opens the specified device function file for reading or writing. More...
 
bool open (FileStatus status=Read_Only)
 Opens the file myDatasetDevice for reading or writing. More...
 
bool close (bool noHeader=false)
 Closes the device function file. More...
 
const std::string & getDevicename () const
 Returns the myDatasetDevice of this device function. More...
 
void setExtrapolationPolicy (InterpolationPolicy policy=Constant)
 Defines the extrapolation policy to be used. More...
 
void setInterpolationPolicy (InterpolationPolicy policy=Linear)
 Defines the interpolation policy to be used. More...
 
virtual double getXAxisOrigin () const
 Returns the function argument origin for this device. More...
 
double integrate (double x, int order=1, int channel=0, double vertShift=0.0, double scaleFac=1.0)
 Computes the integral of this device over the interval [0,x]. More...
 
int getRefCount () const
 Returns the current reference count for this device. More...
 
int ref ()
 Increments the reference count fir this device. More...
 
int unref ()
 Decrements the reference count for this device. More...
 
double getStep () const
 returns the constant sampling time increment. More...
 
double getFrequency () const
 returns the constant sampling frequency. More...
 
void setStep (double aStep)
 Sets the sampling increment for devices with constant sampling. More...
 
void setFrequency (double aFreqency)
 Sets the sampling frequency for devices with constant sampling. More...
 
virtual void setEmptyChannel (const std::string &)
 Flags an empty channel for multi-channel devices. More...
 
void setParent (const std::string &modelfile)
 Sets the model file name associated with this device. More...
 
bool isReadOnly () const
 Returns whether this is a read-only device or not. More...
 
FileStatus getFileStatus () const
 Returns the myFileStatus of this device function. More...
 
void getAxisUnit (int axis, char *unitText, size_t n) const
 Gets the axis unit. More...
 
void getAxisTitle (int axis, char *titleText, size_t n) const
 Gets the axis title. More...
 
void setAxisUnit (int axis, const char *unitText)
 Sets the axis unit. More...
 
void setAxisTitle (int axis, const char *titleText)
 Sets the axis title. More...
 

Protected Member Functions

virtual bool initialDeviceRead ()
 Reads the file content, or at least its meta data. More...
 
virtual bool preliminaryDeviceWrite ()
 Writes the meta data for this device function to file. More...
 
virtual bool concludingDeviceWrite (bool)
 Writes the content of this device function to file. More...
 
- Protected Member Functions inherited from FiDeviceFunctionBase
 FiDeviceFunctionBase (const char *devicename=NULL)
 The default constructor initialize the data members. More...
 
 FiDeviceFunctionBase (const FiDeviceFunctionBase &)=delete
 Deleted copy constructor. More...
 
FiDeviceFunctionBase & operator= (const FiDeviceFunctionBase &)=delete
 Deleted assignment operator. More...
 
double interpolate (double x, double x0, double f0, double x1, double f1) const
 Calculates the function value at x by interpolation. More...
 
double extrapolate (double x, double x0, double f0, double x1, double f1) const
 Calculates the function value at x by extrapolation. More...
 
bool writeString (const char *str)
 Convenience method for a writing text header. More...
 
bool writeString (const char *lab, const std::string &val)
 Convenience method for writing text headers. More...
 

Private Types

enum  FileType {
  Time_History , Matrix , Histogram , Regions ,
  Configuration , Fatigue , Road_Surface , Spectral ,
  Start
}
 
enum  TimeType {
  Drive , Response , Mult_Drive , Mult_Resp ,
  Config_Drive , Config_Resp , Peak_pick
}
 
enum  DataType { ShortInt , Float , Double }
 
enum  Action { toRead , toWrite }
 

Private Member Functions

void commonConstructor ()
 
bool readChannelList ()
 
bool initTHChannel (int channel, int action)
 
int getPartition (int channel)
 
void setReadParams (int channel)
 
void setKeyInt (const std::string &key, const int val, const int numb)
 
void setKeyFloat (const std::string &key, const float val, const int numb)
 
void setKeyString (const std::string &key, const std::string &val, const int numb)
 
int getKeyInt (const std::string &key, bool &ok)
 
float getKeyFloat (const std::string &key, bool &ok)
 
std::string getKeyString (const std::string &key, bool &ok)
 
void writeString (const std::string &buf, FT_int pos, bool skipRepos=false)
 
void writeDouble (const double val, FT_int pos, bool skipRepos=false)
 
void writeFloat (const float val, FT_int pos, bool skipRepos=false)
 
void writeInt16 (const short val, FT_int pos, bool skipRepos=false)
 
std::string readString (FT_int pos, bool castToUpperCase=false)
 
double readDouble (FT_int pos, bool asciiField=false)
 
float readFloat (FT_int pos, bool asciiField=false)
 
short readInt16 (FT_int pos, bool asciiField=false)
 
int readInt32 (FT_int pos, bool asciiField=false)
 
void dumpAllKeysToScreen () const
 

Private Attributes

double myMaxVal
 
double myMinVal
 
Strings myKeys
 
Strings myChannels
 
size_t myNumDatavals
 
int myNumHeaderBlocks
 
int myNumPartitions
 
int myNumChannels
 
int myNumGrpPts
 
int myNumFrames
 
int myNumFrmPts
 
int myNumParams
 
int myDataSize
 
bool myHalfFrameUse
 
double myXaxisOrigin
 
double myFirstReadValue
 
FT_int myByteShift
 
FT_int myPartShift
 
int myFileType
 
int myDataType
 
int myDataFormat
 
int myPartition
 
int myRepeats
 
int myAverages
 
int myChannel
 
bool myBypassFilter
 
double myChannelScale
 
double myTimeSpan
 
int myPhysChan
 
std::map< int, chParams > parameters
 
bool swapStringBytes
 
bool stepSet
 
int kInd
 

Additional Inherited Members

- Public Types inherited from FiDeviceFunctionBase
enum  Endianness { LittleEndian , BigEndian }
 Enumerator for endianness values. More...
 
enum  FileFormat { ascii , binary }
 Enumerator for the file formats. More...
 
enum  FileStatus { Not_Loaded =-1 , Not_Open =0 , Read_Only =1 , Write_Only =2 }
 Enumerator for file opening statuses. More...
 
enum  InterpolationPolicy { Constant , Linear , Previous_Value , Next_Value }
 Enumerator for interpolation and extrapolation policies. More...
 
- Protected Types inherited from FiDeviceFunctionBase
using Doubles = std::vector< double >
 Convenience type alias. More...
 
using Strings = std::vector< std::string >
 Convenience type alias. More...
 
- Protected Attributes inherited from FiDeviceFunctionBase
FT_FILE myFile
 File handle of this device function. More...
 
std::string myParent
 Name of FEDEM model that owns this function. More...
 
std::string myDatasetDevice
 Name of file associated with myFile. More...
 
Endianness myOutputEndian
 Endianness assumed for binary output. More...
 
Endianness myInputEndian
 Endianness assumed for binary input. More...
 
double myStep
 Time series information. More...
 
std::array< AxisInfo, 2 > myAxisInfo
 
- Static Protected Attributes inherited from FiDeviceFunctionBase
static Endianness myMachineEndian
 Endianness for the running computer. More...
 

Member Enumeration Documentation

◆ Action

enum FiRPC3File::Action
private
Enumerator
toRead 
toWrite 

◆ DataType

enum FiRPC3File::DataType
private
Enumerator
ShortInt 
Float 
Double 

◆ FileType

enum FiRPC3File::FileType
private
Enumerator
Time_History 
Matrix 
Histogram 
Regions 
Configuration 
Fatigue 
Road_Surface 
Spectral 
Start 

◆ TimeType

enum FiRPC3File::TimeType
private
Enumerator
Drive 
Response 
Mult_Drive 
Mult_Resp 
Config_Drive 
Config_Resp 
Peak_pick 

Constructor & Destructor Documentation

◆ FiRPC3File() [1/3]

FiRPC3File::FiRPC3File ( const char *  devicename = NULL)
explicit

◆ FiRPC3File() [2/3]

FiRPC3File::FiRPC3File ( const char *  devicename,
int  endianFormat 
)

◆ FiRPC3File() [3/3]

FiRPC3File::FiRPC3File ( const char *  devicename,
int  endianFormat,
int  numberOfChannels 
)

Member Function Documentation

◆ commonConstructor()

void FiRPC3File::commonConstructor ( )
private

◆ concludingDeviceWrite()

bool FiRPC3File::concludingDeviceWrite ( bool  noHeader)
protectedvirtual

Writes the content of this device function to file.

Implements FiDeviceFunctionBase.

◆ dumpAllKeysToScreen()

void FiRPC3File::dumpAllKeysToScreen ( ) const
private

◆ getAverages()

int FiRPC3File::getAverages ( ) const
inline

◆ getChannelList()

bool FiRPC3File::getChannelList ( Strings &  )
virtual

Gets the list channel names for a multi-channel device.

Reimplemented from FiDeviceFunctionBase.

◆ getData()

void FiRPC3File::getData ( Doubles &  x,
Doubles &  y,
const std::string &  ,
double  minX = 0.0,
double  maxX = -1.0 
)
virtual

Extracts all function data point values within specified interval.

Reimplemented from FiDeviceFunctionBase.

◆ getFramePoints()

int FiRPC3File::getFramePoints ( ) const
inline

◆ getGroupPoints()

int FiRPC3File::getGroupPoints ( ) const
inline

◆ getKeyFloat()

float FiRPC3File::getKeyFloat ( const std::string &  key,
bool &  ok 
)
private

◆ getKeyInt()

int FiRPC3File::getKeyInt ( const std::string &  key,
bool &  ok 
)
private

◆ getKeyString()

std::string FiRPC3File::getKeyString ( const std::string &  key,
bool &  ok 
)
private

◆ getPartition()

int FiRPC3File::getPartition ( int  channel)
private

◆ getRawData()

void FiRPC3File::getRawData ( Doubles &  x,
Doubles &  y,
double  minX,
double  maxX,
int  channel = 0 
)
virtual

Extracts all function data point values within specified interval.

Implements FiDeviceFunctionBase.

◆ getRepeats()

int FiRPC3File::getRepeats ( ) const
inline

◆ getValue()

double FiRPC3File::getValue ( double  x,
int  channel = 0,
bool  zeroAdjust = false,
double  vertShift = 0.0,
double  scaleFac = 1.0 
)
virtual

Evaluates the function for a given x value.

Implements FiDeviceFunctionBase.

◆ getValueCount()

virtual size_t FiRPC3File::getValueCount ( ) const
inlinevirtual

Returns the number of (x,y) pairs for this device.

Implements FiDeviceFunctionBase.

◆ getValueRange()

void FiRPC3File::getValueRange ( double &  mn,
double &  mx 
) const
virtual

Calculates the function value range for this device.

Reimplemented from FiDeviceFunctionBase.

◆ getValues()

bool FiRPC3File::getValues ( double  x0,
double  x1,
Doubles &  x,
Doubles &  y,
int  channel = 0,
bool  zeroAdjust = false,
double  shift = 0.0,
double  scale = 1.0 
)
virtual

Evaluates the function at all points within specified interval.

Implements FiDeviceFunctionBase.

◆ initialDeviceRead()

bool FiRPC3File::initialDeviceRead ( )
protectedvirtual

Reads the file content, or at least its meta data.

Implements FiDeviceFunctionBase.

◆ initTHChannel()

bool FiRPC3File::initTHChannel ( int  channel,
int  action 
)
private

◆ isChannelPresentInFile() [1/2]

int FiRPC3File::isChannelPresentInFile ( const std::string &  )
virtual

Checks if a nameed channel is present in the device.

Reimplemented from FiDeviceFunctionBase.

◆ isChannelPresentInFile() [2/2]

bool FiRPC3File::isChannelPresentInFile ( int  )
virtual

Checks if an indexed channel is present in the device.

Reimplemented from FiDeviceFunctionBase.

◆ preliminaryDeviceWrite()

bool FiRPC3File::preliminaryDeviceWrite ( )
protectedvirtual

Writes the meta data for this device function to file.

Implements FiDeviceFunctionBase.

◆ readChannelList()

bool FiRPC3File::readChannelList ( )
private

◆ readDouble()

double FiRPC3File::readDouble ( FT_int  pos,
bool  asciiField = false 
)
private

◆ readFloat()

float FiRPC3File::readFloat ( FT_int  pos,
bool  asciiField = false 
)
private

◆ readInt16()

short FiRPC3File::readInt16 ( FT_int  pos,
bool  asciiField = false 
)
private

◆ readInt32()

int FiRPC3File::readInt32 ( FT_int  pos,
bool  asciiField = false 
)
private

◆ readString()

std::string FiRPC3File::readString ( FT_int  pos,
bool  castToUpperCase = false 
)
private

◆ setAverages()

void FiRPC3File::setAverages ( int  avg)
inline

◆ setData()

bool FiRPC3File::setData ( const Doubles &  x,
const Doubles &  y 
)
virtual

Adds a complete set of x,y-pair values for a new channel.

Implements FiDeviceFunctionBase.

◆ setDescription()

void FiRPC3File::setDescription ( const std::string &  )
virtual

Assigns a name to the (last) channel in the device.

Reimplemented from FiDeviceFunctionBase.

◆ setFramePoints()

void FiRPC3File::setFramePoints ( int  frm)
inline

◆ setGroupPoints()

void FiRPC3File::setGroupPoints ( int  grp)
inline

◆ setKeyFloat()

void FiRPC3File::setKeyFloat ( const std::string &  key,
const float  val,
const int  numb 
)
private

◆ setKeyInt()

void FiRPC3File::setKeyInt ( const std::string &  key,
const int  val,
const int  numb 
)
private

◆ setKeyString()

void FiRPC3File::setKeyString ( const std::string &  key,
const std::string &  val,
const int  numb 
)
private

◆ setPrecision()

virtual void FiRPC3File::setPrecision ( int  )
inlinevirtual

Sets the precision to be used when writing the device to file.

Reimplemented from FiDeviceFunctionBase.

◆ setReadParams()

void FiRPC3File::setReadParams ( int  channel)
private

◆ setRepeats()

void FiRPC3File::setRepeats ( int  rep)
inline

◆ setTimeSpan()

virtual void FiRPC3File::setTimeSpan ( double  )
inlinevirtual

Sets the maximum time span for the device function.

Reimplemented from FiDeviceFunctionBase.

◆ setValue()

virtual void FiRPC3File::setValue ( double  x,
double  y 
)
inlinevirtual

Assigns a function value for a single-channel function.

Implements FiDeviceFunctionBase.

◆ writeDouble()

void FiRPC3File::writeDouble ( const double  val,
FT_int  pos,
bool  skipRepos = false 
)
private

◆ writeFloat()

void FiRPC3File::writeFloat ( const float  val,
FT_int  pos,
bool  skipRepos = false 
)
private

◆ writeInt16()

void FiRPC3File::writeInt16 ( const short  val,
FT_int  pos,
bool  skipRepos = false 
)
private

◆ writeString()

void FiRPC3File::writeString ( const std::string &  buf,
FT_int  pos,
bool  skipRepos = false 
)
private

Member Data Documentation

◆ kInd

int FiRPC3File::kInd
private

◆ myAverages

int FiRPC3File::myAverages
private

◆ myBypassFilter

bool FiRPC3File::myBypassFilter
private

◆ myByteShift

FT_int FiRPC3File::myByteShift
private

◆ myChannel

int FiRPC3File::myChannel
private

◆ myChannels

Strings FiRPC3File::myChannels
private

◆ myChannelScale

double FiRPC3File::myChannelScale
private

◆ myDataFormat

int FiRPC3File::myDataFormat
private

◆ myDataSize

int FiRPC3File::myDataSize
private

◆ myDataType

int FiRPC3File::myDataType
private

◆ myFileType

int FiRPC3File::myFileType
private

◆ myFirstReadValue

double FiRPC3File::myFirstReadValue
private

◆ myHalfFrameUse

bool FiRPC3File::myHalfFrameUse
private

◆ myKeys

Strings FiRPC3File::myKeys
private

◆ myMaxVal

double FiRPC3File::myMaxVal
private

◆ myMinVal

double FiRPC3File::myMinVal
private

◆ myNumChannels

int FiRPC3File::myNumChannels
private

◆ myNumDatavals

size_t FiRPC3File::myNumDatavals
private

◆ myNumFrames

int FiRPC3File::myNumFrames
private

◆ myNumFrmPts

int FiRPC3File::myNumFrmPts
private

◆ myNumGrpPts

int FiRPC3File::myNumGrpPts
private

◆ myNumHeaderBlocks

int FiRPC3File::myNumHeaderBlocks
private

◆ myNumParams

int FiRPC3File::myNumParams
private

◆ myNumPartitions

int FiRPC3File::myNumPartitions
private

◆ myPartition

int FiRPC3File::myPartition
private

◆ myPartShift

FT_int FiRPC3File::myPartShift
private

◆ myPhysChan

int FiRPC3File::myPhysChan
private

◆ myRepeats

int FiRPC3File::myRepeats
private

◆ myTimeSpan

double FiRPC3File::myTimeSpan
private

◆ myXaxisOrigin

double FiRPC3File::myXaxisOrigin
private

◆ parameters

std::map<int,chParams> FiRPC3File::parameters
private

◆ stepSet

bool FiRPC3File::stepSet
private

◆ swapStringBytes

bool FiRPC3File::swapStringBytes
private

The documentation for this class was generated from the following files: