19#ifndef OPM_PY_MATERIAL_STATE_IMPL_HEADER_INCLUDED
20#define OPM_PY_MATERIAL_STATE_IMPL_HEADER_INCLUDED
23#ifndef OPM_PY_MATERIAL_STATE_HEADER_INCLUDED
28#include <fmt/format.h>
32template <
class TypeTag>
37 Model& model = this->simulator_->model();
38 const auto size = model.numGridDof();
39 std::vector<double> array(size);
40 for (
unsigned dof_idx = 0; dof_idx < size; ++dof_idx) {
41 array[dof_idx] = model.dofTotalVolume(dof_idx);
46template <
class TypeTag>
51 Problem& problem = this->simulator_->problem();
52 Model& model = this->simulator_->model();
53 const auto size = model.numGridDof();
54 std::vector<double> array(size);
55 for (
unsigned dof_idx = 0; dof_idx < size; ++dof_idx) {
56 array[dof_idx] = problem.referencePorosity(dof_idx, 0);
61template <
class TypeTag>
66 Problem& problem = this->simulator_->problem();
67 Model& model = this->simulator_->model();
68 const auto model_size = model.numGridDof();
69 if (model_size != size) {
70 const std::string msg = fmt::format(
71 "Cannot set porosity. Expected array of size: {}, got array of size: ",
74 throw std::runtime_error(msg);
76 for (
unsigned dof_idx = 0; dof_idx < size; ++dof_idx) {
77 problem.setPorosity(poro[dof_idx], dof_idx);
std::vector< double > getPorosity()
Definition: PyMaterialState_impl.hpp:49
void setPorosity(const double *poro, std::size_t size)
Definition: PyMaterialState_impl.hpp:64
std::vector< double > getCellVolumes()
Definition: PyMaterialState_impl.hpp:35
Definition: PyBaseSimulator.hpp:41