25 #define TO_HTENSOR(x) static_cast<const gsHTensorBasis<d,T> *>(x)
26 #define TO_BSPLINE(x) static_cast<const gsTensorBSplineBasis<d,T> *>(x)
39 template<
short_t d,
class T>
48 Base(incrSmoothnessDegree,topol,basis)
55 using Base::m_incrSmoothnessDegree;
59 using Base::_setTensorMappingOfPatch;
60 using Base::_getPatch;
61 using Base::_getPatchIndex;
62 using Base::_getLocalIndex;
69 bool _checkMapping()
const
74 void _finalize()
const
76 m_level = _getMaxLevel();
78 mat.conservativeResize(mat.rows(),m_global);
80 m_mapper=
new gsWeightMapper<T>(mat);
81 m_mapper->optimize(gsWeightMapper<T>::optTargetToSource);
84 void _setMappingOfPatch(
index_t const patch)
const
87 for(
index_t i = 0;i<=_getMaxLevel();i++)
89 if(m_level<=_getMaxLevel(patch))
90 _setTensorMappingOfPatch(patch);
98 for (
size_t i = 0; i < m_basis->nPatches(); i++)
100 level = std::max(level, _getMaxLevel(i));
107 return TO_HTENSOR(&(m_basis->getBase(patch)))->maxLevel();
113 std::vector<T> endpoints;
114 T parametricDistance = m_basis->getParametricDistanceOfVertex(pc,ps);
115 if(math::almostEqual<T>(parametricDistance,0.0))
125 for(
size_t i = deg+1;i<knots.
size();i++)
126 endpoints.push_back(knots.
at(i));
127 std::sort(endpoints.begin(),endpoints.end());
129 for(;nr<(
index_t)(endpoints.size());nr++)
130 if(math::almostEqual<T>(endpoints[nr],parametricDistance)||endpoints[nr]>=parametricDistance)
142 gsKnotVector<T> kvComp = TO_HTENSOR(&(m_basis->getBase(patch)))->getBases()[m_level]->knots(par);
148 return TO_HTENSOR(&(m_basis->getBase(patch)))->getBases()[m_level]->size(par)-1;
159 index_t patchIndex = _getPatchIndex(patch,u,v);
160 localIndex=_getLocalIndex(patch,patchIndex);
169 return _getLocalIndex(patch,_getPatchIndex(patch,u,v));
180 if(level>(
index_t)(TO_HTENSOR(&(m_basis->getBase(patch)))->maxLevel()))
183 const index_t u_amount=TO_HTENSOR(&(m_basis->getBase(patch)))->tensorLevel(level).size(0);
184 const index_t v_amount=TO_HTENSOR(&(m_basis->getBase(patch)))->tensorLevel(level).size(1);
188 u=flag ? (u_amount-1) : 0;
193 u=flag ? (u_amount-1) :0;
200 v=flag ? (v_amount-1) : 0;
205 v=flag ? (v_amount-1) : 0;
208 index=TO_HTENSOR(&(m_basis->getBase(patch)))->getBases()[level]->index(vec);
209 patchindex=TO_HTENSOR(&(m_basis->getBase(patch)))->flatTensorIndexToHierachicalIndex(index,level);
211 }
while(-1==patchindex);
217 index_t index=_getTensorIndex(patch,u,v);
218 return TO_HTENSOR(&(m_basis->getBase(patch)))->flatTensorIndexToHierachicalIndex(index,m_level);
226 return TO_HTENSOR(&(m_basis->getBase(patch)))->getBases()[m_level]->index(vec);
231 index_t combIndex = TO_HTENSOR(&(m_basis->getBase(patch)))->flatTensorIndexOf(patchIndex,m_level);
239 index_t patch = _getPatch(localIndex);
240 index_t patchIndex = _getPatchIndex(localIndex);
241 return _getPar(patch,_getTensorIndex(patch,patchIndex),par);
246 gsVector<index_t,d> vec = TO_HTENSOR(&(m_basis->getBase(patch)))->getBases()[m_level]->tensorIndex(tensorIndex);
247 GISMO_ASSERT(static_cast<index_t>(vec(par))<TO_HTENSOR(&(m_basis->getBase(patch)))->getBases()[m_level]->size(par),
"wrong tensorIndex");
248 GISMO_ASSERT(static_cast<index_t>(vec(!par))<TO_HTENSOR(&(m_basis->getBase(patch)))->getBases()[m_level]->size(!par),
"wrong tensorIndex");
Knot vector for B-splines.
void parameters_into(index_t dim, gsVector< bool > ¶m) const
returns a vector of parameters describing the position of the corner
Definition: gsBoundary.h:322
Provides declaration of Basis abstract interface.
Struct which represents a certain side of a patch.
Definition: gsBoundary.h:231
Provides declaration of the BoxTopology class.
bool parameter() const
Returns the parameter value (false=0=start, true=1=end) that corresponds to this side.
Definition: gsBoundary.h:128
A univariate Lagrange basis.
Definition: gsMPBESMapHB2D.h:40
A univariate Lagrange basis.
Definition: gsMPBESMapTensor.h:32
Provides declaration of Basis abstract interface.
size_t size() const
Number of knots (including repetitions).
Definition: gsKnotVector.h:242
#define index_t
Definition: gsConfig.h:32
A tensor product B-spline basis.
Definition: gsTensorBSplineBasis.h:36
Struct which represents a certain corner of a patch.
Definition: gsBoundary.h:392
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Provides declaration of Basis abstract interface.
Purely abstract class gsMappedBasis, which gives means of combining basis functions to new...
Definition: gsMPBESBasis.h:46
Struct which represents a certain side of a box.
Definition: gsBoundary.h:84
T at(const size_t &i) const
Returns the value of the i - th knot (counted with repetitions).
Definition: gsKnotVector.h:865
void reverse()
Better directly use affineTransformTo.
Definition: gsKnotVector.hpp:468
#define GISMO_ERROR(message)
Definition: gsDebug.h:118
Class for representing a knot vector.
Definition: gsKnotVector.h:79
Defines a topological arrangement of a collection of "boxes" (e.g., parameter domains that map to phy...
Definition: gsBoxTopology.h:38
index_t patch
The index of the patch.
Definition: gsBoundary.h:234
short_t direction() const
Returns the parametric direction orthogonal to this side.
Definition: gsBoundary.h:113
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78