Reaktoro
A unified framework for modeling chemically reactive systems
ThermoVector.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2018 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // Reaktoro includes
21 #include <Reaktoro/Math/Matrix.hpp>
22 #include <Reaktoro/Common/ThermoScalar.hpp>
23 
24 namespace Reaktoro {
25 
26 // Forward declaration
27 template<typename V, typename T, typename P>
28 class ThermoVectorBase;
29 
36 using ThermoVector = ThermoVectorBase<Vector,Vector,Vector>;
37 
40 
43 
46 template<typename V, typename T, typename P>
48 {
49 public:
51  V val;
52 
54  T ddT;
55 
57  P ddP;
58 
61  {}
62 
65  explicit ThermoVectorBase(Index nrows)
66  : ThermoVectorBase(zeros(nrows), zeros(nrows), zeros(nrows)) {}
67 
71  ThermoVectorBase(Index nrows, double val)
72  : ThermoVectorBase(constants(nrows, val), zeros(nrows), zeros(nrows)) {}
73 
78  ThermoVectorBase(const V& val, const T& ddT, const P& ddP)
79  : val(val), ddT(ddT), ddP(ddP) {}
80 
82  template<typename VR, typename TR, typename PR>
84  : val(other.val), ddT(other.ddT), ddP(other.ddP)
85  {}
86 
88  template<typename VR, typename TR, typename PR>
90  : val(other.val), ddT(other.ddT), ddP(other.ddP)
91  {}
92 
94  auto size() const -> Index
95  {
96  return val.size();
97  }
98 
101  auto resize(Index nrows) -> void
102  {
103  val = zeros(nrows);
104  ddT = zeros(nrows);
105  ddP = zeros(nrows);
106  }
107 
109  template<typename VR>
110  auto fill(const ThermoScalarBase<VR>& other) -> void
111  {
112  val.fill(other.val);
113  ddT.fill(other.ddT);
114  ddP.fill(other.ddP);
115  }
116 
118  auto fill(double value) -> void
119  {
120  val.fill(value);
121  ddT.fill(0.0);
122  ddP.fill(0.0);
123  }
124 
126  template<typename VR, typename TR, typename PR>
128  {
129  val = other.val;
130  ddT = other.ddT;
131  ddP = other.ddP;
132  return *this;
133  }
134 
136  template<typename VR>
138  {
139  val.fill(other.val);
140  ddT.fill(other.ddT);
141  ddP.fill(other.ddP);
142  return *this;
143  }
144 
146  auto operator=(double other) -> ThermoVectorBase&
147  {
148  val.fill(other);
149  ddT.fill(0.0);
150  ddP.fill(0.0);
151  return *this;
152  }
153 
155  template<typename VR, typename TR, typename PR>
157  {
158  val += other.val;
159  ddT += other.ddT;
160  ddP += other.ddP;
161  return *this;
162  }
163 
165  template<typename VR>
167  {
168  val.array() += other.val;
169  ddT.array() += other.ddT;
170  ddP.array() += other.ddP;
171  return *this;
172  }
173 
175  auto operator+=(double scalar) -> ThermoVectorBase&
176  {
177  val.array() += scalar;
178  return *this;
179  }
180 
182  template<typename VR, typename TR, typename PR>
184  {
185  val -= other.val;
186  ddT -= other.ddT;
187  ddP -= other.ddP;
188  return *this;
189  }
190 
192  template<typename VR>
194  {
195  val.array() -= other.val;
196  ddT.array() -= other.ddT;
197  ddP.array() -= other.ddP;
198  return *this;
199  }
200 
202  auto operator-=(double other) -> ThermoVectorBase&
203  {
204  val.array() -= other;
205  return *this;
206  }
207 
209  template<typename VR, typename TR, typename PR>
211  {
212  ddT = diag(ddT) * other.val + diag(val) * other.ddT;
213  ddP = diag(ddP) * other.val + diag(val) * other.ddP;
214  val = diag(val) * other.val;
215  return *this;
216  }
217 
219  auto operator*=(double scalar) -> ThermoVectorBase&
220  {
221  val *= scalar;
222  ddT *= scalar;
223  ddP *= scalar;
224  return *this;
225  }
226 
228  auto operator/=(double scalar) -> ThermoVectorBase&
229  {
230  *this *= 1.0/scalar;
231  return *this;
232  }
233 
235  auto operator[](Index irow) -> ThermoScalarBase<decltype(val[irow])>
236  {
237  return {val[irow], ddT[irow], ddP[irow]};
238  }
239 
241  auto operator[](Index irow) const -> ThermoScalarBase<decltype(val[irow])>
242  {
243  return {val[irow], ddT[irow], ddP[irow]};
244  }
245 
249  auto view(Index irow, Index nrows) -> ThermoVectorRef
250  {
251  return {rowsmap(val, irow, nrows), rowsmap(ddT, irow, nrows), rowsmap(ddP, irow, nrows)};
252  }
253 
257  auto view(Index irow, Index nrows) const -> ThermoVectorConstRef
258  {
259  return {rowsmap(val, irow, nrows), rowsmap(ddT, irow, nrows), rowsmap(ddP, irow, nrows)};
260  }
261 
263  explicit operator Vector() const
264  {
265  return val;
266  }
267 };
268 
270 template<typename V, typename T, typename P>
271 auto zeros(const ThermoVectorBase<V,T,P>& v) -> ThermoVectorBase<decltype(zeros(0)), decltype(zeros(0)), decltype(zeros(0))>
272 {
273  const Index n = v.size();
274  return {zeros(n), zeros(n), zeros(n)};
275 }
276 
278 template<typename V, typename T, typename P>
279 auto ones(const ThermoVectorBase<V,T,P>& v) -> ThermoVectorBase<decltype(ones(0)), decltype(zeros(0)), decltype(zeros(0))>
280 {
281  const Index n = v.size();
282  return {ones(n), zeros(n), zeros(n)};
283 }
284 
285 template<typename V, typename T, typename P>
286 auto operator<<(std::ostream& out, const ThermoVectorBase<V,T,P>& a) -> std::ostream&
287 {
288  out << a.val;
289  return out;
290 }
291 
292 template<typename V, typename T, typename P>
293 auto operator+(const ThermoVectorBase<V,T,P>& l) -> ThermoVectorBase<V,T,P>
294 {
295  return l;
296 }
297 
298 template<typename V, typename T, typename P>
299 auto operator-(const ThermoVectorBase<V,T,P>& l) -> ThermoVectorBase<decltype(-l.val), decltype(-l.ddT), decltype(-l.ddP)>
300 {
301  return {-l.val, -l.ddT, -l.ddP};
302 }
303 
304 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
305 auto operator+(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> ThermoVectorBase<decltype(l.val + r.val), decltype(l.ddT + r.ddT), decltype(l.ddP + r.ddP)>
306 {
307  return {l.val + r.val, l.ddT + r.ddT, l.ddP + r.ddP};
308 }
309 
310 template<typename V, typename T, typename P>
311 auto operator+(const ThermoVectorBase<V,T,P>& l, VectorConstRef r) -> ThermoVectorBase<decltype(l.val + r),T,P>
312 {
313  return {l.val + r, l.ddT, l.ddP};
314 }
315 
316 template<typename V, typename T, typename P>
317 auto operator+(VectorConstRef l, const ThermoVectorBase<V,T,P>& r) -> decltype(r + l)
318 {
319  return r + l;
320 }
321 
322 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
323 auto operator-(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> ThermoVectorBase<decltype(l.val - r.val), decltype(l.ddT - r.ddT), decltype(l.ddP - r.ddP)>
324 {
325  return {l.val - r.val, l.ddT - r.ddT, l.ddP - r.ddP};
326 }
327 
328 template<typename V, typename T, typename P>
329 auto operator-(const ThermoVectorBase<V,T,P>& l, VectorConstRef r) -> ThermoVectorBase<decltype(l.val - r),T,P>
330 {
331  return {l.val - r, l.ddT, l.ddP};
332 }
333 
334 template<typename V, typename T, typename P>
335 auto operator-(VectorConstRef l, const ThermoVectorBase<V,T,P>& r) -> decltype(-(r - l))
336 {
337  return -(r - l);
338 }
339 
340 template<typename V, typename T, typename P>
341 auto operator*(double l, const ThermoVectorBase<V,T,P>& r) -> ThermoVectorBase<decltype(l * r.val), decltype(l * r.ddT), decltype(l * r.ddP)>
342 {
343  return {l * r.val, l * r.ddT, l * r.ddP};
344 }
345 
346 template<typename V, typename T, typename P>
347 auto operator*(const ThermoVectorBase<V,T,P>& l, double r) -> decltype(r * l)
348 {
349  return r * l;
350 }
351 
352 template<typename VL, typename V, typename T, typename P>
353 auto operator*(const ThermoScalarBase<VL>& l, const ThermoVectorBase<V,T,P>& r) -> ThermoVectorBase<decltype(l.val * r.val), decltype(l.val * r.ddT + l.ddT * r.val), decltype(l.val * r.ddP + l.ddP * r.val)>
354 {
355  return {l.val * r.val, l.val * r.ddT + l.ddT * r.val, l.val * r.ddP + l.ddP * r.val};
356 }
357 
358 template<typename V, typename T, typename P, typename VR>
359 auto operator*(const ThermoVectorBase<V,T,P>& l, const ThermoScalarBase<VR>& r) -> decltype(r * l)
360 {
361  return r * l;
362 }
363 
364 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
365 auto operator%(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> ThermoVectorBase<decltype(diag(l.val) * r.val), decltype(diag(l.val) * r.ddT + diag(r.val) * l.ddT), decltype(diag(l.val) * r.ddP + diag(r.val) * l.ddP)>
366 {
367  return {diag(l.val) * r.val,
368  diag(l.val) * r.ddT + diag(r.val) * l.ddT,
369  diag(l.val) * r.ddP + diag(r.val) * l.ddP};
370 }
371 
372 template<typename V, typename T, typename P>
373 auto operator%(VectorConstRef l, const ThermoVectorBase<V,T,P>& r) -> ThermoVectorBase<decltype(diag(l) * r.val), decltype(diag(l) * r.ddT), decltype(diag(l) * r.ddP)>
374 {
375  return {diag(l) * r.val,
376  diag(l) * r.ddT,
377  diag(l) * r.ddP};
378 }
379 
380 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
381 auto operator%(const ThermoVectorBase<VL,TL,PL>& l, VectorConstRef r) -> decltype(r % l)
382 {
383  return r % l;
384 }
385 
386 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
387 auto operator/(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> ThermoVector
388 {
389  const Vector tmp = 1.0/(r.val % r.val);
390  return {l.val/r.val,
391  diag(tmp) * (diag(r.val) * l.ddT - diag(l.val) * r.ddT),
392  diag(tmp) * (diag(r.val) * l.ddP - diag(l.val) * r.ddP)};
393 }
394 
395 template<typename V, typename T, typename P, typename VR>
396 auto operator/(const ThermoVectorBase<V,T,P>& l, const ThermoScalarBase<VR>& r) -> ThermoVectorBase<decltype(l.val/r.val), decltype(double() * (l.ddT * r.val - l.val * r.ddT)), decltype(double() * (l.ddP * r.val - l.val * r.ddP))>
397 {
398  const double tmp = 1.0/(r.val * r.val);
399  return {l.val/r.val, tmp * (l.ddT * r.val - l.val * r.ddT), tmp * (l.ddP * r.val - l.val * r.ddP)};
400 }
401 
402 template<typename V, typename T, typename P>
403 auto operator/(const ThermoVectorBase<V,T,P>& l, double r) -> decltype((1.0/r) * l)
404 {
405  return (1.0/r) * l;
406 }
407 
408 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
409 auto operator<(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> bool
410 {
411  return l.val < r.val;
412 }
413 
414 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
415 auto operator<=(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> bool
416 {
417  return l.val <= r.val;
418 }
419 
420 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
421 auto operator>(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> bool
422 {
423  return l.val > r.val;
424 }
425 
426 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
427 auto operator>=(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> bool
428 {
429  return l.val >= r.val;
430 }
431 
432 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
433 auto operator==(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> bool
434 {
435  return l.val == r.val;
436 }
437 
438 template<typename VL, typename TL, typename PL, typename VR, typename TR, typename PR>
439 auto operator!=(const ThermoVectorBase<VL,TL,PL>& l, const ThermoVectorBase<VR,TR,PR>& r) -> bool
440 {
441  return l.val == r.val;
442 }
443 
445 template<typename V, typename T, typename P>
446 auto row(ThermoVectorBase<V,T,P>& vec, Index irow) -> ThermoScalarBase<decltype(vec.val[irow])>
447 {
448  return {vec.val[irow], vec.ddT[irow], vec.ddP[irow]};
449 }
450 
452 template<typename V, typename T, typename P>
453 auto row(const ThermoVectorBase<V,T,P>& vec, Index irow) -> ThermoScalarBase<decltype(vec.val[irow])>
454 {
455  return {vec.val[irow], vec.ddT[irow], vec.ddP[irow]};
456 }
457 
459 template<typename V, typename T, typename P>
460 auto rows(ThermoVectorBase<V,T,P>& vec, Index irow, Index nrows) -> ThermoVectorBase<decltype(vec.val.segment(irow, nrows)), decltype(vec.ddT.segment(irow, nrows)), decltype(vec.ddP.segment(irow, nrows))>
461 {
462  return {vec.val.segment(irow, nrows), vec.ddT.segment(irow, nrows), vec.ddP.segment(irow, nrows)};
463 }
464 
466 template<typename V, typename T, typename P>
467 auto rows(const ThermoVectorBase<V,T,P>& vec, Index irow, Index nrows) -> ThermoVectorBase<decltype(vec.val.segment(irow, nrows)), decltype(vec.ddT.segment(irow, nrows)), decltype(vec.ddP.segment(irow, nrows))>
468 {
469  return {vec.val.segment(irow, nrows), vec.ddT.segment(irow, nrows), vec.ddP.segment(irow, nrows)};
470 }
471 
473 template<typename V, typename T, typename P>
474 auto rows(ThermoVectorBase<V,T,P>& vec, const Indices& irows) -> ThermoVectorBase<decltype(Reaktoro::rows(vec.val, irows)), decltype(Reaktoro::rows(vec.ddT, irows)), decltype(Reaktoro::rows(vec.ddP, irows))>
475 {
476  return {Reaktoro::rows(vec.val, irows), Reaktoro::rows(vec.ddT, irows), Reaktoro::rows(vec.ddP, irows)};
477 }
478 
480 template<typename V, typename T, typename P>
481 auto rows(const ThermoVectorBase<V,T,P>& vec, const Indices& irows) -> ThermoVectorBase<decltype(Reaktoro::rows(vec.val, irows)), decltype(Reaktoro::rows(vec.ddT, irows)), decltype(Reaktoro::rows(vec.ddP, irows))>
482 {
483  return {Reaktoro::rows(vec.val, irows), Reaktoro::rows(vec.ddT, irows), Reaktoro::rows(vec.ddP, irows)};
484 }
485 
486 template<typename V, typename T, typename P>
487 auto abs(const ThermoVectorBase<V,T,P>& l) -> ThermoVector
488 {
489  const Vector tmp1 = abs(l.val);
490  const Vector tmp2 = l.val/tmp1;
491  return {tmp1, diag(tmp2) * l.ddT, diag(tmp2) * l.ddP};
492 }
493 
494 template<typename V, typename T, typename P>
495 auto sqrt(const ThermoVectorBase<V,T,P>& l) -> ThermoVector
496 {
497  const Vector tmp1 = sqrt(l.val);
498  const Vector tmp2 = 0.5 * tmp1/l.val;
499  return {tmp1, diag(tmp2) * l.ddT, diag(tmp2) * l.ddP};
500 }
501 
502 template<typename V, typename T, typename P>
503 auto pow(const ThermoVectorBase<V,T,P>& l, double power) -> ThermoVector
504 {
505  const Vector tmp1 = pow(l.val, power);
506  const Vector tmp2 = power * tmp1/l.val;
507  return {tmp1, diag(tmp2) * l.ddT, diag(tmp2) * l.ddP};
508 }
509 
510 template<typename V, typename T, typename P>
511 auto exp(const ThermoVectorBase<V,T,P>& l) -> ThermoVector
512 {
513  const Vector tmp = exp(l.val);
514  return {tmp, diag(tmp) * l.ddT, diag(tmp) * l.ddP};
515 }
516 
517 template<typename V, typename T, typename P>
518 auto log(const ThermoVectorBase<V,T,P>& l) -> ThermoVector
519 {
520  const Vector tmp1 = log(l.val);
521  const Vector tmp2 = 1.0/l.val;
522  return {tmp1, diag(tmp2) * l.ddT, diag(tmp2) * l.ddP};
523 }
524 
525 template<typename V, typename T, typename P>
526 auto log10(const ThermoVectorBase<V,T,P>& l) -> ThermoVector
527 {
528  const double log10e = 0.4342944819032518166679324;
529  const Vector tmp1 = log10e*log(l.val);
530  const Vector tmp2 = log10e/l.val;
531  return {tmp1, diag(tmp2) * l.ddT, diag(tmp2) * l.ddP, diag(tmp2) * l.ddn};
532 }
533 
534 } // namespace Reaktoro
auto operator-=(double other) -> ThermoVectorBase &
Assign-subtraction of a scalar.
Definition: ThermoVector.hpp:202
auto rowsmap(Eigen::Matrix< Scalar, Rows, Cols, Options, MaxRows, MaxCols > &mat, Index row, Index nrows) -> Eigen::Map< Eigen::Matrix< Scalar, Rows, Cols, Options, MaxRows, MaxCols >, Eigen::Unaligned, Eigen::Stride< Rows, Cols >>
Return a mapped view of a sequence of rows of a matrix.
Definition: Matrix.hpp:266
auto operator-=(const ThermoScalarBase< VR > &other) -> ThermoVectorBase &
Assign-subtraction of a ThermoVectorBase instance.
Definition: ThermoVector.hpp:193
auto view(Index irow, Index nrows) const -> ThermoVectorConstRef
Return a view of an interval of the ThermoVectorBase instance.
Definition: ThermoVector.hpp:257
auto operator*=(const ThermoVectorBase< VR, TR, PR > &other) -> ThermoVectorBase &
Assign-multiplication of a ThermoVectorBase instance.
Definition: ThermoVector.hpp:210
auto view(Index irow, Index nrows) -> ThermoVectorRef
Return a view of an interval of the ThermoVectorBase instance.
Definition: ThermoVector.hpp:249
auto size() const -> Index
Return the number of rows in this ChemicalVectorBase instance.
Definition: ThermoVector.hpp:94
ThermoVectorBase< Vector, Vector, Vector > ThermoVector
A type that defines a vector of thermodynamic properties.
Definition: ScalarTypes.hpp:41
auto operator-=(const ThermoVectorBase< VR, TR, PR > &other) -> ThermoVectorBase &
Assign-subtraction of a ThermoVectorBase instance.
Definition: ThermoVector.hpp:183
auto row(ChemicalVectorBase< V, T, P, N > &vec, Index irow) -> ChemicalScalarBase< decltype(vec.val[irow]), decltype(vec.ddn.row(irow))>
Return a ChemicalScalarBase with reference to the chemical scalar in a given row.
Definition: ChemicalVector.hpp:652
V val
The vector of values of the thermodynamic properties.
Definition: ThermoVector.hpp:51
auto operator+=(double scalar) -> ThermoVectorBase &
Assign-addition of a scalar.
Definition: ThermoVector.hpp:175
auto fill(double value) -> void
Assign a scalarsto this.
Definition: ThermoVector.hpp:118
ThermoVectorBase(Index nrows)
Construct a ThermoVectorBase instance with given number of rows.
Definition: ThermoVector.hpp:65
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto operator[](Index irow) const -> ThermoScalarBase< decltype(val[irow])>
Return a ChemicalScalarBase with const reference to the thermo scalar in a given row.
Definition: ThermoVector.hpp:241
auto zeros(const ChemicalVectorBase< V, T, P, N > &v) -> ChemicalVectorBase< decltype(zeros(0)), decltype(zeros(0)), decltype(zeros(0)), decltype(zeros(0, 0))>
Return a ChemicalVectorBase expression representing zeros with same dimension of given vector.
Definition: ChemicalVector.hpp:361
ThermoVectorBase(const V &val, const T &ddT, const P &ddP)
Construct a ChemicalVectorBase instance with given values and derivatives.
Definition: ThermoVector.hpp:78
auto rows(ChemicalVectorBase< V, T, P, N > &vec, Index irow, Index nrows) -> ChemicalVectorBase< decltype(rows(vec.val, irow, nrows)), decltype(rows(vec.ddT, irow, nrows)), decltype(rows(vec.ddP, irow, nrows)), decltype(rows(vec.ddn, irow, nrows))>
Return a reference of a sequence of rows of this ChemicalVectorBase instance.
Definition: ChemicalVector.hpp:680
auto resize(Index nrows) -> void
Resize this ChemicalVectorBase instance with new number of rows.
Definition: ThermoVector.hpp:101
auto operator=(double other) -> ThermoVectorBase &
Assign a scalar to this ThermoVectorBase instance.
Definition: ThermoVector.hpp:146
T ddT
The vector of partial temperature derivatives of the thermodynamic properties.
Definition: ThermoVector.hpp:54
ThermoVectorBase(Index nrows, double val)
Construct a ThermoVectorBase instance with given number of rows and value.
Definition: ThermoVector.hpp:71
ThermoVectorBase()
Construct a default ThermoVectorBase instance.
Definition: ThermoVector.hpp:60
auto fill(const ThermoScalarBase< VR > &other) -> void
Assign a ThermoScalarBase instance to this.
Definition: ThermoVector.hpp:110
auto operator+=(const ThermoScalarBase< VR > &other) -> ThermoVectorBase &
Assign-addition of a ThermoScalarBase instance.
Definition: ThermoVector.hpp:166
auto operator*=(double scalar) -> ThermoVectorBase &
Assign-multiplication of a ThermoVectorBase instance.
Definition: ThermoVector.hpp:219
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
ThermoVectorBase(const ThermoVectorBase< VR, TR, PR > &other)
Construct a ChemicalVectorBase instance from another.
Definition: ThermoVector.hpp:89
auto operator=(const ThermoVectorBase< VR, TR, PR > &other) -> ThermoVectorBase &
Assign a ThermoVectorBase instance to this ThermoVectorBase instance.
Definition: ThermoVector.hpp:127
auto operator=(const ThermoScalarBase< VR > &other) -> ThermoVectorBase &
Assign a ThermoScalarBase instance to this ThermoVectorBase instance.
Definition: ThermoVector.hpp:137
auto operator+=(const ThermoVectorBase< VR, TR, PR > &other) -> ThermoVectorBase &
Assign-addition of a ThermoVectorBase instance.
Definition: ThermoVector.hpp:156
std::vector< Index > Indices
Define a type that represents a collection of indices.
Definition: Index.hpp:29
A template base class to represent a thermodynamic scalar and its partial derivatives.
Definition: ThermoScalar.hpp:45
auto ones(const ChemicalVectorBase< V, T, P, N > &v) -> ChemicalVectorBase< decltype(ones(0)), decltype(zeros(0)), decltype(zeros(0)), decltype(zeros(0, 0))>
Return a ChemicalVectorBase expression representing ones with same dimension of given vector.
Definition: ChemicalVector.hpp:369
auto operator/=(double scalar) -> ThermoVectorBase &
Assign-division of a ThermoVectorBase instance.
Definition: ThermoVector.hpp:228
V val
The value of the thermodynamic property.
Definition: ThermoScalar.hpp:48
auto operator[](Index irow) -> ThermoScalarBase< decltype(val[irow])>
Return a ChemicalScalarBase with reference to the thermo scalar in a given row.
Definition: ThermoVector.hpp:235
Eigen::Ref< const Eigen::VectorXd > VectorConstRef
< Alias to Eigen type Ref<VectorXd>.
Definition: Matrix.hpp:31
P ddP
The vector of partial pressure derivatives of the thermodynamic properties.
Definition: ThermoVector.hpp:57
ThermoVectorBase(ThermoVectorBase< VR, TR, PR > &other)
Construct a ChemicalVectorBase instance from another.
Definition: ThermoVector.hpp:83
auto diag(const Eigen::MatrixBase< Derived > &vec) -> decltype(vec.asDiagonal())
Return a diagonal matrix representation of a vector.
Definition: Matrix.hxx:185
A template base class to represent a vector of thermodynamic scalars and their partial derivatives.
Definition: ThermoVector.hpp:48