| FEAT 3
    Finite Element Analysis Toolbox | 
Domain Integral Assembler class template. More...
#include <domain_assembler.hpp>
| Classes | |
| class | ThreadStats | 
| Thread statistics helper class.  More... | |
| class | Worker | 
| Worker thread data class.  More... | |
| Public Types | |
| typedef TrafoType::MeshType | MeshType | 
| the underlying mesh type  More... | |
| typedef Trafo_ | TrafoType | 
| the underlying trafo type  More... | |
| Public Member Functions | |
| DomainAssembler (const DomainAssembler &)=delete | |
| delete copy constructor | |
| DomainAssembler (const TrafoType &trafo) | |
| Constructor.  More... | |
| virtual | ~DomainAssembler () | 
| virtual destructor  More... | |
| void | add_element (Index ielem) | 
| Adds a single element to the assembler.  More... | |
| void | add_mesh_part (const Geometry::MeshPart< MeshType > &mesh_part) | 
| Adds all elements of a mesh-part to the assembler.  More... | |
| template<typename Job_ > | |
| void | assemble (Job_ &job) | 
| Executes a domain assembly job (in parallel) by (multiple) worker threads.  More... | |
| template<typename Job_ > | |
| void | assemble_master (Job_ &job) | 
| Executes a domain assembly job directly on the calling thread.  More... | |
| template<typename Job_ > | |
| void | assemble_omp (Job_ &job) | 
| void | clear () | 
| Clears the assembler.  More... | |
| void | compile () | 
| Compiles the assembler for all elements that have been added manually.  More... | |
| void | compile_all_elements () | 
| Compiles the assembler for all elements of the underlying mesh.  More... | |
| String | dump () const | 
| Returns a string dump of various debugging information.  More... | |
| const std::vector< Index > & | get_element_indices () const | 
| Returns the element indices vector.  More... | |
| std::size_t | get_max_worker_threads () const | 
| Returns the maximum number of worker threads.  More... | |
| std::size_t | get_num_worker_threads () const | 
| Returns the actual number of worker threads.  More... | |
| ThreadingStrategy | get_threading_strategy () const | 
| Returns the threading strategy.  More... | |
| const Trafo_ & | get_trafo () const | 
| Returns a reference to the domain assembler's trafo.  More... | |
| DomainAssembler & | operator= (const DomainAssembler &)=delete | 
| delete copy assignment operator | |
| ThreadStats | reduce_thread_stats () const | 
| Reduces the thread statistics to a single object.  More... | |
| void | reset_thread_stats () | 
| Resets the thread statistics.  More... | |
| void | set_max_worker_threads (std::size_t max_worker_threads) | 
| Sets the maximum number of worker threads.  More... | |
| void | set_threading_strategy (ThreadingStrategy strategy) | 
| Sets the desired threading strategy.  More... | |
| Static Public Attributes | |
| static constexpr int | shape_dim = MeshType::shape_dim | 
| the shape dimension  More... | |
| Protected Member Functions | |
| void | _build_colors () | 
| Builds the color element vectors for the colored threading strategy.  More... | |
| void | _build_graphs () | 
| Builds the element adjacencies graphs.  More... | |
| void | _build_layers (bool reverse, bool sorted) | 
| Builds the Cuthill-McKee layer graphs.  More... | |
| bool | _build_thread_layers () | 
| Build the actual thread layers for the layered strategy.  More... | |
| void | _compile () | 
| Compiles the domain assembler.  More... | |
| Protected Attributes | |
| std::vector< Index > | _color_elements | 
| a vector of element color offsets  More... | |
| bool | _compiled | 
| specifies whether the assembler has already been compiled  More... | |
| Adjacency::Graph | _elem_neighbors | 
| adjacency graph for element neighbors  More... | |
| std::vector< Index > | _element_indices | 
| a vector of all elements to assemble on  More... | |
| std::vector< char > | _element_mask | 
| an element mask vector  More... | |
| Adjacency::Graph | _elems_at_vert | 
| adjacency graph for elements-at-vertex  More... | |
| std::vector< Index > | _layer_elements | 
| a vector of element layer offsets  More... | |
| std::size_t | _max_worker_threads | 
| specifies the maximum number of worker threads to use  More... | |
| std::size_t | _num_worker_threads | 
| specifies the actual number of worker threads to use  More... | |
| ThreadingStrategy | _strategy | 
| specifies the chosen threading strategy  More... | |
| std::vector< ThreadFence > | _thread_fences | 
| a vector of thread fences  More... | |
| std::vector< Index > | _thread_layers | 
| a vector of thread layer blocks  More... | |
| std::mutex | _thread_mutex | 
| a mutex for free use by the worker threads  More... | |
| std::vector< ThreadStats > | _thread_stats | 
| a vector of thread statistics  More... | |
| std::vector< std::thread > | _threads | 
| a vector of worker threads  More... | |
| const TrafoType & | _trafo | 
| a reference to the underlying trafo  More... | |
| Adjacency::Graph | _verts_at_elem | 
| adjacency graph for vertices-at-element  More... | |
Domain Integral Assembler class template.
This class implements a multi-threaded domain assembler, which is capable of executing domain assembly jobs.
After you have constructed the domain assembler object, there are still a few steps left that have to be performed before you can assemble a assembly job by the domain assembler:
Definition at line 393 of file domain_assembler.hpp.
| typedef TrafoType::MeshType FEAT::Assembly::DomainAssembler< Trafo_ >::MeshType | 
the underlying mesh type
Definition at line 399 of file domain_assembler.hpp.
| typedef Trafo_ FEAT::Assembly::DomainAssembler< Trafo_ >::TrafoType | 
the underlying trafo type
Definition at line 397 of file domain_assembler.hpp.
| 
 | inlineexplicit | 
