Peano
Loading...
Searching...
No Matches
peano4::datamanagement::FaceHeapDataEnumerator< Face > Class Template Reference

Enumerator over copies of the faces of a cell. More...

#include <FaceHeapDataEnumerator.h>

Collaboration diagram for peano4::datamanagement::FaceHeapDataEnumerator< Face >:

Public Member Functions

 FaceHeapDataEnumerator (const FaceEnumerator< Face > &faces)
 Copy the 2d faces the enumerator points to.
 
Face & operator() (int i)
 Access the copy of face i.
 
const Face & operator() (int i) const
 

Private Attributes

std::vector< Face > _faces
 

Detailed Description

template<class Face>
class peano4::datamanagement::FaceHeapDataEnumerator< Face >

Enumerator over copies of the faces of a cell.

A peano4::datamanagement::FaceEnumerator holds pointers to the faces adjacent to a cell. These faces reside on Peano's stacks, i.e. the pointers are only valid while the traversal handles the cell. Code that runs later, e.g. a task spawned from within touchCellFirstTime(), must not use a FaceEnumerator.

The present enumerator takes a FaceEnumerator and copies the faces it points to. It owns these copies and offers the same access operator as the FaceEnumerator, so code written against a FaceEnumerator can work with this enumerator instead. A task can for example capture

[=, fineGridFacesQ = peano4::datamanagement::FaceHeapDataEnumerator(fineGridFacesQ)]() mutable { ... }
Enumerator over copies of the faces of a cell.

which shadows the FaceEnumerator fineGridFacesQ within the task.

Shallow copies required

The enumerator only refers to the actual face data if copying a face is shallow, i.e. if the face's data resides on the heap and the copies share it. This holds for data managed via smart pointers, e.g. data generated by peano4.api.datamodel.PatchToDoubleArrayWithSmartPointer. In this case, the copies are cheap, and writes through the enumerator alter the faces' data.

If the face holds its data as plain array or deep-copies its heap data (e.g. peano4.api.datamodel.PatchToDoubleArray or peano4.api.datamodel.PatchToDoubleArrayOnHeap), the enumerator works on deep copies of the data. Reads then yield the data at construction time of the enumerator, and writes are lost.

The vertex counterpart is peano4::datamanagement::VertexHeapDataEnumerator.

Definition at line 61 of file FaceHeapDataEnumerator.h.

Constructor & Destructor Documentation

◆ FaceHeapDataEnumerator()

template<class Face >
peano4::datamanagement::FaceHeapDataEnumerator< Face >::FaceHeapDataEnumerator ( const FaceEnumerator< Face > &  faces)

Copy the 2d faces the enumerator points to.

Member Function Documentation

◆ operator()() [1/2]

template<class Face >
Face & peano4::datamanagement::FaceHeapDataEnumerator< Face >::operator() ( int  i)

Access the copy of face i.

Faces are enumerated as in peano4::datamanagement::FaceEnumerator.

◆ operator()() [2/2]

template<class Face >
const Face & peano4::datamanagement::FaceHeapDataEnumerator< Face >::operator() ( int  i) const

Field Documentation

◆ _faces

template<class Face >
std::vector<Face> peano4::datamanagement::FaceHeapDataEnumerator< Face >::_faces
private

Definition at line 63 of file FaceHeapDataEnumerator.h.


The documentation for this class was generated from the following file: