📄 cell_hex20.c
字号:
// $Id: cell_hex20.C 2789 2008-04-13 02:24:40Z roystgnr $// The libMesh Finite Element Library.// Copyright (C) 2002-2007 Benjamin S. Kirk, John W. Peterson // This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2.1 of the License, or (at your option) any later version. // This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details. // You should have received a copy of the GNU Lesser General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA// C++ includes// Local includes#include "side.h"#include "cell_hex20.h"#include "edge_edge3.h"#include "face_quad8.h"// ------------------------------------------------------------// Hex20 class static member initializationsconst unsigned int Hex20::side_nodes_map[6][8] ={ {0, 3, 2, 1, 11, 10, 9, 8}, // Side 0 {0, 1, 5, 4, 8, 13, 16, 12}, // Side 1 {1, 2, 6, 5, 9, 14, 17, 13}, // Side 2 {2, 3, 7, 6, 10, 15, 18, 14}, // Side 3 {3, 0, 4, 7, 11, 12, 19, 15}, // Side 4 {4, 5, 6, 7, 16, 17, 18, 19} // Side 5};const unsigned int Hex20::edge_nodes_map[12][3] ={ {0, 1, 8}, // Side 0 {1, 2, 9}, // Side 1 {2, 3, 10}, // Side 2 {0, 3, 11}, // Side 3 {0, 4, 12}, // Side 4 {1, 5, 13}, // Side 5 {2, 6, 14}, // Side 6 {3, 7, 15}, // Side 7 {4, 5, 16}, // Side 8 {5, 6, 17}, // Side 9 {6, 7, 18}, // Side 10 {4, 7, 19} // Side 11};// ------------------------------------------------------------// Hex20 class member functionsbool Hex20::is_vertex(const unsigned int i) const{ if (i < 8) return true; return false;}bool Hex20::is_edge(const unsigned int i) const{ if (i > 7) return true; return false;}bool Hex20::is_face(const unsigned int) const{ return false;}bool Hex20::is_node_on_side(const unsigned int n, const unsigned int s) const{ libmesh_assert(s < n_sides()); for (unsigned int i = 0; i != 8; ++i) if (side_nodes_map[s][i] == n) return true; return false;}bool Hex20::is_node_on_edge(const unsigned int n, const unsigned int e) const{ libmesh_assert(e < n_edges()); for (unsigned int i = 0; i != 3; ++i) if (edge_nodes_map[e][i] == n) return true; return false;}bool Hex20::has_affine_map() const{ // Make sure x-edge endpoints are affine Point v = this->point(1) - this->point(0); if (!v.relative_fuzzy_equals(this->point(2) - this->point(3)) || !v.relative_fuzzy_equals(this->point(5) - this->point(4)) || !v.relative_fuzzy_equals(this->point(6) - this->point(7))) return false; // Make sure x-edges are straight v /= 2; if (!v.relative_fuzzy_equals(this->point(8) - this->point(0)) || !v.relative_fuzzy_equals(this->point(10) - this->point(3)) || !v.relative_fuzzy_equals(this->point(16) - this->point(4)) || !v.relative_fuzzy_equals(this->point(18) - this->point(7))) return false; // Make sure xz-faces are identical parallelograms v = this->point(4) - this->point(0); if (!v.relative_fuzzy_equals(this->point(7) - this->point(3))) return false; v /= 2; if (!v.relative_fuzzy_equals(this->point(12) - this->point(0)) || !v.relative_fuzzy_equals(this->point(13) - this->point(1)) || !v.relative_fuzzy_equals(this->point(14) - this->point(2)) || !v.relative_fuzzy_equals(this->point(15) - this->point(3))) return false; // Make sure y-edges are straight v = (this->point(3) - this->point(0))/2; if (!v.relative_fuzzy_equals(this->point(11) - this->point(0)) || !v.relative_fuzzy_equals(this->point(9) - this->point(1)) || !v.relative_fuzzy_equals(this->point(17) - this->point(5)) || !v.relative_fuzzy_equals(this->point(19) - this->point(4))) return false; // If all the above checks out, the map is affine return true;}AutoPtr<Elem> Hex20::build_side (const unsigned int i, bool proxy ) const{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -