33 #ifndef __H__UG_refinement_mark_util_impl
34 #define __H__UG_refinement_mark_util_impl
44 template <
class TRef,
class TIter,
class TAAPos>
56 number minEdgeRatioSq =
sq(minEdgeRatio);
59 for(TIter iter = elemsBegin; iter != elemsEnd; ++iter){
60 elem_ptr_t elem = *iter;
65 if(assEdges.
size() < 2)
69 number shortestLenSq = numeric_limits<number>::max();
74 shortestLenSq = min(shortestLenSq, lenSq);
75 longestLenSq = max(longestLenSq, lenSq);
81 if(shortestLenSq / longestLenSq >= minEdgeRatioSq)
87 number thresholdLenSq = shortestLenSq / minEdgeRatioSq;
96 template <
class TRef,
class TEdgeIter,
class TAAPos>
100 TEdgeIter edgesBegin,
102 const typename TAAPos::ValueType& dir,
107 UG_COND_THROW(!ref.grid(),
"The given refiner has to operate on a grid");
109 typedef typename TAAPos::ValueType vector_t;
111 Grid& g = *ref.grid();
122 for(TEdgeIter eIter = edgesBegin; eIter != edgesEnd; ++eIter){
128 if((d >= minDot -
SMALL && d <= maxDot +
SMALL) ||
129 (selectFlipped && (-d >= minDot -
SMALL && -d <= maxDot +
SMALL)))
134 for(
size_t i = 0; i < faces.
size(); ++i)
138 for(
size_t i = 0; i < vols.
size(); ++i)
Base-class for edges.
Definition: grid_base_objects.h:397
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:366
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
void associated_elements(traits< Vertex >::secure_container &elemsOut, TElem *e)
Puts all elements of type TAss which are contained in 'e' or which contain 'e' into elemsOut.
Definition: grid_impl.hpp:466
Container which holds an array of pointers.
Definition: pointer_const_array.h:84
size_t size() const
returns the size of the associated array.
Definition: pointer_const_array_impl.hpp:106
UG_API number EdgeLengthSq(const EdgeVertices *e, TAAPosVRT &aaPos)
Calculates the squared length of the given edge.
Definition: edge_util_impl.hpp:73
@ RM_REFINE
DEPRECATED. Use RM_FULL instead.
Definition: refiner_interface.h:55
@ RM_CLOSURE
Refines elements according to associated marked edges.
Definition: refiner_interface.h:50
@ RM_ANISOTROPIC
DEPRECATED. Use RM_CLOSURE instead.
Definition: refiner_interface.h:52
#define UG_COND_THROW(cond, msg)
UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true.
Definition: error.h:61
double number
Definition: types.h:124
TNumber sq(TNumber val)
returns the square of a value (val*val)
Definition: math_util_impl.hpp:91
TNumber deg_to_rad(TNumber deg)
Definition: math_util_impl.hpp:49
void VecNormalize(vector_t &vOut, const vector_t &v)
scales a vector_t to unit length
Definition: math_vector_functions_common_impl.hpp:501
void VecSubtract(vector_t &vOut, const vector_t &v1, const vector_t &v2)
subtracts v2 from v1 and stores the result in a vOut
Definition: math_vector_functions_common_impl.hpp:226
vector_t::value_type VecDot(const vector_t &v1, const vector_t &v2)
returns the dot-product of two vector_ts
Definition: math_vector_functions_common_impl.hpp:385
Definition: smart_pointer.h:814
const number SMALL
Definition: math_constants.h:41
void MarkForRefinementByDirection(TRef &ref, TAAPos aaPos, TEdgeIter edgesBegin, TEdgeIter edgesEnd, const typename TAAPos::ValueType &dir, number minDeviationAngle, number maxDeviationAngle, bool selectFlipped)
Definition: refinement_mark_util_impl.h:97
const number SMALL_SQ
Definition: math_constants.h:42
void MarkForAnisotropicRefinement(Grid &grid, TRef &ref, number minEdgeRatio, TIter elemsBegin, TIter elemsEnd, TAAPos aaPos)
Definition: refinement_mark_util_impl.h:45
T value_type
Definition: sparsematrix_interface.h:2
#define for_each_in_vec(_vfeDecl, _vfeVec)
Allows iteration over all members of an std::vector compatible type.
Definition: vec_for_each.h:52
#define end_for
Allows iteration over all members of an std::vector compatible type.
Definition: vec_for_each.h:56