G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsMPBESBasis.h
Go to the documentation of this file.
1
14#pragma once
15
18
19namespace gismo
20{
45template<short_t d, class T>
46class gsMPBESBasis : public gsMappedBasis<d,T>
47{
48private:
50 static const short_t Dim = d;
51
52 typedef T weightType;
53 typedef index_t indexType; //indizes of gsMatrix
54 typedef std::vector<std::pair<index_t,index_t> >::iterator step_iter;
55 typedef gsBasis<T> BasisType;
56 typedef typename std::vector<BasisType *>::const_iterator ConstBasisIter;
57 typedef typename std::vector<BasisType *>::iterator BasisIter;
58 typedef typename std::vector<gsMatrix<T> *>::const_iterator ConstMatrixPtrIter;
60 typedef typename std::vector<indexType> IndexContainer;
61 typedef typename std::vector<indexType>::const_iterator ConstIndexIter;
62 typedef typename std::vector<weightType> WeightContainer;
63 typedef typename std::vector<weightType>::const_iterator ConstWeightIter;
64
65 typedef memory::unique_ptr< gsDomainIterator<T> > domainIter;
66
67protected:
68 using gsMappedBasis<d,T>::m_mapper;
69 using gsMappedBasis<d,T>::m_topol;
70 using gsMappedBasis<d,T>::m_bases;
71public:
73 typedef memory::shared_ptr< gsMPBESBasis > Ptr;
74
76 typedef memory::unique_ptr< gsMPBESBasis > uPtr;
77
78 using gsMappedBasis<d,T>::size;
79 using gsMappedBasis<d,T>::degree;
80 using gsMappedBasis<d,T>::nPatches;
81
82public:
84 gsMPBESBasis() : gsMappedBasis<d,T>()
85 {
86// m_mapper = NULL;
87 }
88
90 virtual ~gsMPBESBasis()
91 {
92
93 } //destructor
94
95public:
97 // functions for initializing and updating
99
102 {
103 //_setDistanceOfAllVertices(0);
104 _setMapping();
105 }
106
107protected:
108
111 { return m_bases[i]; }
112
114 virtual void _setMapping() = 0;
115
117 void _initVertices();
118
121
123 bool _check() const;
124
126 virtual bool _checkTopologyWithBases() const = 0;
127
128public:
130 // general functions for interacting with this class
132
134 short_t dim() const { return Dim; }
135
137 GISMO_UPTR_FUNCTION_PURE(gsMPBESBasis, clone)
138
139
140 std::string detail() const
141 {
142 // By default just uses print(..)
143 std::ostringstream os;
144 print(os);
145 return os.str();
146 }
147
149 std::ostream & print(std::ostream & os) const
150 { os << m_mapper->asMatrix().toDense() <<"\n"; return os; }
151
153 virtual unsigned basisFunctionsOnSide(const patchSide& ps) const = 0;
154
155 // Look at gsBasis class for a description
156 void connectivity(const gsMatrix<T> & nodes,gsMesh<T> & mesh) const;
157
158 bool isConnected(indexType i,indexType j) const;
159
160 virtual bool isLocallyConnected(indexType i,indexType j) const = 0;
161
162public:
164 // getters for the private fields
166
170
171 unsigned getMinDist() const
172 { return m_minDist; }
173
174public:
176 // functions for refinement
178
186 void uniformRefine(index_t numKnots = 1, index_t mul=1,bool updateBasis = true);
187
196 void uniformRefine_withCoefs(gsMatrix<T>& localCoefs, index_t numKnots = 1, index_t mul=1,
197 bool updateBasis = true);
198
207 virtual void refine(const index_t patch, gsMatrix<T> const & boxes, bool updateBasis = true) = 0;
208
217 virtual void refineElements(const index_t patch, std::vector<index_t> const & boxes, bool updateBasis = true) = 0;
218
228 virtual void refine_withCoefs(gsMatrix<T>& localCoefs, const index_t patch, gsMatrix<T> const & boxes,
229 bool updateBasis = true) = 0;
230
240 virtual void refineElements_withCoefs(gsMatrix<T>& localCoefs, const index_t patch, std::vector<index_t> const & boxes,
241 bool updateBasis = true) = 0;
242
250 void degreeElevate( index_t amount = 1 , bool updateBasis = true);
251
259 void degreeIncrease( index_t amount = 1, index_t dir=-1, bool updateBasis = true);
260
263 virtual void repairPatches(std::vector<gsMatrix<T> *> & coefs,
264 index_t startFromPatch = -1) = 0;
265
266 void repairPatches(gsMatrix<T> & localCoef, index_t startFromPatch=-1);
267
270 void repairPatches(index_t startFromPatch = -1);
271
272public:
274 // functions for smoothing the basis
276
285 void smoothCornerEdge(const patchCorner&pc,const patchSide& ps,bool updateBasis = true);
286
290 void smoothEverything();
291
292public:
294 // functions for working with weights on interfaces
296
301 T getWeight(const patchSide & ps) const;
302
308 bool setWeight(const patchSide & ps, const T weight);
309
310public:
312 // functions for working with special vertices and it's C^0 distance
314
317 void setC0(patchCorner pc);
318
320 bool isSpecialVertex(const patchCorner & pc) const;
321
323 T getParametricDistanceOfVertex(const patchCorner& pc,const patchSide& ps) const;
324
325protected:
328 virtual T findParameter(patchSide const & ps,patchCorner const & pc,unsigned nrBasisFuncs) const = 0;
329
330private:
332 // struct for distances from special vertices
334
342 {
343 boundaryInterface interface;
344 patchCorner corner1;
345 T parametricDistance1;
346 patchCorner corner2;
347 T parametricDistance2;
348
351 distances(const boundaryInterface& iface, const patchCorner& pc1,
352 const patchCorner& pc2,const gsMPBESBasis<d,T>& basis);
353
356 {
357 return (interface==bi) || (interface.getInverse()==bi);
358 }
359
362 void setParamDist(unsigned absoluteVal,const patchCorner& pc,const gsMPBESBasis<d,T>& basis);
363
365 T getParamDist(const patchCorner& pc,const gsMPBESBasis<d,T>& basis) const;
366
368 void _determineValues(patchSide side,patchSide ls,patchSide rs,index_t dist,unsigned degree,unsigned max,
369 unsigned& left,unsigned& right,const gsMPBESBasis<d,T>& basis) const;
370 };
371
372 // Data members
373protected:
377 unsigned m_minDist;
379 std::vector<std::pair<patchSide,T> > m_patchSideWeights;
381 std::vector<std::pair<patchCorner,bool> > m_vertices; //true = EV, false = OV
383 std::vector<distances> m_distances;
384}; // class gsMappedBasis
385
386}
387
388
391
392#ifndef GISMO_BUILD_LIB
393#include GISMO_HPP_HEADER(gsMPBESBasis.hpp)
394#endif
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
uPtr clone()
Clone methode. Produceds a deep copy inside a uPtr.
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
Purely abstract class gsMappedBasis, which gives means of combining basis functions to new,...
Definition gsMPBESBasis.h:47
index_t getIncrSmoothnessDegree() const
getter for m_incrSmoothnessDegree
Definition gsMPBESBasis.h:168
gsMPBESBasis()
Default empty constructor.
Definition gsMPBESBasis.h:84
memory::shared_ptr< gsMPBESBasis > Ptr
Shared pointer for gsMPBESBasis.
Definition gsMPBESBasis.h:73
void updateTopol()
updates the mapping of this basis (f.e. after a knot insertion)
Definition gsMPBESBasis.h:101
bool setWeight(const patchSide &ps, const T weight)
Definition gsMPBESBasis.hpp:279
unsigned m_minDist
minimal C^0 distance from special (extraordinary) vertices, specified in basisfunctions
Definition gsMPBESBasis.h:377
memory::unique_ptr< gsMPBESBasis > uPtr
Unique pointer for gsMPBESBasis.
Definition gsMPBESBasis.h:76
void degreeIncrease(index_t amount=1, index_t dir=-1, bool updateBasis=true)
Definition gsMPBESBasis.hpp:189
virtual void _setMapping()=0
create a new mapping of the local basisfunctions
BasisType * getBasePointer(index_t i)
getter for m_bases[i]
Definition gsMPBESBasis.h:110
void setC0(patchCorner pc)
Definition gsMPBESBasis.hpp:333
T getWeight(const patchSide &ps) const
Definition gsMPBESBasis.hpp:269
void uniformRefine_withCoefs(gsMatrix< T > &localCoefs, index_t numKnots=1, index_t mul=1, bool updateBasis=true)
Definition gsMPBESBasis.hpp:151
short_t dim() const
Returns the dimension d of the parameter space.
Definition gsMPBESBasis.h:134
virtual void repairPatches(std::vector< gsMatrix< T > * > &coefs, index_t startFromPatch=-1)=0
void _setDistanceOfAllVertices()
initializes the m_distances field
Definition gsMPBESBasis.hpp:313
void _initVertices()
initializes the m_vertices field
Definition gsMPBESBasis.hpp:298
virtual void refineElements_withCoefs(gsMatrix< T > &localCoefs, const index_t patch, std::vector< index_t > const &boxes, bool updateBasis=true)=0
std::string detail() const
Clone function. Used to make a copy of a derived basis.
Definition gsMPBESBasis.h:140
virtual ~gsMPBESBasis()
constructor, deletes all the bases and the mapper
Definition gsMPBESBasis.h:90
virtual unsigned basisFunctionsOnSide(const patchSide &ps) const =0
Returns the amount of basis functions on a given side of a given patch.
virtual void refineElements(const index_t patch, std::vector< index_t > const &boxes, bool updateBasis=true)=0
static const short_t Dim
Dimension of the parameter domains.
Definition gsMPBESBasis.h:50
void uniformRefine(index_t numKnots=1, index_t mul=1, bool updateBasis=true)
Definition gsMPBESBasis.hpp:137
virtual T findParameter(patchSide const &ps, patchCorner const &pc, unsigned nrBasisFuncs) const =0
virtual void refine_withCoefs(gsMatrix< T > &localCoefs, const index_t patch, gsMatrix< T > const &boxes, bool updateBasis=true)=0
void smoothEverything()
Definition gsMPBESBasis.hpp:222
bool isSpecialVertex(const patchCorner &pc) const
gives back true, if the given patchCorner is a special vertex
Definition gsMPBESBasis.hpp:362
std::vector< distances > m_distances
vector of distances objects, that store C^0 distances from special vertices on the edges
Definition gsMPBESBasis.h:383
std::vector< std::pair< patchSide, T > > m_patchSideWeights
vector storing the weights for interfaces
Definition gsMPBESBasis.h:379
void smoothCornerEdge(const patchCorner &pc, const patchSide &ps, bool updateBasis=true)
Definition gsMPBESBasis.hpp:207
bool _check() const
Checks the gsMappedBasis for consistency.
Definition gsMPBESBasis.hpp:31
std::vector< std::pair< patchCorner, bool > > m_vertices
vector storing all the inner vertices, with a flag if it is an Extraordinary vertex or an ordinary ve...
Definition gsMPBESBasis.h:381
std::ostream & print(std::ostream &os) const
Prints the object to the stream.
Definition gsMPBESBasis.h:149
virtual void refine(const index_t patch, gsMatrix< T > const &boxes, bool updateBasis=true)=0
short_t m_incrSmoothnessDegree
smoothness degree that is tried to achive over patch interfaces
Definition gsMPBESBasis.h:375
virtual bool _checkTopologyWithBases() const =0
Checks the gsMappedBasis for consistency.
T getParametricDistanceOfVertex(const patchCorner &pc, const patchSide &ps) const
gives back the parametric c^0 distance of the edge ps starting from corner pc
Definition gsMPBESBasis.hpp:372
void degreeElevate(index_t amount=1, bool updateBasis=true)
Definition gsMPBESBasis.hpp:180
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Class Representing a triangle mesh with 3D vertices.
Definition gsMesh.h:32
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
Provides declaration of Basis abstract interface.
Provides declaration of the Mesh class.
The G+Smo namespace, containing all definitions for the library.
Struct which represents an interface between two patches.
Definition gsBoundary.h:650
Private stract that has the purpose of storing distance information of c^0 parts around special verti...
Definition gsMPBESBasis.h:342
void _determineValues(patchSide side, patchSide ls, patchSide rs, index_t dist, unsigned degree, unsigned max, unsigned &left, unsigned &right, const gsMPBESBasis< d, T > &basis) const
determines the right values for the two distances, only used in the constructer
Definition gsMPBESBasis.hpp:472
T getParamDist(const patchCorner &pc, const gsMPBESBasis< d, T > &basis) const
gets the parametric distance from the corner pc
Definition gsMPBESBasis.hpp:455
void setParamDist(unsigned absoluteVal, const patchCorner &pc, const gsMPBESBasis< d, T > &basis)
Definition gsMPBESBasis.hpp:426
bool isDistancesOfInterface(const boundaryInterface &bi) const
checks if this distances struct ressembles the interface given
Definition gsMPBESBasis.h:355
Struct which represents a certain corner of a patch.
Definition gsBoundary.h:393
Struct which represents a certain side of a patch.
Definition gsBoundary.h:232