G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsDPatch.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <gsCore/gsBoxTopology.h>
17 #include <gsCore/gsMultiPatch.h>
18 #include <gsIO/gsOptionList.h>
20 // #include <gsUnstructuredSplines/src/gsDPatchBase.hpp>
21 namespace gismo
22 {
23 
24 
32 template<short_t d,class T>
33 class gsDPatch : public gsDPatchBase<d,T>
34 {
35 
36 typedef typename std::vector<std::tuple<index_t,index_t,T>> sparseEntry_t;
37 
38 public:
39  using Base = gsDPatchBase<d,T>;
40 
42  typedef memory::shared_ptr< gsDPatch > Ptr;
43 
45  typedef memory::unique_ptr< gsDPatch > uPtr;
46 
48  gsDPatch() : Base()
49  { }
50 
51  // using Base::compute;
52 
58  gsDPatch(const gsMultiBasis<T> & mb) ;
59 
60 
66  gsDPatch(const gsMultiPatch<T> & mp) ;
67 
68  // GISMO_CLONE_FUNCTION(gsDPatch)
69 
70  ~gsDPatch();
71 
72  void defaultOptions() override;
73 
74  // using Base::exportToPatches;
75 
76 protected:
83  gsMatrix<T> _preCoefficients(const gsMultiPatch<T> & patches) override;
84  using Base::_preCoefficients;
85 
86  // using Base::exportPatch;
87 
88 protected:
89 
90  // using Base::_indexFromSides;
91 
92  // using Base::_indicesFromVert;
93 
94  // using Base::_indexFromVert;
95 
96  // using Base::_vertexData;
97 
98  // using Base::_sideIndex;
99 
100  // using Base::_vertIndex;
101 
102  // using Base::_getLowestCorners;
103 
104  // using Base::_removeLowestCorners;
105 
106  // using Base::_getLowestIndices;
107 
108  // using Base::_removeLowestIndices;
109 
110  // using Base::_getInterfaceIndices;
111 
112  // using Base::_getAllInterfaceIndices;
113 
114 protected:
115 
116  using Base::_performChecks;
117  using Base::_resetChecks;
118 
119  void _countDoFs() override;
120 
121  // void _computeMapper(); // also initialize the mappers!
122  using Base::_computeMapper;
123 
124  // void _computeSmoothMatrix();
126 
127  void _initTHB() override;
128 
129  void _refBoxes(std::vector<std::vector<index_t>> & patchBoxes);
130 
131  void _initBasis() override;
132 
133  void _makeTHB() override;
134 
135  void _computeEVs() override;
136 
146  gsMatrix<T> _makePi(index_t valence);
147 
148  using Base::getSharpCorners;
149  using Base::_indexFromSides;
150  using Base::_indexFromVert;
151  using Base::_vertexData;
152  using Base::_sideIndex;
153  using Base::_vertIndex;
158 
159  using Base::_push;
160  using Base::_pushAndCheck;
161 
162 
163 
164 protected:
165  // void _computeInterfaceMapper(boundaryInterface iface);
166  using Base::_computeInterfaceMapper;
167 
168  // void _computeBoundaryMapper(patchSide boundary);
169  using Base::_computeBoundaryMapper;
170 
171  void _computeVertexMapper(patchCorner pcorner) override;
172 
173 
174 private:
175  // // Boundary vertex of valence 1
176  // template<bool _boundary, index_t _v> // valence=2
177  // typename std::enable_if< _boundary && _v==1, void>::type
178  // // SAME
179  // _computeVertexMapperBoundary_v1(patchCorner pcorner, index_t valence);
180 
181  using Base::_computeMapperRegularCorner_v1;
182 
183  // // Boundary vertex of valence 2 with C1 smoothness
184  // template<bool _boundary, index_t _v, bool _smooth> // valence=2
185  // typename std::enable_if< _boundary && _v==2 && _smooth, void>::type
186  // // SAME
187  // _computeVertexMapperBoundarySmooth_v2(patchCorner pcorner, index_t valence);
188  using Base::_computeMapperRegularBoundaryVertexSmooth_v2;
189 
190  // // Boundary vertex of valence 2 with C0 smoothness
191  // template<bool _boundary, index_t _v, bool _smooth> // valence=2
192  // typename std::enable_if< _boundary && _v==2 && (!_smooth), void>::type
193  // // DIFFERENT
194  // _computeVertexMapperBoundaryNonSmooth_v2(patchCorner pcorner, index_t valence);
195  using Base::_computeMapperRegularBoundaryVertexNonSmooth_v2;
196 
197  // Boundary vertex of valence 3 with C1 smoothness
198  // ONLY DPATCH
199  void _computeMapperIrregularBoundaryVertexSmooth_v3(patchCorner pcorner, index_t valence);
200 
201  // Boundary vertex of valence 3 with C0 smoothness
202  // template<bool _boundary, index_t _v, bool _smooth> // valence=2
203  // typename std::enable_if< _boundary && _v==3 && (!_smooth), void>::type
204  // ONLY DPATCH
205  void _computeMapperIrregularBoundaryVertexNonSmooth_v3(patchCorner pcorner, index_t valence);
206 
207  // Boundary vertex of valence !(1,2,3) with C1 smoothness
208  // template<bool _boundary, index_t _v, bool _smooth>
209  // typename std::enable_if< _boundary && _v==-1 && _smooth, void>::type
210  // DIFFERENT
211  void _computeMapperIrregularBoundaryVertexSmooth_v(patchCorner pcorner, index_t valence) override;
212 
213  // Boundary vertex of valence !(1,2,3) with C0 smoothness
214  // template<bool _boundary, index_t _v, bool _smooth>
215  // typename std::enable_if< _boundary && _v==-1 && (!_smooth), void>::type
216  // DIFFERENT
217  void _computeMapperIrregularBoundaryVertexNonSmooth_v(patchCorner pcorner, index_t valence) override;
218 
219  // // Interior vertex
220  // template<bool _boundary, index_t _v>
221  // typename std::enable_if< (!_boundary) && _v==-1, void>::type
222  // // DIFFERENT
223  // _computeVertexMapperInterior_v(patchCorner pcorner, index_t valence);
224  using Base::_computeMapperInteriorVertex_v;
225 
226 protected:
227 
257  // void _handleVertex(patchCorner pcorner);
258  // interior vertices
259  // void _handleInteriorVertex(patchCorner pcorner, index_t valence);
260 
269  // void _handleInterface(boundaryInterface iface);
277  // void _handleBoundary(patchSide side);
283  // void _handleInterior();
288 private:
294  // void _handleRegularCorner(patchCorner pcorner);
295 
296 
297  // template<bool _regular, bool _smooth> // valence=2
298  // typename std::enable_if< _regular && _smooth , void>::type
299  // _handleBoundaryVertex(patchCorner pcorner, index_t valence);
300 
301  // template<bool _regular, bool _smooth> // valence=2
302  // typename std::enable_if< _regular && (!_smooth) , void>::type
303  // _handleBoundaryVertex(patchCorner pcorner, index_t valence);
304 
305  // template<bool _regular, bool _smooth> // valence > 2
306  // typename std::enable_if<(!_regular) && _smooth , void>::type
307  // _handleBoundaryVertex(patchCorner pcorner, index_t valence);
308 
309  // template<bool _regular, bool _smooth> // valence > 1
310  // typename std::enable_if<(!_regular) && (!_smooth) , void>::type
311  // _handleBoundaryVertex(patchCorner pcorner, index_t valence);
312 
313  // void _handleRegularBoundaryVertexSmooth(patchCorner pcorner, index_t valence);
314 
315  void _handleIrregularBoundaryVertexSmooth(patchCorner pcorner, index_t valence) override;
316 
317  void _handleIrregularBoundaryVertexNonSmooth(patchCorner pcorner, index_t valence) override;
318 
319 protected:
320  using Base::_whichHandled;
321 
322 protected:
323  using Base::m_computed;
324  using Base::m_topology;
325 
326  using Base::m_bases;
327  gsMultiBasis<T> m_bases0;
328  using Base::m_Bbases;
329  using Base::m_tMatrix;
330  std::vector<gsSparseMatrix<T>> m_tMatrices;
331  using Base::m_sideCheck;
332  using Base::m_vertCheck;
333  using Base::m_basisCheck;
334  using Base::m_C0s;
335 
336  using Base::m_mapModified;
337  using Base::m_mapOriginal;
338 
339  using Base::m_matrix;
340 
341  using Base::m_options;
342 
343  using Base::m_size;
344 
345  using Base::m_coefs;
346 
347  using Base::m_nSides;
348  using Base::m_nVerts;
349 
350 };
351 
352 
353 
354 }
355 
356 #ifndef GISMO_BUILD_LIB
357 #include GISMO_HPP_HEADER(gsDPatch.hpp)
358 #endif
void _handleIrregularBoundaryVertexSmooth(patchCorner pcorner, index_t valence) override
Handles a vertex in the global matrix.
Definition: gsDPatch.hpp:732
Creates the D-Patch smoothing matrix.
virtual void _computeMapper()
Calculates the mapper.
Definition: gsDPatchBase.hpp:1209
Provides declaration of the BoxTopology class.
memory::shared_ptr< gsDPatch > Ptr
Shared pointer for gsDPatch.
Definition: gsDPatch.h:42
virtual std::vector< bool > getSharpCorners(T tol=1e-2) const
Checks if corners are sharp or not.
Definition: gsDPatchBase.hpp:47
#define index_t
Definition: gsConfig.h:32
virtual void _computeSmoothMatrix()
Calculates the smooth matrix.
Definition: gsDPatchBase.hpp:1177
Struct which represents a certain corner of a patch.
Definition: gsBoundary.h:392
virtual const index_t _sideIndex(index_t patch, boxSide bside) const
Computes global index of the side.
Definition: gsDPatchBase.h:557
gsDPatch()
Empty constructor.
Definition: gsDPatch.h:48
Provides a list of labeled parameters/options that can be set and accessed easily.
virtual void _removeLowestCorners(std::vector< patchCorner > &pcorners, index_t n=3) const
From a list of patchCorners pcorners, remove all but the lowest n corners.
Definition: gsDPatchBase.hpp:448
virtual void _whichHandled()
Prints which DoFs have been handled and which have been eliminated.
Definition: gsDPatchBase.hpp:857
Holds a set of patch-wise bases and their topology information.
Definition: gsMultiBasis.h:36
void _countDoFs() override
Initializes the matrix, the basis and the mappers.
Definition: gsDPatch.hpp:642
Provides declaration of the MultiPatch class.
void defaultOptions() override
Sets the default options.
Definition: gsDPatch.hpp:51
Constructs the D-Patch, from which the transformation matrix can be called.
Definition: gsDPatchBase.h:36
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
virtual void _getLowestCorners(std::vector< patchCorner > &pcorners, index_t n=3) const
From a list of patchCorners pcorners, get the lowest n corners.
Definition: gsDPatchBase.hpp:435
virtual void _performChecks(bool basis)
Performs checks on sides, vertices and bases.
Definition: gsDPatchBase.hpp:875
virtual const index_t _vertIndex(index_t patch, boxCorner corner) const
Computes global index of the corner.
Definition: gsDPatchBase.h:577
Constructs the D-Patch, from which the transformation matrix can be called.
Definition: gsDPatch.h:33
memory::unique_ptr< gsDPatch > uPtr
Unique pointer for gsDPatch.
Definition: gsDPatch.h:45
void _computeEVs() override
Corrects the EVs.
Definition: gsDPatch.hpp:332
virtual void _getLowestIndices(std::vector< std::pair< index_t, index_t >> &indices, index_t n=3) const
From a list of tuples (patch,index), get the lowest n tuples.
Definition: gsDPatchBase.hpp:463
virtual const index_t _indexFromSides(index_t index1, const patchSide side1, index_t index2, const patchSide side2)
Computes the index of a basis function using sides as reference.
Definition: gsDPatchBase.hpp:227
void _initTHB() override
Initializes the matrix, the basis and the mappers.
Definition: gsDPatch.hpp:144
void _initBasis() override
Initializes the basis.
Definition: gsDPatch.hpp:271
virtual void _removeLowestIndices(std::vector< std::pair< index_t, index_t >> &indices, index_t n=3) const
From a list of tuples (patch,index), remove all but the lowest n tuples.
Definition: gsDPatchBase.hpp:484
void _makeTHB() override
Prints which DoFs have been handled and which have been eliminated.
Definition: gsDPatch.hpp:292
virtual const std::pair< index_t, bool > _vertexData(const patchCorner corner) const
Returns the valence and whether a corner is interior or boundary.
Definition: gsDPatchBase.hpp:425
virtual const index_t _indexFromVert(const index_t index, const patchCorner corner, const patchSide side, const index_t offsets=0) const
Computes the index of a basis function taking one corner and one side as reference.
Definition: gsDPatchBase.hpp:269
gsMatrix< T > _makePi(index_t valence)
Makes the Pi matrix.
Definition: gsDPatch.hpp:581
virtual void _resetChecks(bool basis)
Resets checks on sides, vertices and bases.
Definition: gsDPatchBase.hpp:890