$extrastylesheet
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 #include "libmesh/tensor_tools.h" 00019 #include "libmesh/vector_value.h" 00020 #include "libmesh/tensor_value.h" 00021 #include "libmesh/type_n_tensor.h" 00022 00023 namespace libMesh 00024 { 00025 namespace TensorTools 00026 { 00027 // Needed for ExactSolution to compile 00028 Number curl_from_grad( const VectorValue<Number>& ) 00029 { 00030 libmesh_error_msg("Operation not defined for scalar quantities."); 00031 } 00032 00033 VectorValue<Number> curl_from_grad( const TensorValue<Number>& grad ) 00034 { 00035 const Number duz_dy = grad(2,1); 00036 const Number duy_dz = grad(1,2); 00037 const Number dux_dz = grad(0,2); 00038 const Number duz_dx = grad(2,0); 00039 const Number duy_dx = grad(1,0); 00040 const Number dux_dy = grad(0,1); 00041 00042 return VectorValue<Number>( duz_dy - duy_dz, dux_dz - duz_dx, duy_dx - dux_dy); 00043 } 00044 00045 // Needed for ExactSolution to compile. Will implement when needed. 00046 TensorValue<Number> curl_from_grad( const TypeNTensor<3,Number>& /* grad */ ) 00047 { 00048 libmesh_not_implemented(); 00049 } 00050 00051 // Needed for ExactSolution to compile 00052 Number div_from_grad( const VectorValue<Number>& /* grad */ ) 00053 { 00054 libmesh_error_msg("Operation not defined for scalar quantities."); 00055 } 00056 00057 Number div_from_grad( const TensorValue<Number>& grad ) 00058 { 00059 const Number dux_dx = grad(0,0); 00060 const Number duy_dy = grad(1,1); 00061 const Number duz_dz = grad(2,2); 00062 00063 return dux_dx + duy_dy + duz_dz; 00064 } 00065 00066 // Needed for ExactSolution to compile. Will implement when needed. 00067 VectorValue<Number> div_from_grad( const TypeNTensor<3,Number>& /* grad */ ) 00068 { 00069 libmesh_not_implemented(); 00070 } 00071 00072 } 00073 }