Constructor.
| [in] | trafo | A resident reference to the transformation that defines the assembly domain. | 
Definition at line 998 of file domain_assembler.hpp.
| 
 | inlinevirtual | 
virtual destructor
Definition at line 1024 of file domain_assembler.hpp.
| 
 | inlineprotected | 
Builds the color element vectors for the colored threading strategy.
Definition at line 1922 of file domain_assembler.hpp.
References FEAT::Adjacency::Coloring::create_partition_graph(), FEAT::Adjacency::Graph::degree(), FEAT::Adjacency::Graph::get_domain_ptr(), FEAT::Adjacency::Graph::get_image_idx(), FEAT::Math::min(), and XASSERT.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::_compile().
| 
 | inlineprotected | 
Builds the element adjacencies graphs.
Definition at line 1638 of file domain_assembler.hpp.
References FEAT::Adjacency::Graph::get_domain_ptr(), FEAT::Adjacency::Graph::get_image_idx(), FEAT::Adjacency::injectify_sorted, FEAT::Adjacency::Graph::sort_indices(), and FEAT::Adjacency::transpose.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::_compile().
| 
 | inlineprotected | 
Builds the Cuthill-McKee layer graphs.
| [in] | reverse | Specifies whether to reverse the ordering. | 
| [in] | sorted | Specifies whether to sort entities in each layer by their degree. | 
Definition at line 1686 of file domain_assembler.hpp.
References FEAT::Adjacency::Graph::degree(), FEAT::Adjacency::Graph::get_domain_ptr(), FEAT::Adjacency::Graph::get_image_idx(), and XASSERTM.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::_compile().
| 
 | inlineprotected | 
Build the actual thread layers for the layered strategy.
Definition at line 1829 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_num_worker_threads, FEAT::Math::min(), and XASSERT.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::_compile().
| 
 | inlineprotected | 
Compiles the domain assembler.
This function performs all the required initializations based on the chosen threading strategy and desired worker thread count.
Definition at line 1559 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_build_colors(), FEAT::Assembly::DomainAssembler< Trafo_ >::_build_graphs(), FEAT::Assembly::DomainAssembler< Trafo_ >::_build_layers(), FEAT::Assembly::DomainAssembler< Trafo_ >::_build_thread_layers(), FEAT::Assembly::DomainAssembler< Trafo_ >::_compiled, FEAT::Assembly::DomainAssembler< Trafo_ >::_thread_stats, FEAT::Assembly::DomainAssembler< Trafo_ >::_threads, FEAT::Assembly::automatic, FEAT::Assembly::colored, FEAT::Geometry::colored, FEAT::Assembly::layered, FEAT::Assembly::layered_sorted, and FEAT::Assembly::single.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::compile(), and FEAT::Assembly::DomainAssembler< Trafo_ >::compile_all_elements().
| 
 | inline | 
Adds a single element to the assembler.
| [in] | ielem | The index of the mesh element that is to be added. | 
ielem has already been added to the assembler by calling this function or the add_mesh_part function, then it will not be added a second time, so every element is processed at most once, no matter how often it has been added to the assembler. Definition at line 1060 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_compiled, and XASSERTM.
| 
 | inline | 
