type_n_tensor.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_TYPE_N_TENSOR_H
21 #define LIBMESH_TYPE_N_TENSOR_H
22 
23 // Local includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/type_vector.h"
26 
27 // C++ includes
28 #include <cstdlib> // *must* precede <cmath> for proper std:abs() on PGI, Sun Studio CC
29 #include <cmath>
30 
31 namespace libMesh
32 {
33 
34 
45 template <unsigned int N, typename T>
46 class TypeNTensor
47 {
48 public:
50 
51  TypeNTensor (const T&) {}
52 
54 
56 
57  operator TypeVector<T> () const { libmesh_error(); return 0; }
58  operator VectorValue<T> () const { libmesh_error(); return 0; }
59 
60  operator TypeTensor<T> () const { libmesh_error(); return 0; }
61  operator TensorValue<T> () const { libmesh_error(); return 0; }
62 
67 
71  const TypeNTensor<N-1,T> slice (const unsigned int /*i*/) const
72  { return TypeNTensor<N-1,T>(); }
73 
77  TypeNTensor<N-1,T> slice (const unsigned int /*i*/)
78  { return TypeNTensor<N-1,T>(); }
79 
83  template<typename T2>
87 
91  template<typename T2>
93  { return *this; }
94 
98  template<typename T2>
102 
106  template<typename T2>
108  { return *this; }
109 
114  { return *this; }
115 
119  template <typename Scalar>
120  typename boostcopy::enable_if_c<
123  operator * (const Scalar) const
125 
129  template <typename Scalar>
130  const TypeNTensor<N,T> & operator *= (const Scalar) { return *this; }
131 
135  template <typename Scalar>
136  typename boostcopy::enable_if_c<
139  operator / (const Scalar) const { return *this; }
140 
144  const TypeNTensor<N,T> & operator /= (const T) { return *this; }
145 
151  template <typename T2>
153  contract (const TypeNTensor<N,T2> &) const { return 0; }
154 
159  Real size_sq() const { return 0.;}
160 
164  bool operator == (const TypeNTensor<N,T>& /*rhs*/) const
165  { return true; }
166 
171  bool operator < (const TypeNTensor<N,T>& /*rhs*/) const
172  { return false; }
173 
178  bool operator > (const TypeNTensor<N,T>& /*rhs*/) const
179  { return false; }
180 
184  void print(std::ostream& /*os = libMesh::out*/) const {}
185 
190  friend std::ostream& operator << (std::ostream& os,
191  const TypeNTensor<N,T>& t)
192  {
193  t.print(os);
194  return os;
195  }
196 };
197 
198 
199 } // namespace libMesh
200 
201 #endif // LIBMESH_TYPE_N_TENSOR_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo