Case.h
Go to the documentation of this file.
1
9/*====================================================================================================================*/
10/*== Guards, Includes ==============================================================================================*/
11/*====================================================================================================================*/
12
13// INCLUDE GUARDS
14//
15#ifndef LIBPF_USER_CASE_H
16#define LIBPF_USER_CASE_H
17
18/* SYSTEM INCLUDES */
19//
20#include <string> // for string
21
22/* PROJECT INCLUDES */
23//
24
25/* LOCAL INCLUDES */
26//
27#include <libpf/user/Handle.h>
28#include <libpf/core/SensitivityResult.h>
29
30/* FORWARD REFERENCES */
31//
32class SensitivityInput;
33class HomotopyInput;
34
35namespace Libpf {
36namespace User {
37
38/*====================================================================================================================*/
39/*== class CallBack declaration =====================================================================================*/
40/*====================================================================================================================*/
41
45class CallBack {
46protected:
47 std::string message_;
48public:
49 CallBack(std::string message);
50 virtual ~CallBack();
51 virtual void run(const std::string &data);
52}; // class CallBack
53
54/*====================================================================================================================*/
55/*== class Case declaration =========================================================================================*/
56/*====================================================================================================================*/
57
59class Case {
60private:
61 void *pimpl_;
62 Case(const Case&); // disable default copy contructor
63 Case& operator=(const Case&); // disable default assignment operator
64public:
65 enum ErrorCode { ERROR_OK = 0,
69 ERROR_SERVER = -84
70 }; // enum ErrorCode
71
74 Case(const Handle &handle);
76 ~Case(void);
77
81 int setTag(const char *tag);
85 int setDescription(const char *desc);
88 int abort(void);
89
92 int calculate(void);
96 int calculateSync(void);
99 int check(void);
105 int sensitivity(const SensitivityInput &sensitivityInput);
111 int sensitivity(const std::string &jsonSensitivityInput);
117 SensitivityResult sensitivitySync(const SensitivityInput &sensitivityInput, int &error);
123 std::string sensitivitySync(const std::string &jsonSensitivityInput, int &error);
124
128 int homotopy(const HomotopyInput &homotopyInput);
133 int homotopy(const std::string &jsonHomotopyInput);
138 int homotopySync(const HomotopyInput &homotopyInput);
142 int homotopySync(const std::string &jsonHomotopyInput);
143
148 double get(const std::string &path, int &error);
154 double get(const std::string &path, const std::string &unit, int &error);
159 int getInteger(const std::string &path, int &error);
164 std::string getString(const std::string &path, int &error);
165
184
188 int exportDataBase(const std::string &sqliteFileName) const;
192 int exportTxt(const std::string &txtFileName) const;
196 int exportJson(const std::string &jsonFileName) const;
200 int exportOds(const std::string &xmlFileName) const;
201
206 int set(const HomotopyInput &homotopyInput);
211 int set(const std::string &jsonHomotopyInput);
212
218 std::vector<std::string> exportSvgs(const std::string &dir, bool tiny, int &error);
219
223 int exportXml(const std::string &dir);
224
227 int setTest(void);
228
232 int setCheck(void);
233
234/*
237 void exportAllXml();
238*/
240 bool isValid(void) const;
241
244 static std::string errorMessage(int error);
245
246#ifndef SWIG
248 void *model(void);
249#endif
250}; // class Case
251
252} // namespace User
253} // namespace Libpf
254
255#endif // LIBPF_USER_CASE_H
Interface to the Handle class.
To define a call-back to be invoked when the asynchronous Case operations finish.
Definition: Case.h:45
virtual void run(const std::string &data)
CallBack(std::string message)
std::string message_
Definition: Case.h:47
An instance of a model - knows about variables, can be calculated and can export data to various form...
Definition: Case.h:59
int homotopySync(const HomotopyInput &homotopyInput)
synchronously perform homotopy calculation
void setCalculateFinishCallBack(CallBack *callBack)
sets the call back function to be called at the end of the execution of calculate
int set(const std::string &jsonHomotopyInput)
set one or more quantities
void setCalculateRunningCallBack(CallBack *callBack)
sets the call back function to be repeatedly called during the execution of calculate
int setTag(const char *tag)
change the tag of the instance
int exportDataBase(const std::string &sqliteFileName) const
export database snapshot of all data related to the case instance in sqlite3 format
int exportOds(const std::string &xmlFileName) const
export stream table in ODF format
int calculate(void)
asynchronously calculate the case; emits a number of calculateRunning signals and the calculateFinish...
int getInteger(const std::string &path, int &error)
get integer
static std::string errorMessage(int error)
bool isValid(void) const
server-side validation
SensitivityResult sensitivitySync(const SensitivityInput &sensitivityInput, int &error)
synchronously perform sensitivity calculation
int exportJson(const std::string &jsonFileName) const
export JSON file report of all data related to the case instance
void setIntermediateSensitivityResultsCallBack(CallBack *callBack)
sets the call back function to be repeatedly called during the execution of sensitivity
double get(const std::string &path, int &error)
get quantity
ErrorCode
Definition: Case.h:65
@ ERROR_ARGUMENT
supplied argument is not valid
Definition: Case.h:68
@ ERROR_SERVER
server-side error while performing the operation
Definition: Case.h:69
@ ERROR_COMMUNICATION
communication problem
Definition: Case.h:67
@ ERROR_INVALID
Case object is not in a valid state.
Definition: Case.h:66
@ ERROR_OK
no error
Definition: Case.h:65
std::string getString(const std::string &path, int &error)
get string
double get(const std::string &path, const std::string &unit, int &error)
get quantity in specified units
int homotopySync(const std::string &jsonHomotopyInput)
synchronously perform homotopy calculation
int homotopy(const std::string &jsonHomotopyInput)
asynchronously perform homotopy calculation emits a number of homotopyRunning signals and the homotop...
int setCheck(void)
enable check features: additional diagnostic and verbose recalculation can be used to perform a test ...
int exportTxt(const std::string &txtFileName) const
export text file report of all data related to the case instance
void setHomotopyFinishCallBack(CallBack *callBack)
sets the call back function to be called at the end of the execution of homotopy
int exportXml(const std::string &dir)
export to XML: recursively print all Quantities, Strings and Integers to xml files in the directory d...
~Case(void)
destructor
int abort(void)
interrupts the current calculation, sensitivity or homotopy
int calculateSync(void)
synchronously calculate the case
int setDescription(const char *desc)
change the description of the instance
int homotopy(const HomotopyInput &homotopyInput)
asynchronously perform homotopy calculation emits a number of homotopyRunning signals and the homotop...
Case(const Handle &handle)
Establishes a connection to the case.
void setSensitivityFinishCallBack(CallBack *callBack)
sets the call back function to be called at the end of the execution of sensitivity
int check(void)
internal utility function
int sensitivity(const std::string &jsonSensitivityInput)
asynchronously perform sensitivity calculation emits N times (with N = the number of rows in the sens...
std::string sensitivitySync(const std::string &jsonSensitivityInput, int &error)
synchronously perform sensitivity calculation
std::vector< std::string > exportSvgs(const std::string &dir, bool tiny, int &error)
export all objects as SVGs
int sensitivity(const SensitivityInput &sensitivityInput)
asynchronously performs sensitivity calculation emits N times (with N = the number of rows in the sen...
int setTest(void)
enable test features: additional diagnostic and solution verification
void setHomotopyRunningCallBack(CallBack *callBack)
sets the call back function to be repeatedly called during the execution of homotopy
void * model(void)
internal use only !
int set(const HomotopyInput &homotopyInput)
set one or more quantities
Opaque pointer to a server-side resource i.e. a Case object.
Definition: Handle.h:43
Definition: Case.h:35