Commit dbb50889 authored by Praetorius, Simon's avatar Praetorius, Simon

signed dist functors and some other things

parent 880c8d64
......@@ -5,6 +5,7 @@
#include "VectorOperations.h"
#include "GeometryTools.h"
#include "Views.h"
using namespace std;
using namespace AMDiS;
......
......@@ -29,6 +29,7 @@
#include "boost/filesystem.hpp"
#include "pugixml.hpp"
#include "kdtree_nanoflann.h"
#include "VectorOperations.h"
namespace AMDiS {
......@@ -51,34 +52,6 @@ namespace AMDiS {
namespace details {
// num_rows for scalar types
template<typename T>
size_t num_rows(T &v) {
return 1;
};
// for WorldVectors print 3 components
template<typename T>
size_t num_rows(WorldVector<T> &v) {
return static_cast<size_t>(v.getSize());
}
// num_rows for vector types
template<typename T>
size_t num_rows(std::vector<T> &v) {
return v.size();
};
template<typename T>
size_t num_rows(const std::vector<T> &v) {
return v.size();
};
template<typename T>
size_t num_rows(mtl::dense_vector<T> &v) {
return mtl::num_rows(v);
};
template<typename T>
size_t num_rows(const mtl::dense_vector<T> &v) {
return mtl::num_rows(v);
};
template<typename T>
struct LessPairEps
{
......
......@@ -219,13 +219,25 @@ typedef std::vector<DataType> VectorOfDataType;
int dim = vec.getFeSpace()->getMesh()->getDim();
DimVec<double> lambda(dim, NO_INIT);
double area = meshconv::triangle_area_3d(elInfo->getCoord(0).begin(),
elInfo->getCoord(1).begin(),
elInfo->getCoord(2).begin())
for (int i = 0; i < dim+1; i++)
lambda[i] = meshconv::triangle_area_3d(p.begin(),
elInfo->getCoord((i+1)%3).begin(),
elInfo->getCoord((i+2)%3).begin())/area;
if (dim == 1) {
double lendth = abs(elInfo->getCoord(1) - elInfo->getCoord(0));
for (int i = 0; i < dim+1; i++)
lambda[i] = abs(p - elInfo->getCoord((i+1)%2))/length;
}
else if (dim == 2) {
double area = meshconv::triangle_area_3d(elInfo->getCoord(0).begin(),
elInfo->getCoord(1).begin(), elInfo->getCoord(2).begin())
for (int i = 0; i < dim+1; i++)
lambda[i] = meshconv::triangle_area_3d(p.begin(),
elInfo->getCoord((i+1)%3).begin(), elInfo->getCoord((i+2)%3).begin())/area;
}
else if (dim == 3) {
double volume = meshconv::volume_tetrahedron(elInfo->getCoord(0).begin(),
elInfo->getCoord(1).begin(), elInfo->getCoord(2).begin(), elInfo->getCoord(3).begin())
for (int i = 0; i < dim+1; i++)
lambda[i] = meshconv::volume_tetrahedron(p.begin(),
elInfo->getCoord((i+1)%3).begin(), elInfo->getCoord((i+2)%3).begin(), elInfo->getCoord((i+3)%3).begin())/volume;
}
ElementFunctionDOFVec<T> elFct(&vec);
elFct.setElInfo(elInfo);
......
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