Wildmeshing Toolkit
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
wmtk::ExecutePass< AppMesh, policy > Struct Template Reference

Public Types

using Tuple = typename AppMesh::Tuple
 

Public Member Functions

 ExecutePass ()
 Construct a new Execute Pass object. It contains the name-to-operation map and the functions that define the rules for operations.
 
 ExecutePass (ExecutePass &)=delete
 
bool operator() (AppMesh &m, const std::vector< std::pair< Op, Tuple > > &operation_tuples)
 Executes the operations for an application when the lambda function is invoked. The rules that are customizly defined for applications are applied.
 
int get_cnt_success () const
 
int get_cnt_fail () const
 

Public Attributes

std::map< Op, std::function< std::optional< std::vector< Tuple > >(AppMesh &, const Tuple &)> > edit_operation_maps
 A dictionary that registers names with operations.
 
std::function< double(const AppMesh &, Op op, const Tuple &)> priority
 Priority function (default to edge length)
 
std::function< bool(double)> should_renew = [](auto) { return true; }
 check on wheather new operations should be added to the priority queue
 
std::function< std::vector< std::pair< Op, Tuple > >(const AppMesh &, Op, const std::vector< Tuple > &)> renew_neighbor_tuples
 renew neighboring Tuples after each operation depends on the operation
 
std::function< bool(AppMesh &, const Tuple &, int task_id)> lock_vertices
 lock the vertices concerned depends on the operation
 
std::function< bool(const AppMesh &)> stopping_criterion
 Stopping Criterion based on the whole mesh For efficiency, not every time is checked. In serial, this may go over all the elements. For parallel, this involves synchronization. So there is a checking frequency.
 
size_t stopping_criterion_checking_frequency = std::numeric_limits<size_t>::max()
 checking frequency to decide whether to stop execution given the stopping criterion
 
std::function< bool(const AppMesh &, const std::tuple< double, Op, Tuple > &t)> is_weight_up_to_date
 Should Process drops some Tuple from being processed. For example, if the energy is out-dated. This is in addition to calling tuple valid.
 
std::function< void(const AppMesh &, Op, const Tuple &t)> on_fail = [](auto&, auto, auto&) {}
 used to collect operations that are not finished and used for later re-execution
 
int num_threads = 1
 
size_t max_retry_limit = 10
 

Private Member Functions

void operation_cleanup (AppMesh &m)
 
size_t get_partition_id (const AppMesh &m, const Tuple &e)
 

Private Attributes

std::atomic_int cnt_update = 0
 
std::atomic_int cnt_success = 0
 
std::atomic_int cnt_fail = 0
 

Constructor & Destructor Documentation

◆ ExecutePass()

template<class AppMesh , ExecutionPolicy policy = ExecutionPolicy::kSeq>
wmtk::ExecutePass< AppMesh, policy >::ExecutePass ( )
inline

Construct a new Execute Pass object. It contains the name-to-operation map and the functions that define the rules for operations.

Note
the constructor is differentiated by the type of mesh, namingly wmtk::TetMesh or wmtk::TriMesh

Member Function Documentation

◆ operator()()

template<class AppMesh , ExecutionPolicy policy = ExecutionPolicy::kSeq>
bool wmtk::ExecutePass< AppMesh, policy >::operator() ( AppMesh &  m,
const std::vector< std::pair< Op, Tuple > > &  operation_tuples 
)
inline

Executes the operations for an application when the lambda function is invoked. The rules that are customizly defined for applications are applied.

Parameters
m
operation_tuplesa vector of pairs of operation's name and the Tuple to be operated on
Returns
true if finished successfully

Member Data Documentation

◆ is_weight_up_to_date

template<class AppMesh , ExecutionPolicy policy = ExecutionPolicy::kSeq>
std::function<bool(const AppMesh&, const std::tuple<double, Op, Tuple>& t)> wmtk::ExecutePass< AppMesh, policy >::is_weight_up_to_date
Initial value:
= [](const AppMesh& m, const std::tuple<double, Op, Tuple>& t) {
assert(std::get<2>(t).is_valid(m));
return true;
}

Should Process drops some Tuple from being processed. For example, if the energy is out-dated. This is in addition to calling tuple valid.

◆ lock_vertices

template<class AppMesh , ExecutionPolicy policy = ExecutionPolicy::kSeq>
std::function<bool(AppMesh&, const Tuple&, int task_id)> wmtk::ExecutePass< AppMesh, policy >::lock_vertices
Initial value:
=
[](const AppMesh&, const Tuple&, int task_id) { return true; }

lock the vertices concerned depends on the operation

◆ max_retry_limit

template<class AppMesh , ExecutionPolicy policy = ExecutionPolicy::kSeq>
size_t wmtk::ExecutePass< AppMesh, policy >::max_retry_limit = 10

To Avoid mutual locking, retry limit is set, and then put in a serial queue in the end.

◆ priority

template<class AppMesh , ExecutionPolicy policy = ExecutionPolicy::kSeq>
std::function<double(const AppMesh&, Op op, const Tuple&)> wmtk::ExecutePass< AppMesh, policy >::priority
Initial value:
= [](auto&, auto, auto&) {
return 0.;
}

Priority function (default to edge length)

◆ renew_neighbor_tuples

template<class AppMesh , ExecutionPolicy policy = ExecutionPolicy::kSeq>
std::function<std::vector<std::pair<Op, Tuple> >(const AppMesh&, Op, const std::vector<Tuple>&)> wmtk::ExecutePass< AppMesh, policy >::renew_neighbor_tuples
Initial value:
=
[](auto&, auto, auto&) -> std::vector<std::pair<Op, Tuple>> { return {}; }

renew neighboring Tuples after each operation depends on the operation

◆ stopping_criterion

template<class AppMesh , ExecutionPolicy policy = ExecutionPolicy::kSeq>
std::function<bool(const AppMesh&)> wmtk::ExecutePass< AppMesh, policy >::stopping_criterion
Initial value:
= [](const AppMesh&) {
return false;
}

Stopping Criterion based on the whole mesh For efficiency, not every time is checked. In serial, this may go over all the elements. For parallel, this involves synchronization. So there is a checking frequency.


The documentation for this struct was generated from the following file: