21 #ifndef PATCH_FE_VALUES_HH_
22 #define PATCH_FE_VALUES_HH_
47 template<
unsigned int spacedim = 3>
59 for (
uint dim=1; dim<4; ++dim) {
73 uint zero_vec_size = 300;
91 for (
unsigned int i=0; i<spacedim; ++i) {
109 template<
unsigned int dim>
111 ASSERT((dim>=0) && (dim<=3))(dim).error(
"Dimension must be 0, 1, 2 or 3.");
118 template<
unsigned int dim>
124 template<
unsigned int dim>
128 return fe_sys->
fe()[component_idx];
130 ASSERT_EQ(component_idx, 0).warning(
"Non-zero component_idx can only be used for FESystem.");
136 template<
unsigned int dim>
137 std::shared_ptr<FiniteElement<dim>>
fe_dim() {
149 template <
unsigned int dim>
156 for (
auto integral_it : integrals.
bulk_) {
157 for (
uint i_data=0; i_data<integral_data.
bulk_[i_int].permanent_size(); ++i_data) {
161 for (
auto p : integral_it.second->points(element_patch_idx) ) {
170 for (
auto integral_it : integrals.
boundary_) {
171 for (
unsigned int i_data=0; i_data<integral_data.
boundary_[i_int].permanent_size(); ++i_data) {
175 for (
auto p : integral_it.second->points(integral_data.
boundary_[i_int][i_data].side) ) {
184 for (
auto integral_it : integrals.
edge_) {
185 for (
unsigned int i_data=0; i_data<integral_data.
edge_[i_int].permanent_size(); ++i_data) {
187 auto range = integral_data.
edge_[i_int][i_data].edge_side_range;
192 for (
auto p : integral_it.second->points(edge_side) ) {
202 for (
auto integral_it : integrals.
coupling_) {
203 uint side_pos, element_patch_idx, elm_pos=0;
204 uint last_element_idx = -1;
206 for (
unsigned int i_data=0; i_data<integral_data.
coupling_[i_int].permanent_size(); ++i_data) {
209 if (integral_data.
coupling_[i_int][i_data].cell.elm_idx() != last_element_idx) {
214 uint i_bulk_point = 0, i_side_point = 0;
215 for (
auto p_high : integral_it.second->points(integral_data.
coupling_[i_int][i_data].side) )
218 if (integral_data.
coupling_[i_int][i_data].cell.elm_idx() != last_element_idx) {
219 auto p_low = p_high.lower_dim(integral_data.
coupling_[i_int][i_data].cell);
223 last_element_idx = integral_data.
coupling_[i_int][i_data].cell.elm_idx();
233 auto map_it =
ppv.n_elems_.insert( {cell.
elm_idx(),
ppv.i_mesh_item_} );
234 bool is_elm_added = map_it.second;
239 return map_it.first->second;
251 ppv.side_list_.push_back( cell_side.
side() );
252 return ppv.i_mesh_item_++;
263 cell_side.
side_idx(), i_point_on_side);
282 template<
class OpType,
unsigned int dim>
284 std::string op_name =
typeid(OpType).name();
291 DebugOut().fmt(
"Create new operation '{}', dim: {}, quad size: {}.\n", op_name, dim, quad->
size());
299 template<
class OpType,
unsigned int dim>
301 return this->
template get<OpType, dim>( this->
element_quad(dim) );
305 template<
class OpType,
unsigned int dim>
307 std::string op_name =
typeid(OpType).name();
314 DebugOut().fmt(
"Create new operation '{}', dim: {}, quad size: {}.\n", op_name, dim, quad->
size());
323 stream << endl <<
"Table of patch FE operations:" << endl;
324 stream << std::setfill(
'-') << setw(160) <<
"" << endl;
326 stream << std::setfill(
' ') <<
" Operation" << std::setw(51) <<
"" <<
"Type" << std::setw(5) <<
"" <<
"Shape" << std::setw(2) <<
""
327 <<
"n DOFs" << std::setw(2) <<
"" <<
"Input operations" << std::endl;
329 stream <<
" " << std::left << std::setw(60) <<
typeid(*
operations_[i]).name() <<
"";
331 stream <<
" " << std::setw(6) <<
operations_[i]->format_shape() <<
"" <<
" "
332 << std::setw(7) <<
operations_[i]->n_dofs() <<
"" <<
" ";
333 for (
auto *i_o :
operations_[i]->input_ops_) stream <<
typeid(*i_o).name() <<
" ";
337 stream << std::setfill(
'=') << setw(160) <<
"" << endl;
353 ASSERT( (dim>0) && (dim<=3) )(dim);
359 for (
uint i_dim=0; i_dim<3; ++i_dim)
360 for (
uint i_domain=0; i_domain<2; ++i_domain) {
381 ppv.elem_dim_list_->push_back( cell.
elm() );
382 return ppv.elem_dim_list_->size() - 1;
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
PatchArenaResource< Resource > * get_child_arena()
Cell accessor allow iterate over DOF handler cells.
unsigned int dim() const
Return dimension of element appropriate to cell.
unsigned int elm_idx() const
Return serial idx to element of loc_ele_idx_.
ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
Side accessor allows to iterate over sides of DOF handler cell.
unsigned int elem_idx() const
Side side() const
Return Side of given cell and side_idx.
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
unsigned int dim() const
Return dimension of element appropriate to the side.
unsigned int side_idx() const
Directing class of FieldValueCache.
unsigned int position_in_cache(unsigned mesh_elm_idx, bool bdr=false) const
Return position of element stored in ElementCacheMap.
Compound finite element on dim dimensional simplex.
const std::vector< std::shared_ptr< FiniteElement< dim > > > & fe() const
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
PatchFeData & patch_fe_data()
Getter of patch_fe_data_.
uint register_element(DHCellAccessor cell, uint element_patch_idx)
Register element to patch_point_vals_ table by dimension of element.
uint register_side_point(DHCellSide cell_side, uint patch_side_idx, uint elm_cache_map_idx, uint i_point_on_side)
Register side point to patch_point_vals_ table by dimension of side.
PatchPointValues< spacedim >::PatchFeData PatchFeData
std::vector< PatchOp< spacedim > * > operations_
std::vector< Quadrature > element_quads_
~PatchFEValues()
Destructor.
PatchPointValues< spacedim > & ppv(uint domain, uint dim)
Temporary method.
void add_patch_points(const DimIntegrals< dim > &integrals, const IntegralData &integral_data, ElementCacheMap *element_cache_map, std::shared_ptr< EvalPoints > eval_points)
Add elements, sides and quadrature points registered on patch.
PatchOp< spacedim > * get_for_elem_quad()
Returns operation of given dim and OpType, creates it if doesn't exist.
PatchOp< spacedim > * get(const Quadrature *quad)
Returns operation of given dim and OpType, creates it if doesn't exist.
uint register_element_internal(DHCellAccessor cell, uint element_patch_idx)
Register element to patch_point_vals_ table by dimension of element.
PatchFEValues(MixedPtr< FiniteElement > fe)
void init_finalize()
Finalize initialization, creates child (patch) arena and passes it to PatchPointValue objects.
std::shared_ptr< FiniteElement< dim > > fe_dim()
Returns pointer to FiniteElement of given dimension.
OperationMap< PatchOp< spacedim > > op_dependency_
const AssemblyArena & asm_arena() const
same as previous but return constant reference
PatchArena & patch_arena() const
return reference to patch arena
uint register_bulk_point(DHCellAccessor cell, uint patch_elm_idx, uint elm_cache_map_idx, uint i_point_on_elem)
Register bulk point to patch_point_vals_ table by dimension of element.
void print_operations(ostream &stream) const
Print table of all used operations - development method.
void set_used_domain(fem_domain domain)
Mark domain (bulk or side) as used in assembly class.
PatchFeData patch_fe_data_
std::vector< ElemDimList< spacedim > > elem_dim_list_vec_
Sub objects of element data of dimensions 1,2,3.
void make_permanent_ppv_data()
Marks data of last successfully added element to patch as permanent.
MixedPtr< FiniteElement > fe_
Mixed of shared pointers of FiniteElement object.
void clean_elements_map()
Clear elements_map, set values to (-1)
unsigned int n_dofs_high() const
Returns the number of shape functions og higher dim element.
std::vector< uint > elements_map_
void reinit_patch()
Reinit data.
unsigned int n_dofs() const
Returns the number of shape functions.
const Quadrature * element_quad(unsigned int dim) const
Return element quadrature (passed to element / side operations)
AssemblyArena & asm_arena()
return reference to assembly arena
bool used_domain_[2]
Pair of flags signs holds info if bulk and side quadratures are used.
uint register_side(DHCellSide cell_side, ElementCacheMap *element_cache_map)
Register side to patch_point_vals_ table by dimension of side.
PatchOp< spacedim > * get(const Quadrature *quad, std::shared_ptr< FiniteElement< dim >> fe)
Returns operation of given dim and OpType, creates it if doesn't exist.
std::vector< std::vector< PatchPointValues< spacedim > > > patch_point_vals_
Sub objects of bulk and side data of dimensions 1,2,3.
std::shared_ptr< FiniteElement< dim > > fe_comp(std::shared_ptr< FiniteElement< dim > > fe, uint component_idx)
Returnd FiniteElement of component_idx for FESystem or fe for other types.
void reset()
Reset PatchpointValues structures.
Symmetric Gauss-Legendre quadrature formulae on simplices.
Base class for quadrature rules on simplices in arbitrary dimensions.
unsigned int size() const
Returns number of quadrature points.
Class FESystem for compound finite elements.
std::unordered_map< std::tuple< std::string, uint >, Operation *, OperationTplHash > OperationMap
Alias for unordered_map of Operation pointer with custom hash.
#define DebugOut()
Macro defining 'debug' record of log.
Declares accessors to FE operations.
Base class of FE operations.
Store finite element data on the actual patch such as shape function values, gradients,...
@ patch_elem_on_domain
Index of patch element for each bulk element or side.
@ ref_side_on_sides
Ref index of side in element for each side in patch.
fem_domain
Distinguishes operations by type and size of output rows.
Definitions of particular quadrature rules on simplices.
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.
Set of integral of given dimension necessary in assemblation.
IntegralPtrMap< BoundaryIntegralAcc< dim > > boundary_
Boundary integrals betwwen side and boundary element of dim-1.
IntegralPtrMap< EdgeIntegralAcc< dim > > edge_
Edge integrals between elements of same dimensions.
IntegralPtrMap< BulkIntegralAcc< dim > > bulk_
Bulk integrals of elements.
IntegralPtrMap< CouplingIntegralAcc< dim > > coupling_
Coupling integrals between elements of dimensions dim and dim-1.
Set of integral data of given dimension used in assemblation.
RevertableListVector< CouplingIntegralData > coupling_
Holds data for computing couplings integrals.
RevertableListVector< BulkIntegralData > bulk_
Holds data for computing bulk integrals.
RevertableListVector< BoundaryIntegralData > boundary_
Holds data for computing boundary integrals.
RevertableListVector< EdgeIntegralData > edge_
Holds data for computing edge integrals.
static std::tuple< std::string, uint > op_tuple(std::string op_type, uint quad_size)
Create tuple from typeid(Operation).name and size of Quadrature.
AssemblyArena asm_arena_
Assembly arena, created and filled once during initialization.
ArenaVec< double > zero_vec_
ArenaVec of zero values of maximal length using in zero PatchPointValues construction.
PatchArena * patch_arena_
Patch arena, reseted before patch reinit.