Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer, es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konto der externen Nutzer:innen sind über den Reiter "Standard" erreichbar. Die Administratoren

Dear Gitlab user, it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab. The administrators

Commit 8ef90e57 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

backgroundmesh and views

parent cf9f88fd
......@@ -64,7 +64,7 @@ namespace experimental {
}
bool Box::inBox(PointType& x)
bool Box::inBox(const PointType& x)
{
for (size_t i = 0; i < DOW; i++)
if (min_corner[i] > x[i] || max_corner[i] < x[i])
......@@ -82,7 +82,7 @@ namespace experimental {
* | 0 | 1 | 2 | 3 |
* -----------------> Nx=4
**/
int Box::getBox(PointType& x)
int Box::getBox(const PointType& x)
{
std::vector<int> idx(DOW);
for (size_t i = 0; i < DOW; i++)
......@@ -92,7 +92,7 @@ namespace experimental {
}
bool Box::getNearestData(PointType& x, DataType& data)
bool Box::getNearestData(const PointType& x, DataType& data)
{
if (!inBox(x))
return false;
......@@ -120,7 +120,7 @@ namespace experimental {
}
bool Box::getNearestData(PointType& x, std::vector<DataType>& data, int nData)
bool Box::getNearestData(const PointType& x, std::vector<DataType>& data, int nData)
{
if (!inBox(x))
return false;
......@@ -346,7 +346,7 @@ namespace experimental {
/// berechne die minimale Entfernung der Ränder der Box zu x
double Box::getBoxBoundaryDist(int nr, PointType& x)
double Box::getBoxBoundaryDist(int nr, const PointType& x)
{
std::vector<int> idx;
nr2idx(nr, idx);
......
......@@ -19,7 +19,7 @@ namespace experimental {
typedef WorldVector<double> PointType;
inline double distance(PointType &x, PointType &y, unsigned int n)
inline double distance(const PointType &x, const PointType &y, unsigned int n)
{
double d = 0.0;
for (unsigned int i = 0; i < n; i++)
......@@ -27,7 +27,7 @@ namespace experimental {
return sqrt(d);
}
inline double distance2(PointType &x, PointType &y, unsigned int n)
inline double distance2(const PointType &x, const PointType &y, unsigned int n)
{
double d = 0.0;
for (unsigned int i = 0; i < n; i++)
......@@ -49,11 +49,11 @@ namespace experimental {
int getMaxBoxSize();
bool inBox(PointType& x);
int getBox(PointType& x);
bool inBox(const PointType& x);
int getBox(const PointType& x);
bool getNearestData(PointType& x, DataType& data);
bool getNearestData(PointType& x, std::vector<DataType>& data, int nData);
bool getNearestData(const PointType& x, DataType& data);
bool getNearestData(const PointType& x, std::vector<DataType>& data, int nData);
/**
* strategies:
......@@ -63,7 +63,7 @@ namespace experimental {
* 3 .. get n nearest points, calc weighted regression plane and eval at x
**/
template<typename T>
T evalAtPoint(DOFVector<T>& vec, PointType& x, int strategy = 0, int nrOfPoints = -1);
T evalAtPoint(const DOFVector<T>& vec, const PointType& x, int strategy = 0, int nrOfPoints = -1);
static Box* provideBackgroundMesh(const FiniteElemSpace* feSpace);
static void delete_all();
......@@ -73,16 +73,16 @@ namespace experimental {
protected:
template<typename T>
T evalAtPoint_simple(DOFVector<T>& vec, PointType& x);
T evalAtPoint_simple(const DOFVector<T>& vec, const PointType& x);
template<typename T>
T evalAtPoint_weighted_sum(DOFVector<T>& vec, PointType& x, int nrOfPoints);
T evalAtPoint_weighted_sum(const DOFVector<T>& vec, const PointType& x, int nrOfPoints);
template<typename T>
T evalAtPoint_regression(DOFVector<T>& vec, PointType& x, int nrOfPoints);
T evalAtPoint_regression(const DOFVector<T>& vec, const PointType& x, int nrOfPoints);
template<typename T>
T evalAtPoint_weighted_regression(DOFVector<T>& vec, PointType& x, int nrOfPoints);
T evalAtPoint_weighted_regression(const DOFVector<T>& vec, const PointType& x, int nrOfPoints);
inline int idx2nr(std::vector<int>& idx);
......@@ -94,7 +94,7 @@ namespace experimental {
void getSurroundingBoxes(std::set<int> &nrs, std::set<int> &surrounding_nrs);
/// berechne die minimale Entfernung der Ränder der Box zu x
double getBoxBoundaryDist(int nr, PointType& x);
double getBoxBoundaryDist(int nr, const PointType& x);
static std::map<const FiniteElemSpace*, std::pair<int, Box*> > boxMap;
......
......@@ -10,7 +10,7 @@ namespace experimental {
* 3 .. get n nearest points, calc weighted regression plane and eval at x
**/
template<typename T>
T Box::evalAtPoint(DOFVector<T>& vec, PointType& x, int strategy, int nrOfPoints)
T Box::evalAtPoint(const DOFVector<T>& vec, const PointType& x, int strategy, int nrOfPoints)
{
T value;
switch (strategy) {
......@@ -35,7 +35,7 @@ namespace experimental {
template<typename T>
T Box::evalAtPoint_simple(DOFVector<T>& vec, PointType& x)
T Box::evalAtPoint_simple(const DOFVector<T>& vec, const PointType& x)
{
DataType dof;
T value; nullify(value);
......@@ -46,7 +46,7 @@ namespace experimental {
template<typename T>
T Box::evalAtPoint_weighted_sum(DOFVector<T>& vec, PointType& x, int nrOfPoints)
T Box::evalAtPoint_weighted_sum(const DOFVector<T>& vec, const PointType& x, int nrOfPoints)
{
T value; nullify(value);
......@@ -76,7 +76,7 @@ namespace experimental {
template<typename T>
T Box::evalAtPoint_regression(DOFVector<T>& vec, PointType& x, int nrOfPoints)
T Box::evalAtPoint_regression(const DOFVector<T>& vec, const PointType& x, int nrOfPoints)
{
T value; nullify(value);
......@@ -102,7 +102,7 @@ namespace experimental {
template<typename T>
T Box::evalAtPoint_weighted_regression(DOFVector<T>& vec, PointType& x, int nrOfPoints)
T Box::evalAtPoint_weighted_regression(const DOFVector<T>& vec, const PointType& x, int nrOfPoints)
{
T value; nullify(value);
......
......@@ -19,7 +19,7 @@ void Helpers::interpolOverLine(const Container &vec,
p[0] = lambda*x2 + (1.0-lambda)*x1;
p[1] = lambda*y2 + (1.0-lambda)*y1;
double value = vec.evalAtPoint(p);
double value = evalAtPoint(vec, p);
x.push_back(p);
y.push_back(value);
}
......
......@@ -159,7 +159,7 @@ struct DOFView : public DOFVector<T> {
bool use_kdtree = false;
Parameters::get("KD-Tree->enabled",use_kdtree);
if (use_kdtree) {
KD_Tree* tree = provideKDTree(feSpace);
KD_Tree_Dof* tree = provideKDTree(feSpace);
T value = tree->evalAtPoint(*vector, x_);
return value;
}
......@@ -384,7 +384,7 @@ inline T evalAtPoint(const DOFVector<T> &obj, WorldVector<double> &p, ElInfo* ol
bool use_kdtree = false;
Parameters::get("KD-Tree->enabled",use_kdtree);
if (use_kdtree) {
KD_Tree* tree = provideKDTree(feSpace);
KD_Tree_Dof* tree = provideKDTree(feSpace);
T value = tree->evalAtPoint(obj, p);
return value;
}
......
......@@ -44,7 +44,7 @@ namespace experimental {
// =====================================================================================
typedef WorldVector<double> PointType;
typedef DOFVector<PointType> my_vector_of_vectors_t;
typedef DOFVector<PointType> VectorOfVectors_Dof;
// =====================================================================================
......@@ -61,12 +61,13 @@ typedef DOFVector<PointType> my_vector_of_vectors_t;
int DIM = -1,
class Distance = nanoflann::metric_L2_Simple,
typename index_type = DegreeOfFreedom >
struct KDTreeVectorOfWorldVectorsAdaptor
struct KDTreeDOFVectorOfWorldVectorsAdaptor
{
typedef KDTreeVectorOfWorldVectorsAdaptor< VectorOfVectorsType,
typedef KDTreeDOFVectorOfWorldVectorsAdaptor< VectorOfVectorsType,
value_type,
DIM,
Distance > self_t;
Distance,
index_type > self_t;
typedef typename Distance::template traits<value_type, self_t>::distance_t metric_t;
typedef KDTreeSingleIndexAdaptor< metric_t,
self_t,
......@@ -76,7 +77,7 @@ typedef DOFVector<PointType> my_vector_of_vectors_t;
index_t* index; //! The kd-tree index for the user to call its methods as usual with any other FLANN index.
/// Constructor: takes a const ref to the vector of vectors object with the data points
KDTreeVectorOfWorldVectorsAdaptor(const int dimensionality,
KDTreeDOFVectorOfWorldVectorsAdaptor(const int dimensionality,
VectorOfVectorsType &mat,
const int leaf_max_size = 10) : m_data(mat)
{
......@@ -88,7 +89,7 @@ typedef DOFVector<PointType> my_vector_of_vectors_t;
index->buildIndex();
}
~KDTreeVectorOfWorldVectorsAdaptor() {
~KDTreeDOFVectorOfWorldVectorsAdaptor() {
delete index;
}
......@@ -167,7 +168,7 @@ typedef DOFVector<PointType> my_vector_of_vectors_t;
* == evalAtPoint_simple
**/
template<typename T>
T evalAtPoint(DOFVector<T>& vec, PointType& x, int strategy = 0, int nrOfPoints = -1)
T evalAtPoint(const DOFVector<T>& vec, const PointType& x, int strategy = 0, int nrOfPoints = -1)
{
const size_t nnp = 1;
std::vector<DegreeOfFreedom> ret_indexes(nnp);
......@@ -184,28 +185,28 @@ typedef DOFVector<PointType> my_vector_of_vectors_t;
return value;
}
}; // end of KDTreeVectorOfVectorsAdaptor
}; // end of KDTreeDOFVectorOfWorldVectorsAdaptor
typedef KDTreeVectorOfWorldVectorsAdaptor< my_vector_of_vectors_t, double > KD_Tree;
static std::map<const FiniteElemSpace*, std::pair<int, KD_Tree*> > kdtreeMap;
typedef KDTreeDOFVectorOfWorldVectorsAdaptor< VectorOfVectors_Dof, double > KD_Tree_Dof;
static std::map<const FiniteElemSpace*, std::pair<int, KD_Tree_Dof*> > kdtreeMap_Dof;
inline KD_Tree* provideKDTree(const FiniteElemSpace* feSpace)
inline KD_Tree_Dof* provideKDTree(const FiniteElemSpace* feSpace)
{
if (kdtreeMap.find(feSpace) != kdtreeMap.end()) {
if (kdtreeMap[feSpace].first != feSpace->getMesh()->getChangeIndex()) {
feSpace->getMesh()->getDofIndexCoords(feSpace, kdtreeMap[feSpace].second->m_data);
kdtreeMap[feSpace].second->reinit();
kdtreeMap[feSpace].first = feSpace->getMesh()->getChangeIndex();
if (kdtreeMap_Dof.find(feSpace) != kdtreeMap_Dof.end()) {
if (kdtreeMap_Dof[feSpace].first != feSpace->getMesh()->getChangeIndex()) {
feSpace->getMesh()->getDofIndexCoords(feSpace, kdtreeMap_Dof[feSpace].second->m_data);
kdtreeMap_Dof[feSpace].second->reinit();
kdtreeMap_Dof[feSpace].first = feSpace->getMesh()->getChangeIndex();
}
} else {
DOFVector<WorldVector<double> >* coords = new DOFVector<WorldVector<double> >(feSpace, "coords");
feSpace->getMesh()->getDofIndexCoords(feSpace, *coords);
KD_Tree* kdtree = new KD_Tree(Global::getGeo(WORLD), *coords);
kdtreeMap[feSpace] = std::make_pair(feSpace->getMesh()->getChangeIndex(), kdtree);
KD_Tree_Dof* kdtree = new KD_Tree_Dof(Global::getGeo(WORLD), *coords);
kdtreeMap_Dof[feSpace] = std::make_pair(feSpace->getMesh()->getChangeIndex(), kdtree);
}
return kdtreeMap[feSpace].second;
return kdtreeMap_Dof[feSpace].second;
}
} // end namespace
......
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