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

ASCII file for curve plotting. More...

#include <FiCurveASCFile.H>

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

Public Member Functions

 FiCurveASCFile (const char *devicename=NULL)
 Default constructor. More...
 
virtual size_t getValueCount () const
 Returns the number of (x,y) pairs for this device. More...
 
virtual double getValue (double, int, bool, double, double)
 Evaluates the function for a given x value. More...
 
virtual bool getValues (double, double, Doubles &x, Doubles &y, int, bool, double, double)
 Evaluates the function at all points within specified interval. More...
 
virtual void getRawData (Doubles &x, Doubles &y, double, double, int)
 Extracts all function data point values within specified interval. More...
 
virtual void setValue (double x, double y)
 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 void setPrecision (int type)
 Sets the precision to be used when writing the device to file. More...
 
- 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 void getValueRange (double &mn, double &mx) const
 Calculates the function value range for this device. More...
 
virtual double getXAxisOrigin () const
 Returns the function argument origin for this device. More...
 
virtual bool getChannelList (Strings &)
 Gets the list channel names for a multi-channel device. More...
 
virtual bool isChannelPresentInFile (int)
 Checks if an indexed channel is present in the device. More...
 
virtual int isChannelPresentInFile (const std::string &)
 Checks if a nameed channel is present in the device. More...
 
virtual void setTimeSpan (double)
 Sets the maximum time span for the device function. More...
 
virtual void getData (Doubles &x, Doubles &y, const std::string &, double minX=0.0, double maxX=-1.0)
 Extracts all function data point values within specified interval. 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 setDescription (const std::string &)
 Assigns a name to the (last) channel in the device. 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 concludingDeviceWrite (bool)
 Writes the content of this device function to file. More...
 
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...
 
- 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 Attributes

Doubles myXValues
 X-axis curve data values. More...
 
Doubles myYValues
 Y-axis curve data values. More...
 
int outputFormat
 0: 4-digits, 1: 8 digits, 2: 16-digits More...
 

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...
 

Detailed Description

ASCII file for curve plotting.

This class is very much like FiASCFile, but uses vectors to store data instead of maps. This allows for export/import of curves with any shape, and not only for strictly growing x-values.

There will be no interpolation, scaling or shifting what so ever. Just raw data in and out.

Constructor & Destructor Documentation

◆ FiCurveASCFile()

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

Default constructor.

Member Function Documentation

◆ concludingDeviceWrite()

bool FiCurveASCFile::concludingDeviceWrite ( bool  noHeader)
protectedvirtual

Writes the content of this device function to file.

Implements FiDeviceFunctionBase.

◆ getRawData()

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

Extracts all function data point values within specified interval.

Implements FiDeviceFunctionBase.

◆ getValue()

virtual double FiCurveASCFile::getValue ( double  x,
int  channel,
bool  zeroAdjust,
double  vertShift,
double  scaleFac 
)
inlinevirtual

Evaluates the function for a given x value.

Implements FiDeviceFunctionBase.

◆ getValueCount()

virtual size_t FiCurveASCFile::getValueCount ( ) const
inlinevirtual

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

Implements FiDeviceFunctionBase.

◆ getValues()

bool FiCurveASCFile::getValues ( double  x0,
double  x1,
Doubles &  x,
Doubles &  y,
int  channel,
bool  zeroAdjust,
double  shift,
double  scale 
)
virtual

Evaluates the function at all points within specified interval.

Implements FiDeviceFunctionBase.

◆ initialDeviceRead()

bool FiCurveASCFile::initialDeviceRead ( )
protectedvirtual

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

Implements FiDeviceFunctionBase.

◆ preliminaryDeviceWrite()

virtual bool FiCurveASCFile::preliminaryDeviceWrite ( )
inlineprotectedvirtual

Writes the meta data for this device function to file.

Implements FiDeviceFunctionBase.

◆ setData()

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

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

Implements FiDeviceFunctionBase.

◆ setPrecision()

virtual void FiCurveASCFile::setPrecision ( int  )
inlinevirtual

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

Reimplemented from FiDeviceFunctionBase.

◆ setValue()

void FiCurveASCFile::setValue ( double  x,
double  y 
)
virtual

Assigns a function value for a single-channel function.

Implements FiDeviceFunctionBase.

Member Data Documentation

◆ myXValues

Doubles FiCurveASCFile::myXValues
private

X-axis curve data values.

◆ myYValues

Doubles FiCurveASCFile::myYValues
private

Y-axis curve data values.

◆ outputFormat

int FiCurveASCFile::outputFormat
private

0: 4-digits, 1: 8 digits, 2: 16-digits


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