23 #ifndef TENSORFIELD_H_INCLUDED 24 #define TENSORFIELD_H_INCLUDED 46 const Space* t_spaceField);
49 const Space* t_spaceField,
50 const std::vector<const Space*>& spaces);
52 template<
class ...Args>
56 template<
class ...Args>
59 std::string
const&
name,
61 std::vector<const Space*>
const& indices,
66 std::vector<Parent> breakSpace(
68 const std::vector<const Space*>& newSpace,
69 const std::vector<size_t>& pieces
77 std::ostream &out = std::cout,
82 const Space* getFieldSpace()
const override;
84 void setFieldSpace(
const Space* t_space)
override;
86 virtual Expr operator()(
const Tensor& point)
override;
89 const Tensor& point)
override;
91 virtual Expr operator()(
const std::vector<int>& indices,
92 const Tensor& point)
override;
94 virtual Expr operator()(std::vector<Index> indices,
95 const Tensor& point)
override;
103 void checkIndicialAndFieldRequest(
const Index& index,
106 void checkIndicialAndFieldRequest(
const std::vector<Index>& indices,
111 const Space* spaceField;
115 template<
class ...Args>
118 return csl::make_shared<TensorFieldParent>(
119 std::forward<Args>(args)...
123 template<
class ...Args>
125 std::string
const&
name,
127 std::vector<const Space*>
const& indices,
130 return csl::make_shared<TensorFieldParent>(
134 std::forward<Args>(args)...
145 const std::string& t_name,
146 const Space* t_spaceField)
151 const std::string& t_name,
152 const Space* t_spaceField,
153 const std::vector<const Space*>& spaces)
154 :
TensorField(tensorfield_s(t_name, t_spaceField, spaces))
157 template<
class ...Args>
159 Expr operator()(Args&& ...args)
161 return (**
this)(std::forward<Args>(args)...);
164 template<
class ...Args>
166 Expr operator()(
const std::vector<int>& indices, Args&& ...args)
168 return (**
this)(indices, std::forward<Args>(args)...);
171 template<
class ...Args>
173 Expr operator()(
const std::vector<Index>& indices, Args&& ...args)
175 return (**
this)(indices, std::forward<Args>(args)...);
194 const std::vector<Index>& indices);
201 template<
typename ...Args>
202 friend Expr tensorfieldelement_s(Args&& ...args);
211 return (not index.empty());
216 void setPoint(
csl::Tensor const& t_point)
override;
218 unique_Expr copy_unique()
const override;
220 Expr refresh()
const override;
222 void print(
int mode=0,
223 std::ostream& out=std::cout,
224 bool lib =
false)
const override;
228 std::ostream& out=std::cout
231 std::string printLaTeX(
int mode=0)
const override;
233 std::vector<csl::Parent> getSubSymbols()
const override;
235 std::optional<Expr> evaluate(
236 csl::eval::mode user_mode = csl::eval::base
239 bool commutesWith(
Expr_info expr,
int sign=-1)
const override;
248 std::map<Index, Index>& constraints,
249 bool keepAllCosntraints =
false)
const override;
256 template<
typename ...Args>
257 Expr tensorfieldelement_s(Args&& ...args)
259 return csl::make_shared<TensorFieldElement>(std::forward<Args>(args)...)
260 ->getCanonicalPermutation();
268 Expr operand = CSL_1;
288 size_t size()
const override;
290 void print(
int mode = 0,
291 std::ostream& out = std::cout,
292 bool lib =
false)
const override;
296 std::ostream& out=std::cout
299 std::string printLaTeX(
int mode = 0)
const override;
301 std::vector<csl::Parent> getSubSymbols()
const override;
303 std::optional<Expr> factor(
bool full=
false)
const override;
305 std::optional<Expr> factor(
307 bool full=
false)
const override;
309 std::optional<Expr> collect(
310 std::vector<Expr>
const &factors,
314 std::optional<Expr> expand(
bool full =
false,
315 bool inPlace =
false)
const override;
317 std::optional<Expr> expand_if(
318 std::function<
bool(
Expr const&)>
const& f,
320 bool inPlace =
false)
const override;
322 unique_Expr copy_unique()
const override;
324 Expr deepCopy()
const override;
326 Expr refresh()
const override;
328 Expr deepRefresh()
const override;
330 bool operatorAppliesOn(
Expr_info expr)
const override;
340 Expr const &getArgument(
int i)
const override;
342 Expr& getArgument(
int i)
override;
344 void setArgument(
Expr const& arg,
int i)
override;
346 Expr getOperand()
const override;
348 void setOperand(
const Expr& t_operand)
override;
350 void setPoint(
const Tensor& newPoint)
override;
362 void selfCheckIndexStructure();
364 void replaceIndexInPlace(
365 Index const &oldIndex,
366 Index const &newIndex)
override;
368 std::optional<Expr> replaceIndex(
369 const Index& indexToReplace,
370 const Index& newIndex,
371 bool refresh =
true)
const override;
373 std::optional<Expr> replaceIndices(
374 std::vector<Index>
const &indexToReplace,
375 std::vector<Index>
const &newIndex,
377 bool flipped =
false)
const override;
379 csl::vector_expr breakSpace(
380 const Space* brokenSpace,
381 const std::vector<const Space*>& newSpaces,
382 const std::vector<std::string>& indexNames
385 std::optional<Expr> getComplexConjugate()
const override;
388 std::map<Index, Index>& constraints,
389 bool keepAllCosntraints =
false)
const override;
395 Expr const &operator[](
int i)
const override;
397 Expr& operator[](
int i)
override;
400 Expr tderivativeelement_s(
const Tensor& t_vector,
402 const Index& t_index)
404 return csl::make_shared<TDerivativeElement>(
405 t_vector, t_parent, t_index);
409 Expr tderivativeelement_s(
const Tensor& t_vector,
411 const Index& t_index,
412 const Expr& t_operand,
415 return csl::make_shared<TDerivativeElement>(
416 t_vector, t_parent, t_index)->applyOperator(t_operand, t_empty);
420 Expr tderivativeelement_s(
const Tensor& t_vector,
422 const Index& t_index);
424 Expr tderivativeelement_s(
const Tensor& t_vector,
426 const Index& t_index,
427 const Expr& t_operand,
437 const Space* t_space);
441 void printDefinition(
447 template<
class ...Args>
454 const Tensor& point)
override;
457 template<
class ...Args>
460 return csl::make_shared<TDerivativeParent>(
461 std::forward<Args>(args)...);
471 const Space* t_space)
475 template<
class ...Args>
477 Expr operator()(Args&& ...args)
479 return (**
this)(std::forward<Args>(args)...);
std::string name
Definition: parent.h:87
Namespace for csl library.
Definition: abreviation.h:34
Parent of an indicial object, allows to generate them (TensorElement).
Definition: indicial.h:245
Index object that is used for indicial objects.
Definition: index.h:75
Definition: tensorField.h:264
Base classes for parents and elements.
Type
Enum of the different types of Abstract (i.e. list of all possible specializations).
Definition: enum.h:47
Definition: tensorField.h:181
PrimaryType
Definition: parent.h:39
virtual bool operator==(const TensorParent &other) const
Compares the parent with another.
Definition: indicial.cpp:1958
Definition: tensorField.h:35
cslParent::Type getType() const override
Definition: tensorField.cpp:55
Specialization of Abstract for Indicial tensor. Building block carrying indices, and respecting Einst...
Definition: indicial.h:763
Definition: tensorField.h:430
PrimaryType
Stores enumerations of types for Abstract objects.
Definition: enum.h:31
Root class of the inheritance tree of abstracts.
Definition: abstract.h:76
Definition: tensorField.h:464
Vector space that has a name, a dimension, a delta tensor and possibly a non-trivial metric...
Definition: space.h:64
Base class for all parents (indicial, fields etc). All parents derive from this class.
Definition: parent.h:81
cslParent::PrimaryType getPrimaryType() const override
Definition: tensorField.cpp:50
Definition: tensorField.h:138
Type
Definition: parent.h:47
bool dependsExplicitlyOn(Expr_info expr) const override
Tells if the parent depends explicitely on another expression or not.
Definition: indicial.cpp:1179
Objects handling indexed expressions in order to perform indicial tensor calculations.
bool isIndexed() const override
Definition: tensorField.h:210
bool dependsOn(Expr_info expr) const override
Tells if the parent depends on another expression or not.
Definition: indicial.cpp:1168
bool operator<(const Expr &a, const Expr &b)
see Abstract::operator<()
Definition: abstract.cpp:1423
Definition: indicial.h:675
Linear operator O(a*X+b*Y) = a*O(X) + b*O(Y)
Definition: operator.h:38
Manages a std::vector of Index, to be used by an TensorElement.
Definition: index.h:472
Expression type/.
Definition: abstract.h:1573