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)
58 std::back_inserter(cells));
61 return {cells, cell_types};
65 std::vector<double>
const& values,
66 std::size_t
const number_of_components)
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
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)
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
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
PropertyVector< T > * getOrCreateMeshProperty(Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)