opm-common
DynamicEvaluation.hpp
Go to the documentation of this file.
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 /*
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM 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 2 of the License, or
9  (at your option) any later version.
10 
11  OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
18 
19  Consult the COPYING file in the top-level source directory of this
20  module for the precise wording of the license and the list of
21  copyright holders.
22 */
32 #ifndef OPM_DENSEAD_EVALUATION_DYNAMIC_HPP
33 #define OPM_DENSEAD_EVALUATION_DYNAMIC_HPP
34 
35 #ifndef NDEBUG
37 #endif
39 #include <cstddef>
40 
41 #include <cassert>
42 #include <iosfwd>
43 #include <stdexcept>
44 
45 #include <opm/common/ErrorMacros.hpp>
46 #include <opm/common/utility/gpuDecorators.hpp>
47 
48 namespace Opm {
49 namespace DenseAd {
50 
55 template <class ValueT, unsigned staticSize>
56 class Evaluation<ValueT, DynamicSize, staticSize>
57 {
58 public:
61  static const int numVars = DynamicSize;
62 
64  typedef ValueT ValueType;
65 
67  OPM_HOST_DEVICE int size() const
68  { return data_.size() - 1; }
69 
70 protected:
72  OPM_HOST_DEVICE int length_() const
73  { return data_.size(); }
74 
75 
77  OPM_HOST_DEVICE constexpr int valuepos_() const
78  { return 0; }
80  OPM_HOST_DEVICE constexpr int dstart_() const
81  { return 1; }
83  OPM_HOST_DEVICE int dend_() const
84  { return length_(); }
85 
88  OPM_HOST_DEVICE constexpr void checkDefined_() const
89  {
90 #ifndef NDEBUG
91  for (int i = dstart_(); i < dend_(); ++i)
92  Valgrind::CheckDefined(data_[i]);
93 #endif
94  }
95 
96 public:
98  OPM_HOST_DEVICE Evaluation() : data_()
99  {}
100 
102  Evaluation(const Evaluation& other) = default;
103 
106  OPM_HOST_DEVICE Evaluation(Evaluation&& other)
107  : data_(std::move(other.data_))
108  { }
109 
111  OPM_HOST_DEVICE Evaluation& operator=(Evaluation&& other)
112  {
113  data_ = std::move(other.data_);
114  return *this;
115  }
116 
117  // create a dynamic evaluation which represents a constant function
118  //
119  // i.e., f(x) = c. this implies an evaluation with the given value and all
120  // derivatives being zero.
121  template <class RhsValueType>
122  OPM_HOST_DEVICE Evaluation(int numDerivatives, const RhsValueType& c)
123  : data_(1 + numDerivatives, 0.0)
124  {
125  //clearDerivatives();
126  setValue(c);
127 
128  checkDefined_();
129  }
130 
131  // create a dynamic evaluation which represents a constant function
132  // by using zero number of derivatives.
133  //
134  // i.e., f(x) = c. this implies an evaluation with the given value and all
135  // derivatives being zero.
136  template <class RhsValueType>
137  OPM_HOST_DEVICE Evaluation(const RhsValueType& c)
138  : Evaluation(0, c)
139  {
140  }
141 
142  // create an evaluation representing a variable with the variable position of varPos
143  // The value is set to c, all derivatives are zero except for the one at varPos, which is set to 1.
144  template <class RhsValueType>
145  OPM_HOST_DEVICE Evaluation(int nVars, const RhsValueType& c, int varPos)
146  : data_(1 + nVars, 0.0)
147  {
148  // The variable position must be in represented by the given variable descriptor
149  assert(0 <= varPos && varPos < size());
150 
151  setValue(c);
152 
153  data_[varPos + dstart_()] = 1.0;
154 
155  checkDefined_();
156  }
157 
158  // set all derivatives to zero
159  OPM_HOST_DEVICE constexpr void clearDerivatives()
160  {
161  for (int i = dstart_(); i < dend_(); ++i)
162  data_[i] = 0.0;
163  }
164 
165  // create an uninitialized Evaluation object that is compatible with the
166  // argument, but not initialized
167  //
168  // This basically boils down to the copy constructor without copying
169  // anything. If the number of derivatives is known at compile time, this
170  // is equivalent to creating an uninitialized object using the default
171  // constructor, while for dynamic evaluations, it creates an Evaluation
172  // object which exhibits the same number of derivatives as the argument.
173  OPM_HOST_DEVICE static Evaluation createBlank(const Evaluation& x)
174  { return Evaluation(x.size()); }
175 
176  // create an Evaluation with value and all the derivatives to be zero
177  OPM_HOST_DEVICE static Evaluation createConstantZero(const Evaluation& x)
178  { return Evaluation(x.size(), 0.0); }
179 
180  // create an Evaluation with value to be one and all the derivatives to be zero
181  OPM_HOST_DEVICE static Evaluation createConstantOne(const Evaluation& x)
182  { return Evaluation(x.size(), 1.); }
183 
184  // create a function evaluation for a "naked" depending variable (i.e., f(x) = x)
185  template <class RhsValueType>
186  OPM_HOST_DEVICE static Evaluation createVariable(const RhsValueType&, int)
187  {
188  OPM_THROW(std::logic_error, "Dynamically sized evaluations require that the number of "
189  "derivatives is specified when creating an evaluation");
190  }
191 
192  template <class RhsValueType>
193  OPM_HOST_DEVICE static Evaluation createVariable(int nVars, const RhsValueType& value, int varPos)
194  {
195  // copy function value and set all derivatives to 0, except for the variable
196  // which is represented by the value (which is set to 1.0)
197  return Evaluation(nVars, value, varPos);
198  }
199 
200  template <class RhsValueType>
201  OPM_HOST_DEVICE static Evaluation createVariable(const Evaluation& x, const RhsValueType& value, int varPos)
202  {
203  // copy function value and set all derivatives to 0, except for the variable
204  // which is represented by the value (which is set to 1.0)
205  return Evaluation(x.size(), value, varPos);
206  }
207 
208 
209  // "evaluate" a constant function (i.e. a function that does not depend on the set of
210  // relevant variables, f(x) = c).
211  template <class RhsValueType>
212  OPM_HOST_DEVICE static Evaluation createConstant(int nVars, const RhsValueType& value)
213  {
214  return Evaluation(nVars, value);
215  }
216 
217  // "evaluate" a constant function (i.e. a function that does not depend on the set of
218  // relevant variables, f(x) = c).
219  template <class RhsValueType>
220  OPM_HOST_DEVICE static Evaluation createConstant(const RhsValueType& value)
221  {
222  // using an evaluation without derivatives
223  return Evaluation(value);
224  }
225 
226  // "evaluate" a constant function (i.e. a function that does not depend on the set of
227  // relevant variables, f(x) = c).
228  template <class RhsValueType>
229  OPM_HOST_DEVICE static Evaluation createConstant(const Evaluation& x, const RhsValueType& value)
230  {
231  return Evaluation(x.size(), value);
232  }
233 
234  // copy all derivatives from other
235  OPM_HOST_DEVICE void copyDerivatives(const Evaluation& other)
236  {
237  assert(size() == other.size());
238 
239  for (int i = dstart_(); i < dend_(); ++i)
240  data_[i] = other.data_[i];
241  }
242 
243 
244  // add value and derivatives from other to this value and derivatives
245  OPM_HOST_DEVICE Evaluation& operator+=(const Evaluation& other)
246  {
247  const int thisSize = size();
248  const int otherSize = other.size();
249 
250  // Allow operation if sizes match or one is constant (size == 0)
251  assert(thisSize == otherSize || thisSize == 0 || otherSize == 0);
252 
253  if (thisSize == otherSize) {
254  for (int i = 0; i < length_(); ++i)
255  data_[i] += other.data_[i];
256  return *this;
257  }
258  if (otherSize == 0) {
259  *this += other.value();
260  return *this;
261  }
262  if (thisSize == 0) {
263  assert(otherSize > 0);
264  this->appendDerivativesToConstant(otherSize);
265  data_[valuepos_()] += other.data_[valuepos_()];
266  for (int i = dstart_(); i < dend_(); ++i)
267  data_[i] = other.data_[i];
268  return *this;
269  }
270  OPM_THROW(std::logic_error,
271  "Cannot operate Evaluations with different number of derivatives "
272  "unless one of them has no derivatives");
273  }
274 
275  // add value from other to this values
276  template <class RhsValueType>
277  OPM_HOST_DEVICE Evaluation& operator+=(const RhsValueType& other)
278  {
279  // value is added, derivatives stay the same
280  data_[valuepos_()] += other;
281 
282  return *this;
283  }
284 
285  // subtract other's value and derivatives from this values
286  OPM_HOST_DEVICE Evaluation& operator-=(const Evaluation& other)
287  {
288  const int thisSize = size();
289  const int otherSize = other.size();
290 
291  // Allow operation if sizes match or one is constant (size == 0)
292  assert(thisSize == otherSize || thisSize == 0 || otherSize == 0);
293 
294  if (thisSize == otherSize) {
295  for (int i = 0; i < length_(); ++i)
296  data_[i] -= other.data_[i];
297  return *this;
298  }
299  if (otherSize == 0) {
300  *this -= other.value();
301  return *this;
302  }
303  if (thisSize == 0) {
304  assert(otherSize > 0);
305  this->appendDerivativesToConstant(otherSize);
306  for (int i = 0; i < other.length_(); ++i)
307  data_[i] -= other.data_[i];
308  return *this;
309  }
310  OPM_THROW(std::logic_error,
311  "Cannot operate Evaluations with different number of derivatives "
312  "unless one of them has no derivatives");
313  }
314 
315  // subtract other's value from this values
316  template <class RhsValueType>
317  OPM_HOST_DEVICE Evaluation& operator-=(const RhsValueType& other)
318  {
319  // for constants, values are subtracted, derivatives stay the same
320  data_[valuepos_()] -= other;
321 
322  return *this;
323  }
324 
325  // multiply values and apply chain rule to derivatives: (u*v)' = (v'u + u'v)
326  OPM_HOST_DEVICE Evaluation& operator*=(const Evaluation& other)
327  {
328  const int thisSize = size();
329  const int otherSize = other.size();
330 
331  // Allow operation if sizes match or one is constant (size == 0)
332  assert(thisSize == otherSize || thisSize == 0 || otherSize == 0);
333 
334  if (thisSize == otherSize) {
335  // while the values are multiplied, the derivatives follow the product rule,
336  // i.e., (u*v)' = (v'u + u'v).
337  const ValueType u = this->value();
338  const ValueType v = other.value();
339 
340  // value
341  data_[valuepos_()] *= v ;
342 
343  // derivatives
344  for (int i = dstart_(); i < dend_(); ++i)
345  data_[i] = data_[i] * v + other.data_[i] * u;
346 
347  return *this;
348  }
349 
350  if (otherSize == 0) {
351  *this *= other.value();
352  return *this;
353  }
354 
355  if (thisSize == 0) {
356  assert(otherSize > 0);
357  this->appendDerivativesToConstant(otherSize);
358  const ValueType u = this->value();
359  for (int i = 0; i < length_(); ++i) {
360  data_[i] = u * other.data_[i];
361  }
362  return *this;
363  }
364  OPM_THROW(std::logic_error,
365  "Cannot operate Evaluations with different number of derivatives "
366  "unless one of them has no derivatives");
367  }
368 
369  // m(c*u)' = c*u'
370  template <class RhsValueType>
371  OPM_HOST_DEVICE Evaluation& operator*=(const RhsValueType& other)
372  {
373  for (int i = 0; i < length_(); ++i)
374  data_[i] *= other;
375 
376  return *this;
377  }
378 
379  // m(u*v)' = (vu' - uv')/v^2
380  OPM_HOST_DEVICE Evaluation& operator/=(const Evaluation& other)
381  {
382  const int thisSize = size();
383  const int otherSize = other.size();
384 
385  // Allow operation if sizes match or one is constant (size == 0)
386  assert(thisSize == otherSize || thisSize == 0 || otherSize == 0);
387 
388  if (thisSize == otherSize) {
389  // while the values are divided, the derivatives follow the rule for division,
390  // i.e., (u/v)' = (v'u - u'v)/v^2.
391  ValueType& u = data_[valuepos_()];
392  const ValueType& v = other.value();
393 
394  // derivatives
395  for (int idx = dstart_(); idx < dend_(); ++idx) {
396  const ValueType& uPrime = data_[idx];
397  const ValueType& vPrime = other.data_[idx];
398 
399  data_[idx] = (v*uPrime - u*vPrime)/(v*v);
400  }
401 
402  // value
403  u /= v;
404 
405  return *this;
406  }
407 
408  if (otherSize == 0) {
409  *this /= other.value();
410  return *this;
411  }
412 
413  if (thisSize == 0) {
414  assert(otherSize > 0);
415  // if *this is a constant, extend to hold derivatives before division
416  this->appendDerivativesToConstant(otherSize);
417 
418  // values are divided, derivatives follow the rule for division, i.e., (u/v)' = (v'u -
419  // u'v)/v^2.
420  ValueType& u = data_[valuepos_()];
421  const ValueType& v = other.value();
422  for (int idx = dstart_(); idx < dend_(); ++idx) {
423  const ValueType& vPrime = other.data_[idx];
424  data_[idx] = -u * vPrime / (v * v);
425  }
426  u /= v;
427 
428  return *this;
429  }
430  OPM_THROW(std::logic_error,
431  "Cannot operate Evaluations with different number of derivatives "
432  "unless one of them has no derivatives");
433  }
434 
435  // divide value and derivatives by value of other
436  template <class RhsValueType>
437  OPM_HOST_DEVICE Evaluation& operator/=(const RhsValueType& other)
438  {
439  const ValueType tmp = 1.0/other;
440 
441  for (int i = 0; i < length_(); ++i)
442  data_[i] *= tmp;
443 
444  return *this;
445  }
446 
447  // add two evaluation objects
448  OPM_HOST_DEVICE Evaluation operator+(const Evaluation& other) const
449  {
450 #ifndef NDEBUG
451  const int thisSize = size();
452  const int otherSize = other.size();
453 
454  // Allow operation if sizes match or one is constant (size == 0)
455  assert(thisSize == otherSize || thisSize == 0 || otherSize == 0);
456 #endif
457 
458  Evaluation result(*this);
459 
460  result += other;
461 
462  return result;
463  }
464 
465  // add constant to this object
466  template <class RhsValueType>
467  OPM_HOST_DEVICE Evaluation operator+(const RhsValueType& other) const
468  {
469  Evaluation result(*this);
470 
471  result += other;
472 
473  return result;
474  }
475 
476  // subtract two evaluation objects
477  OPM_HOST_DEVICE Evaluation operator-(const Evaluation& other) const
478  {
479 #ifndef NDEBUG
480  const int thisSize = size();
481  const int otherSize = other.size();
482 
483  // Allow operation if sizes match or one is constant (size == 0)
484  assert(thisSize == otherSize || thisSize == 0 || otherSize == 0);
485 #endif
486 
487  Evaluation result(*this);
488 
489  result -= other;
490 
491  return result;
492  }
493 
494  // subtract constant from evaluation object
495  template <class RhsValueType>
496  OPM_HOST_DEVICE Evaluation operator-(const RhsValueType& other) const
497  {
498  Evaluation result(*this);
499 
500  result -= other;
501 
502  return result;
503  }
504 
505  // negation (unary minus) operator
506  OPM_HOST_DEVICE Evaluation operator-() const
507  {
508  Evaluation result(*this);
509 
510  // set value and derivatives to negative
511  for (int i = 0; i < length_(); ++i)
512  result.data_[i] = - data_[i];
513 
514  return result;
515  }
516 
517  OPM_HOST_DEVICE Evaluation operator*(const Evaluation& other) const
518  {
519 #ifndef NDEBUG
520  const int thisSize = size();
521  const int otherSize = other.size();
522 
523  // Allow operation if sizes match or one is constant (size == 0)
524  assert(thisSize == otherSize || thisSize == 0 || otherSize == 0);
525 #endif
526 
527  Evaluation result(*this);
528 
529  result *= other;
530 
531  return result;
532  }
533 
534  template <class RhsValueType>
535  OPM_HOST_DEVICE Evaluation operator*(const RhsValueType& other) const
536  {
537  Evaluation result(*this);
538 
539  result *= other;
540 
541  return result;
542  }
543 
544  OPM_HOST_DEVICE Evaluation operator/(const Evaluation& other) const
545  {
546 #ifndef NDEBUG
547  const int thisSize = size();
548  const int otherSize = other.size();
549 
550  // Allow operation if sizes match or one is constant (size == 0)
551  assert(thisSize == otherSize || thisSize == 0 || otherSize == 0);
552 #endif
553 
554  Evaluation result(*this);
555 
556  result /= other;
557 
558  return result;
559  }
560 
561  template <class RhsValueType>
562  OPM_HOST_DEVICE Evaluation operator/(const RhsValueType& other) const
563  {
564  Evaluation result(*this);
565 
566  result /= other;
567 
568  return result;
569  }
570 
571  template <class RhsValueType>
572  OPM_HOST_DEVICE Evaluation& operator=(const RhsValueType& other)
573  {
574  setValue( other );
575  clearDerivatives();
576 
577  return *this;
578  }
579 
580  // copy assignment from evaluation
581  Evaluation& operator=(const Evaluation& other) = default;
582 
583  template <class RhsValueType>
584  OPM_HOST_DEVICE bool operator==(const RhsValueType& other) const
585  { return value() == other; }
586 
587  OPM_HOST_DEVICE bool operator==(const Evaluation& other) const
588  {
589  const int thisSize = size();
590  const int otherSize = other.size();
591 
592  // Allow operation if sizes match or one is constant (size == 0)
593  assert(thisSize == otherSize || thisSize == 0 || otherSize == 0);
594 
595  if (thisSize == otherSize) {
596  for (int idx = 0; idx < length_(); ++idx) {
597  if (data_[idx] != other.data_[idx]) {
598  return false;
599  }
600  }
601  } else {
602  return value() == other.value();
603  }
604  return true;
605  }
606 
607  OPM_HOST_DEVICE bool operator!=(const Evaluation& other) const
608  { return !operator==(other); }
609 
610  template <class RhsValueType>
611  OPM_HOST_DEVICE bool operator!=(const RhsValueType& other) const
612  { return !operator==(other); }
613 
614  template <class RhsValueType>
615  OPM_HOST_DEVICE bool operator>(RhsValueType other) const
616  { return value() > other; }
617 
618  OPM_HOST_DEVICE bool operator>(const Evaluation& other) const
619  {
620  assert(size() == other.size() || size() == 0 || other.size() == 0);
621 
622  return value() > other.value();
623  }
624 
625  template <class RhsValueType>
626  OPM_HOST_DEVICE bool operator<(RhsValueType other) const
627  { return value() < other; }
628 
629  OPM_HOST_DEVICE bool operator<(const Evaluation& other) const
630  {
631  assert(size() == other.size() || size() == 0 || other.size() == 0);
632 
633  return value() < other.value();
634  }
635 
636  template <class RhsValueType>
637  OPM_HOST_DEVICE bool operator>=(RhsValueType other) const
638  { return value() >= other; }
639 
640  OPM_HOST_DEVICE bool operator>=(const Evaluation& other) const
641  {
642  assert(size() == other.size() || size() == 0 || other.size() == 0);
643 
644  return value() >= other.value();
645  }
646 
647  template <class RhsValueType>
648  OPM_HOST_DEVICE bool operator<=(RhsValueType other) const
649  { return value() <= other; }
650 
651  OPM_HOST_DEVICE bool operator<=(const Evaluation& other) const
652  {
653  assert(size() == other.size() || size() == 0 || other.size() == 0);
654 
655  return value() <= other.value();
656  }
657 
658  // return value of variable
659  OPM_HOST_DEVICE const ValueType& value() const
660  { return data_[valuepos_()]; }
661 
662  // set value of variable
663  template <class RhsValueType>
664  OPM_HOST_DEVICE constexpr void setValue(const RhsValueType& val)
665  {
666  if (data_.size() == 0) {
667  data_.resize(1);
668  }
669  data_[valuepos_()] = val;
670  }
671 
672  // return varIdx'th derivative
673  OPM_HOST_DEVICE const ValueType& derivative(int varIdx) const
674  {
675  assert(size() == 0 || (0 <= varIdx && varIdx < size()) );
676 
677  if (size() == 0) {
678  static const ValueType zero {0.0};
679  return zero;
680  }
681 
682  return data_[dstart_() + varIdx];
683  }
684 
685  // set derivative at position varIdx
686  OPM_HOST_DEVICE void setDerivative(int varIdx, const ValueType& derVal, const int nVars = -1)
687  {
688  // if size() == 0, we need nVars to be positive to extend the number of derivatives
689  // if size() > 0, nVars must be either negative (i.e. ignore) or match size()
690  assert( (size() == 0 && nVars > 0) ||
691  ((size() > 0 && (nVars < 0 || nVars == size()))) );
692 
693  if (size() == 0) {
694  if (nVars < 0) {
695  OPM_THROW(std::logic_error, "Cannot set derivative for a DynamicEvaluation initialized from a scalar "
696  "without specifying a positive number of derivatives");
697  }
698 
699  this->appendDerivativesToConstant(nVars);
700  }
701 
702  assert(0 <= varIdx && varIdx < size());
703 
704  data_[dstart_() + varIdx] = derVal;
705  }
706 
707  template<class Serializer>
708  OPM_HOST_DEVICE void serializeOp(Serializer& serializer)
709  {
710  serializer(data_);
711  }
712 
713 private:
714  FastSmallVector<ValueT, staticSize> data_;
715 
716  void appendDerivativesToConstant(std::size_t numDer) {
717  assert(size() == 0); // we only append derivatives to a constant
718  if (numDer > 0) {
719  data_.resize(1 + numDer);
720  }
721  }
722 };
723 
724 template <class Scalar, unsigned staticSize = 0>
725 using DynamicEvaluation = Evaluation<Scalar, DynamicSize, staticSize>;
726 
727 } // namespace DenseAd
728 
729 template <class Scalar, unsigned staticSize>
730 OPM_HOST_DEVICE DenseAd::Evaluation<Scalar, -1, staticSize> constant(int numDerivatives, const Scalar& value)
731 { return DenseAd::Evaluation<Scalar, -1, staticSize>::createConstant(numDerivatives, value); }
732 
733 template <class Scalar, unsigned staticSize>
734 OPM_HOST_DEVICE DenseAd::Evaluation<Scalar, -1, staticSize> variable(int numDerivatives, const Scalar& value, unsigned idx)
735 { return DenseAd::Evaluation<Scalar, -1, staticSize>::createVariable(numDerivatives, value, idx); }
736 
737 } // namespace Opm
738 
739 #endif // OPM_DENSEAD_EVALUATION_DYNAMIC_HPP
OPM_HOST_DEVICE constexpr int dstart_() const
start index for derivatives
Definition: Evaluation.hpp:87
OPM_HOST_DEVICE Evaluation & operator=(Evaluation &&other)
move assignment
Definition: DynamicEvaluation.hpp:111
OPM_HOST_DEVICE int length_() const
length of internal data vector
Definition: DynamicEvaluation.hpp:72
OPM_HOST_DEVICE int dend_() const
end+1 index for derivatives
Definition: DynamicEvaluation.hpp:83
OPM_HOST_DEVICE constexpr void checkDefined_() const
instruct valgrind to check that the value and all derivatives of the Evaluation object are well-defin...
Definition: DynamicEvaluation.hpp:88
OPM_HOST_DEVICE int size() const
number of derivatives
Definition: DynamicEvaluation.hpp:67
OPM_HOST_DEVICE constexpr void checkDefined_() const
instruct valgrind to check that the value and all derivatives of the Evaluation object are well-defin...
Definition: Evaluation.hpp:95
OPM_HOST_DEVICE constexpr int valuepos_() const
position index for value
Definition: Evaluation.hpp:84
OPM_HOST_DEVICE Evaluation()
default constructor
Definition: Evaluation.hpp:105
OPM_HOST_DEVICE constexpr int length_() const
length of internal data vector
Definition: Evaluation.hpp:79
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
ValueT ValueType
field type
Definition: DynamicEvaluation.hpp:64
ValueT ValueType
field type
Definition: Evaluation.hpp:71
OPM_HOST_DEVICE constexpr int size() const
number of derivatives
Definition: Evaluation.hpp:74
static const int numVars
the template argument which specifies the number of derivatives (-1 == "DynamicSize" means runtime de...
Definition: Evaluation.hpp:68
OPM_HOST_DEVICE Evaluation()
default constructor
Definition: DynamicEvaluation.hpp:98
OPM_HOST_DEVICE constexpr int dstart_() const
start index for derivatives
Definition: DynamicEvaluation.hpp:80
OPM_HOST_DEVICE constexpr int valuepos_() const
position index for value
Definition: DynamicEvaluation.hpp:77
Some templates to wrap the valgrind client request macros.
Represents a function evaluation and its derivatives w.r.t.
Definition: Evaluation.hpp:63
An implementation of vector/array based on small object optimization.
OPM_HOST_DEVICE constexpr int dend_() const
end+1 index for derivatives
Definition: Evaluation.hpp:90
OPM_HOST_DEVICE Evaluation(Evaluation &&other)
move other function evaluation (this only makes sense for dynamically allocated Evaluations) ...
Definition: DynamicEvaluation.hpp:106