LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
hybrid2d_refinement_pattern.h
1#ifndef INCG_LF_REFINEMENT_PAT_H_
2#define INCG_LF_REFINEMENT_PAT_H_
3
10#include <lf/mesh/mesh.h>
11
12namespace lf::refinement {
13// Convenient types inherited from base namespace
14using lf::base::dim_t;
18const unsigned int idx_nil = lf::base::kIdxNil;
19
47
48std::ostream& operator<<(std::ostream& o, const RefPat& refpat);
49
61 default;
65 // TODO(ralfh):
66 // We do not need the achor_set_ member, if we follow the convention that
67 // lf::base::kIdxNil represents an invalid (= non-set) anchor index.
68
69 public:
72 : geometry::RefinementPattern(ref_el),
75 anchor_set_(false) {}
76
79 : geometry::RefinementPattern(ref_el),
81 ref_pat_(ref_pat),
82 anchor_set_(false) {}
83
87 : geometry::RefinementPattern(ref_el),
89 ref_pat_(ref_pat),
91 if (anchor_set_) {
92 LF_VERIFY_MSG(
94 "Anchor " << anchor << " invalid for " << ref_el_.ToString());
95 }
96 }
97
103 [[nodiscard]] lf::base::size_type NumChildren(
104 lf::base::dim_t codim) const override;
206 [[nodiscard]] std::vector<Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic>>
207 ChildPolygons(lf::base::dim_t codim) const override;
208
211 anchor_ = anchor;
213 if (anchor_set_) {
214 LF_VERIFY_MSG(
216 "Anchor " << anchor << " invalid for " << ref_el_.ToString());
217 }
218 return (*this);
219 }
220
229 ref_pat_ = ref_pat;
230 anchor_set_ = false;
231 return *this;
232 }
233
237 [[nodiscard]] lf::base::sub_idx_t anchor() const { return anchor_; }
238 [[nodiscard]] RefPat refpat() const {
239 LF_VERIFY_MSG(
240 !(((ref_pat_ == rp_bisect) || (ref_pat_ == rp_trisect) ||
243 !anchor_set_),
244 "ref pattern " << ref_pat_ << " needs anchor!");
245 return ref_pat_;
246 }
249 ~Hybrid2DRefinementPattern() override = default;
250
251 private:
255};
256
257} // namespace lf::refinement
258
260
264template <>
265struct fmt::formatter<lf::refinement::RefPat> : ostream_formatter {};
267
268#endif
Represents a reference element with all its properties.
Definition ref_el.h:109
constexpr size_type NumSubEntities(dim_t sub_codim) const
Get the number of sub-entities of this RefEl with the given codimension.
Definition ref_el.h:308
std::string ToString() const
Return a string representation of this Reference element.
Definition ref_el.h:458
Abstract interface class for encoding topological local refinement
RefinementPattern(const RefinementPattern &)=default
Class containing information about the refinement of a cell.
Hybrid2DRefinementPattern(const Hybrid2DRefinementPattern &)=default
Hybrid2DRefinementPattern & operator=(Hybrid2DRefinementPattern &&)=default
Hybrid2DRefinementPattern(Hybrid2DRefinementPattern &&)=default
lf::base::size_type NumChildren(lf::base::dim_t codim) const override
provide number of child entities of a given co-dimension to be created by refinement
std::vector< Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic > > ChildPolygons(lf::base::dim_t codim) const override
provide lattice reference coordinates of vertices of child polygons
Hybrid2DRefinementPattern & operator=(const Hybrid2DRefinementPattern &)=default
Hybrid2DRefinementPattern(lf::base::RefEl ref_el, RefPat ref_pat)
constructor
Hybrid2DRefinementPattern & setAnchor(lf::base::sub_idx_t anchor)
set local number of anchor edge
Hybrid2DRefinementPattern & setRefPattern(RefPat ref_pat)
set refinement pattern
Hybrid2DRefinementPattern(lf::base::RefEl ref_el)
constructor
Hybrid2DRefinementPattern(lf::base::RefEl ref_el, RefPat ref_pat, lf::base::sub_idx_t anchor)
constructor
const unsigned int kIdxNil
Index flagged as invalid.
Definition types.h:36
unsigned int size_type
general type for variables related to size of arrays
Definition types.h:20
unsigned int sub_idx_t
type for local indices of sub-entities
Definition types.h:28
unsigned int dim_t
type for dimensions and co-dimensions and numbers derived from them
Definition types.h:32
unsigned int glb_idx_t
type for global index of mesh entities (nodes, edges, cells)
Definition types.h:24
tools for regular or local refinement of 2D hybrid meshes
std::ostream & operator<<(std::ostream &o, const RefPat &refpat)
const unsigned int idx_nil
RefPat
(possibly incomplete) list of refinement patterns for triangles/quadrilaterals
Definition assemble.h:31