33 #ifndef __H__UG__LIB_DISC__DOMAIN_UTIL_GENERAL_IMPL__
34 #define __H__UG__LIB_DISC__DOMAIN_UTIL_GENERAL_IMPL__
52 template <
typename TElem,
typename TAAPos>
54 TElem* elem,
const TAAPos& aaPos,
bool clearContainer)
57 vCornerCoordsOut.clear();
63 for(
size_t i = 0; i < numVertices; ++i)
69 vCornerCoordsOut.push_back(aaPos[vert]);
74 template <
typename TElem,
typename TAAPos>
76 const TElem& elem,
const TAAPos& aaPos,
bool clearContainer)
79 TElem* pElem =
const_cast<TElem*
>(&elem);
86 template <
typename TElem,
typename TDomain>
88 const TElem& elem,
const TDomain& domain,
bool clearContainer)
91 const typename TDomain::position_accessor_type& aaPos = domain.position_accessor();
97 template <
typename TDomain>
99 std::vector<typename TDomain::position_type>& vCornerCoordsOut,
100 GridObject& elem,
const TDomain& domain,
bool clearContainer)
102 switch(base_object_id)
104 case VERTEX: CollectCornerCoordinates<Vertex, TDomain>(vCornerCoordsOut, *
dynamic_cast< Vertex*
>(&elem), domain, clearContainer);
return;
105 case EDGE: CollectCornerCoordinates<Edge, TDomain>(vCornerCoordsOut, *
dynamic_cast< Edge*
>(&elem), domain, clearContainer);
return;
106 case FACE: CollectCornerCoordinates<Face, TDomain>(vCornerCoordsOut, *
dynamic_cast< Face*
>(&elem), domain, clearContainer);
return;
107 case VOLUME: CollectCornerCoordinates<Volume, TDomain>(vCornerCoordsOut, *
dynamic_cast< Volume*
>(&elem), domain, clearContainer);
return;
108 default:
UG_THROW(
"CollectCornerCoordinates, base_object_id " << base_object_id <<
"unknown.");
113 template <
typename TElem,
typename TDomain>
115 const TElem& elem,
const TDomain& domain)
118 const typename TDomain::position_accessor_type& aaPos = domain.position_accessor();
120 const Vertex*
const* vVertex =
const_cast<TElem*
>(&elem)->
vertices();
124 vCornerCoordsOut[i] = aaPos[vVertex[i]];
129 template <
typename TDomain>
134 const typename TDomain::position_accessor_type& aaPos = domain.position_accessor();
137 vCornerCoordsOut[0] = aaPos[&vtx];
142 template <
typename TElem,
typename TPosition>
146 std::vector<TPosition> vCornerCoords;
155 static const int dim = TPosition::Size;
158 return ElementSize<TRefElem, dim>(&vCornerCoords[0]);
162 template <
typename TElem,
typename TDomain>
166 const typename TDomain::position_accessor_type& aaPos = domain.position_accessor();
175 template <
typename TElem,
typename TDomain>
181 template <
typename TElem,
typename TDomain>
184 return ElementDiameter(*domain.grid(), domain.position_accessor(), &elem);
A generic specialization of IAttachment.
Definition: attachment_pipe.h:263
Base-class for edges.
Definition: grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
A basic vertex-type.
Definition: grid_objects_0d.h:62
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
number ElementDiameter(const TElem &elem, TDomain &domain)
returns the maximal distance between to element vertices
number ElementDiameterSq(const TElem &elem, TDomain &domain)
returns the maximal squared distance between to element vertices
void CollectCornerCoordinates(std::vector< typename TAAPos::ValueType > &vCornerCoordsOut, const TElem &elem, const TAAPos &aaPos, bool clearContainer=true)
returns the corner coordinates of a geometric object
Definition: domain_util_impl.h:75
Vertex * GetVertex(Vertex *v, size_t i)
returns the i'th vertex of a vertex
Definition: grid_util_impl.hpp:99
size_t NumVertices(Vertex *elem)
Returns the number of vertices of the given geometric object.
Definition: grid_util_impl.hpp:123
#define UG_THROW(msg)
Definition: error.h:57
double number
Definition: types.h:124
std::pair< counting_iterator< size_t >, counting_iterator< size_t > > vertices(ug::BidirectionalMatrix< T > const &M)
Definition: bidirectional_boost.h:60
const int NUM_VERTICES
Definition: hexahedron_rules.h:45
void FillCornerCoordinates(typename TDomain::position_type vCornerCoordsOut[], const TElem &elem, const TDomain &domain)
returns the corner coordinates of a geometric object
Definition: domain_util_impl.h:114
@ VOLUME
Definition: grid_base_objects.h:63
@ VERTEX
Definition: grid_base_objects.h:60
@ EDGE
Definition: grid_base_objects.h:61
@ FACE
Definition: grid_base_objects.h:62
number ElementSize(const MathVector< TWorldDim > *vCornerCoords)
Volume of an Element in a given Dimension.
traits for reference elements
Definition: reference_element_traits.h:48