DACE 2.0 API Manual
Differential Algebra Core Engine
DAFormatter.h
Go to the documentation of this file.
1 /******************************************************************************
2 * *
3 * DIFFERENTIAL ALGEBRA CORE ENGINE *
4 * *
5 *******************************************************************************
6 * *
7 * Copyright 2016 Politecnico di Milano (2014 Dinamica Srl) *
8 * Licensed under the Apache License, Version 2.0 (the "License"); *
9 * you may not use this file except in compliance with the License. *
10 * You may obtain a copy of the License at *
11 * *
12 * http://www.apache.org/licenses/LICENSE-2.0 *
13 * *
14 * Unless required by applicable law or agreed to in writing, software *
15 * distributed under the License is distributed on an "AS IS" BASIS, *
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17 * See the License for the specific language governing permissions and *
18 * limitations under the License. *
19 * *
20 *******************************************************************************/
21 
22 /*
23  * DAFormatter.h
24  *
25  * Created on: Oct 18, 2014
26  * Author: Dinamica Srl
27  */
28 
29 #ifndef DINAMICA_DAFORMATTER_H_
30 #define DINAMICA_DAFORMATTER_H_
31 
32 // C++ stdlib classes used in this public interface
33 #include <vector>
34 #include <string>
35 
36 namespace DACE{
37 
38 // forward declaration
39 class DA;
40 
43 {
44 public:
45  virtual std::string format(const DA &da) = 0;
46  virtual std::string format(const std::vector<DA> &da) = 0;
47 };
48 
53  std::string pos, neg, mul, pre_pow, var, pre_var, post_var, pow, post_pow, linebreak;
54  int first_var, first_pow;
55  unsigned int monperline;
56  bool shorten;
57 };
58 
61 {
62 public:
63  static const DASimpleFormat C;
64  static const DASimpleFormat C_POW;
65  static const DASimpleFormat FORTRAN;
67  static const DASimpleFormat MATLAB;
68  static const DASimpleFormat MATLAB_POW;
69  static const DASimpleFormat LATEX;
70 
72 
73  DASimpleFormatter() : sf(C) {};
74  DASimpleFormatter(const DASimpleFormat& isf) : sf(isf) {};
75 
76  std::string format(const DA &da);
77  std::string format(const std::vector<DA> &da);
78 };
79 
80 }
81 #endif /* DINAMICA_DAFORMATTER_H_ */
DASimpleFormat sf
Definition: DAFormatter.h:71
static const DASimpleFormat FORTRAN
Definition: DAFormatter.h:65
DA pow(const DA &da, int p)
Definition: DA.cpp:2105
bool shorten
Definition: DAFormatter.h:56
Definition: DAFormatter.h:60
DASimpleFormatter(const DASimpleFormat &isf)
Definition: DAFormatter.h:74
static const DASimpleFormat LATEX
Definition: DAFormatter.h:69
int first_var
Definition: DAFormatter.h:54
Definition: DA.h:57
static const DASimpleFormat C_POW
Definition: DAFormatter.h:64
std::string var
Definition: DAFormatter.h:53
Definition: DAFormatter.h:42
#define DACE_API
Definition: dace_s.h:33
Definition: AlgebraicMatrix.cpp:39
unsigned int monperline
Definition: DAFormatter.h:55
DASimpleFormatter()
Definition: DAFormatter.h:73
Definition: DAFormatter.h:52
static const DASimpleFormat MATLAB
Definition: DAFormatter.h:67
static const DASimpleFormat FORTRAN_POW
Definition: DAFormatter.h:66
static const DASimpleFormat C
Definition: DAFormatter.h:63
static const DASimpleFormat MATLAB_POW
Definition: DAFormatter.h:68