Geophysical Inversion and Modelling Library v1.5.4
Loading...
Searching...
No Matches
meshentities.h
1/******************************************************************************
2 * Copyright (C) 2006-2024 by the GIMLi development team *
3 * Carsten Rücker carsten@resistivity.net *
4 * *
5 * Licensed under the Apache License, Version 2.0 (the "License"); *
6 * you may not use this file except in compliance with the License. *
7 * You may obtain a copy of the License at *
8 * *
9 * http://www.apache.org/licenses/LICENSE-2.0 *
10 * *
11 * Unless required by applicable law or agreed to in writing, software *
12 * distributed under the License is distributed on an "AS IS" BASIS, *
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 * See the License for the specific language governing permissions and *
15 * limitations under the License. *
16 * *
17 ******************************************************************************/
18
19#ifndef _GIMLI_MESHENTITIES__H
20#define _GIMLI_MESHENTITIES__H
21
22#include "gimli.h"
23
24#include "vector.h"
25#include "matrix.h"
26#include "elementmatrix.h"
27#include "baseentity.h"
28
29#include "polynomial.h"
30
31#include <vector>
32#include <set>
33
34namespace GIMLI{
35
36template < class Typname > bool lesserId(const Typname * a, const Typname * b){
37 return (a->id() < b->id());
38}
39
40DLLEXPORT Boundary * findBoundary(const Node & n1);
41DLLEXPORT Boundary * findBoundary(const Node & n1, const Node & n2);
42DLLEXPORT Boundary * findBoundary(const Node & n1, const Node & n2, const Node & n3);
43
44DLLEXPORT Boundary * findBoundary(const std::vector < Node * > & n);
45
47DLLEXPORT std::set < Boundary * >
48findBoundaries(const std::vector < Node * > & n);
49
51DLLEXPORT Boundary * findCommonBoundary(const Cell & c1, const Cell & c2);
52
53DLLEXPORT Cell * findCommonCell(const std::vector < Node * > & n, bool warn = true);
54
56class CollectNodeFunctor{
57public:
58 CollectNodeFunctor(std::set< Node * > & c):c_(& c){}
59
60 template < class E > void operator()(E * e){
61 for (Index i = 0; i < e->nodeCount(); i++) c_->insert(& e->node(i));
62 }
63 std::set< Node * > * c_;
64};
65
69template < class ContainerOfMeshEntities >
70std::set< Node * > commonNodes(const ContainerOfMeshEntities & c){
71 std::set< Node * > commons;
72
73 CollectNodeFunctor gc(commons);
74 for_each(c.begin(), c.end(), gc);
75 return commons;
76}
77
78class DLLEXPORT RegionMarker : public RVector3{
79public:
80 RegionMarker(const RVector3 & pos, int marker, double area=0.0,
81 bool hole=false)
82 : RVector3(pos), marker_(marker), area_(area), isHole_(hole){}
83
84 ~RegionMarker(){}
85
86 inline void setMarker(SIndex marker) {marker_ = marker;}
87 inline int marker() const {return marker_;}
88
89 inline void setArea(double area) {area_ = area;}
90 inline double area() const {return area_;}
91
92 inline void setPos(const Pos & pos) {copy_(pos);}
93
94 bool isHole() const { return isHole_; }
95 inline void setHole(bool h) { isHole_ = h; }
96
97protected:
98 int marker_;
99 double area_;
100 bool isHole_;
101};
102
103class DLLEXPORT MeshEntity : public BaseEntity {
104public:
105
107 MeshEntity();
108
110 virtual ~MeshEntity();
111
113 virtual uint dim() const { return 0; }
114
116 virtual uint rtti() const { return MESH_MESHENTITY_RTTI; }
117
119 virtual uint parentType() const { return MESH_MESHENTITY_RTTI; }
120
121 virtual void setNodes(const std::vector < Node * > & nodes);
122
123 const std::vector< Node * > & nodes() const { return nodeVector_; }
124
125 inline Node & node(uint i) {
126 ASSERT_RANGE(i, 0, nodeCount()); return *nodeVector_[i];
127 }
128
129 inline Node & node(uint i) const {
130 ASSERT_RANGE(i, 0, nodeCount()); return *nodeVector_[i];
131 }
132
133 inline uint nodeCount() const { return nodeVector_.size(); }
134
135 inline Shape & shape() { return *shape_; }
136
137 inline Shape & shape() const { return *shape_; }
138
139 inline Shape * pShape() { return shape_; }
140
142 RVector3 rst(uint i) const;
143
145 RVector3 center() const;
146
148 double size() const;
149
150 virtual double attribute() const { return -1.0; }
151
153 IndexArray ids() const;
154
155 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
156
160 virtual RVector N(const RVector3 & rst) const;
161
163 virtual void N(const RVector3 & rst, RVector & n) const;
164
168 virtual RVector dNdL(const RVector3 & rst, uint i) const;
169
175 virtual RMatrix dNdL(const RVector3 & rst) const;
176
180 double pot(const RVector3 & p, const RVector & u) const;
181
185 RVector3 vec(const RVector3 & p, const R3Vector & v) const;
186
190 RVector3 grad(const RVector3 & p, const RVector & u) const;
191
192 friend std::ostream & operator << (std::ostream & str, const MeshEntity & c);
193
194// void setUxCache(const ElementMatrix < double > & mat) const { uxCache_ = mat; }
195
196 // const ElementMatrix < double > & uxCache() const { return uxCache_; }
197
198 void setUxCache(const RMatrix & mat) const { uxCache_ = mat; }
199
200 const RMatrix & uxCache() const { return uxCache_; }
201
202 ElementMatrix < double > & uCache(){ return uCache_; }
203
204 ElementMatrix < double > & gradUCache(){ return gradUCache_; }
205
207 void changed();
208
209 void addSecondaryNode(Node * n);
210
211 void delSecondaryNode(Node * n);
212
213 const std::vector < Node * > & secondaryNodes() const;
214
216 const std::vector < Node * > allNodes() const;
217
218 Index allNodeCount() const;
219
222 virtual bool enforcePositiveDirection();
223
224protected:
225 void fillShape_();
226
227 virtual void registerNodes_();
228 virtual void deRegisterNodes_();
229
230 virtual void registerSecNode_(Node *n);
231 virtual void deRegisterSecNode_(Node *n);
232
233
234 Shape * shape_;
235
236 std::vector < Node * > nodeVector_;
237 std::vector < Node * > secondaryNodes_;
238
240 mutable ElementMatrix < double > uCache_;
241 mutable ElementMatrix < double > gradUCache_;
242
243 mutable RMatrix uxCache_;
244
245protected:
247 MeshEntity(const MeshEntity & ent){
248 THROW_TO_IMPL
249 }
250
252 MeshEntity & operator = (const MeshEntity & ent){
253 if (this != & ent){
254 THROW_TO_IMPL
255 } return *this;
256 }
257};
258
260
261class DLLEXPORT Cell : public MeshEntity {
262public:
263 DLLEXPORT friend std::ostream & operator << (std::ostream & str, const Cell & c);
264
266 Cell();
267
269 Cell(const std::vector < Node * > & nodes);
270
272 virtual ~Cell();
273
275 bool operator==(const Cell & cell){
276 return &cell == this;
277 }
278
279 virtual uint rtti() const { return MESH_CELL_RTTI; }
280 virtual uint parentType() const { return MESH_CELL_RTTI; }
281 virtual uint neighborCellCount() const { return 0; }
282 inline uint boundaryCount() const { return neighborCellCount(); }
283
284 void cleanNeighborInfos();
285
286 Cell * neighborCell(const RVector & sf);
287
294 inline Cell * neighborCell(uint i){ return neighborCells_[i]; }
295
298 virtual void findNeighborCell(uint i);
299
300 inline double attribute() const { return attribute_; }
301
302 inline void setAttribute(double attr) { attribute_ = attr; }
303
306 Node * oppositeTo(const Boundary & bound);
307
310 Boundary * boundaryTo(const RVector & sf);
311
313 Boundary * boundary(Index i);
314
316 virtual std::vector < Node * > boundaryNodes(Index i) const{
317 CERR_TO_IMPL
318 std::cout << rtti() << std::endl;
319 std::vector < Node * > n;
320 return n;
321 }
322
323protected:
324 virtual void registerNodes_();
325 virtual void deRegisterNodes_();
326 virtual void registerSecNode_(Node *n);
327 virtual void deRegisterSecNode_(Node *n);
328
329 std::vector < Cell * > neighborCells_;
330 double attribute_;
331
332protected:
334 Cell(const Cell & cell){
335 std::cerr << "cell(const cell & cell)" << std::endl;
336 THROW_TO_IMPL
337 }
338
340 Cell & operator = (const Cell & cell){
341 if (this != &cell) {
342 THROW_TO_IMPL
343 std::cerr << "cell=cell" << std::endl;
344 }
345 return *this;
346 }
347
348};
349
350class DLLEXPORT Boundary : public MeshEntity{
351public:
352 Boundary();
353 Boundary(const std::vector < Node * > & nodes);
354 virtual ~Boundary();
355
356 virtual uint rtti() const { return MESH_BOUNDARY_RTTI; }
357 virtual uint parentType() const { return MESH_BOUNDARY_RTTI; }
358
360 virtual RVector3 rst(uint i) const;
361
364 inline const Cell & leftCell() const { return *leftCell_; }
365 inline Cell * leftCell() { return leftCell_; }
366
367 inline const Cell & rightCell() const { return *rightCell_; }
368 inline Cell * rightCell() { return rightCell_; }
369
370 inline void setLeftCell(Cell * cell) { leftCell_ = cell; }
371 inline void setRightCell(Cell * cell) { rightCell_ = cell; }
372
373 friend std::ostream & operator << (std::ostream & str, const Boundary & e);
374
376 virtual RVector3 norm() const;
377
380 virtual RVector3 norm(const Cell & cell) const;
381
383 bool normShowsOutside(const Cell & cell) const;
384
386 void swapNorm(bool withNeighbours=true);
387
389 bool outside() const { return (leftCell_ != 0) && (rightCell_ == 0); }
390
391
392protected:
393 virtual void registerNodes_();
394 virtual void deRegisterNodes_();
395 virtual void registerSecNode_(Node *n);
396 virtual void deRegisterSecNode_(Node *n);
397
398
399 Cell *leftCell_;
400 Cell *rightCell_;
401
402protected:
404 Boundary(const Boundary & bound){
405 std::cerr << "Boundary(const Boundary & bound)" << std::endl;
406 THROW_TO_IMPL
407 }
408
410 Boundary & operator = (const Boundary & boundary){
411 if (this != &boundary) {
412 std::cerr << "Assignment for boundaries not yet supported." << std::endl;
413 THROW_TO_IMPL
414 }
415 return *this;
416 }
417
418};
419
420class DLLEXPORT NodeBoundary : public Boundary{
421public:
422 NodeBoundary(Node & n1);
423
424 NodeBoundary(const std::vector < Node * > & nodes);
425
426 virtual ~NodeBoundary();
427
428 virtual uint dim() const { return 1; }
429
430 virtual uint rtti() const { return MESH_BOUNDARY_NODE_RTTI; }
431
432 void setNodes(Node & n1);
433
434 virtual double size() const { return 1.0; }
435
436 friend std::ostream & operator << (std::ostream & str, const NodeBoundary & e);
437
440 virtual RVector3 norm() const;
441
442protected:
443};
444
445class DLLEXPORT Edge : public Boundary{
446public:
447 Edge(Node & n1, Node & n2);
448
449 Edge(const std::vector < Node * > & nodes);
450
451 virtual ~Edge();
452
453 virtual uint dim() const { return 1; }
454
455 virtual uint rtti() const { return MESH_EDGE_RTTI; }
456
457 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
458
459 void setNodes(Node & n1, Node & n2);
460
462 int swap();
463
464// /*! See ref MeshEntity::N() */
465// virtual RVector N(const RVector3 & L) const;
466
467// void shapeFunctionsL(const RVector3 & L, RVector & funct) const;
468
469 friend std::ostream & operator << (std::ostream & str, const Edge & e);
470
471protected:
472};
473
474class DLLEXPORT Edge3 : public Edge{
475public:
476
477 Edge3(const std::vector < Node * > & nodes);
478
479 virtual ~Edge3();
480
481 virtual uint rtti() const { return MESH_EDGE3_RTTI; }
482
484 virtual RVector3 rst(uint i) const;
485
486 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
487
488// /*! See MeshEntity::N() */
489// virtual RVector N(const RVector3 & L) const;
490 /*
491 void shapeFunctionsL(const RVector3 & L, RVector & funct) const;*/
492
493// friend std::ostream & operator << (std::ostream & str, const Edge & e);
494
495protected:
496};
497
498
499class DLLEXPORT TriangleFace : public Boundary{
500public:
501 TriangleFace(Node & n1, Node & n2, Node & n3);
502
503 TriangleFace(const std::vector < Node * > & nodes);
504
505 virtual ~TriangleFace();
506
507 virtual uint dim() const { return 2; }
508
509 virtual uint rtti() const { return MESH_TRIANGLEFACE_RTTI; }
510
511 void setNodes(Node & n1, Node & n2, Node & n3);
512
513 friend std::ostream & operator << (std::ostream & str, const TriangleFace & e);
514
516 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
517
518protected:
519
520 // /*! Don't call this class directly */
521 // TriangleFace(const TriangleFace & bound){
522 // std::cerr << "TriangleFace(const Boundary & bound)" << std::endl;
523 // }
524
525 // /*! Don't call this class directly */
526 // TriangleFace & operator = (const TriangleFace & boundary){
527 // if (this != &boundary) {
528 // std::cerr << "TriangleFace boundary=boundary" << std::endl;
529 // }
530 // return *this;
531 // }
532};
533
534class DLLEXPORT Triangle6Face : public TriangleFace{
535public:
536 Triangle6Face(const std::vector < Node * > & nodes);
537
538 ~Triangle6Face();
539
540 virtual uint rtti() const { return MESH_TRIANGLEFACE6_RTTI; }
541
543 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
544
546 virtual RVector3 rst(uint i) const;
547
548protected:
549};
550
551class DLLEXPORT QuadrangleFace : public Boundary{
552public:
553 QuadrangleFace(Node & n1, Node & n2, Node & n3, Node & n4);
554
555 QuadrangleFace(const std::vector < Node * > & nodes);
556
557 virtual ~QuadrangleFace();
558
559 virtual uint dim() const { return 2; }
560
561 virtual uint rtti() const { return MESH_QUADRANGLEFACE_RTTI; }
562
564 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
565
566 void setNodes(Node & n1, Node & n2, Node & n3, Node & n4);
567
568 friend std::ostream & operator << (std::ostream & str, const TriangleFace & e);
569
570protected:
571
572 QuadrangleFace(const QuadrangleFace & quad){
573 std::cerr << "QuadrangleFace(const QuadrangleFace & quad)" << std::endl;
574 }
575};
576
577class DLLEXPORT Quadrangle8Face : public QuadrangleFace{
578public:
579
580 Quadrangle8Face(const std::vector < Node * > & nodes);
581
582 virtual ~Quadrangle8Face();
583
584 virtual uint rtti() const { return MESH_QUADRANGLEFACE8_RTTI; }
585
587 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
588
590 virtual RVector3 rst(uint i) const;
591
592protected:
593
594private:
595
596};
597
598class DLLEXPORT PolygonFace : public Boundary {
600public:
601 typedef Pos HoleMarker;
602 typedef std::vector < Pos > HoleMarkerList;
603
604 PolygonFace(const std::vector < Node * > & nodes);
605
606 ~PolygonFace();
607
608 virtual uint dim() const { return 3; }
609
610 virtual uint rtti() const { return MESH_POLYGON_FACE_RTTI; }
611
615 void insertNode(Node * node, double tol=TOLERANCE);
616
620 void addSubface(const std::vector < Node * > & nodes, bool isHole=false);
621
622 Index subfaceCount() const {return this->subfaces_.size();}
623
624 const std::vector < Node * > & subface(Index i) const;
625
628 void addHoleMarker(const RVector3 & pos);
629
630 void delHoleMarker(const RVector3 & pos);
631
633 const HoleMarkerList & holeMarkers() const;
634
636 HoleMarkerList & holeMarkers(){ return holeMarker_;}
637
638protected:
639 std::vector < std::vector < Node * > > subfaces_;
640 HoleMarkerList holeMarker_;
641private:
642
643};
644
645class DLLEXPORT EdgeCell : public Cell {
646public:
647 EdgeCell(Node & n1, Node & n2);
648
649 EdgeCell(const std::vector < Node * > & nodes);
650
651 virtual ~EdgeCell();
652
653 virtual uint dim() const { return 1; }
654
655 virtual uint rtti() const { return MESH_EDGE_CELL_RTTI; }
656
657 virtual uint neighborCellCount() const { return 2; }
658
659// virtual void findNeighborCell(uint id);
660
661 void setNodes(Node & n1, Node & n2);
662
663 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
664
669 virtual std::vector < Node * > boundaryNodes(Index i) const;
670
671 friend std::ostream & operator << (std::ostream & str, const EdgeCell & t);
672
673protected:
674};
675
677class DLLEXPORT Edge3Cell : public EdgeCell {
678public:
679 Edge3Cell(const std::vector < Node * > & nodes);
680
681 virtual ~Edge3Cell();
682
683 virtual uint rtti() const { return MESH_EDGE3_CELL_RTTI; }
684
685 virtual RVector3 rst(uint i) const;
686
687 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
688
689protected:
690};
691
693
702class DLLEXPORT Triangle : public Cell {
703public:
704 Triangle(Node & n1, Node & n2, Node & n3);
705
706 Triangle(const std::vector < Node * > & nodes);
707
708 virtual ~Triangle();
709
710 virtual uint dim() const { return 2; }
711
712 virtual uint rtti() const { return MESH_TRIANGLE_RTTI; }
713
714 virtual uint neighborCellCount() const { return 3; }
715
716// virtual void findNeighborCell(uint i);
717
718 void setNodes(Node & n1, Node & n2, Node & n3);
719
720 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
721
722 friend std::ostream & operator << (std::ostream & str, const Triangle & t);
723
729 virtual std::vector < Node * > boundaryNodes(Index i) const;
730
731protected:
732};
733
735
744class DLLEXPORT Triangle6 : public Triangle {
745public:
746 Triangle6(const std::vector < Node * > & nodes);
747
748 virtual ~Triangle6();
749
750 virtual uint rtti() const { return MESH_TRIANGLE6_RTTI; }
751
752 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
753
754protected:
755};
756
758
774class DLLEXPORT Quadrangle : public Cell {
775public:
776 Quadrangle(Node & n1, Node & n2, Node & n3, Node & n4);
777
778 Quadrangle(const std::vector < Node * > & nodes);
779
780 virtual ~Quadrangle();
781
782 virtual uint dim() const { return 2; }
783
784 virtual uint rtti() const { return MESH_QUADRANGLE_RTTI; }
785
786 void setNodes(Node & n1, Node & n2, Node & n3, Node & n4);
787
788 virtual uint neighborCellCount() const { return 4; }
789
790// virtual void findNeighborCell(uint i);
791
792 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
793
794 friend std::ostream & operator << (std::ostream & str, const Quadrangle & t);
795
796 virtual std::vector < Node * > boundaryNodes(Index i) const;
797
798protected:
799};
800
802
813class DLLEXPORT Quadrangle8 : public Quadrangle {
814public:
815 Quadrangle8(const std::vector < Node * > & nodes);
816
817 virtual ~Quadrangle8();
818
819 virtual uint rtti() const { return MESH_QUADRANGLE8_RTTI; }
820
821 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
822
823protected:
824};
825
827
845static const uint8 TetrahedronFacesID[4][3] = {
846 {1, 2, 3},
847 {2, 0, 3},
848 {0, 1, 3},
849 {0, 2, 1}
850};
851
853
856class DLLEXPORT Tetrahedron : public Cell {
857public:
858 Tetrahedron(Node & n1, Node & n2, Node & n3, Node & n4);
859
860 Tetrahedron(const std::vector < Node * > & nodes);
861
862 virtual ~Tetrahedron();
863
864 virtual uint dim() const { return 3; }
865
866 virtual uint rtti() const { return MESH_TETRAHEDRON_RTTI; }
867
868 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
869
870 void setNodes(Node & n1, Node & n2, Node & n3, Node & n4);
871
872 virtual uint neighborCellCount() const { return 4; }
873
874// virtual void findNeighborCell(uint i);
875
876 friend std::ostream & operator << (std::ostream & str, const Tetrahedron & t);
877
883 virtual std::vector < Node * > boundaryNodes(Index i) const;
884
885protected:
886
888 Tetrahedron(const Tetrahedron& cell){ std::cerr << "Tetrahedron cell(const cell & cell)" << std::endl; }
889
891 Tetrahedron & operator = (const Tetrahedron & cell){
892 if (this != &cell) {
893 std::cerr << "Tetrahedron cell=cell" << std::endl;
894 }
895 return *this;
896 }
897
898};
899
900//*! VTK,Flaherty,Gimli count: 1-2-3-4, 5(1-2), 6(2-3), 7(3-1), 8(1-4), 9(2-4), 10(3-4)* //
901static const uint8 Tet10NodeSplit[10][2] = {
902 {0,0},{1,1},{2,2},{3,3},
903 {0,1},{1,2},{2,0},
904 {0,3},{1,3},{2,3}
905};
906
907//*! Zienkiewicz count: 1-2-3-4, 5(1-2), 6(1-3), 7(1-4), 8(2-3), 9(3-4), 10(4-2)* //
908static const uint8 Tet10NodeSplitZienk[10][2] = {
909 {0,0},{1,1},{2,2},{3,3},
910 {0,1},{0,2},{0,3},
911 {1,2},{2,3},{3,1}
912};
913
914class DLLEXPORT Tetrahedron10 : public Tetrahedron {
915public:
916 Tetrahedron10(const std::vector < Node * > & nodes);
917
918 virtual ~Tetrahedron10();
919
920 virtual uint rtti() const { return MESH_TETRAHEDRON10_RTTI; }
921
922 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
923
924protected:
925};
926
928
956
957static const uint8 HexahedronFacesID[6][4] = {
958 {1, 2, 6, 5},
959 {2, 3, 7, 6},
960 {3, 0, 4, 7},
961 {0, 1, 5, 4},
962 {4, 5, 6, 7},
963 {0, 3, 2, 1}
964};
965
966class DLLEXPORT Hexahedron: public Cell {
967public:
968 Hexahedron(const std::vector < Node * > & nodes);
969
970 virtual ~Hexahedron();
971
972 virtual uint dim() const { return 3; }
973
974 virtual uint rtti() const { return MESH_HEXAHEDRON_RTTI; }
975
976 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
977
978 virtual uint neighborCellCount() const { return 6; }
979
980 friend std::ostream & operator << (std::ostream & str, const Hexahedron & t);
981
983 virtual std::vector < Node * > boundaryNodes(Index i) const;
984
985protected:
986};
987
988static const uint8 Hexahedron20FacesID[6][8] = {
989 {0,1,5,4,8,17,12,16},
990 {1,2,6,5,9,18,13,17},
991 {2,3,7,6,10,19,14,18},
992 {3,0,4,7,11,16,15,19},
993 {0,3,2,1,11,10,9,8},
994 {4,5,6,7,12,13,14,15},
995};
996
997static const uint8 Hex20NodeSplit[20][2] = {
998 {0,0},{1,1},{2,2},{3,3},{4,4},{5,5},{6,6},{7,7},
999 {0,1},{1,2},{2,3},{3,0},
1000 {4,5},{5,6},{6,7},{7,4},
1001 {0,4},{1,5},{2,6},{3,7}
1002};
1003
1005
1025class DLLEXPORT Hexahedron20: public Hexahedron {
1026public:
1027 Hexahedron20(const std::vector < Node * > & nodes);
1028
1029 virtual ~Hexahedron20();
1030
1031 virtual uint rtti() const { return MESH_HEXAHEDRON20_RTTI; }
1032
1033 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
1034
1036 virtual std::vector < Node * > boundaryNodes(Index i) const;
1037
1038protected:
1039};
1040
1042
1054
1055static const uint8 TriPrismFacesID[5][4] = {
1056 {1, 2, 5, 4}, // r
1057 {2, 0, 3, 5}, // r
1058 {0, 1, 4, 3}, // l
1059 {3, 4, 5, 255}, // l
1060 {0, 2, 1, 255}, // r
1061};
1062
1063
1064class DLLEXPORT TriPrism : public Cell {
1065public:
1066 TriPrism(const std::vector < Node * > & nodes);
1067
1068 virtual ~TriPrism();
1069
1070 virtual uint dim() const { return 3; }
1071
1072 virtual uint rtti() const { return MESH_TRIPRISM_RTTI; }
1073
1074 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
1075
1076 virtual uint neighborCellCount() const { return 5; }
1077
1078 friend std::ostream & operator << (std::ostream & str, const Hexahedron & t);
1079
1081 virtual std::vector < Node * > boundaryNodes(Index i) const;
1082
1083protected:
1084};
1085
1086static const uint8 Prism15NodeSplit[15][2] = {
1087 {0,0},{1,1},{2,2},{3,3},{4,4},{5,5},
1088 {0,1},{1,2},{2,0},
1089 {3,4},{4,5},{5,3},
1090 {0,3},{1,4},{2,5}
1091};
1092
1094
1109
1110class DLLEXPORT TriPrism15 : public TriPrism {
1111public:
1112 TriPrism15(const std::vector < Node * > & nodes);
1113
1114 virtual ~TriPrism15();
1115
1116 virtual uint rtti() const { return MESH_TRIPRISM15_RTTI; }
1117
1118 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
1119
1120protected:
1121};
1122
1124
1139
1140static const uint8 PyramidFacesID[5][4] = {
1141 {1, 2, 5, 255}, // l
1142 {2, 3, 5, 255}, // l
1143 {0, 5, 3, 255}, // l
1144 {0, 1, 5, 255}, // l
1145 {0, 3, 2, 1}, // r
1146};
1147
1148class DLLEXPORT Pyramid : public Cell {
1149public:
1150 Pyramid(const std::vector < Node * > & nodes);
1151
1152 virtual ~Pyramid();
1153
1154 virtual uint dim() const { return 3; }
1155
1156 virtual uint rtti() const { return MESH_PYRAMID_RTTI; }
1157
1158 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
1159
1160 virtual uint neighborCellCount() const { return 5; }
1161
1163 virtual std::vector < Node * > boundaryNodes(Index i) const;
1164
1165protected:
1166};
1167
1168//*! VTK, Flaherty, Gimli count: 1-2-3-4, 5(1-2), 6(2-3), 7(3-1), 8(1-4), 9(2-4), 10(3-4)* //
1169static const uint8 Pyramid13NodeSplit[13][2] = {
1170 {0,0},{1,1},{2,2},{3,3},{4,4},
1171 {0,1},{1,2},{2,3},{3,0},
1172 {0,4},{1,4},{2,4},{3,4}
1173};
1174
1176
1192
1193class DLLEXPORT Pyramid13 : public Pyramid {
1194public:
1195 Pyramid13(const std::vector < Node * > & nodes);
1196
1197 virtual ~Pyramid13();
1198
1199 virtual uint rtti() const { return MESH_PYRAMID13_RTTI; }
1200
1201 virtual std::vector < PolynomialFunction < double > > createShapeFunctions() const;
1202
1203protected:
1204};
1205
1206DLLEXPORT std::ostream & operator << (std::ostream & str, const std::set < GIMLI::MeshEntity * > & ents);
1207
1208DLLEXPORT std::ostream & operator << (std::ostream & str, const std::set < GIMLI::Boundary * > & bounds);
1209
1210} // namespace GIMLI
1211
1212#endif // MESHENTITIES__H
Definition meshentities.h:350
virtual uint parentType() const
Definition meshentities.h:357
bool outside() const
Definition meshentities.h:389
Boundary(const Boundary &bound)
Definition meshentities.h:404
const Cell & leftCell() const
Definition meshentities.h:364
virtual uint rtti() const
Definition meshentities.h:356
A abstract cell.
Definition meshentities.h:261
Cell()
Definition meshentities.cpp:394
virtual uint parentType() const
Definition meshentities.h:280
Cell(const Cell &cell)
Definition meshentities.h:334
virtual uint rtti() const
Definition meshentities.h:279
virtual std::vector< Node * > boundaryNodes(Index i) const
Definition meshentities.h:316
Cell * neighborCell(uint i)
Definition meshentities.h:294
bool operator==(const Cell &cell)
Definition meshentities.h:275
Definition meshentities.h:56
virtual uint rtti() const
Definition meshentities.h:683
virtual uint rtti() const
Definition meshentities.h:481
virtual uint rtti() const
Definition meshentities.h:655
virtual uint dim() const
Definition meshentities.h:653
Definition meshentities.h:445
virtual uint rtti() const
Definition meshentities.h:455
virtual uint dim() const
Definition meshentities.h:453
virtual uint rtti() const
Definition meshentities.h:1031
virtual uint rtti() const
Definition meshentities.h:974
virtual uint dim() const
Definition meshentities.h:972
ElementMatrix< double > uCache_
Definition meshentities.h:240
MeshEntity(const MeshEntity &ent)
Definition meshentities.h:247
virtual uint parentType() const
Definition meshentities.h:119
virtual uint rtti() const
Definition meshentities.h:116
virtual uint dim() const
Definition meshentities.h:113
MeshEntity()
Definition meshentities.cpp:203
virtual uint dim() const
Definition meshentities.h:428
virtual uint rtti() const
Definition meshentities.h:430
3D Node
Definition node.h:39
virtual uint dim() const
Definition meshentities.h:608
virtual uint rtti() const
Definition meshentities.h:610
HoleMarkerList & holeMarkers()
Definition meshentities.h:636
3 dimensional vector
Definition pos.h:73
Pos()
Definition pos.h:86
virtual uint rtti() const
Definition meshentities.h:1199
virtual uint dim() const
Definition meshentities.h:1154
virtual uint rtti() const
Definition meshentities.h:1156
virtual uint rtti() const
Definition meshentities.h:584
virtual uint rtti() const
Definition meshentities.h:819
Definition meshentities.h:551
virtual uint dim() const
Definition meshentities.h:559
virtual uint rtti() const
Definition meshentities.h:561
virtual uint dim() const
Definition meshentities.h:782
virtual uint rtti() const
Definition meshentities.h:784
virtual uint rtti() const
Definition meshentities.h:920
virtual uint rtti() const
Definition meshentities.h:866
virtual uint dim() const
Definition meshentities.h:864
Tetrahedron(const Tetrahedron &cell)
Definition meshentities.h:888
virtual uint rtti() const
Definition meshentities.h:1116
virtual uint dim() const
Definition meshentities.h:1070
virtual uint rtti() const
Definition meshentities.h:1072
virtual uint rtti() const
Definition meshentities.h:540
virtual uint rtti() const
Definition meshentities.h:750
Definition meshentities.h:499
virtual uint dim() const
Definition meshentities.h:507
virtual uint rtti() const
Definition meshentities.h:509
virtual uint dim() const
Definition meshentities.h:710
virtual uint rtti() const
Definition meshentities.h:712
GIMLi main namespace for the Geophyiscal Inversion and Modelling Library.
Definition baseentity.h:24
static const uint8 TriPrismFacesID[5][4]
Triangular prism.
Definition meshentities.h:1055
std::set< Node * > commonNodes(const ContainerOfMeshEntities &c)
Definition meshentities.h:70
static const uint8 HexahedronFacesID[6][4]
A Hexahedron.
Definition meshentities.h:957
static const uint8 PyramidFacesID[5][4]
A Pyramid.
Definition meshentities.h:1140
std::set< Boundary * > findBoundaries(const std::vector< Node * > &n)
Definition meshentities.cpp:79
static const uint8 TetrahedronFacesID[4][3]
A Tetrahedron.
Definition meshentities.h:845