9#ifndef __df4311acf6554f11919b7b1edfc5b3dd
10#define __df4311acf6554f11919b7b1edfc5b3dd
12#include <lf/mesh/mesh.h>
14#include <boost/container/vector.hpp>
16#include "lf/base/lf_assert.h"
17#include "mesh_data_set.h"
46 [[nodiscard]] T& operator()(const
Entity& e) {
47 LF_ASSERT_MSG(
DefinedOn(e),
"MeshDataSet is not defined on this entity.");
52 LF_ASSERT_MSG(
DefinedOn(e),
"MeshDataSet is not defined on this entity.");
56 return mesh_->Contains(e);
67 const std::shared_ptr<const lf::mesh::Mesh>& mesh)
73 data_[codim].resize(
mesh_->NumEntities(codim));
86 class =
typename std::enable_if_t<std::is_convertible_v<X, T> &&
87 std::is_copy_constructible_v<X>>>
96 boost::container::vector<T>(
mesh_->NumEntities(codim), init_value);
102 std::shared_ptr<const lf::mesh::Mesh>
mesh_;
107 boost::container::vector<boost::container::vector<T>>
data_;
119 const std::shared_ptr<const lf::mesh::Mesh>& mesh) {
122 return std::shared_ptr<impl_t>(t);
132template <
class T,
class =
typename std::enable_if<
133 std::is_copy_constructible<T>::value>::type>
135 const std::shared_ptr<const lf::mesh::Mesh>& mesh, T init_value) {
137 return std::shared_ptr<impl_t>(
new impl_t(mesh, init_value));
Interface class representing a topological entity in a cellular complex
virtual unsigned Codim() const =0
The codimension of this entity w.r.t. the Mesh.dimMesh() of the owning mesh manager.
lf::base::size_type size_type
Assigns to every entity(all codims) in a mesh a value of type T
const T & operator()(const Entity &e) const override
Get the data stored with entity e.
Mesh::size_type size_type
bool DefinedOn(const Entity &e) const override
Does the dataset store information with this entity?
AllCodimMeshDataSet(const std::shared_ptr< const lf::mesh::Mesh > &mesh)
set up default-initialized data arrays
boost::container::vector< boost::container::vector< T > > data_
std::shared_ptr< const lf::mesh::Mesh > mesh_
AllCodimMeshDataSet(AllCodimMeshDataSet &&) noexcept=default
AllCodimMeshDataSet(const AllCodimMeshDataSet &)=delete
AllCodimMeshDataSet(const std::shared_ptr< const lf::mesh::Mesh > &mesh, X init_value)
Set up data array for entities and initialize it with a given value.
Interface that specifies how data is stored with an entity.
Contains helper functions and classes that all operate on the interface classes defined in lf::mesh.
std::shared_ptr< AllCodimMeshDataSet< T > > make_AllCodimMeshDataSet(const std::shared_ptr< const lf::mesh::Mesh > &mesh)
Create a new AllCodimMeshDataSet and Default initialize the data.