template <int dim>
inline
-TriaObjectAccessor<1,dim>::
-TriaObjectAccessor (const Triangulation<dim> *parent,
- const int level,
- const int index,
- const AccessorData *local_data)
+TriaObjectAccessor<1,dim>::TriaObjectAccessor (
+ const Triangulation<dim> *parent,
+ const int level,
+ const int index,
+ const AccessorData *local_data)
:
TriaAccessor<1,dim> (parent, level, index, local_data)
{
template <int dim>
inline
-TriaObjectAccessor<2,dim>::
-TriaObjectAccessor (const Triangulation<dim> *parent,
- const int level,
- const int index,
- const AccessorData *local_data)
+TriaObjectAccessor<2,dim>::TriaObjectAccessor (
+ const Triangulation<dim> *parent,
+ const int level,
+ const int index,
+ const AccessorData *local_data)
:
TriaAccessor<2,dim> (parent, level, index, local_data)
{
bool
TriaObjectAccessor<2,3>::line_orientation (const unsigned int line) const
{
- // we cannot use the objects() function here,
+ // we cannot use the objects() function here,
// since it returns a reference to
// TriaObjects<Quad>, but we need a
// (reference to) TriaObjectsQuad3D
Assert (used(), TriaAccessorExceptions::ExcCellNotUsed());
- Assert (line<GeometryInfo<2>::lines_per_cell,
- ExcIndexRange (line, 0, GeometryInfo<2>::lines_per_cell));
- Assert (this->present_index * GeometryInfo<2>::lines_per_cell + line
- < this->tria->faces->quads.line_orientations.size(),
- ExcInternalError());
- return this->tria->faces->quads.
- line_orientations[this->present_index * GeometryInfo<2>::lines_per_cell + line];
+ return this->tria->faces->quads.face_orientation(this->present_index, line);
}
template <int dim>
inline
-TriaObjectAccessor<3,dim>::
-TriaObjectAccessor (const Triangulation<dim> *parent,
- const int level,
- const int index,
- const AccessorData *local_data)
+TriaObjectAccessor<3,dim>::TriaObjectAccessor (
+ const Triangulation<dim> *parent,
+ const int level,
+ const int index,
+ const AccessorData *local_data)
:
TriaAccessor<3,dim> (parent, level, index, local_data)
{
template <>
inline
bool
-TriaObjectAccessor<3, 3>::
-face_orientation (const unsigned int face) const
+TriaObjectAccessor<3, 3>::face_orientation (const unsigned int face) const
{
- Assert (used(), TriaAccessorExceptions::ExcCellNotUsed());
- Assert (face<GeometryInfo<3>::faces_per_cell,
- ExcIndexRange (face, 0, GeometryInfo<3>::faces_per_cell));
- Assert (this->present_index * GeometryInfo<3>::faces_per_cell + face
- < this->tria->levels[this->present_level]
- ->cells.face_orientations.size(),
- ExcInternalError());
-
+ Assert (used(), TriaAccessorExceptions::ExcCellNotUsed());
return (this->tria->levels[this->present_level]
- ->cells.face_orientations[this->present_index *
- GeometryInfo<3>::faces_per_cell
- + face]);
+ ->cells.face_orientation(this->present_index, face));
}
template <>
inline
bool
-TriaObjectAccessor<3, 3>::
-face_flip (const unsigned int face) const
+TriaObjectAccessor<3, 3>::face_flip (const unsigned int face) const
{
Assert (used(), TriaAccessorExceptions::ExcCellNotUsed());
Assert (face<GeometryInfo<3>::faces_per_cell,
template <>
inline
bool
-TriaObjectAccessor<3, 3>::
-face_rotation (const unsigned int face) const
+TriaObjectAccessor<3, 3>::face_rotation (const unsigned int face) const
{
Assert (used(), TriaAccessorExceptions::ExcCellNotUsed());
Assert (face<GeometryInfo<3>::faces_per_cell,
template <>
inline
bool
-TriaObjectAccessor<3, 3>::
-line_orientation (const unsigned int line) const
+TriaObjectAccessor<3, 3>::line_orientation (const unsigned int line) const
{
const int dim=3;
Assert (used(), TriaAccessorExceptions::ExcCellNotUsed());
template <int dim>
inline
-CellAccessor<dim>::
-CellAccessor (const Triangulation<dim> *parent,
- const int level,
- const int index,
- const AccessorData *local_data)
+CellAccessor<dim>::CellAccessor (
+ const Triangulation<dim> *parent,
+ const int level,
+ const int index,
+ const AccessorData *local_data)
:
TriaObjectAccessor<dim,dim> (parent, level, index, local_data)
{}
* <tt>cell</tt>. The return
* value is <tt>true</tt>, if
* the normal vector points
- * the usual way and
- * <tt>false</tt> else.
+ * the usual way
+ * (GeometryInfo::unit_normal_orientation)
+ * and <tt>false</tt> else.
*
* The result is always
* <tt>true</tt> in this
- * class, but derived vlasses
+ * class, but derived classes
* will reimplement this.
+ *
+ * @warning There is a bug in
+ * the class hierarchy right
+ * now. Avoid ever calling
+ * this function through a
+ * reference, since you might
+ * end up with the base class
+ * function instead of the
+ * derived class. Still, we
+ * do not want to make it
+ * virtual for efficiency
+ * reasons.
*/
bool face_orientation(const unsigned int cell, const unsigned int face) const;
class TriaObjectsHex: public TriaObjects<TriaObject<3> >
{
public:
+ /**
+ * The orientation of the
+ * face number <tt>face</tt>
+ * of the cell with number
+ * <tt>cell</tt>. The return
+ * value is <tt>true</tt>, if
+ * the normal vector points
+ * the usual way
+ * (GeometryInfo::unit_normal_orientation)
+ * and <tt>false</tt> if they
+ * point in opposite
+ * direction.
+ */
+ bool face_orientation(const unsigned int cell, const unsigned int face) const;
+
/**
* For edges, we enforce a
class TriaObjectsQuad3D: public TriaObjects<Quad>
{
public:
+ /**
+ * The orientation of the
+ * face number <tt>face</tt>
+ * of the cell with number
+ * <tt>cell</tt>. The return
+ * value is <tt>true</tt>, if
+ * the normal vector points
+ * the usual way
+ * (GeometryInfo::unit_normal_orientation)
+ * and <tt>false</tt> if they
+ * point in opposite
+ * direction.
+ */
+ bool face_orientation(const unsigned int cell, const unsigned int face) const;
+
/**
* In effect, this field has
unsigned int memory_consumption () const;
};
-
+//----------------------------------------------------------------------//
+
template<typename G>
- bool TriaObjects<G>::face_orientation(const unsigned int, const unsigned int) const
+ inline
+ bool
+ TriaObjects<G>::face_orientation(const unsigned int, const unsigned int) const
{
return true;
}
template<typename G>
- void*& TriaObjects<G>::user_pointer (const unsigned int i)
+ inline
+ void*&
+ TriaObjects<G>::user_pointer (const unsigned int i)
{
#ifdef DEBUG
Assert(user_data_type == data_unknown || user_data_type == data_pointer,
template<typename G>
- const void* TriaObjects<G>::user_pointer (const unsigned int i) const
+ inline
+ const void*
+ TriaObjects<G>::user_pointer (const unsigned int i) const
{
#ifdef DEBUG
Assert(user_data_type == data_unknown || user_data_type == data_pointer,
template<typename G>
- unsigned int& TriaObjects<G>::user_index (const unsigned int i)
+ inline
+ unsigned int&
+ TriaObjects<G>::user_index (const unsigned int i)
{
#ifdef DEBUG
Assert(user_data_type == data_unknown || user_data_type == data_index,
return user_data[i].i;
}
+
template <typename G>
+ inline
TriaObjects<G>::TriaObjects()
:
user_data_type(data_unknown)
{}
-
+
+
template<typename G>
+ inline
unsigned int TriaObjects<G>::user_index (const unsigned int i) const
{
#ifdef DEBUG
template<typename G>
+ inline
void TriaObjects<G>::clear_user_data ()
{
user_data_type = data_unknown;
for (unsigned int i=0;i<user_data.size();++i)
user_data[i].p = 0;
}
-
+
+//----------------------------------------------------------------------//
+
+ inline
+ bool
+ TriaObjectsHex::face_orientation(const unsigned int cell, const unsigned int face) const
+ {
+ Assert (cell < face_orientations.size() / GeometryInfo<3>::faces_per_cell,
+ ExcIndexRange(0, cell, face_orientations.size() / GeometryInfo<3>::faces_per_cell));
+ Assert (face < GeometryInfo<3>::faces_per_cell,
+ ExcIndexRange(0, face, GeometryInfo<3>::faces_per_cell));
+
+ return face_orientations[cell * GeometryInfo<3>::faces_per_cell
+ + face];
+ }
+
+//----------------------------------------------------------------------//
+
+ inline
+ bool
+ TriaObjectsQuad3D::face_orientation(const unsigned int cell, const unsigned int face) const
+ {
+ return line_orientations[cell * GeometryInfo<2>::faces_per_cell
+ + face];
+ }
+
+
}
}