Commit 1d62b5fc authored by Phillip Lino Rall's avatar Phillip Lino Rall
Browse files

removed #IFDEF _GPU directives

parent 527f57cb
......@@ -37,10 +37,7 @@
#include "../ugopenmp.h"
#ifdef _GPU
#include "gpusolve.hh"
#include <program2D/source/extemp/variable2D.h>
#endif
#include <complex>
using std::complex;
//////////////////////////////////////////////////////////////
......@@ -354,15 +351,7 @@ class Variable : public Expr<Variable< DTyp > >, public Object_based_on_ug {
void operator= ( const ExpressionProlongation<DTyp>& Expr_prol );
void operator= ( const Expr_interpolant_cell_to_point<DTyp>& Expr_cell );
#ifdef _GPU
// assignment operator to copy data back from GPUsolve
template<typename Data_Type, typename Tv>
Variable<DTyp>& operator= ( gpusolve::expr::VectorD3Type<Data_Type, gpusolve::device::cpu, Tv>& v );
// copy data to GPUsolve data structure
template<typename Data_Type, typename Tv>
void Get ( gpusolve::expr::VectorD3Type<Data_Type, gpusolve::device::cpu, Tv>& v ) const;
#endif // _GPU
stencil_typ Give_stencil_typ() const { return no_stencil; }
control_typ Give_control_typ() const { return thread_save; }
......@@ -1475,84 +1464,6 @@ void Variable<DTyp>::operator= ( const Expr<A>& a ) {
#ifdef _GPU
template<typename DTyp>
template<typename Data_Type, typename Tv>
Variable<DTyp>& Variable<DTyp>::operator= ( gpusolve::expr::VectorD3Type<Data_Type, gpusolve::device::cpu, Tv>& _v ) {
const Tv& v = dynamic_cast<Tv&> ( _v );
// TODO: handle all blocks?
unsigned int id = 0;
// check dimension
if ( ug->degree_of_freedom() < 3 ) {
std::cerr << "Assignment of gpusolve::expr::VectorD3<cpu> to Variable";
std::cerr << " with wrong dimension!" << std::endl;
}
unsigned int sizeX = blockgrid->Give_Nx_hexahedron ( id );
unsigned int sizeY = blockgrid->Give_Ny_hexahedron ( id );
unsigned int sizeZ = blockgrid->Give_Nz_hexahedron ( id );
// check size
if ( sizeX != v.SizeX() || sizeY != v.SizeY() || sizeZ != v.SizeZ() ) {
std::cerr << "Assignment of gpusolve::expr::VectorD3<cpu> to Variable";
std::cerr << " with wrong number of points!" << std::endl;
}
for ( unsigned int k = 0; k < v.SizeZ(); ++k )
for ( unsigned int j = 0; j < v.SizeY(); ++j )
for ( unsigned int i = 0; i < v.SizeX(); ++i )
data_hexahedra[id][i+sizeX* ( j+sizeY*k ) ] = v ( i, j, k );
return *this;
}
template<typename DTyp>
template<typename Data_Type, typename Tv>
void Variable<DTyp>::Get ( gpusolve::expr::VectorD3Type<Data_Type, gpusolve::device::cpu, Tv>& _v ) const {
Tv& v = dynamic_cast<Tv&> ( _v );
// TODO: handle all blocks?
unsigned int id = 0;
// check dimension
if ( ug->degree_of_freedom() < 3 ) {
std::cerr << "Assignment of Variable to gpusolve::expr::VectorD3<cpu>";
std::cerr << " with wrong dimension!" << std::endl;
}
unsigned int sizeX = blockgrid->Give_Nx_hexahedron ( id );
unsigned int sizeY = blockgrid->Give_Ny_hexahedron ( id );
unsigned int sizeZ = blockgrid->Give_Nz_hexahedron ( id );
// DEBUG
// std::cout << "variable has " << sizeX * sizeY * sizeZ << " points\n";
// check size
if ( sizeX != v.SizeX() || sizeY != v.SizeY() || sizeZ != v.SizeZ() )
v.Resize ( sizeX, sizeY, sizeZ );
Update<hexahedronEl> ( id );
for ( unsigned int k = 0; k < v.SizeZ(); ++k )
for ( unsigned int j = 0; j < v.SizeY(); ++j )
for ( unsigned int i = 0; i < v.SizeX(); ++i )
v ( i, j, k ) = data_hexahedra[id][i+sizeX* ( j+sizeY*k ) ];
}
#endif // _GPU
/////////////////////////////////////////////////////////////////////////
// 5. Nconst , ... funtions for copy of data
//////////////////////////////////////////////////////////////
......
......@@ -25,8 +25,6 @@
#ifndef STENOP_H
#define STENOP_H
#ifdef _GPU
#include "gpusolve.hh"
#endif
///////////////////////////
......@@ -795,17 +793,7 @@ class Sten_matrix : public Expr<Sten_matrix<TYPE2, STENCIL_TYP> > {
Blockgrid* Give_blockgrid() const { return blockgrid; };
#ifdef _GPU
// methods to copy stencil data to GPUsolve data structure
/* template<typename Data_Type, typename Ts>
void GetStencils(gpusolve::stencil::StencilD3Q27CType<Data_Type, gpusolve::device::cpu, Ts>& s) const;
template<typename Data_Type, typename Ts>
void GetStencils(gpusolve::stencil::StencilD3Q27SCType<Data_Type, gpusolve::device::cpu, Ts>& s) const;
*/
template<typename Data_Type, typename Ts>
void GetStencils ( gpusolve::stencil::StencilD3Q27VType<Data_Type, gpusolve::device::cpu, Ts>& s ) const;
#endif // _GPU
void PrintStencilsToFile() const;
......
......@@ -329,63 +329,7 @@ void Sten_matrix<TYPE2, STENCIL_TYP>::Print()
}
*/
}
#ifdef _GPU
inline gpusolve::StencilPointD3Q27 convertStencilPos(unsigned int x, unsigned int y, unsigned int z)
{
return static_cast<gpusolve::StencilPointD3Q27>(x + (3*z + y)*3);
}
template <typename TYPE2, class STENCIL_TYP>
template<typename Data_Type, typename Ts>
void Sten_matrix<TYPE2, STENCIL_TYP>::GetStencils(gpusolve::stencil::StencilD3Q27VType<Data_Type, gpusolve::device::cpu, Ts>& _s) const
{
Ts& s = dynamic_cast<Ts&>(_s);
/// TODO: handle several blocks
unsigned int id = 0;
// check dimension?
if (blockgrid->Give_unstructured_grid()->degree_of_freedom() != 3) {
std::cerr << "Assignment to gpusolve::stencil::StencilD3Q27V<cpu>";
std::cerr << " with wrong dimension!" << std::endl;
}
// stencil groesse 2 kleiner fuer dirichlet rand
unsigned int sizeX = blockgrid->Give_Nx_hexahedron(id);
unsigned int sizeY = blockgrid->Give_Ny_hexahedron(id);
unsigned int sizeZ = blockgrid->Give_Nz_hexahedron(id);
unsigned int stencilSizeX = blockgrid->Give_Nx_hexahedron(id)-2;
unsigned int stencilSizeY = blockgrid->Give_Ny_hexahedron(id)-2;
unsigned int stencilSizeZ = blockgrid->Give_Nz_hexahedron(id)-2;
// check size
if (stencilSizeX != s.SizeX() || stencilSizeY != s.SizeY() || stencilSizeZ != s.SizeZ())
s.Resize(stencilSizeX, stencilSizeY, stencilSizeZ);
for (unsigned int k = 1; k < sizeZ-1; ++k)
for (unsigned int j = 1; j < sizeY-1; ++j)
for (unsigned int i = 1; i < sizeX-1; ++i) {
// indexumrechnung
unsigned int p = sten_typ.stenIndex(i, j, k, sizeX, sizeY, id);
for (unsigned int iz = 0; iz < 3; ++iz)
for (unsigned int iy = 0; iy < 3; ++iy)
for (unsigned int ix = 0; ix < 3; ++ix) {
if (i==1 && j==1 && k==1) {
using namespace std;
cout << "convertStencilPos = " << convertStencilPos(ix, iy, iz) <<
"\n trans27 = " << trans27((Ort1D)ix, (Ort1D)iy, (Ort1D)iz) << endl;
// getchar();
}
s(i-1, j-1, k-1, convertStencilPos(ix, iy, iz)) = sten_m_hexahedra[id][p + trans27((Ort1D)ix, (Ort1D)iy, (Ort1D)iz)];
}
}
}
#endif // _GPU
template <typename TYPE2, class STENCIL_TYP>
void Sten_matrix<TYPE2, STENCIL_TYP>::PrintStencilsToFile() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment