Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ag-ohlberger
dune-community
dune-xt
Commits
b329b6f9
Commit
b329b6f9
authored
8 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[expression] apply clang-format to mathexpr.{cc,hh}
parent
58d06a83
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/xt/functions/expression/mathexpr.cc
+2002
-895
2002 additions, 895 deletions
dune/xt/functions/expression/mathexpr.cc
dune/xt/functions/expression/mathexpr.hh
+88
-53
88 additions, 53 deletions
dune/xt/functions/expression/mathexpr.hh
with
2090 additions
and
948 deletions
dune/xt/functions/expression/mathexpr.cc
+
2002
−
895
View file @
b329b6f9
This diff is collapsed.
Click to expand it.
dune/xt/functions/expression/mathexpr.hh
+
88
−
53
View file @
b329b6f9
...
...
@@ -19,16 +19,14 @@ This software comes with absolutely no warranty.
*/
// clang-format off
#ifndef DUNE_XT_FUNCTIONS_NONPARAMETRIC_EXPRESSION_MATHEXPRESSION_HH
#define DUNE_XT_FUNCTIONS_NONPARAMETRIC_EXPRESSION_MATHEXPRESSION_HH
#include
<string.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<math.h>
#include
<float.h>
#include
<string.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<math.h>
#include
<float.h>
// Compatibility with long double-typed functions
#define atanl atan
...
...
@@ -37,7 +35,7 @@ This software comes with absolutely no warranty.
#define expl exp
#define logl log
#define powl pow
#define pow10l(x) pow(10,x)
#define pow10l(x) pow(10,
x)
#define fabsl fabs
#define cosl cos
#define sinl sin
...
...
@@ -47,11 +45,12 @@ This software comes with absolutely no warranty.
// Warning : if ints are short, everything will fail with strings longer than 32767 chars
const
double
ErrVal
=
DBL_MAX
;
const
double
ErrVal
=
DBL_MAX
;
//Class definitions for operations
//
Class definitions for operations
class
RVar
{
class
RVar
{
public:
RVar
()
{
...
...
@@ -67,54 +66,88 @@ public:
friend
int
operator
==
(
const
RVar
&
,
const
RVar
&
);
char
*
name
;
double
*
pval
;
char
*
name
;
double
*
pval
;
};
typedef
RVar
*
PRVar
;
enum
ROperator
{
ErrOp
,
Juxt
,
Num
,
Var
,
Add
,
Sub
,
Opp
,
Mult
,
Div
,
Pow
,
Sqrt
,
NthRoot
,
Abs
,
Sin
,
Cos
,
Tg
,
Ln
,
Exp
,
Acos
,
Asin
,
Atan
,
E10
,
Fun
};
enum
ROperator
{
ErrOp
,
Juxt
,
Num
,
Var
,
Add
,
Sub
,
Opp
,
Mult
,
Div
,
Pow
,
Sqrt
,
NthRoot
,
Abs
,
Sin
,
Cos
,
Tg
,
Ln
,
Exp
,
Acos
,
Asin
,
Atan
,
E10
,
Fun
};
typedef
void
((
*
pfoncld
)(
double
*&
));
typedef
void
((
*
pfoncld
)(
double
*&
));
class
ROperation
;
typedef
ROperation
*
PROperation
;
class
RFunction
;
typedef
RFunction
*
PRFunction
;
class
ROperation
{
pfoncld
*
pinstr
;
double
**
pvals
;
double
*
ppile
;
RFunction
**
pfuncpile
;
class
ROperation
{
pfoncld
*
pinstr
;
double
**
pvals
;
double
*
ppile
;
RFunction
**
pfuncpile
;
mutable
signed
char
containfuncflag
;
void
BuildCode
();
void
Destroy
();
public:
public:
ROperator
op
;
PROperation
mmb1
,
mmb2
;
double
ValC
;
const
RVar
*
pvar
;
double
*
pvarval
;
PROperation
mmb1
,
mmb2
;
double
ValC
;
const
RVar
*
pvar
;
double
*
pvarval
;
RFunction
*
pfunc
;
ROperation
();
ROperation
(
const
ROperation
&
);
ROperation
(
double
);
ROperation
(
const
RVar
&
);
ROperation
(
const
char
*
sp
,
int
nvarp
=
0
,
PRVar
*
ppvarp
=
NULL
,
int
nfuncp
=
0
,
PRFunction
*
ppfuncp
=
NULL
);
ROperation
(
const
char
*
sp
,
int
nvarp
=
0
,
PRVar
*
ppvarp
=
NULL
,
int
nfuncp
=
0
,
PRFunction
*
ppfuncp
=
NULL
);
~
ROperation
();
double
Val
()
const
;
signed
char
ContainVar
(
const
RVar
&
)
const
;
signed
char
ContainFunc
(
const
RFunction
&
)
const
;
signed
char
ContainFuncNoRec
(
const
RFunction
&
)
const
;
// No recursive test on subfunctions
ROperation
NthMember
(
int
)
const
;
int
NMembers
()
const
;
signed
char
HasError
(
const
ROperation
*
=
NULL
)
const
;
ROperation
NthMember
(
int
)
const
;
int
NMembers
()
const
;
signed
char
HasError
(
const
ROperation
*
=
NULL
)
const
;
ROperation
&
operator
=
(
const
ROperation
&
);
friend
int
operator
==
(
const
ROperation
&
,
const
double
);
friend
int
operator
==
(
const
ROperation
&
,
const
ROperation
&
);
friend
int
operator
!=
(
const
ROperation
&
,
const
ROperation
&
);
ROperation
operator
+
()
const
;
ROperation
operator
-
()
const
;
friend
ROperation
operator
,(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
+
(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
-
(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
*
(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
/
(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
^
(
const
ROperation
&
,
const
ROperation
&
);
// Caution: wrong associativity and precedence
friend
int
operator
==
(
const
ROperation
&
,
const
double
);
friend
int
operator
==
(
const
ROperation
&
,
const
ROperation
&
);
friend
int
operator
!=
(
const
ROperation
&
,
const
ROperation
&
);
ROperation
operator
+
()
const
;
ROperation
operator
-
()
const
;
friend
ROperation
operator
,(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
+
(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
-
(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
*
(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
/
(
const
ROperation
&
,
const
ROperation
&
);
friend
ROperation
operator
^
(
const
ROperation
&
,
const
ROperation
&
);
// Caution: wrong associativity and precedence
friend
ROperation
sqrt
(
const
ROperation
&
);
friend
ROperation
abs
(
const
ROperation
&
);
friend
ROperation
sin
(
const
ROperation
&
);
...
...
@@ -125,40 +158,42 @@ class ROperation{
friend
ROperation
acos
(
const
ROperation
&
);
friend
ROperation
asin
(
const
ROperation
&
);
friend
ROperation
atan
(
const
ROperation
&
);
friend
ROperation
ApplyOperator
(
int
,
ROperation
**
,
ROperation
(
*
)(
const
ROperation
&
,
const
ROperation
&
));
friend
ROperation
ApplyOperator
(
int
,
ROperation
**
,
ROperation
(
*
)(
const
ROperation
&
,
const
ROperation
&
));
ROperation
Diff
(
const
RVar
&
)
const
;
// Differentiate w.r.t a variable
char
*
Expr
()
const
;
ROperation
Substitute
(
const
RVar
&
,
const
ROperation
&
)
const
;
ROperation
Substitute
(
const
RVar
&
,
const
ROperation
&
)
const
;
};
class
RFunction
{
double
*
buf
;
class
RFunction
{
double
*
buf
;
public:
signed
char
type
;
double
((
*
pfuncval
)(
double
));
ROperation
op
;
int
nvars
;
RVar
**
ppvar
;
char
*
name
;
double
((
*
pfuncval
)(
double
));
ROperation
op
;
int
nvars
;
RVar
**
ppvar
;
char
*
name
;
RFunction
();
RFunction
(
double
((
*
)(
double
)));
RFunction
(
const
ROperation
&
opp
,
RVar
*
pvarp
);
RFunction
(
const
ROperation
&
opp
,
int
nvarsp
,
RVar
**
ppvarp
);
RFunction
(
double
((
*
)(
double
)));
RFunction
(
const
ROperation
&
opp
,
RVar
*
pvarp
);
RFunction
(
const
ROperation
&
opp
,
int
nvarsp
,
RVar
**
ppvarp
);
RFunction
(
const
RFunction
&
);
~
RFunction
();
RFunction
&
operator
=
(
const
RFunction
&
);
void
SetName
(
const
char
*
s
);
void
SetName
(
const
char
*
s
);
double
Val
(
double
)
const
;
double
Val
(
double
*
)
const
;
friend
int
operator
==
(
const
RFunction
&
,
const
RFunction
&
);
friend
int
operator
==
(
const
RFunction
&
,
const
RFunction
&
);
ROperation
operator
()(
const
ROperation
&
);
};
char
*
MidStr
(
const
char
*
s
,
int
i1
,
int
i2
);
char
*
CopyStr
(
const
char
*
s
);
char
*
InsStr
(
const
char
*
s
,
int
n
,
char
c
);
signed
char
EqStr
(
const
char
*
s
,
const
char
*
s2
);
signed
char
CompStr
(
const
char
*
s
,
int
n
,
const
char
*
s2
);
char
*
DelStr
(
const
char
*
s
,
int
n
);
char
*
MidStr
(
const
char
*
s
,
int
i1
,
int
i2
);
char
*
CopyStr
(
const
char
*
s
);
char
*
InsStr
(
const
char
*
s
,
int
n
,
char
c
);
signed
char
EqStr
(
const
char
*
s
,
const
char
*
s2
);
signed
char
CompStr
(
const
char
*
s
,
int
n
,
const
char
*
s2
);
char
*
DelStr
(
const
char
*
s
,
int
n
);
#endif // DUNE_XT_FUNCTIONS_NONPARAMETRIC_EXPRESSION_MATHEXPRESSION_HH
// clang-format on
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment