DUNE-FEM (unstable)

genericlagrangepoints.hh
1#ifndef DUNE_FEM_SPACE_LAGRANGE_GENERICLAGRANGEPOINTS_HH
2#define DUNE_FEM_SPACE_LAGRANGE_GENERICLAGRANGEPOINTS_HH
3
4// C++ includes
5#include <iostream>
6
7// dune-common includes
9
10// local includes
11#include "genericgeometry.hh"
12
13
14namespace Dune
15{
16
17 namespace Fem
18 {
19
20 template< class ImplType, unsigned int order, bool bottom = true >
21 class GenericLagrangePoint;
22
23
24 template< unsigned int order, bool bottom >
25 class GenericLagrangePoint< PointGeometry, order, bottom >
26 {
27 public:
28 typedef PointGeometry GeometryType;
29 static const unsigned int dimension = GeometryType::dimension;
30
31 typedef LocalCoordinate< GeometryType, unsigned int > DofCoordinateType;
32
33 static const unsigned int polynomialOrder = order;
34
35 template< class, unsigned int, bool >
36 friend class GenericLagrangePoint;
37
38 template< class, class, unsigned int >
39 friend class GenericLagrangeBaseFunction;
40
41 private:
42 typedef GenericLagrangePoint< GeometryType, polynomialOrder > ThisType;
43
44 public:
45 static const unsigned int numLagrangePoints = 1;
46
47 protected:
48 DofCoordinateType dofCoordinate_;
49
50 public:
51 template< unsigned int codim >
52 struct Codim;
53
54 public:
55 GenericLagrangePoint ( unsigned int index )
56 {
57 dofCoordinate( index, dofCoordinate_ );
58 }
59
60 GenericLagrangePoint ( const ThisType &point )
61 : dofCoordinate_( point.dofCoordinate_ )
62 {}
63
64 template< class LocalCoordinateType >
65 static void dofSubEntity ( LocalCoordinateType &coordinate,
66 unsigned int &codim,
67 unsigned int &subEntity )
68 {
69 codim = 0;
70 subEntity = 0;
71 }
72
73 template< class LocalCoordinateType >
74 static void dofSubEntity ( LocalCoordinateType &coordinate,
75 unsigned int &codim,
76 unsigned int &subEntity,
77 unsigned int &dofNumber )
78 {
79 codim = 0;
80 subEntity = 0;
81 dofNumber = 0;
82 }
83
84 void dofSubEntity ( unsigned int &codim,
85 unsigned int &subEntity )
86 {
87 dofSubEntity( dofCoordinate_, codim, subEntity );
88 }
89
90 void dofSubEntity ( unsigned int &codim,
91 unsigned int &subEntity,
92 unsigned int &dofNumber )
93 {
94 dofSubEntity( dofCoordinate_, codim, subEntity, dofNumber );
95 }
96
97 static unsigned int entityDofNumber ( unsigned int codim,
98 unsigned int subEntity,
99 unsigned int dof )
100 {
101 //assert( (codim == 0) && (subEntity == 0) && (dof == 0) );
102 return 0;
103 }
104
105 template< class LocalCoordinateType >
106 static unsigned int height ( LocalCoordinateType &coordinate )
107 {
108 return polynomialOrder;
109 }
110
111 unsigned int height ()
112 {
113 return height( dofCoordinate_ );
114 }
115
116 template< class FieldType >
117 void local ( FieldVector< FieldType, dimension > &coordinate ) const
118 {
119 const FieldType factor = FieldType( 1 ) / FieldType( polynomialOrder );
120 for( unsigned int i = 0; i < dimension; ++i )
121 coordinate[ i ] = factor * dofCoordinate_[ i ];
122 }
123
130 static unsigned int maxDofs ( unsigned int codim )
131 {
132 return ((codim == 0) ? 1 : 0);
133 }
134
142 static unsigned int numDofs ( unsigned int codim, unsigned int subEntity )
143 {
144 return ((codim == 0) ? 1 : 0);
145 }
146
153 static unsigned int numDofs ( unsigned int codim )
154 {
155 return ((codim == 0) ? 1 : 0);
156 }
157
158 protected:
159 template< class LocalCoordinateType >
160 static inline void dofCoordinate ( unsigned int index,
161 LocalCoordinateType &coordinate )
162 {
163 assert( index <= numLagrangePoints );
164 coordinate = 0;
165 }
166 };
167
168
170 template< unsigned int order, bool bottom >
171 template< unsigned int codim >
172 struct GenericLagrangePoint< PointGeometry, order, bottom >::Codim
173 {
174 static unsigned int maxDofs ()
175 {
176 return ((codim == 0) ? 1 : 0);
177 }
178 };
182 template< class BaseGeometry, bool bottom >
183 class GenericLagrangePoint< PyramidGeometry< BaseGeometry >, 0, bottom >
184 {
185 public:
186 typedef BaseGeometry BaseGeometryType;
187 typedef PyramidGeometry< BaseGeometryType > GeometryType;
188
189 static const unsigned int dimension = GeometryType::dimension;
190
191 typedef LocalCoordinate< GeometryType, unsigned int > DofCoordinateType;
192
193 static const unsigned int polynomialOrder = 0;
194
195 template< class, unsigned int, bool >
196 friend class GenericLagrangePoint;
197
198 template< class, class, unsigned int >
199 friend class GenericLagrangeBaseFunction;
200
201 private:
202 typedef GenericLagrangePoint< GeometryType, polynomialOrder > ThisType;
203
204 public:
205 static const unsigned int numLagrangePoints = 1;
206
207 protected:
208 DofCoordinateType dofCoordinate_;
209
210 public:
211 template< unsigned int codim >
212 struct Codim;
213
214 public:
215 GenericLagrangePoint ( unsigned int index )
216 {
217 dofCoordinate( index, dofCoordinate_ );
218 }
219
220 GenericLagrangePoint ( const ThisType &point )
221 : dofCoordinate_( point.dofCoordinate_ )
222 {}
223
224 template< class LocalCoordinateType >
225 static void dofSubEntity ( LocalCoordinateType &coordinate,
226 unsigned int &codim,
227 unsigned int &subEntity )
228 {
229 codim = (bottom ? 0 : dimension);
230 subEntity = 0;
231 }
232
233 template< class LocalCoordinateType >
234 static void dofSubEntity ( LocalCoordinateType &coordinate,
235 unsigned int &codim,
236 unsigned int &subEntity,
237 unsigned int &dofNumber )
238 {
239 codim = (bottom ? 0 : dimension);
240 subEntity = 0;
241 dofNumber = 0;
242 }
243
244 void dofSubEntity ( unsigned int &codim,
245 unsigned int &subEntity )
246 {
247 dofSubEntity( dofCoordinate_, codim, subEntity );
248 }
249
250 void dofSubEntity ( unsigned int &codim,
251 unsigned int &subEntity,
252 unsigned int &dofNumber )
253 {
254 dofSubEntity( dofCoordinate_, codim, subEntity, dofNumber );
255 }
256
257 static unsigned int entityDofNumber ( unsigned int codim,
258 unsigned int subEntity,
259 unsigned int dof )
260 {
261 return 0;
262 }
263
264 template< class LocalCoordinateType >
265 static unsigned int height ( LocalCoordinateType &coordinate )
266 {
267 return polynomialOrder;
268 }
269
270 unsigned int height ()
271 {
272 return height( dofCoordinate_ );
273 }
274
275 template< class FieldType >
276 void local ( FieldVector< FieldType, dimension > &coordinate ) const
277 {
278 const FieldType factor = FieldType( 1 ) / FieldType( polynomialOrder );
279 for( unsigned int i = 0; i < dimension; ++i )
280 coordinate[ i ] = factor * dofCoordinate_[ i ];
281 }
282
289 static unsigned int maxDofs ( unsigned int codim )
290 {
291 if( bottom )
292 return ((codim == 0) ? 1 : 0);
293 else
294 return ((codim == dimension) ? 1 : 0);
295 }
296
304 static unsigned int numDofs ( unsigned int codim, unsigned int subEntity )
305 {
306 if( bottom )
307 return ((codim == 0) ? 1 : 0);
308 else
309 return ((codim == dimension) ? 1 : 0);
310 }
311
318 static unsigned int numDofs ( unsigned int codim )
319 {
320 if( bottom )
321 return ((codim == 0) ? 1 : 0);
322 else
323 return ((codim == dimension) ? 1 : 0);
324 }
325
326 protected:
327 template< class LocalCoordinateType >
328 static void dofCoordinate ( unsigned int index,
329 LocalCoordinateType &coordinate )
330 {
331 assert( index <= numLagrangePoints );
332 coordinate = 0;
333 }
334 };
335
336
338 template< class BaseGeometry, bool bottom >
339 template< unsigned int codim >
340 struct GenericLagrangePoint< PyramidGeometry< BaseGeometry >, 0, bottom >::Codim
341 {
342 static inline unsigned int maxDofs ()
343 {
344 if( bottom )
345 return ((codim == 0) ? 1 : 0);
346 else
347 return ((codim == dimension) ? 1 : 0);
348 }
349 };
353 template< class BaseGeometry, unsigned int order, bool bottom >
354 class GenericLagrangePoint< PyramidGeometry< BaseGeometry >, order, bottom >
355 {
356 public:
357 typedef BaseGeometry BaseGeometryType;
358 typedef PyramidGeometry< BaseGeometryType > GeometryType;
359 static const unsigned int dimension = GeometryType :: dimension;
360
361 typedef LocalCoordinate< GeometryType, unsigned int > DofCoordinateType;
362
363 static const unsigned int polynomialOrder = order;
364
365 template< class, unsigned int, bool >
366 friend class GenericLagrangePoint;
367
368 template< class, class, unsigned int >
369 friend class GenericLagrangeBaseFunction;
370
371 private:
372 typedef GenericLagrangePoint< GeometryType, polynomialOrder > ThisType;
373
374 typedef GenericLagrangePoint< GeometryType, polynomialOrder - 1, false >
375 OrderReductionType;
376 typedef GenericLagrangePoint< BaseGeometryType, polynomialOrder >
377 DimensionReductionType;
378
379 public:
380 static const unsigned int numLagrangePoints
381 = DimensionReductionType::numLagrangePoints + OrderReductionType::numLagrangePoints;
382
383 protected:
384 DofCoordinateType dofCoordinate_;
385
386 public:
387 template< unsigned int codim >
388 struct Codim;
389
390 public:
391 GenericLagrangePoint ( unsigned int index )
392 {
393 dofCoordinate( index, dofCoordinate_ );
394 }
395
396 GenericLagrangePoint ( const ThisType &point )
397 : dofCoordinate_( point.dofCoordinate_ )
398 {}
399
400 template< class LocalCoordinateType >
401 static void dofSubEntity ( LocalCoordinateType &coordinate,
402 unsigned int &codim,
403 unsigned int &subEntity )
404 {
405 if( !useDimReduction( coordinate ) )
406 {
407 --(*coordinate);
408 OrderReductionType::dofSubEntity( coordinate, codim, subEntity );
409 ++(*coordinate);
410
411 if( bottom && (codim > 0) )
412 subEntity += BaseGeometryType::numSubEntities( codim - 1 );
413 }
414 else
415 {
416 DimensionReductionType::dofSubEntity( coordinate.base(), codim, subEntity );
417 if( bottom )
418 ++codim;
419 }
420 }
421
422 template< class LocalCoordinateType >
423 static void dofSubEntity ( LocalCoordinateType &coordinate,
424 unsigned int &codim,
425 unsigned int &subEntity,
426 unsigned int &dofNumber )
427 {
428 if( !useDimReduction( coordinate ) )
429 {
430 --(*coordinate);
431 OrderReductionType::template dofSubEntity( coordinate, codim, subEntity, dofNumber );
432 ++(*coordinate);
433
434 if( bottom )
435 subEntity += (codim > 0 ? BaseGeometryType :: numSubEntities( codim - 1 ) : 0);
436 else
437 dofNumber += DimensionReductionType::numDofs( codim, subEntity );
438 }
439 else
440 {
441 DimensionReductionType::dofSubEntity( coordinate.base(), codim, subEntity, dofNumber );
442 if( bottom )
443 ++codim;
444 }
445 }
446
447
448 void dofSubEntity ( unsigned int &codim,
449 unsigned int &subEntity )
450 {
451 dofSubEntity( dofCoordinate_, codim, subEntity );
452 }
453
454 void dofSubEntity ( unsigned int &codim,
455 unsigned int &subEntity,
456 unsigned int &dofNumber )
457 {
458 dofSubEntity( dofCoordinate_, codim, subEntity, dofNumber );
459 }
460
461 static unsigned int entityDofNumber ( unsigned int codim,
462 unsigned int subEntity,
463 unsigned int dof )
464 {
465 if( bottom )
466 {
467 if( codim == 0 )
468 return OrderReductionType::entityDofNumber( codim, subEntity, dof )
469 + DimensionReductionType::numLagrangePoints;
470
471 const unsigned int numBaseSubEntities
472 = BaseGeometryType::numSubEntities( codim - 1 );
473 if( subEntity >= numBaseSubEntities )
474 return OrderReductionType::entityDofNumber( codim, subEntity - numBaseSubEntities, dof )
475 + DimensionReductionType::numLagrangePoints;
476 else
477 return DimensionReductionType::entityDofNumber( codim - 1, subEntity, dof );
478 }
479 else
480 {
481 const unsigned int numBaseEntityDofs
482 = DimensionReductionType::numDofs( codim, subEntity );
483 if( dof >= numBaseEntityDofs )
484 return OrderReductionType::entityDofNumber( codim, subEntity, dof - numBaseEntityDofs )
485 + DimensionReductionType::numLagrangePoints;
486 else
487 return DimensionReductionType::entityDofNumber( codim, subEntity, dof );
488 }
489 }
490
491 template< class LocalCoordinateType >
492 static unsigned int height ( LocalCoordinateType &coordinate )
493 {
494 if( !useDimReduction( coordinate ) ) {
495 --(*coordinate);
496 unsigned int h = OrderReductionType :: height( coordinate );
497 ++(*coordinate);
498 return h;
499 } else
500 return DimensionReductionType :: height( coordinate.base() );
501 }
502
503 unsigned int height ()
504 {
505 return height( dofCoordinate_ );
506 }
507
508 template< class FieldType >
509 void local ( FieldVector< FieldType, dimension > &coordinate ) const
510 {
511 const FieldType factor = FieldType( 1 ) / FieldType( polynomialOrder );
512 for( unsigned int i = 0; i < dimension; ++i )
513 coordinate[ i ] = factor * dofCoordinate_[ i ];
514 }
515
522 static unsigned int maxDofs ( unsigned int codim )
523 {
524 const unsigned int maxOrderDofs
525 = OrderReductionType::maxDofs( codim );
526
527 if( bottom && (codim == 0) )
528 return maxOrderDofs;
529
530 const unsigned int maxDimDofs
531 = DimensionReductionType::maxDofs( bottom ? codim - 1 : codim );
532
533 return (bottom ? std::max( maxDimDofs, maxOrderDofs )
534 : maxDimDofs + maxOrderDofs);
535 }
536
544 static unsigned int numDofs ( unsigned int codim, unsigned int subEntity )
545 {
546 if( bottom )
547 {
548 if( bottom && (codim == 0) )
549 return OrderReductionType::numDofs( codim, subEntity );
550
551 const unsigned int numBaseSubEntities
552 = BaseGeometryType::numSubEntities( codim - 1 );
553 if( subEntity < numBaseSubEntities )
554 return DimensionReductionType::numDofs( codim - 1, subEntity );
555 else
556 return OrderReductionType::numDofs( codim, subEntity - numBaseSubEntities );
557 }
558 else
559 {
560 return DimensionReductionType::numDofs( codim, subEntity )
561 + OrderReductionType::numDofs( codim, subEntity );
562 }
563 }
564
571 static unsigned int numDofs ( unsigned int codim )
572 {
573 if( bottom )
574 {
575 const unsigned int orderDofs = OrderReductionType::numDofs( codim );
576 if( codim > 0 )
577 return orderDofs + DimensionReductionType::numDofs( codim - 1 );
578 else
579 return orderDofs;
580 }
581 else
582 {
583 return DimensionReductionType::numDofs( codim )
584 + OrderReductionType::numDofs( codim );
585 }
586 }
587
588 template< class LocalCoordinateType >
589 static bool useDimReduction ( const LocalCoordinateType &coordinate )
590 {
591 return (*coordinate == 0);
592 }
593
594 protected:
595 template< class LocalCoordinateType >
596 static void dofCoordinate ( unsigned int index,
597 LocalCoordinateType &coordinate )
598 {
599 assert( index <= numLagrangePoints );
600
601 if( index < DimensionReductionType::numLagrangePoints )
602 {
603 (*coordinate) = 0;
604 DimensionReductionType :: dofCoordinate( index, coordinate.base() );
605 }
606 else
607 {
608 const int orderIndex = index - DimensionReductionType::numLagrangePoints;
609 OrderReductionType::dofCoordinate( orderIndex, coordinate );
610 ++(*coordinate);
611 }
612 }
613 };
614
615
617 template< class BaseGeometry, unsigned int order, bool bottom >
618 template< unsigned int codim >
619 struct GenericLagrangePoint< PyramidGeometry< BaseGeometry >, order, bottom >::Codim
620 {
621 static unsigned int maxDofs ()
622 {
623 const unsigned int maxOrderDofs
624 = OrderReductionType::template Codim< codim >::maxDofs();
625
626 const unsigned int maxDimDofs
627 = DimensionReductionType::template Codim< (bottom ? codim - 1 : codim) >::maxDofs();
628
629 if( bottom )
630 return std::max( maxDimDofs, maxOrderDofs );
631 else
632 return maxDimDofs + maxOrderDofs;
633 }
634 };
638 template< class FirstGeometry, class SecondGeometry, unsigned int order, bool bottom >
639 class GenericLagrangePoint< ProductGeometry< FirstGeometry, SecondGeometry >, order, bottom >
640 {
641 public:
642 typedef ProductGeometry< FirstGeometry, SecondGeometry > GeometryType;
643 static const unsigned int dimension = GeometryType::dimension;
644
645 typedef LocalCoordinate< GeometryType, unsigned int > DofCoordinateType;
646
647 static const unsigned int polynomialOrder = order;
648
649 template< class, unsigned int, bool >
650 friend class GenericLagrangePoint;
651
652 template< class, class, unsigned int >
653 friend class GenericLagrangeBaseFunction;
654
655 private:
656 typedef GenericLagrangePoint< GeometryType, polynomialOrder > ThisType;
657
658 typedef GenericLagrangePoint< FirstGeometry, polynomialOrder > FirstReductionType;
659 typedef GenericLagrangePoint< SecondGeometry, polynomialOrder > SecondReductionType;
660
661 public:
662 static const unsigned int numLagrangePoints
663 = FirstReductionType::numLagrangePoints * SecondReductionType::numLagrangePoints;
664
665 protected:
666 DofCoordinateType dofCoordinate_;
667
668 private:
669 template< unsigned int codim, unsigned int i >
670 struct CodimIterator;
671
672 public:
673 template< unsigned int codim >
674 struct Codim;
675
676 public:
677 GenericLagrangePoint ( unsigned int index )
678 {
679 dofCoordinate( index, dofCoordinate_ );
680 }
681
682 GenericLagrangePoint ( const ThisType &point )
683 : dofCoordinate_( point.dofCoordinate_ )
684 {}
685
686 template< class LocalCoordinateType >
687 static void dofSubEntity( LocalCoordinateType &coordinate,
688 unsigned int &codim,
689 unsigned int &subEntity )
690 {
691 unsigned int firstCodim, secondCodim;
692 unsigned int firstSubEntity, secondSubEntity;
693
694 FirstReductionType::dofSubEntity( coordinate.first(), firstCodim, firstSubEntity );
695 SecondReductionType::dofSubEntity( coordinate.second(), secondCodim, secondSubEntity );
696
697 codim = firstCodim + secondCodim;
698
699 subEntity = 0;
700 for( unsigned int i = 0; i < secondCodim; ++i )
701 subEntity += FirstGeometry::numSubEntities( codim-i ) * SecondGeometry::numSubEntities( i );
702 subEntity += firstSubEntity + secondSubEntity * FirstGeometry::numSubEntities( firstCodim );
703 }
704
705 template< class LocalCoordinateType >
706 static void dofSubEntity( LocalCoordinateType &coordinate,
707 unsigned int &codim,
708 unsigned int &subEntity,
709 unsigned int &dofNumber )
710 {
711 unsigned int firstCodim, secondCodim;
712 unsigned int firstSubEntity, secondSubEntity;
713 unsigned int firstDofNumber, secondDofNumber;
714
715 FirstReductionType::dofSubEntity( coordinate.first(), firstCodim, firstSubEntity, firstDofNumber );
716 SecondReductionType::dofSubEntity( coordinate.second(), secondCodim, secondSubEntity, secondDofNumber );
717
718 codim = firstCodim + secondCodim;
719
720 subEntity = 0;
721 for( unsigned int i = 0; i < secondCodim; ++i )
722 subEntity += FirstGeometry::numSubEntities( codim-i ) * SecondGeometry::numSubEntities( i );
723 subEntity += firstSubEntity + secondSubEntity * FirstGeometry::numSubEntities( firstCodim );
724
725 dofNumber = firstDofNumber + secondDofNumber * FirstReductionType::numDofs( firstCodim, firstSubEntity );
726 }
727
728 void dofSubEntity ( unsigned int &codim, unsigned int &subEntity )
729 {
730 dofSubEntity( dofCoordinate_, codim, subEntity );
731 }
732
733 void dofSubEntity ( unsigned int &codim,
734 unsigned int &subEntity,
735 unsigned int &dofNumber )
736 {
737 dofSubEntity( dofCoordinate_, codim, subEntity, dofNumber );
738 }
739
740 static unsigned int entityDofNumber ( unsigned int codim,
741 unsigned int subEntity,
742 unsigned int dofNumber )
743 {
744 unsigned int firstCodim = codim;
745 unsigned int secondCodim = 0;
746 for( ; secondCodim < codim; --firstCodim, ++secondCodim )
747 {
748 const unsigned int num
749 = FirstGeometry::numSubEntities( firstCodim ) * SecondGeometry::numSubEntities( secondCodim );
750
751 if( subEntity < num )
752 break;
753 subEntity -= num;
754 }
755
756 const unsigned int n = FirstGeometry::numSubEntities( firstCodim );
757 const unsigned int firstSubEntity = subEntity % n;
758 const unsigned int secondSubEntity = subEntity / n;
759
760 const unsigned int m = FirstReductionType::numDofs( firstCodim, firstSubEntity );
761 const unsigned int firstDofNumber = dofNumber % m;
762 const unsigned int secondDofNumber = dofNumber / m;
763
764 const unsigned int firstEntityDofNumber
765 = FirstReductionType::entityDofNumber( firstCodim, firstSubEntity, firstDofNumber );
766 const unsigned int secondEntityDofNumber
767 = SecondReductionType::entityDofNumber( secondCodim, secondSubEntity, secondDofNumber );
768
769 return firstEntityDofNumber + secondEntityDofNumber * FirstReductionType::numLagrangePoints;
770 }
771
772 template< class LocalCoordinateType >
773 static unsigned int height ( LocalCoordinateType &coordinate )
774 {
775 const unsigned int firstHeight = FirstReductionType::height( coordinate.first() );
776 const unsigned int secondHeight = SecondReductionType::height( coordinate.second() );
777
778 return ((firstHeight < secondHeight) ? firstHeight : secondHeight);
779 }
780
781 unsigned int height ()
782 {
783 return height( dofCoordinate_ );
784 }
785
786 template< class FieldType >
787 void local ( FieldVector< FieldType, dimension > &coordinate ) const
788 {
789 const FieldType factor = FieldType( 1 ) / FieldType( polynomialOrder );
790 for( unsigned int i = 0; i < dimension; ++i )
791 coordinate[ i ] = factor * dofCoordinate_[ i ];
792 }
793
800 static unsigned int maxDofs ( unsigned int codim )
801 {
802 unsigned int max = 0;
803 for( unsigned int i = 0; i <= codim; ++i ) {
804 const unsigned int n
805 = FirstReductionType :: maxDofs( codim - i )
806 * SecondReductionType :: maxDofs( i );
807 max = (max >= n) ? max : n;
808 }
809 return max;
810 }
811
819 static unsigned int numDofs ( unsigned int codim, unsigned int subEntity )
820 {
821 unsigned int firstCodim = codim;
822 unsigned int secondCodim = 0;
823 for( ; secondCodim <= codim; --firstCodim, ++secondCodim )
824 {
825 const unsigned int numSubEntities
826 = FirstGeometry::numSubEntities( firstCodim ) * SecondGeometry :: numSubEntities( secondCodim );
827
828 if( subEntity < numSubEntities )
829 break;
830 subEntity -= numSubEntities;
831 }
832
833 const unsigned int n = FirstGeometry::numSubEntities( firstCodim );
834 const unsigned int firstSubEntity = subEntity % n;
835 const unsigned int secondSubEntity = subEntity / n;
836
837 return FirstReductionType :: numDofs( firstCodim, firstSubEntity )
838 * SecondReductionType :: numDofs( secondCodim, secondSubEntity );
839 }
840
847 static unsigned int numDofs ( unsigned int codim )
848 {
849 unsigned int count = 0;
850
851 unsigned int firstCodim = codim;
852 unsigned int secondCodim = 0;
853 for( ; secondCodim <= codim; --firstCodim, ++secondCodim )
854 count += FirstReductionType :: numDofs( firstCodim )
855 * SecondReductionType :: numDofs( secondCodim );
856
857 return count;
858 }
859
860 protected:
861 template< class LocalCoordinateType >
862 static void dofCoordinate ( unsigned int index,
863 LocalCoordinateType &coordinate )
864 {
865 assert( index <= numLagrangePoints );
866
867 const unsigned int firstIndex
868 = index % FirstReductionType :: numLagrangePoints;
869 const unsigned int secondIndex
870 = index / FirstReductionType :: numLagrangePoints;
871
872 FirstReductionType :: dofCoordinate( firstIndex, coordinate.first() );
873 SecondReductionType :: dofCoordinate( secondIndex, coordinate.second() );
874 }
875 };
876
877
879 template< class FirstGeometry, class SecondGeometry, unsigned int order, bool bottom >
880 template< unsigned int codim >
881 struct GenericLagrangePoint< ProductGeometry< FirstGeometry, SecondGeometry >, order, bottom >::Codim
882 {
883 static unsigned int maxDofs ()
884 {
885 return CodimIterator< codim, codim >::maxDofs();
886 }
887 };
892 template< class FirstGeometry, class SecondGeometry, unsigned int order, bool bottom >
893 template< unsigned int codim, unsigned int i >
894 struct GenericLagrangePoint< ProductGeometry< FirstGeometry, SecondGeometry >, order, bottom >::CodimIterator
895 {
896 static unsigned int maxDofs ()
897 {
898 typedef typename FirstReductionType::template Codim< codim-i > FirstCodim;
899 typedef typename SecondReductionType::template Codim< i > SecondCodim;
900 const unsigned int n = FirstCodim::maxDofs() * SecondCodim::maxDofs();
901
902 const unsigned int m = CodimIterator< codim, i-1 >::maxDofs();
903 return std::max( m, n );
904 }
905 };
906
907 template< class FirstGeometry, class SecondGeometry, unsigned int order, bool bottom >
908 template< unsigned int codim>
909 struct GenericLagrangePoint< ProductGeometry< FirstGeometry, SecondGeometry >, order, bottom >::CodimIterator<codim, 0>
910 {
911 static unsigned int maxDofs ()
912 {
913 typedef typename FirstReductionType::template Codim< codim > FirstCodim;
914 typedef typename SecondReductionType::template Codim< 0 > SecondCodim;
915 return FirstCodim::maxDofs() * SecondCodim::maxDofs();
916 }
917 };
920 } // namespace Fem
921
922} // namespace Dune
923
924#endif // #ifndef DUNE_FEM_SPACE_LAGRANGE_GENERICLAGRANGEPOINTS_HH
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Implements a vector constructed from a given type representing a field and a compile-time given size.
constexpr auto max
Function object that returns the greater of the given values.
Definition: hybridutilities.hh:484
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)