33 #ifndef __H__LIB_GRID__VOLUME_UTIL_IMPL__
34 #define __H__LIB_GRID__VOLUME_UTIL_IMPL__
48 template <
class TAAPos>
69 for(
size_t i = 0; i < vol->
num_faces(); ++i){
74 if(
VecDot(dir, n) < -locSmall)
92 template<
class TVertexPositionAttachmentAccessor>
93 typename TVertexPositionAttachmentAccessor::ValueType
96 typename TVertexPositionAttachmentAccessor::ValueType v;
104 for(
size_t i = 0; i < numVrts; ++i)
106 VecAdd(v, v, aaPosVRT[vrts[i]]);
117 template<
class TAAPosVRT,
class TAAWeightVRT>
119 typename TAAPosVRT::ValueType
122 typename TAAPosVRT::ValueType v;
123 typedef typename TAAWeightVRT::ValueType weight_t;
132 weight_t totalWeight = 0;
133 for(
size_t i = 0; i < numVrts; ++i)
135 weight_t w = aaWeight[vrts[i]];
149 template <
class TElem>
154 return m_e->vertex(i0)->get_hash_value() <
m_e->vertex(i1)->get_hash_value();
161 template <
class TVolIter>
174 for(TVolIter iv = volsBegin; iv != volsEnd; ++iv){
186 for(
size_t i = 0; i + offset < quads.size();){
188 quads[i] = quads[i + offset];
200 quads.resize(quads.size() - offset);
209 for(
int i = 1; i < 4; ++i){
215 int i1 = (smallest + 1) % 4;
216 int i2 = (smallest + 2) % 4;
217 int i3 = (smallest + 3) % 4;
228 HEX_RULES_MAX_NUM_CONVERT_TO_TETS_INDS_OUT__considered_to_be_highest_among_prism_pyra_and_hex);
232 vector<Volume*> volsToErase;
233 for(TVolIter iv = volsBegin; iv != volsEnd; ++iv){
237 size_t numEntries = 0;
249 UG_THROW(
"ConvertToTetrahedra for hexahedra not yet implemented!");
256 volsToErase.push_back(vol);
259 while(i < numEntries){
260 int goid = inds[i++];
262 "Only tetrahedra may result from ConvertToTetrahedra");
Can be used to compare vertices of their grids through their hash-value.
Definition: volume_util_impl.hpp:150
TElem * m_e
Definition: volume_util_impl.hpp:157
CmpVrtsByHash(TElem *e)
Definition: volume_util_impl.hpp:152
bool operator()(int i0, int i1)
Definition: volume_util_impl.hpp:153
Can be used to store information about an edge and to construct an edge.
Definition: grid_base_objects.h:464
Can be queried for the edges and vertices of a face.
Definition: grid_base_objects.h:684
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:701
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:486
virtual size_t num_vertices() const
Definition: grid_base_objects.h:488
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
void end_marking()
ends a marking sequence. Call this method when you're done with marking.
Definition: grid.cpp:1285
bool is_marked(GridObject *obj) const
returns true if the object is marked, false if not.
Definition: grid_impl.hpp:843
void mark(GridObject *obj)
marks the object. Calls are only valid between calls to Grid::begin_marking and Grid::end_marking.
Definition: grid_impl.hpp:773
void erase(GridObject *geomObj)
Definition: grid.cpp:459
void begin_marking()
begin marking.
Definition: grid.cpp:1262
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
geometry_traits< TGeomObj >::iterator create(GridObject *pParent=NULL)
create a custom element.
Definition: grid_impl.hpp:69
Vertex *const * ConstVertexArray
Definition: grid_base_objects.h:319
Container which holds an array of pointers.
Definition: pointer_const_array.h:84
bool empty() const
returns true if the associated array is empty
Definition: pointer_const_array_impl.hpp:113
only used to initialize a tetrahedron. for all other tasks you should use VolumeDescripor.
Definition: grid_objects_3d.h:68
the most simple volume-element.
Definition: grid_objects_3d.h:91
virtual Vertex * vertex(size_t index) const
Definition: grid_objects_3d.h:106
only used to initialize a triangle. for all other tasks you should use FaceDescriptor.
Definition: grid_objects_2d.h:78
the most simple form of a face
Definition: grid_objects_2d.h:174
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
virtual ReferenceObjectID reference_object_id() const
Definition: grid_base_objects.h:927
virtual FaceDescriptor face_desc(int index) const
Definition: grid_base_objects.h:784
virtual EdgeDescriptor edge_desc(int index) const
Definition: grid_base_objects.h:780
virtual uint num_faces() const
Definition: grid_base_objects.h:786
holds the vertices of a Volume or a VolumeDescriptor
Definition: grid_base_objects.h:723
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:728
virtual size_t num_vertices() const
Definition: grid_base_objects.h:729
int CalculateNormalNoNormalize(vector3 &vNormOut, Grid &grid, Edge *e, Grid::VertexAttachmentAccessor< APosition > &aaPos, Grid::FaceAttachmentAccessor< ANormal > *paaNormFACE)
Calculates the normal of the given edge.
Definition: edge_util.cpp:358
UG_API number EdgeLength(const EdgeVertices *e, TAAPosVRT &aaPos)
Calculates the length of the given edge.
Definition: edge_util_impl.hpp:80
UG_API bool ContainsPoint(const EdgeVertices *e, const vector_t &p, TAAPos aaPos)
Returns true if the given point lies on the given edge.
Definition: edge_util_impl.hpp:513
void ConvertToTetrahedra(Grid &grid, TVolIter volsBegin, TVolIter volsEnd)
Converts all volumes in the given range to tetrahedra.
Definition: volume_util_impl.hpp:162
#define UG_THROW(msg)
Definition: error.h:57
#define UG_STATIC_ASSERT(expr, msg)
Checks an expression at compile-time and raises a compile-error if the expression equals 0.
Definition: static_assert.h:63
#define UG_API
Definition: ug_config.h:65
#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
void CalculateCenter(vector_t ¢erOut, const vector_t *pointSet, size_t numPoints)
calculates the center of a point-set
Definition: math_util_impl.hpp:98
bool PointIsInsideTetrahedron(const vector_t &v, const vector_t &v0, const vector_t &v1, const vector_t &v2, const vector_t &v3)
Returns true if the point lies inside or on the boundary of a tetrahedron.
Definition: math_util_impl.hpp:1110
void VecScaleAppend(vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1)
Scales a Vector and adds it to a second vector.
Definition: math_vector_functions_common_impl.hpp:126
void VecSet(vector_t &vInOut, typename vector_t::value_type s)
Set each vector component to scalar (componentwise)
Definition: math_vector_functions_common_impl.hpp:539
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
void VecAdd(vector_t &vOut, const vector_t &v1, const vector_t &v2)
adds two MathVector<N>s and stores the result in a third one
Definition: math_vector_functions_common_impl.hpp:185
void VecScale(vector_t &vOut, const vector_t &v, typename vector_t::value_type s)
scales a MathVector<N>
Definition: math_vector_functions_common_impl.hpp:252
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 int MAX_NUM_CONVERT_TO_TETS_INDS_OUT
Definition: hexahedron_rules.h:51
int ConvertToTetrahedra(int *newIndsOut, TCmp cmp)
fills an array of integers describing tetrahedra that shall replace the prism
Definition: prism_rules_impl.h:43
const int MAX_NUM_CONVERT_TO_TETS_INDS_OUT
Definition: prism_rules.h:51
int ConvertToTetrahedra(int *newIndsOut, TCmp cmp)
fills an array of integers describing tetrahedra that shall replace the pyramid
Definition: pyramid_rules_impl.h:43
const int MAX_NUM_CONVERT_TO_TETS_INDS_OUT
Definition: pyramid_rules.h:52
@ GOID_TETRAHEDRON
Definition: grid_object_ids.h:43
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
@ ROID_PYRAMID
Definition: grid_base_objects.h:83
@ ROID_PRISM
Definition: grid_base_objects.h:82
@ ROID_HEXAHEDRON
Definition: grid_base_objects.h:81
const number SMALL
Definition: math_constants.h:41
#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