KADATH
domain_shell_inner_homothetic_term_eq.cpp
1 /*
2  Copyright 2017 Philippe Grandclement
3 
4  This file is part of Kadath.
5 
6  Kadath is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Kadath is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Kadath. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "headcpp.hpp"
21 #include "utilities.hpp"
22 #include "homothetic.hpp"
23 #include "array_math.hpp"
24 #include "val_domain.hpp"
25 #include "scalar.hpp"
26 #include "tensor_impl.hpp"
27 #include "vector.hpp"
28 namespace Kadath {
30  // Check it is a tensor
31  if (so.get_type_data() != TERM_T) {
32  cerr << "integ_term_eq only defined with respect for a tensor" << endl ;
33  abort() ;
34  }
35 
36  if (so.get_val_t().get_n_comp() != 1) {
37  cerr << "integ_term_eq only defined with respect to a scalar" << endl ;
38  abort() ;
39  }
40 
41  assert (so.get_dom()==num_dom) ;
42 
43 
45 
46 
47 
48  double resval = 0 ;
49  {// The value
50  Array<int> ind (so.get_val_t().indices(0)) ;
51  Val_domain value (mult_sin_theta(rrso.get_val_t()(ind)(num_dom))) ;
52  if (value.check_if_zero())
53  resval= 0. ;
54  else {
55 
56  int baset = (*value.get_base().bases_1d[1]) (0) ;
57  Index pcf (nbr_coefs) ;
58  switch (baset) {
59  case COS_ODD :
60  break ;
61  case SIN_EVEN :
62  break ;
63  case COS_EVEN : {
64  resval += M_PI*val_boundary(bound, value, pcf) ;
65  break ;
66  }
67  case SIN_ODD : {
68  for (int j=0 ; j<nbr_coefs(1) ; j++) {
69  pcf.set(1) = j ;
70  resval += 2./(2*double(j)+1) * val_boundary(bound, value, pcf) ;
71  }
72  break ;
73  }
74 
75  default :
76  cerr << "Case not yet implemented in Domain_shell_inner_homothetic::integrale" << endl ;
77  abort() ;
78  }
79 
80  }
81  resval *= 2*M_PI ;
82  }
83 
84  if (rrso.get_p_der_t()!=0x0) {
85  // The value
86  Array<int> ind (so.get_val_t().indices(0)) ;
87  Val_domain valueder (mult_sin_theta(rrso.get_der_t()(ind)(num_dom))) ;
88  double resder = 0;
89  if (valueder.check_if_zero())
90  resder= 0. ;
91  else {
92 
93  int baset = (*valueder.get_base().bases_1d[1]) (0) ;
94  Index pcf (nbr_coefs) ;
95  switch (baset) {
96  case COS_ODD :
97  break ;
98  case SIN_EVEN :
99  break ;
100  case COS_EVEN : {
101  resder += M_PI*val_boundary(bound, valueder, pcf) ;
102  break ;
103  }
104  case SIN_ODD : {
105  for (int j=0 ; j<nbr_coefs(1) ; j++) {
106  pcf.set(1) = j ;
107  resder += 2./(2*double(j)+1) * val_boundary(bound, valueder, pcf) ;
108  }
109  break ;
110  }
111  default :
112  cerr << "Case not yet implemented in Domain_shell_inner_homothetic::integrale" << endl ;
113  abort() ;
114  }
115  resder *= 2*M_PI ;
116  }
117  return Term_eq (num_dom, resval, resder) ;
118  }
119  else {
120  return Term_eq (num_dom, resval) ;
121  }
122 }
123 
124 }
Bases_container bases_1d
Arrays containing the various basis of decomposition.
virtual double val_boundary(int, const Val_domain &, const Index &) const
Computes the value of a field at a boundary.
virtual Val_domain mult_sin_theta(const Val_domain &) const
Multiplication by .
virtual Term_eq mult_r_term_eq(const Term_eq &) const
Multiplication by of a Term_eq.
virtual Term_eq integ_term_eq(const Term_eq &, int) const
Surface integral of a Term_eq.
int num_dom
Number of the current domain (used by the Space)
Definition: space.hpp:63
Dim_array nbr_coefs
Number of coefficients.
Definition: space.hpp:66
Class that gives the position inside a multi-dimensional Array.
Definition: index.hpp:38
int & set(int i)
Read/write of the position in a given dimension.
Definition: index.hpp:72
int get_n_comp() const
Returns the number of stored components.
Definition: tensor.hpp:514
virtual Array< int > indices(int pos) const
Gives the values of the indices corresponding to a location in the array used for storage of the comp...
Definition: tensor.hpp:484
This class is intended to describe the manage objects appearing in the equations.
Definition: term_eq.hpp:62
int get_dom() const
Definition: term_eq.hpp:135
int get_type_data() const
Definition: term_eq.hpp:131
const Tensor * get_p_der_t() const
Definition: term_eq.hpp:127
Tensor const & get_val_t() const
Definition: term_eq.hpp:355
Tensor const & get_der_t() const
Definition: term_eq.hpp:369
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Definition: val_domain.hpp:69
bool check_if_zero() const
Check whether the logical state is zero or not.
Definition: val_domain.hpp:142
const Base_spectral & get_base() const
Returns the basis of decomposition.
Definition: val_domain.hpp:122