MFEM v2.0
|
00001 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at 00002 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights 00003 // reserved. See file COPYRIGHT for details. 00004 // 00005 // This file is part of the MFEM library. For more information and source code 00006 // availability see http://mfem.googlecode.com. 00007 // 00008 // MFEM is free software; you can redistribute it and/or modify it under the 00009 // terms of the GNU Lesser General Public License (as published by the Free 00010 // Software Foundation) version 2.1 dated February 1999. 00011 00012 #ifndef MFEM_FE_COLLECTION 00013 #define MFEM_FE_COLLECTION 00014 00019 class FiniteElementCollection 00020 { 00021 public: 00022 virtual const FiniteElement * 00023 FiniteElementForGeometry(int GeomType) const = 0; 00024 00025 virtual int DofForGeometry(int GeomType) const = 0; 00026 00027 virtual int * DofOrderForOrientation(int GeomType, int Or) const = 0; 00028 00029 virtual const char * Name() const { return "Undefined"; }; 00030 00031 int HasFaceDofs(int GeomType) const; 00032 00033 virtual ~FiniteElementCollection() { }; 00034 00035 static FiniteElementCollection *New(const char *name); 00036 }; 00037 00039 class H1_FECollection : public FiniteElementCollection 00040 { 00041 private: 00042 char h1_name[32]; 00043 FiniteElement *H1_Elements[Geometry::NumGeom]; 00044 int H1_dof[Geometry::NumGeom]; 00045 int *SegDofOrd[2], *TriDofOrd[6], *QuadDofOrd[8]; 00046 00047 public: 00048 explicit H1_FECollection(const int p, const int dim = 3); 00049 00050 virtual const FiniteElement *FiniteElementForGeometry(int GeomType) const 00051 { return H1_Elements[GeomType]; } 00052 virtual int DofForGeometry(int GeomType) const 00053 { return H1_dof[GeomType]; } 00054 virtual int *DofOrderForOrientation(int GeomType, int Or) const; 00055 virtual const char *Name() const { return h1_name; } 00056 00057 virtual ~H1_FECollection(); 00058 }; 00059 00061 class L2_FECollection : public FiniteElementCollection 00062 { 00063 private: 00064 char d_name[32]; 00065 FiniteElement *L2_Elements[Geometry::NumGeom]; 00066 00067 public: 00068 L2_FECollection(const int p, const int dim); 00069 00070 virtual const FiniteElement *FiniteElementForGeometry(int GeomType) const 00071 { return L2_Elements[GeomType]; } 00072 virtual int DofForGeometry(int GeomType) const 00073 { 00074 if (L2_Elements[GeomType]) 00075 return L2_Elements[GeomType]->GetDof(); 00076 return 0; 00077 } 00078 virtual int *DofOrderForOrientation(int GeomType, int Or) const 00079 { return NULL; } 00080 virtual const char *Name() const { return d_name; } 00081 00082 virtual ~L2_FECollection(); 00083 }; 00084 00086 class RT_FECollection : public FiniteElementCollection 00087 { 00088 private: 00089 char rt_name[32]; 00090 FiniteElement *RT_Elements[Geometry::NumGeom]; 00091 int RT_dof[Geometry::NumGeom]; 00092 int *SegDofOrd[2], *TriDofOrd[6], *QuadDofOrd[8]; 00093 00094 public: 00095 RT_FECollection(const int p, const int dim); 00096 00097 virtual const FiniteElement *FiniteElementForGeometry(int GeomType) const 00098 { return RT_Elements[GeomType]; } 00099 virtual int DofForGeometry(int GeomType) const 00100 { return RT_dof[GeomType]; } 00101 virtual int *DofOrderForOrientation(int GeomType, int Or) const; 00102 virtual const char *Name() const { return rt_name; } 00103 00104 virtual ~RT_FECollection(); 00105 }; 00106 00108 class ND_FECollection : public FiniteElementCollection 00109 { 00110 private: 00111 char nd_name[32]; 00112 FiniteElement *ND_Elements[Geometry::NumGeom]; 00113 int ND_dof[Geometry::NumGeom]; 00114 int *SegDofOrd[2], *TriDofOrd[6], *QuadDofOrd[8]; 00115 00116 public: 00117 ND_FECollection(const int p, const int dim); 00118 00119 virtual const FiniteElement *FiniteElementForGeometry(int GeomType) const 00120 { return ND_Elements[GeomType]; } 00121 virtual int DofForGeometry(int GeomType) const 00122 { return ND_dof[GeomType]; } 00123 virtual int *DofOrderForOrientation(int GeomType, int Or) const; 00124 virtual const char *Name() const { return nd_name; } 00125 00126 virtual ~ND_FECollection(); 00127 }; 00128 00130 class NURBSFECollection : public FiniteElementCollection 00131 { 00132 private: 00133 NURBS1DFiniteElement *SegmentFE; 00134 NURBS2DFiniteElement *QuadrilateralFE; 00135 NURBS3DFiniteElement *ParallelepipedFE; 00136 00137 char name[16]; 00138 00139 void Allocate(int Order); 00140 void Deallocate(); 00141 00142 public: 00143 explicit NURBSFECollection(int Order) { Allocate(Order); } 00144 00145 int GetOrder() const { return SegmentFE->GetOrder(); } 00146 00148 void UpdateOrder(int Order) { Deallocate(); Allocate(Order); } 00149 00150 void Reset() const 00151 { 00152 SegmentFE->Reset(); 00153 QuadrilateralFE->Reset(); 00154 ParallelepipedFE->Reset(); 00155 } 00156 00157 virtual const FiniteElement * 00158 FiniteElementForGeometry(int GeomType) const; 00159 00160 virtual int DofForGeometry(int GeomType) const; 00161 00162 virtual int *DofOrderForOrientation(int GeomType, int Or) const; 00163 00164 virtual const char *Name() const { return name; } 00165 00166 virtual ~NURBSFECollection() { Deallocate(); } 00167 }; 00168 00169 00171 class LinearFECollection : public FiniteElementCollection 00172 { 00173 private: 00174 const PointFiniteElement PointFE; 00175 const Linear1DFiniteElement SegmentFE; 00176 const Linear2DFiniteElement TriangleFE; 00177 const BiLinear2DFiniteElement QuadrilateralFE; 00178 const Linear3DFiniteElement TetrahedronFE; 00179 const TriLinear3DFiniteElement ParallelepipedFE; 00180 public: 00181 LinearFECollection() { }; 00182 00183 virtual const FiniteElement * 00184 FiniteElementForGeometry(int GeomType) const; 00185 00186 virtual int DofForGeometry(int GeomType) const; 00187 00188 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00189 00190 virtual const char * Name() const { return "Linear"; }; 00191 }; 00192 00194 class QuadraticFECollection : public FiniteElementCollection 00195 { 00196 private: 00197 const PointFiniteElement PointFE; 00198 const Quad1DFiniteElement SegmentFE; 00199 const Quad2DFiniteElement TriangleFE; 00200 const BiQuad2DFiniteElement QuadrilateralFE; 00201 const Quadratic3DFiniteElement TetrahedronFE; 00202 const LagrangeHexFiniteElement ParallelepipedFE; 00203 00204 public: 00205 QuadraticFECollection() : ParallelepipedFE(2) { }; 00206 00207 virtual const FiniteElement * 00208 FiniteElementForGeometry(int GeomType) const; 00209 00210 virtual int DofForGeometry(int GeomType) const; 00211 00212 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00213 00214 virtual const char * Name() const { return "Quadratic"; }; 00215 }; 00216 00218 class QuadraticPosFECollection : public FiniteElementCollection 00219 { 00220 private: 00221 const QuadPos1DFiniteElement SegmentFE; 00222 const BiQuadPos2DFiniteElement QuadrilateralFE; 00223 00224 public: 00225 QuadraticPosFECollection() { }; 00226 00227 virtual const FiniteElement * 00228 FiniteElementForGeometry(int GeomType) const; 00229 00230 virtual int DofForGeometry(int GeomType) const; 00231 00232 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00233 00234 virtual const char * Name() const { return "QuadraticPos"; }; 00235 }; 00236 00238 class CubicFECollection : public FiniteElementCollection 00239 { 00240 private: 00241 const PointFiniteElement PointFE; 00242 const Cubic1DFiniteElement SegmentFE; 00243 const Cubic2DFiniteElement TriangleFE; 00244 const BiCubic2DFiniteElement QuadrilateralFE; 00245 const Cubic3DFiniteElement TetrahedronFE; 00246 const LagrangeHexFiniteElement ParallelepipedFE; 00247 00248 public: 00249 CubicFECollection() : ParallelepipedFE(3) { }; 00250 00251 virtual const FiniteElement * 00252 FiniteElementForGeometry(int GeomType) const; 00253 00254 virtual int DofForGeometry(int GeomType) const; 00255 00256 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00257 00258 virtual const char * Name() const { return "Cubic"; }; 00259 }; 00260 00262 class CrouzeixRaviartFECollection : public FiniteElementCollection 00263 { 00264 private: 00265 const P0SegmentFiniteElement SegmentFE; 00266 const CrouzeixRaviartFiniteElement TriangleFE; 00267 const CrouzeixRaviartQuadFiniteElement QuadrilateralFE; 00268 public: 00269 CrouzeixRaviartFECollection() : SegmentFE(1) { }; 00270 00271 virtual const FiniteElement * 00272 FiniteElementForGeometry(int GeomType) const; 00273 00274 virtual int DofForGeometry(int GeomType) const; 00275 00276 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00277 00278 virtual const char * Name() const { return "CrouzeixRaviart"; }; 00279 }; 00280 00282 class LinearNonConf3DFECollection : public FiniteElementCollection 00283 { 00284 private: 00285 const P0TriangleFiniteElement TriangleFE; 00286 const P1TetNonConfFiniteElement TetrahedronFE; 00287 const P0QuadFiniteElement QuadrilateralFE; 00288 const RotTriLinearHexFiniteElement ParallelepipedFE; 00289 00290 public: 00291 LinearNonConf3DFECollection () { }; 00292 00293 virtual const FiniteElement * 00294 FiniteElementForGeometry(int GeomType) const; 00295 00296 virtual int DofForGeometry(int GeomType) const; 00297 00298 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00299 00300 virtual const char * Name() const { return "LinearNonConf3D"; }; 00301 }; 00302 00303 00306 class RT0_2DFECollection : public FiniteElementCollection 00307 { 00308 private: 00309 const P0SegmentFiniteElement SegmentFE; // normal component on edge 00310 const RT0TriangleFiniteElement TriangleFE; 00311 const RT0QuadFiniteElement QuadrilateralFE; 00312 public: 00313 RT0_2DFECollection() : SegmentFE(0) { }; 00314 00315 virtual const FiniteElement * 00316 FiniteElementForGeometry(int GeomType) const; 00317 00318 virtual int DofForGeometry(int GeomType) const; 00319 00320 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00321 00322 virtual const char * Name() const { return "RT0_2D"; }; 00323 }; 00324 00327 class RT1_2DFECollection : public FiniteElementCollection 00328 { 00329 private: 00330 const P1SegmentFiniteElement SegmentFE; // normal component on edge 00331 const RT1TriangleFiniteElement TriangleFE; 00332 const RT1QuadFiniteElement QuadrilateralFE; 00333 public: 00334 RT1_2DFECollection() { }; 00335 00336 virtual const FiniteElement * 00337 FiniteElementForGeometry(int GeomType) const; 00338 00339 virtual int DofForGeometry(int GeomType) const; 00340 00341 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00342 00343 virtual const char * Name() const { return "RT1_2D"; }; 00344 }; 00345 00348 class RT2_2DFECollection : public FiniteElementCollection 00349 { 00350 private: 00351 const P2SegmentFiniteElement SegmentFE; // normal component on edge 00352 const RT2TriangleFiniteElement TriangleFE; 00353 const RT2QuadFiniteElement QuadrilateralFE; 00354 public: 00355 RT2_2DFECollection() { }; 00356 00357 virtual const FiniteElement * 00358 FiniteElementForGeometry(int GeomType) const; 00359 00360 virtual int DofForGeometry(int GeomType) const; 00361 00362 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00363 00364 virtual const char * Name() const { return "RT2_2D"; }; 00365 }; 00366 00369 class Const2DFECollection : public FiniteElementCollection 00370 { 00371 private: 00372 const P0TriangleFiniteElement TriangleFE; 00373 const P0QuadFiniteElement QuadrilateralFE; 00374 public: 00375 Const2DFECollection() { }; 00376 00377 virtual const FiniteElement * 00378 FiniteElementForGeometry(int GeomType) const; 00379 00380 virtual int DofForGeometry(int GeomType) const; 00381 00382 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00383 00384 virtual const char * Name() const { return "Const2D"; }; 00385 }; 00386 00389 class LinearDiscont2DFECollection : public FiniteElementCollection 00390 { 00391 private: 00392 const Linear2DFiniteElement TriangleFE; 00393 const BiLinear2DFiniteElement QuadrilateralFE; 00394 00395 public: 00396 LinearDiscont2DFECollection() { }; 00397 00398 virtual const FiniteElement * 00399 FiniteElementForGeometry(int GeomType) const; 00400 00401 virtual int DofForGeometry(int GeomType) const; 00402 00403 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00404 00405 virtual const char * Name() const { return "LinearDiscont2D"; }; 00406 }; 00407 00409 class GaussLinearDiscont2DFECollection : public FiniteElementCollection 00410 { 00411 private: 00412 // const CrouzeixRaviartFiniteElement TriangleFE; 00413 const GaussLinear2DFiniteElement TriangleFE; 00414 const GaussBiLinear2DFiniteElement QuadrilateralFE; 00415 00416 public: 00417 GaussLinearDiscont2DFECollection() { }; 00418 00419 virtual const FiniteElement * 00420 FiniteElementForGeometry(int GeomType) const; 00421 00422 virtual int DofForGeometry(int GeomType) const; 00423 00424 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00425 00426 virtual const char * Name() const { return "GaussLinearDiscont2D"; }; 00427 }; 00428 00430 class P1OnQuadFECollection : public FiniteElementCollection 00431 { 00432 private: 00433 const P1OnQuadFiniteElement QuadrilateralFE; 00434 public: 00435 P1OnQuadFECollection() { }; 00436 virtual const FiniteElement * 00437 FiniteElementForGeometry(int GeomType) const; 00438 virtual int DofForGeometry(int GeomType) const; 00439 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00440 virtual const char * Name() const { return "P1OnQuad"; }; 00441 }; 00442 00445 class QuadraticDiscont2DFECollection : public FiniteElementCollection 00446 { 00447 private: 00448 const Quad2DFiniteElement TriangleFE; 00449 const BiQuad2DFiniteElement QuadrilateralFE; 00450 00451 public: 00452 QuadraticDiscont2DFECollection() { }; 00453 00454 virtual const FiniteElement * 00455 FiniteElementForGeometry(int GeomType) const; 00456 00457 virtual int DofForGeometry(int GeomType) const; 00458 00459 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00460 00461 virtual const char * Name() const { return "QuadraticDiscont2D"; }; 00462 }; 00463 00465 class QuadraticPosDiscont2DFECollection : public FiniteElementCollection 00466 { 00467 private: 00468 const BiQuadPos2DFiniteElement QuadrilateralFE; 00469 00470 public: 00471 QuadraticPosDiscont2DFECollection() { }; 00472 virtual const FiniteElement * 00473 FiniteElementForGeometry(int GeomType) const; 00474 virtual int DofForGeometry(int GeomType) const; 00475 virtual int * DofOrderForOrientation(int GeomType, int Or) const 00476 { return NULL; }; 00477 virtual const char * Name() const { return "QuadraticPosDiscont2D"; }; 00478 }; 00479 00481 class GaussQuadraticDiscont2DFECollection : public FiniteElementCollection 00482 { 00483 private: 00484 // const Quad2DFiniteElement TriangleFE; 00485 const GaussQuad2DFiniteElement TriangleFE; 00486 const GaussBiQuad2DFiniteElement QuadrilateralFE; 00487 00488 public: 00489 GaussQuadraticDiscont2DFECollection() { }; 00490 00491 virtual const FiniteElement * 00492 FiniteElementForGeometry(int GeomType) const; 00493 00494 virtual int DofForGeometry(int GeomType) const; 00495 00496 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00497 00498 virtual const char * Name() const { return "GaussQuadraticDiscont2D"; }; 00499 }; 00500 00503 class CubicDiscont2DFECollection : public FiniteElementCollection 00504 { 00505 private: 00506 const Cubic2DFiniteElement TriangleFE; 00507 const BiCubic2DFiniteElement QuadrilateralFE; 00508 00509 public: 00510 CubicDiscont2DFECollection() { }; 00511 00512 virtual const FiniteElement * 00513 FiniteElementForGeometry(int GeomType) const; 00514 00515 virtual int DofForGeometry(int GeomType) const; 00516 00517 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00518 00519 virtual const char * Name() const { return "CubicDiscont2D"; }; 00520 }; 00521 00524 class Const3DFECollection : public FiniteElementCollection 00525 { 00526 private: 00527 const P0TetFiniteElement TetrahedronFE; 00528 const P0HexFiniteElement ParallelepipedFE; 00529 00530 public: 00531 Const3DFECollection () { }; 00532 00533 virtual const FiniteElement * 00534 FiniteElementForGeometry(int GeomType) const; 00535 00536 virtual int DofForGeometry(int GeomType) const; 00537 00538 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00539 00540 virtual const char * Name() const { return "Const3D"; }; 00541 }; 00542 00545 class LinearDiscont3DFECollection : public FiniteElementCollection 00546 { 00547 private: 00548 const Linear3DFiniteElement TetrahedronFE; 00549 const TriLinear3DFiniteElement ParallelepipedFE; 00550 00551 public: 00552 LinearDiscont3DFECollection () { }; 00553 00554 virtual const FiniteElement * 00555 FiniteElementForGeometry(int GeomType) const; 00556 00557 virtual int DofForGeometry(int GeomType) const; 00558 00559 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00560 00561 virtual const char * Name() const { return "LinearDiscont3D"; }; 00562 }; 00563 00566 class QuadraticDiscont3DFECollection : public FiniteElementCollection 00567 { 00568 private: 00569 const Quadratic3DFiniteElement TetrahedronFE; 00570 const LagrangeHexFiniteElement ParallelepipedFE; 00571 00572 public: 00573 QuadraticDiscont3DFECollection () : ParallelepipedFE(2) { }; 00574 00575 virtual const FiniteElement * 00576 FiniteElementForGeometry(int GeomType) const; 00577 00578 virtual int DofForGeometry(int GeomType) const; 00579 00580 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00581 00582 virtual const char * Name() const { return "QuadraticDiscont3D"; }; 00583 }; 00584 00586 class RefinedLinearFECollection : public FiniteElementCollection 00587 { 00588 private: 00589 const PointFiniteElement PointFE; 00590 const RefinedLinear1DFiniteElement SegmentFE; 00591 const RefinedLinear2DFiniteElement TriangleFE; 00592 const RefinedBiLinear2DFiniteElement QuadrilateralFE; 00593 const RefinedLinear3DFiniteElement TetrahedronFE; 00594 const RefinedTriLinear3DFiniteElement ParallelepipedFE; 00595 00596 public: 00597 RefinedLinearFECollection() { }; 00598 00599 virtual const FiniteElement * 00600 FiniteElementForGeometry(int GeomType) const; 00601 00602 virtual int DofForGeometry(int GeomType) const; 00603 00604 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00605 00606 virtual const char * Name() const { return "RefinedLinear"; }; 00607 }; 00608 00611 class ND1_3DFECollection : public FiniteElementCollection 00612 { 00613 private: 00614 const Nedelec1HexFiniteElement HexahedronFE; 00615 const Nedelec1TetFiniteElement TetrahedronFE; 00616 00617 public: 00618 ND1_3DFECollection() { }; 00619 00620 virtual const FiniteElement * 00621 FiniteElementForGeometry(int GeomType) const; 00622 00623 virtual int DofForGeometry(int GeomType) const; 00624 00625 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00626 00627 virtual const char * Name() const { return "ND1_3D"; }; 00628 }; 00629 00632 class RT0_3DFECollection : public FiniteElementCollection 00633 { 00634 private: 00635 const P0TriangleFiniteElement TriangleFE; 00636 const P0QuadFiniteElement QuadrilateralFE; 00637 const RT0HexFiniteElement HexahedronFE; 00638 const RT0TetFiniteElement TetrahedronFE; 00639 public: 00640 RT0_3DFECollection() { }; 00641 00642 virtual const FiniteElement * 00643 FiniteElementForGeometry(int GeomType) const; 00644 00645 virtual int DofForGeometry(int GeomType) const; 00646 00647 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00648 00649 virtual const char * Name() const { return "RT0_3D"; }; 00650 }; 00651 00654 class RT1_3DFECollection : public FiniteElementCollection 00655 { 00656 private: 00657 const Linear2DFiniteElement TriangleFE; 00658 const BiLinear2DFiniteElement QuadrilateralFE; 00659 const RT1HexFiniteElement HexahedronFE; 00660 public: 00661 RT1_3DFECollection() { }; 00662 00663 virtual const FiniteElement * 00664 FiniteElementForGeometry(int GeomType) const; 00665 00666 virtual int DofForGeometry(int GeomType) const; 00667 00668 virtual int * DofOrderForOrientation(int GeomType, int Or) const; 00669 00670 virtual const char * Name() const { return "RT1_3D"; }; 00671 }; 00672 00674 class Local_FECollection : public FiniteElementCollection 00675 { 00676 private: 00677 char d_name[32]; 00678 int GeomType; 00679 FiniteElement *Local_Element; 00680 00681 public: 00682 Local_FECollection(const char *fe_name); 00683 00684 virtual const FiniteElement *FiniteElementForGeometry(int _GeomType) const 00685 { return (GeomType == _GeomType) ? Local_Element : NULL; } 00686 virtual int DofForGeometry(int _GeomType) const 00687 { return (GeomType == _GeomType) ? Local_Element->GetDof() : 0; } 00688 virtual int *DofOrderForOrientation(int GeomType, int Or) const 00689 { return NULL; } 00690 virtual const char *Name() const { return d_name; } 00691 00692 virtual ~Local_FECollection() { delete Local_Element; } 00693 }; 00694 00695 #endif