Adds all elements of a mesh-part to the assembler.
| [in] | mesh_part | A transient reference to the mesh part whose elements are to be added. | 
Definition at line 1077 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_compiled, and XASSERTM.
| 
 | inline | 
Executes a domain assembly job (in parallel) by (multiple) worker threads.
| [in,out] | job | A transient reference to the job that is to be assembled. See Assembly::DomainAssemblyJob for details. | 
Definition at line 1215 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_compiled, FEAT::Assembly::DomainAssembler< Trafo_ >::_num_worker_threads, FEAT::Assembly::DomainAssembler< Trafo_ >::_threads, FEAT::Assembly::DomainAssembler< Trafo_ >::assemble_master(), FEAT::Assembly::colored, FEAT::Assembly::layered, FEAT::Assembly::layered_sorted, FEAT::Assembly::single, XABORTM, and XASSERTM.
Referenced by FEAT::Assembly::assemble_bilinear_operator_apply_vector_1(), FEAT::Assembly::assemble_bilinear_operator_matrix_1(), FEAT::Assembly::assemble_bilinear_operator_matrix_2(), FEAT::Assembly::assemble_force_function_vector(), FEAT::Assembly::assemble_linear_functional_vector(), FEAT::Assembly::integrate_analytic_function(), FEAT::Assembly::integrate_discrete_function(), and FEAT::Assembly::integrate_error_function().
| 
 | inline | 
Executes a domain assembly job directly on the calling thread.
This function executes the assembly job directly on the calling thread without spawning dedicated worker threads, which makes debugging of assembly jobs and tasks much easier. Note that as a consequence, the assembly performed by this function is always single-threaded even if the assembler has been configured to work with multiple threads.
| [in,out] | job | A transient reference to the job that is to be assembled. See Assembly::DomainAssemblyJob for details. | 
Definition at line 1335 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_compiled, FEAT::Assembly::DomainAssembler< Trafo_ >::_threads, and XASSERTM.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::assemble().
| 
 | inline | 
Definition at line 1362 of file domain_assembler.hpp.
| 
 | inline | 
Clears the assembler.
Definition at line 1032 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_color_elements, FEAT::Assembly::DomainAssembler< Trafo_ >::_compiled, FEAT::Assembly::DomainAssembler< Trafo_ >::_elem_neighbors, FEAT::Assembly::DomainAssembler< Trafo_ >::_element_indices, FEAT::Assembly::DomainAssembler< Trafo_ >::_element_mask, FEAT::Assembly::DomainAssembler< Trafo_ >::_elems_at_vert, FEAT::Assembly::DomainAssembler< Trafo_ >::_layer_elements, FEAT::Assembly::DomainAssembler< Trafo_ >::_thread_fences, FEAT::Assembly::DomainAssembler< Trafo_ >::_thread_layers, FEAT::Assembly::DomainAssembler< Trafo_ >::_thread_stats, FEAT::Assembly::DomainAssembler< Trafo_ >::_threads, FEAT::Assembly::DomainAssembler< Trafo_ >::_verts_at_elem, FEAT::Adjacency::Graph::clear(), and XASSERTM.
| 
 | inline | 
Compiles the assembler for all elements that have been added manually.
This function compiles the assembler for all cells/elements that have been added manually by previous calls of the add_element or add_mesh_part functions according to the chosen threading strategy and desired maximum worker thread count.
Definition at line 1168 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_compile(), FEAT::Assembly::DomainAssembler< Trafo_ >::_element_indices, XASSERT, and XASSERTM.
| 
 | inline | 
Compiles the assembler for all elements of the underlying mesh.
This function compiles the assembler for all elements of the trafo's underlying mesh according to the chosen threading strategy and desired maximum worker thread count.
Definition at line 1193 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_compile(), FEAT::Assembly::DomainAssembler< Trafo_ >::_element_indices, XASSERT, and XASSERTM.
| 
 | inline | 
Returns a string dump of various debugging information.
Definition at line 1483 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_strategy, FEAT::Assembly::layered, FEAT::Math::max(), FEAT::String::pad_front(), FEAT::stringify(), and FEAT::stringify_fp_fix().
| 
 | inline | 
Returns the element indices vector.
Definition at line 1096 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_element_indices.
| 
 | inline | 
Returns the maximum number of worker threads.
Definition at line 1116 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_max_worker_threads.
| 
 | inline | 
