G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsAdaptiveMeshingUtils.h
1
14#pragma once
15
16
17#include <iostream>
18
19namespace gismo
20{
21
22
31template<typename T>
33{
34public:
41 gsElementErrorPlotter(const gsBasis<T>& basis, const std::vector<T>& errors )
42 : m_basis(basis),m_errors(errors)
43 { }
44
45 virtual void eval_into(const gsMatrix<T>& u, gsMatrix<T>& res) const
46 {
47 // Initialize domain element iterator -- using unknown 0
48 res.setZero(1,u.cols());
49 for(index_t i=0; i<u.cols();++i)
50 {
51 int iter =0;
52 // Start iteration over elements
53
54 typename gsBasis<T>::domainIter domIt = m_basis.makeDomainIterator();
55 for (; domIt->good(); domIt->next() )
56 {
57 bool flag = true;
58 const gsVector<T>& low = domIt->lowerCorner();
59 const gsVector<T>& upp = domIt->upperCorner();
60
61
62 for(int d=0; d<domainDim();++d )
63 {
64 if(low(d)> u(d,i) || u(d,i) > upp(d))
65 {
66 flag = false;
67 break;
68 }
69 }
70 if(flag)
71 {
72 res(0,i) = m_errors.at(iter);
73 break;
74 }
75 iter++;
76 }
77 }
78 }
79
80 short_t domainDim() const { return m_basis.dim();}
81
82private:
83 const gsBasis<T>& m_basis;
84 const std::vector<T>& m_errors;
85};
86
87} // namespace gismo
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
This class provides a function that returns a constant error on each element.
Definition gsAdaptiveMeshingUtils.h:33
gsElementErrorPlotter(const gsBasis< T > &basis, const std::vector< T > &errors)
Constructs a function to plot the error of elements.
Definition gsAdaptiveMeshingUtils.h:41
short_t domainDim() const
Dimension of the (source) domain.
Definition gsAdaptiveMeshingUtils.h:80
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &res) const
Evaluate the function at points u into result.
Definition gsAdaptiveMeshingUtils.h:45
const gsBasis< T > & basis(const index_t k) const
Helper which casts and returns the k-th piece of this function set as a gsBasis.
Definition gsFunctionSet.hpp:33
A function from a n-dimensional domain to an m-dimensional image.
Definition gsFunction.h:60
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
The G+Smo namespace, containing all definitions for the library.