/usr/include/rheolef/space_constant.h is in librheolef-dev 6.5-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | #ifndef _RHEOLEF_SPACE_CONSTANT_H
#define _RHEOLEF_SPACE_CONSTANT_H
///
/// This file is part of Rheolef.
///
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
///
/// Rheolef is free software; you can redistribute it and/or modify
/// it under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 2 of the License, or
/// (at your option) any later version.
///
/// Rheolef 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 General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with Rheolef; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///
/// =========================================================================
// constants
#include "rheolef/distributed.h"
#include "rheolef/undeterminated.h"
// ---------------------------------------------------------------------------
// utility
// ---------------------------------------------------------------------------
namespace rheolef { namespace details {
// is_equal : used by type resolution and by is_symmetric
template <class T1, class T2> struct is_equal : mpl::false_ {};
template <class T> struct is_equal<T,T> : mpl::true_ {};
// switch for a constant, or a pointer-to-function or a class-function:
template<class T> struct is_scalar : boost::mpl::false_ {};
template<> struct is_scalar<int> : boost::mpl::true_ {};
template<> struct is_scalar<const int> : boost::mpl::true_ {};
template<> struct is_scalar<size_t> : boost::mpl::true_ {};
template<> struct is_scalar<Float> : boost::mpl::true_ {};
template<class T> struct is_point : boost::mpl::false_ {};
template<class T> struct is_point<point_basic<T> > : boost::mpl::true_ {};
template<class T> struct is_tensor : boost::mpl::false_ {};
template<class T> struct is_tensor<tensor_basic<T> > : boost::mpl::true_ {};
template<class T> struct is_tensor3 : boost::mpl::false_ {};
template<class T> struct is_tensor3<tensor3_basic<T> > : boost::mpl::true_ {};
template<class T> struct is_tensor4 : boost::mpl::false_ {};
template<class T> struct is_tensor4<tensor4_basic<T> > : boost::mpl::true_ {};
}} // namespace rheolef::details
// -------------------------------------------------------------
// coordinate system helper
// -------------------------------------------------------------
namespace rheolef { namespace space_constant {
typedef size_t size_type;
typedef enum {
cartesian = 0,
axisymmetric_rz = 1,
axisymmetric_zr = 2,
last_coord_sys = 3
} coordinate_type;
coordinate_type coordinate_system (std::string sys_coord);
std::string coordinate_system_name (coordinate_type);
void check_coord_sys_and_dimension (coordinate_type, size_type d);
// -------------------------------------------------------------
// multi-component field support
// -------------------------------------------------------------
typedef enum {
scalar = 0,
vector = 1,
tensor = 2, // symmetric, D_ij
unsymmetric_tensor = 3,
tensor3 = 4, // unsymmetric, G_ijk
tensor4 = 5, // symmetric, A_ijkl
mixed = 6,
last_valued = 7
} valued_type;
const std::string& valued_name (valued_type tag);
valued_type valued_tag (const std::string& name);
size_type n_component (
valued_type valued_tag,
size_type d,
coordinate_type sys_coord);
size_type n_component (
const std::string& valued,
size_type d,
coordinate_type sys_coord);
// convert a type to the enum valued_tag:
// size_t tag = valued_tag_traits<T>::value;
template<class T> struct valued_tag_traits { static const valued_type value = scalar; };
template<class T> struct valued_tag_traits<point_basic<T> > { static const valued_type value = vector; };
template<class T> struct valued_tag_traits<tensor_basic<T> > { static const valued_type value = tensor; };
template<class T> struct valued_tag_traits<tensor3_basic<T> > { static const valued_type value = tensor3; };
template<class T> struct valued_tag_traits<tensor4_basic<T> > { static const valued_type value = tensor4; };
template<class T> struct valued_tag_traits<undeterminated_basic<T> > { static const valued_type value = last_valued; };
// convert an enum valued_tag to the type based on T:
// typedef typename valued_type_traits<tag,T>::type valued_t;
//
template<int Tag, class T> struct valued_type_traits { typedef undeterminated_basic<T> type; };
template<class T> struct valued_type_traits<scalar,T> { typedef T type; };
template<class T> struct valued_type_traits<vector,T> { typedef point_basic<T> type; };
template<class T> struct valued_type_traits<tensor,T> { typedef tensor_basic<T> type; };
template<class T> struct valued_type_traits<tensor3,T> { typedef tensor3_basic<T> type; };
template<class T> struct valued_type_traits<tensor4,T> { typedef tensor4_basic<T> type; };
template<class T> struct valued_type_traits<last_valued,T> { typedef undeterminated_basic<T> type; };
// tensorial up and down helpers (for grad(expr))
template<class T> struct rank_down { typedef undeterminated_basic<typename scalar_traits<T>::type> type; };
template<class T> struct rank_down<point_basic<T> > { typedef T type; };
template<class T> struct rank_down<tensor_basic<T> > { typedef point_basic<T> type; };
template<class T> struct rank_down<tensor3_basic<T> > { typedef tensor_basic<T> type; };
template<class T> struct rank_down<tensor4_basic<T> > { typedef tensor3_basic<T> type; };
template<class T> struct rank_up { typedef point_basic<typename scalar_traits<T>::type> type; };
template<class T> struct rank_up<point_basic<T> > { typedef tensor_basic<T> type; };
template<class T> struct rank_up<tensor_basic<T> > { typedef tensor3_basic<T> type; };
template<class T> struct rank_up<tensor3_basic<T> > { typedef tensor4_basic<T> type; };
template<class T> struct rank_up<undeterminated_basic<T> > { typedef undeterminated_basic<typename scalar_traits<T>::type> type; };
template<class T>
T contract_product (const T& a, const T& b) { return a*b; }
template<class T>
T contract_product (const point_basic<T>& a, const point_basic<T>& b) { return dot(a,b); }
template<class T>
T contract_product (const tensor_basic<T>& a, const tensor_basic<T>& b) { return ddot(a,b); }
// -------------------------------------------------------------
// 2-tensor support
// -------------------------------------------------------------
size_type tensor_index (
valued_type valued_tag,
coordinate_type sys_coord,
size_type i,
size_type j);
size_type tensor_index (
std::string valued,
std::string sys_coord,
size_type i,
size_type j);
std::pair<size_type,size_type>
tensor_subscript (
valued_type valued_tag,
coordinate_type sys_coord,
size_type i_comp);
std::string
tensor_subscript_name (
valued_type valued_tag,
coordinate_type sys_coord,
size_type i_comp);
std::pair<size_type,size_type>
tensor_subscript (
std::string valued,
std::string sys_coord,
size_type i_comp);
std::string
tensor_subscript_name (
std::string valued,
std::string sys_coord,
size_type i_comp);
// -------------------------------------------------------------
// 4-tensor support
// -------------------------------------------------------------
size_type
tensor4_index (
valued_type valued,
coordinate_type sys_coord,
size_type i,
size_type j,
size_type k,
size_type l);
size_type
tensor4_index (
std::string valued,
std::string sys_coord,
size_type i,
size_type j,
size_type k,
size_type l);
std::pair<std::pair<size_type,size_type>, std::pair<size_type,size_type> >
tensor4_subscript (
valued_type valued,
coordinate_type sys_coord,
size_type i_comp);
std::string
tensor4_subscript_name (
valued_type valued,
coordinate_type sys_coord,
size_type i_comp);
std::pair<std::pair<size_type,size_type>, std::pair<size_type,size_type> >
tensor4_subscript (
std::string valued,
std::string sys_coord,
size_type i_comp);
std::string
tensor4_subscript_name (
std::string valued,
std::string sys_coord,
size_type i_comp);
// -------------------------------------------------------------
// field*field & field/field valued_type computed at run time
// -------------------------------------------------------------
valued_type multiplies_result_tag (valued_type tag1, valued_type tag2);
valued_type divides_result_tag (valued_type tag1, valued_type tag2);
}} // namespace rheolef::space_constant
#endif // _RHEOLEF_SPACE_CONSTITUTION_H
|