📄 cell_hex27.c
字号:
// $Id: cell_hex27.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_hex27.h"#include "edge_edge3.h"#include "face_quad9.h"// ------------------------------------------------------------// Hex27 class static member initializationsconst unsigned int Hex27::side_nodes_map[6][9] ={ {0, 3, 2, 1, 11, 10, 9, 8, 20}, // Side 0 {0, 1, 5, 4, 8, 13, 16, 12, 21}, // Side 1 {1, 2, 6, 5, 9, 14, 17, 13, 22}, // Side 2 {2, 3, 7, 6, 10, 15, 18, 14, 23}, // Side 3 {3, 0, 4, 7, 11, 12, 19, 15, 24}, // Side 4 {4, 5, 6, 7, 16, 17, 18, 19, 25} // Side 5};const unsigned int Hex27::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};// ------------------------------------------------------------// Hex27 class member functionsbool Hex27::is_vertex(const unsigned int i) const{ if (i < 8) return true; return false;}bool Hex27::is_edge(const unsigned int i) const{ if (i < 8) return false; if (i > 19) return false; return true;}bool Hex27::is_face(const unsigned int i) const{ if (i == 26) return false; if (i > 19) return true; return false;}bool Hex27::is_node_on_side(const unsigned int n, const unsigned int s) const{ libmesh_assert(s < n_sides()); for (unsigned int i = 0; i != 9; ++i) if (side_nodes_map[s][i] == n) return true; return false;}bool Hex27::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 Hex27::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 // and x-face and center points are centered 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)) || !v.relative_fuzzy_equals(this->point(20) - this->point(11)) || !v.relative_fuzzy_equals(this->point(21) - this->point(12)) || !v.relative_fuzzy_equals(this->point(23) - this->point(15)) || !v.relative_fuzzy_equals(this->point(25) - this->point(19)) || !v.relative_fuzzy_equals(this->point(26) - this->point(24))) 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)) || !v.relative_fuzzy_equals(this->point(22) - this->point(9)) || !v.relative_fuzzy_equals(this->point(24) - this->point(11))) 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;}unsigned int Hex27::key (const unsigned int s) const{ libmesh_assert (s < this->n_sides()); // Think of a unit cube: (-1,1) x (-1,1) x (1,1) switch (s) { case 0: // the face at z=0 return this->compute_key (this->node(20)); case 1: // the face at y = 0 return this->compute_key (this->node(21)); case 2: // the face at x=1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -