16#include <pybind11/eigen.h>
17#include <pybind11/pybind11.h>
18#include <pybind11/stl.h>
19#include <spdlog/spdlog.h>
22#include <range/v3/algorithm/copy.hpp>
23#include <range/v3/numeric.hpp>
24#include <range/v3/range/conversion.hpp>
25#include <range/v3/view/enumerate.hpp>
26#include <range/v3/view/indirect.hpp>
27#include <range/v3/view/join.hpp>
28#include <range/v3/view/map.hpp>
29#include <range/v3/view/transform.hpp>
53 std::vector<int> cells;
54 std::vector<int> cell_types;
55 for (
auto const* element : elements)
57 cells.push_back(
static_cast<int>(element->getNumberOfNodes()));
59 std::back_inserter(cells));
62 return {cells, cell_types};
66 std::vector<double>
const& values,
67 std::size_t
const number_of_components)
69 auto* pv = MeshLib::getOrCreateMeshProperty<double>(
73 OGS_FATAL(
"Couldn't access cell/element property '{}'.", name);
75 if (pv->size() != values.size())
78 "OGSMesh::setPointDataArray: size mismatch: property vector has "
79 "size '{}', while the number of values is '{}'.",
80 pv->size(), values.size());
82 std::copy(values.begin(), values.end(), pv->data());
86 std::string
const& name, std::size_t
const number_of_components)
const
88 auto const* pv = MeshLib::getOrCreateMeshProperty<double>(
92 OGS_FATAL(
"Couldn't access point/node property '{}'.", name);
94 return ranges::to<std::vector>(std::span(pv->data(), pv->size()));
98 std::vector<double>
const& values,
99 std::size_t
const number_of_components)
101 auto* pv = MeshLib::getOrCreateMeshProperty<double>(
105 OGS_FATAL(
"Couldn't access cell/element property '{}'.", name);
107 if (pv->size() != values.size())
110 "OGSMesh::setCellDataArray: size mismatch: property vector has "
111 "size '{}', while the number of values is '{}'.",
112 pv->size(), values.size());
114 std::copy(values.begin(), values.end(), pv->data());
118 std::string
const& name, std::size_t
const number_of_components)
const
120 auto const* pv = MeshLib::getOrCreateMeshProperty<double>(
124 OGS_FATAL(
"Couldn't access cell/element property '{}'.", name);
126 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