G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsMPBESHSplineBasis.h
Go to the documentation of this file.
1 
14 #pragma once
15 
19 
20 namespace gismo
21 {
22 
31 template<short_t d, class T>
32 class gsMPBESHSplineBasis : public gsMPBESBasis<d,T>
33 {
34 public:
36  typedef memory::shared_ptr< gsMPBESHSplineBasis > Ptr;
37 
39  typedef memory::unique_ptr< gsMPBESHSplineBasis > uPtr;
40 
42  static const index_t Dim = d;
43 
44  typedef index_t indexType;
45  typedef gsMPBESBasis<d,T> Base;
47  typedef typename std::vector<BasisType *> BasisContainer;
48  typedef typename std::vector<gsBasis<T>* >::const_iterator ConstBasisIter;
49 
50 protected:
51  using Base::m_bases;
52  using Base::m_topol;
54  using Base::m_mapper;
55  using Base::m_vertices;
56  using Base::m_distances;
57  using Base::m_minDist;
58 public:
59  using Base::nPatches;
60  using Base::updateTopol;
61  using Base::degree;
62  using Base::repairPatches;
63  using Base::maxDegree;
64 protected:
65  using Base::_getPatch;
66  using Base::_getPatchIndex;
68  using Base::_initVertices;
69 
70 //TODO: gsCompactKnotVector to gsKnotVector,
71 // shift knots by constant
72 // read in of thb multipatch
73 // compute topology of thb multipatch
74 
75 public:
78  { }
79 
80  gsMPBESHSplineBasis (std::vector<BasisType *> const & bases, gsBoxTopology const & topol,
81  index_t increaseSmoothnessLevel=-1, index_t minEVDistance=-1);
82 
83  gsMPBESHSplineBasis (std::vector<BasisType *> const & bases, gsBoxTopology const & topol,
84  std::vector<gsMatrix<T> * > & coefs,index_t increaseSmoothnessLevel=-1, index_t minEVDistance=-1);
85 
86  gsMPBESHSplineBasis (BasisType const & base, gsBoxTopology const & topol);
87 
88  gsMPBESHSplineBasis( gsMultiPatch<T> const & mp, index_t increaseSmoothnessLevel = -1,
89  index_t minEVDistance=-1);
90 
91  gsMPBESHSplineBasis( gsMultiBasis<T> const & mb,gsBoxTopology const & topol, index_t increaseSmoothnessLevel = -1,
92  index_t minEVDistance=-1);
93 
95 
96  gsMPBESHSplineBasis<d,T>& operator=( const gsMPBESHSplineBasis& other );
97 
99  {
100 
101  } //destructor
102 
103 private:
105  // functions for initializing and updating
107 
109  { return true; }
110 
111 protected:
112  void _setMapping();
113 
114 
115 public:
117  // general functions for interacting with this class
119 
121  GISMO_CLONE_FUNCTION(gsMPBESHSplineBasis)
122 
123  gsHTensorBasis<d,T> & basis(size_t i)
124  { return static_cast<gsHTensorBasis<d,T>&>(*m_bases[i]); }
125 
126  const gsHTensorBasis<d,T> & basis(size_t i) const
127  { return static_cast<const gsHTensorBasis<d,T>&>(*m_bases[i]); }
128 
129  unsigned basisFunctionsOnSide(const patchSide& ps) const;
130 
131  virtual bool isLocallyConnected(indexType i,indexType j) const;
132 
133 public:
135  // functions for evaluating and derivatives
137 
139  void numActive_into(const index_t patch,const gsMatrix<T> & u, gsVector<index_t>& result) const
140  {
141  GISMO_UNUSED(patch); GISMO_UNUSED(u); GISMO_UNUSED(result);
143  }
144 
145 public:
147  // functions for refinement
149 
150  void refine(const index_t patch, gsMatrix<T> const & boxes, bool updateBasis = true);
151 
152  void refineElements(const index_t patch, std::vector<index_t> const & boxes, bool updateBasis = true);
153 
154  void refine_withCoefs(gsMatrix<T>& localCoef, const index_t patch, gsMatrix<T> const & boxes, bool updateBasis = true);
155 
156  void refineElements_withCoefs(gsMatrix<T>& localCoef, const index_t patch, std::vector<index_t> const & boxes, bool updateBasis = true);
157 
162  virtual void refineWithExtension(const index_t patch,gsMatrix<T> const & boxes, index_t refExt = 0,bool updateBasis = true);
163 
164 //private:
166  // private helper functions for the refinement
168 
169  void repairPatches(std::vector<gsMatrix<T> *> & coefs, index_t startFromPatch = -1);
170 
171  bool _innerBoxesAreSuitable(const index_t patch,
172  std::vector<index_t>& boxes);
173 
174  bool _boxesMatchNeighbours(const index_t patch,
175  std::vector<index_t>& boxes, std::vector<index_t>& checkPatches);
176 
177  void _addBoundaryBox(const index_t patch,const boxSide s,const index_t start, const index_t end,const unsigned level, std::vector<index_t> & boxes, std::vector<bool> & sideToCheck);
178 
179  void _addFunBox(const index_t patch,const unsigned uMin,const unsigned vMin,const unsigned uMax,const unsigned vMax,const unsigned level, std::vector<index_t> & boxes);
180 
181  void _addBox(const index_t patch,const unsigned uMin,const unsigned vMin,const unsigned uMax,const unsigned vMax,const unsigned level, std::vector<index_t> & boxes);
182 
183 protected:
185  // functions going back and forth between absolute val and parametric value for C^0 parts
187 
188  void _endpointsOfActiveBoundaryFunctions(patchSide const & ps,bool orient,std::vector<T>& endpoints) const;
189 
190  T findParameter(patchSide const & ps,patchCorner const & pc,unsigned nrBasisFuncs) const;
191 
192 }; // class gsMPBESHSplineBasis
193 
194 }
Provides definition of HTensorBasis abstract interface.
Provides declaration of Basis abstract interface.
gsHTensorBasis< d, T > & basis(size_t i)
Clone function. Used to make a copy of a derived basis.
Definition: gsMPBESHSplineBasis.h:123
void repairPatches(std::vector< gsMatrix< T > * > &coefs, index_t startFromPatch=-1)
Definition: gsMPBESHSplineBasis.hpp:331
#define GISMO_NO_IMPLEMENTATION
Definition: gsDebug.h:129
Provides declaration of Basis abstract interface.
Struct which represents a certain side of a patch.
Definition: gsBoundary.h:231
void _setMapping()
create a new mapping of the local basisfunctions
Definition: gsMPBESHSplineBasis.hpp:170
short_t m_incrSmoothnessDegree
smoothness degree that is tried to achive over patch interfaces
Definition: gsMPBESBasis.h:375
virtual void refineWithExtension(const index_t patch, gsMatrix< T > const &boxes, index_t refExt=0, bool updateBasis=true)
Refine the are defined by boxes on patch k with extension refExt.
Definition: gsMPBESHSplineBasis.hpp:317
#define index_t
Definition: gsConfig.h:32
A univariate Lagrange basis.
Definition: gsMPBESHSplineBasis.h:32
gsMPBESHSplineBasis()
Default empty constructor.
Definition: gsMPBESHSplineBasis.h:77
Struct which represents a certain corner of a patch.
Definition: gsBoundary.h:392
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
memory::shared_ptr< gsMPBESHSplineBasis > Ptr
Shared pointer for gsMPBESHSplineBasis.
Definition: gsMPBESHSplineBasis.h:36
Class representing a (scalar) hierarchical tensor basis of functions .
Definition: gsHTensorBasis.h:74
Holds a set of patch-wise bases and their topology information.
Definition: gsMultiBasis.h:36
virtual void repairPatches(std::vector< gsMatrix< T > * > &coefs, index_t startFromPatch=-1)=0
void updateTopol()
updates the mapping of this basis (f.e. after a knot insertion)
Definition: gsMPBESBasis.h:101
bool _checkTopologyWithBases() const
Checks the gsMappedBasis for consistency.
Definition: gsMPBESHSplineBasis.h:108
Purely abstract class gsMappedBasis, which gives means of combining basis functions to new...
Definition: gsMPBESBasis.h:46
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
Struct which represents a certain side of a box.
Definition: gsBoundary.h:84
memory::unique_ptr< gsMPBESHSplineBasis > uPtr
Unique pointer for gsMPBESHSplineBasis.
Definition: gsMPBESHSplineBasis.h:39
T findParameter(patchSide const &ps, patchCorner const &pc, unsigned nrBasisFuncs) const
Definition: gsMPBESHSplineBasis.hpp:586
void refineElements(const index_t patch, std::vector< index_t > const &boxes, bool updateBasis=true)
Definition: gsMPBESHSplineBasis.hpp:231
#define GISMO_UNUSED(x)
Definition: gsDebug.h:112
void numActive_into(const index_t patch, const gsMatrix< T > &u, gsVector< index_t > &result) const
Returns the number of active (nonzero) basis functions at points u in result.
Definition: gsMPBESHSplineBasis.h:139
unsigned basisFunctionsOnSide(const patchSide &ps) const
Returns the amount of basis functions on a given side of a given patch.
Definition: gsMPBESHSplineBasis.hpp:180
std::vector< distances > m_distances
vector of distances objects, that store C^0 distances from special vertices on the edges ...
Definition: gsMPBESBasis.h:383
void refine_withCoefs(gsMatrix< T > &localCoef, const index_t patch, gsMatrix< T > const &boxes, bool updateBasis=true)
Definition: gsMPBESHSplineBasis.hpp:245
void _initVertices()
initializes the m_vertices field
Definition: gsMPBESBasis.hpp:298
Defines a topological arrangement of a collection of &quot;boxes&quot; (e.g., parameter domains that map to phy...
Definition: gsBoxTopology.h:38
unsigned m_minDist
minimal C^0 distance from special (extraordinary) vertices, specified in basisfunctions ...
Definition: gsMPBESBasis.h:377
static const index_t Dim
Dimension of the parameter domain.
Definition: gsMPBESHSplineBasis.h:42
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78
void refineElements_withCoefs(gsMatrix< T > &localCoef, const index_t patch, std::vector< index_t > const &boxes, bool updateBasis=true)
Definition: gsMPBESHSplineBasis.hpp:282
void _setDistanceOfAllVertices()
initializes the m_distances field
Definition: gsMPBESBasis.hpp:313
void refine(const index_t patch, gsMatrix< T > const &boxes, bool updateBasis=true)
Definition: gsMPBESHSplineBasis.hpp:217