15#include <pybind11/eigen.h>
16#include <pybind11/pybind11.h>
17#include <pybind11/stl.h>
18#include <spdlog/spdlog.h>
21#include <range/v3/algorithm/copy.hpp>
22#include <range/v3/numeric.hpp>
23#include <range/v3/range/conversion.hpp>
24#include <range/v3/view/enumerate.hpp>
25#include <range/v3/view/indirect.hpp>
26#include <range/v3/view/join.hpp>
27#include <range/v3/view/map.hpp>
28#include <range/v3/view/transform.hpp>
52 std::vector<int> cells;
53 std::vector<int> cell_types;
54 for (
auto const* element : elements)
56 cells.push_back(
static_cast<int>(element->getNumberOfNodes()));
58 std::back_inserter(cells));
61 return {cells, cell_types};
65 std::vector<double>
const& values,
66 std::size_t
const number_of_components)
68 auto* pv = MeshLib::getOrCreateMeshProperty<double>(
72 OGS_FATAL(
"Couldn't access cell/element property '{}'.", name);
74 if (pv->size() != values.size())
77 "OGSMesh::setPointDataArray: size mismatch: property vector has "
78 "size '{}', while the number of values is '{}'.",
79 pv->size(), values.size());
81 std::copy(values.begin(), values.end(), pv->data());
85 std::string
const& name, std::size_t
const number_of_components)
const
87 auto const* pv = MeshLib::getOrCreateMeshProperty<double>(
91 OGS_FATAL(
"Couldn't access point/node property '{}'.", name);
93 return ranges::to<std::vector>(std::span(pv->data(), pv->size()));
97 std::vector<double>
const& values,
98 std::size_t
const number_of_components)
100 auto* pv = MeshLib::getOrCreateMeshProperty<double>(
104 OGS_FATAL(
"Couldn't access cell/element property '{}'.", name);
106 if (pv->size() != values.size())
109 "OGSMesh::setCellDataArray: size mismatch: property vector has "
110 "size '{}', while the number of values is '{}'.",
111 pv->size(), values.size());
113 std::copy(values.begin(), values.end(), pv->data());
117 std::string
const& name, std::size_t
const number_of_components)
const
119 auto const* pv = MeshLib::getOrCreateMeshProperty<double>(
123 OGS_FATAL(
"Couldn't access cell/element property '{}'.", name);
125 return ranges::to<std::vector>(std::span(pv->data(), pv->size()));
Definition of the Element class.
Definition of the Mesh class.
Definition of the Node class.
int OGSToVtkCellType(MeshLib::CellType ogs)
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
void setPointDataArray(std::string const &name, std::vector< double > const &values, std::size_t const number_of_components)
std::vector< double > getPointDataArray(std::string const &name, std::size_t const number_of_components=1) const
void setCellDataArray(std::string const &name, std::vector< double > const &values, std::size_t const number_of_components)
std::vector< double > getPointCoordinates() const
OGSMesh(MeshLib::Mesh &mesh)
std::pair< std::vector< int >, std::vector< int > > getCells() const
std::vector< double > getCellDataArray(std::string const &name, std::size_t const number_of_components) const
constexpr ranges::views::view_closure ids
For an element of a range view return its id.
constexpr ranges::views::view_closure coords