Revert interface code to preserve compatibility with NGSolve

This commit is contained in:
Matthias Hochsteger 2017-04-20 17:55:56 +02:00
parent 247afdb1bd
commit 9fb7fcacfc
3 changed files with 46 additions and 40 deletions

View File

@ -17,7 +17,7 @@ namespace netgen
template <int D, typename T> template <int D, typename T>
class Point : public AlignedAlloc<Point<D,T>> class Point : public ngsimd::AlignedAlloc<Point<D,T>>
{ {
protected: protected:
@ -67,7 +67,7 @@ namespace netgen
}; };
template <int D, typename T> template <int D, typename T>
class Vec : public AlignedAlloc<Vec<D,T>> class Vec : public ngsimd::AlignedAlloc<Vec<D,T>>
{ {
protected: protected:
@ -150,7 +150,7 @@ namespace netgen
template <int H, int W=H, typename T = double> template <int H, int W=H, typename T = double>
class Mat : public AlignedAlloc<Mat<H,W,T>> class Mat : public ngsimd::AlignedAlloc<Mat<H,W,T>>
{ {
protected: protected:

View File

@ -646,26 +646,29 @@ namespace netgen
#ifdef __AVX__
#include <immintrin.h>
template<> DLL_HEADER void Ngx_Mesh :: template<> DLL_HEADER void Ngx_Mesh ::
MultiElementTransformation<1,1> (int elnr, int npts, MultiElementTransformation<1,1> (int elnr, int npts,
const SIMD<double> * xi, size_t sxi, const __m256d * xi, size_t sxi,
SIMD<double> * x, size_t sx, __m256d * x, size_t sx,
SIMD<double> * dxdxi, size_t sdxdxi) const __m256d * dxdxi, size_t sdxdxi) const
{ {
cout << "multi-eltrafo simd called, 1,1,simd" << endl; cout << "multi-eltrafo simd called, 1,1,simd" << endl;
} }
template<> DLL_HEADER void Ngx_Mesh :: template<> DLL_HEADER void Ngx_Mesh ::
MultiElementTransformation<2,2> (int elnr, int npts, MultiElementTransformation<2,2> (int elnr, int npts,
const SIMD<double> * xi, size_t sxi, const __m256d * xi, size_t sxi,
SIMD<double> * x, size_t sx, __m256d * x, size_t sx,
SIMD<double> * dxdxi, size_t sdxdxi) const __m256d * dxdxi, size_t sdxdxi) const
{ {
mesh->GetCurvedElements().CalcMultiPointSurfaceTransformation<2> mesh->GetCurvedElements().CalcMultiPointSurfaceTransformation<2>
(elnr, npts, (elnr, npts,
xi, sxi, reinterpret_cast<const SIMD<double>*> (xi), sxi,
x, sx, reinterpret_cast<SIMD<double>*> (x), sx,
dxdxi, sdxdxi); reinterpret_cast<SIMD<double>*> (dxdxi), sdxdxi);
/* /*
for (int i = 0; i < npts; i++) for (int i = 0; i < npts; i++)
{ {
@ -692,15 +695,15 @@ namespace netgen
template<> DLL_HEADER void Ngx_Mesh :: template<> DLL_HEADER void Ngx_Mesh ::
MultiElementTransformation<3,3> (int elnr, int npts, MultiElementTransformation<3,3> (int elnr, int npts,
const SIMD<double> * xi, size_t sxi, const __m256d * xi, size_t sxi,
SIMD<double> * x, size_t sx, __m256d * x, size_t sx,
SIMD<double> * dxdxi, size_t sdxdxi) const __m256d * dxdxi, size_t sdxdxi) const
{ {
mesh->GetCurvedElements().CalcMultiPointElementTransformation mesh->GetCurvedElements().CalcMultiPointElementTransformation
(elnr, npts, (elnr, npts,
xi, sxi, reinterpret_cast<const SIMD<double>*> (xi), sxi,
x, sx, reinterpret_cast<SIMD<double>*> (x), sx,
dxdxi, sdxdxi); reinterpret_cast<SIMD<double>*> (dxdxi), sdxdxi);
/* /*
for (int i = 0; i < npts; i++) for (int i = 0; i < npts; i++)
{ {
@ -727,27 +730,27 @@ namespace netgen
template<> DLL_HEADER void Ngx_Mesh :: template<> DLL_HEADER void Ngx_Mesh ::
MultiElementTransformation<0,2> (int elnr, int npts, MultiElementTransformation<0,2> (int elnr, int npts,
const SIMD<double> *xi, size_t sxi, const __m256d *xi, size_t sxi,
SIMD<double> * x, size_t sx, __m256d * x, size_t sx,
SIMD<double> * dxdxi, size_t sdxdxi) const __m256d * dxdxi, size_t sdxdxi) const
{ {
cout << "MultiElementtransformation<0,2> simd not implemented" << endl; cout << "MultiElementtransformation<0,2> simd not implemented" << endl;
} }
template<> DLL_HEADER void Ngx_Mesh :: template<> DLL_HEADER void Ngx_Mesh ::
MultiElementTransformation<0,1> (int elnr, int npts, MultiElementTransformation<0,1> (int elnr, int npts,
const SIMD<double> * xi, size_t sxi, const __m256d * xi, size_t sxi,
SIMD<double> * x, size_t sx, __m256d * x, size_t sx,
SIMD<double> * dxdxi, size_t sdxdxi) const __m256d * dxdxi, size_t sdxdxi) const
{ {
cout << "multi-eltrafo simd called, 0,1,simd" << endl; cout << "multi-eltrafo simd called, 0,1,simd" << endl;
} }
template<> DLL_HEADER void Ngx_Mesh :: template<> DLL_HEADER void Ngx_Mesh ::
MultiElementTransformation<1,3> (int elnr, int npts, MultiElementTransformation<1,3> (int elnr, int npts,
const SIMD<double> * xi, size_t sxi, const __m256d * xi, size_t sxi,
SIMD<double> * x, size_t sx, __m256d * x, size_t sx,
SIMD<double> * dxdxi, size_t sdxdxi) const __m256d * dxdxi, size_t sdxdxi) const
{ {
double hxi[4][1]; double hxi[4][1];
double hx[4][3]; double hx[4][3];
@ -769,9 +772,9 @@ namespace netgen
template<> DLL_HEADER void Ngx_Mesh :: template<> DLL_HEADER void Ngx_Mesh ::
MultiElementTransformation<1,2> (int elnr, int npts, MultiElementTransformation<1,2> (int elnr, int npts,
const SIMD<double> * xi, size_t sxi, const __m256d * xi, size_t sxi,
SIMD<double> * x, size_t sx, __m256d * x, size_t sx,
SIMD<double> * dxdxi, size_t sdxdxi) const __m256d * dxdxi, size_t sdxdxi) const
{ {
for (int i = 0; i < npts; i++) for (int i = 0; i < npts; i++)
{ {
@ -798,15 +801,15 @@ namespace netgen
template<> DLL_HEADER void Ngx_Mesh :: template<> DLL_HEADER void Ngx_Mesh ::
MultiElementTransformation<2,3> (int elnr, int npts, MultiElementTransformation<2,3> (int elnr, int npts,
const SIMD<double> * xi, size_t sxi, const __m256d * xi, size_t sxi,
SIMD<double> * x, size_t sx, __m256d * x, size_t sx,
SIMD<double> * dxdxi, size_t sdxdxi) const __m256d * dxdxi, size_t sdxdxi) const
{ {
mesh->GetCurvedElements().CalcMultiPointSurfaceTransformation<3> mesh->GetCurvedElements().CalcMultiPointSurfaceTransformation<3>
(elnr, npts, (elnr, npts,
xi, sxi, reinterpret_cast<const SIMD<double>*> (xi), sxi,
x, sx, reinterpret_cast<SIMD<double>*> (x), sx,
dxdxi, sdxdxi); reinterpret_cast<SIMD<double>*> (dxdxi), sdxdxi);
/* /*
for (int i = 0; i < npts; i++) for (int i = 0; i < npts; i++)
{ {
@ -831,6 +834,7 @@ namespace netgen
*/ */
} }
#endif

View File

@ -92,15 +92,17 @@ namespace netgen
return res; return res;
} }
#ifdef __AVX__
virtual bool GetMultiSurfValue (size_t selnr, size_t facetnr, size_t npts, virtual bool GetMultiSurfValue (size_t selnr, size_t facetnr, size_t npts,
const SIMD<double> * xref, const __m256d * xref,
const SIMD<double> * x, const __m256d * x,
const SIMD<double> * dxdxref, const __m256d * dxdxref,
SIMD<double> * values) __m256d * values)
{ {
cerr << "GetMultiSurfVaue not overloaded for SIMD<double>" << endl; cerr << "GetMultiSurfVaue not overloaded for SIMD<double>" << endl;
return false; return false;
} }
#endif
virtual bool GetSegmentValue (int segnr, double xref, double * values) virtual bool GetSegmentValue (int segnr, double xref, double * values)
{ return false; } { return false; }