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
efadcb70
Commit
efadcb70
authored
Apr 20, 2020
by
Christoph Pflaum
Browse files
mit HIlfe von Phillip
parent
f6c640fc
Changes
16
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
efadcb70
...
...
@@ -3,4 +3,8 @@
/Default/
/QMake-build/
/build-program-Desktop-Debug/
bin_o/
\ No newline at end of file
bin_o/
html
latex
run
*.dx
config.pri
View file @
efadcb70
...
...
@@ -29,7 +29,8 @@ unix: VTK_LIBS = \
# Pathes
# -Home Directory
HOME_DIR = /home/pflaum/Documents/asld/repos_mysev/customers/branches/externSoftware
HOME_DIR = /home/pflaum/UGBlocks
#HOME_DIR = ../../
# -UGBlocks Directory
UGBLOCKS_PATH = $${HOME_DIR}/UGBlocks_V3
...
...
program/Makefile
0 → 100644
View file @
efadcb70
This source diff could not be displayed because it is too large. You can
view the blob
instead.
program/program.pro
View file @
efadcb70
...
...
@@ -4,7 +4,6 @@
unix
:
TEMPLATE
=
app
TARGET
=
run
...
...
program/source/extemp/co_fu.h
View file @
efadcb70
...
...
@@ -45,10 +45,14 @@ Ny-1 * + + + + *
0 1 2 3 Nx-1 Nx
*/
///////////////////////////
// 1. Coordinate
///////////////////////////
/** \defgroup ExpressionTemplates ''Expression Template Operators (excluding +,-,... ) ''
**/
/* @{ */
class
X_coordinate
:
public
Expr
<
X_coordinate
>
{
public:
...
...
@@ -76,7 +80,7 @@ class X_coordinate : public Expr<X_coordinate> {
private:
Blockgrid
*
blockgrid
;
};
/* @} */
inline
double
X_coordinate
::
Give_cell_hexahedra
(
params_in_cell
)
const
{
// return blockgrid->Give_coord_hexahedron(id_hex, i, j, k).x;
...
...
@@ -111,6 +115,8 @@ inline double X_coordinate::Give_data<pointEl> ( params_in ) const {
return
blockgrid
->
Give_coord_point
(
id
).
x
;
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
class
Y_coordinate
:
public
Expr
<
Y_coordinate
>
{
public:
...
...
@@ -137,6 +143,7 @@ class Y_coordinate : public Expr<Y_coordinate> {
private:
Blockgrid
*
blockgrid
;
};
/* @} */
inline
double
Y_coordinate
::
Give_cell_hexahedra
(
params_in_cell
)
const
{
return
0.125
*
(
blockgrid
->
Give_coord_hexahedron
(
id_hex
,
i
,
j
,
k
).
y
+
...
...
@@ -171,6 +178,8 @@ inline double Y_coordinate::Give_data<pointEl> ( params_in ) const {
//////////////////////////////////////////////////////////////////////
/** \addtogroup ExpressionTemplates **/
/* @{ */
class
Z_coordinate
:
public
Expr
<
Z_coordinate
>
{
public:
...
...
@@ -197,6 +206,7 @@ class Z_coordinate : public Expr<Z_coordinate> {
private:
Blockgrid
*
blockgrid
;
};
/* @} */
inline
double
Z_coordinate
::
Give_cell_hexahedra
(
params_in_cell
)
const
{
return
0.125
*
(
blockgrid
->
Give_coord_hexahedron
(
id_hex
,
i
,
j
,
k
).
z
+
...
...
@@ -236,6 +246,8 @@ inline double Z_coordinate::Give_data<pointEl> ( params_in ) const {
// 2. Meshsize_x,y,z
///////////////////////////
/** \addtogroup ExpressionTemplates **/
/* @{ */
///////// x-direction
class
X_meshsize
:
public
Expr
<
X_meshsize
>
{
...
...
@@ -263,6 +275,7 @@ class X_meshsize : public Expr<X_meshsize> {
private:
Blockgrid
*
blockgrid
;
};
/* @} */
inline
double
X_meshsize
::
Give_cell_hexahedra
(
params_in_cell
)
const
{
return
0.25
*
ABS
(
(
blockgrid
->
Give_coord_hexahedron
(
id_hex
,
i
+
1
,
j
,
k
).
z
+
...
...
@@ -275,6 +288,8 @@ inline double X_meshsize::Give_cell_hexahedra ( params_in_cell ) const {
blockgrid
->
Give_coord_hexahedron
(
id_hex
,
i
,
j
+
1
,
k
+
1
).
z
)
);
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
///////// y-direction
class
Y_meshsize
:
public
Expr
<
Y_meshsize
>
{
...
...
@@ -302,6 +317,7 @@ class Y_meshsize : public Expr<Y_meshsize> {
private:
Blockgrid
*
blockgrid
;
};
/* @} */
inline
double
Y_meshsize
::
Give_cell_hexahedra
(
params_in_cell
)
const
{
return
0.25
*
ABS
(
(
blockgrid
->
Give_coord_hexahedron
(
id_hex
,
i
,
j
+
1
,
k
).
z
+
...
...
@@ -314,6 +330,8 @@ inline double Y_meshsize::Give_cell_hexahedra ( params_in_cell ) const {
blockgrid
->
Give_coord_hexahedron
(
id_hex
,
i
+
1
,
j
,
k
+
1
).
z
)
);
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
///////// z-direction
class
Z_meshsize
:
public
Expr
<
Z_meshsize
>
{
...
...
@@ -341,6 +359,7 @@ class Z_meshsize : public Expr<Z_meshsize> {
private:
Blockgrid
*
blockgrid
;
};
/* @} */
inline
double
Z_meshsize
::
Give_cell_hexahedra
(
params_in_cell
)
const
{
return
0.25
*
ABS
(
(
blockgrid
->
Give_coord_hexahedron
(
id_hex
,
i
,
j
,
k
+
1
).
z
+
...
...
@@ -448,6 +467,8 @@ inline DTyp_Result Exp_Function1<A, DTyp, DTyp_Result>::Give_fromTotal(int i) co
return
Formula_
(
a_
.
Give_fromTotal
(
i
));
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
template
<
class
DTyp_Result
,
class
DTyp
>
class
Function1
{
...
...
@@ -462,7 +483,7 @@ class Function1 {
DTyp_Result
(
*
Formula
)
(
DTyp
x
);
control_typ
funCtrTyp_
;
};
/* @} */
// 2 arguments
...
...
@@ -524,6 +545,8 @@ inline DTyp Exp_Function2<A, B, DTyp>::Give_fromTotal(int i) const {
b_
.
Give_fromTotal
(
i
)
);
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
template
<
class
DTyp
>
class
Function2
{
...
...
@@ -541,6 +564,7 @@ class Function2 {
DTyp
(
*
Formula
)
(
DTyp
x
,
DTyp
y
);
control_typ
funCtrTyp_
;
};
/* @} */
// 3 arguments
...
...
@@ -611,8 +635,9 @@ inline DTyp Exp_Function3<A, B, C, DTyp>::Give_fromTotal(int i) const {
c_
.
Give_fromTotal
(
i
)
);
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
template
<
class
DTyp
>
class
Function3
{
public:
...
...
@@ -630,6 +655,7 @@ class Function3 {
DTyp
(
*
Formula
)
(
DTyp
x
,
DTyp
y
,
DTyp
z
);
control_typ
funCtrTyp_
;
};
// 4 arguments
/* @} */
template
<
class
A
,
class
B
,
class
C
,
class
D
,
class
DTyp
,
class
DTyp_Result
>
...
...
@@ -706,6 +732,8 @@ inline DTyp_Result Exp_Function4<A, B, C, D, DTyp, DTyp_Result>::Give_fromTotal(
d_
.
Give_fromTotal
(
i
)
);
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
template
<
class
DTyp
,
class
DTyp_Result
>
class
Function4
{
...
...
@@ -725,7 +753,7 @@ class Function4 {
DTyp_Result
(
*
Formula
)
(
DTyp
x
,
DTyp
y
,
DTyp
z
,
DTyp
z2
);
control_typ
funCtrTyp_
;
};
/* @} */
//////////////////////////////////////////////////////////////
...
...
@@ -798,6 +826,8 @@ inline DTyp_Result Exp_Function3R<A, B, C, DTyp, DTyp_Result>::Give_fromTotal(in
c_
.
Give_fromTotal
(
i
)
);
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
template
<
class
DTyp_Result
,
class
DTyp
>
class
Function3R
{
...
...
@@ -816,7 +846,7 @@ class Function3R {
DTyp_Result
(
*
Formula
)
(
DTyp
x
,
DTyp
y
,
DTyp
z
);
control_typ
funCtrTyp_
;
};
/* @} */
#endif // CO_FU_H
program/source/extemp/extemp.cc
View file @
efadcb70
...
...
@@ -27,7 +27,13 @@
#include
"../abbrevi.h"
#include
"../parameter.h"
#include
"../math_lib/math_lib.h"
#include
"../basics/basic.h"
#include
"../grid/elements.h"
#include
"../grid/parti.h"
#include
"../grid/ug.h"
#include
"../grid/blockgrid.h"
#include
"extemp.h"
double
S
aveDiv
::
eps
Div
=
1.0e-
8
0
;
double
s
aveDiv
ision
::
eps
=
1.0e-
4
0
;
program/source/extemp/extemp.h
View file @
efadcb70
...
...
@@ -754,5 +754,108 @@ inline VDiv<A, B> operator/ ( const Expr<A>& a, const Expr<B>& b ) {
return
VDiv
<
A
,
B
>
(
a
,
b
);
}
//----------------------------------------------------------------------------
/** \addtogroup ExpressionTemplates **/
/* @{ */
/**
* epsilin Parameter for save division
**/
struct
saveDivision
{
static
double
eps
;
};
/* @} */
template
<
class
A
,
class
B
>
class
SaveDiv
:
public
Expr
<
SaveDiv
<
A
,
B
>
>
{
const
A
&
a_
;
const
B
&
b_
;
public:
inline
SaveDiv
(
const
A
&
a
,
const
B
&
b
)
:
a_
(
a
),
b_
(
b
)
{}
Blockgrid
*
Give_blockgrid
()
const
{
if
(
a_
.
Give_blockgrid
()
==
NULL
)
return
b_
.
Give_blockgrid
();
return
a_
.
Give_blockgrid
();
};
stencil_typ
Give_stencil_typ
()
const
{
if
(
a_
.
Give_stencil_typ
()
==
yes_stencil
)
return
yes_stencil
;
return
b_
.
Give_stencil_typ
();
}
bool
totalCalcNotPossible
()
const
{
if
(
a_
.
totalCalcNotPossible
())
return
true
;
return
b_
.
totalCalcNotPossible
();
};
int
getTotalNumberData
()
const
{
return
a_
.
getTotalNumberData
();
}
control_typ
Give_control_typ
()
const
{
if
(
a_
.
Give_control_typ
()
==
not_thread_save
)
{
return
not_thread_save
;
}
return
b_
.
Give_control_typ
();
}
typedef
_TypeOf2_
(
A
,
B
)
Result
;
template
<
elementTyp
TYP_EL
>
inline
Result
Give_data
(
params_in
)
const
{
Result
valueB
=
b_
.
template
Give_data
<
TYP_EL
>
(
params_out
);
if
(
abs
(
valueB
)
<
saveDivision
::
eps
)
return
0.0
;
return
a_
.
template
Give_data
<
TYP_EL
>
(
params_out
)
/
valueB
;
}
template
<
sten_part_typ
TYP_EL
>
inline
Result
Give_data_sten
(
params_in_sten
)
const
{
Result
valueB
=
b_
.
template
Give_data_sten
<
TYP_EL
>
(
params_out_sten
);
if
(
abs
(
valueB
)
<
saveDivision
::
eps
)
return
0.0
;
return
a_
.
template
Give_data_sten
<
TYP_EL
>
(
params_out_sten
)
/
valueB
;
}
inline
Result
Give_matrix_hexahedra
(
params_in_loc_matrix
)
const
{
Result
valueB
=
b_
.
Give_matrix_hexahedra
(
params_out_loc_matrix
);
if
(
abs
(
valueB
)
<
saveDivision
::
eps
)
return
0.0
;
return
a_
.
Give_matrix_hexahedra
(
params_out_loc_matrix
)
/
valueB
;
}
inline
Result
Give_cell_hexahedra
(
params_in_cell
)
const
{
Result
valueB
=
b_
.
Give_cell_hexahedra
(
params_out_cell
);
if
(
abs
(
valueB
)
<
saveDivision
::
eps
)
return
0.0
;
return
a_
.
Give_cell_hexahedra
(
params_out_cell
)
/
valueB
;
}
inline
Result
Give_fromTotal
(
int
i
)
const
{
Result
valueB
=
b_
.
Give_fromTotal
(
i
);
if
(
abs
(
valueB
)
<
saveDivision
::
eps
)
return
0.0
;
return
a_
.
Give_fromTotal
(
i
)
/
valueB
;
}
template
<
elementTyp
TYP_EL
>
void
Update
(
int
id
)
const
{
a_
.
template
Update
<
TYP_EL
>
(
id
);
b_
.
template
Update
<
TYP_EL
>
(
id
);
}
};
//----------------------------------------------------------------------------
/** \addtogroup ExpressionTemplates **/
/* @{ */
/**
* performs save division. This means if divisor is smaller than saveDivision::eps, then result is 0.0
**/
template
<
class
A
,
class
B
>
inline
SaveDiv
<
A
,
B
>
saveDiv
(
const
Expr
<
A
>&
a
,
const
Expr
<
B
>&
b
)
{
return
SaveDiv
<
A
,
B
>
(
a
,
b
);
}
/* @} */
//----------------------------------------------------------------------------
#endif // EXTEMP_H
program/source/grid/blockgrid.h
View file @
efadcb70
...
...
@@ -33,6 +33,9 @@ template <class DTyp>
class
Variable
;
class
Blockgrid
;
/** \defgroup GridGeneration ''Grid Generation''
**/
/* @{ */
class
Blockgrid_coordinates
{
public:
Blockgrid_coordinates
(
Blockgrid
*
bg_
)
:
bg
(
bg_
){};
...
...
@@ -152,6 +155,6 @@ class Blockgrid {
int
id_of_grid
;
static
int
id_count_grid
;
};
/* @} */
#endif // BLOCKGRID_H
program/source/grid/compose_grid.h
View file @
efadcb70
...
...
@@ -21,6 +21,8 @@
#include
<vector>
#include
"blockgrid.h"
/** \addtogroup GridGeneration **/
/* @{ */
/**
* Composition von unterschiedlichen Gittern
*
...
...
@@ -74,7 +76,7 @@ class ComposeBlockGrid : public Blockgrid {
std
::
vector
<
double
>
transZ
;
};
/* @} */
...
...
program/source/grid/examples_ug.h
View file @
efadcb70
...
...
@@ -20,6 +20,8 @@
#define EXAMPLES_UG_H
#include
<vector>
/** \addtogroup GridGeneration **/
/* @{ */
/**
* Normaler Hexaeder
*
...
...
@@ -300,7 +302,7 @@ private:
friend
class
UGFrom3DSlice
;
};
/* @} */
...
...
program/source/grid/examples_ug_optics.h
View file @
efadcb70
...
...
@@ -5,7 +5,8 @@
/** \addtogroup GridGeneration **/
/* @{ */
class
Lens_Geometry
:
public
Unstructured_grid
{
public:
Lens_Geometry
(
double
Radius
,
double
radius
,
double
thickness
,
double
curvatureLeft
,
double
curvatureRight
,
double
offsetX
,
double
offsetY
,
double
offsetZ
,
bool
inner_grid_arched
=
false
);
...
...
@@ -31,7 +32,7 @@ class Lens_Geometry_Quad : public Unstructured_grid {
private:
};
/* @} */
#endif // EXAMPLES_UG_OPTICS_H
program/source/grid/ug.h
View file @
efadcb70
...
...
@@ -132,7 +132,8 @@ protected:
/** \addtogroup GridGeneration **/
/* @{ */
class
Unstructured_grid
:
public
Partitioning
{
public:
Unstructured_grid
();
...
...
@@ -348,6 +349,8 @@ private:
Object_list
all_objects_based_on_ug
;
};
/* @} */
//////////////////////////////////////////////////////////////////
// 4. UG mit z-direction um slize und so auf 2D Gitter machen zu können
//////////////////////////////////////////////////////////////////
...
...
program/ugblocks3D.pri
View file @
efadcb70
...
...
@@ -76,6 +76,7 @@ SOURCES += $${UGBLOCKS_PATH}/program/source/ugopenmp.cc \
$${UGBLOCKS_PATH}/program/source/extemp/print_var_dx.cc \
$${UGBLOCKS_PATH}/program/source/extemp/print_var_vtk.cc \
$${UGBLOCKS_PATH}/program/source/extemp/variable.cc \
$${UGBLOCKS_PATH}/program/source/extemp/extemp.cc \
$${UGBLOCKS_PATH}/program/source/grid/blockgrid.cc \
$${UGBLOCKS_PATH}/program/source/grid/elements.cc \
$${UGBLOCKS_PATH}/program/source/grid/examples_ug.cc \
...
...
program2D/source/extemp/extemp2D.cc
0 → 100644
View file @
efadcb70
/**********************************************************************************
* Copyright 2010 Christoph Pflaum
* Department Informatik Lehrstuhl 10 - Systemsimulation
* Friedrich-Alexander Universität Erlangen-Nürnberg
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**********************************************************************************/
// ------------------------------------------------------------
//
// extemp2D.cc
//
// ------------------------------------------------------------
#include
<string>
#include
<stdexcept>
#include
"../../../program/source/mympi.h"
// von 3D UGBlocks
#include
"../abbrevi2D.h"
#include
"../math_lib/math_lib.h"
#include
"../grid/elements2D.h"
#include
"../grid/parti2D.h"
#include
"../grid/ug2D.h"
#include
"../grid/blockgrid2D.h"
#include
"../grid/marker2D.h"
#include
"extemp2D.h"
double
saveDivision2D
::
eps
=
1.0e-40
;
\ No newline at end of file
program2D/source/extemp/extemp2D.h
View file @
efadcb70
...
...
@@ -695,5 +695,86 @@ inline VDiv2D<A, B> operator/ ( const Expr2D<A>& a, const Expr2D<B>& b ) {
return
VDiv2D
<
A
,
B
>
(
a
,
b
);
}
/** \addtogroup ExpressionTemplatesTwoD **/
/* @{ */
/**
* epsilin Parameter for save division
**/
struct
saveDivision2D
{
static
double
eps
;
};
/* @} */
//----------------------------------------------------------------------------
template
<
class
A
,
class
B
>
class
SaveDiv2D
:
public
Expr2D
<
SaveDiv2D
<
A
,
B
>
>
{
const
A
&
a_
;
const
B
&
b_
;
public:
inline
SaveDiv2D
(
const
A
&
a
,
const
B
&
b
)
:
a_
(
a
),
b_
(
b
)
{}
Blockgrid2D
*
Give_blockgrid
()
const
{
if
(
a_
.
Give_blockgrid
()
==
NULL
)
return
b_
.
Give_blockgrid
();
return
a_
.
Give_blockgrid
();
};
stencil_typ
Give_stencil_typ
()
const
{
if
(
a_
.
Give_stencil_typ
()
==
yes_stencil
)
{
return
yes_stencil
;
}
return
b_
.
Give_stencil_typ
();
}
typedef
_TypeOf2_
(
A
,
B
)
Result
;
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
;
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
;
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
;
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
;
return
a_
.
Give_cell_rectangle
(
params2D_out_cell
)
/
valueB
;
}
template
<
elementTyp
TYP_EL
>
void
Update
(
int
id
)
const
{
a_
.
template
Update
<
TYP_EL
>
(
id
);
b_
.
template
Update
<
TYP_EL
>
(
id
);
}
inline
Unstructured2DGrid
*
Give_Ug
()
const
{
return
a_
.
Give_Ug
();
}
};
//----------------------------------------------------------------------------
template
<
class
A
,
class
B
>
inline
SaveDiv2D
<
A
,
B
>
saveDiv
(
const
Expr2D
<
A
>&
a
,
const
Expr2D
<
B
>&
b
)
{
return
SaveDiv2D
<
A
,
B
>
(
a
,
b
);
}
//----------------------------------------------------------------------------
#endif // EXTEMP_H
program2D/ugblocks2D.pri
View file @
efadcb70
...
...
@@ -62,6 +62,7 @@ HEADERS += $${UGBLOCKS_PATH}/program2D/source/abbrevi2D.h \
SOURCES += $${UGBLOCKS_PATH}/program2D/source/extemp/variable2D.cc \
$${UGBLOCKS_PATH}/program2D/source/extemp/cellvar2D.cc \
$${UGBLOCKS_PATH}/program2D/source/extemp/print_var2D_Qt_vtk.cc \
$${UGBLOCKS_PATH}/program2D/source/extemp/extemp2D.cc \
$${UGBLOCKS_PATH}/program2D/source/grid/blockgrid2D.cc \
$${UGBLOCKS_PATH}/program2D/source/grid/elements2D.cc \
$${UGBLOCKS_PATH}/program2D/source/grid/examples_ug2D.cc \
...
...
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