Wildmeshing Toolkit
Loading...
Searching...
No Matches
NewAttributeStrategy.cpp
Go to the documentation of this file.
1
#include "
NewAttributeStrategy.hpp
"
2
#include <
wmtk/Mesh.hpp
>
3
#include <
wmtk/utils/Rational.hpp
>
4
5
namespace
wmtk::operations
{
6
7
NewAttributeStrategy::~NewAttributeStrategy
() =
default
;
8
9
//NewAttributeStrategy::NewAttributeStrategy(const wmtk::attribute::MeshAttributeHandle& handle) {
10
//}
11
12
const
Mesh
&
NewAttributeStrategy::mesh
()
const
13
{
14
return
const_cast<
const
Mesh
&
>
(
const_cast<
NewAttributeStrategy
*
>
(
this
)->
mesh
());
15
}
16
void
NewAttributeStrategy::set_simplex_predicate
(
SimplexPredicateType
&& f)
17
{
18
m_simplex_predicate
= std::move(f);
19
}
20
21
void
NewAttributeStrategy::set_simplex_predicate
(
BasicSimplexPredicate
f)
22
{
23
switch
(f) {
24
default
: [[fallthrough]];
25
case
BasicSimplexPredicate::Default
: [[fallthrough]];
26
case
BasicSimplexPredicate::None
:
set_simplex_predicate
({});
break
;
27
case
BasicSimplexPredicate::IsInterior
:
28
set_simplex_predicate
(
29
[&](
const
simplex::Simplex
& s) ->
bool
{
return
mesh
().
is_boundary
(s); });
30
break
;
31
}
32
}
33
34
std::bitset<2>
NewAttributeStrategy::evaluate_predicate
(
35
PrimitiveType
pt,
36
const
std::array<Tuple, 2>& simplices)
const
37
{
38
if
(!
bool
(
m_simplex_predicate
)) {
39
std::bitset<2> pred(0);
40
return
pred;
41
}
42
43
auto
old_pred =
mesh
().
parent_scope
([&]() {
44
std::bitset<2> pred(0);
45
if
(
bool
(
m_simplex_predicate
)) {
46
for
(
size_t
j = 0; j < 2; ++j) {
47
pred[j] =
m_simplex_predicate
(
simplex::Simplex
(
mesh
(), pt, simplices[j]));
48
}
49
}
50
return
pred;
51
});
52
53
return
old_pred;
54
}
55
}
// namespace wmtk::operations
Mesh.hpp
NewAttributeStrategy.hpp
Rational.hpp
wmtk::Mesh
Definition
Mesh.hpp:95
wmtk::Mesh::is_boundary
bool is_boundary(const simplex::Simplex &tuple) const
check if a simplex lies on a boundary or not
Definition
Mesh.cpp:107
wmtk::Mesh::parent_scope
decltype(auto) parent_scope(Functor &&f, Args &&... args) const
Evaluate the passed in function inside the parent scope.
Definition
Mesh.hpp:939
wmtk::operations::NewAttributeStrategy
Definition
NewAttributeStrategy.hpp:22
wmtk::operations::NewAttributeStrategy::m_simplex_predicate
SimplexPredicateType m_simplex_predicate
Definition
NewAttributeStrategy.hpp:49
wmtk::operations::NewAttributeStrategy::~NewAttributeStrategy
virtual ~NewAttributeStrategy()
wmtk::operations::NewAttributeStrategy::set_simplex_predicate
void set_simplex_predicate(SimplexPredicateType &&f)
Definition
NewAttributeStrategy.cpp:16
wmtk::operations::NewAttributeStrategy::evaluate_predicate
std::bitset< 2 > evaluate_predicate(PrimitiveType pt, const std::array< Tuple, 2 > &simplices) const
Definition
NewAttributeStrategy.cpp:34
wmtk::operations::NewAttributeStrategy::mesh
virtual Mesh & mesh()=0
wmtk::operations::NewAttributeStrategy::SimplexPredicateType
std::function< bool(const simplex::Simplex &)> SimplexPredicateType
Definition
NewAttributeStrategy.hpp:24
wmtk::simplex::Simplex
Definition
Simplex.hpp:22
wmtk::operations
Definition
EdgeMesh.hpp:10
wmtk::operations::BasicSimplexPredicate
BasicSimplexPredicate
Definition
NewAttributeStrategy.hpp:19
wmtk::operations::BasicSimplexPredicate::IsInterior
@ IsInterior
wmtk::operations::BasicSimplexPredicate::None
@ None
wmtk::operations::BasicSimplexPredicate::Default
@ Default
wmtk::PrimitiveType
PrimitiveType
Definition
PrimitiveType.hpp:9
src
wmtk
operations
attribute_new
NewAttributeStrategy.cpp
Generated by
1.9.8