Wildmeshing Toolkit
AttributeTransferStrategyBase.hpp
Go to the documentation of this file.
1 
2 #pragma once
3 #include <variant>
4 //#include <wmtk/utils/Rational.hpp>
5 #include <wmtk/Tuple.hpp>
6 #include <wmtk/Types.hpp>
9 // #include "NewAttributeStrategy.hpp"
10 
11 namespace wmtk {
12 class Mesh;
13 namespace simplex {
14 class Simplex;
15 }
16 } // namespace wmtk
17 
18 namespace wmtk::operations {
19 
20 
22 {
23 public:
26  // placeholder for when this turns into a DAG that needs to be linearized
27  // using HandleVariant = std::variant<
28  // attribute::MeshAttributeHandle<double>,
29  // attribute::MeshAttributeHandle<int64_t>,
30  // attribute::MeshAttributeHandle<char>,
31  // attribute::MeshAttributeHandle<Rational>>;
32 
33  // if you map a j-simplex to a k-simplex then
34  // if j < k: the system evaluates the function at every j-simplex that is a face of k
35  // if k < j: the system evaluates the function at every j-simplex that is a coface of k
36  // if j == k: the system assumes a point-wise update with no neighbors
37  //
38  static std::vector<Tuple> get_parent_simplices(
39  const Mesh& m,
40  const Mesh& parent,
41  const simplex::Simplex& s,
42  PrimitiveType parent_primitive_type);
43 
44  static std::vector<Tuple> get_parent_simplices(
46  const attribute::MeshAttributeHandle& parent,
47  const simplex::Simplex& s);
48 
49  const attribute::MeshAttributeHandle& handle() const { return m_handle; }
51 
52  std::vector<wmtk::attribute::MeshAttributeHandle> targets() const final override
53  {
54  return {handle()};
55  }
56 
57 
58  // virtual bool run(const simplex::Simplex& s) = 0;
60 
61  // const simplex::Simplex& s) const = 0;
62 
63  virtual void run(const simplex::Simplex& s) const = 0;
64  // virtual void update(const simplex::Simplex& simplex) = 0;
65  // placeholder for when this turns into a DAG that needs to be linearized
66  // virtual std::vector<HandleVariant> parent_handles() const = 0;
67 
68  virtual PrimitiveType primitive_type() const = 0;
69  virtual Mesh& mesh() = 0;
70  const Mesh& mesh() const;
71 
72  // runs the transfer on every simplex - good for initializing an attribute that will be
73  // managed by transfer
74  void run_on_all() const;
75 
76 private:
78 };
79 
80 
81 } // namespace wmtk::operations
std::vector< wmtk::attribute::MeshAttributeHandle > targets() const final override
AttributeTransferStrategyBase(const attribute::MeshAttributeHandle &my_handle)
virtual void run(const simplex::Simplex &s) const =0
static std::vector< Tuple > get_parent_simplices(const Mesh &m, const Mesh &parent, const simplex::Simplex &s, PrimitiveType parent_primitive_type)
bool matches_attribute(const wmtk::attribute::MeshAttributeHandle &attr) const
virtual PrimitiveType primitive_type() const =0
const attribute::MeshAttributeHandle & handle() const
Definition: Accessor.hpp:6