Commit f3c87616 authored by Phillip Lino Rall's avatar Phillip Lino Rall
Browse files

merged with changes, christoph pushed to master. Hopefully, nothing missing.

parents 757eaef9 90ceaefe
......@@ -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
......@@ -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
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,7 +4,6 @@
unix:TEMPLATE = app
TARGET=run
......
......@@ -45,10 +45,14 @@ Ny-1 * + + + + *
0 1 2 3 Nx-1 Nx
*/
///////////////////////////
// 1. Coordinate
///////////////////////////
/** \defgroup ExpressionTemplates ''Expression Template Operators in 3D (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
/**********************************************************************************
* 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.
**********************************************************************************/
// ------------------------------------------------------------
//
// extemp.cc
//
// ------------------------------------------------------------
#include "../mympi.h"
#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 saveDivision::eps = 1.0e-40;
......@@ -754,5 +754,116 @@ 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(myABS(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(myABS(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(myABS(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(myABS(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(myABS(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 );
}
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());
}
};
//----------------------------------------------------------------------------
/** \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
......@@ -179,7 +179,7 @@ class Functor {
#endif
template <class A, class DTyp_Result, class DTyp, class Func>
class Exp_Functor1 : public Expr<Exp_Functor1<A, DTyp_Result, DTyp, Func> > {
......@@ -211,6 +211,7 @@ class Exp_Functor1 : public Expr<Exp_Functor1<A, DTyp_Result, DTyp, Func> > {
}
};
template <class A, class DTyp_Result, class DTyp, class Func>
template <elementTyp TYP_EL>
inline DTyp_Result
......@@ -230,6 +231,8 @@ Exp_Functor1<A, DTyp_Result, DTyp, Func>::Give_fromTotal(int i) const {
return functor_->evaluate ( a_.Give_fromTotal(i) );
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
template <class DTyp_Result, class DTyp, class Func>
class Functor1 {
public:
......@@ -245,10 +248,11 @@ class Functor1 {
Func* functor_;
control_typ funCtrTyp_;
};
/* @} */
// 2 arguments
/**
* 2 arguments
**/
template <class A, class B, class DTyp_Result, class DTyp, class Func>
class Exp_Functor2
......@@ -311,7 +315,8 @@ Exp_Functor2<A, B, DTyp_Result, DTyp, Func>::Give_fromTotal(int i) const {
b_.Give_fromTotal(i) );
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
template <class DTyp_Result, class DTyp, class Func>
class Functor2 {
......@@ -328,7 +333,7 @@ class Functor2 {
Func* functor_;
control_typ funCtrTyp_;
};
/* @} */
// 3 arguments
......@@ -413,7 +418,8 @@ Exp_Functor3<A, B, C, DTyp_Result, DTyp, Func>::Give_fromTotal(int i) const {
}
/** \addtogroup ExpressionTemplates **/
/* @{ */
template <class DTyp_Result, class DTyp, class Func>
class Functor3 {
......@@ -434,7 +440,7 @@ class Functor3 {
Func* functor_;
control_typ funCtrTyp_;
};
/* @} */
// 4 arguments
......@@ -502,7 +508,8 @@ Exp_Functor4<A, B, C, D, DTyp_Result, DTyp, Func>::Give_cell_hexahedra ( params_
/** \addtogroup ExpressionTemplates **/
/* @{ */
template <class DTyp_Result, class DTyp, class Func>
class Functor4 {
......@@ -531,6 +538,7 @@ class Functor4 {
Func* functor_;
control_typ funCtrTyp_;
};
/* @} */
////////////////////////////////////////////////////////////////////////////////////////////////////
// list of arguments
......
......@@ -83,8 +83,6 @@ Blockgrid::Blockgrid ( Unstructured_grid *ug_ ) {
number_points[i] = 10;
}
variable_set = false;
}
Blockgrid::Blockgrid ( Unstructured_grid *ug_, int N ) {
......
......@@ -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
This diff is collapsed.
This diff is collapsed.
......@@ -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;
};
/* @} */
......
......@@ -20,6 +20,8 @@
#define EXAMPLES_UG_H
#include <vector>
/** \addtogroup GridGeneration **/
/* @{ */
/**
* Normaler Hexaeder
*
......@@ -300,7 +302,7 @@ private:
friend class UGFrom3DSlice;
};
/* @} */
......
......@@ -5,7 +5,8 @@
/** \addtogroup GridGeneration **/
/* @{ */
class Lens_Geometry : public Unstructured_grid {
public:
Lens_Geometry(double Radius, double thickness, double curvatureLeft, double curvatureRight, double offsetX, double offsetY, double offsetZ, bool inner_grid_arched = false, double radius = 0.0);
......@@ -44,6 +45,7 @@ class Lens_Geometry_cutted_edges : public Unstructured_grid {
};
/* @} */
#endif // EXAMPLES_UG_OPTICS_H
......@@ -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
//////////////////////////////////////////////////////////////////
......
......@@ -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 \
......
......@@ -124,7 +124,8 @@ inline Expr2D_interpolant_point_to_cell<A> Cell_interpolation(const Expr2D<A>& a
//////////////////////////////////////////////////////
// 3.1. definition
//////////////////////////////////////////////////////////////
/** \addtogroup ExpressionTemplates2D **/
/* @{ */
template <class DTyp>
class Cell_variable2D : public Expr2D<Cell_variable2D< DTyp > > {
......@@ -187,6 +188,7 @@ double L_infty_cell(const Expr2D<A>& a, Marker2D& marker);
template <class A>
double L_infty_cell(const Expr2D<A>& a);
/* @} */
//////////////////////////////////////////
......
......@@ -55,6 +55,9 @@ Ny-1 * + + + + *
// 1. Coordinate
///////////////////////////
/** \defgroup ExpressionTemplates2D ''Expression Template Operators in 2D (excluding +,-,... ) ''
**/
/* @{ */
class X_coordinate2d : public Expr2D<X_coordinate2d> {
public:
......@@ -79,7 +82,7 @@ class X_coordinate2d : public Expr2D<X_coordinate2d> {
private:
Blockgrid2D* blockgrid;
};
/* @} */
inline double X_coordinate2d::Give_cell_rectangle ( params2D_in_cell ) const {
// return blockgrid->Give_coord_rectangle(id_rec, i, j, k).x;
......@@ -105,6 +108,8 @@ inline double X_coordinate2d::Give_data<pointEl> ( params2D_in ) const {
return blockgrid->Give_coord_point ( id ).x;
}
/** \addtogroup ExpressionTemplates2D **/
/* @{ */
class Y_coordinate2d : public Expr2D<Y_coordinate2d> {