Fuse.Problem
Public Member Functions | Public Attributes | List of all members
Problem< FP > Class Template Reference

The problem container class that abstract the device of filesystem. More...

#include <problem.h>

Public Member Functions

 Problem (const char *dl)
 Initialization, calls init method. More...
 
 ~Problem ()
 Destroyes the Problem<FP> class. More...
 
size_t write (FunctionInput type, const char *buf)
 representation of the libfuse write operation More...
 
int read (int type, char *buf, size_t size, size_t offset)
 representation of the libfuse read operation More...
 
int pathid (const char *path)
 gives a number that identifies the file in path More...
 
size_t size (FunctionOutput t)
 Returns the size (dimensions) of specified element. More...
 
size_t filesize (FunctionOutput t, int i=0)
 number of characters in file More...
 

Public Attributes

vector< FP > x
 
vector< FP > p
 
vector< FP > y
 

Detailed Description

template<class FP>
class Problem< FP >

The problem container class that abstract the device of filesystem.

This is a container of the problem. It handles loading and unloading of the shared object and also parses filesystem input. It contains string representation for the files and pointer to externally declared functions. The problem precision is unader the template class FP, and it can be float or double. Usually the real problem precision is described in PROBLEM_PRECISION macro.

Constructor & Destructor Documentation

◆ Problem()

template<class FP >
Problem< FP >::Problem ( const char *  dl)
inline

Initialization, calls init method.

The initialization function calls the init method and set some of the internal properties to initial values.

Parameters
dlpath to external shared object
Returns
Problem<FP> new instance

◆ ~Problem()

template<class FP >
Problem< FP >::~Problem ( )
inline

Destroyes the Problem<FP> class.

Calls close method.

Member Function Documentation

◆ filesize()

template<class FP >
size_t Problem< FP >::filesize ( FunctionOutput  t,
int  i = 0 
)

number of characters in file

Number of characters in specified file. The second argument is used to specify the number of output file.

Parameters
ttype of file to query
ielement number in y_file vector, default to 0 when not needed

◆ pathid()

template<class FP >
int Problem< FP >::pathid ( const char *  path)

gives a number that identifies the file in path

Returns a number that identifies the file in path. It returns a PROBLEM_E_NOFILE when the file does not exist. If number is negative, it is one of the fixed files, while if it is positive is one of the output files.

Parameters
paththe required file path
Returns
an integer that identifies the file (w.r.t FunctionOutput)

◆ read()

template<class FP >
int Problem< FP >::read ( int  type,
char *  buf,
size_t  size,
size_t  offset 
)

representation of the libfuse read operation

It is the equivalent of the read operation from fuse. The first int value is the file identification from pathid, and the content of the file is inserted into the buffer buf, starting from the offset point, till reaching the size. Obviously, file size is truncated when requested segment is bigger than content. The function returns an integer, that is the number of bytes written into buf. This int format is required libfuse. That means we set a direct I/O filesystem type (see fpr_read function)

Parameters
typefile that is currently required
bufthe buffer in which informations will be copied
sizethe number of byte maximum for buf
offsetthe offset in byte since last reading
Returns
number of byte written in buf

◆ size()

template<class FP >
size_t Problem< FP >::size ( FunctionOutput  t)

Returns the size (dimensions) of specified element.

Returns the number of dimensions for vector x, vector p and number of functions in f.

Parameters
ttype of vector size to query
Returns
a size_t value

◆ write()

template<class FP >
size_t Problem< FP >::write ( FunctionInput  type,
const char *  buf 
)

representation of the libfuse write operation

It is the equivalent of the write operation from fuse. Already handles size, thus it is not in parameter list. Once called, it also calls update method to regenerate all internal representations. TODO: must be simplified and broken in smaller pieces.

Parameters
typeFunctionInput enum value to understand what is being written
bufthe buffer that is being written.
Returns
the number of variable updated.

Member Data Documentation

◆ p

template<class FP >
vector<FP> Problem< FP >::p

last values of parameters p

◆ x

template<class FP >
vector<FP> Problem< FP >::x

last values of input x

◆ y

template<class FP >
vector<FP> Problem< FP >::y

last value of last evaluated function (it is garbage)


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