Returns the actual number of worker threads.
This returned count corresponds to the actual number of worker threads used for assembling, which may be lower than the maximum number of worker requested by the user.
Definition at line 1130 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_num_worker_threads.
| 
 | inline | 
Returns the threading strategy.
Definition at line 1152 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_strategy.
| 
 | inline | 
Returns a reference to the domain assembler's trafo.
Definition at line 1088 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_trafo.
Referenced by FEAT::Assembly::assemble_bilinear_operator_apply_vector_1(), FEAT::Assembly::assemble_bilinear_operator_matrix_1(), FEAT::Assembly::assemble_bilinear_operator_matrix_2(), FEAT::Assembly::assemble_force_function_vector(), FEAT::Assembly::assemble_linear_functional_vector(), FEAT::Assembly::integrate_analytic_function(), FEAT::Assembly::integrate_discrete_function(), and FEAT::Assembly::integrate_error_function().
| 
 | inline | 
Reduces the thread statistics to a single object.
Definition at line 1544 of file domain_assembler.hpp.
| 
 | inline | 
Resets the thread statistics.
Definition at line 1533 of file domain_assembler.hpp.
| 
 | inline | 
Sets the maximum number of worker threads.
Definition at line 1107 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_compiled, and XASSERTM.
| 
 | inline | 
Sets the desired threading strategy.
See Assembly::ThreadingStrategy for details.
Definition at line 1143 of file domain_assembler.hpp.
References FEAT::Assembly::DomainAssembler< Trafo_ >::_compiled, and XASSERTM.
| 
 | protected | 
a vector of element color offsets
Definition at line 969 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | protected | 
specifies whether the assembler has already been compiled
Definition at line 989 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::_compile(), FEAT::Assembly::DomainAssembler< Trafo_ >::add_element(), FEAT::Assembly::DomainAssembler< Trafo_ >::add_mesh_part(), FEAT::Assembly::DomainAssembler< Trafo_ >::assemble(), FEAT::Assembly::DomainAssembler< Trafo_ >::assemble_master(), FEAT::Assembly::DomainAssembler< Trafo_ >::clear(), FEAT::Assembly::DomainAssembler< Trafo_ >::set_max_worker_threads(), and FEAT::Assembly::DomainAssembler< Trafo_ >::set_threading_strategy().
| 
 | protected | 
adjacency graph for element neighbors
Definition at line 963 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | protected | 
a vector of all elements to assemble on
Definition at line 967 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::clear(), FEAT::Assembly::DomainAssembler< Trafo_ >::compile(), FEAT::Assembly::DomainAssembler< Trafo_ >::compile_all_elements(), and FEAT::Assembly::DomainAssembler< Trafo_ >::get_element_indices().
| 
 | protected | 
an element mask vector
Definition at line 965 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | protected | 
adjacency graph for elements-at-vertex
Definition at line 961 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | protected | 
a vector of element layer offsets
Definition at line 971 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | protected | 
specifies the maximum number of worker threads to use
Definition at line 985 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::get_max_worker_threads().
| 
 | protected | 
specifies the actual number of worker threads to use
Definition at line 987 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::_build_thread_layers(), FEAT::Assembly::DomainAssembler< Trafo_ >::assemble(), and FEAT::Assembly::DomainAssembler< Trafo_ >::get_num_worker_threads().
| 
 | protected | 
specifies the chosen threading strategy
Definition at line 983 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::dump(), and FEAT::Assembly::DomainAssembler< Trafo_ >::get_threading_strategy().
| 
 | protected | 
a vector of thread fences
Definition at line 975 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | protected | 
a vector of thread layer blocks
Definition at line 973 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | protected | 
a mutex for free use by the worker threads
Definition at line 981 of file domain_assembler.hpp.
| 
 | protected | 
a vector of thread statistics
Definition at line 977 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::_compile(), and FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | protected | 
a vector of worker threads
Definition at line 979 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::_compile(), FEAT::Assembly::DomainAssembler< Trafo_ >::assemble(), FEAT::Assembly::DomainAssembler< Trafo_ >::assemble_master(), and FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | protected | 
a reference to the underlying trafo
Definition at line 957 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::get_trafo().
| 
 | protected | 
adjacency graph for vertices-at-element
Definition at line 959 of file domain_assembler.hpp.
Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::clear().
| 
 | staticconstexpr | 
the shape dimension
Definition at line 401 of file domain_assembler.hpp.