$extrastylesheet
face_inf_quad.C
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 // Local includes
00020 #include "libmesh/libmesh_config.h"
00021 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
00022 
00023 // C++ includes
00024 
00025 // Local includes cont'd
00026 #include "libmesh/face_inf_quad.h"
00027 #include "libmesh/edge_edge2.h"
00028 #include "libmesh/edge_inf_edge2.h"
00029 
00030 namespace libMesh
00031 {
00032 
00033 
00034 // ------------------------------------------------------------
00035 // InfQuad class member functions
00036 dof_id_type InfQuad::key (const unsigned int s) const
00037 {
00038   libmesh_assert_less (s, this->n_sides());
00039 
00040 
00041   switch (s)
00042     {
00043     case 0:
00044 
00045       return
00046         this->compute_key (this->node(0),
00047                            this->node(1));
00048 
00049     case 1:
00050 
00051       return
00052         this->compute_key (this->node(1),
00053                            this->node(3));
00054 
00055     case 2:
00056 
00057       return
00058         this->compute_key (this->node(0),
00059                            this->node(2));
00060 
00061     default:
00062       libmesh_error_msg("Invalid side s = " << s);
00063     }
00064 
00065   libmesh_error_msg("We'll never get here!");
00066   return 0;
00067 }
00068 
00069 
00070 
00071 UniquePtr<Elem> InfQuad::side (const unsigned int i) const
00072 {
00073   libmesh_assert_less (i, this->n_sides());
00074 
00075   // To be returned wrapped in an UniquePtr
00076   Elem* edge = NULL;
00077 
00078   switch (i)
00079     {
00080     case 0:
00081       {
00082         // base face
00083         edge = new Edge2;
00084         edge->set_node(0) = this->get_node(0);
00085         edge->set_node(1) = this->get_node(1);
00086         break;
00087       }
00088 
00089     case 1:
00090       {
00091         // adjacent to another infinite element
00092         edge = new InfEdge2;
00093         edge->set_node(0) = this->get_node(1);
00094         edge->set_node(1) = this->get_node(3);
00095         break;
00096       }
00097 
00098     case 2:
00099       {
00100         // adjacent to another infinite element
00101         edge = new InfEdge2;
00102         edge->set_node(0) = this->get_node(0); // be aware of swapped nodes,
00103         edge->set_node(1) = this->get_node(2); // compared to conventional side numbering
00104         break;
00105       }
00106 
00107     default:
00108       libmesh_error_msg("Invalid side i = " << i);
00109     }
00110 
00111   return UniquePtr<Elem>(edge);
00112 }
00113 
00114 
00115 
00116 bool InfQuad::is_child_on_side(const unsigned int c,
00117                                const unsigned int s) const
00118 {
00119   libmesh_assert_less (c, this->n_children());
00120   libmesh_assert_less (s, this->n_sides());
00121 
00122   return (s == 0 || s == c+1);
00123 }
00124 
00125 
00126 
00127 Real InfQuad::quality (const ElemQuality) const
00128 {
00129   return 0.; // Not implemented
00130 }
00131 
00132 
00133 
00134 
00135 std::pair<Real, Real> InfQuad::qual_bounds (const ElemQuality q) const
00136 {
00137   std::pair<Real, Real> bounds;
00138 
00139   switch (q)
00140     {
00141 
00142     case ASPECT_RATIO:
00143       bounds.first  = 1.;
00144       bounds.second = 4.;
00145       break;
00146 
00147     case SKEW:
00148       bounds.first  = 0.;
00149       bounds.second = 0.5;
00150       break;
00151 
00152     case TAPER:
00153       bounds.first  = 0.;
00154       bounds.second = 0.7;
00155       break;
00156 
00157     case WARP:
00158       bounds.first  = 0.9;
00159       bounds.second = 1.;
00160       break;
00161 
00162     case STRETCH:
00163       bounds.first  = 0.25;
00164       bounds.second = 1.;
00165       break;
00166 
00167     case MIN_ANGLE:
00168       bounds.first  = 45.;
00169       bounds.second = 90.;
00170       break;
00171 
00172     case MAX_ANGLE:
00173       bounds.first  = 90.;
00174       bounds.second = 135.;
00175       break;
00176 
00177     case CONDITION:
00178       bounds.first  = 1.;
00179       bounds.second = 4.;
00180       break;
00181 
00182     case JACOBIAN:
00183       bounds.first  = 0.5;
00184       bounds.second = 1.;
00185       break;
00186 
00187     case SHEAR:
00188     case SHAPE:
00189     case SIZE:
00190       bounds.first  = 0.3;
00191       bounds.second = 1.;
00192       break;
00193 
00194     case DISTORTION:
00195       bounds.first  = 0.6;
00196       bounds.second = 1.;
00197       break;
00198 
00199     default:
00200       libMesh::out << "Warning: Invalid quality measure chosen." << std::endl;
00201       bounds.first  = -1;
00202       bounds.second = -1;
00203     }
00204 
00205   return bounds;
00206 }
00207 
00208 } // namespace libMesh
00209 
00210 
00211 
00212 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS