Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Phillip Lino Rall
UGBlocks_V3
Commits
d65f6a6f
Commit
d65f6a6f
authored
May 06, 2020
by
Christoph Pflaum
Browse files
iKOmmentare wohl nur
parent
62a65618
Changes
2
Hide whitespace changes
Inline
Side-by-side
program/source/extemp/functor.h
View file @
d65f6a6f
...
...
@@ -233,6 +233,27 @@ Exp_Functor1<A, DTyp_Result, DTyp, Func>::Give_fromTotal(int i) const {
/** \addtogroup ExpressionTemplates **/
/* @{ */
/**
* The class Func must contain a member function
* DTyp Func::evalute(DTyp x);
* Then, one apply Functor1 as follows
* \verbatim
* class Func test{
* public:
* Func(double f) : mf(f) {};
* double evaluate(double x) { return x * mf; }
* private:
* double mf;
* };
* .....
*
* Func multiplyFive(5.0);
* Functor1 multiplyFiveFunc(multiplyFive);
* .....
*
* a = multiplyFiveFunc(b);
* \endverbatim
**/
template
<
class
DTyp_Result
,
class
DTyp
,
class
Func
>
class
Functor1
{
public:
...
...
@@ -254,7 +275,6 @@ class Functor1 {
* 2 arguments
**/
template
<
class
A
,
class
B
,
class
DTyp_Result
,
class
DTyp
,
class
Func
>
class
Exp_Functor2
:
public
Expr
<
Exp_Functor2
<
A
,
B
,
DTyp_Result
,
DTyp
,
Func
>
>
{
const
A
&
a_
;
...
...
@@ -317,6 +337,11 @@ Exp_Functor2<A, B, DTyp_Result, DTyp, Func>::Give_fromTotal(int i) const {
/** \addtogroup ExpressionTemplates **/
/* @{ */
/**
* The class Func must contain a member function
* DTyp Func::evalute(DTyp x, DTyp y);
* see Functor1
**/
template
<
class
DTyp_Result
,
class
DTyp
,
class
Func
>
class
Functor2
{
...
...
@@ -420,8 +445,12 @@ Exp_Functor3<A, B, C, DTyp_Result, DTyp, Func>::Give_fromTotal(int i) const {
/** \addtogroup ExpressionTemplates **/
/* @{ */
/**
* The class Func must contain a member function
* DTyp Func::evalute(DTyp x, DTyp y, DTyp z);
* see Functor1
**/
template
<
class
DTyp_Result
,
class
DTyp
,
class
Func
>
class
Functor3
{
public:
...
...
@@ -510,8 +539,12 @@ Exp_Functor4<A, B, C, D, DTyp_Result, DTyp, Func>::Give_cell_hexahedra ( params_
/** \addtogroup ExpressionTemplates **/
/* @{ */
/**
* The class Func must contain a member function
* DTyp Func::evalute(DTyp x, DTyp y);
* see Functor1
**/
template
<
class
DTyp_Result
,
class
DTyp
,
class
Func
>
class
Functor4
{
public:
...
...
program2D/source/extemp/extemp2D.h
View file @
d65f6a6f
...
...
@@ -735,26 +735,26 @@ class SaveDiv2D : public Expr2D<SaveDiv2D<A, B> > {
template
<
elementTyp
TYP_EL
>
inline
Result
Give_data
(
params2D_in
)
const
{
Result
valueB
=
b_
.
template
Give_data
<
TYP_EL
>
(
params2D_out
);
if
(
abs
(
valueB
)
<
saveDivision2D
::
eps
)
return
0.0
;
if
(
myABS
(
valueB
)
<
saveDivision2D
::
eps
)
return
0.0
;
return
a_
.
template
Give_data
<
TYP_EL
>
(
params2D_out
)
/
valueB
;
}
template
<
sten_part_typ
TYP_EL
>
inline
Result
Give_data_sten
(
params2D_in_sten
)
const
{
Result
valueB
=
b_
.
template
Give_data_sten
<
TYP_EL
>
(
params2D_out_sten
);
if
(
abs
(
valueB
)
<
saveDivision2D
::
eps
)
return
0.0
;
if
(
myABS
(
valueB
)
<
saveDivision2D
::
eps
)
return
0.0
;
return
a_
.
template
Give_data_sten
<
TYP_EL
>
(
params2D_out_sten
)
/
valueB
;
}
inline
Result
Give_matrix_rectangle
(
params2D_in_loc_matrix
)
const
{
Result
valueB
=
b_
.
Give_matrix_rectangle
(
params2D_out_loc_matrix
);
if
(
abs
(
valueB
)
<
saveDivision2D
::
eps
)
return
0.0
;
if
(
myABS
(
valueB
)
<
saveDivision2D
::
eps
)
return
0.0
;
return
a_
.
Give_matrix_rectangle
(
params2D_out_loc_matrix
)
/
valueB
;
}
inline
Result
Give_cell_rectangle
(
params2D_in_cell
)
const
{
Result
valueB
=
b_
.
Give_cell_rectangle
(
params2D_out_cell
);
if
(
abs
(
valueB
)
<
saveDivision2D
::
eps
)
return
0.0
;
if
(
myABS
(
valueB
)
<
saveDivision2D
::
eps
)
return
0.0
;
return
a_
.
Give_cell_rectangle
(
params2D_out_cell
)
/
valueB
;
}
...
...
@@ -767,6 +767,12 @@ class SaveDiv2D : public Expr2D<SaveDiv2D<A, B> > {
inline
Unstructured2DGrid
*
Give_Ug
()
const
{
return
a_
.
Give_Ug
();
}
private:
static
double
myABS
(
double
a
)
{
return
a
<
0.0
?
-
a
:
a
;
}
static
std
::
complex
<
double
>
myABS
(
std
::
complex
<
double
>
c
)
{
return
(
c
.
real
()
<
0.0
?
-
c
.
real
()
:
c
.
real
())
+
(
c
.
imag
()
<
0.0
?
-
c
.
imag
()
:
c
.
imag
());
}
};
//----------------------------------------------------------------------------
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment