KADATH
tensor.hpp
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 #ifndef __TENSOR_HPP_
21 #define __TENSOR_HPP_
22 
23 
24 constexpr short COV{-1};
25 constexpr short CON{+1};
26 
27 #include <vector>
28 #include "base_tensor.hpp"
29 #include "array.hpp"
30 #include "space.hpp"
31 #include "val_domain.hpp"
32 
33 namespace Kadath {
34 
35  class Index;
36  class Tensor;
37  class Vector;
38  class Ope_id;
39  class Metric_tensor;
40  class Param_tensor;
41  class Term_eq;
42  class Scalar;
43 
44  Tensor operator+(const Tensor &);
45  Tensor operator-(const Tensor &);
46  Tensor operator+(const Tensor &, const Tensor &);
47  Tensor operator-(const Tensor &, const Tensor &);
48  Scalar operator+(const Tensor &, const Scalar &);
49  Scalar operator+(const Scalar &, const Tensor &);
50  Tensor operator+(const Tensor &, double);
51  Tensor operator+(double, const Tensor &);
52  Scalar operator-(const Tensor &, const Scalar &);
53  Scalar operator-(const Scalar &, const Tensor &);
54  Tensor operator-(const Tensor &, double);
55  Tensor operator-(double, const Tensor &);
56  Tensor operator*(const Scalar &, const Tensor &);
57  Tensor operator*(const Tensor &, const Scalar &);
58  Tensor operator*(double, const Tensor &);
59  Tensor operator*(const Tensor &, double);
60  Tensor operator*(int, const Tensor &);
61  Tensor operator*(const Tensor &, int);
62  Tensor operator*(const Tensor &, const Tensor &);
63  Tensor operator/(const Tensor &, const Scalar &);
64  Tensor operator/(const Tensor &, double);
65  Tensor operator/(const Tensor &, int);
66 
67  double maxval(const Tensor &);
68  double minval(const Tensor &);
69 
70  void affecte_one_dom(int, Tensor *, const Tensor *);
71 
72  Tensor add_one_dom(int, const Tensor &, const Tensor &);
73  Tensor add_one_dom(int, const Tensor &, double);
74  Tensor add_one_dom(int, double, const Tensor &);
75  Tensor sub_one_dom(int, const Tensor &, const Tensor &);
76  Tensor sub_one_dom(int, const Tensor &, double);
77  Tensor sub_one_dom(int, double, const Tensor &);
78  Tensor mult_one_dom(int, const Tensor &, const Tensor &);
79  Tensor mult_one_dom(int, const Tensor &, double);
80  Tensor mult_one_dom(int, double, const Tensor &);
81  Tensor mult_one_dom(int, const Tensor &, int);
82  Tensor mult_one_dom(int, int, const Tensor &);
83  Tensor div_one_dom(int, const Tensor &, const Tensor &);
84  Tensor div_one_dom(int, const Tensor &, double);
85  Tensor div_one_dom(int, double, const Tensor &);
86  Tensor scal_one_dom(int, const Tensor &, const Tensor &);
87  Tensor partial_one_dom(int, char, const Tensor &);
88  Tensor sqrt_one_dom(int, const Tensor &);
89 
90  //-------------------------//
91  // class Tensor //
92  //-------------------------//
93 
94 
95  int add_m_quant(const Param_tensor &, const Param_tensor &);
96  int mult_m_quant(const Param_tensor &, const Param_tensor &);
97  int div_m_quant(const Param_tensor &, const Param_tensor &);
98  int inv_m_quant(const Param_tensor &);
99 
105  class Param_tensor : public Memory_mapped {
106 
107  protected:
109  int m_order;
111  int m_quant;
112 
113  public:
114  int get_m_order() const;
115  int &set_m_order();
116 
117  int get_m_quant() const;
118  int &set_m_quant();
119 
121  void swap(Param_tensor &so) noexcept;
122 
124  operator bool() const noexcept { return m_order_affected || m_quant_affected; }
125 
127  bool operator!() const noexcept { return !m_order_affected && !m_quant_affected; }
128 
130  friend int add_m_quant(const Param_tensor &, const Param_tensor &);
131 
133  friend int mult_m_quant(const Param_tensor &, const Param_tensor &);
134 
136  friend int div_m_quant(const Param_tensor &, const Param_tensor &);
137 
139  friend int inv_m_quant(const Param_tensor &);
140 
141  friend class Tensor;
142  };
143 
149  class Tensor : public Memory_mapped {
150 
151  // Data :
152  // -----
153  protected:
154  const Space &espace;
155  int ndom;
156  int ndim;
157  int valence;
158 
159 
164 
171 
176  Memory_mapped_array<char> name_indice;
177 
178  int n_comp;
179  Memory_mapped_array<Scalar *> cmp;
180 
182 
183 
184  int (*give_place_array)(const Array<int> &,int);
185  int (*give_place_index)(const Index &,int);
186  Array<int> (*give_indices)(int, int,int);
187 
188  // Constructors - Destructor :
189  // -------------------------
190  public:
191 
199  Tensor(const Space &sp, int val, const Array<int> &tipe, const Base_tensor &ba);
200 
208  Tensor(const Space &sp, int val, int tipe, const Base_tensor & ba);
209 
218  Tensor(const Space &sp, int val, const Array<int> &tipe, const Base_tensor &ba, int dim);
219 
229  Tensor(const Space &sp, int val, int tipe, const Base_tensor & ba, int dim);
230 
231 
237  Tensor(const Tensor & so, bool copie = true);
238 
239  Tensor(const Space &sp, FILE *);
240  Tensor(const Space &sp, int dim, FILE *);
241 
242  void swap(Tensor &) noexcept;
243 #ifdef TENSOR_MOVE_SEMANTIC
244 
245  void do_move(Tensor &&so, bool move_cmp) noexcept;
246 
247  Tensor(Tensor &&so) noexcept;
248  virtual Tensor &operator=(Tensor &&) noexcept;
249 #endif
250 
251  protected:
257  explicit Tensor(const Space &sp);
258 
267  Tensor(const Space &sp, int val, const Array<int> &tipe, int n_compi, const Base_tensor & ba);
268 
277  Tensor(const Space &sp, int val, int tipe, int n_compi, const Base_tensor &ba);
278 
289  Tensor(const Space &sp, int val, const Array<int> &tipe, int n_compi, const Base_tensor & ba, int dim);
290 
301  Tensor(const Space &sp, int val, int tipe, int n_compi, const Base_tensor &ba, int dim);
302 
303  public:
304  virtual ~Tensor();
305  virtual void save(FILE *) const;
306 
307  // Mutators / assignment
308  // ---------------------
309  public:
311  const Param_tensor &get_parameters() const { return parameters; }
312 
315 
320  [[deprecated]] void affect_parameters() {}
321 
324 
327 
331  int &set_basis(int dd) { return basis.set_basis(dd); }
332 
333 
334  virtual Tensor & operator=(const Tensor &);
335  virtual Tensor & operator=(double xx);
336  virtual void annule_hard();
337 
349  Scalar &set(const Array<int> &ind);
350 
362  Scalar &set(const Index &ind);
363 
364  Scalar &set() {
365  assert (valence == 0);
366  return *cmp[0];
367  }
375  Scalar &set(int i);
376 
386  Scalar &set(int i1, int i2);
387 
388 
399  Scalar &set(int i1, int i2, int i3);
400 
412  Scalar &set(int i1, int i2, int i3, int i4);
413 
419  void set_name_ind(int dd, char name);
420 
424  char const *get_name_ind() const { return name_indice.get_data(); };
425 
429  bool is_name_affected() const { return name_affected; };
430 
435  void set_name_affected() { name_affected = true; };
436 
442  Tensor do_summation() const;
443 
450  Tensor do_summation_one_dom(int dd) const;
451 
452  Tensor grad() const;
453 
458  virtual void std_base();
459 
460 
461  // Accessors
462  // ---------
463  public:
464 
470  virtual int position(const Array<int> &idx) const { return (give_place_array(idx, ndim)); }
471 
477  virtual int position(const Index &idx) const { return (give_place_index(idx, ndim)); }
478 
484  virtual Array<int> indices(int pos) const { return (give_indices(pos, valence, ndim)); }
485 
486  private:
493  bool find_indices(const Tensor &tt, Array<int> &output_ind) const;
494 
495  public:
499  const Space &get_space() const { return espace; };
500 
504  const Base_tensor &get_basis() const { return basis; };
505 
509  int get_valence() const { return valence; };
510 
514  int get_n_comp() const { return n_comp; };
515 
519  int get_ndim() const { return ndim; };
520 
526  int get_index_type(int i) const { return type_indice(i); };
527 
531  Array<int> get_index_type() const { return type_indice; };
532 
538  int &set_index_type(int i) { return type_indice.set(i); };
539 
546 
547 
559  const Scalar &operator()(const Array<int> &ind) const;
560 
572  const Scalar &operator()(const Index &ind) const;
573 
574  const Scalar &operator()() const;
582  const Scalar &operator()(int i) const;
583 
593  const Scalar &operator()(int i1, int i2) const;
594 
596  const Scalar &at(int i1, int i2) const;
597 
608  const Scalar &operator()(int i1, int i2, int i3) const;
609 
620  const Scalar &operator()(int i1, int i2, int i3, int i4) const;
621 
624 
629  void filter(double tre);
630 
631  // Member arithmetics
632  // ------------------
633  public:
634  void coef() const;
635  void coef_i() const;
636  void operator+=(const Tensor &);
637  void operator-=(const Tensor &);
638 
645  void filter_phi(int dom, int ncf);
646 
647  // Outputs
648  // -------
649  public:
650 
651  friend ostream &operator<<(ostream &, const Tensor &);
652 
653  // Friend classes
654  // ---------------
655  friend class Index;
656  friend class Domain;
657  friend class Scalar;
658  friend class Vector;
659  friend class System_of_eqs;
660  friend class Eq_matching_non_std;
661  friend class Ope_id;
662  friend class Metric_tensor;
663  friend class Space_spheric_adapted;
664  friend class Space_polar_adapted;
665  friend class Space_bin_ns;
666  friend class Space_bin_bh;
667  friend class Space_polar_periodic;
668  friend class Space_adapted_bh;
669 friend class Space_bbh ;
670  // Mathematical operators
671  // ----------------------
672  friend Tensor operator+(const Tensor &);
673  friend Tensor operator-(const Tensor &);
674  friend Tensor operator+(const Tensor &, const Tensor &);
675  friend Scalar operator+(const Tensor &, const Scalar &);
676  friend Scalar operator+(const Scalar &, const Tensor &);
677  friend Tensor operator+(const Tensor &, double);
678  friend Tensor operator+(double, const Tensor &);
679  friend Tensor operator-(const Tensor &, const Tensor &);
680  friend Scalar operator-(const Tensor &, const Scalar &);
681  friend Scalar operator-(const Scalar &, const Tensor &);
682  friend Tensor operator-(const Tensor &, double);
683  friend Tensor operator-(double, const Tensor &);
684  friend Tensor operator*(const Scalar &, const Tensor &);
685  friend Tensor operator*(const Tensor &, const Scalar &);
686  friend Tensor operator*(double, const Tensor &);
687  friend Tensor operator*(const Tensor &, double);
688  friend Tensor operator*(int, const Tensor &);
689  friend Tensor operator*(const Tensor &, int);
690  friend Tensor
691  operator*(const Tensor &, const Tensor &);
692  friend Tensor operator/(const Tensor &, const Scalar &);
693  friend Tensor operator/(const Tensor &, double);
694  friend Tensor operator/(const Tensor &, int);
695  friend double
696  maxval(const Tensor &);
697  friend double
698  minval(const Tensor &);
705  friend void affecte_one_dom(int dom, Tensor * out, const Tensor * so);
706  friend Tensor add_one_dom(int, const Tensor &, const Tensor &);
707  friend Tensor add_one_dom(int, const Tensor &, double);
708  friend Tensor add_one_dom(int, double, const Tensor &);
709  friend Tensor sub_one_dom(int, const Tensor &, const Tensor &);
710  friend Tensor sub_one_dom(int, const Tensor &, double);
711  friend Tensor sub_one_dom(int, double, const Tensor &);
712  friend Tensor mult_one_dom(int, const Tensor &, const Tensor &);
713  friend Tensor mult_one_dom(int, const Tensor &, double);
714  friend Tensor mult_one_dom(int, double, const Tensor &);
715  friend Tensor mult_one_dom(int, const Tensor &, int);
716  friend Tensor mult_one_dom(int, int, const Tensor &);
717  friend Tensor div_one_dom(int, const Tensor &, const Tensor &);
718  friend Tensor div_one_dom(int, const Tensor &, double);
719  friend Tensor div_one_dom(int, double, const Tensor &);
720  friend Tensor scal_one_dom(int, const Tensor &, const Tensor &);
721  friend Tensor partial_one_dom(int, char, const Tensor &);
722  friend Tensor sqrt_one_dom(int, const Tensor &);
723  friend class Domain_nucleus;
724  friend class Domain_shell;
725  friend class Domain_bispheric_chi_first;
726  friend class Domain_bispheric_rect;
727  friend class Domain_bispheric_eta_first;
728  friend class Domain_shell_outer_adapted;
729  friend class Domain_shell_inner_adapted;
732  friend class Domain_compact;
733  friend class Domain_polar_periodic_nucleus;
734  friend class Domain_polar_periodic_shell;
735  };
736 
737  inline int Param_tensor::get_m_order() const {
738 #ifndef REMOVE_ALL_CHECKS
739  if (!m_order_affected) {
740  cerr << "m_order not affected in Param_tensor" << endl;
741  abort();
742  } else
743 #endif
744  return m_order;
745  }
746 
747  inline int Param_tensor::get_m_quant() const {
748 #ifndef REMOVE_ALL_CHECKS
749  if (!m_quant_affected) {
750  cerr << "m_quant not affected in Param_tensor" << endl;
751  abort();
752  } else
753 #endif
754  return m_quant;
755  }
756 
758  m_quant_affected = true;
759  return m_quant;
760  }
761 
763  m_order_affected = true;
764  return m_order;
765  }
766 
767  inline void Param_tensor::swap(Param_tensor &so) noexcept {
768  std::swap(m_quant_affected, so.m_quant_affected);
769  std::swap(m_quant, so.m_quant);
770  std::swap(m_order_affected, so.m_order_affected);
771  std::swap(m_order, so.m_order);
772  }
773 }
774 
775 #endif
reference set(const Index &pos)
Read/write of an element.
Definition: array.hpp:186
Describes the tensorial basis used by the various tensors.
Definition: base_tensor.hpp:49
int & set_basis(int nd)
Read/write the basis in a given domain.
Definition: base_tensor.hpp:91
Class for bispherical coordinates with a symmetry with respect to the plane .
Definition: bispheric.hpp:460
Class for bispherical coordinates with a symmetry with respect to the plane .
Definition: bispheric.hpp:878
Class for bispherical coordinates with a symmetry with respect to the plane .
Definition: bispheric.hpp:64
Class for a spherical compactified domain and a symmetry with respect to the plane .
Definition: spheric.hpp:1007
Class for a spherical domain containing the origin and a symmetry with respect to the plane .
Definition: spheric.hpp:66
Class for a spherical nucleus with a symmetry in .
Class for a spherical shell with a symmetry in .
Class for a spherical-like domain, having a symmetry with respect to the plane .
Class for a spherical-like domain, having a symmetry with respect to the plane .
Class for a spherical-like domain, having a symmetry with respect to the plane .
Definition: adapted.hpp:51
Class for a spherical-like domain, having a symmetry with respect to the plane .
Definition: adapted.hpp:367
Class for a spherical shell and a symmetry with respect to the plane .
Definition: spheric.hpp:555
Abstract class that implements the fonctionnalities common to all the type of domains.
Definition: space.hpp:60
Class for an equation representing the matching of quantities accross a boundary.
Class that gives the position inside a multi-dimensional Array.
Definition: index.hpp:38
Particular type of Tensor, dedicated to the desription of metrics.
The operator identity.
Definition: ope_eq.hpp:72
Class for handling additional parameters for some Tensor.
Definition: tensor.hpp:105
friend int add_m_quant(const Param_tensor &, const Param_tensor &)
Addition quantum numbers.
friend int div_m_quant(const Param_tensor &, const Param_tensor &)
Division of quantum numbers.
void swap(Param_tensor &so) noexcept
Sylvain's stuff.
Definition: tensor.hpp:767
friend int inv_m_quant(const Param_tensor &)
Inverse of a quantum number.
int & set_m_order()
Sets .
Definition: tensor.hpp:762
int get_m_order() const
Returns .
Definition: tensor.hpp:737
int m_order
The value of , if affected.
Definition: tensor.hpp:109
bool operator!() const noexcept
Check if the parameters are not affected.
Definition: tensor.hpp:127
int get_m_quant() const
Returns .
Definition: tensor.hpp:747
bool m_quant_affected
States if the parameter is affected.
Definition: tensor.hpp:110
int m_quant
The value of , if affected.
Definition: tensor.hpp:111
int & set_m_quant()
Sets .
Definition: tensor.hpp:757
bool m_order_affected
States if the parameter is affected.
Definition: tensor.hpp:108
friend int mult_m_quant(const Param_tensor &, const Param_tensor &)
Multiplication of quantum numbers.
The class Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
Definition: scalar.hpp:67
The Space_spheric_adapted class fills the space with one shell adapted on the inside,...
Definition: adapted_bh.hpp:36
Spacetime intended for binary black hole configurations in full general relativity (see constructor f...
Definition: bbh.hpp:33
Spacetime intended for binary black hole configurations (see constructor for details about the domain...
Definition: bin_bh.hpp:35
Spacetime intended for binary neutron stars configurations (see constructor for details about the dom...
Definition: bin_ns.hpp:35
The Space_polar_adapted class fills the space with one polar nucleus, one polar shell adapted on the ...
The Space_polar_periodic class fills the space with one polar nucleus and several polar shells,...
The Space_spheric_adapted class fills the space with one nucleus, one shell adapted on the outside,...
Definition: adapted.hpp:661
The Space class is an ensemble of domains describing the whole space of the computation.
Definition: space.hpp:1362
Class used to describe and solve a system of equations.
Tensor handling.
Definition: tensor.hpp:149
void affect_parameters()
The function affect_parameters is deprecated and actually does nothing since the parameters are now a...
Definition: tensor.hpp:320
virtual ~Tensor()
Destructor.
Definition: tensor.cpp:323
int ndim
The dimension/.
Definition: tensor.hpp:156
const Scalar & operator()() const
Read only for a Scalar.
bool name_affected
Indicator that states if the indices have been given names.
Definition: tensor.hpp:172
Memory_mapped_array< char > name_indice
If the indices haves names they are stored here.
Definition: tensor.hpp:176
void swap(Tensor &) noexcept
Swap method.
Definition: tensor.cpp:270
void set_name_ind(int dd, char name)
Sets the name of one index ; the names must have been affected first.
virtual Tensor & operator=(const Tensor &)
Assignment to a Tensor.
Definition: tensor_math.cpp:27
bool is_m_order_affected() const
Checks whether the additional parameter order is affected (not very used).
Definition: tensor.hpp:323
friend Tensor operator-(const Tensor &)
Operator -.
Base_tensor basis
Tensorial basis with respect to which the tensor components are defined.
Definition: tensor.hpp:163
void change_basis_spher_to_cart()
Changes the tensorial basis from orthonormal spherical to Cartesian.
Definition: tensor.cpp:474
bool find_indices(const Tensor &tt, Array< int > &output_ind) const
Checks whether the current Tensor and tt have compatible indices (i.e.
Definition: tensor.cpp:445
Tensor do_summation() const
Does the inner contraction of the Tensor.
void operator-=(const Tensor &)
-= Tensor
int ndom
The number of Domain.
Definition: tensor.hpp:155
Tensor(const Space &sp, int val, const Array< int > &tipe, const Base_tensor &ba)
Constructor.
Definition: tensor.cpp:77
int valence
Valence of the tensor (0 = scalar, 1 = vector, etc...)
Definition: tensor.hpp:157
friend double minval(const Tensor &)
Gives the minimum value amongst all the components, at all the collocation points.
void set_name_affected()
Affects the name of the indices.
Definition: tensor.hpp:435
int(* give_place_index)(const Index &, int)
Pointer on the function that gives the storage location corresponding to a set of indices values....
Definition: tensor.hpp:185
friend ostream & operator<<(ostream &, const Tensor &)
Display.
Definition: tensor.cpp:339
void coef() const
Computes the coefficients.
Tensor grad() const
Computes the flat gradient, in Cartesian coordinates.
friend Tensor operator+(const Tensor &)
Operator + (unitary version)
Array< int > type_indice
1D array of integers of size valence containing the type of each index: COV for a covariant one and C...
Definition: tensor.hpp:170
Param_tensor parameters
Possible additional parameters relevant for the current Tensor.
Definition: tensor.hpp:181
Array< int >(* give_indices)(int, int, int)
Pointer on the function that gives the indices corresponding to a give storage location.
Definition: tensor.hpp:186
Param_tensor & set_parameters()
Read/write of the parameters.
Definition: tensor.hpp:314
void filter_phi(int dom, int ncf)
Sets to zero all the coefficients above a given order, for the coefficients, in a gicen Domain.
virtual void std_base()
Sets the standard spectal bases of decomposition for each component.
Definition: tensor.cpp:385
void coef_i() const
Computes the values in the configuration space.
Memory_mapped_array< Scalar * > cmp
Array of size n_comp of pointers onto the components.
Definition: tensor.hpp:179
const Param_tensor & get_parameters() const
Returns a pointer on the possible additional parameter.
Definition: tensor.hpp:311
Array< int > get_index_type() const
Definition: tensor.hpp:531
void filter(double tre)
Sets all the coefficients below a given treshold, to zero (maintaining regularity).
int & set_index_type(int i)
Sets the type of the index number.
Definition: tensor.hpp:538
char const * get_name_ind() const
Definition: tensor.hpp:424
int get_index_type(int i) const
Gives the type (covariant or contravariant) of a given index.
Definition: tensor.hpp:526
friend Tensor add_one_dom(int, const Tensor &, const Tensor &)
Addition (one domain version)
virtual void annule_hard()
Sets the Tensor to zero (hard version ; no logical state used).
Definition: tensor_impl.hpp:23
friend Tensor mult_one_dom(int, const Tensor &, const Tensor &)
Multiplication (one domain version)
void operator+=(const Tensor &)
+= Tensor
Definition: tensor_math.cpp:69
friend Tensor partial_one_dom(int, char, const Tensor &)
Partial derivative (one domain version)
void change_basis_cart_to_spher()
Changes the tensorial basis from Cartesian to orthonormal spherical.
Definition: tensor.cpp:489
virtual int position(const Index &idx) const
Gives the location of a given component in the array used for storage (Index version).
Definition: tensor.hpp:477
const Base_tensor & get_basis() const
Returns the vectorial basis (triad) on which the components are defined.
Definition: tensor.hpp:504
Array< int > & set_index_type()
Sets the types of all the indices.
Definition: tensor.hpp:545
friend Tensor sqrt_one_dom(int, const Tensor &)
Square root (one domain version)
int get_n_comp() const
Returns the number of stored components.
Definition: tensor.hpp:514
virtual void save(FILE *) const
Saving operator.
Definition: tensor.cpp:327
Scalar & set()
Read/write for a Scalar.
Definition: tensor.hpp:364
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
friend void affecte_one_dom(int dom, Tensor *out, const Tensor *so)
Affectation in one domain only.
friend Tensor div_one_dom(int, const Tensor &, const Tensor &)
Division (one domain version)
int n_comp
Number of stored components, depending on the symmetry.
Definition: tensor.hpp:178
const Space & espace
The Space.
Definition: tensor.hpp:154
int get_valence() const
Returns the valence.
Definition: tensor.hpp:509
friend Tensor sub_one_dom(int, const Tensor &, const Tensor &)
Difference (one domain version)
friend Tensor scal_one_dom(int, const Tensor &, const Tensor &)
Scalar product (one domain version)
const Scalar & at(int i1, int i2) const
Sylvain' stuff.
friend Tensor operator/(const Tensor &, const Scalar &)
Operator /.
virtual int position(const Array< int > &idx) const
Gives the location of a given component in the array used for storage (Array version).
Definition: tensor.hpp:470
bool is_name_affected() const
Check whether the names of the indices have been affected.
Definition: tensor.hpp:429
bool is_m_quant_affected() const
Checks whether the additional parameter is affected (used for boson stars for instance).
Definition: tensor.hpp:326
Tensor do_summation_one_dom(int dd) const
Does the inner contraction of the Tensor in a given domain.
int(* give_place_array)(const Array< int > &, int)
Pointer on the function that gives the storage location corresponding to a set of indices values....
Definition: tensor.hpp:184
friend Tensor operator*(const Scalar &, const Tensor &)
Operator *.
int get_ndim() const
Returns the number dimension.
Definition: tensor.hpp:519
const Space & get_space() const
Returns the Space.
Definition: tensor.hpp:499
friend double maxval(const Tensor &)
Gives the maximum value amongst all the components, at all the collocation points.
int & set_basis(int dd)
Assigns a new tensorial basis in a given domain.
Definition: tensor.hpp:331
A class derived from Tensor to deal specificaly with objects of valence 1 (and so also 1-forms).
Definition: vector.hpp:41